@xyo-network/os-react-runtime 4.2.0-rc.1 → 4.2.0-rc.10

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 (43) hide show
  1. package/dist/browser/DappPathSwitcher.d.ts.map +1 -1
  2. package/dist/browser/hooks/os/useDappContextCreator.d.ts.map +1 -1
  3. package/dist/browser/index.mjs +86 -90
  4. package/dist/browser/index.mjs.map +1 -1
  5. package/dist/browser/modules/Dapp/Container.d.ts +1 -0
  6. package/dist/browser/modules/Dapp/Container.d.ts.map +1 -1
  7. package/dist/browser/modules/Dapp/Page/Row.d.ts +2 -1
  8. package/dist/browser/modules/Dapp/Page/Row.d.ts.map +1 -1
  9. package/dist/browser/modules/Dapp/modules/Window/DappWindow.d.ts +4 -3
  10. package/dist/browser/modules/Dapp/modules/Window/DappWindow.d.ts.map +1 -1
  11. package/dist/browser/modules/Dapp/modules/Window/hooks/index.d.ts +1 -0
  12. package/dist/browser/modules/Dapp/modules/Window/hooks/index.d.ts.map +1 -1
  13. package/dist/browser/modules/Dapp/modules/Window/hooks/lib/deriveDappState.d.ts +3 -3
  14. package/dist/browser/modules/Dapp/modules/Window/hooks/lib/deriveDappState.d.ts.map +1 -1
  15. package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/index.d.ts +4 -4
  16. package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/index.d.ts.map +1 -1
  17. package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.d.ts +1 -1
  18. package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.d.ts.map +1 -1
  19. package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.d.ts +2 -0
  20. package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.d.ts.map +1 -1
  21. package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappStateFromRoute.d.ts +2 -2
  22. package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappStateFromRoute.d.ts.map +1 -1
  23. package/dist/browser/modules/Dapp/modules/Window/hooks/route/index.d.ts +0 -1
  24. package/dist/browser/modules/Dapp/modules/Window/hooks/route/index.d.ts.map +1 -1
  25. package/package.json +9 -9
  26. package/src/DappPathSwitcher.tsx +11 -9
  27. package/src/hooks/os/useDappContextCreator.tsx +20 -15
  28. package/src/hooks/os/useWidgetDapps.tsx +1 -1
  29. package/src/modules/Dapp/Container.tsx +5 -3
  30. package/src/modules/Dapp/Page/Row.tsx +8 -10
  31. package/src/modules/Dapp/modules/Window/DappWindow.tsx +17 -21
  32. package/src/modules/Dapp/modules/Window/hooks/index.ts +1 -0
  33. package/src/modules/Dapp/modules/Window/hooks/lib/deriveDappState.ts +6 -6
  34. package/src/modules/Dapp/modules/Window/hooks/menu/useDappMenu.tsx +1 -1
  35. package/src/modules/Dapp/modules/Window/hooks/route/helpers/RoutingNodes.md +7 -0
  36. package/src/modules/Dapp/modules/Window/hooks/route/helpers/index.ts +4 -4
  37. package/src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.tsx +1 -1
  38. package/src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.tsx +2 -0
  39. package/src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappStateFromRoute.tsx +26 -20
  40. package/src/modules/Dapp/modules/Window/hooks/route/index.ts +0 -1
  41. package/dist/browser/modules/Dapp/modules/Window/hooks/route/useManageDappBasedOffRoute.d.ts +0 -19
  42. package/dist/browser/modules/Dapp/modules/Window/hooks/route/useManageDappBasedOffRoute.d.ts.map +0 -1
  43. package/src/modules/Dapp/modules/Window/hooks/route/useManageDappBasedOffRoute.tsx +0 -33
@@ -8,4 +8,5 @@ export interface DappContainerProps {
8
8
  xnsNodeUrl: string | undefined;
9
9
  }
10
10
  export declare const DappContainer: React.FC<DappContainerProps>;
11
+ export declare const DappContainerMemo: React.NamedExoticComponent<DappContainerProps>;
11
12
  //# sourceMappingURL=Container.d.ts.map
@@ -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,KAAkB,MAAM,OAAO,CAAA;AAMtC,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"}
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,8 +1,9 @@
1
- import type { InstallationType } from '@xyo-network/os-model';
1
+ import type { DappIntent, InstallationType } from '@xyo-network/os-model';
2
2
  import type { RegisteredReactDappSet } from '@xyo-network/os-react-model';
3
3
  import React from 'react';
4
4
  export interface DappsRowProps {
5
5
  chipLabel: string;
6
+ currentIntent?: DappIntent;
6
7
  installType: InstallationType;
7
8
  registeredDappsSet?: RegisteredReactDappSet[];
8
9
  xnsNetwork: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Row.d.ts","sourceRoot":"","sources":["../../../../../src/modules/Dapp/Page/Row.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACzE,OAAO,KAAkB,MAAM,OAAO,CAAA;AAOtC,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,gBAAgB,CAAA;IAC7B,kBAAkB,CAAC,EAAE,sBAAsB,EAAE,CAAA;IAC7C,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAuC5C,CAAA;AAED,eAAO,MAAM,mBAAmB,ySAQ7B,CAAA"}
1
+ {"version":3,"file":"Row.d.ts","sourceRoot":"","sources":["../../../../../src/modules/Dapp/Page/Row.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACzE,OAAO,KAAkB,MAAM,OAAO,CAAA;AAMtC,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B,WAAW,EAAE,gBAAgB,CAAA;IAC7B,kBAAkB,CAAC,EAAE,sBAAsB,EAAE,CAAA;IAC7C,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAsC5C,CAAA;AAED,eAAO,MAAM,mBAAmB,ySAQ7B,CAAA"}
@@ -1,13 +1,14 @@
1
- import type { DappIntent, XyOsContext } from '@xyo-network/os-model';
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?: XyOsContext | null;
7
+ context?: XyOsUiContext | null;
8
8
  dappSet?: RegisteredReactDappSet;
9
9
  dappState?: DappState;
10
10
  dappWallet?: WalletInstance;
11
+ errors?: Error[];
11
12
  intent?: DappIntent;
12
13
  nodeCreateError?: Error;
13
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DappWindow.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/Dapp/modules/Window/DappWindow.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAIzE,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,WAAW,GAAG,IAAI,CAAA;IAC5B,OAAO,CAAC,EAAE,sBAAsB,CAAA;IAChC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,eAAe,CAAC,EAAE,KAAK,CAAA;CACxB;AAED,gIAAgI;AAChI,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAwHhD,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,6 +1,7 @@
1
1
  export * from './lib/index.ts';
2
2
  export * from './menu/index.ts';
3
3
  export * from './route/index.ts';
4
+ export * from './useDappMenuResourceValues.tsx';
4
5
  export * from './useDecomposeDappSet.js';
5
6
  export * from './useSkipLoadingScreen.js';
6
7
  export * from './useSyncOsRegisteredAccessInterfaces.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/Dapp/modules/Window/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,0CAA0C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/Dapp/modules/Window/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,0CAA0C,CAAA"}
@@ -1,8 +1,8 @@
1
- import type { DappIntent, XyOsContext } from '@xyo-network/os-model';
1
+ import type { DappIntent } from '@xyo-network/os-model';
2
2
  export interface DappState {
3
3
  active: boolean;
4
+ closed: boolean;
4
5
  minimized: boolean;
5
- open: boolean;
6
6
  }
7
- export declare const deriveDappState: (intent?: DappIntent, context?: XyOsContext | null) => DappState;
7
+ export declare const deriveDappState: (intent?: DappIntent) => DappState;
8
8
  //# sourceMappingURL=deriveDappState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deriveDappState.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/Dapp/modules/Window/hooks/lib/deriveDappState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGpE,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;IAClB,IAAI,EAAE,OAAO,CAAA;CACd;AAED,eAAO,MAAM,eAAe,YAAa,UAAU,YAAY,WAAW,GAAG,IAAI,KAAG,SAUnF,CAAA"}
1
+ {"version":3,"file":"deriveDappState.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/Dapp/modules/Window/hooks/lib/deriveDappState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAGvD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,eAAO,MAAM,eAAe,YAAa,UAAU,KAAG,SAUrD,CAAA"}
@@ -1,5 +1,5 @@
1
- export * from './useManageDappInjectableParamsFromRoute.js';
2
- export * from './useManageDappIntentRequest.js';
3
- export * from './useManageDappPathFromRoute.js';
4
- export * from './useManageDappStateFromRoute.js';
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,6CAA6C,CAAA;AAC3D,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA"}
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
- /** React to change in the query params */
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,0CAA0C;AAC1C,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;AAOxD,6FAA6F;AAC7F,eAAO,MAAM,sCAAsC,aAAc,WAAW,GAAG,IAAI,0BA8ClF,CAAA"}
@@ -1,5 +1,7 @@
1
1
  import type { XyOsContext } from '@xyo-network/os-model';
2
2
  /**
3
+ * Update the menu archivist based off changes in the the `path` route param
4
+ *
3
5
  * Test Cases:
4
6
  *
5
7
  * 1. Clicking sidebar menu
@@ -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;;;;;;;;GAQG;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,SAiDzF,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import type { DappIntent } from '@xyo-network/os-model';
2
- /** React to changes in `dappName` route param */
3
- export declare const useManageDappStateFromRoute: (intentPayload?: DappIntent, dappName?: string) => void;
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;AAOvD,iDAAiD;AACjD,eAAO,MAAM,2BAA2B,mBAAoB,UAAU,aAAa,MAAM,SAmCxF,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,3 +1,2 @@
1
1
  export * from './helpers/index.ts';
2
- export * from './useManageDappBasedOffRoute.js';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -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;AAClC,cAAc,iCAAiC,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.1",
3
+ "version": "4.2.0-rc.10",
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.1",
52
- "@xyo-network/bios-model": "^4.2.0-rc.1",
51
+ "@xyo-network/bios-browser": "^4.2.0-rc.10",
52
+ "@xyo-network/bios-model": "^4.2.0-rc.10",
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.1",
59
- "@xyo-network/kernel-model": "^4.2.0-rc.1",
58
+ "@xyo-network/kernel": "^4.2.0-rc.10",
59
+ "@xyo-network/kernel-model": "^4.2.0-rc.10",
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.1",
65
- "@xyo-network/os-react-debug": "^4.2.0-rc.1",
66
- "@xyo-network/os-react-model": "^4.2.0-rc.1",
67
- "@xyo-network/os-runtime": "^4.2.0-rc.1",
64
+ "@xyo-network/os-model": "^4.2.0-rc.10",
65
+ "@xyo-network/os-react-debug": "^4.2.0-rc.10",
66
+ "@xyo-network/os-react-model": "^4.2.0-rc.10",
67
+ "@xyo-network/os-runtime": "^4.2.0-rc.10",
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 from 'react'
4
+ import React, { useMemo } from 'react'
5
5
 
6
6
  export interface PathToComponent<PathNames extends string = string> {
7
7
  component: ReactNode
@@ -23,9 +23,17 @@ 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
+
26
34
  return (
27
35
  <>
28
- {transitions((transitionProps, activePath) => (
36
+ {transitions(transitionProps => (
29
37
  <animated.div
30
38
  style={{
31
39
  ...transitionProps,
@@ -43,13 +51,7 @@ export const DappPathSwitcher: React.FC<DappPathSwitcherProps> = ({ activePath,
43
51
  zIndex,
44
52
  }}
45
53
  >
46
- {(() => {
47
- const activeIndex = pathToComponent?.findIndex(({ path: componentPath }) => activePath === 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: ${activePath}`)} scope="DappPathSwitcher" />
52
- })()}
54
+ {activeComponent}
53
55
  </animated.div>
54
56
  ))}
55
57
  </>
@@ -28,6 +28,8 @@ export const useDappContextCreator = (
28
28
  const context = useXyOsUiContext()
29
29
  const [windowDappNodeSet, setWindowDappNodeSet] = useState<WindowDappNodeSet>({ context: undefined, dappWallet: undefined })
30
30
  const [dappWindowNodeError, setDappWindowNodeError] = useState<Error>()
31
+ // ensure the dapp is targeted by the current intent
32
+ const targetedDapp = !!(dapp && context && currentIntent?.targetDappId === dapp?.config.name)
31
33
 
32
34
  // Keep a ref of the windowDappNodeSet to use in effect hooks without needing it as a dependency
33
35
  const windowDappNodeSetRef = useRef<WindowDappNodeSet>(windowDappNodeSet)
@@ -36,7 +38,7 @@ export const useDappContextCreator = (
36
38
  }, [windowDappNodeSet])
37
39
 
38
40
  const createNode = useCallback(async () => {
39
- if (dapp && context) {
41
+ if (targetedDapp) {
40
42
  try {
41
43
  const windowDappNodeSet = await RunningDappCache.findOrCreate(dapp, context, allowedNames ?? [], xnsNodeUrl, xnsNetwork)
42
44
  setWindowDappNodeSet(windowDappNodeSet)
@@ -44,7 +46,7 @@ export const useDappContextCreator = (
44
46
  setDappWindowNodeError(e as Error)
45
47
  }
46
48
  }
47
- }, [dapp, context, allowedNames])
49
+ }, [dapp, currentIntent, context, allowedNames])
48
50
 
49
51
  useEffect(() => {
50
52
  if (createOnMount) {
@@ -58,21 +60,24 @@ export const useDappContextCreator = (
58
60
  useAsyncEffect(
59
61
 
60
62
  async () => {
61
- switch (currentIntent?.intent) {
62
- case DappIntentTypes.Launch: {
63
- await createNode()
64
- break
65
- }
66
- case DappIntentTypes.Close: {
67
- if (windowDappNodeSetRef.current.context) {
68
- // In case a cached dapp was closed, clear its Dapp Archivist to allow for a fresh start upon next launch
69
- await DappContextCreator.resetDappArchivist(windowDappNodeSetRef.current.context)
70
- setWindowDappNodeSet({ context: null, dappWallet: undefined })
63
+ // unless the dapp was passed, do nothing
64
+ if (targetedDapp) {
65
+ switch (currentIntent?.intent) {
66
+ case DappIntentTypes.Launch: {
67
+ await createNode()
68
+ break
69
+ }
70
+ case DappIntentTypes.Close: {
71
+ if (windowDappNodeSetRef.current.context) {
72
+ // In case a cached dapp was closed, clear its Dapp Archivist to allow for a fresh start upon next launch
73
+ await DappContextCreator.resetDappArchivist(windowDappNodeSetRef.current.context)
74
+ setWindowDappNodeSet({ context: null, dappWallet: undefined })
75
+ }
76
+ break
71
77
  }
72
- break
78
+ case DappIntentTypes.Minimize:
79
+ // do nothing
73
80
  }
74
- case DappIntentTypes.Minimize:
75
- // do nothing
76
81
  }
77
82
  },
78
83
  [createNode, currentIntent],
@@ -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,6 +1,6 @@
1
1
  import type { DappIntent } from '@xyo-network/os-model'
2
2
  import type { RegisteredReactDappSet } from '@xyo-network/os-react-model'
3
- import React, { useMemo } from 'react'
3
+ import React, { memo, useMemo } from 'react'
4
4
 
5
5
  import { useDappContextCreator } from '../../hooks/index.ts'
6
6
  import { DappIconButton } from './Button/index.ts'
@@ -24,9 +24,9 @@ export const DappContainer: React.FC<DappContainerProps> = ({
24
24
 
25
25
  const dappState = useMemo(() => {
26
26
  if (currentIntent?.targetDappId === dapp.config.name) {
27
- return deriveDappState(currentIntent, context)
27
+ return deriveDappState(currentIntent)
28
28
  }
29
- }, [currentIntent, context, dapp])
29
+ }, [currentIntent, dapp])
30
30
 
31
31
  return (
32
32
  <DappIconButton
@@ -46,3 +46,5 @@ export const DappContainer: React.FC<DappContainerProps> = ({
46
46
  </DappIconButton>
47
47
  )
48
48
  }
49
+
50
+ export const DappContainerMemo = memo(DappContainer)
@@ -1,18 +1,17 @@
1
- /* eslint-disable @eslint-react/no-array-index-key */
2
1
  import {
3
2
  Divider, Fade, styled,
4
3
  } from '@mui/material'
5
- import type { InstallationType } from '@xyo-network/os-model'
4
+ import type { DappIntent, InstallationType } from '@xyo-network/os-model'
6
5
  import type { RegisteredReactDappSet } from '@xyo-network/os-react-model'
7
6
  import React, { useMemo } from 'react'
8
7
 
9
- import { useDappIntentListener } from '../../../hooks/index.ts'
10
8
  import { DappInstallTypeFilters } from '../../../utils/index.ts'
11
- import { DappContainer } from '../Container.js'
9
+ import { DappContainerMemo } from '../Container.tsx'
12
10
  import { DividerChip } from './DividerChip.js'
13
11
 
14
12
  export interface DappsRowProps {
15
13
  chipLabel: string
14
+ currentIntent?: DappIntent
16
15
  installType: InstallationType
17
16
  registeredDappsSet?: RegisteredReactDappSet[]
18
17
  xnsNetwork: string | undefined
@@ -20,10 +19,9 @@ export interface DappsRowProps {
20
19
  }
21
20
 
22
21
  export const DappsRow: React.FC<DappsRowProps> = ({
23
- chipLabel, installType, registeredDappsSet, xnsNetwork, xnsNodeUrl,
22
+ chipLabel, currentIntent, installType, registeredDappsSet, xnsNetwork, xnsNodeUrl,
24
23
  }) => {
25
24
  const filteredRegisteredDappSets = useMemo(() => DappInstallTypeFilters[installType](registeredDappsSet), [installType, registeredDappsSet])
26
- const { intentPayload } = useDappIntentListener(null)
27
25
 
28
26
  return (
29
27
  <>
@@ -42,10 +40,10 @@ export const DappsRow: React.FC<DappsRowProps> = ({
42
40
  <Fade in={!!filteredRegisteredDappSets?.length} timeout={1000}>
43
41
  <StyledGridContainer>
44
42
  {filteredRegisteredDappSets?.map(
45
- (dappSet, index) => (
46
- <DappContainer
47
- currentIntent={intentPayload}
48
- key={index}
43
+ dappSet => (
44
+ <DappContainerMemo
45
+ currentIntent={currentIntent}
46
+ key={dappSet.dapp.config.name}
49
47
  dappSet={dappSet as RegisteredReactDappSet}
50
48
  xnsNodeUrl={xnsNodeUrl}
51
49
  xnsNetwork={xnsNetwork}
@@ -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, XyOsContext } from '@xyo-network/os-model'
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'
@@ -16,45 +15,45 @@ import { DappBar } from './AppBar.js'
16
15
  import { DappChrome } from './Chrome.js'
17
16
  import type { DappState } from './hooks/index.ts'
18
17
  import {
19
- decomposeDappSet, useDappMenu, useManageDappBasedOffRoute, useSyncOsRegisteredAccessInterfaces,
18
+ decomposeDappSet, useDappMenu, useManageDappInjectableParamsFromRoute, useManageDappPathFromRoute, useSyncOsRegisteredAccessInterfaces,
20
19
  } from './hooks/index.ts'
21
20
  import { DappLoadingFlexbox } from './LoadingFlexbox.js'
22
21
  import { DappBottomNavigation, DappMenuDrawer } from './menu/index.ts'
23
22
 
24
23
  export interface DappWindowProps {
25
- context?: XyOsContext | null
24
+ context?: XyOsUiContext | null
26
25
  dappSet?: RegisteredReactDappSet
27
26
  dappState?: DappState
28
27
  dappWallet?: WalletInstance
28
+ errors?: Error[]
29
29
  intent?: DappIntent
30
30
  nodeCreateError?: Error
31
31
  }
32
32
 
33
33
  /** A component that can load immediately, but delays node loading and dapp mounting till corresponding launch intent arrives */
34
34
  export const DappWindow: React.FC<DappWindowProps> = ({
35
- context, dappSet, dappState, dappWallet, intent, nodeCreateError,
35
+ context, dappSet, dappState, dappWallet, errors, nodeCreateError,
36
36
  }) => {
37
37
  const {
38
38
  DappComponent, name, scrollable = true, version,
39
39
  } = decomposeDappSet(dappSet)
40
40
 
41
- const {
42
- active, minimized, open,
43
- } = dappState ?? {}
41
+ const { active, minimized } = dappState ?? {}
44
42
 
45
43
  const TypedDappComponent = useMemo(() => DappComponent as React.FC<{
46
44
  name?: string
47
45
  }>, [])
48
46
 
49
- // TODO - see if we can move this outside of the DappWindow component
50
- const errors = useManageDappBasedOffRoute(intent, name, context)
51
47
  useSyncOsRegisteredAccessInterfaces(context)
48
+ useManageDappPathFromRoute(context, name)
49
+ useManageDappInjectableParamsFromRoute(context)
52
50
 
53
51
  const {
54
52
  activePath, error: menuError, menuConfig, menuItemsVisible, onPathChange,
55
53
  } = useDappMenu(context, name)
56
54
 
57
- const resolvedError = nodeCreateError || menuError
55
+ const resolvedErrors = [nodeCreateError, menuError, ...(errors ?? [])].filter(Boolean)
56
+ const hasErrors = resolvedErrors.length > 0
58
57
 
59
58
  return (
60
59
  <>
@@ -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}
@@ -102,16 +101,13 @@ export const DappWindow: React.FC<DappWindowProps> = ({
102
101
  />
103
102
  )}
104
103
  /* Ensure that loading goes away when error occurs */
105
- splashScreen={resolvedError ? null : <DappLoadingFlexbox minimize={!!minimized} name={name} open={!!open} />}
104
+ splashScreen={hasErrors ? null : <DappLoadingFlexbox minimize={!!minimized} name={name} open={!!active} />}
106
105
  >
107
- {resolvedError || errors?.length > 0
106
+ {hasErrors
108
107
  ? (
109
108
  <FlexCol padding={2}>
110
- {resolvedError
111
- ? <ErrorRender error={resolvedError} scope="DappWindow" />
112
- : null}
113
- {errors.map((error, index) => (
114
- <ErrorRender key={index} error={error} scope="DappWindowErrors" />
109
+ {resolvedErrors?.map(error => (
110
+ <ErrorRender key={error?.message} error={error} scope="DappWindow" />
115
111
  ))}
116
112
  </FlexCol>
117
113
  )
@@ -1,6 +1,7 @@
1
1
  export * from './lib/index.ts'
2
2
  export * from './menu/index.ts'
3
3
  export * from './route/index.ts'
4
+ export * from './useDappMenuResourceValues.tsx'
4
5
  export * from './useDecomposeDappSet.js'
5
6
  export * from './useSkipLoadingScreen.js'
6
7
  export * from './useSyncOsRegisteredAccessInterfaces.js'
@@ -1,20 +1,20 @@
1
- import type { DappIntent, XyOsContext } from '@xyo-network/os-model'
1
+ import type { DappIntent } from '@xyo-network/os-model'
2
2
  import { DappIntentTypes } from '@xyo-network/os-model'
3
3
 
4
4
  export interface DappState {
5
5
  active: boolean
6
+ closed: boolean
6
7
  minimized: boolean
7
- open: boolean
8
8
  }
9
9
 
10
- export const deriveDappState = (intent?: DappIntent, context?: XyOsContext | null): DappState => {
10
+ export const deriveDappState = (intent?: DappIntent): DappState => {
11
11
  const minimized = intent?.intent === DappIntentTypes.Minimize
12
- const open = intent?.intent === DappIntentTypes.Launch
13
- const active = !!(context && open)
12
+ const active = intent?.intent === DappIntentTypes.Launch
13
+ const closed = intent?.intent === DappIntentTypes.Close
14
14
 
15
15
  return {
16
16
  active,
17
+ closed,
17
18
  minimized,
18
- open,
19
19
  }
20
20
  }
@@ -6,7 +6,7 @@ import {
6
6
  import { useNavigate, useParams } from 'react-router-dom'
7
7
 
8
8
  import { DappPathHelpers } from '../lib/index.ts'
9
- import { useDappMenuDependencies } from '../useDappMenuResourceValues.js'
9
+ import { useDappMenuDependencies } from '../useDappMenuResourceValues.tsx'
10
10
 
11
11
  /**
12
12
  * Use the passed in dapp Node to resolve menu related modules and return the menu related items
@@ -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.js'
2
- export * from './useManageDappIntentRequest.js'
3
- export * from './useManageDappPathFromRoute.js'
4
- export * from './useManageDappStateFromRoute.js'
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
- /** React to change in the query params */
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