@dxos/plugin-client 0.8.4-main.69d29f4 → 0.8.4-main.6fa680abb7

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 (222) hide show
  1. package/dist/lib/browser/DevicesContainer-3N7ANEJ7.mjs +268 -0
  2. package/dist/lib/browser/DevicesContainer-3N7ANEJ7.mjs.map +7 -0
  3. package/dist/lib/browser/JoinDialog-VTTK7NHO.mjs +59 -0
  4. package/dist/lib/browser/JoinDialog-VTTK7NHO.mjs.map +7 -0
  5. package/dist/lib/browser/ProfileContainer-XV7OXJC2.mjs +171 -0
  6. package/dist/lib/browser/ProfileContainer-XV7OXJC2.mjs.map +7 -0
  7. package/dist/lib/browser/RecoveryCodeDialog-WO34OZEJ.mjs +60 -0
  8. package/dist/lib/browser/RecoveryCodeDialog-WO34OZEJ.mjs.map +7 -0
  9. package/dist/lib/browser/RecoveryCredentialsContainer-G22FSTIX.mjs +57 -0
  10. package/dist/lib/browser/RecoveryCredentialsContainer-G22FSTIX.mjs.map +7 -0
  11. package/dist/lib/browser/ResetDialog-W24FOWBQ.mjs +52 -0
  12. package/dist/lib/browser/ResetDialog-W24FOWBQ.mjs.map +7 -0
  13. package/dist/lib/browser/{app-graph-builder-3FGBMLTF.mjs → app-graph-builder-GGJKFY3X.mjs} +9 -6
  14. package/dist/lib/browser/app-graph-builder-GGJKFY3X.mjs.map +7 -0
  15. package/dist/lib/browser/{chunk-4BZGRIFS.mjs → chunk-FVEKZBM7.mjs} +34 -44
  16. package/dist/lib/browser/chunk-FVEKZBM7.mjs.map +7 -0
  17. package/dist/lib/browser/{chunk-F7H2Y3Z2.mjs → chunk-GSVYEYVS.mjs} +4 -4
  18. package/dist/lib/browser/chunk-HSFDKP5D.mjs +15 -0
  19. package/dist/lib/browser/{chunk-G7C3S2BE.mjs.map → chunk-HSFDKP5D.mjs.map} +1 -1
  20. package/dist/lib/browser/chunk-JHSBBOCI.mjs +15 -0
  21. package/dist/lib/browser/chunk-JHSBBOCI.mjs.map +7 -0
  22. package/dist/lib/browser/cli/index.mjs +60 -49
  23. package/dist/lib/browser/cli/index.mjs.map +3 -3
  24. package/dist/lib/browser/{client-IX5LMWV4.mjs → client-BXCP3EUE.mjs} +11 -11
  25. package/dist/lib/browser/client-BXCP3EUE.mjs.map +7 -0
  26. package/dist/lib/browser/index.mjs +26 -23
  27. package/dist/lib/browser/index.mjs.map +3 -3
  28. package/dist/lib/browser/meta.json +1 -1
  29. package/dist/lib/browser/{migrations-3EBTAW3N.mjs → migrations-GKUA2ARL.mjs} +6 -5
  30. package/dist/lib/browser/migrations-GKUA2ARL.mjs.map +7 -0
  31. package/dist/lib/browser/{operation-resolver-2NT3ISVP.mjs → operation-resolver-VSWA74RS.mjs} +24 -23
  32. package/dist/lib/browser/operation-resolver-VSWA74RS.mjs.map +7 -0
  33. package/dist/lib/browser/{react-context-4UABG3GP.mjs → react-context-GZ3T5UON.mjs} +8 -6
  34. package/dist/lib/browser/react-context-GZ3T5UON.mjs.map +7 -0
  35. package/dist/lib/browser/react-surface-5VZP34X3.mjs +77 -0
  36. package/dist/lib/browser/react-surface-5VZP34X3.mjs.map +7 -0
  37. package/dist/lib/browser/{schema-defs-O7VLP745.mjs → schema-defs-KAG6HQMI.mjs} +8 -6
  38. package/dist/lib/browser/schema-defs-KAG6HQMI.mjs.map +7 -0
  39. package/dist/lib/browser/types/index.mjs +2 -1
  40. package/dist/lib/node-esm/DevicesContainer-V7HEUPO7.mjs +269 -0
  41. package/dist/lib/node-esm/DevicesContainer-V7HEUPO7.mjs.map +7 -0
  42. package/dist/lib/node-esm/JoinDialog-XVKW4SLT.mjs +60 -0
  43. package/dist/lib/node-esm/JoinDialog-XVKW4SLT.mjs.map +7 -0
  44. package/dist/lib/node-esm/ProfileContainer-B5LJ6TMU.mjs +172 -0
  45. package/dist/lib/node-esm/ProfileContainer-B5LJ6TMU.mjs.map +7 -0
  46. package/dist/lib/node-esm/RecoveryCodeDialog-YIRGXM7N.mjs +61 -0
  47. package/dist/lib/node-esm/RecoveryCodeDialog-YIRGXM7N.mjs.map +7 -0
  48. package/dist/lib/node-esm/RecoveryCredentialsContainer-MVJEFNXX.mjs +58 -0
  49. package/dist/lib/node-esm/RecoveryCredentialsContainer-MVJEFNXX.mjs.map +7 -0
  50. package/dist/lib/node-esm/ResetDialog-GGBWSQZO.mjs +54 -0
  51. package/dist/lib/node-esm/ResetDialog-GGBWSQZO.mjs.map +7 -0
  52. package/dist/lib/node-esm/{app-graph-builder-2PIYVUNC.mjs → app-graph-builder-PTNZ46NN.mjs} +9 -6
  53. package/dist/lib/node-esm/app-graph-builder-PTNZ46NN.mjs.map +7 -0
  54. package/dist/lib/node-esm/chunk-BOTJSPCT.mjs +17 -0
  55. package/dist/lib/node-esm/chunk-BOTJSPCT.mjs.map +7 -0
  56. package/dist/lib/node-esm/{chunk-JAF64TFQ.mjs → chunk-DT2ZNOGU.mjs} +33 -44
  57. package/dist/lib/node-esm/chunk-DT2ZNOGU.mjs.map +7 -0
  58. package/dist/lib/node-esm/{chunk-BCELGXRI.mjs → chunk-OFJUOKY7.mjs} +4 -4
  59. package/dist/lib/node-esm/chunk-VLNCZYIC.mjs +16 -0
  60. package/dist/lib/node-esm/{chunk-PRAFFO54.mjs.map → chunk-VLNCZYIC.mjs.map} +1 -1
  61. package/dist/lib/node-esm/cli/index.mjs +60 -49
  62. package/dist/lib/node-esm/cli/index.mjs.map +3 -3
  63. package/dist/lib/node-esm/{client-FFPK5UFP.mjs → client-EGZHGRRC.mjs} +11 -11
  64. package/dist/lib/node-esm/client-EGZHGRRC.mjs.map +7 -0
  65. package/dist/lib/node-esm/index.mjs +26 -23
  66. package/dist/lib/node-esm/index.mjs.map +3 -3
  67. package/dist/lib/node-esm/meta.json +1 -1
  68. package/dist/lib/node-esm/{migrations-WSZSFGDK.mjs → migrations-4NEKCBGU.mjs} +6 -5
  69. package/dist/lib/node-esm/migrations-4NEKCBGU.mjs.map +7 -0
  70. package/dist/lib/node-esm/{operation-resolver-VW5R2BE4.mjs → operation-resolver-4GWB3YZG.mjs} +24 -23
  71. package/dist/lib/node-esm/operation-resolver-4GWB3YZG.mjs.map +7 -0
  72. package/dist/lib/node-esm/{react-context-UVXMGPW4.mjs → react-context-T2ORT5CC.mjs} +8 -6
  73. package/dist/lib/node-esm/react-context-T2ORT5CC.mjs.map +7 -0
  74. package/dist/lib/node-esm/react-surface-B65OUZYI.mjs +78 -0
  75. package/dist/lib/node-esm/react-surface-B65OUZYI.mjs.map +7 -0
  76. package/dist/lib/node-esm/{schema-defs-QLRGBIKY.mjs → schema-defs-GXQ47JZN.mjs} +8 -6
  77. package/dist/lib/node-esm/schema-defs-GXQ47JZN.mjs.map +7 -0
  78. package/dist/lib/node-esm/types/index.mjs +2 -1
  79. package/dist/types/src/ClientPlugin.d.ts.map +1 -1
  80. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +1 -1
  81. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
  82. package/dist/types/src/capabilities/client/client.d.ts +2 -2
  83. package/dist/types/src/capabilities/client/client.d.ts.map +1 -1
  84. package/dist/types/src/capabilities/client/index.d.ts +2 -1
  85. package/dist/types/src/capabilities/client/index.d.ts.map +1 -1
  86. package/dist/types/src/capabilities/migrations/migrations.d.ts +1 -1
  87. package/dist/types/src/capabilities/migrations/migrations.d.ts.map +1 -1
  88. package/dist/types/src/capabilities/operation-resolver/index.d.ts +1 -1
  89. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -1
  90. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +2 -2
  91. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
  92. package/dist/types/src/capabilities/react-context/react-context.d.ts +1 -1
  93. package/dist/types/src/capabilities/react-context/react-context.d.ts.map +1 -1
  94. package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
  95. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
  96. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
  97. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
  98. package/dist/types/src/capabilities/schema-defs/schema-defs.d.ts +1 -1
  99. package/dist/types/src/capabilities/schema-defs/schema-defs.d.ts.map +1 -1
  100. package/dist/types/src/cli/commands/halo/create/create.d.ts.map +1 -1
  101. package/dist/types/src/cli/commands/profile/create.d.ts +2 -1
  102. package/dist/types/src/cli/commands/profile/create.d.ts.map +1 -1
  103. package/dist/types/src/cli/commands/profile/delete.d.ts +1 -1
  104. package/dist/types/src/cli/commands/profile/delete.d.ts.map +1 -1
  105. package/dist/types/src/cli/commands/profile/list.d.ts.map +1 -1
  106. package/dist/types/src/cli/plugin.d.ts.map +1 -1
  107. package/dist/types/src/components/index.d.ts +0 -6
  108. package/dist/types/src/components/index.d.ts.map +1 -1
  109. package/dist/types/src/containers/DevicesContainer/DevicesContainer.d.ts.map +1 -0
  110. package/dist/types/src/{components → containers/DevicesContainer}/DevicesContainer.stories.d.ts +9 -7
  111. package/dist/types/src/containers/DevicesContainer/DevicesContainer.stories.d.ts.map +1 -0
  112. package/dist/types/src/containers/DevicesContainer/index.d.ts +3 -0
  113. package/dist/types/src/containers/DevicesContainer/index.d.ts.map +1 -0
  114. package/dist/types/src/containers/JoinDialog/JoinDialog.d.ts.map +1 -0
  115. package/dist/types/src/containers/JoinDialog/index.d.ts +3 -0
  116. package/dist/types/src/containers/JoinDialog/index.d.ts.map +1 -0
  117. package/dist/types/src/containers/ProfileContainer/ProfileContainer.d.ts.map +1 -0
  118. package/dist/types/src/containers/ProfileContainer/ProfileContainer.stories.d.ts.map +1 -0
  119. package/dist/types/src/containers/ProfileContainer/index.d.ts +3 -0
  120. package/dist/types/src/containers/ProfileContainer/index.d.ts.map +1 -0
  121. package/dist/types/src/containers/RecoveryCodeDialog/RecoveryCodeDialog.d.ts.map +1 -0
  122. package/dist/types/src/containers/RecoveryCodeDialog/RecoveryCodeDialog.stories.d.ts.map +1 -0
  123. package/dist/types/src/containers/RecoveryCodeDialog/index.d.ts +4 -0
  124. package/dist/types/src/containers/RecoveryCodeDialog/index.d.ts.map +1 -0
  125. package/dist/types/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.d.ts.map +1 -0
  126. package/dist/types/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.stories.d.ts.map +1 -0
  127. package/dist/types/src/containers/RecoveryCredentialsContainer/index.d.ts +3 -0
  128. package/dist/types/src/containers/RecoveryCredentialsContainer/index.d.ts.map +1 -0
  129. package/dist/types/src/{components → containers/ResetDialog}/ResetDialog.d.ts +1 -1
  130. package/dist/types/src/containers/ResetDialog/ResetDialog.d.ts.map +1 -0
  131. package/dist/types/src/{components → containers/ResetDialog}/ResetDialog.stories.d.ts +1 -1
  132. package/dist/types/src/containers/ResetDialog/ResetDialog.stories.d.ts.map +1 -0
  133. package/dist/types/src/containers/ResetDialog/index.d.ts +4 -0
  134. package/dist/types/src/containers/ResetDialog/index.d.ts.map +1 -0
  135. package/dist/types/src/containers/index.d.ts +10 -0
  136. package/dist/types/src/containers/index.d.ts.map +1 -0
  137. package/dist/types/src/types/capabilities.d.ts +1 -1
  138. package/dist/types/src/types/capabilities.d.ts.map +1 -1
  139. package/dist/types/src/types/schema.d.ts +36 -32
  140. package/dist/types/src/types/schema.d.ts.map +1 -1
  141. package/dist/types/tsconfig.tsbuildinfo +1 -1
  142. package/package.json +36 -35
  143. package/src/ClientPlugin.ts +27 -19
  144. package/src/capabilities/app-graph-builder/app-graph-builder.ts +4 -3
  145. package/src/capabilities/client/client.ts +7 -5
  146. package/src/capabilities/migrations/migrations.ts +3 -3
  147. package/src/capabilities/operation-resolver/operation-resolver.ts +13 -12
  148. package/src/capabilities/react-context/react-context.tsx +3 -3
  149. package/src/capabilities/react-surface/react-surface.tsx +12 -12
  150. package/src/capabilities/schema-defs/schema-defs.ts +7 -6
  151. package/src/cli/commands/edge/status.ts +2 -2
  152. package/src/cli/commands/halo/create/create.ts +2 -2
  153. package/src/cli/commands/profile/create.ts +9 -6
  154. package/src/cli/commands/profile/delete.ts +5 -2
  155. package/src/cli/commands/profile/list.ts +13 -11
  156. package/src/cli/plugin.ts +7 -6
  157. package/src/components/index.ts +0 -7
  158. package/src/constants.ts +3 -3
  159. package/src/{components → containers/DevicesContainer}/DevicesContainer.stories.tsx +8 -6
  160. package/src/{components → containers/DevicesContainer}/DevicesContainer.tsx +49 -57
  161. package/src/containers/DevicesContainer/index.ts +7 -0
  162. package/src/{components → containers/JoinDialog}/JoinDialog.tsx +8 -6
  163. package/src/containers/JoinDialog/index.ts +7 -0
  164. package/src/{components → containers/ProfileContainer}/ProfileContainer.stories.tsx +4 -4
  165. package/src/{components → containers/ProfileContainer}/ProfileContainer.tsx +20 -28
  166. package/src/containers/ProfileContainer/index.ts +7 -0
  167. package/src/{components → containers/RecoveryCodeDialog}/RecoveryCodeDialog.stories.tsx +4 -4
  168. package/src/{components → containers/RecoveryCodeDialog}/RecoveryCodeDialog.tsx +28 -25
  169. package/src/containers/RecoveryCodeDialog/index.ts +8 -0
  170. package/src/{components → containers/RecoveryCredentialsContainer}/RecoveryCredentialsContainer.stories.tsx +8 -6
  171. package/src/{components → containers/RecoveryCredentialsContainer}/RecoveryCredentialsContainer.tsx +19 -19
  172. package/src/containers/RecoveryCredentialsContainer/index.ts +7 -0
  173. package/src/{components → containers/ResetDialog}/ResetDialog.stories.tsx +27 -14
  174. package/src/{components → containers/ResetDialog}/ResetDialog.tsx +10 -10
  175. package/src/containers/ResetDialog/index.ts +8 -0
  176. package/src/containers/index.ts +15 -0
  177. package/src/meta.ts +1 -1
  178. package/src/translations.ts +1 -1
  179. package/src/types/capabilities.ts +3 -3
  180. package/src/types/events.ts +5 -5
  181. package/src/types/schema.ts +28 -23
  182. package/dist/lib/browser/app-graph-builder-3FGBMLTF.mjs.map +0 -7
  183. package/dist/lib/browser/chunk-4BZGRIFS.mjs.map +0 -7
  184. package/dist/lib/browser/chunk-G7C3S2BE.mjs +0 -15
  185. package/dist/lib/browser/client-IX5LMWV4.mjs.map +0 -7
  186. package/dist/lib/browser/migrations-3EBTAW3N.mjs.map +0 -7
  187. package/dist/lib/browser/operation-resolver-2NT3ISVP.mjs.map +0 -7
  188. package/dist/lib/browser/react-context-4UABG3GP.mjs.map +0 -7
  189. package/dist/lib/browser/react-surface-RSQ74XCT.mjs +0 -675
  190. package/dist/lib/browser/react-surface-RSQ74XCT.mjs.map +0 -7
  191. package/dist/lib/browser/schema-defs-O7VLP745.mjs.map +0 -7
  192. package/dist/lib/node-esm/app-graph-builder-2PIYVUNC.mjs.map +0 -7
  193. package/dist/lib/node-esm/chunk-JAF64TFQ.mjs.map +0 -7
  194. package/dist/lib/node-esm/chunk-PRAFFO54.mjs +0 -16
  195. package/dist/lib/node-esm/client-FFPK5UFP.mjs.map +0 -7
  196. package/dist/lib/node-esm/migrations-WSZSFGDK.mjs.map +0 -7
  197. package/dist/lib/node-esm/operation-resolver-VW5R2BE4.mjs.map +0 -7
  198. package/dist/lib/node-esm/react-context-UVXMGPW4.mjs.map +0 -7
  199. package/dist/lib/node-esm/react-surface-KBHANGGC.mjs +0 -676
  200. package/dist/lib/node-esm/react-surface-KBHANGGC.mjs.map +0 -7
  201. package/dist/lib/node-esm/schema-defs-QLRGBIKY.mjs.map +0 -7
  202. package/dist/types/src/components/DevicesContainer.d.ts.map +0 -1
  203. package/dist/types/src/components/DevicesContainer.stories.d.ts.map +0 -1
  204. package/dist/types/src/components/JoinDialog.d.ts.map +0 -1
  205. package/dist/types/src/components/ProfileContainer.d.ts.map +0 -1
  206. package/dist/types/src/components/ProfileContainer.stories.d.ts.map +0 -1
  207. package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +0 -1
  208. package/dist/types/src/components/RecoveryCodeDialog.stories.d.ts.map +0 -1
  209. package/dist/types/src/components/RecoveryCredentialsContainer.d.ts.map +0 -1
  210. package/dist/types/src/components/RecoveryCredentialsContainer.stories.d.ts.map +0 -1
  211. package/dist/types/src/components/ResetDialog.d.ts.map +0 -1
  212. package/dist/types/src/components/ResetDialog.stories.d.ts.map +0 -1
  213. /package/dist/lib/browser/{chunk-F7H2Y3Z2.mjs.map → chunk-GSVYEYVS.mjs.map} +0 -0
  214. /package/dist/lib/node-esm/{chunk-BCELGXRI.mjs.map → chunk-OFJUOKY7.mjs.map} +0 -0
  215. /package/dist/types/src/{components → containers/DevicesContainer}/DevicesContainer.d.ts +0 -0
  216. /package/dist/types/src/{components → containers/JoinDialog}/JoinDialog.d.ts +0 -0
  217. /package/dist/types/src/{components → containers/ProfileContainer}/ProfileContainer.d.ts +0 -0
  218. /package/dist/types/src/{components → containers/ProfileContainer}/ProfileContainer.stories.d.ts +0 -0
  219. /package/dist/types/src/{components → containers/RecoveryCodeDialog}/RecoveryCodeDialog.d.ts +0 -0
  220. /package/dist/types/src/{components → containers/RecoveryCodeDialog}/RecoveryCodeDialog.stories.d.ts +0 -0
  221. /package/dist/types/src/{components → containers/RecoveryCredentialsContainer}/RecoveryCredentialsContainer.d.ts +0 -0
  222. /package/dist/types/src/{components → containers/RecoveryCredentialsContainer}/RecoveryCredentialsContainer.stories.d.ts +0 -0
@@ -1,676 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- JOIN_DIALOG,
4
- RECOVERY_CODE_DIALOG,
5
- RESET_DIALOG
6
- } from "./chunk-PRAFFO54.mjs";
7
- import {
8
- Account,
9
- ClientOperation,
10
- meta
11
- } from "./chunk-JAF64TFQ.mjs";
12
-
13
- // src/capabilities/react-surface/react-surface.tsx
14
- import * as Effect2 from "effect/Effect";
15
- import React7 from "react";
16
- import { Capability as Capability2, Common as Common3 } from "@dxos/app-framework";
17
-
18
- // src/components/DevicesContainer.tsx
19
- import React, { useCallback, useEffect, useState } from "react";
20
- import { QR } from "react-qr-rounded";
21
- import { useOperationInvoker } from "@dxos/app-framework/react";
22
- import { log } from "@dxos/log";
23
- import { useClient, useMulticastObservable } from "@dxos/react-client";
24
- import { useDevices } from "@dxos/react-client/halo";
25
- import { Invitation, InvitationEncoder } from "@dxos/react-client/invitations";
26
- import { useNetworkStatus } from "@dxos/react-client/mesh";
27
- import { Button, Clipboard, Icon, IconButton, List, useId, useTranslation } from "@dxos/react-ui";
28
- import { ControlFrame, ControlFrameItem, ControlGroup, ControlItem, ControlPage, ControlSection } from "@dxos/react-ui-form";
29
- import { translationKey } from "@dxos/shell/react";
30
- import { AuthCode, Centered, DeviceListItem, Emoji, Viewport } from "@dxos/shell/react";
31
- import { osTranslations } from "@dxos/ui-theme";
32
- import { hexToEmoji } from "@dxos/util";
33
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-client/src/components/DevicesContainer.tsx";
34
- var DevicesContainer = ({ createInvitationUrl }) => {
35
- const { t } = useTranslation(translationKey);
36
- const { invokePromise } = useOperationInvoker();
37
- const devices = useDevices();
38
- const { swarm: connectionState } = useNetworkStatus();
39
- const handleResetStorage = useCallback(() => invokePromise(ClientOperation.ResetStorage, {}), [
40
- invokePromise
41
- ]);
42
- const handleRecover = useCallback(() => invokePromise(ClientOperation.ResetStorage, {
43
- mode: "recover"
44
- }), [
45
- invokePromise
46
- ]);
47
- const handleJoinNewIdentity = useCallback(() => invokePromise(ClientOperation.ResetStorage, {
48
- mode: "join new identity"
49
- }), [
50
- invokePromise
51
- ]);
52
- return /* @__PURE__ */ React.createElement(Clipboard.Provider, null, /* @__PURE__ */ React.createElement(ControlPage, null, /* @__PURE__ */ React.createElement(ControlSection, {
53
- title: t("devices verbose label", {
54
- ns: meta.id
55
- }),
56
- description: t("devices description", {
57
- ns: meta.id
58
- })
59
- }, /* @__PURE__ */ React.createElement(ControlFrame, null, /* @__PURE__ */ React.createElement(ControlFrameItem, {
60
- title: t("devices label", {
61
- ns: meta.id
62
- })
63
- }, /* @__PURE__ */ React.createElement(List, null, devices.map((device) => {
64
- return /* @__PURE__ */ React.createElement(DeviceListItem, {
65
- key: device.deviceKey.toHex(),
66
- device,
67
- connectionState
68
- });
69
- }))), createInvitationUrl && /* @__PURE__ */ React.createElement(ControlFrameItem, {
70
- title: "Add device"
71
- }, /* @__PURE__ */ React.createElement(DeviceInvitation, {
72
- createInvitationUrl
73
- })))), /* @__PURE__ */ React.createElement(ControlSection, {
74
- title: t("danger zone title", {
75
- ns: meta.id
76
- }),
77
- description: t("danger zone description", {
78
- ns: meta.id
79
- })
80
- }, /* @__PURE__ */ React.createElement(ControlGroup, null, /* @__PURE__ */ React.createElement(ControlItem, {
81
- title: t("reset device label"),
82
- description: t("reset device description", {
83
- ns: meta.id
84
- })
85
- }, /* @__PURE__ */ React.createElement(Button, {
86
- variant: "destructive",
87
- onClick: handleResetStorage,
88
- "data-testid": "devicesContainer.reset"
89
- }, t("reset device label"))), /* @__PURE__ */ React.createElement(ControlItem, {
90
- title: t("recover identity label"),
91
- description: t("recover identity description", {
92
- ns: meta.id
93
- })
94
- }, /* @__PURE__ */ React.createElement(Button, {
95
- variant: "destructive",
96
- onClick: handleRecover,
97
- "data-testid": "devicesContainer.recover"
98
- }, t("recover identity label"))), /* @__PURE__ */ React.createElement(ControlItem, {
99
- title: t("join new identity label"),
100
- description: t("join new identity description", {
101
- ns: meta.id
102
- })
103
- }, /* @__PURE__ */ React.createElement(Button, {
104
- variant: "destructive",
105
- onClick: handleJoinNewIdentity,
106
- "data-testid": "devicesContainer.joinExisting"
107
- }, t("join new identity label")))))));
108
- };
109
- var DeviceInvitation = (props) => {
110
- const client = useClient();
111
- const [invitation, setInvitation] = useState();
112
- const onInvitationCreate = useCallback(() => {
113
- const invitation2 = client.halo.share();
114
- if (client.config.values.runtime?.app?.env?.DX_ENVIRONMENT !== "production") {
115
- const subscription = invitation2.subscribe((invitation3) => {
116
- const invitationCode = InvitationEncoder.encode(invitation3);
117
- if (invitation3.state === Invitation.State.CONNECTING) {
118
- log.info(JSON.stringify({
119
- invitationCode,
120
- authCode: invitation3.authCode
121
- }), void 0, {
122
- F: __dxlog_file,
123
- L: 127,
124
- S: void 0,
125
- C: (f, a) => f(...a)
126
- });
127
- subscription.unsubscribe();
128
- }
129
- });
130
- }
131
- setInvitation(invitation2);
132
- }, [
133
- client
134
- ]);
135
- const onInvitationDone = useCallback(() => {
136
- setInvitation(void 0);
137
- }, []);
138
- if (invitation) {
139
- return /* @__PURE__ */ React.createElement(DeviceInvitationImpl, {
140
- ...props,
141
- invitation,
142
- onInvitationCreate,
143
- onInvitationDone
144
- });
145
- } else {
146
- return /* @__PURE__ */ React.createElement(InvitationSection, {
147
- ...props,
148
- onInvitationCreate,
149
- onInvitationDone
150
- });
151
- }
152
- };
153
- var DeviceInvitationImpl = ({ invitation: invitationObservable, createInvitationUrl, onInvitationDone, onInvitationCreate }) => {
154
- const invitation = useMulticastObservable(invitationObservable);
155
- const url = createInvitationUrl(InvitationEncoder.encode(invitation));
156
- useEffect(() => {
157
- if (invitation.state >= Invitation.State.SUCCESS) {
158
- onInvitationDone();
159
- }
160
- }, [
161
- invitation.state
162
- ]);
163
- return /* @__PURE__ */ React.createElement(InvitationSection, {
164
- ...invitation,
165
- url,
166
- onInvitationDone,
167
- onInvitationCreate
168
- });
169
- };
170
- var InvitationSection = ({ state = -1, authCode, invitationId = "never", url = "never", onInvitationDone = () => {
171
- }, onInvitationCreate = () => {
172
- } }) => {
173
- const { t } = useTranslation(meta.id);
174
- const activeView = state < 0 ? "init" : state >= Invitation.State.CANCELLED ? "complete" : state >= Invitation.State.READY_FOR_AUTHENTICATION && authCode ? "auth-code" : "qr-code";
175
- return activeView === "init" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", {
176
- className: "text-description mbe-2"
177
- }, t("add device description")), /* @__PURE__ */ React.createElement(IconButton, {
178
- icon: "ph--plus--regular",
179
- label: t("create device invitation label"),
180
- disabled: state >= 0,
181
- classNames: "is-full",
182
- "data-testid": "devicesContainer.createInvitation",
183
- onClick: onInvitationCreate
184
- })) : /* @__PURE__ */ React.createElement(Viewport.Root, {
185
- activeView
186
- }, /* @__PURE__ */ React.createElement(Viewport.Views, null, /* @__PURE__ */ React.createElement(Viewport.View, {
187
- id: "init"
188
- }), /* @__PURE__ */ React.createElement(Viewport.View, {
189
- id: "complete"
190
- }, /* @__PURE__ */ React.createElement(InvitationComplete, {
191
- statusValue: state
192
- })), /* @__PURE__ */ React.createElement(Viewport.View, {
193
- id: "auth-code"
194
- }, /* @__PURE__ */ React.createElement(InvitationAuthCode, {
195
- id: invitationId,
196
- code: authCode ?? "never",
197
- onCancel: onInvitationDone
198
- })), /* @__PURE__ */ React.createElement(Viewport.View, {
199
- id: "qr-code"
200
- }, /* @__PURE__ */ React.createElement(InvitationQR, {
201
- id: invitationId,
202
- url,
203
- onCancel: onInvitationDone
204
- }))));
205
- };
206
- var InvitationQR = ({ id, url, onCancel }) => {
207
- const { t } = useTranslation(osTranslations);
208
- const qrLabel = useId("devices-container__qr-code");
209
- const emoji = hexToEmoji(id);
210
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", {
211
- className: "text-description"
212
- }, t("qr code description", {
213
- ns: meta.id
214
- })), /* @__PURE__ */ React.createElement("div", {
215
- role: "group",
216
- className: "grid grid-cols-[1fr_min-content] mlb-2 gap-2"
217
- }, /* @__PURE__ */ React.createElement("div", {
218
- role: "none",
219
- className: "is-full aspect-square relative text-description"
220
- }, /* @__PURE__ */ React.createElement(QR, {
221
- rounding: 100,
222
- backgroundColor: "transparent",
223
- color: "currentColor",
224
- "aria-labelledby": qrLabel,
225
- errorCorrectionLevel: "Q",
226
- cutout: true
227
- }, url ?? "never"), /* @__PURE__ */ React.createElement(Centered, null, /* @__PURE__ */ React.createElement(Emoji, {
228
- text: emoji
229
- }))), /* @__PURE__ */ React.createElement("span", {
230
- id: qrLabel,
231
- className: "sr-only"
232
- }, t("qr label"))), /* @__PURE__ */ React.createElement("div", {
233
- className: "flex justify-center"
234
- }, /* @__PURE__ */ React.createElement("div", {
235
- className: "flex gap-2"
236
- }, /* @__PURE__ */ React.createElement(Clipboard.Button, {
237
- value: url ?? "never"
238
- }), /* @__PURE__ */ React.createElement(Button, {
239
- variant: "ghost",
240
- onClick: onCancel
241
- }, t("cancel label")))));
242
- };
243
- var InvitationAuthCode = ({ id, code, onCancel }) => {
244
- const { t } = useTranslation(osTranslations);
245
- const emoji = hexToEmoji(id);
246
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", {
247
- className: "text-description"
248
- }, t("auth other device emoji message")), emoji && /* @__PURE__ */ React.createElement(Emoji, {
249
- text: emoji,
250
- className: "mli-auto mlb-2 text-center"
251
- }), /* @__PURE__ */ React.createElement("p", {
252
- className: "text-description"
253
- }, t("auth code message")), /* @__PURE__ */ React.createElement(AuthCode, {
254
- code,
255
- large: true,
256
- classNames: "mli-auto mlb-2 text-center grow"
257
- }), /* @__PURE__ */ React.createElement(Button, {
258
- variant: "ghost",
259
- onClick: onCancel
260
- }, t("cancel label")));
261
- };
262
- var InvitationComplete = ({ statusValue }) => {
263
- return statusValue > 0 ? /* @__PURE__ */ React.createElement(Icon, {
264
- icon: "ph--check--regular",
265
- size: 6,
266
- classNames: "m-1.5"
267
- }) : /* @__PURE__ */ React.createElement(Icon, {
268
- icon: "ph--x--regular",
269
- size: 6,
270
- classNames: "m-1.5"
271
- });
272
- };
273
-
274
- // src/components/JoinDialog.tsx
275
- import React2, { useCallback as useCallback2 } from "react";
276
- import { Common } from "@dxos/app-framework";
277
- import { useOperationInvoker as useOperationInvoker2 } from "@dxos/app-framework/react";
278
- import { ObservabilityOperation } from "@dxos/plugin-observability/types";
279
- import { Dialog, useTranslation as useTranslation2 } from "@dxos/react-ui";
280
- import { JoinPanel } from "@dxos/shell/react";
281
- import { osTranslations as osTranslations2 } from "@dxos/ui-theme";
282
- var JoinDialog = (props) => {
283
- const { invokePromise } = useOperationInvoker2();
284
- const { t } = useTranslation2(meta.id);
285
- const handleCancelResetStorage = useCallback2(() => invokePromise(ClientOperation.ShareIdentity), [
286
- invokePromise
287
- ]);
288
- const handleDone = useCallback2(async (result) => {
289
- if (result?.identityKey) {
290
- await Promise.all([
291
- invokePromise(Common.LayoutOperation.UpdateDialog, {
292
- state: false
293
- }),
294
- invokePromise(ObservabilityOperation.SendEvent, {
295
- name: props.initialDisposition === "recover-identity" ? "identity.recover" : "identity.join"
296
- })
297
- ]);
298
- }
299
- }, [
300
- invokePromise
301
- ]);
302
- return /* @__PURE__ */ React2.createElement(Dialog.Content, null, /* @__PURE__ */ React2.createElement(Dialog.Title, {
303
- classNames: "sr-only"
304
- }, t("join space label", {
305
- ns: osTranslations2
306
- })), /* @__PURE__ */ React2.createElement(JoinPanel, {
307
- mode: "halo-only",
308
- ...props,
309
- exitActionParent: /* @__PURE__ */ React2.createElement(Dialog.Close, {
310
- asChild: true
311
- }),
312
- doneActionParent: /* @__PURE__ */ React2.createElement(Dialog.Close, {
313
- asChild: true
314
- }),
315
- onCancelResetStorage: handleCancelResetStorage,
316
- onDone: handleDone
317
- }));
318
- };
319
-
320
- // src/components/ProfileContainer.tsx
321
- import * as Schema from "effect/Schema";
322
- import React3, { useCallback as useCallback3, useMemo, useState as useState2 } from "react";
323
- import { debounce } from "@dxos/async";
324
- import { useClient as useClient2 } from "@dxos/react-client";
325
- import { useIdentity } from "@dxos/react-client/halo";
326
- import { ButtonGroup, Clipboard as Clipboard2, Input, useTranslation as useTranslation3 } from "@dxos/react-ui";
327
- import { ControlItem as ControlItem2, ControlItemInput, ControlPage as ControlPage2, ControlSection as ControlSection2, Form } from "@dxos/react-ui-form";
328
- import { EmojiPickerBlock, HuePicker } from "@dxos/react-ui-pickers";
329
- import { hexToEmoji as hexToEmoji2, hexToHue } from "@dxos/util";
330
- var UserProfile = Schema.Struct({
331
- did: Schema.String.annotations({
332
- title: "DID"
333
- }),
334
- displayName: Schema.String.annotations({
335
- title: "Display name"
336
- }),
337
- emoji: Schema.String.annotations({
338
- title: "Avatar"
339
- }),
340
- hue: Schema.String.annotations({
341
- title: "Color"
342
- })
343
- });
344
- var getDefaultHueValue = (identity) => hexToHue(identity?.identityKey.toHex() ?? "0");
345
- var getHueValue = (identity) => identity?.profile?.data?.hue || getDefaultHueValue(identity);
346
- var getDefaultEmojiValue = (identity) => hexToEmoji2(identity?.identityKey.toHex() ?? "0");
347
- var getEmojiValue = (identity) => identity?.profile?.data?.emoji || getDefaultEmojiValue(identity);
348
- var ProfileContainer = () => {
349
- const { t } = useTranslation3(meta.id);
350
- const client = useClient2();
351
- const identity = useIdentity();
352
- const [displayName, setDisplayNameDirectly] = useState2(identity?.profile?.displayName ?? "");
353
- const [emoji, setEmojiDirectly] = useState2(getEmojiValue(identity));
354
- const [hue, setHueDirectly] = useState2(getHueValue(identity));
355
- const updateProfile = useMemo(() => debounce((profile) => client.halo.updateProfile({
356
- displayName: profile.displayName,
357
- data: {
358
- emoji: profile.emoji,
359
- hue: profile.hue
360
- }
361
- }), 2e3), []);
362
- const handleChange = useCallback3((profile, meta2) => {
363
- for (const [path, changed] of Object.entries(meta2.changed)) {
364
- if (changed) {
365
- switch (path) {
366
- case "displayName":
367
- setDisplayNameDirectly(profile.displayName ?? "");
368
- break;
369
- case "emoji":
370
- setEmojiDirectly(profile.emoji ?? getDefaultEmojiValue(identity));
371
- break;
372
- case "hue":
373
- setHueDirectly(profile.hue ?? getDefaultHueValue(identity));
374
- break;
375
- default:
376
- break;
377
- }
378
- }
379
- }
380
- void updateProfile(profile);
381
- }, [
382
- identity
383
- ]);
384
- const values = useMemo(() => ({
385
- did: identity?.did,
386
- displayName,
387
- emoji,
388
- hue
389
- }), [
390
- identity,
391
- displayName,
392
- emoji,
393
- hue
394
- ]);
395
- const fieldMap = useMemo(() => ({
396
- displayName: ({ type, label, getValue, onValueChange }) => {
397
- const handleChange2 = useCallback3(({ target: { value } }) => onValueChange(type, value), [
398
- onValueChange,
399
- type
400
- ]);
401
- return /* @__PURE__ */ React3.createElement(ControlItemInput, {
402
- title: label,
403
- description: t("display name description")
404
- }, /* @__PURE__ */ React3.createElement(Input.TextInput, {
405
- value: getValue(),
406
- onChange: handleChange2,
407
- placeholder: t("display name input placeholder"),
408
- classNames: "min-is-64"
409
- }));
410
- },
411
- emoji: ({ type, label, getValue, onValueChange }) => {
412
- const handleChange2 = useCallback3((nextEmoji) => onValueChange(type, nextEmoji), [
413
- onValueChange,
414
- type
415
- ]);
416
- const handleEmojiReset = useCallback3(() => onValueChange(type, getDefaultEmojiValue(identity)), [
417
- onValueChange,
418
- type
419
- ]);
420
- return /* @__PURE__ */ React3.createElement(ControlItem2, {
421
- title: label,
422
- description: t("icon description")
423
- }, /* @__PURE__ */ React3.createElement(EmojiPickerBlock, {
424
- triggerVariant: "default",
425
- emoji: getValue(),
426
- onChangeEmoji: handleChange2,
427
- onClickClear: handleEmojiReset,
428
- classNames: "justify-self-end"
429
- }));
430
- },
431
- hue: ({ type, label, getValue, onValueChange }) => {
432
- const handleChange2 = useCallback3((nextHue) => onValueChange(type, nextHue), [
433
- onValueChange,
434
- type
435
- ]);
436
- const handleHueReset = useCallback3(() => onValueChange(type, getDefaultHueValue(identity)), [
437
- onValueChange,
438
- type
439
- ]);
440
- return /* @__PURE__ */ React3.createElement(ControlItem2, {
441
- title: label,
442
- description: t("hue description")
443
- }, /* @__PURE__ */ React3.createElement("div", {
444
- role: "none",
445
- className: "flex justify-self-end"
446
- }, /* @__PURE__ */ React3.createElement(HuePicker, {
447
- value: getValue(),
448
- onChange: handleChange2,
449
- onReset: handleHueReset
450
- })));
451
- },
452
- // TODO(wittjosiah): We need text input annotations for disabled and copyable.
453
- did: ({ label, getValue }) => {
454
- return /* @__PURE__ */ React3.createElement(ControlItemInput, {
455
- title: label,
456
- description: t("did description")
457
- }, /* @__PURE__ */ React3.createElement(ButtonGroup, null, /* @__PURE__ */ React3.createElement(Input.TextInput, {
458
- value: getValue(),
459
- disabled: true,
460
- classNames: "min-is-64"
461
- }), /* @__PURE__ */ React3.createElement(Clipboard2.IconButton, {
462
- value: getValue() ?? ""
463
- })));
464
- }
465
- }), [
466
- t
467
- ]);
468
- return /* @__PURE__ */ React3.createElement(ControlPage2, null, /* @__PURE__ */ React3.createElement(Clipboard2.Provider, null, /* @__PURE__ */ React3.createElement(ControlSection2, {
469
- title: t("profile label"),
470
- description: t("profile description")
471
- }, /* @__PURE__ */ React3.createElement(Form.Root, {
472
- schema: UserProfile,
473
- values,
474
- fieldMap,
475
- onValuesChanged: handleChange
476
- }, /* @__PURE__ */ React3.createElement(Form.Content, null, /* @__PURE__ */ React3.createElement(Form.FieldSet, {
477
- classNames: "container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]"
478
- }))))));
479
- };
480
-
481
- // src/components/RecoveryCodeDialog.tsx
482
- import React4, { useCallback as useCallback4, useState as useState3 } from "react";
483
- import { AlertDialog, Button as Button2, Clipboard as Clipboard3, Input as Input2, useTranslation as useTranslation4 } from "@dxos/react-ui";
484
- var RecoveryCodeDialog = ({ code }) => {
485
- const { t } = useTranslation4(meta.id);
486
- const [confirmation, setConfirmation] = useState3(false);
487
- const handleConfirmation = useCallback4((checked) => setConfirmation(checked), []);
488
- return /* @__PURE__ */ React4.createElement(AlertDialog.Content, {
489
- classNames: "bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
490
- }, /* @__PURE__ */ React4.createElement(AlertDialog.Title, null, t("recovery code dialog title")), /* @__PURE__ */ React4.createElement("p", {
491
- className: "plb-4"
492
- }, t("recovery code dialog description")), /* @__PURE__ */ React4.createElement(Clipboard3.Provider, null, /* @__PURE__ */ React4.createElement(Code, {
493
- code
494
- })), /* @__PURE__ */ React4.createElement("div", {
495
- className: "flex flex-col plb-4 gap-2"
496
- }, /* @__PURE__ */ React4.createElement("p", null, t("recovery code dialog warning 1")), /* @__PURE__ */ React4.createElement("p", null, t("recovery code dialog warning 2"))), /* @__PURE__ */ React4.createElement("div", {
497
- className: "flex items-center gap-2 pbe-4"
498
- }, /* @__PURE__ */ React4.createElement(Input2.Root, null, /* @__PURE__ */ React4.createElement(Input2.Checkbox, {
499
- "data-testid": "recoveryCode.confirm",
500
- checked: confirmation,
501
- onCheckedChange: handleConfirmation
502
- }), /* @__PURE__ */ React4.createElement(Input2.Label, null, t("recovery code confirmation label")))), /* @__PURE__ */ React4.createElement("div", {
503
- className: "flex justify-end"
504
- }, /* @__PURE__ */ React4.createElement(AlertDialog.Action, {
505
- asChild: true
506
- }, /* @__PURE__ */ React4.createElement(Button2, {
507
- "data-testid": "recoveryCode.continue",
508
- variant: "primary",
509
- disabled: !confirmation
510
- }, t("continue label")))));
511
- };
512
- var Code = ({ code }) => {
513
- const words = code.split(" ");
514
- return /* @__PURE__ */ React4.createElement("div", {
515
- className: "relative p-2 border border-separator rounded group"
516
- }, /* @__PURE__ */ React4.createElement(Clipboard3.IconButton, {
517
- value: code,
518
- classNames: "absolute top-2 right-2 invisible group-hover:visible"
519
- }), /* @__PURE__ */ React4.createElement("div", {
520
- className: "grid grid-cols-4"
521
- }, words.map((word, i) => /* @__PURE__ */ React4.createElement("div", {
522
- key: i,
523
- className: "flex items-center p-2 gap-2"
524
- }, /* @__PURE__ */ React4.createElement("div", {
525
- className: "is-4 text-xs text-center text-subdued"
526
- }, i + 1), /* @__PURE__ */ React4.createElement("div", {
527
- className: "text-sm"
528
- }, word)))));
529
- };
530
-
531
- // src/components/RecoveryCredentialsContainer.tsx
532
- import React5 from "react";
533
- import { useOperationInvoker as useOperationInvoker3 } from "@dxos/app-framework/react";
534
- import { useCredentials } from "@dxos/react-client/halo";
535
- import { Icon as Icon2, IconButton as IconButton2, List as List2, ListItem, Message, useTranslation as useTranslation5 } from "@dxos/react-ui";
536
- import { ControlGroup as ControlGroup2, ControlItem as ControlItem3, ControlPage as ControlPage3, ControlSection as ControlSection3 } from "@dxos/react-ui-form";
537
- var MANAGE_CREDENTIALS_DIALOG = `${meta.id}/ManageCredentialsDialog`;
538
- var RecoveryCredentialsContainer = () => {
539
- const { t } = useTranslation5(meta.id);
540
- const { invokePromise } = useOperationInvoker3();
541
- const credentials = useCredentials();
542
- const recoveryCredentials = credentials.filter((credential) => credential.subject.assertion["@type"] === "dxos.halo.credentials.IdentityRecovery");
543
- return /* @__PURE__ */ React5.createElement(ControlPage3, null, /* @__PURE__ */ React5.createElement(ControlSection3, {
544
- title: t("recovery setup dialog title"),
545
- description: t("recovery setup dialog description")
546
- }, /* @__PURE__ */ React5.createElement(ControlGroup2, null, /* @__PURE__ */ React5.createElement(ControlItem3, {
547
- title: t("create passkey label"),
548
- description: t("create passkey description")
549
- }, /* @__PURE__ */ React5.createElement(IconButton2, {
550
- label: t("create passkey label"),
551
- icon: "ph--key--duotone",
552
- variant: "primary",
553
- onClick: () => invokePromise(ClientOperation.CreatePasskey)
554
- })), /* @__PURE__ */ React5.createElement(ControlItem3, {
555
- title: t("create recovery code label"),
556
- description: t("create recovery code description")
557
- }, /* @__PURE__ */ React5.createElement(IconButton2, {
558
- label: t("create recovery code label"),
559
- icon: "ph--receipt--duotone",
560
- variant: "default",
561
- onClick: () => invokePromise(ClientOperation.CreateRecoveryCode)
562
- })))), /* @__PURE__ */ React5.createElement(ControlSection3, {
563
- title: t("credentials list label")
564
- }, recoveryCredentials.length < 1 ? /* @__PURE__ */ React5.createElement(Message.Root, {
565
- valence: "error",
566
- classNames: "container-max-width"
567
- }, /* @__PURE__ */ React5.createElement(Message.Title, {
568
- icon: "ph--shield-warning--duotone"
569
- }, t("no credentials title")), /* @__PURE__ */ React5.createElement(Message.Content, null, t("no credentials message"))) : /* @__PURE__ */ React5.createElement(List2, {
570
- classNames: "container-max-width pli-2"
571
- }, recoveryCredentials.map((credential) => /* @__PURE__ */ React5.createElement(ListItem.Root, {
572
- key: credential.id?.toHex()
573
- }, /* @__PURE__ */ React5.createElement(ListItem.Endcap, null, /* @__PURE__ */ React5.createElement(Icon2, {
574
- icon: "ph--key--regular"
575
- })), /* @__PURE__ */ React5.createElement(ListItem.Heading, null, credential.issuanceDate.toLocaleString()))))));
576
- };
577
-
578
- // src/components/ResetDialog.tsx
579
- import * as Effect from "effect/Effect";
580
- import React6, { useCallback as useCallback5 } from "react";
581
- import { Capability, Common as Common2 } from "@dxos/app-framework";
582
- import { useOperationInvoker as useOperationInvoker4 } from "@dxos/app-framework/react";
583
- import { runAndForwardErrors } from "@dxos/effect";
584
- import { useClient as useClient3 } from "@dxos/react-client";
585
- import { Dialog as Dialog2, useTranslation as useTranslation6 } from "@dxos/react-ui";
586
- import { ConfirmReset } from "@dxos/shell/react";
587
- var ResetDialog = ({ mode, onReset, capabilityManager }) => {
588
- const { t } = useTranslation6(meta.id);
589
- const { invokePromise } = useOperationInvoker4();
590
- const client = useClient3();
591
- const handleReset = useCallback5(async () => {
592
- await client.reset();
593
- const target = mode === "join new identity" ? "deviceInvitation" : mode === "recover" ? "recoverIdentity" : void 0;
594
- if (onReset) {
595
- await runAndForwardErrors(onReset({
596
- target
597
- }).pipe(Effect.provideService(Capability.Service, capabilityManager)));
598
- }
599
- }, [
600
- client,
601
- mode,
602
- onReset,
603
- capabilityManager
604
- ]);
605
- const handleCancel = useCallback5(() => {
606
- void invokePromise(Common2.LayoutOperation.UpdateDialog, {
607
- state: false
608
- });
609
- }, [
610
- invokePromise
611
- ]);
612
- return /* @__PURE__ */ React6.createElement(Dialog2.Content, null, /* @__PURE__ */ React6.createElement(Dialog2.Title, {
613
- classNames: "sr-only"
614
- }, t("reset dialog title")), /* @__PURE__ */ React6.createElement(Dialog2.Description, {
615
- classNames: "sr-only"
616
- }, t("reset dialog description")), /* @__PURE__ */ React6.createElement(ConfirmReset, {
617
- active: true,
618
- mode,
619
- onConfirm: handleReset,
620
- onCancel: handleCancel
621
- }));
622
- };
623
-
624
- // src/capabilities/react-surface/react-surface.tsx
625
- var react_surface_default = Capability2.makeModule(Effect2.fnUntraced(function* (props) {
626
- const { createInvitationUrl, onReset } = props;
627
- const capabilityManager = yield* Capability2.Service;
628
- return Capability2.contributes(Common3.Capability.ReactSurface, [
629
- Common3.createSurface({
630
- id: Account.Profile,
631
- role: "article",
632
- filter: (data) => data.subject === Account.Profile,
633
- component: () => /* @__PURE__ */ React7.createElement(ProfileContainer, null)
634
- }),
635
- Common3.createSurface({
636
- id: Account.Devices,
637
- role: "article",
638
- filter: (data) => data.subject === Account.Devices,
639
- component: () => /* @__PURE__ */ React7.createElement(DevicesContainer, {
640
- createInvitationUrl
641
- })
642
- }),
643
- Common3.createSurface({
644
- id: Account.Security,
645
- role: "article",
646
- filter: (data) => data.subject === Account.Security,
647
- component: () => /* @__PURE__ */ React7.createElement(RecoveryCredentialsContainer, null)
648
- }),
649
- Common3.createSurface({
650
- id: JOIN_DIALOG,
651
- role: "dialog",
652
- filter: (data) => data.component === JOIN_DIALOG,
653
- component: ({ data }) => /* @__PURE__ */ React7.createElement(JoinDialog, data.props)
654
- }),
655
- Common3.createSurface({
656
- id: RECOVERY_CODE_DIALOG,
657
- role: "dialog",
658
- filter: (data) => data.component === RECOVERY_CODE_DIALOG,
659
- component: ({ data }) => /* @__PURE__ */ React7.createElement(RecoveryCodeDialog, data.props)
660
- }),
661
- Common3.createSurface({
662
- id: RESET_DIALOG,
663
- role: "dialog",
664
- filter: (data) => data.component === RESET_DIALOG,
665
- component: ({ data }) => /* @__PURE__ */ React7.createElement(ResetDialog, {
666
- ...data.props,
667
- onReset,
668
- capabilityManager
669
- })
670
- })
671
- ]);
672
- }));
673
- export {
674
- react_surface_default as default
675
- };
676
- //# sourceMappingURL=react-surface-KBHANGGC.mjs.map