@dxos/shell 0.3.11-main.162de7b → 0.3.11-main.18bb4b6

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 (73) hide show
  1. package/dist/bundle/shell.mjs +6647 -6478
  2. package/dist/bundle/shell.mjs.map +1 -1
  3. package/dist/bundle/shell.umd.js +59 -59
  4. package/dist/bundle/shell.umd.js.map +1 -1
  5. package/dist/bundle/style.css +1 -1
  6. package/dist/lib/browser/meta.json +1 -1
  7. package/dist/lib/browser/react.mjs +676 -426
  8. package/dist/lib/browser/react.mjs.map +4 -4
  9. package/dist/types/src/components/Panel/Action.js +1 -1
  10. package/dist/types/src/components/Panel/Action.js.map +1 -1
  11. package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -1
  12. package/dist/types/src/composites/Shell/Shell.js +15 -5
  13. package/dist/types/src/composites/Shell/Shell.js.map +1 -1
  14. package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -1
  15. package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +12 -8
  16. package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -1
  17. package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts +3 -1
  18. package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts.map +1 -1
  19. package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts +1 -1
  20. package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts.map +1 -1
  21. package/dist/types/src/panels/IdentityPanel/identityMachine.js +10 -2
  22. package/dist/types/src/panels/IdentityPanel/identityMachine.js.map +1 -1
  23. package/dist/types/src/panels/IdentityPanel/steps/AgentPanel.d.ts +19 -0
  24. package/dist/types/src/panels/IdentityPanel/steps/AgentPanel.d.ts.map +1 -0
  25. package/dist/types/src/panels/IdentityPanel/steps/AgentPanel.js +122 -0
  26. package/dist/types/src/panels/IdentityPanel/steps/AgentPanel.js.map +1 -0
  27. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +5 -1
  28. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -1
  29. package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.d.ts +16 -0
  30. package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.d.ts.map +1 -0
  31. package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.js +40 -0
  32. package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.js.map +1 -0
  33. package/dist/types/src/panels/IdentityPanel/steps/index.d.ts +2 -0
  34. package/dist/types/src/panels/IdentityPanel/steps/index.d.ts.map +1 -1
  35. package/dist/types/src/panels/IdentityPanel/steps/index.js +2 -0
  36. package/dist/types/src/panels/IdentityPanel/steps/index.js.map +1 -1
  37. package/dist/types/src/panels/JoinPanel/JoinPanel.js +4 -3
  38. package/dist/types/src/panels/JoinPanel/JoinPanel.js.map +1 -1
  39. package/dist/types/src/panels/JoinPanel/joinMachine.js +1 -1
  40. package/dist/types/src/panels/JoinPanel/joinMachine.js.map +1 -1
  41. package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts.map +1 -1
  42. package/dist/types/src/panels/SpacePanel/SpacePanel.js +5 -3
  43. package/dist/types/src/panels/SpacePanel/SpacePanel.js.map +1 -1
  44. package/dist/types/src/panels/SpacePanel/SpacePanel.stories.d.ts.map +1 -1
  45. package/dist/types/src/panels/SpacePanel/SpacePanel.stories.js +2 -2
  46. package/dist/types/src/panels/SpacePanel/SpacePanel.stories.js.map +1 -1
  47. package/dist/types/src/panels/SpacePanel/SpacePanelProps.d.ts +1 -0
  48. package/dist/types/src/panels/SpacePanel/SpacePanelProps.d.ts.map +1 -1
  49. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts +1 -0
  50. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts.map +1 -1
  51. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js +3 -1
  52. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js.map +1 -1
  53. package/dist/types/src/translations/locales/en-US.d.ts +5 -0
  54. package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
  55. package/dist/types/src/translations/locales/en-US.js +5 -0
  56. package/dist/types/src/translations/locales/en-US.js.map +1 -1
  57. package/package.json +18 -17
  58. package/src/components/Panel/Action.tsx +1 -1
  59. package/src/composites/Shell/Shell.tsx +16 -3
  60. package/src/panels/IdentityPanel/IdentityPanel.tsx +21 -9
  61. package/src/panels/IdentityPanel/IdentityPanelProps.ts +9 -1
  62. package/src/panels/IdentityPanel/identityMachine.ts +11 -3
  63. package/src/panels/IdentityPanel/steps/AgentPanel.tsx +165 -0
  64. package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +7 -7
  65. package/src/panels/IdentityPanel/steps/SignOutChooser.tsx +82 -0
  66. package/src/panels/IdentityPanel/steps/index.ts +2 -0
  67. package/src/panels/JoinPanel/JoinPanel.tsx +2 -2
  68. package/src/panels/JoinPanel/joinMachine.ts +1 -1
  69. package/src/panels/SpacePanel/SpacePanel.stories.tsx +2 -1
  70. package/src/panels/SpacePanel/SpacePanel.tsx +4 -1
  71. package/src/panels/SpacePanel/SpacePanelProps.ts +1 -0
  72. package/src/panels/SpacePanel/steps/SpaceManager.tsx +4 -1
  73. package/src/translations/locales/en-US.ts +5 -0
@@ -17,7 +17,7 @@ import {
17
17
  type IdentityPanelProps,
18
18
  } from './IdentityPanelProps';
19
19
  import { useIdentityMachine } from './identityMachine';
20
- import { DeviceManager, IdentityActionChooser, ProfileForm } from './steps';
20
+ import { AgentForm, DeviceManager, IdentityActionChooser, ProfileForm, SignOutChooser } from './steps';
21
21
  import { Viewport, Heading, CloseButton } from '../../components';
22
22
  import { InvitationManager } from '../../steps';
23
23
 
@@ -45,6 +45,8 @@ export const IdentityPanelImpl = (props: IdentityPanelImplProps) => {
45
45
  titleId,
46
46
  activeView,
47
47
  onUpdateProfile,
48
+ onResetDevice,
49
+ onJoinNewIdentity,
48
50
  IdentityActionChooser: IdentityActionChooserComponent = IdentityActionChooser,
49
51
  InvitationManager: InvitationManagerComponent = InvitationManager,
50
52
  onDone,
@@ -53,15 +55,15 @@ export const IdentityPanelImpl = (props: IdentityPanelImplProps) => {
53
55
  const { t } = useTranslation('os');
54
56
  const title = useMemo(() => {
55
57
  switch (activeView) {
56
- case 'device manager':
57
- return t('choose devices label');
58
+ case 'agent manager':
59
+ return 'Manage Agent';
58
60
  case 'device invitation manager':
59
61
  return t('choose add device label');
60
62
  default:
61
63
  return t('identity heading');
62
64
  }
63
65
  }, [activeView, t]);
64
- console.log('[IdentityPanelImpl]', { activeView });
66
+
65
67
  return (
66
68
  <DensityProvider density='fine'>
67
69
  <IdentityHeading {...{ identity, titleId, title, onDone }} />
@@ -88,7 +90,17 @@ export const IdentityPanelImpl = (props: IdentityPanelImplProps) => {
88
90
  onUpdateProfile={onUpdateProfile}
89
91
  />
90
92
  </Viewport.View>
91
- {/* <Viewport.View id='signing out'></Viewport.View> */}
93
+ <Viewport.View classNames={viewStyles} id='signing out'>
94
+ <SignOutChooser
95
+ send={rest.send}
96
+ active={activeView === 'signing out'}
97
+ onResetDevice={onResetDevice}
98
+ onJoinNewIdentity={onJoinNewIdentity}
99
+ />
100
+ </Viewport.View>
101
+ <Viewport.View classNames={viewStyles} id='agent manager'>
102
+ <AgentForm send={rest.send} active={activeView === 'agent manager'} identity={identity} />
103
+ </Viewport.View>
92
104
  </Viewport.Views>
93
105
  </Viewport.Root>
94
106
  </DensityProvider>
@@ -136,15 +148,15 @@ export const IdentityPanel = ({
136
148
  return 'device manager';
137
149
  case [{ managingProfile: 'idle' }, { managingProfile: 'pending' }].some(identityState.matches):
138
150
  return 'update profile form';
139
- // case identityState.matches('signingOut'):
140
- // return 'identity exit';
151
+ case identityState.matches('signingOut'):
152
+ return 'signing out';
153
+ case [{ managingAgent: 'idle' }, { managingAgent: 'pending' }].some(identityState.matches):
154
+ return 'agent manager';
141
155
  default:
142
156
  return 'identity action chooser';
143
157
  }
144
158
  }, [identityState]);
145
159
 
146
- console.log({ activeView, identityState });
147
-
148
160
  const onUpdateProfile = async (profile: NonNullable<Identity['profile']>) => {
149
161
  identitySend({ type: 'updateProfile' });
150
162
  await client.halo.updateProfile(profile);
@@ -13,10 +13,18 @@ import type { InvitationManagerProps } from '../../steps';
13
13
 
14
14
  export type IdentityPanelImplProps = {
15
15
  titleId: string;
16
- activeView: 'device manager' | 'update profile form' | 'device invitation manager' | 'identity action chooser';
16
+ activeView:
17
+ | 'device manager'
18
+ | 'agent manager'
19
+ | 'update profile form'
20
+ | 'device invitation manager'
21
+ | 'identity action chooser'
22
+ | 'signing out';
17
23
  identity: Identity;
18
24
  devices: Device[];
19
25
  onUpdateProfile?: (profile: NonNullable<Identity['profile']>) => Promise<void>;
26
+ onResetDevice?: () => Promise<void>;
27
+ onJoinNewIdentity?: () => void;
20
28
  createInvitationUrl: (invitationCode: string) => string;
21
29
  send?: (event: SingleOrArray<Event<IdentityEvent>>) => void;
22
30
  onDone?: () => void;
@@ -19,7 +19,7 @@ type IdentityMachineContext = {
19
19
  };
20
20
 
21
21
  type IdentityChooseActionEvent = {
22
- type: 'chooseDevices' | 'chooseProfile' | /* 'chooseSignOut' | */ 'unchooseAction';
22
+ type: 'chooseDevices' | 'chooseAgent' | 'chooseProfile' | 'chooseSignOut' | 'sigingOut' | 'unchooseAction';
23
23
  };
24
24
 
25
25
  type IdentitySelectDeviceInvitationEvent = {
@@ -58,6 +58,13 @@ const identityMachine = createMachine<IdentityMachineContext, IdentityEvent>(
58
58
  states: {
59
59
  choosingAction: {},
60
60
  managingDeviceInvitation: {},
61
+ managingAgent: {
62
+ initial: 'idle',
63
+ states: {
64
+ idle: {},
65
+ pending: {},
66
+ },
67
+ },
61
68
  managingDevices: {},
62
69
  managingProfile: {
63
70
  initial: 'idle',
@@ -70,7 +77,7 @@ const identityMachine = createMachine<IdentityMachineContext, IdentityEvent>(
70
77
  updateProfile: { target: '.pending', actions: 'log' },
71
78
  },
72
79
  },
73
- // signingOut: {},
80
+ signingOut: {},
74
81
  },
75
82
  on: {
76
83
  unchooseAction: { target: '.choosingAction', actions: ['unsetInvitation', 'log'] },
@@ -78,7 +85,8 @@ const identityMachine = createMachine<IdentityMachineContext, IdentityEvent>(
78
85
  selectInvitation: { target: '.managingDeviceInvitation', actions: ['setInvitation', 'log'] },
79
86
  chooseDevices: { target: '.managingDevices', actions: 'log' },
80
87
  chooseProfile: { target: '.managingProfile', actions: 'log' },
81
- // chooseSignOut: { target: '.signingOut', actions: 'log' },
88
+ chooseSignOut: { target: '.signingOut', actions: 'log' },
89
+ chooseAgent: { target: '.managingAgent', actions: 'log' },
82
90
  },
83
91
  },
84
92
  {
@@ -0,0 +1,165 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React, { useState, useCallback, useEffect } from 'react';
6
+ import { type Event, type SingleOrArray } from 'xstate';
7
+
8
+ import { invariant } from '@dxos/invariant';
9
+ import { useClient, useAgentHostingProviderClient } from '@dxos/react-client';
10
+ import { type Identity, useHaloInvitations } from '@dxos/react-client/halo';
11
+ import { Invitation, InvitationEncoder } from '@dxos/react-client/invitations';
12
+ import { useTranslation } from '@dxos/react-ui';
13
+
14
+ import { Action, Actions, StepHeading, Input } from '../../../components';
15
+ import { type IdentityPanelStepProps } from '../IdentityPanelProps';
16
+ import { type IdentityEvent } from '../identityMachine';
17
+
18
+ export interface AgentFormProps extends Omit<IdentityPanelStepProps, 'send'> {
19
+ send?: (event: SingleOrArray<Event<IdentityEvent>>) => void;
20
+ onAgentCreate?: () => Promise<void>;
21
+ onAgentDestroy?: () => Promise<void>;
22
+ identity?: Identity;
23
+ }
24
+
25
+ export type AgentFormImplProps = AgentFormProps & {
26
+ agentStatus?: string;
27
+ agentActive?: boolean;
28
+ agentProviderDisabled?: boolean;
29
+ validationMessage?: string;
30
+ };
31
+
32
+ export const AgentForm = (props: AgentFormProps) => {
33
+ const { identity } = props;
34
+ // const { t } = useTranslation('os');
35
+ const [validationMessage, setValidationMessage] = useState('');
36
+ const [agentStatus, setAgentStatus] = useState('');
37
+ const [agentActive, setAgentActive] = useState(false);
38
+ const client = useClient();
39
+ const invitations = useHaloInvitations();
40
+ const agentHostingProviderClient = useAgentHostingProviderClient(client.config);
41
+
42
+ useEffect(() => {
43
+ const fetchAgentStatus = async () => {
44
+ // TODO(nf): if agent exists, subscribe to updates instead of oneshot status
45
+ if (agentHostingProviderClient) {
46
+ const agentStatus = await agentHostingProviderClient?.getAgent(identity?.identityKey.truncate() ?? 'foo');
47
+ if (agentStatus) {
48
+ setAgentActive(true);
49
+ setAgentStatus(agentStatus);
50
+ } else {
51
+ setAgentActive(false);
52
+ setValidationMessage('No agent deployed via provider.');
53
+ }
54
+ } else {
55
+ setValidationMessage('No agent provider configured.');
56
+ }
57
+ };
58
+ void fetchAgentStatus();
59
+ }, []);
60
+
61
+ const onAgentCreateEvent = useCallback(async (invitation: Invitation) => {
62
+ const invitationCode = InvitationEncoder.encode(invitation);
63
+ if (invitation.state === Invitation.State.CONNECTING) {
64
+ console.log(JSON.stringify({ invitationCode, authCode: invitation.authCode }));
65
+ invariant(identity, 'Identity not found');
66
+ if (agentHostingProviderClient) {
67
+ try {
68
+ const res = await agentHostingProviderClient?.createAgent(invitationCode, identity.identityKey.truncate());
69
+ // TODO(nf): human-consumable response from API
70
+ setAgentStatus(res);
71
+ setAgentActive(true);
72
+ setValidationMessage('');
73
+ } catch (err: any) {
74
+ setValidationMessage(`error creating agent: ${err.message}`);
75
+ }
76
+ }
77
+ }
78
+ }, []);
79
+
80
+ const handleAgentCreate = async () => {
81
+ invitations.forEach((invitation) => invitation.cancel());
82
+
83
+ // TODO(nf): do this work in the hosting provider client?
84
+ const invitation = client.halo.share({ type: Invitation.Type.MULTIUSE, authMethod: Invitation.AuthMethod.NONE });
85
+
86
+ invitation.subscribe(onAgentCreateEvent);
87
+ };
88
+
89
+ const handleAgentDestroy = async () => {
90
+ const identity = client.halo.identity.get();
91
+ invariant(identity, 'Identity not found');
92
+ try {
93
+ await agentHostingProviderClient?.destroyAgent(identity.identityKey.truncate());
94
+ setValidationMessage('No agent deployed via provider.');
95
+ setAgentStatus('');
96
+ setAgentActive(false);
97
+ } catch (err: any) {
98
+ setValidationMessage(`error destroying agent: ${err.message}`);
99
+ }
100
+ };
101
+
102
+ return (
103
+ <AgentFormImpl
104
+ {...props}
105
+ onAgentCreate={handleAgentCreate}
106
+ onAgentDestroy={handleAgentDestroy}
107
+ validationMessage={validationMessage}
108
+ agentStatus={agentStatus}
109
+ agentActive={agentActive}
110
+ agentProviderDisabled={!agentHostingProviderClient}
111
+ />
112
+ );
113
+ };
114
+
115
+ // TODO(zhenyasav): impl shouldn't need send()
116
+ export const AgentFormImpl = (props: AgentFormImplProps) => {
117
+ const {
118
+ active,
119
+ onAgentCreate,
120
+ onAgentDestroy,
121
+ send,
122
+ validationMessage,
123
+ agentStatus,
124
+ agentActive,
125
+ agentProviderDisabled,
126
+ } = props;
127
+ const disabled = !active;
128
+ const { t } = useTranslation('os');
129
+ return (
130
+ <>
131
+ <div role='none' className='grow flex flex-col justify-center'>
132
+ <Input
133
+ {...{ validationMessage }}
134
+ label={<StepHeading>Agent Status</StepHeading>}
135
+ disabled={disabled}
136
+ data-testid='agent-status'
137
+ value={agentStatus}
138
+ />
139
+ </div>
140
+ <Actions>
141
+ <Action
142
+ disabled={agentActive || agentProviderDisabled}
143
+ onClick={() => onAgentCreate?.()}
144
+ data-testid={'create-agent'}
145
+ >
146
+ Create Agent
147
+ </Action>
148
+ <Action
149
+ disabled={!agentActive || agentProviderDisabled}
150
+ onClick={() => onAgentDestroy?.()}
151
+ data-testid={'destroy-agent'}
152
+ >
153
+ Destroy Agent
154
+ </Action>
155
+ <Action
156
+ disabled={disabled}
157
+ onClick={() => send?.({ type: 'unchooseAction' })}
158
+ data-testid={'update-profile-form-back'}
159
+ >
160
+ {t('back label')}
161
+ </Action>
162
+ </Actions>
163
+ </>
164
+ );
165
+ };
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { CaretRight, Devices, Plus, Power, UserGear } from '@phosphor-icons/react';
5
+ import { CaretRight, Devices, Plus, Power, UserGear, HardDrive } from '@phosphor-icons/react';
6
6
  import React, { useCallback } from 'react';
7
7
 
8
8
  import { useClient } from '@dxos/react-client';
@@ -63,6 +63,11 @@ export const IdentityActionChooserImpl = ({
63
63
  <div role='none' className='grow flex flex-col gap-1'>
64
64
  <DensityProvider density='coarse'>
65
65
  <div className='grow justify-center flex flex-col gap-1'>
66
+ <Action data-testid='manage-agent' onClick={() => send?.({ type: 'chooseAgent' })} classNames='plb-4'>
67
+ <HardDrive className={getSize(6)} />
68
+ <span className='grow mli-3'>Manage Agent</span>
69
+ <CaretRight weight='bold' className={getSize(4)} />
70
+ </Action>
66
71
  <Action
67
72
  disabled={!active}
68
73
  data-testid='devices-panel.create-invitation'
@@ -83,12 +88,7 @@ export const IdentityActionChooserImpl = ({
83
88
  <span className='grow mli-3'>{t('choose profile label')}</span>
84
89
  <CaretRight weight='bold' className={getSize(4)} />
85
90
  </Action>
86
- <Action
87
- disabled
88
- data-testid='sign-out'
89
- onClick={() => {} /* send({ type: 'chooseSignOut' }) */}
90
- classNames='plb-4'
91
- >
91
+ <Action data-testid='sign-out' onClick={() => send?.({ type: 'chooseSignOut' })} classNames='plb-4'>
92
92
  <Power className={getSize(6)} />
93
93
  <span className='grow mli-3'>{t('choose sign out label')}</span>
94
94
  <CaretRight weight='bold' className={getSize(4)} />
@@ -0,0 +1,82 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { Warning } from '@phosphor-icons/react';
6
+ import React from 'react';
7
+ import { type Event, type SingleOrArray } from 'xstate';
8
+
9
+ import { Message, useTranslation } from '@dxos/react-ui';
10
+ import { getSize, mx } from '@dxos/react-ui-theme';
11
+
12
+ import { Action, Actions } from '../../../components';
13
+ import { type IdentityPanelStepProps } from '../IdentityPanelProps';
14
+ import { type IdentityEvent } from '../identityMachine';
15
+
16
+ export interface SignOutChooserProps extends Omit<IdentityPanelStepProps, 'send'> {
17
+ send?: (event: SingleOrArray<Event<IdentityEvent>>) => void;
18
+ onResetDevice?: () => Promise<void>;
19
+ onJoinNewIdentity?: () => void;
20
+ }
21
+
22
+ export const SignOutChooser = (props: SignOutChooserProps) => {
23
+ const { t } = useTranslation('os');
24
+ const onResetDevice = () => {
25
+ if (window.confirm(t('reset device confirm message'))) {
26
+ void props.onResetDevice?.();
27
+ }
28
+ };
29
+ return (
30
+ <SignOutChooserImpl
31
+ disabled={!props.active}
32
+ onBack={() => props.send?.({ type: 'unchooseAction' })}
33
+ onResetDevice={onResetDevice}
34
+ onJoinNewIdentity={props.onJoinNewIdentity}
35
+ />
36
+ );
37
+ };
38
+
39
+ export type SignOutChooserImplProps = {
40
+ disabled?: boolean;
41
+ onResetDevice?: () => void;
42
+ onJoinNewIdentity?: () => void;
43
+ onBack?: () => void;
44
+ };
45
+
46
+ const SignOutChooserImpl = ({ disabled, onResetDevice, onJoinNewIdentity, onBack }: SignOutChooserImplProps) => {
47
+ const { t } = useTranslation('os');
48
+ return (
49
+ <>
50
+ <div role='none' className='grow flex flex-col justify-center'>
51
+ <Message.Root valence='error'>
52
+ <Message.Title>
53
+ <Warning className={mx(getSize(6), 'inline mie-2')} />
54
+ {t('sign out chooser title')}
55
+ </Message.Title>
56
+ <Message.Body>{t('sign out chooser message')}</Message.Body>
57
+ </Message.Root>
58
+ </div>
59
+ <Actions>
60
+ <Action disabled={disabled} onClick={onBack}>
61
+ {t('back label')}
62
+ </Action>
63
+ <Action
64
+ variant='primary'
65
+ classNames='!bg-error-500 hover:!bg-error-550'
66
+ disabled={disabled}
67
+ onClick={onJoinNewIdentity}
68
+ >
69
+ {t('join new identity label')}
70
+ </Action>
71
+ <Action
72
+ variant='primary'
73
+ classNames='!bg-error-500 hover:!bg-error-550'
74
+ disabled={disabled}
75
+ onClick={onResetDevice}
76
+ >
77
+ {t('reset device label')}
78
+ </Action>
79
+ </Actions>
80
+ </>
81
+ );
82
+ };
@@ -2,6 +2,8 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ export * from './AgentPanel';
5
6
  export * from './DeviceManager';
6
7
  export * from './IdentityActionChooser';
7
8
  export * from './ProfileForm';
9
+ export * from './SignOutChooser';
@@ -193,8 +193,6 @@ export const JoinPanel = ({
193
193
  },
194
194
  });
195
195
 
196
- console.log('[joinState]', joinState);
197
-
198
196
  useEffect(() => {
199
197
  const subscription = joinService.subscribe((state) => {
200
198
  log('[state]', state);
@@ -368,6 +366,7 @@ export const JoinPanel = ({
368
366
  identityKey: joinState.context.halo.invitation?.identityKey ?? null,
369
367
  swarmKey: joinState.context.halo.invitation?.swarmKey ?? null,
370
368
  spaceKey: joinState.context.halo.invitation?.spaceKey ?? null,
369
+ target: joinState.context.halo.invitation?.target ?? null,
371
370
  });
372
371
  }, [joinState, propsOnDone]);
373
372
 
@@ -376,6 +375,7 @@ export const JoinPanel = ({
376
375
  identityKey: joinState.context.space.invitation?.identityKey ?? null,
377
376
  swarmKey: joinState.context.space.invitation?.swarmKey ?? null,
378
377
  spaceKey: joinState.context.space.invitation?.spaceKey ?? null,
378
+ target: joinState.context.space.invitation?.target ?? null,
379
379
  });
380
380
  }, [joinState, propsOnDone]);
381
381
 
@@ -397,7 +397,7 @@ const joinMachine = createMachine<JoinMachineContext, JoinEvent>(
397
397
  event.type.includes('Space') ? { ...context.space, invitation: event.invitation } : context.space,
398
398
  }),
399
399
  log: (context, event) => {
400
- log.info('[transition]', {
400
+ log('[transition]', {
401
401
  event,
402
402
  haloInvitation: context.halo.invitation,
403
403
  spaceInvitation: context.space.invitation,
@@ -129,6 +129,7 @@ export const SpaceManagerWithEvenMoreInvites = () => {
129
129
  identityKey = PublicKey.random(),
130
130
  swarmKey,
131
131
  spaceKey = PublicKey.random(),
132
+ target = null,
132
133
  } = invitation;
133
134
  return (
134
135
  <InvitationListItemImpl
@@ -140,7 +141,7 @@ export const SpaceManagerWithEvenMoreInvites = () => {
140
141
  invitationCode: id,
141
142
  authCode: state === Invitation.State.READY_FOR_AUTHENTICATION ? '123414' : undefined,
142
143
  id,
143
- result: { identityKey, swarmKey, spaceKey },
144
+ result: { identityKey, swarmKey, spaceKey, target },
144
145
  cancel: () => {},
145
146
  authenticate: async (authCode: string) => {},
146
147
  connect: () => {},
@@ -39,17 +39,19 @@ export const SpacePanelImpl = (props: SpacePanelImplProps) => {
39
39
  titleId,
40
40
  activeView,
41
41
  space,
42
+ target,
42
43
  SpaceManager: SpaceManagerComponent = SpaceManager,
43
44
  InvitationManager: InvitationManagerComponent = InvitationManager,
44
45
  ...rest
45
46
  } = props;
47
+
46
48
  return (
47
49
  <DensityProvider density='fine'>
48
50
  <SpacePanelHeading {...rest} {...{ titleId, space }} />
49
51
  <Viewport.Root activeView={activeView}>
50
52
  <Viewport.Views>
51
53
  <Viewport.View id='space manager' classNames={stepStyles}>
52
- <SpaceManagerComponent active={activeView === 'space manager'} space={space} {...rest} />
54
+ <SpaceManagerComponent active={activeView === 'space manager'} space={space} target={target} {...rest} />
53
55
  </Viewport.View>
54
56
  <Viewport.View id='space invitation manager' classNames={stepStyles}>
55
57
  <InvitationManagerComponent
@@ -115,6 +117,7 @@ export const SpacePanel = ({
115
117
  };
116
118
 
117
119
  return spaceState.context.invitation ? (
120
+ // TODO(wittjosiah): Unused? Remove?
118
121
  <SpacePanelWithInvitationImpl {...implProps} invitation={spaceState.context.invitation} />
119
122
  ) : (
120
123
  <SpacePanelImpl {...implProps} />
@@ -16,6 +16,7 @@ export type SpacePanelImplProps = {
16
16
  titleId: string;
17
17
  activeView: string;
18
18
  send: (event: SingleOrArray<Event<any>>) => void;
19
+ target?: string;
19
20
  createInvitationUrl: (invitationCode: string) => string;
20
21
  space: ErsatzSpace | Space;
21
22
  invitationUrl?: string;
@@ -23,6 +23,7 @@ import {
23
23
  import { type SpacePanelStepProps } from '../SpacePanelProps';
24
24
 
25
25
  export type SpaceManagerImplProps = SpacePanelStepProps & {
26
+ target?: string;
26
27
  invitations?: CancellableInvitationObservable[];
27
28
  showInactiveInvitations?: boolean;
28
29
  inviteActions?: Record<string, ActionMenuItem>;
@@ -35,7 +36,7 @@ const activeActionKey = 'dxos:react-shell/space-manager/active-action';
35
36
  export type SpaceManagerProps = SpaceManagerImplProps & {};
36
37
 
37
38
  export const SpaceManager = (props: SpaceManagerProps) => {
38
- const { space } = props;
39
+ const { space, target } = props;
39
40
  const { t } = useTranslation('os');
40
41
  const config = useConfig();
41
42
 
@@ -57,6 +58,7 @@ export const SpaceManager = (props: SpaceManagerProps) => {
57
58
  const invitation = space.share?.({
58
59
  type: Invitation.Type.INTERACTIVE,
59
60
  authMethod: Invitation.AuthMethod.SHARED_SECRET,
61
+ target,
60
62
  });
61
63
  if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== 'production') {
62
64
  invitation.subscribe(onInvitationEvent);
@@ -71,6 +73,7 @@ export const SpaceManager = (props: SpaceManagerProps) => {
71
73
  const invitation = space.share?.({
72
74
  type: Invitation.Type.MULTIUSE,
73
75
  authMethod: Invitation.AuthMethod.NONE,
76
+ target,
74
77
  });
75
78
  if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== 'production') {
76
79
  invitation.subscribe(onInvitationEvent);
@@ -99,4 +99,9 @@ export const os = {
99
99
  'This will clear this device and all associated data. Type {{confirmationValue}} and confirm to continue.',
100
100
  'failed to reset identity message': 'Failed to reset identity.',
101
101
  'confirmation value': 'CONFIRM',
102
+ 'sign out chooser title': 'DANGER ZONE',
103
+ 'sign out chooser message': 'Proceeding with either action below will erase all data on this device.',
104
+ 'join new identity label': 'Join a new identity',
105
+ 'reset device label': 'Reset device',
106
+ 'reset device confirm message': 'Are you sure you want to reset your device? All data will be lost.',
102
107
  };