@dxos/plugin-client 0.7.5-main.9d26e3a → 0.7.5-main.9d2a38b

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.
Files changed (123) hide show
  1. package/dist/lib/browser/app-graph-builder-6LOTDB4T.mjs +44 -0
  2. package/dist/lib/browser/app-graph-builder-6LOTDB4T.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-6IF6PREG.mjs +158 -0
  4. package/dist/lib/browser/chunk-6IF6PREG.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-52IJQ35F.mjs → chunk-E3OUNOEL.mjs} +4 -6
  6. package/dist/lib/browser/chunk-E3OUNOEL.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-X4QUPYC6.mjs → chunk-NHIL4T3L.mjs} +3 -3
  8. package/dist/lib/browser/chunk-NHIL4T3L.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-R4Q6H7RD.mjs +18 -0
  10. package/dist/lib/browser/chunk-R4Q6H7RD.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-SVBQRT7I.mjs +17 -0
  12. package/dist/lib/browser/chunk-SVBQRT7I.mjs.map +7 -0
  13. package/dist/lib/browser/client-25GYH6TN.mjs +45 -0
  14. package/dist/lib/browser/client-25GYH6TN.mjs.map +7 -0
  15. package/dist/lib/browser/index.mjs +69 -369
  16. package/dist/lib/browser/index.mjs.map +4 -4
  17. package/dist/lib/browser/intent-resolver-IWWLWOZD.mjs +132 -0
  18. package/dist/lib/browser/intent-resolver-IWWLWOZD.mjs.map +7 -0
  19. package/dist/lib/browser/meta.json +1 -1
  20. package/dist/lib/browser/react-context-M3RT6SSG.mjs +24 -0
  21. package/dist/lib/browser/react-context-M3RT6SSG.mjs.map +7 -0
  22. package/dist/lib/browser/react-surface-XXONPG5T.mjs +41 -0
  23. package/dist/lib/browser/react-surface-XXONPG5T.mjs.map +7 -0
  24. package/dist/lib/browser/types.mjs +4 -6
  25. package/dist/lib/node/app-graph-builder-JCND3P6G.cjs +58 -0
  26. package/dist/lib/node/app-graph-builder-JCND3P6G.cjs.map +7 -0
  27. package/dist/lib/node/{meta.cjs → chunk-3OB25QN2.cjs} +14 -8
  28. package/dist/lib/node/chunk-3OB25QN2.cjs.map +7 -0
  29. package/dist/lib/node/chunk-IXVWJCYB.cjs +37 -0
  30. package/dist/lib/node/chunk-IXVWJCYB.cjs.map +7 -0
  31. package/dist/lib/node/chunk-N3U7KVO3.cjs +186 -0
  32. package/dist/lib/node/chunk-N3U7KVO3.cjs.map +7 -0
  33. package/dist/lib/node/{chunk-NFO3ADQC.cjs → chunk-NVYWMDF3.cjs} +8 -11
  34. package/dist/lib/node/chunk-NVYWMDF3.cjs.map +7 -0
  35. package/dist/lib/node/{chunk-RUA5KXVW.cjs → chunk-OIFPM5ZW.cjs} +7 -7
  36. package/dist/lib/node/chunk-OIFPM5ZW.cjs.map +7 -0
  37. package/dist/lib/node/client-52L4TUYU.cjs +59 -0
  38. package/dist/lib/node/client-52L4TUYU.cjs.map +7 -0
  39. package/dist/lib/node/index.cjs +66 -358
  40. package/dist/lib/node/index.cjs.map +4 -4
  41. package/dist/lib/node/intent-resolver-H3Y64MIP.cjs +140 -0
  42. package/dist/lib/node/intent-resolver-H3Y64MIP.cjs.map +7 -0
  43. package/dist/lib/node/meta.json +1 -1
  44. package/dist/lib/node/react-context-B2DNULH4.cjs +48 -0
  45. package/dist/lib/node/react-context-B2DNULH4.cjs.map +7 -0
  46. package/dist/lib/node/react-surface-7USN5NOO.cjs +62 -0
  47. package/dist/lib/node/react-surface-7USN5NOO.cjs.map +7 -0
  48. package/dist/lib/node/types.cjs +4 -6
  49. package/dist/lib/node/types.cjs.map +2 -2
  50. package/dist/lib/node-esm/app-graph-builder-ZLGKFBLY.mjs +45 -0
  51. package/dist/lib/node-esm/app-graph-builder-ZLGKFBLY.mjs.map +7 -0
  52. package/dist/lib/node-esm/chunk-73M5MK5Q.mjs +19 -0
  53. package/dist/lib/node-esm/chunk-73M5MK5Q.mjs.map +7 -0
  54. package/dist/lib/node-esm/{chunk-TI4GNGMM.mjs → chunk-74T33KTB.mjs} +4 -6
  55. package/dist/lib/node-esm/chunk-74T33KTB.mjs.map +7 -0
  56. package/dist/lib/node-esm/chunk-EHGD3UJH.mjs +159 -0
  57. package/dist/lib/node-esm/chunk-EHGD3UJH.mjs.map +7 -0
  58. package/dist/lib/node-esm/{chunk-GMGRQ5Q7.mjs → chunk-HO7WDE7C.mjs} +3 -3
  59. package/dist/lib/node-esm/chunk-HO7WDE7C.mjs.map +7 -0
  60. package/dist/lib/node-esm/chunk-OBGRL3DF.mjs +18 -0
  61. package/dist/lib/node-esm/chunk-OBGRL3DF.mjs.map +7 -0
  62. package/dist/lib/node-esm/client-K52NWOUN.mjs +46 -0
  63. package/dist/lib/node-esm/client-K52NWOUN.mjs.map +7 -0
  64. package/dist/lib/node-esm/index.mjs +69 -369
  65. package/dist/lib/node-esm/index.mjs.map +4 -4
  66. package/dist/lib/node-esm/intent-resolver-JCKD6R6L.mjs +133 -0
  67. package/dist/lib/node-esm/intent-resolver-JCKD6R6L.mjs.map +7 -0
  68. package/dist/lib/node-esm/meta.json +1 -1
  69. package/dist/lib/node-esm/react-context-IGEHJQK5.mjs +25 -0
  70. package/dist/lib/node-esm/react-context-IGEHJQK5.mjs.map +7 -0
  71. package/dist/lib/node-esm/react-surface-CXLBCMPN.mjs +42 -0
  72. package/dist/lib/node-esm/react-surface-CXLBCMPN.mjs.map +7 -0
  73. package/dist/lib/node-esm/types.mjs +4 -6
  74. package/dist/types/src/ClientPlugin.d.ts +2 -3
  75. package/dist/types/src/ClientPlugin.d.ts.map +1 -1
  76. package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
  77. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  78. package/dist/types/src/capabilities/capabilities.d.ts +8 -0
  79. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  80. package/dist/types/src/capabilities/client.d.ts +9 -0
  81. package/dist/types/src/capabilities/client.d.ts.map +1 -0
  82. package/dist/types/src/capabilities/index.d.ts +193 -0
  83. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  84. package/dist/types/src/capabilities/intent-resolver.d.ts +8 -0
  85. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  86. package/dist/types/src/capabilities/react-context.d.ts +8 -0
  87. package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
  88. package/dist/types/src/capabilities/react-surface.d.ts +7 -0
  89. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  90. package/dist/types/src/events.d.ts +7 -0
  91. package/dist/types/src/events.d.ts.map +1 -0
  92. package/dist/types/src/index.d.ts +3 -2
  93. package/dist/types/src/index.d.ts.map +1 -1
  94. package/dist/types/src/meta.d.ts +1 -2
  95. package/dist/types/src/meta.d.ts.map +1 -1
  96. package/dist/types/src/types.d.ts +5 -17
  97. package/dist/types/src/types.d.ts.map +1 -1
  98. package/dist/types/tsconfig.tsbuildinfo +1 -1
  99. package/package.json +15 -22
  100. package/src/ClientPlugin.ts +59 -0
  101. package/src/capabilities/app-graph-builder.ts +39 -0
  102. package/src/capabilities/capabilities.ts +15 -0
  103. package/src/capabilities/client.ts +48 -0
  104. package/src/capabilities/index.ts +13 -0
  105. package/src/capabilities/intent-resolver.ts +101 -0
  106. package/src/capabilities/react-context.tsx +20 -0
  107. package/src/capabilities/react-surface.tsx +44 -0
  108. package/src/events.ts +14 -0
  109. package/src/index.ts +4 -4
  110. package/src/meta.ts +1 -1
  111. package/src/types.ts +5 -31
  112. package/dist/lib/browser/chunk-52IJQ35F.mjs.map +0 -7
  113. package/dist/lib/browser/chunk-X4QUPYC6.mjs.map +0 -7
  114. package/dist/lib/browser/meta.mjs +0 -9
  115. package/dist/lib/browser/meta.mjs.map +0 -7
  116. package/dist/lib/node/chunk-NFO3ADQC.cjs.map +0 -7
  117. package/dist/lib/node/chunk-RUA5KXVW.cjs.map +0 -7
  118. package/dist/lib/node/meta.cjs.map +0 -7
  119. package/dist/lib/node-esm/chunk-GMGRQ5Q7.mjs.map +0 -7
  120. package/dist/lib/node-esm/chunk-TI4GNGMM.mjs.map +0 -7
  121. package/dist/lib/node-esm/meta.mjs +0 -10
  122. package/dist/lib/node-esm/meta.mjs.map +0 -7
  123. package/src/ClientPlugin.tsx +0 -227
@@ -1,163 +1,25 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
- ClientAction
4
- } from "./chunk-TI4GNGMM.mjs";
3
+ ClientEvents
4
+ } from "./chunk-73M5MK5Q.mjs";
5
+ import {
6
+ ClientCapabilities
7
+ } from "./chunk-OBGRL3DF.mjs";
5
8
  import {
6
9
  CLIENT_PLUGIN,
7
- meta_default
8
- } from "./chunk-GMGRQ5Q7.mjs";
9
-
10
- // packages/plugins/plugin-client/src/ClientPlugin.tsx
11
- import React4 from "react";
12
- import { LayoutAction as LayoutAction3, parseIntentPlugin, resolvePlugin, createSurface, createIntent as createIntent3, createResolver } from "@dxos/app-framework";
13
- import { Config, Defaults, Envs, Local, Storage } from "@dxos/config";
14
- import { registerSignalsRuntime } from "@dxos/echo-signals/react";
15
- import { invariant } from "@dxos/invariant";
16
- import { createExtension } from "@dxos/plugin-graph";
17
- import { ObservabilityAction as ObservabilityAction2 } from "@dxos/plugin-observability/types";
18
- import { Client, ClientProvider } from "@dxos/react-client";
10
+ meta
11
+ } from "./chunk-HO7WDE7C.mjs";
19
12
 
20
- // packages/plugins/plugin-client/src/components/IdentityDialog.tsx
21
- import React, { useCallback } from "react";
22
- import { createIntent, LayoutAction, useIntentDispatcher } from "@dxos/app-framework";
23
- import { useClient } from "@dxos/react-client";
24
- import { Clipboard, Dialog } from "@dxos/react-ui";
25
- import { IdentityPanel } from "@dxos/shell/react";
26
- var IDENTITY_DIALOG = `${CLIENT_PLUGIN}/IdentityDialog`;
27
- var IdentityDialog = (props) => {
28
- const { dispatchPromise: dispatch } = useIntentDispatcher();
29
- const client = useClient();
30
- const handleDone = useCallback(() => dispatch(createIntent(LayoutAction.SetLayout, {
31
- element: "dialog",
32
- state: false
33
- })), [
34
- dispatch
35
- ]);
36
- const handleResetStorage = useCallback(async () => {
37
- await client.reset();
38
- await dispatch(createIntent(ClientAction.ResetStorage));
39
- }, [
40
- dispatch
41
- ]);
42
- const handleRecover = useCallback(async () => {
43
- await client.reset();
44
- await dispatch(createIntent(ClientAction.ResetStorage, {
45
- target: "recoverIdentity"
46
- }));
47
- }, [
48
- dispatch
49
- ]);
50
- const handleJoinNewIdentity = useCallback(async () => {
51
- await client.reset();
52
- await dispatch(createIntent(ClientAction.ResetStorage, {
53
- target: "deviceInvitation"
54
- }));
55
- }, [
56
- dispatch
57
- ]);
58
- return /* @__PURE__ */ React.createElement(Dialog.Content, null, /* @__PURE__ */ React.createElement(Clipboard.Provider, null, /* @__PURE__ */ React.createElement(IdentityPanel, {
59
- ...props,
60
- doneActionParent: /* @__PURE__ */ React.createElement(Dialog.Close, {
61
- asChild: true
62
- }),
63
- onDone: handleDone,
64
- onResetStorage: handleResetStorage,
65
- onRecover: handleRecover,
66
- onJoinNewIdentity: handleJoinNewIdentity
67
- })));
68
- };
69
-
70
- // packages/plugins/plugin-client/src/components/JoinDialog.tsx
71
- import React2, { useCallback as useCallback2 } from "react";
72
- import { createIntent as createIntent2, LayoutAction as LayoutAction2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
73
- import { ObservabilityAction } from "@dxos/plugin-observability/types";
74
- import { Dialog as Dialog2 } from "@dxos/react-ui";
75
- import { JoinPanel } from "@dxos/shell/react";
76
- var JOIN_DIALOG = `${CLIENT_PLUGIN}/JoinDialog`;
77
- var JoinDialog = (props) => {
78
- const { dispatchPromise: dispatch } = useIntentDispatcher2();
79
- const handleCancelResetStorage = useCallback2(() => dispatch(createIntent2(ClientAction.ShareIdentity)), [
80
- dispatch
81
- ]);
82
- const handleDone = useCallback2(async (result) => {
83
- if (result?.identityKey) {
84
- await Promise.all([
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
- }))
92
- ]);
93
- }
94
- }, [
95
- dispatch
96
- ]);
97
- return /* @__PURE__ */ React2.createElement(Dialog2.Content, null, /* @__PURE__ */ React2.createElement(JoinPanel, {
98
- mode: "halo-only",
99
- ...props,
100
- exitActionParent: /* @__PURE__ */ React2.createElement(Dialog2.Close, {
101
- asChild: true
102
- }),
103
- doneActionParent: /* @__PURE__ */ React2.createElement(Dialog2.Close, {
104
- asChild: true
105
- }),
106
- onCancelResetStorage: handleCancelResetStorage,
107
- onDone: handleDone
108
- }));
109
- };
13
+ // packages/plugins/plugin-client/src/ClientPlugin.ts
14
+ import { Capabilities, contributes, defineModule, definePlugin, Events } from "@dxos/app-framework";
110
15
 
111
- // packages/plugins/plugin-client/src/components/RecoveryCodeDialog.tsx
112
- import React3, { useCallback as useCallback3, useState } from "react";
113
- import { AlertDialog, Button, Clipboard as Clipboard2, Input, useTranslation } from "@dxos/react-ui";
114
- var RECOVER_CODE_DIALOG = `${CLIENT_PLUGIN}/RecoveryCodeDialog`;
115
- var RecoveryCodeDialog = ({ code }) => {
116
- const { t } = useTranslation(CLIENT_PLUGIN);
117
- const [confirmation, setConfirmation] = useState(false);
118
- const handleConfirmation = useCallback3((checked) => setConfirmation(checked), []);
119
- return /* @__PURE__ */ React3.createElement(AlertDialog.Content, {
120
- classNames: "bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
121
- }, /* @__PURE__ */ React3.createElement(AlertDialog.Title, null, t("recovery code dialog title")), /* @__PURE__ */ React3.createElement("p", {
122
- className: "py-4"
123
- }, t("recovery code dialog description")), /* @__PURE__ */ React3.createElement(Clipboard2.Provider, null, /* @__PURE__ */ React3.createElement(Code, {
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", {
128
- className: "flex items-center gap-2 pbe-4"
129
- }, /* @__PURE__ */ React3.createElement(Input.Root, null, /* @__PURE__ */ React3.createElement(Input.Checkbox, {
130
- "data-testid": "recoveryCode.confirm",
131
- checked: confirmation,
132
- onCheckedChange: handleConfirmation
133
- }), /* @__PURE__ */ React3.createElement(Input.Label, null, t("recovery code confirmation label")))), /* @__PURE__ */ React3.createElement("div", {
134
- className: "flex justify-end"
135
- }, /* @__PURE__ */ React3.createElement(AlertDialog.Action, {
136
- asChild: true
137
- }, /* @__PURE__ */ React3.createElement(Button, {
138
- "data-testid": "recoveryCode.continue",
139
- variant: "primary",
140
- disabled: !confirmation
141
- }, t("continue label")))));
142
- };
143
- var Code = ({ code }) => {
144
- const words = code.split(" ");
145
- return /* @__PURE__ */ React3.createElement("div", {
146
- className: "relative p-2 border border-separator rounded group"
147
- }, /* @__PURE__ */ React3.createElement(Clipboard2.IconButton, {
148
- value: code,
149
- classNames: "absolute top-2 right-2 invisible group-hover:visible"
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)))));
160
- };
16
+ // packages/plugins/plugin-client/src/capabilities/index.ts
17
+ import { lazy } from "@dxos/app-framework";
18
+ var AppGraphBuilder = lazy(async () => import("./app-graph-builder-ZLGKFBLY.mjs"));
19
+ var Client = lazy(async () => import("./client-K52NWOUN.mjs"));
20
+ var IntentResolver = lazy(async () => import("./intent-resolver-JCKD6R6L.mjs"));
21
+ var ReactContext = lazy(async () => import("./react-context-IGEHJQK5.mjs"));
22
+ var ReactSurface = lazy(async () => import("./react-surface-CXLBCMPN.mjs"));
161
23
 
162
24
  // packages/plugins/plugin-client/src/translations.ts
163
25
  var translations_default = [
@@ -176,227 +38,65 @@ var translations_default = [
176
38
  }
177
39
  ];
178
40
 
179
- // packages/plugins/plugin-client/src/ClientPlugin.tsx
180
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-client/src/ClientPlugin.tsx";
181
- var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitationParam = "deviceInvitationCode", onClientInitialized, onReady, onReset, ...options }) => {
182
- registerSignalsRuntime();
183
- let client;
184
- let error = null;
185
- const createDeviceInvitationUrl = (invitationCode) => {
41
+ // packages/plugins/plugin-client/src/ClientPlugin.ts
42
+ var ClientPlugin = ({ invitationUrl = window.location.origin, invitationParam = "deviceInvitationCode", onReset, ...options }) => {
43
+ const createInvitationUrl = (invitationCode) => {
186
44
  const baseUrl = new URL(invitationUrl);
187
45
  baseUrl.searchParams.set(invitationParam, invitationCode);
188
46
  return baseUrl.toString();
189
47
  };
190
- return {
191
- meta: meta_default,
192
- initialize: async () => {
193
- const config = new Config(await Storage(), Envs(), Local(), Defaults());
194
- client = new Client({
195
- config,
196
- ...options
197
- });
198
- try {
199
- await client.initialize();
200
- await onClientInitialized?.(client);
201
- client.reloaded.on(() => {
202
- client.halo.identity.subscribe(async (identity) => {
203
- if (identity) {
204
- window.location.href = window.location.origin;
205
- }
206
- });
207
- });
208
- } catch (err) {
209
- error = err;
210
- }
211
- return {
212
- client,
213
- context: ({ children }) => /* @__PURE__ */ React4.createElement(ClientProvider, {
214
- client
215
- }, children)
216
- };
217
- },
218
- ready: async ({ plugins }) => {
219
- if (error) {
220
- throw error;
221
- }
222
- await onReady?.(client, plugins);
223
- },
224
- unload: async () => {
225
- await client.destroy();
226
- },
227
- provides: {
228
- translations: translations_default,
229
- surface: {
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
- ]
253
- },
254
- graph: {
255
- builder: (plugins) => {
256
- const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatchPromise;
257
- const id = `${CLIENT_PLUGIN}/open-shell`;
258
- return createExtension({
259
- id: CLIENT_PLUGIN,
260
- filter: (node) => node.id === "root",
261
- actions: () => [
262
- {
263
- id,
264
- data: async () => {
265
- await dispatch?.(createIntent3(ClientAction.ShareIdentity));
266
- },
267
- properties: {
268
- label: [
269
- "open shell label",
270
- {
271
- ns: CLIENT_PLUGIN
272
- }
273
- ],
274
- icon: "ph--address-book--regular",
275
- keyBinding: {
276
- macos: "meta+shift+.",
277
- // TODO(wittjosiah): Test on windows to see if it behaves the same as linux.
278
- windows: "alt+shift+.",
279
- linux: "alt+shift+>"
280
- },
281
- testId: "clientPlugin.openShell"
282
- }
283
- }
284
- ]
285
- });
286
- }
287
- },
288
- intent: {
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
- ]
391
- }
392
- }
393
- };
48
+ return definePlugin(meta, [
49
+ defineModule({
50
+ id: `${meta.id}/module/client`,
51
+ activatesOn: Events.Startup,
52
+ activatesBefore: [
53
+ ClientEvents.SetupClient
54
+ ],
55
+ activatesAfter: [
56
+ ClientEvents.ClientReady
57
+ ],
58
+ activate: (context) => Client({
59
+ ...options,
60
+ context
61
+ })
62
+ }),
63
+ defineModule({
64
+ id: `${meta.id}/module/react-context`,
65
+ activatesOn: Events.Startup,
66
+ activate: ReactContext
67
+ }),
68
+ defineModule({
69
+ id: `${meta.id}/module/react-surface`,
70
+ activatesOn: Events.Startup,
71
+ activate: () => ReactSurface({
72
+ createInvitationUrl
73
+ })
74
+ }),
75
+ defineModule({
76
+ id: `${meta.id}/module/app-graph-builder`,
77
+ activatesOn: Events.SetupAppGraph,
78
+ activate: AppGraphBuilder
79
+ }),
80
+ defineModule({
81
+ id: `${meta.id}/module/intent-resolver`,
82
+ activatesOn: Events.SetupIntents,
83
+ activate: (context) => IntentResolver({
84
+ context,
85
+ onReset
86
+ })
87
+ }),
88
+ defineModule({
89
+ id: `${meta.id}/module/translations`,
90
+ activatesOn: Events.SetupTranslations,
91
+ activate: () => contributes(Capabilities.Translations, translations_default)
92
+ })
93
+ ]);
394
94
  };
395
-
396
- // packages/plugins/plugin-client/src/index.ts
397
- var src_default = ClientPlugin;
398
95
  export {
96
+ CLIENT_PLUGIN,
97
+ ClientCapabilities,
98
+ ClientEvents,
399
99
  ClientPlugin,
400
- src_default as default
100
+ meta
401
101
  };
402
102
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/ClientPlugin.tsx", "../../../src/components/IdentityDialog.tsx", "../../../src/components/JoinDialog.tsx", "../../../src/components/RecoveryCodeDialog.tsx", "../../../src/translations.ts", "../../../src/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport {\n LayoutAction,\n parseIntentPlugin,\n resolvePlugin,\n type PluginDefinition,\n createSurface,\n createIntent,\n createResolver,\n} from '@dxos/app-framework';\nimport { Config, Defaults, Envs, Local, Storage } from '@dxos/config';\nimport { registerSignalsRuntime } from '@dxos/echo-signals/react';\nimport { invariant } from '@dxos/invariant';\nimport { createExtension, type Node } from '@dxos/plugin-graph';\nimport { ObservabilityAction } from '@dxos/plugin-observability/types';\nimport { Client, ClientProvider } from '@dxos/react-client';\nimport { type IdentityPanelProps, type JoinPanelProps } from '@dxos/shell/react';\n\nimport {\n IDENTITY_DIALOG,\n IdentityDialog,\n JOIN_DIALOG,\n JoinDialog,\n RECOVER_CODE_DIALOG,\n RecoveryCodeDialog,\n type RecoveryCodeDialogProps,\n} from './components';\nimport meta, { CLIENT_PLUGIN } from './meta';\nimport translations from './translations';\nimport { ClientAction, type ClientPluginOptions, type ClientPluginProvides } from './types';\n\nexport const ClientPlugin = ({\n appKey,\n invitationUrl = window.location.origin,\n invitationParam = 'deviceInvitationCode',\n onClientInitialized,\n onReady,\n onReset,\n ...options\n}: ClientPluginOptions): PluginDefinition<\n Omit<ClientPluginProvides, 'client'>,\n Pick<ClientPluginProvides, 'client'>\n> => {\n registerSignalsRuntime();\n\n let client: Client;\n let error: unknown = null;\n\n const createDeviceInvitationUrl = (invitationCode: string) => {\n const baseUrl = new URL(invitationUrl);\n baseUrl.searchParams.set(invitationParam, invitationCode);\n return baseUrl.toString();\n };\n\n return {\n meta,\n initialize: async () => {\n const config = new Config(await Storage(), Envs(), Local(), Defaults());\n client = new Client({ config, ...options });\n\n try {\n await client.initialize();\n await onClientInitialized?.(client);\n\n // TODO(wittjosiah): Remove. This is a hack to get the app to boot with the new identity after a reset.\n client.reloaded.on(() => {\n client.halo.identity.subscribe(async (identity) => {\n if (identity) {\n window.location.href = window.location.origin;\n }\n });\n });\n } catch (err) {\n error = err;\n }\n\n return {\n client,\n context: ({ children }) => <ClientProvider client={client}>{children}</ClientProvider>,\n };\n },\n ready: async ({ plugins }) => {\n if (error) {\n throw error;\n }\n\n await onReady?.(client, plugins);\n },\n unload: async () => {\n await client.destroy();\n },\n provides: {\n translations,\n surface: {\n definitions: () => [\n createSurface({\n id: IDENTITY_DIALOG,\n role: 'dialog',\n filter: (data): data is { subject: IdentityPanelProps } => data.component === IDENTITY_DIALOG,\n component: ({ data }) => (\n <IdentityDialog {...data.subject} createInvitationUrl={createDeviceInvitationUrl} />\n ),\n }),\n createSurface({\n id: JOIN_DIALOG,\n role: 'dialog',\n filter: (data): data is { subject: JoinPanelProps } => data.component === JOIN_DIALOG,\n component: ({ data }) => <JoinDialog {...data.subject} />,\n }),\n createSurface({\n id: RECOVER_CODE_DIALOG,\n role: 'dialog',\n filter: (data): data is { subject: RecoveryCodeDialogProps } => data.component === RECOVER_CODE_DIALOG,\n component: ({ data }) => <RecoveryCodeDialog {...data.subject} />,\n }),\n ],\n },\n graph: {\n builder: (plugins) => {\n const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatchPromise;\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 dispatch?.(createIntent(ClientAction.ShareIdentity));\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 resolvers: () => [\n createResolver(ClientAction.CreateIdentity, async () => {\n const data = await client.halo.createIdentity();\n return { data, intents: [createIntent(ObservabilityAction.SendEvent, { name: 'identity.create' })] };\n }),\n createResolver(ClientAction.JoinIdentity, async (data) => {\n return {\n intents: [\n createIntent(LayoutAction.SetLayout, {\n element: 'dialog',\n component: JOIN_DIALOG,\n dialogBlockAlign: 'start',\n subject: {\n initialInvitationCode: data.invitationCode,\n initialDisposition: 'accept-halo-invitation',\n } satisfies Partial<JoinPanelProps>,\n }),\n ],\n };\n }),\n createResolver(ClientAction.ShareIdentity, async () => {\n return {\n intents: [\n createIntent(LayoutAction.SetLayout, {\n element: 'dialog',\n component: IDENTITY_DIALOG,\n dialogBlockAlign: 'start',\n }),\n createIntent(ObservabilityAction.SendEvent, { name: 'identity.share' }),\n ],\n };\n }),\n createResolver(ClientAction.RecoverIdentity, async () => {\n return {\n intents: [\n createIntent(LayoutAction.SetLayout, {\n element: 'dialog',\n component: JOIN_DIALOG,\n dialogBlockAlign: 'start',\n subject: { initialDisposition: 'recover-identity' } satisfies Partial<JoinPanelProps>,\n }),\n ],\n };\n }),\n createResolver(ClientAction.ResetStorage, async (data) => {\n await onReset?.({ target: data.target });\n return {};\n }),\n createResolver(ClientAction.CreateAgent, async () => {\n invariant(client.services.services.EdgeAgentService, 'Missing EdgeAgentService');\n await client.services.services.EdgeAgentService.createAgent(null as any, { timeout: 10_000 });\n }),\n createResolver(ClientAction.CreateRecoveryCode, async () => {\n invariant(client.services.services.IdentityService, 'IdentityService not available');\n // TODO(wittjosiah): This needs a proper api. Rename property.\n const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();\n return {\n intents: [\n createIntent(LayoutAction.SetLayout, {\n element: 'dialog',\n dialogBlockAlign: 'start',\n dialogType: 'alert',\n state: true,\n component: RECOVER_CODE_DIALOG,\n subject: { code: seedphrase },\n }),\n ],\n };\n }),\n ],\n },\n },\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { useClient } from '@dxos/react-client';\nimport { Clipboard, Dialog } from '@dxos/react-ui';\nimport { IdentityPanel, type IdentityPanelProps } from '@dxos/shell/react';\n\nimport { CLIENT_PLUGIN } from '../meta';\nimport { ClientAction } from '../types';\n\nexport const IDENTITY_DIALOG = `${CLIENT_PLUGIN}/IdentityDialog`;\n\nexport const IdentityDialog = (props: IdentityPanelProps) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const client = useClient();\n\n const handleDone = useCallback(\n () =>\n dispatch(\n createIntent(LayoutAction.SetLayout, {\n element: 'dialog',\n state: false,\n }),\n ),\n [dispatch],\n );\n\n const handleResetStorage = useCallback(async () => {\n await client.reset();\n await dispatch(createIntent(ClientAction.ResetStorage));\n }, [dispatch]);\n\n const handleRecover = useCallback(async () => {\n await client.reset();\n await dispatch(createIntent(ClientAction.ResetStorage, { target: 'recoverIdentity' }));\n }, [dispatch]);\n\n const handleJoinNewIdentity = useCallback(async () => {\n await client.reset();\n await dispatch(createIntent(ClientAction.ResetStorage, { target: 'deviceInvitation' }));\n }, [dispatch]);\n\n return (\n <Dialog.Content>\n <Clipboard.Provider>\n <IdentityPanel\n {...props}\n doneActionParent={<Dialog.Close asChild />}\n onDone={handleDone}\n onResetStorage={handleResetStorage}\n onRecover={handleRecover}\n onJoinNewIdentity={handleJoinNewIdentity}\n />\n </Clipboard.Provider>\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { ObservabilityAction } from '@dxos/plugin-observability/types';\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 } from '../meta';\nimport { ClientAction } from '../types';\n\nexport const JOIN_DIALOG = `${CLIENT_PLUGIN}/JoinDialog`;\n\nexport const JoinDialog = (props: JoinPanelProps) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n const handleCancelResetStorage = useCallback(() => dispatch(createIntent(ClientAction.ShareIdentity)), [dispatch]);\n\n const handleDone = useCallback(\n async (result: InvitationResult | null) => {\n if (result?.identityKey) {\n await Promise.all([\n dispatch(createIntent(LayoutAction.SetLayout, { element: 'dialog', state: false })),\n dispatch(\n createIntent(ObservabilityAction.SendEvent, {\n name: props.initialDisposition === 'recover-identity' ? 'identity.recover' : 'identity.join',\n }),\n ),\n ]);\n }\n },\n [dispatch],\n );\n\n return (\n <Dialog.Content>\n <JoinPanel\n mode='halo-only'\n {...props}\n exitActionParent={<Dialog.Close asChild />}\n doneActionParent={<Dialog.Close asChild />}\n onCancelResetStorage={handleCancelResetStorage}\n onDone={handleDone}\n />\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useState } from 'react';\n\nimport { AlertDialog, Button, Clipboard, Input, useTranslation } from '@dxos/react-ui';\n\nimport { CLIENT_PLUGIN } from '../meta';\n\nexport const RECOVER_CODE_DIALOG = `${CLIENT_PLUGIN}/RecoveryCodeDialog`;\n\nexport type RecoveryCodeDialogProps = {\n code: string;\n};\n\nexport const RecoveryCodeDialog = ({ code }: RecoveryCodeDialogProps) => {\n const { t } = useTranslation(CLIENT_PLUGIN);\n const [confirmation, setConfirmation] = useState(false);\n\n const handleConfirmation = useCallback((checked: boolean) => setConfirmation(checked), []);\n\n return (\n <AlertDialog.Content classNames='bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden'>\n <AlertDialog.Title>{t('recovery code dialog title')}</AlertDialog.Title>\n <p className='py-4'>{t('recovery code dialog description')}</p>\n <Clipboard.Provider>\n <Code code={code} />\n </Clipboard.Provider>\n <div className='flex flex-col py-4 gap-2'>\n <p>{t('recovery code dialog warning 1')}</p>\n <p>{t('recovery code dialog warning 2')}</p>\n </div>\n <div className='flex items-center gap-2 pbe-4'>\n <Input.Root>\n <Input.Checkbox\n data-testid='recoveryCode.confirm'\n checked={confirmation}\n onCheckedChange={handleConfirmation}\n />\n <Input.Label>{t('recovery code confirmation label')}</Input.Label>\n </Input.Root>\n </div>\n <div className='flex justify-end'>\n <AlertDialog.Action asChild>\n <Button data-testid='recoveryCode.continue' variant='primary' disabled={!confirmation}>\n {t('continue label')}\n </Button>\n </AlertDialog.Action>\n </div>\n </AlertDialog.Content>\n );\n};\n\nconst Code = ({ code }: { code: string }) => {\n const words = code.split(' ');\n return (\n <div className='relative p-2 border border-separator rounded group'>\n <Clipboard.IconButton value={code} classNames='absolute top-2 right-2 invisible group-hover:visible' />\n <div className='grid grid-cols-4'>\n {words.map((word, i) => (\n <div key={i} className='flex items-center p-2 gap-2 items-center'>\n <div className='w-4 text-xs text-center text-subdued'>{i + 1}</div>\n <div className='text-sm'>{word}</div>\n </div>\n ))}\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CLIENT_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [CLIENT_PLUGIN]: {\n 'open shell label': 'Open HALO',\n 'recovery code dialog title': 'Account Recovery',\n 'recovery code dialog description':\n 'This is your identity recovery code, store it in a safe place. You can use it to recover your identity if you ever lose access to your devices.',\n 'recovery code dialog warning 1': 'NOTE: This code will not be displayed again.',\n 'recovery code dialog warning 2':\n 'It is your private key for recovering DXOS data. Anyone with this key will be able to gain access to your account.',\n 'recovery code confirmation label': 'Please confirm you have saved the code.',\n 'continue label': 'Continue',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ClientPlugin } from './ClientPlugin';\n\nexport default ClientPlugin;\n\nexport * from './ClientPlugin';\n"],
5
- "mappings": ";;;;;;;;;;AAIA,OAAOA,YAAW;AAElB,SACEC,gBAAAA,eACAC,mBACAC,eAEAC,eACAC,gBAAAA,eACAC,sBACK;AACP,SAASC,QAAQC,UAAUC,MAAMC,OAAOC,eAAe;AACvD,SAASC,8BAA8B;AACvC,SAASC,iBAAiB;AAC1B,SAASC,uBAAkC;AAC3C,SAASC,uBAAAA,4BAA2B;AACpC,SAAS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QAAQjD,KAAKiD;YAAO,CAAA;AACtC,mBAAO,CAAC;UACV,CAAA;UACAhB,eAAeZ,aAAa6B,aAAa,YAAA;AACvCC,sBAAU7F,OAAO8F,SAASA,SAASC,kBAAkB,4BAAA;;;;;;;;;AACrD,kBAAM/F,OAAO8F,SAASA,SAASC,iBAAiBC,YAAY,MAAa;cAAEC,SAAS;YAAO,CAAA;UAC7F,CAAA;UACAtB,eAAeZ,aAAamC,oBAAoB,YAAA;AAC9CL,sBAAU7F,OAAO8F,SAASA,SAASK,iBAAiB,iCAAA;;;;;;;;;AAEpD,kBAAM,EAAEC,WAAU,IAAK,MAAMpG,OAAO8F,SAASA,SAASK,gBAAgBE,qBAAoB;AAC1F,mBAAO;cACLvB,SAAS;gBACPhB,cAAaqB,cAAaC,WAAW;kBACnCC,SAAS;kBACTC,kBAAkB;kBAClBgB,YAAY;kBACZC,OAAO;kBACP5D,WAAWM;kBACXJ,SAAS;oBAAE2D,MAAMJ;kBAAW;gBAC9B,CAAA;;YAEJ;UACF,CAAA;;MAEJ;IACF;EACF;AACF;;;AK5NA,IAAA,cAAeK;",
6
- "names": ["React", "LayoutAction", "parseIntentPlugin", "resolvePlugin", "createSurface", "createIntent", "createResolver", "Config", "Defaults", "Envs", "Local", "Storage", "registerSignalsRuntime", "invariant", "createExtension", "ObservabilityAction", "Client", "ClientProvider", "React", "useCallback", "createIntent", "LayoutAction", "useIntentDispatcher", "useClient", "Clipboard", "Dialog", "IdentityPanel", "IDENTITY_DIALOG", "CLIENT_PLUGIN", "IdentityDialog", "props", "dispatchPromise", "dispatch", "useIntentDispatcher", "client", "useClient", "handleDone", "useCallback", "createIntent", "LayoutAction", "SetLayout", "element", "state", "handleResetStorage", "reset", "ClientAction", "ResetStorage", "handleRecover", "target", "handleJoinNewIdentity", "Dialog", "Content", "Clipboard", "Provider", "IdentityPanel", "doneActionParent", "Close", "asChild", "onDone", "onResetStorage", "onRecover", "onJoinNewIdentity", "React", "useCallback", "createIntent", "LayoutAction", "useIntentDispatcher", "ObservabilityAction", "Dialog", "JoinPanel", "JOIN_DIALOG", "CLIENT_PLUGIN", "JoinDialog", "props", "dispatchPromise", "dispatch", "useIntentDispatcher", "handleCancelResetStorage", "useCallback", "createIntent", "ClientAction", "ShareIdentity", "handleDone", "result", "identityKey", "Promise", "all", "LayoutAction", "SetLayout", "element", "state", "ObservabilityAction", "SendEvent", "name", "initialDisposition", "React", "Dialog", "Content", "JoinPanel", "mode", "exitActionParent", "Close", "asChild", "doneActionParent", "onCancelResetStorage", "onDone", "React", "useCallback", "useState", "AlertDialog", "Button", "Clipboard", "Input", "useTranslation", "RECOVER_CODE_DIALOG", "CLIENT_PLUGIN", "RecoveryCodeDialog", "code", "t", "useTranslation", "confirmation", "setConfirmation", "useState", "handleConfirmation", "useCallback", "checked", "React", "AlertDialog", "Content", "classNames", "Title", "p", "className", "Clipboard", "Provider", "Code", "div", "Input", "Root", "Checkbox", "data-testid", "onCheckedChange", "Label", "Action", "asChild", "Button", "variant", "disabled", "words", "split", "IconButton", "value", "map", "word", "i", "key", "CLIENT_PLUGIN", "ClientPlugin", "appKey", "invitationUrl", "window", "location", "origin", "invitationParam", "onClientInitialized", "onReady", "onReset", "options", "registerSignalsRuntime", "client", "error", "createDeviceInvitationUrl", "invitationCode", "baseUrl", "URL", "searchParams", "set", "toString", "meta", "initialize", "config", "Config", "Storage", "Envs", "Local", "Defaults", "Client", "reloaded", "on", "halo", "identity", "subscribe", "href", "err", "context", "children", "React", "ClientProvider", "ready", "plugins", "unload", "destroy", "provides", "translations", "surface", "definitions", "createSurface", "id", "IDENTITY_DIALOG", "role", "filter", "data", "component", "IdentityDialog", "subject", "createInvitationUrl", "JOIN_DIALOG", "JoinDialog", "RECOVER_CODE_DIALOG", "RecoveryCodeDialog", "graph", "builder", "dispatch", "resolvePlugin", "parseIntentPlugin", "intent", "dispatchPromise", "CLIENT_PLUGIN", "createExtension", "node", "actions", "createIntent", "ClientAction", "ShareIdentity", "properties", "label", "ns", "icon", "keyBinding", "macos", "windows", "linux", "testId", "resolvers", "createResolver", "CreateIdentity", "createIdentity", "intents", "ObservabilityAction", "SendEvent", "name", "JoinIdentity", "LayoutAction", "SetLayout", "element", "dialogBlockAlign", "initialInvitationCode", "initialDisposition", "RecoverIdentity", "ResetStorage", "target", "CreateAgent", "invariant", "services", "EdgeAgentService", "createAgent", "timeout", "CreateRecoveryCode", "IdentityService", "seedphrase", "createRecoveryPhrase", "dialogType", "state", "code", "ClientPlugin"]
3
+ "sources": ["../../../src/ClientPlugin.ts", "../../../src/capabilities/index.ts", "../../../src/translations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, defineModule, definePlugin, Events } from '@dxos/app-framework';\n\nimport { Client, AppGraphBuilder, IntentResolver, ReactContext, ReactSurface } from './capabilities';\nimport { ClientEvents } from './events';\nimport { meta } from './meta';\nimport translations from './translations';\nimport { type ClientPluginOptions } from './types';\n\nexport const ClientPlugin = ({\n invitationUrl = window.location.origin,\n invitationParam = 'deviceInvitationCode',\n onReset,\n ...options\n}: ClientPluginOptions) => {\n const createInvitationUrl = (invitationCode: string) => {\n const baseUrl = new URL(invitationUrl);\n baseUrl.searchParams.set(invitationParam, invitationCode);\n return baseUrl.toString();\n };\n\n return definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/client`,\n activatesOn: Events.Startup,\n activatesBefore: [ClientEvents.SetupClient],\n activatesAfter: [ClientEvents.ClientReady],\n activate: (context) => Client({ ...options, context }),\n }),\n defineModule({\n id: `${meta.id}/module/react-context`,\n activatesOn: Events.Startup,\n activate: ReactContext,\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.Startup,\n activate: () => ReactSurface({ createInvitationUrl }),\n }),\n defineModule({\n id: `${meta.id}/module/app-graph-builder`,\n activatesOn: Events.SetupAppGraph,\n activate: AppGraphBuilder,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntents,\n activate: (context) => IntentResolver({ context, onReset }),\n }),\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n ]);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const AppGraphBuilder = lazy(async () => import('./app-graph-builder'));\nexport const Client = lazy(async () => import('./client'));\nexport const IntentResolver = lazy(async () => import('./intent-resolver'));\nexport const ReactContext = lazy(async () => import('./react-context'));\nexport const ReactSurface = lazy(async () => import('./react-surface'));\n\nexport * from './capabilities';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CLIENT_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [CLIENT_PLUGIN]: {\n 'open shell label': 'Open HALO',\n 'recovery code dialog title': 'Account Recovery',\n 'recovery code dialog description':\n 'This is your identity recovery code, store it in a safe place. You can use it to recover your identity if you ever lose access to your devices.',\n 'recovery code dialog warning 1': 'NOTE: This code will not be displayed again.',\n 'recovery code dialog warning 2':\n 'It is your private key for recovering DXOS data. Anyone with this key will be able to gain access to your account.',\n 'recovery code confirmation label': 'Please confirm you have saved the code.',\n 'continue label': 'Continue',\n },\n },\n },\n];\n"],
5
+ "mappings": ";;;;;;;;;;;;;AAIA,SAASA,cAAcC,aAAaC,cAAcC,cAAcC,cAAc;;;ACA9E,SAASC,YAAY;AAEd,IAAMC,kBAAkBC,KAAK,YAAY,OAAO,kCAAA,CAAA;AAChD,IAAMC,SAASD,KAAK,YAAY,OAAO,uBAAA,CAAA;AACvC,IAAME,iBAAiBF,KAAK,YAAY,OAAO,gCAAA,CAAA;AAC/C,IAAMG,eAAeH,KAAK,YAAY,OAAO,8BAAA,CAAA;AAC7C,IAAMI,eAAeJ,KAAK,YAAY,OAAO,8BAAA,CAAA;;;ACJpD,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACK,aAAAA,GAAgB;QACf,oBAAoB;QACpB,8BAA8B;QAC9B,oCACE;QACF,kCAAkC;QAClC,kCACE;QACF,oCAAoC;QACpC,kBAAkB;MACpB;IACF;EACF;;;;AFTK,IAAMC,eAAe,CAAC,EAC3BC,gBAAgBC,OAAOC,SAASC,QAChCC,kBAAkB,wBAClBC,SACA,GAAGC,QAAAA,MACiB;AACpB,QAAMC,sBAAsB,CAACC,mBAAAA;AAC3B,UAAMC,UAAU,IAAIC,IAAIV,aAAAA;AACxBS,YAAQE,aAAaC,IAAIR,iBAAiBI,cAAAA;AAC1C,WAAOC,QAAQI,SAAQ;EACzB;AAEA,SAAOC,aAAaC,MAAM;IACxBC,aAAa;MACXC,IAAI,GAAGF,KAAKE,EAAE;MACdC,aAAaC,OAAOC;MACpBC,iBAAiB;QAACC,aAAaC;;MAC/BC,gBAAgB;QAACF,aAAaG;;MAC9BC,UAAU,CAACC,YAAYC,OAAO;QAAE,GAAGtB;QAASqB;MAAQ,CAAA;IACtD,CAAA;IACAX,aAAa;MACXC,IAAI,GAAGF,KAAKE,EAAE;MACdC,aAAaC,OAAOC;MACpBM,UAAUG;IACZ,CAAA;IACAb,aAAa;MACXC,IAAI,GAAGF,KAAKE,EAAE;MACdC,aAAaC,OAAOC;MACpBM,UAAU,MAAMI,aAAa;QAAEvB;MAAoB,CAAA;IACrD,CAAA;IACAS,aAAa;MACXC,IAAI,GAAGF,KAAKE,EAAE;MACdC,aAAaC,OAAOY;MACpBL,UAAUM;IACZ,CAAA;IACAhB,aAAa;MACXC,IAAI,GAAGF,KAAKE,EAAE;MACdC,aAAaC,OAAOc;MACpBP,UAAU,CAACC,YAAYO,eAAe;QAAEP;QAAStB;MAAQ,CAAA;IAC3D,CAAA;IACAW,aAAa;MACXC,IAAI,GAAGF,KAAKE,EAAE;MACdC,aAAaC,OAAOgB;MACpBT,UAAU,MAAMU,YAAYC,aAAaC,cAAcC,oBAAAA;IACzD,CAAA;GACD;AACH;",
6
+ "names": ["Capabilities", "contributes", "defineModule", "definePlugin", "Events", "lazy", "AppGraphBuilder", "lazy", "Client", "IntentResolver", "ReactContext", "ReactSurface", "CLIENT_PLUGIN", "ClientPlugin", "invitationUrl", "window", "location", "origin", "invitationParam", "onReset", "options", "createInvitationUrl", "invitationCode", "baseUrl", "URL", "searchParams", "set", "toString", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "activatesBefore", "ClientEvents", "SetupClient", "activatesAfter", "ClientReady", "activate", "context", "Client", "ReactContext", "ReactSurface", "SetupAppGraph", "AppGraphBuilder", "SetupIntents", "IntentResolver", "SetupTranslations", "contributes", "Capabilities", "Translations", "translations"]
7
7
  }