@dxos/shell 0.4.10-main.d560ca0 → 0.4.10-main.f68a1ca

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 (114) hide show
  1. package/dist/bundle/shell.mjs +8261 -8194
  2. package/dist/bundle/shell.mjs.map +1 -1
  3. package/dist/bundle/shell.umd.js +53 -53
  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 +417 -328
  8. package/dist/lib/browser/react.mjs.map +4 -4
  9. package/dist/types/src/composites/IdentityDialog/IdentityDialog.js +1 -1
  10. package/dist/types/src/composites/IdentityDialog/IdentityDialog.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 +18 -6
  13. package/dist/types/src/composites/Shell/Shell.js.map +1 -1
  14. package/dist/types/src/composites/StatusDialog/StatusDialog.d.ts +2 -0
  15. package/dist/types/src/composites/StatusDialog/StatusDialog.d.ts.map +1 -0
  16. package/dist/types/src/composites/StatusDialog/StatusDialog.js +22 -0
  17. package/dist/types/src/composites/StatusDialog/StatusDialog.js.map +1 -0
  18. package/dist/types/src/composites/StatusDialog/index.d.ts +2 -0
  19. package/dist/types/src/composites/StatusDialog/index.d.ts.map +1 -0
  20. package/dist/types/src/composites/StatusDialog/index.js +21 -0
  21. package/dist/types/src/composites/StatusDialog/index.js.map +1 -0
  22. package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts +1 -1
  23. package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -1
  24. package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +15 -8
  25. package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -1
  26. package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts +5 -3
  27. package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts.map +1 -1
  28. package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts +3 -1
  29. package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts.map +1 -1
  30. package/dist/types/src/panels/IdentityPanel/identityMachine.js +15 -2
  31. package/dist/types/src/panels/IdentityPanel/identityMachine.js.map +1 -1
  32. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts.map +1 -1
  33. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +9 -5
  34. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -1
  35. package/dist/types/src/panels/IdentityPanel/steps/index.d.ts +0 -1
  36. package/dist/types/src/panels/IdentityPanel/steps/index.d.ts.map +1 -1
  37. package/dist/types/src/panels/IdentityPanel/steps/index.js +0 -1
  38. package/dist/types/src/panels/IdentityPanel/steps/index.js.map +1 -1
  39. package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts +1 -1
  40. package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +1 -1
  41. package/dist/types/src/panels/JoinPanel/JoinPanel.js +12 -5
  42. package/dist/types/src/panels/JoinPanel/JoinPanel.js.map +1 -1
  43. package/dist/types/src/panels/JoinPanel/JoinPanel.stories.d.ts +1 -1
  44. package/dist/types/src/panels/JoinPanel/JoinPanel.stories.d.ts.map +1 -1
  45. package/dist/types/src/panels/JoinPanel/JoinPanel.stories.js +2 -1
  46. package/dist/types/src/panels/JoinPanel/JoinPanel.stories.js.map +1 -1
  47. package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts +8 -3
  48. package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +1 -1
  49. package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +3 -2
  50. package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -1
  51. package/dist/types/src/panels/JoinPanel/joinMachine.js +7 -0
  52. package/dist/types/src/panels/JoinPanel/joinMachine.js.map +1 -1
  53. package/dist/types/src/panels/JoinPanel/steps/index.d.ts +0 -1
  54. package/dist/types/src/panels/JoinPanel/steps/index.d.ts.map +1 -1
  55. package/dist/types/src/panels/JoinPanel/steps/index.js +0 -1
  56. package/dist/types/src/panels/JoinPanel/steps/index.js.map +1 -1
  57. package/dist/types/src/panels/StatusPanel/StatusPanel.d.ts +4 -0
  58. package/dist/types/src/panels/StatusPanel/StatusPanel.d.ts.map +1 -0
  59. package/dist/types/src/panels/StatusPanel/StatusPanel.js +19 -0
  60. package/dist/types/src/panels/StatusPanel/StatusPanel.js.map +1 -0
  61. package/dist/types/src/panels/StatusPanel/index.d.ts +2 -0
  62. package/dist/types/src/panels/StatusPanel/index.d.ts.map +1 -0
  63. package/dist/types/src/panels/StatusPanel/index.js +21 -0
  64. package/dist/types/src/panels/StatusPanel/index.js.map +1 -0
  65. package/dist/types/src/panels/index.d.ts +1 -0
  66. package/dist/types/src/panels/index.d.ts.map +1 -1
  67. package/dist/types/src/panels/index.js +1 -0
  68. package/dist/types/src/panels/index.js.map +1 -1
  69. package/dist/types/src/steps/ConfirmReset.d.ts +16 -0
  70. package/dist/types/src/steps/ConfirmReset.d.ts.map +1 -0
  71. package/dist/types/src/steps/ConfirmReset.js +70 -0
  72. package/dist/types/src/steps/ConfirmReset.js.map +1 -0
  73. package/dist/types/src/steps/StepProps.d.ts +4 -1
  74. package/dist/types/src/steps/StepProps.d.ts.map +1 -1
  75. package/dist/types/src/steps/index.d.ts +1 -0
  76. package/dist/types/src/steps/index.d.ts.map +1 -1
  77. package/dist/types/src/steps/index.js +1 -0
  78. package/dist/types/src/steps/index.js.map +1 -1
  79. package/dist/types/src/translations/locales/en-US.d.ts +4 -1
  80. package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
  81. package/dist/types/src/translations/locales/en-US.js +8 -5
  82. package/dist/types/src/translations/locales/en-US.js.map +1 -1
  83. package/package.json +19 -19
  84. package/src/composites/IdentityDialog/IdentityDialog.tsx +1 -1
  85. package/src/composites/Shell/Shell.tsx +23 -4
  86. package/src/composites/StatusDialog/StatusDialog.tsx +24 -0
  87. package/src/composites/StatusDialog/index.ts +5 -0
  88. package/src/panels/IdentityPanel/IdentityPanel.tsx +31 -14
  89. package/src/panels/IdentityPanel/IdentityPanelProps.ts +7 -3
  90. package/src/panels/IdentityPanel/identityMachine.ts +25 -3
  91. package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +16 -7
  92. package/src/panels/IdentityPanel/steps/index.ts +0 -1
  93. package/src/panels/JoinPanel/JoinPanel.stories.tsx +3 -2
  94. package/src/panels/JoinPanel/JoinPanel.tsx +21 -5
  95. package/src/panels/JoinPanel/JoinPanelProps.ts +9 -3
  96. package/src/panels/JoinPanel/joinMachine.ts +12 -2
  97. package/src/panels/JoinPanel/steps/index.ts +0 -1
  98. package/src/panels/StatusPanel/StatusPanel.tsx +19 -0
  99. package/src/panels/StatusPanel/index.ts +5 -0
  100. package/src/panels/index.ts +1 -0
  101. package/src/steps/ConfirmReset.tsx +111 -0
  102. package/src/steps/StepProps.ts +2 -1
  103. package/src/steps/index.ts +1 -0
  104. package/src/translations/locales/en-US.ts +9 -5
  105. package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.d.ts +0 -16
  106. package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.d.ts.map +0 -1
  107. package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.js +0 -40
  108. package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.js.map +0 -1
  109. package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.d.ts +0 -13
  110. package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.d.ts.map +0 -1
  111. package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.js +0 -66
  112. package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.js.map +0 -1
  113. package/src/panels/IdentityPanel/steps/SignOutChooser.tsx +0 -84
  114. package/src/panels/JoinPanel/steps/ResetIdentity.tsx +0 -80
@@ -19,7 +19,7 @@ import { type Client, AlreadyJoinedError } from '@dxos/react-client';
19
19
  import { type Identity } from '@dxos/react-client/halo';
20
20
  import { type AuthenticatingInvitationObservable, Invitation, InvitationEncoder } from '@dxos/react-client/invitations';
21
21
 
22
- import { type JoinPanelMode } from './JoinPanelProps';
22
+ import { type JoinPanelInitialDisposition, type JoinPanelMode } from './JoinPanelProps';
23
23
  import { type FailReason } from '../../types';
24
24
 
25
25
  type InvitationKindContext = Partial<{
@@ -33,6 +33,7 @@ type InvitationKindContext = Partial<{
33
33
 
34
34
  type JoinMachineContext = {
35
35
  mode: JoinPanelMode;
36
+ initialDisposition: JoinPanelInitialDisposition;
36
37
  identity: Identity | null;
37
38
  halo: InvitationKindContext;
38
39
  space: InvitationKindContext;
@@ -74,7 +75,8 @@ type EmptyInvitationEvent = {
74
75
  | 'authenticateHaloVerificationCode'
75
76
  | 'authenticateSpaceVerificationCode'
76
77
  | 'resetHaloInvitation'
77
- | 'resetSpaceInvitation';
78
+ | 'resetSpaceInvitation'
79
+ | 'deselectInvitation';
78
80
  };
79
81
 
80
82
  type InvitationEvent = FailInvitationEvent | SetInvitationCodeEvent | SetInvitationEvent | EmptyInvitationEvent;
@@ -294,6 +296,7 @@ const joinMachine = createMachine<JoinMachineContext, JoinEvent>(
294
296
  id: 'join',
295
297
  predictableActionArguments: true,
296
298
  context: {
299
+ initialDisposition: 'default',
297
300
  mode: 'default',
298
301
  identity: null,
299
302
  halo: {},
@@ -304,6 +307,11 @@ const joinMachine = createMachine<JoinMachineContext, JoinEvent>(
304
307
  unknown: {
305
308
  always: [
306
309
  { cond: 'existingIdentity', target: 'resettingIdentity', actions: 'log' },
310
+ {
311
+ cond: 'initiallyAcceptingHaloInvitation',
312
+ target: '#join.choosingIdentity.acceptingHaloInvitation',
313
+ actions: 'log',
314
+ },
307
315
  { cond: 'noSelectedIdentity', target: 'choosingIdentity', actions: 'log' },
308
316
  { target: 'acceptingSpaceInvitation', actions: 'log' },
309
317
  ],
@@ -352,6 +360,8 @@ const joinMachine = createMachine<JoinMachineContext, JoinEvent>(
352
360
  guards: {
353
361
  existingIdentity: ({ identity, mode }, _event) => mode === 'halo-only' && !!identity,
354
362
  noSelectedIdentity: ({ identity }, _event) => !identity,
363
+ initiallyAcceptingHaloInvitation: ({ identity, initialDisposition }, _event) =>
364
+ !identity && initialDisposition === 'accept-halo-invitation',
355
365
  hasHaloUnredeemedCode: ({ halo }, _event) => !!halo.unredeemedCode,
356
366
  noSpaceInvitation: ({ space }, _event) => !space.invitation && !space.unredeemedCode,
357
367
  },
@@ -9,4 +9,3 @@ export * from './InvitationAccepted';
9
9
  export * from './InvitationInput';
10
10
  export * from './InvitationRescuer';
11
11
  export * from './InvitationAuthenticator';
12
- export * from './ResetIdentity';
@@ -0,0 +1,19 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Status, useTranslation } from '@dxos/react-ui';
8
+
9
+ export const StatusPanel = ({ titleId }: { titleId?: string }) => {
10
+ const { t } = useTranslation('os');
11
+ return (
12
+ <div className='grid place-items-center p-2 gap-2'>
13
+ <p id={titleId} className='font-medium text-center'>
14
+ {t('resetting message')}
15
+ </p>
16
+ <Status indeterminate>{t('resetting message')}</Status>
17
+ </div>
18
+ );
19
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export * from './StatusPanel';
@@ -5,3 +5,4 @@
5
5
  export * from './IdentityPanel';
6
6
  export * from './JoinPanel';
7
7
  export * from './SpacePanel';
8
+ export * from './StatusPanel';
@@ -0,0 +1,111 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { Warning } from '@phosphor-icons/react';
6
+ import React, { useState } from 'react';
7
+
8
+ import { log } from '@dxos/log';
9
+ import { Message, useTranslation } from '@dxos/react-ui';
10
+ import { getSize, mx } from '@dxos/react-ui-theme';
11
+
12
+ import { type StepProps } from './StepProps';
13
+ import { Action, Actions, StepHeading, Input } from '../components';
14
+
15
+ type ConfirmResetOptions = Partial<{
16
+ onCancel: () => void;
17
+ onConfirm: () => Promise<void>;
18
+ mode: 'join new identity' | 'reset storage';
19
+ }>;
20
+
21
+ export type ConfirmResetProps = StepProps & ConfirmResetOptions;
22
+
23
+ export type ConfirmResetImplProps = ConfirmResetOptions & {
24
+ disabled?: boolean;
25
+ pending?: boolean;
26
+ validationMessage?: string;
27
+ };
28
+
29
+ export const ConfirmReset = ({ active, onCancel, onConfirm, mode }: ConfirmResetProps) => {
30
+ const { t } = useTranslation('os');
31
+ const [validationMessage, setValidationMessage] = useState('');
32
+ const [pending, setPending] = useState(false);
33
+ const processReset = async () => {
34
+ setPending(true);
35
+ return onConfirm?.().then(
36
+ () => setPending(false),
37
+ (error) => {
38
+ log.catch(error);
39
+ setValidationMessage(t('failed to reset identity message'));
40
+ setPending(false);
41
+ },
42
+ );
43
+ };
44
+ return (
45
+ <ConfirmResetImpl
46
+ disabled={!active}
47
+ pending={pending}
48
+ validationMessage={validationMessage}
49
+ onConfirm={processReset}
50
+ onCancel={onCancel}
51
+ mode={mode}
52
+ />
53
+ );
54
+ };
55
+
56
+ export const ConfirmResetImpl = ({
57
+ disabled,
58
+ pending,
59
+ validationMessage,
60
+ onConfirm,
61
+ onCancel,
62
+ mode,
63
+ }: ConfirmResetImplProps) => {
64
+ const { t } = useTranslation('os');
65
+ const confirmationValue = t('confirmation value');
66
+ const [inputValue, setInputValue] = useState('');
67
+ return (
68
+ <>
69
+ <div role='none' className='grow flex flex-col gap-2 justify-center'>
70
+ <Message.Root valence='error'>
71
+ <Message.Title>
72
+ <Warning className={mx(getSize(6), 'inline mie-2')} />
73
+ {t('sign out chooser title')}
74
+ </Message.Title>
75
+ <Message.Body>{t('sign out chooser message')}</Message.Body>
76
+ </Message.Root>
77
+ <Input
78
+ {...{ validationMessage }}
79
+ label={
80
+ <StepHeading className='text-start mlb-2'>
81
+ {t(mode === 'join new identity' ? 'join new identity input label' : 'reset storage input label', {
82
+ confirmationValue,
83
+ })}
84
+ </StepHeading>
85
+ }
86
+ disabled={disabled}
87
+ data-testid='reset-identity-input'
88
+ placeholder={confirmationValue}
89
+ onChange={({ target: { value } }) => setInputValue(value)}
90
+ />
91
+ </div>
92
+ <Actions>
93
+ {onCancel && (
94
+ <Action disabled={disabled} onClick={onCancel} data-testid='reset-identity-input-cancel'>
95
+ {t('cancel label')}
96
+ </Action>
97
+ )}
98
+ {onConfirm && (
99
+ <Action
100
+ variant='destructive'
101
+ disabled={disabled || pending || inputValue !== confirmationValue}
102
+ onClick={onConfirm}
103
+ data-testid='reset-identity-input-confirm'
104
+ >
105
+ {pending ? t('reset in progress label') : t('reset device label')}
106
+ </Action>
107
+ )}
108
+ </Actions>
109
+ </>
110
+ );
111
+ };
@@ -6,8 +6,9 @@ import { type cloneElement } from 'react';
6
6
  import { type Event, type SingleOrArray } from 'xstate';
7
7
 
8
8
  type StepDeselectInvitationEvent = { type: 'deselectInvitation' };
9
+ type StepResetIdentityEvent = { type: 'resetIdentity' };
9
10
 
10
- export type StepEvent = StepDeselectInvitationEvent;
11
+ export type StepEvent = StepDeselectInvitationEvent | StepResetIdentityEvent;
11
12
 
12
13
  export type StepProps = {
13
14
  active?: boolean;
@@ -4,3 +4,4 @@
4
4
 
5
5
  export * from './InvitationManager';
6
6
  export * from './StepProps';
7
+ export * from './ConfirmReset';
@@ -73,7 +73,8 @@ export const os = {
73
73
  'choose add device label': 'Add device',
74
74
  'choose devices label': 'Manage devices',
75
75
  'choose profile label': 'Edit profile',
76
- 'choose sign out label': 'Sign out',
76
+ 'choose sign out label': 'Reset storage',
77
+ 'choose join new identity label': 'Join existing device',
77
78
  'empty space members message': 'There is nobody in this space yet.',
78
79
  'back to all invitations label': 'Back to all invitations',
79
80
  'invitation heading': 'Invitation',
@@ -97,19 +98,22 @@ export const os = {
97
98
  'invite options label': 'Change the active invite option.',
98
99
  'reset in progress label': 'Resetting...',
99
100
  'confirm label': 'Confirm',
100
- 'reset identity input label':
101
+ 'reset storage input label':
101
102
  'This will clear this device and all associated data. Type {{confirmationValue}} and confirm to continue.',
103
+ 'join new identity input label':
104
+ 'In order to join an existing device, storage on this device must be cleared first. Type {{confirmationValue}} to continue.',
102
105
  'failed to reset identity message': 'Failed to reset identity.',
103
106
  'confirmation value': 'CONFIRM',
104
- 'sign out chooser title': 'DANGER ZONE',
105
- 'sign out chooser message': 'Proceeding with either action below will erase all data on this device.',
107
+ 'sign out chooser title': 'Danger zone',
108
+ 'sign out chooser message': 'Proceeding with the action below will erase all data on this device.',
106
109
  'join new identity label': 'Join a new identity',
107
- 'reset device label': 'Reset device',
110
+ 'reset device label': 'Reset storage',
108
111
  'reset device confirm message': 'Are you sure you want to reset your device? All data will be lost.',
109
112
  'emoji and color label': 'Emoji and color',
110
113
  'clear label': 'Use default',
111
114
  'select emoji label': 'Choose an emoji to use in your avatar',
112
115
  'select hue label': 'Choose a hue to use in your avatar',
116
+ 'resetting message': 'One moment while things are reset…',
113
117
  'red label': 'Red',
114
118
  'orange label': 'Orange',
115
119
  'amber label': 'Amber',
@@ -1,16 +0,0 @@
1
- import { type Event, type SingleOrArray } from 'xstate';
2
- import { type IdentityPanelStepProps } from '../IdentityPanelProps';
3
- import { type IdentityEvent } from '../identityMachine';
4
- export interface SignOutChooserProps extends Omit<IdentityPanelStepProps, 'send'> {
5
- send?: (event: SingleOrArray<Event<IdentityEvent>>) => void;
6
- onResetDevice?: () => Promise<void>;
7
- onJoinNewIdentity?: () => void;
8
- }
9
- export declare const SignOutChooser: (props: SignOutChooserProps) => JSX.Element;
10
- export type SignOutChooserImplProps = {
11
- disabled?: boolean;
12
- onResetDevice?: () => void;
13
- onJoinNewIdentity?: () => void;
14
- onBack?: () => void;
15
- };
16
- //# sourceMappingURL=SignOutChooser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SignOutChooser.d.ts","sourceRoot":"","sources":["../../../../../../src/panels/IdentityPanel/steps/SignOutChooser.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAMxD,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAC/E,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,KAAK,IAAI,CAAC;IAC5D,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;CAChC;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,gBAexD,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC"}
@@ -1,40 +0,0 @@
1
- "use strict";
2
- //
3
- // Copyright 2023 DXOS.org
4
- //
5
- var __importDefault = (this && this.__importDefault) || function (mod) {
6
- return (mod && mod.__esModule) ? mod : { "default": mod };
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.SignOutChooser = void 0;
10
- const react_1 = require("@phosphor-icons/react");
11
- const react_2 = __importDefault(require("react"));
12
- const react_ui_1 = require("@dxos/react-ui");
13
- const react_ui_theme_1 = require("@dxos/react-ui-theme");
14
- const components_1 = require("../../../components");
15
- const SignOutChooser = (props) => {
16
- const { t } = (0, react_ui_1.useTranslation)('os');
17
- const onResetDevice = () => {
18
- var _a;
19
- if (window.confirm(t('reset device confirm message'))) {
20
- void ((_a = props.onResetDevice) === null || _a === void 0 ? void 0 : _a.call(props));
21
- }
22
- };
23
- return (react_2.default.createElement(SignOutChooserImpl, { disabled: !props.active, onBack: () => { var _a; return (_a = props.send) === null || _a === void 0 ? void 0 : _a.call(props, { type: 'unchooseAction' }); }, onResetDevice: onResetDevice, onJoinNewIdentity: props.onJoinNewIdentity }));
24
- };
25
- exports.SignOutChooser = SignOutChooser;
26
- const SignOutChooserImpl = ({ disabled, onResetDevice, onJoinNewIdentity, onBack }) => {
27
- const { t } = (0, react_ui_1.useTranslation)('os');
28
- return (react_2.default.createElement(react_2.default.Fragment, null,
29
- react_2.default.createElement("div", { role: 'none', className: 'grow flex flex-col justify-center' },
30
- react_2.default.createElement(react_ui_1.Message.Root, { valence: 'error' },
31
- react_2.default.createElement(react_ui_1.Message.Title, null,
32
- react_2.default.createElement(react_1.Warning, { className: (0, react_ui_theme_1.mx)((0, react_ui_theme_1.getSize)(6), 'inline mie-2') }),
33
- t('sign out chooser title')),
34
- react_2.default.createElement(react_ui_1.Message.Body, null, t('sign out chooser message')))),
35
- react_2.default.createElement(components_1.Actions, null,
36
- react_2.default.createElement(components_1.Action, { disabled: disabled, onClick: onBack }, t('back label')),
37
- react_2.default.createElement(components_1.Action, { variant: 'primary', "data-testid": 'sign-out.join-new-identity', classNames: '!bg-error-500 hover:!bg-error-550', disabled: disabled, onClick: onJoinNewIdentity }, t('join new identity label')),
38
- react_2.default.createElement(components_1.Action, { variant: 'primary', "data-testid": 'sign-out.reset-device', classNames: '!bg-error-500 hover:!bg-error-550', disabled: disabled, onClick: onResetDevice }, t('reset device label')))));
39
- };
40
- //# sourceMappingURL=SignOutChooser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SignOutChooser.js","sourceRoot":"","sources":["../../../../../../src/panels/IdentityPanel/steps/SignOutChooser.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,iDAAgD;AAChD,kDAA0B;AAG1B,6CAAyD;AACzD,yDAAmD;AAEnD,oDAAsD;AAU/C,MAAM,cAAc,GAAG,C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,mBAAM,IAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,IACxC,CAAC,CAAC,YAAY,CAAC,CACT;YACT,8BAAC,mBAAM,IACL,OAAO,EAAC,SAAS,iBACL,4BAA4B,EACxC,UAAU,EAAC,mCAAmC,EAC9C,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,iBAAiB,IAEzB,CAAC,CAAC,yBAAyB,CAAC,CACtB;YACT,8BAAC,mBAAM,IACL,OAAO,EAAC,SAAS,iBACL,uBAAuB,EACnC,UAAU,EAAC,mCAAmC,EAC9C,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,aAAa,IAErB,CAAC,CAAC,oBAAoB,CAAC,CACjB,CACD,CACT,CACJ,CAAC;AACJ,CAAC,CAAC"}
@@ -1,13 +0,0 @@
1
- import { type JoinStepProps } from '../JoinPanelProps';
2
- export type ResetIdentityProps = JoinStepProps & {
3
- method: 'reset identity';
4
- };
5
- export type ResetIdentityImplProps = {
6
- disabled?: boolean;
7
- pending?: boolean;
8
- validationMessage?: string;
9
- onConfirm?: () => void;
10
- };
11
- export declare const ResetIdentity: ({ send, active }: ResetIdentityProps) => JSX.Element;
12
- export declare const ResetIdentityImpl: ({ disabled, pending, validationMessage, onConfirm }: ResetIdentityImplProps) => JSX.Element;
13
- //# sourceMappingURL=ResetIdentity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResetIdentity.d.ts","sourceRoot":"","sources":["../../../../../../src/panels/JoinPanel/steps/ResetIdentity.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,aAAa,qBAAsB,kBAAkB,gBAwBjE,CAAC;AAEF,eAAO,MAAM,iBAAiB,wDAAyD,sBAAsB,gBA6B5G,CAAC"}
@@ -1,66 +0,0 @@
1
- "use strict";
2
- //
3
- // Copyright 2023 DXOS.org
4
- //
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.ResetIdentityImpl = exports.ResetIdentity = void 0;
30
- const react_1 = __importStar(require("react"));
31
- const log_1 = require("@dxos/log");
32
- const react_client_1 = require("@dxos/react-client");
33
- const react_ui_1 = require("@dxos/react-ui");
34
- const components_1 = require("../../../components");
35
- const ResetIdentity = ({ send, active }) => {
36
- const client = (0, react_client_1.useClient)();
37
- const { t } = (0, react_ui_1.useTranslation)('os');
38
- const [validationMessage, setValidationMessage] = (0, react_1.useState)('');
39
- const [pending, setPending] = (0, react_1.useState)(false);
40
- const resetIdentity = () => {
41
- setPending(true);
42
- void client.reset().then(() => send === null || send === void 0 ? void 0 : send({ type: 'resetIdentity' }), (error) => {
43
- log_1.log.catch(error);
44
- setValidationMessage(t('failed to reset identity message'));
45
- setPending(false);
46
- });
47
- };
48
- return (react_1.default.createElement(exports.ResetIdentityImpl, { disabled: !active, pending: pending, validationMessage: validationMessage, onConfirm: () => resetIdentity() }));
49
- };
50
- exports.ResetIdentity = ResetIdentity;
51
- const ResetIdentityImpl = ({ disabled, pending, validationMessage, onConfirm }) => {
52
- const { t } = (0, react_ui_1.useTranslation)('os');
53
- const confirmationValue = t('confirmation value');
54
- const [inputValue, setInputValue] = (0, react_1.useState)('');
55
- return (react_1.default.createElement(react_1.default.Fragment, null,
56
- react_1.default.createElement("div", { role: 'none', className: 'grow flex flex-col justify-center' },
57
- react_1.default.createElement(components_1.Input, { validationMessage, label: react_1.default.createElement(components_1.StepHeading, null, t('reset identity input label', { confirmationValue })), disabled: disabled, "data-testid": 'reset-identity-input', placeholder: confirmationValue, onChange: ({ target: { value } }) => setInputValue(value) })),
58
- react_1.default.createElement(components_1.Actions, null,
59
- react_1.default.createElement(components_1.Action
60
- // TODO(wittjosiah): Probably make this red?
61
- , {
62
- // TODO(wittjosiah): Probably make this red?
63
- variant: 'primary', disabled: disabled || pending || inputValue !== confirmationValue, onClick: () => onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(), "data-testid": 'reset-identity-input-confirm' }, pending ? t('reset in progress label') : t('confirm label')))));
64
- };
65
- exports.ResetIdentityImpl = ResetIdentityImpl;
66
- //# sourceMappingURL=ResetIdentity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResetIdentity.js","sourceRoot":"","sources":["../../../../../../src/panels/JoinPanel/steps/ResetIdentity.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,+CAAwC;AAExC,mCAAgC;AAChC,qDAA+C;AAC/C,6CAAg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AAC;IACnC,MAAM,iBAAiB,GAAG,CAAC,CAAC,oBAAoB,CAAC,CAAC;IAClD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IACjD,OAAO,CACL;QACE,uCAAK,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,mCAAmC;YAC5D,8BAAC,kBAAK,IACE,iBAAiB,EACvB,KAAK,EAAE,8BAAC,wBAAW,QAAE,CAAC,CAAC,4BAA4B,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAe,EAC1F,QAAQ,EAAE,QAAQ,iBACN,sBAAsB,EAClC,WAAW,EAAE,iBAAiB,EAC9B,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GACzD,CACE;QACN,8BAAC,oBAAO;YACN,8BAAC,mBAAM;YACL,4CAA4C;;gBAA5C,4CAA4C;gBAC5C,OAAO,EAAC,SAAS,EACjB,QAAQ,EAAE,QAAQ,IAAI,OAAO,IAAI,UAAU,KAAK,iBAAiB,EACjE,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,EAAI,iBAChB,8BAA8B,IAEzC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CACrD,CACD,CACT,CACJ,CAAC;AACJ,CAAC,CAAC;AA7BW,QAAA,iBAAiB,qBA6B5B"}
@@ -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
- };