@xyo-network/react-embed 2.64.0 → 2.64.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/components/EmbedPlugin.js +203 -11
- package/dist/browser/components/EmbedPlugin.js.map +1 -1
- package/dist/browser/components/EmbedResolver.js +13 -3
- package/dist/browser/components/EmbedResolver.js.map +1 -1
- package/dist/browser/components/controls/EmbedFormControl.js +3 -2
- package/dist/browser/components/controls/EmbedFormControl.js.map +1 -1
- package/dist/browser/components/controls/ListModeSelect.js +23 -11
- package/dist/browser/components/controls/ListModeSelect.js.map +1 -1
- package/dist/browser/components/controls/RenderSelect.js +26 -7
- package/dist/browser/components/controls/RenderSelect.js.map +1 -1
- package/dist/browser/components/controls/index.js +63 -3
- package/dist/browser/components/controls/index.js.map +1 -1
- package/dist/browser/components/embed-card/EmbedCardResolver.js +52 -5
- package/dist/browser/components/embed-card/EmbedCardResolver.js.map +1 -1
- package/dist/browser/components/embed-card/EmbedPluginCard.js +429 -11
- package/dist/browser/components/embed-card/EmbedPluginCard.js.map +1 -1
- package/dist/browser/components/embed-card/card/BusyCard.js +3 -2
- package/dist/browser/components/embed-card/card/BusyCard.js.map +1 -1
- package/dist/browser/components/embed-card/card/EmbedCardHeader.js +61 -10
- package/dist/browser/components/embed-card/card/EmbedCardHeader.js.map +1 -1
- package/dist/browser/components/embed-card/card/EmbedPluginCard.js +168 -13
- package/dist/browser/components/embed-card/card/EmbedPluginCard.js.map +1 -1
- package/dist/browser/components/embed-card/card/index.js +182 -3
- package/dist/browser/components/embed-card/card/index.js.map +1 -1
- package/dist/browser/components/embed-card/error-handling/EmbedCardApiErrorRenderer.js +26 -6
- package/dist/browser/components/embed-card/error-handling/EmbedCardApiErrorRenderer.js.map +1 -1
- package/dist/browser/components/embed-card/error-handling/EmbedErrorCard.js +4 -3
- package/dist/browser/components/embed-card/error-handling/EmbedErrorCard.js.map +1 -1
- package/dist/browser/components/embed-card/error-handling/index.js +33 -2
- package/dist/browser/components/embed-card/error-handling/index.js.map +1 -1
- package/dist/browser/components/embed-card/index.js +481 -2
- package/dist/browser/components/embed-card/index.js.map +1 -1
- package/dist/browser/components/embed-card/menu/EmbedMenu.js +30 -6
- package/dist/browser/components/embed-card/menu/EmbedMenu.js.map +1 -1
- package/dist/browser/components/embed-card/menu/JsonMenuItem.js +13 -3
- package/dist/browser/components/embed-card/menu/JsonMenuItem.js.map +1 -1
- package/dist/browser/components/embed-card/menu/index.js +46 -1
- package/dist/browser/components/embed-card/menu/index.js.map +1 -1
- package/dist/browser/components/embed-plugin-stories/storyPayload.js +2 -1
- package/dist/browser/components/embed-plugin-stories/storyPayload.js.map +1 -1
- package/dist/browser/components/embed-plugin-stories/storyShared.js +480 -5
- package/dist/browser/components/embed-plugin-stories/storyShared.js.map +1 -1
- package/dist/browser/components/index.js +482 -2
- package/dist/browser/components/index.js.map +1 -1
- package/dist/browser/components/validation-alerts/ValidatePayload.js +13 -3
- package/dist/browser/components/validation-alerts/ValidatePayload.js.map +1 -1
- package/dist/browser/components/validation-alerts/ValidatePlugins.js +21 -3
- package/dist/browser/components/validation-alerts/ValidatePlugins.js.map +1 -1
- package/dist/browser/components/validation-alerts/index.js +59 -2
- package/dist/browser/components/validation-alerts/index.js.map +1 -1
- package/dist/browser/contexts/EmbedPluginContext/Context.js +2 -1
- package/dist/browser/contexts/EmbedPluginContext/Context.js.map +1 -1
- package/dist/browser/contexts/EmbedPluginContext/Provider.js +9 -3
- package/dist/browser/contexts/EmbedPluginContext/Provider.js.map +1 -1
- package/dist/browser/contexts/EmbedPluginContext/index.js +44 -4
- package/dist/browser/contexts/EmbedPluginContext/index.js.map +1 -1
- package/dist/browser/contexts/EmbedPluginContext/use.js +8 -2
- package/dist/browser/contexts/EmbedPluginContext/use.js.map +1 -1
- package/dist/browser/contexts/RefreshPayloadContext/Context.js +2 -1
- package/dist/browser/contexts/RefreshPayloadContext/Context.js.map +1 -1
- package/dist/browser/contexts/RefreshPayloadContext/Provider.js +9 -3
- package/dist/browser/contexts/RefreshPayloadContext/Provider.js.map +1 -1
- package/dist/browser/contexts/RefreshPayloadContext/index.js +21 -3
- package/dist/browser/contexts/RefreshPayloadContext/index.js.map +1 -1
- package/dist/browser/contexts/RefreshPayloadContext/use.js +8 -2
- package/dist/browser/contexts/RefreshPayloadContext/use.js.map +1 -1
- package/dist/browser/contexts/ResolvePayloadContext/Context.js +2 -1
- package/dist/browser/contexts/ResolvePayloadContext/Context.js.map +1 -1
- package/dist/browser/contexts/ResolvePayloadContext/Provider.js +17 -4
- package/dist/browser/contexts/ResolvePayloadContext/Provider.js.map +1 -1
- package/dist/browser/contexts/ResolvePayloadContext/index.js +72 -4
- package/dist/browser/contexts/ResolvePayloadContext/index.js.map +1 -1
- package/dist/browser/contexts/ResolvePayloadContext/use.js +8 -2
- package/dist/browser/contexts/ResolvePayloadContext/use.js.map +1 -1
- package/dist/browser/contexts/ValidatePayloadContext/Context.js +2 -1
- package/dist/browser/contexts/ValidatePayloadContext/Context.js.map +1 -1
- package/dist/browser/contexts/ValidatePayloadContext/Provider.js +17 -4
- package/dist/browser/contexts/ValidatePayloadContext/Provider.js.map +1 -1
- package/dist/browser/contexts/ValidatePayloadContext/index.js +49 -3
- package/dist/browser/contexts/ValidatePayloadContext/index.js.map +1 -1
- package/dist/browser/contexts/ValidatePayloadContext/use.js +8 -2
- package/dist/browser/contexts/ValidatePayloadContext/use.js.map +1 -1
- package/dist/browser/contexts/index.js +165 -4
- package/dist/browser/contexts/index.js.map +1 -1
- package/dist/browser/index.js +492 -3
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/types/index.js +0 -1
- package/dist/browser/types/index.js.map +1 -1
- package/dist/docs.json +109 -109
- package/package.json +15 -15
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/embed-card/error-handling/EmbedCardApiErrorRenderer.tsx"],"sourcesContent":["import { CardProps } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { ModuleError } from '@xyo-network/payload-model'\nimport { ErrorAlert, ErrorRender } from '@xyo-network/react-error'\n\nimport { EmbedErrorCard } from './EmbedErrorCard'\n\ninterface EmbedCardApiErrorRendererProps extends CardProps {\n xyoError?: ModuleError\n}\n\nexport const EmbedCardApiErrorRenderer: React.FC<WithChildren<EmbedCardApiErrorRendererProps>> = ({ xyoError, children, ...props }) => {\n return (\n <ErrorRender error={xyoError} noReAuth noErrorDisplay customError={<CustomApiErrorCard xyoError={xyoError} {...props} />}>\n {children}\n </ErrorRender>\n )\n}\n\nconst CustomApiErrorCard: React.FC<EmbedCardApiErrorRendererProps> = ({ xyoError, ...props }) => {\n return (\n <EmbedErrorCard {...props}>\n <ErrorAlert error={xyoError} />\n </EmbedErrorCard>\n )\n}\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../../../src/components/embed-card/error-handling/EmbedCardApiErrorRenderer.tsx","../../../../../src/components/embed-card/error-handling/EmbedErrorCard.tsx"],"sourcesContent":["import { CardProps } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { ModuleError } from '@xyo-network/payload-model'\nimport { ErrorAlert, ErrorRender } from '@xyo-network/react-error'\n\nimport { EmbedErrorCard } from './EmbedErrorCard'\n\ninterface EmbedCardApiErrorRendererProps extends CardProps {\n xyoError?: ModuleError\n}\n\nexport const EmbedCardApiErrorRenderer: React.FC<WithChildren<EmbedCardApiErrorRendererProps>> = ({ xyoError, children, ...props }) => {\n return (\n <ErrorRender error={xyoError} noReAuth noErrorDisplay customError={<CustomApiErrorCard xyoError={xyoError} {...props} />}>\n {children}\n </ErrorRender>\n )\n}\n\nconst CustomApiErrorCard: React.FC<EmbedCardApiErrorRendererProps> = ({ xyoError, ...props }) => {\n return (\n <EmbedErrorCard {...props}>\n <ErrorAlert error={xyoError} />\n </EmbedErrorCard>\n )\n}\n","import { Alert, AlertProps, AlertTitle, Card, CardContent, CardProps, Typography } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\ninterface EmbedErrorCardBaseProps {\n alertProps?: AlertProps\n error?: Error\n hideErrorDetails?: boolean\n}\n\ninterface EmbedErrorCardProps extends EmbedErrorCardBaseProps, CardProps {\n alertProps?: AlertProps\n error?: Error\n}\n\nexport const EmbedErrorCard: React.FC<WithChildren<EmbedErrorCardProps>> = (props) => {\n const { alertProps, error, hideErrorDetails = true, children, ...cardProps } = props\n const errorProps = { alertProps, error, hideErrorDetails }\n return (\n <Card {...cardProps}>\n <CardContent>{children ?? <DefaultErrorAlert {...errorProps} />}</CardContent>\n </Card>\n )\n}\n\nconst DefaultErrorAlert: React.FC<EmbedErrorCardBaseProps> = ({ alertProps, hideErrorDetails, error }) => {\n return (\n <Alert severity=\"error\" {...alertProps}>\n <AlertTitle>Whoops! Something went wrong</AlertTitle>\n {!hideErrorDetails && error ? (\n <>\n <Typography variant=\"caption\">Error: </Typography>\n <Typography variant=\"caption\">{error?.message}</Typography>\n </>\n ) : (\n <Typography variant=\"caption\" fontSize=\"small\">\n Error Loading Plugin\n </Typography>\n )}\n </Alert>\n )\n}\n"],"mappings":";AAGA,SAAS,YAAY,mBAAmB;;;ACHxC,SAAS,OAAmB,YAAY,MAAM,aAAwB,kBAAkB;AAmBxD,SAUxB,UAVwB,KAUxB,YAVwB;AALzB,IAAM,iBAA8D,CAAC,UAAU;AACpF,QAAM,EAAE,YAAY,OAAO,mBAAmB,MAAM,UAAU,GAAG,UAAU,IAAI;AAC/E,QAAM,aAAa,EAAE,YAAY,OAAO,iBAAiB;AACzD,SACE,oBAAC,QAAM,GAAG,WACR,8BAAC,eAAa,sBAAY,oBAAC,qBAAmB,GAAG,YAAY,GAAG,GAClE;AAEJ;AAEA,IAAM,oBAAuD,CAAC,EAAE,YAAY,kBAAkB,MAAM,MAAM;AACxG,SACE,qBAAC,SAAM,UAAS,SAAS,GAAG,YAC1B;AAAA,wBAAC,cAAW,0CAA4B;AAAA,IACvC,CAAC,oBAAoB,QACpB,iCACE;AAAA,0BAAC,cAAW,SAAQ,WAAU,qBAAO;AAAA,MACrC,oBAAC,cAAW,SAAQ,WAAW,iBAAO,SAAQ;AAAA,OAChD,IAEA,oBAAC,cAAW,SAAQ,WAAU,UAAS,SAAQ,kCAE/C;AAAA,KAEJ;AAEJ;;;AD3BuE,gBAAAA,YAAA;AAFhE,IAAM,4BAAoF,CAAC,EAAE,UAAU,UAAU,GAAG,MAAM,MAAM;AACrI,SACE,gBAAAA,KAAC,eAAY,OAAO,UAAU,UAAQ,MAAC,gBAAc,MAAC,aAAa,gBAAAA,KAAC,sBAAmB,UAAqB,GAAG,OAAO,GACnH,UACH;AAEJ;AAEA,IAAM,qBAA+D,CAAC,EAAE,UAAU,GAAG,MAAM,MAAM;AAC/F,SACE,gBAAAA,KAAC,kBAAgB,GAAG,OAClB,0BAAAA,KAAC,cAAW,OAAO,UAAU,GAC/B;AAEJ;","names":["jsx"]}
|
@@ -1,11 +1,12 @@
|
|
1
|
-
|
1
|
+
// src/components/embed-card/error-handling/EmbedErrorCard.tsx
|
2
2
|
import { Alert, AlertTitle, Card, CardContent, Typography } from "@mui/material";
|
3
|
-
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
4
|
+
var EmbedErrorCard = (props) => {
|
4
5
|
const { alertProps, error, hideErrorDetails = true, children, ...cardProps } = props;
|
5
6
|
const errorProps = { alertProps, error, hideErrorDetails };
|
6
7
|
return /* @__PURE__ */ jsx(Card, { ...cardProps, children: /* @__PURE__ */ jsx(CardContent, { children: children ?? /* @__PURE__ */ jsx(DefaultErrorAlert, { ...errorProps }) }) });
|
7
8
|
};
|
8
|
-
|
9
|
+
var DefaultErrorAlert = ({ alertProps, hideErrorDetails, error }) => {
|
9
10
|
return /* @__PURE__ */ jsxs(Alert, { severity: "error", ...alertProps, children: [
|
10
11
|
/* @__PURE__ */ jsx(AlertTitle, { children: "Whoops! Something went wrong" }),
|
11
12
|
!hideErrorDetails && error ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/embed-card/error-handling/EmbedErrorCard.tsx"],"sourcesContent":["import { Alert, AlertProps, AlertTitle, Card, CardContent, CardProps, Typography } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\ninterface EmbedErrorCardBaseProps {\n alertProps?: AlertProps\n error?: Error\n hideErrorDetails?: boolean\n}\n\ninterface EmbedErrorCardProps extends EmbedErrorCardBaseProps, CardProps {\n alertProps?: AlertProps\n error?: Error\n}\n\nexport const EmbedErrorCard: React.FC<WithChildren<EmbedErrorCardProps>> = (props) => {\n const { alertProps, error, hideErrorDetails = true, children, ...cardProps } = props\n const errorProps = { alertProps, error, hideErrorDetails }\n return (\n <Card {...cardProps}>\n <CardContent>{children ?? <DefaultErrorAlert {...errorProps} />}</CardContent>\n </Card>\n )\n}\n\nconst DefaultErrorAlert: React.FC<EmbedErrorCardBaseProps> = ({ alertProps, hideErrorDetails, error }) => {\n return (\n <Alert severity=\"error\" {...alertProps}>\n <AlertTitle>Whoops! Something went wrong</AlertTitle>\n {!hideErrorDetails && error ? (\n <>\n <Typography variant=\"caption\">Error: </Typography>\n <Typography variant=\"caption\">{error?.message}</Typography>\n </>\n ) : (\n <Typography variant=\"caption\" fontSize=\"small\">\n Error Loading Plugin\n </Typography>\n )}\n </Alert>\n )\n}\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../../../src/components/embed-card/error-handling/EmbedErrorCard.tsx"],"sourcesContent":["import { Alert, AlertProps, AlertTitle, Card, CardContent, CardProps, Typography } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\ninterface EmbedErrorCardBaseProps {\n alertProps?: AlertProps\n error?: Error\n hideErrorDetails?: boolean\n}\n\ninterface EmbedErrorCardProps extends EmbedErrorCardBaseProps, CardProps {\n alertProps?: AlertProps\n error?: Error\n}\n\nexport const EmbedErrorCard: React.FC<WithChildren<EmbedErrorCardProps>> = (props) => {\n const { alertProps, error, hideErrorDetails = true, children, ...cardProps } = props\n const errorProps = { alertProps, error, hideErrorDetails }\n return (\n <Card {...cardProps}>\n <CardContent>{children ?? <DefaultErrorAlert {...errorProps} />}</CardContent>\n </Card>\n )\n}\n\nconst DefaultErrorAlert: React.FC<EmbedErrorCardBaseProps> = ({ alertProps, hideErrorDetails, error }) => {\n return (\n <Alert severity=\"error\" {...alertProps}>\n <AlertTitle>Whoops! Something went wrong</AlertTitle>\n {!hideErrorDetails && error ? (\n <>\n <Typography variant=\"caption\">Error: </Typography>\n <Typography variant=\"caption\">{error?.message}</Typography>\n </>\n ) : (\n <Typography variant=\"caption\" fontSize=\"small\">\n Error Loading Plugin\n </Typography>\n )}\n </Alert>\n )\n}\n"],"mappings":";AAAA,SAAS,OAAmB,YAAY,MAAM,aAAwB,kBAAkB;AAmBxD,SAUxB,UAVwB,KAUxB,YAVwB;AALzB,IAAM,iBAA8D,CAAC,UAAU;AACpF,QAAM,EAAE,YAAY,OAAO,mBAAmB,MAAM,UAAU,GAAG,UAAU,IAAI;AAC/E,QAAM,aAAa,EAAE,YAAY,OAAO,iBAAiB;AACzD,SACE,oBAAC,QAAM,GAAG,WACR,8BAAC,eAAa,sBAAY,oBAAC,qBAAmB,GAAG,YAAY,GAAG,GAClE;AAEJ;AAEA,IAAM,oBAAuD,CAAC,EAAE,YAAY,kBAAkB,MAAM,MAAM;AACxG,SACE,qBAAC,SAAM,UAAS,SAAS,GAAG,YAC1B;AAAA,wBAAC,cAAW,0CAA4B;AAAA,IACvC,CAAC,oBAAoB,QACpB,iCACE;AAAA,0BAAC,cAAW,SAAQ,WAAU,qBAAO;AAAA,MACrC,oBAAC,cAAW,SAAQ,WAAW,iBAAO,SAAQ;AAAA,OAChD,IAEA,oBAAC,cAAW,SAAQ,WAAU,UAAS,SAAQ,kCAE/C;AAAA,KAEJ;AAEJ;","names":[]}
|
@@ -1,3 +1,34 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
// src/components/embed-card/error-handling/EmbedCardApiErrorRenderer.tsx
|
2
|
+
import { ErrorAlert, ErrorRender } from "@xyo-network/react-error";
|
3
|
+
|
4
|
+
// src/components/embed-card/error-handling/EmbedErrorCard.tsx
|
5
|
+
import { Alert, AlertTitle, Card, CardContent, Typography } from "@mui/material";
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
7
|
+
var EmbedErrorCard = (props) => {
|
8
|
+
const { alertProps, error, hideErrorDetails = true, children, ...cardProps } = props;
|
9
|
+
const errorProps = { alertProps, error, hideErrorDetails };
|
10
|
+
return /* @__PURE__ */ jsx(Card, { ...cardProps, children: /* @__PURE__ */ jsx(CardContent, { children: children ?? /* @__PURE__ */ jsx(DefaultErrorAlert, { ...errorProps }) }) });
|
11
|
+
};
|
12
|
+
var DefaultErrorAlert = ({ alertProps, hideErrorDetails, error }) => {
|
13
|
+
return /* @__PURE__ */ jsxs(Alert, { severity: "error", ...alertProps, children: [
|
14
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: "Whoops! Something went wrong" }),
|
15
|
+
!hideErrorDetails && error ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
16
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: "Error: " }),
|
17
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: error?.message })
|
18
|
+
] }) : /* @__PURE__ */ jsx(Typography, { variant: "caption", fontSize: "small", children: "Error Loading Plugin" })
|
19
|
+
] });
|
20
|
+
};
|
21
|
+
|
22
|
+
// src/components/embed-card/error-handling/EmbedCardApiErrorRenderer.tsx
|
23
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
24
|
+
var EmbedCardApiErrorRenderer = ({ xyoError, children, ...props }) => {
|
25
|
+
return /* @__PURE__ */ jsx2(ErrorRender, { error: xyoError, noReAuth: true, noErrorDisplay: true, customError: /* @__PURE__ */ jsx2(CustomApiErrorCard, { xyoError, ...props }), children });
|
26
|
+
};
|
27
|
+
var CustomApiErrorCard = ({ xyoError, ...props }) => {
|
28
|
+
return /* @__PURE__ */ jsx2(EmbedErrorCard, { ...props, children: /* @__PURE__ */ jsx2(ErrorAlert, { error: xyoError }) });
|
29
|
+
};
|
30
|
+
export {
|
31
|
+
EmbedCardApiErrorRenderer,
|
32
|
+
EmbedErrorCard
|
33
|
+
};
|
3
34
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/embed-card/error-handling/
|
1
|
+
{"version":3,"sources":["../../../../../src/components/embed-card/error-handling/EmbedCardApiErrorRenderer.tsx","../../../../../src/components/embed-card/error-handling/EmbedErrorCard.tsx"],"sourcesContent":["import { CardProps } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { ModuleError } from '@xyo-network/payload-model'\nimport { ErrorAlert, ErrorRender } from '@xyo-network/react-error'\n\nimport { EmbedErrorCard } from './EmbedErrorCard'\n\ninterface EmbedCardApiErrorRendererProps extends CardProps {\n xyoError?: ModuleError\n}\n\nexport const EmbedCardApiErrorRenderer: React.FC<WithChildren<EmbedCardApiErrorRendererProps>> = ({ xyoError, children, ...props }) => {\n return (\n <ErrorRender error={xyoError} noReAuth noErrorDisplay customError={<CustomApiErrorCard xyoError={xyoError} {...props} />}>\n {children}\n </ErrorRender>\n )\n}\n\nconst CustomApiErrorCard: React.FC<EmbedCardApiErrorRendererProps> = ({ xyoError, ...props }) => {\n return (\n <EmbedErrorCard {...props}>\n <ErrorAlert error={xyoError} />\n </EmbedErrorCard>\n )\n}\n","import { Alert, AlertProps, AlertTitle, Card, CardContent, CardProps, Typography } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\ninterface EmbedErrorCardBaseProps {\n alertProps?: AlertProps\n error?: Error\n hideErrorDetails?: boolean\n}\n\ninterface EmbedErrorCardProps extends EmbedErrorCardBaseProps, CardProps {\n alertProps?: AlertProps\n error?: Error\n}\n\nexport const EmbedErrorCard: React.FC<WithChildren<EmbedErrorCardProps>> = (props) => {\n const { alertProps, error, hideErrorDetails = true, children, ...cardProps } = props\n const errorProps = { alertProps, error, hideErrorDetails }\n return (\n <Card {...cardProps}>\n <CardContent>{children ?? <DefaultErrorAlert {...errorProps} />}</CardContent>\n </Card>\n )\n}\n\nconst DefaultErrorAlert: React.FC<EmbedErrorCardBaseProps> = ({ alertProps, hideErrorDetails, error }) => {\n return (\n <Alert severity=\"error\" {...alertProps}>\n <AlertTitle>Whoops! Something went wrong</AlertTitle>\n {!hideErrorDetails && error ? (\n <>\n <Typography variant=\"caption\">Error: </Typography>\n <Typography variant=\"caption\">{error?.message}</Typography>\n </>\n ) : (\n <Typography variant=\"caption\" fontSize=\"small\">\n Error Loading Plugin\n </Typography>\n )}\n </Alert>\n )\n}\n"],"mappings":";AAGA,SAAS,YAAY,mBAAmB;;;ACHxC,SAAS,OAAmB,YAAY,MAAM,aAAwB,kBAAkB;AAmBxD,SAUxB,UAVwB,KAUxB,YAVwB;AALzB,IAAM,iBAA8D,CAAC,UAAU;AACpF,QAAM,EAAE,YAAY,OAAO,mBAAmB,MAAM,UAAU,GAAG,UAAU,IAAI;AAC/E,QAAM,aAAa,EAAE,YAAY,OAAO,iBAAiB;AACzD,SACE,oBAAC,QAAM,GAAG,WACR,8BAAC,eAAa,sBAAY,oBAAC,qBAAmB,GAAG,YAAY,GAAG,GAClE;AAEJ;AAEA,IAAM,oBAAuD,CAAC,EAAE,YAAY,kBAAkB,MAAM,MAAM;AACxG,SACE,qBAAC,SAAM,UAAS,SAAS,GAAG,YAC1B;AAAA,wBAAC,cAAW,0CAA4B;AAAA,IACvC,CAAC,oBAAoB,QACpB,iCACE;AAAA,0BAAC,cAAW,SAAQ,WAAU,qBAAO;AAAA,MACrC,oBAAC,cAAW,SAAQ,WAAW,iBAAO,SAAQ;AAAA,OAChD,IAEA,oBAAC,cAAW,SAAQ,WAAU,UAAS,SAAQ,kCAE/C;AAAA,KAEJ;AAEJ;;;AD3BuE,gBAAAA,YAAA;AAFhE,IAAM,4BAAoF,CAAC,EAAE,UAAU,UAAU,GAAG,MAAM,MAAM;AACrI,SACE,gBAAAA,KAAC,eAAY,OAAO,UAAU,UAAQ,MAAC,gBAAc,MAAC,aAAa,gBAAAA,KAAC,sBAAmB,UAAqB,GAAG,OAAO,GACnH,UACH;AAEJ;AAEA,IAAM,qBAA+D,CAAC,EAAE,UAAU,GAAG,MAAM,MAAM;AAC/F,SACE,gBAAAA,KAAC,kBAAgB,GAAG,OAClB,0BAAAA,KAAC,cAAW,OAAO,UAAU,GAC/B;AAEJ;","names":["jsx"]}
|
@@ -1,3 +1,482 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
// src/components/embed-card/card/BusyCard.tsx
|
2
|
+
import { Card } from "@mui/material";
|
3
|
+
import { useBusyTiming } from "@xylabs/react-flexbox";
|
4
|
+
import {
|
5
|
+
BusyCircularProgress,
|
6
|
+
BusyLinearProgress
|
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
|
+
}) => {
|
17
|
+
const internalBusy = useBusyTiming(busy, busyMinimum);
|
18
|
+
return /* @__PURE__ */ jsxs(Card, { ...props, children: [
|
19
|
+
children,
|
20
|
+
busyVariant === "circular" && internalBusy ? /* @__PURE__ */ jsx(BusyCircularProgress, { ...busyVariantProps }) : null,
|
21
|
+
busyVariant === "linear" && internalBusy ? /* @__PURE__ */ jsx(BusyLinearProgress, { ...busyVariantProps }) : null
|
22
|
+
] });
|
23
|
+
};
|
24
|
+
|
25
|
+
// src/components/embed-card/card/EmbedCardHeader.tsx
|
26
|
+
import { Refresh as RefreshIcon } from "@mui/icons-material";
|
27
|
+
import { Avatar, CardHeader, Chip as Chip2 } from "@mui/material";
|
28
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
29
|
+
|
30
|
+
// src/contexts/EmbedPluginContext/Context.tsx
|
31
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
32
|
+
var EmbedPluginContext = createContextEx();
|
33
|
+
|
34
|
+
// src/contexts/EmbedPluginContext/Provider.tsx
|
35
|
+
import { useEffect, useState } from "react";
|
36
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
37
|
+
var EmbedPluginProvider = ({
|
38
|
+
children,
|
39
|
+
refreshTitle,
|
40
|
+
timestampLabel,
|
41
|
+
hideElementsConfig,
|
42
|
+
plugins,
|
43
|
+
embedPluginConfig
|
44
|
+
}) => {
|
45
|
+
const [activePlugin, setActivePlugin] = useState(plugins ? plugins[0] : void 0);
|
46
|
+
useEffect(() => {
|
47
|
+
setActivePlugin(plugins ? plugins[0] : void 0);
|
48
|
+
}, [plugins]);
|
49
|
+
return /* @__PURE__ */ jsx2(
|
50
|
+
EmbedPluginContext.Provider,
|
51
|
+
{
|
52
|
+
value: {
|
53
|
+
activePlugin,
|
54
|
+
embedPluginConfig,
|
55
|
+
hideElementsConfig,
|
56
|
+
provided: true,
|
57
|
+
refreshTitle,
|
58
|
+
setActivePlugin,
|
59
|
+
timestampLabel
|
60
|
+
},
|
61
|
+
children
|
62
|
+
}
|
63
|
+
);
|
64
|
+
};
|
65
|
+
|
66
|
+
// src/contexts/EmbedPluginContext/use.tsx
|
67
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
68
|
+
var useEmbedPluginState = () => useContextEx(EmbedPluginContext, "EmbedPlugin", true);
|
69
|
+
|
70
|
+
// src/contexts/RefreshPayloadContext/Provider.tsx
|
71
|
+
import { useState as useState2 } from "react";
|
72
|
+
|
73
|
+
// src/contexts/RefreshPayloadContext/Context.tsx
|
74
|
+
import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
|
75
|
+
var RefreshPayloadContext = createContextEx2();
|
76
|
+
|
77
|
+
// src/contexts/RefreshPayloadContext/Provider.tsx
|
78
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
79
|
+
var RefreshPayloadProvider = ({ children, onRefresh, refreshPayload }) => {
|
80
|
+
const [localRefreshPayload, setRefreshPayload] = useState2(refreshPayload);
|
81
|
+
return /* @__PURE__ */ jsx3(RefreshPayloadContext.Provider, { value: { onRefresh, provided: true, refreshPayload: localRefreshPayload, setRefreshPayload }, children });
|
82
|
+
};
|
83
|
+
|
84
|
+
// src/contexts/RefreshPayloadContext/use.tsx
|
85
|
+
import { useContextEx as useContextEx2 } from "@xyo-network/react-shared";
|
86
|
+
var useRefreshPayload = () => useContextEx2(RefreshPayloadContext, "RefreshPayload", true);
|
87
|
+
|
88
|
+
// src/contexts/ResolvePayloadContext/Context.ts
|
89
|
+
import { createContextEx as createContextEx3 } from "@xyo-network/react-shared";
|
90
|
+
var ResolvePayloadContext = createContextEx3();
|
91
|
+
|
92
|
+
// src/contexts/ResolvePayloadContext/Provider.tsx
|
93
|
+
import { delay } from "@xylabs/delay";
|
94
|
+
import { useAsyncEffect } from "@xylabs/react-async-effect";
|
95
|
+
import { Huri } from "@xyo-network/huri";
|
96
|
+
import { ModuleErrorSchema } from "@xyo-network/payload-model";
|
97
|
+
import { useEffect as useEffect2, useState as useState3 } from "react";
|
98
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
99
|
+
var ResolvePayloadProvider = ({ children, huriPayload }) => {
|
100
|
+
const [payload, setPayload] = useState3();
|
101
|
+
const [huri, setHuri] = useState3();
|
102
|
+
const { refreshPayload, setRefreshPayload, onRefresh } = useRefreshPayload();
|
103
|
+
useEffect2(() => {
|
104
|
+
typeof huriPayload === "string" ? setHuri(huriPayload) : void 0;
|
105
|
+
if (typeof huriPayload === "object") {
|
106
|
+
setPayload(huriPayload);
|
107
|
+
setRefreshPayload?.(true);
|
108
|
+
}
|
109
|
+
}, [huriPayload, setRefreshPayload]);
|
110
|
+
const [notFound, setNotFound] = useState3();
|
111
|
+
const [huriError, setHuriError] = useState3();
|
112
|
+
useAsyncEffect(
|
113
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
114
|
+
async (mounted) => {
|
115
|
+
if (huri && !refreshPayload) {
|
116
|
+
try {
|
117
|
+
const huriInstance = new Huri(huri);
|
118
|
+
const result = await huriInstance.fetch();
|
119
|
+
await delay(500);
|
120
|
+
if (mounted()) {
|
121
|
+
setNotFound(result === null);
|
122
|
+
setPayload(result);
|
123
|
+
setRefreshPayload?.(true);
|
124
|
+
}
|
125
|
+
} catch (e) {
|
126
|
+
const error = e;
|
127
|
+
setHuriError({ message: error.message, schema: ModuleErrorSchema, sources: [] });
|
128
|
+
}
|
129
|
+
}
|
130
|
+
},
|
131
|
+
[huri, payload, refreshPayload, setRefreshPayload]
|
132
|
+
);
|
133
|
+
const refreshHuri = () => {
|
134
|
+
onRefresh?.();
|
135
|
+
if (huri) {
|
136
|
+
setRefreshPayload?.(false);
|
137
|
+
}
|
138
|
+
};
|
139
|
+
return /* @__PURE__ */ jsx4(ResolvePayloadContext.Provider, { value: { huri, huriError, notFound, payload, provided: true, refreshHuri, setPayload }, children });
|
140
|
+
};
|
141
|
+
|
142
|
+
// src/contexts/ResolvePayloadContext/use.tsx
|
143
|
+
import { useContextEx as useContextEx3 } from "@xyo-network/react-shared";
|
144
|
+
var useResolvePayload = () => useContextEx3(ResolvePayloadContext, "ResolvePayload", true);
|
145
|
+
|
146
|
+
// src/contexts/ValidatePayloadContext/Provider.tsx
|
147
|
+
import { Chip } from "@mui/material";
|
148
|
+
import { useAsyncEffect as useAsyncEffect2 } from "@xylabs/react-async-effect";
|
149
|
+
import { SchemaCache } from "@xyo-network/schema-cache";
|
150
|
+
import { useState as useState4 } from "react";
|
151
|
+
|
152
|
+
// src/contexts/ValidatePayloadContext/Context.ts
|
153
|
+
import { createContextEx as createContextEx4 } from "@xyo-network/react-shared";
|
154
|
+
var ValidatePayloadContext = createContextEx4();
|
155
|
+
|
156
|
+
// src/contexts/ValidatePayloadContext/Provider.tsx
|
157
|
+
import { Fragment, jsx as jsx5 } from "react/jsx-runtime";
|
158
|
+
var ValidatePayloadProvider = ({ children, enabled = false }) => {
|
159
|
+
const { payload } = useResolvePayload();
|
160
|
+
const [initialized, setInitialized] = useState4(false);
|
161
|
+
const [valid, setValid] = useState4();
|
162
|
+
useAsyncEffect2(
|
163
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
164
|
+
async () => {
|
165
|
+
if (payload && enabled) {
|
166
|
+
await SchemaCache.instance.get(payload.schema);
|
167
|
+
const possibleKnownSchema = payload.schema;
|
168
|
+
if (SchemaCache.instance.validators[possibleKnownSchema]) {
|
169
|
+
const validator = SchemaCache.instance.validators[possibleKnownSchema];
|
170
|
+
setValid(validator?.(payload));
|
171
|
+
}
|
172
|
+
setInitialized(true);
|
173
|
+
}
|
174
|
+
},
|
175
|
+
[payload, enabled]
|
176
|
+
);
|
177
|
+
return /* @__PURE__ */ jsx5(ValidatePayloadContext.Provider, { value: { enabled, provided: true, schema: payload?.schema, validPayload: valid }, children: enabled ? /* @__PURE__ */ jsx5(Fragment, { children: initialized ? children : /* @__PURE__ */ jsx5(Chip, { label: "Validating Payload..." }) }) : children });
|
178
|
+
};
|
179
|
+
|
180
|
+
// src/contexts/ValidatePayloadContext/use.tsx
|
181
|
+
import { useContextEx as useContextEx4 } from "@xyo-network/react-shared";
|
182
|
+
var useValidatePayload = () => useContextEx4(ValidatePayloadContext, "ValidateSchema", true);
|
183
|
+
|
184
|
+
// src/components/embed-card/menu/EmbedMenu.tsx
|
185
|
+
import { MoreVert as MoreVertIcon } from "@mui/icons-material";
|
186
|
+
import { IconButton, Menu } from "@mui/material";
|
187
|
+
import { useState as useState5 } from "react";
|
188
|
+
|
189
|
+
// src/components/embed-card/menu/JsonMenuItem.tsx
|
190
|
+
import { OpenInNew as OpenInNewIcon } from "@mui/icons-material";
|
191
|
+
import { ListItemIcon, ListItemText, MenuItem } from "@mui/material";
|
192
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
193
|
+
var JsonMenuItem = (props) => {
|
194
|
+
const { huri } = useResolvePayload();
|
195
|
+
return /* @__PURE__ */ jsx6(Fragment2, { children: huri ? /* @__PURE__ */ jsxs2(MenuItem, { title: "Source Payload JSON", onClick: () => window.open(huri, "_blank"), ...props, children: [
|
196
|
+
/* @__PURE__ */ jsx6(ListItemText, { sx: { mr: 1 }, children: "JSON" }),
|
197
|
+
/* @__PURE__ */ jsx6(ListItemIcon, { sx: { justifyContent: "end" }, children: /* @__PURE__ */ jsx6(OpenInNewIcon, { fontSize: "small" }) })
|
198
|
+
] }) : null });
|
199
|
+
};
|
200
|
+
|
201
|
+
// src/components/embed-card/menu/EmbedMenu.tsx
|
202
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
203
|
+
var EmbedMenu = (props) => {
|
204
|
+
const [anchorEl, setAnchorEl] = useState5(null);
|
205
|
+
const open = Boolean(anchorEl);
|
206
|
+
const handleClick = (event) => {
|
207
|
+
setAnchorEl(event.currentTarget);
|
208
|
+
};
|
209
|
+
const handleClose = () => {
|
210
|
+
setAnchorEl(null);
|
211
|
+
};
|
212
|
+
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
213
|
+
/* @__PURE__ */ jsx7(IconButton, { onClick: handleClick, ...props, children: /* @__PURE__ */ jsx7(MoreVertIcon, {}) }),
|
214
|
+
/* @__PURE__ */ jsx7(Menu, { anchorEl, open, onClose: handleClose, PaperProps: { variant: "elevation" }, MenuListProps: { dense: true }, children: /* @__PURE__ */ jsx7(JsonMenuItem, {}) })
|
215
|
+
] });
|
216
|
+
};
|
217
|
+
|
218
|
+
// src/components/embed-card/card/EmbedCardHeader.tsx
|
219
|
+
import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
220
|
+
var EmbedCardHeader = () => {
|
221
|
+
const { refreshHuri, huri } = useResolvePayload();
|
222
|
+
const { activePlugin, timestampLabel, hideElementsConfig } = useEmbedPluginState();
|
223
|
+
const { hideAvatar, hideTitle, hideRefreshButton, hideTimestamp, hideCardActions } = hideElementsConfig ?? {};
|
224
|
+
const timestamp = Date.now();
|
225
|
+
return /* @__PURE__ */ jsx8(
|
226
|
+
CardHeader,
|
227
|
+
{
|
228
|
+
sx: { flexWrap: "wrap", rowGap: 1 },
|
229
|
+
avatar: hideAvatar ? /* @__PURE__ */ jsx8(Fragment4, {}) : /* @__PURE__ */ jsx8(Avatar, { sx: { bgcolor: (theme) => theme.palette.primary.main }, "aria-label": activePlugin?.name, children: activePlugin?.name?.charAt(0) }),
|
230
|
+
action: /* @__PURE__ */ jsxs4(FlexRow, { flexWrap: "wrap", columnGap: 0.5, children: [
|
231
|
+
timestamp ? hideTimestamp && hideRefreshButton ? "" : /* @__PURE__ */ jsx8(
|
232
|
+
Chip2,
|
233
|
+
{
|
234
|
+
avatar: hideRefreshButton ? /* @__PURE__ */ jsx8(Fragment4, {}) : /* @__PURE__ */ jsx8(RefreshIcon, {}),
|
235
|
+
clickable: hideRefreshButton ? false : true,
|
236
|
+
onClick: refreshHuri,
|
237
|
+
label: hideTimestamp ? "" : `${timestampLabel} ${new Date(timestamp).toLocaleString()}`
|
238
|
+
}
|
239
|
+
) : null,
|
240
|
+
hideCardActions || huri === void 0 ? null : /* @__PURE__ */ jsx8(EmbedMenu, {})
|
241
|
+
] }),
|
242
|
+
title: hideTitle ? "" : activePlugin?.name
|
243
|
+
}
|
244
|
+
);
|
245
|
+
};
|
246
|
+
|
247
|
+
// src/components/embed-card/card/EmbedPluginCard.tsx
|
248
|
+
import { CardContent } from "@mui/material";
|
249
|
+
import { FlexGrowRow } from "@xylabs/react-flexbox";
|
250
|
+
import { useListMode as useListMode2 } from "@xyo-network/react-shared";
|
251
|
+
|
252
|
+
// src/components/controls/EmbedFormControl.tsx
|
253
|
+
import { FormControl, InputLabel } from "@mui/material";
|
254
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
255
|
+
var EmbedFormControl = ({ formId, formLabel, children, ...props }) => {
|
256
|
+
return /* @__PURE__ */ jsxs5(FormControl, { ...props, children: [
|
257
|
+
/* @__PURE__ */ jsx9(InputLabel, { id: formId, children: formLabel }),
|
258
|
+
children
|
259
|
+
] });
|
260
|
+
};
|
261
|
+
|
262
|
+
// src/components/controls/ListModeSelect.tsx
|
263
|
+
import { MenuItem as MenuItem2, Select } from "@mui/material";
|
264
|
+
import { useListMode } from "@xyo-network/react-shared";
|
265
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
266
|
+
var listModeSelectId = "listmode-select-id";
|
267
|
+
var listModeSelectLabel = "List Mode";
|
268
|
+
var ListModeSelect = (props) => {
|
269
|
+
const { listMode, setListMode } = useListMode();
|
270
|
+
return /* @__PURE__ */ jsxs6(
|
271
|
+
Select,
|
272
|
+
{
|
273
|
+
value: listMode ?? "default",
|
274
|
+
onChange: (event) => {
|
275
|
+
setListMode?.(event.target.value);
|
276
|
+
},
|
277
|
+
...props,
|
278
|
+
children: [
|
279
|
+
/* @__PURE__ */ jsx10(MenuItem2, { value: "default", children: "Default" }, "default"),
|
280
|
+
/* @__PURE__ */ jsx10(MenuItem2, { value: "table", children: "Table" }, "table"),
|
281
|
+
/* @__PURE__ */ jsx10(MenuItem2, { value: "grid", children: "Grid" }, "grid")
|
282
|
+
]
|
283
|
+
}
|
284
|
+
);
|
285
|
+
};
|
286
|
+
var ListModeSelectFormControl = (props) => {
|
287
|
+
return /* @__PURE__ */ jsx10(EmbedFormControl, { formId: listModeSelectId, formLabel: listModeSelectLabel, children: /* @__PURE__ */ jsx10(ListModeSelect, { size: "small", label: listModeSelectLabel, labelId: listModeSelectId, ...props }) });
|
288
|
+
};
|
289
|
+
|
290
|
+
// src/components/controls/RenderSelect.tsx
|
291
|
+
import { MenuItem as MenuItem3, Select as Select2 } from "@mui/material";
|
292
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
293
|
+
var renderSelectId = "render-select-id";
|
294
|
+
var renderSelectLabel = "Renderer";
|
295
|
+
var EmbedRenderSelect = (props) => {
|
296
|
+
const { activePlugin, setActivePlugin, plugins } = useEmbedPluginState();
|
297
|
+
return /* @__PURE__ */ jsx11(EmbedFormControl, { formId: renderSelectId, formLabel: renderSelectLabel, children: /* @__PURE__ */ jsx11(Select2, { size: "small", value: activePlugin?.name, ...props, children: plugins?.map((plugin) => /* @__PURE__ */ jsx11(MenuItem3, { value: plugin.name, onClick: () => setActivePlugin?.(plugin), children: plugin.name }, plugin.name)) }) });
|
298
|
+
};
|
299
|
+
|
300
|
+
// src/components/embed-card/card/EmbedPluginCard.tsx
|
301
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
302
|
+
var EmbedPluginCard = ({ ...props }) => {
|
303
|
+
const { payload } = useResolvePayload();
|
304
|
+
const { activePlugin: ActivePlugin, plugins, hideElementsConfig } = useEmbedPluginState();
|
305
|
+
const { listMode } = useListMode2();
|
306
|
+
const supportsListMode = ActivePlugin?.components?.box?.listModes?.length ?? 0 > 1;
|
307
|
+
return /* @__PURE__ */ jsxs7(BusyCard, { ...props, children: [
|
308
|
+
hideElementsConfig?.hideCardHeader ? null : /* @__PURE__ */ jsx12(EmbedCardHeader, {}),
|
309
|
+
plugins && plugins.length || supportsListMode ? /* @__PURE__ */ jsxs7(FlexGrowRow, { columnGap: 2, rowGap: 2, flexWrap: "wrap", pb: 1, children: [
|
310
|
+
plugins && plugins.length > 1 ? /* @__PURE__ */ jsx12(EmbedRenderSelect, {}) : null,
|
311
|
+
supportsListMode ? /* @__PURE__ */ jsx12(ListModeSelectFormControl, {}) : null
|
312
|
+
] }) : null,
|
313
|
+
/* @__PURE__ */ jsx12(CardContent, { sx: { height: "100%" }, children: ActivePlugin ? /* @__PURE__ */ jsx12(ActivePlugin.components.box.detailsBox, { payload, ...supportsListMode && { listMode } }) : null })
|
314
|
+
] });
|
315
|
+
};
|
316
|
+
|
317
|
+
// src/components/embed-card/EmbedPluginCard.tsx
|
318
|
+
import { useTheme } from "@mui/material";
|
319
|
+
|
320
|
+
// src/components/EmbedPlugin.tsx
|
321
|
+
import { ErrorBoundary, ListModeProvider } from "@xyo-network/react-shared";
|
322
|
+
|
323
|
+
// src/components/EmbedResolver.tsx
|
324
|
+
import { LoadResult } from "@xyo-network/react-shared";
|
325
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
326
|
+
var EmbedResolver = ({ children }) => {
|
327
|
+
const { payload, notFound, huriError } = useResolvePayload();
|
328
|
+
return /* @__PURE__ */ jsx13(LoadResult, { searchResult: payload, notFound: !!notFound, error: !!huriError, children });
|
329
|
+
};
|
330
|
+
|
331
|
+
// src/components/validation-alerts/ValidatePayload.tsx
|
332
|
+
import { Alert } from "@mui/material";
|
333
|
+
import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
334
|
+
var ValidatePayloadAlert = ({ children, ...props }) => {
|
335
|
+
const { validPayload, enabled, schema } = useValidatePayload();
|
336
|
+
if (enabled && validPayload === false) {
|
337
|
+
return /* @__PURE__ */ jsxs8(Alert, { severity: "error", title: "Invalid Payload!", ...props, children: [
|
338
|
+
"Payload schema claimed to be ",
|
339
|
+
schema,
|
340
|
+
" but failed to validate."
|
341
|
+
] });
|
342
|
+
}
|
343
|
+
return /* @__PURE__ */ jsx14(Fragment5, { children });
|
344
|
+
};
|
345
|
+
|
346
|
+
// src/components/validation-alerts/ValidatePlugins.tsx
|
347
|
+
import { Alert as Alert2, AlertTitle } from "@mui/material";
|
348
|
+
import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
349
|
+
var ValidatePluginsAlert = ({ children, ...props }) => {
|
350
|
+
const { payload } = useResolvePayload();
|
351
|
+
const { plugins } = useEmbedPluginState();
|
352
|
+
if (payload && plugins?.length === 0) {
|
353
|
+
return /* @__PURE__ */ jsxs9(Alert2, { severity: "warning", ...props, children: [
|
354
|
+
/* @__PURE__ */ jsx15(AlertTitle, { children: "Missing plugins!" }),
|
355
|
+
"Payload found but no plugins were present."
|
356
|
+
] });
|
357
|
+
}
|
358
|
+
return /* @__PURE__ */ jsx15(Fragment6, { children });
|
359
|
+
};
|
360
|
+
|
361
|
+
// src/components/EmbedPlugin.tsx
|
362
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
363
|
+
var EmbedPluginInner = ({
|
364
|
+
validateSchema,
|
365
|
+
plugins = [],
|
366
|
+
huriPayload,
|
367
|
+
refreshTitle = "",
|
368
|
+
timestampLabel = "Data From",
|
369
|
+
hideElementsConfig,
|
370
|
+
embedPluginConfig,
|
371
|
+
onRefresh,
|
372
|
+
children
|
373
|
+
}) => {
|
374
|
+
return /* @__PURE__ */ jsx16(ErrorBoundary, { children: /* @__PURE__ */ jsx16(
|
375
|
+
EmbedPluginProvider,
|
376
|
+
{
|
377
|
+
refreshTitle,
|
378
|
+
timestampLabel,
|
379
|
+
hideElementsConfig,
|
380
|
+
plugins,
|
381
|
+
embedPluginConfig,
|
382
|
+
children: /* @__PURE__ */ jsx16(WithResolvers, { onRefresh, huriPayload, children: /* @__PURE__ */ jsx16(WithValidators, { validateSchema, children: /* @__PURE__ */ jsx16(ListModeProvider, { defaultListMode: embedPluginConfig?.listMode, children }) }) })
|
383
|
+
}
|
384
|
+
) });
|
385
|
+
};
|
386
|
+
var WithResolvers = ({ children, onRefresh, huriPayload }) => {
|
387
|
+
return /* @__PURE__ */ jsx16(RefreshPayloadProvider, { onRefresh, children: /* @__PURE__ */ jsx16(ResolvePayloadProvider, { huriPayload, children: /* @__PURE__ */ jsx16(EmbedResolver, { children }) }) });
|
388
|
+
};
|
389
|
+
var WithValidators = ({ children, validateSchema }) => {
|
390
|
+
return /* @__PURE__ */ jsx16(ValidatePayloadProvider, { enabled: validateSchema, children: /* @__PURE__ */ jsx16(ValidatePluginsAlert, { children: /* @__PURE__ */ jsx16(ValidatePayloadAlert, { children }) }) });
|
391
|
+
};
|
392
|
+
|
393
|
+
// src/components/embed-card/error-handling/EmbedCardApiErrorRenderer.tsx
|
394
|
+
import { ErrorAlert, ErrorRender } from "@xyo-network/react-error";
|
395
|
+
|
396
|
+
// src/components/embed-card/error-handling/EmbedErrorCard.tsx
|
397
|
+
import { Alert as Alert3, AlertTitle as AlertTitle2, Card as Card2, CardContent as CardContent2, Typography } from "@mui/material";
|
398
|
+
import { Fragment as Fragment7, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
399
|
+
var EmbedErrorCard = (props) => {
|
400
|
+
const { alertProps, error, hideErrorDetails = true, children, ...cardProps } = props;
|
401
|
+
const errorProps = { alertProps, error, hideErrorDetails };
|
402
|
+
return /* @__PURE__ */ jsx17(Card2, { ...cardProps, children: /* @__PURE__ */ jsx17(CardContent2, { children: children ?? /* @__PURE__ */ jsx17(DefaultErrorAlert, { ...errorProps }) }) });
|
403
|
+
};
|
404
|
+
var DefaultErrorAlert = ({ alertProps, hideErrorDetails, error }) => {
|
405
|
+
return /* @__PURE__ */ jsxs10(Alert3, { severity: "error", ...alertProps, children: [
|
406
|
+
/* @__PURE__ */ jsx17(AlertTitle2, { children: "Whoops! Something went wrong" }),
|
407
|
+
!hideErrorDetails && error ? /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
408
|
+
/* @__PURE__ */ jsx17(Typography, { variant: "caption", children: "Error: " }),
|
409
|
+
/* @__PURE__ */ jsx17(Typography, { variant: "caption", children: error?.message })
|
410
|
+
] }) : /* @__PURE__ */ jsx17(Typography, { variant: "caption", fontSize: "small", children: "Error Loading Plugin" })
|
411
|
+
] });
|
412
|
+
};
|
413
|
+
|
414
|
+
// src/components/embed-card/error-handling/EmbedCardApiErrorRenderer.tsx
|
415
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
416
|
+
var EmbedCardApiErrorRenderer = ({ xyoError, children, ...props }) => {
|
417
|
+
return /* @__PURE__ */ jsx18(ErrorRender, { error: xyoError, noReAuth: true, noErrorDisplay: true, customError: /* @__PURE__ */ jsx18(CustomApiErrorCard, { xyoError, ...props }), children });
|
418
|
+
};
|
419
|
+
var CustomApiErrorCard = ({ xyoError, ...props }) => {
|
420
|
+
return /* @__PURE__ */ jsx18(EmbedErrorCard, { ...props, children: /* @__PURE__ */ jsx18(ErrorAlert, { error: xyoError }) });
|
421
|
+
};
|
422
|
+
|
423
|
+
// src/components/embed-card/EmbedPluginCard.tsx
|
424
|
+
import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
425
|
+
var ApiEmbedPluginCard = ({ children, ...props }) => {
|
426
|
+
const {
|
427
|
+
validateSchema,
|
428
|
+
plugins = [],
|
429
|
+
huriPayload,
|
430
|
+
refreshTitle = "",
|
431
|
+
timestampLabel = "Data From",
|
432
|
+
hideElementsConfig,
|
433
|
+
embedPluginConfig,
|
434
|
+
onRefresh,
|
435
|
+
...busyCardProps
|
436
|
+
} = props;
|
437
|
+
return /* @__PURE__ */ jsxs11(
|
438
|
+
EmbedPluginInner,
|
439
|
+
{
|
440
|
+
...{
|
441
|
+
embedPluginConfig,
|
442
|
+
hideElementsConfig,
|
443
|
+
huriPayload,
|
444
|
+
onRefresh,
|
445
|
+
plugins,
|
446
|
+
refreshTitle,
|
447
|
+
timestampLabel,
|
448
|
+
validateSchema
|
449
|
+
},
|
450
|
+
children: [
|
451
|
+
/* @__PURE__ */ jsx19(EmbedPluginCardInner, { ...busyCardProps }),
|
452
|
+
children
|
453
|
+
]
|
454
|
+
}
|
455
|
+
);
|
456
|
+
};
|
457
|
+
var EmbedPluginCardInner = (props) => {
|
458
|
+
const { payload, huriError } = useResolvePayload();
|
459
|
+
const { refreshPayload } = useRefreshPayload();
|
460
|
+
const theme = useTheme();
|
461
|
+
return /* @__PURE__ */ jsx19(EmbedCardApiErrorRenderer, { xyoError: huriError, children: /* @__PURE__ */ jsx19(
|
462
|
+
EmbedPluginCard,
|
463
|
+
{
|
464
|
+
elevation: 3,
|
465
|
+
variant: "elevation",
|
466
|
+
busy: Boolean(!refreshPayload && payload),
|
467
|
+
busyVariantProps: { style: { alignItems: "start", paddingTop: theme.spacing(2), zIndex: 2 } },
|
468
|
+
sx: { position: "relative" },
|
469
|
+
...props
|
470
|
+
}
|
471
|
+
) });
|
472
|
+
};
|
473
|
+
var EmbedPlugin = EmbedPluginCard;
|
474
|
+
export {
|
475
|
+
ApiEmbedPluginCard,
|
476
|
+
BusyCard,
|
477
|
+
EmbedCardHeader,
|
478
|
+
EmbedPlugin,
|
479
|
+
EmbedPluginCard,
|
480
|
+
EmbedPluginCardInner
|
481
|
+
};
|
3
482
|
//# sourceMappingURL=index.js.map
|