@plitzi/sdk-interactions 0.32.0 → 0.32.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.
- package/CHANGELOG.md +24 -0
- package/dist/InteractionsContextProvider.d.ts +1 -1
- package/dist/InteractionsSourcesProvider.d.ts +7 -0
- package/dist/InteractionsSourcesProvider.mjs +27 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.mjs +5 -1
- package/dist/sources/CollectionSource/CollectionInteractions.d.ts +6 -0
- package/dist/sources/CollectionSource/CollectionInteractions.mjs +268 -0
- package/dist/sources/CollectionSource/index.d.ts +3 -0
- package/dist/sources/CollectionSource/index.mjs +2 -0
- package/dist/sources/NavigationSource/NavigationInteractions.d.ts +7 -0
- package/dist/sources/NavigationSource/NavigationInteractions.mjs +65 -0
- package/dist/sources/NavigationSource/index.d.ts +3 -0
- package/dist/sources/NavigationSource/index.mjs +2 -0
- package/dist/sources/StateSource/StateInteractions.d.ts +6 -0
- package/dist/sources/StateSource/StateInteractions.mjs +70 -0
- package/dist/sources/StateSource/index.d.ts +3 -0
- package/dist/sources/StateSource/index.mjs +2 -0
- package/dist/sources/index.d.ts +7 -1
- package/dist/sources/index.mjs +4 -1
- package/package.json +50 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @plitzi/sdk-interactions
|
|
2
2
|
|
|
3
|
+
## 0.32.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- v0.32.2
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @plitzi/sdk-auth@0.32.2
|
|
10
|
+
- @plitzi/sdk-collections@0.32.2
|
|
11
|
+
- @plitzi/sdk-dev-tools@0.32.2
|
|
12
|
+
- @plitzi/sdk-event-bridge@0.32.2
|
|
13
|
+
- @plitzi/sdk-navigation@0.32.2
|
|
14
|
+
- @plitzi/sdk-shared@0.32.2
|
|
15
|
+
|
|
16
|
+
## 0.32.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- v0.32.1
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
- @plitzi/sdk-auth@0.32.1
|
|
23
|
+
- @plitzi/sdk-dev-tools@0.32.1
|
|
24
|
+
- @plitzi/sdk-event-bridge@0.32.1
|
|
25
|
+
- @plitzi/sdk-shared@0.32.1
|
|
26
|
+
|
|
3
27
|
## 0.32.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
|
@@ -6,5 +6,5 @@ export type InteractionsContextProviderProps = {
|
|
|
6
6
|
routeParams: RouteParams;
|
|
7
7
|
queryParams: QueryParams;
|
|
8
8
|
};
|
|
9
|
-
declare const InteractionsContextProvider: ({ children, currentPageId, routeParams, queryParams }: InteractionsContextProviderProps) => import("react
|
|
9
|
+
declare const InteractionsContextProvider: ({ children, currentPageId, routeParams, queryParams }: InteractionsContextProviderProps) => import("react").JSX.Element;
|
|
10
10
|
export default InteractionsContextProvider;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type InteractionsSourcesProviderProps = {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
previewMode?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const InteractionsSourcesProvider: ({ children, previewMode }: InteractionsSourcesProviderProps) => import("react").JSX.Element;
|
|
7
|
+
export default InteractionsSourcesProvider;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import e from "./InteractionsContextProvider.mjs";
|
|
2
|
+
import t from "./sources/AuthSource/AuthInteractions.mjs";
|
|
3
|
+
import n from "./sources/CollectionSource/CollectionInteractions.mjs";
|
|
4
|
+
import r from "./sources/NavigationSource/NavigationInteractions.mjs";
|
|
5
|
+
import i from "./sources/StateSource/StateInteractions.mjs";
|
|
6
|
+
import { use as a } from "react";
|
|
7
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
8
|
+
import s from "@plitzi/sdk-navigation/NavigationContext";
|
|
9
|
+
import { useCommonStore as c } from "@plitzi/sdk-shared/store";
|
|
10
|
+
//#region src/InteractionsSourcesProvider.tsx
|
|
11
|
+
var l = ({ children: l, previewMode: u = !1 }) => {
|
|
12
|
+
let { currentPageId: d, routeParams: f, queryParams: p } = a(s), [m = "basic"] = c("schema.settings.userProvider");
|
|
13
|
+
return /* @__PURE__ */ o(e, {
|
|
14
|
+
currentPageId: d,
|
|
15
|
+
routeParams: f,
|
|
16
|
+
queryParams: p,
|
|
17
|
+
children: /* @__PURE__ */ o(t, {
|
|
18
|
+
authProvider: m,
|
|
19
|
+
children: /* @__PURE__ */ o(n, { children: /* @__PURE__ */ o(i, { children: /* @__PURE__ */ o(r, {
|
|
20
|
+
previewMode: u,
|
|
21
|
+
children: l
|
|
22
|
+
}) }) })
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { l as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,13 +3,15 @@ import { default as InteractionsContext } from './InteractionsContext';
|
|
|
3
3
|
import { default as InteractionsContextProvider } from './InteractionsContextProvider';
|
|
4
4
|
import { default as InteractionsHelper } from './InteractionsHelper';
|
|
5
5
|
import { default as InteractionsManager } from './InteractionsManager';
|
|
6
|
-
import {
|
|
6
|
+
import { default as InteractionsSourcesProvider } from './InteractionsSourcesProvider';
|
|
7
|
+
import { AuthInteractions, CollectionInteractions, NavigationInteractions, StateInteractions } from './sources';
|
|
7
8
|
import { default as utility } from './utility';
|
|
8
9
|
export * from './utility';
|
|
9
10
|
export * from './InteractionsContext';
|
|
10
11
|
export * from './InteractionsContextProvider';
|
|
11
12
|
export * from './InteractionsHelper';
|
|
13
|
+
export * from './InteractionsSourcesProvider';
|
|
12
14
|
export * from './hooks/useInteractions';
|
|
13
15
|
export * from './sources';
|
|
14
16
|
export * from './InteractionsManager';
|
|
15
|
-
export { InteractionsManager, utility, InteractionsContext, InteractionsContextProvider, InteractionsHelper, useInteractions, AuthInteractions };
|
|
17
|
+
export { InteractionsManager, utility, InteractionsContext, InteractionsContextProvider, InteractionsHelper, InteractionsSourcesProvider, useInteractions, AuthInteractions, CollectionInteractions, NavigationInteractions, StateInteractions };
|
package/dist/index.mjs
CHANGED
|
@@ -5,4 +5,8 @@ import r, { flowTrigger as i } from "./InteractionsHelper.mjs";
|
|
|
5
5
|
import a from "./InteractionsManager.mjs";
|
|
6
6
|
import o from "./InteractionsContextProvider.mjs";
|
|
7
7
|
import s from "./sources/AuthSource/AuthInteractions.mjs";
|
|
8
|
-
|
|
8
|
+
import c from "./sources/CollectionSource/CollectionInteractions.mjs";
|
|
9
|
+
import l from "./sources/NavigationSource/NavigationInteractions.mjs";
|
|
10
|
+
import u from "./sources/StateSource/StateInteractions.mjs";
|
|
11
|
+
import d from "./InteractionsSourcesProvider.mjs";
|
|
12
|
+
export { s as AuthInteractions, c as CollectionInteractions, e as InteractionsContext, o as InteractionsContextProvider, r as InteractionsHelper, a as InteractionsManager, d as InteractionsSourcesProvider, l as NavigationInteractions, u as StateInteractions, i as flowTrigger, t as useInteractions, n as utility };
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import e from "../../InteractionsContext.mjs";
|
|
2
|
+
import { use as t, useCallback as n, useMemo as r } from "react";
|
|
3
|
+
import { get as i, pick as a } from "@plitzi/plitzi-ui/helpers";
|
|
4
|
+
import { collectionFieldTypeToInteractions as o } from "@plitzi/sdk-collections/CollectionsHelper";
|
|
5
|
+
import s from "@plitzi/sdk-shared/collections/CollectionContext";
|
|
6
|
+
//#region src/sources/CollectionSource/CollectionInteractions.tsx
|
|
7
|
+
var c = ({ children: c }) => {
|
|
8
|
+
let { useInteractions: l } = t(e), { collections: u, addRecord: d, updateRecord: f, removeRecord: p } = t(s), m = n((e, t) => {
|
|
9
|
+
if (!e) return !1;
|
|
10
|
+
let { fields: n } = e;
|
|
11
|
+
if (typeof n != "object") return !0;
|
|
12
|
+
let r = Object.values(n).filter((e) => e.params.required);
|
|
13
|
+
if (r.length === 0) return !0;
|
|
14
|
+
let i = !0;
|
|
15
|
+
return r.forEach((e) => {
|
|
16
|
+
if (!t[e.machineName] && i) {
|
|
17
|
+
i = !1;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
}), i;
|
|
21
|
+
}, []), h = n(async (e) => {
|
|
22
|
+
let { collectionId: t, recordStatus: n = "draft" } = e, r = i(u, t, void 0);
|
|
23
|
+
if (!r || !m(r, e)) return {
|
|
24
|
+
success: !1,
|
|
25
|
+
record: void 0
|
|
26
|
+
};
|
|
27
|
+
let { fields: o } = r, s = a(e, Object.keys(o));
|
|
28
|
+
return {
|
|
29
|
+
success: !0,
|
|
30
|
+
collectionId: t,
|
|
31
|
+
record: await d(t, n, s)
|
|
32
|
+
};
|
|
33
|
+
}, [
|
|
34
|
+
d,
|
|
35
|
+
u,
|
|
36
|
+
m
|
|
37
|
+
]), g = n(async (e) => {
|
|
38
|
+
let { collectionId: t, recordStatus: n = "draft", recordId: r } = e, o = i(u, t, void 0);
|
|
39
|
+
if (!o || !r || !m(o, e)) return {
|
|
40
|
+
success: !1,
|
|
41
|
+
record: void 0
|
|
42
|
+
};
|
|
43
|
+
let { fields: s } = o, c = a(e, Object.keys(s));
|
|
44
|
+
return {
|
|
45
|
+
success: !0,
|
|
46
|
+
collectionId: t,
|
|
47
|
+
record: await f(t, r, n, c)
|
|
48
|
+
};
|
|
49
|
+
}, [
|
|
50
|
+
u,
|
|
51
|
+
f,
|
|
52
|
+
m
|
|
53
|
+
]), _ = n(async (e) => {
|
|
54
|
+
let { collectionId: t, recordId: n } = e;
|
|
55
|
+
return !i(u, t, void 0) || !n ? {
|
|
56
|
+
success: !1,
|
|
57
|
+
record: void 0
|
|
58
|
+
} : (await p(t, n), {
|
|
59
|
+
success: !0,
|
|
60
|
+
collectionId: t,
|
|
61
|
+
recordId: n
|
|
62
|
+
});
|
|
63
|
+
}, [u, p]), v = r(() => !u || typeof u != "object" ? [] : Object.keys(u).reduce((e, t) => {
|
|
64
|
+
let n = u[t], r = i(n, "name", t);
|
|
65
|
+
return [...e, {
|
|
66
|
+
value: t,
|
|
67
|
+
label: r
|
|
68
|
+
}];
|
|
69
|
+
}, []), [u]);
|
|
70
|
+
return l({
|
|
71
|
+
id: "collection",
|
|
72
|
+
callbacks: r(() => ({
|
|
73
|
+
addCollectionRecord: {
|
|
74
|
+
action: "addCollectionRecord",
|
|
75
|
+
title: "Add Collection Record",
|
|
76
|
+
type: "globalCallback",
|
|
77
|
+
callback: h,
|
|
78
|
+
preview: {
|
|
79
|
+
success: "",
|
|
80
|
+
collectionId: "",
|
|
81
|
+
record: {
|
|
82
|
+
id: "",
|
|
83
|
+
status: "",
|
|
84
|
+
values: {}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
params: (e) => {
|
|
88
|
+
let t = i(u, `${e.collectionId}.fields`, {});
|
|
89
|
+
return {
|
|
90
|
+
collectionId: {
|
|
91
|
+
label: "Collection",
|
|
92
|
+
defaultValue: void 0,
|
|
93
|
+
type: "select",
|
|
94
|
+
options: v
|
|
95
|
+
},
|
|
96
|
+
recordStatus: {
|
|
97
|
+
label: "Record Status",
|
|
98
|
+
defaultValue: "draft",
|
|
99
|
+
type: "select",
|
|
100
|
+
options: [
|
|
101
|
+
{
|
|
102
|
+
value: "published",
|
|
103
|
+
label: "Published"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
value: "draft",
|
|
107
|
+
label: "Draft"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
value: "archived",
|
|
111
|
+
label: "Archived"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
value: "deleted",
|
|
115
|
+
label: "Deleted"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
value: "created",
|
|
119
|
+
label: "Created"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
...Object.values(t).reduce((e, t) => {
|
|
124
|
+
let { machineName: n, name: r, type: i } = t;
|
|
125
|
+
return {
|
|
126
|
+
...e,
|
|
127
|
+
[n]: {
|
|
128
|
+
label: r,
|
|
129
|
+
defaultValue: void 0,
|
|
130
|
+
when: (e) => !!e.collectionId,
|
|
131
|
+
type: o(i)
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}, {})
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
updateCollectionRecord: {
|
|
139
|
+
action: "updateCollectionRecord",
|
|
140
|
+
title: "Update Collection Record",
|
|
141
|
+
type: "globalCallback",
|
|
142
|
+
callback: g,
|
|
143
|
+
preview: {
|
|
144
|
+
success: "",
|
|
145
|
+
collectionId: "",
|
|
146
|
+
record: {
|
|
147
|
+
id: "",
|
|
148
|
+
status: "",
|
|
149
|
+
values: {}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
params: (e) => {
|
|
153
|
+
let t = i(u, `${e.collectionId}.fields`, {});
|
|
154
|
+
return {
|
|
155
|
+
collectionId: {
|
|
156
|
+
label: "Collection",
|
|
157
|
+
defaultValue: void 0,
|
|
158
|
+
type: "select",
|
|
159
|
+
options: v
|
|
160
|
+
},
|
|
161
|
+
recordStatus: {
|
|
162
|
+
label: "Record Status",
|
|
163
|
+
defaultValue: "draft",
|
|
164
|
+
type: "select",
|
|
165
|
+
options: [
|
|
166
|
+
{
|
|
167
|
+
value: "published",
|
|
168
|
+
label: "Published"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
value: "draft",
|
|
172
|
+
label: "Draft"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
value: "archived",
|
|
176
|
+
label: "Archived"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
value: "deleted",
|
|
180
|
+
label: "Deleted"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
value: "created",
|
|
184
|
+
label: "Created"
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
recordId: {
|
|
189
|
+
label: "Record",
|
|
190
|
+
defaultValue: void 0,
|
|
191
|
+
type: "select",
|
|
192
|
+
when: (e) => !!e.collectionId,
|
|
193
|
+
options: (e) => {
|
|
194
|
+
let { collectionId: t } = e, n = u[t];
|
|
195
|
+
if (!t || !n) return [];
|
|
196
|
+
let r = Object.values(n.fields).find((e) => e.params.primary);
|
|
197
|
+
return n.records.map((e) => {
|
|
198
|
+
let t = "";
|
|
199
|
+
return t = r ? e.values[r.machineName] : JSON.stringify(e.values), {
|
|
200
|
+
value: e.id,
|
|
201
|
+
label: t
|
|
202
|
+
};
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
...Object.values(t).reduce((e, t) => {
|
|
207
|
+
let { machineName: n, name: r, type: i } = t;
|
|
208
|
+
return {
|
|
209
|
+
...e,
|
|
210
|
+
[n]: {
|
|
211
|
+
label: r,
|
|
212
|
+
defaultValue: void 0,
|
|
213
|
+
when: (e) => !!e.collectionId,
|
|
214
|
+
type: o(i)
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}, {})
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
removeCollectionRecord: {
|
|
222
|
+
action: "removeCollectionRecord",
|
|
223
|
+
title: "Remove Collection Record",
|
|
224
|
+
type: "globalCallback",
|
|
225
|
+
callback: _,
|
|
226
|
+
preview: {
|
|
227
|
+
success: "",
|
|
228
|
+
collectionId: "",
|
|
229
|
+
recordId: ""
|
|
230
|
+
},
|
|
231
|
+
params: {
|
|
232
|
+
collectionId: {
|
|
233
|
+
label: "Collection",
|
|
234
|
+
defaultValue: void 0,
|
|
235
|
+
type: "select",
|
|
236
|
+
options: v
|
|
237
|
+
},
|
|
238
|
+
recordId: {
|
|
239
|
+
label: "Record",
|
|
240
|
+
defaultValue: void 0,
|
|
241
|
+
type: "select",
|
|
242
|
+
when: (e) => !!e.collectionId,
|
|
243
|
+
options: (e) => {
|
|
244
|
+
let { collectionId: t } = e, n = u[t];
|
|
245
|
+
if (!t || !n) return [];
|
|
246
|
+
let r = Object.values(n.fields).find((e) => e.params.primary);
|
|
247
|
+
return n.records.map((e) => {
|
|
248
|
+
let t = "";
|
|
249
|
+
return t = r ? e.values[r.machineName] : JSON.stringify(e.values), {
|
|
250
|
+
value: e.id,
|
|
251
|
+
label: t
|
|
252
|
+
};
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}), [
|
|
259
|
+
u,
|
|
260
|
+
v,
|
|
261
|
+
h,
|
|
262
|
+
_,
|
|
263
|
+
g
|
|
264
|
+
])
|
|
265
|
+
}), c;
|
|
266
|
+
};
|
|
267
|
+
//#endregion
|
|
268
|
+
export { c as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type NavigationInteractionsProps = {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
previewMode?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const NavigationInteractions: ({ children, previewMode }: NavigationInteractionsProps) => ReactNode;
|
|
7
|
+
export default NavigationInteractions;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import e from "../../InteractionsContext.mjs";
|
|
2
|
+
import { use as t, useCallback as n, useMemo as r } from "react";
|
|
3
|
+
import { get as i, pick as a } from "@plitzi/plitzi-ui/helpers";
|
|
4
|
+
import o from "@plitzi/sdk-navigation/NavigationContext";
|
|
5
|
+
import { useCommonStore as s } from "@plitzi/sdk-shared/store";
|
|
6
|
+
//#region src/sources/NavigationSource/NavigationInteractions.tsx
|
|
7
|
+
var c = ({ children: c, previewMode: l = !1 }) => {
|
|
8
|
+
let { useInteractions: u } = t(e), { navigate: d } = t(o), [[f, p]] = s(["schema.pages", "pageDefinitions"]), m = r(() => {
|
|
9
|
+
let e = a(p, f);
|
|
10
|
+
return Object.keys(e).reduce((t, n) => {
|
|
11
|
+
let r = e[n], a = i(r, "attributes.name", n), o = i(r, "attributes.default", !1);
|
|
12
|
+
return [...t, {
|
|
13
|
+
key: n,
|
|
14
|
+
label: a,
|
|
15
|
+
defaultPage: o
|
|
16
|
+
}];
|
|
17
|
+
}, []);
|
|
18
|
+
}, [p, f]), h = n((e) => {
|
|
19
|
+
if (!l) return;
|
|
20
|
+
let { url: t, urlType: n } = e;
|
|
21
|
+
n === "page" || n === "internal" ? d(t) : d(t, !0);
|
|
22
|
+
}, [d, l]);
|
|
23
|
+
return u({
|
|
24
|
+
id: "navigation",
|
|
25
|
+
callbacks: r(() => ({ navigate: {
|
|
26
|
+
action: "navigate",
|
|
27
|
+
title: "Navigate",
|
|
28
|
+
type: "globalCallback",
|
|
29
|
+
callback: h,
|
|
30
|
+
preview: {},
|
|
31
|
+
params: {
|
|
32
|
+
urlType: {
|
|
33
|
+
label: "Url Type",
|
|
34
|
+
defaultValue: void 0,
|
|
35
|
+
type: "select",
|
|
36
|
+
options: [
|
|
37
|
+
{
|
|
38
|
+
value: "page",
|
|
39
|
+
label: "Space Page"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
value: "internal",
|
|
43
|
+
label: "Inside Space"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
value: "external",
|
|
47
|
+
label: "Outside Space"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
url: {
|
|
52
|
+
defaultValue: m.find((e) => e.defaultPage)?.key ?? "",
|
|
53
|
+
type: (e) => e.urlType === "page" ? "select" : "text",
|
|
54
|
+
when: (e) => !!e.urlType,
|
|
55
|
+
options: m.map((e) => ({
|
|
56
|
+
value: e.key,
|
|
57
|
+
label: e.label
|
|
58
|
+
}))
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
} }), [h, m])
|
|
62
|
+
}), c;
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { c as default };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import e from "../../InteractionsContext.mjs";
|
|
2
|
+
import { use as t, useCallback as n, useMemo as r } from "react";
|
|
3
|
+
import { useCommonStoreSetter as i } from "@plitzi/sdk-shared/store";
|
|
4
|
+
//#region src/sources/StateSource/StateInteractions.tsx
|
|
5
|
+
var a = ({ children: a }) => {
|
|
6
|
+
let { useInteractions: o } = t(e), s = i(), c = n((e) => {
|
|
7
|
+
let { key: t, type: n } = e, { value: r } = e;
|
|
8
|
+
n === "boolean" ? r = r === "true" : n === "number" && (r = parseInt(r, 10)), s(`runtime.state.${t}`, r);
|
|
9
|
+
}, [s]), l = n(() => {
|
|
10
|
+
s("runtime.state", {});
|
|
11
|
+
}, [s]);
|
|
12
|
+
return o({
|
|
13
|
+
id: "state",
|
|
14
|
+
callbacks: r(() => ({
|
|
15
|
+
setState: {
|
|
16
|
+
action: "setState",
|
|
17
|
+
title: "Set State",
|
|
18
|
+
type: "globalCallback",
|
|
19
|
+
callback: c,
|
|
20
|
+
preview: {},
|
|
21
|
+
params: {
|
|
22
|
+
key: {
|
|
23
|
+
defaultValue: "",
|
|
24
|
+
type: "text"
|
|
25
|
+
},
|
|
26
|
+
type: {
|
|
27
|
+
defaultValue: void 0,
|
|
28
|
+
type: "select",
|
|
29
|
+
options: [
|
|
30
|
+
{
|
|
31
|
+
value: "boolean",
|
|
32
|
+
label: "True / False"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: "number",
|
|
36
|
+
label: "Numeric"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: "text",
|
|
40
|
+
label: "Text"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
value: {
|
|
45
|
+
defaultValue: void 0,
|
|
46
|
+
type: (e) => e.type === "boolean" ? "select" : "text",
|
|
47
|
+
when: (e) => !!e.type,
|
|
48
|
+
options: [{
|
|
49
|
+
value: "true",
|
|
50
|
+
label: "True"
|
|
51
|
+
}, {
|
|
52
|
+
value: "false",
|
|
53
|
+
label: "False"
|
|
54
|
+
}]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
clearState: {
|
|
59
|
+
action: "clearState",
|
|
60
|
+
title: "Clear State",
|
|
61
|
+
type: "globalCallback",
|
|
62
|
+
callback: l,
|
|
63
|
+
preview: {},
|
|
64
|
+
params: {}
|
|
65
|
+
}
|
|
66
|
+
}), [c, l])
|
|
67
|
+
}), a;
|
|
68
|
+
};
|
|
69
|
+
//#endregion
|
|
70
|
+
export { a as default };
|
package/dist/sources/index.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { AuthInteractions } from './AuthSource';
|
|
2
|
+
import { CollectionInteractions } from './CollectionSource';
|
|
3
|
+
import { NavigationInteractions } from './NavigationSource';
|
|
4
|
+
import { StateInteractions } from './StateSource';
|
|
2
5
|
export * from './AuthSource';
|
|
3
|
-
export
|
|
6
|
+
export * from './CollectionSource';
|
|
7
|
+
export * from './NavigationSource';
|
|
8
|
+
export * from './StateSource';
|
|
9
|
+
export { AuthInteractions, CollectionInteractions, NavigationInteractions, StateInteractions };
|
package/dist/sources/index.mjs
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import e from "./AuthSource/AuthInteractions.mjs";
|
|
2
|
-
|
|
2
|
+
import t from "./CollectionSource/CollectionInteractions.mjs";
|
|
3
|
+
import n from "./NavigationSource/NavigationInteractions.mjs";
|
|
4
|
+
import r from "./StateSource/StateInteractions.mjs";
|
|
5
|
+
export { e as AuthInteractions, t as CollectionInteractions, n as NavigationInteractions, r as StateInteractions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-interactions",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.2",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -26,6 +26,10 @@
|
|
|
26
26
|
"types": "./dist/InteractionsManager.d.ts",
|
|
27
27
|
"import": "./dist/InteractionsManager.mjs"
|
|
28
28
|
},
|
|
29
|
+
"./InteractionsSourcesProvider": {
|
|
30
|
+
"types": "./dist/InteractionsSourcesProvider.d.ts",
|
|
31
|
+
"import": "./dist/InteractionsSourcesProvider.mjs"
|
|
32
|
+
},
|
|
29
33
|
"./hooks/useInteractions": {
|
|
30
34
|
"types": "./dist/hooks/useInteractions.d.ts",
|
|
31
35
|
"import": "./dist/hooks/useInteractions.mjs"
|
|
@@ -50,6 +54,42 @@
|
|
|
50
54
|
"types": "./dist/sources/AuthSource/index.d.ts",
|
|
51
55
|
"import": "./dist/sources/AuthSource/index.mjs"
|
|
52
56
|
},
|
|
57
|
+
"./sources/CollectionSource": {
|
|
58
|
+
"types": "./dist/sources/CollectionSource/index.d.ts",
|
|
59
|
+
"import": "./dist/sources/CollectionSource/index.mjs"
|
|
60
|
+
},
|
|
61
|
+
"./sources/CollectionSource/CollectionInteractions": {
|
|
62
|
+
"types": "./dist/sources/CollectionSource/CollectionInteractions.d.ts",
|
|
63
|
+
"import": "./dist/sources/CollectionSource/CollectionInteractions.mjs"
|
|
64
|
+
},
|
|
65
|
+
"./sources/CollectionSource/index": {
|
|
66
|
+
"types": "./dist/sources/CollectionSource/index.d.ts",
|
|
67
|
+
"import": "./dist/sources/CollectionSource/index.mjs"
|
|
68
|
+
},
|
|
69
|
+
"./sources/NavigationSource": {
|
|
70
|
+
"types": "./dist/sources/NavigationSource/index.d.ts",
|
|
71
|
+
"import": "./dist/sources/NavigationSource/index.mjs"
|
|
72
|
+
},
|
|
73
|
+
"./sources/NavigationSource/NavigationInteractions": {
|
|
74
|
+
"types": "./dist/sources/NavigationSource/NavigationInteractions.d.ts",
|
|
75
|
+
"import": "./dist/sources/NavigationSource/NavigationInteractions.mjs"
|
|
76
|
+
},
|
|
77
|
+
"./sources/NavigationSource/index": {
|
|
78
|
+
"types": "./dist/sources/NavigationSource/index.d.ts",
|
|
79
|
+
"import": "./dist/sources/NavigationSource/index.mjs"
|
|
80
|
+
},
|
|
81
|
+
"./sources/StateSource": {
|
|
82
|
+
"types": "./dist/sources/StateSource/index.d.ts",
|
|
83
|
+
"import": "./dist/sources/StateSource/index.mjs"
|
|
84
|
+
},
|
|
85
|
+
"./sources/StateSource/StateInteractions": {
|
|
86
|
+
"types": "./dist/sources/StateSource/StateInteractions.d.ts",
|
|
87
|
+
"import": "./dist/sources/StateSource/StateInteractions.mjs"
|
|
88
|
+
},
|
|
89
|
+
"./sources/StateSource/index": {
|
|
90
|
+
"types": "./dist/sources/StateSource/index.d.ts",
|
|
91
|
+
"import": "./dist/sources/StateSource/index.mjs"
|
|
92
|
+
},
|
|
53
93
|
"./sources/index": {
|
|
54
94
|
"types": "./dist/sources/index.d.ts",
|
|
55
95
|
"import": "./dist/sources/index.mjs"
|
|
@@ -89,14 +129,16 @@
|
|
|
89
129
|
"devDependencies": {
|
|
90
130
|
"eslint": "^9.39.4",
|
|
91
131
|
"typescript": "^6.0.3",
|
|
92
|
-
"vite": "^8.0.
|
|
93
|
-
"vitest": "^4.1.
|
|
132
|
+
"vite": "^8.0.16",
|
|
133
|
+
"vitest": "^4.1.9"
|
|
94
134
|
},
|
|
95
135
|
"dependencies": {
|
|
96
|
-
"@plitzi/plitzi-ui": "^1.6.
|
|
97
|
-
"@plitzi/sdk-auth": "0.32.
|
|
98
|
-
"@plitzi/sdk-
|
|
99
|
-
"@plitzi/sdk-
|
|
100
|
-
"@plitzi/sdk-
|
|
136
|
+
"@plitzi/plitzi-ui": "^1.6.13",
|
|
137
|
+
"@plitzi/sdk-auth": "0.32.2",
|
|
138
|
+
"@plitzi/sdk-collections": "0.32.2",
|
|
139
|
+
"@plitzi/sdk-dev-tools": "0.32.2",
|
|
140
|
+
"@plitzi/sdk-event-bridge": "0.32.2",
|
|
141
|
+
"@plitzi/sdk-navigation": "0.32.2",
|
|
142
|
+
"@plitzi/sdk-shared": "0.32.2"
|
|
101
143
|
}
|
|
102
144
|
}
|