@dxos/shell 0.3.11-main.4feb9c9 → 0.3.11-main.5960564
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/shell.mjs +4715 -4670
- package/dist/bundle/shell.mjs.map +1 -1
- package/dist/bundle/shell.umd.js +51 -51
- 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 +513 -443
- package/dist/lib/browser/react.mjs.map +4 -4
- package/dist/types/src/components/Panel/Action.js +1 -1
- package/dist/types/src/components/Panel/Action.js.map +1 -1
- package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -1
- package/dist/types/src/composites/Shell/Shell.js +5 -1
- package/dist/types/src/composites/Shell/Shell.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +5 -5
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts +3 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts +1 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.js +2 -2
- package/dist/types/src/panels/IdentityPanel/identityMachine.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.d.ts +16 -0
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.js +40 -0
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/index.d.ts +2 -1
- package/dist/types/src/panels/IdentityPanel/steps/index.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/index.js +2 -1
- package/dist/types/src/panels/IdentityPanel/steps/index.js.map +1 -1
- package/dist/types/src/translations/locales/en-US.d.ts +5 -0
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
- package/dist/types/src/translations/locales/en-US.js +5 -0
- package/dist/types/src/translations/locales/en-US.js.map +1 -1
- package/package.json +18 -18
- package/src/components/Panel/Action.tsx +1 -1
- package/src/composites/Shell/Shell.tsx +7 -1
- package/src/panels/IdentityPanel/IdentityPanel.tsx +14 -7
- package/src/panels/IdentityPanel/IdentityPanelProps.ts +4 -1
- package/src/panels/IdentityPanel/identityMachine.ts +3 -3
- package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +1 -6
- package/src/panels/IdentityPanel/steps/SignOutChooser.tsx +82 -0
- package/src/panels/IdentityPanel/steps/index.ts +2 -1
- package/src/translations/locales/en-US.ts +5 -0
|
@@ -19,7 +19,7 @@ type IdentityMachineContext = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
type IdentityChooseActionEvent = {
|
|
22
|
-
type: 'chooseDevices' | 'chooseAgent' | 'chooseProfile' |
|
|
22
|
+
type: 'chooseDevices' | 'chooseAgent' | 'chooseProfile' | 'chooseSignOut' | 'sigingOut' | 'unchooseAction';
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
type IdentitySelectDeviceInvitationEvent = {
|
|
@@ -77,7 +77,7 @@ const identityMachine = createMachine<IdentityMachineContext, IdentityEvent>(
|
|
|
77
77
|
updateProfile: { target: '.pending', actions: 'log' },
|
|
78
78
|
},
|
|
79
79
|
},
|
|
80
|
-
|
|
80
|
+
signingOut: {},
|
|
81
81
|
},
|
|
82
82
|
on: {
|
|
83
83
|
unchooseAction: { target: '.choosingAction', actions: ['unsetInvitation', 'log'] },
|
|
@@ -85,8 +85,8 @@ const identityMachine = createMachine<IdentityMachineContext, IdentityEvent>(
|
|
|
85
85
|
selectInvitation: { target: '.managingDeviceInvitation', actions: ['setInvitation', 'log'] },
|
|
86
86
|
chooseDevices: { target: '.managingDevices', actions: 'log' },
|
|
87
87
|
chooseProfile: { target: '.managingProfile', actions: 'log' },
|
|
88
|
+
chooseSignOut: { target: '.signingOut', actions: 'log' },
|
|
88
89
|
chooseAgent: { target: '.managingAgent', actions: 'log' },
|
|
89
|
-
// chooseSignOut: { target: '.signingOut', actions: 'log' },
|
|
90
90
|
},
|
|
91
91
|
},
|
|
92
92
|
{
|
|
@@ -88,12 +88,7 @@ export const IdentityActionChooserImpl = ({
|
|
|
88
88
|
<span className='grow mli-3'>{t('choose profile label')}</span>
|
|
89
89
|
<CaretRight weight='bold' className={getSize(4)} />
|
|
90
90
|
</Action>
|
|
91
|
-
<Action
|
|
92
|
-
disabled
|
|
93
|
-
data-testid='sign-out'
|
|
94
|
-
onClick={() => {} /* send({ type: 'chooseSignOut' }) */}
|
|
95
|
-
classNames='plb-4'
|
|
96
|
-
>
|
|
91
|
+
<Action data-testid='sign-out' onClick={() => send?.({ type: 'chooseSignOut' })} classNames='plb-4'>
|
|
97
92
|
<Power className={getSize(6)} />
|
|
98
93
|
<span className='grow mli-3'>{t('choose sign out label')}</span>
|
|
99
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
|
+
};
|
|
@@ -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
|
};
|