@xyo-network/os-react-runtime 4.2.0-rc.9 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/browser/index.mjs +558 -519
  2. package/dist/browser/index.mjs.map +1 -1
  3. package/dist/browser/modules/Dapp/Container.d.ts.map +1 -1
  4. package/dist/browser/modules/Dapp/modules/Window/DappWindow.d.ts +3 -14
  5. package/dist/browser/modules/Dapp/modules/Window/DappWindow.d.ts.map +1 -1
  6. package/dist/browser/modules/Dapp/modules/Window/MetaTags.d.ts +8 -0
  7. package/dist/browser/modules/Dapp/modules/Window/MetaTags.d.ts.map +1 -0
  8. package/dist/browser/modules/Dapp/modules/Window/Rendered.d.ts +5 -0
  9. package/dist/browser/modules/Dapp/modules/Window/Rendered.d.ts.map +1 -0
  10. package/dist/browser/modules/Dapp/modules/Window/hooks/index.d.ts +1 -1
  11. package/dist/browser/modules/Dapp/modules/Window/hooks/index.d.ts.map +1 -1
  12. package/dist/browser/modules/Dapp/modules/Window/hooks/menu/useDappMenu.d.ts +2 -21
  13. package/dist/browser/modules/Dapp/modules/Window/hooks/menu/useDappMenu.d.ts.map +1 -1
  14. package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.d.ts.map +1 -1
  15. package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.d.ts +1 -1
  16. package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.d.ts.map +1 -1
  17. package/dist/browser/modules/Dapp/modules/Window/hooks/useDecomposeDapp.d.ts +11 -0
  18. package/dist/browser/modules/Dapp/modules/Window/hooks/useDecomposeDapp.d.ts.map +1 -0
  19. package/dist/browser/modules/Dapp/modules/Window/index.d.ts +3 -1
  20. package/dist/browser/modules/Dapp/modules/Window/index.d.ts.map +1 -1
  21. package/dist/browser/modules/Dapp/modules/Window/types/DappMenuProperties.d.ts +9 -0
  22. package/dist/browser/modules/Dapp/modules/Window/types/DappMenuProperties.d.ts.map +1 -0
  23. package/dist/browser/modules/Dapp/modules/Window/types/DappWindowProps.d.ts +13 -0
  24. package/dist/browser/modules/Dapp/modules/Window/types/DappWindowProps.d.ts.map +1 -0
  25. package/dist/browser/modules/Dapp/modules/Window/types/index.d.ts +3 -0
  26. package/dist/browser/modules/Dapp/modules/Window/types/index.d.ts.map +1 -0
  27. package/package.json +10 -11
  28. package/src/DappPathSwitcher.tsx +3 -3
  29. package/src/modules/Dapp/Container.tsx +21 -9
  30. package/src/modules/Dapp/modules/Window/DappWindow.tsx +22 -131
  31. package/src/modules/Dapp/modules/Window/MetaTags.tsx +27 -0
  32. package/src/modules/Dapp/modules/Window/Rendered.tsx +101 -0
  33. package/src/modules/Dapp/modules/Window/hooks/index.ts +1 -1
  34. package/src/modules/Dapp/modules/Window/hooks/menu/useDappMenu.tsx +3 -2
  35. package/src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.tsx +3 -6
  36. package/src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.tsx +3 -1
  37. package/src/modules/Dapp/modules/Window/hooks/useDecomposeDapp.tsx +21 -0
  38. package/src/modules/Dapp/modules/Window/index.ts +3 -1
  39. package/src/modules/Dapp/modules/Window/types/DappMenuProperties.ts +9 -0
  40. package/src/modules/Dapp/modules/Window/types/DappWindowProps.ts +14 -0
  41. package/src/modules/Dapp/modules/Window/types/index.ts +2 -0
  42. package/dist/browser/modules/Dapp/modules/Window/hooks/useDecomposeDappSet.d.ts +0 -9
  43. package/dist/browser/modules/Dapp/modules/Window/hooks/useDecomposeDappSet.d.ts.map +0 -1
  44. package/src/modules/Dapp/modules/Window/hooks/useDecomposeDappSet.tsx +0 -19
@@ -5,6 +5,7 @@ import {
5
5
  } from 'react'
6
6
  import { useNavigate, useParams } from 'react-router-dom'
7
7
 
8
+ import type { DappMenuProperties } from '../../types/index.ts'
8
9
  import { DappPathHelpers } from '../lib/index.ts'
9
10
  import { useDappMenuDependencies } from '../useDappMenuResourceValues.tsx'
10
11
 
@@ -12,7 +13,7 @@ import { useDappMenuDependencies } from '../useDappMenuResourceValues.tsx'
12
13
  * Use the passed in dapp Node to resolve menu related modules and return the menu related items
13
14
  */
14
15
 
15
- export const useDappMenu = (context?: XyOsContext | null, dappName?: DappName) => {
16
+ export const useDappMenu = (context?: XyOsContext | null, dappName?: DappName): DappMenuProperties => {
16
17
  const [error, setError] = useState<Error>()
17
18
  const params = useParams()
18
19
  const navigate = useNavigate()
@@ -65,7 +66,7 @@ export const useDappMenu = (context?: XyOsContext | null, dappName?: DappName) =
65
66
  activePath,
66
67
  error,
67
68
  menuConfig: menuConfigs?.[0],
68
- menuItemsVisible,
69
+ menuItems: menuItemsVisible,
69
70
  onPathChange,
70
71
  }
71
72
  }
@@ -5,23 +5,20 @@ import { asArchivistInstance } from '@xyo-network/archivist-model'
5
5
  import type { XyOsContext } from '@xyo-network/os-model'
6
6
  import { isDappInjectableParams } from '@xyo-network/os-model'
7
7
  import { DappCaller } from '@xyo-network/os-runtime'
8
- import {
9
- useNavigate, useParams, useSearchParams,
10
- } from 'react-router-dom'
8
+ import { useNavigate, useSearchParams } from 'react-router-dom'
11
9
 
12
10
  /** Update the dapp archivist with injectable params based off changes in the query params */
13
11
  export const useManageDappInjectableParamsFromRoute = (context?: XyOsContext | null) => {
14
12
  const [queryParams] = useSearchParams()
15
- const params = useParams()
16
13
  const navigate = useNavigate()
17
14
 
18
15
  const [, callerError] = usePromise(async () => {
19
- if (context && (params || queryParams)) {
16
+ if (context && queryParams) {
20
17
  const dappCaller = new DappCaller(context)
21
18
  const pathname = globalThis.location.pathname
22
19
  await dappCaller.setDappInjectableRouteParams(queryParams, pathname)
23
20
  }
24
- }, [context, queryParams, params])
21
+ }, [context, queryParams])
25
22
 
26
23
  // Update the route if the dapp inserts a new injectable params payload and the path is different
27
24
  const [, listenerError] = usePromise(async () => {
@@ -65,10 +65,12 @@ export const useManageDappPathFromRoute = (context?: XyOsContext | null, dappNam
65
65
  }, [dappName, context, defaultPath, menuSelection])
66
66
 
67
67
  // Sync the menu archivist when the route changes (no menuSelection dependency)
68
- usePromise(async () => {
68
+ const [, updateErrors] = usePromise(async () => {
69
69
  if (context && pathParam !== currentPathRef.current) {
70
70
  await updateMenuArchivist(pathParam)
71
71
  currentPathRef.current = pathParam
72
72
  }
73
73
  }, [context, pathParam, updateMenuArchivist])
74
+
75
+ return updateErrors
74
76
  }
@@ -0,0 +1,21 @@
1
+ import type { RegisteredReactDapp } from '@xyo-network/os-react-model'
2
+ import { useMemo } from 'react'
3
+
4
+ import { NodeManifest } from '../NodeManifest.tsx'
5
+
6
+ export const useDecomposeDapp = (dapp?: RegisteredReactDapp) => {
7
+ const DappComponent = useMemo(() => dapp?.params.modes?.window?.component ?? NodeManifest, []) as React.FC<{
8
+ name?: string
9
+ }>
10
+ const name = dapp?.config.name
11
+ const version = dapp?.config.version
12
+ const scrollable = dapp?.params.modes?.window?.scrollable ?? true
13
+
14
+ return {
15
+ DappComponent,
16
+ dapp,
17
+ name,
18
+ scrollable,
19
+ version,
20
+ }
21
+ }
@@ -1,6 +1,8 @@
1
1
  export * from './AppBar.tsx'
2
2
  export * from './Chrome.tsx'
3
3
  export * from './components/index.ts'
4
- export * from './DappWindow.js'
4
+ export * from './DappWindow.tsx'
5
5
  export * from './hooks/index.ts'
6
6
  export * from './menu/index.ts'
7
+ export * from './Rendered.tsx'
8
+ export * from './types/index.ts'
@@ -0,0 +1,9 @@
1
+ import type { DappNavItem, DappNavMenuConfig } from '@xyo-network/os-model'
2
+
3
+ export interface DappMenuProperties {
4
+ activePath?: string
5
+ error?: Error
6
+ menuConfig?: DappNavMenuConfig
7
+ menuItems?: DappNavItem[]
8
+ onPathChange: (path: string) => void
9
+ }
@@ -0,0 +1,14 @@
1
+ import type { RegisteredReactDapp, XyOsUiContext } from '@xyo-network/os-react-model'
2
+ import type { WalletInstance } from '@xyo-network/wallet-model'
3
+
4
+ import type { DappState } from '../hooks/index.ts'
5
+ import type { DappMenuProperties } from './DappMenuProperties.ts'
6
+
7
+ export interface DappWindowProps {
8
+ context?: XyOsUiContext | null
9
+ dapp?: RegisteredReactDapp
10
+ dappMenuProperties?: DappMenuProperties
11
+ dappState?: DappState
12
+ dappWallet?: WalletInstance
13
+ errors?: (Error | undefined)[]
14
+ }
@@ -0,0 +1,2 @@
1
+ export * from './DappMenuProperties.ts'
2
+ export * from './DappWindowProps.ts'
@@ -1,9 +0,0 @@
1
- import type { RegisteredReactDappSet } from '@xyo-network/os-react-model';
2
- export declare const decomposeDappSet: (dappSet?: RegisteredReactDappSet) => {
3
- DappComponent: import("react").FC<{}> | (() => import("react/jsx-runtime").JSX.Element);
4
- dapp: import("@xyo-network/os-react-model").RegisteredReactDapp | undefined;
5
- name: string | undefined;
6
- scrollable: boolean;
7
- version: string | undefined;
8
- };
9
- //# sourceMappingURL=useDecomposeDappSet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDecomposeDappSet.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/Dapp/modules/Window/hooks/useDecomposeDappSet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAIzE,eAAO,MAAM,gBAAgB,aAAc,sBAAsB;;;;;;CAchE,CAAA"}
@@ -1,19 +0,0 @@
1
- import type { RegisteredReactDappSet } from '@xyo-network/os-react-model'
2
-
3
- import { NodeManifest } from '../NodeManifest.js'
4
-
5
- export const decomposeDappSet = (dappSet?: RegisteredReactDappSet) => {
6
- const { dapp } = dappSet ?? {}
7
- const DappComponent = dapp?.params.modes?.window?.component ?? NodeManifest
8
- const name = dapp?.config.name
9
- const version = dapp?.config.version
10
- const scrollable = dapp?.params.modes?.window?.scrollable ?? true
11
-
12
- return {
13
- DappComponent,
14
- dapp,
15
- name,
16
- scrollable,
17
- version,
18
- }
19
- }