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