@dxos/shell 0.3.11-main.1caa3af
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/LICENSE +8 -0
- package/README.md +21 -0
- package/dist/lib/browser/chunk-ZSTKOCBT.mjs +10 -0
- package/dist/lib/browser/chunk-ZSTKOCBT.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/browser/react.mjs +3617 -0
- package/dist/lib/browser/react.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +179 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/types/src/components/AuthCode.d.ts +8 -0
- package/dist/types/src/components/AuthCode.d.ts.map +1 -0
- package/dist/types/src/components/AuthCode.js +26 -0
- package/dist/types/src/components/AuthCode.js.map +1 -0
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts +9 -0
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/ClipboardProvider.js +46 -0
- package/dist/types/src/components/Clipboard/ClipboardProvider.js.map +1 -0
- package/dist/types/src/components/Clipboard/CopyButton.d.ts +9 -0
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/CopyButton.js +65 -0
- package/dist/types/src/components/Clipboard/CopyButton.js.map +1 -0
- package/dist/types/src/components/Clipboard/index.d.ts +3 -0
- package/dist/types/src/components/Clipboard/index.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/index.js +22 -0
- package/dist/types/src/components/Clipboard/index.js.map +1 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.d.ts +17 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.d.ts.map +1 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.js +29 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.js.map +1 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.stories.d.ts +35 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.stories.d.ts.map +1 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.stories.js +45 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.stories.js.map +1 -0
- package/dist/types/src/components/CompoundButton/index.d.ts +2 -0
- package/dist/types/src/components/CompoundButton/index.d.ts.map +1 -0
- package/dist/types/src/components/CompoundButton/index.js +21 -0
- package/dist/types/src/components/CompoundButton/index.js.map +1 -0
- package/dist/types/src/components/IdentityList/DeviceList.d.ts +7 -0
- package/dist/types/src/components/IdentityList/DeviceList.d.ts.map +1 -0
- package/dist/types/src/components/IdentityList/DeviceList.js +29 -0
- package/dist/types/src/components/IdentityList/DeviceList.js.map +1 -0
- package/dist/types/src/components/IdentityList/IdentityListItem.d.ts +11 -0
- package/dist/types/src/components/IdentityList/IdentityListItem.d.ts.map +1 -0
- package/dist/types/src/components/IdentityList/IdentityListItem.js +47 -0
- package/dist/types/src/components/IdentityList/IdentityListItem.js.map +1 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts +13 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts.map +1 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.js +54 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.js.map +1 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.stories.d.ts +17 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.stories.d.ts.map +1 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.stories.js +26 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.stories.js.map +1 -0
- package/dist/types/src/components/IdentityList/index.d.ts +4 -0
- package/dist/types/src/components/IdentityList/index.d.ts.map +1 -0
- package/dist/types/src/components/IdentityList/index.js +23 -0
- package/dist/types/src/components/IdentityList/index.js.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationList.d.ts +11 -0
- package/dist/types/src/components/InvitationList/InvitationList.d.ts.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationList.js +22 -0
- package/dist/types/src/components/InvitationList/InvitationList.js.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationList.stories.d.ts +17 -0
- package/dist/types/src/components/InvitationList/InvitationList.stories.d.ts.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationList.stories.js +39 -0
- package/dist/types/src/components/InvitationList/InvitationList.stories.js.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts +7 -0
- package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationListContainer.js +42 -0
- package/dist/types/src/components/InvitationList/InvitationListContainer.js.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationListItem.d.ts +12 -0
- package/dist/types/src/components/InvitationList/InvitationListItem.d.ts.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationListItem.js +103 -0
- package/dist/types/src/components/InvitationList/InvitationListItem.js.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationListProps.d.ts +9 -0
- package/dist/types/src/components/InvitationList/InvitationListProps.d.ts.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationListProps.js +3 -0
- package/dist/types/src/components/InvitationList/InvitationListProps.js.map +1 -0
- package/dist/types/src/components/InvitationList/index.d.ts +4 -0
- package/dist/types/src/components/InvitationList/index.d.ts.map +1 -0
- package/dist/types/src/components/InvitationList/index.js +23 -0
- package/dist/types/src/components/InvitationList/index.js.map +1 -0
- package/dist/types/src/components/Panel/Action.d.ts +20 -0
- package/dist/types/src/components/Panel/Action.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Action.js +93 -0
- package/dist/types/src/components/Panel/Action.js.map +1 -0
- package/dist/types/src/components/Panel/Actions.d.ts +11 -0
- package/dist/types/src/components/Panel/Actions.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Actions.js +36 -0
- package/dist/types/src/components/Panel/Actions.js.map +1 -0
- package/dist/types/src/components/Panel/CloseButton.d.ts +5 -0
- package/dist/types/src/components/Panel/CloseButton.d.ts.map +1 -0
- package/dist/types/src/components/Panel/CloseButton.js +21 -0
- package/dist/types/src/components/Panel/CloseButton.js.map +1 -0
- package/dist/types/src/components/Panel/Emoji.d.ts +7 -0
- package/dist/types/src/components/Panel/Emoji.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Emoji.js +24 -0
- package/dist/types/src/components/Panel/Emoji.js.map +1 -0
- package/dist/types/src/components/Panel/Heading.d.ts +16 -0
- package/dist/types/src/components/Panel/Heading.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Heading.js +39 -0
- package/dist/types/src/components/Panel/Heading.js.map +1 -0
- package/dist/types/src/components/Panel/Input.d.ts +11 -0
- package/dist/types/src/components/Panel/Input.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Input.js +19 -0
- package/dist/types/src/components/Panel/Input.js.map +1 -0
- package/dist/types/src/components/Panel/Label.d.ts +4 -0
- package/dist/types/src/components/Panel/Label.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Label.js +17 -0
- package/dist/types/src/components/Panel/Label.js.map +1 -0
- package/dist/types/src/components/Panel/Panel.stories.d.ts +13 -0
- package/dist/types/src/components/Panel/Panel.stories.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Panel.stories.js +44 -0
- package/dist/types/src/components/Panel/Panel.stories.js.map +1 -0
- package/dist/types/src/components/Panel/StepHeading.d.ts +5 -0
- package/dist/types/src/components/Panel/StepHeading.d.ts.map +1 -0
- package/dist/types/src/components/Panel/StepHeading.js +35 -0
- package/dist/types/src/components/Panel/StepHeading.js.map +1 -0
- package/dist/types/src/components/Panel/index.d.ts +9 -0
- package/dist/types/src/components/Panel/index.d.ts.map +1 -0
- package/dist/types/src/components/Panel/index.js +28 -0
- package/dist/types/src/components/Panel/index.js.map +1 -0
- package/dist/types/src/components/SpaceListItem.d.ts +7 -0
- package/dist/types/src/components/SpaceListItem.d.ts.map +1 -0
- package/dist/types/src/components/SpaceListItem.js +46 -0
- package/dist/types/src/components/SpaceListItem.js.map +1 -0
- package/dist/types/src/components/StorybookDialog.d.ts +6 -0
- package/dist/types/src/components/StorybookDialog.d.ts.map +1 -0
- package/dist/types/src/components/StorybookDialog.js +23 -0
- package/dist/types/src/components/StorybookDialog.js.map +1 -0
- package/dist/types/src/components/Viewport/Viewport.d.ts +39 -0
- package/dist/types/src/components/Viewport/Viewport.d.ts.map +1 -0
- package/dist/types/src/components/Viewport/Viewport.js +73 -0
- package/dist/types/src/components/Viewport/Viewport.js.map +1 -0
- package/dist/types/src/components/Viewport/Viewport.stories.d.ts +17 -0
- package/dist/types/src/components/Viewport/Viewport.stories.d.ts.map +1 -0
- package/dist/types/src/components/Viewport/Viewport.stories.js +51 -0
- package/dist/types/src/components/Viewport/Viewport.stories.js.map +1 -0
- package/dist/types/src/components/Viewport/index.d.ts +2 -0
- package/dist/types/src/components/Viewport/index.d.ts.map +1 -0
- package/dist/types/src/components/Viewport/index.js +21 -0
- package/dist/types/src/components/Viewport/index.js.map +1 -0
- package/dist/types/src/components/index.d.ts +9 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/components/index.js +28 -0
- package/dist/types/src/components/index.js.map +1 -0
- package/dist/types/src/composites/IdentityDialog/IdentityDialog.d.ts +7 -0
- package/dist/types/src/composites/IdentityDialog/IdentityDialog.d.ts.map +1 -0
- package/dist/types/src/composites/IdentityDialog/IdentityDialog.js +26 -0
- package/dist/types/src/composites/IdentityDialog/IdentityDialog.js.map +1 -0
- package/dist/types/src/composites/IdentityDialog/index.d.ts +2 -0
- package/dist/types/src/composites/IdentityDialog/index.d.ts.map +1 -0
- package/dist/types/src/composites/IdentityDialog/index.js +21 -0
- package/dist/types/src/composites/IdentityDialog/index.js.map +1 -0
- package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts +6 -0
- package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts.map +1 -0
- package/dist/types/src/composites/JoinDialog/JoinDialog.js +27 -0
- package/dist/types/src/composites/JoinDialog/JoinDialog.js.map +1 -0
- package/dist/types/src/composites/JoinDialog/index.d.ts +2 -0
- package/dist/types/src/composites/JoinDialog/index.d.ts.map +1 -0
- package/dist/types/src/composites/JoinDialog/index.js +21 -0
- package/dist/types/src/composites/JoinDialog/index.js.map +1 -0
- package/dist/types/src/composites/Shell/Shell.d.ts +6 -0
- package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -0
- package/dist/types/src/composites/Shell/Shell.js +90 -0
- package/dist/types/src/composites/Shell/Shell.js.map +1 -0
- package/dist/types/src/composites/Shell/ShellContext.d.ts +30 -0
- package/dist/types/src/composites/Shell/ShellContext.d.ts.map +1 -0
- package/dist/types/src/composites/Shell/ShellContext.js +129 -0
- package/dist/types/src/composites/Shell/ShellContext.js.map +1 -0
- package/dist/types/src/composites/Shell/index.d.ts +4 -0
- package/dist/types/src/composites/Shell/index.d.ts.map +1 -0
- package/dist/types/src/composites/Shell/index.js +23 -0
- package/dist/types/src/composites/Shell/index.js.map +1 -0
- package/dist/types/src/composites/Shell/memory-shell-runtime.d.ts +16 -0
- package/dist/types/src/composites/Shell/memory-shell-runtime.d.ts.map +1 -0
- package/dist/types/src/composites/Shell/memory-shell-runtime.js +38 -0
- package/dist/types/src/composites/Shell/memory-shell-runtime.js.map +1 -0
- package/dist/types/src/composites/Shell/run-shell.d.ts +3 -0
- package/dist/types/src/composites/Shell/run-shell.d.ts.map +1 -0
- package/dist/types/src/composites/Shell/run-shell.js +54 -0
- package/dist/types/src/composites/Shell/run-shell.js.map +1 -0
- package/dist/types/src/composites/SpaceDialog/SpaceDialog.d.ts +6 -0
- package/dist/types/src/composites/SpaceDialog/SpaceDialog.d.ts.map +1 -0
- package/dist/types/src/composites/SpaceDialog/SpaceDialog.js +26 -0
- package/dist/types/src/composites/SpaceDialog/SpaceDialog.js.map +1 -0
- package/dist/types/src/composites/SpaceDialog/index.d.ts +2 -0
- package/dist/types/src/composites/SpaceDialog/index.d.ts.map +1 -0
- package/dist/types/src/composites/SpaceDialog/index.js +21 -0
- package/dist/types/src/composites/SpaceDialog/index.js.map +1 -0
- package/dist/types/src/composites/index.d.ts +5 -0
- package/dist/types/src/composites/index.d.ts.map +1 -0
- package/dist/types/src/composites/index.js +24 -0
- package/dist/types/src/composites/index.js.map +1 -0
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/index.js +10 -0
- package/dist/types/src/index.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts +4 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +124 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts +22 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js +86 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts +27 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.js +6 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts +46 -0
- package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/identityMachine.js +79 -0
- package/dist/types/src/panels/IdentityPanel/identityMachine.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/index.d.ts +3 -0
- package/dist/types/src/panels/IdentityPanel/index.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/index.js +22 -0
- package/dist/types/src/panels/IdentityPanel/index.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts +9 -0
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +85 -0
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts +15 -0
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js +62 -0
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/index.d.ts +3 -0
- package/dist/types/src/panels/IdentityPanel/steps/index.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/index.js +22 -0
- package/dist/types/src/panels/IdentityPanel/steps/index.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts +10 -0
- package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinHeading.js +45 -0
- package/dist/types/src/panels/JoinPanel/JoinHeading.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts +4 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.js +293 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.d.ts +92 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.js +74 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts +91 -0
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.js +6 -0
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/index.d.ts +3 -0
- package/dist/types/src/panels/JoinPanel/index.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/index.js +22 -0
- package/dist/types/src/panels/JoinPanel/index.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +87 -0
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/joinMachine.js +402 -0
- package/dist/types/src/panels/JoinPanel/joinMachine.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.d.ts +4 -0
- package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.js +34 -0
- package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityAdded.d.ts +8 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityAdded.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityAdded.js +56 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityAdded.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityInput.d.ts +12 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityInput.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityInput.js +67 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityInput.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAccepted.d.ts +9 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAccepted.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAccepted.js +44 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAccepted.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.d.ts +11 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.js +72 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationInput.d.ts +8 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationInput.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationInput.js +68 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationInput.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationRescuer.d.ts +11 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationRescuer.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationRescuer.js +49 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationRescuer.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.d.ts +12 -0
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.js +63 -0
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/index.d.ts +9 -0
- package/dist/types/src/panels/JoinPanel/steps/index.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/index.js +28 -0
- package/dist/types/src/panels/JoinPanel/steps/index.js.map +1 -0
- package/dist/types/src/panels/Panels.stories.d.ts +22 -0
- package/dist/types/src/panels/Panels.stories.d.ts.map +1 -0
- package/dist/types/src/panels/Panels.stories.js +71 -0
- package/dist/types/src/panels/Panels.stories.js.map +1 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts +4 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts.map +1 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.js +93 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.js.map +1 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.d.ts +30 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.d.ts.map +1 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.js +183 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.js.map +1 -0
- package/dist/types/src/panels/SpacePanel/SpacePanelProps.d.ts +30 -0
- package/dist/types/src/panels/SpacePanel/SpacePanelProps.d.ts.map +1 -0
- package/dist/types/src/panels/SpacePanel/SpacePanelProps.js +6 -0
- package/dist/types/src/panels/SpacePanel/SpacePanelProps.js.map +1 -0
- package/dist/types/src/panels/SpacePanel/index.d.ts +3 -0
- package/dist/types/src/panels/SpacePanel/index.d.ts.map +1 -0
- package/dist/types/src/panels/SpacePanel/index.js +22 -0
- package/dist/types/src/panels/SpacePanel/index.js.map +1 -0
- package/dist/types/src/panels/SpacePanel/spaceMachine.d.ts +35 -0
- package/dist/types/src/panels/SpacePanel/spaceMachine.d.ts.map +1 -0
- package/dist/types/src/panels/SpacePanel/spaceMachine.js +46 -0
- package/dist/types/src/panels/SpacePanel/spaceMachine.js.map +1 -0
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts +15 -0
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts.map +1 -0
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js +120 -0
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js.map +1 -0
- package/dist/types/src/panels/SpacePanel/steps/index.d.ts +2 -0
- package/dist/types/src/panels/SpacePanel/steps/index.d.ts.map +1 -0
- package/dist/types/src/panels/SpacePanel/steps/index.js +21 -0
- package/dist/types/src/panels/SpacePanel/steps/index.js.map +1 -0
- package/dist/types/src/panels/index.d.ts +4 -0
- package/dist/types/src/panels/index.d.ts.map +1 -0
- package/dist/types/src/panels/index.js +23 -0
- package/dist/types/src/panels/index.js.map +1 -0
- package/dist/types/src/playwright/invitations-manager.d.ts +26 -0
- package/dist/types/src/playwright/invitations-manager.d.ts.map +1 -0
- package/dist/types/src/playwright/invitations-manager.js +142 -0
- package/dist/types/src/playwright/invitations-manager.js.map +1 -0
- package/dist/types/src/playwright/invitations.spec.d.ts +2 -0
- package/dist/types/src/playwright/invitations.spec.d.ts.map +1 -0
- package/dist/types/src/playwright/invitations.spec.js +298 -0
- package/dist/types/src/playwright/invitations.spec.js.map +1 -0
- package/dist/types/src/playwright/playwright.config.d.ts +3 -0
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -0
- package/dist/types/src/playwright/playwright.config.js +8 -0
- package/dist/types/src/playwright/playwright.config.js.map +1 -0
- package/dist/types/src/react.d.ts +6 -0
- package/dist/types/src/react.d.ts.map +1 -0
- package/dist/types/src/react.js +25 -0
- package/dist/types/src/react.js.map +1 -0
- package/dist/types/src/steps/InvitationManager.d.ts +7 -0
- package/dist/types/src/steps/InvitationManager.d.ts.map +1 -0
- package/dist/types/src/steps/InvitationManager.js +80 -0
- package/dist/types/src/steps/InvitationManager.js.map +1 -0
- package/dist/types/src/steps/StepProps.d.ts +14 -0
- package/dist/types/src/steps/StepProps.d.ts.map +1 -0
- package/dist/types/src/steps/StepProps.js +6 -0
- package/dist/types/src/steps/StepProps.js.map +1 -0
- package/dist/types/src/steps/index.d.ts +3 -0
- package/dist/types/src/steps/index.d.ts.map +1 -0
- package/dist/types/src/steps/index.js +22 -0
- package/dist/types/src/steps/index.js.map +1 -0
- package/dist/types/src/stories/Invitations.e2e-stories.d.ts +22 -0
- package/dist/types/src/stories/Invitations.e2e-stories.d.ts.map +1 -0
- package/dist/types/src/stories/Invitations.e2e-stories.js +146 -0
- package/dist/types/src/stories/Invitations.e2e-stories.js.map +1 -0
- package/dist/types/src/styles/index.d.ts +3 -0
- package/dist/types/src/styles/index.d.ts.map +1 -0
- package/dist/types/src/styles/index.js +22 -0
- package/dist/types/src/styles/index.js.map +1 -0
- package/dist/types/src/styles/invitationStatusStyles.d.ts +20 -0
- package/dist/types/src/styles/invitationStatusStyles.d.ts.map +1 -0
- package/dist/types/src/styles/invitationStatusStyles.js +41 -0
- package/dist/types/src/styles/invitationStatusStyles.js.map +1 -0
- package/dist/types/src/styles/panelStyles.d.ts +2 -0
- package/dist/types/src/styles/panelStyles.d.ts.map +1 -0
- package/dist/types/src/styles/panelStyles.js +8 -0
- package/dist/types/src/styles/panelStyles.js.map +1 -0
- package/dist/types/src/testing/fixtures/identities.d.ts +3 -0
- package/dist/types/src/testing/fixtures/identities.d.ts.map +1 -0
- package/dist/types/src/testing/fixtures/identities.js +18 -0
- package/dist/types/src/testing/fixtures/identities.js.map +1 -0
- package/dist/types/src/testing/fixtures/index.d.ts +3 -0
- package/dist/types/src/testing/fixtures/index.d.ts.map +1 -0
- package/dist/types/src/testing/fixtures/index.js +22 -0
- package/dist/types/src/testing/fixtures/index.js.map +1 -0
- package/dist/types/src/testing/fixtures/invitations.d.ts +3 -0
- package/dist/types/src/testing/fixtures/invitations.d.ts.map +1 -0
- package/dist/types/src/testing/fixtures/invitations.js +25 -0
- package/dist/types/src/testing/fixtures/invitations.js.map +1 -0
- package/dist/types/src/testing/index.d.ts +4 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/index.js +23 -0
- package/dist/types/src/testing/index.js.map +1 -0
- package/dist/types/src/testing/scoped-shell-manager.d.ts +17 -0
- package/dist/types/src/testing/scoped-shell-manager.d.ts.map +1 -0
- package/dist/types/src/testing/scoped-shell-manager.js +71 -0
- package/dist/types/src/testing/scoped-shell-manager.js.map +1 -0
- package/dist/types/src/testing/shell-manager.d.ts +24 -0
- package/dist/types/src/testing/shell-manager.d.ts.map +1 -0
- package/dist/types/src/testing/shell-manager.js +85 -0
- package/dist/types/src/testing/shell-manager.js.map +1 -0
- package/dist/types/src/translations/index.d.ts +5 -0
- package/dist/types/src/translations/index.d.ts.map +1 -0
- package/dist/types/src/translations/index.js +32 -0
- package/dist/types/src/translations/index.js.map +1 -0
- package/dist/types/src/translations/locales/en-US.d.ts +97 -0
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -0
- package/dist/types/src/translations/locales/en-US.js +103 -0
- package/dist/types/src/translations/locales/en-US.js.map +1 -0
- package/dist/types/src/types/FailReason.d.ts +2 -0
- package/dist/types/src/types/FailReason.d.ts.map +1 -0
- package/dist/types/src/types/FailReason.js +6 -0
- package/dist/types/src/types/FailReason.js.map +1 -0
- package/dist/types/src/types/IInvitation.d.ts +7 -0
- package/dist/types/src/types/IInvitation.d.ts.map +1 -0
- package/dist/types/src/types/IInvitation.js +6 -0
- package/dist/types/src/types/IInvitation.js.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/index.js +22 -0
- package/dist/types/src/types/index.js.map +1 -0
- package/dist/types/src/util/index.d.ts +3 -0
- package/dist/types/src/util/index.d.ts.map +1 -0
- package/dist/types/src/util/index.js +22 -0
- package/dist/types/src/util/index.js.map +1 -0
- package/dist/types/src/util/invitationStatusValue.d.ts +8 -0
- package/dist/types/src/util/invitationStatusValue.d.ts.map +1 -0
- package/dist/types/src/util/invitationStatusValue.js +24 -0
- package/dist/types/src/util/invitationStatusValue.js.map +1 -0
- package/dist/types/src/util/toEmoji.d.ts +2 -0
- package/dist/types/src/util/toEmoji.d.ts.map +1 -0
- package/dist/types/src/util/toEmoji.js +26 -0
- package/dist/types/src/util/toEmoji.js.map +1 -0
- package/package.json +79 -0
- package/src/components/AuthCode.tsx +36 -0
- package/src/components/Clipboard/ClipboardProvider.tsx +26 -0
- package/src/components/Clipboard/CopyButton.tsx +70 -0
- package/src/components/Clipboard/index.ts +6 -0
- package/src/components/CompoundButton/CompoundButton.stories.tsx +49 -0
- package/src/components/CompoundButton/CompoundButton.tsx +89 -0
- package/src/components/CompoundButton/index.ts +5 -0
- package/src/components/IdentityList/DeviceList.tsx +45 -0
- package/src/components/IdentityList/IdentityListItem.tsx +42 -0
- package/src/components/IdentityList/SpaceMemberList.stories.tsx +24 -0
- package/src/components/IdentityList/SpaceMemberList.tsx +65 -0
- package/src/components/IdentityList/index.ts +7 -0
- package/src/components/InvitationList/InvitationList.stories.tsx +44 -0
- package/src/components/InvitationList/InvitationList.tsx +31 -0
- package/src/components/InvitationList/InvitationListContainer.tsx +27 -0
- package/src/components/InvitationList/InvitationListItem.tsx +183 -0
- package/src/components/InvitationList/InvitationListProps.ts +9 -0
- package/src/components/InvitationList/index.ts +7 -0
- package/src/components/Panel/Action.tsx +142 -0
- package/src/components/Panel/Actions.tsx +31 -0
- package/src/components/Panel/CloseButton.tsx +24 -0
- package/src/components/Panel/Emoji.tsx +36 -0
- package/src/components/Panel/Heading.tsx +32 -0
- package/src/components/Panel/Input.tsx +27 -0
- package/src/components/Panel/Label.tsx +14 -0
- package/src/components/Panel/Panel.stories.tsx +52 -0
- package/src/components/Panel/StepHeading.tsx +17 -0
- package/src/components/Panel/index.ts +12 -0
- package/src/components/SpaceListItem.tsx +35 -0
- package/src/components/StorybookDialog.tsx +33 -0
- package/src/components/Viewport/Viewport.stories.tsx +66 -0
- package/src/components/Viewport/Viewport.tsx +120 -0
- package/src/components/Viewport/index.tsx +5 -0
- package/src/components/index.ts +12 -0
- package/src/composites/IdentityDialog/IdentityDialog.tsx +39 -0
- package/src/composites/IdentityDialog/index.ts +5 -0
- package/src/composites/JoinDialog/JoinDialog.tsx +40 -0
- package/src/composites/JoinDialog/index.ts +5 -0
- package/src/composites/Shell/Shell.tsx +98 -0
- package/src/composites/Shell/ShellContext.tsx +163 -0
- package/src/composites/Shell/index.ts +7 -0
- package/src/composites/Shell/memory-shell-runtime.ts +50 -0
- package/src/composites/Shell/run-shell.tsx +38 -0
- package/src/composites/SpaceDialog/SpaceDialog.tsx +37 -0
- package/src/composites/SpaceDialog/index.ts +5 -0
- package/src/composites/index.ts +8 -0
- package/src/index.ts +7 -0
- package/src/panels/IdentityPanel/IdentityPanel.stories.tsx +113 -0
- package/src/panels/IdentityPanel/IdentityPanel.tsx +158 -0
- package/src/panels/IdentityPanel/IdentityPanelProps.ts +36 -0
- package/src/panels/IdentityPanel/identityMachine.ts +131 -0
- package/src/panels/IdentityPanel/index.ts +6 -0
- package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +96 -0
- package/src/panels/IdentityPanel/steps/ProfileForm.tsx +79 -0
- package/src/panels/IdentityPanel/steps/index.ts +6 -0
- package/src/panels/JoinPanel/JoinHeading.tsx +49 -0
- package/src/panels/JoinPanel/JoinPanel.stories.tsx +91 -0
- package/src/panels/JoinPanel/JoinPanel.tsx +415 -0
- package/src/panels/JoinPanel/JoinPanelProps.ts +132 -0
- package/src/panels/JoinPanel/index.ts +6 -0
- package/src/panels/JoinPanel/joinMachine.ts +536 -0
- package/src/panels/JoinPanel/steps/AdditionMethodChooser.tsx +65 -0
- package/src/panels/JoinPanel/steps/IdentityAdded.tsx +75 -0
- package/src/panels/JoinPanel/steps/IdentityInput.tsx +86 -0
- package/src/panels/JoinPanel/steps/InvitationAccepted.tsx +43 -0
- package/src/panels/JoinPanel/steps/InvitationAuthenticator.tsx +99 -0
- package/src/panels/JoinPanel/steps/InvitationInput.tsx +102 -0
- package/src/panels/JoinPanel/steps/InvitationRescuer.tsx +102 -0
- package/src/panels/JoinPanel/steps/ResetIdentity.tsx +71 -0
- package/src/panels/JoinPanel/steps/index.ts +12 -0
- package/src/panels/Panels.stories.tsx +61 -0
- package/src/panels/SpacePanel/SpacePanel.stories.tsx +328 -0
- package/src/panels/SpacePanel/SpacePanel.tsx +122 -0
- package/src/panels/SpacePanel/SpacePanelProps.ts +40 -0
- package/src/panels/SpacePanel/index.ts +6 -0
- package/src/panels/SpacePanel/spaceMachine.ts +72 -0
- package/src/panels/SpacePanel/steps/SpaceManager.tsx +157 -0
- package/src/panels/SpacePanel/steps/index.ts +5 -0
- package/src/panels/index.ts +7 -0
- package/src/playwright/invitations-manager.ts +168 -0
- package/src/playwright/invitations.spec.ts +364 -0
- package/src/playwright/playwright.config.ts +7 -0
- package/src/react.ts +9 -0
- package/src/steps/InvitationManager.tsx +116 -0
- package/src/steps/StepProps.ts +17 -0
- package/src/steps/index.ts +6 -0
- package/src/stories/Invitations.e2e-stories.tsx +231 -0
- package/src/styles/index.ts +6 -0
- package/src/styles/invitationStatusStyles.ts +42 -0
- package/src/styles/panelStyles.ts +5 -0
- package/src/testing/fixtures/identities.ts +16 -0
- package/src/testing/fixtures/index.ts +6 -0
- package/src/testing/fixtures/invitations.ts +23 -0
- package/src/testing/index.ts +7 -0
- package/src/testing/scoped-shell-manager.ts +79 -0
- package/src/testing/shell-manager.ts +102 -0
- package/src/translations/index.ts +7 -0
- package/src/translations/locales/en-US.ts +101 -0
- package/src/types/FailReason.ts +5 -0
- package/src/types/IInvitation.ts +14 -0
- package/src/types/index.ts +6 -0
- package/src/util/index.ts +6 -0
- package/src/util/invitationStatusValue.ts +22 -0
- package/src/util/toEmoji.ts +22 -0
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useMachine } from '@xstate/react';
|
|
6
|
+
import { useCallback } from 'react';
|
|
7
|
+
import {
|
|
8
|
+
assign,
|
|
9
|
+
createMachine,
|
|
10
|
+
type InterpreterFrom,
|
|
11
|
+
type StateFrom,
|
|
12
|
+
type StateNodeConfig,
|
|
13
|
+
type Subscribable,
|
|
14
|
+
type Subscription,
|
|
15
|
+
} from 'xstate';
|
|
16
|
+
|
|
17
|
+
import { log } from '@dxos/log';
|
|
18
|
+
import type { Client } from '@dxos/react-client';
|
|
19
|
+
import { type Identity } from '@dxos/react-client/halo';
|
|
20
|
+
import { type AuthenticatingInvitationObservable, Invitation, InvitationEncoder } from '@dxos/react-client/invitations';
|
|
21
|
+
|
|
22
|
+
import { type JoinPanelMode } from './JoinPanelProps';
|
|
23
|
+
import { type FailReason } from '../../types';
|
|
24
|
+
|
|
25
|
+
type InvitationKindContext = Partial<{
|
|
26
|
+
failReason: FailReason | null;
|
|
27
|
+
unredeemedCode: string;
|
|
28
|
+
invitationObservable: AuthenticatingInvitationObservable;
|
|
29
|
+
invitation: Invitation;
|
|
30
|
+
invitationSubscribable: Subscribable<InvitationEvent>;
|
|
31
|
+
succeededKeys: Set<string>;
|
|
32
|
+
}>;
|
|
33
|
+
|
|
34
|
+
type JoinMachineContext = {
|
|
35
|
+
mode: JoinPanelMode;
|
|
36
|
+
identity: Identity | null;
|
|
37
|
+
halo: InvitationKindContext;
|
|
38
|
+
space: InvitationKindContext;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type SelectIdentityEvent = {
|
|
42
|
+
type: 'selectIdentity';
|
|
43
|
+
identity: Identity;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
type SetInvitationCodeEvent = {
|
|
47
|
+
type: 'setHaloInvitationCode' | 'setSpaceInvitationCode';
|
|
48
|
+
code: string;
|
|
49
|
+
succeededKeys?: Set<string>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
type SetInvitationEvent = {
|
|
53
|
+
type:
|
|
54
|
+
| 'authenticatingHaloInvitation'
|
|
55
|
+
| 'authenticatingSpaceInvitation'
|
|
56
|
+
| 'readyForAuthenticationHaloInvitation'
|
|
57
|
+
| 'readyForAuthenticationSpaceInvitation'
|
|
58
|
+
| 'connectingHaloInvitation'
|
|
59
|
+
| 'connectingSpaceInvitation'
|
|
60
|
+
| 'connectedHaloInvitation'
|
|
61
|
+
| 'connectedSpaceInvitation'
|
|
62
|
+
| 'successHaloInvitation'
|
|
63
|
+
| 'successSpaceInvitation';
|
|
64
|
+
invitation: Invitation;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
type FailInvitationEvent = {
|
|
68
|
+
type: 'failHaloInvitation' | 'failSpaceInvitation';
|
|
69
|
+
reason: FailReason;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
type EmptyInvitationEvent = {
|
|
73
|
+
type:
|
|
74
|
+
| 'authenticateHaloVerificationCode'
|
|
75
|
+
| 'authenticateSpaceVerificationCode'
|
|
76
|
+
| 'resetHaloInvitation'
|
|
77
|
+
| 'resetSpaceInvitation';
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
type InvitationEvent = FailInvitationEvent | SetInvitationCodeEvent | SetInvitationEvent | EmptyInvitationEvent;
|
|
81
|
+
|
|
82
|
+
type Kind = 'Space' | 'Halo';
|
|
83
|
+
|
|
84
|
+
const getInvitationSubscribable = (
|
|
85
|
+
Kind: Kind,
|
|
86
|
+
invitation: AuthenticatingInvitationObservable,
|
|
87
|
+
): Subscribable<InvitationEvent> => {
|
|
88
|
+
log('[subscribing to invitation]', invitation);
|
|
89
|
+
return {
|
|
90
|
+
subscribe: (
|
|
91
|
+
next: (value: InvitationEvent) => void,
|
|
92
|
+
onError?: (error: any) => void,
|
|
93
|
+
complete?: () => void,
|
|
94
|
+
): Subscription =>
|
|
95
|
+
invitation.subscribe(
|
|
96
|
+
(invitation: Invitation) => {
|
|
97
|
+
switch (invitation.state) {
|
|
98
|
+
case Invitation.State.CONNECTING: {
|
|
99
|
+
log('[invitation connecting]', { Kind, invitation });
|
|
100
|
+
return next({ type: `connecting${Kind}Invitation`, invitation });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
case Invitation.State.CONNECTED: {
|
|
104
|
+
log('[invitation connected]', { Kind, invitation });
|
|
105
|
+
return next({ type: `connected${Kind}Invitation`, invitation });
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
case Invitation.State.READY_FOR_AUTHENTICATION: {
|
|
109
|
+
log('[invitation ready for authentication]', { Kind, invitation });
|
|
110
|
+
return next({ type: `readyForAuthentication${Kind}Invitation`, invitation });
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
case Invitation.State.AUTHENTICATING: {
|
|
114
|
+
log('[invitation authenticating]', { Kind, invitation });
|
|
115
|
+
return next({ type: `authenticating${Kind}Invitation`, invitation });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
case Invitation.State.SUCCESS: {
|
|
119
|
+
log('[invitation success]', { Kind, invitation });
|
|
120
|
+
next({ type: `success${Kind}Invitation`, invitation });
|
|
121
|
+
return complete?.();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
case Invitation.State.CANCELLED: {
|
|
125
|
+
log.warn('[invitation cancelled]', { Kind });
|
|
126
|
+
return next({ type: `fail${Kind}Invitation`, reason: 'cancelled' } as FailInvitationEvent);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
case Invitation.State.TIMEOUT: {
|
|
130
|
+
log.error('[invitation timeout]', { Kind });
|
|
131
|
+
return next({ type: `fail${Kind}Invitation`, reason: 'timeout' } as FailInvitationEvent);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
(error: any) => {
|
|
136
|
+
log.error('[invitation errored]', { Kind, error });
|
|
137
|
+
next({ type: `fail${Kind}Invitation`, reason: 'error' });
|
|
138
|
+
return onError?.(error);
|
|
139
|
+
},
|
|
140
|
+
),
|
|
141
|
+
} as Subscribable<InvitationEvent>;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const acceptingInvitationTemplate = (Kind: Kind, successTarget: string) => {
|
|
145
|
+
const config: StateNodeConfig<JoinMachineContext, any, InvitationEvent> = {
|
|
146
|
+
initial: `unknown${Kind}`,
|
|
147
|
+
states: {
|
|
148
|
+
[`unknown${Kind}`]: {
|
|
149
|
+
always: [
|
|
150
|
+
{
|
|
151
|
+
cond: ({ mode }) => mode === 'halo-only' && Kind === 'Space',
|
|
152
|
+
target: '#join.finishingJoiningHalo',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
cond: (context) => !!context[Kind.toLowerCase() as Lowercase<typeof Kind>].unredeemedCode,
|
|
156
|
+
target: `acceptingRedeemed${Kind}Invitation`,
|
|
157
|
+
actions: [`redeem${Kind}InvitationCode`, `invalidate${Kind}InvitationCode`, 'log'],
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
target: `inputting${Kind}InvitationCode`,
|
|
161
|
+
actions: 'log',
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
[`inputting${Kind}InvitationCode`]: {},
|
|
166
|
+
[`acceptingRedeemed${Kind}Invitation`]: {
|
|
167
|
+
invoke: {
|
|
168
|
+
src: (context) => context[Kind.toLowerCase() as Lowercase<Kind>].invitationSubscribable!,
|
|
169
|
+
},
|
|
170
|
+
initial: `unknown${Kind}Invitation`,
|
|
171
|
+
states: {
|
|
172
|
+
[`unknown${Kind}Invitation`]: {
|
|
173
|
+
always: [
|
|
174
|
+
{
|
|
175
|
+
cond: (context) => {
|
|
176
|
+
if (Kind !== 'Space') {
|
|
177
|
+
return false;
|
|
178
|
+
} else {
|
|
179
|
+
const spaceKey = context.space.invitation?.spaceKey?.toHex();
|
|
180
|
+
const succeededKeys = context.space.succeededKeys;
|
|
181
|
+
return spaceKey ? !!succeededKeys?.has(spaceKey) : false;
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
target: successTarget,
|
|
185
|
+
actions: 'log',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
cond: (context) => {
|
|
189
|
+
const invitation = context[Kind.toLowerCase() as Lowercase<Kind>].invitation;
|
|
190
|
+
return !invitation || invitation?.state === Invitation.State.CONNECTING;
|
|
191
|
+
},
|
|
192
|
+
target: `connecting${Kind}Invitation`,
|
|
193
|
+
actions: 'log',
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
target: `inputting${Kind}VerificationCode`,
|
|
197
|
+
actions: 'log',
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
},
|
|
201
|
+
[`connecting${Kind}Invitation`]: {},
|
|
202
|
+
[`inputting${Kind}VerificationCode`]: {},
|
|
203
|
+
[`authenticating${Kind}VerificationCode`]: {
|
|
204
|
+
on: {
|
|
205
|
+
[`readyForAuthentication${Kind}Invitation`]: {
|
|
206
|
+
target: `authenticationFailing${Kind}VerificationCode`,
|
|
207
|
+
actions: ['setInvitation', 'log'],
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
[`authenticationFailing${Kind}VerificationCode`]: {},
|
|
212
|
+
[`failing${Kind}Invitation`]: {},
|
|
213
|
+
[`success${Kind}Invitation`]: {},
|
|
214
|
+
},
|
|
215
|
+
on: {
|
|
216
|
+
[`reset${Kind}Invitation`]: {
|
|
217
|
+
target: `#join${Kind === 'Halo' ? '.choosingIdentity' : ''}.accepting${Kind}Invitation.unknown${Kind}`,
|
|
218
|
+
actions: ['resetInvitation', 'log'],
|
|
219
|
+
},
|
|
220
|
+
[`connecting${Kind}Invitation`]: {
|
|
221
|
+
target: `.connecting${Kind}Invitation`,
|
|
222
|
+
actions: ['setInvitation', 'log'],
|
|
223
|
+
},
|
|
224
|
+
[`connected${Kind}Invitation`]: {
|
|
225
|
+
target: `.connecting${Kind}Invitation`,
|
|
226
|
+
actions: ['setInvitation', 'log'],
|
|
227
|
+
},
|
|
228
|
+
[`readyForAuthentication${Kind}Invitation`]: {
|
|
229
|
+
target: `.inputting${Kind}VerificationCode`,
|
|
230
|
+
actions: ['setInvitation', 'log'],
|
|
231
|
+
},
|
|
232
|
+
[`authenticating${Kind}Invitation`]: {
|
|
233
|
+
target: `.authenticating${Kind}VerificationCode`,
|
|
234
|
+
actions: ['setInvitation', 'log'],
|
|
235
|
+
},
|
|
236
|
+
[`success${Kind}Invitation`]: { target: successTarget, actions: ['setInvitation', 'log'] },
|
|
237
|
+
[`fail${Kind}Invitation`]: {
|
|
238
|
+
target: `.failing${Kind}Invitation`,
|
|
239
|
+
actions: [
|
|
240
|
+
assign({
|
|
241
|
+
[Kind.toLowerCase()]: (context: JoinMachineContext, event: FailInvitationEvent) => ({
|
|
242
|
+
...context[Kind.toLowerCase() as Lowercase<Kind>],
|
|
243
|
+
failReason: event.reason,
|
|
244
|
+
}),
|
|
245
|
+
}),
|
|
246
|
+
'log',
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
on: {
|
|
253
|
+
[`set${Kind}InvitationCode`]: {
|
|
254
|
+
target: `.acceptingRedeemed${Kind}Invitation`,
|
|
255
|
+
actions: [
|
|
256
|
+
assign({
|
|
257
|
+
[Kind.toLowerCase()]: (context: JoinMachineContext, event: SetInvitationCodeEvent) => ({
|
|
258
|
+
...context[Kind.toLowerCase() as Lowercase<Kind>],
|
|
259
|
+
unredeemedCode: event.code,
|
|
260
|
+
succeededKeys: event.succeededKeys,
|
|
261
|
+
}),
|
|
262
|
+
}),
|
|
263
|
+
`redeem${Kind}InvitationCode`,
|
|
264
|
+
`invalidate${Kind}InvitationCode`,
|
|
265
|
+
'log',
|
|
266
|
+
],
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
return config as StateNodeConfig<JoinMachineContext, typeof config, JoinEvent>;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
type EmptyJoinEvent = {
|
|
274
|
+
type:
|
|
275
|
+
| 'resetIdentity'
|
|
276
|
+
| 'recoverIdentity'
|
|
277
|
+
| 'createIdentity'
|
|
278
|
+
| 'acceptHaloInvitation'
|
|
279
|
+
| 'addIdentity'
|
|
280
|
+
| 'selectIdentity'
|
|
281
|
+
| 'deselectAuthMethod';
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
type JoinEvent = InvitationEvent | SelectIdentityEvent | EmptyJoinEvent;
|
|
285
|
+
|
|
286
|
+
const joinMachine = createMachine<JoinMachineContext, JoinEvent>(
|
|
287
|
+
{
|
|
288
|
+
id: 'join',
|
|
289
|
+
predictableActionArguments: true,
|
|
290
|
+
context: {
|
|
291
|
+
mode: 'default',
|
|
292
|
+
identity: null,
|
|
293
|
+
halo: {},
|
|
294
|
+
space: {},
|
|
295
|
+
},
|
|
296
|
+
initial: 'unknown',
|
|
297
|
+
states: {
|
|
298
|
+
unknown: {
|
|
299
|
+
always: [
|
|
300
|
+
{ cond: 'existingIdentity', target: 'resettingIdentity', actions: 'log' },
|
|
301
|
+
{ cond: 'noSelectedIdentity', target: 'choosingIdentity', actions: 'log' },
|
|
302
|
+
{ target: 'acceptingSpaceInvitation', actions: 'log' },
|
|
303
|
+
],
|
|
304
|
+
},
|
|
305
|
+
choosingIdentity: {
|
|
306
|
+
initial: 'unknownAuthMethod',
|
|
307
|
+
states: {
|
|
308
|
+
unknownAuthMethod: {
|
|
309
|
+
always: [
|
|
310
|
+
{ cond: 'hasHaloUnredeemedCode', target: 'acceptingHaloInvitation', actions: 'log' },
|
|
311
|
+
{ target: 'choosingAuthMethod', actions: 'log' },
|
|
312
|
+
],
|
|
313
|
+
},
|
|
314
|
+
choosingAuthMethod: {},
|
|
315
|
+
recoveringIdentity: {},
|
|
316
|
+
creatingIdentity: {},
|
|
317
|
+
acceptingHaloInvitation: acceptingInvitationTemplate('Halo', '#join.acceptingSpaceInvitation'),
|
|
318
|
+
confirmingAddedIdentity: {},
|
|
319
|
+
},
|
|
320
|
+
on: {
|
|
321
|
+
recoverIdentity: { target: '.recoveringIdentity', actions: 'log' },
|
|
322
|
+
createIdentity: { target: '.creatingIdentity', actions: 'log' },
|
|
323
|
+
acceptHaloInvitation: { target: '.acceptingHaloInvitation', actions: 'log' },
|
|
324
|
+
addIdentity: { target: '.confirmingAddedIdentity', actions: 'log' },
|
|
325
|
+
selectIdentity: {
|
|
326
|
+
target: 'acceptingSpaceInvitation',
|
|
327
|
+
actions: ['setIdentity', 'log'],
|
|
328
|
+
},
|
|
329
|
+
deselectAuthMethod: { target: '.choosingAuthMethod', actions: 'log' },
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
resettingIdentity: {},
|
|
333
|
+
acceptingSpaceInvitation: acceptingInvitationTemplate('Space', '#join.finishingJoiningSpace'),
|
|
334
|
+
finishingJoiningSpace: {
|
|
335
|
+
type: 'final',
|
|
336
|
+
},
|
|
337
|
+
finishingJoiningHalo: {
|
|
338
|
+
type: 'final',
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
on: {
|
|
342
|
+
resetIdentity: { target: 'choosingIdentity', actions: 'unsetIdentity' },
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
guards: {
|
|
347
|
+
existingIdentity: ({ identity, mode }, _event) => mode === 'halo-only' && !!identity,
|
|
348
|
+
noSelectedIdentity: ({ identity }, _event) => !identity,
|
|
349
|
+
hasHaloUnredeemedCode: ({ halo }, _event) => !!halo.unredeemedCode,
|
|
350
|
+
noSpaceInvitation: ({ space }, _event) => !space.invitation && !space.unredeemedCode,
|
|
351
|
+
},
|
|
352
|
+
actions: {
|
|
353
|
+
setIdentity: assign<JoinMachineContext, SelectIdentityEvent>({
|
|
354
|
+
identity: (context, event) => event.identity,
|
|
355
|
+
}),
|
|
356
|
+
unsetIdentity: assign<JoinMachineContext>({
|
|
357
|
+
identity: () => null,
|
|
358
|
+
}),
|
|
359
|
+
resetInvitation: assign<JoinMachineContext, EmptyInvitationEvent>({
|
|
360
|
+
halo: (context, event) => {
|
|
361
|
+
if (event.type !== 'resetHaloInvitation') {
|
|
362
|
+
return context.halo;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (context.halo.invitationObservable) {
|
|
366
|
+
void context.halo.invitationObservable.cancel();
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return {
|
|
370
|
+
...context.halo,
|
|
371
|
+
invitation: undefined,
|
|
372
|
+
invitationObservable: undefined,
|
|
373
|
+
invitationSubscribable: undefined,
|
|
374
|
+
};
|
|
375
|
+
},
|
|
376
|
+
space: (context, event) => {
|
|
377
|
+
if (event.type !== 'resetSpaceInvitation') {
|
|
378
|
+
return context.space;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (context.space.invitationObservable) {
|
|
382
|
+
void context.space.invitationObservable.cancel();
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
return {
|
|
386
|
+
...context.space,
|
|
387
|
+
invitation: undefined,
|
|
388
|
+
invitationObservable: undefined,
|
|
389
|
+
invitationSubscribable: undefined,
|
|
390
|
+
};
|
|
391
|
+
},
|
|
392
|
+
}),
|
|
393
|
+
setInvitation: assign<JoinMachineContext, SetInvitationEvent>({
|
|
394
|
+
halo: (context, event) =>
|
|
395
|
+
event.type.includes('Halo') ? { ...context.halo, invitation: event.invitation } : context.halo,
|
|
396
|
+
space: (context, event) =>
|
|
397
|
+
event.type.includes('Space') ? { ...context.space, invitation: event.invitation } : context.space,
|
|
398
|
+
}),
|
|
399
|
+
log: (context, event) => {
|
|
400
|
+
log.info('[transition]', {
|
|
401
|
+
event,
|
|
402
|
+
haloInvitation: context.halo.invitation,
|
|
403
|
+
spaceInvitation: context.space.invitation,
|
|
404
|
+
});
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
);
|
|
409
|
+
|
|
410
|
+
type JoinMachine = typeof joinMachine;
|
|
411
|
+
|
|
412
|
+
type JoinState = StateFrom<JoinMachine>;
|
|
413
|
+
type JoinSendVoid = (...params: Parameters<InterpreterFrom<JoinMachine>['send']>) => void;
|
|
414
|
+
type JoinSend = InterpreterFrom<JoinMachine>['send'] | JoinSendVoid;
|
|
415
|
+
|
|
416
|
+
const defaultCodeFromUrl = (invitationType: 'halo' | 'space', text: string) => {
|
|
417
|
+
try {
|
|
418
|
+
const searchParams = new URLSearchParams(text.substring(text.lastIndexOf('?')));
|
|
419
|
+
return (
|
|
420
|
+
searchParams.get(`${invitationType}InvitationCode`) ??
|
|
421
|
+
searchParams.get(`${invitationType}Invitation`) ??
|
|
422
|
+
searchParams.get('invitationCode') ??
|
|
423
|
+
searchParams.get('invitation') ??
|
|
424
|
+
text
|
|
425
|
+
);
|
|
426
|
+
} catch (err) {
|
|
427
|
+
log.catch(err);
|
|
428
|
+
return text;
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
const useJoinMachine = (
|
|
433
|
+
client: Client,
|
|
434
|
+
options?: Parameters<typeof useMachine<JoinMachine>>[1] & { onInvalidateInvitationCode?: (code: string) => void },
|
|
435
|
+
) => {
|
|
436
|
+
const redeemHaloInvitationCode = useCallback(
|
|
437
|
+
({ halo }: JoinMachineContext) => {
|
|
438
|
+
if (halo.unredeemedCode) {
|
|
439
|
+
try {
|
|
440
|
+
const invitationObservable = client.halo.join(
|
|
441
|
+
InvitationEncoder.decode(defaultCodeFromUrl('halo', halo.unredeemedCode)),
|
|
442
|
+
);
|
|
443
|
+
return {
|
|
444
|
+
...halo,
|
|
445
|
+
invitationObservable,
|
|
446
|
+
invitationSubscribable: getInvitationSubscribable('Halo', invitationObservable),
|
|
447
|
+
};
|
|
448
|
+
} catch (err) {
|
|
449
|
+
log.error('Could not redeem device invitation code', err);
|
|
450
|
+
return halo;
|
|
451
|
+
}
|
|
452
|
+
} else {
|
|
453
|
+
return halo;
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
[client],
|
|
457
|
+
);
|
|
458
|
+
|
|
459
|
+
const redeemSpaceInvitationCode = useCallback(
|
|
460
|
+
({ space }: JoinMachineContext) => {
|
|
461
|
+
if (space.unredeemedCode) {
|
|
462
|
+
try {
|
|
463
|
+
const invitation = InvitationEncoder.decode(defaultCodeFromUrl('space', space.unredeemedCode));
|
|
464
|
+
// Don’t join with the invitation if it has already succeeded.
|
|
465
|
+
if (space.succeededKeys?.has(invitation.spaceKey?.toHex() ?? 'never')) {
|
|
466
|
+
return {
|
|
467
|
+
...space,
|
|
468
|
+
invitation,
|
|
469
|
+
};
|
|
470
|
+
} else {
|
|
471
|
+
const invitationObservable = client.spaces.join(invitation);
|
|
472
|
+
return {
|
|
473
|
+
...space,
|
|
474
|
+
invitationObservable,
|
|
475
|
+
invitationSubscribable: getInvitationSubscribable('Space', invitationObservable),
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
} catch (err) {
|
|
479
|
+
log.error('Could not redeem space invitation code', err);
|
|
480
|
+
return space;
|
|
481
|
+
}
|
|
482
|
+
} else {
|
|
483
|
+
return space;
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
[client],
|
|
487
|
+
);
|
|
488
|
+
|
|
489
|
+
const invalidateHaloInvitationCode = useCallback(
|
|
490
|
+
({ halo }: JoinMachineContext) => {
|
|
491
|
+
if (halo.unredeemedCode) {
|
|
492
|
+
options?.onInvalidateInvitationCode?.(halo.unredeemedCode);
|
|
493
|
+
return {
|
|
494
|
+
...halo,
|
|
495
|
+
unredeemedCode: undefined,
|
|
496
|
+
};
|
|
497
|
+
} else {
|
|
498
|
+
return halo;
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
[options?.onInvalidateInvitationCode],
|
|
502
|
+
);
|
|
503
|
+
|
|
504
|
+
const invalidateSpaceInvitationCode = useCallback(
|
|
505
|
+
({ space }: JoinMachineContext) => {
|
|
506
|
+
if (space.unredeemedCode) {
|
|
507
|
+
options?.onInvalidateInvitationCode?.(space.unredeemedCode);
|
|
508
|
+
return {
|
|
509
|
+
...space,
|
|
510
|
+
unredeemedCode: undefined,
|
|
511
|
+
};
|
|
512
|
+
} else {
|
|
513
|
+
return space;
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
[options?.onInvalidateInvitationCode],
|
|
517
|
+
);
|
|
518
|
+
|
|
519
|
+
return useMachine(joinMachine, {
|
|
520
|
+
...options,
|
|
521
|
+
actions: {
|
|
522
|
+
...options?.actions,
|
|
523
|
+
redeemHaloInvitationCode: assign<JoinMachineContext>({ halo: redeemHaloInvitationCode }),
|
|
524
|
+
redeemSpaceInvitationCode: assign<JoinMachineContext>({ space: redeemSpaceInvitationCode }),
|
|
525
|
+
invalidateHaloInvitationCode: assign<JoinMachineContext>({
|
|
526
|
+
halo: invalidateHaloInvitationCode,
|
|
527
|
+
}),
|
|
528
|
+
invalidateSpaceInvitationCode: assign<JoinMachineContext>({
|
|
529
|
+
space: invalidateSpaceInvitationCode,
|
|
530
|
+
}),
|
|
531
|
+
},
|
|
532
|
+
});
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
export type { JoinMachine, JoinState, JoinSend, JoinEvent, JoinMachineContext };
|
|
536
|
+
export { joinMachine, useJoinMachine };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { CaretRight, Plus, QrCode, Textbox } from '@phosphor-icons/react';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { getSize } from '@dxos/react-ui-theme';
|
|
10
|
+
|
|
11
|
+
import { CompoundButton, StepHeading } from '../../../components';
|
|
12
|
+
import { type JoinStepProps } from '../JoinPanelProps';
|
|
13
|
+
|
|
14
|
+
export type AdditionMethodChooserProps = JoinStepProps;
|
|
15
|
+
|
|
16
|
+
export const AdditionMethodChooser = (viewStateProps: AdditionMethodChooserProps) => {
|
|
17
|
+
const disabled = !viewStateProps.active;
|
|
18
|
+
const { send } = viewStateProps;
|
|
19
|
+
|
|
20
|
+
const { t } = useTranslation('os');
|
|
21
|
+
|
|
22
|
+
const sharedButtonProps = {
|
|
23
|
+
disabled,
|
|
24
|
+
after: <CaretRight className={getSize(4)} weight='bold' />,
|
|
25
|
+
slots: { label: { className: 'text-sm' } },
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
<StepHeading>{t('addition method chooser title')}</StepHeading>
|
|
31
|
+
<div role='none' className='flex flex-col gap-1 grow'>
|
|
32
|
+
<CompoundButton
|
|
33
|
+
{...sharedButtonProps}
|
|
34
|
+
description={t('create identity description')}
|
|
35
|
+
before={<Plus className={getSize(6)} />}
|
|
36
|
+
onClick={() => send({ type: 'createIdentity' })}
|
|
37
|
+
data-autofocus='choosingAuthMethod'
|
|
38
|
+
data-testid='create-identity'
|
|
39
|
+
>
|
|
40
|
+
{t('create identity label')}
|
|
41
|
+
</CompoundButton>
|
|
42
|
+
<CompoundButton
|
|
43
|
+
{...sharedButtonProps}
|
|
44
|
+
description={t('join identity description')}
|
|
45
|
+
before={<QrCode className={getSize(6)} />}
|
|
46
|
+
onClick={() => send({ type: 'acceptHaloInvitation' })}
|
|
47
|
+
data-testid='join-identity'
|
|
48
|
+
>
|
|
49
|
+
{t('join identity label')}
|
|
50
|
+
</CompoundButton>
|
|
51
|
+
<CompoundButton
|
|
52
|
+
{...sharedButtonProps}
|
|
53
|
+
// TODO(mykola): Implement recover.
|
|
54
|
+
disabled={true}
|
|
55
|
+
description={t('recover identity description')}
|
|
56
|
+
before={<Textbox className={getSize(6)} />}
|
|
57
|
+
onClick={() => send({ type: 'recoverIdentity' })}
|
|
58
|
+
data-testid='recover-identity'
|
|
59
|
+
>
|
|
60
|
+
{t('recover identity label')}
|
|
61
|
+
</CompoundButton>
|
|
62
|
+
</div>
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { cloneElement } from 'react';
|
|
6
|
+
|
|
7
|
+
import { generateName } from '@dxos/display-name';
|
|
8
|
+
import type { Identity } from '@dxos/react-client/halo';
|
|
9
|
+
import { Avatar, useId, useJdenticonHref, useTranslation } from '@dxos/react-ui';
|
|
10
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
11
|
+
|
|
12
|
+
import { Action, Actions, StepHeading } from '../../../components';
|
|
13
|
+
import { type JoinPanelMode, type JoinStepProps } from '../JoinPanelProps';
|
|
14
|
+
|
|
15
|
+
export interface IdentityAddedProps extends JoinStepProps {
|
|
16
|
+
mode?: JoinPanelMode;
|
|
17
|
+
addedIdentity?: Identity;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const IdentityAdded = (props: IdentityAddedProps) => {
|
|
21
|
+
const { mode, addedIdentity, active, send, onDone, doneActionParent } = props;
|
|
22
|
+
const disabled = !active;
|
|
23
|
+
const { t } = useTranslation('os');
|
|
24
|
+
|
|
25
|
+
const fallbackValue = addedIdentity?.identityKey.toHex();
|
|
26
|
+
const labelId = useId('identityListItem__label');
|
|
27
|
+
const jdenticon = useJdenticonHref(fallbackValue ?? '', 12);
|
|
28
|
+
const displayName =
|
|
29
|
+
addedIdentity?.profile?.displayName ?? (addedIdentity && generateName(addedIdentity?.identityKey.toHex()));
|
|
30
|
+
|
|
31
|
+
const doneAction = (
|
|
32
|
+
<Action
|
|
33
|
+
{...(onDone && { onClick: () => onDone(null) })}
|
|
34
|
+
disabled={disabled}
|
|
35
|
+
data-autofocus='confirmingAddedIdentity'
|
|
36
|
+
data-testid='identity-added-done'
|
|
37
|
+
>
|
|
38
|
+
<span>{t('done label')}</span>
|
|
39
|
+
</Action>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<>
|
|
44
|
+
<StepHeading>{t('identity added label')}</StepHeading>
|
|
45
|
+
<div role='none' className='grow flex flex-col items-center justify-center text-center gap-2'>
|
|
46
|
+
<Avatar.Root status='active' labelId={labelId}>
|
|
47
|
+
<Avatar.Frame>
|
|
48
|
+
<Avatar.Fallback href={jdenticon} />
|
|
49
|
+
</Avatar.Frame>
|
|
50
|
+
<Avatar.Label classNames={mx('text-lg truncate', !addedIdentity?.profile?.displayName && 'font-mono')}>
|
|
51
|
+
{displayName}
|
|
52
|
+
</Avatar.Label>
|
|
53
|
+
</Avatar.Root>
|
|
54
|
+
</div>
|
|
55
|
+
<Actions>
|
|
56
|
+
{mode === 'halo-only' ? (
|
|
57
|
+
doneActionParent ? (
|
|
58
|
+
cloneElement(doneActionParent, {}, doneAction)
|
|
59
|
+
) : (
|
|
60
|
+
doneAction
|
|
61
|
+
)
|
|
62
|
+
) : (
|
|
63
|
+
<Action
|
|
64
|
+
variant='primary'
|
|
65
|
+
disabled={disabled || !addedIdentity}
|
|
66
|
+
onClick={() => addedIdentity && send({ type: 'selectIdentity', identity: addedIdentity })}
|
|
67
|
+
data-autofocus='confirmingAddedIdentity'
|
|
68
|
+
>
|
|
69
|
+
{t('continue label')}
|
|
70
|
+
</Action>
|
|
71
|
+
)}
|
|
72
|
+
</Actions>
|
|
73
|
+
</>
|
|
74
|
+
);
|
|
75
|
+
};
|