@dxos/shell 0.4.10-main.fa5a270 → 0.4.10-main.fe71b4c
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/bundle/index-BjPIerZ_.mjs +110 -0
- package/dist/bundle/index-BjPIerZ_.mjs.map +1 -0
- package/dist/bundle/index-BnojJ-lm.mjs +96615 -0
- package/dist/bundle/index-BnojJ-lm.mjs.map +1 -0
- package/dist/bundle/shell.mjs +9 -80814
- package/dist/bundle/shell.mjs.map +1 -1
- package/dist/bundle/shell.umd.js +156 -85
- package/dist/bundle/shell.umd.js.map +1 -1
- package/dist/bundle/style.css +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react.mjs +1177 -1034
- package/dist/lib/browser/react.mjs.map +4 -4
- package/dist/lib/browser/testing/index.mjs +8 -8
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/types/src/components/AgentConfig.d.ts +3 -0
- package/dist/types/src/components/AgentConfig.d.ts.map +1 -0
- package/dist/types/src/components/AgentConfig.js +37 -0
- package/dist/types/src/components/AgentConfig.js.map +1 -0
- package/dist/types/src/components/DeviceList/DeviceList.d.ts +3 -0
- package/dist/types/src/components/DeviceList/DeviceList.d.ts.map +1 -0
- package/dist/types/src/components/DeviceList/DeviceList.js +29 -0
- package/dist/types/src/components/DeviceList/DeviceList.js.map +1 -0
- package/dist/types/src/components/DeviceList/DeviceListItem.d.ts +6 -0
- package/dist/types/src/components/DeviceList/DeviceListItem.d.ts.map +1 -0
- package/dist/types/src/components/DeviceList/DeviceListItem.js +72 -0
- package/dist/types/src/components/DeviceList/DeviceListItem.js.map +1 -0
- package/dist/types/src/components/DeviceList/DeviceListProps.d.ts +27 -0
- package/dist/types/src/components/DeviceList/DeviceListProps.d.ts.map +1 -0
- package/dist/types/src/components/DeviceList/DeviceListProps.js +6 -0
- package/dist/types/src/components/DeviceList/DeviceListProps.js.map +1 -0
- package/dist/types/src/components/DeviceList/index.d.ts +3 -0
- package/dist/types/src/components/DeviceList/index.d.ts.map +1 -0
- package/dist/types/src/components/DeviceList/index.js +22 -0
- package/dist/types/src/components/DeviceList/index.js.map +1 -0
- package/dist/types/src/components/EmojiPicker.d.ts +9 -2
- package/dist/types/src/components/EmojiPicker.d.ts.map +1 -1
- package/dist/types/src/components/EmojiPicker.js +59 -4
- package/dist/types/src/components/EmojiPicker.js.map +1 -1
- package/dist/types/src/components/HuePicker.d.ts +9 -2
- package/dist/types/src/components/HuePicker.d.ts.map +1 -1
- package/dist/types/src/components/HuePicker.js +75 -6
- package/dist/types/src/components/HuePicker.js.map +1 -1
- package/dist/types/src/components/IdentityList/index.d.ts +0 -1
- package/dist/types/src/components/IdentityList/index.d.ts.map +1 -1
- package/dist/types/src/components/IdentityList/index.js +0 -1
- package/dist/types/src/components/IdentityList/index.js.map +1 -1
- package/dist/types/src/components/InvitationList/InvitationListItem.js +5 -5
- package/dist/types/src/components/InvitationList/InvitationListItem.js.map +1 -1
- package/dist/types/src/components/Panel/Action.d.ts +2 -2
- package/dist/types/src/components/Viewport/Viewport.d.ts +1 -1
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/index.js +2 -0
- package/dist/types/src/components/index.js.map +1 -1
- package/dist/types/src/composites/IdentityDialog/IdentityDialog.js +1 -1
- package/dist/types/src/composites/IdentityDialog/IdentityDialog.js.map +1 -1
- package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -1
- package/dist/types/src/composites/Shell/Shell.js +14 -6
- package/dist/types/src/composites/Shell/Shell.js.map +1 -1
- package/dist/types/src/composites/StatusDialog/StatusDialog.d.ts +2 -0
- package/dist/types/src/composites/StatusDialog/StatusDialog.d.ts.map +1 -0
- package/dist/types/src/composites/StatusDialog/StatusDialog.js +22 -0
- package/dist/types/src/composites/StatusDialog/StatusDialog.js.map +1 -0
- package/dist/types/src/composites/StatusDialog/index.d.ts +2 -0
- package/dist/types/src/composites/StatusDialog/index.d.ts.map +1 -0
- package/dist/types/src/composites/StatusDialog/index.js +21 -0
- package/dist/types/src/composites/StatusDialog/index.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +89 -42
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts +0 -3
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js +1 -43
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts +11 -12
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts +3 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.js +13 -24
- package/dist/types/src/panels/IdentityPanel/identityMachine.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts +4 -4
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +9 -39
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js +6 -3
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/index.d.ts +0 -3
- package/dist/types/src/panels/IdentityPanel/steps/index.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/index.js +0 -3
- package/dist/types/src/panels/IdentityPanel/steps/index.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/useAgentHandlers.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/useAgentHandlers.js +5 -1
- package/dist/types/src/panels/IdentityPanel/useAgentHandlers.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.js +12 -5
- package/dist/types/src/panels/JoinPanel/JoinPanel.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.js +2 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts +8 -3
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +3 -2
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.js +7 -0
- package/dist/types/src/panels/JoinPanel/joinMachine.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/steps/index.d.ts +0 -1
- package/dist/types/src/panels/JoinPanel/steps/index.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/steps/index.js +0 -1
- package/dist/types/src/panels/JoinPanel/steps/index.js.map +1 -1
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts.map +1 -1
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js +3 -1
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js.map +1 -1
- package/dist/types/src/panels/StatusPanel/StatusPanel.d.ts +4 -0
- package/dist/types/src/panels/StatusPanel/StatusPanel.d.ts.map +1 -0
- package/dist/types/src/panels/StatusPanel/StatusPanel.js +19 -0
- package/dist/types/src/panels/StatusPanel/StatusPanel.js.map +1 -0
- package/dist/types/src/panels/StatusPanel/index.d.ts +2 -0
- package/dist/types/src/panels/StatusPanel/index.d.ts.map +1 -0
- package/dist/types/src/panels/StatusPanel/index.js +21 -0
- package/dist/types/src/panels/StatusPanel/index.js.map +1 -0
- package/dist/types/src/panels/index.d.ts +1 -0
- package/dist/types/src/panels/index.d.ts.map +1 -1
- package/dist/types/src/panels/index.js +1 -0
- package/dist/types/src/panels/index.js.map +1 -1
- package/dist/types/src/steps/ConfirmReset.d.ts +16 -0
- package/dist/types/src/steps/ConfirmReset.d.ts.map +1 -0
- package/dist/types/src/steps/ConfirmReset.js +71 -0
- package/dist/types/src/steps/ConfirmReset.js.map +1 -0
- package/dist/types/src/steps/InvitationManager.d.ts +1 -1
- package/dist/types/src/steps/InvitationManager.d.ts.map +1 -1
- package/dist/types/src/steps/InvitationManager.js +3 -4
- package/dist/types/src/steps/InvitationManager.js.map +1 -1
- package/dist/types/src/steps/StepProps.d.ts +4 -1
- package/dist/types/src/steps/StepProps.d.ts.map +1 -1
- package/dist/types/src/steps/index.d.ts +1 -0
- package/dist/types/src/steps/index.d.ts.map +1 -1
- package/dist/types/src/steps/index.js +1 -0
- package/dist/types/src/steps/index.js.map +1 -1
- package/dist/types/src/stories/Invitations.e2e-stories.d.ts.map +1 -1
- package/dist/types/src/stories/Invitations.e2e-stories.js +2 -2
- package/dist/types/src/stories/Invitations.e2e-stories.js.map +1 -1
- package/dist/types/src/testing/shell-manager.d.ts.map +1 -1
- package/dist/types/src/testing/shell-manager.js +8 -8
- package/dist/types/src/testing/shell-manager.js.map +1 -1
- package/dist/types/src/translations/locales/en-US.d.ts +16 -3
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
- package/dist/types/src/translations/locales/en-US.js +20 -7
- package/dist/types/src/translations/locales/en-US.js.map +1 -1
- package/dist/types/src/types/index.js +1 -0
- package/dist/types/src/types/index.js.map +1 -1
- package/package.json +22 -21
- package/src/components/AgentConfig.tsx +66 -0
- package/src/components/DeviceList/DeviceList.tsx +54 -0
- package/src/components/DeviceList/DeviceListItem.tsx +120 -0
- package/src/components/DeviceList/DeviceListProps.ts +33 -0
- package/src/components/DeviceList/index.ts +6 -0
- package/src/components/EmojiPicker.tsx +103 -4
- package/src/components/HuePicker.tsx +99 -5
- package/src/components/IdentityList/index.ts +0 -1
- package/src/components/InvitationList/InvitationListItem.tsx +5 -5
- package/src/components/index.ts +2 -0
- package/src/composites/IdentityDialog/IdentityDialog.tsx +1 -1
- package/src/composites/Shell/Shell.tsx +17 -4
- package/src/composites/StatusDialog/StatusDialog.tsx +24 -0
- package/src/composites/StatusDialog/index.ts +5 -0
- package/src/panels/IdentityPanel/IdentityPanel.stories.tsx +0 -63
- package/src/panels/IdentityPanel/IdentityPanel.tsx +149 -43
- package/src/panels/IdentityPanel/IdentityPanelProps.ts +15 -15
- package/src/panels/IdentityPanel/identityMachine.ts +17 -25
- package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +23 -67
- package/src/panels/IdentityPanel/steps/ProfileForm.tsx +18 -5
- package/src/panels/IdentityPanel/steps/index.ts +0 -3
- package/src/panels/IdentityPanel/useAgentHandlers.ts +5 -1
- package/src/panels/JoinPanel/JoinPanel.stories.tsx +3 -2
- package/src/panels/JoinPanel/JoinPanel.tsx +21 -5
- package/src/panels/JoinPanel/JoinPanelProps.ts +9 -3
- package/src/panels/JoinPanel/joinMachine.ts +12 -2
- package/src/panels/JoinPanel/steps/index.ts +0 -1
- package/src/panels/SpacePanel/steps/SpaceManager.tsx +3 -1
- package/src/panels/StatusPanel/StatusPanel.tsx +19 -0
- package/src/panels/StatusPanel/index.ts +5 -0
- package/src/panels/index.ts +1 -0
- package/src/steps/ConfirmReset.tsx +112 -0
- package/src/steps/InvitationManager.tsx +4 -4
- package/src/steps/StepProps.ts +2 -1
- package/src/steps/index.ts +1 -0
- package/src/stories/Invitations.e2e-stories.tsx +3 -3
- package/src/testing/shell-manager.ts +8 -8
- package/src/translations/locales/en-US.ts +22 -7
- package/src/types/index.ts +2 -0
- package/dist/types/src/components/IdentityList/DeviceList.d.ts +0 -7
- package/dist/types/src/components/IdentityList/DeviceList.d.ts.map +0 -1
- package/dist/types/src/components/IdentityList/DeviceList.js +0 -34
- package/dist/types/src/components/IdentityList/DeviceList.js.map +0 -1
- package/dist/types/src/panels/IdentityPanel/steps/AgentForm.d.ts +0 -3
- package/dist/types/src/panels/IdentityPanel/steps/AgentForm.d.ts.map +0 -1
- package/dist/types/src/panels/IdentityPanel/steps/AgentForm.js +0 -26
- package/dist/types/src/panels/IdentityPanel/steps/AgentForm.js.map +0 -1
- package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.d.ts +0 -10
- package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.d.ts.map +0 -1
- package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.js +0 -23
- package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.js.map +0 -1
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.d.ts +0 -16
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.d.ts.map +0 -1
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.js +0 -40
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.js.map +0 -1
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.d.ts +0 -13
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.js +0 -66
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.js.map +0 -1
- package/src/components/IdentityList/DeviceList.tsx +0 -49
- package/src/panels/IdentityPanel/steps/AgentForm.tsx +0 -61
- package/src/panels/IdentityPanel/steps/DeviceManager.tsx +0 -41
- package/src/panels/IdentityPanel/steps/SignOutChooser.tsx +0 -84
- package/src/panels/JoinPanel/steps/ResetIdentity.tsx +0 -80
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { generateName } from '@dxos/display-name';
|
|
8
|
-
import { type Device, DeviceType } from '@dxos/react-client/halo';
|
|
9
|
-
import { List, useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import { descriptionText, mx } from '@dxos/react-ui-theme';
|
|
11
|
-
|
|
12
|
-
import { IdentityListItem } from './IdentityListItem';
|
|
13
|
-
|
|
14
|
-
export interface DeviceListProps {
|
|
15
|
-
devices: Device[];
|
|
16
|
-
onSelect?: (device: Device) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const DeviceList = ({ devices, onSelect }: DeviceListProps) => {
|
|
20
|
-
const { t } = useTranslation('os');
|
|
21
|
-
return devices.length > 0 ? (
|
|
22
|
-
<List classNames='flex flex-col gap-2'>
|
|
23
|
-
{devices.map((device) => {
|
|
24
|
-
// TODO(wittjosiah): Render this better. Consider communicating these as apps rather than devices.
|
|
25
|
-
const deviceType = device.profile?.type || DeviceType.UNKNOWN;
|
|
26
|
-
const displayName = device.profile?.label
|
|
27
|
-
? `${device.profile.label} (${DeviceType[deviceType]})`
|
|
28
|
-
: generateName(device.deviceKey.toHex());
|
|
29
|
-
|
|
30
|
-
const identity = {
|
|
31
|
-
identityKey: device.deviceKey,
|
|
32
|
-
profile: { displayName },
|
|
33
|
-
};
|
|
34
|
-
return (
|
|
35
|
-
<IdentityListItem
|
|
36
|
-
key={device.deviceKey.toHex()}
|
|
37
|
-
identity={identity}
|
|
38
|
-
presence={device.presence}
|
|
39
|
-
onClick={onSelect && (() => onSelect(device))}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
})}
|
|
43
|
-
</List>
|
|
44
|
-
) : (
|
|
45
|
-
<div role='none' className='grow flex items-center p-2'>
|
|
46
|
-
<p className={mx(descriptionText, 'text-center is-full')}>{t('empty device list message')}</p>
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
8
|
-
|
|
9
|
-
import { Action, Actions, StepHeading, Input } from '../../../components';
|
|
10
|
-
import { type AgentFormProps, type IdentityPanelStepProps } from '../IdentityPanelProps';
|
|
11
|
-
|
|
12
|
-
export const AgentForm = (props: IdentityPanelStepProps & AgentFormProps) => {
|
|
13
|
-
const {
|
|
14
|
-
active,
|
|
15
|
-
onAgentCreate,
|
|
16
|
-
onAgentDestroy,
|
|
17
|
-
send,
|
|
18
|
-
validationMessage,
|
|
19
|
-
agentStatus,
|
|
20
|
-
agentActive,
|
|
21
|
-
agentProviderDisabled,
|
|
22
|
-
} = props;
|
|
23
|
-
const disabled = !active;
|
|
24
|
-
const { t } = useTranslation('os');
|
|
25
|
-
return (
|
|
26
|
-
<>
|
|
27
|
-
<div role='none' className='grow flex flex-col justify-center'>
|
|
28
|
-
<Input
|
|
29
|
-
{...{ validationMessage }}
|
|
30
|
-
label={<StepHeading>Agent Status</StepHeading>}
|
|
31
|
-
disabled={disabled}
|
|
32
|
-
data-testid='agent-status'
|
|
33
|
-
value={agentStatus}
|
|
34
|
-
/>
|
|
35
|
-
</div>
|
|
36
|
-
<Actions>
|
|
37
|
-
<Action
|
|
38
|
-
disabled={agentActive || agentProviderDisabled}
|
|
39
|
-
onClick={() => onAgentCreate?.()}
|
|
40
|
-
data-testid={'create-agent'}
|
|
41
|
-
>
|
|
42
|
-
Create Agent
|
|
43
|
-
</Action>
|
|
44
|
-
<Action
|
|
45
|
-
disabled={!agentActive || agentProviderDisabled}
|
|
46
|
-
onClick={() => onAgentDestroy?.()}
|
|
47
|
-
data-testid={'destroy-agent'}
|
|
48
|
-
>
|
|
49
|
-
Destroy Agent
|
|
50
|
-
</Action>
|
|
51
|
-
<Action
|
|
52
|
-
disabled={disabled}
|
|
53
|
-
onClick={() => send?.({ type: 'unchooseAction' })}
|
|
54
|
-
data-testid={'update-profile-form-back'}
|
|
55
|
-
>
|
|
56
|
-
{t('back label')}
|
|
57
|
-
</Action>
|
|
58
|
-
</Actions>
|
|
59
|
-
</>
|
|
60
|
-
);
|
|
61
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { type Event, type SingleOrArray } from 'xstate';
|
|
7
|
-
|
|
8
|
-
import { type Device } from '@dxos/react-client/halo';
|
|
9
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
10
|
-
|
|
11
|
-
import { Action, Actions, DeviceList } from '../../../components';
|
|
12
|
-
import type { IdentityPanelStepProps } from '../IdentityPanelProps';
|
|
13
|
-
import type { IdentityEvent } from '../identityMachine';
|
|
14
|
-
|
|
15
|
-
export interface DeviceManagerProps extends Omit<IdentityPanelStepProps, 'send'> {
|
|
16
|
-
send?: (event: SingleOrArray<Event<IdentityEvent>>) => void;
|
|
17
|
-
devices: Device[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const DeviceManager = ({ devices, active, send }: DeviceManagerProps) => {
|
|
21
|
-
const { t } = useTranslation('os');
|
|
22
|
-
const disabled = !active;
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<>
|
|
26
|
-
<div role='none' className='grow'>
|
|
27
|
-
<DeviceList devices={devices} />
|
|
28
|
-
</div>
|
|
29
|
-
<Actions>
|
|
30
|
-
<Action
|
|
31
|
-
variant='ghost'
|
|
32
|
-
disabled={disabled}
|
|
33
|
-
onClick={() => send?.({ type: 'unchooseAction' })}
|
|
34
|
-
data-testid={'manage-devices-back'}
|
|
35
|
-
>
|
|
36
|
-
{t('back label')}
|
|
37
|
-
</Action>
|
|
38
|
-
</Actions>
|
|
39
|
-
</>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
@@ -1,84 +0,0 @@
|
|
|
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
|
-
data-testid='sign-out.join-new-identity'
|
|
66
|
-
classNames='!bg-error-500 hover:!bg-error-550'
|
|
67
|
-
disabled={disabled}
|
|
68
|
-
onClick={onJoinNewIdentity}
|
|
69
|
-
>
|
|
70
|
-
{t('join new identity label')}
|
|
71
|
-
</Action>
|
|
72
|
-
<Action
|
|
73
|
-
variant='primary'
|
|
74
|
-
data-testid='sign-out.reset-device'
|
|
75
|
-
classNames='!bg-error-500 hover:!bg-error-550'
|
|
76
|
-
disabled={disabled}
|
|
77
|
-
onClick={onResetDevice}
|
|
78
|
-
>
|
|
79
|
-
{t('reset device label')}
|
|
80
|
-
</Action>
|
|
81
|
-
</Actions>
|
|
82
|
-
</>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { log } from '@dxos/log';
|
|
8
|
-
import { useClient } from '@dxos/react-client';
|
|
9
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
10
|
-
|
|
11
|
-
import { Action, Actions, StepHeading, Input } from '../../../components';
|
|
12
|
-
import { type JoinStepProps } from '../JoinPanelProps';
|
|
13
|
-
|
|
14
|
-
export type ResetIdentityProps = JoinStepProps & {
|
|
15
|
-
method: 'reset identity';
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type ResetIdentityImplProps = {
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
pending?: boolean;
|
|
21
|
-
validationMessage?: string;
|
|
22
|
-
onConfirm?: () => void;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const ResetIdentity = ({ send, active }: ResetIdentityProps) => {
|
|
26
|
-
const client = useClient();
|
|
27
|
-
const { t } = useTranslation('os');
|
|
28
|
-
const [validationMessage, setValidationMessage] = useState('');
|
|
29
|
-
const [pending, setPending] = useState(false);
|
|
30
|
-
const resetIdentity = () => {
|
|
31
|
-
setPending(true);
|
|
32
|
-
void client.reset().then(
|
|
33
|
-
() => send?.({ type: 'resetIdentity' }),
|
|
34
|
-
(error) => {
|
|
35
|
-
log.catch(error);
|
|
36
|
-
setValidationMessage(t('failed to reset identity message'));
|
|
37
|
-
setPending(false);
|
|
38
|
-
},
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
return (
|
|
42
|
-
<ResetIdentityImpl
|
|
43
|
-
disabled={!active}
|
|
44
|
-
pending={pending}
|
|
45
|
-
validationMessage={validationMessage}
|
|
46
|
-
onConfirm={() => resetIdentity()}
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const ResetIdentityImpl = ({ disabled, pending, validationMessage, onConfirm }: ResetIdentityImplProps) => {
|
|
52
|
-
const { t } = useTranslation('os');
|
|
53
|
-
const confirmationValue = t('confirmation value');
|
|
54
|
-
const [inputValue, setInputValue] = useState('');
|
|
55
|
-
return (
|
|
56
|
-
<>
|
|
57
|
-
<div role='none' className='grow flex flex-col justify-center'>
|
|
58
|
-
<Input
|
|
59
|
-
{...{ validationMessage }}
|
|
60
|
-
label={<StepHeading>{t('reset identity input label', { confirmationValue })}</StepHeading>}
|
|
61
|
-
disabled={disabled}
|
|
62
|
-
data-testid='reset-identity-input'
|
|
63
|
-
placeholder={confirmationValue}
|
|
64
|
-
onChange={({ target: { value } }) => setInputValue(value)}
|
|
65
|
-
/>
|
|
66
|
-
</div>
|
|
67
|
-
<Actions>
|
|
68
|
-
<Action
|
|
69
|
-
// TODO(wittjosiah): Probably make this red?
|
|
70
|
-
variant='primary'
|
|
71
|
-
disabled={disabled || pending || inputValue !== confirmationValue}
|
|
72
|
-
onClick={() => onConfirm?.()}
|
|
73
|
-
data-testid='reset-identity-input-confirm'
|
|
74
|
-
>
|
|
75
|
-
{pending ? t('reset in progress label') : t('confirm label')}
|
|
76
|
-
</Action>
|
|
77
|
-
</Actions>
|
|
78
|
-
</>
|
|
79
|
-
);
|
|
80
|
-
};
|