@dxos/plugin-client 0.7.3-staging.cc8dd3e → 0.7.3
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/{chunk-VCPHSTE7.mjs → chunk-FGUXUNOK.mjs} +3 -1
- package/dist/lib/browser/{chunk-VCPHSTE7.mjs.map → chunk-FGUXUNOK.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +111 -9
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/node/{chunk-JYQZCE2U.cjs → chunk-XYLDQWFV.cjs} +6 -4
- package/dist/lib/node/{chunk-JYQZCE2U.cjs.map → chunk-XYLDQWFV.cjs.map} +2 -2
- package/dist/lib/node/index.cjs +123 -23
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.cjs +5 -5
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/{chunk-4FDLD5H4.mjs → chunk-C6X363FK.mjs} +3 -1
- package/dist/lib/node-esm/{chunk-4FDLD5H4.mjs.map → chunk-C6X363FK.mjs.map} +2 -2
- package/dist/lib/node-esm/index.mjs +111 -9
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -1
- package/dist/types/src/ClientPlugin.d.ts.map +1 -1
- package/dist/types/src/components/IdentityDialog.d.ts.map +1 -1
- package/dist/types/src/components/RecoveryCodeDialog.d.ts +6 -0
- package/dist/types/src/components/RecoveryCodeDialog.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/meta.d.ts +3 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +5 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/ClientPlugin.tsx +34 -1
- package/src/components/IdentityDialog.tsx +4 -4
- package/src/components/RecoveryCodeDialog.tsx +58 -0
- package/src/components/index.ts +1 -0
- package/src/meta.ts +2 -0
- package/src/translations.ts +7 -0
|
@@ -4,13 +4,14 @@ import {
|
|
|
4
4
|
ClientAction,
|
|
5
5
|
OBSERVABILITY_ACTION,
|
|
6
6
|
meta_default
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-C6X363FK.mjs";
|
|
8
8
|
|
|
9
9
|
// packages/plugins/plugin-client/src/ClientPlugin.tsx
|
|
10
|
-
import
|
|
10
|
+
import React4 from "react";
|
|
11
11
|
import { LayoutAction as LayoutAction3, parseIntentPlugin, resolvePlugin } from "@dxos/app-framework";
|
|
12
12
|
import { Config, Defaults, Envs, Local, Storage } from "@dxos/config";
|
|
13
13
|
import { registerSignalsRuntime } from "@dxos/echo-signals/react";
|
|
14
|
+
import { invariant } from "@dxos/invariant";
|
|
14
15
|
import { createExtension } from "@dxos/plugin-graph";
|
|
15
16
|
import { Client, ClientProvider } from "@dxos/react-client";
|
|
16
17
|
|
|
@@ -18,8 +19,8 @@ import { Client, ClientProvider } from "@dxos/react-client";
|
|
|
18
19
|
import React, { useCallback } from "react";
|
|
19
20
|
import { LayoutAction, useIntentDispatcher } from "@dxos/app-framework";
|
|
20
21
|
import { useClient } from "@dxos/react-client";
|
|
21
|
-
import { Dialog } from "@dxos/react-ui";
|
|
22
|
-
import {
|
|
22
|
+
import { Clipboard, Dialog } from "@dxos/react-ui";
|
|
23
|
+
import { IdentityPanel } from "@dxos/shell/react";
|
|
23
24
|
var IdentityDialog = (props) => {
|
|
24
25
|
const dispatch = useIntentDispatcher();
|
|
25
26
|
const client = useClient();
|
|
@@ -62,7 +63,7 @@ var IdentityDialog = (props) => {
|
|
|
62
63
|
}, [
|
|
63
64
|
dispatch
|
|
64
65
|
]);
|
|
65
|
-
return /* @__PURE__ */ React.createElement(Dialog.Content, null, /* @__PURE__ */ React.createElement(
|
|
66
|
+
return /* @__PURE__ */ React.createElement(Dialog.Content, null, /* @__PURE__ */ React.createElement(Clipboard.Provider, null, /* @__PURE__ */ React.createElement(IdentityPanel, {
|
|
66
67
|
...props,
|
|
67
68
|
doneActionParent: /* @__PURE__ */ React.createElement(Dialog.Close, {
|
|
68
69
|
asChild: true
|
|
@@ -122,18 +123,68 @@ var JoinDialog = (props) => {
|
|
|
122
123
|
}));
|
|
123
124
|
};
|
|
124
125
|
|
|
126
|
+
// packages/plugins/plugin-client/src/components/RecoveryCodeDialog.tsx
|
|
127
|
+
import React3, { useCallback as useCallback3, useState } from "react";
|
|
128
|
+
import { AlertDialog, Button, Clipboard as Clipboard2, Input, useTranslation } from "@dxos/react-ui";
|
|
129
|
+
var RecoveryCodeDialog = ({ code }) => {
|
|
130
|
+
const { t } = useTranslation(CLIENT_PLUGIN);
|
|
131
|
+
const [confirmation, setConfirmation] = useState(false);
|
|
132
|
+
const handleConfirmation = useCallback3((checked) => setConfirmation(checked), []);
|
|
133
|
+
return /* @__PURE__ */ React3.createElement(AlertDialog.Content, {
|
|
134
|
+
classNames: "bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
135
|
+
}, /* @__PURE__ */ React3.createElement(AlertDialog.Title, {
|
|
136
|
+
classNames: ""
|
|
137
|
+
}, t("recovery code dialog title")), /* @__PURE__ */ React3.createElement("p", {
|
|
138
|
+
className: "py-4"
|
|
139
|
+
}, t("recovery code dialog description")), /* @__PURE__ */ React3.createElement(Clipboard2.Provider, null, /* @__PURE__ */ React3.createElement(Code, {
|
|
140
|
+
value: code
|
|
141
|
+
})), /* @__PURE__ */ React3.createElement("p", {
|
|
142
|
+
className: "py-4"
|
|
143
|
+
}, t("recovery code dialog warning")), /* @__PURE__ */ React3.createElement("div", {
|
|
144
|
+
className: "flex items-center gap-2 pbe-4"
|
|
145
|
+
}, /* @__PURE__ */ React3.createElement(Input.Root, null, /* @__PURE__ */ React3.createElement(Input.Checkbox, {
|
|
146
|
+
"data-testid": "recoveryCode.confirm",
|
|
147
|
+
checked: confirmation,
|
|
148
|
+
onCheckedChange: handleConfirmation
|
|
149
|
+
}), /* @__PURE__ */ React3.createElement(Input.Label, null, t("recovery code confirmation label")))), /* @__PURE__ */ React3.createElement("div", {
|
|
150
|
+
className: "flex justify-end"
|
|
151
|
+
}, /* @__PURE__ */ React3.createElement(AlertDialog.Action, {
|
|
152
|
+
asChild: true
|
|
153
|
+
}, /* @__PURE__ */ React3.createElement(Button, {
|
|
154
|
+
"data-testid": "recoveryCode.continue",
|
|
155
|
+
variant: "primary",
|
|
156
|
+
disabled: !confirmation
|
|
157
|
+
}, t("continue label")))));
|
|
158
|
+
};
|
|
159
|
+
var Code = ({ value }) => {
|
|
160
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
161
|
+
className: "relative p-2 border border-separator rounded group"
|
|
162
|
+
}, /* @__PURE__ */ React3.createElement(Clipboard2.IconButton, {
|
|
163
|
+
value,
|
|
164
|
+
classNames: "absolute top-2 right-2 invisible group-hover:visible"
|
|
165
|
+
}), /* @__PURE__ */ React3.createElement("code", {
|
|
166
|
+
className: "whitespace-pre-wrap"
|
|
167
|
+
}, value));
|
|
168
|
+
};
|
|
169
|
+
|
|
125
170
|
// packages/plugins/plugin-client/src/translations.ts
|
|
126
171
|
var translations_default = [
|
|
127
172
|
{
|
|
128
173
|
"en-US": {
|
|
129
174
|
[CLIENT_PLUGIN]: {
|
|
130
|
-
"open shell label": "Open HALO"
|
|
175
|
+
"open shell label": "Open HALO",
|
|
176
|
+
"recovery code dialog title": "Recovery Code",
|
|
177
|
+
"recovery code dialog description": "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.",
|
|
178
|
+
"recovery code dialog warning": "Please note: This code will not be displayed again and cannot be replaced. It is your private key for recovering DXOS data. Anyone with this key will also be able to gain access to your account.",
|
|
179
|
+
"recovery code confirmation label": "Confirm the code has been saved",
|
|
180
|
+
"continue label": "Continue"
|
|
131
181
|
}
|
|
132
182
|
}
|
|
133
183
|
}
|
|
134
184
|
];
|
|
135
185
|
|
|
136
186
|
// packages/plugins/plugin-client/src/ClientPlugin.tsx
|
|
187
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-client/src/ClientPlugin.tsx";
|
|
137
188
|
var parseClientPlugin = (plugin) => (plugin?.provides).client instanceof Client ? plugin : void 0;
|
|
138
189
|
var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitationParam = "deviceInvitationCode", onClientInitialized, onReady, onReset, ...options }) => {
|
|
139
190
|
registerSignalsRuntime();
|
|
@@ -167,7 +218,7 @@ var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitation
|
|
|
167
218
|
}
|
|
168
219
|
return {
|
|
169
220
|
client,
|
|
170
|
-
context: ({ children }) => /* @__PURE__ */
|
|
221
|
+
context: ({ children }) => /* @__PURE__ */ React4.createElement(ClientProvider, {
|
|
171
222
|
client
|
|
172
223
|
}, children)
|
|
173
224
|
};
|
|
@@ -188,12 +239,14 @@ var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitation
|
|
|
188
239
|
switch (role) {
|
|
189
240
|
case "dialog":
|
|
190
241
|
if (data.component === "dxos.org/plugin/client/IdentityDialog") {
|
|
191
|
-
return /* @__PURE__ */
|
|
242
|
+
return /* @__PURE__ */ React4.createElement(IdentityDialog, {
|
|
192
243
|
...data.subject,
|
|
193
244
|
createInvitationUrl: createDeviceInvitationUrl
|
|
194
245
|
});
|
|
195
246
|
} else if (data.component === "dxos.org/plugin/client/JoinDialog") {
|
|
196
|
-
return /* @__PURE__ */
|
|
247
|
+
return /* @__PURE__ */ React4.createElement(JoinDialog, data.subject);
|
|
248
|
+
} else if (data.component === "dxos.org/plugin/client/RecoveryCodeDialog") {
|
|
249
|
+
return /* @__PURE__ */ React4.createElement(RecoveryCodeDialog, data.subject);
|
|
197
250
|
}
|
|
198
251
|
break;
|
|
199
252
|
}
|
|
@@ -332,6 +385,55 @@ var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitation
|
|
|
332
385
|
data: true
|
|
333
386
|
};
|
|
334
387
|
}
|
|
388
|
+
case ClientAction.CREATE_AGENT: {
|
|
389
|
+
invariant(client.services.services.EdgeAgentService, "Missing EdgeAgentService", {
|
|
390
|
+
F: __dxlog_file,
|
|
391
|
+
L: 283,
|
|
392
|
+
S: void 0,
|
|
393
|
+
A: [
|
|
394
|
+
"client.services.services.EdgeAgentService",
|
|
395
|
+
"'Missing EdgeAgentService'"
|
|
396
|
+
]
|
|
397
|
+
});
|
|
398
|
+
await client.services.services.EdgeAgentService.createAgent(null, {
|
|
399
|
+
timeout: 1e4
|
|
400
|
+
});
|
|
401
|
+
return {
|
|
402
|
+
data: true
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
case ClientAction.CREATE_RECOVERY_CODE: {
|
|
406
|
+
invariant(client.services.services.IdentityService, "IdentityService not available", {
|
|
407
|
+
F: __dxlog_file,
|
|
408
|
+
L: 289,
|
|
409
|
+
S: void 0,
|
|
410
|
+
A: [
|
|
411
|
+
"client.services.services.IdentityService",
|
|
412
|
+
"'IdentityService not available'"
|
|
413
|
+
]
|
|
414
|
+
});
|
|
415
|
+
const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();
|
|
416
|
+
return {
|
|
417
|
+
data: true,
|
|
418
|
+
intents: [
|
|
419
|
+
[
|
|
420
|
+
{
|
|
421
|
+
action: LayoutAction3.SET_LAYOUT,
|
|
422
|
+
data: {
|
|
423
|
+
element: "dialog",
|
|
424
|
+
dialogBlockAlign: "start",
|
|
425
|
+
dialogType: "alert",
|
|
426
|
+
state: true,
|
|
427
|
+
component: "dxos.org/plugin/client/RecoveryCodeDialog",
|
|
428
|
+
subject: {
|
|
429
|
+
code: seedphrase
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
]
|
|
434
|
+
]
|
|
435
|
+
};
|
|
436
|
+
}
|
|
335
437
|
}
|
|
336
438
|
}
|
|
337
439
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/ClientPlugin.tsx", "../../../src/components/IdentityDialog.tsx", "../../../src/components/JoinDialog.tsx", "../../../src/translations.ts", "../../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport {\n LayoutAction,\n parseIntentPlugin,\n resolvePlugin,\n type SurfaceProvides,\n type GraphBuilderProvides,\n type IntentResolverProvides,\n type Plugin,\n type PluginDefinition,\n type TranslationsProvides,\n} from '@dxos/app-framework';\nimport { Config, Defaults, Envs, Local, Storage } from '@dxos/config';\nimport { registerSignalsRuntime } from '@dxos/echo-signals/react';\nimport { createExtension, type Node } from '@dxos/plugin-graph';\nimport { Client, type ClientOptions, ClientProvider } from '@dxos/react-client';\nimport { type IdentityPanelProps, type JoinPanelProps } from '@dxos/shell/react';\n\nimport { IdentityDialog, JoinDialog } from './components';\nimport meta, { CLIENT_PLUGIN, ClientAction, OBSERVABILITY_ACTION } from './meta';\nimport translations from './translations';\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\nexport const ClientPlugin = ({\n appKey,\n invitationUrl = window.location.origin,\n invitationParam = 'deviceInvitationCode',\n onClientInitialized,\n onReady,\n onReset,\n ...options\n}: ClientPluginOptions): PluginDefinition<\n Omit<ClientPluginProvides, 'client'>,\n Pick<ClientPluginProvides, 'client'>\n> => {\n registerSignalsRuntime();\n\n let client: Client;\n let error: unknown = null;\n\n const createDeviceInvitationUrl = (invitationCode: string) => {\n const baseUrl = new URL(invitationUrl);\n baseUrl.searchParams.set(invitationParam, invitationCode);\n return baseUrl.toString();\n };\n\n return {\n meta,\n initialize: async () => {\n const config = new Config(await Storage(), Envs(), Local(), Defaults());\n client = new Client({ config, ...options });\n\n try {\n await client.initialize();\n await onClientInitialized?.(client);\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 } catch (err) {\n error = err;\n }\n\n return {\n client,\n context: ({ children }) => <ClientProvider client={client}>{children}</ClientProvider>,\n };\n },\n ready: async (plugins) => {\n if (error) {\n throw error;\n }\n\n await onReady?.(client, plugins);\n },\n unload: async () => {\n await client.destroy();\n },\n provides: {\n translations,\n surface: {\n component: ({ data, role, ...rest }) => {\n switch (role) {\n case 'dialog':\n if (data.component === 'dxos.org/plugin/client/IdentityDialog') {\n return (\n <IdentityDialog\n {...(data.subject as IdentityPanelProps)}\n createInvitationUrl={createDeviceInvitationUrl}\n />\n );\n } else if (data.component === 'dxos.org/plugin/client/JoinDialog') {\n return <JoinDialog {...(data.subject as JoinPanelProps)} />;\n }\n break;\n }\n\n return null;\n },\n },\n graph: {\n builder: (plugins) => {\n const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);\n const id = `${CLIENT_PLUGIN}/open-shell`;\n\n return createExtension({\n id: CLIENT_PLUGIN,\n filter: (node): node is Node<null> => node.id === 'root',\n actions: () => [\n {\n id,\n data: async () => {\n await intentPlugin?.provides.intent.dispatch([\n { plugin: CLIENT_PLUGIN, action: ClientAction.SHARE_IDENTITY },\n ]);\n },\n properties: {\n label: ['open shell label', { ns: CLIENT_PLUGIN }],\n icon: 'ph--address-book--regular',\n keyBinding: {\n macos: 'meta+shift+.',\n // TODO(wittjosiah): Test on windows to see if it behaves the same as linux.\n windows: 'alt+shift+.',\n linux: 'alt+shift+>',\n },\n testId: 'clientPlugin.openShell',\n },\n },\n ],\n });\n },\n },\n intent: {\n resolver: async (intent) => {\n switch (intent.action) {\n case ClientAction.CREATE_IDENTITY: {\n const data = await client.halo.createIdentity();\n return {\n data,\n intents: [\n [\n {\n action: OBSERVABILITY_ACTION,\n data: {\n name: 'identity.create',\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.JOIN_IDENTITY: {\n return {\n data: true,\n intents: [\n [\n {\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n component: 'dxos.org/plugin/client/JoinDialog',\n dialogBlockAlign: 'start',\n subject: {\n initialInvitationCode: intent.data?.invitationCode,\n initialDisposition: 'accept-halo-invitation',\n } satisfies Partial<JoinPanelProps>,\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.SHARE_IDENTITY: {\n return {\n data: true,\n intents: [\n [\n {\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n component: 'dxos.org/plugin/client/IdentityDialog',\n dialogBlockAlign: 'start',\n },\n },\n ],\n [\n {\n action: OBSERVABILITY_ACTION,\n data: {\n name: 'identity.share',\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.RECOVER_IDENTITY: {\n return {\n data: true,\n intents: [\n [\n {\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n component: 'dxos.org/plugin/client/JoinDialog',\n dialogBlockAlign: 'start',\n subject: {\n initialDisposition: 'recover-identity',\n } satisfies Partial<JoinPanelProps>,\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.RESET_STORAGE: {\n await onReset?.({ target: intent.data?.target });\n return { data: true };\n }\n }\n },\n },\n },\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { useClient } from '@dxos/react-client';\nimport { Dialog } from '@dxos/react-ui';\nimport { ClipboardProvider, IdentityPanel, type IdentityPanelProps } from '@dxos/shell/react';\n\nimport { ClientAction } from '../meta';\n\nexport const IdentityDialog = (props: IdentityPanelProps) => {\n const dispatch = useIntentDispatcher();\n const client = useClient();\n\n const handleDone = useCallback(\n () =>\n dispatch({\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n state: false,\n },\n }),\n [dispatch],\n );\n\n const handleResetStorage = useCallback(async () => {\n await client.reset();\n await dispatch({ action: ClientAction.RESET_STORAGE });\n }, [dispatch]);\n\n const handleRecover = useCallback(async () => {\n await client.reset();\n await dispatch({ action: ClientAction.RESET_STORAGE, data: { target: 'recoverIdentity' } });\n }, [dispatch]);\n\n const handleJoinNewIdentity = useCallback(async () => {\n await client.reset();\n await dispatch({ action: ClientAction.RESET_STORAGE, data: { target: 'deviceInvitation' } });\n }, [dispatch]);\n\n return (\n <Dialog.Content>\n <ClipboardProvider>\n <IdentityPanel\n {...props}\n doneActionParent={<Dialog.Close asChild />}\n onDone={handleDone}\n onResetStorage={handleResetStorage}\n onRecover={handleRecover}\n onJoinNewIdentity={handleJoinNewIdentity}\n />\n </ClipboardProvider>\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\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, ClientAction, OBSERVABILITY_ACTION } from '../meta';\n\nexport const JoinDialog = (props: JoinPanelProps) => {\n const dispatch = useIntentDispatcher();\n\n const handleCancelResetStorage = useCallback(\n () => dispatch({ plugin: CLIENT_PLUGIN, action: ClientAction.SHARE_IDENTITY }),\n [dispatch],\n );\n\n const handleDone = useCallback(\n async (result: InvitationResult | null) => {\n if (result?.identityKey) {\n await Promise.all([\n dispatch({\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n state: false,\n },\n }),\n dispatch({\n action: OBSERVABILITY_ACTION,\n data: {\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 2023 DXOS.org\n//\n\nimport { CLIENT_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [CLIENT_PLUGIN]: {\n 'open shell label': 'Open HALO',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ClientPlugin } from './ClientPlugin';\n\nexport default ClientPlugin;\n\nexport * from './ClientPlugin';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;AAIA,OAAOA,YAAW;AAElB,SACEC,gBAAAA,eACAC,mBACAC,qBAOK;AACP,SAASC,QAAQC,UAAUC,MAAMC,OAAOC,eAAe;AACvD,SAASC,8BAA8B;AACvC,SAASC,uBAAkC;AAC3C,SAASC,QAA4BC,sBAAsB;;;
|
|
6
|
-
"names": ["React", "LayoutAction", "parseIntentPlugin", "resolvePlugin", "Config", "Defaults", "Envs", "Local", "Storage", "registerSignalsRuntime", "createExtension", "Client", "ClientProvider", "React", "useCallback", "LayoutAction", "useIntentDispatcher", "useClient", "
|
|
3
|
+
"sources": ["../../../src/ClientPlugin.tsx", "../../../src/components/IdentityDialog.tsx", "../../../src/components/JoinDialog.tsx", "../../../src/components/RecoveryCodeDialog.tsx", "../../../src/translations.ts", "../../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport {\n LayoutAction,\n parseIntentPlugin,\n resolvePlugin,\n type SurfaceProvides,\n type GraphBuilderProvides,\n type IntentResolverProvides,\n type Plugin,\n type PluginDefinition,\n type TranslationsProvides,\n} from '@dxos/app-framework';\nimport { Config, Defaults, Envs, Local, Storage } from '@dxos/config';\nimport { registerSignalsRuntime } from '@dxos/echo-signals/react';\nimport { invariant } from '@dxos/invariant';\nimport { createExtension, type Node } from '@dxos/plugin-graph';\nimport { Client, type ClientOptions, ClientProvider } from '@dxos/react-client';\nimport { type IdentityPanelProps, type JoinPanelProps } from '@dxos/shell/react';\n\nimport { IdentityDialog, JoinDialog, RecoveryCodeDialog, type RecoveryCodeDialogProps } from './components';\nimport meta, { CLIENT_PLUGIN, ClientAction, OBSERVABILITY_ACTION } from './meta';\nimport translations from './translations';\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\nexport const ClientPlugin = ({\n appKey,\n invitationUrl = window.location.origin,\n invitationParam = 'deviceInvitationCode',\n onClientInitialized,\n onReady,\n onReset,\n ...options\n}: ClientPluginOptions): PluginDefinition<\n Omit<ClientPluginProvides, 'client'>,\n Pick<ClientPluginProvides, 'client'>\n> => {\n registerSignalsRuntime();\n\n let client: Client;\n let error: unknown = null;\n\n const createDeviceInvitationUrl = (invitationCode: string) => {\n const baseUrl = new URL(invitationUrl);\n baseUrl.searchParams.set(invitationParam, invitationCode);\n return baseUrl.toString();\n };\n\n return {\n meta,\n initialize: async () => {\n const config = new Config(await Storage(), Envs(), Local(), Defaults());\n client = new Client({ config, ...options });\n\n try {\n await client.initialize();\n await onClientInitialized?.(client);\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 } catch (err) {\n error = err;\n }\n\n return {\n client,\n context: ({ children }) => <ClientProvider client={client}>{children}</ClientProvider>,\n };\n },\n ready: async (plugins) => {\n if (error) {\n throw error;\n }\n\n await onReady?.(client, plugins);\n },\n unload: async () => {\n await client.destroy();\n },\n provides: {\n translations,\n surface: {\n component: ({ data, role, ...rest }) => {\n switch (role) {\n case 'dialog':\n if (data.component === 'dxos.org/plugin/client/IdentityDialog') {\n return (\n <IdentityDialog\n {...(data.subject as IdentityPanelProps)}\n createInvitationUrl={createDeviceInvitationUrl}\n />\n );\n } else if (data.component === 'dxos.org/plugin/client/JoinDialog') {\n return <JoinDialog {...(data.subject as JoinPanelProps)} />;\n } else if (data.component === 'dxos.org/plugin/client/RecoveryCodeDialog') {\n return <RecoveryCodeDialog {...(data.subject as RecoveryCodeDialogProps)} />;\n }\n break;\n }\n\n return null;\n },\n },\n graph: {\n builder: (plugins) => {\n const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);\n const id = `${CLIENT_PLUGIN}/open-shell`;\n\n return createExtension({\n id: CLIENT_PLUGIN,\n filter: (node): node is Node<null> => node.id === 'root',\n actions: () => [\n {\n id,\n data: async () => {\n await intentPlugin?.provides.intent.dispatch([\n { plugin: CLIENT_PLUGIN, action: ClientAction.SHARE_IDENTITY },\n ]);\n },\n properties: {\n label: ['open shell label', { ns: CLIENT_PLUGIN }],\n icon: 'ph--address-book--regular',\n keyBinding: {\n macos: 'meta+shift+.',\n // TODO(wittjosiah): Test on windows to see if it behaves the same as linux.\n windows: 'alt+shift+.',\n linux: 'alt+shift+>',\n },\n testId: 'clientPlugin.openShell',\n },\n },\n ],\n });\n },\n },\n intent: {\n resolver: async (intent) => {\n switch (intent.action) {\n case ClientAction.CREATE_IDENTITY: {\n const data = await client.halo.createIdentity();\n return {\n data,\n intents: [\n [\n {\n action: OBSERVABILITY_ACTION,\n data: {\n name: 'identity.create',\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.JOIN_IDENTITY: {\n return {\n data: true,\n intents: [\n [\n {\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n component: 'dxos.org/plugin/client/JoinDialog',\n dialogBlockAlign: 'start',\n subject: {\n initialInvitationCode: intent.data?.invitationCode,\n initialDisposition: 'accept-halo-invitation',\n } satisfies Partial<JoinPanelProps>,\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.SHARE_IDENTITY: {\n return {\n data: true,\n intents: [\n [\n {\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n component: 'dxos.org/plugin/client/IdentityDialog',\n dialogBlockAlign: 'start',\n },\n },\n ],\n [\n {\n action: OBSERVABILITY_ACTION,\n data: {\n name: 'identity.share',\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.RECOVER_IDENTITY: {\n return {\n data: true,\n intents: [\n [\n {\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n component: 'dxos.org/plugin/client/JoinDialog',\n dialogBlockAlign: 'start',\n subject: {\n initialDisposition: 'recover-identity',\n } satisfies Partial<JoinPanelProps>,\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.RESET_STORAGE: {\n await onReset?.({ target: intent.data?.target });\n return { data: true };\n }\n\n case ClientAction.CREATE_AGENT: {\n invariant(client.services.services.EdgeAgentService, 'Missing EdgeAgentService');\n await client.services.services.EdgeAgentService.createAgent(null as any, { timeout: 10_000 });\n return { data: true };\n }\n\n case ClientAction.CREATE_RECOVERY_CODE: {\n invariant(client.services.services.IdentityService, 'IdentityService not available');\n // TODO(wittjosiah): This needs a proper api. Rename property.\n const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();\n return {\n data: true,\n intents: [\n [\n {\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n dialogBlockAlign: 'start',\n dialogType: 'alert',\n state: true,\n component: 'dxos.org/plugin/client/RecoveryCodeDialog',\n subject: { code: seedphrase },\n },\n },\n ],\n ],\n };\n }\n }\n },\n },\n },\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { 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 { ClientAction } from '../meta';\n\nexport const IdentityDialog = (props: IdentityPanelProps) => {\n const dispatch = useIntentDispatcher();\n const client = useClient();\n\n const handleDone = useCallback(\n () =>\n dispatch({\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n state: false,\n },\n }),\n [dispatch],\n );\n\n const handleResetStorage = useCallback(async () => {\n await client.reset();\n await dispatch({ action: ClientAction.RESET_STORAGE });\n }, [dispatch]);\n\n const handleRecover = useCallback(async () => {\n await client.reset();\n await dispatch({ action: ClientAction.RESET_STORAGE, data: { target: 'recoverIdentity' } });\n }, [dispatch]);\n\n const handleJoinNewIdentity = useCallback(async () => {\n await client.reset();\n await dispatch({ action: ClientAction.RESET_STORAGE, data: { 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 { LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\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, ClientAction, OBSERVABILITY_ACTION } from '../meta';\n\nexport const JoinDialog = (props: JoinPanelProps) => {\n const dispatch = useIntentDispatcher();\n\n const handleCancelResetStorage = useCallback(\n () => dispatch({ plugin: CLIENT_PLUGIN, action: ClientAction.SHARE_IDENTITY }),\n [dispatch],\n );\n\n const handleDone = useCallback(\n async (result: InvitationResult | null) => {\n if (result?.identityKey) {\n await Promise.all([\n dispatch({\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n state: false,\n },\n }),\n dispatch({\n action: OBSERVABILITY_ACTION,\n data: {\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 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 classNames=''>{t('recovery code dialog title')}</AlertDialog.Title>\n <p className='py-4'>{t('recovery code dialog description')}</p>\n <Clipboard.Provider>\n <Code value={code} />\n </Clipboard.Provider>\n <p className='py-4'>{t('recovery code dialog warning')}</p>\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\n// TODO(wittjosiah): Factor out.\nconst Code = ({ value }: { value: string }) => {\n return (\n <div className='relative p-2 border border-separator rounded group'>\n <Clipboard.IconButton value={value} classNames='absolute top-2 right-2 invisible group-hover:visible' />\n <code className='whitespace-pre-wrap'>{value}</code>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CLIENT_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [CLIENT_PLUGIN]: {\n 'open shell label': 'Open HALO',\n 'recovery code dialog title': 'Recovery Code',\n 'recovery code dialog description':\n '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.',\n 'recovery code dialog warning':\n 'Please note: This code will not be displayed again and cannot be replaced. It is your private key for recovering DXOS data. Anyone with this key will also be able to gain access to your account.',\n 'recovery code confirmation label': 'Confirm the code has been saved',\n 'continue label': 'Continue',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ClientPlugin } from './ClientPlugin';\n\nexport default ClientPlugin;\n\nexport * from './ClientPlugin';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAIA,OAAOA,YAAW;AAElB,SACEC,gBAAAA,eACAC,mBACAC,qBAOK;AACP,SAASC,QAAQC,UAAUC,MAAMC,OAAOC,eAAe;AACvD,SAASC,8BAA8B;AACvC,SAASC,iBAAiB;AAC1B,SAASC,uBAAkC;AAC3C,SAASC,QAA4BC,sBAAsB;;;ACjB3D,OAAOC,SAASC,mBAAmB;AAEnC,SAASC,cAAcC,2BAA2B;AAClD,SAASC,iBAAiB;AAC1B,SAASC,WAAWC,cAAc;AAClC,SAASC,qBAA8C;AAIhD,IAAMC,iBAAiB,CAACC,UAAAA;AAC7B,QAAMC,WAAWC,oBAAAA;AACjB,QAAMC,SAASC,UAAAA;AAEf,QAAMC,aAAaC,YACjB,MACEL,SAAS;IACPM,QAAQC,aAAaC;IACrBC,MAAM;MACJC,SAAS;MACTC,OAAO;IACT;EACF,CAAA,GACF;IAACX;GAAS;AAGZ,QAAMY,qBAAqBP,YAAY,YAAA;AACrC,UAAMH,OAAOW,MAAK;AAClB,UAAMb,SAAS;MAAEM,QAAQQ,aAAaC;IAAc,CAAA;EACtD,GAAG;IAACf;GAAS;AAEb,QAAMgB,gBAAgBX,YAAY,YAAA;AAChC,UAAMH,OAAOW,MAAK;AAClB,UAAMb,SAAS;MAAEM,QAAQQ,aAAaC;MAAeN,MAAM;QAAEQ,QAAQ;MAAkB;IAAE,CAAA;EAC3F,GAAG;IAACjB;GAAS;AAEb,QAAMkB,wBAAwBb,YAAY,YAAA;AACxC,UAAMH,OAAOW,MAAK;AAClB,UAAMb,SAAS;MAAEM,QAAQQ,aAAaC;MAAeN,MAAM;QAAEQ,QAAQ;MAAmB;IAAE,CAAA;EAC5F,GAAG;IAACjB;GAAS;AAEb,SACE,sBAAA,cAACmB,OAAOC,SAAO,MACb,sBAAA,cAACC,UAAUC,UAAQ,MACjB,sBAAA,c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AAOoG,SAASA,SAASC,iBAAiBC,YAAY,MAAa;gBAAEC,SAAS;cAAO,CAAA;AAC3F,qBAAO;gBAAEtD,MAAM;cAAK;YACtB;YAEA,KAAKsB,aAAaiC,sBAAsB;AACtCL,wBAAUnG,OAAOoG,SAASA,SAASK,iBAAiB,iCAAA;;;;;;;;;AAEpD,oBAAM,EAAEC,WAAU,IAAK,MAAM1G,OAAOoG,SAASA,SAASK,gBAAgBE,qBAAoB;AAC1F,qBAAO;gBACL1D,MAAM;gBACNoC,SAAS;kBACP;oBACE;sBACEf,QAAQmB,cAAaC;sBACrBzC,MAAM;wBACJ0C,SAAS;wBACTC,kBAAkB;wBAClBgB,YAAY;wBACZC,OAAO;wBACP7D,WAAW;wBACXK,SAAS;0BAAEyD,MAAMJ;wBAAW;sBAC9B;oBACF;;;cAGN;YACF;UACF;QACF;MACF;IACF;EACF;AACF;;;AKrTA,IAAA,cAAeK;",
|
|
6
|
+
"names": ["React", "LayoutAction", "parseIntentPlugin", "resolvePlugin", "Config", "Defaults", "Envs", "Local", "Storage", "registerSignalsRuntime", "invariant", "createExtension", "Client", "ClientProvider", "React", "useCallback", "LayoutAction", "useIntentDispatcher", "useClient", "Clipboard", "Dialog", "IdentityPanel", "IdentityDialog", "props", "dispatch", "useIntentDispatcher", "client", "useClient", "handleDone", "useCallback", "action", "LayoutAction", "SET_LAYOUT", "data", "element", "state", "handleResetStorage", "reset", "ClientAction", "RESET_STORAGE", "handleRecover", "target", "handleJoinNewIdentity", "Dialog", "Content", "Clipboard", "Provider", "IdentityPanel", "doneActionParent", "Close", "asChild", "onDone", "onResetStorage", "onRecover", "onJoinNewIdentity", "React", "useCallback", "LayoutAction", "useIntentDispatcher", "Dialog", "JoinPanel", "JoinDialog", "props", "dispatch", "useIntentDispatcher", "handleCancelResetStorage", "useCallback", "plugin", "CLIENT_PLUGIN", "action", "ClientAction", "SHARE_IDENTITY", "handleDone", "result", "identityKey", "Promise", "all", "LayoutAction", "SET_LAYOUT", "data", "element", "state", "OBSERVABILITY_ACTION", "name", "initialDisposition", "React", "Dialog", "Content", "JoinPanel", "mode", "exitActionParent", "Close", "asChild", "doneActionParent", "onCancelResetStorage", "onDone", "React", "useCallback", "useState", "AlertDialog", "Button", "Clipboard", "Input", "useTranslation", "RecoveryCodeDialog", "code", "t", "useTranslation", "CLIENT_PLUGIN", "confirmation", "setConfirmation", "useState", "handleConfirmation", "useCallback", "checked", "React", "AlertDialog", "Content", "classNames", "Title", "p", "className", "Clipboard", "Provider", "Code", "value", "div", "Input", "Root", "Checkbox", "data-testid", "onCheckedChange", "Label", "Action", "asChild", "Button", "variant", "disabled", "IconButton", "CLIENT_PLUGIN", "parseClientPlugin", "plugin", "provides", "client", "Client", "undefined", "ClientPlugin", "appKey", "invitationUrl", "window", "location", "origin", "invitationParam", "onClientInitialized", "onReady", "onReset", "options", "registerSignalsRuntime", "error", "createDeviceInvitationUrl", "invitationCode", "baseUrl", "URL", "searchParams", "set", "toString", "meta", "initialize", "config", "Config", "Storage", "Envs", "Local", "Defaults", "reloaded", "on", "halo", "identity", "subscribe", "href", "err", "context", "children", "React", "ClientProvider", "ready", "plugins", "unload", "destroy", "translations", "surface", "component", "data", "role", "rest", "IdentityDialog", "subject", "createInvitationUrl", "JoinDialog", "RecoveryCodeDialog", "graph", "builder", "intentPlugin", "resolvePlugin", "parseIntentPlugin", "id", "CLIENT_PLUGIN", "createExtension", "filter", "node", "actions", "intent", "dispatch", "action", "ClientAction", "SHARE_IDENTITY", "properties", "label", "ns", "icon", "keyBinding", "macos", "windows", "linux", "testId", "resolver", "CREATE_IDENTITY", "createIdentity", "intents", "OBSERVABILITY_ACTION", "name", "JOIN_IDENTITY", "LayoutAction", "SET_LAYOUT", "element", "dialogBlockAlign", "initialInvitationCode", "initialDisposition", "RECOVER_IDENTITY", "RESET_STORAGE", "target", "CREATE_AGENT", "invariant", "services", "EdgeAgentService", "createAgent", "timeout", "CREATE_RECOVERY_CODE", "IdentityService", "seedphrase", "createRecoveryPhrase", "dialogType", "state", "code", "ClientPlugin"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-client/src/meta.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-client/src/meta.ts":{"bytes":3419,"imports":[],"format":"esm"},"packages/plugins/plugin-client/src/components/IdentityDialog.tsx":{"bytes":6572,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/shell/react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-client/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-client/src/components/JoinDialog.tsx":{"bytes":6031,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/shell/react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-client/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-client/src/components/RecoveryCodeDialog.tsx":{"bytes":7403,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-client/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-client/src/components/index.ts":{"bytes":739,"imports":[{"path":"packages/plugins/plugin-client/src/components/IdentityDialog.tsx","kind":"import-statement","original":"./IdentityDialog"},{"path":"packages/plugins/plugin-client/src/components/JoinDialog.tsx","kind":"import-statement","original":"./JoinDialog"},{"path":"packages/plugins/plugin-client/src/components/RecoveryCodeDialog.tsx","kind":"import-statement","original":"./RecoveryCodeDialog"}],"format":"esm"},"packages/plugins/plugin-client/src/translations.ts":{"bytes":2616,"imports":[{"path":"packages/plugins/plugin-client/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-client/src/ClientPlugin.tsx":{"bytes":35879,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/config","kind":"import-statement","external":true},{"path":"@dxos/echo-signals/react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-client/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/plugin-client/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-client/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/plugins/plugin-client/src/index.ts":{"bytes":782,"imports":[{"path":"packages/plugins/plugin-client/src/ClientPlugin.tsx","kind":"import-statement","original":"./ClientPlugin"},{"path":"packages/plugins/plugin-client/src/ClientPlugin.tsx","kind":"import-statement","original":"./ClientPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-client/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":27353},"packages/plugins/plugin-client/dist/lib/node-esm/index.mjs":{"imports":[{"path":"packages/plugins/plugin-client/dist/lib/node-esm/chunk-C6X363FK.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/config","kind":"import-statement","external":true},{"path":"@dxos/echo-signals/react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-graph","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-client","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/shell/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/shell/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["ClientPlugin","default","parseClientPlugin"],"entryPoint":"packages/plugins/plugin-client/src/index.ts","inputs":{"packages/plugins/plugin-client/src/ClientPlugin.tsx":{"bytesInOutput":9038},"packages/plugins/plugin-client/src/components/IdentityDialog.tsx":{"bytesInOutput":1642},"packages/plugins/plugin-client/src/components/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-client/src/components/JoinDialog.tsx":{"bytesInOutput":1474},"packages/plugins/plugin-client/src/components/RecoveryCodeDialog.tsx":{"bytesInOutput":2208},"packages/plugins/plugin-client/src/translations.ts":{"bytesInOutput":735},"packages/plugins/plugin-client/src/index.ts":{"bytesInOutput":32}},"bytes":15864},"packages/plugins/plugin-client/dist/lib/node-esm/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-client/dist/lib/node-esm/meta.mjs":{"imports":[{"path":"packages/plugins/plugin-client/dist/lib/node-esm/chunk-C6X363FK.mjs","kind":"import-statement"}],"exports":["CLIENT_PLUGIN","ClientAction","OBSERVABILITY_ACTION","default"],"entryPoint":"packages/plugins/plugin-client/src/meta.ts","inputs":{},"bytes":333},"packages/plugins/plugin-client/dist/lib/node-esm/chunk-C6X363FK.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1466},"packages/plugins/plugin-client/dist/lib/node-esm/chunk-C6X363FK.mjs":{"imports":[],"exports":["CLIENT_PLUGIN","ClientAction","OBSERVABILITY_ACTION","meta_default"],"inputs":{"packages/plugins/plugin-client/src/meta.ts":{"bytesInOutput":1062}},"bytes":1330}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientPlugin.d.ts","sourceRoot":"","sources":["../../../src/ClientPlugin.tsx"],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;AAE5G,eAAO,MAAM,YAAY,kGAQtB,mBAAmB,KAAG,gBAAgB,CACvC,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC,EACpC,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CA0OrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdentityDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/IdentityDialog.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAK3C,OAAO,
|
|
1
|
+
{"version":3,"file":"IdentityDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/IdentityDialog.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAK3C,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAI3E,eAAO,MAAM,cAAc,UAAW,kBAAkB,sBA6CvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecoveryCodeDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/RecoveryCodeDialog.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAMrD,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,kBAAkB,aAAc,uBAAuB,sBAiCnE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC"}
|
package/dist/types/src/meta.d.ts
CHANGED
|
@@ -9,7 +9,9 @@ export declare enum ClientAction {
|
|
|
9
9
|
JOIN_IDENTITY = "dxos.org/plugin/client/action/JOIN_IDENTITY",
|
|
10
10
|
SHARE_IDENTITY = "dxos.org/plugin/client/action/SHARE_IDENTITY",
|
|
11
11
|
RECOVER_IDENTITY = "dxos.org/plugin/client/action/RECOVER_IDENTITY",
|
|
12
|
-
RESET_STORAGE = "dxos.org/plugin/client/action/RESET_STORAGE"
|
|
12
|
+
RESET_STORAGE = "dxos.org/plugin/client/action/RESET_STORAGE",
|
|
13
|
+
CREATE_AGENT = "dxos.org/plugin/client/action/CREATE_AGENT",
|
|
14
|
+
CREATE_RECOVERY_CODE = "dxos.org/plugin/client/action/CREATE_RECOVERY_CODE"
|
|
13
15
|
}
|
|
14
16
|
export declare const OBSERVABILITY_ACTION = "dxos.org/plugin/observability/send-event";
|
|
15
17
|
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa,2BAA2B,CAAC;;;;;AAEtD,wBAGuB;AAGvB,oBAAY,YAAY;IACtB,eAAe,kDAAqC;IACpD,aAAa,gDAAmC;IAChD,cAAc,iDAAoC;IAClD,gBAAgB,mDAAsC;IACtD,aAAa,gDAAmC;
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa,2BAA2B,CAAC;;;;;AAEtD,wBAGuB;AAGvB,oBAAY,YAAY;IACtB,eAAe,kDAAqC;IACpD,aAAa,gDAAmC;IAChD,cAAc,iDAAoC;IAClD,gBAAgB,mDAAsC;IACtD,aAAa,gDAAmC;IAChD,YAAY,+CAAkC;IAC9C,oBAAoB,uDAA0C;CAC/D;AAGD,eAAO,MAAM,oBAAoB,6CAA6C,CAAC"}
|
|
@@ -2,6 +2,11 @@ declare const _default: {
|
|
|
2
2
|
'en-US': {
|
|
3
3
|
"dxos.org/plugin/client": {
|
|
4
4
|
'open shell label': string;
|
|
5
|
+
'recovery code dialog title': string;
|
|
6
|
+
'recovery code dialog description': string;
|
|
7
|
+
'recovery code dialog warning': string;
|
|
8
|
+
'recovery code confirmation label': string;
|
|
9
|
+
'continue label': string;
|
|
5
10
|
};
|
|
6
11
|
};
|
|
7
12
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;;;;;AAMA,wBAeE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-client",
|
|
3
|
-
"version": "0.7.3
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "DXOS Surface plugin for DXOS Client",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@phosphor-icons/react": "^2.1.5",
|
|
36
|
-
"@dxos/app-framework": "0.7.3
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
36
|
+
"@dxos/app-framework": "0.7.3",
|
|
37
|
+
"@dxos/config": "0.7.3",
|
|
38
|
+
"@dxos/echo-signals": "0.7.3",
|
|
39
|
+
"@dxos/local-storage": "0.7.3",
|
|
40
|
+
"@dxos/log": "0.7.3",
|
|
41
|
+
"@dxos/echo-schema": "0.7.3",
|
|
42
|
+
"@dxos/invariant": "0.7.3",
|
|
43
|
+
"@dxos/react-client": "0.7.3",
|
|
44
|
+
"@dxos/plugin-graph": "0.7.3",
|
|
45
|
+
"@dxos/react-ui": "0.7.3",
|
|
46
|
+
"@dxos/shell": "0.7.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/react": "~18.2.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"react": "~18.2.0",
|
|
52
52
|
"react-dom": "~18.2.0",
|
|
53
53
|
"vite": "5.4.7",
|
|
54
|
-
"@dxos/storybook-utils": "0.7.3
|
|
54
|
+
"@dxos/storybook-utils": "0.7.3"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@phosphor-icons/react": "^2.1.5",
|
package/src/ClientPlugin.tsx
CHANGED
|
@@ -17,11 +17,12 @@ import {
|
|
|
17
17
|
} from '@dxos/app-framework';
|
|
18
18
|
import { Config, Defaults, Envs, Local, Storage } from '@dxos/config';
|
|
19
19
|
import { registerSignalsRuntime } from '@dxos/echo-signals/react';
|
|
20
|
+
import { invariant } from '@dxos/invariant';
|
|
20
21
|
import { createExtension, type Node } from '@dxos/plugin-graph';
|
|
21
22
|
import { Client, type ClientOptions, ClientProvider } from '@dxos/react-client';
|
|
22
23
|
import { type IdentityPanelProps, type JoinPanelProps } from '@dxos/shell/react';
|
|
23
24
|
|
|
24
|
-
import { IdentityDialog, JoinDialog } from './components';
|
|
25
|
+
import { IdentityDialog, JoinDialog, RecoveryCodeDialog, type RecoveryCodeDialogProps } from './components';
|
|
25
26
|
import meta, { CLIENT_PLUGIN, ClientAction, OBSERVABILITY_ACTION } from './meta';
|
|
26
27
|
import translations from './translations';
|
|
27
28
|
|
|
@@ -143,6 +144,8 @@ export const ClientPlugin = ({
|
|
|
143
144
|
);
|
|
144
145
|
} else if (data.component === 'dxos.org/plugin/client/JoinDialog') {
|
|
145
146
|
return <JoinDialog {...(data.subject as JoinPanelProps)} />;
|
|
147
|
+
} else if (data.component === 'dxos.org/plugin/client/RecoveryCodeDialog') {
|
|
148
|
+
return <RecoveryCodeDialog {...(data.subject as RecoveryCodeDialogProps)} />;
|
|
146
149
|
}
|
|
147
150
|
break;
|
|
148
151
|
}
|
|
@@ -275,6 +278,36 @@ export const ClientPlugin = ({
|
|
|
275
278
|
await onReset?.({ target: intent.data?.target });
|
|
276
279
|
return { data: true };
|
|
277
280
|
}
|
|
281
|
+
|
|
282
|
+
case ClientAction.CREATE_AGENT: {
|
|
283
|
+
invariant(client.services.services.EdgeAgentService, 'Missing EdgeAgentService');
|
|
284
|
+
await client.services.services.EdgeAgentService.createAgent(null as any, { timeout: 10_000 });
|
|
285
|
+
return { data: true };
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
case ClientAction.CREATE_RECOVERY_CODE: {
|
|
289
|
+
invariant(client.services.services.IdentityService, 'IdentityService not available');
|
|
290
|
+
// TODO(wittjosiah): This needs a proper api. Rename property.
|
|
291
|
+
const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();
|
|
292
|
+
return {
|
|
293
|
+
data: true,
|
|
294
|
+
intents: [
|
|
295
|
+
[
|
|
296
|
+
{
|
|
297
|
+
action: LayoutAction.SET_LAYOUT,
|
|
298
|
+
data: {
|
|
299
|
+
element: 'dialog',
|
|
300
|
+
dialogBlockAlign: 'start',
|
|
301
|
+
dialogType: 'alert',
|
|
302
|
+
state: true,
|
|
303
|
+
component: 'dxos.org/plugin/client/RecoveryCodeDialog',
|
|
304
|
+
subject: { code: seedphrase },
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
],
|
|
308
|
+
],
|
|
309
|
+
};
|
|
310
|
+
}
|
|
278
311
|
}
|
|
279
312
|
},
|
|
280
313
|
},
|
|
@@ -6,8 +6,8 @@ import React, { useCallback } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { LayoutAction, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { useClient } from '@dxos/react-client';
|
|
9
|
-
import { Dialog } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
9
|
+
import { Clipboard, Dialog } from '@dxos/react-ui';
|
|
10
|
+
import { IdentityPanel, type IdentityPanelProps } from '@dxos/shell/react';
|
|
11
11
|
|
|
12
12
|
import { ClientAction } from '../meta';
|
|
13
13
|
|
|
@@ -44,7 +44,7 @@ export const IdentityDialog = (props: IdentityPanelProps) => {
|
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
46
|
<Dialog.Content>
|
|
47
|
-
<
|
|
47
|
+
<Clipboard.Provider>
|
|
48
48
|
<IdentityPanel
|
|
49
49
|
{...props}
|
|
50
50
|
doneActionParent={<Dialog.Close asChild />}
|
|
@@ -53,7 +53,7 @@ export const IdentityDialog = (props: IdentityPanelProps) => {
|
|
|
53
53
|
onRecover={handleRecover}
|
|
54
54
|
onJoinNewIdentity={handleJoinNewIdentity}
|
|
55
55
|
/>
|
|
56
|
-
</
|
|
56
|
+
</Clipboard.Provider>
|
|
57
57
|
</Dialog.Content>
|
|
58
58
|
);
|
|
59
59
|
};
|