@xyo-network/react-embed 7.4.2 → 7.5.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/dist/browser/components/stories/XyoEmbedPlugin.examples.stories.d.ts +2 -2
- package/dist/browser/components/stories/XyoEmbedPlugin.examples.stories.d.ts.map +1 -1
- package/dist/browser/components/stories/XyoEmbedPlugin.states.stories.d.ts +7 -7
- package/dist/browser/components/stories/XyoEmbedPlugin.states.stories.d.ts.map +1 -1
- package/dist/browser/components/stories/storyPayload.d.ts +3 -1
- package/dist/browser/components/stories/storyPayload.d.ts.map +1 -1
- package/dist/browser/contexts/ValidatePayloadContext/Provider.d.ts.map +1 -1
- package/dist/browser/contexts/ValidatePayloadContext/Provider.stories.d.ts +3 -3
- package/dist/browser/contexts/ValidatePayloadContext/Provider.stories.d.ts.map +1 -1
- package/dist/browser/index.mjs +388 -457
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +30 -30
- package/src/components/embed-card/card/EmbedCardHeader.tsx +1 -1
- package/src/components/embed-card/card/EmbedPluginCard.tsx +1 -1
- package/src/components/embed-card/error-handling/EmbedErrorCard.tsx +1 -1
- package/src/components/embed-card/menu/JsonMenuItem.tsx +1 -1
- package/src/components/stories/storyPayload.ts +3 -1
- package/src/contexts/ResolvePayloadContext/Provider.tsx +1 -1
- package/src/contexts/ValidatePayloadContext/Provider.stories.tsx +3 -2
- package/src/contexts/ValidatePayloadContext/Provider.tsx +2 -1
package/dist/browser/index.mjs
CHANGED
|
@@ -1,36 +1,22 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
1
4
|
// src/components/embed-card/card/BusyCard.tsx
|
|
2
5
|
import { Card } from "@mui/material";
|
|
3
6
|
import { useBusyTiming } from "@xylabs/react-flexbox";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "@xylabs/react-shared";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
var BusyCard = ({
|
|
10
|
-
busy,
|
|
11
|
-
busyMinimum = 500,
|
|
12
|
-
busyVariant = "circular",
|
|
13
|
-
busyVariantProps,
|
|
14
|
-
children,
|
|
15
|
-
...props
|
|
16
|
-
}) => {
|
|
7
|
+
import { BusyCircularProgress, BusyLinearProgress } from "@xylabs/react-shared";
|
|
8
|
+
import React from "react";
|
|
9
|
+
var BusyCard = /* @__PURE__ */ __name(({ busy, busyMinimum = 500, busyVariant = "circular", busyVariantProps, children, ...props }) => {
|
|
17
10
|
const internalBusy = useBusyTiming(busy, busyMinimum);
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
20
|
-
busyVariant === "circular" && internalBusy ? /* @__PURE__ */ jsx(BusyCircularProgress, { ...busyVariantProps }) : null,
|
|
21
|
-
busyVariant === "linear" && internalBusy ? /* @__PURE__ */ jsx(BusyLinearProgress, { ...busyVariantProps }) : null
|
|
22
|
-
] });
|
|
23
|
-
};
|
|
11
|
+
return /* @__PURE__ */ React.createElement(Card, props, children, busyVariant === "circular" && internalBusy ? /* @__PURE__ */ React.createElement(BusyCircularProgress, busyVariantProps) : null, busyVariant === "linear" && internalBusy ? /* @__PURE__ */ React.createElement(BusyLinearProgress, busyVariantProps) : null);
|
|
12
|
+
}, "BusyCard");
|
|
24
13
|
|
|
25
14
|
// src/components/embed-card/card/EmbedCardHeader.tsx
|
|
26
15
|
import { Refresh as RefreshIcon } from "@mui/icons-material";
|
|
27
|
-
import {
|
|
28
|
-
Avatar,
|
|
29
|
-
CardHeader,
|
|
30
|
-
Chip as Chip2
|
|
31
|
-
} from "@mui/material";
|
|
16
|
+
import { Avatar, CardHeader, Chip as Chip2 } from "@mui/material";
|
|
32
17
|
import { FlexRow } from "@xylabs/react-flexbox";
|
|
33
|
-
import { isDefined as isDefined3 } from "@xylabs/
|
|
18
|
+
import { isDefined as isDefined3 } from "@xylabs/sdk-js";
|
|
19
|
+
import React9 from "react";
|
|
34
20
|
|
|
35
21
|
// src/contexts/EmbedPluginContext/Context.ts
|
|
36
22
|
import { createContextEx } from "@xylabs/react-shared";
|
|
@@ -38,96 +24,77 @@ var EmbedPluginContext = createContextEx();
|
|
|
38
24
|
|
|
39
25
|
// src/contexts/EmbedPluginContext/Provider.tsx
|
|
40
26
|
import { useResetState } from "@xylabs/react-hooks";
|
|
41
|
-
import
|
|
42
|
-
var EmbedPluginProvider = ({
|
|
43
|
-
children,
|
|
44
|
-
refreshTitle,
|
|
45
|
-
timestampLabel,
|
|
46
|
-
hideElementsConfig,
|
|
47
|
-
plugins,
|
|
48
|
-
embedPluginConfig
|
|
49
|
-
}) => {
|
|
27
|
+
import React2 from "react";
|
|
28
|
+
var EmbedPluginProvider = /* @__PURE__ */ __name(({ children, refreshTitle, timestampLabel, hideElementsConfig, plugins, embedPluginConfig }) => {
|
|
50
29
|
const [activePlugin, setActivePlugin] = useResetState(plugins ? plugins[0] : void 0);
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
setActivePlugin,
|
|
61
|
-
timestampLabel
|
|
62
|
-
},
|
|
63
|
-
children
|
|
30
|
+
return /* @__PURE__ */ React2.createElement(EmbedPluginContext, {
|
|
31
|
+
value: {
|
|
32
|
+
activePlugin,
|
|
33
|
+
embedPluginConfig,
|
|
34
|
+
hideElementsConfig,
|
|
35
|
+
provided: true,
|
|
36
|
+
refreshTitle,
|
|
37
|
+
setActivePlugin,
|
|
38
|
+
timestampLabel
|
|
64
39
|
}
|
|
65
|
-
);
|
|
66
|
-
};
|
|
40
|
+
}, children);
|
|
41
|
+
}, "EmbedPluginProvider");
|
|
67
42
|
|
|
68
43
|
// src/contexts/EmbedPluginContext/use.ts
|
|
69
44
|
import { useContextEx } from "@xylabs/react-shared";
|
|
70
|
-
var useEmbedPluginState = () => useContextEx(EmbedPluginContext, "EmbedPlugin", true);
|
|
45
|
+
var useEmbedPluginState = /* @__PURE__ */ __name(() => useContextEx(EmbedPluginContext, "EmbedPlugin", true), "useEmbedPluginState");
|
|
71
46
|
|
|
72
47
|
// src/contexts/PluginPropsContext/context.ts
|
|
73
48
|
import { createContextEx as createContextEx2 } from "@xylabs/react-shared";
|
|
74
49
|
var PluginPropsContext = createContextEx2();
|
|
75
50
|
|
|
76
51
|
// src/contexts/PluginPropsContext/Provider.tsx
|
|
77
|
-
import {
|
|
78
|
-
|
|
79
|
-
useMemo,
|
|
80
|
-
useState
|
|
81
|
-
} from "react";
|
|
82
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
83
|
-
var PluginPropsProvider = ({ children, pluginProps: pluginPropsProp }) => {
|
|
52
|
+
import React3, { useEffect, useMemo, useState } from "react";
|
|
53
|
+
var PluginPropsProvider = /* @__PURE__ */ __name(({ children, pluginProps: pluginPropsProp }) => {
|
|
84
54
|
const [pluginProps, setPluginProps] = useState(pluginPropsProp);
|
|
85
55
|
useEffect(() => {
|
|
86
56
|
setPluginProps(pluginPropsProp);
|
|
87
|
-
}, [
|
|
57
|
+
}, [
|
|
58
|
+
pluginPropsProp
|
|
59
|
+
]);
|
|
88
60
|
const value = useMemo(() => ({
|
|
89
61
|
pluginProps,
|
|
90
62
|
provided: true
|
|
91
|
-
}), [
|
|
92
|
-
|
|
93
|
-
|
|
63
|
+
}), [
|
|
64
|
+
pluginProps
|
|
65
|
+
]);
|
|
66
|
+
return /* @__PURE__ */ React3.createElement(PluginPropsContext, {
|
|
67
|
+
value
|
|
68
|
+
}, children);
|
|
69
|
+
}, "PluginPropsProvider");
|
|
94
70
|
|
|
95
71
|
// src/contexts/PluginPropsContext/use.ts
|
|
96
72
|
import { useContextEx as useContextEx2 } from "@xylabs/react-shared";
|
|
97
|
-
var usePluginProps = (required = false) => useContextEx2(PluginPropsContext, "PluginProps", required);
|
|
73
|
+
var usePluginProps = /* @__PURE__ */ __name((required = false) => useContextEx2(PluginPropsContext, "PluginProps", required), "usePluginProps");
|
|
98
74
|
|
|
99
75
|
// src/contexts/RefreshPayloadContext/Provider.tsx
|
|
100
|
-
import { useState as useState2 } from "react";
|
|
76
|
+
import React4, { useState as useState2 } from "react";
|
|
101
77
|
|
|
102
78
|
// src/contexts/RefreshPayloadContext/Context.ts
|
|
103
79
|
import { createContextEx as createContextEx3 } from "@xylabs/react-shared";
|
|
104
80
|
var RefreshPayloadContext = createContextEx3();
|
|
105
81
|
|
|
106
82
|
// src/contexts/RefreshPayloadContext/Provider.tsx
|
|
107
|
-
|
|
108
|
-
var RefreshPayloadProvider = ({
|
|
109
|
-
children,
|
|
110
|
-
onRefresh,
|
|
111
|
-
refreshPayload
|
|
112
|
-
}) => {
|
|
83
|
+
var RefreshPayloadProvider = /* @__PURE__ */ __name(({ children, onRefresh, refreshPayload }) => {
|
|
113
84
|
const [localRefreshPayload, setLocalRefreshPayload] = useState2(refreshPayload);
|
|
114
|
-
return /* @__PURE__ */
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
refreshPayload: localRefreshPayload,
|
|
121
|
-
setRefreshPayload: setLocalRefreshPayload
|
|
122
|
-
},
|
|
123
|
-
children
|
|
85
|
+
return /* @__PURE__ */ React4.createElement(RefreshPayloadContext, {
|
|
86
|
+
value: {
|
|
87
|
+
onRefresh,
|
|
88
|
+
provided: true,
|
|
89
|
+
refreshPayload: localRefreshPayload,
|
|
90
|
+
setRefreshPayload: setLocalRefreshPayload
|
|
124
91
|
}
|
|
125
|
-
);
|
|
126
|
-
};
|
|
92
|
+
}, children);
|
|
93
|
+
}, "RefreshPayloadProvider");
|
|
127
94
|
|
|
128
95
|
// src/contexts/RefreshPayloadContext/use.ts
|
|
129
96
|
import { useContextEx as useContextEx3 } from "@xylabs/react-shared";
|
|
130
|
-
var useRefreshPayload = () => useContextEx3(RefreshPayloadContext, "RefreshPayload", true);
|
|
97
|
+
var useRefreshPayload = /* @__PURE__ */ __name(() => useContextEx3(RefreshPayloadContext, "RefreshPayload", true), "useRefreshPayload");
|
|
131
98
|
|
|
132
99
|
// src/contexts/ResolvePayloadContext/Context.ts
|
|
133
100
|
import { createContextEx as createContextEx4 } from "@xylabs/react-shared";
|
|
@@ -136,513 +103,477 @@ var ResolvePayloadContext = createContextEx4();
|
|
|
136
103
|
// src/contexts/ResolvePayloadContext/Provider.tsx
|
|
137
104
|
import { delay } from "@xylabs/delay";
|
|
138
105
|
import { useAsyncEffect } from "@xylabs/react-async-effect";
|
|
139
|
-
import { isDefined } from "@xylabs/
|
|
106
|
+
import { isDefined } from "@xylabs/sdk-js";
|
|
140
107
|
import { Huri } from "@xyo-network/huri";
|
|
141
108
|
import { ModuleErrorSchema } from "@xyo-network/payload-model";
|
|
142
|
-
import { useEffect as useEffect2, useState as useState3 } from "react";
|
|
143
|
-
|
|
144
|
-
var ResolvePayloadProvider = ({ children, huriPayload }) => {
|
|
109
|
+
import React5, { useEffect as useEffect2, useState as useState3 } from "react";
|
|
110
|
+
var ResolvePayloadProvider = /* @__PURE__ */ __name(({ children, huriPayload }) => {
|
|
145
111
|
const [payload, setPayload] = useState3();
|
|
146
112
|
const [huri, setHuri] = useState3();
|
|
147
|
-
const {
|
|
148
|
-
refreshPayload,
|
|
149
|
-
setRefreshPayload,
|
|
150
|
-
onRefresh
|
|
151
|
-
} = useRefreshPayload();
|
|
113
|
+
const { refreshPayload, setRefreshPayload, onRefresh } = useRefreshPayload();
|
|
152
114
|
useEffect2(() => {
|
|
153
115
|
typeof huriPayload === "string" ? setHuri(huriPayload) : void 0;
|
|
154
116
|
if (typeof huriPayload === "object") {
|
|
155
117
|
setPayload(huriPayload);
|
|
156
118
|
setRefreshPayload?.(true);
|
|
157
119
|
}
|
|
158
|
-
}, [
|
|
120
|
+
}, [
|
|
121
|
+
huriPayload,
|
|
122
|
+
setRefreshPayload
|
|
123
|
+
]);
|
|
159
124
|
const [notFound, setNotFound] = useState3();
|
|
160
125
|
const [huriError, setHuriError] = useState3();
|
|
161
|
-
useAsyncEffect(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
setRefreshPayload?.(true);
|
|
172
|
-
}
|
|
173
|
-
} catch (e) {
|
|
174
|
-
const error = e;
|
|
175
|
-
setHuriError({
|
|
176
|
-
message: error.message,
|
|
177
|
-
schema: ModuleErrorSchema,
|
|
178
|
-
$sources: []
|
|
179
|
-
});
|
|
126
|
+
useAsyncEffect(async (mounted) => {
|
|
127
|
+
if (isDefined(huri) && !refreshPayload) {
|
|
128
|
+
try {
|
|
129
|
+
const huriInstance = new Huri(huri);
|
|
130
|
+
const result = await huriInstance.fetch();
|
|
131
|
+
await delay(500);
|
|
132
|
+
if (mounted()) {
|
|
133
|
+
setNotFound(result === null);
|
|
134
|
+
setPayload(result);
|
|
135
|
+
setRefreshPayload?.(true);
|
|
180
136
|
}
|
|
137
|
+
} catch (e) {
|
|
138
|
+
const error = e;
|
|
139
|
+
setHuriError({
|
|
140
|
+
message: error.message,
|
|
141
|
+
schema: ModuleErrorSchema,
|
|
142
|
+
$sources: []
|
|
143
|
+
});
|
|
181
144
|
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
145
|
+
}
|
|
146
|
+
}, [
|
|
147
|
+
huri,
|
|
148
|
+
payload,
|
|
149
|
+
refreshPayload,
|
|
150
|
+
setRefreshPayload
|
|
151
|
+
]);
|
|
152
|
+
const refreshHuri = /* @__PURE__ */ __name(() => {
|
|
186
153
|
onRefresh?.();
|
|
187
154
|
if (isDefined(huri)) {
|
|
188
155
|
setRefreshPayload?.(false);
|
|
189
156
|
}
|
|
190
|
-
};
|
|
191
|
-
return /* @__PURE__ */
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
refreshHuri,
|
|
201
|
-
setPayload
|
|
202
|
-
},
|
|
203
|
-
children
|
|
157
|
+
}, "refreshHuri");
|
|
158
|
+
return /* @__PURE__ */ React5.createElement(ResolvePayloadContext, {
|
|
159
|
+
value: {
|
|
160
|
+
huri,
|
|
161
|
+
huriError,
|
|
162
|
+
notFound,
|
|
163
|
+
payload,
|
|
164
|
+
provided: true,
|
|
165
|
+
refreshHuri,
|
|
166
|
+
setPayload
|
|
204
167
|
}
|
|
205
|
-
);
|
|
206
|
-
};
|
|
168
|
+
}, children);
|
|
169
|
+
}, "ResolvePayloadProvider");
|
|
207
170
|
|
|
208
171
|
// src/contexts/ResolvePayloadContext/use.ts
|
|
209
172
|
import { useContextEx as useContextEx4 } from "@xylabs/react-shared";
|
|
210
|
-
var useResolvePayload = () => useContextEx4(ResolvePayloadContext, "ResolvePayload", true);
|
|
173
|
+
var useResolvePayload = /* @__PURE__ */ __name(() => useContextEx4(ResolvePayloadContext, "ResolvePayload", true), "useResolvePayload");
|
|
211
174
|
|
|
212
175
|
// src/contexts/ValidatePayloadContext/Provider.tsx
|
|
213
176
|
import { Chip } from "@mui/material";
|
|
214
177
|
import { useAsyncEffect as useAsyncEffect2 } from "@xylabs/react-async-effect";
|
|
215
178
|
import { SchemaCache } from "@xyo-network/schema-cache";
|
|
216
|
-
import { useState as useState4 } from "react";
|
|
179
|
+
import React6, { useState as useState4 } from "react";
|
|
217
180
|
|
|
218
181
|
// src/contexts/ValidatePayloadContext/Context.ts
|
|
219
182
|
import { createContextEx as createContextEx5 } from "@xylabs/react-shared";
|
|
220
183
|
var ValidatePayloadContext = createContextEx5();
|
|
221
184
|
|
|
222
185
|
// src/contexts/ValidatePayloadContext/Provider.tsx
|
|
223
|
-
|
|
224
|
-
var ValidatePayloadProvider = ({ children, enabled = false }) => {
|
|
186
|
+
var ValidatePayloadProvider = /* @__PURE__ */ __name(({ children, enabled = false }) => {
|
|
225
187
|
const { payload } = useResolvePayload();
|
|
226
188
|
const [initialized, setInitialized] = useState4(false);
|
|
227
189
|
const [valid, setValid] = useState4();
|
|
228
|
-
useAsyncEffect2(
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const validator = SchemaCache.instance.validators[possibleKnownSchema];
|
|
235
|
-
setValid(validator?.(payload));
|
|
236
|
-
}
|
|
237
|
-
setInitialized(true);
|
|
190
|
+
useAsyncEffect2(async () => {
|
|
191
|
+
if (payload && enabled) {
|
|
192
|
+
await SchemaCache.instance.get(payload.schema);
|
|
193
|
+
const possibleKnownSchema = payload.schema;
|
|
194
|
+
if (SchemaCache.instance.validators[possibleKnownSchema]) {
|
|
195
|
+
const validator = SchemaCache.instance.validators[possibleKnownSchema];
|
|
238
196
|
}
|
|
239
|
-
|
|
240
|
-
[payload, enabled]
|
|
241
|
-
);
|
|
242
|
-
return /* @__PURE__ */ jsx6(
|
|
243
|
-
ValidatePayloadContext,
|
|
244
|
-
{
|
|
245
|
-
value: {
|
|
246
|
-
enabled,
|
|
247
|
-
provided: true,
|
|
248
|
-
schema: payload?.schema,
|
|
249
|
-
validPayload: valid
|
|
250
|
-
},
|
|
251
|
-
children: enabled ? /* @__PURE__ */ jsx6(Fragment, { children: initialized ? children : /* @__PURE__ */ jsx6(Chip, { label: "Validating Payload..." }) }) : children
|
|
197
|
+
setInitialized(true);
|
|
252
198
|
}
|
|
253
|
-
|
|
254
|
-
|
|
199
|
+
}, [
|
|
200
|
+
payload,
|
|
201
|
+
enabled
|
|
202
|
+
]);
|
|
203
|
+
return /* @__PURE__ */ React6.createElement(ValidatePayloadContext, {
|
|
204
|
+
value: {
|
|
205
|
+
enabled,
|
|
206
|
+
provided: true,
|
|
207
|
+
schema: payload?.schema,
|
|
208
|
+
validPayload: valid
|
|
209
|
+
}
|
|
210
|
+
}, enabled ? /* @__PURE__ */ React6.createElement(React6.Fragment, null, initialized ? children : /* @__PURE__ */ React6.createElement(Chip, {
|
|
211
|
+
label: "Validating Payload..."
|
|
212
|
+
})) : children);
|
|
213
|
+
}, "ValidatePayloadProvider");
|
|
255
214
|
|
|
256
215
|
// src/contexts/ValidatePayloadContext/use.ts
|
|
257
216
|
import { useContextEx as useContextEx5 } from "@xylabs/react-shared";
|
|
258
|
-
var useValidatePayload = () => useContextEx5(ValidatePayloadContext, "ValidateSchema", true);
|
|
217
|
+
var useValidatePayload = /* @__PURE__ */ __name(() => useContextEx5(ValidatePayloadContext, "ValidateSchema", true), "useValidatePayload");
|
|
259
218
|
|
|
260
219
|
// src/components/embed-card/menu/EmbedMenu.tsx
|
|
261
220
|
import { MoreVert as MoreVertIcon } from "@mui/icons-material";
|
|
262
221
|
import { IconButton, Menu } from "@mui/material";
|
|
263
|
-
import { useState as useState5 } from "react";
|
|
222
|
+
import React8, { useState as useState5 } from "react";
|
|
264
223
|
|
|
265
224
|
// src/components/embed-card/menu/JsonMenuItem.tsx
|
|
266
225
|
import { OpenInNew as OpenInNewIcon } from "@mui/icons-material";
|
|
267
|
-
import {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
} from "@mui/material";
|
|
272
|
-
import { isDefined as isDefined2 } from "@xylabs/typeof";
|
|
273
|
-
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
274
|
-
var JsonMenuItem = (props) => {
|
|
226
|
+
import { ListItemIcon, ListItemText, MenuItem } from "@mui/material";
|
|
227
|
+
import { isDefined as isDefined2 } from "@xylabs/sdk-js";
|
|
228
|
+
import React7 from "react";
|
|
229
|
+
var JsonMenuItem = /* @__PURE__ */ __name((props) => {
|
|
275
230
|
const { huri } = useResolvePayload();
|
|
276
|
-
return /* @__PURE__ */
|
|
277
|
-
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
|
|
280
|
-
}
|
|
231
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, isDefined2(huri) ? /* @__PURE__ */ React7.createElement(MenuItem, {
|
|
232
|
+
title: "Source Payload JSON",
|
|
233
|
+
onClick: /* @__PURE__ */ __name(() => window.open(huri, "_blank"), "onClick"),
|
|
234
|
+
...props
|
|
235
|
+
}, /* @__PURE__ */ React7.createElement(ListItemText, {
|
|
236
|
+
sx: {
|
|
237
|
+
mr: 1
|
|
238
|
+
}
|
|
239
|
+
}, "JSON"), /* @__PURE__ */ React7.createElement(ListItemIcon, {
|
|
240
|
+
sx: {
|
|
241
|
+
justifyContent: "end"
|
|
242
|
+
}
|
|
243
|
+
}, /* @__PURE__ */ React7.createElement(OpenInNewIcon, {
|
|
244
|
+
fontSize: "small"
|
|
245
|
+
}))) : null);
|
|
246
|
+
}, "JsonMenuItem");
|
|
281
247
|
|
|
282
248
|
// src/components/embed-card/menu/EmbedMenu.tsx
|
|
283
|
-
|
|
284
|
-
var EmbedMenu = (props) => {
|
|
249
|
+
var EmbedMenu = /* @__PURE__ */ __name((props) => {
|
|
285
250
|
const [anchorEl, setAnchorEl] = useState5(null);
|
|
286
251
|
const open = Boolean(anchorEl);
|
|
287
|
-
const handleClick = (event) => {
|
|
252
|
+
const handleClick = /* @__PURE__ */ __name((event) => {
|
|
288
253
|
setAnchorEl(event.currentTarget);
|
|
289
|
-
};
|
|
290
|
-
const handleClose = () => {
|
|
254
|
+
}, "handleClick");
|
|
255
|
+
const handleClose = /* @__PURE__ */ __name(() => {
|
|
291
256
|
setAnchorEl(null);
|
|
292
|
-
};
|
|
293
|
-
return /* @__PURE__ */
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
257
|
+
}, "handleClose");
|
|
258
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(IconButton, {
|
|
259
|
+
onClick: handleClick,
|
|
260
|
+
...props
|
|
261
|
+
}, /* @__PURE__ */ React8.createElement(MoreVertIcon, null)), /* @__PURE__ */ React8.createElement(Menu, {
|
|
262
|
+
anchorEl,
|
|
263
|
+
open,
|
|
264
|
+
onClose: handleClose,
|
|
265
|
+
slotProps: {
|
|
266
|
+
paper: {
|
|
267
|
+
variant: "elevation"
|
|
268
|
+
},
|
|
269
|
+
list: {
|
|
270
|
+
dense: true
|
|
306
271
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
};
|
|
272
|
+
}
|
|
273
|
+
}, /* @__PURE__ */ React8.createElement(JsonMenuItem, null)));
|
|
274
|
+
}, "EmbedMenu");
|
|
310
275
|
|
|
311
276
|
// src/components/embed-card/card/EmbedCardHeader.tsx
|
|
312
|
-
|
|
313
|
-
var EmbedCardHeader = () => {
|
|
277
|
+
var EmbedCardHeader = /* @__PURE__ */ __name(() => {
|
|
314
278
|
const { refreshHuri, huri } = useResolvePayload();
|
|
315
|
-
const {
|
|
316
|
-
|
|
317
|
-
timestampLabel,
|
|
318
|
-
hideElementsConfig
|
|
319
|
-
} = useEmbedPluginState();
|
|
320
|
-
const {
|
|
321
|
-
hideAvatar,
|
|
322
|
-
hideTitle,
|
|
323
|
-
hideRefreshButton,
|
|
324
|
-
hideTimestamp,
|
|
325
|
-
hideCardActions
|
|
326
|
-
} = hideElementsConfig ?? {};
|
|
279
|
+
const { activePlugin, timestampLabel, hideElementsConfig } = useEmbedPluginState();
|
|
280
|
+
const { hideAvatar, hideTitle, hideRefreshButton, hideTimestamp, hideCardActions } = hideElementsConfig ?? {};
|
|
327
281
|
const timestamp = Date.now();
|
|
328
|
-
return /* @__PURE__ */
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
282
|
+
return /* @__PURE__ */ React9.createElement(CardHeader, {
|
|
283
|
+
sx: {
|
|
284
|
+
flexWrap: "wrap",
|
|
285
|
+
rowGap: 1
|
|
286
|
+
},
|
|
287
|
+
avatar: hideAvatar ? /* @__PURE__ */ React9.createElement(React9.Fragment, null) : /* @__PURE__ */ React9.createElement(Avatar, {
|
|
288
|
+
sx: {
|
|
289
|
+
bgcolor: /* @__PURE__ */ __name((theme) => theme.vars.palette.primary.main, "bgcolor")
|
|
290
|
+
},
|
|
291
|
+
"aria-label": activePlugin?.name
|
|
292
|
+
}, activePlugin?.name?.charAt(0)),
|
|
293
|
+
action: /* @__PURE__ */ React9.createElement(FlexRow, {
|
|
294
|
+
flexWrap: "wrap",
|
|
295
|
+
columnGap: 0.5
|
|
296
|
+
}, isDefined3(timestamp) && !Number.isNaN(timestamp) ? hideTimestamp && hideRefreshButton ? "" : /* @__PURE__ */ React9.createElement(Chip2, {
|
|
297
|
+
avatar: hideRefreshButton ? /* @__PURE__ */ React9.createElement(React9.Fragment, null) : /* @__PURE__ */ React9.createElement(RefreshIcon, null),
|
|
298
|
+
clickable: hideRefreshButton ? false : true,
|
|
299
|
+
onClick: refreshHuri,
|
|
300
|
+
label: hideTimestamp ? "" : `${timestampLabel} ${new Date(timestamp).toLocaleString()}`
|
|
301
|
+
}) : null, hideCardActions || huri === void 0 ? null : /* @__PURE__ */ React9.createElement(EmbedMenu, null)),
|
|
302
|
+
title: hideTitle ? "" : activePlugin?.name
|
|
303
|
+
});
|
|
304
|
+
}, "EmbedCardHeader");
|
|
349
305
|
|
|
350
306
|
// src/components/embed-card/card/EmbedPluginCard.tsx
|
|
351
307
|
import { CardContent } from "@mui/material";
|
|
352
308
|
import { FlexGrowRow } from "@xylabs/react-flexbox";
|
|
353
|
-
import { isTruthy } from "@xylabs/
|
|
309
|
+
import { isTruthy } from "@xylabs/sdk-js";
|
|
354
310
|
import { useListMode as useListMode2 } from "@xyo-network/react-shared";
|
|
311
|
+
import React13 from "react";
|
|
355
312
|
|
|
356
313
|
// src/components/controls/EmbedFormControl.tsx
|
|
357
314
|
import { FormControl, InputLabel } from "@mui/material";
|
|
358
|
-
import
|
|
359
|
-
var EmbedFormControl = ({
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
children
|
|
363
|
-
|
|
364
|
-
}) => {
|
|
365
|
-
return /* @__PURE__ */ jsxs5(FormControl, { ...props, children: [
|
|
366
|
-
/* @__PURE__ */ jsx10(InputLabel, { id: formId, children: formLabel }),
|
|
367
|
-
children
|
|
368
|
-
] });
|
|
369
|
-
};
|
|
315
|
+
import React10 from "react";
|
|
316
|
+
var EmbedFormControl = /* @__PURE__ */ __name(({ formId, formLabel, children, ...props }) => {
|
|
317
|
+
return /* @__PURE__ */ React10.createElement(FormControl, props, /* @__PURE__ */ React10.createElement(InputLabel, {
|
|
318
|
+
id: formId
|
|
319
|
+
}, formLabel), children);
|
|
320
|
+
}, "EmbedFormControl");
|
|
370
321
|
|
|
371
322
|
// src/components/controls/ListModeSelect.tsx
|
|
372
323
|
import { MenuItem as MenuItem2 } from "@mui/material";
|
|
373
324
|
import { SelectEx } from "@xylabs/react-select";
|
|
374
325
|
import { useListMode } from "@xyo-network/react-shared";
|
|
375
|
-
import
|
|
326
|
+
import React11 from "react";
|
|
376
327
|
var listModeSelectId = "listmode-select-id";
|
|
377
328
|
var listModeSelectLabel = "List Mode";
|
|
378
|
-
var ListModeSelect = (props) => {
|
|
329
|
+
var ListModeSelect = /* @__PURE__ */ __name((props) => {
|
|
379
330
|
const { listMode, setListMode } = useListMode();
|
|
380
|
-
return /* @__PURE__ */
|
|
381
|
-
|
|
382
|
-
{
|
|
383
|
-
value
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
331
|
+
return /* @__PURE__ */ React11.createElement(SelectEx, {
|
|
332
|
+
value: listMode ?? "default",
|
|
333
|
+
onChange: /* @__PURE__ */ __name((event) => {
|
|
334
|
+
setListMode?.(event.target.value);
|
|
335
|
+
}, "onChange"),
|
|
336
|
+
...props
|
|
337
|
+
}, /* @__PURE__ */ React11.createElement(MenuItem2, {
|
|
338
|
+
key: "default",
|
|
339
|
+
value: "default"
|
|
340
|
+
}, "Default"), /* @__PURE__ */ React11.createElement(MenuItem2, {
|
|
341
|
+
key: "table",
|
|
342
|
+
value: "table"
|
|
343
|
+
}, "Table"), /* @__PURE__ */ React11.createElement(MenuItem2, {
|
|
344
|
+
key: "grid",
|
|
345
|
+
value: "grid"
|
|
346
|
+
}, "Grid"));
|
|
347
|
+
}, "ListModeSelect");
|
|
348
|
+
var ListModeSelectFormControl = /* @__PURE__ */ __name((props) => {
|
|
349
|
+
return /* @__PURE__ */ React11.createElement(EmbedFormControl, {
|
|
350
|
+
formId: listModeSelectId,
|
|
351
|
+
formLabel: listModeSelectLabel
|
|
352
|
+
}, /* @__PURE__ */ React11.createElement(ListModeSelect, {
|
|
353
|
+
size: "small",
|
|
354
|
+
label: listModeSelectLabel,
|
|
355
|
+
labelId: listModeSelectId,
|
|
356
|
+
...props
|
|
357
|
+
}));
|
|
358
|
+
}, "ListModeSelectFormControl");
|
|
399
359
|
|
|
400
360
|
// src/components/controls/RenderSelect.tsx
|
|
401
361
|
import { MenuItem as MenuItem3 } from "@mui/material";
|
|
402
362
|
import { SelectEx as SelectEx2 } from "@xylabs/react-select";
|
|
403
|
-
import
|
|
363
|
+
import React12 from "react";
|
|
404
364
|
var renderSelectId = "render-select-id";
|
|
405
365
|
var renderSelectLabel = "Renderer";
|
|
406
|
-
var EmbedRenderSelect = (props) => {
|
|
407
|
-
const {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
366
|
+
var EmbedRenderSelect = /* @__PURE__ */ __name((props) => {
|
|
367
|
+
const { activePlugin, setActivePlugin, plugins } = useEmbedPluginState();
|
|
368
|
+
return /* @__PURE__ */ React12.createElement(EmbedFormControl, {
|
|
369
|
+
formId: renderSelectId,
|
|
370
|
+
formLabel: renderSelectLabel
|
|
371
|
+
}, /* @__PURE__ */ React12.createElement(SelectEx2, {
|
|
372
|
+
size: "small",
|
|
373
|
+
value: activePlugin?.name,
|
|
374
|
+
...props
|
|
375
|
+
}, plugins?.map((plugin) => /* @__PURE__ */ React12.createElement(MenuItem3, {
|
|
376
|
+
value: plugin.name,
|
|
377
|
+
key: plugin.name,
|
|
378
|
+
onClick: /* @__PURE__ */ __name(() => setActivePlugin?.(plugin), "onClick")
|
|
379
|
+
}, plugin.name))));
|
|
380
|
+
}, "EmbedRenderSelect");
|
|
414
381
|
|
|
415
382
|
// src/components/embed-card/card/EmbedPluginCard.tsx
|
|
416
|
-
|
|
417
|
-
var EmbedPluginCard = ({ ...props }) => {
|
|
383
|
+
var EmbedPluginCard = /* @__PURE__ */ __name(({ ...props }) => {
|
|
418
384
|
const { payload } = useResolvePayload();
|
|
419
|
-
const {
|
|
420
|
-
activePlugin: ActivePlugin,
|
|
421
|
-
plugins,
|
|
422
|
-
hideElementsConfig
|
|
423
|
-
} = useEmbedPluginState();
|
|
385
|
+
const { activePlugin: ActivePlugin, plugins, hideElementsConfig } = useEmbedPluginState();
|
|
424
386
|
const { listMode } = useListMode2();
|
|
425
387
|
const { pluginProps } = usePluginProps();
|
|
426
388
|
const supportsListMode = isTruthy(ActivePlugin?.components?.box?.listModes?.length) ? true : false;
|
|
427
|
-
return /* @__PURE__ */
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}
|
|
389
|
+
return /* @__PURE__ */ React13.createElement(BusyCard, props, hideElementsConfig?.hideCardHeader ? null : /* @__PURE__ */ React13.createElement(EmbedCardHeader, null), plugins && plugins.length > 0 || supportsListMode ? /* @__PURE__ */ React13.createElement(FlexGrowRow, {
|
|
390
|
+
columnGap: 2,
|
|
391
|
+
rowGap: 2,
|
|
392
|
+
flexWrap: "wrap",
|
|
393
|
+
pb: 1
|
|
394
|
+
}, plugins && plugins.length > 1 ? /* @__PURE__ */ React13.createElement(EmbedRenderSelect, null) : null, supportsListMode ? /* @__PURE__ */ React13.createElement(ListModeSelectFormControl, null) : null) : null, /* @__PURE__ */ React13.createElement(CardContent, {
|
|
395
|
+
sx: {
|
|
396
|
+
height: "100%"
|
|
397
|
+
}
|
|
398
|
+
}, ActivePlugin ? /* @__PURE__ */ React13.createElement(ActivePlugin.components.box.detailsBox, {
|
|
399
|
+
payload,
|
|
400
|
+
...pluginProps,
|
|
401
|
+
...supportsListMode && {
|
|
402
|
+
listMode
|
|
403
|
+
}
|
|
404
|
+
}) : null));
|
|
405
|
+
}, "EmbedPluginCard");
|
|
436
406
|
|
|
437
407
|
// src/components/embed-card/EmbedPluginCard.tsx
|
|
438
408
|
import { useTheme } from "@mui/material";
|
|
409
|
+
import React20 from "react";
|
|
439
410
|
|
|
440
411
|
// src/components/EmbedPlugin.tsx
|
|
441
412
|
import { ErrorBoundary } from "@xylabs/react-error";
|
|
442
413
|
import { ListModeProvider } from "@xyo-network/react-shared";
|
|
414
|
+
import React17 from "react";
|
|
443
415
|
|
|
444
416
|
// src/components/EmbedResolver.tsx
|
|
445
417
|
import { LoadResult } from "@xyo-network/react-shared";
|
|
446
|
-
import
|
|
447
|
-
var EmbedResolver = ({ children }) => {
|
|
448
|
-
const {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
};
|
|
418
|
+
import React14 from "react";
|
|
419
|
+
var EmbedResolver = /* @__PURE__ */ __name(({ children }) => {
|
|
420
|
+
const { payload, notFound, huriError } = useResolvePayload();
|
|
421
|
+
return /* @__PURE__ */ React14.createElement(LoadResult, {
|
|
422
|
+
searchResult: payload,
|
|
423
|
+
notFound: !!notFound,
|
|
424
|
+
error: !!huriError
|
|
425
|
+
}, children);
|
|
426
|
+
}, "EmbedResolver");
|
|
455
427
|
|
|
456
428
|
// src/components/validation-alerts/ValidatePayload.tsx
|
|
457
429
|
import { Alert } from "@mui/material";
|
|
458
|
-
import
|
|
459
|
-
var ValidatePayloadAlert = ({ children, ...props }) => {
|
|
460
|
-
const {
|
|
461
|
-
validPayload,
|
|
462
|
-
enabled,
|
|
463
|
-
schema
|
|
464
|
-
} = useValidatePayload();
|
|
430
|
+
import React15 from "react";
|
|
431
|
+
var ValidatePayloadAlert = /* @__PURE__ */ __name(({ children, ...props }) => {
|
|
432
|
+
const { validPayload, enabled, schema } = useValidatePayload();
|
|
465
433
|
if (enabled && validPayload === false) {
|
|
466
|
-
return /* @__PURE__ */
|
|
467
|
-
|
|
468
|
-
" ",
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
"but failed to validate."
|
|
472
|
-
] });
|
|
434
|
+
return /* @__PURE__ */ React15.createElement(Alert, {
|
|
435
|
+
severity: "error",
|
|
436
|
+
title: "Invalid Payload!",
|
|
437
|
+
...props
|
|
438
|
+
}, "Payload schema claimed to be", " ", schema, " ", "but failed to validate.");
|
|
473
439
|
}
|
|
474
|
-
return /* @__PURE__ */
|
|
475
|
-
};
|
|
440
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, children);
|
|
441
|
+
}, "ValidatePayloadAlert");
|
|
476
442
|
|
|
477
443
|
// src/components/validation-alerts/ValidatePlugins.tsx
|
|
478
444
|
import { Alert as Alert2, AlertTitle } from "@mui/material";
|
|
479
|
-
import
|
|
480
|
-
var ValidatePluginsAlert = ({ children, ...props }) => {
|
|
445
|
+
import React16 from "react";
|
|
446
|
+
var ValidatePluginsAlert = /* @__PURE__ */ __name(({ children, ...props }) => {
|
|
481
447
|
const { payload } = useResolvePayload();
|
|
482
448
|
const { plugins } = useEmbedPluginState();
|
|
483
449
|
if (payload && plugins?.length === 0) {
|
|
484
|
-
return /* @__PURE__ */
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
450
|
+
return /* @__PURE__ */ React16.createElement(Alert2, {
|
|
451
|
+
severity: "warning",
|
|
452
|
+
...props
|
|
453
|
+
}, /* @__PURE__ */ React16.createElement(AlertTitle, null, "Missing plugins!"), "Payload found but no plugins were present.");
|
|
488
454
|
}
|
|
489
|
-
return /* @__PURE__ */
|
|
490
|
-
};
|
|
455
|
+
return /* @__PURE__ */ React16.createElement(React16.Fragment, null, children);
|
|
456
|
+
}, "ValidatePluginsAlert");
|
|
491
457
|
|
|
492
458
|
// src/components/EmbedPlugin.tsx
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}) => {
|
|
522
|
-
return /* @__PURE__ */ jsx17(RefreshPayloadProvider, { onRefresh, children: /* @__PURE__ */ jsx17(ResolvePayloadProvider, { huriPayload, children: /* @__PURE__ */ jsx17(EmbedResolver, { children }) }) });
|
|
523
|
-
};
|
|
524
|
-
var WithValidators = ({ children, validateSchema }) => {
|
|
525
|
-
return /* @__PURE__ */ jsx17(ValidatePayloadProvider, { enabled: validateSchema, children: /* @__PURE__ */ jsx17(ValidatePluginsAlert, { children: /* @__PURE__ */ jsx17(ValidatePayloadAlert, { children }) }) });
|
|
526
|
-
};
|
|
459
|
+
var EmbedPluginInner = /* @__PURE__ */ __name(({ validateSchema, plugins, huriPayload, refreshTitle = "", timestampLabel = "Data From", hideElementsConfig, embedPluginConfig, onRefresh, children }) => {
|
|
460
|
+
return /* @__PURE__ */ React17.createElement(ErrorBoundary, null, /* @__PURE__ */ React17.createElement(EmbedPluginProvider, {
|
|
461
|
+
refreshTitle,
|
|
462
|
+
timestampLabel,
|
|
463
|
+
hideElementsConfig,
|
|
464
|
+
plugins,
|
|
465
|
+
embedPluginConfig
|
|
466
|
+
}, /* @__PURE__ */ React17.createElement(WithResolvers, {
|
|
467
|
+
onRefresh,
|
|
468
|
+
huriPayload
|
|
469
|
+
}, /* @__PURE__ */ React17.createElement(WithValidators, {
|
|
470
|
+
validateSchema
|
|
471
|
+
}, /* @__PURE__ */ React17.createElement(ListModeProvider, {
|
|
472
|
+
defaultListMode: embedPluginConfig?.listMode
|
|
473
|
+
}, children)))));
|
|
474
|
+
}, "EmbedPluginInner");
|
|
475
|
+
var WithResolvers = /* @__PURE__ */ __name(({ children, onRefresh, huriPayload }) => {
|
|
476
|
+
return /* @__PURE__ */ React17.createElement(RefreshPayloadProvider, {
|
|
477
|
+
onRefresh
|
|
478
|
+
}, /* @__PURE__ */ React17.createElement(ResolvePayloadProvider, {
|
|
479
|
+
huriPayload
|
|
480
|
+
}, /* @__PURE__ */ React17.createElement(EmbedResolver, null, children)));
|
|
481
|
+
}, "WithResolvers");
|
|
482
|
+
var WithValidators = /* @__PURE__ */ __name(({ children, validateSchema }) => {
|
|
483
|
+
return /* @__PURE__ */ React17.createElement(ValidatePayloadProvider, {
|
|
484
|
+
enabled: validateSchema
|
|
485
|
+
}, /* @__PURE__ */ React17.createElement(ValidatePluginsAlert, null, /* @__PURE__ */ React17.createElement(ValidatePayloadAlert, null, children)));
|
|
486
|
+
}, "WithValidators");
|
|
527
487
|
|
|
528
488
|
// src/components/embed-card/error-handling/EmbedCardApiErrorRenderer.tsx
|
|
529
489
|
import { ErrorAlert, ErrorRender } from "@xylabs/react-error";
|
|
490
|
+
import React19 from "react";
|
|
530
491
|
|
|
531
492
|
// src/components/embed-card/error-handling/EmbedErrorCard.tsx
|
|
532
|
-
import {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
Typography
|
|
538
|
-
} from "@mui/material";
|
|
539
|
-
import { isDefined as isDefined4 } from "@xylabs/typeof";
|
|
540
|
-
import { Fragment as Fragment7, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
541
|
-
var EmbedErrorCard = (props) => {
|
|
542
|
-
const {
|
|
543
|
-
alertProps,
|
|
544
|
-
error,
|
|
545
|
-
scope,
|
|
546
|
-
hideErrorDetails = true,
|
|
547
|
-
children,
|
|
548
|
-
...cardProps
|
|
549
|
-
} = props;
|
|
493
|
+
import { Alert as Alert3, AlertTitle as AlertTitle2, Card as Card2, CardContent as CardContent2, Typography } from "@mui/material";
|
|
494
|
+
import { isDefined as isDefined4 } from "@xylabs/sdk-js";
|
|
495
|
+
import React18 from "react";
|
|
496
|
+
var EmbedErrorCard = /* @__PURE__ */ __name((props) => {
|
|
497
|
+
const { alertProps, error, scope, hideErrorDetails = true, children, ...cardProps } = props;
|
|
550
498
|
const errorProps = {
|
|
551
499
|
alertProps,
|
|
552
500
|
error,
|
|
553
501
|
hideErrorDetails,
|
|
554
502
|
scope
|
|
555
503
|
};
|
|
556
|
-
return /* @__PURE__ */
|
|
557
|
-
};
|
|
558
|
-
var DefaultErrorAlert = ({
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
] }) : /* @__PURE__ */ jsx18(Typography, { variant: "caption", fontSize: "small", children: "Error Loading Plugin" })
|
|
574
|
-
] });
|
|
575
|
-
};
|
|
504
|
+
return /* @__PURE__ */ React18.createElement(Card2, cardProps, /* @__PURE__ */ React18.createElement(CardContent2, null, children ?? /* @__PURE__ */ React18.createElement(DefaultErrorAlert, errorProps)));
|
|
505
|
+
}, "EmbedErrorCard");
|
|
506
|
+
var DefaultErrorAlert = /* @__PURE__ */ __name(({ alertProps, scope, hideErrorDetails, error }) => {
|
|
507
|
+
return /* @__PURE__ */ React18.createElement(Alert3, {
|
|
508
|
+
severity: "error",
|
|
509
|
+
...alertProps
|
|
510
|
+
}, /* @__PURE__ */ React18.createElement(AlertTitle2, null, "Whoops! Something went wrong"), isDefined4(scope) ? /* @__PURE__ */ React18.createElement(Typography, {
|
|
511
|
+
variant: "caption"
|
|
512
|
+
}, "Scope:", scope) : null, !hideErrorDetails && error ? /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(Typography, {
|
|
513
|
+
variant: "caption"
|
|
514
|
+
}, "Error: "), /* @__PURE__ */ React18.createElement(Typography, {
|
|
515
|
+
variant: "caption"
|
|
516
|
+
}, error?.message)) : /* @__PURE__ */ React18.createElement(Typography, {
|
|
517
|
+
variant: "caption",
|
|
518
|
+
fontSize: "small"
|
|
519
|
+
}, "Error Loading Plugin"));
|
|
520
|
+
}, "DefaultErrorAlert");
|
|
576
521
|
|
|
577
522
|
// src/components/embed-card/error-handling/EmbedCardApiErrorRenderer.tsx
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
};
|
|
523
|
+
var EmbedCardApiErrorRenderer = /* @__PURE__ */ __name(({ xyoError, children, ...props }) => {
|
|
524
|
+
return /* @__PURE__ */ React19.createElement(ErrorRender, {
|
|
525
|
+
error: xyoError,
|
|
526
|
+
noReAuth: true,
|
|
527
|
+
noErrorDisplay: true,
|
|
528
|
+
customError: /* @__PURE__ */ React19.createElement(CustomApiErrorCard, {
|
|
529
|
+
xyoError,
|
|
530
|
+
...props
|
|
531
|
+
})
|
|
532
|
+
}, children);
|
|
533
|
+
}, "EmbedCardApiErrorRenderer");
|
|
534
|
+
var CustomApiErrorCard = /* @__PURE__ */ __name(({ xyoError, ...props }) => {
|
|
535
|
+
return /* @__PURE__ */ React19.createElement(EmbedErrorCard, props, /* @__PURE__ */ React19.createElement(ErrorAlert, {
|
|
536
|
+
error: xyoError
|
|
537
|
+
}));
|
|
538
|
+
}, "CustomApiErrorCard");
|
|
589
539
|
|
|
590
540
|
// src/components/embed-card/EmbedPluginCard.tsx
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
validateSchema,
|
|
595
|
-
plugins = [],
|
|
596
|
-
huriPayload,
|
|
597
|
-
refreshTitle = "",
|
|
598
|
-
timestampLabel = "Data From",
|
|
599
|
-
hideElementsConfig,
|
|
541
|
+
var ApiEmbedPluginCard = /* @__PURE__ */ __name(({ children, ...props }) => {
|
|
542
|
+
const { validateSchema, plugins = [], huriPayload, refreshTitle = "", timestampLabel = "Data From", hideElementsConfig, embedPluginConfig, onRefresh, ...busyCardProps } = props;
|
|
543
|
+
return /* @__PURE__ */ React20.createElement(EmbedPluginInner, {
|
|
600
544
|
embedPluginConfig,
|
|
545
|
+
hideElementsConfig,
|
|
546
|
+
huriPayload,
|
|
601
547
|
onRefresh,
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
hideElementsConfig,
|
|
610
|
-
huriPayload,
|
|
611
|
-
onRefresh,
|
|
612
|
-
plugins,
|
|
613
|
-
refreshTitle,
|
|
614
|
-
timestampLabel,
|
|
615
|
-
validateSchema
|
|
616
|
-
},
|
|
617
|
-
children: [
|
|
618
|
-
/* @__PURE__ */ jsx20(EmbedPluginCardInner, { ...busyCardProps }),
|
|
619
|
-
children
|
|
620
|
-
]
|
|
621
|
-
}
|
|
622
|
-
);
|
|
623
|
-
};
|
|
624
|
-
var EmbedPluginCardInner = (props) => {
|
|
548
|
+
plugins,
|
|
549
|
+
refreshTitle,
|
|
550
|
+
timestampLabel,
|
|
551
|
+
validateSchema
|
|
552
|
+
}, /* @__PURE__ */ React20.createElement(EmbedPluginCardInner, busyCardProps), children);
|
|
553
|
+
}, "ApiEmbedPluginCard");
|
|
554
|
+
var EmbedPluginCardInner = /* @__PURE__ */ __name((props) => {
|
|
625
555
|
const { payload, huriError } = useResolvePayload();
|
|
626
556
|
const { refreshPayload } = useRefreshPayload();
|
|
627
557
|
const theme = useTheme();
|
|
628
|
-
return /* @__PURE__ */
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
};
|
|
558
|
+
return /* @__PURE__ */ React20.createElement(EmbedCardApiErrorRenderer, {
|
|
559
|
+
xyoError: huriError
|
|
560
|
+
}, /* @__PURE__ */ React20.createElement(EmbedPluginCard, {
|
|
561
|
+
elevation: 3,
|
|
562
|
+
variant: "elevation",
|
|
563
|
+
busy: Boolean(!refreshPayload && payload),
|
|
564
|
+
busyVariantProps: {
|
|
565
|
+
style: {
|
|
566
|
+
alignItems: "start",
|
|
567
|
+
paddingTop: theme.spacing(2),
|
|
568
|
+
zIndex: 2
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
sx: {
|
|
572
|
+
position: "relative"
|
|
573
|
+
},
|
|
574
|
+
...props
|
|
575
|
+
}));
|
|
576
|
+
}, "EmbedPluginCardInner");
|
|
646
577
|
export {
|
|
647
578
|
ApiEmbedPluginCard,
|
|
648
579
|
BusyCard,
|