@dxos/plugin-client 0.7.4-staging.f7e8224 → 0.7.5-feature-compute.4d9d99a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/app-graph-builder-6LOTDB4T.mjs +44 -0
- package/dist/lib/browser/app-graph-builder-6LOTDB4T.mjs.map +7 -0
- package/dist/lib/browser/chunk-6IF6PREG.mjs +158 -0
- package/dist/lib/browser/chunk-6IF6PREG.mjs.map +7 -0
- package/dist/lib/browser/chunk-E3OUNOEL.mjs +76 -0
- package/dist/lib/browser/chunk-E3OUNOEL.mjs.map +7 -0
- package/dist/lib/browser/chunk-NHIL4T3L.mjs +12 -0
- package/dist/lib/browser/chunk-NHIL4T3L.mjs.map +7 -0
- package/dist/lib/browser/chunk-R4Q6H7RD.mjs +18 -0
- package/dist/lib/browser/chunk-R4Q6H7RD.mjs.map +7 -0
- package/dist/lib/browser/chunk-SVBQRT7I.mjs +17 -0
- package/dist/lib/browser/chunk-SVBQRT7I.mjs.map +7 -0
- package/dist/lib/browser/client-25GYH6TN.mjs +45 -0
- package/dist/lib/browser/client-25GYH6TN.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +74 -423
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-IWWLWOZD.mjs +132 -0
- package/dist/lib/browser/intent-resolver-IWWLWOZD.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-M3RT6SSG.mjs +24 -0
- package/dist/lib/browser/react-context-M3RT6SSG.mjs.map +7 -0
- package/dist/lib/browser/react-surface-XXONPG5T.mjs +41 -0
- package/dist/lib/browser/react-surface-XXONPG5T.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +8 -0
- package/dist/lib/node/app-graph-builder-JCND3P6G.cjs +58 -0
- package/dist/lib/node/app-graph-builder-JCND3P6G.cjs.map +7 -0
- package/dist/lib/node/chunk-3OB25QN2.cjs +36 -0
- package/dist/lib/node/chunk-3OB25QN2.cjs.map +7 -0
- package/dist/lib/node/chunk-IXVWJCYB.cjs +37 -0
- package/dist/lib/node/chunk-IXVWJCYB.cjs.map +7 -0
- package/dist/lib/node/chunk-N3U7KVO3.cjs +186 -0
- package/dist/lib/node/chunk-N3U7KVO3.cjs.map +7 -0
- package/dist/lib/node/chunk-NVYWMDF3.cjs +95 -0
- package/dist/lib/node/chunk-NVYWMDF3.cjs.map +7 -0
- package/dist/lib/node/{meta.cjs → chunk-OIFPM5ZW.cjs} +12 -11
- package/dist/lib/node/chunk-OIFPM5ZW.cjs.map +7 -0
- package/dist/lib/node/client-52L4TUYU.cjs +59 -0
- package/dist/lib/node/client-52L4TUYU.cjs.map +7 -0
- package/dist/lib/node/index.cjs +69 -411
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-H3Y64MIP.cjs +140 -0
- package/dist/lib/node/intent-resolver-H3Y64MIP.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-context-B2DNULH4.cjs +48 -0
- package/dist/lib/node/react-context-B2DNULH4.cjs.map +7 -0
- package/dist/lib/node/react-surface-7USN5NOO.cjs +62 -0
- package/dist/lib/node/react-surface-7USN5NOO.cjs.map +7 -0
- package/dist/lib/node/types.cjs +30 -0
- package/dist/lib/node/types.cjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-ZLGKFBLY.mjs +45 -0
- package/dist/lib/node-esm/app-graph-builder-ZLGKFBLY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-73M5MK5Q.mjs +19 -0
- package/dist/lib/node-esm/chunk-73M5MK5Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-74T33KTB.mjs +77 -0
- package/dist/lib/node-esm/chunk-74T33KTB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-EHGD3UJH.mjs +159 -0
- package/dist/lib/node-esm/chunk-EHGD3UJH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HO7WDE7C.mjs +14 -0
- package/dist/lib/node-esm/chunk-HO7WDE7C.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-OBGRL3DF.mjs +18 -0
- package/dist/lib/node-esm/chunk-OBGRL3DF.mjs.map +7 -0
- package/dist/lib/node-esm/client-K52NWOUN.mjs +46 -0
- package/dist/lib/node-esm/client-K52NWOUN.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +74 -423
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-JCKD6R6L.mjs +133 -0
- package/dist/lib/node-esm/intent-resolver-JCKD6R6L.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-context-IGEHJQK5.mjs +25 -0
- package/dist/lib/node-esm/react-context-IGEHJQK5.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-CXLBCMPN.mjs +42 -0
- package/dist/lib/node-esm/react-surface-CXLBCMPN.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +9 -0
- package/dist/types/src/ClientPlugin.d.ts +2 -36
- package/dist/types/src/ClientPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +8 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/client.d.ts +9 -0
- package/dist/types/src/capabilities/client.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +193 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +8 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context.d.ts +8 -0
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +7 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/IdentityDialog.d.ts +1 -0
- package/dist/types/src/components/IdentityDialog.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +1 -0
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/RecoveryCodeDialog.d.ts +1 -0
- package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +1 -1
- package/dist/types/src/components/RecoveryCodeDialog.stories.d.ts +8 -0
- package/dist/types/src/components/RecoveryCodeDialog.stories.d.ts.map +1 -0
- package/dist/types/src/events.d.ts +7 -0
- package/dist/types/src/events.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -12
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +98 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +21 -19
- package/src/ClientPlugin.ts +59 -0
- package/src/capabilities/app-graph-builder.ts +39 -0
- package/src/capabilities/capabilities.ts +15 -0
- package/src/capabilities/client.ts +48 -0
- package/src/capabilities/index.ts +13 -0
- package/src/capabilities/intent-resolver.ts +101 -0
- package/src/capabilities/react-context.tsx +20 -0
- package/src/capabilities/react-surface.tsx +44 -0
- package/src/components/IdentityDialog.tsx +13 -11
- package/src/components/JoinDialog.tsx +13 -19
- package/src/components/RecoveryCodeDialog.stories.tsx +50 -0
- package/src/components/RecoveryCodeDialog.tsx +19 -7
- package/src/events.ts +14 -0
- package/src/index.ts +4 -4
- package/src/meta.ts +1 -15
- package/src/translations.ts +5 -4
- package/src/types.ts +89 -0
- package/dist/lib/browser/chunk-FGUXUNOK.mjs +0 -26
- package/dist/lib/browser/chunk-FGUXUNOK.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -13
- package/dist/lib/node/chunk-XYLDQWFV.cjs +0 -51
- package/dist/lib/node/chunk-XYLDQWFV.cjs.map +0 -7
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-C6X363FK.mjs +0 -28
- package/dist/lib/node-esm/chunk-C6X363FK.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -14
- package/src/ClientPlugin.tsx +0 -316
- /package/dist/lib/browser/{meta.mjs.map → types.mjs.map} +0 -0
- /package/dist/lib/node-esm/{meta.mjs.map → types.mjs.map} +0 -0
|
@@ -1,170 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ClientEvents
|
|
3
|
+
} from "./chunk-R4Q6H7RD.mjs";
|
|
4
|
+
import {
|
|
5
|
+
ClientCapabilities
|
|
6
|
+
} from "./chunk-SVBQRT7I.mjs";
|
|
1
7
|
import {
|
|
2
8
|
CLIENT_PLUGIN,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
meta_default
|
|
6
|
-
} from "./chunk-FGUXUNOK.mjs";
|
|
7
|
-
|
|
8
|
-
// packages/plugins/plugin-client/src/ClientPlugin.tsx
|
|
9
|
-
import React4 from "react";
|
|
10
|
-
import { LayoutAction as LayoutAction3, parseIntentPlugin, resolvePlugin } from "@dxos/app-framework";
|
|
11
|
-
import { Config, Defaults, Envs, Local, Storage } from "@dxos/config";
|
|
12
|
-
import { registerSignalsRuntime } from "@dxos/echo-signals/react";
|
|
13
|
-
import { invariant } from "@dxos/invariant";
|
|
14
|
-
import { createExtension } from "@dxos/plugin-graph";
|
|
15
|
-
import { Client, ClientProvider } from "@dxos/react-client";
|
|
9
|
+
meta
|
|
10
|
+
} from "./chunk-NHIL4T3L.mjs";
|
|
16
11
|
|
|
17
|
-
// packages/plugins/plugin-client/src/
|
|
18
|
-
import
|
|
19
|
-
import { LayoutAction, useIntentDispatcher } from "@dxos/app-framework";
|
|
20
|
-
import { useClient } from "@dxos/react-client";
|
|
21
|
-
import { Clipboard, Dialog } from "@dxos/react-ui";
|
|
22
|
-
import { IdentityPanel } from "@dxos/shell/react";
|
|
23
|
-
var IdentityDialog = (props) => {
|
|
24
|
-
const dispatch = useIntentDispatcher();
|
|
25
|
-
const client = useClient();
|
|
26
|
-
const handleDone = useCallback(() => dispatch({
|
|
27
|
-
action: LayoutAction.SET_LAYOUT,
|
|
28
|
-
data: {
|
|
29
|
-
element: "dialog",
|
|
30
|
-
state: false
|
|
31
|
-
}
|
|
32
|
-
}), [
|
|
33
|
-
dispatch
|
|
34
|
-
]);
|
|
35
|
-
const handleResetStorage = useCallback(async () => {
|
|
36
|
-
await client.reset();
|
|
37
|
-
await dispatch({
|
|
38
|
-
action: ClientAction.RESET_STORAGE
|
|
39
|
-
});
|
|
40
|
-
}, [
|
|
41
|
-
dispatch
|
|
42
|
-
]);
|
|
43
|
-
const handleRecover = useCallback(async () => {
|
|
44
|
-
await client.reset();
|
|
45
|
-
await dispatch({
|
|
46
|
-
action: ClientAction.RESET_STORAGE,
|
|
47
|
-
data: {
|
|
48
|
-
target: "recoverIdentity"
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}, [
|
|
52
|
-
dispatch
|
|
53
|
-
]);
|
|
54
|
-
const handleJoinNewIdentity = useCallback(async () => {
|
|
55
|
-
await client.reset();
|
|
56
|
-
await dispatch({
|
|
57
|
-
action: ClientAction.RESET_STORAGE,
|
|
58
|
-
data: {
|
|
59
|
-
target: "deviceInvitation"
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}, [
|
|
63
|
-
dispatch
|
|
64
|
-
]);
|
|
65
|
-
return /* @__PURE__ */ React.createElement(Dialog.Content, null, /* @__PURE__ */ React.createElement(Clipboard.Provider, null, /* @__PURE__ */ React.createElement(IdentityPanel, {
|
|
66
|
-
...props,
|
|
67
|
-
doneActionParent: /* @__PURE__ */ React.createElement(Dialog.Close, {
|
|
68
|
-
asChild: true
|
|
69
|
-
}),
|
|
70
|
-
onDone: handleDone,
|
|
71
|
-
onResetStorage: handleResetStorage,
|
|
72
|
-
onRecover: handleRecover,
|
|
73
|
-
onJoinNewIdentity: handleJoinNewIdentity
|
|
74
|
-
})));
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// packages/plugins/plugin-client/src/components/JoinDialog.tsx
|
|
78
|
-
import React2, { useCallback as useCallback2 } from "react";
|
|
79
|
-
import { LayoutAction as LayoutAction2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
80
|
-
import { Dialog as Dialog2 } from "@dxos/react-ui";
|
|
81
|
-
import { JoinPanel } from "@dxos/shell/react";
|
|
82
|
-
var JoinDialog = (props) => {
|
|
83
|
-
const dispatch = useIntentDispatcher2();
|
|
84
|
-
const handleCancelResetStorage = useCallback2(() => dispatch({
|
|
85
|
-
plugin: CLIENT_PLUGIN,
|
|
86
|
-
action: ClientAction.SHARE_IDENTITY
|
|
87
|
-
}), [
|
|
88
|
-
dispatch
|
|
89
|
-
]);
|
|
90
|
-
const handleDone = useCallback2(async (result) => {
|
|
91
|
-
if (result?.identityKey) {
|
|
92
|
-
await Promise.all([
|
|
93
|
-
dispatch({
|
|
94
|
-
action: LayoutAction2.SET_LAYOUT,
|
|
95
|
-
data: {
|
|
96
|
-
element: "dialog",
|
|
97
|
-
state: false
|
|
98
|
-
}
|
|
99
|
-
}),
|
|
100
|
-
dispatch({
|
|
101
|
-
action: OBSERVABILITY_ACTION,
|
|
102
|
-
data: {
|
|
103
|
-
name: props.initialDisposition === "recover-identity" ? "identity.recover" : "identity.join"
|
|
104
|
-
}
|
|
105
|
-
})
|
|
106
|
-
]);
|
|
107
|
-
}
|
|
108
|
-
}, [
|
|
109
|
-
dispatch
|
|
110
|
-
]);
|
|
111
|
-
return /* @__PURE__ */ React2.createElement(Dialog2.Content, null, /* @__PURE__ */ React2.createElement(JoinPanel, {
|
|
112
|
-
mode: "halo-only",
|
|
113
|
-
...props,
|
|
114
|
-
exitActionParent: /* @__PURE__ */ React2.createElement(Dialog2.Close, {
|
|
115
|
-
asChild: true
|
|
116
|
-
}),
|
|
117
|
-
doneActionParent: /* @__PURE__ */ React2.createElement(Dialog2.Close, {
|
|
118
|
-
asChild: true
|
|
119
|
-
}),
|
|
120
|
-
onCancelResetStorage: handleCancelResetStorage,
|
|
121
|
-
onDone: handleDone
|
|
122
|
-
}));
|
|
123
|
-
};
|
|
12
|
+
// packages/plugins/plugin-client/src/ClientPlugin.ts
|
|
13
|
+
import { Capabilities, contributes, defineModule, definePlugin, Events } from "@dxos/app-framework";
|
|
124
14
|
|
|
125
|
-
// packages/plugins/plugin-client/src/
|
|
126
|
-
import
|
|
127
|
-
|
|
128
|
-
var
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return /* @__PURE__ */ React3.createElement(AlertDialog.Content, {
|
|
133
|
-
classNames: "bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
134
|
-
}, /* @__PURE__ */ React3.createElement(AlertDialog.Title, {
|
|
135
|
-
classNames: ""
|
|
136
|
-
}, t("recovery code dialog title")), /* @__PURE__ */ React3.createElement("p", {
|
|
137
|
-
className: "py-4"
|
|
138
|
-
}, t("recovery code dialog description")), /* @__PURE__ */ React3.createElement(Clipboard2.Provider, null, /* @__PURE__ */ React3.createElement(Code, {
|
|
139
|
-
value: code
|
|
140
|
-
})), /* @__PURE__ */ React3.createElement("p", {
|
|
141
|
-
className: "py-4"
|
|
142
|
-
}, t("recovery code dialog warning")), /* @__PURE__ */ React3.createElement("div", {
|
|
143
|
-
className: "flex items-center gap-2 pbe-4"
|
|
144
|
-
}, /* @__PURE__ */ React3.createElement(Input.Root, null, /* @__PURE__ */ React3.createElement(Input.Checkbox, {
|
|
145
|
-
"data-testid": "recoveryCode.confirm",
|
|
146
|
-
checked: confirmation,
|
|
147
|
-
onCheckedChange: handleConfirmation
|
|
148
|
-
}), /* @__PURE__ */ React3.createElement(Input.Label, null, t("recovery code confirmation label")))), /* @__PURE__ */ React3.createElement("div", {
|
|
149
|
-
className: "flex justify-end"
|
|
150
|
-
}, /* @__PURE__ */ React3.createElement(AlertDialog.Action, {
|
|
151
|
-
asChild: true
|
|
152
|
-
}, /* @__PURE__ */ React3.createElement(Button, {
|
|
153
|
-
"data-testid": "recoveryCode.continue",
|
|
154
|
-
variant: "primary",
|
|
155
|
-
disabled: !confirmation
|
|
156
|
-
}, t("continue label")))));
|
|
157
|
-
};
|
|
158
|
-
var Code = ({ value }) => {
|
|
159
|
-
return /* @__PURE__ */ React3.createElement("div", {
|
|
160
|
-
className: "relative p-2 border border-separator rounded group"
|
|
161
|
-
}, /* @__PURE__ */ React3.createElement(Clipboard2.IconButton, {
|
|
162
|
-
value,
|
|
163
|
-
classNames: "absolute top-2 right-2 invisible group-hover:visible"
|
|
164
|
-
}), /* @__PURE__ */ React3.createElement("code", {
|
|
165
|
-
className: "whitespace-pre-wrap"
|
|
166
|
-
}, value));
|
|
167
|
-
};
|
|
15
|
+
// packages/plugins/plugin-client/src/capabilities/index.ts
|
|
16
|
+
import { lazy } from "@dxos/app-framework";
|
|
17
|
+
var AppGraphBuilder = lazy(async () => import("./app-graph-builder-6LOTDB4T.mjs"));
|
|
18
|
+
var Client = lazy(async () => import("./client-25GYH6TN.mjs"));
|
|
19
|
+
var IntentResolver = lazy(async () => import("./intent-resolver-IWWLWOZD.mjs"));
|
|
20
|
+
var ReactContext = lazy(async () => import("./react-context-M3RT6SSG.mjs"));
|
|
21
|
+
var ReactSurface = lazy(async () => import("./react-surface-XXONPG5T.mjs"));
|
|
168
22
|
|
|
169
23
|
// packages/plugins/plugin-client/src/translations.ts
|
|
170
24
|
var translations_default = [
|
|
@@ -172,279 +26,76 @@ var translations_default = [
|
|
|
172
26
|
"en-US": {
|
|
173
27
|
[CLIENT_PLUGIN]: {
|
|
174
28
|
"open shell label": "Open HALO",
|
|
175
|
-
"recovery code dialog title": "Recovery
|
|
29
|
+
"recovery code dialog title": "Account Recovery",
|
|
176
30
|
"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.",
|
|
177
|
-
"recovery code dialog warning": "
|
|
178
|
-
"recovery code
|
|
31
|
+
"recovery code dialog warning 1": "NOTE: This code will not be displayed again.",
|
|
32
|
+
"recovery code dialog warning 2": "It is your private key for recovering DXOS data. Anyone with this key will be able to gain access to your account.",
|
|
33
|
+
"recovery code confirmation label": "Please confirm you have saved the code.",
|
|
179
34
|
"continue label": "Continue"
|
|
180
35
|
}
|
|
181
36
|
}
|
|
182
37
|
}
|
|
183
38
|
];
|
|
184
39
|
|
|
185
|
-
// packages/plugins/plugin-client/src/ClientPlugin.
|
|
186
|
-
var
|
|
187
|
-
|
|
188
|
-
var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitationParam = "deviceInvitationCode", onClientInitialized, onReady, onReset, ...options }) => {
|
|
189
|
-
registerSignalsRuntime();
|
|
190
|
-
let client;
|
|
191
|
-
let error = null;
|
|
192
|
-
const createDeviceInvitationUrl = (invitationCode) => {
|
|
40
|
+
// packages/plugins/plugin-client/src/ClientPlugin.ts
|
|
41
|
+
var ClientPlugin = ({ invitationUrl = window.location.origin, invitationParam = "deviceInvitationCode", onReset, ...options }) => {
|
|
42
|
+
const createInvitationUrl = (invitationCode) => {
|
|
193
43
|
const baseUrl = new URL(invitationUrl);
|
|
194
44
|
baseUrl.searchParams.set(invitationParam, invitationCode);
|
|
195
45
|
return baseUrl.toString();
|
|
196
46
|
};
|
|
197
|
-
return
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
createInvitationUrl: createDeviceInvitationUrl
|
|
244
|
-
});
|
|
245
|
-
} else if (data.component === "dxos.org/plugin/client/JoinDialog") {
|
|
246
|
-
return /* @__PURE__ */ React4.createElement(JoinDialog, data.subject);
|
|
247
|
-
} else if (data.component === "dxos.org/plugin/client/RecoveryCodeDialog") {
|
|
248
|
-
return /* @__PURE__ */ React4.createElement(RecoveryCodeDialog, data.subject);
|
|
249
|
-
}
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
|
-
return null;
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
graph: {
|
|
256
|
-
builder: (plugins) => {
|
|
257
|
-
const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
|
|
258
|
-
const id = `${CLIENT_PLUGIN}/open-shell`;
|
|
259
|
-
return createExtension({
|
|
260
|
-
id: CLIENT_PLUGIN,
|
|
261
|
-
filter: (node) => node.id === "root",
|
|
262
|
-
actions: () => [
|
|
263
|
-
{
|
|
264
|
-
id,
|
|
265
|
-
data: async () => {
|
|
266
|
-
await intentPlugin?.provides.intent.dispatch([
|
|
267
|
-
{
|
|
268
|
-
plugin: CLIENT_PLUGIN,
|
|
269
|
-
action: ClientAction.SHARE_IDENTITY
|
|
270
|
-
}
|
|
271
|
-
]);
|
|
272
|
-
},
|
|
273
|
-
properties: {
|
|
274
|
-
label: [
|
|
275
|
-
"open shell label",
|
|
276
|
-
{
|
|
277
|
-
ns: CLIENT_PLUGIN
|
|
278
|
-
}
|
|
279
|
-
],
|
|
280
|
-
icon: "ph--address-book--regular",
|
|
281
|
-
keyBinding: {
|
|
282
|
-
macos: "meta+shift+.",
|
|
283
|
-
// TODO(wittjosiah): Test on windows to see if it behaves the same as linux.
|
|
284
|
-
windows: "alt+shift+.",
|
|
285
|
-
linux: "alt+shift+>"
|
|
286
|
-
},
|
|
287
|
-
testId: "clientPlugin.openShell"
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
]
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
intent: {
|
|
295
|
-
resolver: async (intent) => {
|
|
296
|
-
switch (intent.action) {
|
|
297
|
-
case ClientAction.CREATE_IDENTITY: {
|
|
298
|
-
const data = await client.halo.createIdentity();
|
|
299
|
-
return {
|
|
300
|
-
data,
|
|
301
|
-
intents: [
|
|
302
|
-
[
|
|
303
|
-
{
|
|
304
|
-
action: OBSERVABILITY_ACTION,
|
|
305
|
-
data: {
|
|
306
|
-
name: "identity.create"
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
]
|
|
310
|
-
]
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
case ClientAction.JOIN_IDENTITY: {
|
|
314
|
-
return {
|
|
315
|
-
data: true,
|
|
316
|
-
intents: [
|
|
317
|
-
[
|
|
318
|
-
{
|
|
319
|
-
action: LayoutAction3.SET_LAYOUT,
|
|
320
|
-
data: {
|
|
321
|
-
element: "dialog",
|
|
322
|
-
component: "dxos.org/plugin/client/JoinDialog",
|
|
323
|
-
dialogBlockAlign: "start",
|
|
324
|
-
subject: {
|
|
325
|
-
initialInvitationCode: intent.data?.invitationCode,
|
|
326
|
-
initialDisposition: "accept-halo-invitation"
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
]
|
|
331
|
-
]
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
case ClientAction.SHARE_IDENTITY: {
|
|
335
|
-
return {
|
|
336
|
-
data: true,
|
|
337
|
-
intents: [
|
|
338
|
-
[
|
|
339
|
-
{
|
|
340
|
-
action: LayoutAction3.SET_LAYOUT,
|
|
341
|
-
data: {
|
|
342
|
-
element: "dialog",
|
|
343
|
-
component: "dxos.org/plugin/client/IdentityDialog",
|
|
344
|
-
dialogBlockAlign: "start"
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
],
|
|
348
|
-
[
|
|
349
|
-
{
|
|
350
|
-
action: OBSERVABILITY_ACTION,
|
|
351
|
-
data: {
|
|
352
|
-
name: "identity.share"
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
]
|
|
356
|
-
]
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
case ClientAction.RECOVER_IDENTITY: {
|
|
360
|
-
return {
|
|
361
|
-
data: true,
|
|
362
|
-
intents: [
|
|
363
|
-
[
|
|
364
|
-
{
|
|
365
|
-
action: LayoutAction3.SET_LAYOUT,
|
|
366
|
-
data: {
|
|
367
|
-
element: "dialog",
|
|
368
|
-
component: "dxos.org/plugin/client/JoinDialog",
|
|
369
|
-
dialogBlockAlign: "start",
|
|
370
|
-
subject: {
|
|
371
|
-
initialDisposition: "recover-identity"
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
]
|
|
376
|
-
]
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
case ClientAction.RESET_STORAGE: {
|
|
380
|
-
await onReset?.({
|
|
381
|
-
target: intent.data?.target
|
|
382
|
-
});
|
|
383
|
-
return {
|
|
384
|
-
data: true
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
case ClientAction.CREATE_AGENT: {
|
|
388
|
-
invariant(client.services.services.EdgeAgentService, "Missing EdgeAgentService", {
|
|
389
|
-
F: __dxlog_file,
|
|
390
|
-
L: 283,
|
|
391
|
-
S: void 0,
|
|
392
|
-
A: [
|
|
393
|
-
"client.services.services.EdgeAgentService",
|
|
394
|
-
"'Missing EdgeAgentService'"
|
|
395
|
-
]
|
|
396
|
-
});
|
|
397
|
-
await client.services.services.EdgeAgentService.createAgent(null, {
|
|
398
|
-
timeout: 1e4
|
|
399
|
-
});
|
|
400
|
-
return {
|
|
401
|
-
data: true
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
case ClientAction.CREATE_RECOVERY_CODE: {
|
|
405
|
-
invariant(client.services.services.IdentityService, "IdentityService not available", {
|
|
406
|
-
F: __dxlog_file,
|
|
407
|
-
L: 289,
|
|
408
|
-
S: void 0,
|
|
409
|
-
A: [
|
|
410
|
-
"client.services.services.IdentityService",
|
|
411
|
-
"'IdentityService not available'"
|
|
412
|
-
]
|
|
413
|
-
});
|
|
414
|
-
const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();
|
|
415
|
-
return {
|
|
416
|
-
data: true,
|
|
417
|
-
intents: [
|
|
418
|
-
[
|
|
419
|
-
{
|
|
420
|
-
action: LayoutAction3.SET_LAYOUT,
|
|
421
|
-
data: {
|
|
422
|
-
element: "dialog",
|
|
423
|
-
dialogBlockAlign: "start",
|
|
424
|
-
dialogType: "alert",
|
|
425
|
-
state: true,
|
|
426
|
-
component: "dxos.org/plugin/client/RecoveryCodeDialog",
|
|
427
|
-
subject: {
|
|
428
|
-
code: seedphrase
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
]
|
|
433
|
-
]
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
};
|
|
47
|
+
return definePlugin(meta, [
|
|
48
|
+
defineModule({
|
|
49
|
+
id: `${meta.id}/module/client`,
|
|
50
|
+
activatesOn: Events.Startup,
|
|
51
|
+
activatesBefore: [
|
|
52
|
+
ClientEvents.SetupClient
|
|
53
|
+
],
|
|
54
|
+
activatesAfter: [
|
|
55
|
+
ClientEvents.ClientReady
|
|
56
|
+
],
|
|
57
|
+
activate: (context) => Client({
|
|
58
|
+
...options,
|
|
59
|
+
context
|
|
60
|
+
})
|
|
61
|
+
}),
|
|
62
|
+
defineModule({
|
|
63
|
+
id: `${meta.id}/module/react-context`,
|
|
64
|
+
activatesOn: Events.Startup,
|
|
65
|
+
activate: ReactContext
|
|
66
|
+
}),
|
|
67
|
+
defineModule({
|
|
68
|
+
id: `${meta.id}/module/react-surface`,
|
|
69
|
+
activatesOn: Events.Startup,
|
|
70
|
+
activate: () => ReactSurface({
|
|
71
|
+
createInvitationUrl
|
|
72
|
+
})
|
|
73
|
+
}),
|
|
74
|
+
defineModule({
|
|
75
|
+
id: `${meta.id}/module/app-graph-builder`,
|
|
76
|
+
activatesOn: Events.SetupAppGraph,
|
|
77
|
+
activate: AppGraphBuilder
|
|
78
|
+
}),
|
|
79
|
+
defineModule({
|
|
80
|
+
id: `${meta.id}/module/intent-resolver`,
|
|
81
|
+
activatesOn: Events.SetupIntents,
|
|
82
|
+
activate: (context) => IntentResolver({
|
|
83
|
+
context,
|
|
84
|
+
onReset
|
|
85
|
+
})
|
|
86
|
+
}),
|
|
87
|
+
defineModule({
|
|
88
|
+
id: `${meta.id}/module/translations`,
|
|
89
|
+
activatesOn: Events.SetupTranslations,
|
|
90
|
+
activate: () => contributes(Capabilities.Translations, translations_default)
|
|
91
|
+
})
|
|
92
|
+
]);
|
|
441
93
|
};
|
|
442
|
-
|
|
443
|
-
// packages/plugins/plugin-client/src/index.ts
|
|
444
|
-
var src_default = ClientPlugin;
|
|
445
94
|
export {
|
|
95
|
+
CLIENT_PLUGIN,
|
|
96
|
+
ClientCapabilities,
|
|
97
|
+
ClientEvents,
|
|
446
98
|
ClientPlugin,
|
|
447
|
-
|
|
448
|
-
parseClientPlugin
|
|
99
|
+
meta
|
|
449
100
|
};
|
|
450
101
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/ClientPlugin.
|
|
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": "
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/ClientPlugin.ts", "../../../src/capabilities/index.ts", "../../../src/translations.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, defineModule, definePlugin, Events } from '@dxos/app-framework';\n\nimport { Client, AppGraphBuilder, IntentResolver, ReactContext, ReactSurface } from './capabilities';\nimport { ClientEvents } from './events';\nimport { meta } from './meta';\nimport translations from './translations';\nimport { type ClientPluginOptions } from './types';\n\nexport const ClientPlugin = ({\n invitationUrl = window.location.origin,\n invitationParam = 'deviceInvitationCode',\n onReset,\n ...options\n}: ClientPluginOptions) => {\n const createInvitationUrl = (invitationCode: string) => {\n const baseUrl = new URL(invitationUrl);\n baseUrl.searchParams.set(invitationParam, invitationCode);\n return baseUrl.toString();\n };\n\n return definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/client`,\n activatesOn: Events.Startup,\n activatesBefore: [ClientEvents.SetupClient],\n activatesAfter: [ClientEvents.ClientReady],\n activate: (context) => Client({ ...options, context }),\n }),\n defineModule({\n id: `${meta.id}/module/react-context`,\n activatesOn: Events.Startup,\n activate: ReactContext,\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.Startup,\n activate: () => ReactSurface({ createInvitationUrl }),\n }),\n defineModule({\n id: `${meta.id}/module/app-graph-builder`,\n activatesOn: Events.SetupAppGraph,\n activate: AppGraphBuilder,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntents,\n activate: (context) => IntentResolver({ context, onReset }),\n }),\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n ]);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const AppGraphBuilder = lazy(async () => import('./app-graph-builder'));\nexport const Client = lazy(async () => import('./client'));\nexport const IntentResolver = lazy(async () => import('./intent-resolver'));\nexport const ReactContext = lazy(async () => import('./react-context'));\nexport const ReactSurface = lazy(async () => import('./react-surface'));\n\nexport * from './capabilities';\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': 'Account Recovery',\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 1': 'NOTE: This code will not be displayed again.',\n 'recovery code dialog warning 2':\n 'It is your private key for recovering DXOS data. Anyone with this key will be able to gain access to your account.',\n 'recovery code confirmation label': 'Please confirm you have saved the code.',\n 'continue label': 'Continue',\n },\n },\n },\n];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAIA,SAASA,cAAcC,aAAaC,cAAcC,cAAcC,cAAc;;;ACA9E,SAASC,YAAY;AAEd,IAAMC,kBAAkBC,KAAK,YAAY,OAAO,kCAAA,CAAA;AAChD,IAAMC,SAASD,KAAK,YAAY,OAAO,uBAAA,CAAA;AACvC,IAAME,iBAAiBF,KAAK,YAAY,OAAO,gCAAA,CAAA;AAC/C,IAAMG,eAAeH,KAAK,YAAY,OAAO,8BAAA,CAAA;AAC7C,IAAMI,eAAeJ,KAAK,YAAY,OAAO,8BAAA,CAAA;;;ACJpD,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACK,aAAAA,GAAgB;QACf,oBAAoB;QACpB,8BAA8B;QAC9B,oCACE;QACF,kCAAkC;QAClC,kCACE;QACF,oCAAoC;QACpC,kBAAkB;MACpB;IACF;EACF;;;;AFTK,IAAMC,eAAe,CAAC,EAC3BC,gBAAgBC,OAAOC,SAASC,QAChCC,kBAAkB,wBAClBC,SACA,GAAGC,QAAAA,MACiB;AACpB,QAAMC,sBAAsB,CAACC,mBAAAA;AAC3B,UAAMC,UAAU,IAAIC,IAAIV,aAAAA;AACxBS,YAAQE,aAAaC,IAAIR,iBAAiBI,cAAAA;AAC1C,WAAOC,QAAQI,SAAQ;EACzB;AAEA,SAAOC,aAAaC,MAAM;IACxBC,aAAa;MACXC,IAAI,GAAGF,KAAKE,EAAE;MACdC,aAAaC,OAAOC;MACpBC,iBAAiB;QAACC,aAAaC;;MAC/BC,gBAAgB;QAACF,aAAaG;;MAC9BC,UAAU,CAACC,YAAYC,OAAO;QAAE,GAAGtB;QAASqB;MAAQ,CAAA;IACtD,CAAA;IACAX,aAAa;MACXC,IAAI,GAAGF,KAAKE,EAAE;MACdC,aAAaC,OAAOC;MACpBM,UAAUG;IACZ,CAAA;IACAb,aAAa;MACXC,IAAI,GAAGF,KAAKE,EAAE;MACdC,aAAaC,OAAOC;MACpBM,UAAU,MAAMI,aAAa;QAAEvB;MAAoB,CAAA;IACrD,CAAA;IACAS,aAAa;MACXC,IAAI,GAAGF,KAAKE,EAAE;MACdC,aAAaC,OAAOY;MACpBL,UAAUM;IACZ,CAAA;IACAhB,aAAa;MACXC,IAAI,GAAGF,KAAKE,EAAE;MACdC,aAAaC,OAAOc;MACpBP,UAAU,CAACC,YAAYO,eAAe;QAAEP;QAAStB;MAAQ,CAAA;IAC3D,CAAA;IACAW,aAAa;MACXC,IAAI,GAAGF,KAAKE,EAAE;MACdC,aAAaC,OAAOgB;MACpBT,UAAU,MAAMU,YAAYC,aAAaC,cAAcC,oBAAAA;IACzD,CAAA;GACD;AACH;",
|
|
6
|
+
"names": ["Capabilities", "contributes", "defineModule", "definePlugin", "Events", "lazy", "AppGraphBuilder", "lazy", "Client", "IntentResolver", "ReactContext", "ReactSurface", "CLIENT_PLUGIN", "ClientPlugin", "invitationUrl", "window", "location", "origin", "invitationParam", "onReset", "options", "createInvitationUrl", "invitationCode", "baseUrl", "URL", "searchParams", "set", "toString", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "activatesBefore", "ClientEvents", "SetupClient", "activatesAfter", "ClientReady", "activate", "context", "Client", "ReactContext", "ReactSurface", "SetupAppGraph", "AppGraphBuilder", "SetupIntents", "IntentResolver", "SetupTranslations", "contributes", "Capabilities", "Translations", "translations"]
|
|
7
7
|
}
|