@dxos/plugin-client 0.8.4-main.c4373fc → 0.8.4-main.c85a9c8dae
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/DevicesContainer-46MEG3F5.mjs +268 -0
- package/dist/lib/browser/DevicesContainer-46MEG3F5.mjs.map +7 -0
- package/dist/lib/browser/JoinDialog-2RCYK4O5.mjs +59 -0
- package/dist/lib/browser/JoinDialog-2RCYK4O5.mjs.map +7 -0
- package/dist/lib/browser/ProfileContainer-XYRCOQ5I.mjs +171 -0
- package/dist/lib/browser/ProfileContainer-XYRCOQ5I.mjs.map +7 -0
- package/dist/lib/browser/RecoveryCodeDialog-EX2CLFND.mjs +60 -0
- package/dist/lib/browser/RecoveryCodeDialog-EX2CLFND.mjs.map +7 -0
- package/dist/lib/browser/RecoveryCredentialsContainer-RWTEIHOB.mjs +57 -0
- package/dist/lib/browser/RecoveryCredentialsContainer-RWTEIHOB.mjs.map +7 -0
- package/dist/lib/browser/ResetDialog-W24FOWBQ.mjs +52 -0
- package/dist/lib/browser/ResetDialog-W24FOWBQ.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-QJWFLYZE.mjs +121 -0
- package/dist/lib/browser/app-graph-builder-QJWFLYZE.mjs.map +7 -0
- package/dist/lib/browser/chunk-4XYOOXAH.mjs +18 -0
- package/dist/lib/browser/chunk-4XYOOXAH.mjs.map +7 -0
- package/dist/lib/browser/chunk-DPAXDXMK.mjs +283 -0
- package/dist/lib/browser/chunk-DPAXDXMK.mjs.map +7 -0
- package/dist/lib/browser/chunk-N2GMSVDQ.mjs +15 -0
- package/dist/lib/browser/chunk-N2GMSVDQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-VYX3ROUX.mjs +15 -0
- package/dist/lib/browser/chunk-VYX3ROUX.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +1051 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/client-Z25GQ5YC.mjs +86 -0
- package/dist/lib/browser/client-Z25GQ5YC.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +77 -84
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/migrations-HLHRMOW6.mjs +25 -0
- package/dist/lib/browser/migrations-HLHRMOW6.mjs.map +7 -0
- package/dist/lib/browser/operation-resolver-6QW3BKA5.mjs +299 -0
- package/dist/lib/browser/operation-resolver-6QW3BKA5.mjs.map +7 -0
- package/dist/lib/browser/react-context-E7TAJMDK.mjs +26 -0
- package/dist/lib/browser/react-context-E7TAJMDK.mjs.map +7 -0
- package/dist/lib/browser/react-surface-L5A2LBFE.mjs +77 -0
- package/dist/lib/browser/react-surface-L5A2LBFE.mjs.map +7 -0
- package/dist/lib/browser/schema-defs-5WDZWVEI.mjs +28 -0
- package/dist/lib/browser/schema-defs-5WDZWVEI.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -4
- package/dist/lib/node-esm/DevicesContainer-WQ3DQA45.mjs +269 -0
- package/dist/lib/node-esm/DevicesContainer-WQ3DQA45.mjs.map +7 -0
- package/dist/lib/node-esm/JoinDialog-KLTNJY5F.mjs +60 -0
- package/dist/lib/node-esm/JoinDialog-KLTNJY5F.mjs.map +7 -0
- package/dist/lib/node-esm/ProfileContainer-XI425QK5.mjs +172 -0
- package/dist/lib/node-esm/ProfileContainer-XI425QK5.mjs.map +7 -0
- package/dist/lib/node-esm/RecoveryCodeDialog-AISRNJUM.mjs +61 -0
- package/dist/lib/node-esm/RecoveryCodeDialog-AISRNJUM.mjs.map +7 -0
- package/dist/lib/node-esm/RecoveryCredentialsContainer-3TKQRPQK.mjs +58 -0
- package/dist/lib/node-esm/RecoveryCredentialsContainer-3TKQRPQK.mjs.map +7 -0
- package/dist/lib/node-esm/ResetDialog-GGBWSQZO.mjs +54 -0
- package/dist/lib/node-esm/ResetDialog-GGBWSQZO.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-6JD6BZAI.mjs +122 -0
- package/dist/lib/node-esm/app-graph-builder-6JD6BZAI.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-H2CCMM4Z.mjs +20 -0
- package/dist/lib/node-esm/chunk-H2CCMM4Z.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HKSNTZF5.mjs +16 -0
- package/dist/lib/node-esm/chunk-HKSNTZF5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-RGULICLJ.mjs +17 -0
- package/dist/lib/node-esm/chunk-RGULICLJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VEUNEDN5.mjs +284 -0
- package/dist/lib/node-esm/chunk-VEUNEDN5.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +1052 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/client-5AIPYSBT.mjs +87 -0
- package/dist/lib/node-esm/client-5AIPYSBT.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +77 -84
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/migrations-O5KG2GGN.mjs +26 -0
- package/dist/lib/node-esm/migrations-O5KG2GGN.mjs.map +7 -0
- package/dist/lib/node-esm/operation-resolver-GSH7AOTZ.mjs +300 -0
- package/dist/lib/node-esm/operation-resolver-GSH7AOTZ.mjs.map +7 -0
- package/dist/lib/node-esm/{react-context-4SZYNSIS.mjs → react-context-OMJSBS23.mjs} +9 -7
- package/dist/lib/node-esm/react-context-OMJSBS23.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-N3BSPMMX.mjs +78 -0
- package/dist/lib/node-esm/react-surface-N3BSPMMX.mjs.map +7 -0
- package/dist/lib/node-esm/schema-defs-ENOYSDP3.mjs +29 -0
- package/dist/lib/node-esm/schema-defs-ENOYSDP3.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +10 -4
- package/dist/types/src/ClientPlugin.d.ts +2 -1
- package/dist/types/src/ClientPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/client/client.d.ts +8 -0
- package/dist/types/src/capabilities/client/client.d.ts.map +1 -0
- package/dist/types/src/capabilities/client/index.d.ts +18 -0
- package/dist/types/src/capabilities/client/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +7 -19
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/migrations/index.d.ts +3 -0
- package/dist/types/src/capabilities/migrations/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/migrations/migrations.d.ts +5 -0
- package/dist/types/src/capabilities/migrations/migrations.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +8 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context/index.d.ts +7 -0
- package/dist/types/src/capabilities/react-context/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts +10 -0
- package/dist/types/src/capabilities/react-context/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +9 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/schema-defs/index.d.ts +3 -0
- package/dist/types/src/capabilities/schema-defs/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/schema-defs/schema-defs.d.ts +5 -0
- package/dist/types/src/capabilities/schema-defs/schema-defs.d.ts.map +1 -0
- package/dist/types/src/cli/commands/config/index.d.ts +5 -0
- package/dist/types/src/cli/commands/config/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/config/view.d.ts +5 -0
- package/dist/types/src/cli/commands/config/view.d.ts.map +1 -0
- package/dist/types/src/cli/commands/device/index.d.ts +7 -0
- package/dist/types/src/cli/commands/device/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/device/info/index.d.ts +2 -0
- package/dist/types/src/cli/commands/device/info/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/device/info/info.d.ts +7 -0
- package/dist/types/src/cli/commands/device/info/info.d.ts.map +1 -0
- package/dist/types/src/cli/commands/device/info/info.test.d.ts +2 -0
- package/dist/types/src/cli/commands/device/info/info.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/device/list/index.d.ts +2 -0
- package/dist/types/src/cli/commands/device/list/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/device/list/list.d.ts +7 -0
- package/dist/types/src/cli/commands/device/list/list.d.ts.map +1 -0
- package/dist/types/src/cli/commands/device/list/list.test.d.ts +2 -0
- package/dist/types/src/cli/commands/device/list/list.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/device/update/index.d.ts +2 -0
- package/dist/types/src/cli/commands/device/update/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/device/update/update.d.ts +11 -0
- package/dist/types/src/cli/commands/device/update/update.d.ts.map +1 -0
- package/dist/types/src/cli/commands/device/util.d.ts +16 -0
- package/dist/types/src/cli/commands/device/util.d.ts.map +1 -0
- package/dist/types/src/cli/commands/edge/index.d.ts +5 -0
- package/dist/types/src/cli/commands/edge/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/edge/status.d.ts +7 -0
- package/dist/types/src/cli/commands/edge/status.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/create/create.d.ts +15 -0
- package/dist/types/src/cli/commands/halo/create/create.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/create/create.test.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/create/create.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/create/index.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/create/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/credential/add/add.d.ts +13 -0
- package/dist/types/src/cli/commands/halo/credential/add/add.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/credential/add/index.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/credential/add/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/credential/index.d.ts +12 -0
- package/dist/types/src/cli/commands/halo/credential/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/credential/list/index.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/credential/list/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/credential/list/list.d.ts +19 -0
- package/dist/types/src/cli/commands/halo/credential/list/list.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/credential/list/list.test.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/credential/list/list.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/identity/identity.d.ts +7 -0
- package/dist/types/src/cli/commands/halo/identity/identity.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/identity/identity.test.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/identity/identity.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/identity/index.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/identity/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/index.d.ts +3 -0
- package/dist/types/src/cli/commands/halo/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/join/index.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/join/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/join/join.d.ts +8 -0
- package/dist/types/src/cli/commands/halo/join/join.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/join/join.test.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/join/join.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/keys/index.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/keys/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/keys/keys.d.ts +7 -0
- package/dist/types/src/cli/commands/halo/keys/keys.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/keys/keys.test.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/keys/keys.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/recover/index.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/recover/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/recover/recover.d.ts +7 -0
- package/dist/types/src/cli/commands/halo/recover/recover.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/recover/recover.test.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/recover/recover.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/seed/index.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/seed/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/seed/seed.d.ts +7 -0
- package/dist/types/src/cli/commands/halo/seed/seed.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/share/index.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/share/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/share/share.d.ts +15 -0
- package/dist/types/src/cli/commands/halo/share/share.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/update/index.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/update/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/update/update.d.ts +11 -0
- package/dist/types/src/cli/commands/halo/update/update.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/update/update.test.d.ts +2 -0
- package/dist/types/src/cli/commands/halo/update/update.test.d.ts.map +1 -0
- package/dist/types/src/cli/commands/halo/util.d.ts +13 -0
- package/dist/types/src/cli/commands/halo/util.d.ts.map +1 -0
- package/dist/types/src/cli/commands/index.d.ts +6 -0
- package/dist/types/src/cli/commands/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/profile/create.d.ts +9 -0
- package/dist/types/src/cli/commands/profile/create.d.ts.map +1 -0
- package/dist/types/src/cli/commands/profile/delete.d.ts +8 -0
- package/dist/types/src/cli/commands/profile/delete.d.ts.map +1 -0
- package/dist/types/src/cli/commands/profile/import.d.ts +17 -0
- package/dist/types/src/cli/commands/profile/import.d.ts.map +1 -0
- package/dist/types/src/cli/commands/profile/index.d.ts +19 -0
- package/dist/types/src/cli/commands/profile/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/profile/inspect.d.ts +13 -0
- package/dist/types/src/cli/commands/profile/inspect.d.ts.map +1 -0
- package/dist/types/src/cli/commands/profile/list.d.ts +6 -0
- package/dist/types/src/cli/commands/profile/list.d.ts.map +1 -0
- package/dist/types/src/cli/commands/profile/reset.d.ts +8 -0
- package/dist/types/src/cli/commands/profile/reset.d.ts.map +1 -0
- package/dist/types/src/cli/commands/profile/util.d.ts +24 -0
- package/dist/types/src/cli/commands/profile/util.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +4 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/cli/testing/test-console.d.ts +37 -0
- package/dist/types/src/cli/testing/test-console.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +0 -6
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +4 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/containers/DevicesContainer/DevicesContainer.d.ts.map +1 -0
- package/dist/types/src/{components → containers/DevicesContainer}/DevicesContainer.stories.d.ts +10 -54
- package/dist/types/src/containers/DevicesContainer/DevicesContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/DevicesContainer/index.d.ts +3 -0
- package/dist/types/src/containers/DevicesContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/JoinDialog}/JoinDialog.d.ts +0 -1
- package/dist/types/src/containers/JoinDialog/JoinDialog.d.ts.map +1 -0
- package/dist/types/src/containers/JoinDialog/index.d.ts +3 -0
- package/dist/types/src/containers/JoinDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/ProfileContainer/ProfileContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ProfileContainer/ProfileContainer.stories.d.ts +14 -0
- package/dist/types/src/containers/ProfileContainer/ProfileContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ProfileContainer/index.d.ts +3 -0
- package/dist/types/src/containers/ProfileContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/RecoveryCodeDialog}/RecoveryCodeDialog.d.ts +0 -1
- package/dist/types/src/containers/RecoveryCodeDialog/RecoveryCodeDialog.d.ts.map +1 -0
- package/dist/types/src/containers/RecoveryCodeDialog/RecoveryCodeDialog.stories.d.ts +16 -0
- package/dist/types/src/containers/RecoveryCodeDialog/RecoveryCodeDialog.stories.d.ts.map +1 -0
- package/dist/types/src/containers/RecoveryCodeDialog/index.d.ts +4 -0
- package/dist/types/src/containers/RecoveryCodeDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.d.ts.map +1 -0
- package/dist/types/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.stories.d.ts +14 -0
- package/dist/types/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/RecoveryCredentialsContainer/index.d.ts +3 -0
- package/dist/types/src/containers/RecoveryCredentialsContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/ResetDialog/ResetDialog.d.ts +9 -0
- package/dist/types/src/containers/ResetDialog/ResetDialog.d.ts.map +1 -0
- package/dist/types/src/containers/ResetDialog/ResetDialog.stories.d.ts +19 -0
- package/dist/types/src/containers/ResetDialog/ResetDialog.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ResetDialog/index.d.ts +4 -0
- package/dist/types/src/containers/ResetDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +10 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -48
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +10 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +9 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +169 -11
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +54 -38
- package/src/ClientPlugin.ts +45 -55
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +96 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/client/client.ts +77 -0
- package/src/capabilities/client/index.ts +7 -0
- package/src/capabilities/index.ts +7 -11
- package/src/capabilities/migrations/index.ts +7 -0
- package/src/capabilities/migrations/migrations.ts +30 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +247 -0
- package/src/capabilities/react-context/index.ts +7 -0
- package/src/capabilities/react-context/react-context.tsx +25 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +74 -0
- package/src/capabilities/schema-defs/index.ts +7 -0
- package/src/capabilities/schema-defs/schema-defs.ts +36 -0
- package/src/cli/commands/config/index.ts +12 -0
- package/src/cli/commands/config/view.ts +26 -0
- package/src/cli/commands/device/index.ts +14 -0
- package/src/cli/commands/device/info/index.ts +5 -0
- package/src/cli/commands/device/info/info.test.ts +29 -0
- package/src/cli/commands/device/info/info.ts +50 -0
- package/src/cli/commands/device/list/index.ts +5 -0
- package/src/cli/commands/device/list/list.test.ts +31 -0
- package/src/cli/commands/device/list/list.ts +30 -0
- package/src/cli/commands/device/update/index.ts +5 -0
- package/src/cli/commands/device/update/update.ts +70 -0
- package/src/cli/commands/device/util.ts +55 -0
- package/src/cli/commands/edge/index.ts +12 -0
- package/src/cli/commands/edge/status.ts +45 -0
- package/src/cli/commands/halo/create/create.test.ts +52 -0
- package/src/cli/commands/halo/create/create.ts +75 -0
- package/src/cli/commands/halo/create/index.ts +5 -0
- package/src/cli/commands/halo/credential/add/add.ts +97 -0
- package/src/cli/commands/halo/credential/add/index.ts +5 -0
- package/src/cli/commands/halo/credential/index.ts +13 -0
- package/src/cli/commands/halo/credential/list/index.ts +5 -0
- package/src/cli/commands/halo/credential/list/list.test.ts +28 -0
- package/src/cli/commands/halo/credential/list/list.ts +118 -0
- package/src/cli/commands/halo/identity/identity.test.ts +40 -0
- package/src/cli/commands/halo/identity/identity.ts +46 -0
- package/src/cli/commands/halo/identity/index.ts +5 -0
- package/src/cli/commands/halo/index.ts +21 -0
- package/src/cli/commands/halo/join/index.ts +5 -0
- package/src/cli/commands/halo/join/join.test.ts +10 -0
- package/src/cli/commands/halo/join/join.ts +87 -0
- package/src/cli/commands/halo/keys/index.ts +5 -0
- package/src/cli/commands/halo/keys/keys.test.ts +29 -0
- package/src/cli/commands/halo/keys/keys.ts +42 -0
- package/src/cli/commands/halo/recover/index.ts +5 -0
- package/src/cli/commands/halo/recover/recover.test.ts +10 -0
- package/src/cli/commands/halo/recover/recover.ts +44 -0
- package/src/cli/commands/halo/seed/index.ts +5 -0
- package/src/cli/commands/halo/seed/seed.ts +38 -0
- package/src/cli/commands/halo/share/index.ts +5 -0
- package/src/cli/commands/halo/share/share.ts +97 -0
- package/src/cli/commands/halo/update/index.ts +5 -0
- package/src/cli/commands/halo/update/update.test.ts +29 -0
- package/src/cli/commands/halo/update/update.ts +69 -0
- package/src/cli/commands/halo/util.ts +18 -0
- package/src/cli/commands/index.ts +9 -0
- package/src/cli/commands/profile/create.ts +87 -0
- package/src/cli/commands/profile/delete.ts +33 -0
- package/src/cli/commands/profile/import.ts +101 -0
- package/src/cli/commands/profile/index.ts +17 -0
- package/src/cli/commands/profile/inspect.ts +64 -0
- package/src/cli/commands/profile/list.ts +54 -0
- package/src/cli/commands/profile/reset.ts +45 -0
- package/src/cli/commands/profile/util.ts +48 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +34 -0
- package/src/cli/testing/test-console.ts +88 -0
- package/src/components/index.ts +0 -7
- package/src/constants.ts +9 -0
- package/src/{components → containers/DevicesContainer}/DevicesContainer.stories.tsx +14 -10
- package/src/{components → containers/DevicesContainer}/DevicesContainer.tsx +59 -65
- package/src/containers/DevicesContainer/index.ts +7 -0
- package/src/containers/JoinDialog/JoinDialog.tsx +53 -0
- package/src/containers/JoinDialog/index.ts +7 -0
- package/src/{components → containers/ProfileContainer}/ProfileContainer.stories.tsx +4 -4
- package/src/{components → containers/ProfileContainer}/ProfileContainer.tsx +65 -59
- package/src/containers/ProfileContainer/index.ts +7 -0
- package/src/{components → containers/RecoveryCodeDialog}/RecoveryCodeDialog.stories.tsx +4 -4
- package/src/{components → containers/RecoveryCodeDialog}/RecoveryCodeDialog.tsx +27 -26
- package/src/containers/RecoveryCodeDialog/index.ts +8 -0
- package/src/containers/RecoveryCredentialsContainer/RecoveryCredentialsContainer.stories.tsx +46 -0
- package/src/{components → containers/RecoveryCredentialsContainer}/RecoveryCredentialsContainer.tsx +22 -24
- package/src/containers/RecoveryCredentialsContainer/index.ts +7 -0
- package/src/containers/ResetDialog/ResetDialog.stories.tsx +73 -0
- package/src/containers/ResetDialog/ResetDialog.tsx +50 -0
- package/src/containers/ResetDialog/index.ts +8 -0
- package/src/containers/index.ts +15 -0
- package/src/index.ts +1 -2
- package/src/meta.ts +7 -2
- package/src/translations.ts +6 -3
- package/src/types/capabilities.ts +16 -0
- package/src/types/events.ts +15 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +127 -9
- package/dist/lib/browser/app-graph-builder-LUY3BJGC.mjs +0 -124
- package/dist/lib/browser/app-graph-builder-LUY3BJGC.mjs.map +0 -7
- package/dist/lib/browser/chunk-C7B7NM2G.mjs +0 -686
- package/dist/lib/browser/chunk-C7B7NM2G.mjs.map +0 -7
- package/dist/lib/browser/chunk-PFY3EQPI.mjs +0 -18
- package/dist/lib/browser/chunk-PFY3EQPI.mjs.map +0 -7
- package/dist/lib/browser/chunk-QB3D2P4J.mjs +0 -10
- package/dist/lib/browser/chunk-QB3D2P4J.mjs.map +0 -7
- package/dist/lib/browser/chunk-TRA2GP4M.mjs +0 -110
- package/dist/lib/browser/chunk-TRA2GP4M.mjs.map +0 -7
- package/dist/lib/browser/chunk-VTC4GIND.mjs +0 -19
- package/dist/lib/browser/chunk-VTC4GIND.mjs.map +0 -7
- package/dist/lib/browser/client-5PWEJ3U6.mjs +0 -43
- package/dist/lib/browser/client-5PWEJ3U6.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-L5NVP2G3.mjs +0 -305
- package/dist/lib/browser/intent-resolver-L5NVP2G3.mjs.map +0 -7
- package/dist/lib/browser/migrations-MWQCO5KY.mjs +0 -23
- package/dist/lib/browser/migrations-MWQCO5KY.mjs.map +0 -7
- package/dist/lib/browser/react-context-S4SRYUVY.mjs +0 -24
- package/dist/lib/browser/react-context-S4SRYUVY.mjs.map +0 -7
- package/dist/lib/browser/react-surface-6PV7RVQN.mjs +0 -66
- package/dist/lib/browser/react-surface-6PV7RVQN.mjs.map +0 -7
- package/dist/lib/browser/schema-defs-E3USCMH3.mjs +0 -25
- package/dist/lib/browser/schema-defs-E3USCMH3.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-S3BVB3IU.mjs +0 -125
- package/dist/lib/node-esm/app-graph-builder-S3BVB3IU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4MPOOMDQ.mjs +0 -111
- package/dist/lib/node-esm/chunk-4MPOOMDQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-H73VVAMA.mjs +0 -687
- package/dist/lib/node-esm/chunk-H73VVAMA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K5IFPSCL.mjs +0 -20
- package/dist/lib/node-esm/chunk-K5IFPSCL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QE4LPI2A.mjs +0 -12
- package/dist/lib/node-esm/chunk-QE4LPI2A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UYDFBGYA.mjs +0 -19
- package/dist/lib/node-esm/chunk-UYDFBGYA.mjs.map +0 -7
- package/dist/lib/node-esm/client-ODN7EBTY.mjs +0 -44
- package/dist/lib/node-esm/client-ODN7EBTY.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-3JZIPI6F.mjs +0 -306
- package/dist/lib/node-esm/intent-resolver-3JZIPI6F.mjs.map +0 -7
- package/dist/lib/node-esm/migrations-ARXHGBH5.mjs +0 -24
- package/dist/lib/node-esm/migrations-ARXHGBH5.mjs.map +0 -7
- package/dist/lib/node-esm/react-context-4SZYNSIS.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-BOST4EH2.mjs +0 -67
- package/dist/lib/node-esm/react-surface-BOST4EH2.mjs.map +0 -7
- package/dist/lib/node-esm/schema-defs-ATH5YBDR.mjs +0 -26
- package/dist/lib/node-esm/schema-defs-ATH5YBDR.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -9
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/client.d.ts +0 -9
- package/dist/types/src/capabilities/client.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -8
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/migrations.d.ts +0 -4
- package/dist/types/src/capabilities/migrations.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-context.d.ts +0 -8
- package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -8
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/schema-defs.d.ts +0 -4
- package/dist/types/src/capabilities/schema-defs.d.ts.map +0 -1
- package/dist/types/src/components/DevicesContainer.d.ts.map +0 -1
- package/dist/types/src/components/DevicesContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/JoinDialog.d.ts.map +0 -1
- package/dist/types/src/components/ProfileContainer.d.ts.map +0 -1
- package/dist/types/src/components/ProfileContainer.stories.d.ts +0 -60
- package/dist/types/src/components/ProfileContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +0 -1
- package/dist/types/src/components/RecoveryCodeDialog.stories.d.ts +0 -62
- package/dist/types/src/components/RecoveryCodeDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/RecoveryCredentialsContainer.d.ts.map +0 -1
- package/dist/types/src/components/RecoveryCredentialsContainer.stories.d.ts +0 -60
- package/dist/types/src/components/RecoveryCredentialsContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/ResetDialog.d.ts +0 -7
- package/dist/types/src/components/ResetDialog.d.ts.map +0 -1
- package/dist/types/src/components/ResetDialog.stories.d.ts +0 -65
- package/dist/types/src/components/ResetDialog.stories.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -8
- package/dist/types/src/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -115
- package/src/capabilities/capabilities.ts +0 -18
- package/src/capabilities/client.ts +0 -43
- package/src/capabilities/intent-resolver.ts +0 -251
- package/src/capabilities/migrations.ts +0 -25
- package/src/capabilities/react-context.tsx +0 -21
- package/src/capabilities/react-surface.tsx +0 -67
- package/src/capabilities/schema-defs.ts +0 -29
- package/src/components/JoinDialog.tsx +0 -53
- package/src/components/RecoveryCredentialsContainer.stories.tsx +0 -42
- package/src/components/ResetDialog.stories.tsx +0 -50
- package/src/components/ResetDialog.tsx +0 -49
- package/src/events.ts +0 -15
- /package/dist/types/src/{components → containers/DevicesContainer}/DevicesContainer.d.ts +0 -0
- /package/dist/types/src/{components → containers/ProfileContainer}/ProfileContainer.d.ts +0 -0
- /package/dist/types/src/{components → containers/RecoveryCredentialsContainer}/RecoveryCredentialsContainer.d.ts +0 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ClientOperation
|
|
3
|
+
} from "./chunk-DPAXDXMK.mjs";
|
|
4
|
+
import {
|
|
5
|
+
meta
|
|
6
|
+
} from "./chunk-N2GMSVDQ.mjs";
|
|
7
|
+
|
|
8
|
+
// src/containers/DevicesContainer/DevicesContainer.tsx
|
|
9
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
10
|
+
import { QR } from "react-qr-rounded";
|
|
11
|
+
import { useOperationInvoker } from "@dxos/app-framework/ui";
|
|
12
|
+
import { log } from "@dxos/log";
|
|
13
|
+
import { useClient, useMulticastObservable } from "@dxos/react-client";
|
|
14
|
+
import { useDevices } from "@dxos/react-client/halo";
|
|
15
|
+
import { Invitation, InvitationEncoder } from "@dxos/react-client/invitations";
|
|
16
|
+
import { useNetworkStatus } from "@dxos/react-client/mesh";
|
|
17
|
+
import { Button, Clipboard, Icon, IconButton, List, useId, useTranslation } from "@dxos/react-ui";
|
|
18
|
+
import { Settings } from "@dxos/react-ui-form";
|
|
19
|
+
import { AuthCode, Centered, DeviceListItem, Emoji, Viewport, translationKey } from "@dxos/shell/react";
|
|
20
|
+
import { osTranslations } from "@dxos/ui-theme";
|
|
21
|
+
import { hexToEmoji } from "@dxos/util";
|
|
22
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-client/src/containers/DevicesContainer/DevicesContainer.tsx";
|
|
23
|
+
var DevicesContainer = ({ createInvitationUrl }) => {
|
|
24
|
+
const { t } = useTranslation(translationKey);
|
|
25
|
+
const { invokePromise } = useOperationInvoker();
|
|
26
|
+
const devices = useDevices();
|
|
27
|
+
const { swarm: connectionState } = useNetworkStatus();
|
|
28
|
+
const handleResetStorage = useCallback(() => invokePromise(ClientOperation.ResetStorage, {}), [
|
|
29
|
+
invokePromise
|
|
30
|
+
]);
|
|
31
|
+
const handleRecover = useCallback(() => invokePromise(ClientOperation.ResetStorage, {
|
|
32
|
+
mode: "recover"
|
|
33
|
+
}), [
|
|
34
|
+
invokePromise
|
|
35
|
+
]);
|
|
36
|
+
const handleJoinNewIdentity = useCallback(() => invokePromise(ClientOperation.ResetStorage, {
|
|
37
|
+
mode: "join new identity"
|
|
38
|
+
}), [
|
|
39
|
+
invokePromise
|
|
40
|
+
]);
|
|
41
|
+
return /* @__PURE__ */ React.createElement(Clipboard.Provider, null, /* @__PURE__ */ React.createElement(Settings.Root, null, /* @__PURE__ */ React.createElement(Settings.Section, {
|
|
42
|
+
title: t("devices verbose label", {
|
|
43
|
+
ns: meta.id
|
|
44
|
+
}),
|
|
45
|
+
description: t("devices description", {
|
|
46
|
+
ns: meta.id
|
|
47
|
+
})
|
|
48
|
+
}, /* @__PURE__ */ React.createElement(Settings.Frame, null, /* @__PURE__ */ React.createElement(Settings.FrameItem, {
|
|
49
|
+
title: t("devices label", {
|
|
50
|
+
ns: meta.id
|
|
51
|
+
})
|
|
52
|
+
}, /* @__PURE__ */ React.createElement(List, null, devices.map((device) => /* @__PURE__ */ React.createElement(DeviceListItem, {
|
|
53
|
+
key: device.deviceKey.toHex(),
|
|
54
|
+
device,
|
|
55
|
+
connectionState
|
|
56
|
+
})))), createInvitationUrl && /* @__PURE__ */ React.createElement(Settings.FrameItem, {
|
|
57
|
+
title: "Add device"
|
|
58
|
+
}, /* @__PURE__ */ React.createElement(DeviceInvitation, {
|
|
59
|
+
createInvitationUrl
|
|
60
|
+
})))), /* @__PURE__ */ React.createElement(Settings.Section, {
|
|
61
|
+
title: t("danger zone title", {
|
|
62
|
+
ns: meta.id
|
|
63
|
+
}),
|
|
64
|
+
description: t("danger zone description", {
|
|
65
|
+
ns: meta.id
|
|
66
|
+
})
|
|
67
|
+
}, /* @__PURE__ */ React.createElement(Settings.Group, null, /* @__PURE__ */ React.createElement(Settings.Item, {
|
|
68
|
+
title: t("reset device label"),
|
|
69
|
+
description: t("reset device description", {
|
|
70
|
+
ns: meta.id
|
|
71
|
+
})
|
|
72
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
73
|
+
variant: "destructive",
|
|
74
|
+
onClick: handleResetStorage,
|
|
75
|
+
"data-testid": "devicesContainer.reset"
|
|
76
|
+
}, t("reset device label"))), /* @__PURE__ */ React.createElement(Settings.Item, {
|
|
77
|
+
title: t("recover identity label"),
|
|
78
|
+
description: t("recover identity description", {
|
|
79
|
+
ns: meta.id
|
|
80
|
+
})
|
|
81
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
82
|
+
variant: "destructive",
|
|
83
|
+
onClick: handleRecover,
|
|
84
|
+
"data-testid": "devicesContainer.recover"
|
|
85
|
+
}, t("recover identity label"))), /* @__PURE__ */ React.createElement(Settings.Item, {
|
|
86
|
+
title: t("join new identity label"),
|
|
87
|
+
description: t("join new identity description", {
|
|
88
|
+
ns: meta.id
|
|
89
|
+
})
|
|
90
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
91
|
+
variant: "destructive",
|
|
92
|
+
onClick: handleJoinNewIdentity,
|
|
93
|
+
"data-testid": "devicesContainer.joinExisting"
|
|
94
|
+
}, t("join new identity label")))))));
|
|
95
|
+
};
|
|
96
|
+
var DeviceInvitation = (props) => {
|
|
97
|
+
const client = useClient();
|
|
98
|
+
const [invitation, setInvitation] = useState();
|
|
99
|
+
const onInvitationCreate = useCallback(() => {
|
|
100
|
+
const invitation2 = client.halo.share();
|
|
101
|
+
if (client.config.values.runtime?.app?.env?.DX_ENVIRONMENT !== "production") {
|
|
102
|
+
const subscription = invitation2.subscribe((invitation3) => {
|
|
103
|
+
const invitationCode = InvitationEncoder.encode(invitation3);
|
|
104
|
+
if (invitation3.state === Invitation.State.CONNECTING) {
|
|
105
|
+
log.info(JSON.stringify({
|
|
106
|
+
invitationCode,
|
|
107
|
+
authCode: invitation3.authCode
|
|
108
|
+
}), void 0, {
|
|
109
|
+
F: __dxlog_file,
|
|
110
|
+
L: 117,
|
|
111
|
+
S: void 0,
|
|
112
|
+
C: (f, a) => f(...a)
|
|
113
|
+
});
|
|
114
|
+
subscription.unsubscribe();
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
setInvitation(invitation2);
|
|
119
|
+
}, [
|
|
120
|
+
client
|
|
121
|
+
]);
|
|
122
|
+
const onInvitationDone = useCallback(() => {
|
|
123
|
+
setInvitation(void 0);
|
|
124
|
+
}, []);
|
|
125
|
+
if (invitation) {
|
|
126
|
+
return /* @__PURE__ */ React.createElement(DeviceInvitationImpl, {
|
|
127
|
+
...props,
|
|
128
|
+
invitation,
|
|
129
|
+
onInvitationCreate,
|
|
130
|
+
onInvitationDone
|
|
131
|
+
});
|
|
132
|
+
} else {
|
|
133
|
+
return /* @__PURE__ */ React.createElement(InvitationSection, {
|
|
134
|
+
...props,
|
|
135
|
+
onInvitationCreate,
|
|
136
|
+
onInvitationDone
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
var DeviceInvitationImpl = ({ invitation: invitationObservable, createInvitationUrl, onInvitationDone, onInvitationCreate }) => {
|
|
141
|
+
const invitation = useMulticastObservable(invitationObservable);
|
|
142
|
+
const url = createInvitationUrl(InvitationEncoder.encode(invitation));
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
if (invitation.state >= Invitation.State.SUCCESS) {
|
|
145
|
+
onInvitationDone();
|
|
146
|
+
}
|
|
147
|
+
}, [
|
|
148
|
+
invitation.state
|
|
149
|
+
]);
|
|
150
|
+
return /* @__PURE__ */ React.createElement(InvitationSection, {
|
|
151
|
+
...invitation,
|
|
152
|
+
url,
|
|
153
|
+
onInvitationDone,
|
|
154
|
+
onInvitationCreate
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
var InvitationSection = ({ state = -1, authCode, invitationId = "never", url = "never", onInvitationDone = () => {
|
|
158
|
+
}, onInvitationCreate = () => {
|
|
159
|
+
} }) => {
|
|
160
|
+
const { t } = useTranslation(meta.id);
|
|
161
|
+
const activeView = state < 0 ? "init" : state >= Invitation.State.CANCELLED ? "complete" : state >= Invitation.State.READY_FOR_AUTHENTICATION && authCode ? "auth-code" : "qr-code";
|
|
162
|
+
return activeView === "init" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", {
|
|
163
|
+
className: "text-description mb-2"
|
|
164
|
+
}, t("add device description")), /* @__PURE__ */ React.createElement(IconButton, {
|
|
165
|
+
icon: "ph--plus--regular",
|
|
166
|
+
label: t("create device invitation label"),
|
|
167
|
+
disabled: state >= 0,
|
|
168
|
+
classNames: "w-full",
|
|
169
|
+
"data-testid": "devicesContainer.createInvitation",
|
|
170
|
+
onClick: onInvitationCreate
|
|
171
|
+
})) : /* @__PURE__ */ React.createElement(Viewport.Root, {
|
|
172
|
+
activeView
|
|
173
|
+
}, /* @__PURE__ */ React.createElement(Viewport.Views, null, /* @__PURE__ */ React.createElement(Viewport.View, {
|
|
174
|
+
id: "init"
|
|
175
|
+
}), /* @__PURE__ */ React.createElement(Viewport.View, {
|
|
176
|
+
id: "complete"
|
|
177
|
+
}, /* @__PURE__ */ React.createElement(InvitationComplete, {
|
|
178
|
+
statusValue: state
|
|
179
|
+
})), /* @__PURE__ */ React.createElement(Viewport.View, {
|
|
180
|
+
id: "auth-code"
|
|
181
|
+
}, /* @__PURE__ */ React.createElement(InvitationAuthCode, {
|
|
182
|
+
id: invitationId,
|
|
183
|
+
code: authCode ?? "never",
|
|
184
|
+
onCancel: onInvitationDone
|
|
185
|
+
})), /* @__PURE__ */ React.createElement(Viewport.View, {
|
|
186
|
+
id: "qr-code"
|
|
187
|
+
}, /* @__PURE__ */ React.createElement(InvitationQR, {
|
|
188
|
+
id: invitationId,
|
|
189
|
+
url,
|
|
190
|
+
onCancel: onInvitationDone
|
|
191
|
+
}))));
|
|
192
|
+
};
|
|
193
|
+
var InvitationQR = ({ id, url, onCancel }) => {
|
|
194
|
+
const { t } = useTranslation(osTranslations);
|
|
195
|
+
const qrLabel = useId("devices-container__qr-code");
|
|
196
|
+
const emoji = hexToEmoji(id);
|
|
197
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", {
|
|
198
|
+
className: "text-description"
|
|
199
|
+
}, t("qr code description", {
|
|
200
|
+
ns: meta.id
|
|
201
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
202
|
+
role: "group",
|
|
203
|
+
className: "grid grid-cols-[1fr_min-content]"
|
|
204
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
205
|
+
className: "flex justify-center py-4"
|
|
206
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
207
|
+
role: "none",
|
|
208
|
+
className: "w-full md:max-w-80 aspect-square relative text-description"
|
|
209
|
+
}, /* @__PURE__ */ React.createElement(QR, {
|
|
210
|
+
rounding: 100,
|
|
211
|
+
backgroundColor: "transparent",
|
|
212
|
+
color: "currentColor",
|
|
213
|
+
"aria-labelledby": qrLabel,
|
|
214
|
+
errorCorrectionLevel: "Q",
|
|
215
|
+
cutout: true
|
|
216
|
+
}, url ?? "never"), /* @__PURE__ */ React.createElement(Centered, null, /* @__PURE__ */ React.createElement(Emoji, {
|
|
217
|
+
text: emoji
|
|
218
|
+
})))), /* @__PURE__ */ React.createElement("span", {
|
|
219
|
+
id: qrLabel,
|
|
220
|
+
className: "sr-only"
|
|
221
|
+
}, t("qr label"))), /* @__PURE__ */ React.createElement("div", {
|
|
222
|
+
className: "flex justify-center"
|
|
223
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
224
|
+
className: "flex gap-2"
|
|
225
|
+
}, /* @__PURE__ */ React.createElement(Clipboard.Button, {
|
|
226
|
+
value: url ?? "never"
|
|
227
|
+
}), /* @__PURE__ */ React.createElement(Button, {
|
|
228
|
+
variant: "ghost",
|
|
229
|
+
onClick: onCancel
|
|
230
|
+
}, t("cancel label")))));
|
|
231
|
+
};
|
|
232
|
+
var InvitationAuthCode = ({ id, code, onCancel }) => {
|
|
233
|
+
const { t } = useTranslation(osTranslations);
|
|
234
|
+
const emoji = hexToEmoji(id);
|
|
235
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", {
|
|
236
|
+
className: "text-description"
|
|
237
|
+
}, t("auth other device emoji message")), emoji && /* @__PURE__ */ React.createElement(Emoji, {
|
|
238
|
+
text: emoji,
|
|
239
|
+
className: "mx-auto my-2 text-center"
|
|
240
|
+
}), /* @__PURE__ */ React.createElement("p", {
|
|
241
|
+
className: "text-description"
|
|
242
|
+
}, t("auth code message")), /* @__PURE__ */ React.createElement(AuthCode, {
|
|
243
|
+
code,
|
|
244
|
+
large: true,
|
|
245
|
+
classNames: "mx-auto my-2 text-center grow"
|
|
246
|
+
}), /* @__PURE__ */ React.createElement(Button, {
|
|
247
|
+
variant: "ghost",
|
|
248
|
+
onClick: onCancel
|
|
249
|
+
}, t("cancel label")));
|
|
250
|
+
};
|
|
251
|
+
var InvitationComplete = ({ statusValue }) => {
|
|
252
|
+
return statusValue > 0 ? /* @__PURE__ */ React.createElement(Icon, {
|
|
253
|
+
icon: "ph--check--regular",
|
|
254
|
+
size: 6,
|
|
255
|
+
classNames: "m-1.5"
|
|
256
|
+
}) : /* @__PURE__ */ React.createElement(Icon, {
|
|
257
|
+
icon: "ph--x--regular",
|
|
258
|
+
size: 6,
|
|
259
|
+
classNames: "m-1.5"
|
|
260
|
+
});
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
// src/containers/DevicesContainer/index.ts
|
|
264
|
+
var DevicesContainer_default = DevicesContainer;
|
|
265
|
+
export {
|
|
266
|
+
DevicesContainer_default as default
|
|
267
|
+
};
|
|
268
|
+
//# sourceMappingURL=DevicesContainer-46MEG3F5.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/DevicesContainer/DevicesContainer.tsx", "../../../src/containers/DevicesContainer/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useEffect, useState } from 'react';\nimport { QR } from 'react-qr-rounded';\n\nimport { useOperationInvoker } from '@dxos/app-framework/ui';\nimport { log } from '@dxos/log';\nimport { useClient, useMulticastObservable } from '@dxos/react-client';\nimport { type Device, useDevices } from '@dxos/react-client/halo';\nimport { type CancellableInvitationObservable, Invitation, InvitationEncoder } from '@dxos/react-client/invitations';\nimport { useNetworkStatus } from '@dxos/react-client/mesh';\nimport { Button, Clipboard, Icon, IconButton, List, useId, useTranslation } from '@dxos/react-ui';\nimport { Settings } from '@dxos/react-ui-form';\nimport { AuthCode, Centered, DeviceListItem, Emoji, Viewport, translationKey } from '@dxos/shell/react';\nimport { osTranslations } from '@dxos/ui-theme';\nimport { hexToEmoji } from '@dxos/util';\n\nimport { meta } from '../../meta';\nimport { ClientOperation } from '../../types';\n\nexport type DevicesContainerProps = {\n createInvitationUrl?: (invitationCode: string) => string;\n};\n\nexport const DevicesContainer = ({ createInvitationUrl }: DevicesContainerProps) => {\n const { t } = useTranslation(translationKey);\n const { invokePromise } = useOperationInvoker();\n const devices = useDevices();\n const { swarm: connectionState } = useNetworkStatus();\n\n const handleResetStorage = useCallback(() => invokePromise(ClientOperation.ResetStorage, {}), [invokePromise]);\n\n const handleRecover = useCallback(\n () => invokePromise(ClientOperation.ResetStorage, { mode: 'recover' }),\n [invokePromise],\n );\n\n const handleJoinNewIdentity = useCallback(\n () => invokePromise(ClientOperation.ResetStorage, { mode: 'join new identity' }),\n [invokePromise],\n );\n\n return (\n <Clipboard.Provider>\n <Settings.Root>\n <Settings.Section\n title={t('devices verbose label', { ns: meta.id })}\n description={t('devices description', { ns: meta.id })}\n >\n <Settings.Frame>\n <Settings.FrameItem title={t('devices label', { ns: meta.id })}>\n <List>\n {devices.map((device: Device) => (\n <DeviceListItem key={device.deviceKey.toHex()} device={device} connectionState={connectionState} />\n ))}\n </List>\n </Settings.FrameItem>\n {createInvitationUrl && (\n <Settings.FrameItem title='Add device'>\n <DeviceInvitation createInvitationUrl={createInvitationUrl} />\n </Settings.FrameItem>\n )}\n </Settings.Frame>\n </Settings.Section>\n <Settings.Section\n title={t('danger zone title', { ns: meta.id })}\n description={t('danger zone description', { ns: meta.id })}\n >\n <Settings.Group>\n <Settings.Item title={t('reset device label')} description={t('reset device description', { ns: meta.id })}>\n <Button variant='destructive' onClick={handleResetStorage} data-testid='devicesContainer.reset'>\n {t('reset device label')}\n </Button>\n </Settings.Item>\n <Settings.Item\n title={t('recover identity label')}\n description={t('recover identity description', { ns: meta.id })}\n >\n <Button variant='destructive' onClick={handleRecover} data-testid='devicesContainer.recover'>\n {t('recover identity label')}\n </Button>\n </Settings.Item>\n <Settings.Item\n title={t('join new identity label')}\n description={t('join new identity description', { ns: meta.id })}\n >\n <Button variant='destructive' onClick={handleJoinNewIdentity} data-testid='devicesContainer.joinExisting'>\n {t('join new identity label')}\n </Button>\n </Settings.Item>\n </Settings.Group>\n </Settings.Section>\n </Settings.Root>\n </Clipboard.Provider>\n );\n};\n\ntype DeviceInvitationProps = {\n invitation?: CancellableInvitationObservable;\n createInvitationUrl: (invitationCode: string) => string;\n onInvitationDone: () => void;\n onInvitationCreate: () => void;\n};\n\nconst DeviceInvitation = (props: Pick<DeviceInvitationProps, 'createInvitationUrl'>) => {\n const client = useClient();\n const [invitation, setInvitation] = useState<CancellableInvitationObservable>();\n\n const onInvitationCreate = useCallback(() => {\n const invitation = client.halo.share();\n if (client.config.values.runtime?.app?.env?.DX_ENVIRONMENT !== 'production') {\n const subscription = invitation.subscribe((invitation: Invitation) => {\n const invitationCode = InvitationEncoder.encode(invitation);\n if (invitation.state === Invitation.State.CONNECTING) {\n log.info(JSON.stringify({ invitationCode, authCode: invitation.authCode }));\n subscription.unsubscribe();\n }\n });\n }\n setInvitation(invitation);\n }, [client]);\n\n const onInvitationDone = useCallback(() => {\n setInvitation(undefined);\n }, []);\n\n if (invitation) {\n return <DeviceInvitationImpl {...props} {...{ invitation, onInvitationCreate, onInvitationDone }} />;\n } else {\n return <InvitationSection {...props} {...{ onInvitationCreate, onInvitationDone }} />;\n }\n};\n\nconst DeviceInvitationImpl = ({\n invitation: invitationObservable,\n createInvitationUrl,\n onInvitationDone,\n onInvitationCreate,\n}: DeviceInvitationProps) => {\n const invitation = useMulticastObservable(invitationObservable!);\n const url = createInvitationUrl(InvitationEncoder.encode(invitation));\n\n useEffect(() => {\n if (invitation.state >= Invitation.State.SUCCESS) {\n onInvitationDone();\n }\n }, [invitation.state]);\n\n return <InvitationSection {...invitation} {...{ url, onInvitationDone, onInvitationCreate }} />;\n};\n\ntype InvitationComponentProps = Partial<\n Pick<Invitation, 'authCode' | 'invitationId'> &\n Pick<DeviceInvitationProps, 'onInvitationDone' | 'onInvitationCreate'> & {\n state: number;\n url: string;\n }\n>;\n\nconst InvitationSection = ({\n state = -1,\n authCode,\n invitationId = 'never',\n url = 'never',\n onInvitationDone = () => {},\n onInvitationCreate = () => {},\n}: InvitationComponentProps) => {\n const { t } = useTranslation(meta.id);\n const activeView =\n state < 0\n ? 'init'\n : state >= Invitation.State.CANCELLED\n ? 'complete'\n : state >= Invitation.State.READY_FOR_AUTHENTICATION && authCode\n ? 'auth-code'\n : 'qr-code';\n return activeView === 'init' ? (\n <>\n <p className='text-description mb-2'>{t('add device description')}</p>\n <IconButton\n icon='ph--plus--regular'\n label={t('create device invitation label')}\n disabled={state >= 0}\n classNames='w-full'\n data-testid='devicesContainer.createInvitation'\n onClick={onInvitationCreate}\n />\n </>\n ) : (\n <Viewport.Root activeView={activeView}>\n <Viewport.Views>\n <Viewport.View id='init'>\n {/* This view intentionally left blank while conditionally rendering the viewport. */}\n </Viewport.View>\n <Viewport.View id='complete'>\n <InvitationComplete statusValue={state} />\n </Viewport.View>\n <Viewport.View id='auth-code'>\n <InvitationAuthCode id={invitationId} code={authCode ?? 'never'} onCancel={onInvitationDone} />\n </Viewport.View>\n <Viewport.View id='qr-code'>\n <InvitationQR id={invitationId} url={url} onCancel={onInvitationDone} />\n </Viewport.View>\n </Viewport.Views>\n </Viewport.Root>\n );\n};\n\nconst InvitationQR = ({ id, url, onCancel }: { id: string; url: string; onCancel: () => void }) => {\n const { t } = useTranslation(osTranslations);\n const qrLabel = useId('devices-container__qr-code');\n const emoji = hexToEmoji(id);\n return (\n <>\n <p className='text-description'>{t('qr code description', { ns: meta.id })}</p>\n <div role='group' className='grid grid-cols-[1fr_min-content]'>\n <div className='flex justify-center py-4'>\n <div role='none' className='w-full md:max-w-80 aspect-square relative text-description'>\n <QR\n rounding={100}\n backgroundColor='transparent'\n color='currentColor'\n aria-labelledby={qrLabel}\n errorCorrectionLevel='Q'\n cutout={true}\n >\n {url ?? 'never'}\n </QR>\n <Centered>\n <Emoji text={emoji} />\n </Centered>\n </div>\n </div>\n <span id={qrLabel} className='sr-only'>\n {t('qr label')}\n </span>\n </div>\n {/* TODO(burdon): Factor out button bar */}\n <div className='flex justify-center'>\n <div className='flex gap-2'>\n <Clipboard.Button value={url ?? 'never'} />\n <Button variant='ghost' onClick={onCancel}>\n {t('cancel label')}\n </Button>\n </div>\n </div>\n </>\n );\n};\n\nconst InvitationAuthCode = ({ id, code, onCancel }: { id: string; code: string; onCancel: () => void }) => {\n const { t } = useTranslation(osTranslations);\n const emoji = hexToEmoji(id);\n\n return (\n <>\n <p className='text-description'>{t('auth other device emoji message')}</p>\n {emoji && <Emoji text={emoji} className='mx-auto my-2 text-center' />}\n <p className='text-description'>{t('auth code message')}</p>\n <AuthCode code={code} large classNames='mx-auto my-2 text-center grow' />\n <Button variant='ghost' onClick={onCancel}>\n {t('cancel label')}\n </Button>\n </>\n );\n};\n\nconst InvitationComplete = ({ statusValue }: { statusValue: number }) => {\n return statusValue > 0 ? (\n <Icon icon='ph--check--regular' size={6} classNames='m-1.5' />\n ) : (\n <Icon icon='ph--x--regular' size={6} classNames='m-1.5' />\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { DevicesContainer } from './DevicesContainer';\n\nexport default DevicesContainer;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAIA,OAAOA,SAASC,aAAaC,WAAWC,gBAAgB;AACxD,SAASC,UAAU;AAEnB,SAASC,2BAA2B;AACpC,SAASC,WAAW;AACpB,SAASC,WAAWC,8BAA8B;AAClD,SAAsBC,kBAAkB;AACxC,SAA+CC,YAAYC,yBAAyB;AACpF,SAASC,wBAAwB;AACjC,SAASC,QAAQC,WAAWC,MAAMC,YAAYC,MAAMC,OAAOC,sBAAsB;AACjF,SAASC,gBAAgB;AACzB,SAASC,UAAUC,UAAUC,gBAAgBC,OAAOC,UAAUC,sBAAsB;AACpF,SAASC,sBAAsB;AAC/B,SAASC,kBAAkB;;AASpB,IAAMC,mBAAmB,CAAC,EAAEC,oBAAmB,MAAyB;AAC7E,QAAM,EAAEC,EAAC,IAAKC,eAAeC,cAAAA;AAC7B,QAAM,EAAEC,cAAa,IAAKC,oBAAAA;AAC1B,QAAMC,UAAUC,WAAAA;AAChB,QAAM,EAAEC,OAAOC,gBAAe,IAAKC,iBAAAA;AAEnC,QAAMC,qBAAqBC,YAAY,MAAMR,cAAcS,gBAAgBC,cAAc,CAAC,CAAA,GAAI;IAACV;GAAc;AAE7G,QAAMW,gBAAgBH,YACpB,MAAMR,cAAcS,gBAAgBC,cAAc;IAAEE,MAAM;EAAU,CAAA,GACpE;IAACZ;GAAc;AAGjB,QAAMa,wBAAwBL,YAC5B,MAAMR,cAAcS,gBAAgBC,cAAc;IAAEE,MAAM;EAAoB,CAAA,GAC9E;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EAAC,IAAKC,eAAeqG,cAAAA;AAC7B,QAAMG,QAAQC,WAAWjF,EAAAA;AAEzB,SACE,sBAAA,cAAA,MAAA,UAAA,MACE,sBAAA,cAAC6D,KAAAA;IAAEC,WAAU;KAAoBvF,EAAE,iCAAA,CAAA,GAClCyG,SAAS,sBAAA,cAACY,OAAAA;IAAMC,MAAMb;IAAOlB,WAAU;MACxC,sBAAA,cAACD,KAAAA;IAAEC,WAAU;KAAoBvF,EAAE,mBAAA,CAAA,GACnC,sBAAA,cAACyH,UAAAA;IAAStB;IAAYuB,OAAAA;IAAM9B,YAAW;MACvC,sBAAA,cAACrD,QAAAA;IAAOC,SAAQ;IAAQC,SAAS2D;KAC9BpG,EAAE,cAAA,CAAA,CAAA;AAIX;AAEA,IAAMgG,qBAAqB,CAAC,EAAEC,YAAW,MAA2B;AAClE,SAAOA,cAAc,IACnB,sBAAA,cAAC0B,MAAAA;IAAKlC,MAAK;IAAqBmC,MAAM;IAAGhC,YAAW;OAEpD,sBAAA,cAAC+B,MAAAA;IAAKlC,MAAK;IAAiBmC,MAAM;IAAGhC,YAAW;;AAEpD;;;AC7QA,IAAA,2BAAeiC;",
|
|
6
|
+
"names": ["React", "useCallback", "useEffect", "useState", "QR", "useOperationInvoker", "log", "useClient", "useMulticastObservable", "useDevices", "Invitation", "InvitationEncoder", "useNetworkStatus", "Button", "Clipboard", "Icon", "IconButton", "List", "useId", "useTranslation", "Settings", "AuthCode", "Centered", "DeviceListItem", "Emoji", "Viewport", "translationKey", "osTranslations", "hexToEmoji", "DevicesContainer", "createInvitationUrl", "t", "useTranslation", "translationKey", "invokePromise", "useOperationInvoker", "devices", "useDevices", "swarm", "connectionState", "useNetworkStatus", "handleResetStorage", "useCallback", "ClientOperation", "ResetStorage", "handleRecover", "mode", "handleJoinNewIdentity", "Clipboard", "Provider", "Settings", "Root", "Section", "title", "ns", "meta", "id", "description", "Frame", "FrameItem", "List", "map", "device", "DeviceListItem", "key", "deviceKey", "toHex", "DeviceInvitation", "Group", "Item", "Button", "variant", "onClick", "data-testid", "props", "client", "useClient", "invitation", "setInvitation", "useState", "onInvitationCreate", "halo", "share", "config", "values", "runtime", "app", "env", "DX_ENVIRONMENT", "subscription", "subscribe", "invitationCode", "InvitationEncoder", "encode", "state", "Invitation", "State", "CONNECTING", "log", "info", "JSON", "stringify", "authCode", "unsubscribe", "onInvitationDone", "undefined", "DeviceInvitationImpl", "InvitationSection", "invitationObservable", "useMulticastObservable", "url", "useEffect", "SUCCESS", "invitationId", "activeView", "CANCELLED", "READY_FOR_AUTHENTICATION", "p", "className", "IconButton", "icon", "label", "disabled", "classNames", "Viewport", "Views", "View", "InvitationComplete", "statusValue", "InvitationAuthCode", "code", "onCancel", "InvitationQR", "osTranslations", "qrLabel", "useId", "emoji", "hexToEmoji", "div", "role", "QR", "rounding", "backgroundColor", "color", "aria-labelledby", "errorCorrectionLevel", "cutout", "Centered", "Emoji", "text", "span", "value", "AuthCode", "large", "Icon", "size", "DevicesContainer"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ClientOperation
|
|
3
|
+
} from "./chunk-DPAXDXMK.mjs";
|
|
4
|
+
import {
|
|
5
|
+
meta
|
|
6
|
+
} from "./chunk-N2GMSVDQ.mjs";
|
|
7
|
+
|
|
8
|
+
// src/containers/JoinDialog/JoinDialog.tsx
|
|
9
|
+
import React, { useCallback } from "react";
|
|
10
|
+
import { useOperationInvoker } from "@dxos/app-framework/ui";
|
|
11
|
+
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
12
|
+
import { ObservabilityOperation } from "@dxos/plugin-observability/types";
|
|
13
|
+
import { Dialog, useTranslation } from "@dxos/react-ui";
|
|
14
|
+
import { JoinPanel } from "@dxos/shell/react";
|
|
15
|
+
import { osTranslations } from "@dxos/ui-theme";
|
|
16
|
+
var JoinDialog = (props) => {
|
|
17
|
+
const { invokePromise } = useOperationInvoker();
|
|
18
|
+
const { t } = useTranslation(meta.id);
|
|
19
|
+
const handleCancelResetStorage = useCallback(() => invokePromise(ClientOperation.ShareIdentity), [
|
|
20
|
+
invokePromise
|
|
21
|
+
]);
|
|
22
|
+
const handleDone = useCallback(async (result) => {
|
|
23
|
+
if (result?.identityKey) {
|
|
24
|
+
await Promise.all([
|
|
25
|
+
invokePromise(LayoutOperation.UpdateDialog, {
|
|
26
|
+
state: false
|
|
27
|
+
}),
|
|
28
|
+
invokePromise(ObservabilityOperation.SendEvent, {
|
|
29
|
+
name: props.initialDisposition === "recover-identity" ? "identity.recover" : "identity.join"
|
|
30
|
+
})
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
}, [
|
|
34
|
+
invokePromise
|
|
35
|
+
]);
|
|
36
|
+
return /* @__PURE__ */ React.createElement(Dialog.Content, null, /* @__PURE__ */ React.createElement(Dialog.Header, null, /* @__PURE__ */ React.createElement(Dialog.Title, {
|
|
37
|
+
classNames: "sr-only"
|
|
38
|
+
}, t("join space label", {
|
|
39
|
+
ns: osTranslations
|
|
40
|
+
}))), /* @__PURE__ */ React.createElement(JoinPanel, {
|
|
41
|
+
mode: "halo-only",
|
|
42
|
+
...props,
|
|
43
|
+
exitActionParent: /* @__PURE__ */ React.createElement(Dialog.Close, {
|
|
44
|
+
asChild: true
|
|
45
|
+
}),
|
|
46
|
+
doneActionParent: /* @__PURE__ */ React.createElement(Dialog.Close, {
|
|
47
|
+
asChild: true
|
|
48
|
+
}),
|
|
49
|
+
onCancelResetStorage: handleCancelResetStorage,
|
|
50
|
+
onDone: handleDone
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/containers/JoinDialog/index.ts
|
|
55
|
+
var JoinDialog_default = JoinDialog;
|
|
56
|
+
export {
|
|
57
|
+
JoinDialog_default as default
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=JoinDialog-2RCYK4O5.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/JoinDialog/JoinDialog.tsx", "../../../src/containers/JoinDialog/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { useOperationInvoker } from '@dxos/app-framework/ui';\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { ObservabilityOperation } from '@dxos/plugin-observability/types';\nimport { type InvitationResult } from '@dxos/react-client/invitations';\nimport { Dialog, useTranslation } from '@dxos/react-ui';\nimport { JoinPanel, type JoinPanelProps } from '@dxos/shell/react';\nimport { osTranslations } from '@dxos/ui-theme';\n\nimport { meta } from '../../meta';\nimport { ClientOperation } from '../../types';\n\nexport const JoinDialog = (props: JoinPanelProps) => {\n const { invokePromise } = useOperationInvoker();\n const { t } = useTranslation(meta.id);\n\n const handleCancelResetStorage = useCallback(() => invokePromise(ClientOperation.ShareIdentity), [invokePromise]);\n\n const handleDone = useCallback(\n async (result: InvitationResult | null) => {\n if (result?.identityKey) {\n await Promise.all([\n invokePromise(LayoutOperation.UpdateDialog, { state: false }),\n invokePromise(ObservabilityOperation.SendEvent, {\n name: props.initialDisposition === 'recover-identity' ? 'identity.recover' : 'identity.join',\n }),\n ]);\n }\n },\n [invokePromise],\n );\n\n return (\n <Dialog.Content>\n <Dialog.Header>\n <Dialog.Title classNames='sr-only'>{t('join space label', { ns: osTranslations })}</Dialog.Title>\n </Dialog.Header>\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 2025 DXOS.org\n//\n\nimport { JoinDialog } from './JoinDialog';\n\nexport default JoinDialog;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAIA,OAAOA,SAASC,mBAAmB;AAEnC,SAASC,2BAA2B;AACpC,SAASC,uBAAuB;AAChC,SAASC,8BAA8B;AAEvC,SAASC,QAAQC,sBAAsB;AACvC,SAASC,iBAAsC;AAC/C,SAASC,sBAAsB;AAKxB,IAAMC,aAAa,CAACC,UAAAA;AACzB,QAAM,EAAEC,cAAa,IAAKC,oBAAAA;AAC1B,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AAEpC,QAAMC,2BAA2BC,YAAY,MAAMP,cAAcQ,gBAAgBC,aAAa,GAAG;IAACT;GAAc;AAEhH,QAAMU,aAAaH,YACjB,OAAOI,WAAAA;AACL,QAAIA,QAAQC,aAAa;AACvB,YAAMC,QAAQC,IAAI;QAChBd,cAAce,gBAAgBC,cAAc;UAAEC,OAAO;QAAM,CAAA;QAC3DjB,cAAckB,uBAAuBC,WAAW;UAC9CC,MAAMrB,MAAMsB,uBAAuB,qBAAqB,qBAAqB;QAC/E,CAAA;OACD;IACH;EACF,GACA;IAACrB;GAAc;AAGjB,SACE,sBAAA,cAACsB,OAAOC,SAAO,MACb,sBAAA,cAACD,OAAOE,QAAM,MACZ,sBAAA,cAACF,OAAOG,OAAK;IAACC,YAAW;KAAWxB,EAAE,oBAAoB;IAAEyB,IAAIC;EAAe,CAAA,CAAA,CAAA,GAEjF,sBAAA,cAACC,WAAAA;IACCC,MAAK;IACJ,GAAG/B;IACJgC,kBAAkB,sBAAA,cAACT,OAAOU,OAAK;MAACC,SAAAA;;IAChCC,kBAAkB,sBAAA,cAACZ,OAAOU,OAAK;MAACC,SAAAA;;IAChCE,sBAAsB7B;IACtB8B,QAAQ1B;;AAIhB;;;AC9CA,IAAA,qBAAe2B;",
|
|
6
|
+
"names": ["React", "useCallback", "useOperationInvoker", "LayoutOperation", "ObservabilityOperation", "Dialog", "useTranslation", "JoinPanel", "osTranslations", "JoinDialog", "props", "invokePromise", "useOperationInvoker", "t", "useTranslation", "meta", "id", "handleCancelResetStorage", "useCallback", "ClientOperation", "ShareIdentity", "handleDone", "result", "identityKey", "Promise", "all", "LayoutOperation", "UpdateDialog", "state", "ObservabilityOperation", "SendEvent", "name", "initialDisposition", "Dialog", "Content", "Header", "Title", "classNames", "ns", "osTranslations", "JoinPanel", "mode", "exitActionParent", "Close", "asChild", "doneActionParent", "onCancelResetStorage", "onDone", "JoinDialog"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {
|
|
2
|
+
meta
|
|
3
|
+
} from "./chunk-N2GMSVDQ.mjs";
|
|
4
|
+
|
|
5
|
+
// src/containers/ProfileContainer/ProfileContainer.tsx
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
8
|
+
import { debounce } from "@dxos/async";
|
|
9
|
+
import { useClient } from "@dxos/react-client";
|
|
10
|
+
import { useIdentity } from "@dxos/react-client/halo";
|
|
11
|
+
import { ButtonGroup, Clipboard, Input, useTranslation } from "@dxos/react-ui";
|
|
12
|
+
import { Form, Settings } from "@dxos/react-ui-form";
|
|
13
|
+
import { EmojiPickerBlock, HuePicker } from "@dxos/react-ui-pickers";
|
|
14
|
+
import { hexToEmoji, hexToHue } from "@dxos/util";
|
|
15
|
+
var UserProfile = Schema.Struct({
|
|
16
|
+
did: Schema.String.annotations({
|
|
17
|
+
title: "DID"
|
|
18
|
+
}),
|
|
19
|
+
displayName: Schema.String.annotations({
|
|
20
|
+
title: "Display name"
|
|
21
|
+
}),
|
|
22
|
+
emoji: Schema.String.annotations({
|
|
23
|
+
title: "Avatar"
|
|
24
|
+
}),
|
|
25
|
+
hue: Schema.String.annotations({
|
|
26
|
+
title: "Color"
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
var getDefaultHueValue = (identity) => hexToHue(identity?.identityKey.toHex() ?? "0");
|
|
30
|
+
var getHueValue = (identity) => identity?.profile?.data?.hue || getDefaultHueValue(identity);
|
|
31
|
+
var getDefaultEmojiValue = (identity) => hexToEmoji(identity?.identityKey.toHex() ?? "0");
|
|
32
|
+
var getEmojiValue = (identity) => identity?.profile?.data?.emoji || getDefaultEmojiValue(identity);
|
|
33
|
+
var ProfileContainer = () => {
|
|
34
|
+
const { t } = useTranslation(meta.id);
|
|
35
|
+
const client = useClient();
|
|
36
|
+
const identity = useIdentity();
|
|
37
|
+
const [displayName, setDisplayNameDirectly] = useState(identity?.profile?.displayName ?? "");
|
|
38
|
+
const [emoji, setEmojiDirectly] = useState(getEmojiValue(identity));
|
|
39
|
+
const [hue, setHueDirectly] = useState(getHueValue(identity));
|
|
40
|
+
const updateProfile = useMemo(() => debounce((profile) => client.halo.updateProfile({
|
|
41
|
+
displayName: profile.displayName,
|
|
42
|
+
data: {
|
|
43
|
+
emoji: profile.emoji,
|
|
44
|
+
hue: profile.hue
|
|
45
|
+
}
|
|
46
|
+
}), 2e3), []);
|
|
47
|
+
const handleChange = useCallback((profile, meta2) => {
|
|
48
|
+
for (const [path, changed] of Object.entries(meta2.changed)) {
|
|
49
|
+
if (changed) {
|
|
50
|
+
switch (path) {
|
|
51
|
+
case "displayName":
|
|
52
|
+
setDisplayNameDirectly(profile.displayName ?? "");
|
|
53
|
+
break;
|
|
54
|
+
case "emoji":
|
|
55
|
+
setEmojiDirectly(profile.emoji ?? getDefaultEmojiValue(identity));
|
|
56
|
+
break;
|
|
57
|
+
case "hue":
|
|
58
|
+
setHueDirectly(profile.hue ?? getDefaultHueValue(identity));
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
void updateProfile(profile);
|
|
66
|
+
}, [
|
|
67
|
+
identity
|
|
68
|
+
]);
|
|
69
|
+
const values = useMemo(() => ({
|
|
70
|
+
did: identity?.did,
|
|
71
|
+
displayName,
|
|
72
|
+
emoji,
|
|
73
|
+
hue
|
|
74
|
+
}), [
|
|
75
|
+
identity,
|
|
76
|
+
displayName,
|
|
77
|
+
emoji,
|
|
78
|
+
hue
|
|
79
|
+
]);
|
|
80
|
+
const fieldMap = useMemo(() => ({
|
|
81
|
+
displayName: ({ type, label, getValue, onValueChange }) => {
|
|
82
|
+
const handleChange2 = useCallback(({ target: { value } }) => onValueChange(type, value), [
|
|
83
|
+
onValueChange,
|
|
84
|
+
type
|
|
85
|
+
]);
|
|
86
|
+
return /* @__PURE__ */ React.createElement(Settings.ItemInput, {
|
|
87
|
+
title: label,
|
|
88
|
+
description: t("display name description")
|
|
89
|
+
}, /* @__PURE__ */ React.createElement(Input.TextInput, {
|
|
90
|
+
value: getValue(),
|
|
91
|
+
onChange: handleChange2,
|
|
92
|
+
placeholder: t("display name input placeholder"),
|
|
93
|
+
classNames: "min-w-64"
|
|
94
|
+
}));
|
|
95
|
+
},
|
|
96
|
+
emoji: ({ type, label, getValue, onValueChange }) => {
|
|
97
|
+
const handleChange2 = useCallback((nextEmoji) => onValueChange(type, nextEmoji), [
|
|
98
|
+
onValueChange,
|
|
99
|
+
type
|
|
100
|
+
]);
|
|
101
|
+
const handleEmojiReset = useCallback(() => onValueChange(type, getDefaultEmojiValue(identity)), [
|
|
102
|
+
onValueChange,
|
|
103
|
+
type
|
|
104
|
+
]);
|
|
105
|
+
return /* @__PURE__ */ React.createElement(Settings.Item, {
|
|
106
|
+
title: label,
|
|
107
|
+
description: t("icon description")
|
|
108
|
+
}, /* @__PURE__ */ React.createElement(EmojiPickerBlock, {
|
|
109
|
+
triggerVariant: "default",
|
|
110
|
+
emoji: getValue(),
|
|
111
|
+
onChangeEmoji: handleChange2,
|
|
112
|
+
onClickClear: handleEmojiReset,
|
|
113
|
+
classNames: "justify-self-end"
|
|
114
|
+
}));
|
|
115
|
+
},
|
|
116
|
+
hue: ({ type, label, getValue, onValueChange }) => {
|
|
117
|
+
const handleChange2 = useCallback((nextHue) => onValueChange(type, nextHue), [
|
|
118
|
+
onValueChange,
|
|
119
|
+
type
|
|
120
|
+
]);
|
|
121
|
+
const handleHueReset = useCallback(() => onValueChange(type, getDefaultHueValue(identity)), [
|
|
122
|
+
onValueChange,
|
|
123
|
+
type
|
|
124
|
+
]);
|
|
125
|
+
return /* @__PURE__ */ React.createElement(Settings.Item, {
|
|
126
|
+
title: label,
|
|
127
|
+
description: t("hue description")
|
|
128
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
129
|
+
role: "none",
|
|
130
|
+
className: "flex justify-self-end"
|
|
131
|
+
}, /* @__PURE__ */ React.createElement(HuePicker, {
|
|
132
|
+
value: getValue(),
|
|
133
|
+
onChange: handleChange2,
|
|
134
|
+
onReset: handleHueReset
|
|
135
|
+
})));
|
|
136
|
+
},
|
|
137
|
+
// TODO(wittjosiah): We need text input annotations for disabled and copyable.
|
|
138
|
+
did: ({ label, getValue }) => {
|
|
139
|
+
return /* @__PURE__ */ React.createElement(Settings.ItemInput, {
|
|
140
|
+
title: label,
|
|
141
|
+
description: t("did description")
|
|
142
|
+
}, /* @__PURE__ */ React.createElement(ButtonGroup, {
|
|
143
|
+
classNames: "w-full"
|
|
144
|
+
}, /* @__PURE__ */ React.createElement(Input.TextInput, {
|
|
145
|
+
value: getValue(),
|
|
146
|
+
disabled: true,
|
|
147
|
+
classNames: "min-w-64"
|
|
148
|
+
}), /* @__PURE__ */ React.createElement(Clipboard.IconButton, {
|
|
149
|
+
value: getValue() ?? ""
|
|
150
|
+
})));
|
|
151
|
+
}
|
|
152
|
+
}), [
|
|
153
|
+
t
|
|
154
|
+
]);
|
|
155
|
+
return /* @__PURE__ */ React.createElement(Clipboard.Provider, null, /* @__PURE__ */ React.createElement(Settings.Root, null, /* @__PURE__ */ React.createElement(Settings.Section, {
|
|
156
|
+
title: t("profile label"),
|
|
157
|
+
description: t("profile description")
|
|
158
|
+
}, /* @__PURE__ */ React.createElement(Form.Root, {
|
|
159
|
+
schema: UserProfile,
|
|
160
|
+
values,
|
|
161
|
+
fieldMap,
|
|
162
|
+
onValuesChanged: handleChange
|
|
163
|
+
}, /* @__PURE__ */ React.createElement(Form.Content, null, /* @__PURE__ */ React.createElement(Form.FieldSet, null))))));
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// src/containers/ProfileContainer/index.ts
|
|
167
|
+
var ProfileContainer_default = ProfileContainer;
|
|
168
|
+
export {
|
|
169
|
+
ProfileContainer_default as default
|
|
170
|
+
};
|
|
171
|
+
//# sourceMappingURL=ProfileContainer-XYRCOQ5I.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/ProfileContainer/ProfileContainer.tsx", "../../../src/containers/ProfileContainer/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport React, { type ChangeEvent, useCallback, useMemo, useState } from 'react';\n\nimport { debounce } from '@dxos/async';\nimport { useClient } from '@dxos/react-client';\nimport { type Identity, useIdentity } from '@dxos/react-client/halo';\nimport { ButtonGroup, Clipboard, Input, useTranslation } from '@dxos/react-ui';\nimport { Form, type FormFieldMap, type FormUpdateMeta, Settings } from '@dxos/react-ui-form';\nimport { EmojiPickerBlock, HuePicker } from '@dxos/react-ui-pickers';\nimport { hexToEmoji, hexToHue } from '@dxos/util';\n\nimport { meta } from '../../meta';\n\n// TOOD(burdon): Factor out?\n// TODO(wittjosiah): Integrate annotations with translations.\nconst UserProfile = Schema.Struct({\n did: Schema.String.annotations({ title: 'DID' }),\n displayName: Schema.String.annotations({ title: 'Display name' }),\n emoji: Schema.String.annotations({ title: 'Avatar' }),\n hue: Schema.String.annotations({ title: 'Color' }),\n});\n\ntype UserProfile = Schema.Schema.Type<typeof UserProfile>;\n\n// TODO(thure): Factor out?\nconst getDefaultHueValue = (identity: Identity | null) => hexToHue(identity?.identityKey.toHex() ?? '0');\nconst getHueValue = (identity: Identity | null) => identity?.profile?.data?.hue || getDefaultHueValue(identity);\nconst getDefaultEmojiValue = (identity: Identity | null) => hexToEmoji(identity?.identityKey.toHex() ?? '0');\nconst getEmojiValue = (identity: Identity | null) => identity?.profile?.data?.emoji || getDefaultEmojiValue(identity);\n\nexport const ProfileContainer = () => {\n const { t } = useTranslation(meta.id);\n const client = useClient();\n const identity = useIdentity();\n const [displayName, setDisplayNameDirectly] = useState(identity?.profile?.displayName ?? '');\n const [emoji, setEmojiDirectly] = useState<string>(getEmojiValue(identity));\n const [hue, setHueDirectly] = useState<string>(getHueValue(identity));\n\n const updateProfile = useMemo(\n () =>\n debounce(\n (profile: Partial<UserProfile>) =>\n client.halo.updateProfile({\n displayName: profile.displayName,\n data: {\n emoji: profile.emoji,\n hue: profile.hue,\n },\n }),\n 2_000,\n ),\n [],\n );\n\n const handleChange = useCallback(\n (profile: Partial<UserProfile>, meta: FormUpdateMeta<UserProfile>) => {\n for (const [path, changed] of Object.entries(meta.changed)) {\n if (changed) {\n switch (path) {\n case 'displayName':\n setDisplayNameDirectly(profile.displayName ?? '');\n break;\n case 'emoji':\n setEmojiDirectly(profile.emoji ?? getDefaultEmojiValue(identity));\n break;\n case 'hue':\n setHueDirectly(profile.hue ?? getDefaultHueValue(identity));\n break;\n default:\n break;\n }\n }\n }\n\n void updateProfile(profile);\n },\n [identity],\n );\n\n const values = useMemo(\n () => ({\n did: identity?.did,\n displayName,\n emoji,\n hue,\n }),\n [identity, displayName, emoji, hue],\n );\n\n // TODO(wittjosiah): Integrate descriptions with the form schema.\n const fieldMap = useMemo<FormFieldMap>(\n () => ({\n displayName: ({ type, label, getValue, onValueChange }) => {\n const handleChange = useCallback(\n ({ target: { value } }: ChangeEvent<HTMLInputElement>) => onValueChange(type, value),\n [onValueChange, type],\n );\n\n return (\n <Settings.ItemInput title={label} description={t('display name description')}>\n <Input.TextInput\n value={getValue()}\n onChange={handleChange}\n placeholder={t('display name input placeholder')}\n classNames='min-w-64'\n />\n </Settings.ItemInput>\n );\n },\n emoji: ({ type, label, getValue, onValueChange }) => {\n const handleChange = useCallback((nextEmoji: string) => onValueChange(type, nextEmoji), [onValueChange, type]);\n const handleEmojiReset = useCallback(\n () => onValueChange(type, getDefaultEmojiValue(identity)),\n [onValueChange, type],\n );\n\n return (\n <Settings.Item title={label} description={t('icon description')}>\n <EmojiPickerBlock\n triggerVariant='default'\n emoji={getValue()}\n onChangeEmoji={handleChange}\n onClickClear={handleEmojiReset}\n classNames='justify-self-end'\n />\n </Settings.Item>\n );\n },\n hue: ({ type, label, getValue, onValueChange }) => {\n const handleChange = useCallback((nextHue: string) => onValueChange(type, nextHue), [onValueChange, type]);\n const handleHueReset = useCallback(\n () => onValueChange(type, getDefaultHueValue(identity)),\n [onValueChange, type],\n );\n\n return (\n <Settings.Item title={label} description={t('hue description')}>\n <div role='none' className='flex justify-self-end'>\n <HuePicker value={getValue()} onChange={handleChange} onReset={handleHueReset} />\n </div>\n </Settings.Item>\n );\n },\n // TODO(wittjosiah): We need text input annotations for disabled and copyable.\n did: ({ label, getValue }) => {\n return (\n <Settings.ItemInput title={label} description={t('did description')}>\n <ButtonGroup classNames='w-full'>\n <Input.TextInput value={getValue()} disabled classNames='min-w-64' />\n <Clipboard.IconButton value={getValue() ?? ''} />\n </ButtonGroup>\n </Settings.ItemInput>\n );\n },\n }),\n [t],\n );\n\n return (\n <Clipboard.Provider>\n <Settings.Root>\n <Settings.Section title={t('profile label')} description={t('profile description')}>\n <Form.Root schema={UserProfile} values={values} fieldMap={fieldMap} onValuesChanged={handleChange}>\n <Form.Content>\n <Form.FieldSet />\n </Form.Content>\n </Form.Root>\n </Settings.Section>\n </Settings.Root>\n </Clipboard.Provider>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { ProfileContainer } from './ProfileContainer';\n\nexport default ProfileContainer;\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,SAA2BC,aAAaC,SAASC,gBAAgB;AAExE,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAC1B,SAAwBC,mBAAmB;AAC3C,SAASC,aAAaC,WAAWC,OAAOC,sBAAsB;AAC9D,SAASC,MAA8CC,gBAAgB;AACvE,SAASC,kBAAkBC,iBAAiB;AAC5C,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BAAA,cAAC2C,KAAKG,SAAO,MACX,sBAAA,cAACH,KAAKI,UAAQ,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAO5B;;;ACzKA,IAAA,2BAAeC;",
|
|
6
|
+
"names": ["Schema", "React", "useCallback", "useMemo", "useState", "debounce", "useClient", "useIdentity", "ButtonGroup", "Clipboard", "Input", "useTranslation", "Form", "Settings", "EmojiPickerBlock", "HuePicker", "hexToEmoji", "hexToHue", "UserProfile", "Struct", "did", "String", "annotations", "title", "displayName", "emoji", "hue", "getDefaultHueValue", "identity", "hexToHue", "identityKey", "toHex", "getHueValue", "profile", "data", "getDefaultEmojiValue", "hexToEmoji", "getEmojiValue", "ProfileContainer", "t", "useTranslation", "meta", "id", "client", "useClient", "useIdentity", "setDisplayNameDirectly", "useState", "setEmojiDirectly", "setHueDirectly", "updateProfile", "useMemo", "debounce", "halo", "handleChange", "useCallback", "path", "changed", "Object", "entries", "values", "fieldMap", "type", "label", "getValue", "onValueChange", "target", "value", "Settings", "ItemInput", "description", "Input", "TextInput", "onChange", "placeholder", "classNames", "nextEmoji", "handleEmojiReset", "Item", "EmojiPickerBlock", "triggerVariant", "onChangeEmoji", "onClickClear", "nextHue", "handleHueReset", "div", "role", "className", "HuePicker", "onReset", "ButtonGroup", "disabled", "Clipboard", "IconButton", "Provider", "Root", "Section", "Form", "schema", "onValuesChanged", "Content", "FieldSet", "ProfileContainer"]
|
|
7
|
+
}
|