@dxos/plugin-client 0.7.5-main.499c70c → 0.7.5-main.6a330ac
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-ON64R7SO.mjs +44 -0
- package/dist/lib/browser/app-graph-builder-ON64R7SO.mjs.map +7 -0
- package/dist/lib/browser/{chunk-52IJQ35F.mjs → chunk-7DPLXOMO.mjs} +17 -7
- package/dist/lib/browser/chunk-7DPLXOMO.mjs.map +7 -0
- package/dist/lib/browser/chunk-EYBZZHSM.mjs +271 -0
- package/dist/lib/browser/chunk-EYBZZHSM.mjs.map +7 -0
- package/dist/lib/browser/chunk-GHEQL2E6.mjs +16 -0
- package/dist/lib/browser/chunk-GHEQL2E6.mjs.map +7 -0
- package/dist/lib/browser/{chunk-X4QUPYC6.mjs → chunk-NHIL4T3L.mjs} +3 -3
- package/dist/lib/browser/chunk-NHIL4T3L.mjs.map +7 -0
- package/dist/lib/browser/chunk-RGMLBYIF.mjs +18 -0
- package/dist/lib/browser/chunk-RGMLBYIF.mjs.map +7 -0
- package/dist/lib/browser/client-A7YSVURS.mjs +36 -0
- package/dist/lib/browser/client-A7YSVURS.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +83 -370
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-SSM6WXAW.mjs +263 -0
- package/dist/lib/browser/intent-resolver-SSM6WXAW.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-R3SG55F5.mjs +24 -0
- package/dist/lib/browser/react-context-R3SG55F5.mjs.map +7 -0
- package/dist/lib/browser/react-surface-XGOUHVIH.mjs +57 -0
- package/dist/lib/browser/react-surface-XGOUHVIH.mjs.map +7 -0
- package/dist/lib/browser/schema-J4MJIXRP.mjs +23 -0
- package/dist/lib/browser/schema-J4MJIXRP.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +4 -6
- package/dist/lib/node/app-graph-builder-RW7ESEX3.cjs +58 -0
- package/dist/lib/node/app-graph-builder-RW7ESEX3.cjs.map +7 -0
- package/dist/lib/node/chunk-7LVBFGKQ.cjs +299 -0
- package/dist/lib/node/chunk-7LVBFGKQ.cjs.map +7 -0
- package/dist/lib/node/{chunk-RUA5KXVW.cjs → chunk-OIFPM5ZW.cjs} +7 -7
- package/dist/lib/node/chunk-OIFPM5ZW.cjs.map +7 -0
- package/dist/lib/node/{chunk-NFO3ADQC.cjs → chunk-TREVKZCJ.cjs} +21 -12
- package/dist/lib/node/chunk-TREVKZCJ.cjs.map +7 -0
- package/dist/lib/node/{meta.cjs → chunk-UHIGZJQL.cjs} +13 -8
- package/dist/lib/node/chunk-UHIGZJQL.cjs.map +7 -0
- package/dist/lib/node/chunk-XPC4JOPP.cjs +37 -0
- package/dist/lib/node/chunk-XPC4JOPP.cjs.map +7 -0
- package/dist/lib/node/client-2RQATBB6.cjs +50 -0
- package/dist/lib/node/client-2RQATBB6.cjs.map +7 -0
- package/dist/lib/node/index.cjs +80 -359
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-RIHCW2KJ.cjs +271 -0
- package/dist/lib/node/intent-resolver-RIHCW2KJ.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-context-TD6VGBVA.cjs +48 -0
- package/dist/lib/node/react-context-TD6VGBVA.cjs.map +7 -0
- package/dist/lib/node/react-surface-IY7GXEGU.cjs +74 -0
- package/dist/lib/node/react-surface-IY7GXEGU.cjs.map +7 -0
- package/dist/lib/node/schema-JXJS75HQ.cjs +39 -0
- package/dist/lib/node/schema-JXJS75HQ.cjs.map +7 -0
- package/dist/lib/node/types.cjs +4 -6
- package/dist/lib/node/types.cjs.map +2 -2
- package/dist/lib/node-esm/app-graph-builder-TDYRWNI7.mjs +45 -0
- package/dist/lib/node-esm/app-graph-builder-TDYRWNI7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CRF22MJJ.mjs +272 -0
- package/dist/lib/node-esm/chunk-CRF22MJJ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-GMGRQ5Q7.mjs → chunk-HO7WDE7C.mjs} +3 -3
- package/dist/lib/node-esm/chunk-HO7WDE7C.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-TI4GNGMM.mjs → chunk-QJMF2MWP.mjs} +17 -7
- package/dist/lib/node-esm/chunk-QJMF2MWP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QR72BXJK.mjs +19 -0
- package/dist/lib/node-esm/chunk-QR72BXJK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-T35SFKK3.mjs +17 -0
- package/dist/lib/node-esm/chunk-T35SFKK3.mjs.map +7 -0
- package/dist/lib/node-esm/client-36DKBSB7.mjs +37 -0
- package/dist/lib/node-esm/client-36DKBSB7.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +83 -370
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-WWTVE6T6.mjs +264 -0
- package/dist/lib/node-esm/intent-resolver-WWTVE6T6.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-context-ZOGDOWJ2.mjs +25 -0
- package/dist/lib/node-esm/react-context-ZOGDOWJ2.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-F3PDFJMV.mjs +58 -0
- package/dist/lib/node-esm/react-surface-F3PDFJMV.mjs.map +7 -0
- package/dist/lib/node-esm/schema-XM4HBLIX.mjs +24 -0
- package/dist/lib/node-esm/schema-XM4HBLIX.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +4 -6
- package/dist/types/src/ClientPlugin.d.ts +2 -3
- package/dist/types/src/ClientPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +7 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/client.d.ts +9 -0
- package/dist/types/src/capabilities/client.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +195 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +9 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context.d.ts +8 -0
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +7 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/schema.d.ts +4 -0
- package/dist/types/src/capabilities/schema.d.ts.map +1 -0
- package/dist/types/src/components/IdentityDialog.d.ts +1 -2
- package/dist/types/src/components/IdentityDialog.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +1 -2
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/ManageCredentialsDialog.d.ts +3 -0
- package/dist/types/src/components/ManageCredentialsDialog.d.ts.map +1 -0
- package/dist/types/src/components/ManageCredentialsDialog.stories.d.ts +8 -0
- package/dist/types/src/components/ManageCredentialsDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/RecoveryCodeDialog.d.ts +1 -2
- package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +1 -1
- package/dist/types/src/components/RecoverySetupDialog.d.ts +3 -0
- package/dist/types/src/components/RecoverySetupDialog.d.ts.map +1 -0
- package/dist/types/src/components/RecoverySetupDialog.stories.d.ts +8 -0
- package/dist/types/src/components/RecoverySetupDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +7 -0
- package/dist/types/src/events.d.ts.map +1 -0
- 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 +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +7 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +22 -18
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -24
- package/src/ClientPlugin.ts +64 -0
- package/src/capabilities/app-graph-builder.ts +39 -0
- package/src/capabilities/capabilities.ts +14 -0
- package/src/capabilities/client.ts +40 -0
- package/src/capabilities/index.ts +14 -0
- package/src/capabilities/intent-resolver.ts +198 -0
- package/src/capabilities/react-context.tsx +20 -0
- package/src/capabilities/react-surface.tsx +59 -0
- package/src/capabilities/schema.ts +26 -0
- package/src/components/IdentityDialog.tsx +15 -3
- package/src/components/JoinDialog.tsx +1 -1
- package/src/components/ManageCredentialsDialog.stories.tsx +57 -0
- package/src/components/ManageCredentialsDialog.tsx +64 -0
- package/src/components/RecoveryCodeDialog.stories.tsx +5 -5
- package/src/components/RecoveryCodeDialog.tsx +2 -1
- package/src/components/RecoverySetupDialog.stories.tsx +77 -0
- package/src/components/RecoverySetupDialog.tsx +52 -0
- package/src/components/index.ts +1 -0
- package/src/events.ts +14 -0
- package/src/index.ts +4 -4
- package/src/meta.ts +1 -1
- package/src/translations.ts +10 -1
- package/src/types.ts +16 -32
- package/dist/lib/browser/chunk-52IJQ35F.mjs.map +0 -7
- package/dist/lib/browser/chunk-X4QUPYC6.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/lib/node/chunk-NFO3ADQC.cjs.map +0 -7
- package/dist/lib/node/chunk-RUA5KXVW.cjs.map +0 -7
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-GMGRQ5Q7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TI4GNGMM.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -10
- package/dist/lib/node-esm/meta.mjs.map +0 -7
- package/src/ClientPlugin.tsx +0 -227
|
@@ -9,6 +9,7 @@ import { useClient } from '@dxos/react-client';
|
|
|
9
9
|
import { Clipboard, Dialog } from '@dxos/react-ui';
|
|
10
10
|
import { IdentityPanel, type IdentityPanelProps } from '@dxos/shell/react';
|
|
11
11
|
|
|
12
|
+
import { MANAGE_CREDENTIALS_DIALOG } from './ManageCredentialsDialog';
|
|
12
13
|
import { CLIENT_PLUGIN } from '../meta';
|
|
13
14
|
import { ClientAction } from '../types';
|
|
14
15
|
|
|
@@ -21,9 +22,9 @@ export const IdentityDialog = (props: IdentityPanelProps) => {
|
|
|
21
22
|
const handleDone = useCallback(
|
|
22
23
|
() =>
|
|
23
24
|
dispatch(
|
|
24
|
-
createIntent(LayoutAction.
|
|
25
|
-
|
|
26
|
-
state: false,
|
|
25
|
+
createIntent(LayoutAction.UpdateDialog, {
|
|
26
|
+
part: 'dialog',
|
|
27
|
+
options: { state: false },
|
|
27
28
|
}),
|
|
28
29
|
),
|
|
29
30
|
[dispatch],
|
|
@@ -44,6 +45,16 @@ export const IdentityDialog = (props: IdentityPanelProps) => {
|
|
|
44
45
|
await dispatch(createIntent(ClientAction.ResetStorage, { target: 'deviceInvitation' }));
|
|
45
46
|
}, [dispatch]);
|
|
46
47
|
|
|
48
|
+
const handleManageCredentials = useCallback(async () => {
|
|
49
|
+
await dispatch(
|
|
50
|
+
createIntent(LayoutAction.UpdateDialog, {
|
|
51
|
+
part: 'dialog',
|
|
52
|
+
subject: MANAGE_CREDENTIALS_DIALOG,
|
|
53
|
+
options: { state: true, blockAlign: 'start' },
|
|
54
|
+
}),
|
|
55
|
+
);
|
|
56
|
+
}, [dispatch]);
|
|
57
|
+
|
|
47
58
|
return (
|
|
48
59
|
<Dialog.Content>
|
|
49
60
|
<Clipboard.Provider>
|
|
@@ -54,6 +65,7 @@ export const IdentityDialog = (props: IdentityPanelProps) => {
|
|
|
54
65
|
onResetStorage={handleResetStorage}
|
|
55
66
|
onRecover={handleRecover}
|
|
56
67
|
onJoinNewIdentity={handleJoinNewIdentity}
|
|
68
|
+
onManageCredentials={handleManageCredentials}
|
|
57
69
|
/>
|
|
58
70
|
</Clipboard.Provider>
|
|
59
71
|
</Dialog.Content>
|
|
@@ -24,7 +24,7 @@ export const JoinDialog = (props: JoinPanelProps) => {
|
|
|
24
24
|
async (result: InvitationResult | null) => {
|
|
25
25
|
if (result?.identityKey) {
|
|
26
26
|
await Promise.all([
|
|
27
|
-
dispatch(createIntent(LayoutAction.
|
|
27
|
+
dispatch(createIntent(LayoutAction.UpdateDialog, { part: 'dialog', options: { state: false } })),
|
|
28
28
|
dispatch(
|
|
29
29
|
createIntent(ObservabilityAction.SendEvent, {
|
|
30
30
|
name: props.initialDisposition === 'recover-identity' ? 'identity.recover' : 'identity.join',
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
import { IntentPlugin } from '@dxos/app-framework';
|
|
11
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
+
import { AlertDialog } from '@dxos/react-ui';
|
|
13
|
+
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
14
|
+
|
|
15
|
+
import { ManageCredentialsDialog } from './ManageCredentialsDialog';
|
|
16
|
+
import { ClientPlugin } from '../ClientPlugin';
|
|
17
|
+
import translations from '../translations';
|
|
18
|
+
|
|
19
|
+
const Render = () => {
|
|
20
|
+
return (
|
|
21
|
+
<AlertDialog.Root open>
|
|
22
|
+
<AlertDialog.Overlay>
|
|
23
|
+
<ManageCredentialsDialog />
|
|
24
|
+
</AlertDialog.Overlay>
|
|
25
|
+
</AlertDialog.Root>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const meta: Meta = {
|
|
30
|
+
title: 'plugins/plugin-client/ManageCredentialsDialog',
|
|
31
|
+
component: ManageCredentialsDialog,
|
|
32
|
+
render: Render,
|
|
33
|
+
decorators: [
|
|
34
|
+
withPluginManager({
|
|
35
|
+
plugins: [
|
|
36
|
+
IntentPlugin(),
|
|
37
|
+
ClientPlugin({
|
|
38
|
+
onClientInitialized: async (_, client) => {
|
|
39
|
+
await client.halo.createIdentity();
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
}),
|
|
44
|
+
withTheme,
|
|
45
|
+
withLayout({ tooltips: true }),
|
|
46
|
+
],
|
|
47
|
+
parameters: {
|
|
48
|
+
layout: 'fullscreen',
|
|
49
|
+
translations,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default meta;
|
|
54
|
+
|
|
55
|
+
type Story = StoryObj<typeof ManageCredentialsDialog>;
|
|
56
|
+
|
|
57
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Receipt, Key } from '@phosphor-icons/react';
|
|
6
|
+
import React, { useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
9
|
+
import { useCredentials } from '@dxos/react-client/halo';
|
|
10
|
+
import { Dialog, Icon, List, ListItem, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { BifurcatedAction, type ActionMenuItem } from '@dxos/shell/react';
|
|
12
|
+
|
|
13
|
+
import { CLIENT_PLUGIN } from '../meta';
|
|
14
|
+
import { ClientAction } from '../types';
|
|
15
|
+
|
|
16
|
+
export const MANAGE_CREDENTIALS_DIALOG = `${CLIENT_PLUGIN}/ManageCredentialsDialog`;
|
|
17
|
+
|
|
18
|
+
// TODO(wittjosiah): Factor panel out to @dxos/shell.
|
|
19
|
+
export const ManageCredentialsDialog = () => {
|
|
20
|
+
const { t } = useTranslation(CLIENT_PLUGIN);
|
|
21
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
22
|
+
const credentials = useCredentials();
|
|
23
|
+
const recoveryCredentials = credentials.filter(
|
|
24
|
+
(credential) => credential.subject.assertion['@type'] === 'dxos.halo.credentials.IdentityRecovery',
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// TODO(wittjosiah): Reconsile w/ RecoverySetupDialog actions.
|
|
28
|
+
const actions: Record<string, ActionMenuItem> = useMemo(
|
|
29
|
+
() => ({
|
|
30
|
+
createPasskey: {
|
|
31
|
+
label: t('create passkey label'),
|
|
32
|
+
description: t('create passkey description'),
|
|
33
|
+
// TODO(wittjosiah): Ideally this would be a `user-key` icon.
|
|
34
|
+
icon: Key,
|
|
35
|
+
onClick: () => dispatch(createIntent(ClientAction.CreatePasskey)),
|
|
36
|
+
},
|
|
37
|
+
createRecoveryCode: {
|
|
38
|
+
label: t('create recovery code label'),
|
|
39
|
+
description: t('create recovery code description'),
|
|
40
|
+
icon: Receipt,
|
|
41
|
+
onClick: () => dispatch(createIntent(ClientAction.CreateRecoveryCode)),
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
[t],
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Dialog.Content classNames='bs-content min-bs-[15rem] max-bs-full md:max-is-[25rem] overflow-hidden'>
|
|
49
|
+
<Dialog.Title>{t('manage credentials dialog title')}</Dialog.Title>
|
|
50
|
+
<List classNames='py-4'>
|
|
51
|
+
{recoveryCredentials.map((credential) => (
|
|
52
|
+
<ListItem.Root key={credential.id?.toHex()}>
|
|
53
|
+
<ListItem.Endcap>
|
|
54
|
+
<Icon icon='ph--key--regular' size={5} />
|
|
55
|
+
</ListItem.Endcap>
|
|
56
|
+
<ListItem.Heading>{credential.issuanceDate.toLocaleString()}</ListItem.Heading>
|
|
57
|
+
</ListItem.Root>
|
|
58
|
+
))}
|
|
59
|
+
</List>
|
|
60
|
+
<div className='grow' />
|
|
61
|
+
<BifurcatedAction actions={actions} />
|
|
62
|
+
</Dialog.Content>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
@@ -17,16 +17,16 @@ import translations from '../translations';
|
|
|
17
17
|
|
|
18
18
|
const Render = () => {
|
|
19
19
|
const client = useClient();
|
|
20
|
-
const [
|
|
20
|
+
const [recoveryCode, setRecoveryCode] = useState<string>();
|
|
21
21
|
useAsyncEffect(async () => {
|
|
22
|
-
const {
|
|
23
|
-
|
|
22
|
+
const { recoveryCode } = (await client.services.services.IdentityService?.createRecoveryCredential({})) ?? {};
|
|
23
|
+
setRecoveryCode(recoveryCode);
|
|
24
24
|
}, [client]);
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
|
-
<AlertDialog.Root open={!!
|
|
27
|
+
<AlertDialog.Root open={!!recoveryCode}>
|
|
28
28
|
<AlertDialog.Overlay>
|
|
29
|
-
<RecoveryCodeDialog code={
|
|
29
|
+
<RecoveryCodeDialog code={recoveryCode ?? ''} />
|
|
30
30
|
</AlertDialog.Overlay>
|
|
31
31
|
</AlertDialog.Root>
|
|
32
32
|
);
|
|
@@ -14,6 +14,7 @@ export type RecoveryCodeDialogProps = {
|
|
|
14
14
|
code: string;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
// TODO(wittjosiah): Factor panel out to @dxos/shell.
|
|
17
18
|
export const RecoveryCodeDialog = ({ code }: RecoveryCodeDialogProps) => {
|
|
18
19
|
const { t } = useTranslation(CLIENT_PLUGIN);
|
|
19
20
|
const [confirmation, setConfirmation] = useState(false);
|
|
@@ -59,7 +60,7 @@ const Code = ({ code }: { code: string }) => {
|
|
|
59
60
|
<Clipboard.IconButton value={code} classNames='absolute top-2 right-2 invisible group-hover:visible' />
|
|
60
61
|
<div className='grid grid-cols-4'>
|
|
61
62
|
{words.map((word, i) => (
|
|
62
|
-
<div key={i} className='flex items-center p-2 gap-2
|
|
63
|
+
<div key={i} className='flex items-center p-2 gap-2'>
|
|
63
64
|
<div className='w-4 text-xs text-center text-subdued'>{i + 1}</div>
|
|
64
65
|
<div className='text-sm'>{word}</div>
|
|
65
66
|
</div>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
import { createResolver, contributes, Capabilities, IntentPlugin, LayoutAction } from '@dxos/app-framework';
|
|
11
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
+
import { S } from '@dxos/echo-schema';
|
|
13
|
+
import { create } from '@dxos/live-object';
|
|
14
|
+
import { AlertDialog } from '@dxos/react-ui';
|
|
15
|
+
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
16
|
+
|
|
17
|
+
import { RECOVER_CODE_DIALOG, RecoveryCodeDialog } from './RecoveryCodeDialog';
|
|
18
|
+
import { RecoverySetupDialog } from './RecoverySetupDialog';
|
|
19
|
+
import { ClientPlugin } from '../ClientPlugin';
|
|
20
|
+
import translations from '../translations';
|
|
21
|
+
|
|
22
|
+
const state = create<{ recoveryCode?: string }>({});
|
|
23
|
+
|
|
24
|
+
const Render = () => {
|
|
25
|
+
return (
|
|
26
|
+
<AlertDialog.Root open>
|
|
27
|
+
<AlertDialog.Overlay>
|
|
28
|
+
{state.recoveryCode ? <RecoveryCodeDialog code={state.recoveryCode} /> : <RecoverySetupDialog />}
|
|
29
|
+
</AlertDialog.Overlay>
|
|
30
|
+
</AlertDialog.Root>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const meta: Meta = {
|
|
35
|
+
title: 'plugins/plugin-client/RecoverySetupDialog',
|
|
36
|
+
component: RecoverySetupDialog,
|
|
37
|
+
render: Render,
|
|
38
|
+
decorators: [
|
|
39
|
+
withPluginManager({
|
|
40
|
+
plugins: [
|
|
41
|
+
IntentPlugin(),
|
|
42
|
+
ClientPlugin({
|
|
43
|
+
onClientInitialized: async (_, client) => {
|
|
44
|
+
await client.halo.createIdentity();
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
],
|
|
48
|
+
capabilities: [
|
|
49
|
+
contributes(
|
|
50
|
+
Capabilities.IntentResolver,
|
|
51
|
+
createResolver({
|
|
52
|
+
intent: LayoutAction.UpdateLayout,
|
|
53
|
+
filter: (data): data is S.Schema.Type<typeof LayoutAction.UpdateDialog.fields.input> =>
|
|
54
|
+
S.is(LayoutAction.UpdateDialog.fields.input)(data),
|
|
55
|
+
resolve: (data) => {
|
|
56
|
+
if (data.subject === RECOVER_CODE_DIALOG) {
|
|
57
|
+
state.recoveryCode = data.options?.props?.code;
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
),
|
|
62
|
+
],
|
|
63
|
+
}),
|
|
64
|
+
withTheme,
|
|
65
|
+
withLayout({ tooltips: true }),
|
|
66
|
+
],
|
|
67
|
+
parameters: {
|
|
68
|
+
layout: 'fullscreen',
|
|
69
|
+
translations,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default meta;
|
|
74
|
+
|
|
75
|
+
type Story = StoryObj<typeof RecoverySetupDialog>;
|
|
76
|
+
|
|
77
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Key, Receipt } from '@phosphor-icons/react';
|
|
6
|
+
import React, { useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';
|
|
9
|
+
import { AlertDialog, useTranslation } from '@dxos/react-ui';
|
|
10
|
+
import { type ActionMenuItem, BifurcatedAction } from '@dxos/shell/react';
|
|
11
|
+
|
|
12
|
+
import { CLIENT_PLUGIN } from '../meta';
|
|
13
|
+
import { ClientAction } from '../types';
|
|
14
|
+
|
|
15
|
+
export const RECOVER_SETUP_DIALOG = `${CLIENT_PLUGIN}/RecoverySetupDialog`;
|
|
16
|
+
|
|
17
|
+
// TODO(wittjosiah): Factor panel out to @dxos/shell.
|
|
18
|
+
export const RecoverySetupDialog = () => {
|
|
19
|
+
const { t } = useTranslation(CLIENT_PLUGIN);
|
|
20
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
21
|
+
|
|
22
|
+
const actions: Record<string, ActionMenuItem> = useMemo(
|
|
23
|
+
() => ({
|
|
24
|
+
createPasskey: {
|
|
25
|
+
label: t('create passkey label'),
|
|
26
|
+
description: t('create passkey description'),
|
|
27
|
+
// TODO(wittjosiah): Ideally this would be a `user-key` icon.
|
|
28
|
+
icon: Key,
|
|
29
|
+
onClick: async () => {
|
|
30
|
+
await dispatch(createIntent(ClientAction.CreatePasskey));
|
|
31
|
+
await dispatch(createIntent(LayoutAction.UpdateDialog, { part: 'dialog', options: { state: false } }));
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
createRecoveryCode: {
|
|
35
|
+
label: t('create recovery code label'),
|
|
36
|
+
description: t('create recovery code description'),
|
|
37
|
+
icon: Receipt,
|
|
38
|
+
onClick: () => dispatch(createIntent(ClientAction.CreateRecoveryCode)),
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
[t],
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<AlertDialog.Content classNames='bs-content min-bs-[15rem] max-bs-full md:max-is-[25rem] overflow-hidden'>
|
|
46
|
+
<AlertDialog.Title>{t('recovery setup dialog title')}</AlertDialog.Title>
|
|
47
|
+
<p className='py-4'>{t('recovery setup dialog description')}</p>
|
|
48
|
+
<div className='grow' />
|
|
49
|
+
<BifurcatedAction actions={actions} />
|
|
50
|
+
</AlertDialog.Content>
|
|
51
|
+
);
|
|
52
|
+
};
|
package/src/components/index.ts
CHANGED
package/src/events.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { defineEvent } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { CLIENT_PLUGIN } from './meta';
|
|
8
|
+
|
|
9
|
+
export namespace ClientEvents {
|
|
10
|
+
export const ClientReady = defineEvent(`${CLIENT_PLUGIN}/event/client-ready`);
|
|
11
|
+
export const SetupSchema = defineEvent(`${CLIENT_PLUGIN}/event/setup-schema`);
|
|
12
|
+
export const IdentityCreated = defineEvent(`${CLIENT_PLUGIN}/event/identity-created`);
|
|
13
|
+
export const SpacesReady = defineEvent(`${CLIENT_PLUGIN}/event/spaces-ready`);
|
|
14
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { ClientPlugin } from './ClientPlugin';
|
|
6
|
-
|
|
7
|
-
export default ClientPlugin;
|
|
8
|
-
|
|
9
5
|
export * from './ClientPlugin';
|
|
6
|
+
export * from './meta';
|
|
7
|
+
|
|
8
|
+
export { ClientCapabilities } from './capabilities';
|
|
9
|
+
export { ClientEvents } from './events';
|
package/src/meta.ts
CHANGED
package/src/translations.ts
CHANGED
|
@@ -9,7 +9,16 @@ export default [
|
|
|
9
9
|
'en-US': {
|
|
10
10
|
[CLIENT_PLUGIN]: {
|
|
11
11
|
'open shell label': 'Open HALO',
|
|
12
|
-
'
|
|
12
|
+
'manage credentials dialog title': 'Manage Account Recovery',
|
|
13
|
+
'recovery setup dialog title': 'Account Recovery',
|
|
14
|
+
'recovery setup dialog description':
|
|
15
|
+
'In order to recover your account you need to register a recovery credential. Passkeys are the recommended way to do this, they can be stored in your browser or in a password manager.',
|
|
16
|
+
'create passkey label': 'Create Passkey',
|
|
17
|
+
'create passkey description':
|
|
18
|
+
'A passkey is a secure and easy to use credential that can be used to recover your account.',
|
|
19
|
+
'create recovery code label': 'Create Recovery Code',
|
|
20
|
+
'create recovery code description': 'A recovery code is 12 word phrase representing a private key.',
|
|
21
|
+
'recovery code dialog title': 'Recovery Code',
|
|
13
22
|
'recovery code dialog description':
|
|
14
23
|
'This is your identity recovery code, store it in a safe place. You can use it to recover your identity if you ever lose access to your devices.',
|
|
15
24
|
'recovery code dialog warning 1': 'NOTE: This code will not be displayed again.',
|
package/src/types.ts
CHANGED
|
@@ -2,15 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
type GraphBuilderProvides,
|
|
7
|
-
type IntentResolverProvides,
|
|
8
|
-
type Plugin,
|
|
9
|
-
type SurfaceProvides,
|
|
10
|
-
type TranslationsProvides,
|
|
11
|
-
} from '@dxos/app-framework';
|
|
5
|
+
import { type PluginsContext } from '@dxos/app-framework';
|
|
12
6
|
import { S } from '@dxos/echo-schema';
|
|
13
|
-
import { Client, PublicKey, type ClientOptions } from '@dxos/react-client';
|
|
7
|
+
import { type Client, PublicKey, type ClientOptions } from '@dxos/react-client';
|
|
8
|
+
import { type MaybePromise } from '@dxos/util';
|
|
14
9
|
|
|
15
10
|
import { CLIENT_PLUGIN } from './meta';
|
|
16
11
|
|
|
@@ -38,7 +33,7 @@ export namespace ClientAction {
|
|
|
38
33
|
|
|
39
34
|
export class JoinIdentity extends S.TaggedClass<JoinIdentity>()(`${CLIENT_ACTION}/join-identity`, {
|
|
40
35
|
input: S.Struct({
|
|
41
|
-
invitationCode: S.String,
|
|
36
|
+
invitationCode: S.optional(S.String),
|
|
42
37
|
}),
|
|
43
38
|
output: S.Void,
|
|
44
39
|
}) {}
|
|
@@ -69,14 +64,19 @@ export namespace ClientAction {
|
|
|
69
64
|
input: S.Void,
|
|
70
65
|
output: S.Void,
|
|
71
66
|
}) {}
|
|
67
|
+
|
|
68
|
+
export class CreatePasskey extends S.TaggedClass<CreatePasskey>()(`${CLIENT_ACTION}/create-passkey`, {
|
|
69
|
+
input: S.Void,
|
|
70
|
+
output: S.Void,
|
|
71
|
+
}) {}
|
|
72
|
+
|
|
73
|
+
export class RedeemPasskey extends S.TaggedClass<RedeemPasskey>()(`${CLIENT_ACTION}/redeem-passkey`, {
|
|
74
|
+
input: S.Void,
|
|
75
|
+
output: S.Void,
|
|
76
|
+
}) {}
|
|
72
77
|
}
|
|
73
78
|
|
|
74
79
|
export type ClientPluginOptions = ClientOptions & {
|
|
75
|
-
/**
|
|
76
|
-
* Used to track app-specific state in spaces.
|
|
77
|
-
*/
|
|
78
|
-
appKey: string;
|
|
79
|
-
|
|
80
80
|
/**
|
|
81
81
|
* Base URL for the invitation link.
|
|
82
82
|
*/
|
|
@@ -90,26 +90,10 @@ export type ClientPluginOptions = ClientOptions & {
|
|
|
90
90
|
/**
|
|
91
91
|
* Run after the client has been initialized.
|
|
92
92
|
*/
|
|
93
|
-
onClientInitialized?: (client: Client) =>
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Run after the identity has been successfully initialized.
|
|
97
|
-
* Run with client during plugin ready phase.
|
|
98
|
-
*/
|
|
99
|
-
onReady?: (client: Client, plugins: Plugin[]) => Promise<void>;
|
|
93
|
+
onClientInitialized?: (context: PluginsContext, client: Client) => MaybePromise<void>;
|
|
100
94
|
|
|
101
95
|
/**
|
|
102
96
|
* Called when the client is reset.
|
|
103
97
|
*/
|
|
104
|
-
onReset?: (params: { target?: string }) =>
|
|
98
|
+
onReset?: (params: { target?: string }) => MaybePromise<void>;
|
|
105
99
|
};
|
|
106
|
-
|
|
107
|
-
export type ClientPluginProvides = IntentResolverProvides &
|
|
108
|
-
GraphBuilderProvides &
|
|
109
|
-
SurfaceProvides &
|
|
110
|
-
TranslationsProvides & {
|
|
111
|
-
client: Client;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export const parseClientPlugin = (plugin?: Plugin) =>
|
|
115
|
-
(plugin?.provides as any).client instanceof Client ? (plugin as Plugin<ClientPluginProvides>) : undefined;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport {\n type GraphBuilderProvides,\n type IntentResolverProvides,\n type Plugin,\n type SurfaceProvides,\n type TranslationsProvides,\n} from '@dxos/app-framework';\nimport { S } from '@dxos/echo-schema';\nimport { Client, PublicKey, type ClientOptions } from '@dxos/react-client';\n\nimport { CLIENT_PLUGIN } from './meta';\n\n// TODO(wittjosiah): Factor out. Generate?\nconst IdentitySchema = S.Struct({\n identityKey: S.instanceOf(PublicKey),\n spaceKey: S.optional(S.instanceOf(PublicKey)),\n profile: S.optional(\n S.Struct({\n displayName: S.optional(S.String),\n avatarCid: S.optional(S.String),\n data: S.optional(S.Record({ key: S.String, value: S.Any })),\n }),\n ),\n});\n\nconst CLIENT_ACTION = `${CLIENT_PLUGIN}/action`;\nexport namespace ClientAction {\n export class CreateIdentity extends S.TaggedClass<CreateIdentity>()(`${CLIENT_ACTION}/create-identity`, {\n input: S.Struct({\n displayName: S.optional(S.String),\n }),\n output: IdentitySchema,\n }) {}\n\n export class JoinIdentity extends S.TaggedClass<JoinIdentity>()(`${CLIENT_ACTION}/join-identity`, {\n input: S.Struct({\n invitationCode: S.String,\n }),\n output: S.Void,\n }) {}\n\n export class ShareIdentity extends S.TaggedClass<ShareIdentity>()(`${CLIENT_ACTION}/share-identity`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class RecoverIdentity extends S.TaggedClass<RecoverIdentity>()(`${CLIENT_ACTION}/recover-identity`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class ResetStorage extends S.TaggedClass<ResetStorage>()(`${CLIENT_ACTION}/reset-storage`, {\n input: S.Struct({\n target: S.optional(S.String),\n }),\n output: S.Void,\n }) {}\n\n export class CreateAgent extends S.TaggedClass<CreateAgent>()(`${CLIENT_ACTION}/create-agent`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class CreateRecoveryCode extends S.TaggedClass<CreateRecoveryCode>()(`${CLIENT_ACTION}/create-recovery-code`, {\n input: S.Void,\n output: S.Void,\n }) {}\n}\n\nexport type ClientPluginOptions = ClientOptions & {\n /**\n * Used to track app-specific state in spaces.\n */\n appKey: string;\n\n /**\n * Base URL for the invitation link.\n */\n invitationUrl?: string;\n\n /**\n * Query parameter for the invitation code.\n */\n invitationParam?: string;\n\n /**\n * Run after the client has been initialized.\n */\n onClientInitialized?: (client: Client) => Promise<void>;\n\n /**\n * Run after the identity has been successfully initialized.\n * Run with client during plugin ready phase.\n */\n onReady?: (client: Client, plugins: Plugin[]) => Promise<void>;\n\n /**\n * Called when the client is reset.\n */\n onReset?: (params: { target?: string }) => Promise<void>;\n};\n\nexport type ClientPluginProvides = IntentResolverProvides &\n GraphBuilderProvides &\n SurfaceProvides &\n TranslationsProvides & {\n client: Client;\n };\n\nexport const parseClientPlugin = (plugin?: Plugin) =>\n (plugin?.provides as any).client instanceof Client ? (plugin as Plugin<ClientPluginProvides>) : undefined;\n"],
|
|
5
|
-
"mappings": ";;;;;AAWA,SAASA,SAAS;AAClB,SAASC,QAAQC,iBAAqC;AAKtD,IAAMC,iBAAiBC,EAAEC,OAAO;EAC9BC,aAAaF,EAAEG,WAAWC,SAAAA;EAC1BC,UAAUL,EAAEM,SAASN,EAAEG,WAAWC,SAAAA,CAAAA;EAClCG,SAASP,EAAEM,SACTN,EAAEC,OAAO;IACPO,aAAaR,EAAEM,SAASN,EAAES,MAAM;IAChCC,WAAWV,EAAEM,SAASN,EAAES,MAAM;IAC9BE,MAAMX,EAAEM,SAASN,EAAEY,OAAO;MAAEC,KAAKb,EAAES;MAAQK,OAAOd,EAAEe;IAAI,CAAA,CAAA;EAC1D,CAAA,CAAA;AAEJ,CAAA;AAEA,IAAMC,gBAAgB,GAAGC,aAAAA;;UACRC,eAAAA;EACR,MAAMC,uBAAuBnB,EAAEoB,YAAW,EAAmB,GAAGJ,aAAAA,oBAAiC;IACtGK,OAAOrB,EAAEC,OAAO;MACdO,aAAaR,EAAEM,SAASN,EAAES,MAAM;IAClC,CAAA;IACAa,QAAQvB;EACV,CAAA,EAAA;EAAI;gBALSoB,iBAAAA;EAON,MAAMI,qBAAqBvB,EAAEoB,YAAW,EAAiB,GAAGJ,aAAAA,kBAA+B;IAChGK,OAAOrB,EAAEC,OAAO;MACduB,gBAAgBxB,EAAES;IACpB,CAAA;IACAa,QAAQtB,EAAEyB;EACZ,CAAA,EAAA;EAAI;gBALSF,eAAAA;EAON,MAAMG,sBAAsB1B,EAAEoB,YAAW,EAAkB,GAAGJ,aAAAA,mBAAgC;IACnGK,OAAOrB,EAAEyB;IACTH,QAAQtB,EAAEyB;EACZ,CAAA,EAAA;EAAI;gBAHSC,gBAAAA;EAKN,MAAMC,wBAAwB3B,EAAEoB,YAAW,EAAoB,GAAGJ,aAAAA,qBAAkC;IACzGK,OAAOrB,EAAEyB;IACTH,QAAQtB,EAAEyB;EACZ,CAAA,EAAA;EAAI;gBAHSE,kBAAAA;EAKN,MAAMC,qBAAqB5B,EAAEoB,YAAW,EAAiB,GAAGJ,aAAAA,kBAA+B;IAChGK,OAAOrB,EAAEC,OAAO;MACd4B,QAAQ7B,EAAEM,SAASN,EAAES,MAAM;IAC7B,CAAA;IACAa,QAAQtB,EAAEyB;EACZ,CAAA,EAAA;EAAI;gBALSG,eAAAA;EAON,MAAME,oBAAoB9B,EAAEoB,YAAW,EAAgB,GAAGJ,aAAAA,iBAA8B;IAC7FK,OAAOrB,EAAEyB;IACTH,QAAQtB,EAAEyB;EACZ,CAAA,EAAA;EAAI;gBAHSK,cAAAA;EAKN,MAAMC,2BAA2B/B,EAAEoB,YAAW,EAAuB,GAAGJ,aAAAA,yBAAsC;IACnHK,OAAOrB,EAAEyB;IACTH,QAAQtB,EAAEyB;EACZ,CAAA,EAAA;EAAI;gBAHSM,qBAAAA;AAIf,GAzCiBb,iBAAAA,eAAAA,CAAAA,EAAAA;AAmFV,IAAMc,oBAAoB,CAACC,YAC/BA,QAAQC,UAAiBC,kBAAkBC,SAAUH,SAA0CI;",
|
|
6
|
-
"names": ["S", "Client", "PublicKey", "IdentitySchema", "S", "Struct", "identityKey", "instanceOf", "PublicKey", "spaceKey", "optional", "profile", "displayName", "String", "avatarCid", "data", "Record", "key", "value", "Any", "CLIENT_ACTION", "CLIENT_PLUGIN", "ClientAction", "CreateIdentity", "TaggedClass", "input", "output", "JoinIdentity", "invitationCode", "Void", "ShareIdentity", "RecoverIdentity", "ResetStorage", "target", "CreateAgent", "CreateRecoveryCode", "parseClientPlugin", "plugin", "provides", "client", "Client", "undefined"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const CLIENT_PLUGIN = 'dxos.org/plugin/client';\n\nexport default {\n id: CLIENT_PLUGIN,\n name: 'Client',\n} satisfies PluginMeta;\n"],
|
|
5
|
-
"mappings": ";AAMO,IAAMA,gBAAgB;AAE7B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;",
|
|
6
|
-
"names": ["CLIENT_PLUGIN", "id", "name"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport {\n type GraphBuilderProvides,\n type IntentResolverProvides,\n type Plugin,\n type SurfaceProvides,\n type TranslationsProvides,\n} from '@dxos/app-framework';\nimport { S } from '@dxos/echo-schema';\nimport { Client, PublicKey, type ClientOptions } from '@dxos/react-client';\n\nimport { CLIENT_PLUGIN } from './meta';\n\n// TODO(wittjosiah): Factor out. Generate?\nconst IdentitySchema = S.Struct({\n identityKey: S.instanceOf(PublicKey),\n spaceKey: S.optional(S.instanceOf(PublicKey)),\n profile: S.optional(\n S.Struct({\n displayName: S.optional(S.String),\n avatarCid: S.optional(S.String),\n data: S.optional(S.Record({ key: S.String, value: S.Any })),\n }),\n ),\n});\n\nconst CLIENT_ACTION = `${CLIENT_PLUGIN}/action`;\nexport namespace ClientAction {\n export class CreateIdentity extends S.TaggedClass<CreateIdentity>()(`${CLIENT_ACTION}/create-identity`, {\n input: S.Struct({\n displayName: S.optional(S.String),\n }),\n output: IdentitySchema,\n }) {}\n\n export class JoinIdentity extends S.TaggedClass<JoinIdentity>()(`${CLIENT_ACTION}/join-identity`, {\n input: S.Struct({\n invitationCode: S.String,\n }),\n output: S.Void,\n }) {}\n\n export class ShareIdentity extends S.TaggedClass<ShareIdentity>()(`${CLIENT_ACTION}/share-identity`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class RecoverIdentity extends S.TaggedClass<RecoverIdentity>()(`${CLIENT_ACTION}/recover-identity`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class ResetStorage extends S.TaggedClass<ResetStorage>()(`${CLIENT_ACTION}/reset-storage`, {\n input: S.Struct({\n target: S.optional(S.String),\n }),\n output: S.Void,\n }) {}\n\n export class CreateAgent extends S.TaggedClass<CreateAgent>()(`${CLIENT_ACTION}/create-agent`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class CreateRecoveryCode extends S.TaggedClass<CreateRecoveryCode>()(`${CLIENT_ACTION}/create-recovery-code`, {\n input: S.Void,\n output: S.Void,\n }) {}\n}\n\nexport type ClientPluginOptions = ClientOptions & {\n /**\n * Used to track app-specific state in spaces.\n */\n appKey: string;\n\n /**\n * Base URL for the invitation link.\n */\n invitationUrl?: string;\n\n /**\n * Query parameter for the invitation code.\n */\n invitationParam?: string;\n\n /**\n * Run after the client has been initialized.\n */\n onClientInitialized?: (client: Client) => Promise<void>;\n\n /**\n * Run after the identity has been successfully initialized.\n * Run with client during plugin ready phase.\n */\n onReady?: (client: Client, plugins: Plugin[]) => Promise<void>;\n\n /**\n * Called when the client is reset.\n */\n onReset?: (params: { target?: string }) => Promise<void>;\n};\n\nexport type ClientPluginProvides = IntentResolverProvides &\n GraphBuilderProvides &\n SurfaceProvides &\n TranslationsProvides & {\n client: Client;\n };\n\nexport const parseClientPlugin = (plugin?: Plugin) =>\n (plugin?.provides as any).client instanceof Client ? (plugin as Plugin<ClientPluginProvides>) : undefined;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAWA,yBAAkB;AAClB,0BAAsD;AAKtD,IAAMA,iBAAiBC,qBAAEC,OAAO;EAC9BC,aAAaF,qBAAEG,WAAWC,6BAAAA;EAC1BC,UAAUL,qBAAEM,SAASN,qBAAEG,WAAWC,6BAAAA,CAAAA;EAClCG,SAASP,qBAAEM,SACTN,qBAAEC,OAAO;IACPO,aAAaR,qBAAEM,SAASN,qBAAES,MAAM;IAChCC,WAAWV,qBAAEM,SAASN,qBAAES,MAAM;IAC9BE,MAAMX,qBAAEM,SAASN,qBAAEY,OAAO;MAAEC,KAAKb,qBAAES;MAAQK,OAAOd,qBAAEe;IAAI,CAAA,CAAA;EAC1D,CAAA,CAAA;AAEJ,CAAA;AAEA,IAAMC,gBAAgB,GAAGC,mCAAAA;;UACRC,eAAAA;EACR,MAAMC,uBAAuBnB,qBAAEoB,YAAW,EAAmB,GAAGJ,aAAAA,oBAAiC;IACtGK,OAAOrB,qBAAEC,OAAO;MACdO,aAAaR,qBAAEM,SAASN,qBAAES,MAAM;IAClC,CAAA;IACAa,QAAQvB;EACV,CAAA,EAAA;EAAI;gBALSoB,iBAAAA;EAON,MAAMI,qBAAqBvB,qBAAEoB,YAAW,EAAiB,GAAGJ,aAAAA,kBAA+B;IAChGK,OAAOrB,qBAAEC,OAAO;MACduB,gBAAgBxB,qBAAES;IACpB,CAAA;IACAa,QAAQtB,qBAAEyB;EACZ,CAAA,EAAA;EAAI;gBALSF,eAAAA;EAON,MAAMG,sBAAsB1B,qBAAEoB,YAAW,EAAkB,GAAGJ,aAAAA,mBAAgC;IACnGK,OAAOrB,qBAAEyB;IACTH,QAAQtB,qBAAEyB;EACZ,CAAA,EAAA;EAAI;gBAHSC,gBAAAA;EAKN,MAAMC,wBAAwB3B,qBAAEoB,YAAW,EAAoB,GAAGJ,aAAAA,qBAAkC;IACzGK,OAAOrB,qBAAEyB;IACTH,QAAQtB,qBAAEyB;EACZ,CAAA,EAAA;EAAI;gBAHSE,kBAAAA;EAKN,MAAMC,qBAAqB5B,qBAAEoB,YAAW,EAAiB,GAAGJ,aAAAA,kBAA+B;IAChGK,OAAOrB,qBAAEC,OAAO;MACd4B,QAAQ7B,qBAAEM,SAASN,qBAAES,MAAM;IAC7B,CAAA;IACAa,QAAQtB,qBAAEyB;EACZ,CAAA,EAAA;EAAI;gBALSG,eAAAA;EAON,MAAME,oBAAoB9B,qBAAEoB,YAAW,EAAgB,GAAGJ,aAAAA,iBAA8B;IAC7FK,OAAOrB,qBAAEyB;IACTH,QAAQtB,qBAAEyB;EACZ,CAAA,EAAA;EAAI;gBAHSK,cAAAA;EAKN,MAAMC,2BAA2B/B,qBAAEoB,YAAW,EAAuB,GAAGJ,aAAAA,yBAAsC;IACnHK,OAAOrB,qBAAEyB;IACTH,QAAQtB,qBAAEyB;EACZ,CAAA,EAAA;EAAI;gBAHSM,qBAAAA;AAIf,GAzCiBb,iBAAAA,eAAAA,CAAAA,EAAAA;AAmFV,IAAMc,oBAAoB,CAACC,YAC/BA,QAAQC,UAAiBC,kBAAkBC,6BAAUH,SAA0CI;",
|
|
6
|
-
"names": ["IdentitySchema", "S", "Struct", "identityKey", "instanceOf", "PublicKey", "spaceKey", "optional", "profile", "displayName", "String", "avatarCid", "data", "Record", "key", "value", "Any", "CLIENT_ACTION", "CLIENT_PLUGIN", "ClientAction", "CreateIdentity", "TaggedClass", "input", "output", "JoinIdentity", "invitationCode", "Void", "ShareIdentity", "RecoverIdentity", "ResetStorage", "target", "CreateAgent", "CreateRecoveryCode", "parseClientPlugin", "plugin", "provides", "client", "Client", "undefined"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const CLIENT_PLUGIN = 'dxos.org/plugin/client';\n\nexport default {\n id: CLIENT_PLUGIN,\n name: 'Client',\n} satisfies PluginMeta;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAMO,IAAMA,gBAAgB;AAE7B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;",
|
|
6
|
-
"names": ["CLIENT_PLUGIN", "id", "name"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["meta.cjs"],
|
|
4
|
-
"sourcesContent": ["import {\n CLIENT_PLUGIN,\n meta_default\n} from \"./chunk-RUA5KXVW.cjs\";\nexport {\n CLIENT_PLUGIN,\n meta_default as default\n};\n//# sourceMappingURL=meta.cjs.map\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAGO;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const CLIENT_PLUGIN = 'dxos.org/plugin/client';\n\nexport default {\n id: CLIENT_PLUGIN,\n name: 'Client',\n} satisfies PluginMeta;\n"],
|
|
5
|
-
"mappings": ";;;AAMO,IAAMA,gBAAgB;AAE7B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;",
|
|
6
|
-
"names": ["CLIENT_PLUGIN", "id", "name"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport {\n type GraphBuilderProvides,\n type IntentResolverProvides,\n type Plugin,\n type SurfaceProvides,\n type TranslationsProvides,\n} from '@dxos/app-framework';\nimport { S } from '@dxos/echo-schema';\nimport { Client, PublicKey, type ClientOptions } from '@dxos/react-client';\n\nimport { CLIENT_PLUGIN } from './meta';\n\n// TODO(wittjosiah): Factor out. Generate?\nconst IdentitySchema = S.Struct({\n identityKey: S.instanceOf(PublicKey),\n spaceKey: S.optional(S.instanceOf(PublicKey)),\n profile: S.optional(\n S.Struct({\n displayName: S.optional(S.String),\n avatarCid: S.optional(S.String),\n data: S.optional(S.Record({ key: S.String, value: S.Any })),\n }),\n ),\n});\n\nconst CLIENT_ACTION = `${CLIENT_PLUGIN}/action`;\nexport namespace ClientAction {\n export class CreateIdentity extends S.TaggedClass<CreateIdentity>()(`${CLIENT_ACTION}/create-identity`, {\n input: S.Struct({\n displayName: S.optional(S.String),\n }),\n output: IdentitySchema,\n }) {}\n\n export class JoinIdentity extends S.TaggedClass<JoinIdentity>()(`${CLIENT_ACTION}/join-identity`, {\n input: S.Struct({\n invitationCode: S.String,\n }),\n output: S.Void,\n }) {}\n\n export class ShareIdentity extends S.TaggedClass<ShareIdentity>()(`${CLIENT_ACTION}/share-identity`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class RecoverIdentity extends S.TaggedClass<RecoverIdentity>()(`${CLIENT_ACTION}/recover-identity`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class ResetStorage extends S.TaggedClass<ResetStorage>()(`${CLIENT_ACTION}/reset-storage`, {\n input: S.Struct({\n target: S.optional(S.String),\n }),\n output: S.Void,\n }) {}\n\n export class CreateAgent extends S.TaggedClass<CreateAgent>()(`${CLIENT_ACTION}/create-agent`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class CreateRecoveryCode extends S.TaggedClass<CreateRecoveryCode>()(`${CLIENT_ACTION}/create-recovery-code`, {\n input: S.Void,\n output: S.Void,\n }) {}\n}\n\nexport type ClientPluginOptions = ClientOptions & {\n /**\n * Used to track app-specific state in spaces.\n */\n appKey: string;\n\n /**\n * Base URL for the invitation link.\n */\n invitationUrl?: string;\n\n /**\n * Query parameter for the invitation code.\n */\n invitationParam?: string;\n\n /**\n * Run after the client has been initialized.\n */\n onClientInitialized?: (client: Client) => Promise<void>;\n\n /**\n * Run after the identity has been successfully initialized.\n * Run with client during plugin ready phase.\n */\n onReady?: (client: Client, plugins: Plugin[]) => Promise<void>;\n\n /**\n * Called when the client is reset.\n */\n onReset?: (params: { target?: string }) => Promise<void>;\n};\n\nexport type ClientPluginProvides = IntentResolverProvides &\n GraphBuilderProvides &\n SurfaceProvides &\n TranslationsProvides & {\n client: Client;\n };\n\nexport const parseClientPlugin = (plugin?: Plugin) =>\n (plugin?.provides as any).client instanceof Client ? (plugin as Plugin<ClientPluginProvides>) : undefined;\n"],
|
|
5
|
-
"mappings": ";;;;;;AAWA,SAASA,SAAS;AAClB,SAASC,QAAQC,iBAAqC;AAKtD,IAAMC,iBAAiBC,EAAEC,OAAO;EAC9BC,aAAaF,EAAEG,WAAWC,SAAAA;EAC1BC,UAAUL,EAAEM,SAASN,EAAEG,WAAWC,SAAAA,CAAAA;EAClCG,SAASP,EAAEM,SACTN,EAAEC,OAAO;IACPO,aAAaR,EAAEM,SAASN,EAAES,MAAM;IAChCC,WAAWV,EAAEM,SAASN,EAAES,MAAM;IAC9BE,MAAMX,EAAEM,SAASN,EAAEY,OAAO;MAAEC,KAAKb,EAAES;MAAQK,OAAOd,EAAEe;IAAI,CAAA,CAAA;EAC1D,CAAA,CAAA;AAEJ,CAAA;AAEA,IAAMC,gBAAgB,GAAGC,aAAAA;;UACRC,eAAAA;EACR,MAAMC,uBAAuBnB,EAAEoB,YAAW,EAAmB,GAAGJ,aAAAA,oBAAiC;IACtGK,OAAOrB,EAAEC,OAAO;MACdO,aAAaR,EAAEM,SAASN,EAAES,MAAM;IAClC,CAAA;IACAa,QAAQvB;EACV,CAAA,EAAA;EAAI;gBALSoB,iBAAAA;EAON,MAAMI,qBAAqBvB,EAAEoB,YAAW,EAAiB,GAAGJ,aAAAA,kBAA+B;IAChGK,OAAOrB,EAAEC,OAAO;MACduB,gBAAgBxB,EAAES;IACpB,CAAA;IACAa,QAAQtB,EAAEyB;EACZ,CAAA,EAAA;EAAI;gBALSF,eAAAA;EAON,MAAMG,sBAAsB1B,EAAEoB,YAAW,EAAkB,GAAGJ,aAAAA,mBAAgC;IACnGK,OAAOrB,EAAEyB;IACTH,QAAQtB,EAAEyB;EACZ,CAAA,EAAA;EAAI;gBAHSC,gBAAAA;EAKN,MAAMC,wBAAwB3B,EAAEoB,YAAW,EAAoB,GAAGJ,aAAAA,qBAAkC;IACzGK,OAAOrB,EAAEyB;IACTH,QAAQtB,EAAEyB;EACZ,CAAA,EAAA;EAAI;gBAHSE,kBAAAA;EAKN,MAAMC,qBAAqB5B,EAAEoB,YAAW,EAAiB,GAAGJ,aAAAA,kBAA+B;IAChGK,OAAOrB,EAAEC,OAAO;MACd4B,QAAQ7B,EAAEM,SAASN,EAAES,MAAM;IAC7B,CAAA;IACAa,QAAQtB,EAAEyB;EACZ,CAAA,EAAA;EAAI;gBALSG,eAAAA;EAON,MAAME,oBAAoB9B,EAAEoB,YAAW,EAAgB,GAAGJ,aAAAA,iBAA8B;IAC7FK,OAAOrB,EAAEyB;IACTH,QAAQtB,EAAEyB;EACZ,CAAA,EAAA;EAAI;gBAHSK,cAAAA;EAKN,MAAMC,2BAA2B/B,EAAEoB,YAAW,EAAuB,GAAGJ,aAAAA,yBAAsC;IACnHK,OAAOrB,EAAEyB;IACTH,QAAQtB,EAAEyB;EACZ,CAAA,EAAA;EAAI;gBAHSM,qBAAAA;AAIf,GAzCiBb,iBAAAA,eAAAA,CAAAA,EAAAA;AAmFV,IAAMc,oBAAoB,CAACC,YAC/BA,QAAQC,UAAiBC,kBAAkBC,SAAUH,SAA0CI;",
|
|
6
|
-
"names": ["S", "Client", "PublicKey", "IdentitySchema", "S", "Struct", "identityKey", "instanceOf", "PublicKey", "spaceKey", "optional", "profile", "displayName", "String", "avatarCid", "data", "Record", "key", "value", "Any", "CLIENT_ACTION", "CLIENT_PLUGIN", "ClientAction", "CreateIdentity", "TaggedClass", "input", "output", "JoinIdentity", "invitationCode", "Void", "ShareIdentity", "RecoverIdentity", "ResetStorage", "target", "CreateAgent", "CreateRecoveryCode", "parseClientPlugin", "plugin", "provides", "client", "Client", "undefined"]
|
|
7
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
CLIENT_PLUGIN,
|
|
4
|
-
meta_default
|
|
5
|
-
} from "./chunk-GMGRQ5Q7.mjs";
|
|
6
|
-
export {
|
|
7
|
-
CLIENT_PLUGIN,
|
|
8
|
-
meta_default as default
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=meta.mjs.map
|