@xyo-network/os-react-runtime 4.2.0-rc.5 → 4.2.0-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.mjs +21 -37
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/DappWindow.d.ts +3 -3
- package/dist/browser/modules/Dapp/modules/Window/DappWindow.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/index.d.ts +4 -4
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/index.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.d.ts +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.d.ts +2 -0
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappStateFromRoute.d.ts +2 -2
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappStateFromRoute.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/index.d.ts +0 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/index.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/hooks/os/useWidgetDapps.tsx +1 -1
- package/src/modules/Dapp/modules/Window/DappWindow.tsx +7 -8
- package/src/modules/Dapp/modules/Window/hooks/route/helpers/RoutingNodes.md +7 -0
- package/src/modules/Dapp/modules/Window/hooks/route/helpers/index.ts +4 -4
- package/src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.tsx +1 -1
- package/src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.tsx +2 -0
- package/src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappStateFromRoute.tsx +26 -20
- package/src/modules/Dapp/modules/Window/hooks/route/index.ts +0 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/useManageDappBasedOffRoute.d.ts +0 -19
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/useManageDappBasedOffRoute.d.ts.map +0 -1
- package/src/modules/Dapp/modules/Window/hooks/route/useManageDappBasedOffRoute.tsx +0 -33
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { DappIntent
|
|
2
|
-
import type { RegisteredReactDappSet } from '@xyo-network/os-react-model';
|
|
1
|
+
import type { DappIntent } from '@xyo-network/os-model';
|
|
2
|
+
import type { RegisteredReactDappSet, XyOsUiContext } from '@xyo-network/os-react-model';
|
|
3
3
|
import type { WalletInstance } from '@xyo-network/wallet-model';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import type { DappState } from './hooks/index.ts';
|
|
6
6
|
export interface DappWindowProps {
|
|
7
|
-
context?:
|
|
7
|
+
context?: XyOsUiContext | null;
|
|
8
8
|
dappSet?: RegisteredReactDappSet;
|
|
9
9
|
dappState?: DappState;
|
|
10
10
|
dappWallet?: WalletInstance;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DappWindow.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/Dapp/modules/Window/DappWindow.tsx"],"names":[],"mappings":"
|
|
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,5 +1,5 @@
|
|
|
1
|
-
export * from './useManageDappInjectableParamsFromRoute.
|
|
2
|
-
export * from './useManageDappIntentRequest.
|
|
3
|
-
export * from './useManageDappPathFromRoute.
|
|
4
|
-
export * from './useManageDappStateFromRoute.
|
|
1
|
+
export * from './useManageDappInjectableParamsFromRoute.tsx';
|
|
2
|
+
export * from './useManageDappIntentRequest.tsx';
|
|
3
|
+
export * from './useManageDappPathFromRoute.tsx';
|
|
4
|
+
export * from './useManageDappStateFromRoute.tsx';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,8CAA8C,CAAA;AAC5D,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,mCAAmC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { XyOsContext } from '@xyo-network/os-model';
|
|
2
|
-
/**
|
|
2
|
+
/** Update the dapp archivist with injectable params based off changes in the query params */
|
|
3
3
|
export declare const useManageDappInjectableParamsFromRoute: (context?: XyOsContext | null) => (Error | undefined)[];
|
|
4
4
|
//# sourceMappingURL=useManageDappInjectableParamsFromRoute.d.ts.map
|
|
@@ -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,
|
|
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 +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
|
|
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,4 +1,4 @@
|
|
|
1
1
|
import type { DappIntent } from '@xyo-network/os-model';
|
|
2
|
-
/**
|
|
3
|
-
export declare const useManageDappStateFromRoute: (intentPayload?: DappIntent
|
|
2
|
+
/** Launch or close the dapp based off changes to the `dappName` route param */
|
|
3
|
+
export declare const useManageDappStateFromRoute: (intentPayload?: DappIntent) => void;
|
|
4
4
|
//# sourceMappingURL=useManageDappStateFromRoute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useManageDappStateFromRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappStateFromRoute.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"useManageDappStateFromRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappStateFromRoute.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAQvD,+EAA+E;AAC/E,eAAO,MAAM,2BAA2B,mBAAoB,UAAU,SAwCrE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,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.
|
|
3
|
+
"version": "4.2.0-rc.7",
|
|
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.
|
|
52
|
-
"@xyo-network/bios-model": "^4.2.0-rc.
|
|
51
|
+
"@xyo-network/bios-browser": "^4.2.0-rc.7",
|
|
52
|
+
"@xyo-network/bios-model": "^4.2.0-rc.7",
|
|
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.
|
|
59
|
-
"@xyo-network/kernel-model": "^4.2.0-rc.
|
|
58
|
+
"@xyo-network/kernel": "^4.2.0-rc.7",
|
|
59
|
+
"@xyo-network/kernel-model": "^4.2.0-rc.7",
|
|
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.
|
|
65
|
-
"@xyo-network/os-react-debug": "^4.2.0-rc.
|
|
66
|
-
"@xyo-network/os-react-model": "^4.2.0-rc.
|
|
67
|
-
"@xyo-network/os-runtime": "^4.2.0-rc.
|
|
64
|
+
"@xyo-network/os-model": "^4.2.0-rc.7",
|
|
65
|
+
"@xyo-network/os-react-debug": "^4.2.0-rc.7",
|
|
66
|
+
"@xyo-network/os-react-model": "^4.2.0-rc.7",
|
|
67
|
+
"@xyo-network/os-runtime": "^4.2.0-rc.7",
|
|
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",
|
|
@@ -15,7 +15,7 @@ export const useWidgetDapps = (
|
|
|
15
15
|
): [WidgetResults, Error | undefined, UsePromiseState | undefined] => {
|
|
16
16
|
const context = useXyOsUiContext()
|
|
17
17
|
return usePromise(async () => {
|
|
18
|
-
if (registeredDapps && context && widgetTrayLayout) {
|
|
18
|
+
if (registeredDapps && registeredDapps.length > 0 && context && widgetTrayLayout) {
|
|
19
19
|
const caller = new WidgetCaller(context, registeredDapps, widgetTrayLayout)
|
|
20
20
|
return await caller.buildWidgetComponents()
|
|
21
21
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/* eslint-disable @eslint-react/no-array-index-key */
|
|
2
1
|
import { ErrorBoundary, ErrorRender } from '@xylabs/react-error'
|
|
3
2
|
import { FlexCol } from '@xylabs/react-flexbox'
|
|
4
|
-
import type { DappIntent
|
|
5
|
-
import type { RegisteredReactDappSet } from '@xyo-network/os-react-model'
|
|
3
|
+
import type { DappIntent } from '@xyo-network/os-model'
|
|
4
|
+
import type { RegisteredReactDappSet, XyOsUiContext } from '@xyo-network/os-react-model'
|
|
6
5
|
import { NameTransforms } from '@xyo-network/os-runtime'
|
|
7
6
|
import { NodeProvider } from '@xyo-network/react-node'
|
|
8
7
|
import { WalletProvider } from '@xyo-network/react-wallet'
|
|
@@ -22,7 +21,7 @@ import { DappLoadingFlexbox } from './LoadingFlexbox.js'
|
|
|
22
21
|
import { DappBottomNavigation, DappMenuDrawer } from './menu/index.ts'
|
|
23
22
|
|
|
24
23
|
export interface DappWindowProps {
|
|
25
|
-
context?:
|
|
24
|
+
context?: XyOsUiContext | null
|
|
26
25
|
dappSet?: RegisteredReactDappSet
|
|
27
26
|
dappState?: DappState
|
|
28
27
|
dappWallet?: WalletInstance
|
|
@@ -81,7 +80,7 @@ export const DappWindow: React.FC<DappWindowProps> = ({
|
|
|
81
80
|
)}
|
|
82
81
|
height="100dvh"
|
|
83
82
|
width="100dvw"
|
|
84
|
-
largeScreenMenu={(
|
|
83
|
+
largeScreenMenu={active && (
|
|
85
84
|
<DappMenuDrawer
|
|
86
85
|
context={context}
|
|
87
86
|
name={name}
|
|
@@ -92,7 +91,7 @@ export const DappWindow: React.FC<DappWindowProps> = ({
|
|
|
92
91
|
menuItems={menuItemsVisible}
|
|
93
92
|
/>
|
|
94
93
|
)}
|
|
95
|
-
smallScreenMenu={(
|
|
94
|
+
smallScreenMenu={active && (
|
|
96
95
|
<DappBottomNavigation
|
|
97
96
|
activePath={activePath}
|
|
98
97
|
onPathChange={onPathChange}
|
|
@@ -107,8 +106,8 @@ export const DappWindow: React.FC<DappWindowProps> = ({
|
|
|
107
106
|
{hasErrors
|
|
108
107
|
? (
|
|
109
108
|
<FlexCol padding={2}>
|
|
110
|
-
{resolvedErrors?.map(
|
|
111
|
-
<ErrorRender key={
|
|
109
|
+
{resolvedErrors?.map(error => (
|
|
110
|
+
<ErrorRender key={error?.message} error={error} scope="DappWindow" />
|
|
112
111
|
))}
|
|
113
112
|
</FlexCol>
|
|
114
113
|
)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Manage the dapp based off the route params and intent type
|
|
2
|
+
|
|
3
|
+
This hook centralizes the logic for managing the dapp based off the route. It reacts to changes in the route params and performs the following:
|
|
4
|
+
|
|
5
|
+
1. Launch or close the dapp based off changes to the `dappName` route params
|
|
6
|
+
1. Update the menu archivist based off changes in the the `path` route param
|
|
7
|
+
1. Update the dapp archivist with injectable params based off changes in the query params
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './useManageDappInjectableParamsFromRoute.
|
|
2
|
-
export * from './useManageDappIntentRequest.
|
|
3
|
-
export * from './useManageDappPathFromRoute.
|
|
4
|
-
export * from './useManageDappStateFromRoute.
|
|
1
|
+
export * from './useManageDappInjectableParamsFromRoute.tsx'
|
|
2
|
+
export * from './useManageDappIntentRequest.tsx'
|
|
3
|
+
export * from './useManageDappPathFromRoute.tsx'
|
|
4
|
+
export * from './useManageDappStateFromRoute.tsx'
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useNavigate, useParams, useSearchParams,
|
|
10
10
|
} from 'react-router-dom'
|
|
11
11
|
|
|
12
|
-
/**
|
|
12
|
+
/** Update the dapp archivist with injectable params based off changes in the query params */
|
|
13
13
|
export const useManageDappInjectableParamsFromRoute = (context?: XyOsContext | null) => {
|
|
14
14
|
const [queryParams] = useSearchParams()
|
|
15
15
|
const params = useParams()
|
|
@@ -10,6 +10,8 @@ import { DappPathHelpers } from '../../lib/index.ts'
|
|
|
10
10
|
import { useDappMenuDependencies } from '../../useDappMenuResourceValues.js'
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
+
* Update the menu archivist based off changes in the the `path` route param
|
|
14
|
+
*
|
|
13
15
|
* Test Cases:
|
|
14
16
|
*
|
|
15
17
|
* 1. Clicking sidebar menu
|
|
@@ -2,44 +2,50 @@ import { usePromise } from '@xylabs/react-promise'
|
|
|
2
2
|
import type { DappIntent } from '@xyo-network/os-model'
|
|
3
3
|
import { DappIntentTypes } from '@xyo-network/os-model'
|
|
4
4
|
import { DappIntentCaller, NameTransforms } from '@xyo-network/os-runtime'
|
|
5
|
-
import {
|
|
5
|
+
import { useRef } from 'react'
|
|
6
|
+
import { useParams } from 'react-router-dom'
|
|
6
7
|
|
|
7
8
|
import { useDappIntentCaller, useSendDappIntent } from '../../../../../../../hooks/index.ts'
|
|
8
9
|
|
|
9
|
-
/**
|
|
10
|
-
export const useManageDappStateFromRoute = (intentPayload?: DappIntent
|
|
10
|
+
/** Launch or close the dapp based off changes to the `dappName` route param */
|
|
11
|
+
export const useManageDappStateFromRoute = (intentPayload?: DappIntent) => {
|
|
11
12
|
const params = useParams()
|
|
12
13
|
const { dappName: dappNameParam } = params
|
|
13
14
|
const sendIntent = useSendDappIntent()
|
|
14
|
-
const navigationType = useNavigationType()
|
|
15
15
|
const intentCaller = useDappIntentCaller()
|
|
16
16
|
|
|
17
|
+
// refs to track the dappName param and the last intent sent
|
|
18
|
+
const dappNameParamRef = useRef<string>()
|
|
19
|
+
const intentRef = useRef<DappIntent>()
|
|
20
|
+
|
|
17
21
|
// auto-close the dapp if it was launched and the route param goes undefined (i.e. back button clicked)
|
|
18
22
|
usePromise(async () => {
|
|
19
23
|
const launched = intentPayload?.intent === DappIntentTypes.Launch
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
const dappNameParamRemoved = !!dappNameParamRef.current && dappNameParam === undefined
|
|
25
|
+
// The last intent was Launch and the dappName param was removed
|
|
26
|
+
if (launched && dappNameParamRemoved && sendIntent) {
|
|
27
|
+
const closeIntent = DappIntentCaller.buildIntent(DappIntentCaller.OsDappName, DappIntentTypes.Close)
|
|
22
28
|
await sendIntent(closeIntent)
|
|
23
29
|
}
|
|
24
|
-
|
|
30
|
+
|
|
31
|
+
// sync back the dappNameParamRef for future checks
|
|
32
|
+
dappNameParamRef.current = dappNameParam
|
|
33
|
+
}, [dappNameParam, intentPayload, sendIntent])
|
|
25
34
|
|
|
26
35
|
// auto-launch the dapp if the route param matches the dapp name
|
|
27
36
|
usePromise(async () => {
|
|
28
|
-
if (dappNameParam &&
|
|
37
|
+
if (dappNameParam && sendIntent && intentCaller) {
|
|
29
38
|
const dappNameParamDeSlugged = new NameTransforms(dappNameParam).deSlug()
|
|
39
|
+
// no intents have been sent yet and the dappName param is set so we need to auto launch the dapp
|
|
40
|
+
const autoLaunchNeeded = intentRef.current === undefined && dappNameParam
|
|
30
41
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!existing) {
|
|
38
|
-
const launchIntent = DappIntentCaller.buildIntent(DappIntentCaller.OsDappName, DappIntentTypes.Launch, dappNameParamDeSlugged)
|
|
39
|
-
await sendIntent(launchIntent)
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
+
if (autoLaunchNeeded) {
|
|
43
|
+
const launchIntent = DappIntentCaller.buildIntent(DappIntentCaller.OsDappName, DappIntentTypes.Launch, dappNameParamDeSlugged)
|
|
44
|
+
await sendIntent(launchIntent)
|
|
45
|
+
// sync back the intentRef to ensure the auto launch only happens once
|
|
46
|
+
intentRef.current = launchIntent
|
|
47
|
+
return
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
|
-
}, [dappNameParam,
|
|
50
|
+
}, [dappNameParam, sendIntent, intentCaller, intentPayload?.intent])
|
|
45
51
|
}
|
package/dist/browser/modules/Dapp/modules/Window/hooks/route/useManageDappBasedOffRoute.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { DappIntent, XyOsContext } from '@xyo-network/os-model';
|
|
2
|
-
/**
|
|
3
|
-
* Manage the dapp based off the route params and intent type
|
|
4
|
-
*
|
|
5
|
-
* This hook centralizes the logic for managing the dapp based off the route.
|
|
6
|
-
*
|
|
7
|
-
* It reacts to changes in the route params and performs the following:
|
|
8
|
-
*
|
|
9
|
-
* 1. Launch or close the dapp based off changes to the `dappName` route params
|
|
10
|
-
* 2. Update the menu archivist based off changes in the the `path` route param
|
|
11
|
-
* 3. Update the dapp archivist with injectable params based off changes in the query params
|
|
12
|
-
*
|
|
13
|
-
* @param intentPayload - The intent type of the dapp
|
|
14
|
-
* @param dappName - The name of the dapp
|
|
15
|
-
* @param dappNode - The node instance of the dapp
|
|
16
|
-
* @param context - The context of the dapp
|
|
17
|
-
*/
|
|
18
|
-
export declare const useManageDappBasedOffRoute: (intentPayload?: DappIntent, dappName?: string, context?: XyOsContext | null) => (Error | undefined)[];
|
|
19
|
-
//# sourceMappingURL=useManageDappBasedOffRoute.d.ts.map
|
package/dist/browser/modules/Dapp/modules/Window/hooks/route/useManageDappBasedOffRoute.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useManageDappBasedOffRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/useManageDappBasedOffRoute.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AASpE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,0BAA0B,mBAAoB,UAAU,aAAa,MAAM,YAAY,WAAW,GAAG,IAAI,0BAOrH,CAAA"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { DappIntent, XyOsContext } from '@xyo-network/os-model'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
useManageDappInjectableParamsFromRoute,
|
|
5
|
-
useManageDappIntentRequest,
|
|
6
|
-
useManageDappPathFromRoute,
|
|
7
|
-
useManageDappStateFromRoute,
|
|
8
|
-
} from './helpers/index.ts'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Manage the dapp based off the route params and intent type
|
|
12
|
-
*
|
|
13
|
-
* This hook centralizes the logic for managing the dapp based off the route.
|
|
14
|
-
*
|
|
15
|
-
* It reacts to changes in the route params and performs the following:
|
|
16
|
-
*
|
|
17
|
-
* 1. Launch or close the dapp based off changes to the `dappName` route params
|
|
18
|
-
* 2. Update the menu archivist based off changes in the the `path` route param
|
|
19
|
-
* 3. Update the dapp archivist with injectable params based off changes in the query params
|
|
20
|
-
*
|
|
21
|
-
* @param intentPayload - The intent type of the dapp
|
|
22
|
-
* @param dappName - The name of the dapp
|
|
23
|
-
* @param dappNode - The node instance of the dapp
|
|
24
|
-
* @param context - The context of the dapp
|
|
25
|
-
*/
|
|
26
|
-
export const useManageDappBasedOffRoute = (intentPayload?: DappIntent, dappName?: string, context?: XyOsContext | null) => {
|
|
27
|
-
const handleIntentError = useManageDappIntentRequest(context, dappName)
|
|
28
|
-
useManageDappStateFromRoute(intentPayload, dappName)
|
|
29
|
-
useManageDappPathFromRoute(context, dappName)
|
|
30
|
-
const injectableErrors = useManageDappInjectableParamsFromRoute(context)
|
|
31
|
-
|
|
32
|
-
return [...injectableErrors, handleIntentError]
|
|
33
|
-
}
|