@dxos/react-ui 0.1.34 → 0.1.36-next.ef27157
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/dist/lib/browser/chunk-5VRACIDE.mjs +10 -0
- package/dist/lib/browser/chunk-5VRACIDE.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +225 -174
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +43 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts.map +1 -1
- package/dist/types/src/components/InvitationList/InvitationListItem.d.ts.map +1 -1
- package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts.map +1 -1
- package/dist/types/src/composites/Shell/ShellContext.d.ts.map +1 -1
- package/dist/types/src/panels/DevicesPanel/DevicesPanel.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +5 -5
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts +2 -2
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts +2 -2
- package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts +2 -2
- package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts.map +1 -1
- package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts.map +1 -1
- package/dist/types/src/playwright/invitations-manager.d.ts +8 -17
- package/dist/types/src/playwright/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/shell-manager.d.ts +16 -0
- package/dist/types/src/testing/shell-manager.d.ts.map +1 -0
- package/dist/types/src/util/invitationStatusValue.d.ts.map +1 -1
- package/package.json +25 -14
- package/src/components/InvitationList/InvitationList.tsx +2 -2
- package/src/components/InvitationList/InvitationListContainer.tsx +3 -2
- package/src/components/InvitationList/InvitationListItem.tsx +4 -8
- package/src/composites/JoinDialog/JoinDialog.stories.tsx +3 -12
- package/src/composites/Shell/Shell.tsx +1 -1
- package/src/composites/Shell/ShellContext.tsx +11 -8
- package/src/panels/DevicesPanel/DevicesPanel.tsx +3 -1
- package/src/panels/JoinPanel/JoinPanel.tsx +8 -8
- package/src/panels/JoinPanel/joinMachine.ts +108 -98
- package/src/panels/JoinPanel/view-states/InvitationAccepted.tsx +6 -6
- package/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx +14 -14
- package/src/panels/JoinPanel/view-states/InvitationInput.tsx +9 -9
- package/src/panels/JoinPanel/view-states/InvitationRescuer.tsx +10 -10
- package/src/panels/SpacePanel/SpacePanel.tsx +19 -4
- package/src/playwright/invitations-manager.ts +23 -78
- package/src/playwright/invitations.spec.ts +79 -117
- package/src/testing/index.ts +5 -0
- package/src/testing/shell-manager.ts +59 -0
- package/src/util/invitationStatusValue.ts +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpacePanel.d.ts","sourceRoot":"","sources":["../../../../../src/panels/SpacePanel/SpacePanel.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"SpacePanel.d.ts","sourceRoot":"","sources":["../../../../../src/panels/SpacePanel/SpacePanel.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,YAAY,EAA2B,MAAM,OAAO,CAAC;AAErE,OAAO,EAAiC,KAAK,EAAE,MAAM,cAAc,CAAC;AAOpE,oBAAY,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,mBAAmB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,MAAM,CAAC;IACxD,gBAAgB,CAAC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,oBAAY,SAAS,GAAG,eAAe,CAAC;AA+DxC,eAAO,MAAM,UAAU,UAAW,eAAe,gBAmBhD,CAAC"}
|
|
@@ -1,33 +1,24 @@
|
|
|
1
|
-
import type { Browser
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import type { Browser } from 'playwright';
|
|
2
|
+
import { ConnectionState, Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
3
|
+
import { ShellManager } from '../testing';
|
|
4
4
|
export declare type PanelType = number | 'identity' | 'devices' | 'spaces' | 'join';
|
|
5
|
-
export declare class InvitationsManager {
|
|
5
|
+
export declare class InvitationsManager extends ShellManager {
|
|
6
6
|
private readonly _browser;
|
|
7
|
-
page: Page;
|
|
8
7
|
private _initialized;
|
|
9
8
|
private _invitationCode;
|
|
10
|
-
private
|
|
9
|
+
private _authCode;
|
|
11
10
|
constructor(_browser: Browser);
|
|
12
11
|
init(): Promise<void>;
|
|
13
12
|
getDisplayName(id: number): Promise<string | null>;
|
|
14
13
|
getSpaceName(id: number, nth: number): Promise<string | null>;
|
|
15
|
-
authenticatorIsVisible(id: number, type: 'device' | 'space'): Promise<boolean>;
|
|
16
|
-
invitationFailed(id: number): Promise<boolean>;
|
|
17
14
|
setConnectionState(id: number, state: ConnectionState): Promise<void>;
|
|
18
15
|
openPanel(id: number, panel: PanelType): Promise<void>;
|
|
19
16
|
createIdentity(id: number): Promise<void>;
|
|
20
17
|
createSpace(id: number): Promise<void>;
|
|
21
|
-
createInvitation(id: number, type: 'device' | 'space', options?:
|
|
18
|
+
createInvitation(id: number, type: 'device' | 'space', options?: Partial<Invitation>): Promise<string>;
|
|
22
19
|
acceptInvitation(id: number, type: 'device' | 'space', invitation: string): Promise<void>;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
getAuthenticationCode(): Promise<string>;
|
|
26
|
-
authenticateInvitation(id: number, type: 'device' | 'space', authenticationCode: string): Promise<void>;
|
|
27
|
-
clearAuthenticationCode(id: number, type: 'device' | 'space'): Promise<void>;
|
|
28
|
-
resetInvitation(id: number): Promise<void>;
|
|
29
|
-
doneInvitation(id: number, type: 'device' | 'space'): Promise<void>;
|
|
30
|
-
private _peer;
|
|
20
|
+
getAuthCode(): Promise<string>;
|
|
21
|
+
peer(id: number): import("playwright").Locator;
|
|
31
22
|
private _onConsoleMessage;
|
|
32
23
|
}
|
|
33
24
|
//# sourceMappingURL=invitations-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitations-manager.d.ts","sourceRoot":"","sources":["../../../../src/playwright/invitations-manager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAkB,
|
|
1
|
+
{"version":3,"file":"invitations-manager.d.ts","sourceRoot":"","sources":["../../../../src/playwright/invitations-manager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAkB,MAAM,YAAY,CAAC;AAI1D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAGzF,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAM1C,oBAAY,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE5E,qBAAa,kBAAmB,SAAQ,YAAY;IAKtC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAJrC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,eAAe,CAAyB;IAChD,OAAO,CAAC,SAAS,CAAyB;gBAEb,QAAQ,EAAE,OAAO;IAIxC,IAAI;IAiBJ,cAAc,CAAC,EAAE,EAAE,MAAM;IAKzB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAOpC,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe;IASrD,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS;IA2BtC,cAAc,CAAC,EAAE,EAAE,MAAM;IASzB,WAAW,CAAC,EAAE,EAAE,MAAM;IAItB,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAsBtG,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,UAAU,EAAE,MAAM;IAUzE,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAKpC,IAAI,CAAC,EAAE,EAAE,MAAM;YAID,iBAAiB;CAUhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Locator, Page, FrameLocator } from 'playwright';
|
|
2
|
+
declare type Scope = Locator | FrameLocator | Page;
|
|
3
|
+
export declare class ShellManager {
|
|
4
|
+
page: Page;
|
|
5
|
+
authenticatorIsVisible(type: 'device' | 'space', scope?: Scope): Promise<boolean>;
|
|
6
|
+
invitationFailed(scope?: Scope): Promise<boolean>;
|
|
7
|
+
inputInvitation(type: 'device' | 'space', invitation: string, scope?: Scope): Promise<void>;
|
|
8
|
+
invitationInputContinue(type: 'device' | 'space', scope?: Scope): Promise<void>;
|
|
9
|
+
cancelInvitation(type: 'device' | 'space', kind: 'host' | 'guest', scope?: Scope): Promise<void>;
|
|
10
|
+
authenticateInvitation(type: 'device' | 'space', authCode: string, scope?: Scope): Promise<void>;
|
|
11
|
+
clearAuthCode(type: 'device' | 'space', scope?: Scope): Promise<void>;
|
|
12
|
+
resetInvitation(scope?: Scope): Promise<void>;
|
|
13
|
+
doneInvitation(type: 'device' | 'space', scope?: Scope): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=shell-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-manager.d.ts","sourceRoot":"","sources":["../../../../src/testing/shell-manager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE9D,aAAK,KAAK,GAAG,OAAO,GAAG,YAAY,GAAG,IAAI,CAAC;AAE3C,qBAAa,YAAY;IACvB,IAAI,EAAG,IAAI,CAAC;IAEZ,sBAAsB,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,KAAK,CAAC,EAAE,KAAK;IAI9D,gBAAgB,CAAC,KAAK,CAAC,EAAE,KAAK;IAIxB,eAAe,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAK3E,uBAAuB,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,KAAK,CAAC,EAAE,KAAK;IAI/D,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,KAAK,CAAC,EAAE,KAAK;IAQhF,sBAAsB,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAOhF,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,KAAK,CAAC,EAAE,KAAK;IAMrD,eAAe,CAAC,KAAK,CAAC,EAAE,KAAK;IAI7B,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,KAAK,CAAC,EAAE,KAAK;CAK7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitationStatusValue.d.ts","sourceRoot":"","sources":["../../../../src/util/invitationStatusValue.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,+
|
|
1
|
+
{"version":3,"file":"invitationStatusValue.d.ts","sourceRoot":"","sources":["../../../../src/util/invitationStatusValue.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,+BAUhC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36-next.ef27157",
|
|
4
4
|
"description": "A React component library for DXOS’s OS experiences",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "DXOS.org",
|
|
9
|
-
"
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./dist/lib/browser/index.mjs",
|
|
11
|
+
"./testing": "./dist/lib/browser/testing/index.mjs",
|
|
12
|
+
"./theme-extensions": "./theme-extensions.js"
|
|
13
|
+
},
|
|
10
14
|
"types": "dist/types/src/index.d.ts",
|
|
15
|
+
"typesVersions": {
|
|
16
|
+
"*": {
|
|
17
|
+
"testing": [
|
|
18
|
+
"dist/types/src/testing/index.d.ts"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
11
22
|
"files": [
|
|
12
23
|
"dist",
|
|
13
24
|
"src",
|
|
@@ -25,14 +36,14 @@
|
|
|
25
36
|
"qrcode.react": "^3.1.0",
|
|
26
37
|
"url-join": "^5.0.0",
|
|
27
38
|
"xstate": "^4.37.0",
|
|
28
|
-
"@dxos/client": "0.1.
|
|
29
|
-
"@dxos/config": "0.1.
|
|
30
|
-
"@dxos/debug": "0.1.
|
|
31
|
-
"@dxos/keys": "0.1.
|
|
32
|
-
"@dxos/protocols": "0.1.
|
|
33
|
-
"@dxos/react-client": "0.1.
|
|
34
|
-
"@dxos/react-components": "0.1.
|
|
35
|
-
"@dxos/util": "0.1.
|
|
39
|
+
"@dxos/client": "0.1.36-next.ef27157",
|
|
40
|
+
"@dxos/config": "0.1.36-next.ef27157",
|
|
41
|
+
"@dxos/debug": "0.1.36-next.ef27157",
|
|
42
|
+
"@dxos/keys": "0.1.36-next.ef27157",
|
|
43
|
+
"@dxos/protocols": "0.1.36-next.ef27157",
|
|
44
|
+
"@dxos/react-client": "0.1.36-next.ef27157",
|
|
45
|
+
"@dxos/react-components": "0.1.36-next.ef27157",
|
|
46
|
+
"@dxos/util": "0.1.36-next.ef27157"
|
|
36
47
|
},
|
|
37
48
|
"devDependencies": {
|
|
38
49
|
"@faker-js/faker": "^7.6.0",
|
|
@@ -45,10 +56,10 @@
|
|
|
45
56
|
"react": "^18.2.0",
|
|
46
57
|
"react-dom": "^18.2.0",
|
|
47
58
|
"vite": "^4.2.0",
|
|
48
|
-
"@dxos/async": "0.1.
|
|
49
|
-
"@dxos/client-services": "0.1.
|
|
50
|
-
"@dxos/log": "0.1.
|
|
51
|
-
"@dxos/react-async": "0.1.
|
|
59
|
+
"@dxos/async": "0.1.36-next.ef27157",
|
|
60
|
+
"@dxos/client-services": "0.1.36-next.ef27157",
|
|
61
|
+
"@dxos/log": "0.1.36-next.ef27157",
|
|
62
|
+
"@dxos/react-async": "0.1.36-next.ef27157"
|
|
52
63
|
},
|
|
53
64
|
"peerDependencies": {
|
|
54
65
|
"@phosphor-icons/react": "^2.0.5",
|
|
@@ -20,8 +20,8 @@ export const InvitationList = ({ invitations, ...invitationProps }: InvitationLi
|
|
|
20
20
|
<AccordionRoot type='single' collapsible className='flex flex-col gap-1'>
|
|
21
21
|
<DensityProvider density='fine'>
|
|
22
22
|
<ClipboardProvider>
|
|
23
|
-
{invitations.map((invitation
|
|
24
|
-
const value = invitation.
|
|
23
|
+
{invitations.map((invitation) => {
|
|
24
|
+
const value = invitation.get().invitationId;
|
|
25
25
|
return <InvitationListItem key={value} value={value} invitation={invitation} {...invitationProps} />;
|
|
26
26
|
})}
|
|
27
27
|
</ClipboardProvider>
|
|
@@ -18,8 +18,9 @@ export const InvitationListContainer = ({ spaceKey, createInvitationUrl }: Invit
|
|
|
18
18
|
const space = useSpace(spaceKey);
|
|
19
19
|
const invitations = useSpaceInvitations(spaceKey);
|
|
20
20
|
const onClickRemove = useCallback(
|
|
21
|
-
(
|
|
22
|
-
|
|
21
|
+
(invitation: CancellableInvitationObservable) => {
|
|
22
|
+
const invitationId = invitation.get().invitationId;
|
|
23
|
+
invitationId && space?.removeInvitation(invitationId);
|
|
23
24
|
},
|
|
24
25
|
[space]
|
|
25
26
|
);
|
|
@@ -30,10 +30,10 @@ export const InvitationListItem = ({
|
|
|
30
30
|
const { t } = useTranslation('os');
|
|
31
31
|
const qrLabel = useId('qrLabel');
|
|
32
32
|
|
|
33
|
-
const { cancel, status, haltedAt, invitationCode,
|
|
33
|
+
const { cancel, status, haltedAt, invitationCode, authCode } = useInvitationStatus(invitation);
|
|
34
34
|
const statusValue = invitationStatusValue.get(status) ?? 0;
|
|
35
35
|
|
|
36
|
-
const isCancellable = statusValue <
|
|
36
|
+
const isCancellable = statusValue < 5 && statusValue >= 0;
|
|
37
37
|
const showShare = statusValue < 3 && statusValue >= 0;
|
|
38
38
|
const showAuthCode = statusValue === 3;
|
|
39
39
|
|
|
@@ -44,9 +44,7 @@ export const InvitationListItem = ({
|
|
|
44
44
|
return (
|
|
45
45
|
<AccordionPrimitive.Item value={value}>
|
|
46
46
|
<AccordionPrimitive.Header className='flex gap-2 items-center'>
|
|
47
|
-
<InvitationStatusAvatar
|
|
48
|
-
{...{ status, haltedAt, size: 8, invitationId: invitation?.invitation?.invitationId }}
|
|
49
|
-
/>
|
|
47
|
+
<InvitationStatusAvatar {...{ status, haltedAt, size: 8, invitationId: invitation?.get().invitationId }} />
|
|
50
48
|
{showShare && invitationUrl ? (
|
|
51
49
|
<>
|
|
52
50
|
<AccordionPrimitive.Trigger asChild>
|
|
@@ -58,9 +56,7 @@ export const InvitationListItem = ({
|
|
|
58
56
|
<CopyButton value={invitationUrl} />
|
|
59
57
|
</>
|
|
60
58
|
) : showAuthCode ? (
|
|
61
|
-
<p className='grow text-xl text-center text-success-500 dark:text-success-300 font-mono'>
|
|
62
|
-
{authenticationCode}
|
|
63
|
-
</p>
|
|
59
|
+
<p className='grow text-xl text-center text-success-500 dark:text-success-300 font-mono'>{authCode}</p>
|
|
64
60
|
) : (
|
|
65
61
|
<span role='none' className='grow' />
|
|
66
62
|
)}
|
|
@@ -35,8 +35,8 @@ const JoinClientDecorator = (Story: StoryFn, { args }: StoryContext) => {
|
|
|
35
35
|
log.info('[next invitation code]', { nextInvitationCode });
|
|
36
36
|
setInvitationCode(nextInvitationCode);
|
|
37
37
|
}
|
|
38
|
-
if (invitation.
|
|
39
|
-
log.info('[verification code]', invitation.
|
|
38
|
+
if (invitation.authCode) {
|
|
39
|
+
log.info('[verification code]', invitation.authCode);
|
|
40
40
|
}
|
|
41
41
|
}, []);
|
|
42
42
|
|
|
@@ -51,16 +51,7 @@ const JoinClientDecorator = (Story: StoryFn, { args }: StoryContext) => {
|
|
|
51
51
|
space.properties.name = 'Q3 2022 Planning';
|
|
52
52
|
|
|
53
53
|
const invitation = space.createInvitation({ type: Invitation.Type.INTERACTIVE });
|
|
54
|
-
|
|
55
|
-
invitation.subscribe({
|
|
56
|
-
onAuthenticating: onInvitationEvent,
|
|
57
|
-
onCancelled: (...args) => log.warn('[cancelled]', args),
|
|
58
|
-
onConnected: onInvitationEvent,
|
|
59
|
-
onConnecting: onInvitationEvent,
|
|
60
|
-
onError: onInvitationEvent,
|
|
61
|
-
onSuccess: onInvitationEvent,
|
|
62
|
-
onTimeout: (...args) => log.warn('[timeout]', args)
|
|
63
|
-
});
|
|
54
|
+
invitation.subscribe(onInvitationEvent, (err) => log.catch(err));
|
|
64
55
|
|
|
65
56
|
return () => {
|
|
66
57
|
void Promise.all(clients.map((client) => client.destroy()));
|
|
@@ -48,7 +48,7 @@ export const Shell = ({ runtime, origin }: { runtime: ShellRuntime; origin: stri
|
|
|
48
48
|
mode='halo-only'
|
|
49
49
|
initialInvitationCode={invitationCode}
|
|
50
50
|
onDone={async () => {
|
|
51
|
-
// TODO(wittjosiah):
|
|
51
|
+
// TODO(wittjosiah): Support this first-class inside client?
|
|
52
52
|
spaces.length > 0 || (await client.createSpace());
|
|
53
53
|
await runtime.setAppContext({ display: ShellDisplay.NONE });
|
|
54
54
|
runtime.setLayout(ShellLayout.DEFAULT);
|
|
@@ -62,6 +62,7 @@ export const useShell = (): {
|
|
|
62
62
|
};
|
|
63
63
|
export type ShellProviderProps = PropsWithChildren<{
|
|
64
64
|
space?: Space;
|
|
65
|
+
// TODO(wittjosiah): `deviceInvitationCode`.
|
|
65
66
|
haloInvitationCode?: string | null;
|
|
66
67
|
spaceInvitationCode?: string | null;
|
|
67
68
|
onJoinedSpace?: (spaceKey?: PublicKey) => void;
|
|
@@ -104,7 +105,7 @@ export const ShellProvider = ({
|
|
|
104
105
|
);
|
|
105
106
|
|
|
106
107
|
const shellRuntime = useMemo(() => {
|
|
107
|
-
if (client.config.get('runtime.app.env.DX_VAULT')
|
|
108
|
+
if (client.config.get('runtime.app.env.DX_VAULT') !== 'false') {
|
|
108
109
|
return;
|
|
109
110
|
}
|
|
110
111
|
|
|
@@ -115,10 +116,14 @@ export const ShellProvider = ({
|
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
if (haloInvitationCode) {
|
|
120
|
+
return new MemoryShellRuntime({
|
|
121
|
+
layout: ShellLayout.INITIALIZE_IDENTITY,
|
|
122
|
+
invitationCode: haloInvitationCode
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return new MemoryShellRuntime({ layout: ShellLayout.DEFAULT });
|
|
122
127
|
}, [client, identity, spaceInvitationCode, haloInvitationCode]);
|
|
123
128
|
|
|
124
129
|
const handleKeyDown = useCallback(
|
|
@@ -167,9 +172,7 @@ export const ShellProvider = ({
|
|
|
167
172
|
</div>
|
|
168
173
|
)}
|
|
169
174
|
|
|
170
|
-
<ShellContext.Provider value={{ runtime: shellRuntime, setDisplay }}>
|
|
171
|
-
{identity ? children : undefined}
|
|
172
|
-
</ShellContext.Provider>
|
|
175
|
+
<ShellContext.Provider value={{ runtime: shellRuntime, setDisplay }}>{children}</ShellContext.Provider>
|
|
173
176
|
</>
|
|
174
177
|
);
|
|
175
178
|
};
|
|
@@ -64,7 +64,9 @@ const DeviceListView = ({ createInvitationUrl, titleId, onDone, doneActionParent
|
|
|
64
64
|
<div role='region' className={mx(defaultSurface, 'rounded-be-md p-2')}>
|
|
65
65
|
<InvitationList
|
|
66
66
|
invitations={invitations}
|
|
67
|
-
onClickRemove={(
|
|
67
|
+
onClickRemove={(invitation) =>
|
|
68
|
+
invitation.get() && client.halo.removeInvitation(invitation.get().invitationId)
|
|
69
|
+
}
|
|
68
70
|
createInvitationUrl={createInvitationUrl}
|
|
69
71
|
/>
|
|
70
72
|
<Button
|
|
@@ -98,7 +98,7 @@ export const JoinPanel = ({
|
|
|
98
98
|
active: joinState.matches({
|
|
99
99
|
choosingIdentity: { acceptingHaloInvitation: 'inputtingHaloInvitationCode' }
|
|
100
100
|
}),
|
|
101
|
-
|
|
101
|
+
Kind: 'Halo'
|
|
102
102
|
}}
|
|
103
103
|
/>
|
|
104
104
|
<InvitationRescuer
|
|
@@ -117,7 +117,7 @@ export const JoinPanel = ({
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
].some(joinState.matches),
|
|
120
|
-
|
|
120
|
+
Kind: 'Halo'
|
|
121
121
|
}}
|
|
122
122
|
/>
|
|
123
123
|
<InvitationAuthenticator
|
|
@@ -143,7 +143,7 @@ export const JoinPanel = ({
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
].some(joinState.matches),
|
|
146
|
-
|
|
146
|
+
Kind: 'Halo',
|
|
147
147
|
...(joinState.matches({
|
|
148
148
|
acceptingHaloInvitation: {
|
|
149
149
|
acceptingRedeemedHaloInvitation: 'authenticationFailingHaloVerificationCode'
|
|
@@ -163,7 +163,7 @@ export const JoinPanel = ({
|
|
|
163
163
|
},
|
|
164
164
|
'finishingJoiningHalo'
|
|
165
165
|
].some(joinState.matches),
|
|
166
|
-
|
|
166
|
+
Kind: 'Halo',
|
|
167
167
|
doneActionParent,
|
|
168
168
|
onDone
|
|
169
169
|
}}
|
|
@@ -187,7 +187,7 @@ export const JoinPanel = ({
|
|
|
187
187
|
active: joinState.matches({
|
|
188
188
|
acceptingSpaceInvitation: 'inputtingSpaceInvitationCode'
|
|
189
189
|
}),
|
|
190
|
-
|
|
190
|
+
Kind: 'Space'
|
|
191
191
|
}}
|
|
192
192
|
/>
|
|
193
193
|
<InvitationRescuer
|
|
@@ -202,7 +202,7 @@ export const JoinPanel = ({
|
|
|
202
202
|
acceptingSpaceInvitation: { acceptingRedeemedSpaceInvitation: 'failingSpaceInvitation' }
|
|
203
203
|
}
|
|
204
204
|
].some(joinState.matches),
|
|
205
|
-
|
|
205
|
+
Kind: 'Space'
|
|
206
206
|
}}
|
|
207
207
|
/>
|
|
208
208
|
<InvitationAuthenticator
|
|
@@ -222,7 +222,7 @@ export const JoinPanel = ({
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
].some(joinState.matches),
|
|
225
|
-
|
|
225
|
+
Kind: 'Space',
|
|
226
226
|
...(joinState.matches({
|
|
227
227
|
acceptingSpaceInvitation: {
|
|
228
228
|
acceptingRedeemedSpaceInvitation: 'authenticationFailingSpaceVerificationCode'
|
|
@@ -235,7 +235,7 @@ export const JoinPanel = ({
|
|
|
235
235
|
joinState,
|
|
236
236
|
joinSend,
|
|
237
237
|
active: joinState.matches('finishingJoiningSpace'),
|
|
238
|
-
|
|
238
|
+
Kind: 'Space',
|
|
239
239
|
doneActionParent,
|
|
240
240
|
onDone
|
|
241
241
|
}}
|