@dxos/plugin-client 0.7.5-main.9d2a38b → 0.7.5-main.e94eead

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 (148) hide show
  1. package/dist/lib/browser/{app-graph-builder-6LOTDB4T.mjs → app-graph-builder-ON64R7SO.mjs} +2 -2
  2. package/dist/lib/browser/{chunk-E3OUNOEL.mjs → chunk-7DPLXOMO.mjs} +14 -2
  3. package/dist/lib/browser/chunk-7DPLXOMO.mjs.map +7 -0
  4. package/dist/lib/browser/chunk-EYBZZHSM.mjs +271 -0
  5. package/dist/lib/browser/chunk-EYBZZHSM.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-SVBQRT7I.mjs → chunk-GHEQL2E6.mjs} +1 -2
  7. package/dist/lib/browser/{chunk-SVBQRT7I.mjs.map → chunk-GHEQL2E6.mjs.map} +3 -3
  8. package/dist/lib/browser/{chunk-R4Q6H7RD.mjs → chunk-RGMLBYIF.mjs} +2 -2
  9. package/dist/lib/browser/{chunk-R4Q6H7RD.mjs.map → chunk-RGMLBYIF.mjs.map} +2 -2
  10. package/dist/lib/browser/{client-25GYH6TN.mjs → client-A7YSVURS.mjs} +4 -13
  11. package/dist/lib/browser/client-A7YSVURS.mjs.map +7 -0
  12. package/dist/lib/browser/index.mjs +28 -15
  13. package/dist/lib/browser/index.mjs.map +3 -3
  14. package/dist/lib/browser/intent-resolver-A6SKE7WJ.mjs +267 -0
  15. package/dist/lib/browser/intent-resolver-A6SKE7WJ.mjs.map +7 -0
  16. package/dist/lib/browser/meta.json +1 -1
  17. package/dist/lib/browser/{react-context-M3RT6SSG.mjs → react-context-R3SG55F5.mjs} +2 -2
  18. package/dist/lib/browser/{react-surface-XXONPG5T.mjs → react-surface-XGOUHVIH.mjs} +23 -7
  19. package/dist/lib/browser/react-surface-XGOUHVIH.mjs.map +7 -0
  20. package/dist/lib/browser/schema-J4MJIXRP.mjs +23 -0
  21. package/dist/lib/browser/schema-J4MJIXRP.mjs.map +7 -0
  22. package/dist/lib/browser/types.mjs +1 -1
  23. package/dist/lib/node/{app-graph-builder-JCND3P6G.cjs → app-graph-builder-RW7ESEX3.cjs} +6 -6
  24. package/dist/lib/node/chunk-7LVBFGKQ.cjs +299 -0
  25. package/dist/lib/node/chunk-7LVBFGKQ.cjs.map +7 -0
  26. package/dist/lib/node/{chunk-NVYWMDF3.cjs → chunk-TREVKZCJ.cjs} +17 -5
  27. package/dist/lib/node/chunk-TREVKZCJ.cjs.map +7 -0
  28. package/dist/lib/node/{chunk-3OB25QN2.cjs → chunk-UHIGZJQL.cjs} +4 -5
  29. package/dist/lib/node/{chunk-3OB25QN2.cjs.map → chunk-UHIGZJQL.cjs.map} +3 -3
  30. package/dist/lib/node/{chunk-IXVWJCYB.cjs → chunk-XPC4JOPP.cjs} +5 -5
  31. package/dist/lib/node/{chunk-IXVWJCYB.cjs.map → chunk-XPC4JOPP.cjs.map} +2 -2
  32. package/dist/lib/node/{client-52L4TUYU.cjs → client-2RQATBB6.cjs} +9 -18
  33. package/dist/lib/node/client-2RQATBB6.cjs.map +7 -0
  34. package/dist/lib/node/index.cjs +30 -17
  35. package/dist/lib/node/index.cjs.map +3 -3
  36. package/dist/lib/node/intent-resolver-DKQHARC2.cjs +275 -0
  37. package/dist/lib/node/intent-resolver-DKQHARC2.cjs.map +7 -0
  38. package/dist/lib/node/meta.json +1 -1
  39. package/dist/lib/node/{react-context-B2DNULH4.cjs → react-context-TD6VGBVA.cjs} +6 -6
  40. package/dist/lib/node/{react-surface-7USN5NOO.cjs → react-surface-IY7GXEGU.cjs} +28 -16
  41. package/dist/lib/node/react-surface-IY7GXEGU.cjs.map +7 -0
  42. package/dist/lib/node/schema-JXJS75HQ.cjs +39 -0
  43. package/dist/lib/node/schema-JXJS75HQ.cjs.map +7 -0
  44. package/dist/lib/node/types.cjs +2 -2
  45. package/dist/lib/node/types.cjs.map +1 -1
  46. package/dist/lib/node-esm/{app-graph-builder-ZLGKFBLY.mjs → app-graph-builder-TDYRWNI7.mjs} +2 -2
  47. package/dist/lib/node-esm/chunk-CRF22MJJ.mjs +272 -0
  48. package/dist/lib/node-esm/chunk-CRF22MJJ.mjs.map +7 -0
  49. package/dist/lib/node-esm/{chunk-74T33KTB.mjs → chunk-QJMF2MWP.mjs} +14 -2
  50. package/dist/lib/node-esm/chunk-QJMF2MWP.mjs.map +7 -0
  51. package/dist/lib/node-esm/{chunk-73M5MK5Q.mjs → chunk-QR72BXJK.mjs} +2 -2
  52. package/dist/lib/node-esm/{chunk-73M5MK5Q.mjs.map → chunk-QR72BXJK.mjs.map} +2 -2
  53. package/dist/lib/node-esm/{chunk-OBGRL3DF.mjs → chunk-T35SFKK3.mjs} +1 -2
  54. package/dist/lib/node-esm/{chunk-OBGRL3DF.mjs.map → chunk-T35SFKK3.mjs.map} +3 -3
  55. package/dist/lib/node-esm/{client-K52NWOUN.mjs → client-36DKBSB7.mjs} +4 -13
  56. package/dist/lib/node-esm/client-36DKBSB7.mjs.map +7 -0
  57. package/dist/lib/node-esm/index.mjs +28 -15
  58. package/dist/lib/node-esm/index.mjs.map +3 -3
  59. package/dist/lib/node-esm/intent-resolver-HFYRSXUG.mjs +268 -0
  60. package/dist/lib/node-esm/intent-resolver-HFYRSXUG.mjs.map +7 -0
  61. package/dist/lib/node-esm/meta.json +1 -1
  62. package/dist/lib/node-esm/{react-context-IGEHJQK5.mjs → react-context-ZOGDOWJ2.mjs} +2 -2
  63. package/dist/lib/node-esm/{react-surface-CXLBCMPN.mjs → react-surface-F3PDFJMV.mjs} +23 -7
  64. package/dist/lib/node-esm/react-surface-F3PDFJMV.mjs.map +7 -0
  65. package/dist/lib/node-esm/schema-XM4HBLIX.mjs +24 -0
  66. package/dist/lib/node-esm/schema-XM4HBLIX.mjs.map +7 -0
  67. package/dist/lib/node-esm/types.mjs +1 -1
  68. package/dist/types/src/ClientPlugin.d.ts.map +1 -1
  69. package/dist/types/src/capabilities/app-graph-builder.d.ts +110 -110
  70. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  71. package/dist/types/src/capabilities/capabilities.d.ts +0 -1
  72. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  73. package/dist/types/src/capabilities/client.d.ts.map +1 -1
  74. package/dist/types/src/capabilities/index.d.ts +119 -117
  75. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  76. package/dist/types/src/capabilities/intent-resolver.d.ts +2 -1
  77. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  78. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  79. package/dist/types/src/capabilities/schema.d.ts +4 -0
  80. package/dist/types/src/capabilities/schema.d.ts.map +1 -0
  81. package/dist/types/src/components/IdentityDialog.d.ts +1 -2
  82. package/dist/types/src/components/IdentityDialog.d.ts.map +1 -1
  83. package/dist/types/src/components/JoinDialog.d.ts +1 -2
  84. package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
  85. package/dist/types/src/components/ManageCredentialsDialog.d.ts +3 -0
  86. package/dist/types/src/components/ManageCredentialsDialog.d.ts.map +1 -0
  87. package/dist/types/src/components/ManageCredentialsDialog.stories.d.ts +8 -0
  88. package/dist/types/src/components/ManageCredentialsDialog.stories.d.ts.map +1 -0
  89. package/dist/types/src/components/RecoveryCodeDialog.d.ts +1 -2
  90. package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +1 -1
  91. package/dist/types/src/components/RecoverySetupDialog.d.ts +3 -0
  92. package/dist/types/src/components/RecoverySetupDialog.d.ts.map +1 -0
  93. package/dist/types/src/components/RecoverySetupDialog.stories.d.ts +8 -0
  94. package/dist/types/src/components/RecoverySetupDialog.stories.d.ts.map +1 -0
  95. package/dist/types/src/components/index.d.ts +1 -0
  96. package/dist/types/src/components/index.d.ts.map +1 -1
  97. package/dist/types/src/events.d.ts +1 -1
  98. package/dist/types/src/translations.d.ts +7 -0
  99. package/dist/types/src/translations.d.ts.map +1 -1
  100. package/dist/types/src/types.d.ts +17 -1
  101. package/dist/types/src/types.d.ts.map +1 -1
  102. package/package.json +23 -17
  103. package/src/ClientPlugin.ts +11 -6
  104. package/src/capabilities/capabilities.ts +0 -1
  105. package/src/capabilities/client.ts +1 -9
  106. package/src/capabilities/index.ts +1 -0
  107. package/src/capabilities/intent-resolver.ts +171 -67
  108. package/src/capabilities/react-surface.tsx +21 -6
  109. package/src/capabilities/schema.ts +26 -0
  110. package/src/components/IdentityDialog.tsx +15 -3
  111. package/src/components/JoinDialog.tsx +1 -1
  112. package/src/components/ManageCredentialsDialog.stories.tsx +57 -0
  113. package/src/components/ManageCredentialsDialog.tsx +64 -0
  114. package/src/components/RecoveryCodeDialog.stories.tsx +5 -5
  115. package/src/components/RecoveryCodeDialog.tsx +2 -1
  116. package/src/components/RecoverySetupDialog.stories.tsx +77 -0
  117. package/src/components/RecoverySetupDialog.tsx +52 -0
  118. package/src/components/index.ts +1 -0
  119. package/src/events.ts +1 -1
  120. package/src/translations.ts +10 -1
  121. package/src/types.ts +11 -1
  122. package/dist/lib/browser/chunk-6IF6PREG.mjs +0 -158
  123. package/dist/lib/browser/chunk-6IF6PREG.mjs.map +0 -7
  124. package/dist/lib/browser/chunk-E3OUNOEL.mjs.map +0 -7
  125. package/dist/lib/browser/client-25GYH6TN.mjs.map +0 -7
  126. package/dist/lib/browser/intent-resolver-IWWLWOZD.mjs +0 -132
  127. package/dist/lib/browser/intent-resolver-IWWLWOZD.mjs.map +0 -7
  128. package/dist/lib/browser/react-surface-XXONPG5T.mjs.map +0 -7
  129. package/dist/lib/node/chunk-N3U7KVO3.cjs +0 -186
  130. package/dist/lib/node/chunk-N3U7KVO3.cjs.map +0 -7
  131. package/dist/lib/node/chunk-NVYWMDF3.cjs.map +0 -7
  132. package/dist/lib/node/client-52L4TUYU.cjs.map +0 -7
  133. package/dist/lib/node/intent-resolver-H3Y64MIP.cjs +0 -140
  134. package/dist/lib/node/intent-resolver-H3Y64MIP.cjs.map +0 -7
  135. package/dist/lib/node/react-surface-7USN5NOO.cjs.map +0 -7
  136. package/dist/lib/node-esm/chunk-74T33KTB.mjs.map +0 -7
  137. package/dist/lib/node-esm/chunk-EHGD3UJH.mjs +0 -159
  138. package/dist/lib/node-esm/chunk-EHGD3UJH.mjs.map +0 -7
  139. package/dist/lib/node-esm/client-K52NWOUN.mjs.map +0 -7
  140. package/dist/lib/node-esm/intent-resolver-JCKD6R6L.mjs +0 -133
  141. package/dist/lib/node-esm/intent-resolver-JCKD6R6L.mjs.map +0 -7
  142. package/dist/lib/node-esm/react-surface-CXLBCMPN.mjs.map +0 -7
  143. /package/dist/lib/browser/{app-graph-builder-6LOTDB4T.mjs.map → app-graph-builder-ON64R7SO.mjs.map} +0 -0
  144. /package/dist/lib/browser/{react-context-M3RT6SSG.mjs.map → react-context-R3SG55F5.mjs.map} +0 -0
  145. /package/dist/lib/node/{app-graph-builder-JCND3P6G.cjs.map → app-graph-builder-RW7ESEX3.cjs.map} +0 -0
  146. /package/dist/lib/node/{react-context-B2DNULH4.cjs.map → react-context-TD6VGBVA.cjs.map} +0 -0
  147. /package/dist/lib/node-esm/{app-graph-builder-ZLGKFBLY.mjs.map → app-graph-builder-TDYRWNI7.mjs.map} +0 -0
  148. /package/dist/lib/node-esm/{react-context-IGEHJQK5.mjs.map → react-context-ZOGDOWJ2.mjs.map} +0 -0
@@ -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 [seedphrase, setSeedphrase] = useState<string>();
20
+ const [recoveryCode, setRecoveryCode] = useState<string>();
21
21
  useAsyncEffect(async () => {
22
- const { seedphrase } = (await client.services.services.IdentityService?.createRecoveryPhrase()) ?? {};
23
- setSeedphrase(seedphrase);
22
+ const { recoveryCode } = (await client.services.services.IdentityService?.createRecoveryCredential({})) ?? {};
23
+ setRecoveryCode(recoveryCode);
24
24
  }, [client]);
25
25
 
26
26
  return (
27
- <AlertDialog.Root open={!!seedphrase}>
27
+ <AlertDialog.Root open={!!recoveryCode}>
28
28
  <AlertDialog.Overlay>
29
- <RecoveryCodeDialog code={seedphrase ?? ''} />
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 items-center'>
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
+ };
@@ -5,3 +5,4 @@
5
5
  export * from './IdentityDialog';
6
6
  export * from './JoinDialog';
7
7
  export * from './RecoveryCodeDialog';
8
+ export * from './RecoverySetupDialog';
package/src/events.ts CHANGED
@@ -7,8 +7,8 @@ import { defineEvent } from '@dxos/app-framework';
7
7
  import { CLIENT_PLUGIN } from './meta';
8
8
 
9
9
  export namespace ClientEvents {
10
- export const SetupClient = defineEvent(`${CLIENT_PLUGIN}/event/setup-client`);
11
10
  export const ClientReady = defineEvent(`${CLIENT_PLUGIN}/event/client-ready`);
11
+ export const SetupSchema = defineEvent(`${CLIENT_PLUGIN}/event/setup-schema`);
12
12
  export const IdentityCreated = defineEvent(`${CLIENT_PLUGIN}/event/identity-created`);
13
13
  export const SpacesReady = defineEvent(`${CLIENT_PLUGIN}/event/spaces-ready`);
14
14
  }
@@ -9,7 +9,16 @@ export default [
9
9
  'en-US': {
10
10
  [CLIENT_PLUGIN]: {
11
11
  'open shell label': 'Open HALO',
12
- 'recovery code dialog title': 'Account Recovery',
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
@@ -33,7 +33,7 @@ export namespace ClientAction {
33
33
 
34
34
  export class JoinIdentity extends S.TaggedClass<JoinIdentity>()(`${CLIENT_ACTION}/join-identity`, {
35
35
  input: S.Struct({
36
- invitationCode: S.String,
36
+ invitationCode: S.optional(S.String),
37
37
  }),
38
38
  output: S.Void,
39
39
  }) {}
@@ -64,6 +64,16 @@ export namespace ClientAction {
64
64
  input: S.Void,
65
65
  output: S.Void,
66
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
+ }) {}
67
77
  }
68
78
 
69
79
  export type ClientPluginOptions = ClientOptions & {
@@ -1,158 +0,0 @@
1
- import {
2
- ClientAction
3
- } from "./chunk-E3OUNOEL.mjs";
4
- import {
5
- CLIENT_PLUGIN
6
- } from "./chunk-NHIL4T3L.mjs";
7
-
8
- // packages/plugins/plugin-client/src/components/IdentityDialog.tsx
9
- import React, { useCallback } from "react";
10
- import { createIntent, LayoutAction, useIntentDispatcher } from "@dxos/app-framework";
11
- import { useClient } from "@dxos/react-client";
12
- import { Clipboard, Dialog } from "@dxos/react-ui";
13
- import { IdentityPanel } from "@dxos/shell/react";
14
- var IDENTITY_DIALOG = `${CLIENT_PLUGIN}/IdentityDialog`;
15
- var IdentityDialog = (props) => {
16
- const { dispatchPromise: dispatch } = useIntentDispatcher();
17
- const client = useClient();
18
- const handleDone = useCallback(() => dispatch(createIntent(LayoutAction.SetLayout, {
19
- element: "dialog",
20
- state: false
21
- })), [
22
- dispatch
23
- ]);
24
- const handleResetStorage = useCallback(async () => {
25
- await client.reset();
26
- await dispatch(createIntent(ClientAction.ResetStorage));
27
- }, [
28
- dispatch
29
- ]);
30
- const handleRecover = useCallback(async () => {
31
- await client.reset();
32
- await dispatch(createIntent(ClientAction.ResetStorage, {
33
- target: "recoverIdentity"
34
- }));
35
- }, [
36
- dispatch
37
- ]);
38
- const handleJoinNewIdentity = useCallback(async () => {
39
- await client.reset();
40
- await dispatch(createIntent(ClientAction.ResetStorage, {
41
- target: "deviceInvitation"
42
- }));
43
- }, [
44
- dispatch
45
- ]);
46
- return /* @__PURE__ */ React.createElement(Dialog.Content, null, /* @__PURE__ */ React.createElement(Clipboard.Provider, null, /* @__PURE__ */ React.createElement(IdentityPanel, {
47
- ...props,
48
- doneActionParent: /* @__PURE__ */ React.createElement(Dialog.Close, {
49
- asChild: true
50
- }),
51
- onDone: handleDone,
52
- onResetStorage: handleResetStorage,
53
- onRecover: handleRecover,
54
- onJoinNewIdentity: handleJoinNewIdentity
55
- })));
56
- };
57
-
58
- // packages/plugins/plugin-client/src/components/JoinDialog.tsx
59
- import React2, { useCallback as useCallback2 } from "react";
60
- import { createIntent as createIntent2, LayoutAction as LayoutAction2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
61
- import { ObservabilityAction } from "@dxos/plugin-observability/types";
62
- import { Dialog as Dialog2 } from "@dxos/react-ui";
63
- import { JoinPanel } from "@dxos/shell/react";
64
- var JOIN_DIALOG = `${CLIENT_PLUGIN}/JoinDialog`;
65
- var JoinDialog = (props) => {
66
- const { dispatchPromise: dispatch } = useIntentDispatcher2();
67
- const handleCancelResetStorage = useCallback2(() => dispatch(createIntent2(ClientAction.ShareIdentity)), [
68
- dispatch
69
- ]);
70
- const handleDone = useCallback2(async (result) => {
71
- if (result?.identityKey) {
72
- await Promise.all([
73
- dispatch(createIntent2(LayoutAction2.SetLayout, {
74
- element: "dialog",
75
- state: false
76
- })),
77
- dispatch(createIntent2(ObservabilityAction.SendEvent, {
78
- name: props.initialDisposition === "recover-identity" ? "identity.recover" : "identity.join"
79
- }))
80
- ]);
81
- }
82
- }, [
83
- dispatch
84
- ]);
85
- return /* @__PURE__ */ React2.createElement(Dialog2.Content, null, /* @__PURE__ */ React2.createElement(JoinPanel, {
86
- mode: "halo-only",
87
- ...props,
88
- exitActionParent: /* @__PURE__ */ React2.createElement(Dialog2.Close, {
89
- asChild: true
90
- }),
91
- doneActionParent: /* @__PURE__ */ React2.createElement(Dialog2.Close, {
92
- asChild: true
93
- }),
94
- onCancelResetStorage: handleCancelResetStorage,
95
- onDone: handleDone
96
- }));
97
- };
98
-
99
- // packages/plugins/plugin-client/src/components/RecoveryCodeDialog.tsx
100
- import React3, { useCallback as useCallback3, useState } from "react";
101
- import { AlertDialog, Button, Clipboard as Clipboard2, Input, useTranslation } from "@dxos/react-ui";
102
- var RECOVER_CODE_DIALOG = `${CLIENT_PLUGIN}/RecoveryCodeDialog`;
103
- var RecoveryCodeDialog = ({ code }) => {
104
- const { t } = useTranslation(CLIENT_PLUGIN);
105
- const [confirmation, setConfirmation] = useState(false);
106
- const handleConfirmation = useCallback3((checked) => setConfirmation(checked), []);
107
- return /* @__PURE__ */ React3.createElement(AlertDialog.Content, {
108
- classNames: "bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
109
- }, /* @__PURE__ */ React3.createElement(AlertDialog.Title, null, t("recovery code dialog title")), /* @__PURE__ */ React3.createElement("p", {
110
- className: "py-4"
111
- }, t("recovery code dialog description")), /* @__PURE__ */ React3.createElement(Clipboard2.Provider, null, /* @__PURE__ */ React3.createElement(Code, {
112
- code
113
- })), /* @__PURE__ */ React3.createElement("div", {
114
- className: "flex flex-col py-4 gap-2"
115
- }, /* @__PURE__ */ React3.createElement("p", null, t("recovery code dialog warning 1")), /* @__PURE__ */ React3.createElement("p", null, t("recovery code dialog warning 2"))), /* @__PURE__ */ React3.createElement("div", {
116
- className: "flex items-center gap-2 pbe-4"
117
- }, /* @__PURE__ */ React3.createElement(Input.Root, null, /* @__PURE__ */ React3.createElement(Input.Checkbox, {
118
- "data-testid": "recoveryCode.confirm",
119
- checked: confirmation,
120
- onCheckedChange: handleConfirmation
121
- }), /* @__PURE__ */ React3.createElement(Input.Label, null, t("recovery code confirmation label")))), /* @__PURE__ */ React3.createElement("div", {
122
- className: "flex justify-end"
123
- }, /* @__PURE__ */ React3.createElement(AlertDialog.Action, {
124
- asChild: true
125
- }, /* @__PURE__ */ React3.createElement(Button, {
126
- "data-testid": "recoveryCode.continue",
127
- variant: "primary",
128
- disabled: !confirmation
129
- }, t("continue label")))));
130
- };
131
- var Code = ({ code }) => {
132
- const words = code.split(" ");
133
- return /* @__PURE__ */ React3.createElement("div", {
134
- className: "relative p-2 border border-separator rounded group"
135
- }, /* @__PURE__ */ React3.createElement(Clipboard2.IconButton, {
136
- value: code,
137
- classNames: "absolute top-2 right-2 invisible group-hover:visible"
138
- }), /* @__PURE__ */ React3.createElement("div", {
139
- className: "grid grid-cols-4"
140
- }, words.map((word, i) => /* @__PURE__ */ React3.createElement("div", {
141
- key: i,
142
- className: "flex items-center p-2 gap-2 items-center"
143
- }, /* @__PURE__ */ React3.createElement("div", {
144
- className: "w-4 text-xs text-center text-subdued"
145
- }, i + 1), /* @__PURE__ */ React3.createElement("div", {
146
- className: "text-sm"
147
- }, word)))));
148
- };
149
-
150
- export {
151
- IDENTITY_DIALOG,
152
- IdentityDialog,
153
- JOIN_DIALOG,
154
- JoinDialog,
155
- RECOVER_CODE_DIALOG,
156
- RecoveryCodeDialog
157
- };
158
- //# sourceMappingURL=chunk-6IF6PREG.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/IdentityDialog.tsx", "../../../src/components/JoinDialog.tsx", "../../../src/components/RecoveryCodeDialog.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { useClient } from '@dxos/react-client';\nimport { Clipboard, Dialog } from '@dxos/react-ui';\nimport { IdentityPanel, type IdentityPanelProps } from '@dxos/shell/react';\n\nimport { CLIENT_PLUGIN } from '../meta';\nimport { ClientAction } from '../types';\n\nexport const IDENTITY_DIALOG = `${CLIENT_PLUGIN}/IdentityDialog`;\n\nexport const IdentityDialog = (props: IdentityPanelProps) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const client = useClient();\n\n const handleDone = useCallback(\n () =>\n dispatch(\n createIntent(LayoutAction.SetLayout, {\n element: 'dialog',\n state: false,\n }),\n ),\n [dispatch],\n );\n\n const handleResetStorage = useCallback(async () => {\n await client.reset();\n await dispatch(createIntent(ClientAction.ResetStorage));\n }, [dispatch]);\n\n const handleRecover = useCallback(async () => {\n await client.reset();\n await dispatch(createIntent(ClientAction.ResetStorage, { target: 'recoverIdentity' }));\n }, [dispatch]);\n\n const handleJoinNewIdentity = useCallback(async () => {\n await client.reset();\n await dispatch(createIntent(ClientAction.ResetStorage, { target: 'deviceInvitation' }));\n }, [dispatch]);\n\n return (\n <Dialog.Content>\n <Clipboard.Provider>\n <IdentityPanel\n {...props}\n doneActionParent={<Dialog.Close asChild />}\n onDone={handleDone}\n onResetStorage={handleResetStorage}\n onRecover={handleRecover}\n onJoinNewIdentity={handleJoinNewIdentity}\n />\n </Clipboard.Provider>\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { ObservabilityAction } from '@dxos/plugin-observability/types';\nimport { type InvitationResult } from '@dxos/react-client/invitations';\nimport { Dialog } from '@dxos/react-ui';\nimport { JoinPanel, type JoinPanelProps } from '@dxos/shell/react';\n\nimport { CLIENT_PLUGIN } from '../meta';\nimport { ClientAction } from '../types';\n\nexport const JOIN_DIALOG = `${CLIENT_PLUGIN}/JoinDialog`;\n\nexport const JoinDialog = (props: JoinPanelProps) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n const handleCancelResetStorage = useCallback(() => dispatch(createIntent(ClientAction.ShareIdentity)), [dispatch]);\n\n const handleDone = useCallback(\n async (result: InvitationResult | null) => {\n if (result?.identityKey) {\n await Promise.all([\n dispatch(createIntent(LayoutAction.SetLayout, { element: 'dialog', state: false })),\n dispatch(\n createIntent(ObservabilityAction.SendEvent, {\n name: props.initialDisposition === 'recover-identity' ? 'identity.recover' : 'identity.join',\n }),\n ),\n ]);\n }\n },\n [dispatch],\n );\n\n return (\n <Dialog.Content>\n <JoinPanel\n mode='halo-only'\n {...props}\n exitActionParent={<Dialog.Close asChild />}\n doneActionParent={<Dialog.Close asChild />}\n onCancelResetStorage={handleCancelResetStorage}\n onDone={handleDone}\n />\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useState } from 'react';\n\nimport { AlertDialog, Button, Clipboard, Input, useTranslation } from '@dxos/react-ui';\n\nimport { CLIENT_PLUGIN } from '../meta';\n\nexport const RECOVER_CODE_DIALOG = `${CLIENT_PLUGIN}/RecoveryCodeDialog`;\n\nexport type RecoveryCodeDialogProps = {\n code: string;\n};\n\nexport const RecoveryCodeDialog = ({ code }: RecoveryCodeDialogProps) => {\n const { t } = useTranslation(CLIENT_PLUGIN);\n const [confirmation, setConfirmation] = useState(false);\n\n const handleConfirmation = useCallback((checked: boolean) => setConfirmation(checked), []);\n\n return (\n <AlertDialog.Content classNames='bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden'>\n <AlertDialog.Title>{t('recovery code dialog title')}</AlertDialog.Title>\n <p className='py-4'>{t('recovery code dialog description')}</p>\n <Clipboard.Provider>\n <Code code={code} />\n </Clipboard.Provider>\n <div className='flex flex-col py-4 gap-2'>\n <p>{t('recovery code dialog warning 1')}</p>\n <p>{t('recovery code dialog warning 2')}</p>\n </div>\n <div className='flex items-center gap-2 pbe-4'>\n <Input.Root>\n <Input.Checkbox\n data-testid='recoveryCode.confirm'\n checked={confirmation}\n onCheckedChange={handleConfirmation}\n />\n <Input.Label>{t('recovery code confirmation label')}</Input.Label>\n </Input.Root>\n </div>\n <div className='flex justify-end'>\n <AlertDialog.Action asChild>\n <Button data-testid='recoveryCode.continue' variant='primary' disabled={!confirmation}>\n {t('continue label')}\n </Button>\n </AlertDialog.Action>\n </div>\n </AlertDialog.Content>\n );\n};\n\nconst Code = ({ code }: { code: string }) => {\n const words = code.split(' ');\n return (\n <div className='relative p-2 border border-separator rounded group'>\n <Clipboard.IconButton value={code} classNames='absolute top-2 right-2 invisible group-hover:visible' />\n <div className='grid grid-cols-4'>\n {words.map((word, i) => (\n <div key={i} className='flex items-center p-2 gap-2 items-center'>\n <div className='w-4 text-xs text-center text-subdued'>{i + 1}</div>\n <div className='text-sm'>{word}</div>\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],
5
- "mappings": "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",
6
- "names": ["React", "useCallback", "createIntent", "LayoutAction", "useIntentDispatcher", "useClient", "Clipboard", "Dialog", "IdentityPanel", "IDENTITY_DIALOG", "CLIENT_PLUGIN", "IdentityDialog", "props", "dispatchPromise", "dispatch", "useIntentDispatcher", "client", "useClient", "handleDone", "useCallback", "createIntent", "LayoutAction", "SetLayout", "element", "state", "handleResetStorage", "reset", "ClientAction", "ResetStorage", "handleRecover", "target", "handleJoinNewIdentity", "Dialog", "Content", "Clipboard", "Provider", "IdentityPanel", "doneActionParent", "Close", "asChild", "onDone", "onResetStorage", "onRecover", "onJoinNewIdentity", "React", "useCallback", "createIntent", "LayoutAction", "useIntentDispatcher", "ObservabilityAction", "Dialog", "JoinPanel", "JOIN_DIALOG", "CLIENT_PLUGIN", "JoinDialog", "props", "dispatchPromise", "dispatch", "useIntentDispatcher", "handleCancelResetStorage", "useCallback", "createIntent", "ClientAction", "ShareIdentity", "handleDone", "result", "identityKey", "Promise", "all", "LayoutAction", "SetLayout", "element", "state", "ObservabilityAction", "SendEvent", "name", "initialDisposition", "React", "Dialog", "Content", "JoinPanel", "mode", "exitActionParent", "Close", "asChild", "doneActionParent", "onCancelResetStorage", "onDone", "React", "useCallback", "useState", "AlertDialog", "Button", "Clipboard", "Input", "useTranslation", "RECOVER_CODE_DIALOG", "CLIENT_PLUGIN", "RecoveryCodeDialog", "code", "t", "useTranslation", "confirmation", "setConfirmation", "useState", "handleConfirmation", "useCallback", "checked", "React", "AlertDialog", "Content", "classNames", "Title", "p", "className", "Clipboard", "Provider", "Code", "div", "Input", "Root", "Checkbox", "data-testid", "onCheckedChange", "Label", "Action", "asChild", "Button", "variant", "disabled", "words", "split", "IconButton", "value", "map", "word", "i", "key"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type PluginsContext } from '@dxos/app-framework';\nimport { S } from '@dxos/echo-schema';\nimport { type Client, PublicKey, type ClientOptions } from '@dxos/react-client';\nimport { type MaybePromise } from '@dxos/util';\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 * 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?: (context: PluginsContext, client: Client) => MaybePromise<void>;\n\n /**\n * Called when the client is reset.\n */\n onReset?: (params: { target?: string }) => MaybePromise<void>;\n};\n"],
5
- "mappings": ";;;;;AAKA,SAASA,SAAS;AAClB,SAAsBC,iBAAqC;AAM3D,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;",
6
- "names": ["S", "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"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/client.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, type PluginsContext } from '@dxos/app-framework';\nimport { Config, Defaults, Envs, Local, Storage } from '@dxos/config';\nimport { Client } from '@dxos/react-client';\n\nimport { ClientCapabilities } from './capabilities';\nimport { ClientEvents } from '../events';\nimport { type ClientPluginOptions } from '../types';\n\ntype ClientCapabilityOptions = Omit<ClientPluginOptions, 'appKey' | 'invitationUrl' | 'invitationParam' | 'onReset'> & {\n context: PluginsContext;\n};\n\nexport default async ({ context, onClientInitialized, ...options }: ClientCapabilityOptions) => {\n const config = new Config(await Storage(), Envs(), Local(), Defaults());\n const client = new Client({ config, ...options });\n\n await client.initialize();\n await onClientInitialized?.(context, client);\n\n const systemSchemas = Array.from(new Set(context.requestCapabilities(ClientCapabilities.SystemSchema).flat()));\n const schemas = Array.from(new Set(context.requestCapabilities(ClientCapabilities.Schema).flat()));\n client.addTypes(systemSchemas);\n client.addTypes(schemas);\n\n // TODO(wittjosiah): Remove. This is a hack to get the app to boot with the new identity after a reset.\n client.reloaded.on(() => {\n client.halo.identity.subscribe(async (identity) => {\n if (identity) {\n window.location.href = window.location.origin;\n }\n });\n });\n\n const subscription = client.spaces.isReady.subscribe(async (ready) => {\n if (ready) {\n await context.activate(ClientEvents.SpacesReady);\n }\n });\n\n return contributes(ClientCapabilities.Client, client, async () => {\n subscription.unsubscribe();\n await client.destroy();\n });\n};\n"],
5
- "mappings": ";;;;;;;;;AAIA,SAASA,mBAAwC;AACjD,SAASC,QAAQC,UAAUC,MAAMC,OAAOC,eAAe;AACvD,SAASC,cAAc;AAUvB,IAAA,iBAAe,OAAO,EAAEC,SAASC,qBAAqB,GAAGC,QAAAA,MAAkC;AACzF,QAAMC,SAAS,IAAIC,OAAO,MAAMC,QAAAA,GAAWC,KAAAA,GAAQC,MAAAA,GAASC,SAAAA,CAAAA;AAC5D,QAAMC,SAAS,IAAIC,OAAO;IAAEP;IAAQ,GAAGD;EAAQ,CAAA;AAE/C,QAAMO,OAAOE,WAAU;AACvB,QAAMV,sBAAsBD,SAASS,MAAAA;AAErC,QAAMG,gBAAgBC,MAAMC,KAAK,IAAIC,IAAIf,QAAQgB,oBAAoBC,mBAAmBC,YAAY,EAAEC,KAAI,CAAA,CAAA;AAC1G,QAAMC,UAAUP,MAAMC,KAAK,IAAIC,IAAIf,QAAQgB,oBAAoBC,mBAAmBI,MAAM,EAAEF,KAAI,CAAA,CAAA;AAC9FV,SAAOa,SAASV,aAAAA;AAChBH,SAAOa,SAASF,OAAAA;AAGhBX,SAAOc,SAASC,GAAG,MAAA;AACjBf,WAAOgB,KAAKC,SAASC,UAAU,OAAOD,aAAAA;AACpC,UAAIA,UAAU;AACZE,eAAOC,SAASC,OAAOF,OAAOC,SAASE;MACzC;IACF,CAAA;EACF,CAAA;AAEA,QAAMC,eAAevB,OAAOwB,OAAOC,QAAQP,UAAU,OAAOQ,UAAAA;AAC1D,QAAIA,OAAO;AACT,YAAMnC,QAAQoC,SAASC,aAAaC,WAAW;IACjD;EACF,CAAA;AAEA,SAAOC,YAAYtB,mBAAmBP,QAAQD,QAAQ,YAAA;AACpDuB,iBAAaQ,YAAW;AACxB,UAAM/B,OAAOgC,QAAO;EACtB,CAAA;AACF;",
6
- "names": ["contributes", "Config", "Defaults", "Envs", "Local", "Storage", "Client", "context", "onClientInitialized", "options", "config", "Config", "Storage", "Envs", "Local", "Defaults", "client", "Client", "initialize", "systemSchemas", "Array", "from", "Set", "requestCapabilities", "ClientCapabilities", "SystemSchema", "flat", "schemas", "Schema", "addTypes", "reloaded", "on", "halo", "identity", "subscribe", "window", "location", "href", "origin", "subscription", "spaces", "isReady", "ready", "activate", "ClientEvents", "SpacesReady", "contributes", "unsubscribe", "destroy"]
7
- }
@@ -1,132 +0,0 @@
1
- import {
2
- ClientEvents
3
- } from "./chunk-R4Q6H7RD.mjs";
4
- import {
5
- ClientCapabilities
6
- } from "./chunk-SVBQRT7I.mjs";
7
- import {
8
- IDENTITY_DIALOG,
9
- JOIN_DIALOG,
10
- RECOVER_CODE_DIALOG
11
- } from "./chunk-6IF6PREG.mjs";
12
- import {
13
- ClientAction
14
- } from "./chunk-E3OUNOEL.mjs";
15
- import "./chunk-NHIL4T3L.mjs";
16
-
17
- // packages/plugins/plugin-client/src/capabilities/intent-resolver.ts
18
- import { Capabilities, contributes, createIntent, createResolver, LayoutAction } from "@dxos/app-framework";
19
- import { invariant } from "@dxos/invariant";
20
- import { ObservabilityAction } from "@dxos/plugin-observability/types";
21
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-client/src/capabilities/intent-resolver.ts";
22
- var intent_resolver_default = ({ context, onReset }) => contributes(Capabilities.IntentResolver, [
23
- createResolver(ClientAction.CreateIdentity, async () => {
24
- const manager = context.requestCapability(Capabilities.PluginManager);
25
- const client = context.requestCapability(ClientCapabilities.Client);
26
- const data = await client.halo.createIdentity();
27
- await manager.activate(ClientEvents.IdentityCreated);
28
- return {
29
- data,
30
- intents: [
31
- createIntent(ObservabilityAction.SendEvent, {
32
- name: "identity.create"
33
- })
34
- ]
35
- };
36
- }),
37
- createResolver(ClientAction.JoinIdentity, async (data) => {
38
- return {
39
- intents: [
40
- createIntent(LayoutAction.SetLayout, {
41
- element: "dialog",
42
- component: JOIN_DIALOG,
43
- dialogBlockAlign: "start",
44
- subject: {
45
- initialInvitationCode: data.invitationCode,
46
- initialDisposition: "accept-halo-invitation"
47
- }
48
- })
49
- ]
50
- };
51
- }),
52
- createResolver(ClientAction.ShareIdentity, async () => {
53
- return {
54
- intents: [
55
- createIntent(LayoutAction.SetLayout, {
56
- element: "dialog",
57
- component: IDENTITY_DIALOG,
58
- dialogBlockAlign: "start"
59
- }),
60
- createIntent(ObservabilityAction.SendEvent, {
61
- name: "identity.share"
62
- })
63
- ]
64
- };
65
- }),
66
- createResolver(ClientAction.RecoverIdentity, async () => {
67
- return {
68
- intents: [
69
- createIntent(LayoutAction.SetLayout, {
70
- element: "dialog",
71
- component: JOIN_DIALOG,
72
- dialogBlockAlign: "start",
73
- subject: {
74
- initialDisposition: "recover-identity"
75
- }
76
- })
77
- ]
78
- };
79
- }),
80
- createResolver(ClientAction.ResetStorage, async (data) => {
81
- await onReset?.({
82
- target: data.target
83
- });
84
- return {};
85
- }),
86
- createResolver(ClientAction.CreateAgent, async () => {
87
- const client = context.requestCapability(ClientCapabilities.Client);
88
- invariant(client.services.services.EdgeAgentService, "Missing EdgeAgentService", {
89
- F: __dxlog_file,
90
- L: 80,
91
- S: void 0,
92
- A: [
93
- "client.services.services.EdgeAgentService",
94
- "'Missing EdgeAgentService'"
95
- ]
96
- });
97
- await client.services.services.EdgeAgentService.createAgent(null, {
98
- timeout: 1e4
99
- });
100
- }),
101
- createResolver(ClientAction.CreateRecoveryCode, async () => {
102
- const client = context.requestCapability(ClientCapabilities.Client);
103
- invariant(client.services.services.IdentityService, "IdentityService not available", {
104
- F: __dxlog_file,
105
- L: 85,
106
- S: void 0,
107
- A: [
108
- "client.services.services.IdentityService",
109
- "'IdentityService not available'"
110
- ]
111
- });
112
- const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();
113
- return {
114
- intents: [
115
- createIntent(LayoutAction.SetLayout, {
116
- element: "dialog",
117
- dialogBlockAlign: "start",
118
- dialogType: "alert",
119
- state: true,
120
- component: RECOVER_CODE_DIALOG,
121
- subject: {
122
- code: seedphrase
123
- }
124
- })
125
- ]
126
- };
127
- })
128
- ]);
129
- export {
130
- intent_resolver_default as default
131
- };
132
- //# sourceMappingURL=intent-resolver-IWWLWOZD.mjs.map