@dxos/plugin-client 0.7.4-staging.f7e8224 → 0.7.5-main.499c70c
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-52IJQ35F.mjs +78 -0
- package/dist/lib/browser/chunk-52IJQ35F.mjs.map +7 -0
- package/dist/lib/browser/chunk-X4QUPYC6.mjs +12 -0
- package/dist/lib/browser/chunk-X4QUPYC6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +184 -233
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -5
- package/dist/lib/browser/types.mjs +10 -0
- package/dist/lib/browser/types.mjs.map +7 -0
- package/dist/lib/node/chunk-NFO3ADQC.cjs +98 -0
- package/dist/lib/node/chunk-NFO3ADQC.cjs.map +7 -0
- package/dist/lib/node/chunk-RUA5KXVW.cjs +35 -0
- package/dist/lib/node/chunk-RUA5KXVW.cjs.map +7 -0
- package/dist/lib/node/index.cjs +186 -236
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.cjs +4 -8
- package/dist/lib/node/meta.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types.cjs +32 -0
- package/dist/lib/node/types.cjs.map +7 -0
- package/dist/lib/node-esm/chunk-GMGRQ5Q7.mjs +14 -0
- package/dist/lib/node-esm/chunk-GMGRQ5Q7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-TI4GNGMM.mjs +79 -0
- package/dist/lib/node-esm/chunk-TI4GNGMM.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +184 -233
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -5
- package/dist/lib/node-esm/types.mjs +11 -0
- package/dist/lib/node-esm/types.mjs.map +7 -0
- package/dist/types/src/ClientPlugin.d.ts +2 -35
- package/dist/types/src/ClientPlugin.d.ts.map +1 -1
- 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/meta.d.ts +0 -10
- 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 +110 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +22 -13
- package/src/ClientPlugin.tsx +111 -200
- 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/meta.ts +0 -14
- package/src/translations.ts +5 -4
- package/src/types.ts +115 -0
- package/dist/lib/browser/chunk-FGUXUNOK.mjs +0 -26
- package/dist/lib/browser/chunk-FGUXUNOK.mjs.map +0 -7
- package/dist/lib/node/chunk-XYLDQWFV.cjs +0 -51
- package/dist/lib/node/chunk-XYLDQWFV.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
|
@@ -1,65 +1,57 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
ClientAction
|
|
4
|
+
} from "./chunk-TI4GNGMM.mjs";
|
|
2
5
|
import {
|
|
3
6
|
CLIENT_PLUGIN,
|
|
4
|
-
ClientAction,
|
|
5
|
-
OBSERVABILITY_ACTION,
|
|
6
7
|
meta_default
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GMGRQ5Q7.mjs";
|
|
8
9
|
|
|
9
10
|
// packages/plugins/plugin-client/src/ClientPlugin.tsx
|
|
10
11
|
import React4 from "react";
|
|
11
|
-
import { LayoutAction as LayoutAction3, parseIntentPlugin, resolvePlugin } from "@dxos/app-framework";
|
|
12
|
+
import { LayoutAction as LayoutAction3, parseIntentPlugin, resolvePlugin, createSurface, createIntent as createIntent3, createResolver } from "@dxos/app-framework";
|
|
12
13
|
import { Config, Defaults, Envs, Local, Storage } from "@dxos/config";
|
|
13
14
|
import { registerSignalsRuntime } from "@dxos/echo-signals/react";
|
|
14
15
|
import { invariant } from "@dxos/invariant";
|
|
15
16
|
import { createExtension } from "@dxos/plugin-graph";
|
|
17
|
+
import { ObservabilityAction as ObservabilityAction2 } from "@dxos/plugin-observability/types";
|
|
16
18
|
import { Client, ClientProvider } from "@dxos/react-client";
|
|
17
19
|
|
|
18
20
|
// packages/plugins/plugin-client/src/components/IdentityDialog.tsx
|
|
19
21
|
import React, { useCallback } from "react";
|
|
20
|
-
import { LayoutAction, useIntentDispatcher } from "@dxos/app-framework";
|
|
22
|
+
import { createIntent, LayoutAction, useIntentDispatcher } from "@dxos/app-framework";
|
|
21
23
|
import { useClient } from "@dxos/react-client";
|
|
22
24
|
import { Clipboard, Dialog } from "@dxos/react-ui";
|
|
23
25
|
import { IdentityPanel } from "@dxos/shell/react";
|
|
26
|
+
var IDENTITY_DIALOG = `${CLIENT_PLUGIN}/IdentityDialog`;
|
|
24
27
|
var IdentityDialog = (props) => {
|
|
25
|
-
const dispatch = useIntentDispatcher();
|
|
28
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
26
29
|
const client = useClient();
|
|
27
|
-
const handleDone = useCallback(() => dispatch({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
state: false
|
|
32
|
-
}
|
|
33
|
-
}), [
|
|
30
|
+
const handleDone = useCallback(() => dispatch(createIntent(LayoutAction.SetLayout, {
|
|
31
|
+
element: "dialog",
|
|
32
|
+
state: false
|
|
33
|
+
})), [
|
|
34
34
|
dispatch
|
|
35
35
|
]);
|
|
36
36
|
const handleResetStorage = useCallback(async () => {
|
|
37
37
|
await client.reset();
|
|
38
|
-
await dispatch(
|
|
39
|
-
action: ClientAction.RESET_STORAGE
|
|
40
|
-
});
|
|
38
|
+
await dispatch(createIntent(ClientAction.ResetStorage));
|
|
41
39
|
}, [
|
|
42
40
|
dispatch
|
|
43
41
|
]);
|
|
44
42
|
const handleRecover = useCallback(async () => {
|
|
45
43
|
await client.reset();
|
|
46
|
-
await dispatch({
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
target: "recoverIdentity"
|
|
50
|
-
}
|
|
51
|
-
});
|
|
44
|
+
await dispatch(createIntent(ClientAction.ResetStorage, {
|
|
45
|
+
target: "recoverIdentity"
|
|
46
|
+
}));
|
|
52
47
|
}, [
|
|
53
48
|
dispatch
|
|
54
49
|
]);
|
|
55
50
|
const handleJoinNewIdentity = useCallback(async () => {
|
|
56
51
|
await client.reset();
|
|
57
|
-
await dispatch({
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
target: "deviceInvitation"
|
|
61
|
-
}
|
|
62
|
-
});
|
|
52
|
+
await dispatch(createIntent(ClientAction.ResetStorage, {
|
|
53
|
+
target: "deviceInvitation"
|
|
54
|
+
}));
|
|
63
55
|
}, [
|
|
64
56
|
dispatch
|
|
65
57
|
]);
|
|
@@ -77,33 +69,26 @@ var IdentityDialog = (props) => {
|
|
|
77
69
|
|
|
78
70
|
// packages/plugins/plugin-client/src/components/JoinDialog.tsx
|
|
79
71
|
import React2, { useCallback as useCallback2 } from "react";
|
|
80
|
-
import { LayoutAction as LayoutAction2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
72
|
+
import { createIntent as createIntent2, LayoutAction as LayoutAction2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
73
|
+
import { ObservabilityAction } from "@dxos/plugin-observability/types";
|
|
81
74
|
import { Dialog as Dialog2 } from "@dxos/react-ui";
|
|
82
75
|
import { JoinPanel } from "@dxos/shell/react";
|
|
76
|
+
var JOIN_DIALOG = `${CLIENT_PLUGIN}/JoinDialog`;
|
|
83
77
|
var JoinDialog = (props) => {
|
|
84
|
-
const dispatch = useIntentDispatcher2();
|
|
85
|
-
const handleCancelResetStorage = useCallback2(() => dispatch(
|
|
86
|
-
plugin: CLIENT_PLUGIN,
|
|
87
|
-
action: ClientAction.SHARE_IDENTITY
|
|
88
|
-
}), [
|
|
78
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
79
|
+
const handleCancelResetStorage = useCallback2(() => dispatch(createIntent2(ClientAction.ShareIdentity)), [
|
|
89
80
|
dispatch
|
|
90
81
|
]);
|
|
91
82
|
const handleDone = useCallback2(async (result) => {
|
|
92
83
|
if (result?.identityKey) {
|
|
93
84
|
await Promise.all([
|
|
94
|
-
dispatch({
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
})
|
|
101
|
-
dispatch({
|
|
102
|
-
action: OBSERVABILITY_ACTION,
|
|
103
|
-
data: {
|
|
104
|
-
name: props.initialDisposition === "recover-identity" ? "identity.recover" : "identity.join"
|
|
105
|
-
}
|
|
106
|
-
})
|
|
85
|
+
dispatch(createIntent2(LayoutAction2.SetLayout, {
|
|
86
|
+
element: "dialog",
|
|
87
|
+
state: false
|
|
88
|
+
})),
|
|
89
|
+
dispatch(createIntent2(ObservabilityAction.SendEvent, {
|
|
90
|
+
name: props.initialDisposition === "recover-identity" ? "identity.recover" : "identity.join"
|
|
91
|
+
}))
|
|
107
92
|
]);
|
|
108
93
|
}
|
|
109
94
|
}, [
|
|
@@ -126,21 +111,20 @@ var JoinDialog = (props) => {
|
|
|
126
111
|
// packages/plugins/plugin-client/src/components/RecoveryCodeDialog.tsx
|
|
127
112
|
import React3, { useCallback as useCallback3, useState } from "react";
|
|
128
113
|
import { AlertDialog, Button, Clipboard as Clipboard2, Input, useTranslation } from "@dxos/react-ui";
|
|
114
|
+
var RECOVER_CODE_DIALOG = `${CLIENT_PLUGIN}/RecoveryCodeDialog`;
|
|
129
115
|
var RecoveryCodeDialog = ({ code }) => {
|
|
130
116
|
const { t } = useTranslation(CLIENT_PLUGIN);
|
|
131
117
|
const [confirmation, setConfirmation] = useState(false);
|
|
132
118
|
const handleConfirmation = useCallback3((checked) => setConfirmation(checked), []);
|
|
133
119
|
return /* @__PURE__ */ React3.createElement(AlertDialog.Content, {
|
|
134
120
|
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", {
|
|
121
|
+
}, /* @__PURE__ */ React3.createElement(AlertDialog.Title, null, t("recovery code dialog title")), /* @__PURE__ */ React3.createElement("p", {
|
|
138
122
|
className: "py-4"
|
|
139
123
|
}, t("recovery code dialog description")), /* @__PURE__ */ React3.createElement(Clipboard2.Provider, null, /* @__PURE__ */ React3.createElement(Code, {
|
|
140
|
-
|
|
141
|
-
})), /* @__PURE__ */ React3.createElement("
|
|
142
|
-
className: "py-4"
|
|
143
|
-
}, t("recovery code dialog warning")), /* @__PURE__ */ React3.createElement("div", {
|
|
124
|
+
code
|
|
125
|
+
})), /* @__PURE__ */ React3.createElement("div", {
|
|
126
|
+
className: "flex flex-col py-4 gap-2"
|
|
127
|
+
}, /* @__PURE__ */ React3.createElement("p", null, t("recovery code dialog warning 1")), /* @__PURE__ */ React3.createElement("p", null, t("recovery code dialog warning 2"))), /* @__PURE__ */ React3.createElement("div", {
|
|
144
128
|
className: "flex items-center gap-2 pbe-4"
|
|
145
129
|
}, /* @__PURE__ */ React3.createElement(Input.Root, null, /* @__PURE__ */ React3.createElement(Input.Checkbox, {
|
|
146
130
|
"data-testid": "recoveryCode.confirm",
|
|
@@ -156,15 +140,23 @@ var RecoveryCodeDialog = ({ code }) => {
|
|
|
156
140
|
disabled: !confirmation
|
|
157
141
|
}, t("continue label")))));
|
|
158
142
|
};
|
|
159
|
-
var Code = ({
|
|
143
|
+
var Code = ({ code }) => {
|
|
144
|
+
const words = code.split(" ");
|
|
160
145
|
return /* @__PURE__ */ React3.createElement("div", {
|
|
161
146
|
className: "relative p-2 border border-separator rounded group"
|
|
162
147
|
}, /* @__PURE__ */ React3.createElement(Clipboard2.IconButton, {
|
|
163
|
-
value,
|
|
148
|
+
value: code,
|
|
164
149
|
classNames: "absolute top-2 right-2 invisible group-hover:visible"
|
|
165
|
-
}), /* @__PURE__ */ React3.createElement("
|
|
166
|
-
className: "
|
|
167
|
-
},
|
|
150
|
+
}), /* @__PURE__ */ React3.createElement("div", {
|
|
151
|
+
className: "grid grid-cols-4"
|
|
152
|
+
}, words.map((word, i) => /* @__PURE__ */ React3.createElement("div", {
|
|
153
|
+
key: i,
|
|
154
|
+
className: "flex items-center p-2 gap-2 items-center"
|
|
155
|
+
}, /* @__PURE__ */ React3.createElement("div", {
|
|
156
|
+
className: "w-4 text-xs text-center text-subdued"
|
|
157
|
+
}, i + 1), /* @__PURE__ */ React3.createElement("div", {
|
|
158
|
+
className: "text-sm"
|
|
159
|
+
}, word)))));
|
|
168
160
|
};
|
|
169
161
|
|
|
170
162
|
// packages/plugins/plugin-client/src/translations.ts
|
|
@@ -173,10 +165,11 @@ var translations_default = [
|
|
|
173
165
|
"en-US": {
|
|
174
166
|
[CLIENT_PLUGIN]: {
|
|
175
167
|
"open shell label": "Open HALO",
|
|
176
|
-
"recovery code dialog title": "Recovery
|
|
168
|
+
"recovery code dialog title": "Account Recovery",
|
|
177
169
|
"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": "
|
|
179
|
-
"recovery code
|
|
170
|
+
"recovery code dialog warning 1": "NOTE: This code will not be displayed again.",
|
|
171
|
+
"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.",
|
|
172
|
+
"recovery code confirmation label": "Please confirm you have saved the code.",
|
|
180
173
|
"continue label": "Continue"
|
|
181
174
|
}
|
|
182
175
|
}
|
|
@@ -185,7 +178,6 @@ var translations_default = [
|
|
|
185
178
|
|
|
186
179
|
// packages/plugins/plugin-client/src/ClientPlugin.tsx
|
|
187
180
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-client/src/ClientPlugin.tsx";
|
|
188
|
-
var parseClientPlugin = (plugin) => (plugin?.provides).client instanceof Client ? plugin : void 0;
|
|
189
181
|
var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitationParam = "deviceInvitationCode", onClientInitialized, onReady, onReset, ...options }) => {
|
|
190
182
|
registerSignalsRuntime();
|
|
191
183
|
let client;
|
|
@@ -223,7 +215,7 @@ var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitation
|
|
|
223
215
|
}, children)
|
|
224
216
|
};
|
|
225
217
|
},
|
|
226
|
-
ready: async (plugins) => {
|
|
218
|
+
ready: async ({ plugins }) => {
|
|
227
219
|
if (error) {
|
|
228
220
|
throw error;
|
|
229
221
|
}
|
|
@@ -235,27 +227,33 @@ var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitation
|
|
|
235
227
|
provides: {
|
|
236
228
|
translations: translations_default,
|
|
237
229
|
surface: {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
230
|
+
definitions: () => [
|
|
231
|
+
createSurface({
|
|
232
|
+
id: IDENTITY_DIALOG,
|
|
233
|
+
role: "dialog",
|
|
234
|
+
filter: (data) => data.component === IDENTITY_DIALOG,
|
|
235
|
+
component: ({ data }) => /* @__PURE__ */ React4.createElement(IdentityDialog, {
|
|
236
|
+
...data.subject,
|
|
237
|
+
createInvitationUrl: createDeviceInvitationUrl
|
|
238
|
+
})
|
|
239
|
+
}),
|
|
240
|
+
createSurface({
|
|
241
|
+
id: JOIN_DIALOG,
|
|
242
|
+
role: "dialog",
|
|
243
|
+
filter: (data) => data.component === JOIN_DIALOG,
|
|
244
|
+
component: ({ data }) => /* @__PURE__ */ React4.createElement(JoinDialog, data.subject)
|
|
245
|
+
}),
|
|
246
|
+
createSurface({
|
|
247
|
+
id: RECOVER_CODE_DIALOG,
|
|
248
|
+
role: "dialog",
|
|
249
|
+
filter: (data) => data.component === RECOVER_CODE_DIALOG,
|
|
250
|
+
component: ({ data }) => /* @__PURE__ */ React4.createElement(RecoveryCodeDialog, data.subject)
|
|
251
|
+
})
|
|
252
|
+
]
|
|
255
253
|
},
|
|
256
254
|
graph: {
|
|
257
255
|
builder: (plugins) => {
|
|
258
|
-
const
|
|
256
|
+
const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatchPromise;
|
|
259
257
|
const id = `${CLIENT_PLUGIN}/open-shell`;
|
|
260
258
|
return createExtension({
|
|
261
259
|
id: CLIENT_PLUGIN,
|
|
@@ -264,12 +262,7 @@ var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitation
|
|
|
264
262
|
{
|
|
265
263
|
id,
|
|
266
264
|
data: async () => {
|
|
267
|
-
await
|
|
268
|
-
{
|
|
269
|
-
plugin: CLIENT_PLUGIN,
|
|
270
|
-
action: ClientAction.SHARE_IDENTITY
|
|
271
|
-
}
|
|
272
|
-
]);
|
|
265
|
+
await dispatch?.(createIntent3(ClientAction.ShareIdentity));
|
|
273
266
|
},
|
|
274
267
|
properties: {
|
|
275
268
|
label: [
|
|
@@ -293,149 +286,108 @@ var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitation
|
|
|
293
286
|
}
|
|
294
287
|
},
|
|
295
288
|
intent: {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
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
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
289
|
+
resolvers: () => [
|
|
290
|
+
createResolver(ClientAction.CreateIdentity, async () => {
|
|
291
|
+
const data = await client.halo.createIdentity();
|
|
292
|
+
return {
|
|
293
|
+
data,
|
|
294
|
+
intents: [
|
|
295
|
+
createIntent3(ObservabilityAction2.SendEvent, {
|
|
296
|
+
name: "identity.create"
|
|
297
|
+
})
|
|
298
|
+
]
|
|
299
|
+
};
|
|
300
|
+
}),
|
|
301
|
+
createResolver(ClientAction.JoinIdentity, async (data) => {
|
|
302
|
+
return {
|
|
303
|
+
intents: [
|
|
304
|
+
createIntent3(LayoutAction3.SetLayout, {
|
|
305
|
+
element: "dialog",
|
|
306
|
+
component: JOIN_DIALOG,
|
|
307
|
+
dialogBlockAlign: "start",
|
|
308
|
+
subject: {
|
|
309
|
+
initialInvitationCode: data.invitationCode,
|
|
310
|
+
initialDisposition: "accept-halo-invitation"
|
|
311
|
+
}
|
|
312
|
+
})
|
|
313
|
+
]
|
|
314
|
+
};
|
|
315
|
+
}),
|
|
316
|
+
createResolver(ClientAction.ShareIdentity, async () => {
|
|
317
|
+
return {
|
|
318
|
+
intents: [
|
|
319
|
+
createIntent3(LayoutAction3.SetLayout, {
|
|
320
|
+
element: "dialog",
|
|
321
|
+
component: IDENTITY_DIALOG,
|
|
322
|
+
dialogBlockAlign: "start"
|
|
323
|
+
}),
|
|
324
|
+
createIntent3(ObservabilityAction2.SendEvent, {
|
|
325
|
+
name: "identity.share"
|
|
326
|
+
})
|
|
327
|
+
]
|
|
328
|
+
};
|
|
329
|
+
}),
|
|
330
|
+
createResolver(ClientAction.RecoverIdentity, async () => {
|
|
331
|
+
return {
|
|
332
|
+
intents: [
|
|
333
|
+
createIntent3(LayoutAction3.SetLayout, {
|
|
334
|
+
element: "dialog",
|
|
335
|
+
component: JOIN_DIALOG,
|
|
336
|
+
dialogBlockAlign: "start",
|
|
337
|
+
subject: {
|
|
338
|
+
initialDisposition: "recover-identity"
|
|
339
|
+
}
|
|
340
|
+
})
|
|
341
|
+
]
|
|
342
|
+
};
|
|
343
|
+
}),
|
|
344
|
+
createResolver(ClientAction.ResetStorage, async (data) => {
|
|
345
|
+
await onReset?.({
|
|
346
|
+
target: data.target
|
|
347
|
+
});
|
|
348
|
+
return {};
|
|
349
|
+
}),
|
|
350
|
+
createResolver(ClientAction.CreateAgent, async () => {
|
|
351
|
+
invariant(client.services.services.EdgeAgentService, "Missing EdgeAgentService", {
|
|
352
|
+
F: __dxlog_file,
|
|
353
|
+
L: 203,
|
|
354
|
+
S: void 0,
|
|
355
|
+
A: [
|
|
356
|
+
"client.services.services.EdgeAgentService",
|
|
357
|
+
"'Missing EdgeAgentService'"
|
|
358
|
+
]
|
|
359
|
+
});
|
|
360
|
+
await client.services.services.EdgeAgentService.createAgent(null, {
|
|
361
|
+
timeout: 1e4
|
|
362
|
+
});
|
|
363
|
+
}),
|
|
364
|
+
createResolver(ClientAction.CreateRecoveryCode, async () => {
|
|
365
|
+
invariant(client.services.services.IdentityService, "IdentityService not available", {
|
|
366
|
+
F: __dxlog_file,
|
|
367
|
+
L: 207,
|
|
368
|
+
S: void 0,
|
|
369
|
+
A: [
|
|
370
|
+
"client.services.services.IdentityService",
|
|
371
|
+
"'IdentityService not available'"
|
|
372
|
+
]
|
|
373
|
+
});
|
|
374
|
+
const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();
|
|
375
|
+
return {
|
|
376
|
+
intents: [
|
|
377
|
+
createIntent3(LayoutAction3.SetLayout, {
|
|
378
|
+
element: "dialog",
|
|
379
|
+
dialogBlockAlign: "start",
|
|
380
|
+
dialogType: "alert",
|
|
381
|
+
state: true,
|
|
382
|
+
component: RECOVER_CODE_DIALOG,
|
|
383
|
+
subject: {
|
|
384
|
+
code: seedphrase
|
|
385
|
+
}
|
|
386
|
+
})
|
|
387
|
+
]
|
|
388
|
+
};
|
|
389
|
+
})
|
|
390
|
+
]
|
|
439
391
|
}
|
|
440
392
|
}
|
|
441
393
|
};
|
|
@@ -445,7 +397,6 @@ var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitation
|
|
|
445
397
|
var src_default = ClientPlugin;
|
|
446
398
|
export {
|
|
447
399
|
ClientPlugin,
|
|
448
|
-
src_default as default
|
|
449
|
-
parseClientPlugin
|
|
400
|
+
src_default as default
|
|
450
401
|
};
|
|
451
402
|
//# sourceMappingURL=index.mjs.map
|