@dxos/plugin-client 0.7.4-staging.f7e8224 → 0.7.5-main.499c70c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/lib/browser/chunk-52IJQ35F.mjs +78 -0
  2. package/dist/lib/browser/chunk-52IJQ35F.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-X4QUPYC6.mjs +12 -0
  4. package/dist/lib/browser/chunk-X4QUPYC6.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +184 -233
  6. package/dist/lib/browser/index.mjs.map +3 -3
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/meta.mjs +1 -5
  9. package/dist/lib/browser/types.mjs +10 -0
  10. package/dist/lib/browser/types.mjs.map +7 -0
  11. package/dist/lib/node/chunk-NFO3ADQC.cjs +98 -0
  12. package/dist/lib/node/chunk-NFO3ADQC.cjs.map +7 -0
  13. package/dist/lib/node/chunk-RUA5KXVW.cjs +35 -0
  14. package/dist/lib/node/chunk-RUA5KXVW.cjs.map +7 -0
  15. package/dist/lib/node/index.cjs +186 -236
  16. package/dist/lib/node/index.cjs.map +3 -3
  17. package/dist/lib/node/meta.cjs +4 -8
  18. package/dist/lib/node/meta.cjs.map +2 -2
  19. package/dist/lib/node/meta.json +1 -1
  20. package/dist/lib/node/types.cjs +32 -0
  21. package/dist/lib/node/types.cjs.map +7 -0
  22. package/dist/lib/node-esm/chunk-GMGRQ5Q7.mjs +14 -0
  23. package/dist/lib/node-esm/chunk-GMGRQ5Q7.mjs.map +7 -0
  24. package/dist/lib/node-esm/chunk-TI4GNGMM.mjs +79 -0
  25. package/dist/lib/node-esm/chunk-TI4GNGMM.mjs.map +7 -0
  26. package/dist/lib/node-esm/index.mjs +184 -233
  27. package/dist/lib/node-esm/index.mjs.map +3 -3
  28. package/dist/lib/node-esm/meta.json +1 -1
  29. package/dist/lib/node-esm/meta.mjs +1 -5
  30. package/dist/lib/node-esm/types.mjs +11 -0
  31. package/dist/lib/node-esm/types.mjs.map +7 -0
  32. package/dist/types/src/ClientPlugin.d.ts +2 -35
  33. package/dist/types/src/ClientPlugin.d.ts.map +1 -1
  34. package/dist/types/src/components/IdentityDialog.d.ts +1 -0
  35. package/dist/types/src/components/IdentityDialog.d.ts.map +1 -1
  36. package/dist/types/src/components/JoinDialog.d.ts +1 -0
  37. package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
  38. package/dist/types/src/components/RecoveryCodeDialog.d.ts +1 -0
  39. package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +1 -1
  40. package/dist/types/src/components/RecoveryCodeDialog.stories.d.ts +8 -0
  41. package/dist/types/src/components/RecoveryCodeDialog.stories.d.ts.map +1 -0
  42. package/dist/types/src/meta.d.ts +0 -10
  43. package/dist/types/src/meta.d.ts.map +1 -1
  44. package/dist/types/src/translations.d.ts +2 -1
  45. package/dist/types/src/translations.d.ts.map +1 -1
  46. package/dist/types/src/types.d.ts +110 -0
  47. package/dist/types/src/types.d.ts.map +1 -0
  48. package/dist/types/tsconfig.tsbuildinfo +1 -0
  49. package/package.json +22 -13
  50. package/src/ClientPlugin.tsx +111 -200
  51. package/src/components/IdentityDialog.tsx +13 -11
  52. package/src/components/JoinDialog.tsx +13 -19
  53. package/src/components/RecoveryCodeDialog.stories.tsx +50 -0
  54. package/src/components/RecoveryCodeDialog.tsx +19 -7
  55. package/src/meta.ts +0 -14
  56. package/src/translations.ts +5 -4
  57. package/src/types.ts +115 -0
  58. package/dist/lib/browser/chunk-FGUXUNOK.mjs +0 -26
  59. package/dist/lib/browser/chunk-FGUXUNOK.mjs.map +0 -7
  60. package/dist/lib/node/chunk-XYLDQWFV.cjs +0 -51
  61. package/dist/lib/node/chunk-XYLDQWFV.cjs.map +0 -7
  62. package/dist/lib/node-esm/chunk-C6X363FK.mjs +0 -28
  63. package/dist/lib/node-esm/chunk-C6X363FK.mjs.map +0 -7
@@ -29,17 +29,18 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  var node_exports = {};
30
30
  __export(node_exports, {
31
31
  ClientPlugin: () => ClientPlugin,
32
- default: () => src_default,
33
- parseClientPlugin: () => parseClientPlugin
32
+ default: () => src_default
34
33
  });
35
34
  module.exports = __toCommonJS(node_exports);
36
- var import_chunk_XYLDQWFV = require("./chunk-XYLDQWFV.cjs");
35
+ var import_chunk_NFO3ADQC = require("./chunk-NFO3ADQC.cjs");
36
+ var import_chunk_RUA5KXVW = require("./chunk-RUA5KXVW.cjs");
37
37
  var import_react = __toESM(require("react"));
38
38
  var import_app_framework = require("@dxos/app-framework");
39
39
  var import_config = require("@dxos/config");
40
40
  var import_react2 = require("@dxos/echo-signals/react");
41
41
  var import_invariant = require("@dxos/invariant");
42
42
  var import_plugin_graph = require("@dxos/plugin-graph");
43
+ var import_types = require("@dxos/plugin-observability/types");
43
44
  var import_react_client = require("@dxos/react-client");
44
45
  var import_react3 = __toESM(require("react"));
45
46
  var import_app_framework2 = require("@dxos/app-framework");
@@ -48,49 +49,40 @@ var import_react_ui = require("@dxos/react-ui");
48
49
  var import_react4 = require("@dxos/shell/react");
49
50
  var import_react5 = __toESM(require("react"));
50
51
  var import_app_framework3 = require("@dxos/app-framework");
52
+ var import_types2 = require("@dxos/plugin-observability/types");
51
53
  var import_react_ui2 = require("@dxos/react-ui");
52
54
  var import_react6 = require("@dxos/shell/react");
53
55
  var import_react7 = __toESM(require("react"));
54
56
  var import_react_ui3 = require("@dxos/react-ui");
57
+ var IDENTITY_DIALOG = `${import_chunk_RUA5KXVW.CLIENT_PLUGIN}/IdentityDialog`;
55
58
  var IdentityDialog = (props) => {
56
- const dispatch = (0, import_app_framework2.useIntentDispatcher)();
59
+ const { dispatchPromise: dispatch } = (0, import_app_framework2.useIntentDispatcher)();
57
60
  const client = (0, import_react_client2.useClient)();
58
- const handleDone = (0, import_react3.useCallback)(() => dispatch({
59
- action: import_app_framework2.LayoutAction.SET_LAYOUT,
60
- data: {
61
- element: "dialog",
62
- state: false
63
- }
64
- }), [
61
+ const handleDone = (0, import_react3.useCallback)(() => dispatch((0, import_app_framework2.createIntent)(import_app_framework2.LayoutAction.SetLayout, {
62
+ element: "dialog",
63
+ state: false
64
+ })), [
65
65
  dispatch
66
66
  ]);
67
67
  const handleResetStorage = (0, import_react3.useCallback)(async () => {
68
68
  await client.reset();
69
- await dispatch({
70
- action: import_chunk_XYLDQWFV.ClientAction.RESET_STORAGE
71
- });
69
+ await dispatch((0, import_app_framework2.createIntent)(import_chunk_NFO3ADQC.ClientAction.ResetStorage));
72
70
  }, [
73
71
  dispatch
74
72
  ]);
75
73
  const handleRecover = (0, import_react3.useCallback)(async () => {
76
74
  await client.reset();
77
- await dispatch({
78
- action: import_chunk_XYLDQWFV.ClientAction.RESET_STORAGE,
79
- data: {
80
- target: "recoverIdentity"
81
- }
82
- });
75
+ await dispatch((0, import_app_framework2.createIntent)(import_chunk_NFO3ADQC.ClientAction.ResetStorage, {
76
+ target: "recoverIdentity"
77
+ }));
83
78
  }, [
84
79
  dispatch
85
80
  ]);
86
81
  const handleJoinNewIdentity = (0, import_react3.useCallback)(async () => {
87
82
  await client.reset();
88
- await dispatch({
89
- action: import_chunk_XYLDQWFV.ClientAction.RESET_STORAGE,
90
- data: {
91
- target: "deviceInvitation"
92
- }
93
- });
83
+ await dispatch((0, import_app_framework2.createIntent)(import_chunk_NFO3ADQC.ClientAction.ResetStorage, {
84
+ target: "deviceInvitation"
85
+ }));
94
86
  }, [
95
87
  dispatch
96
88
  ]);
@@ -105,30 +97,22 @@ var IdentityDialog = (props) => {
105
97
  onJoinNewIdentity: handleJoinNewIdentity
106
98
  })));
107
99
  };
100
+ var JOIN_DIALOG = `${import_chunk_RUA5KXVW.CLIENT_PLUGIN}/JoinDialog`;
108
101
  var JoinDialog = (props) => {
109
- const dispatch = (0, import_app_framework3.useIntentDispatcher)();
110
- const handleCancelResetStorage = (0, import_react5.useCallback)(() => dispatch({
111
- plugin: import_chunk_XYLDQWFV.CLIENT_PLUGIN,
112
- action: import_chunk_XYLDQWFV.ClientAction.SHARE_IDENTITY
113
- }), [
102
+ const { dispatchPromise: dispatch } = (0, import_app_framework3.useIntentDispatcher)();
103
+ const handleCancelResetStorage = (0, import_react5.useCallback)(() => dispatch((0, import_app_framework3.createIntent)(import_chunk_NFO3ADQC.ClientAction.ShareIdentity)), [
114
104
  dispatch
115
105
  ]);
116
106
  const handleDone = (0, import_react5.useCallback)(async (result) => {
117
107
  if (result?.identityKey) {
118
108
  await Promise.all([
119
- dispatch({
120
- action: import_app_framework3.LayoutAction.SET_LAYOUT,
121
- data: {
122
- element: "dialog",
123
- state: false
124
- }
125
- }),
126
- dispatch({
127
- action: import_chunk_XYLDQWFV.OBSERVABILITY_ACTION,
128
- data: {
129
- name: props.initialDisposition === "recover-identity" ? "identity.recover" : "identity.join"
130
- }
131
- })
109
+ dispatch((0, import_app_framework3.createIntent)(import_app_framework3.LayoutAction.SetLayout, {
110
+ element: "dialog",
111
+ state: false
112
+ })),
113
+ dispatch((0, import_app_framework3.createIntent)(import_types2.ObservabilityAction.SendEvent, {
114
+ name: props.initialDisposition === "recover-identity" ? "identity.recover" : "identity.join"
115
+ }))
132
116
  ]);
133
117
  }
134
118
  }, [
@@ -147,21 +131,20 @@ var JoinDialog = (props) => {
147
131
  onDone: handleDone
148
132
  }));
149
133
  };
134
+ var RECOVER_CODE_DIALOG = `${import_chunk_RUA5KXVW.CLIENT_PLUGIN}/RecoveryCodeDialog`;
150
135
  var RecoveryCodeDialog = ({ code }) => {
151
- const { t } = (0, import_react_ui3.useTranslation)(import_chunk_XYLDQWFV.CLIENT_PLUGIN);
136
+ const { t } = (0, import_react_ui3.useTranslation)(import_chunk_RUA5KXVW.CLIENT_PLUGIN);
152
137
  const [confirmation, setConfirmation] = (0, import_react7.useState)(false);
153
138
  const handleConfirmation = (0, import_react7.useCallback)((checked) => setConfirmation(checked), []);
154
139
  return /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.AlertDialog.Content, {
155
140
  classNames: "bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
156
- }, /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.AlertDialog.Title, {
157
- classNames: ""
158
- }, t("recovery code dialog title")), /* @__PURE__ */ import_react7.default.createElement("p", {
141
+ }, /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.AlertDialog.Title, null, t("recovery code dialog title")), /* @__PURE__ */ import_react7.default.createElement("p", {
159
142
  className: "py-4"
160
143
  }, t("recovery code dialog description")), /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.Clipboard.Provider, null, /* @__PURE__ */ import_react7.default.createElement(Code, {
161
- value: code
162
- })), /* @__PURE__ */ import_react7.default.createElement("p", {
163
- className: "py-4"
164
- }, t("recovery code dialog warning")), /* @__PURE__ */ import_react7.default.createElement("div", {
144
+ code
145
+ })), /* @__PURE__ */ import_react7.default.createElement("div", {
146
+ className: "flex flex-col py-4 gap-2"
147
+ }, /* @__PURE__ */ import_react7.default.createElement("p", null, t("recovery code dialog warning 1")), /* @__PURE__ */ import_react7.default.createElement("p", null, t("recovery code dialog warning 2"))), /* @__PURE__ */ import_react7.default.createElement("div", {
165
148
  className: "flex items-center gap-2 pbe-4"
166
149
  }, /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.Input.Root, null, /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.Input.Checkbox, {
167
150
  "data-testid": "recoveryCode.confirm",
@@ -177,32 +160,40 @@ var RecoveryCodeDialog = ({ code }) => {
177
160
  disabled: !confirmation
178
161
  }, t("continue label")))));
179
162
  };
180
- var Code = ({ value }) => {
163
+ var Code = ({ code }) => {
164
+ const words = code.split(" ");
181
165
  return /* @__PURE__ */ import_react7.default.createElement("div", {
182
166
  className: "relative p-2 border border-separator rounded group"
183
167
  }, /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.Clipboard.IconButton, {
184
- value,
168
+ value: code,
185
169
  classNames: "absolute top-2 right-2 invisible group-hover:visible"
186
- }), /* @__PURE__ */ import_react7.default.createElement("code", {
187
- className: "whitespace-pre-wrap"
188
- }, value));
170
+ }), /* @__PURE__ */ import_react7.default.createElement("div", {
171
+ className: "grid grid-cols-4"
172
+ }, words.map((word, i) => /* @__PURE__ */ import_react7.default.createElement("div", {
173
+ key: i,
174
+ className: "flex items-center p-2 gap-2 items-center"
175
+ }, /* @__PURE__ */ import_react7.default.createElement("div", {
176
+ className: "w-4 text-xs text-center text-subdued"
177
+ }, i + 1), /* @__PURE__ */ import_react7.default.createElement("div", {
178
+ className: "text-sm"
179
+ }, word)))));
189
180
  };
190
181
  var translations_default = [
191
182
  {
192
183
  "en-US": {
193
- [import_chunk_XYLDQWFV.CLIENT_PLUGIN]: {
184
+ [import_chunk_RUA5KXVW.CLIENT_PLUGIN]: {
194
185
  "open shell label": "Open HALO",
195
- "recovery code dialog title": "Recovery Code",
186
+ "recovery code dialog title": "Account Recovery",
196
187
  "recovery code dialog description": "This is your identity recovery code, store it in a safe place. You can use it to recover your identity if you ever lose access to your devices.",
197
- "recovery code dialog warning": "Please note: This code will not be displayed again and cannot be replaced. It is your private key for recovering DXOS data. Anyone with this key will also be able to gain access to your account.",
198
- "recovery code confirmation label": "Confirm the code has been saved",
188
+ "recovery code dialog warning 1": "NOTE: This code will not be displayed again.",
189
+ "recovery code dialog warning 2": "It is your private key for recovering DXOS data. Anyone with this key will be able to gain access to your account.",
190
+ "recovery code confirmation label": "Please confirm you have saved the code.",
199
191
  "continue label": "Continue"
200
192
  }
201
193
  }
202
194
  }
203
195
  ];
204
196
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-client/src/ClientPlugin.tsx";
205
- var parseClientPlugin = (plugin) => (plugin?.provides).client instanceof import_react_client.Client ? plugin : void 0;
206
197
  var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitationParam = "deviceInvitationCode", onClientInitialized, onReady, onReset, ...options }) => {
207
198
  (0, import_react2.registerSignalsRuntime)();
208
199
  let client;
@@ -213,7 +204,7 @@ var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitation
213
204
  return baseUrl.toString();
214
205
  };
215
206
  return {
216
- meta: import_chunk_XYLDQWFV.meta_default,
207
+ meta: import_chunk_RUA5KXVW.meta_default,
217
208
  initialize: async () => {
218
209
  const config = new import_config.Config(await (0, import_config.Storage)(), (0, import_config.Envs)(), (0, import_config.Local)(), (0, import_config.Defaults)());
219
210
  client = new import_react_client.Client({
@@ -240,7 +231,7 @@ var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitation
240
231
  }, children)
241
232
  };
242
233
  },
243
- ready: async (plugins) => {
234
+ ready: async ({ plugins }) => {
244
235
  if (error) {
245
236
  throw error;
246
237
  }
@@ -252,47 +243,48 @@ var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitation
252
243
  provides: {
253
244
  translations: translations_default,
254
245
  surface: {
255
- component: ({ data, role, ...rest }) => {
256
- switch (role) {
257
- case "dialog":
258
- if (data.component === "dxos.org/plugin/client/IdentityDialog") {
259
- return /* @__PURE__ */ import_react.default.createElement(IdentityDialog, {
260
- ...data.subject,
261
- createInvitationUrl: createDeviceInvitationUrl
262
- });
263
- } else if (data.component === "dxos.org/plugin/client/JoinDialog") {
264
- return /* @__PURE__ */ import_react.default.createElement(JoinDialog, data.subject);
265
- } else if (data.component === "dxos.org/plugin/client/RecoveryCodeDialog") {
266
- return /* @__PURE__ */ import_react.default.createElement(RecoveryCodeDialog, data.subject);
267
- }
268
- break;
269
- }
270
- return null;
271
- }
246
+ definitions: () => [
247
+ (0, import_app_framework.createSurface)({
248
+ id: IDENTITY_DIALOG,
249
+ role: "dialog",
250
+ filter: (data) => data.component === IDENTITY_DIALOG,
251
+ component: ({ data }) => /* @__PURE__ */ import_react.default.createElement(IdentityDialog, {
252
+ ...data.subject,
253
+ createInvitationUrl: createDeviceInvitationUrl
254
+ })
255
+ }),
256
+ (0, import_app_framework.createSurface)({
257
+ id: JOIN_DIALOG,
258
+ role: "dialog",
259
+ filter: (data) => data.component === JOIN_DIALOG,
260
+ component: ({ data }) => /* @__PURE__ */ import_react.default.createElement(JoinDialog, data.subject)
261
+ }),
262
+ (0, import_app_framework.createSurface)({
263
+ id: RECOVER_CODE_DIALOG,
264
+ role: "dialog",
265
+ filter: (data) => data.component === RECOVER_CODE_DIALOG,
266
+ component: ({ data }) => /* @__PURE__ */ import_react.default.createElement(RecoveryCodeDialog, data.subject)
267
+ })
268
+ ]
272
269
  },
273
270
  graph: {
274
271
  builder: (plugins) => {
275
- const intentPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin);
276
- const id = `${import_chunk_XYLDQWFV.CLIENT_PLUGIN}/open-shell`;
272
+ const dispatch = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin)?.provides.intent.dispatchPromise;
273
+ const id = `${import_chunk_RUA5KXVW.CLIENT_PLUGIN}/open-shell`;
277
274
  return (0, import_plugin_graph.createExtension)({
278
- id: import_chunk_XYLDQWFV.CLIENT_PLUGIN,
275
+ id: import_chunk_RUA5KXVW.CLIENT_PLUGIN,
279
276
  filter: (node) => node.id === "root",
280
277
  actions: () => [
281
278
  {
282
279
  id,
283
280
  data: async () => {
284
- await intentPlugin?.provides.intent.dispatch([
285
- {
286
- plugin: import_chunk_XYLDQWFV.CLIENT_PLUGIN,
287
- action: import_chunk_XYLDQWFV.ClientAction.SHARE_IDENTITY
288
- }
289
- ]);
281
+ await dispatch?.((0, import_app_framework.createIntent)(import_chunk_NFO3ADQC.ClientAction.ShareIdentity));
290
282
  },
291
283
  properties: {
292
284
  label: [
293
285
  "open shell label",
294
286
  {
295
- ns: import_chunk_XYLDQWFV.CLIENT_PLUGIN
287
+ ns: import_chunk_RUA5KXVW.CLIENT_PLUGIN
296
288
  }
297
289
  ],
298
290
  icon: "ph--address-book--regular",
@@ -310,149 +302,108 @@ var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitation
310
302
  }
311
303
  },
312
304
  intent: {
313
- resolver: async (intent) => {
314
- switch (intent.action) {
315
- case import_chunk_XYLDQWFV.ClientAction.CREATE_IDENTITY: {
316
- const data = await client.halo.createIdentity();
317
- return {
318
- data,
319
- intents: [
320
- [
321
- {
322
- action: import_chunk_XYLDQWFV.OBSERVABILITY_ACTION,
323
- data: {
324
- name: "identity.create"
325
- }
326
- }
327
- ]
328
- ]
329
- };
330
- }
331
- case import_chunk_XYLDQWFV.ClientAction.JOIN_IDENTITY: {
332
- return {
333
- data: true,
334
- intents: [
335
- [
336
- {
337
- action: import_app_framework.LayoutAction.SET_LAYOUT,
338
- data: {
339
- element: "dialog",
340
- component: "dxos.org/plugin/client/JoinDialog",
341
- dialogBlockAlign: "start",
342
- subject: {
343
- initialInvitationCode: intent.data?.invitationCode,
344
- initialDisposition: "accept-halo-invitation"
345
- }
346
- }
347
- }
348
- ]
349
- ]
350
- };
351
- }
352
- case import_chunk_XYLDQWFV.ClientAction.SHARE_IDENTITY: {
353
- return {
354
- data: true,
355
- intents: [
356
- [
357
- {
358
- action: import_app_framework.LayoutAction.SET_LAYOUT,
359
- data: {
360
- element: "dialog",
361
- component: "dxos.org/plugin/client/IdentityDialog",
362
- dialogBlockAlign: "start"
363
- }
364
- }
365
- ],
366
- [
367
- {
368
- action: import_chunk_XYLDQWFV.OBSERVABILITY_ACTION,
369
- data: {
370
- name: "identity.share"
371
- }
372
- }
373
- ]
374
- ]
375
- };
376
- }
377
- case import_chunk_XYLDQWFV.ClientAction.RECOVER_IDENTITY: {
378
- return {
379
- data: true,
380
- intents: [
381
- [
382
- {
383
- action: import_app_framework.LayoutAction.SET_LAYOUT,
384
- data: {
385
- element: "dialog",
386
- component: "dxos.org/plugin/client/JoinDialog",
387
- dialogBlockAlign: "start",
388
- subject: {
389
- initialDisposition: "recover-identity"
390
- }
391
- }
392
- }
393
- ]
394
- ]
395
- };
396
- }
397
- case import_chunk_XYLDQWFV.ClientAction.RESET_STORAGE: {
398
- await onReset?.({
399
- target: intent.data?.target
400
- });
401
- return {
402
- data: true
403
- };
404
- }
405
- case import_chunk_XYLDQWFV.ClientAction.CREATE_AGENT: {
406
- (0, import_invariant.invariant)(client.services.services.EdgeAgentService, "Missing EdgeAgentService", {
407
- F: __dxlog_file,
408
- L: 283,
409
- S: void 0,
410
- A: [
411
- "client.services.services.EdgeAgentService",
412
- "'Missing EdgeAgentService'"
413
- ]
414
- });
415
- await client.services.services.EdgeAgentService.createAgent(null, {
416
- timeout: 1e4
417
- });
418
- return {
419
- data: true
420
- };
421
- }
422
- case import_chunk_XYLDQWFV.ClientAction.CREATE_RECOVERY_CODE: {
423
- (0, import_invariant.invariant)(client.services.services.IdentityService, "IdentityService not available", {
424
- F: __dxlog_file,
425
- L: 289,
426
- S: void 0,
427
- A: [
428
- "client.services.services.IdentityService",
429
- "'IdentityService not available'"
430
- ]
431
- });
432
- const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();
433
- return {
434
- data: true,
435
- intents: [
436
- [
437
- {
438
- action: import_app_framework.LayoutAction.SET_LAYOUT,
439
- data: {
440
- element: "dialog",
441
- dialogBlockAlign: "start",
442
- dialogType: "alert",
443
- state: true,
444
- component: "dxos.org/plugin/client/RecoveryCodeDialog",
445
- subject: {
446
- code: seedphrase
447
- }
448
- }
449
- }
450
- ]
451
- ]
452
- };
453
- }
454
- }
455
- }
305
+ resolvers: () => [
306
+ (0, import_app_framework.createResolver)(import_chunk_NFO3ADQC.ClientAction.CreateIdentity, async () => {
307
+ const data = await client.halo.createIdentity();
308
+ return {
309
+ data,
310
+ intents: [
311
+ (0, import_app_framework.createIntent)(import_types.ObservabilityAction.SendEvent, {
312
+ name: "identity.create"
313
+ })
314
+ ]
315
+ };
316
+ }),
317
+ (0, import_app_framework.createResolver)(import_chunk_NFO3ADQC.ClientAction.JoinIdentity, async (data) => {
318
+ return {
319
+ intents: [
320
+ (0, import_app_framework.createIntent)(import_app_framework.LayoutAction.SetLayout, {
321
+ element: "dialog",
322
+ component: JOIN_DIALOG,
323
+ dialogBlockAlign: "start",
324
+ subject: {
325
+ initialInvitationCode: data.invitationCode,
326
+ initialDisposition: "accept-halo-invitation"
327
+ }
328
+ })
329
+ ]
330
+ };
331
+ }),
332
+ (0, import_app_framework.createResolver)(import_chunk_NFO3ADQC.ClientAction.ShareIdentity, async () => {
333
+ return {
334
+ intents: [
335
+ (0, import_app_framework.createIntent)(import_app_framework.LayoutAction.SetLayout, {
336
+ element: "dialog",
337
+ component: IDENTITY_DIALOG,
338
+ dialogBlockAlign: "start"
339
+ }),
340
+ (0, import_app_framework.createIntent)(import_types.ObservabilityAction.SendEvent, {
341
+ name: "identity.share"
342
+ })
343
+ ]
344
+ };
345
+ }),
346
+ (0, import_app_framework.createResolver)(import_chunk_NFO3ADQC.ClientAction.RecoverIdentity, async () => {
347
+ return {
348
+ intents: [
349
+ (0, import_app_framework.createIntent)(import_app_framework.LayoutAction.SetLayout, {
350
+ element: "dialog",
351
+ component: JOIN_DIALOG,
352
+ dialogBlockAlign: "start",
353
+ subject: {
354
+ initialDisposition: "recover-identity"
355
+ }
356
+ })
357
+ ]
358
+ };
359
+ }),
360
+ (0, import_app_framework.createResolver)(import_chunk_NFO3ADQC.ClientAction.ResetStorage, async (data) => {
361
+ await onReset?.({
362
+ target: data.target
363
+ });
364
+ return {};
365
+ }),
366
+ (0, import_app_framework.createResolver)(import_chunk_NFO3ADQC.ClientAction.CreateAgent, async () => {
367
+ (0, import_invariant.invariant)(client.services.services.EdgeAgentService, "Missing EdgeAgentService", {
368
+ F: __dxlog_file,
369
+ L: 203,
370
+ S: void 0,
371
+ A: [
372
+ "client.services.services.EdgeAgentService",
373
+ "'Missing EdgeAgentService'"
374
+ ]
375
+ });
376
+ await client.services.services.EdgeAgentService.createAgent(null, {
377
+ timeout: 1e4
378
+ });
379
+ }),
380
+ (0, import_app_framework.createResolver)(import_chunk_NFO3ADQC.ClientAction.CreateRecoveryCode, async () => {
381
+ (0, import_invariant.invariant)(client.services.services.IdentityService, "IdentityService not available", {
382
+ F: __dxlog_file,
383
+ L: 207,
384
+ S: void 0,
385
+ A: [
386
+ "client.services.services.IdentityService",
387
+ "'IdentityService not available'"
388
+ ]
389
+ });
390
+ const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();
391
+ return {
392
+ intents: [
393
+ (0, import_app_framework.createIntent)(import_app_framework.LayoutAction.SetLayout, {
394
+ element: "dialog",
395
+ dialogBlockAlign: "start",
396
+ dialogType: "alert",
397
+ state: true,
398
+ component: RECOVER_CODE_DIALOG,
399
+ subject: {
400
+ code: seedphrase
401
+ }
402
+ })
403
+ ]
404
+ };
405
+ })
406
+ ]
456
407
  }
457
408
  }
458
409
  };
@@ -460,7 +411,6 @@ var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitation
460
411
  var src_default = ClientPlugin;
461
412
  // Annotate the CommonJS export names for ESM import in node:
462
413
  0 && (module.exports = {
463
- ClientPlugin,
464
- parseClientPlugin
414
+ ClientPlugin
465
415
  });
466
416
  //# sourceMappingURL=index.cjs.map