@dxos/react-client 2.19.4-dev.e19ce289 → 2.19.5-dev.4fb0c4a8

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 (50) hide show
  1. package/.rush/temp/package-deps_build.json +10 -8
  2. package/.rush/temp/package-deps_build:test.json +10 -8
  3. package/.rush/temp/shrinkwrap-deps.json +202 -6
  4. package/dist/src/banner.d.ts +2 -1
  5. package/dist/src/banner.d.ts.map +1 -1
  6. package/dist/src/banner.js +11 -6
  7. package/dist/src/banner.js.map +1 -1
  8. package/dist/src/containers/ClientProvider.d.ts.map +1 -1
  9. package/dist/src/containers/ClientProvider.js +1 -1
  10. package/dist/src/containers/ClientProvider.js.map +1 -1
  11. package/dist/src/hooks/bot-factory/index.d.ts +2 -0
  12. package/dist/src/hooks/bot-factory/index.d.ts.map +1 -0
  13. package/dist/src/hooks/bot-factory/index.js +17 -0
  14. package/dist/src/hooks/bot-factory/index.js.map +1 -0
  15. package/dist/src/hooks/bot-factory/useBotFactoryClient.d.ts +3 -0
  16. package/dist/src/hooks/bot-factory/useBotFactoryClient.d.ts.map +1 -0
  17. package/dist/src/hooks/bot-factory/useBotFactoryClient.js +31 -0
  18. package/dist/src/hooks/bot-factory/useBotFactoryClient.js.map +1 -0
  19. package/dist/src/hooks/index.d.ts +1 -0
  20. package/dist/src/hooks/index.d.ts.map +1 -1
  21. package/dist/src/hooks/index.js +1 -0
  22. package/dist/src/hooks/index.js.map +1 -1
  23. package/dist/src/hooks/invitations/useSecretGenerator.d.ts +1 -0
  24. package/dist/src/hooks/invitations/useSecretGenerator.d.ts.map +1 -1
  25. package/dist/src/testing/ProfileInitializer.d.ts +2 -2
  26. package/dist/src/testing/ProfileInitializer.d.ts.map +1 -1
  27. package/dist/src/testing/ProfileInitializer.js.map +1 -1
  28. package/dist/stories/helpers/ContactsSelector.d.ts +1 -0
  29. package/dist/stories/helpers/ContactsSelector.d.ts.map +1 -1
  30. package/dist/stories/helpers/Container.d.ts +2 -2
  31. package/dist/stories/helpers/Container.d.ts.map +1 -1
  32. package/dist/stories/helpers/Container.js.map +1 -1
  33. package/dist/stories/helpers/JsonPanel.d.ts +1 -0
  34. package/dist/stories/helpers/JsonPanel.d.ts.map +1 -1
  35. package/dist/stories/helpers/PartyJoinPanel.d.ts +1 -0
  36. package/dist/stories/helpers/PartyJoinPanel.d.ts.map +1 -1
  37. package/dist/stories/helpers/ThemeProvider.d.ts +2 -2
  38. package/dist/stories/helpers/ThemeProvider.d.ts.map +1 -1
  39. package/dist/stories/helpers/ThemeProvider.js.map +1 -1
  40. package/dist/tsconfig.tsbuildinfo +1 -1
  41. package/package.json +13 -13
  42. package/react-client.build.log +6 -6
  43. package/src/banner.ts +16 -7
  44. package/src/containers/ClientProvider.tsx +1 -2
  45. package/src/hooks/bot-factory/index.ts +5 -0
  46. package/src/hooks/bot-factory/useBotFactoryClient.ts +33 -0
  47. package/src/hooks/index.ts +1 -0
  48. package/src/testing/ProfileInitializer.tsx +2 -2
  49. package/stories/helpers/Container.tsx +2 -2
  50. package/stories/helpers/ThemeProvider.tsx +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-client",
3
- "version": "2.19.4-dev.e19ce289",
3
+ "version": "2.19.5-dev.4fb0c4a8",
4
4
  "description": "React client API",
5
5
  "keywords": [],
6
6
  "license": "AGPL-3.0",
@@ -8,24 +8,24 @@
8
8
  "main": "dist/src/index.js",
9
9
  "types": "dist/src/index.d.ts",
10
10
  "dependencies": {
11
- "@dxos/async": "2.19.4-dev.e19ce289",
12
- "@dxos/client": "2.19.4-dev.e19ce289",
13
- "@dxos/config": "2.19.4-dev.e19ce289",
14
- "@dxos/credentials": "2.19.4-dev.e19ce289",
15
- "@dxos/crypto": "2.19.4-dev.e19ce289",
16
- "@dxos/debug": "2.19.4-dev.e19ce289",
17
- "@dxos/echo-db": "2.19.4-dev.e19ce289",
18
- "@dxos/esbuild-plugins": "2.19.4-dev.e19ce289",
19
- "@dxos/esbuild-server": "~1.4.1",
20
- "@dxos/util": "2.19.4-dev.e19ce289",
21
- "@types/debug": "^4.1.7",
11
+ "@dxos/async": "2.19.5-dev.4fb0c4a8",
12
+ "@dxos/bot-factory-client": "2.19.5-dev.4fb0c4a8",
13
+ "@dxos/client": "2.19.5-dev.4fb0c4a8",
14
+ "@dxos/config": "2.19.5-dev.4fb0c4a8",
15
+ "@dxos/credentials": "2.19.5-dev.4fb0c4a8",
16
+ "@dxos/crypto": "2.19.5-dev.4fb0c4a8",
17
+ "@dxos/debug": "2.19.5-dev.4fb0c4a8",
18
+ "@dxos/echo-db": "2.19.5-dev.4fb0c4a8",
19
+ "@dxos/util": "2.19.5-dev.4fb0c4a8",
22
20
  "assert": "^2.0.0",
23
21
  "debug": "^4.3.3",
24
22
  "react-display-name": "^0.2.5",
25
23
  "use-subscription": "^1.4.1"
26
24
  },
27
25
  "devDependencies": {
28
- "@dxos/toolchain-node-library": "2.19.3",
26
+ "@dxos/esbuild-plugins": "2.19.5-dev.4fb0c4a8",
27
+ "@dxos/esbuild-server": "~1.7.1",
28
+ "@dxos/toolchain-node-library": "2.19.4",
29
29
  "@mui/material": "^5.0.1",
30
30
  "@testing-library/react": "^11.0.4",
31
31
  "@testing-library/react-hooks": "5.1.2",
@@ -1,11 +1,12 @@
1
1
  Invoking: toolchain build:test
2
2
 
3
+ ENOENT: no such file or directory, stat '/home/github/_work/protocols/protocols/packages/sdk/react-client/src/proto/gen'
3
4
 
4
5
  typescript
5
- OK in 7119 ms
6
+ OK in 4192 ms
6
7
 
7
8
  eslint
8
- OK in 7918 ms
9
+ OK in 9673 ms
9
10
 
10
11
  mocha
11
12
  This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills
@@ -13,7 +14,6 @@ This browser doesn't support cancelAnimationFrame. Make sure that you load a pol
13
14
 
14
15
 
15
16
  ClientProvider
16
- DXOS
17
17
  ✓ Renders with children
18
18
  ✓ Provides the client
19
19
 
@@ -27,8 +27,8 @@ DXOS
27
27
  ✓ should return custom client config when used properly in a context
28
28
 
29
29
 
30
- 7 passing (283ms)
30
+ 7 passing (315ms)
31
31
 
32
- OK in 10616 ms
32
+ OK in 3385 ms
33
33
 
34
- CHECK COMPLETE in 25659 ms
34
+ CHECK COMPLETE in 17258 ms
package/src/banner.ts CHANGED
@@ -2,17 +2,26 @@
2
2
  // Copyright 2021 DXOS.org
3
3
  //
4
4
 
5
+ import { Client } from '@dxos/client';
6
+
7
+ // TODO(burdon): Print version.
8
+ // http://patorjk.com/software/taag/#p=testall&f=Patorjk-HeX&t=DXOS
9
+
10
+ const BANNER = (client: Client) => '\n' +
11
+ '_/\\/\\/\\/\\/\\____/\\/\\____/\\/\\____/\\/\\/\\/\\______/\\/\\/\\/\\/\\_\n' +
12
+ '_/\\/\\____/\\/\\____/\\/\\/\\/\\____/\\/\\____/\\/\\__/\\/\\_________\n' +
13
+ '_/\\/\\____/\\/\\______/\\/\\______/\\/\\____/\\/\\____/\\/\\/\\/\\___\n' +
14
+ '_/\\/\\____/\\/\\____/\\/\\/\\/\\____/\\/\\____/\\/\\__________/\\/\\_\n' +
15
+ '_/\\/\\/\\/\\/\\____/\\/\\____/\\/\\____/\\/\\/\\/\\____/\\/\\/\\/\\/\\___\n' +
16
+ `\n DXOS Client ${client.version} \n\n`;
17
+
5
18
  let bannerPrinted = false;
6
19
 
7
- export function printBanner () {
20
+ export function printBanner (client: Client) {
8
21
  if (bannerPrinted) {
9
22
  return;
10
23
  }
11
- bannerPrinted = true;
12
24
 
13
- console.log('%cDXOS', `
14
- text-align: center;
15
- text-shadow: #ddd 4px -4px, #bbb 8px -8px, #999 12px -12px, #777 16px -16px;
16
- font-size: 10em;padding:10px;
17
- `);
25
+ bannerPrinted = true;
26
+ console.log(BANNER(client));
18
27
  }
@@ -65,8 +65,6 @@ export const ClientProvider = ({
65
65
 
66
66
  // Async helpers.
67
67
  useEffect(() => {
68
- printBanner();
69
-
70
68
  if (!client) {
71
69
  const done = async (client: Client) => {
72
70
  log(`Created client: ${client}`);
@@ -75,6 +73,7 @@ export const ClientProvider = ({
75
73
  }
76
74
  await onInitialize?.(client);
77
75
  setClient(client);
76
+ printBanner(client);
78
77
  };
79
78
 
80
79
  // TODO(burdon): Error handling.
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2021 DXOS.org
3
+ //
4
+
5
+ export * from './useBotFactoryClient';
@@ -0,0 +1,33 @@
1
+ //
2
+ // Copyright 2021 DXOS.org
3
+ //
4
+
5
+ import { useEffect, useState } from 'react';
6
+
7
+ import { BotFactoryClient } from '@dxos/bot-factory-client';
8
+ import { PublicKey } from '@dxos/crypto';
9
+ import { raise } from '@dxos/debug';
10
+
11
+ import { useClient, useConfig } from '../client';
12
+
13
+ export const useBotFactoryClient = (): BotFactoryClient | undefined => {
14
+ const [botFactoryClient, setBotFactoryClient] = useState<BotFactoryClient>();
15
+
16
+ const client = useClient();
17
+ const config = useConfig();
18
+
19
+ useEffect(() => {
20
+ const botFactoryClient = new BotFactoryClient(client.echo.networkManager);
21
+ const topic = config.get('services.bot.topic') ??
22
+ raise(new Error('Bot factory topic is not provided'));
23
+ setImmediate(async () => {
24
+ await botFactoryClient.start(PublicKey.from(topic));
25
+ setBotFactoryClient(botFactoryClient);
26
+ });
27
+ return () => {
28
+ void botFactoryClient.stop();
29
+ };
30
+ }, []);
31
+
32
+ return botFactoryClient;
33
+ };
@@ -8,3 +8,4 @@ export * from './echo-selections';
8
8
  export * from './invitations';
9
9
  export * from './wns';
10
10
  export * from './util';
11
+ export * from './bot-factory';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2020 DXOS.org
3
3
  //
4
4
 
5
- import React, { useEffect } from 'react';
5
+ import React, { ReactNode, useEffect } from 'react';
6
6
 
7
7
  import { useClient, useProfile } from '../hooks';
8
8
 
@@ -11,7 +11,7 @@ import { useClient, useProfile } from '../hooks';
11
11
  * @deprecated
12
12
  */
13
13
  // TODO(burdon): Testing-only; replace with useTestProfile();
14
- export const ProfileInitializer = ({ children }: { children: React.ReactNode }) => {
14
+ export const ProfileInitializer = ({ children }: { children: ReactNode }) => {
15
15
  const client = useClient();
16
16
  const profile = useProfile();
17
17
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2020 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
5
+ import React, { ReactNode } from 'react';
6
6
 
7
7
  import { styled } from '@mui/material';
8
8
 
@@ -19,7 +19,7 @@ const FullScreen = styled('div')({
19
19
  backgroundColor: '#EEE'
20
20
  });
21
21
 
22
- export const Container = ({ children }: { children: React.ReactNode }) => (
22
+ export const Container = ({ children }: { children: ReactNode }) => (
23
23
  <FullScreen>
24
24
  <ThemeProvider>
25
25
  {children}
@@ -2,7 +2,7 @@
2
2
  // Copyright 2021 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
5
+ import React, { ReactNode } from 'react';
6
6
 
7
7
  import { createTheme, ThemeProvider as MuiThemeProvider } from '@mui/material';
8
8
 
@@ -33,7 +33,7 @@ const theme = createTheme({
33
33
  });
34
34
 
35
35
  // TODO(burdon): Add theme as decorator.
36
- export const ThemeProvider = ({ children }: { children: React.ReactNode }) => (
36
+ export const ThemeProvider = ({ children }: { children: ReactNode }) => (
37
37
  <MuiThemeProvider theme={theme}>
38
38
  {children}
39
39
  </MuiThemeProvider>