@dxos/react-client 2.19.12-dev.15870405 → 2.19.12-dev.65b9deba

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 (28) hide show
  1. package/.rush/temp/package-deps_build:test.json +6 -6
  2. package/.rush/temp/shrinkwrap-deps.json +2 -40
  3. package/dist/src/hooks/invitations/index.d.ts +1 -1
  4. package/dist/src/hooks/invitations/index.d.ts.map +1 -1
  5. package/dist/src/hooks/invitations/index.js +1 -1
  6. package/dist/src/hooks/invitations/index.js.map +1 -1
  7. package/dist/src/hooks/invitations/usePartyInvitations.d.ts +4 -0
  8. package/dist/src/hooks/invitations/usePartyInvitations.d.ts.map +1 -0
  9. package/dist/src/hooks/invitations/usePartyInvitations.js +24 -0
  10. package/dist/src/hooks/invitations/usePartyInvitations.js.map +1 -0
  11. package/dist/stories/halo-invitations.stories.js +1 -1
  12. package/dist/stories/halo-invitations.stories.js.map +1 -1
  13. package/dist/stories/party-invitations.stories.d.ts.map +1 -1
  14. package/dist/stories/party-invitations.stories.js +6 -13
  15. package/dist/stories/party-invitations.stories.js.map +1 -1
  16. package/dist/tsconfig.tsbuildinfo +1 -1
  17. package/package.json +12 -12
  18. package/react-client.build.log +0 -34
  19. package/src/hooks/invitations/index.ts +1 -1
  20. package/src/hooks/invitations/usePartyInvitations.ts +27 -0
  21. package/stories/halo-invitations.stories.tsx +1 -1
  22. package/stories/party-invitations.stories.tsx +7 -12
  23. package/.rush/temp/package-deps_build.json +0 -56
  24. package/dist/src/hooks/invitations/useSecretGenerator.d.ts +0 -3
  25. package/dist/src/hooks/invitations/useSecretGenerator.d.ts.map +0 -1
  26. package/dist/src/hooks/invitations/useSecretGenerator.js +0 -19
  27. package/dist/src/hooks/invitations/useSecretGenerator.js.map +0 -1
  28. package/src/hooks/invitations/useSecretGenerator.ts +0 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-client",
3
- "version": "2.19.12-dev.15870405",
3
+ "version": "2.19.12-dev.65b9deba",
4
4
  "description": "React client API",
5
5
  "keywords": [],
6
6
  "license": "AGPL-3.0",
@@ -8,23 +8,23 @@
8
8
  "main": "dist/src/index.js",
9
9
  "types": "dist/src/index.d.ts",
10
10
  "dependencies": {
11
- "@dxos/async": "2.19.12-dev.15870405",
12
- "@dxos/bot-factory-client": "2.19.12-dev.15870405",
13
- "@dxos/client": "2.19.12-dev.15870405",
14
- "@dxos/config": "2.19.12-dev.15870405",
15
- "@dxos/credentials": "2.19.12-dev.15870405",
16
- "@dxos/crypto": "2.19.12-dev.15870405",
17
- "@dxos/debug": "2.19.12-dev.15870405",
18
- "@dxos/echo-db": "2.19.12-dev.15870405",
19
- "@dxos/util": "2.19.12-dev.15870405",
11
+ "@dxos/async": "2.19.12-dev.65b9deba",
12
+ "@dxos/bot-factory-client": "2.19.12-dev.65b9deba",
13
+ "@dxos/client": "2.19.12-dev.65b9deba",
14
+ "@dxos/config": "2.19.12-dev.65b9deba",
15
+ "@dxos/credentials": "2.19.12-dev.65b9deba",
16
+ "@dxos/crypto": "2.19.12-dev.65b9deba",
17
+ "@dxos/debug": "2.19.12-dev.65b9deba",
18
+ "@dxos/echo-db": "2.19.12-dev.65b9deba",
19
+ "@dxos/util": "2.19.12-dev.65b9deba",
20
20
  "assert": "^2.0.0",
21
21
  "debug": "^4.3.3",
22
22
  "react-display-name": "^0.2.5",
23
23
  "use-subscription": "^1.4.1"
24
24
  },
25
25
  "devDependencies": {
26
- "@dxos/esbuild-plugins": "2.19.12-dev.15870405",
27
- "@dxos/esbuild-server": "~1.7.2",
26
+ "@dxos/esbuild-plugins": "2.19.12-dev.65b9deba",
27
+ "@dxos/esbuild-server": "~1.7.4",
28
28
  "@dxos/toolchain-node-library": "2.19.11",
29
29
  "@mui/material": "^5.0.1",
30
30
  "@testing-library/react": "^11.0.4",
@@ -1,34 +0,0 @@
1
- Invoking: toolchain build:test
2
-
3
- ENOENT: no such file or directory, stat '/home/github/_work/protocols/protocols/packages/sdk/react-client/src/proto/gen'
4
-
5
- typescript
6
- OK in 15862 ms
7
-
8
- eslint
9
- OK in 13928 ms
10
-
11
- mocha
12
- This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills
13
- This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills
14
-
15
-
16
- ClientProvider
17
- ✓ Renders with children
18
- ✓ Provides the client
19
-
20
- Client hook
21
- ✓ should throw when used outside a context
22
- ✓ should return client when used properly in a context
23
-
24
- Config hook
25
- ✓ should throw when used outside a context
26
- ✓ should return default client config when no config is passed in a context
27
- ✓ should return custom client config when used properly in a context
28
-
29
-
30
- 7 passing (469ms)
31
-
32
- OK in 3324 ms
33
-
34
- CHECK COMPLETE in 33123 ms
@@ -2,5 +2,5 @@
2
2
  // Copyright 2020 DXOS.org
3
3
  //
4
4
 
5
- export * from './useSecretGenerator';
5
+ export * from './usePartyInvitations';
6
6
  export * from './useSecretProvider';
@@ -0,0 +1,27 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import { useEffect, useState } from 'react';
6
+
7
+ import { InvitationRequest } from '@dxos/client';
8
+ import { PublicKey } from '@dxos/crypto';
9
+
10
+ import { useParty } from '../echo-queries';
11
+
12
+ export const usePartyInvitations = (partyKey?: PublicKey) => {
13
+ const party = useParty(partyKey);
14
+ const [invitations, setInvitations] = useState<InvitationRequest[]>(party?.activeInvitations ?? []);
15
+
16
+ useEffect(() => {
17
+ return party?.invitationsUpdate.on(() => {
18
+ setInvitations([...party.activeInvitations]);
19
+ });
20
+ }, [party]);
21
+
22
+ useEffect(() => {
23
+ setInvitations([]);
24
+ }, [party?.key.toHex()]);
25
+
26
+ return invitations;
27
+ };
@@ -146,7 +146,7 @@ const TestApp = () => {
146
146
  <ClientPanel client={client} profile={profile} parties={parties} />
147
147
  <Divider />
148
148
  <HaloInvitationContainer />
149
- {!client.halo.isInitialized && (
149
+ {!profile && (
150
150
  <>
151
151
  <Divider />
152
152
  <HaloAuthenticationContainer />
@@ -10,7 +10,6 @@ import {
10
10
 
11
11
  import { decodeInvitation, encodeInvitation, Invitation } from '@dxos/client';
12
12
  import { PublicKey } from '@dxos/crypto';
13
- import { InvitationDescriptorType } from '@dxos/echo-db';
14
13
 
15
14
  import {
16
15
  ClientProvider,
@@ -73,8 +72,8 @@ const PartyInvitationContainer = () => {
73
72
  setImmediate(async () => {
74
73
  resetInvitations();
75
74
  if (contact) {
76
- const invitation = await client.echo.createOfflineInvitation(partyKey!, PublicKey.fromHex(contact!));
77
- setInvitationCode(encodeInvitation(invitation));
75
+ const invitation = await client.echo.getParty(partyKey!)!.createInvitation({ inviteeKey: PublicKey.fromHex(contact!) });
76
+ setInvitationCode(encodeInvitation(invitation.descriptor));
78
77
  } else {
79
78
  const invitation = await client.echo.createInvitation(partyKey!);
80
79
  invitation.connected.on(() => setPin(invitation.secret.toString()));
@@ -155,15 +154,11 @@ const PartyJoinContainer = () => {
155
154
  setStatus({});
156
155
 
157
156
  try {
158
- const invitation = decodeInvitation(invitationCode);
159
- if (invitation.type === InvitationDescriptorType.OFFLINE) {
160
- const party = await client.echo.joinParty(invitation);
161
- await party.open();
162
- setStatus({ party: party.key.toHex() });
163
- } else {
164
- const redeemingInvitation = client.echo.acceptInvitation(invitation);
165
- setStatus({ invitation: redeemingInvitation });
166
- }
157
+ const invitation = await client.echo.acceptInvitation(decodeInvitation(invitationCode));
158
+ setStatus({ invitation });
159
+
160
+ const party = await invitation.getParty();
161
+ setStatus({ party: party.key.toHex() });
167
162
  } catch (error: any) {
168
163
  setStatus({ error });
169
164
  }
@@ -1,56 +0,0 @@
1
- {
2
- "files": {
3
- "packages/sdk/react-client/.rush/temp/shrinkwrap-deps.json": "e7b3b7a723a0dc1ec8289b9d3c5ffe2d1e4d5a0d",
4
- "packages/sdk/react-client/README.md": "f781dc2b0cf91ac94e4ee57e8c2e9c24d371e575",
5
- "packages/sdk/react-client/esbuild-server.config.js": "4cd7d0e6cd307de23b075d64c07ad4e0cf715ff4",
6
- "packages/sdk/react-client/package.json": "5959f8cad88bd13a1c17d0ca8b1f31543cb7ea76",
7
- "packages/sdk/react-client/src/banner.ts": "0c7616c09c6acb9abfdc09ebb8074ee06277cf11",
8
- "packages/sdk/react-client/src/containers/ClientProvider.test.tsx": "dc7ff4b7baf181522f3ab4210aed35361fd30939",
9
- "packages/sdk/react-client/src/containers/ClientProvider.tsx": "34f684a1698cc1f5bc3235175ab34a508f3c2856",
10
- "packages/sdk/react-client/src/containers/index.ts": "b7c76473fa7b17166837ffe492f78cd2bfaf42fc",
11
- "packages/sdk/react-client/src/hooks/bot-factory/index.ts": "970b504d70018209eed44806152b76a612e5853c",
12
- "packages/sdk/react-client/src/hooks/bot-factory/useBotFactoryClient.ts": "bb7e3f3bf0819ea74cb840c56583dea230030446",
13
- "packages/sdk/react-client/src/hooks/client/client.test.tsx": "315161751b8ac1d9d5f47accc69fff4b33dea0f0",
14
- "packages/sdk/react-client/src/hooks/client/config.test.tsx": "34b094a3d1e10aa7003e0ddf31d7790333be91a4",
15
- "packages/sdk/react-client/src/hooks/client/context.ts": "8214e48537ec5f1f5dd63531147047f238b131d7",
16
- "packages/sdk/react-client/src/hooks/client/index.ts": "ae7c3dd1bb38ba7f622073fb6850d08ce70ecc52",
17
- "packages/sdk/react-client/src/hooks/client/useClient.ts": "a57cc8ce9cd54e0f20c10923b7d70e9029b57665",
18
- "packages/sdk/react-client/src/hooks/client/useConfig.ts": "6ad945c8d378e560c24640b87036415b9bc0f811",
19
- "packages/sdk/react-client/src/hooks/client/useProfile.ts": "f46262917bf0fc6e6b025368380cf6d5d67634c6",
20
- "packages/sdk/react-client/src/hooks/echo-queries/index.ts": "3eb29bc51f3b511a86adc34047138f80b20e0d25",
21
- "packages/sdk/react-client/src/hooks/echo-queries/useContacts.ts": "4c7df3e75a448535b8f96631038e6810fe840ac8",
22
- "packages/sdk/react-client/src/hooks/echo-queries/useMembers.tsx": "a7253e5bd50524ccd8e7c8a1b46ebaa0bfec53a8",
23
- "packages/sdk/react-client/src/hooks/echo-queries/useParties.ts": "2a81acfc6b36e8dfca26f7d8b4e4c51cebd7d2fc",
24
- "packages/sdk/react-client/src/hooks/echo-queries/useRemoteParties.ts": "4657d62c7c37b5736d85c1cf4d636287268ce1ed",
25
- "packages/sdk/react-client/src/hooks/echo-selections/index.ts": "bd7c992f3c4355158dcb3698d4d93d919b8325fa",
26
- "packages/sdk/react-client/src/hooks/echo-selections/search.ts": "d78a5b3b688dc5535e5fff2953bf911bf22dd2e8",
27
- "packages/sdk/react-client/src/hooks/echo-selections/useSelection.ts": "386aea0d2f27eb4fed65eb4b63b92492567c95e5",
28
- "packages/sdk/react-client/src/hooks/index.ts": "45dcdd5e8712652c72c57ca7e66c4a0369cad45b",
29
- "packages/sdk/react-client/src/hooks/invitations/index.ts": "94fe8cbc9872da7a1edc9201f9545978a7e4d1da",
30
- "packages/sdk/react-client/src/hooks/invitations/useSecretGenerator.ts": "904b220863be410825eaec9c31c9ee9b9c88c08f",
31
- "packages/sdk/react-client/src/hooks/invitations/useSecretProvider.ts": "ac932b9964b1cb21011aefa89c09849897c25fca",
32
- "packages/sdk/react-client/src/hooks/util/index.ts": "f0419f072260d9cc907aba489590791d2ccf0f5b",
33
- "packages/sdk/react-client/src/hooks/util/useResultSet.ts": "11b1d68c81930e82f5d39b00b4e6381e3249371e",
34
- "packages/sdk/react-client/src/hooks/wns/index.ts": "42b9a65f575eca413d37d3576d0dc0fb70585758",
35
- "packages/sdk/react-client/src/hooks/wns/registry.ts": "1fa723dbddac0bef5051d2c81748aab2096d6957",
36
- "packages/sdk/react-client/src/hooks/wns/registryBotFactories.ts": "a765b94908c14fe83a4d61fa19ac24b383772bd3",
37
- "packages/sdk/react-client/src/hooks/wns/registryBots.ts": "5430bbff71bc12b59eff67d19b00e87f5924f814",
38
- "packages/sdk/react-client/src/hooks/wns/types.ts": "42fb64aaafbe4648d8f817bbb278b5cce197dd95",
39
- "packages/sdk/react-client/src/index.ts": "e5e79dc66b7ed5e0e010e0d56fafbc96365c6d5e",
40
- "packages/sdk/react-client/src/testing/ProfileInitializer.tsx": "fec239c7b218f6a138c89c16b57ef701a18c04ff",
41
- "packages/sdk/react-client/src/testing/index.ts": "9e023b0470159958d7a538130199b576a408a5df",
42
- "packages/sdk/react-client/stories/client.stories.tsx": "48003a0ef5a1e729091a7f2999bf5e3a6762c81d",
43
- "packages/sdk/react-client/stories/halo-invitations.stories.tsx": "52242778cb6bcc0092d545620dbc613b4d9d242d",
44
- "packages/sdk/react-client/stories/helpers/ClientPanel.tsx": "1eafdb3a2666a7f56034cb06319154e40301c866",
45
- "packages/sdk/react-client/stories/helpers/ContactsSelector.tsx": "702919f8031ab1c923b0ef829ee10ec3527dbba4",
46
- "packages/sdk/react-client/stories/helpers/Container.tsx": "ab90a46770f01c94687f182627ef132f108a63b7",
47
- "packages/sdk/react-client/stories/helpers/JsonPanel.tsx": "55a9f3e1452c553a63970bc022b56ee86290e837",
48
- "packages/sdk/react-client/stories/helpers/PartyJoinPanel.tsx": "1b3798a43d67ec6224bdef5d6bbbf8e54f8d20f1",
49
- "packages/sdk/react-client/stories/helpers/ThemeProvider.tsx": "b4023674d5ec66910481f5e37fc507d46a0e9437",
50
- "packages/sdk/react-client/stories/helpers/index.ts": "3f5c4425b7ebd5a702f4159eebfaff695c0b2a1c",
51
- "packages/sdk/react-client/stories/party-invitations.stories.tsx": "7fdb4ba72444127d7a91e73a6b5bbf18fb5ef2f6",
52
- "packages/sdk/react-client/tests/config.test.ts": "7bf77786817c03c0b4a9fbe8bd38a629a15869e5",
53
- "packages/sdk/react-client/tsconfig.json": "0105c4a7888e237dce4ef5bde51e3224ffa05983"
54
- },
55
- "arguments": "toolchain build "
56
- }
@@ -1,3 +0,0 @@
1
- /// <reference types="node" />
2
- export declare const useSecretGenerator: () => [() => Promise<Buffer>, string | undefined, () => void];
3
- //# sourceMappingURL=useSecretGenerator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSecretGenerator.d.ts","sourceRoot":"","sources":["../../../../src/hooks/invitations/useSecretGenerator.ts"],"names":[],"mappings":";AAQA,eAAO,MAAM,kBAAkB,QAAO,CAAC,MAAM,QAAQ,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,IAAI,CAU3F,CAAC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- //
3
- // Copyright 2021 DXOS.org
4
- //
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.useSecretGenerator = void 0;
7
- const react_1 = require("react");
8
- const credentials_1 = require("@dxos/credentials");
9
- const useSecretGenerator = () => {
10
- const [pin, setPin] = (0, react_1.useState)();
11
- const provider = () => {
12
- const pin = (0, credentials_1.generatePasscode)();
13
- setPin(pin);
14
- return Promise.resolve(Buffer.from(pin));
15
- };
16
- return [provider, pin, () => setPin(undefined)];
17
- };
18
- exports.useSecretGenerator = useSecretGenerator;
19
- //# sourceMappingURL=useSecretGenerator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSecretGenerator.js","sourceRoot":"","sources":["../../../../src/hooks/invitations/useSecretGenerator.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;AAEF,iCAAiC;AAEjC,mDAAqD;AAE9C,MAAM,kBAAkB,GAAG,GAA4D,EAAE;IAC9F,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,IAAA,gBAAQ,GAAU,CAAC;IAEzC,MAAM,QAAQ,GAAG,GAAG,EAAE;QACpB,MAAM,GAAG,GAAG,IAAA,8BAAgB,GAAE,CAAC;QAC/B,MAAM,CAAC,GAAG,CAAC,CAAC;QACZ,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC;IAEF,OAAO,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;AAClD,CAAC,CAAC;AAVW,QAAA,kBAAkB,sBAU7B"}
@@ -1,19 +0,0 @@
1
- //
2
- // Copyright 2021 DXOS.org
3
- //
4
-
5
- import { useState } from 'react';
6
-
7
- import { generatePasscode } from '@dxos/credentials';
8
-
9
- export const useSecretGenerator = (): [() => Promise<Buffer>, string | undefined, () => void] => {
10
- const [pin, setPin] = useState<string>();
11
-
12
- const provider = () => {
13
- const pin = generatePasscode();
14
- setPin(pin);
15
- return Promise.resolve(Buffer.from(pin));
16
- };
17
-
18
- return [provider, pin, () => setPin(undefined)];
19
- };