@xyo-network/os-react-runtime 4.2.0-rc.11 → 4.2.0-rc.13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../src/modules/Dapp/Container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACzE,OAAO,KAAwB,MAAM,OAAO,CAAA;AAQ5C,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B,OAAO,EAAE,sBAAsB,CAAA;IAC/B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAkCtD,CAAA;AAED,eAAO,MAAM,iBAAiB,gDAAsB,CAAA"}
1
+ {"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../src/modules/Dapp/Container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACzE,OAAO,KAAwB,MAAM,OAAO,CAAA;AAM5C,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B,OAAO,EAAE,sBAAsB,CAAA;IAC/B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAgCtD,CAAA;AAED,eAAO,MAAM,iBAAiB,gDAAsB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"DappWindow.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/Dapp/modules/Window/DappWindow.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAIxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAkB,MAAM,OAAO,CAAA;AAOtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAOjD,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IAC9B,OAAO,CAAC,EAAE,sBAAsB,CAAA;IAChC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;IAChB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,eAAe,CAAC,EAAE,KAAK,CAAA;CACxB;AAED,gIAAgI;AAChI,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmHhD,CAAA"}
1
+ {"version":3,"file":"DappWindow.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/Dapp/modules/Window/DappWindow.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAIxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAkB,MAAM,OAAO,CAAA;AAOtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAOjD,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IAC9B,OAAO,CAAC,EAAE,sBAAsB,CAAA;IAChC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;IAChB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,eAAe,CAAC,EAAE,KAAK,CAAA;CACxB;AAED,gIAAgI;AAChI,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAoHhD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useManageDappInjectableParamsFromRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAOxD,6FAA6F;AAC7F,eAAO,MAAM,sCAAsC,aAAc,WAAW,GAAG,IAAI,0BA8ClF,CAAA"}
1
+ {"version":3,"file":"useManageDappInjectableParamsFromRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAKxD,6FAA6F;AAC7F,eAAO,MAAM,sCAAsC,aAAc,WAAW,GAAG,IAAI,0BA6ClF,CAAA"}
@@ -11,5 +11,5 @@ import type { XyOsContext } from '@xyo-network/os-model';
11
11
  * 5. Navigating directly to a path from within the dApp by clicking back
12
12
  */
13
13
  /** React to changes in the `path` route param */
14
- export declare const useManageDappPathFromRoute: (context?: XyOsContext | null, dappName?: string) => void;
14
+ export declare const useManageDappPathFromRoute: (context?: XyOsContext | null, dappName?: string) => Error | undefined;
15
15
  //# sourceMappingURL=useManageDappPathFromRoute.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useManageDappPathFromRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAUxD;;;;;;;;;;GAUG;AAEH,iDAAiD;AACjD,eAAO,MAAM,0BAA0B,aAAc,WAAW,GAAG,IAAI,aAAa,MAAM,SAiDzF,CAAA"}
1
+ {"version":3,"file":"useManageDappPathFromRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAUxD;;;;;;;;;;GAUG;AAEH,iDAAiD;AACjD,eAAO,MAAM,0BAA0B,aAAc,WAAW,GAAG,IAAI,aAAa,MAAM,sBAmDzF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/os-react-runtime",
3
- "version": "4.2.0-rc.11",
3
+ "version": "4.2.0-rc.13",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -48,23 +48,23 @@
48
48
  "@xylabs/react-shared": "^5.3.14",
49
49
  "@xyo-network/archivist-indexeddb": "^3.6.6",
50
50
  "@xyo-network/archivist-model": "^3.6.6",
51
- "@xyo-network/bios-browser": "^4.2.0-rc.11",
52
- "@xyo-network/bios-model": "^4.2.0-rc.11",
51
+ "@xyo-network/bios-browser": "^4.2.0-rc.13",
52
+ "@xyo-network/bios-model": "^4.2.0-rc.13",
53
53
  "@xyo-network/diviner-boundwitness-indexeddb": "^3.6.6",
54
54
  "@xyo-network/diviner-model": "^3.6.6",
55
55
  "@xyo-network/diviner-payload-generic": "^3.6.6",
56
56
  "@xyo-network/diviner-payload-indexeddb": "^3.6.6",
57
57
  "@xyo-network/diviner-payload-model": "^3.6.6",
58
- "@xyo-network/kernel": "^4.2.0-rc.11",
59
- "@xyo-network/kernel-model": "^4.2.0-rc.11",
58
+ "@xyo-network/kernel": "^4.2.0-rc.13",
59
+ "@xyo-network/kernel-model": "^4.2.0-rc.13",
60
60
  "@xyo-network/module-event-emitter": "^3.6.6",
61
61
  "@xyo-network/module-events": "^3.6.6",
62
62
  "@xyo-network/module-factory-locator": "^3.6.6",
63
63
  "@xyo-network/node-model": "^3.6.6",
64
- "@xyo-network/os-model": "^4.2.0-rc.11",
65
- "@xyo-network/os-react-debug": "^4.2.0-rc.11",
66
- "@xyo-network/os-react-model": "^4.2.0-rc.11",
67
- "@xyo-network/os-runtime": "^4.2.0-rc.11",
64
+ "@xyo-network/os-model": "^4.2.0-rc.13",
65
+ "@xyo-network/os-react-debug": "^4.2.0-rc.13",
66
+ "@xyo-network/os-react-model": "^4.2.0-rc.13",
67
+ "@xyo-network/os-runtime": "^4.2.0-rc.13",
68
68
  "@xyo-network/payload-model": "^3.6.6",
69
69
  "@xyo-network/react-archivist": "^4.3.1",
70
70
  "@xyo-network/react-card": "^4.3.1",
@@ -1,7 +1,7 @@
1
1
  import { animated, useTransition } from '@react-spring/web'
2
2
  import { ErrorRender } from '@xylabs/react-error'
3
3
  import type { ReactNode } from 'react'
4
- import React, { useMemo } from 'react'
4
+ import React from 'react'
5
5
 
6
6
  export interface PathToComponent<PathNames extends string = string> {
7
7
  component: ReactNode
@@ -23,17 +23,9 @@ export const DappPathSwitcher: React.FC<DappPathSwitcherProps> = ({ activePath,
23
23
  const possibleZIndex = pathToComponent?.findIndex(item => item.path === activePath)
24
24
  const zIndex = possibleZIndex !== -1 && possibleZIndex !== undefined ? possibleZIndex : 1
25
25
 
26
- const activeComponent = useMemo(() => {
27
- const activeIndex = pathToComponent?.findIndex(({ path: componentPath }) => activePath === componentPath)
28
- const activeItem = pathToComponent && activeIndex !== -1 && activeIndex !== undefined ? pathToComponent[activeIndex] : undefined
29
- return activeItem
30
- ? activeItem.component
31
- : <ErrorRender error={new Error(`No component found for path: ${activePath}`)} scope="DappPathSwitcher" />
32
- }, [activePath, pathToComponent])
33
-
34
26
  return (
35
27
  <>
36
- {transitions(transitionProps => (
28
+ {transitions((transitionProps, activePathRef) => (
37
29
  <animated.div
38
30
  style={{
39
31
  ...transitionProps,
@@ -51,7 +43,13 @@ export const DappPathSwitcher: React.FC<DappPathSwitcherProps> = ({ activePath,
51
43
  zIndex,
52
44
  }}
53
45
  >
54
- {activeComponent}
46
+ {(() => {
47
+ const activeIndex = pathToComponent?.findIndex(({ path: componentPath }) => activePathRef === componentPath)
48
+ const activeItem = pathToComponent && activeIndex !== -1 && activeIndex !== undefined ? pathToComponent[activeIndex] : undefined
49
+ return activeItem
50
+ ? activeItem.component
51
+ : <ErrorRender error={new Error(`No component found for path: ${activePathRef}`)} scope="DappPathSwitcher" />
52
+ })()}
55
53
  </animated.div>
56
54
  ))}
57
55
  </>
@@ -4,9 +4,7 @@ import React, { memo, useMemo } from 'react'
4
4
 
5
5
  import { useDappContextCreator } from '../../hooks/index.ts'
6
6
  import { DappIconButton } from './Button/index.ts'
7
- import {
8
- DappWindow, deriveDappState, useManageDappPathFromRoute,
9
- } from './modules/index.ts'
7
+ import { DappWindow, deriveDappState } from './modules/index.ts'
10
8
 
11
9
  export interface DappContainerProps {
12
10
  currentIntent?: DappIntent
@@ -24,8 +22,6 @@ export const DappContainer: React.FC<DappContainerProps> = ({
24
22
  dappWallet, context, nodeCreateError,
25
23
  } = useDappContextCreator(xnsNodeUrl, xnsNetwork, dapp, currentIntent)
26
24
 
27
- useManageDappPathFromRoute(context, dapp.config.name)
28
-
29
25
  const dappState = useMemo(() => {
30
26
  if (currentIntent?.targetDappId === dapp.config.name) {
31
27
  return deriveDappState(currentIntent)
@@ -15,7 +15,7 @@ import { DappBar } from './AppBar.js'
15
15
  import { DappChrome } from './Chrome.js'
16
16
  import type { DappState } from './hooks/index.ts'
17
17
  import {
18
- decomposeDappSet, useDappMenu, useManageDappInjectableParamsFromRoute, useSyncOsRegisteredAccessInterfaces,
18
+ decomposeDappSet, useDappMenu, useManageDappInjectableParamsFromRoute, useManageDappPathFromRoute, useSyncOsRegisteredAccessInterfaces,
19
19
  } from './hooks/index.ts'
20
20
  import { DappLoadingFlexbox } from './LoadingFlexbox.js'
21
21
  import { DappBottomNavigation, DappMenuDrawer } from './menu/index.ts'
@@ -45,13 +45,14 @@ export const DappWindow: React.FC<DappWindowProps> = ({
45
45
  }>, [])
46
46
 
47
47
  useSyncOsRegisteredAccessInterfaces(context)
48
- const routingErrors = useManageDappInjectableParamsFromRoute(context)
48
+ const routingError = useManageDappPathFromRoute(context, name)
49
+ const injectableErrors = useManageDappInjectableParamsFromRoute(context)
49
50
 
50
51
  const {
51
52
  activePath, error: menuError, menuConfig, menuItemsVisible, onPathChange,
52
53
  } = useDappMenu(context, name)
53
54
 
54
- const resolvedErrors = [...routingErrors, nodeCreateError, menuError, ...(errors ?? [])].filter(Boolean)
55
+ const resolvedErrors = [...injectableErrors, routingError, nodeCreateError, menuError, ...(errors ?? [])].filter(Boolean)
55
56
  const hasErrors = resolvedErrors.length > 0
56
57
 
57
58
  return (
@@ -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
  }