@dxos/react-client 2.19.12-dev.20302225 → 2.19.12-dev.7ae2b1de

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-client",
3
- "version": "2.19.12-dev.20302225",
3
+ "version": "2.19.12-dev.7ae2b1de",
4
4
  "description": "React client API",
5
5
  "keywords": [],
6
6
  "license": "AGPL-3.0",
@@ -8,22 +8,22 @@
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.20302225",
12
- "@dxos/bot-factory-client": "2.19.12-dev.20302225",
13
- "@dxos/client": "2.19.12-dev.20302225",
14
- "@dxos/config": "2.19.12-dev.20302225",
15
- "@dxos/credentials": "2.19.12-dev.20302225",
16
- "@dxos/crypto": "2.19.12-dev.20302225",
17
- "@dxos/debug": "2.19.12-dev.20302225",
18
- "@dxos/echo-db": "2.19.12-dev.20302225",
19
- "@dxos/util": "2.19.12-dev.20302225",
11
+ "@dxos/async": "2.19.12-dev.7ae2b1de",
12
+ "@dxos/bot-factory-client": "2.19.12-dev.7ae2b1de",
13
+ "@dxos/client": "2.19.12-dev.7ae2b1de",
14
+ "@dxos/config": "2.19.12-dev.7ae2b1de",
15
+ "@dxos/credentials": "2.19.12-dev.7ae2b1de",
16
+ "@dxos/crypto": "2.19.12-dev.7ae2b1de",
17
+ "@dxos/debug": "2.19.12-dev.7ae2b1de",
18
+ "@dxos/echo-db": "2.19.12-dev.7ae2b1de",
19
+ "@dxos/util": "2.19.12-dev.7ae2b1de",
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.20302225",
26
+ "@dxos/esbuild-plugins": "2.19.12-dev.7ae2b1de",
27
27
  "@dxos/esbuild-server": "~1.7.4",
28
28
  "@dxos/toolchain-node-library": "2.19.11",
29
29
  "@mui/material": "^5.0.1",
@@ -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,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"}