@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.
Files changed (90) hide show
  1. package/dist/browser/components/EmbedPlugin.js +203 -11
  2. package/dist/browser/components/EmbedPlugin.js.map +1 -1
  3. package/dist/browser/components/EmbedResolver.js +13 -3
  4. package/dist/browser/components/EmbedResolver.js.map +1 -1
  5. package/dist/browser/components/controls/EmbedFormControl.js +3 -2
  6. package/dist/browser/components/controls/EmbedFormControl.js.map +1 -1
  7. package/dist/browser/components/controls/ListModeSelect.js +23 -11
  8. package/dist/browser/components/controls/ListModeSelect.js.map +1 -1
  9. package/dist/browser/components/controls/RenderSelect.js +26 -7
  10. package/dist/browser/components/controls/RenderSelect.js.map +1 -1
  11. package/dist/browser/components/controls/index.js +63 -3
  12. package/dist/browser/components/controls/index.js.map +1 -1
  13. package/dist/browser/components/embed-card/EmbedCardResolver.js +52 -5
  14. package/dist/browser/components/embed-card/EmbedCardResolver.js.map +1 -1
  15. package/dist/browser/components/embed-card/EmbedPluginCard.js +429 -11
  16. package/dist/browser/components/embed-card/EmbedPluginCard.js.map +1 -1
  17. package/dist/browser/components/embed-card/card/BusyCard.js +3 -2
  18. package/dist/browser/components/embed-card/card/BusyCard.js.map +1 -1
  19. package/dist/browser/components/embed-card/card/EmbedCardHeader.js +61 -10
  20. package/dist/browser/components/embed-card/card/EmbedCardHeader.js.map +1 -1
  21. package/dist/browser/components/embed-card/card/EmbedPluginCard.js +168 -13
  22. package/dist/browser/components/embed-card/card/EmbedPluginCard.js.map +1 -1
  23. package/dist/browser/components/embed-card/card/index.js +182 -3
  24. package/dist/browser/components/embed-card/card/index.js.map +1 -1
  25. package/dist/browser/components/embed-card/error-handling/EmbedCardApiErrorRenderer.js +26 -6
  26. package/dist/browser/components/embed-card/error-handling/EmbedCardApiErrorRenderer.js.map +1 -1
  27. package/dist/browser/components/embed-card/error-handling/EmbedErrorCard.js +4 -3
  28. package/dist/browser/components/embed-card/error-handling/EmbedErrorCard.js.map +1 -1
  29. package/dist/browser/components/embed-card/error-handling/index.js +33 -2
  30. package/dist/browser/components/embed-card/error-handling/index.js.map +1 -1
  31. package/dist/browser/components/embed-card/index.js +481 -2
  32. package/dist/browser/components/embed-card/index.js.map +1 -1
  33. package/dist/browser/components/embed-card/menu/EmbedMenu.js +30 -6
  34. package/dist/browser/components/embed-card/menu/EmbedMenu.js.map +1 -1
  35. package/dist/browser/components/embed-card/menu/JsonMenuItem.js +13 -3
  36. package/dist/browser/components/embed-card/menu/JsonMenuItem.js.map +1 -1
  37. package/dist/browser/components/embed-card/menu/index.js +46 -1
  38. package/dist/browser/components/embed-card/menu/index.js.map +1 -1
  39. package/dist/browser/components/embed-plugin-stories/storyPayload.js +2 -1
  40. package/dist/browser/components/embed-plugin-stories/storyPayload.js.map +1 -1
  41. package/dist/browser/components/embed-plugin-stories/storyShared.js +480 -5
  42. package/dist/browser/components/embed-plugin-stories/storyShared.js.map +1 -1
  43. package/dist/browser/components/index.js +482 -2
  44. package/dist/browser/components/index.js.map +1 -1
  45. package/dist/browser/components/validation-alerts/ValidatePayload.js +13 -3
  46. package/dist/browser/components/validation-alerts/ValidatePayload.js.map +1 -1
  47. package/dist/browser/components/validation-alerts/ValidatePlugins.js +21 -3
  48. package/dist/browser/components/validation-alerts/ValidatePlugins.js.map +1 -1
  49. package/dist/browser/components/validation-alerts/index.js +59 -2
  50. package/dist/browser/components/validation-alerts/index.js.map +1 -1
  51. package/dist/browser/contexts/EmbedPluginContext/Context.js +2 -1
  52. package/dist/browser/contexts/EmbedPluginContext/Context.js.map +1 -1
  53. package/dist/browser/contexts/EmbedPluginContext/Provider.js +9 -3
  54. package/dist/browser/contexts/EmbedPluginContext/Provider.js.map +1 -1
  55. package/dist/browser/contexts/EmbedPluginContext/index.js +44 -4
  56. package/dist/browser/contexts/EmbedPluginContext/index.js.map +1 -1
  57. package/dist/browser/contexts/EmbedPluginContext/use.js +8 -2
  58. package/dist/browser/contexts/EmbedPluginContext/use.js.map +1 -1
  59. package/dist/browser/contexts/RefreshPayloadContext/Context.js +2 -1
  60. package/dist/browser/contexts/RefreshPayloadContext/Context.js.map +1 -1
  61. package/dist/browser/contexts/RefreshPayloadContext/Provider.js +9 -3
  62. package/dist/browser/contexts/RefreshPayloadContext/Provider.js.map +1 -1
  63. package/dist/browser/contexts/RefreshPayloadContext/index.js +21 -3
  64. package/dist/browser/contexts/RefreshPayloadContext/index.js.map +1 -1
  65. package/dist/browser/contexts/RefreshPayloadContext/use.js +8 -2
  66. package/dist/browser/contexts/RefreshPayloadContext/use.js.map +1 -1
  67. package/dist/browser/contexts/ResolvePayloadContext/Context.js +2 -1
  68. package/dist/browser/contexts/ResolvePayloadContext/Context.js.map +1 -1
  69. package/dist/browser/contexts/ResolvePayloadContext/Provider.js +17 -4
  70. package/dist/browser/contexts/ResolvePayloadContext/Provider.js.map +1 -1
  71. package/dist/browser/contexts/ResolvePayloadContext/index.js +72 -4
  72. package/dist/browser/contexts/ResolvePayloadContext/index.js.map +1 -1
  73. package/dist/browser/contexts/ResolvePayloadContext/use.js +8 -2
  74. package/dist/browser/contexts/ResolvePayloadContext/use.js.map +1 -1
  75. package/dist/browser/contexts/ValidatePayloadContext/Context.js +2 -1
  76. package/dist/browser/contexts/ValidatePayloadContext/Context.js.map +1 -1
  77. package/dist/browser/contexts/ValidatePayloadContext/Provider.js +17 -4
  78. package/dist/browser/contexts/ValidatePayloadContext/Provider.js.map +1 -1
  79. package/dist/browser/contexts/ValidatePayloadContext/index.js +49 -3
  80. package/dist/browser/contexts/ValidatePayloadContext/index.js.map +1 -1
  81. package/dist/browser/contexts/ValidatePayloadContext/use.js +8 -2
  82. package/dist/browser/contexts/ValidatePayloadContext/use.js.map +1 -1
  83. package/dist/browser/contexts/index.js +165 -4
  84. package/dist/browser/contexts/index.js.map +1 -1
  85. package/dist/browser/index.js +492 -3
  86. package/dist/browser/index.js.map +1 -1
  87. package/dist/browser/types/index.js +0 -1
  88. package/dist/browser/types/index.js.map +1 -1
  89. package/dist/docs.json +109 -109
  90. package/package.json +15 -15
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/validation-alerts/ValidatePlugins.tsx"],"sourcesContent":["import { Alert, AlertProps, AlertTitle } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\nimport { useEmbedPluginState, useResolvePayload } from '../../contexts'\n\nexport const ValidatePluginsAlert: React.FC<WithChildren<AlertProps>> = ({ children, ...props }) => {\n const { payload } = useResolvePayload()\n const { plugins } = useEmbedPluginState()\n\n if (payload && plugins?.length === 0) {\n return (\n <Alert severity=\"warning\" {...props}>\n <AlertTitle>Missing plugins!</AlertTitle>Payload found but no plugins were present.\n </Alert>\n )\n }\n\n return <>{children}</>\n}\n"],"mappings":"AAWM,SAMG,UALD,KADF;AAXN,SAAS,OAAmB,kBAAkB;AAG9C,SAAS,qBAAqB,yBAAyB;AAEhD,MAAM,uBAA2D,CAAC,EAAE,UAAU,GAAG,MAAM,MAAM;AAClG,QAAM,EAAE,QAAQ,IAAI,kBAAkB;AACtC,QAAM,EAAE,QAAQ,IAAI,oBAAoB;AAExC,MAAI,WAAW,SAAS,WAAW,GAAG;AACpC,WACE,qBAAC,SAAM,UAAS,WAAW,GAAG,OAC5B;AAAA,0BAAC,cAAW,8BAAgB;AAAA,MAAa;AAAA,OAC3C;AAAA,EAEJ;AAEA,SAAO,gCAAG,UAAS;AACrB;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/validation-alerts/ValidatePlugins.tsx","../../../../src/contexts/EmbedPluginContext/Context.tsx","../../../../src/contexts/EmbedPluginContext/use.tsx","../../../../src/contexts/ResolvePayloadContext/Context.ts","../../../../src/contexts/ResolvePayloadContext/use.tsx"],"sourcesContent":["import { Alert, AlertProps, AlertTitle } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\nimport { useEmbedPluginState, useResolvePayload } from '../../contexts'\n\nexport const ValidatePluginsAlert: React.FC<WithChildren<AlertProps>> = ({ children, ...props }) => {\n const { payload } = useResolvePayload()\n const { plugins } = useEmbedPluginState()\n\n if (payload && plugins?.length === 0) {\n return (\n <Alert severity=\"warning\" {...props}>\n <AlertTitle>Missing plugins!</AlertTitle>Payload found but no plugins were present.\n </Alert>\n )\n }\n\n return <>{children}</>\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginState } from './State'\n\nexport const EmbedPluginContext = createContextEx<EmbedPluginState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginContext } from './Context'\n\nexport const useEmbedPluginState = () => useContextEx(EmbedPluginContext, 'EmbedPlugin', true)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadState } from './State'\n\nexport const ResolvePayloadContext = createContextEx<ResolvePayloadState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadContext } from './Context'\n\nexport const useResolvePayload = () => useContextEx(ResolvePayloadContext, 'ResolvePayload', true)\n"],"mappings":";AAAA,SAAS,OAAmB,kBAAkB;;;ACA9C,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ACJpE,SAAS,oBAAoB;AAItB,IAAM,sBAAsB,MAAM,aAAa,oBAAoB,eAAe,IAAI;;;ACJ7F,SAAS,mBAAAA,wBAAuB;AAIzB,IAAM,wBAAwBA,iBAAqC;;;ACJ1E,SAAS,gBAAAC,qBAAoB;AAItB,IAAM,oBAAoB,MAAMC,cAAa,uBAAuB,kBAAkB,IAAI;;;AJO3F,SAMG,UALD,KADF;AANC,IAAM,uBAA2D,CAAC,EAAE,UAAU,GAAG,MAAM,MAAM;AAClG,QAAM,EAAE,QAAQ,IAAI,kBAAkB;AACtC,QAAM,EAAE,QAAQ,IAAI,oBAAoB;AAExC,MAAI,WAAW,SAAS,WAAW,GAAG;AACpC,WACE,qBAAC,SAAM,UAAS,WAAW,GAAG,OAC5B;AAAA,0BAAC,cAAW,8BAAgB;AAAA,MAAa;AAAA,OAC3C;AAAA,EAEJ;AAEA,SAAO,gCAAG,UAAS;AACrB;","names":["createContextEx","useContextEx","useContextEx"]}
@@ -1,3 +1,60 @@
1
- export * from "./ValidatePayload";
2
- export * from "./ValidatePlugins";
1
+ // src/components/validation-alerts/ValidatePayload.tsx
2
+ import { Alert } from "@mui/material";
3
+
4
+ // src/contexts/EmbedPluginContext/Context.tsx
5
+ import { createContextEx } from "@xyo-network/react-shared";
6
+ var EmbedPluginContext = createContextEx();
7
+
8
+ // src/contexts/EmbedPluginContext/use.tsx
9
+ import { useContextEx } from "@xyo-network/react-shared";
10
+ var useEmbedPluginState = () => useContextEx(EmbedPluginContext, "EmbedPlugin", true);
11
+
12
+ // src/contexts/ResolvePayloadContext/Context.ts
13
+ import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
14
+ var ResolvePayloadContext = createContextEx2();
15
+
16
+ // src/contexts/ResolvePayloadContext/use.tsx
17
+ import { useContextEx as useContextEx2 } from "@xyo-network/react-shared";
18
+ var useResolvePayload = () => useContextEx2(ResolvePayloadContext, "ResolvePayload", true);
19
+
20
+ // src/contexts/ValidatePayloadContext/Context.ts
21
+ import { createContextEx as createContextEx3 } from "@xyo-network/react-shared";
22
+ var ValidatePayloadContext = createContextEx3();
23
+
24
+ // src/contexts/ValidatePayloadContext/use.tsx
25
+ import { useContextEx as useContextEx3 } from "@xyo-network/react-shared";
26
+ var useValidatePayload = () => useContextEx3(ValidatePayloadContext, "ValidateSchema", true);
27
+
28
+ // src/components/validation-alerts/ValidatePayload.tsx
29
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
30
+ var ValidatePayloadAlert = ({ children, ...props }) => {
31
+ const { validPayload, enabled, schema } = useValidatePayload();
32
+ if (enabled && validPayload === false) {
33
+ return /* @__PURE__ */ jsxs(Alert, { severity: "error", title: "Invalid Payload!", ...props, children: [
34
+ "Payload schema claimed to be ",
35
+ schema,
36
+ " but failed to validate."
37
+ ] });
38
+ }
39
+ return /* @__PURE__ */ jsx(Fragment, { children });
40
+ };
41
+
42
+ // src/components/validation-alerts/ValidatePlugins.tsx
43
+ import { Alert as Alert2, AlertTitle } from "@mui/material";
44
+ import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
45
+ var ValidatePluginsAlert = ({ children, ...props }) => {
46
+ const { payload } = useResolvePayload();
47
+ const { plugins } = useEmbedPluginState();
48
+ if (payload && plugins?.length === 0) {
49
+ return /* @__PURE__ */ jsxs2(Alert2, { severity: "warning", ...props, children: [
50
+ /* @__PURE__ */ jsx2(AlertTitle, { children: "Missing plugins!" }),
51
+ "Payload found but no plugins were present."
52
+ ] });
53
+ }
54
+ return /* @__PURE__ */ jsx2(Fragment2, { children });
55
+ };
56
+ export {
57
+ ValidatePayloadAlert,
58
+ ValidatePluginsAlert
59
+ };
3
60
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/validation-alerts/index.ts"],"sourcesContent":["export * from './ValidatePayload'\nexport * from './ValidatePlugins'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/validation-alerts/ValidatePayload.tsx","../../../../src/contexts/EmbedPluginContext/Context.tsx","../../../../src/contexts/EmbedPluginContext/use.tsx","../../../../src/contexts/ResolvePayloadContext/Context.ts","../../../../src/contexts/ResolvePayloadContext/use.tsx","../../../../src/contexts/ValidatePayloadContext/Context.ts","../../../../src/contexts/ValidatePayloadContext/use.tsx","../../../../src/components/validation-alerts/ValidatePlugins.tsx"],"sourcesContent":["import { Alert, AlertProps } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\nimport { useValidatePayload } from '../../contexts'\n\nexport const ValidatePayloadAlert: React.FC<WithChildren<AlertProps>> = ({ children, ...props }) => {\n const { validPayload, enabled, schema } = useValidatePayload()\n\n if (enabled && validPayload === false) {\n return (\n <Alert severity=\"error\" title=\"Invalid Payload!\" {...props}>\n Payload schema claimed to be {schema} but failed to validate.\n </Alert>\n )\n }\n\n return <>{children}</>\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginState } from './State'\n\nexport const EmbedPluginContext = createContextEx<EmbedPluginState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginContext } from './Context'\n\nexport const useEmbedPluginState = () => useContextEx(EmbedPluginContext, 'EmbedPlugin', true)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadState } from './State'\n\nexport const ResolvePayloadContext = createContextEx<ResolvePayloadState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadContext } from './Context'\n\nexport const useResolvePayload = () => useContextEx(ResolvePayloadContext, 'ResolvePayload', true)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ValidatePayloadState } from './State'\n\nexport const ValidatePayloadContext = createContextEx<ValidatePayloadState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { ValidatePayloadContext } from './Context'\n\nexport const useValidatePayload = () => useContextEx(ValidatePayloadContext, 'ValidateSchema', true)\n","import { Alert, AlertProps, AlertTitle } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\nimport { useEmbedPluginState, useResolvePayload } from '../../contexts'\n\nexport const ValidatePluginsAlert: React.FC<WithChildren<AlertProps>> = ({ children, ...props }) => {\n const { payload } = useResolvePayload()\n const { plugins } = useEmbedPluginState()\n\n if (payload && plugins?.length === 0) {\n return (\n <Alert severity=\"warning\" {...props}>\n <AlertTitle>Missing plugins!</AlertTitle>Payload found but no plugins were present.\n </Alert>\n )\n }\n\n return <>{children}</>\n}\n"],"mappings":";AAAA,SAAS,aAAyB;;;ACAlC,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ACJpE,SAAS,oBAAoB;AAItB,IAAM,sBAAsB,MAAM,aAAa,oBAAoB,eAAe,IAAI;;;ACJ7F,SAAS,mBAAAA,wBAAuB;AAIzB,IAAM,wBAAwBA,iBAAqC;;;ACJ1E,SAAS,gBAAAC,qBAAoB;AAItB,IAAM,oBAAoB,MAAMC,cAAa,uBAAuB,kBAAkB,IAAI;;;ACJjG,SAAS,mBAAAC,wBAAuB;AAIzB,IAAM,yBAAyBA,iBAAsC;;;ACJ5E,SAAS,gBAAAC,qBAAoB;AAItB,IAAM,qBAAqB,MAAMC,cAAa,wBAAwB,kBAAkB,IAAI;;;ANM7F,SAMG,eANH;AALC,IAAM,uBAA2D,CAAC,EAAE,UAAU,GAAG,MAAM,MAAM;AAClG,QAAM,EAAE,cAAc,SAAS,OAAO,IAAI,mBAAmB;AAE7D,MAAI,WAAW,iBAAiB,OAAO;AACrC,WACE,qBAAC,SAAM,UAAS,SAAQ,OAAM,oBAAoB,GAAG,OAAO;AAAA;AAAA,MAC5B;AAAA,MAAO;AAAA,OACvC;AAAA,EAEJ;AAEA,SAAO,gCAAG,UAAS;AACrB;;;AOjBA,SAAS,SAAAC,QAAmB,kBAAkB;AAWxC,SAMG,YAAAC,WALD,OAAAC,MADF,QAAAC,aAAA;AANC,IAAM,uBAA2D,CAAC,EAAE,UAAU,GAAG,MAAM,MAAM;AAClG,QAAM,EAAE,QAAQ,IAAI,kBAAkB;AACtC,QAAM,EAAE,QAAQ,IAAI,oBAAoB;AAExC,MAAI,WAAW,SAAS,WAAW,GAAG;AACpC,WACE,gBAAAA,MAACC,QAAA,EAAM,UAAS,WAAW,GAAG,OAC5B;AAAA,sBAAAF,KAAC,cAAW,8BAAgB;AAAA,MAAa;AAAA,OAC3C;AAAA,EAEJ;AAEA,SAAO,gBAAAA,KAAAD,WAAA,EAAG,UAAS;AACrB;","names":["createContextEx","useContextEx","useContextEx","createContextEx","useContextEx","useContextEx","Alert","Fragment","jsx","jsxs","Alert"]}
@@ -1,5 +1,6 @@
1
+ // src/contexts/EmbedPluginContext/Context.tsx
1
2
  import { createContextEx } from "@xyo-network/react-shared";
2
- const EmbedPluginContext = createContextEx();
3
+ var EmbedPluginContext = createContextEx();
3
4
  export {
4
5
  EmbedPluginContext
5
6
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/EmbedPluginContext/Context.tsx"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginState } from './State'\n\nexport const EmbedPluginContext = createContextEx<EmbedPluginState>()\n"],"mappings":"AAAA,SAAS,uBAAuB;AAIzB,MAAM,qBAAqB,gBAAkC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/contexts/EmbedPluginContext/Context.tsx"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginState } from './State'\n\nexport const EmbedPluginContext = createContextEx<EmbedPluginState>()\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;","names":[]}
@@ -1,7 +1,13 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ // src/contexts/EmbedPluginContext/Provider.tsx
2
2
  import { useEffect, useState } from "react";
3
- import { EmbedPluginContext } from "./Context";
4
- const EmbedPluginProvider = ({
3
+
4
+ // src/contexts/EmbedPluginContext/Context.tsx
5
+ import { createContextEx } from "@xyo-network/react-shared";
6
+ var EmbedPluginContext = createContextEx();
7
+
8
+ // src/contexts/EmbedPluginContext/Provider.tsx
9
+ import { jsx } from "react/jsx-runtime";
10
+ var EmbedPluginProvider = ({
5
11
  children,
6
12
  refreshTitle,
7
13
  timestampLabel,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/EmbedPluginContext/Provider.tsx"],"sourcesContent":["import { WithChildren } from '@xylabs/react-shared'\nimport { PayloadRenderPlugin } from '@xyo-network/react-payload-plugin'\nimport { useEffect, useState } from 'react'\n\nimport { EmbedPluginContext } from './Context'\nimport { EmbedPluginBase } from './State'\n\nexport type EmbedPluginProviderProps = EmbedPluginBase\n\n/** Expose passed embed plugin props via context */\nexport const EmbedPluginProvider: React.FC<WithChildren<EmbedPluginProviderProps>> = ({\n children,\n refreshTitle,\n timestampLabel,\n hideElementsConfig,\n plugins,\n embedPluginConfig,\n}) => {\n const [activePlugin, setActivePlugin] = useState<PayloadRenderPlugin | undefined>(plugins ? plugins[0] : undefined)\n\n useEffect(() => {\n setActivePlugin(plugins ? plugins[0] : undefined)\n }, [plugins])\n\n return (\n <EmbedPluginContext.Provider\n value={{\n activePlugin,\n embedPluginConfig,\n hideElementsConfig,\n provided: true,\n refreshTitle,\n setActivePlugin,\n timestampLabel,\n }}\n >\n {children}\n </EmbedPluginContext.Provider>\n )\n}\n"],"mappings":"AAyBI;AAvBJ,SAAS,WAAW,gBAAgB;AAEpC,SAAS,0BAA0B;AAM5B,MAAM,sBAAwE,CAAC;AAAA,EACpF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,cAAc,eAAe,IAAI,SAA0C,UAAU,QAAQ,CAAC,IAAI,MAAS;AAElH,YAAU,MAAM;AACd,oBAAgB,UAAU,QAAQ,CAAC,IAAI,MAAS;AAAA,EAClD,GAAG,CAAC,OAAO,CAAC;AAEZ,SACE;AAAA,IAAC,mBAAmB;AAAA,IAAnB;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/contexts/EmbedPluginContext/Provider.tsx","../../../../src/contexts/EmbedPluginContext/Context.tsx"],"sourcesContent":["import { WithChildren } from '@xylabs/react-shared'\nimport { PayloadRenderPlugin } from '@xyo-network/react-payload-plugin'\nimport { useEffect, useState } from 'react'\n\nimport { EmbedPluginContext } from './Context'\nimport { EmbedPluginBase } from './State'\n\nexport type EmbedPluginProviderProps = EmbedPluginBase\n\n/** Expose passed embed plugin props via context */\nexport const EmbedPluginProvider: React.FC<WithChildren<EmbedPluginProviderProps>> = ({\n children,\n refreshTitle,\n timestampLabel,\n hideElementsConfig,\n plugins,\n embedPluginConfig,\n}) => {\n const [activePlugin, setActivePlugin] = useState<PayloadRenderPlugin | undefined>(plugins ? plugins[0] : undefined)\n\n useEffect(() => {\n setActivePlugin(plugins ? plugins[0] : undefined)\n }, [plugins])\n\n return (\n <EmbedPluginContext.Provider\n value={{\n activePlugin,\n embedPluginConfig,\n hideElementsConfig,\n provided: true,\n refreshTitle,\n setActivePlugin,\n timestampLabel,\n }}\n >\n {children}\n </EmbedPluginContext.Provider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginState } from './State'\n\nexport const EmbedPluginContext = createContextEx<EmbedPluginState>()\n"],"mappings":";AAEA,SAAS,WAAW,gBAAgB;;;ACFpC,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ADqBhE;AAfG,IAAM,sBAAwE,CAAC;AAAA,EACpF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,cAAc,eAAe,IAAI,SAA0C,UAAU,QAAQ,CAAC,IAAI,MAAS;AAElH,YAAU,MAAM;AACd,oBAAgB,UAAU,QAAQ,CAAC,IAAI,MAAS;AAAA,EAClD,GAAG,CAAC,OAAO,CAAC;AAEZ,SACE;AAAA,IAAC,mBAAmB;AAAA,IAAnB;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -1,5 +1,45 @@
1
- export * from "./Context";
2
- export * from "./Provider";
3
- export * from "./State";
4
- export * from "./use";
1
+ // src/contexts/EmbedPluginContext/Context.tsx
2
+ import { createContextEx } from "@xyo-network/react-shared";
3
+ var EmbedPluginContext = createContextEx();
4
+
5
+ // src/contexts/EmbedPluginContext/Provider.tsx
6
+ import { useEffect, useState } from "react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ var EmbedPluginProvider = ({
9
+ children,
10
+ refreshTitle,
11
+ timestampLabel,
12
+ hideElementsConfig,
13
+ plugins,
14
+ embedPluginConfig
15
+ }) => {
16
+ const [activePlugin, setActivePlugin] = useState(plugins ? plugins[0] : void 0);
17
+ useEffect(() => {
18
+ setActivePlugin(plugins ? plugins[0] : void 0);
19
+ }, [plugins]);
20
+ return /* @__PURE__ */ jsx(
21
+ EmbedPluginContext.Provider,
22
+ {
23
+ value: {
24
+ activePlugin,
25
+ embedPluginConfig,
26
+ hideElementsConfig,
27
+ provided: true,
28
+ refreshTitle,
29
+ setActivePlugin,
30
+ timestampLabel
31
+ },
32
+ children
33
+ }
34
+ );
35
+ };
36
+
37
+ // src/contexts/EmbedPluginContext/use.tsx
38
+ import { useContextEx } from "@xyo-network/react-shared";
39
+ var useEmbedPluginState = () => useContextEx(EmbedPluginContext, "EmbedPlugin", true);
40
+ export {
41
+ EmbedPluginContext,
42
+ EmbedPluginProvider,
43
+ useEmbedPluginState
44
+ };
5
45
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/EmbedPluginContext/index.ts"],"sourcesContent":["export * from './Context'\nexport * from './Provider'\nexport * from './State'\nexport * from './use'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../../src/contexts/EmbedPluginContext/Context.tsx","../../../../src/contexts/EmbedPluginContext/Provider.tsx","../../../../src/contexts/EmbedPluginContext/use.tsx"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginState } from './State'\n\nexport const EmbedPluginContext = createContextEx<EmbedPluginState>()\n","import { WithChildren } from '@xylabs/react-shared'\nimport { PayloadRenderPlugin } from '@xyo-network/react-payload-plugin'\nimport { useEffect, useState } from 'react'\n\nimport { EmbedPluginContext } from './Context'\nimport { EmbedPluginBase } from './State'\n\nexport type EmbedPluginProviderProps = EmbedPluginBase\n\n/** Expose passed embed plugin props via context */\nexport const EmbedPluginProvider: React.FC<WithChildren<EmbedPluginProviderProps>> = ({\n children,\n refreshTitle,\n timestampLabel,\n hideElementsConfig,\n plugins,\n embedPluginConfig,\n}) => {\n const [activePlugin, setActivePlugin] = useState<PayloadRenderPlugin | undefined>(plugins ? plugins[0] : undefined)\n\n useEffect(() => {\n setActivePlugin(plugins ? plugins[0] : undefined)\n }, [plugins])\n\n return (\n <EmbedPluginContext.Provider\n value={{\n activePlugin,\n embedPluginConfig,\n hideElementsConfig,\n provided: true,\n refreshTitle,\n setActivePlugin,\n timestampLabel,\n }}\n >\n {children}\n </EmbedPluginContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginContext } from './Context'\n\nexport const useEmbedPluginState = () => useContextEx(EmbedPluginContext, 'EmbedPlugin', true)\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ACFpE,SAAS,WAAW,gBAAgB;AAuBhC;AAfG,IAAM,sBAAwE,CAAC;AAAA,EACpF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,cAAc,eAAe,IAAI,SAA0C,UAAU,QAAQ,CAAC,IAAI,MAAS;AAElH,YAAU,MAAM;AACd,oBAAgB,UAAU,QAAQ,CAAC,IAAI,MAAS;AAAA,EAClD,GAAG,CAAC,OAAO,CAAC;AAEZ,SACE;AAAA,IAAC,mBAAmB;AAAA,IAAnB;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;;;ACvCA,SAAS,oBAAoB;AAItB,IAAM,sBAAsB,MAAM,aAAa,oBAAoB,eAAe,IAAI;","names":[]}
@@ -1,6 +1,12 @@
1
+ // src/contexts/EmbedPluginContext/use.tsx
1
2
  import { useContextEx } from "@xyo-network/react-shared";
2
- import { EmbedPluginContext } from "./Context";
3
- const useEmbedPluginState = () => useContextEx(EmbedPluginContext, "EmbedPlugin", true);
3
+
4
+ // src/contexts/EmbedPluginContext/Context.tsx
5
+ import { createContextEx } from "@xyo-network/react-shared";
6
+ var EmbedPluginContext = createContextEx();
7
+
8
+ // src/contexts/EmbedPluginContext/use.tsx
9
+ var useEmbedPluginState = () => useContextEx(EmbedPluginContext, "EmbedPlugin", true);
4
10
  export {
5
11
  useEmbedPluginState
6
12
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/EmbedPluginContext/use.tsx"],"sourcesContent":["import { useContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginContext } from './Context'\n\nexport const useEmbedPluginState = () => useContextEx(EmbedPluginContext, 'EmbedPlugin', true)\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,SAAS,0BAA0B;AAE5B,MAAM,sBAAsB,MAAM,aAAa,oBAAoB,eAAe,IAAI;","names":[]}
1
+ {"version":3,"sources":["../../../../src/contexts/EmbedPluginContext/use.tsx","../../../../src/contexts/EmbedPluginContext/Context.tsx"],"sourcesContent":["import { useContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginContext } from './Context'\n\nexport const useEmbedPluginState = () => useContextEx(EmbedPluginContext, 'EmbedPlugin', true)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginState } from './State'\n\nexport const EmbedPluginContext = createContextEx<EmbedPluginState>()\n"],"mappings":";AAAA,SAAS,oBAAoB;;;ACA7B,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ADA7D,IAAM,sBAAsB,MAAM,aAAa,oBAAoB,eAAe,IAAI;","names":[]}
@@ -1,5 +1,6 @@
1
+ // src/contexts/RefreshPayloadContext/Context.tsx
1
2
  import { createContextEx } from "@xyo-network/react-shared";
2
- const RefreshPayloadContext = createContextEx();
3
+ var RefreshPayloadContext = createContextEx();
3
4
  export {
4
5
  RefreshPayloadContext
5
6
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/RefreshPayloadContext/Context.tsx"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { RefreshPayloadState } from './State'\n\nexport const RefreshPayloadContext = createContextEx<RefreshPayloadState>()\n"],"mappings":"AAAA,SAAS,uBAAuB;AAIzB,MAAM,wBAAwB,gBAAqC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/contexts/RefreshPayloadContext/Context.tsx"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { RefreshPayloadState } from './State'\n\nexport const RefreshPayloadContext = createContextEx<RefreshPayloadState>()\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;","names":[]}
@@ -1,7 +1,13 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ // src/contexts/RefreshPayloadContext/Provider.tsx
2
2
  import { useState } from "react";
3
- import { RefreshPayloadContext } from "./Context";
4
- const RefreshPayloadProvider = ({ children, onRefresh, refreshPayload }) => {
3
+
4
+ // src/contexts/RefreshPayloadContext/Context.tsx
5
+ import { createContextEx } from "@xyo-network/react-shared";
6
+ var RefreshPayloadContext = createContextEx();
7
+
8
+ // src/contexts/RefreshPayloadContext/Provider.tsx
9
+ import { jsx } from "react/jsx-runtime";
10
+ var RefreshPayloadProvider = ({ children, onRefresh, refreshPayload }) => {
5
11
  const [localRefreshPayload, setRefreshPayload] = useState(refreshPayload);
6
12
  return /* @__PURE__ */ jsx(RefreshPayloadContext.Provider, { value: { onRefresh, provided: true, refreshPayload: localRefreshPayload, setRefreshPayload }, children });
7
13
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/RefreshPayloadContext/Provider.tsx"],"sourcesContent":["import { WithChildren } from '@xylabs/react-shared'\nimport { useState } from 'react'\n\nimport { RefreshPayloadContext } from './Context'\n\nexport interface RefreshPayloadProps {\n onRefresh?: () => void\n refreshPayload?: boolean\n}\n\nexport const RefreshPayloadProvider: React.FC<WithChildren<RefreshPayloadProps>> = ({ children, onRefresh, refreshPayload }) => {\n const [localRefreshPayload, setRefreshPayload] = useState(refreshPayload)\n\n return (\n <RefreshPayloadContext.Provider value={{ onRefresh, provided: true, refreshPayload: localRefreshPayload, setRefreshPayload }}>\n {children}\n </RefreshPayloadContext.Provider>\n )\n}\n"],"mappings":"AAcI;AAbJ,SAAS,gBAAgB;AAEzB,SAAS,6BAA6B;AAO/B,MAAM,yBAAsE,CAAC,EAAE,UAAU,WAAW,eAAe,MAAM;AAC9H,QAAM,CAAC,qBAAqB,iBAAiB,IAAI,SAAS,cAAc;AAExE,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,WAAW,UAAU,MAAM,gBAAgB,qBAAqB,kBAAkB,GACxH,UACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/contexts/RefreshPayloadContext/Provider.tsx","../../../../src/contexts/RefreshPayloadContext/Context.tsx"],"sourcesContent":["import { WithChildren } from '@xylabs/react-shared'\nimport { useState } from 'react'\n\nimport { RefreshPayloadContext } from './Context'\n\nexport interface RefreshPayloadProps {\n onRefresh?: () => void\n refreshPayload?: boolean\n}\n\nexport const RefreshPayloadProvider: React.FC<WithChildren<RefreshPayloadProps>> = ({ children, onRefresh, refreshPayload }) => {\n const [localRefreshPayload, setRefreshPayload] = useState(refreshPayload)\n\n return (\n <RefreshPayloadContext.Provider value={{ onRefresh, provided: true, refreshPayload: localRefreshPayload, setRefreshPayload }}>\n {children}\n </RefreshPayloadContext.Provider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { RefreshPayloadState } from './State'\n\nexport const RefreshPayloadContext = createContextEx<RefreshPayloadState>()\n"],"mappings":";AACA,SAAS,gBAAgB;;;ACDzB,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;;;ADUtE;AAJG,IAAM,yBAAsE,CAAC,EAAE,UAAU,WAAW,eAAe,MAAM;AAC9H,QAAM,CAAC,qBAAqB,iBAAiB,IAAI,SAAS,cAAc;AAExE,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,WAAW,UAAU,MAAM,gBAAgB,qBAAqB,kBAAkB,GACxH,UACH;AAEJ;","names":[]}
@@ -1,4 +1,22 @@
1
- export * from "./Provider";
2
- export * from "./State";
3
- export * from "./use";
1
+ // src/contexts/RefreshPayloadContext/Provider.tsx
2
+ import { useState } from "react";
3
+
4
+ // src/contexts/RefreshPayloadContext/Context.tsx
5
+ import { createContextEx } from "@xyo-network/react-shared";
6
+ var RefreshPayloadContext = createContextEx();
7
+
8
+ // src/contexts/RefreshPayloadContext/Provider.tsx
9
+ import { jsx } from "react/jsx-runtime";
10
+ var RefreshPayloadProvider = ({ children, onRefresh, refreshPayload }) => {
11
+ const [localRefreshPayload, setRefreshPayload] = useState(refreshPayload);
12
+ return /* @__PURE__ */ jsx(RefreshPayloadContext.Provider, { value: { onRefresh, provided: true, refreshPayload: localRefreshPayload, setRefreshPayload }, children });
13
+ };
14
+
15
+ // src/contexts/RefreshPayloadContext/use.tsx
16
+ import { useContextEx } from "@xyo-network/react-shared";
17
+ var useRefreshPayload = () => useContextEx(RefreshPayloadContext, "RefreshPayload", true);
18
+ export {
19
+ RefreshPayloadProvider,
20
+ useRefreshPayload
21
+ };
4
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/RefreshPayloadContext/index.ts"],"sourcesContent":["export * from './Provider'\nexport * from './State'\nexport * from './use'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../../src/contexts/RefreshPayloadContext/Provider.tsx","../../../../src/contexts/RefreshPayloadContext/Context.tsx","../../../../src/contexts/RefreshPayloadContext/use.tsx"],"sourcesContent":["import { WithChildren } from '@xylabs/react-shared'\nimport { useState } from 'react'\n\nimport { RefreshPayloadContext } from './Context'\n\nexport interface RefreshPayloadProps {\n onRefresh?: () => void\n refreshPayload?: boolean\n}\n\nexport const RefreshPayloadProvider: React.FC<WithChildren<RefreshPayloadProps>> = ({ children, onRefresh, refreshPayload }) => {\n const [localRefreshPayload, setRefreshPayload] = useState(refreshPayload)\n\n return (\n <RefreshPayloadContext.Provider value={{ onRefresh, provided: true, refreshPayload: localRefreshPayload, setRefreshPayload }}>\n {children}\n </RefreshPayloadContext.Provider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { RefreshPayloadState } from './State'\n\nexport const RefreshPayloadContext = createContextEx<RefreshPayloadState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { RefreshPayloadContext } from './Context'\n\nexport const useRefreshPayload = () => useContextEx(RefreshPayloadContext, 'RefreshPayload', true)\n"],"mappings":";AACA,SAAS,gBAAgB;;;ACDzB,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;;;ADUtE;AAJG,IAAM,yBAAsE,CAAC,EAAE,UAAU,WAAW,eAAe,MAAM;AAC9H,QAAM,CAAC,qBAAqB,iBAAiB,IAAI,SAAS,cAAc;AAExE,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,WAAW,UAAU,MAAM,gBAAgB,qBAAqB,kBAAkB,GACxH,UACH;AAEJ;;;AElBA,SAAS,oBAAoB;AAItB,IAAM,oBAAoB,MAAM,aAAa,uBAAuB,kBAAkB,IAAI;","names":[]}
@@ -1,6 +1,12 @@
1
+ // src/contexts/RefreshPayloadContext/use.tsx
1
2
  import { useContextEx } from "@xyo-network/react-shared";
2
- import { RefreshPayloadContext } from "./Context";
3
- const useRefreshPayload = () => useContextEx(RefreshPayloadContext, "RefreshPayload", true);
3
+
4
+ // src/contexts/RefreshPayloadContext/Context.tsx
5
+ import { createContextEx } from "@xyo-network/react-shared";
6
+ var RefreshPayloadContext = createContextEx();
7
+
8
+ // src/contexts/RefreshPayloadContext/use.tsx
9
+ var useRefreshPayload = () => useContextEx(RefreshPayloadContext, "RefreshPayload", true);
4
10
  export {
5
11
  useRefreshPayload
6
12
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/RefreshPayloadContext/use.tsx"],"sourcesContent":["import { useContextEx } from '@xyo-network/react-shared'\n\nimport { RefreshPayloadContext } from './Context'\n\nexport const useRefreshPayload = () => useContextEx(RefreshPayloadContext, 'RefreshPayload', true)\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,SAAS,6BAA6B;AAE/B,MAAM,oBAAoB,MAAM,aAAa,uBAAuB,kBAAkB,IAAI;","names":[]}
1
+ {"version":3,"sources":["../../../../src/contexts/RefreshPayloadContext/use.tsx","../../../../src/contexts/RefreshPayloadContext/Context.tsx"],"sourcesContent":["import { useContextEx } from '@xyo-network/react-shared'\n\nimport { RefreshPayloadContext } from './Context'\n\nexport const useRefreshPayload = () => useContextEx(RefreshPayloadContext, 'RefreshPayload', true)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { RefreshPayloadState } from './State'\n\nexport const RefreshPayloadContext = createContextEx<RefreshPayloadState>()\n"],"mappings":";AAAA,SAAS,oBAAoB;;;ACA7B,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;;;ADAnE,IAAM,oBAAoB,MAAM,aAAa,uBAAuB,kBAAkB,IAAI;","names":[]}
@@ -1,5 +1,6 @@
1
+ // src/contexts/ResolvePayloadContext/Context.ts
1
2
  import { createContextEx } from "@xyo-network/react-shared";
2
- const ResolvePayloadContext = createContextEx();
3
+ var ResolvePayloadContext = createContextEx();
3
4
  export {
4
5
  ResolvePayloadContext
5
6
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/ResolvePayloadContext/Context.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadState } from './State'\n\nexport const ResolvePayloadContext = createContextEx<ResolvePayloadState>()\n"],"mappings":"AAAA,SAAS,uBAAuB;AAIzB,MAAM,wBAAwB,gBAAqC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/contexts/ResolvePayloadContext/Context.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadState } from './State'\n\nexport const ResolvePayloadContext = createContextEx<ResolvePayloadState>()\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;","names":[]}
@@ -1,12 +1,25 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ // src/contexts/ResolvePayloadContext/Provider.tsx
2
2
  import { delay } from "@xylabs/delay";
3
3
  import { useAsyncEffect } from "@xylabs/react-async-effect";
4
4
  import { Huri } from "@xyo-network/huri";
5
5
  import { ModuleErrorSchema } from "@xyo-network/payload-model";
6
6
  import { useEffect, useState } from "react";
7
- import { useRefreshPayload } from "../RefreshPayloadContext";
8
- import { ResolvePayloadContext } from "./Context";
9
- const ResolvePayloadProvider = ({ children, huriPayload }) => {
7
+
8
+ // src/contexts/RefreshPayloadContext/Context.tsx
9
+ import { createContextEx } from "@xyo-network/react-shared";
10
+ var RefreshPayloadContext = createContextEx();
11
+
12
+ // src/contexts/RefreshPayloadContext/use.tsx
13
+ import { useContextEx } from "@xyo-network/react-shared";
14
+ var useRefreshPayload = () => useContextEx(RefreshPayloadContext, "RefreshPayload", true);
15
+
16
+ // src/contexts/ResolvePayloadContext/Context.ts
17
+ import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
18
+ var ResolvePayloadContext = createContextEx2();
19
+
20
+ // src/contexts/ResolvePayloadContext/Provider.tsx
21
+ import { jsx } from "react/jsx-runtime";
22
+ var ResolvePayloadProvider = ({ children, huriPayload }) => {
10
23
  const [payload, setPayload] = useState();
11
24
  const [huri, setHuri] = useState();
12
25
  const { refreshPayload, setRefreshPayload, onRefresh } = useRefreshPayload();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/ResolvePayloadContext/Provider.tsx"],"sourcesContent":["import { delay } from '@xylabs/delay'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { Huri } from '@xyo-network/huri'\nimport { ModuleError, ModuleErrorSchema, Payload } from '@xyo-network/payload-model'\nimport { useEffect, useState } from 'react'\n\nimport { useRefreshPayload } from '../RefreshPayloadContext'\nimport { ResolvePayloadContext } from './Context'\nimport { ResolvePayloadState } from './State'\n\nexport type ResolvePayloadProviderProps = Omit<ResolvePayloadState, 'provided'>\n\nexport const ResolvePayloadProvider: React.FC<WithChildren<ResolvePayloadProviderProps>> = ({ children, huriPayload }) => {\n const [payload, setPayload] = useState<Payload>()\n const [huri, setHuri] = useState<string>()\n const { refreshPayload, setRefreshPayload, onRefresh } = useRefreshPayload()\n\n useEffect(() => {\n typeof huriPayload === 'string' ? setHuri(huriPayload) : undefined\n if (typeof huriPayload === 'object') {\n setPayload(huriPayload)\n setRefreshPayload?.(true)\n }\n }, [huriPayload, setRefreshPayload])\n\n const [notFound, setNotFound] = useState<boolean>()\n const [huriError, setHuriError] = useState<ModuleError>()\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (huri && !refreshPayload) {\n try {\n const huriInstance = new Huri(huri)\n const result = await huriInstance.fetch()\n // ensure the busy state can stay for a moment to avoid flashing too quickly\n await delay(500)\n\n if (mounted()) {\n setNotFound(result === null)\n setPayload(result)\n setRefreshPayload?.(true)\n }\n } catch (e) {\n const error = e as Error\n setHuriError({ message: error.message, schema: ModuleErrorSchema, sources: [] })\n }\n }\n },\n [huri, payload, refreshPayload, setRefreshPayload],\n )\n\n const refreshHuri = () => {\n onRefresh?.()\n if (huri) {\n setRefreshPayload?.(false)\n }\n }\n\n return (\n <ResolvePayloadContext.Provider value={{ huri, huriError, notFound, payload, provided: true, refreshHuri, setPayload }}>\n {children}\n </ResolvePayloadContext.Provider>\n )\n}\n"],"mappings":"AA6DI;AA7DJ,SAAS,aAAa;AACtB,SAAS,sBAAsB;AAE/B,SAAS,YAAY;AACrB,SAAsB,yBAAkC;AACxD,SAAS,WAAW,gBAAgB;AAEpC,SAAS,yBAAyB;AAClC,SAAS,6BAA6B;AAK/B,MAAM,yBAA8E,CAAC,EAAE,UAAU,YAAY,MAAM;AACxH,QAAM,CAAC,SAAS,UAAU,IAAI,SAAkB;AAChD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAiB;AACzC,QAAM,EAAE,gBAAgB,mBAAmB,UAAU,IAAI,kBAAkB;AAE3E,YAAU,MAAM;AACd,WAAO,gBAAgB,WAAW,QAAQ,WAAW,IAAI;AACzD,QAAI,OAAO,gBAAgB,UAAU;AACnC,iBAAW,WAAW;AACtB,0BAAoB,IAAI;AAAA,IAC1B;AAAA,EACF,GAAG,CAAC,aAAa,iBAAiB,CAAC;AAEnC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAkB;AAClD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAsB;AAExD;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,QAAQ,CAAC,gBAAgB;AAC3B,YAAI;AACF,gBAAM,eAAe,IAAI,KAAK,IAAI;AAClC,gBAAM,SAAS,MAAM,aAAa,MAAM;AAExC,gBAAM,MAAM,GAAG;AAEf,cAAI,QAAQ,GAAG;AACb,wBAAY,WAAW,IAAI;AAC3B,uBAAW,MAAM;AACjB,gCAAoB,IAAI;AAAA,UAC1B;AAAA,QACF,SAAS,GAAG;AACV,gBAAM,QAAQ;AACd,uBAAa,EAAE,SAAS,MAAM,SAAS,QAAQ,mBAAmB,SAAS,CAAC,EAAE,CAAC;AAAA,QACjF;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,MAAM,SAAS,gBAAgB,iBAAiB;AAAA,EACnD;AAEA,QAAM,cAAc,MAAM;AACxB,gBAAY;AACZ,QAAI,MAAM;AACR,0BAAoB,KAAK;AAAA,IAC3B;AAAA,EACF;AAEA,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,MAAM,WAAW,UAAU,SAAS,UAAU,MAAM,aAAa,WAAW,GAClH,UACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/contexts/ResolvePayloadContext/Provider.tsx","../../../../src/contexts/RefreshPayloadContext/Context.tsx","../../../../src/contexts/RefreshPayloadContext/use.tsx","../../../../src/contexts/ResolvePayloadContext/Context.ts"],"sourcesContent":["import { delay } from '@xylabs/delay'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { Huri } from '@xyo-network/huri'\nimport { ModuleError, ModuleErrorSchema, Payload } from '@xyo-network/payload-model'\nimport { useEffect, useState } from 'react'\n\nimport { useRefreshPayload } from '../RefreshPayloadContext'\nimport { ResolvePayloadContext } from './Context'\nimport { ResolvePayloadState } from './State'\n\nexport type ResolvePayloadProviderProps = Omit<ResolvePayloadState, 'provided'>\n\nexport const ResolvePayloadProvider: React.FC<WithChildren<ResolvePayloadProviderProps>> = ({ children, huriPayload }) => {\n const [payload, setPayload] = useState<Payload>()\n const [huri, setHuri] = useState<string>()\n const { refreshPayload, setRefreshPayload, onRefresh } = useRefreshPayload()\n\n useEffect(() => {\n typeof huriPayload === 'string' ? setHuri(huriPayload) : undefined\n if (typeof huriPayload === 'object') {\n setPayload(huriPayload)\n setRefreshPayload?.(true)\n }\n }, [huriPayload, setRefreshPayload])\n\n const [notFound, setNotFound] = useState<boolean>()\n const [huriError, setHuriError] = useState<ModuleError>()\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (huri && !refreshPayload) {\n try {\n const huriInstance = new Huri(huri)\n const result = await huriInstance.fetch()\n // ensure the busy state can stay for a moment to avoid flashing too quickly\n await delay(500)\n\n if (mounted()) {\n setNotFound(result === null)\n setPayload(result)\n setRefreshPayload?.(true)\n }\n } catch (e) {\n const error = e as Error\n setHuriError({ message: error.message, schema: ModuleErrorSchema, sources: [] })\n }\n }\n },\n [huri, payload, refreshPayload, setRefreshPayload],\n )\n\n const refreshHuri = () => {\n onRefresh?.()\n if (huri) {\n setRefreshPayload?.(false)\n }\n }\n\n return (\n <ResolvePayloadContext.Provider value={{ huri, huriError, notFound, payload, provided: true, refreshHuri, setPayload }}>\n {children}\n </ResolvePayloadContext.Provider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { RefreshPayloadState } from './State'\n\nexport const RefreshPayloadContext = createContextEx<RefreshPayloadState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { RefreshPayloadContext } from './Context'\n\nexport const useRefreshPayload = () => useContextEx(RefreshPayloadContext, 'RefreshPayload', true)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadState } from './State'\n\nexport const ResolvePayloadContext = createContextEx<ResolvePayloadState>()\n"],"mappings":";AAAA,SAAS,aAAa;AACtB,SAAS,sBAAsB;AAE/B,SAAS,YAAY;AACrB,SAAsB,yBAAkC;AACxD,SAAS,WAAW,gBAAgB;;;ACLpC,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;;;ACJ1E,SAAS,oBAAoB;AAItB,IAAM,oBAAoB,MAAM,aAAa,uBAAuB,kBAAkB,IAAI;;;ACJjG,SAAS,mBAAAA,wBAAuB;AAIzB,IAAM,wBAAwBA,iBAAqC;;;AHyDtE;AAhDG,IAAM,yBAA8E,CAAC,EAAE,UAAU,YAAY,MAAM;AACxH,QAAM,CAAC,SAAS,UAAU,IAAI,SAAkB;AAChD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAiB;AACzC,QAAM,EAAE,gBAAgB,mBAAmB,UAAU,IAAI,kBAAkB;AAE3E,YAAU,MAAM;AACd,WAAO,gBAAgB,WAAW,QAAQ,WAAW,IAAI;AACzD,QAAI,OAAO,gBAAgB,UAAU;AACnC,iBAAW,WAAW;AACtB,0BAAoB,IAAI;AAAA,IAC1B;AAAA,EACF,GAAG,CAAC,aAAa,iBAAiB,CAAC;AAEnC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAkB;AAClD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAsB;AAExD;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,QAAQ,CAAC,gBAAgB;AAC3B,YAAI;AACF,gBAAM,eAAe,IAAI,KAAK,IAAI;AAClC,gBAAM,SAAS,MAAM,aAAa,MAAM;AAExC,gBAAM,MAAM,GAAG;AAEf,cAAI,QAAQ,GAAG;AACb,wBAAY,WAAW,IAAI;AAC3B,uBAAW,MAAM;AACjB,gCAAoB,IAAI;AAAA,UAC1B;AAAA,QACF,SAAS,GAAG;AACV,gBAAM,QAAQ;AACd,uBAAa,EAAE,SAAS,MAAM,SAAS,QAAQ,mBAAmB,SAAS,CAAC,EAAE,CAAC;AAAA,QACjF;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,MAAM,SAAS,gBAAgB,iBAAiB;AAAA,EACnD;AAEA,QAAM,cAAc,MAAM;AACxB,gBAAY;AACZ,QAAI,MAAM;AACR,0BAAoB,KAAK;AAAA,IAC3B;AAAA,EACF;AAEA,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,MAAM,WAAW,UAAU,SAAS,UAAU,MAAM,aAAa,WAAW,GAClH,UACH;AAEJ;","names":["createContextEx"]}
@@ -1,5 +1,73 @@
1
- export * from "./Context";
2
- export * from "./Provider";
3
- export * from "./State";
4
- export * from "./use";
1
+ // src/contexts/ResolvePayloadContext/Context.ts
2
+ import { createContextEx } from "@xyo-network/react-shared";
3
+ var ResolvePayloadContext = createContextEx();
4
+
5
+ // src/contexts/ResolvePayloadContext/Provider.tsx
6
+ import { delay } from "@xylabs/delay";
7
+ import { useAsyncEffect } from "@xylabs/react-async-effect";
8
+ import { Huri } from "@xyo-network/huri";
9
+ import { ModuleErrorSchema } from "@xyo-network/payload-model";
10
+ import { useEffect, useState } from "react";
11
+
12
+ // src/contexts/RefreshPayloadContext/Context.tsx
13
+ import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
14
+ var RefreshPayloadContext = createContextEx2();
15
+
16
+ // src/contexts/RefreshPayloadContext/use.tsx
17
+ import { useContextEx } from "@xyo-network/react-shared";
18
+ var useRefreshPayload = () => useContextEx(RefreshPayloadContext, "RefreshPayload", true);
19
+
20
+ // src/contexts/ResolvePayloadContext/Provider.tsx
21
+ import { jsx } from "react/jsx-runtime";
22
+ var ResolvePayloadProvider = ({ children, huriPayload }) => {
23
+ const [payload, setPayload] = useState();
24
+ const [huri, setHuri] = useState();
25
+ const { refreshPayload, setRefreshPayload, onRefresh } = useRefreshPayload();
26
+ useEffect(() => {
27
+ typeof huriPayload === "string" ? setHuri(huriPayload) : void 0;
28
+ if (typeof huriPayload === "object") {
29
+ setPayload(huriPayload);
30
+ setRefreshPayload?.(true);
31
+ }
32
+ }, [huriPayload, setRefreshPayload]);
33
+ const [notFound, setNotFound] = useState();
34
+ const [huriError, setHuriError] = useState();
35
+ useAsyncEffect(
36
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37
+ async (mounted) => {
38
+ if (huri && !refreshPayload) {
39
+ try {
40
+ const huriInstance = new Huri(huri);
41
+ const result = await huriInstance.fetch();
42
+ await delay(500);
43
+ if (mounted()) {
44
+ setNotFound(result === null);
45
+ setPayload(result);
46
+ setRefreshPayload?.(true);
47
+ }
48
+ } catch (e) {
49
+ const error = e;
50
+ setHuriError({ message: error.message, schema: ModuleErrorSchema, sources: [] });
51
+ }
52
+ }
53
+ },
54
+ [huri, payload, refreshPayload, setRefreshPayload]
55
+ );
56
+ const refreshHuri = () => {
57
+ onRefresh?.();
58
+ if (huri) {
59
+ setRefreshPayload?.(false);
60
+ }
61
+ };
62
+ return /* @__PURE__ */ jsx(ResolvePayloadContext.Provider, { value: { huri, huriError, notFound, payload, provided: true, refreshHuri, setPayload }, children });
63
+ };
64
+
65
+ // src/contexts/ResolvePayloadContext/use.tsx
66
+ import { useContextEx as useContextEx2 } from "@xyo-network/react-shared";
67
+ var useResolvePayload = () => useContextEx2(ResolvePayloadContext, "ResolvePayload", true);
68
+ export {
69
+ ResolvePayloadContext,
70
+ ResolvePayloadProvider,
71
+ useResolvePayload
72
+ };
5
73
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/ResolvePayloadContext/index.ts"],"sourcesContent":["export * from './Context'\nexport * from './Provider'\nexport * from './State'\nexport * from './use'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../../src/contexts/ResolvePayloadContext/Context.ts","../../../../src/contexts/ResolvePayloadContext/Provider.tsx","../../../../src/contexts/RefreshPayloadContext/Context.tsx","../../../../src/contexts/RefreshPayloadContext/use.tsx","../../../../src/contexts/ResolvePayloadContext/use.tsx"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadState } from './State'\n\nexport const ResolvePayloadContext = createContextEx<ResolvePayloadState>()\n","import { delay } from '@xylabs/delay'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { Huri } from '@xyo-network/huri'\nimport { ModuleError, ModuleErrorSchema, Payload } from '@xyo-network/payload-model'\nimport { useEffect, useState } from 'react'\n\nimport { useRefreshPayload } from '../RefreshPayloadContext'\nimport { ResolvePayloadContext } from './Context'\nimport { ResolvePayloadState } from './State'\n\nexport type ResolvePayloadProviderProps = Omit<ResolvePayloadState, 'provided'>\n\nexport const ResolvePayloadProvider: React.FC<WithChildren<ResolvePayloadProviderProps>> = ({ children, huriPayload }) => {\n const [payload, setPayload] = useState<Payload>()\n const [huri, setHuri] = useState<string>()\n const { refreshPayload, setRefreshPayload, onRefresh } = useRefreshPayload()\n\n useEffect(() => {\n typeof huriPayload === 'string' ? setHuri(huriPayload) : undefined\n if (typeof huriPayload === 'object') {\n setPayload(huriPayload)\n setRefreshPayload?.(true)\n }\n }, [huriPayload, setRefreshPayload])\n\n const [notFound, setNotFound] = useState<boolean>()\n const [huriError, setHuriError] = useState<ModuleError>()\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (huri && !refreshPayload) {\n try {\n const huriInstance = new Huri(huri)\n const result = await huriInstance.fetch()\n // ensure the busy state can stay for a moment to avoid flashing too quickly\n await delay(500)\n\n if (mounted()) {\n setNotFound(result === null)\n setPayload(result)\n setRefreshPayload?.(true)\n }\n } catch (e) {\n const error = e as Error\n setHuriError({ message: error.message, schema: ModuleErrorSchema, sources: [] })\n }\n }\n },\n [huri, payload, refreshPayload, setRefreshPayload],\n )\n\n const refreshHuri = () => {\n onRefresh?.()\n if (huri) {\n setRefreshPayload?.(false)\n }\n }\n\n return (\n <ResolvePayloadContext.Provider value={{ huri, huriError, notFound, payload, provided: true, refreshHuri, setPayload }}>\n {children}\n </ResolvePayloadContext.Provider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { RefreshPayloadState } from './State'\n\nexport const RefreshPayloadContext = createContextEx<RefreshPayloadState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { RefreshPayloadContext } from './Context'\n\nexport const useRefreshPayload = () => useContextEx(RefreshPayloadContext, 'RefreshPayload', true)\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadContext } from './Context'\n\nexport const useResolvePayload = () => useContextEx(ResolvePayloadContext, 'ResolvePayload', true)\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;;;ACJ1E,SAAS,aAAa;AACtB,SAAS,sBAAsB;AAE/B,SAAS,YAAY;AACrB,SAAsB,yBAAkC;AACxD,SAAS,WAAW,gBAAgB;;;ACLpC,SAAS,mBAAAA,wBAAuB;AAIzB,IAAM,wBAAwBA,iBAAqC;;;ACJ1E,SAAS,oBAAoB;AAItB,IAAM,oBAAoB,MAAM,aAAa,uBAAuB,kBAAkB,IAAI;;;AFyD7F;AAhDG,IAAM,yBAA8E,CAAC,EAAE,UAAU,YAAY,MAAM;AACxH,QAAM,CAAC,SAAS,UAAU,IAAI,SAAkB;AAChD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAiB;AACzC,QAAM,EAAE,gBAAgB,mBAAmB,UAAU,IAAI,kBAAkB;AAE3E,YAAU,MAAM;AACd,WAAO,gBAAgB,WAAW,QAAQ,WAAW,IAAI;AACzD,QAAI,OAAO,gBAAgB,UAAU;AACnC,iBAAW,WAAW;AACtB,0BAAoB,IAAI;AAAA,IAC1B;AAAA,EACF,GAAG,CAAC,aAAa,iBAAiB,CAAC;AAEnC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAkB;AAClD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAsB;AAExD;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,QAAQ,CAAC,gBAAgB;AAC3B,YAAI;AACF,gBAAM,eAAe,IAAI,KAAK,IAAI;AAClC,gBAAM,SAAS,MAAM,aAAa,MAAM;AAExC,gBAAM,MAAM,GAAG;AAEf,cAAI,QAAQ,GAAG;AACb,wBAAY,WAAW,IAAI;AAC3B,uBAAW,MAAM;AACjB,gCAAoB,IAAI;AAAA,UAC1B;AAAA,QACF,SAAS,GAAG;AACV,gBAAM,QAAQ;AACd,uBAAa,EAAE,SAAS,MAAM,SAAS,QAAQ,mBAAmB,SAAS,CAAC,EAAE,CAAC;AAAA,QACjF;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,MAAM,SAAS,gBAAgB,iBAAiB;AAAA,EACnD;AAEA,QAAM,cAAc,MAAM;AACxB,gBAAY;AACZ,QAAI,MAAM;AACR,0BAAoB,KAAK;AAAA,IAC3B;AAAA,EACF;AAEA,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,MAAM,WAAW,UAAU,SAAS,UAAU,MAAM,aAAa,WAAW,GAClH,UACH;AAEJ;;;AGjEA,SAAS,gBAAAC,qBAAoB;AAItB,IAAM,oBAAoB,MAAMC,cAAa,uBAAuB,kBAAkB,IAAI;","names":["createContextEx","useContextEx","useContextEx"]}
@@ -1,6 +1,12 @@
1
+ // src/contexts/ResolvePayloadContext/use.tsx
1
2
  import { useContextEx } from "@xyo-network/react-shared";
2
- import { ResolvePayloadContext } from "./Context";
3
- const useResolvePayload = () => useContextEx(ResolvePayloadContext, "ResolvePayload", true);
3
+
4
+ // src/contexts/ResolvePayloadContext/Context.ts
5
+ import { createContextEx } from "@xyo-network/react-shared";
6
+ var ResolvePayloadContext = createContextEx();
7
+
8
+ // src/contexts/ResolvePayloadContext/use.tsx
9
+ var useResolvePayload = () => useContextEx(ResolvePayloadContext, "ResolvePayload", true);
4
10
  export {
5
11
  useResolvePayload
6
12
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/ResolvePayloadContext/use.tsx"],"sourcesContent":["import { useContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadContext } from './Context'\n\nexport const useResolvePayload = () => useContextEx(ResolvePayloadContext, 'ResolvePayload', true)\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,SAAS,6BAA6B;AAE/B,MAAM,oBAAoB,MAAM,aAAa,uBAAuB,kBAAkB,IAAI;","names":[]}
1
+ {"version":3,"sources":["../../../../src/contexts/ResolvePayloadContext/use.tsx","../../../../src/contexts/ResolvePayloadContext/Context.ts"],"sourcesContent":["import { useContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadContext } from './Context'\n\nexport const useResolvePayload = () => useContextEx(ResolvePayloadContext, 'ResolvePayload', true)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadState } from './State'\n\nexport const ResolvePayloadContext = createContextEx<ResolvePayloadState>()\n"],"mappings":";AAAA,SAAS,oBAAoB;;;ACA7B,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;;;ADAnE,IAAM,oBAAoB,MAAM,aAAa,uBAAuB,kBAAkB,IAAI;","names":[]}
@@ -1,5 +1,6 @@
1
+ // src/contexts/ValidatePayloadContext/Context.ts
1
2
  import { createContextEx } from "@xyo-network/react-shared";
2
- const ValidatePayloadContext = createContextEx();
3
+ var ValidatePayloadContext = createContextEx();
3
4
  export {
4
5
  ValidatePayloadContext
5
6
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/ValidatePayloadContext/Context.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ValidatePayloadState } from './State'\n\nexport const ValidatePayloadContext = createContextEx<ValidatePayloadState>()\n"],"mappings":"AAAA,SAAS,uBAAuB;AAIzB,MAAM,yBAAyB,gBAAsC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/contexts/ValidatePayloadContext/Context.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ValidatePayloadState } from './State'\n\nexport const ValidatePayloadContext = createContextEx<ValidatePayloadState>()\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,yBAAyB,gBAAsC;","names":[]}
@@ -1,11 +1,24 @@
1
- import { Fragment, jsx } from "react/jsx-runtime";
1
+ // src/contexts/ValidatePayloadContext/Provider.tsx
2
2
  import { Chip } from "@mui/material";
3
3
  import { useAsyncEffect } from "@xylabs/react-async-effect";
4
4
  import { SchemaCache } from "@xyo-network/schema-cache";
5
5
  import { useState } from "react";
6
- import { useResolvePayload } from "../ResolvePayloadContext";
7
- import { ValidatePayloadContext } from "./Context";
8
- const ValidatePayloadProvider = ({ children, enabled = false }) => {
6
+
7
+ // src/contexts/ResolvePayloadContext/Context.ts
8
+ import { createContextEx } from "@xyo-network/react-shared";
9
+ var ResolvePayloadContext = createContextEx();
10
+
11
+ // src/contexts/ResolvePayloadContext/use.tsx
12
+ import { useContextEx } from "@xyo-network/react-shared";
13
+ var useResolvePayload = () => useContextEx(ResolvePayloadContext, "ResolvePayload", true);
14
+
15
+ // src/contexts/ValidatePayloadContext/Context.ts
16
+ import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
17
+ var ValidatePayloadContext = createContextEx2();
18
+
19
+ // src/contexts/ValidatePayloadContext/Provider.tsx
20
+ import { Fragment, jsx } from "react/jsx-runtime";
21
+ var ValidatePayloadProvider = ({ children, enabled = false }) => {
9
22
  const { payload } = useResolvePayload();
10
23
  const [initialized, setInitialized] = useState(false);
11
24
  const [valid, setValid] = useState();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/contexts/ValidatePayloadContext/Provider.tsx"],"sourcesContent":["import { Chip } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { SchemaCache, SchemaNameToValidatorMap } from '@xyo-network/schema-cache'\nimport { useState } from 'react'\n\nimport { useResolvePayload } from '../ResolvePayloadContext'\nimport { ValidatePayloadContext } from './Context'\n\nexport interface ValidatePayloadProviderProps {\n // Opt-in flag to validate payloads for the plugin(s)\n enabled?: boolean\n}\n\nexport const ValidatePayloadProvider: React.FC<WithChildren<ValidatePayloadProviderProps>> = ({ children, enabled = false }) => {\n const { payload } = useResolvePayload()\n const [initialized, setInitialized] = useState(false)\n const [valid, setValid] = useState<boolean>()\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async () => {\n if (payload && enabled) {\n await SchemaCache.instance.get(payload.schema)\n\n const possibleKnownSchema = payload.schema as keyof SchemaNameToValidatorMap\n\n if (SchemaCache.instance.validators[possibleKnownSchema]) {\n const validator = SchemaCache.instance.validators[possibleKnownSchema]\n setValid(validator?.(payload))\n }\n setInitialized(true)\n }\n },\n [payload, enabled],\n )\n\n return (\n <ValidatePayloadContext.Provider value={{ enabled, provided: true, schema: payload?.schema, validPayload: valid }}>\n {enabled ? <>{initialized ? children : <Chip label=\"Validating Payload...\" />}</> : children}\n </ValidatePayloadContext.Provider>\n )\n}\n"],"mappings":"AAuCiB,mBAA4B,WAA5B;AAvCjB,SAAS,YAAY;AACrB,SAAS,sBAAsB;AAE/B,SAAS,mBAA6C;AACtD,SAAS,gBAAgB;AAEzB,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AAOhC,MAAM,0BAAgF,CAAC,EAAE,UAAU,UAAU,MAAM,MAAM;AAC9H,QAAM,EAAE,QAAQ,IAAI,kBAAkB;AACtC,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AACpD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAkB;AAE5C;AAAA;AAAA,IAEE,YAAY;AACV,UAAI,WAAW,SAAS;AACtB,cAAM,YAAY,SAAS,IAAI,QAAQ,MAAM;AAE7C,cAAM,sBAAsB,QAAQ;AAEpC,YAAI,YAAY,SAAS,WAAW,mBAAmB,GAAG;AACxD,gBAAM,YAAY,YAAY,SAAS,WAAW,mBAAmB;AACrE,mBAAS,YAAY,OAAO,CAAC;AAAA,QAC/B;AACA,uBAAe,IAAI;AAAA,MACrB;AAAA,IACF;AAAA,IACA,CAAC,SAAS,OAAO;AAAA,EACnB;AAEA,SACE,oBAAC,uBAAuB,UAAvB,EAAgC,OAAO,EAAE,SAAS,UAAU,MAAM,QAAQ,SAAS,QAAQ,cAAc,MAAM,GAC7G,oBAAU,gCAAG,wBAAc,WAAW,oBAAC,QAAK,OAAM,yBAAwB,GAAG,IAAM,UACtF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/contexts/ValidatePayloadContext/Provider.tsx","../../../../src/contexts/ResolvePayloadContext/Context.ts","../../../../src/contexts/ResolvePayloadContext/use.tsx","../../../../src/contexts/ValidatePayloadContext/Context.ts"],"sourcesContent":["import { Chip } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { SchemaCache, SchemaNameToValidatorMap } from '@xyo-network/schema-cache'\nimport { useState } from 'react'\n\nimport { useResolvePayload } from '../ResolvePayloadContext'\nimport { ValidatePayloadContext } from './Context'\n\nexport interface ValidatePayloadProviderProps {\n // Opt-in flag to validate payloads for the plugin(s)\n enabled?: boolean\n}\n\nexport const ValidatePayloadProvider: React.FC<WithChildren<ValidatePayloadProviderProps>> = ({ children, enabled = false }) => {\n const { payload } = useResolvePayload()\n const [initialized, setInitialized] = useState(false)\n const [valid, setValid] = useState<boolean>()\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async () => {\n if (payload && enabled) {\n await SchemaCache.instance.get(payload.schema)\n\n const possibleKnownSchema = payload.schema as keyof SchemaNameToValidatorMap\n\n if (SchemaCache.instance.validators[possibleKnownSchema]) {\n const validator = SchemaCache.instance.validators[possibleKnownSchema]\n setValid(validator?.(payload))\n }\n setInitialized(true)\n }\n },\n [payload, enabled],\n )\n\n return (\n <ValidatePayloadContext.Provider value={{ enabled, provided: true, schema: payload?.schema, validPayload: valid }}>\n {enabled ? <>{initialized ? children : <Chip label=\"Validating Payload...\" />}</> : children}\n </ValidatePayloadContext.Provider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadState } from './State'\n\nexport const ResolvePayloadContext = createContextEx<ResolvePayloadState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadContext } from './Context'\n\nexport const useResolvePayload = () => useContextEx(ResolvePayloadContext, 'ResolvePayload', true)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ValidatePayloadState } from './State'\n\nexport const ValidatePayloadContext = createContextEx<ValidatePayloadState>()\n"],"mappings":";AAAA,SAAS,YAAY;AACrB,SAAS,sBAAsB;AAE/B,SAAS,mBAA6C;AACtD,SAAS,gBAAgB;;;ACJzB,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;;;ACJ1E,SAAS,oBAAoB;AAItB,IAAM,oBAAoB,MAAM,aAAa,uBAAuB,kBAAkB,IAAI;;;ACJjG,SAAS,mBAAAA,wBAAuB;AAIzB,IAAM,yBAAyBA,iBAAsC;;;AHmC3D,mBAA4B,WAA5B;AAzBV,IAAM,0BAAgF,CAAC,EAAE,UAAU,UAAU,MAAM,MAAM;AAC9H,QAAM,EAAE,QAAQ,IAAI,kBAAkB;AACtC,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AACpD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAkB;AAE5C;AAAA;AAAA,IAEE,YAAY;AACV,UAAI,WAAW,SAAS;AACtB,cAAM,YAAY,SAAS,IAAI,QAAQ,MAAM;AAE7C,cAAM,sBAAsB,QAAQ;AAEpC,YAAI,YAAY,SAAS,WAAW,mBAAmB,GAAG;AACxD,gBAAM,YAAY,YAAY,SAAS,WAAW,mBAAmB;AACrE,mBAAS,YAAY,OAAO,CAAC;AAAA,QAC/B;AACA,uBAAe,IAAI;AAAA,MACrB;AAAA,IACF;AAAA,IACA,CAAC,SAAS,OAAO;AAAA,EACnB;AAEA,SACE,oBAAC,uBAAuB,UAAvB,EAAgC,OAAO,EAAE,SAAS,UAAU,MAAM,QAAQ,SAAS,QAAQ,cAAc,MAAM,GAC7G,oBAAU,gCAAG,wBAAc,WAAW,oBAAC,QAAK,OAAM,yBAAwB,GAAG,IAAM,UACtF;AAEJ;","names":["createContextEx"]}