@dxos/plugin-client 0.8.4-main.f9ba587 → 0.8.4-main.fffef41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{app-graph-builder-3EILEBWW.mjs → app-graph-builder-ARY4H3VC.mjs} +26 -25
- package/dist/lib/browser/app-graph-builder-ARY4H3VC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-64ANQXYZ.mjs → chunk-4G4YWIUQ.mjs} +59 -66
- package/dist/lib/browser/chunk-4G4YWIUQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-4LRO3Y2O.mjs +19 -0
- package/dist/lib/browser/chunk-4LRO3Y2O.mjs.map +7 -0
- package/dist/lib/browser/chunk-N5UR2HOE.mjs +18 -0
- package/dist/lib/browser/chunk-N5UR2HOE.mjs.map +7 -0
- package/dist/lib/browser/{chunk-Q7TFRFHI.mjs → chunk-RDIG75CA.mjs} +15 -16
- package/dist/lib/browser/chunk-RDIG75CA.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZRVMXLDR.mjs +15 -0
- package/dist/lib/browser/chunk-ZRVMXLDR.mjs.map +7 -0
- package/dist/lib/browser/{client-JFNMEFOK.mjs → client-O7U3MQ6J.mjs} +14 -8
- package/dist/lib/browser/client-O7U3MQ6J.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +23 -19
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-YGAQVXI2.mjs → intent-resolver-KLK7PJZK.mjs} +18 -18
- package/dist/lib/browser/intent-resolver-KLK7PJZK.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{migrations-5COKGS4E.mjs → migrations-RUAKBBTF.mjs} +6 -6
- package/dist/lib/browser/migrations-RUAKBBTF.mjs.map +7 -0
- package/dist/lib/browser/{react-context-GBNYT5QK.mjs → react-context-PCT5C3BN.mjs} +9 -8
- package/dist/lib/browser/react-context-PCT5C3BN.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-YKQAUE2M.mjs → react-surface-RCXEA65V.mjs} +7 -7
- package/dist/lib/browser/{react-surface-YKQAUE2M.mjs.map → react-surface-RCXEA65V.mjs.map} +3 -3
- package/dist/lib/browser/{schema-defs-6L7W2RHL.mjs → schema-defs-UNNBAEFW.mjs} +6 -6
- package/dist/lib/browser/schema-defs-UNNBAEFW.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -0
- package/dist/lib/node-esm/{app-graph-builder-GINHOE7A.mjs → app-graph-builder-LLM25DRR.mjs} +26 -25
- package/dist/lib/node-esm/app-graph-builder-LLM25DRR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-6ANOJ7ZM.mjs +19 -0
- package/dist/lib/node-esm/chunk-6ANOJ7ZM.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7M7VWQJW.mjs +20 -0
- package/dist/lib/node-esm/chunk-7M7VWQJW.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-K4PIKBQQ.mjs → chunk-DJ6XKSE4.mjs} +59 -66
- package/dist/lib/node-esm/chunk-DJ6XKSE4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QT3EQXDU.mjs +17 -0
- package/dist/lib/node-esm/chunk-QT3EQXDU.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-GDJMDBWM.mjs → chunk-VENKFPBC.mjs} +15 -16
- package/dist/lib/node-esm/chunk-VENKFPBC.mjs.map +7 -0
- package/dist/lib/node-esm/{client-XDYQARBL.mjs → client-6MTNT7M6.mjs} +14 -8
- package/dist/lib/node-esm/client-6MTNT7M6.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +23 -19
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-IN7YG7N7.mjs → intent-resolver-YR2C224X.mjs} +18 -18
- package/dist/lib/node-esm/intent-resolver-YR2C224X.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{migrations-FE4PDX6W.mjs → migrations-ASF2SAUR.mjs} +6 -6
- package/dist/lib/node-esm/migrations-ASF2SAUR.mjs.map +7 -0
- package/dist/lib/node-esm/{react-context-UCK43H3Z.mjs → react-context-F4QOBWSP.mjs} +9 -8
- package/dist/lib/node-esm/react-context-F4QOBWSP.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-HDHC6XHQ.mjs → react-surface-SQBRXVMZ.mjs} +7 -7
- package/dist/lib/node-esm/{react-surface-HDHC6XHQ.mjs.map → react-surface-SQBRXVMZ.mjs.map} +3 -3
- package/dist/lib/node-esm/{schema-defs-GZIVMHLW.mjs → schema-defs-MSIT2KK2.mjs} +6 -6
- package/dist/lib/node-esm/schema-defs-MSIT2KK2.mjs.map +7 -0
- package/dist/lib/node-esm/{types.mjs → types/index.mjs} +3 -3
- package/dist/types/src/ClientPlugin.d.ts +1 -1
- package/dist/types/src/ClientPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +2 -3
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/client.d.ts +1 -1
- package/dist/types/src/capabilities/client.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +10 -10
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/migrations.d.ts +1 -1
- package/dist/types/src/capabilities/migrations.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-context.d.ts +2 -2
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/schema-defs.d.ts +1 -1
- package/dist/types/src/capabilities/schema-defs.d.ts.map +1 -1
- package/dist/types/src/components/DevicesContainer.d.ts.map +1 -1
- package/dist/types/src/components/DevicesContainer.stories.d.ts +224 -5
- package/dist/types/src/components/DevicesContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +1 -1
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/ProfileContainer.d.ts.map +1 -1
- package/dist/types/src/components/ProfileContainer.stories.d.ts +57 -5
- package/dist/types/src/components/ProfileContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/RecoveryCodeDialog.d.ts +1 -1
- package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +1 -1
- package/dist/types/src/components/RecoveryCodeDialog.stories.d.ts +59 -5
- package/dist/types/src/components/RecoveryCodeDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/RecoveryCredentialsContainer.d.ts +1 -1
- package/dist/types/src/components/RecoveryCredentialsContainer.d.ts.map +1 -1
- package/dist/types/src/components/RecoveryCredentialsContainer.stories.d.ts +57 -5
- package/dist/types/src/components/RecoveryCredentialsContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/ResetDialog.d.ts +1 -1
- package/dist/types/src/components/ResetDialog.d.ts.map +1 -1
- package/dist/types/src/components/ResetDialog.stories.d.ts +59 -4
- package/dist/types/src/components/ResetDialog.stories.d.ts.map +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/{types.d.ts → types/schema.d.ts} +31 -25
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +41 -42
- package/src/ClientPlugin.ts +57 -59
- package/src/capabilities/app-graph-builder.ts +25 -23
- package/src/capabilities/capabilities.ts +7 -6
- package/src/capabilities/client.ts +6 -4
- package/src/capabilities/intent-resolver.ts +7 -6
- package/src/capabilities/migrations.ts +2 -2
- package/src/capabilities/react-context.tsx +5 -3
- package/src/capabilities/react-surface.tsx +3 -3
- package/src/capabilities/schema-defs.ts +4 -4
- package/src/components/DevicesContainer.stories.tsx +9 -11
- package/src/components/DevicesContainer.tsx +61 -72
- package/src/components/JoinDialog.tsx +5 -4
- package/src/components/ProfileContainer.stories.tsx +8 -9
- package/src/components/ProfileContainer.tsx +24 -32
- package/src/components/RecoveryCodeDialog.stories.tsx +9 -10
- package/src/components/RecoveryCodeDialog.tsx +6 -6
- package/src/components/RecoveryCredentialsContainer.stories.tsx +9 -11
- package/src/components/RecoveryCredentialsContainer.tsx +47 -51
- package/src/components/ResetDialog.stories.tsx +10 -11
- package/src/components/ResetDialog.tsx +5 -4
- package/src/events.ts +6 -6
- package/src/index.ts +4 -3
- package/src/meta.ts +6 -3
- package/src/types/index.ts +5 -0
- package/src/{types.ts → types/schema.ts} +15 -16
- package/dist/lib/browser/app-graph-builder-3EILEBWW.mjs.map +0 -7
- package/dist/lib/browser/chunk-64ANQXYZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-AWXKL4UR.mjs +0 -18
- package/dist/lib/browser/chunk-AWXKL4UR.mjs.map +0 -7
- package/dist/lib/browser/chunk-CAF2COXW.mjs +0 -19
- package/dist/lib/browser/chunk-CAF2COXW.mjs.map +0 -7
- package/dist/lib/browser/chunk-GS3LDHYD.mjs +0 -12
- package/dist/lib/browser/chunk-GS3LDHYD.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q7TFRFHI.mjs.map +0 -7
- package/dist/lib/browser/client-JFNMEFOK.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-YGAQVXI2.mjs.map +0 -7
- package/dist/lib/browser/migrations-5COKGS4E.mjs.map +0 -7
- package/dist/lib/browser/react-context-GBNYT5QK.mjs.map +0 -7
- package/dist/lib/browser/schema-defs-6L7W2RHL.mjs.map +0 -7
- package/dist/lib/browser/types.mjs +0 -10
- package/dist/lib/node-esm/app-graph-builder-GINHOE7A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3BUB64JB.mjs +0 -19
- package/dist/lib/node-esm/chunk-3BUB64JB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GDJMDBWM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K4PIKBQQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SZLX4BVJ.mjs +0 -14
- package/dist/lib/node-esm/chunk-SZLX4BVJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UMO3ETDV.mjs +0 -20
- package/dist/lib/node-esm/chunk-UMO3ETDV.mjs.map +0 -7
- package/dist/lib/node-esm/client-XDYQARBL.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-IN7YG7N7.mjs.map +0 -7
- package/dist/lib/node-esm/migrations-FE4PDX6W.mjs.map +0 -7
- package/dist/lib/node-esm/react-context-UCK43H3Z.mjs.map +0 -7
- package/dist/lib/node-esm/schema-defs-GZIVMHLW.mjs.map +0 -7
- package/dist/types/src/types.d.ts.map +0 -1
- /package/dist/lib/browser/{types.mjs.map → types/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{types.mjs.map → types/index.mjs.map} +0 -0
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Check, X } from '@phosphor-icons/react';
|
|
6
5
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
7
6
|
import { QR } from 'react-qr-rounded';
|
|
8
7
|
|
|
9
|
-
import { createIntent
|
|
8
|
+
import { createIntent } from '@dxos/app-framework';
|
|
9
|
+
import { useIntentDispatcher } from '@dxos/app-framework/react';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
11
|
import { useClient, useMulticastObservable } from '@dxos/react-client';
|
|
12
12
|
import { type Device, useDevices } from '@dxos/react-client/halo';
|
|
13
13
|
import { type CancellableInvitationObservable, Invitation, InvitationEncoder } from '@dxos/react-client/invitations';
|
|
14
14
|
import { useNetworkStatus } from '@dxos/react-client/mesh';
|
|
15
|
-
import { Button, Clipboard, IconButton, List, useId, useTranslation } from '@dxos/react-ui';
|
|
15
|
+
import { Button, Clipboard, Icon, IconButton, List, useId, useTranslation } from '@dxos/react-ui';
|
|
16
16
|
import {
|
|
17
17
|
ControlFrame,
|
|
18
18
|
ControlFrameItem,
|
|
@@ -21,12 +21,10 @@ import {
|
|
|
21
21
|
ControlPage,
|
|
22
22
|
ControlSection,
|
|
23
23
|
} from '@dxos/react-ui-form';
|
|
24
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
25
|
-
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
26
24
|
import { AuthCode, Centered, DeviceListItem, Emoji, Viewport } from '@dxos/shell/react';
|
|
27
25
|
import { hexToEmoji } from '@dxos/util';
|
|
28
26
|
|
|
29
|
-
import {
|
|
27
|
+
import { meta } from '../meta';
|
|
30
28
|
import { ClientAction } from '../types';
|
|
31
29
|
|
|
32
30
|
export type DevicesContainerProps = {
|
|
@@ -53,70 +51,57 @@ export const DevicesContainer = ({ createInvitationUrl }: DevicesContainerProps)
|
|
|
53
51
|
|
|
54
52
|
return (
|
|
55
53
|
<Clipboard.Provider>
|
|
56
|
-
<
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
>
|
|
62
|
-
<
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
</List>
|
|
54
|
+
<ControlPage>
|
|
55
|
+
<ControlSection
|
|
56
|
+
title={t('devices verbose label', { ns: meta.id })}
|
|
57
|
+
description={t('devices description', { ns: meta.id })}
|
|
58
|
+
>
|
|
59
|
+
<ControlFrame>
|
|
60
|
+
<ControlFrameItem title={t('devices label', { ns: meta.id })}>
|
|
61
|
+
<List>
|
|
62
|
+
{devices.map((device: Device) => {
|
|
63
|
+
return (
|
|
64
|
+
<DeviceListItem key={device.deviceKey.toHex()} device={device} connectionState={connectionState} />
|
|
65
|
+
);
|
|
66
|
+
})}
|
|
67
|
+
</List>
|
|
68
|
+
</ControlFrameItem>
|
|
69
|
+
{createInvitationUrl && (
|
|
70
|
+
<ControlFrameItem title='Add device'>
|
|
71
|
+
<DeviceInvitation createInvitationUrl={createInvitationUrl} />
|
|
75
72
|
</ControlFrameItem>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
<
|
|
84
|
-
title={t('
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
</
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
</
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
<Button
|
|
109
|
-
variant='destructive'
|
|
110
|
-
onClick={handleJoinNewIdentity}
|
|
111
|
-
data-testid='devicesContainer.joinExisting'
|
|
112
|
-
>
|
|
113
|
-
{t('join new identity label')}
|
|
114
|
-
</Button>
|
|
115
|
-
</ControlItem>
|
|
116
|
-
</ControlGroup>
|
|
117
|
-
</ControlSection>
|
|
118
|
-
</ControlPage>
|
|
119
|
-
</StackItem.Content>
|
|
73
|
+
)}
|
|
74
|
+
</ControlFrame>
|
|
75
|
+
</ControlSection>
|
|
76
|
+
<ControlSection
|
|
77
|
+
title={t('danger zone title', { ns: meta.id })}
|
|
78
|
+
description={t('danger zone description', { ns: meta.id })}
|
|
79
|
+
>
|
|
80
|
+
<ControlGroup>
|
|
81
|
+
<ControlItem title={t('reset device label')} description={t('reset device description', { ns: meta.id })}>
|
|
82
|
+
<Button variant='destructive' onClick={handleResetStorage} data-testid='devicesContainer.reset'>
|
|
83
|
+
{t('reset device label')}
|
|
84
|
+
</Button>
|
|
85
|
+
</ControlItem>
|
|
86
|
+
<ControlItem
|
|
87
|
+
title={t('recover identity label')}
|
|
88
|
+
description={t('recover identity description', { ns: meta.id })}
|
|
89
|
+
>
|
|
90
|
+
<Button variant='destructive' onClick={handleRecover} data-testid='devicesContainer.recover'>
|
|
91
|
+
{t('recover identity label')}
|
|
92
|
+
</Button>
|
|
93
|
+
</ControlItem>
|
|
94
|
+
<ControlItem
|
|
95
|
+
title={t('join new identity label')}
|
|
96
|
+
description={t('join new identity description', { ns: meta.id })}
|
|
97
|
+
>
|
|
98
|
+
<Button variant='destructive' onClick={handleJoinNewIdentity} data-testid='devicesContainer.joinExisting'>
|
|
99
|
+
{t('join new identity label')}
|
|
100
|
+
</Button>
|
|
101
|
+
</ControlItem>
|
|
102
|
+
</ControlGroup>
|
|
103
|
+
</ControlSection>
|
|
104
|
+
</ControlPage>
|
|
120
105
|
</Clipboard.Provider>
|
|
121
106
|
);
|
|
122
107
|
};
|
|
@@ -191,7 +176,7 @@ const InvitationSection = ({
|
|
|
191
176
|
onInvitationDone = () => {},
|
|
192
177
|
onInvitationCreate = () => {},
|
|
193
178
|
}: InvitationComponentProps) => {
|
|
194
|
-
const { t } = useTranslation(
|
|
179
|
+
const { t } = useTranslation(meta.id);
|
|
195
180
|
const activeView =
|
|
196
181
|
state < 0
|
|
197
182
|
? 'init'
|
|
@@ -238,7 +223,7 @@ const InvitationQR = ({ id, url, onCancel }: { id: string; url: string; onCancel
|
|
|
238
223
|
const emoji = hexToEmoji(id);
|
|
239
224
|
return (
|
|
240
225
|
<>
|
|
241
|
-
<p className='text-description'>{t('qr code description', { ns:
|
|
226
|
+
<p className='text-description'>{t('qr code description', { ns: meta.id })}</p>
|
|
242
227
|
<div role='group' className='grid grid-cols-[1fr_min-content] mlb-2 gap-2'>
|
|
243
228
|
<div role='none' className='is-full aspect-square relative text-description'>
|
|
244
229
|
<QR
|
|
@@ -290,5 +275,9 @@ const InvitationAuthCode = ({ id, code, onCancel }: { id: string; code: string;
|
|
|
290
275
|
};
|
|
291
276
|
|
|
292
277
|
const InvitationComplete = ({ statusValue }: { statusValue: number }) => {
|
|
293
|
-
return statusValue > 0 ?
|
|
278
|
+
return statusValue > 0 ? (
|
|
279
|
+
<Icon icon='ph--check--regular' size={6} classNames='m-1.5' />
|
|
280
|
+
) : (
|
|
281
|
+
<Icon icon='ph--x--regular' size={6} classNames='m-1.5' />
|
|
282
|
+
);
|
|
294
283
|
};
|
|
@@ -4,20 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { LayoutAction, createIntent } from '@dxos/app-framework';
|
|
8
|
+
import { useIntentDispatcher } from '@dxos/app-framework/react';
|
|
8
9
|
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
9
10
|
import { type InvitationResult } from '@dxos/react-client/invitations';
|
|
10
11
|
import { Dialog, useTranslation } from '@dxos/react-ui';
|
|
11
12
|
import { JoinPanel, type JoinPanelProps } from '@dxos/shell/react';
|
|
12
13
|
|
|
13
|
-
import {
|
|
14
|
+
import { meta } from '../meta';
|
|
14
15
|
import { ClientAction } from '../types';
|
|
15
16
|
|
|
16
|
-
export const JOIN_DIALOG = `${
|
|
17
|
+
export const JOIN_DIALOG = `${meta.id}/JoinDialog`;
|
|
17
18
|
|
|
18
19
|
export const JoinDialog = (props: JoinPanelProps) => {
|
|
19
20
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
20
|
-
const { t } = useTranslation(
|
|
21
|
+
const { t } = useTranslation(meta.id);
|
|
21
22
|
|
|
22
23
|
const handleCancelResetStorage = useCallback(() => dispatch(createIntent(ClientAction.ShareIdentity)), [dispatch]);
|
|
23
24
|
|
|
@@ -2,28 +2,27 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
|
|
9
7
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
10
|
-
import { withTheme
|
|
8
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
9
|
|
|
12
|
-
import { ProfileContainer } from './ProfileContainer';
|
|
13
10
|
import { translations } from '../translations';
|
|
14
11
|
|
|
15
|
-
|
|
12
|
+
import { ProfileContainer } from './ProfileContainer';
|
|
13
|
+
|
|
14
|
+
const meta = {
|
|
16
15
|
title: 'plugins/plugin-client/ProfileContainer',
|
|
17
16
|
component: ProfileContainer,
|
|
18
|
-
decorators: [withClientProvider({ createIdentity: true })
|
|
17
|
+
decorators: [withTheme, withClientProvider({ createIdentity: true })],
|
|
19
18
|
parameters: {
|
|
20
19
|
layout: 'fullscreen',
|
|
21
20
|
translations,
|
|
22
21
|
},
|
|
23
|
-
}
|
|
22
|
+
} satisfies Meta<typeof ProfileContainer>;
|
|
24
23
|
|
|
25
24
|
export default meta;
|
|
26
25
|
|
|
27
|
-
type Story = StoryObj<typeof
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
28
27
|
|
|
29
28
|
export const Default: Story = {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { type ChangeEvent, useCallback, useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { debounce } from '@dxos/async';
|
|
@@ -10,18 +10,17 @@ import { useClient } from '@dxos/react-client';
|
|
|
10
10
|
import { type Identity, useIdentity } from '@dxos/react-client/halo';
|
|
11
11
|
import { ButtonGroup, Clipboard, Input, useTranslation } from '@dxos/react-ui';
|
|
12
12
|
import {
|
|
13
|
-
Form,
|
|
14
|
-
type InputComponent,
|
|
15
13
|
ControlItem,
|
|
16
14
|
ControlItemInput,
|
|
17
|
-
ControlSection,
|
|
18
15
|
ControlPage,
|
|
16
|
+
ControlSection,
|
|
17
|
+
Form,
|
|
18
|
+
type InputComponent,
|
|
19
19
|
} from '@dxos/react-ui-form';
|
|
20
20
|
import { EmojiPickerBlock, HuePicker } from '@dxos/react-ui-pickers';
|
|
21
|
-
import {
|
|
22
|
-
import { hexToHue, hexToEmoji } from '@dxos/util';
|
|
21
|
+
import { hexToEmoji, hexToHue } from '@dxos/util';
|
|
23
22
|
|
|
24
|
-
import {
|
|
23
|
+
import { meta } from '../meta';
|
|
25
24
|
|
|
26
25
|
// TODO(thure): Factor out?
|
|
27
26
|
const getDefaultHueValue = (identity: Identity | null) => hexToHue(identity?.identityKey.toHex() ?? '0');
|
|
@@ -30,7 +29,7 @@ const getHueValue = (identity: Identity | null) => identity?.profile?.data?.hue
|
|
|
30
29
|
const getEmojiValue = (identity: Identity | null) => identity?.profile?.data?.emoji || getDefaultEmojiValue(identity);
|
|
31
30
|
|
|
32
31
|
export const ProfileContainer = () => {
|
|
33
|
-
const { t } = useTranslation(
|
|
32
|
+
const { t } = useTranslation(meta.id);
|
|
34
33
|
const client = useClient();
|
|
35
34
|
const identity = useIdentity();
|
|
36
35
|
const [displayName, setDisplayNameDirectly] = useState(identity?.profile?.displayName ?? '');
|
|
@@ -58,7 +57,7 @@ export const ProfileContainer = () => {
|
|
|
58
57
|
setDisplayNameDirectly(profile.displayName);
|
|
59
58
|
setEmojiDirectly(profile.emoji);
|
|
60
59
|
setHueDirectly(profile.hue);
|
|
61
|
-
updateProfile(profile);
|
|
60
|
+
void updateProfile(profile);
|
|
62
61
|
},
|
|
63
62
|
[identity],
|
|
64
63
|
);
|
|
@@ -118,12 +117,7 @@ export const ProfileContainer = () => {
|
|
|
118
117
|
);
|
|
119
118
|
return (
|
|
120
119
|
<ControlItem title={label} description={t('hue description')}>
|
|
121
|
-
<HuePicker
|
|
122
|
-
value={getValue()}
|
|
123
|
-
onChange={handleChange}
|
|
124
|
-
onReset={handleHueReset}
|
|
125
|
-
classNames='[--hue-preview-size:1.5rem] justify-self-end'
|
|
126
|
-
/>
|
|
120
|
+
<HuePicker value={getValue()} onChange={handleChange} onReset={handleHueReset} />
|
|
127
121
|
</ControlItem>
|
|
128
122
|
);
|
|
129
123
|
},
|
|
@@ -143,23 +137,21 @@ export const ProfileContainer = () => {
|
|
|
143
137
|
);
|
|
144
138
|
|
|
145
139
|
return (
|
|
146
|
-
<
|
|
147
|
-
<
|
|
148
|
-
<
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
</ControlPage>
|
|
162
|
-
</StackItem.Content>
|
|
140
|
+
<ControlPage>
|
|
141
|
+
<Clipboard.Provider>
|
|
142
|
+
<ControlSection title={t('profile label')} description={t('profile description')}>
|
|
143
|
+
<Form
|
|
144
|
+
schema={ProfileSchema}
|
|
145
|
+
values={values}
|
|
146
|
+
autoSave
|
|
147
|
+
onSave={handleSave}
|
|
148
|
+
Custom={customElements}
|
|
149
|
+
classNames='container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]'
|
|
150
|
+
outerSpacing={false}
|
|
151
|
+
/>
|
|
152
|
+
</ControlSection>
|
|
153
|
+
</Clipboard.Provider>
|
|
154
|
+
</ControlPage>
|
|
163
155
|
);
|
|
164
156
|
};
|
|
165
157
|
|
|
@@ -2,19 +2,18 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { useClient } from '@dxos/react-client';
|
|
11
9
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
12
10
|
import { AlertDialog, useAsyncEffect } from '@dxos/react-ui';
|
|
13
|
-
import { withTheme
|
|
11
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
12
|
|
|
15
|
-
import { RecoveryCodeDialog, type RecoveryCodeDialogProps } from './RecoveryCodeDialog';
|
|
16
13
|
import { translations } from '../translations';
|
|
17
14
|
|
|
15
|
+
import { RecoveryCodeDialog } from './RecoveryCodeDialog';
|
|
16
|
+
|
|
18
17
|
const DefaultStory = () => {
|
|
19
18
|
const client = useClient();
|
|
20
19
|
const [recoveryCode, setRecoveryCode] = useState<string>();
|
|
@@ -32,19 +31,19 @@ const DefaultStory = () => {
|
|
|
32
31
|
);
|
|
33
32
|
};
|
|
34
33
|
|
|
35
|
-
const meta
|
|
34
|
+
const meta = {
|
|
36
35
|
title: 'plugins/plugin-client/RecoveryCodeDialog',
|
|
37
|
-
component: RecoveryCodeDialog,
|
|
36
|
+
component: RecoveryCodeDialog as any,
|
|
38
37
|
render: DefaultStory,
|
|
39
|
-
decorators: [withClientProvider({ createIdentity: true })
|
|
38
|
+
decorators: [withTheme, withClientProvider({ createIdentity: true })],
|
|
40
39
|
parameters: {
|
|
41
40
|
layout: 'fullscreen',
|
|
42
41
|
translations,
|
|
43
42
|
},
|
|
44
|
-
}
|
|
43
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
45
44
|
|
|
46
45
|
export default meta;
|
|
47
46
|
|
|
48
|
-
type Story = StoryObj<
|
|
47
|
+
type Story = StoryObj<typeof meta>;
|
|
49
48
|
|
|
50
49
|
export const Default: Story = {};
|
|
@@ -6,16 +6,16 @@ import React, { useCallback, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { AlertDialog, Button, Clipboard, Input, useTranslation } from '@dxos/react-ui';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { meta } from '../meta';
|
|
10
10
|
|
|
11
|
-
export const RECOVERY_CODE_DIALOG = `${
|
|
11
|
+
export const RECOVERY_CODE_DIALOG = `${meta.id}/RecoveryCodeDialog`;
|
|
12
12
|
|
|
13
13
|
export type RecoveryCodeDialogProps = {
|
|
14
14
|
code: string;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export const RecoveryCodeDialog = ({ code }: RecoveryCodeDialogProps) => {
|
|
18
|
-
const { t } = useTranslation(
|
|
18
|
+
const { t } = useTranslation(meta.id);
|
|
19
19
|
const [confirmation, setConfirmation] = useState(false);
|
|
20
20
|
|
|
21
21
|
const handleConfirmation = useCallback((checked: boolean) => setConfirmation(checked), []);
|
|
@@ -23,11 +23,11 @@ export const RecoveryCodeDialog = ({ code }: RecoveryCodeDialogProps) => {
|
|
|
23
23
|
return (
|
|
24
24
|
<AlertDialog.Content classNames='bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden'>
|
|
25
25
|
<AlertDialog.Title>{t('recovery code dialog title')}</AlertDialog.Title>
|
|
26
|
-
<p className='
|
|
26
|
+
<p className='plb-4'>{t('recovery code dialog description')}</p>
|
|
27
27
|
<Clipboard.Provider>
|
|
28
28
|
<Code code={code} />
|
|
29
29
|
</Clipboard.Provider>
|
|
30
|
-
<div className='flex flex-col
|
|
30
|
+
<div className='flex flex-col plb-4 gap-2'>
|
|
31
31
|
<p>{t('recovery code dialog warning 1')}</p>
|
|
32
32
|
<p>{t('recovery code dialog warning 2')}</p>
|
|
33
33
|
</div>
|
|
@@ -60,7 +60,7 @@ const Code = ({ code }: { code: string }) => {
|
|
|
60
60
|
<div className='grid grid-cols-4'>
|
|
61
61
|
{words.map((word, i) => (
|
|
62
62
|
<div key={i} className='flex items-center p-2 gap-2'>
|
|
63
|
-
<div className='
|
|
63
|
+
<div className='is-4 text-xs text-center text-subdued'>{i + 1}</div>
|
|
64
64
|
<div className='text-sm'>{word}</div>
|
|
65
65
|
</div>
|
|
66
66
|
))}
|
|
@@ -2,43 +2,41 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
|
|
9
7
|
import { IntentPlugin } from '@dxos/app-framework';
|
|
10
8
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
-
import { withTheme
|
|
9
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
12
10
|
|
|
13
|
-
import { RecoveryCredentialsContainer } from './RecoveryCredentialsContainer';
|
|
14
11
|
import { ClientPlugin } from '../ClientPlugin';
|
|
15
12
|
import { translations } from '../translations';
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
import { RecoveryCredentialsContainer } from './RecoveryCredentialsContainer';
|
|
15
|
+
|
|
16
|
+
const meta = {
|
|
18
17
|
title: 'plugins/plugin-client/RecoveryCredentialsContainer',
|
|
19
18
|
component: RecoveryCredentialsContainer,
|
|
20
19
|
decorators: [
|
|
20
|
+
withTheme,
|
|
21
21
|
withPluginManager({
|
|
22
22
|
plugins: [
|
|
23
23
|
ClientPlugin({
|
|
24
|
-
onClientInitialized: async (
|
|
24
|
+
onClientInitialized: async ({ client }) => {
|
|
25
25
|
await client.halo.createIdentity();
|
|
26
26
|
},
|
|
27
27
|
}),
|
|
28
28
|
IntentPlugin(),
|
|
29
29
|
],
|
|
30
30
|
}),
|
|
31
|
-
withTheme,
|
|
32
|
-
withLayout(),
|
|
33
31
|
],
|
|
34
32
|
parameters: {
|
|
35
33
|
layout: 'fullscreen',
|
|
36
34
|
translations,
|
|
37
35
|
},
|
|
38
|
-
}
|
|
36
|
+
} satisfies Meta<typeof RecoveryCredentialsContainer>;
|
|
39
37
|
|
|
40
38
|
export default meta;
|
|
41
39
|
|
|
42
|
-
type Story = StoryObj<typeof
|
|
40
|
+
type Story = StoryObj<typeof meta>;
|
|
43
41
|
|
|
44
42
|
export const Default: Story = {};
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { createIntent
|
|
7
|
+
import { createIntent } from '@dxos/app-framework';
|
|
8
|
+
import { useIntentDispatcher } from '@dxos/app-framework/react';
|
|
8
9
|
import { useCredentials } from '@dxos/react-client/halo';
|
|
9
|
-
import { Icon, IconButton, List, ListItem,
|
|
10
|
+
import { Icon, IconButton, List, ListItem, Message, useTranslation } from '@dxos/react-ui';
|
|
10
11
|
import { ControlGroup, ControlItem, ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
11
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { meta } from '../meta';
|
|
14
14
|
import { ClientAction } from '../types';
|
|
15
15
|
|
|
16
|
-
export const MANAGE_CREDENTIALS_DIALOG = `${
|
|
16
|
+
export const MANAGE_CREDENTIALS_DIALOG = `${meta.id}/ManageCredentialsDialog`;
|
|
17
17
|
|
|
18
18
|
export const RecoveryCredentialsContainer = () => {
|
|
19
|
-
const { t } = useTranslation(
|
|
19
|
+
const { t } = useTranslation(meta.id);
|
|
20
20
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
21
21
|
const credentials = useCredentials();
|
|
22
22
|
const recoveryCredentials = credentials.filter(
|
|
@@ -24,50 +24,46 @@ export const RecoveryCredentialsContainer = () => {
|
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
)}
|
|
69
|
-
</ControlSection>
|
|
70
|
-
</ControlPage>
|
|
71
|
-
</StackItem.Content>
|
|
27
|
+
<ControlPage>
|
|
28
|
+
<ControlSection title={t('recovery setup dialog title')} description={t('recovery setup dialog description')}>
|
|
29
|
+
<ControlGroup>
|
|
30
|
+
<ControlItem title={t('create passkey label')} description={t('create passkey description')}>
|
|
31
|
+
<IconButton
|
|
32
|
+
label={t('create passkey label')}
|
|
33
|
+
icon='ph--key--duotone'
|
|
34
|
+
variant='primary'
|
|
35
|
+
onClick={() => dispatch(createIntent(ClientAction.CreatePasskey))}
|
|
36
|
+
/>
|
|
37
|
+
</ControlItem>
|
|
38
|
+
<ControlItem title={t('create recovery code label')} description={t('create recovery code description')}>
|
|
39
|
+
<IconButton
|
|
40
|
+
label={t('create recovery code label')}
|
|
41
|
+
icon='ph--receipt--duotone'
|
|
42
|
+
variant='default'
|
|
43
|
+
onClick={() => dispatch(createIntent(ClientAction.CreateRecoveryCode))}
|
|
44
|
+
/>
|
|
45
|
+
</ControlItem>
|
|
46
|
+
</ControlGroup>
|
|
47
|
+
</ControlSection>
|
|
48
|
+
<ControlSection title={t('credentials list label')}>
|
|
49
|
+
{recoveryCredentials.length < 1 ? (
|
|
50
|
+
<Message.Root valence='error' classNames='container-max-width'>
|
|
51
|
+
<Message.Title icon='ph--shield-warning--duotone'>{t('no credentials title')}</Message.Title>
|
|
52
|
+
<Message.Content>{t('no credentials message')}</Message.Content>
|
|
53
|
+
</Message.Root>
|
|
54
|
+
) : (
|
|
55
|
+
<List classNames='container-max-width pli-2'>
|
|
56
|
+
{recoveryCredentials.map((credential) => (
|
|
57
|
+
<ListItem.Root key={credential.id?.toHex()}>
|
|
58
|
+
<ListItem.Endcap>
|
|
59
|
+
<Icon icon='ph--key--regular' />
|
|
60
|
+
</ListItem.Endcap>
|
|
61
|
+
<ListItem.Heading>{credential.issuanceDate.toLocaleString()}</ListItem.Heading>
|
|
62
|
+
</ListItem.Root>
|
|
63
|
+
))}
|
|
64
|
+
</List>
|
|
65
|
+
)}
|
|
66
|
+
</ControlSection>
|
|
67
|
+
</ControlPage>
|
|
72
68
|
);
|
|
73
69
|
};
|