@dxos/plugin-client 0.6.14-staging.e15392e → 0.7.0
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-3ESI7PGR.mjs → chunk-VCPHSTE7.mjs} +5 -3
- package/dist/lib/browser/chunk-VCPHSTE7.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +178 -38
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +3 -1
- package/dist/lib/node/{chunk-ZWE6N7MY.cjs → chunk-JYQZCE2U.cjs} +8 -5
- package/dist/lib/node/chunk-JYQZCE2U.cjs.map +7 -0
- package/dist/lib/node/index.cjs +180 -45
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.cjs +7 -5
- package/dist/lib/node/meta.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/{chunk-SZVMJZ6O.mjs → chunk-4FDLD5H4.mjs} +5 -3
- package/dist/lib/node-esm/chunk-4FDLD5H4.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +178 -38
- 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 +3 -1
- package/dist/types/src/ClientPlugin.d.ts +17 -3
- package/dist/types/src/ClientPlugin.d.ts.map +1 -1
- package/dist/types/src/components/IdentityDialog.d.ts +4 -0
- package/dist/types/src/components/IdentityDialog.d.ts.map +1 -0
- package/dist/types/src/components/JoinDialog.d.ts +4 -0
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +3 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +3 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/package.json +13 -11
- package/src/ClientPlugin.tsx +88 -30
- package/src/components/IdentityDialog.tsx +59 -0
- package/src/components/JoinDialog.tsx +57 -0
- package/src/components/index.ts +6 -0
- package/src/meta.ts +4 -1
- package/dist/lib/browser/chunk-3ESI7PGR.mjs.map +0 -7
- package/dist/lib/node/chunk-ZWE6N7MY.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-SZVMJZ6O.mjs.map +0 -7
|
@@ -7,16 +7,18 @@ var meta_default = {
|
|
|
7
7
|
var CLIENT_ACTION = `${CLIENT_PLUGIN}/action`;
|
|
8
8
|
var ClientAction;
|
|
9
9
|
(function(ClientAction2) {
|
|
10
|
-
ClientAction2[ClientAction2["OPEN_SHELL"] = `${CLIENT_ACTION}/SHELL`] = "OPEN_SHELL";
|
|
11
10
|
ClientAction2[ClientAction2["CREATE_IDENTITY"] = `${CLIENT_ACTION}/CREATE_IDENTITY`] = "CREATE_IDENTITY";
|
|
12
11
|
ClientAction2[ClientAction2["JOIN_IDENTITY"] = `${CLIENT_ACTION}/JOIN_IDENTITY`] = "JOIN_IDENTITY";
|
|
13
12
|
ClientAction2[ClientAction2["SHARE_IDENTITY"] = `${CLIENT_ACTION}/SHARE_IDENTITY`] = "SHARE_IDENTITY";
|
|
14
13
|
ClientAction2[ClientAction2["RECOVER_IDENTITY"] = `${CLIENT_ACTION}/RECOVER_IDENTITY`] = "RECOVER_IDENTITY";
|
|
14
|
+
ClientAction2[ClientAction2["RESET_STORAGE"] = `${CLIENT_ACTION}/RESET_STORAGE`] = "RESET_STORAGE";
|
|
15
15
|
})(ClientAction || (ClientAction = {}));
|
|
16
|
+
var OBSERVABILITY_ACTION = "dxos.org/plugin/observability/send-event";
|
|
16
17
|
|
|
17
18
|
export {
|
|
18
19
|
CLIENT_PLUGIN,
|
|
19
20
|
meta_default,
|
|
20
|
-
ClientAction
|
|
21
|
+
ClientAction,
|
|
22
|
+
OBSERVABILITY_ACTION
|
|
21
23
|
};
|
|
22
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
//# sourceMappingURL=chunk-VCPHSTE7.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const CLIENT_PLUGIN = 'dxos.org/plugin/client';\n\nexport default {\n id: CLIENT_PLUGIN,\n name: 'Client',\n} satisfies PluginMeta;\n\nconst CLIENT_ACTION = `${CLIENT_PLUGIN}/action`;\nexport enum ClientAction {\n CREATE_IDENTITY = `${CLIENT_ACTION}/CREATE_IDENTITY`,\n JOIN_IDENTITY = `${CLIENT_ACTION}/JOIN_IDENTITY`,\n SHARE_IDENTITY = `${CLIENT_ACTION}/SHARE_IDENTITY`,\n RECOVER_IDENTITY = `${CLIENT_ACTION}/RECOVER_IDENTITY`,\n RESET_STORAGE = `${CLIENT_ACTION}/RESET_STORAGE`,\n}\n\n// NOTE: This action is hardcoded to avoid circular dependency with observability plugin.\nexport const OBSERVABILITY_ACTION = 'dxos.org/plugin/observability/send-event';\n"],
|
|
5
|
+
"mappings": ";AAMO,IAAMA,gBAAgB;AAE7B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;AAEA,IAAMC,gBAAgB,GAAGH,aAAAA;;UACbI,eAAAA;mDACQ,GAAGD,aAAAA,kBAA+B,IAAA;iDACpC,GAAGA,aAAAA,gBAA6B,IAAA;kDAC/B,GAAGA,aAAAA,iBAA8B,IAAA;oDAC/B,GAAGA,aAAAA,mBAAgC,IAAA;iDACtC,GAAGA,aAAAA,gBAA6B,IAAA;GALtCC,iBAAAA,eAAAA,CAAAA,EAAAA;AASL,IAAMC,uBAAuB;",
|
|
6
|
+
"names": ["CLIENT_PLUGIN", "id", "name", "CLIENT_ACTION", "ClientAction", "OBSERVABILITY_ACTION"]
|
|
7
|
+
}
|
|
@@ -1,18 +1,127 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CLIENT_PLUGIN,
|
|
3
3
|
ClientAction,
|
|
4
|
+
OBSERVABILITY_ACTION,
|
|
4
5
|
meta_default
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VCPHSTE7.mjs";
|
|
6
7
|
|
|
7
8
|
// packages/plugins/plugin-client/src/ClientPlugin.tsx
|
|
8
|
-
import
|
|
9
|
-
import { filterPlugins, parseIntentPlugin, resolvePlugin } from "@dxos/app-framework";
|
|
9
|
+
import React3 from "react";
|
|
10
|
+
import { filterPlugins, LayoutAction as LayoutAction3, parseIntentPlugin, resolvePlugin } from "@dxos/app-framework";
|
|
10
11
|
import { Config, Defaults, Envs, Local, Storage } from "@dxos/config";
|
|
11
12
|
import { registerSignalsRuntime } from "@dxos/echo-signals/react";
|
|
12
13
|
import { log } from "@dxos/log";
|
|
13
14
|
import { createExtension } from "@dxos/plugin-graph";
|
|
14
15
|
import { Client, ClientProvider } from "@dxos/react-client";
|
|
15
16
|
|
|
17
|
+
// packages/plugins/plugin-client/src/components/IdentityDialog.tsx
|
|
18
|
+
import React, { useCallback } from "react";
|
|
19
|
+
import { LayoutAction, useIntentDispatcher } from "@dxos/app-framework";
|
|
20
|
+
import { useClient } from "@dxos/react-client";
|
|
21
|
+
import { Dialog } from "@dxos/react-ui";
|
|
22
|
+
import { ClipboardProvider, 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(ClipboardProvider, 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
|
+
};
|
|
124
|
+
|
|
16
125
|
// packages/plugins/plugin-client/src/translations.ts
|
|
17
126
|
var translations_default = [
|
|
18
127
|
{
|
|
@@ -28,10 +137,15 @@ var translations_default = [
|
|
|
28
137
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-client/src/ClientPlugin.tsx";
|
|
29
138
|
var parseClientPlugin = (plugin) => (plugin?.provides).client instanceof Client ? plugin : void 0;
|
|
30
139
|
var parseSchemaPlugin = (plugin) => Array.isArray(plugin?.provides.echo?.schema) ? plugin : void 0;
|
|
31
|
-
var ClientPlugin = ({ appKey, onClientInitialized, onReady, ...options }) => {
|
|
140
|
+
var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitationParam = "deviceInvitationCode", onClientInitialized, onReady, onReset, ...options }) => {
|
|
32
141
|
registerSignalsRuntime();
|
|
33
142
|
let client;
|
|
34
143
|
let error = null;
|
|
144
|
+
const createDeviceInvitationUrl = (invitationCode) => {
|
|
145
|
+
const baseUrl = new URL(invitationUrl);
|
|
146
|
+
baseUrl.searchParams.set(invitationParam, invitationCode);
|
|
147
|
+
return baseUrl.toString();
|
|
148
|
+
};
|
|
35
149
|
return {
|
|
36
150
|
meta: meta_default,
|
|
37
151
|
initialize: async () => {
|
|
@@ -55,7 +169,7 @@ var ClientPlugin = ({ appKey, onClientInitialized, onReady, ...options }) => {
|
|
|
55
169
|
}
|
|
56
170
|
return {
|
|
57
171
|
client,
|
|
58
|
-
context: ({ children }) => /* @__PURE__ */
|
|
172
|
+
context: ({ children }) => /* @__PURE__ */ React3.createElement(ClientProvider, {
|
|
59
173
|
client
|
|
60
174
|
}, children)
|
|
61
175
|
};
|
|
@@ -70,7 +184,7 @@ var ClientPlugin = ({ appKey, onClientInitialized, onReady, ...options }) => {
|
|
|
70
184
|
id: plugin.meta.id
|
|
71
185
|
}, {
|
|
72
186
|
F: __dxlog_file,
|
|
73
|
-
L:
|
|
187
|
+
L: 141,
|
|
74
188
|
S: void 0,
|
|
75
189
|
C: (f, a) => f(...a)
|
|
76
190
|
});
|
|
@@ -82,6 +196,23 @@ var ClientPlugin = ({ appKey, onClientInitialized, onReady, ...options }) => {
|
|
|
82
196
|
},
|
|
83
197
|
provides: {
|
|
84
198
|
translations: translations_default,
|
|
199
|
+
surface: {
|
|
200
|
+
component: ({ data, role, ...rest }) => {
|
|
201
|
+
switch (role) {
|
|
202
|
+
case "dialog":
|
|
203
|
+
if (data.component === "dxos.org/plugin/client/IdentityDialog") {
|
|
204
|
+
return /* @__PURE__ */ React3.createElement(IdentityDialog, {
|
|
205
|
+
...data.subject,
|
|
206
|
+
createInvitationUrl: createDeviceInvitationUrl
|
|
207
|
+
});
|
|
208
|
+
} else if (data.component === "dxos.org/plugin/client/JoinDialog") {
|
|
209
|
+
return /* @__PURE__ */ React3.createElement(JoinDialog, data.subject);
|
|
210
|
+
}
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
},
|
|
85
216
|
graph: {
|
|
86
217
|
builder: (plugins) => {
|
|
87
218
|
const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
|
|
@@ -96,7 +227,7 @@ var ClientPlugin = ({ appKey, onClientInitialized, onReady, ...options }) => {
|
|
|
96
227
|
await intentPlugin?.provides.intent.dispatch([
|
|
97
228
|
{
|
|
98
229
|
plugin: CLIENT_PLUGIN,
|
|
99
|
-
action: ClientAction.
|
|
230
|
+
action: ClientAction.SHARE_IDENTITY
|
|
100
231
|
}
|
|
101
232
|
]);
|
|
102
233
|
},
|
|
@@ -124,11 +255,6 @@ var ClientPlugin = ({ appKey, onClientInitialized, onReady, ...options }) => {
|
|
|
124
255
|
intent: {
|
|
125
256
|
resolver: async (intent) => {
|
|
126
257
|
switch (intent.action) {
|
|
127
|
-
case ClientAction.OPEN_SHELL:
|
|
128
|
-
await client.shell.open(intent.data?.layout);
|
|
129
|
-
return {
|
|
130
|
-
data: true
|
|
131
|
-
};
|
|
132
258
|
case ClientAction.CREATE_IDENTITY: {
|
|
133
259
|
const data = await client.halo.createIdentity();
|
|
134
260
|
return {
|
|
@@ -136,10 +262,9 @@ var ClientPlugin = ({ appKey, onClientInitialized, onReady, ...options }) => {
|
|
|
136
262
|
intents: [
|
|
137
263
|
[
|
|
138
264
|
{
|
|
139
|
-
|
|
140
|
-
action: "dxos.org/plugin/observability/send-event",
|
|
265
|
+
action: OBSERVABILITY_ACTION,
|
|
141
266
|
data: {
|
|
142
|
-
name: "identity.
|
|
267
|
+
name: "identity.create"
|
|
143
268
|
}
|
|
144
269
|
}
|
|
145
270
|
]
|
|
@@ -147,18 +272,20 @@ var ClientPlugin = ({ appKey, onClientInitialized, onReady, ...options }) => {
|
|
|
147
272
|
};
|
|
148
273
|
}
|
|
149
274
|
case ClientAction.JOIN_IDENTITY: {
|
|
150
|
-
const data = await client.shell.joinIdentity({
|
|
151
|
-
invitationCode: intent.data?.invitationCode
|
|
152
|
-
});
|
|
153
275
|
return {
|
|
154
|
-
data,
|
|
276
|
+
data: true,
|
|
155
277
|
intents: [
|
|
156
278
|
[
|
|
157
279
|
{
|
|
158
|
-
|
|
159
|
-
action: "dxos.org/plugin/observability/send-event",
|
|
280
|
+
action: LayoutAction3.SET_LAYOUT,
|
|
160
281
|
data: {
|
|
161
|
-
|
|
282
|
+
element: "dialog",
|
|
283
|
+
component: "dxos.org/plugin/client/JoinDialog",
|
|
284
|
+
dialogBlockAlign: "start",
|
|
285
|
+
subject: {
|
|
286
|
+
initialInvitationCode: intent.data?.invitationCode,
|
|
287
|
+
initialDisposition: "accept-halo-invitation"
|
|
288
|
+
}
|
|
162
289
|
}
|
|
163
290
|
}
|
|
164
291
|
]
|
|
@@ -166,22 +293,24 @@ var ClientPlugin = ({ appKey, onClientInitialized, onReady, ...options }) => {
|
|
|
166
293
|
};
|
|
167
294
|
}
|
|
168
295
|
case ClientAction.SHARE_IDENTITY: {
|
|
169
|
-
const data = await client.shell.shareIdentity();
|
|
170
296
|
return {
|
|
171
|
-
data,
|
|
297
|
+
data: true,
|
|
172
298
|
intents: [
|
|
173
299
|
[
|
|
174
300
|
{
|
|
175
|
-
|
|
176
|
-
action: "dxos.org/plugin/observability/send-event",
|
|
301
|
+
action: LayoutAction3.SET_LAYOUT,
|
|
177
302
|
data: {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
303
|
+
element: "dialog",
|
|
304
|
+
component: "dxos.org/plugin/client/IdentityDialog",
|
|
305
|
+
dialogBlockAlign: "start"
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
],
|
|
309
|
+
[
|
|
310
|
+
{
|
|
311
|
+
action: OBSERVABILITY_ACTION,
|
|
312
|
+
data: {
|
|
313
|
+
name: "identity.share"
|
|
185
314
|
}
|
|
186
315
|
}
|
|
187
316
|
]
|
|
@@ -189,22 +318,33 @@ var ClientPlugin = ({ appKey, onClientInitialized, onReady, ...options }) => {
|
|
|
189
318
|
};
|
|
190
319
|
}
|
|
191
320
|
case ClientAction.RECOVER_IDENTITY: {
|
|
192
|
-
const data = await client.shell.recoverIdentity();
|
|
193
321
|
return {
|
|
194
|
-
data,
|
|
322
|
+
data: true,
|
|
195
323
|
intents: [
|
|
196
324
|
[
|
|
197
325
|
{
|
|
198
|
-
|
|
199
|
-
action: "dxos.org/plugin/observability/send-event",
|
|
326
|
+
action: LayoutAction3.SET_LAYOUT,
|
|
200
327
|
data: {
|
|
201
|
-
|
|
328
|
+
element: "dialog",
|
|
329
|
+
component: "dxos.org/plugin/client/JoinDialog",
|
|
330
|
+
dialogBlockAlign: "start",
|
|
331
|
+
subject: {
|
|
332
|
+
initialDisposition: "recover-identity"
|
|
333
|
+
}
|
|
202
334
|
}
|
|
203
335
|
}
|
|
204
336
|
]
|
|
205
337
|
]
|
|
206
338
|
};
|
|
207
339
|
}
|
|
340
|
+
case ClientAction.RESET_STORAGE: {
|
|
341
|
+
await onReset?.({
|
|
342
|
+
target: intent.data?.target
|
|
343
|
+
});
|
|
344
|
+
return {
|
|
345
|
+
data: true
|
|
346
|
+
};
|
|
347
|
+
}
|
|
208
348
|
}
|
|
209
349
|
}
|
|
210
350
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/ClientPlugin.tsx", "../../../src/translations.ts", "../../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Schema as S } from '@effect/schema';\nimport React from 'react';\n\nimport {\n filterPlugins,\n parseIntentPlugin,\n resolvePlugin,\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 { log } from '@dxos/log';\nimport { createExtension, type Node } from '@dxos/plugin-graph';\nimport { Client, type ClientOptions, ClientProvider } from '@dxos/react-client';\n\nimport meta, { CLIENT_PLUGIN, ClientAction } 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 * 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\nexport type ClientPluginProvides = IntentResolverProvides &\n GraphBuilderProvides &\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 type SchemaProvides = {\n echo: {\n schema: S.Schema<any>[];\n };\n};\n\nexport const parseSchemaPlugin = (plugin?: Plugin) =>\n Array.isArray((plugin?.provides as any).echo?.schema) ? (plugin as Plugin<SchemaProvides>) : undefined;\n\nexport const ClientPlugin = ({\n appKey,\n onClientInitialized,\n onReady,\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 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 filterPlugins(plugins, parseSchemaPlugin).forEach((plugin) => {\n log('ready', { id: plugin.meta.id });\n client.addTypes(plugin.provides.echo.schema);\n });\n },\n unload: async () => {\n await client.destroy();\n },\n provides: {\n translations,\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.OPEN_SHELL },\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.OPEN_SHELL:\n await client.shell.open(intent.data?.layout);\n return { data: true };\n\n case ClientAction.CREATE_IDENTITY: {\n const data = await client.halo.createIdentity();\n return {\n data,\n intents: [\n [\n {\n // NOTE: This action is hardcoded to avoid circular dependency with observability plugin.\n action: 'dxos.org/plugin/observability/send-event',\n data: {\n name: 'identity.created',\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.JOIN_IDENTITY: {\n const data = await client.shell.joinIdentity({ invitationCode: intent.data?.invitationCode });\n return {\n data,\n intents: [\n [\n {\n // NOTE: This action is hardcoded to avoid circular dependency with observability plugin.\n action: 'dxos.org/plugin/observability/send-event',\n data: {\n name: 'identity.joined',\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.SHARE_IDENTITY: {\n const data = await client.shell.shareIdentity();\n return {\n data,\n intents: [\n [\n {\n // NOTE: This action is hardcoded to avoid circular dependency with observability plugin.\n action: 'dxos.org/plugin/observability/send-event',\n data: {\n name: 'identity.shared',\n properties: {\n deviceKey: data.device?.deviceKey.truncate(),\n deviceKind: data.device?.kind,\n error: data.error?.message,\n canceled: data.cancelled,\n },\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.RECOVER_IDENTITY: {\n const data = await client.shell.recoverIdentity();\n return {\n data,\n intents: [\n [\n {\n // NOTE: This action is hardcoded to avoid circular dependency with observability plugin.\n action: 'dxos.org/plugin/observability/send-event',\n data: {\n name: 'identity.recovered',\n },\n },\n ],\n ],\n };\n }\n }\n },\n },\n },\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": "
|
|
6
|
-
"names": ["React", "filterPlugins", "parseIntentPlugin", "resolvePlugin", "Config", "Defaults", "Envs", "Local", "Storage", "registerSignalsRuntime", "log", "createExtension", "Client", "ClientProvider", "CLIENT_PLUGIN", "parseClientPlugin", "plugin", "provides", "client", "Client", "undefined", "parseSchemaPlugin", "Array", "isArray", "echo", "schema", "ClientPlugin", "appKey", "onClientInitialized", "onReady", "options", "registerSignalsRuntime", "error", "meta", "initialize", "config", "Config", "Storage", "Envs", "Local", "Defaults", "reloaded", "on", "halo", "identity", "subscribe", "
|
|
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 { type Schema as S } from '@effect/schema';\nimport React from 'react';\n\nimport {\n filterPlugins,\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 { log } from '@dxos/log';\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 type SchemaProvides = {\n echo: {\n schema: S.Schema<any>[];\n };\n};\n\nexport const parseSchemaPlugin = (plugin?: Plugin) =>\n Array.isArray((plugin?.provides as any).echo?.schema) ? (plugin as Plugin<SchemaProvides>) : 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 filterPlugins(plugins, parseSchemaPlugin).forEach((plugin) => {\n log('ready', { id: plugin.meta.id });\n client.addTypes(plugin.provides.echo.schema);\n });\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": ";;;;;;;;AAKA,OAAOA,YAAW;AAElB,SACEC,eACAC,gBAAAA,eACAC,mBACAC,qBAOK;AACP,SAASC,QAAQC,UAAUC,MAAMC,OAAOC,eAAe;AACvD,SAASC,8BAA8B;AACvC,SAASC,WAAW;AACpB,SAASC,uBAAkC;AAC3C,SAASC,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wBACTzC,WAAW;wBACX0C,kBAAkB;wBAClBrC,SAAS;0BACPsC,uBAAuBzB,OAAOjB,MAAMrC;0BACpCgF,oBAAoB;wBACtB;sBACF;oBACF;;;cAGN;YACF;YAEA,KAAKvB,aAAaC,gBAAgB;AAChC,qBAAO;gBACLrB,MAAM;gBACNkC,SAAS;kBACP;oBACE;sBACEf,QAAQmB,cAAaC;sBACrBvC,MAAM;wBACJwC,SAAS;wBACTzC,WAAW;wBACX0C,kBAAkB;sBACpB;oBACF;;kBAEF;oBACE;sBACEtB,QAAQgB;sBACRnC,MAAM;wBACJoC,MAAM;sBACR;oBACF;;;cAGN;YACF;YAEA,KAAKhB,aAAawB,kBAAkB;AAClC,qBAAO;gBACL5C,MAAM;gBACNkC,SAAS;kBACP;oBACE;sBACEf,QAAQmB,cAAaC;sBACrBvC,MAAM;wBACJwC,SAAS;wBACTzC,WAAW;wBACX0C,kBAAkB;wBAClBrC,SAAS;0BACPuC,oBAAoB;wBACtB;sBACF;oBACF;;;cAGN;YACF;YAEA,KAAKvB,aAAayB,eAAe;AAC/B,oBAAMvF,UAAU;gBAAEwF,QAAQ7B,OAAOjB,MAAM8C;cAAO,CAAA;AAC9C,qBAAO;gBAAE9C,MAAM;cAAK;YACtB;UACF;QACF;MACF;IACF;EACF;AACF;;;AIrSA,IAAA,cAAe+C;",
|
|
6
|
+
"names": ["React", "filterPlugins", "LayoutAction", "parseIntentPlugin", "resolvePlugin", "Config", "Defaults", "Envs", "Local", "Storage", "registerSignalsRuntime", "log", "createExtension", "Client", "ClientProvider", "React", "useCallback", "LayoutAction", "useIntentDispatcher", "useClient", "Dialog", "ClipboardProvider", "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", "ClipboardProvider", "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", "CLIENT_PLUGIN", "parseClientPlugin", "plugin", "provides", "client", "Client", "undefined", "parseSchemaPlugin", "Array", "isArray", "echo", "schema", "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", "filterPlugins", "forEach", "log", "id", "addTypes", "unload", "destroy", "translations", "surface", "component", "data", "role", "rest", "IdentityDialog", "subject", "createInvitationUrl", "JoinDialog", "graph", "builder", "intentPlugin", "resolvePlugin", "parseIntentPlugin", "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", "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":2945,"imports":[],"format":"esm"},"packages/plugins/plugin-client/src/components/IdentityDialog.tsx":{"bytes":6567,"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/index.ts":{"bytes":625,"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"}],"format":"esm"},"packages/plugins/plugin-client/src/translations.ts":{"bytes":1043,"imports":[{"path":"packages/plugins/plugin-client/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-client/src/ClientPlugin.tsx":{"bytes":30969,"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/log","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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":21273},"packages/plugins/plugin-client/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-client/dist/lib/browser/chunk-VCPHSTE7.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/log","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}],"exports":["ClientPlugin","default","parseClientPlugin","parseSchemaPlugin"],"entryPoint":"packages/plugins/plugin-client/src/index.ts","inputs":{"packages/plugins/plugin-client/src/ClientPlugin.tsx":{"bytesInOutput":7460},"packages/plugins/plugin-client/src/components/IdentityDialog.tsx":{"bytesInOutput":1649},"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/translations.ts":{"bytesInOutput":134},"packages/plugins/plugin-client/src/index.ts":{"bytesInOutput":32}},"bytes":11340},"packages/plugins/plugin-client/dist/lib/browser/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-client/dist/lib/browser/meta.mjs":{"imports":[{"path":"packages/plugins/plugin-client/dist/lib/browser/chunk-VCPHSTE7.mjs","kind":"import-statement"}],"exports":["CLIENT_PLUGIN","ClientAction","OBSERVABILITY_ACTION","default"],"entryPoint":"packages/plugins/plugin-client/src/meta.ts","inputs":{},"bytes":241},"packages/plugins/plugin-client/dist/lib/browser/chunk-VCPHSTE7.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1285},"packages/plugins/plugin-client/dist/lib/browser/chunk-VCPHSTE7.mjs":{"imports":[],"exports":["CLIENT_PLUGIN","ClientAction","OBSERVABILITY_ACTION","meta_default"],"inputs":{"packages/plugins/plugin-client/src/meta.ts":{"bytesInOutput":840}},"bytes":1015}}}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CLIENT_PLUGIN,
|
|
3
3
|
ClientAction,
|
|
4
|
+
OBSERVABILITY_ACTION,
|
|
4
5
|
meta_default
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VCPHSTE7.mjs";
|
|
6
7
|
export {
|
|
7
8
|
CLIENT_PLUGIN,
|
|
8
9
|
ClientAction,
|
|
10
|
+
OBSERVABILITY_ACTION,
|
|
9
11
|
meta_default as default
|
|
10
12
|
};
|
|
11
13
|
//# sourceMappingURL=meta.mjs.map
|
|
@@ -16,13 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_JYQZCE2U_exports = {};
|
|
20
|
+
__export(chunk_JYQZCE2U_exports, {
|
|
21
21
|
CLIENT_PLUGIN: () => CLIENT_PLUGIN,
|
|
22
22
|
ClientAction: () => ClientAction,
|
|
23
|
+
OBSERVABILITY_ACTION: () => OBSERVABILITY_ACTION,
|
|
23
24
|
meta_default: () => meta_default
|
|
24
25
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
26
|
+
module.exports = __toCommonJS(chunk_JYQZCE2U_exports);
|
|
26
27
|
var CLIENT_PLUGIN = "dxos.org/plugin/client";
|
|
27
28
|
var meta_default = {
|
|
28
29
|
id: CLIENT_PLUGIN,
|
|
@@ -31,16 +32,18 @@ var meta_default = {
|
|
|
31
32
|
var CLIENT_ACTION = `${CLIENT_PLUGIN}/action`;
|
|
32
33
|
var ClientAction;
|
|
33
34
|
(function(ClientAction2) {
|
|
34
|
-
ClientAction2[ClientAction2["OPEN_SHELL"] = `${CLIENT_ACTION}/SHELL`] = "OPEN_SHELL";
|
|
35
35
|
ClientAction2[ClientAction2["CREATE_IDENTITY"] = `${CLIENT_ACTION}/CREATE_IDENTITY`] = "CREATE_IDENTITY";
|
|
36
36
|
ClientAction2[ClientAction2["JOIN_IDENTITY"] = `${CLIENT_ACTION}/JOIN_IDENTITY`] = "JOIN_IDENTITY";
|
|
37
37
|
ClientAction2[ClientAction2["SHARE_IDENTITY"] = `${CLIENT_ACTION}/SHARE_IDENTITY`] = "SHARE_IDENTITY";
|
|
38
38
|
ClientAction2[ClientAction2["RECOVER_IDENTITY"] = `${CLIENT_ACTION}/RECOVER_IDENTITY`] = "RECOVER_IDENTITY";
|
|
39
|
+
ClientAction2[ClientAction2["RESET_STORAGE"] = `${CLIENT_ACTION}/RESET_STORAGE`] = "RESET_STORAGE";
|
|
39
40
|
})(ClientAction || (ClientAction = {}));
|
|
41
|
+
var OBSERVABILITY_ACTION = "dxos.org/plugin/observability/send-event";
|
|
40
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
43
|
0 && (module.exports = {
|
|
42
44
|
CLIENT_PLUGIN,
|
|
43
45
|
ClientAction,
|
|
46
|
+
OBSERVABILITY_ACTION,
|
|
44
47
|
meta_default
|
|
45
48
|
});
|
|
46
|
-
//# sourceMappingURL=chunk-
|
|
49
|
+
//# sourceMappingURL=chunk-JYQZCE2U.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const CLIENT_PLUGIN = 'dxos.org/plugin/client';\n\nexport default {\n id: CLIENT_PLUGIN,\n name: 'Client',\n} satisfies PluginMeta;\n\nconst CLIENT_ACTION = `${CLIENT_PLUGIN}/action`;\nexport enum ClientAction {\n CREATE_IDENTITY = `${CLIENT_ACTION}/CREATE_IDENTITY`,\n JOIN_IDENTITY = `${CLIENT_ACTION}/JOIN_IDENTITY`,\n SHARE_IDENTITY = `${CLIENT_ACTION}/SHARE_IDENTITY`,\n RECOVER_IDENTITY = `${CLIENT_ACTION}/RECOVER_IDENTITY`,\n RESET_STORAGE = `${CLIENT_ACTION}/RESET_STORAGE`,\n}\n\n// NOTE: This action is hardcoded to avoid circular dependency with observability plugin.\nexport const OBSERVABILITY_ACTION = 'dxos.org/plugin/observability/send-event';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAMO,IAAMA,gBAAgB;AAE7B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;AAEA,IAAMC,gBAAgB,GAAGH,aAAAA;;UACbI,eAAAA;mDACQ,GAAGD,aAAAA,kBAA+B,IAAA;iDACpC,GAAGA,aAAAA,gBAA6B,IAAA;kDAC/B,GAAGA,aAAAA,iBAA8B,IAAA;oDAC/B,GAAGA,aAAAA,mBAAgC,IAAA;iDACtC,GAAGA,aAAAA,gBAA6B,IAAA;GALtCC,iBAAAA,eAAAA,CAAAA,EAAAA;AASL,IAAMC,uBAAuB;",
|
|
6
|
+
"names": ["CLIENT_PLUGIN", "id", "name", "CLIENT_ACTION", "ClientAction", "OBSERVABILITY_ACTION"]
|
|
7
|
+
}
|