@dxos/plugin-client 0.7.5-labs.e27f9b9 → 0.7.5-labs.f400bbc

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 (137) hide show
  1. package/dist/lib/browser/{app-graph-builder-6LOTDB4T.mjs → app-graph-builder-ON64R7SO.mjs} +2 -2
  2. package/dist/lib/browser/{chunk-E3OUNOEL.mjs → chunk-7DPLXOMO.mjs} +14 -2
  3. package/dist/lib/browser/chunk-7DPLXOMO.mjs.map +7 -0
  4. package/dist/lib/browser/chunk-EYBZZHSM.mjs +271 -0
  5. package/dist/lib/browser/chunk-EYBZZHSM.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-MSK3TLIH.mjs → chunk-GHEQL2E6.mjs} +1 -2
  7. package/dist/lib/browser/{chunk-MSK3TLIH.mjs.map → chunk-GHEQL2E6.mjs.map} +3 -3
  8. package/dist/lib/browser/{client-BEJK55IM.mjs → client-A7YSVURS.mjs} +3 -8
  9. package/dist/lib/browser/client-A7YSVURS.mjs.map +7 -0
  10. package/dist/lib/browser/index.mjs +17 -10
  11. package/dist/lib/browser/index.mjs.map +3 -3
  12. package/dist/lib/browser/{intent-resolver-E6TL7E24.mjs → intent-resolver-XZ2FBRQN.mjs} +113 -7
  13. package/dist/lib/browser/intent-resolver-XZ2FBRQN.mjs.map +7 -0
  14. package/dist/lib/browser/meta.json +1 -1
  15. package/dist/lib/browser/{react-context-PHX2CVI7.mjs → react-context-R3SG55F5.mjs} +2 -2
  16. package/dist/lib/browser/{react-surface-K5NKVCIB.mjs → react-surface-XGOUHVIH.mjs} +20 -4
  17. package/dist/lib/browser/react-surface-XGOUHVIH.mjs.map +7 -0
  18. package/dist/lib/browser/{schema-AL34NY2M.mjs → schema-J4MJIXRP.mjs} +3 -13
  19. package/dist/lib/browser/schema-J4MJIXRP.mjs.map +7 -0
  20. package/dist/lib/browser/types.mjs +1 -1
  21. package/dist/lib/node/{app-graph-builder-JCND3P6G.cjs → app-graph-builder-RW7ESEX3.cjs} +6 -6
  22. package/dist/lib/node/chunk-7LVBFGKQ.cjs +299 -0
  23. package/dist/lib/node/chunk-7LVBFGKQ.cjs.map +7 -0
  24. package/dist/lib/node/{chunk-NVYWMDF3.cjs → chunk-TREVKZCJ.cjs} +17 -5
  25. package/dist/lib/node/chunk-TREVKZCJ.cjs.map +7 -0
  26. package/dist/lib/node/{chunk-ZI7AV5RP.cjs → chunk-UHIGZJQL.cjs} +4 -5
  27. package/dist/lib/node/{chunk-ZI7AV5RP.cjs.map → chunk-UHIGZJQL.cjs.map} +3 -3
  28. package/dist/lib/node/{client-AHIW24VM.cjs → client-2RQATBB6.cjs} +7 -12
  29. package/dist/lib/node/client-2RQATBB6.cjs.map +7 -0
  30. package/dist/lib/node/index.cjs +18 -11
  31. package/dist/lib/node/index.cjs.map +3 -3
  32. package/dist/lib/node/intent-resolver-MKNGTBJU.cjs +273 -0
  33. package/dist/lib/node/intent-resolver-MKNGTBJU.cjs.map +7 -0
  34. package/dist/lib/node/meta.json +1 -1
  35. package/dist/lib/node/{react-context-WMOFXPT4.cjs → react-context-TD6VGBVA.cjs} +6 -6
  36. package/dist/lib/node/{react-surface-YQ2PKXNV.cjs → react-surface-IY7GXEGU.cjs} +27 -15
  37. package/dist/lib/node/react-surface-IY7GXEGU.cjs.map +7 -0
  38. package/dist/lib/node/{schema-HW4W3QYU.cjs → schema-JXJS75HQ.cjs} +8 -18
  39. package/dist/lib/node/schema-JXJS75HQ.cjs.map +7 -0
  40. package/dist/lib/node/types.cjs +2 -2
  41. package/dist/lib/node/types.cjs.map +1 -1
  42. package/dist/lib/node-esm/{app-graph-builder-ZLGKFBLY.mjs → app-graph-builder-TDYRWNI7.mjs} +2 -2
  43. package/dist/lib/node-esm/chunk-CRF22MJJ.mjs +272 -0
  44. package/dist/lib/node-esm/chunk-CRF22MJJ.mjs.map +7 -0
  45. package/dist/lib/node-esm/{chunk-74T33KTB.mjs → chunk-QJMF2MWP.mjs} +14 -2
  46. package/dist/lib/node-esm/chunk-QJMF2MWP.mjs.map +7 -0
  47. package/dist/lib/node-esm/{chunk-B73LKPGU.mjs → chunk-T35SFKK3.mjs} +1 -2
  48. package/dist/lib/node-esm/{chunk-B73LKPGU.mjs.map → chunk-T35SFKK3.mjs.map} +3 -3
  49. package/dist/lib/node-esm/{client-FY7IDNRL.mjs → client-36DKBSB7.mjs} +3 -8
  50. package/dist/lib/node-esm/client-36DKBSB7.mjs.map +7 -0
  51. package/dist/lib/node-esm/index.mjs +17 -10
  52. package/dist/lib/node-esm/index.mjs.map +3 -3
  53. package/dist/lib/node-esm/{intent-resolver-QUQH2LS2.mjs → intent-resolver-M72XLGTY.mjs} +113 -7
  54. package/dist/lib/node-esm/intent-resolver-M72XLGTY.mjs.map +7 -0
  55. package/dist/lib/node-esm/meta.json +1 -1
  56. package/dist/lib/node-esm/{react-context-EEGDXBWA.mjs → react-context-ZOGDOWJ2.mjs} +2 -2
  57. package/dist/lib/node-esm/{react-surface-H34XQPWC.mjs → react-surface-F3PDFJMV.mjs} +20 -4
  58. package/dist/lib/node-esm/react-surface-F3PDFJMV.mjs.map +7 -0
  59. package/dist/lib/node-esm/{schema-74LVJ3EU.mjs → schema-XM4HBLIX.mjs} +3 -13
  60. package/dist/lib/node-esm/schema-XM4HBLIX.mjs.map +7 -0
  61. package/dist/lib/node-esm/types.mjs +1 -1
  62. package/dist/types/src/capabilities/app-graph-builder.d.ts +110 -110
  63. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  64. package/dist/types/src/capabilities/capabilities.d.ts +0 -1
  65. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  66. package/dist/types/src/capabilities/client.d.ts.map +1 -1
  67. package/dist/types/src/capabilities/index.d.ts +112 -111
  68. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  69. package/dist/types/src/capabilities/intent-resolver.d.ts +2 -1
  70. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  71. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  72. package/dist/types/src/capabilities/schema.d.ts.map +1 -1
  73. package/dist/types/src/components/IdentityDialog.d.ts +1 -2
  74. package/dist/types/src/components/IdentityDialog.d.ts.map +1 -1
  75. package/dist/types/src/components/JoinDialog.d.ts +1 -2
  76. package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
  77. package/dist/types/src/components/ManageCredentialsDialog.d.ts +3 -0
  78. package/dist/types/src/components/ManageCredentialsDialog.d.ts.map +1 -0
  79. package/dist/types/src/components/ManageCredentialsDialog.stories.d.ts +8 -0
  80. package/dist/types/src/components/ManageCredentialsDialog.stories.d.ts.map +1 -0
  81. package/dist/types/src/components/RecoveryCodeDialog.d.ts +1 -2
  82. package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +1 -1
  83. package/dist/types/src/components/RecoverySetupDialog.d.ts +3 -0
  84. package/dist/types/src/components/RecoverySetupDialog.d.ts.map +1 -0
  85. package/dist/types/src/components/RecoverySetupDialog.stories.d.ts +8 -0
  86. package/dist/types/src/components/RecoverySetupDialog.stories.d.ts.map +1 -0
  87. package/dist/types/src/components/index.d.ts +1 -0
  88. package/dist/types/src/components/index.d.ts.map +1 -1
  89. package/dist/types/src/translations.d.ts +7 -0
  90. package/dist/types/src/translations.d.ts.map +1 -1
  91. package/dist/types/src/types.d.ts +17 -1
  92. package/dist/types/src/types.d.ts.map +1 -1
  93. package/package.json +21 -16
  94. package/src/ClientPlugin.ts +2 -2
  95. package/src/capabilities/capabilities.ts +0 -2
  96. package/src/capabilities/client.ts +1 -3
  97. package/src/capabilities/intent-resolver.ts +74 -1
  98. package/src/capabilities/react-surface.tsx +15 -0
  99. package/src/capabilities/schema.ts +3 -13
  100. package/src/components/IdentityDialog.tsx +12 -0
  101. package/src/components/ManageCredentialsDialog.stories.tsx +57 -0
  102. package/src/components/ManageCredentialsDialog.tsx +64 -0
  103. package/src/components/RecoveryCodeDialog.stories.tsx +4 -4
  104. package/src/components/RecoveryCodeDialog.tsx +2 -1
  105. package/src/components/RecoverySetupDialog.stories.tsx +77 -0
  106. package/src/components/RecoverySetupDialog.tsx +52 -0
  107. package/src/components/index.ts +1 -0
  108. package/src/translations.ts +10 -1
  109. package/src/types.ts +11 -1
  110. package/dist/lib/browser/chunk-E3OUNOEL.mjs.map +0 -7
  111. package/dist/lib/browser/chunk-PDSHZE3P.mjs +0 -162
  112. package/dist/lib/browser/chunk-PDSHZE3P.mjs.map +0 -7
  113. package/dist/lib/browser/client-BEJK55IM.mjs.map +0 -7
  114. package/dist/lib/browser/intent-resolver-E6TL7E24.mjs.map +0 -7
  115. package/dist/lib/browser/react-surface-K5NKVCIB.mjs.map +0 -7
  116. package/dist/lib/browser/schema-AL34NY2M.mjs.map +0 -7
  117. package/dist/lib/node/chunk-NVYWMDF3.cjs.map +0 -7
  118. package/dist/lib/node/chunk-VUJ3ZPK3.cjs +0 -190
  119. package/dist/lib/node/chunk-VUJ3ZPK3.cjs.map +0 -7
  120. package/dist/lib/node/client-AHIW24VM.cjs.map +0 -7
  121. package/dist/lib/node/intent-resolver-DUPICQ3F.cjs +0 -167
  122. package/dist/lib/node/intent-resolver-DUPICQ3F.cjs.map +0 -7
  123. package/dist/lib/node/react-surface-YQ2PKXNV.cjs.map +0 -7
  124. package/dist/lib/node/schema-HW4W3QYU.cjs.map +0 -7
  125. package/dist/lib/node-esm/chunk-74T33KTB.mjs.map +0 -7
  126. package/dist/lib/node-esm/chunk-WS4CKCUR.mjs +0 -163
  127. package/dist/lib/node-esm/chunk-WS4CKCUR.mjs.map +0 -7
  128. package/dist/lib/node-esm/client-FY7IDNRL.mjs.map +0 -7
  129. package/dist/lib/node-esm/intent-resolver-QUQH2LS2.mjs.map +0 -7
  130. package/dist/lib/node-esm/react-surface-H34XQPWC.mjs.map +0 -7
  131. package/dist/lib/node-esm/schema-74LVJ3EU.mjs.map +0 -7
  132. /package/dist/lib/browser/{app-graph-builder-6LOTDB4T.mjs.map → app-graph-builder-ON64R7SO.mjs.map} +0 -0
  133. /package/dist/lib/browser/{react-context-PHX2CVI7.mjs.map → react-context-R3SG55F5.mjs.map} +0 -0
  134. /package/dist/lib/node/{app-graph-builder-JCND3P6G.cjs.map → app-graph-builder-RW7ESEX3.cjs.map} +0 -0
  135. /package/dist/lib/node/{react-context-WMOFXPT4.cjs.map → react-context-TD6VGBVA.cjs.map} +0 -0
  136. /package/dist/lib/node-esm/{app-graph-builder-ZLGKFBLY.mjs.map → app-graph-builder-TDYRWNI7.mjs.map} +0 -0
  137. /package/dist/lib/node-esm/{react-context-EEGDXBWA.mjs.map → react-context-ZOGDOWJ2.mjs.map} +0 -0
@@ -1,162 +0,0 @@
1
- import {
2
- ClientAction
3
- } from "./chunk-E3OUNOEL.mjs";
4
- import {
5
- CLIENT_PLUGIN
6
- } from "./chunk-NHIL4T3L.mjs";
7
-
8
- // packages/plugins/plugin-client/src/components/IdentityDialog.tsx
9
- import React, { useCallback } from "react";
10
- import { createIntent, LayoutAction, useIntentDispatcher } from "@dxos/app-framework";
11
- import { useClient } from "@dxos/react-client";
12
- import { Clipboard, Dialog } from "@dxos/react-ui";
13
- import { IdentityPanel } from "@dxos/shell/react";
14
- var IDENTITY_DIALOG = `${CLIENT_PLUGIN}/IdentityDialog`;
15
- var IdentityDialog = (props) => {
16
- const { dispatchPromise: dispatch } = useIntentDispatcher();
17
- const client = useClient();
18
- const handleDone = useCallback(() => dispatch(createIntent(LayoutAction.UpdateDialog, {
19
- part: "dialog",
20
- options: {
21
- state: false
22
- }
23
- })), [
24
- dispatch
25
- ]);
26
- const handleResetStorage = useCallback(async () => {
27
- await client.reset();
28
- await dispatch(createIntent(ClientAction.ResetStorage));
29
- }, [
30
- dispatch
31
- ]);
32
- const handleRecover = useCallback(async () => {
33
- await client.reset();
34
- await dispatch(createIntent(ClientAction.ResetStorage, {
35
- target: "recoverIdentity"
36
- }));
37
- }, [
38
- dispatch
39
- ]);
40
- const handleJoinNewIdentity = useCallback(async () => {
41
- await client.reset();
42
- await dispatch(createIntent(ClientAction.ResetStorage, {
43
- target: "deviceInvitation"
44
- }));
45
- }, [
46
- dispatch
47
- ]);
48
- return /* @__PURE__ */ React.createElement(Dialog.Content, null, /* @__PURE__ */ React.createElement(Clipboard.Provider, null, /* @__PURE__ */ React.createElement(IdentityPanel, {
49
- ...props,
50
- doneActionParent: /* @__PURE__ */ React.createElement(Dialog.Close, {
51
- asChild: true
52
- }),
53
- onDone: handleDone,
54
- onResetStorage: handleResetStorage,
55
- onRecover: handleRecover,
56
- onJoinNewIdentity: handleJoinNewIdentity
57
- })));
58
- };
59
-
60
- // packages/plugins/plugin-client/src/components/JoinDialog.tsx
61
- import React2, { useCallback as useCallback2 } from "react";
62
- import { createIntent as createIntent2, LayoutAction as LayoutAction2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
63
- import { ObservabilityAction } from "@dxos/plugin-observability/types";
64
- import { Dialog as Dialog2 } from "@dxos/react-ui";
65
- import { JoinPanel } from "@dxos/shell/react";
66
- var JOIN_DIALOG = `${CLIENT_PLUGIN}/JoinDialog`;
67
- var JoinDialog = (props) => {
68
- const { dispatchPromise: dispatch } = useIntentDispatcher2();
69
- const handleCancelResetStorage = useCallback2(() => dispatch(createIntent2(ClientAction.ShareIdentity)), [
70
- dispatch
71
- ]);
72
- const handleDone = useCallback2(async (result) => {
73
- if (result?.identityKey) {
74
- await Promise.all([
75
- dispatch(createIntent2(LayoutAction2.UpdateDialog, {
76
- part: "dialog",
77
- options: {
78
- state: false
79
- }
80
- })),
81
- dispatch(createIntent2(ObservabilityAction.SendEvent, {
82
- name: props.initialDisposition === "recover-identity" ? "identity.recover" : "identity.join"
83
- }))
84
- ]);
85
- }
86
- }, [
87
- dispatch
88
- ]);
89
- return /* @__PURE__ */ React2.createElement(Dialog2.Content, null, /* @__PURE__ */ React2.createElement(JoinPanel, {
90
- mode: "halo-only",
91
- ...props,
92
- exitActionParent: /* @__PURE__ */ React2.createElement(Dialog2.Close, {
93
- asChild: true
94
- }),
95
- doneActionParent: /* @__PURE__ */ React2.createElement(Dialog2.Close, {
96
- asChild: true
97
- }),
98
- onCancelResetStorage: handleCancelResetStorage,
99
- onDone: handleDone
100
- }));
101
- };
102
-
103
- // packages/plugins/plugin-client/src/components/RecoveryCodeDialog.tsx
104
- import React3, { useCallback as useCallback3, useState } from "react";
105
- import { AlertDialog, Button, Clipboard as Clipboard2, Input, useTranslation } from "@dxos/react-ui";
106
- var RECOVER_CODE_DIALOG = `${CLIENT_PLUGIN}/RecoveryCodeDialog`;
107
- var RecoveryCodeDialog = ({ code }) => {
108
- const { t } = useTranslation(CLIENT_PLUGIN);
109
- const [confirmation, setConfirmation] = useState(false);
110
- const handleConfirmation = useCallback3((checked) => setConfirmation(checked), []);
111
- return /* @__PURE__ */ React3.createElement(AlertDialog.Content, {
112
- classNames: "bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
113
- }, /* @__PURE__ */ React3.createElement(AlertDialog.Title, null, t("recovery code dialog title")), /* @__PURE__ */ React3.createElement("p", {
114
- className: "py-4"
115
- }, t("recovery code dialog description")), /* @__PURE__ */ React3.createElement(Clipboard2.Provider, null, /* @__PURE__ */ React3.createElement(Code, {
116
- code
117
- })), /* @__PURE__ */ React3.createElement("div", {
118
- className: "flex flex-col py-4 gap-2"
119
- }, /* @__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", {
120
- className: "flex items-center gap-2 pbe-4"
121
- }, /* @__PURE__ */ React3.createElement(Input.Root, null, /* @__PURE__ */ React3.createElement(Input.Checkbox, {
122
- "data-testid": "recoveryCode.confirm",
123
- checked: confirmation,
124
- onCheckedChange: handleConfirmation
125
- }), /* @__PURE__ */ React3.createElement(Input.Label, null, t("recovery code confirmation label")))), /* @__PURE__ */ React3.createElement("div", {
126
- className: "flex justify-end"
127
- }, /* @__PURE__ */ React3.createElement(AlertDialog.Action, {
128
- asChild: true
129
- }, /* @__PURE__ */ React3.createElement(Button, {
130
- "data-testid": "recoveryCode.continue",
131
- variant: "primary",
132
- disabled: !confirmation
133
- }, t("continue label")))));
134
- };
135
- var Code = ({ code }) => {
136
- const words = code.split(" ");
137
- return /* @__PURE__ */ React3.createElement("div", {
138
- className: "relative p-2 border border-separator rounded group"
139
- }, /* @__PURE__ */ React3.createElement(Clipboard2.IconButton, {
140
- value: code,
141
- classNames: "absolute top-2 right-2 invisible group-hover:visible"
142
- }), /* @__PURE__ */ React3.createElement("div", {
143
- className: "grid grid-cols-4"
144
- }, words.map((word, i) => /* @__PURE__ */ React3.createElement("div", {
145
- key: i,
146
- className: "flex items-center p-2 gap-2 items-center"
147
- }, /* @__PURE__ */ React3.createElement("div", {
148
- className: "w-4 text-xs text-center text-subdued"
149
- }, i + 1), /* @__PURE__ */ React3.createElement("div", {
150
- className: "text-sm"
151
- }, word)))));
152
- };
153
-
154
- export {
155
- IDENTITY_DIALOG,
156
- IdentityDialog,
157
- JOIN_DIALOG,
158
- JoinDialog,
159
- RECOVER_CODE_DIALOG,
160
- RecoveryCodeDialog
161
- };
162
- //# sourceMappingURL=chunk-PDSHZE3P.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/IdentityDialog.tsx", "../../../src/components/JoinDialog.tsx", "../../../src/components/RecoveryCodeDialog.tsx"],
4
- "sourcesContent": ["//\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.UpdateDialog, {\n part: 'dialog',\n options: { 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.UpdateDialog, { part: 'dialog', options: { 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"],
5
- "mappings": ";;;;;;;;AAIA,OAAOA,SAASC,mBAAmB;AAEnC,SAASC,cAAcC,cAAcC,2BAA2B;AAChE,SAASC,iBAAiB;AAC1B,SAASC,WAAWC,cAAc;AAClC,SAASC,qBAA8C;AAKhD,IAAMC,kBAAkB,GAAGC,aAAAA;AAE3B,IAAMC,iBAAiB,CAACC,UAAAA;AAC7B,QAAM,EAAEC,iBAAiBC,SAAQ,IAAKC,oBAAAA;AACtC,QAAMC,SAASC,UAAAA;AAEf,QAAMC,aAAaC,YACjB,MACEL,SACEM,aAAaC,aAAaC,cAAc;IACtCC,MAAM;IACNC,SAAS;MAAEC,OAAO;IAAM;EAC1B,CAAA,CAAA,GAEJ;IAACX;GAAS;AAGZ,QAAMY,qBAAqBP,YAAY,YAAA;AACrC,UAAMH,OAAOW,MAAK;AAClB,UAAMb,SAASM,aAAaQ,aAAaC,YAAY,CAAA;EACvD,GAAG;IAACf;GAAS;AAEb,QAAMgB,gBAAgBX,YAAY,YAAA;AAChC,UAAMH,OAAOW,MAAK;AAClB,UAAMb,SAASM,aAAaQ,aAAaC,cAAc;MAAEE,QAAQ;IAAkB,CAAA,CAAA;EACrF,GAAG;IAACjB;GAAS;AAEb,QAAMkB,wBAAwBb,YAAY,YAAA;AACxC,UAAMH,OAAOW,MAAK;AAClB,UAAMb,SAASM,aAAaQ,aAAaC,cAAc;MAAEE,QAAQ;IAAmB,CAAA,CAAA;EACtF,GAAG;IAACjB;GAAS;AAEb,SACE,sBA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;IAAUC,UAAU,CAAC3B;KACtEF,EAAE,gBAAA,CAAA,CAAA,CAAA,CAAA;AAMf;AAEA,IAAMiB,OAAO,CAAC,EAAElB,KAAI,MAAoB;AACtC,QAAM+B,QAAQ/B,KAAKgC,MAAM,GAAA;AACzB,SACE,gBAAAvB,OAAA,cAACU,OAAAA;IAAIJ,WAAU;KACb,gBAAAN,OAAA,cAACO,WAAUiB,YAAU;IAACC,OAAOlC;IAAMY,YAAW;MAC9C,gBAAAH,OAAA,cAACU,OAAAA;IAAIJ,WAAU;KACZgB,MAAMI,IAAI,CAACC,MAAMC,MAChB,gBAAA5B,OAAA,cAACU,OAAAA;IAAImB,KAAKD;IAAGtB,WAAU;KACrB,gBAAAN,OAAA,cAACU,OAAAA;IAAIJ,WAAU;KAAwCsB,IAAI,CAAA,GAC3D,gBAAA5B,OAAA,cAACU,OAAAA;IAAIJ,WAAU;KAAWqB,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAMtC;",
6
- "names": ["React", "useCallback", "createIntent", "LayoutAction", "useIntentDispatcher", "useClient", "Clipboard", "Dialog", "IdentityPanel", "IDENTITY_DIALOG", "CLIENT_PLUGIN", "IdentityDialog", "props", "dispatchPromise", "dispatch", "useIntentDispatcher", "client", "useClient", "handleDone", "useCallback", "createIntent", "LayoutAction", "UpdateDialog", "part", "options", "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", "UpdateDialog", "part", "options", "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"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/client.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, type PluginsContext } from '@dxos/app-framework';\nimport { Config, Defaults, Envs, Local, Storage } from '@dxos/config';\nimport { Client } from '@dxos/react-client';\n\nimport { ClientCapabilities } from './capabilities';\nimport { ClientEvents } from '../events';\nimport { type ClientPluginOptions } from '../types';\n\ntype ClientCapabilityOptions = Omit<ClientPluginOptions, 'appKey' | 'invitationUrl' | 'invitationParam' | 'onReset'> & {\n context: PluginsContext;\n};\n\nexport default async ({ context, onClientInitialized, ...options }: ClientCapabilityOptions) => {\n const config = new Config(await Storage(), Envs(), Local(), Defaults());\n const client = new Client({ config, ...options });\n await client.initialize();\n await onClientInitialized?.(context, 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\n const subscription = client.spaces.isReady.subscribe(async (ready) => {\n if (ready) {\n await context.activate(ClientEvents.SpacesReady);\n }\n });\n\n return contributes(ClientCapabilities.Client, client, async () => {\n subscription.unsubscribe();\n await client.destroy();\n });\n};\n"],
5
- "mappings": ";;;;;;;;;AAIA,SAASA,mBAAwC;AACjD,SAASC,QAAQC,UAAUC,MAAMC,OAAOC,eAAe;AACvD,SAASC,cAAc;AAUvB,IAAA,iBAAe,OAAO,EAAEC,SAASC,qBAAqB,GAAGC,QAAAA,MAAkC;AACzF,QAAMC,SAAS,IAAIC,OAAO,MAAMC,QAAAA,GAAWC,KAAAA,GAAQC,MAAAA,GAASC,SAAAA,CAAAA;AAC5D,QAAMC,SAAS,IAAIC,OAAO;IAAEP;IAAQ,GAAGD;EAAQ,CAAA;AAC/C,QAAMO,OAAOE,WAAU;AACvB,QAAMV,sBAAsBD,SAASS,MAAAA;AAGrCA,SAAOG,SAASC,GAAG,MAAA;AACjBJ,WAAOK,KAAKC,SAASC,UAAU,OAAOD,aAAAA;AACpC,UAAIA,UAAU;AACZE,eAAOC,SAASC,OAAOF,OAAOC,SAASE;MACzC;IACF,CAAA;EACF,CAAA;AAEA,QAAMC,eAAeZ,OAAOa,OAAOC,QAAQP,UAAU,OAAOQ,UAAAA;AAC1D,QAAIA,OAAO;AACT,YAAMxB,QAAQyB,SAASC,aAAaC,WAAW;IACjD;EACF,CAAA;AAEA,SAAOC,YAAYC,mBAAmBnB,QAAQD,QAAQ,YAAA;AACpDY,iBAAaS,YAAW;AACxB,UAAMrB,OAAOsB,QAAO;EACtB,CAAA;AACF;",
6
- "names": ["contributes", "Config", "Defaults", "Envs", "Local", "Storage", "Client", "context", "onClientInitialized", "options", "config", "Config", "Storage", "Envs", "Local", "Defaults", "client", "Client", "initialize", "reloaded", "on", "halo", "identity", "subscribe", "window", "location", "href", "origin", "subscription", "spaces", "isReady", "ready", "activate", "ClientEvents", "SpacesReady", "contributes", "ClientCapabilities", "unsubscribe", "destroy"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/intent-resolver.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n Capabilities,\n contributes,\n createIntent,\n createResolver,\n LayoutAction,\n type PluginsContext,\n} from '@dxos/app-framework';\nimport { invariant } from '@dxos/invariant';\nimport { ObservabilityAction } from '@dxos/plugin-observability/types';\nimport { type JoinPanelProps } from '@dxos/shell/react';\n\nimport { ClientCapabilities } from './capabilities';\nimport { IDENTITY_DIALOG, JOIN_DIALOG, RECOVER_CODE_DIALOG } from '../components';\nimport { ClientEvents } from '../events';\nimport { ClientAction, type ClientPluginOptions } from '../types';\n\ntype IntentResolverOptions = Pick<ClientPluginOptions, 'onReset'> & {\n context: PluginsContext;\n};\n\nexport default ({ context, onReset }: IntentResolverOptions) =>\n contributes(Capabilities.IntentResolver, [\n createResolver({\n intent: ClientAction.CreateIdentity,\n resolve: async () => {\n const manager = context.requestCapability(Capabilities.PluginManager);\n const client = context.requestCapability(ClientCapabilities.Client);\n const data = await client.halo.createIdentity();\n await manager.activate(ClientEvents.IdentityCreated);\n return { data, intents: [createIntent(ObservabilityAction.SendEvent, { name: 'identity.create' })] };\n },\n }),\n createResolver({\n intent: ClientAction.JoinIdentity,\n resolve: async (data) => {\n return {\n intents: [\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: JOIN_DIALOG,\n options: {\n blockAlign: 'start',\n props: {\n initialInvitationCode: data.invitationCode,\n initialDisposition: 'accept-halo-invitation',\n },\n },\n }),\n ],\n };\n },\n }),\n createResolver({\n intent: ClientAction.ShareIdentity,\n resolve: async () => {\n return {\n intents: [\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: IDENTITY_DIALOG,\n options: {\n blockAlign: 'start',\n },\n }),\n createIntent(ObservabilityAction.SendEvent, { name: 'identity.share' }),\n ],\n };\n },\n }),\n createResolver({\n intent: ClientAction.RecoverIdentity,\n resolve: async () => {\n return {\n intents: [\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: JOIN_DIALOG,\n options: {\n blockAlign: 'start',\n props: {\n initialDisposition: 'recover-identity',\n } satisfies Partial<JoinPanelProps>,\n },\n }),\n ],\n };\n },\n }),\n createResolver({\n intent: ClientAction.ResetStorage,\n resolve: async (data) => {\n await onReset?.({ target: data.target });\n },\n }),\n createResolver({\n intent: ClientAction.CreateAgent,\n resolve: async () => {\n const client = context.requestCapability(ClientCapabilities.Client);\n invariant(client.services.services.EdgeAgentService, 'Missing EdgeAgentService');\n await client.services.services.EdgeAgentService.createAgent(null as any, { timeout: 10_000 });\n },\n }),\n createResolver({\n intent: ClientAction.CreateRecoveryCode,\n resolve: async () => {\n const client = context.requestCapability(ClientCapabilities.Client);\n invariant(client.services.services.IdentityService, 'IdentityService not available');\n // TODO(wittjosiah): This needs a proper api.\n const { recoveryCode } = await client.services.services.IdentityService.createRecoveryCredential({});\n return {\n intents: [\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: RECOVER_CODE_DIALOG,\n options: {\n blockAlign: 'start',\n type: 'alert',\n props: { code: recoveryCode },\n },\n }),\n ],\n };\n },\n }),\n ]);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAIA,SACEA,cACAC,aACAC,cACAC,gBACAC,oBAEK;AACP,SAASC,iBAAiB;AAC1B,SAASC,2BAA2B;;AAYpC,IAAA,0BAAe,CAAC,EAAEC,SAASC,QAAO,MAChCC,YAAYC,aAAaC,gBAAgB;EACvCC,eAAe;IACbC,QAAQC,aAAaC;IACrBC,SAAS,YAAA;AACP,YAAMC,UAAUV,QAAQW,kBAAkBR,aAAaS,aAAa;AACpE,YAAMC,SAASb,QAAQW,kBAAkBG,mBAAmBC,MAAM;AAClE,YAAMC,OAAO,MAAMH,OAAOI,KAAKC,eAAc;AAC7C,YAAMR,QAAQS,SAASC,aAAaC,eAAe;AACnD,aAAO;QAAEL;QAAMM,SAAS;UAACC,aAAaC,oBAAoBC,WAAW;YAAEC,MAAM;UAAkB,CAAA;;MAAI;IACrG;EACF,CAAA;EACArB,eAAe;IACbC,QAAQC,aAAaoB;IACrBlB,SAAS,OAAOO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iBAAiB,iCAAA;;;;;;;;;AAEpD,YAAM,EAAEC,aAAY,IAAK,MAAMvC,OAAOiC,SAASA,SAASK,gBAAgBE,yBAAyB,CAAC,CAAA;AAClG,aAAO;QACL/B,SAAS;UACPC,aAAaK,aAAaC,cAAc;YACtCC,MAAM;YACNC,SAASuB;YACTrB,SAAS;cACPC,YAAY;cACZqB,MAAM;cACNpB,OAAO;gBAAEqB,MAAMJ;cAAa;YAC9B;UACF,CAAA;;MAEJ;IACF;EACF,CAAA;CACD;",
6
- "names": ["Capabilities", "contributes", "createIntent", "createResolver", "LayoutAction", "invariant", "ObservabilityAction", "context", "onReset", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "ClientAction", "CreateIdentity", "resolve", "manager", "requestCapability", "PluginManager", "client", "ClientCapabilities", "Client", "data", "halo", "createIdentity", "activate", "ClientEvents", "IdentityCreated", "intents", "createIntent", "ObservabilityAction", "SendEvent", "name", "JoinIdentity", "LayoutAction", "UpdateDialog", "part", "subject", "JOIN_DIALOG", "options", "blockAlign", "props", "initialInvitationCode", "invitationCode", "initialDisposition", "ShareIdentity", "IDENTITY_DIALOG", "RecoverIdentity", "ResetStorage", "target", "CreateAgent", "invariant", "services", "EdgeAgentService", "createAgent", "timeout", "CreateRecoveryCode", "IdentityService", "recoveryCode", "createRecoveryCredential", "RECOVER_CODE_DIALOG", "type", "code"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/react-surface.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { createSurface, Capabilities, contributes } from '@dxos/app-framework';\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';\n\ntype ReactSurfaceOptions = {\n createInvitationUrl: (invitationCode: string) => string;\n};\n\nexport default ({ createInvitationUrl }: ReactSurfaceOptions) =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: IDENTITY_DIALOG,\n role: 'dialog',\n filter: (data): data is { props: IdentityPanelProps } => data.component === IDENTITY_DIALOG,\n component: ({ data }) => <IdentityDialog {...data.props} createInvitationUrl={createInvitationUrl} />,\n }),\n createSurface({\n id: JOIN_DIALOG,\n role: 'dialog',\n filter: (data): data is { props: JoinPanelProps } => data.component === JOIN_DIALOG,\n component: ({ data }) => <JoinDialog {...data.props} />,\n }),\n createSurface({\n id: RECOVER_CODE_DIALOG,\n role: 'dialog',\n filter: (data): data is { props: RecoveryCodeDialogProps } => data.component === RECOVER_CODE_DIALOG,\n component: ({ data }) => <RecoveryCodeDialog {...data.props} />,\n }),\n ]);\n"],
5
- "mappings": ";;;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,eAAeC,cAAcC,mBAAmB;AAiBzD,IAAA,wBAAe,CAAC,EAAEC,oBAAmB,MACnCC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAIC;IACJC,MAAM;IACNC,QAAQ,CAACC,SAAgDA,KAAKC,cAAcJ;IAC5EI,WAAW,CAAC,EAAED,KAAI,MAAO,sBAAA,cAACE,gBAAAA;MAAgB,GAAGF,KAAKG;MAAOZ;;EAC3D,CAAA;EACAI,cAAc;IACZC,IAAIQ;IACJN,MAAM;IACNC,QAAQ,CAACC,SAA4CA,KAAKC,cAAcG;IACxEH,WAAW,CAAC,EAAED,KAAI,MAAO,sBAAA,cAACK,YAAeL,KAAKG,KAAK;EACrD,CAAA;EACAR,cAAc;IACZC,IAAIU;IACJR,MAAM;IACNC,QAAQ,CAACC,SAAqDA,KAAKC,cAAcK;IACjFL,WAAW,CAAC,EAAED,KAAI,MAAO,sBAAA,cAACO,oBAAuBP,KAAKG,KAAK;EAC7D,CAAA;CACD;",
6
- "names": ["React", "createSurface", "Capabilities", "contributes", "createInvitationUrl", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "IDENTITY_DIALOG", "role", "filter", "data", "component", "IdentityDialog", "props", "JOIN_DIALOG", "JoinDialog", "RECOVER_CODE_DIALOG", "RecoveryCodeDialog"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/schema.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { effect } from '@preact/signals-core';\n\nimport { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';\nimport { type TypedObject } from '@dxos/echo-schema';\n\nimport { ClientCapabilities } from './capabilities';\n\n// TODO(wittjosiah): Remove types?\nexport default (context: PluginsContext) => {\n const client = context.requestCapability(ClientCapabilities.Client);\n\n let previousSystem: TypedObject[] = [];\n const unsubscribeSystem = effect(() => {\n const systemSchemas = Array.from(new Set(context.requestCapabilities(ClientCapabilities.SystemSchema).flat()));\n const newSchemas = systemSchemas.filter((schema) => !previousSystem.includes(schema));\n previousSystem = systemSchemas;\n client.addTypes(newSchemas);\n });\n\n let previous: TypedObject[] = [];\n const unsubscribe = effect(() => {\n const schemas = Array.from(new Set(context.requestCapabilities(ClientCapabilities.Schema).flat()));\n const newSchemas = schemas.filter((schema) => !previous.includes(schema));\n previous = schemas;\n client.addTypes(newSchemas);\n });\n\n return contributes(Capabilities.Null, null, () => {\n unsubscribeSystem();\n unsubscribe();\n });\n};\n"],
5
- "mappings": ";;;;;;AAIA,SAASA,cAAc;AAEvB,SAASC,cAAcC,mBAAwC;AAM/D,IAAA,iBAAe,CAACC,YAAAA;AACd,QAAMC,SAASD,QAAQE,kBAAkBC,mBAAmBC,MAAM;AAElE,MAAIC,iBAAgC,CAAA;AACpC,QAAMC,oBAAoBC,OAAO,MAAA;AAC/B,UAAMC,gBAAgBC,MAAMC,KAAK,IAAIC,IAAIX,QAAQY,oBAAoBT,mBAAmBU,YAAY,EAAEC,KAAI,CAAA,CAAA;AAC1G,UAAMC,aAAaP,cAAcQ,OAAO,CAACC,WAAW,CAACZ,eAAea,SAASD,MAAAA,CAAAA;AAC7EZ,qBAAiBG;AACjBP,WAAOkB,SAASJ,UAAAA;EAClB,CAAA;AAEA,MAAIK,WAA0B,CAAA;AAC9B,QAAMC,cAAcd,OAAO,MAAA;AACzB,UAAMe,UAAUb,MAAMC,KAAK,IAAIC,IAAIX,QAAQY,oBAAoBT,mBAAmBoB,MAAM,EAAET,KAAI,CAAA,CAAA;AAC9F,UAAMC,aAAaO,QAAQN,OAAO,CAACC,WAAW,CAACG,SAASF,SAASD,MAAAA,CAAAA;AACjEG,eAAWE;AACXrB,WAAOkB,SAASJ,UAAAA;EAClB,CAAA;AAEA,SAAOS,YAAYC,aAAaC,MAAM,MAAM,MAAA;AAC1CpB,sBAAAA;AACAe,gBAAAA;EACF,CAAA;AACF;",
6
- "names": ["effect", "Capabilities", "contributes", "context", "client", "requestCapability", "ClientCapabilities", "Client", "previousSystem", "unsubscribeSystem", "effect", "systemSchemas", "Array", "from", "Set", "requestCapabilities", "SystemSchema", "flat", "newSchemas", "filter", "schema", "includes", "addTypes", "previous", "unsubscribe", "schemas", "Schema", "contributes", "Capabilities", "Null"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type PluginsContext } from '@dxos/app-framework';\nimport { S } from '@dxos/echo-schema';\nimport { type Client, PublicKey, type ClientOptions } from '@dxos/react-client';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { CLIENT_PLUGIN } from './meta';\n\n// TODO(wittjosiah): Factor out. Generate?\nconst IdentitySchema = S.Struct({\n identityKey: S.instanceOf(PublicKey),\n spaceKey: S.optional(S.instanceOf(PublicKey)),\n profile: S.optional(\n S.Struct({\n displayName: S.optional(S.String),\n avatarCid: S.optional(S.String),\n data: S.optional(S.Record({ key: S.String, value: S.Any })),\n }),\n ),\n});\n\nconst CLIENT_ACTION = `${CLIENT_PLUGIN}/action`;\nexport namespace ClientAction {\n export class CreateIdentity extends S.TaggedClass<CreateIdentity>()(`${CLIENT_ACTION}/create-identity`, {\n input: S.Struct({\n displayName: S.optional(S.String),\n }),\n output: IdentitySchema,\n }) {}\n\n export class JoinIdentity extends S.TaggedClass<JoinIdentity>()(`${CLIENT_ACTION}/join-identity`, {\n input: S.Struct({\n invitationCode: S.String,\n }),\n output: S.Void,\n }) {}\n\n export class ShareIdentity extends S.TaggedClass<ShareIdentity>()(`${CLIENT_ACTION}/share-identity`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class RecoverIdentity extends S.TaggedClass<RecoverIdentity>()(`${CLIENT_ACTION}/recover-identity`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class ResetStorage extends S.TaggedClass<ResetStorage>()(`${CLIENT_ACTION}/reset-storage`, {\n input: S.Struct({\n target: S.optional(S.String),\n }),\n output: S.Void,\n }) {}\n\n export class CreateAgent extends S.TaggedClass<CreateAgent>()(`${CLIENT_ACTION}/create-agent`, {\n input: S.Void,\n output: S.Void,\n }) {}\n\n export class CreateRecoveryCode extends S.TaggedClass<CreateRecoveryCode>()(`${CLIENT_ACTION}/create-recovery-code`, {\n input: S.Void,\n output: S.Void,\n }) {}\n}\n\nexport type ClientPluginOptions = ClientOptions & {\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?: (context: PluginsContext, client: Client) => MaybePromise<void>;\n\n /**\n * Called when the client is reset.\n */\n onReset?: (params: { target?: string }) => MaybePromise<void>;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAKA,yBAAkB;AAClB,0BAA2D;AAM3D,IAAMA,iBAAiBC,qBAAEC,OAAO;EAC9BC,aAAaF,qBAAEG,WAAWC,6BAAAA;EAC1BC,UAAUL,qBAAEM,SAASN,qBAAEG,WAAWC,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qBAAEyB;EACZ,CAAA,EAAA;EAAI;gBALSG,eAAAA;EAON,MAAME,oBAAoB9B,qBAAEoB,YAAW,EAAgB,GAAGJ,aAAAA,iBAA8B;IAC7FK,OAAOrB,qBAAEyB;IACTH,QAAQtB,qBAAEyB;EACZ,CAAA,EAAA;EAAI;gBAHSK,cAAAA;EAKN,MAAMC,2BAA2B/B,qBAAEoB,YAAW,EAAuB,GAAGJ,aAAAA,yBAAsC;IACnHK,OAAOrB,qBAAEyB;IACTH,QAAQtB,qBAAEyB;EACZ,CAAA,EAAA;EAAI;gBAHSM,qBAAAA;AAIf,GAzCiBb,iBAAAA,eAAAA,CAAAA,EAAAA;",
6
- "names": ["IdentitySchema", "S", "Struct", "identityKey", "instanceOf", "PublicKey", "spaceKey", "optional", "profile", "displayName", "String", "avatarCid", "data", "Record", "key", "value", "Any", "CLIENT_ACTION", "CLIENT_PLUGIN", "ClientAction", "CreateIdentity", "TaggedClass", "input", "output", "JoinIdentity", "invitationCode", "Void", "ShareIdentity", "RecoverIdentity", "ResetStorage", "target", "CreateAgent", "CreateRecoveryCode"]
7
- }
@@ -1,190 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_VUJ3ZPK3_exports = {};
30
- __export(chunk_VUJ3ZPK3_exports, {
31
- IDENTITY_DIALOG: () => IDENTITY_DIALOG,
32
- IdentityDialog: () => IdentityDialog,
33
- JOIN_DIALOG: () => JOIN_DIALOG,
34
- JoinDialog: () => JoinDialog,
35
- RECOVER_CODE_DIALOG: () => RECOVER_CODE_DIALOG,
36
- RecoveryCodeDialog: () => RecoveryCodeDialog
37
- });
38
- module.exports = __toCommonJS(chunk_VUJ3ZPK3_exports);
39
- var import_chunk_NVYWMDF3 = require("./chunk-NVYWMDF3.cjs");
40
- var import_chunk_OIFPM5ZW = require("./chunk-OIFPM5ZW.cjs");
41
- var import_react = __toESM(require("react"));
42
- var import_app_framework = require("@dxos/app-framework");
43
- var import_react_client = require("@dxos/react-client");
44
- var import_react_ui = require("@dxos/react-ui");
45
- var import_react2 = require("@dxos/shell/react");
46
- var import_react3 = __toESM(require("react"));
47
- var import_app_framework2 = require("@dxos/app-framework");
48
- var import_types = require("@dxos/plugin-observability/types");
49
- var import_react_ui2 = require("@dxos/react-ui");
50
- var import_react4 = require("@dxos/shell/react");
51
- var import_react5 = __toESM(require("react"));
52
- var import_react_ui3 = require("@dxos/react-ui");
53
- var IDENTITY_DIALOG = `${import_chunk_OIFPM5ZW.CLIENT_PLUGIN}/IdentityDialog`;
54
- var IdentityDialog = (props) => {
55
- const { dispatchPromise: dispatch } = (0, import_app_framework.useIntentDispatcher)();
56
- const client = (0, import_react_client.useClient)();
57
- const handleDone = (0, import_react.useCallback)(() => dispatch((0, import_app_framework.createIntent)(import_app_framework.LayoutAction.UpdateDialog, {
58
- part: "dialog",
59
- options: {
60
- state: false
61
- }
62
- })), [
63
- dispatch
64
- ]);
65
- const handleResetStorage = (0, import_react.useCallback)(async () => {
66
- await client.reset();
67
- await dispatch((0, import_app_framework.createIntent)(import_chunk_NVYWMDF3.ClientAction.ResetStorage));
68
- }, [
69
- dispatch
70
- ]);
71
- const handleRecover = (0, import_react.useCallback)(async () => {
72
- await client.reset();
73
- await dispatch((0, import_app_framework.createIntent)(import_chunk_NVYWMDF3.ClientAction.ResetStorage, {
74
- target: "recoverIdentity"
75
- }));
76
- }, [
77
- dispatch
78
- ]);
79
- const handleJoinNewIdentity = (0, import_react.useCallback)(async () => {
80
- await client.reset();
81
- await dispatch((0, import_app_framework.createIntent)(import_chunk_NVYWMDF3.ClientAction.ResetStorage, {
82
- target: "deviceInvitation"
83
- }));
84
- }, [
85
- dispatch
86
- ]);
87
- return /* @__PURE__ */ import_react.default.createElement(import_react_ui.Dialog.Content, null, /* @__PURE__ */ import_react.default.createElement(import_react_ui.Clipboard.Provider, null, /* @__PURE__ */ import_react.default.createElement(import_react2.IdentityPanel, {
88
- ...props,
89
- doneActionParent: /* @__PURE__ */ import_react.default.createElement(import_react_ui.Dialog.Close, {
90
- asChild: true
91
- }),
92
- onDone: handleDone,
93
- onResetStorage: handleResetStorage,
94
- onRecover: handleRecover,
95
- onJoinNewIdentity: handleJoinNewIdentity
96
- })));
97
- };
98
- var JOIN_DIALOG = `${import_chunk_OIFPM5ZW.CLIENT_PLUGIN}/JoinDialog`;
99
- var JoinDialog = (props) => {
100
- const { dispatchPromise: dispatch } = (0, import_app_framework2.useIntentDispatcher)();
101
- const handleCancelResetStorage = (0, import_react3.useCallback)(() => dispatch((0, import_app_framework2.createIntent)(import_chunk_NVYWMDF3.ClientAction.ShareIdentity)), [
102
- dispatch
103
- ]);
104
- const handleDone = (0, import_react3.useCallback)(async (result) => {
105
- if (result?.identityKey) {
106
- await Promise.all([
107
- dispatch((0, import_app_framework2.createIntent)(import_app_framework2.LayoutAction.UpdateDialog, {
108
- part: "dialog",
109
- options: {
110
- state: false
111
- }
112
- })),
113
- dispatch((0, import_app_framework2.createIntent)(import_types.ObservabilityAction.SendEvent, {
114
- name: props.initialDisposition === "recover-identity" ? "identity.recover" : "identity.join"
115
- }))
116
- ]);
117
- }
118
- }, [
119
- dispatch
120
- ]);
121
- return /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Dialog.Content, null, /* @__PURE__ */ import_react3.default.createElement(import_react4.JoinPanel, {
122
- mode: "halo-only",
123
- ...props,
124
- exitActionParent: /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Dialog.Close, {
125
- asChild: true
126
- }),
127
- doneActionParent: /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Dialog.Close, {
128
- asChild: true
129
- }),
130
- onCancelResetStorage: handleCancelResetStorage,
131
- onDone: handleDone
132
- }));
133
- };
134
- var RECOVER_CODE_DIALOG = `${import_chunk_OIFPM5ZW.CLIENT_PLUGIN}/RecoveryCodeDialog`;
135
- var RecoveryCodeDialog = ({ code }) => {
136
- const { t } = (0, import_react_ui3.useTranslation)(import_chunk_OIFPM5ZW.CLIENT_PLUGIN);
137
- const [confirmation, setConfirmation] = (0, import_react5.useState)(false);
138
- const handleConfirmation = (0, import_react5.useCallback)((checked) => setConfirmation(checked), []);
139
- return /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.AlertDialog.Content, {
140
- classNames: "bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
141
- }, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.AlertDialog.Title, null, t("recovery code dialog title")), /* @__PURE__ */ import_react5.default.createElement("p", {
142
- className: "py-4"
143
- }, t("recovery code dialog description")), /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Clipboard.Provider, null, /* @__PURE__ */ import_react5.default.createElement(Code, {
144
- code
145
- })), /* @__PURE__ */ import_react5.default.createElement("div", {
146
- className: "flex flex-col py-4 gap-2"
147
- }, /* @__PURE__ */ import_react5.default.createElement("p", null, t("recovery code dialog warning 1")), /* @__PURE__ */ import_react5.default.createElement("p", null, t("recovery code dialog warning 2"))), /* @__PURE__ */ import_react5.default.createElement("div", {
148
- className: "flex items-center gap-2 pbe-4"
149
- }, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Input.Root, null, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Input.Checkbox, {
150
- "data-testid": "recoveryCode.confirm",
151
- checked: confirmation,
152
- onCheckedChange: handleConfirmation
153
- }), /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Input.Label, null, t("recovery code confirmation label")))), /* @__PURE__ */ import_react5.default.createElement("div", {
154
- className: "flex justify-end"
155
- }, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.AlertDialog.Action, {
156
- asChild: true
157
- }, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Button, {
158
- "data-testid": "recoveryCode.continue",
159
- variant: "primary",
160
- disabled: !confirmation
161
- }, t("continue label")))));
162
- };
163
- var Code = ({ code }) => {
164
- const words = code.split(" ");
165
- return /* @__PURE__ */ import_react5.default.createElement("div", {
166
- className: "relative p-2 border border-separator rounded group"
167
- }, /* @__PURE__ */ import_react5.default.createElement(import_react_ui3.Clipboard.IconButton, {
168
- value: code,
169
- classNames: "absolute top-2 right-2 invisible group-hover:visible"
170
- }), /* @__PURE__ */ import_react5.default.createElement("div", {
171
- className: "grid grid-cols-4"
172
- }, words.map((word, i) => /* @__PURE__ */ import_react5.default.createElement("div", {
173
- key: i,
174
- className: "flex items-center p-2 gap-2 items-center"
175
- }, /* @__PURE__ */ import_react5.default.createElement("div", {
176
- className: "w-4 text-xs text-center text-subdued"
177
- }, i + 1), /* @__PURE__ */ import_react5.default.createElement("div", {
178
- className: "text-sm"
179
- }, word)))));
180
- };
181
- // Annotate the CommonJS export names for ESM import in node:
182
- 0 && (module.exports = {
183
- IDENTITY_DIALOG,
184
- IdentityDialog,
185
- JOIN_DIALOG,
186
- JoinDialog,
187
- RECOVER_CODE_DIALOG,
188
- RecoveryCodeDialog
189
- });
190
- //# sourceMappingURL=chunk-VUJ3ZPK3.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/IdentityDialog.tsx", "../../../src/components/JoinDialog.tsx", "../../../src/components/RecoveryCodeDialog.tsx"],
4
- "sourcesContent": ["//\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.UpdateDialog, {\n part: 'dialog',\n options: { 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.UpdateDialog, { part: 'dialog', options: { 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"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAmC;AAEnC,2BAAgE;AAChE,0BAA0B;AAC1B,sBAAkC;AAClC,IAAAA,gBAAuD;ACLvD,IAAAA,gBAAmC;AAEnC,IAAAC,wBAAgE;AAChE,mBAAoC;AAEpC,IAAAC,mBAAuB;AACvB,IAAAF,gBAA+C;ACN/C,IAAAA,gBAA6C;AAE7C,IAAAE,mBAAsE;AFQ/D,I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CmB,IAAI,CAAA,GAC3D9D,8BAAAA,QAAA,cAAC6C,OAAAA;IAAIF,WAAU;KAAWkB,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAMtC;",
6
- "names": ["import_react", "import_app_framework", "import_react_ui", "IDENTITY_DIALOG", "CLIENT_PLUGIN", "IdentityDialog", "props", "dispatchPromise", "dispatch", "useIntentDispatcher", "client", "useClient", "handleDone", "useCallback", "createIntent", "LayoutAction", "UpdateDialog", "part", "options", "state", "handleResetStorage", "reset", "ClientAction", "ResetStorage", "handleRecover", "target", "handleJoinNewIdentity", "React", "Dialog", "Content", "Clipboard", "Provider", "IdentityPanel", "doneActionParent", "Close", "asChild", "onDone", "onResetStorage", "onRecover", "onJoinNewIdentity", "JOIN_DIALOG", "JoinDialog", "handleCancelResetStorage", "ShareIdentity", "result", "identityKey", "Promise", "all", "ObservabilityAction", "SendEvent", "name", "initialDisposition", "JoinPanel", "mode", "exitActionParent", "onCancelResetStorage", "RECOVER_CODE_DIALOG", "RecoveryCodeDialog", "code", "t", "useTranslation", "confirmation", "setConfirmation", "useState", "handleConfirmation", "checked", "AlertDialog", "classNames", "Title", "p", "className", "Code", "div", "Input", "Root", "Checkbox", "data-testid", "onCheckedChange", "Label", "Action", "Button", "variant", "disabled", "words", "split", "IconButton", "value", "map", "word", "i", "key"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/client.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, type PluginsContext } from '@dxos/app-framework';\nimport { Config, Defaults, Envs, Local, Storage } from '@dxos/config';\nimport { Client } from '@dxos/react-client';\n\nimport { ClientCapabilities } from './capabilities';\nimport { ClientEvents } from '../events';\nimport { type ClientPluginOptions } from '../types';\n\ntype ClientCapabilityOptions = Omit<ClientPluginOptions, 'appKey' | 'invitationUrl' | 'invitationParam' | 'onReset'> & {\n context: PluginsContext;\n};\n\nexport default async ({ context, onClientInitialized, ...options }: ClientCapabilityOptions) => {\n const config = new Config(await Storage(), Envs(), Local(), Defaults());\n const client = new Client({ config, ...options });\n await client.initialize();\n await onClientInitialized?.(context, 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\n const subscription = client.spaces.isReady.subscribe(async (ready) => {\n if (ready) {\n await context.activate(ClientEvents.SpacesReady);\n }\n });\n\n return contributes(ClientCapabilities.Client, client, async () => {\n subscription.unsubscribe();\n await client.destroy();\n });\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,2BAAiD;AACjD,oBAAuD;AACvD,0BAAuB;AAUvB,IAAA,iBAAe,OAAO,EAAEA,SAASC,qBAAqB,GAAGC,QAAAA,MAAkC;AACzF,QAAMC,SAAS,IAAIC,qBAAO,UAAMC,uBAAAA,OAAWC,oBAAAA,OAAQC,qBAAAA,OAASC,wBAAAA,CAAAA;AAC5D,QAAMC,SAAS,IAAIC,2BAAO;IAAEP;IAAQ,GAAGD;EAAQ,CAAA;AAC/C,QAAMO,OAAOE,WAAU;AACvB,QAAMV,sBAAsBD,SAASS,MAAAA;AAGrCA,SAAOG,SAASC,GAAG,MAAA;AACjBJ,WAAOK,KAAKC,SAASC,UAAU,OAAOD,aAAAA;AACpC,UAAIA,UAAU;AACZE,eAAOC,SAASC,OAAOF,OAAOC,SAASE;MACzC;IACF,CAAA;EACF,CAAA;AAEA,QAAMC,eAAeZ,OAAOa,OAAOC,QAAQP,UAAU,OAAOQ,UAAAA;AAC1D,QAAIA,OAAO;AACT,YAAMxB,QAAQyB,SAASC,mCAAaC,WAAW;IACjD;EACF,CAAA;AAEA,aAAOC,kCAAYC,yCAAmBnB,QAAQD,QAAQ,YAAA;AACpDY,iBAAaS,YAAW;AACxB,UAAMrB,OAAOsB,QAAO;EACtB,CAAA;AACF;",
6
- "names": ["context", "onClientInitialized", "options", "config", "Config", "Storage", "Envs", "Local", "Defaults", "client", "Client", "initialize", "reloaded", "on", "halo", "identity", "subscribe", "window", "location", "href", "origin", "subscription", "spaces", "isReady", "ready", "activate", "ClientEvents", "SpacesReady", "contributes", "ClientCapabilities", "unsubscribe", "destroy"]
7
- }