@dxos/react-client 2.33.6 → 2.33.7-dev.40cf0994
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/.rush/temp/package-deps_build.json +19 -15
- package/.rush/temp/package-deps_build_test.json +19 -15
- package/.rush/temp/shrinkwrap-deps.json +35 -9
- package/README.md +1 -1
- package/dist/src/containers/BotFactoryClientProvider.js +2 -2
- package/dist/src/containers/BotFactoryClientProvider.js.map +1 -1
- package/dist/src/hooks/client/index.d.ts +1 -0
- package/dist/src/hooks/client/index.d.ts.map +1 -1
- package/dist/src/hooks/client/index.js +1 -0
- package/dist/src/hooks/client/index.js.map +1 -1
- package/dist/src/hooks/client/useDevtools.d.ts +2 -0
- package/dist/src/hooks/client/useDevtools.d.ts.map +1 -0
- package/dist/src/hooks/client/useDevtools.js +13 -0
- package/dist/src/hooks/client/useDevtools.js.map +1 -0
- package/dist/src/hooks/echo-queries/useContacts.d.ts +1 -1
- package/dist/src/hooks/echo-queries/useContacts.d.ts.map +1 -1
- package/dist/src/hooks/echo-queries/useContacts.js +1 -1
- package/dist/src/hooks/echo-queries/useContacts.js.map +1 -1
- package/dist/src/hooks/echo-queries/useParties.d.ts +1 -1
- package/dist/src/hooks/echo-queries/useParties.d.ts.map +1 -1
- package/dist/src/hooks/invitations/usePartyInvitations.d.ts +1 -1
- package/dist/src/hooks/invitations/usePartyInvitations.d.ts.map +1 -1
- package/dist/src/hooks/util/index.d.ts +1 -0
- package/dist/src/hooks/util/index.d.ts.map +1 -1
- package/dist/src/hooks/util/index.js +1 -0
- package/dist/src/hooks/util/index.js.map +1 -1
- package/dist/src/hooks/util/useResultSet.d.ts +1 -0
- package/dist/src/hooks/util/useResultSet.d.ts.map +1 -1
- package/dist/src/hooks/util/useResultSet.js +1 -0
- package/dist/src/hooks/util/useResultSet.js.map +1 -1
- package/dist/src/hooks/util/useStream.d.ts +7 -0
- package/dist/src/hooks/util/useStream.d.ts.map +1 -0
- package/dist/src/hooks/util/useStream.js +21 -0
- package/dist/src/hooks/util/useStream.js.map +1 -0
- package/dist/stories/client.stories.js.map +1 -1
- package/dist/stories/halo-recovery.stories.d.ts.map +1 -1
- package/dist/stories/halo-recovery.stories.js.map +1 -1
- package/dist/stories/helpers/ContactsSelector.js.map +1 -1
- package/dist/stories/helpers/JsonPanel.js.map +1 -1
- package/dist/stories/party-invitations.stories.js +3 -3
- package/dist/stories/party-invitations.stories.js.map +1 -1
- package/dist/tests/playwright/config.d.ts +4 -0
- package/dist/tests/playwright/config.d.ts.map +1 -0
- package/dist/tests/playwright/config.js +18 -0
- package/dist/tests/playwright/config.js.map +1 -0
- package/dist/tests/playwright/smoke.spec.d.ts +2 -0
- package/dist/tests/playwright/smoke.spec.d.ts.map +1 -0
- package/dist/tests/playwright/smoke.spec.js +20 -0
- package/dist/tests/playwright/smoke.spec.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -15
- package/react-client.build.log +0 -21
- package/src/containers/BotFactoryClientProvider.tsx +1 -1
- package/src/hooks/client/index.ts +1 -0
- package/src/hooks/client/useDevtools.ts +10 -0
- package/src/hooks/echo-queries/useContacts.ts +1 -1
- package/src/hooks/echo-queries/useParties.ts +1 -1
- package/src/hooks/invitations/usePartyInvitations.ts +1 -1
- package/src/hooks/util/index.ts +1 -0
- package/src/hooks/util/useResultSet.ts +1 -0
- package/src/hooks/util/useStream.ts +25 -0
- package/stories/client.stories.tsx +6 -6
- package/stories/halo-recovery.stories.tsx +12 -13
- package/stories/helpers/ContactsSelector.tsx +16 -16
- package/stories/helpers/JsonPanel.tsx +11 -11
- package/stories/party-invitations.stories.tsx +2 -2
- package/tests/playwright/config.ts +19 -0
- package/tests/playwright/smoke.spec.ts +17 -0
package/package.json
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-client",
|
|
3
|
-
"version": "2.33.
|
|
3
|
+
"version": "2.33.7-dev.40cf0994",
|
|
4
4
|
"description": "React client API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "DXOS.org",
|
|
7
7
|
"main": "dist/src/index.js",
|
|
8
8
|
"types": "dist/src/index.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@dxos/async": "2.33.
|
|
11
|
-
"@dxos/bot-factory-client": "2.33.
|
|
12
|
-
"@dxos/client": "2.33.
|
|
13
|
-
"@dxos/config": "2.33.
|
|
14
|
-
"@dxos/
|
|
15
|
-
"@dxos/
|
|
16
|
-
"@dxos/debug": "2.33.
|
|
17
|
-
"@dxos/echo-db": "2.33.
|
|
18
|
-
"@dxos/network-manager": "2.33.
|
|
19
|
-
"@dxos/
|
|
20
|
-
"@dxos/
|
|
10
|
+
"@dxos/async": "2.33.7-dev.40cf0994",
|
|
11
|
+
"@dxos/bot-factory-client": "2.33.7-dev.40cf0994",
|
|
12
|
+
"@dxos/client": "2.33.7-dev.40cf0994",
|
|
13
|
+
"@dxos/config": "2.33.7-dev.40cf0994",
|
|
14
|
+
"@dxos/codec-protobuf": "2.33.7-dev.40cf0994",
|
|
15
|
+
"@dxos/credentials": "2.33.7-dev.40cf0994",
|
|
16
|
+
"@dxos/debug": "2.33.7-dev.40cf0994",
|
|
17
|
+
"@dxos/echo-db": "2.33.7-dev.40cf0994",
|
|
18
|
+
"@dxos/network-manager": "2.33.7-dev.40cf0994",
|
|
19
|
+
"@dxos/protocols": "2.33.7-dev.40cf0994",
|
|
20
|
+
"@dxos/react-async": "2.33.7-dev.40cf0994",
|
|
21
|
+
"@dxos/util": "2.33.7-dev.40cf0994",
|
|
21
22
|
"assert": "^2.0.0",
|
|
22
23
|
"debug": "^4.3.3",
|
|
23
24
|
"use-subscription": "^1.8.0"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
|
-
"@dxos/
|
|
27
|
-
"@dxos/
|
|
27
|
+
"@dxos/crypto": "2.33.7-dev.40cf0994",
|
|
28
|
+
"@dxos/esbuild-plugins": "~2.28.10",
|
|
29
|
+
"@dxos/eslint-plugin": "~1.0.34",
|
|
28
30
|
"@dxos/protocols-toolchain": "2.33.6",
|
|
29
31
|
"@mui/material": "^5.8.1",
|
|
32
|
+
"@playwright/test": "^1.14.1",
|
|
30
33
|
"@testing-library/react": "^11.0.4",
|
|
31
34
|
"@testing-library/react-hooks": "5.1.2",
|
|
32
35
|
"@types/debug": "^4.1.7",
|
|
@@ -40,6 +43,7 @@
|
|
|
40
43
|
"eslint": "^7.12.1",
|
|
41
44
|
"expect": "~27.0.2",
|
|
42
45
|
"level-js": "^5.0.2",
|
|
46
|
+
"playwright": "^1.14.1",
|
|
43
47
|
"raf": "^3.4.1",
|
|
44
48
|
"react": "^18.1.0",
|
|
45
49
|
"react-dom": "^18.1.0",
|
|
@@ -65,6 +69,7 @@
|
|
|
65
69
|
"build:book": "toolchain build:book",
|
|
66
70
|
"build:test": "toolchain build:test",
|
|
67
71
|
"lint": "toolchain lint",
|
|
68
|
-
"test": "toolchain test"
|
|
72
|
+
"test": "toolchain test && npm run test:playwright",
|
|
73
|
+
"test:playwright": "playwright test --config ./tests/playwright/config.ts"
|
|
69
74
|
}
|
|
70
75
|
}
|
package/react-client.build.log
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
Invoking: toolchain build:test
|
|
2
|
-
|
|
3
|
-
Tests started
|
|
4
|
-
Typescript
|
|
5
|
-
OK in 8582 ms
|
|
6
|
-
no problems
|
|
7
|
-
OK in 8075 ms
|
|
8
|
-
|
|
9
|
-
Mocha Tests
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
useSelection
|
|
13
|
-
Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot
|
|
14
|
-
✓ gets updated items selection (293ms)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
1 passing (302ms)
|
|
18
|
-
|
|
19
|
-
OK in 2608 ms
|
|
20
|
-
|
|
21
|
-
Tests complete in 19293 ms
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import React, { ReactNode, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { BotFactoryClient } from '@dxos/bot-factory-client';
|
|
8
|
-
import { PublicKey } from '@dxos/crypto';
|
|
9
8
|
import { raise } from '@dxos/debug';
|
|
9
|
+
import { PublicKey } from '@dxos/protocols';
|
|
10
10
|
import { useAsyncEffect } from '@dxos/react-async';
|
|
11
11
|
|
|
12
12
|
import { BotFactoryClientContext, createBotFactoryClient, useConfig } from '../hooks';
|
package/src/hooks/util/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { ResultSet } from '@dxos/client';
|
|
|
11
11
|
* A convenience hook used for subscribing to changing values of a result set.
|
|
12
12
|
* Result sets are reactive query results from ECHO.
|
|
13
13
|
* @param resultSet The result set to subscribe to
|
|
14
|
+
* @deprecated
|
|
14
15
|
* @returns Always up-to-date value of the result set
|
|
15
16
|
*/
|
|
16
17
|
export const useResultSet = <T>(resultSet: ResultSet<T>): T[] => useSubscription(useMemo(() => ({
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2021 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { DependencyList, useState, useEffect } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Stream } from '@dxos/codec-protobuf';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Subscribe to service API streams.
|
|
11
|
+
*/
|
|
12
|
+
export const useStream = <T>(
|
|
13
|
+
streamFactory: () => Stream<T>,
|
|
14
|
+
defaultValue: T,
|
|
15
|
+
deps: DependencyList = []
|
|
16
|
+
): T => {
|
|
17
|
+
const [value, setValue] = useState<T | undefined>(defaultValue);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const stream = streamFactory();
|
|
20
|
+
stream.subscribe((response: T) => setValue(response));
|
|
21
|
+
return () => stream.close();
|
|
22
|
+
}, deps);
|
|
23
|
+
|
|
24
|
+
return value ?? defaultValue;
|
|
25
|
+
};
|
|
@@ -26,13 +26,13 @@ const TestApp = () => {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export const Primary = () => (
|
|
29
|
-
<ClientProvider>
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
<ClientProvider>
|
|
30
|
+
<TestApp />
|
|
31
|
+
</ClientProvider>
|
|
32
32
|
);
|
|
33
33
|
|
|
34
34
|
export const Secondary = () => (
|
|
35
|
-
<ClientProvider config={() => ({})}>
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
<ClientProvider config={() => ({})}>
|
|
36
|
+
<TestApp />
|
|
37
|
+
</ClientProvider>
|
|
38
38
|
);
|
|
@@ -31,7 +31,6 @@ const HaloCreationContainer = () => {
|
|
|
31
31
|
const handleCreateHalo = async () => {
|
|
32
32
|
const seedPhrase = generateSeedPhrase();
|
|
33
33
|
const keyPair = keyPairFromSeedPhrase(seedPhrase);
|
|
34
|
-
|
|
35
34
|
await client.halo.createProfile({ ...keyPair });
|
|
36
35
|
setSeed(seedPhrase);
|
|
37
36
|
};
|
|
@@ -109,16 +108,16 @@ const TestApp = () => {
|
|
|
109
108
|
};
|
|
110
109
|
|
|
111
110
|
export const HaloRecovery = () => (
|
|
112
|
-
<Container>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
111
|
+
<Container>
|
|
112
|
+
<Box sx={{ display: 'flex', flex: 1, padding: 1, justifyContent: 'space-around' }}>
|
|
113
|
+
{/* Instantiated Client. */}
|
|
114
|
+
<ClientProvider>
|
|
115
|
+
<TestApp />
|
|
116
|
+
</ClientProvider>
|
|
117
|
+
|
|
118
|
+
<ClientProvider>
|
|
119
|
+
<TestApp />
|
|
120
|
+
</ClientProvider>
|
|
121
|
+
</Box>
|
|
122
|
+
</Container>
|
|
124
123
|
);
|
|
@@ -16,20 +16,20 @@ export const ContactsSelector = ({ contacts, selected = '', onSelect }: {
|
|
|
16
16
|
selected?: string,
|
|
17
17
|
onSelect: (selected: string) => void
|
|
18
18
|
}) => (
|
|
19
|
-
<FormControl fullWidth>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
<FormControl fullWidth>
|
|
20
|
+
<InputLabel id='contact-select-label'>Contact</InputLabel>
|
|
21
|
+
<Select
|
|
22
|
+
value={selected || ''}
|
|
23
|
+
label='Contact'
|
|
24
|
+
labelId='contact-select-label'
|
|
25
|
+
onChange={(event: SelectChangeEvent) => onSelect(event.target.value)}
|
|
26
|
+
>
|
|
27
|
+
<MenuItem value='' />
|
|
28
|
+
{contacts.map(contact => (
|
|
29
|
+
<MenuItem key={contact.publicKey.toHex()} value={contact.publicKey.toHex()}>
|
|
30
|
+
{contact.displayName}
|
|
31
|
+
</MenuItem>
|
|
32
|
+
))}
|
|
33
|
+
</Select>
|
|
34
|
+
</FormControl>
|
|
35
35
|
);
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
export const JsonPanel = ({ value }: { value: any }) => (
|
|
8
|
-
<pre
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
<pre
|
|
9
|
+
style={{
|
|
10
|
+
margin: 0,
|
|
11
|
+
// code whiteSpace: 'pre-wrap',
|
|
12
|
+
// code wordBreak: 'break-all',
|
|
13
|
+
overflow: 'hidden',
|
|
14
|
+
textOverflow: 'ellipsis'
|
|
15
|
+
}}
|
|
16
|
+
>
|
|
17
|
+
{JSON.stringify(value, undefined, 2)}
|
|
18
|
+
</pre>
|
|
19
19
|
);
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '@mui/material';
|
|
10
10
|
|
|
11
11
|
import { PartyInvitation, InvitationDescriptor } from '@dxos/client';
|
|
12
|
-
import { PublicKey } from '@dxos/
|
|
12
|
+
import { PublicKey } from '@dxos/protocols';
|
|
13
13
|
import { useAsyncEffect } from '@dxos/react-async';
|
|
14
14
|
|
|
15
15
|
import {
|
|
@@ -40,7 +40,7 @@ const PartyInvitationContainer = () => {
|
|
|
40
40
|
const [partyKey, setPartyKey] = useState<PublicKey>();
|
|
41
41
|
const [invitationCode, setInvitationCode] = useState<string>();
|
|
42
42
|
const [contact, setContact] = useState<string>();
|
|
43
|
-
const
|
|
43
|
+
const contacts = useContacts();
|
|
44
44
|
const [pin, setPin] = useState('');
|
|
45
45
|
|
|
46
46
|
const resetInvitations = () => {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2021 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { PlaywrightTestConfig } from '@playwright/test';
|
|
6
|
+
|
|
7
|
+
const config: PlaywrightTestConfig = {
|
|
8
|
+
use: {
|
|
9
|
+
headless: !!process.env.CI || !!process.env.HEADLESS
|
|
10
|
+
},
|
|
11
|
+
webServer: {
|
|
12
|
+
command: 'npm run book',
|
|
13
|
+
port: 8080,
|
|
14
|
+
timeout: 300 * 1000,
|
|
15
|
+
reuseExistingServer: !process.env.CI
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default config;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2021 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { test, expect } from '@playwright/test';
|
|
6
|
+
import waitForExpect from 'wait-for-expect';
|
|
7
|
+
|
|
8
|
+
test.describe('Smoke test', () => {
|
|
9
|
+
test('Renders tutorial from descriptor', async ({ page }) => {
|
|
10
|
+
await page.goto('#/__story/stories-client-stories-tsx/Primary');
|
|
11
|
+
|
|
12
|
+
await waitForExpect(async () => {
|
|
13
|
+
const isVisible = await page.isVisible(':has-text("initialized")');
|
|
14
|
+
expect(isVisible).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
});
|