@dxos/shell 0.6.13 → 0.6.14-main.69511f5
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/bundle/shell.mjs +16256 -15872
- package/dist/bundle/shell.mjs.map +1 -1
- package/dist/bundle/shell.umd.js +146 -108
- package/dist/bundle/shell.umd.js.map +1 -1
- package/dist/bundle/style.css +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react.mjs +428 -229
- package/dist/lib/browser/react.mjs.map +4 -4
- package/dist/lib/browser/testing/index.mjs +3 -46
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node/chunk-Q7SFCCGT.cjs +33 -0
- package/dist/lib/node/chunk-Q7SFCCGT.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -0
- package/dist/lib/node/react.cjs +4763 -0
- package/dist/lib/node/react.cjs.map +7 -0
- package/dist/lib/node/react.css +7 -0
- package/dist/lib/node/react.css.map +7 -0
- package/dist/lib/node/testing/index.cjs +181 -0
- package/dist/lib/node/testing/index.cjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/react.css +7 -0
- package/dist/lib/node-esm/react.css.map +7 -0
- package/dist/lib/node-esm/react.mjs +4809 -0
- package/dist/lib/node-esm/react.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +161 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.stories.js +1 -1
- package/dist/types/src/components/CompoundButton/CompoundButton.stories.js.map +1 -1
- package/dist/types/src/components/DeviceList/DeviceList.d.ts +1 -1
- package/dist/types/src/components/DeviceList/DeviceList.d.ts.map +1 -1
- package/dist/types/src/components/DeviceList/DeviceList.js +2 -2
- package/dist/types/src/components/DeviceList/DeviceList.js.map +1 -1
- package/dist/types/src/components/DeviceList/DeviceListItem.d.ts.map +1 -1
- package/dist/types/src/components/DeviceList/DeviceListItem.js +4 -1
- package/dist/types/src/components/DeviceList/DeviceListItem.js.map +1 -1
- package/dist/types/src/components/DeviceList/DeviceListProps.d.ts +2 -0
- package/dist/types/src/components/DeviceList/DeviceListProps.d.ts.map +1 -1
- package/dist/types/src/components/IdentityList/SpaceMemberList.stories.d.ts +0 -3
- package/dist/types/src/components/IdentityList/SpaceMemberList.stories.d.ts.map +1 -1
- package/dist/types/src/components/IdentityList/SpaceMemberList.stories.js +3 -4
- package/dist/types/src/components/IdentityList/SpaceMemberList.stories.js.map +1 -1
- package/dist/types/src/components/InvitationList/InvitationList.stories.d.ts +0 -3
- package/dist/types/src/components/InvitationList/InvitationList.stories.d.ts.map +1 -1
- package/dist/types/src/components/InvitationList/InvitationList.stories.js +11 -12
- package/dist/types/src/components/InvitationList/InvitationList.stories.js.map +1 -1
- package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts.map +1 -1
- package/dist/types/src/components/InvitationList/InvitationListContainer.js +2 -2
- package/dist/types/src/components/InvitationList/InvitationListContainer.js.map +1 -1
- package/dist/types/src/components/Panel/Panel.stories.d.ts +0 -3
- package/dist/types/src/components/Panel/Panel.stories.d.ts.map +1 -1
- package/dist/types/src/components/Panel/Panel.stories.js +1 -2
- package/dist/types/src/components/Panel/Panel.stories.js.map +1 -1
- package/dist/types/src/components/Viewport/Viewport.stories.js +1 -1
- package/dist/types/src/components/Viewport/Viewport.stories.js.map +1 -1
- package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -1
- package/dist/types/src/composites/Shell/Shell.js +14 -3
- package/dist/types/src/composites/Shell/Shell.js.map +1 -1
- package/dist/types/src/composites/Shell/run-shell.js +1 -1
- package/dist/types/src/composites/Shell/run-shell.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +44 -25
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js +7 -2
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts +6 -5
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts +1 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.js +2 -0
- package/dist/types/src/panels/IdentityPanel/identityMachine.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts +3 -5
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +5 -3
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/useAgentHandlers.d.ts +1 -1
- package/dist/types/src/panels/IdentityPanel/useAgentHandlers.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/useAgentHandlers.js +10 -108
- package/dist/types/src/panels/IdentityPanel/useAgentHandlers.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/useEdgeAgentsHandlers.d.ts +8 -0
- package/dist/types/src/panels/IdentityPanel/useEdgeAgentsHandlers.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/useEdgeAgentsHandlers.js +84 -0
- package/dist/types/src/panels/IdentityPanel/useEdgeAgentsHandlers.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/useKubeAgentHandlers.d.ts +8 -0
- package/dist/types/src/panels/IdentityPanel/useKubeAgentHandlers.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/useKubeAgentHandlers.js +119 -0
- package/dist/types/src/panels/IdentityPanel/useKubeAgentHandlers.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.js +24 -16
- package/dist/types/src/panels/JoinPanel/JoinPanel.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.d.ts +3 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.js +3 -2
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts +8 -4
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.js +8 -0
- package/dist/types/src/panels/JoinPanel/joinMachine.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.js +1 -3
- package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/steps/IdentityInput.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/steps/IdentityInput.js +17 -7
- package/dist/types/src/panels/JoinPanel/steps/IdentityInput.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.d.ts +3 -1
- package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.js +9 -6
- package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/steps/InvitationInput.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/steps/InvitationInput.js +8 -2
- package/dist/types/src/panels/JoinPanel/steps/InvitationInput.js.map +1 -1
- package/dist/types/src/panels/Panels.stories.js +1 -1
- package/dist/types/src/panels/Panels.stories.js.map +1 -1
- package/dist/types/src/panels/SpacePanel/SpacePanel.js +1 -1
- package/dist/types/src/panels/SpacePanel/SpacePanel.js.map +1 -1
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.js +16 -16
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.js.map +1 -1
- package/dist/types/src/panels/SpacePanel/SpacePanelProps.d.ts +4 -4
- package/dist/types/src/panels/SpacePanel/SpacePanelProps.d.ts.map +1 -1
- package/dist/types/src/playwright/invitations-manager.d.ts +2 -3
- package/dist/types/src/playwright/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/playwright/invitations-manager.js +8 -15
- package/dist/types/src/playwright/invitations-manager.js.map +1 -1
- package/dist/types/src/playwright/invitations.spec.js +40 -53
- package/dist/types/src/playwright/invitations.spec.js.map +1 -1
- package/dist/types/src/playwright/playwright.config.d.ts +2 -2
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
- package/dist/types/src/playwright/playwright.config.js +12 -2
- package/dist/types/src/playwright/playwright.config.js.map +1 -1
- package/dist/types/src/steps/ConfirmReset.d.ts +1 -1
- package/dist/types/src/steps/ConfirmReset.d.ts.map +1 -1
- package/dist/types/src/steps/ConfirmReset.js +6 -2
- package/dist/types/src/steps/ConfirmReset.js.map +1 -1
- package/dist/types/src/stories/Invitations.e2e-stories.d.ts +1 -3
- package/dist/types/src/stories/Invitations.e2e-stories.d.ts.map +1 -1
- package/dist/types/src/stories/Invitations.e2e-stories.js +14 -6
- package/dist/types/src/stories/Invitations.e2e-stories.js.map +1 -1
- package/dist/types/src/testing/index.d.ts +0 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/index.js +1 -1
- package/dist/types/src/testing/index.js.map +1 -1
- package/dist/types/src/testing/shell-manager.d.ts +1 -0
- package/dist/types/src/testing/shell-manager.d.ts.map +1 -1
- package/dist/types/src/testing/shell-manager.js +2 -7
- package/dist/types/src/testing/shell-manager.js.map +1 -1
- package/dist/types/src/translations/locales/en-US.d.ts +3 -0
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
- package/dist/types/src/translations/locales/en-US.js +6 -3
- package/dist/types/src/translations/locales/en-US.js.map +1 -1
- package/package.json +42 -29
- package/src/components/CompoundButton/CompoundButton.stories.tsx +1 -1
- package/src/components/DeviceList/DeviceList.tsx +2 -1
- package/src/components/DeviceList/DeviceListItem.tsx +8 -0
- package/src/components/DeviceList/DeviceListProps.ts +2 -0
- package/src/components/IdentityList/SpaceMemberList.stories.tsx +2 -3
- package/src/components/InvitationList/InvitationList.stories.tsx +2 -3
- package/src/components/InvitationList/InvitationListContainer.tsx +6 -3
- package/src/components/Panel/Panel.stories.tsx +1 -2
- package/src/components/Viewport/Viewport.stories.tsx +1 -1
- package/src/composites/Shell/Shell.tsx +16 -4
- package/src/composites/Shell/run-shell.tsx +1 -1
- package/src/panels/IdentityPanel/IdentityPanel.stories.tsx +7 -2
- package/src/panels/IdentityPanel/IdentityPanel.tsx +81 -47
- package/src/panels/IdentityPanel/IdentityPanelProps.ts +6 -4
- package/src/panels/IdentityPanel/identityMachine.ts +3 -1
- package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +21 -10
- package/src/panels/IdentityPanel/useAgentHandlers.ts +9 -114
- package/src/panels/IdentityPanel/useEdgeAgentsHandlers.ts +96 -0
- package/src/panels/IdentityPanel/useKubeAgentHandlers.ts +128 -0
- package/src/panels/JoinPanel/JoinPanel.stories.tsx +3 -2
- package/src/panels/JoinPanel/JoinPanel.tsx +31 -9
- package/src/panels/JoinPanel/JoinPanelProps.ts +8 -4
- package/src/panels/JoinPanel/joinMachine.ts +9 -0
- package/src/panels/JoinPanel/steps/AdditionMethodChooser.tsx +0 -2
- package/src/panels/JoinPanel/steps/IdentityInput.tsx +22 -10
- package/src/panels/JoinPanel/steps/InvitationAuthenticator.tsx +29 -16
- package/src/panels/JoinPanel/steps/InvitationInput.tsx +9 -17
- package/src/panels/Panels.stories.tsx +1 -1
- package/src/panels/SpacePanel/SpacePanel.stories.tsx +2 -2
- package/src/panels/SpacePanel/SpacePanel.tsx +3 -3
- package/src/panels/SpacePanel/SpacePanelProps.ts +4 -4
- package/src/playwright/invitations-manager.ts +9 -13
- package/src/playwright/invitations.spec.ts +42 -54
- package/src/playwright/playwright.config.ts +13 -2
- package/src/steps/ConfirmReset.tsx +13 -5
- package/src/stories/Invitations.e2e-stories.tsx +17 -10
- package/src/testing/index.ts +2 -1
- package/src/testing/shell-manager.ts +4 -9
- package/src/translations/locales/en-US.ts +6 -3
|
@@ -571,7 +571,7 @@ import { Button as Button6, List as List2, useTranslation as useTranslation7 } f
|
|
|
571
571
|
import { descriptionText as descriptionText4, getSize as getSize6, mx as mx7 } from "@dxos/react-ui-theme";
|
|
572
572
|
|
|
573
573
|
// packages/sdk/shell/src/components/DeviceList/DeviceListItem.tsx
|
|
574
|
-
import { Compass, Desktop, DeviceMobile, Devices, DotsThree, ShareFat, Power as Power2, Robot, Database as Database2 } from "@phosphor-icons/react";
|
|
574
|
+
import { Compass, Desktop, DeviceMobile, Devices, DotsThree, ShareFat, Power as Power2, Robot, Database as Database2, FirstAidKit } from "@phosphor-icons/react";
|
|
575
575
|
import React9, { forwardRef as forwardRef2 } from "react";
|
|
576
576
|
import { generateName as generateName2 } from "@dxos/display-name";
|
|
577
577
|
import { Device, DeviceType, DeviceKind } from "@dxos/react-client/halo";
|
|
@@ -586,7 +586,7 @@ var iconProps = {
|
|
|
586
586
|
x: 8,
|
|
587
587
|
y: 8
|
|
588
588
|
};
|
|
589
|
-
var DeviceListItem = /* @__PURE__ */ forwardRef2(({ device, onClickAdd, onClickEdit, onClickReset, onClickJoinExisting, classNames, connectionState, onAgentDestroy, ...props }, forwardedRef) => {
|
|
589
|
+
var DeviceListItem = /* @__PURE__ */ forwardRef2(({ device, onClickAdd, onClickEdit, onClickReset, onClickRecover, onClickJoinExisting, classNames, connectionState, onAgentDestroy, ...props }, forwardedRef) => {
|
|
590
590
|
const { t } = useTranslation6("os");
|
|
591
591
|
const fallbackValue = keyToFallback2(device.deviceKey);
|
|
592
592
|
const labelId = useId3("identityListItem__label");
|
|
@@ -649,7 +649,12 @@ var DeviceListItem = /* @__PURE__ */ forwardRef2(({ device, onClickAdd, onClickE
|
|
|
649
649
|
onClick: onClickJoinExisting
|
|
650
650
|
}, /* @__PURE__ */ React9.createElement(ShareFat, {
|
|
651
651
|
className: getSize5(5)
|
|
652
|
-
}), t("choose join new identity label")), /* @__PURE__ */ React9.createElement(DropdownMenu2.Item, {
|
|
652
|
+
}), t("choose join new identity label")), onClickRecover && /* @__PURE__ */ React9.createElement(DropdownMenu2.Item, {
|
|
653
|
+
"data-testid": "device-list-item-current.recover",
|
|
654
|
+
onClick: onClickRecover
|
|
655
|
+
}, /* @__PURE__ */ React9.createElement(FirstAidKit, {
|
|
656
|
+
className: getSize5(5)
|
|
657
|
+
}), t("choose recover identity label")), /* @__PURE__ */ React9.createElement(DropdownMenu2.Item, {
|
|
653
658
|
"data-testid": "device-list-item-current.reset",
|
|
654
659
|
onClick: onClickReset
|
|
655
660
|
}, /* @__PURE__ */ React9.createElement(Power2, {
|
|
@@ -658,7 +663,7 @@ var DeviceListItem = /* @__PURE__ */ forwardRef2(({ device, onClickAdd, onClickE
|
|
|
658
663
|
});
|
|
659
664
|
|
|
660
665
|
// packages/sdk/shell/src/components/DeviceList/DeviceList.tsx
|
|
661
|
-
var DeviceList = ({ devices, connectionState, onClickAdd, onClickEdit, onClickReset, onClickJoinExisting, onAgentDestroy }) => {
|
|
666
|
+
var DeviceList = ({ devices, connectionState, onClickAdd, onClickEdit, onClickReset, onClickRecover, onClickJoinExisting, onAgentDestroy }) => {
|
|
662
667
|
const { t } = useTranslation7("os");
|
|
663
668
|
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("h2", {
|
|
664
669
|
className: mx7(descriptionText4, "text-center mbs-4")
|
|
@@ -668,6 +673,7 @@ var DeviceList = ({ devices, connectionState, onClickAdd, onClickEdit, onClickRe
|
|
|
668
673
|
device,
|
|
669
674
|
onClickEdit: () => onClickEdit?.(device),
|
|
670
675
|
onClickReset,
|
|
676
|
+
onClickRecover,
|
|
671
677
|
onClickJoinExisting,
|
|
672
678
|
connectionState,
|
|
673
679
|
onAgentDestroy
|
|
@@ -925,14 +931,14 @@ var InvitationList = ({ invitations, send, ...invitationProps }) => {
|
|
|
925
931
|
var InvitationListContainer = ({ spaceKey, createInvitationUrl, send }) => {
|
|
926
932
|
const space = useSpace(spaceKey);
|
|
927
933
|
const invitations = useSpaceInvitations(spaceKey);
|
|
928
|
-
const
|
|
934
|
+
const handleClickRemove = useCallback3((invitation) => {
|
|
929
935
|
void invitation.cancel();
|
|
930
936
|
}, [
|
|
931
937
|
space
|
|
932
938
|
]);
|
|
933
939
|
return /* @__PURE__ */ React14.createElement(InvitationList, {
|
|
934
940
|
invitations,
|
|
935
|
-
onClickRemove,
|
|
941
|
+
onClickRemove: handleClickRemove,
|
|
936
942
|
createInvitationUrl,
|
|
937
943
|
send
|
|
938
944
|
});
|
|
@@ -1237,15 +1243,16 @@ import React42 from "react";
|
|
|
1237
1243
|
import { Dialog, useId as useId10 } from "@dxos/react-ui";
|
|
1238
1244
|
|
|
1239
1245
|
// packages/sdk/shell/src/panels/IdentityPanel/IdentityPanel.tsx
|
|
1240
|
-
import { Key, Plugs, PlugsConnected } from "@phosphor-icons/react";
|
|
1241
|
-
import React29, { useEffect as
|
|
1246
|
+
import { FirstAidKit as FirstAidKit2, Key, Plugs, PlugsConnected } from "@phosphor-icons/react";
|
|
1247
|
+
import React29, { useEffect as useEffect4, useMemo as useMemo3, useState as useState9 } from "react";
|
|
1242
1248
|
import { generateName as generateName3 } from "@dxos/display-name";
|
|
1249
|
+
import { invariant as invariant3 } from "@dxos/invariant";
|
|
1243
1250
|
import { log as log6 } from "@dxos/log";
|
|
1244
|
-
import { useClient as
|
|
1251
|
+
import { useClient as useClient6 } from "@dxos/react-client";
|
|
1245
1252
|
import { useIdentity, useDevices, useHaloInvitations as useHaloInvitations2 } from "@dxos/react-client/halo";
|
|
1246
1253
|
import { useInvitationStatus as useInvitationStatus2 } from "@dxos/react-client/invitations";
|
|
1247
1254
|
import { useNetworkStatus, ConnectionState as ConnectionState2 } from "@dxos/react-client/mesh";
|
|
1248
|
-
import { Avatar as Avatar6,
|
|
1255
|
+
import { Avatar as Avatar6, Input as Input2, Toolbar as Toolbar3, Tooltip as Tooltip7, useId as useId6, useTranslation as useTranslation14 } from "@dxos/react-ui";
|
|
1249
1256
|
import { getSize as getSize13 } from "@dxos/react-ui-theme";
|
|
1250
1257
|
import { hexToEmoji as hexToEmoji4, hexToHue as hexToHue2, keyToFallback as keyToFallback3 } from "@dxos/util";
|
|
1251
1258
|
|
|
@@ -1282,6 +1289,7 @@ var identityMachine = createMachine({
|
|
|
1282
1289
|
choosingAction: {},
|
|
1283
1290
|
managingDeviceInvitation: {},
|
|
1284
1291
|
confirmingResetStorage: {},
|
|
1292
|
+
confirmingRecover: {},
|
|
1285
1293
|
confirmingJoinNewIdentity: {}
|
|
1286
1294
|
},
|
|
1287
1295
|
on: {
|
|
@@ -1310,6 +1318,10 @@ var identityMachine = createMachine({
|
|
|
1310
1318
|
target: ".confirmingJoinNewIdentity",
|
|
1311
1319
|
actions: "log"
|
|
1312
1320
|
},
|
|
1321
|
+
chooseRecoverIdentity: {
|
|
1322
|
+
target: ".confirmingRecover",
|
|
1323
|
+
actions: "log"
|
|
1324
|
+
},
|
|
1313
1325
|
chooseResetStorage: {
|
|
1314
1326
|
target: ".confirmingResetStorage",
|
|
1315
1327
|
actions: "log"
|
|
@@ -1335,7 +1347,7 @@ var identityMachine = createMachine({
|
|
|
1335
1347
|
context
|
|
1336
1348
|
}, {
|
|
1337
1349
|
F: __dxlog_file,
|
|
1338
|
-
L:
|
|
1350
|
+
L: 98,
|
|
1339
1351
|
S: void 0,
|
|
1340
1352
|
C: (f, a) => f(...a)
|
|
1341
1353
|
});
|
|
@@ -1392,12 +1404,22 @@ var IdentityActionChooser = (props) => {
|
|
|
1392
1404
|
invitation
|
|
1393
1405
|
});
|
|
1394
1406
|
};
|
|
1407
|
+
const isProduction = client.config.values.runtime?.app?.env?.DX_ENVIRONMENT === "production";
|
|
1395
1408
|
return /* @__PURE__ */ React25.createElement(IdentityActionChooserImpl, {
|
|
1396
1409
|
...props,
|
|
1397
|
-
|
|
1410
|
+
onClickAdd: createInvitation,
|
|
1411
|
+
onClickJoinExisting: () => send?.({
|
|
1412
|
+
type: "chooseJoinNewIdentity"
|
|
1413
|
+
}),
|
|
1414
|
+
onClickRecover: isProduction ? void 0 : () => send?.({
|
|
1415
|
+
type: "chooseRecoverIdentity"
|
|
1416
|
+
}),
|
|
1417
|
+
onClickReset: () => send?.({
|
|
1418
|
+
type: "chooseResetStorage"
|
|
1419
|
+
})
|
|
1398
1420
|
});
|
|
1399
1421
|
};
|
|
1400
|
-
var IdentityActionChooserImpl = ({
|
|
1422
|
+
var IdentityActionChooserImpl = ({ devices, connectionState, agentHostingEnabled, onClickAdd, onClickJoinExisting, onClickRecover, onClickReset, ...agentProps }) => {
|
|
1401
1423
|
const managedDeviceAvailable = devices.find((device) => device.profile?.type === DeviceType2.AGENT_MANAGED);
|
|
1402
1424
|
return /* @__PURE__ */ React25.createElement("div", {
|
|
1403
1425
|
role: "none",
|
|
@@ -1405,13 +1427,10 @@ var IdentityActionChooserImpl = ({ send, onCreateInvitationClick, devices, conne
|
|
|
1405
1427
|
}, /* @__PURE__ */ React25.createElement(DeviceList, {
|
|
1406
1428
|
devices,
|
|
1407
1429
|
connectionState,
|
|
1408
|
-
onClickAdd
|
|
1409
|
-
onClickJoinExisting
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
onClickReset: () => send?.({
|
|
1413
|
-
type: "chooseResetStorage"
|
|
1414
|
-
}),
|
|
1430
|
+
onClickAdd,
|
|
1431
|
+
onClickJoinExisting,
|
|
1432
|
+
onClickRecover,
|
|
1433
|
+
onClickReset,
|
|
1415
1434
|
onAgentDestroy: agentProps.onAgentDestroy
|
|
1416
1435
|
}), !managedDeviceAvailable && agentHostingEnabled && /* @__PURE__ */ React25.createElement(AgentConfig, agentProps));
|
|
1417
1436
|
};
|
|
@@ -1423,17 +1442,105 @@ import { useTranslation as useTranslation11 } from "@dxos/react-ui";
|
|
|
1423
1442
|
import { hexToEmoji as hexToEmoji2, hexToHue } from "@dxos/util";
|
|
1424
1443
|
|
|
1425
1444
|
// packages/sdk/shell/src/panels/IdentityPanel/useAgentHandlers.ts
|
|
1426
|
-
import {
|
|
1445
|
+
import { useClient as useClient5 } from "@dxos/react-client";
|
|
1446
|
+
|
|
1447
|
+
// packages/sdk/shell/src/panels/IdentityPanel/useEdgeAgentsHandlers.ts
|
|
1448
|
+
import { useEffect as useEffect2, useState as useState6 } from "react";
|
|
1427
1449
|
import { invariant } from "@dxos/invariant";
|
|
1428
|
-
import {
|
|
1429
|
-
import { useClient as useClient3
|
|
1430
|
-
|
|
1431
|
-
var
|
|
1432
|
-
var useAgentHandlers = ({ invitations, identity }) => {
|
|
1450
|
+
import { QueryAgentStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
|
|
1451
|
+
import { useClient as useClient3 } from "@dxos/react-client";
|
|
1452
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/IdentityPanel/useEdgeAgentsHandlers.ts";
|
|
1453
|
+
var useEdgeAgentHandlers = ({ identity }) => {
|
|
1433
1454
|
const [validationMessage, setValidationMessage] = useState6("");
|
|
1455
|
+
const [lastReceivedStatus, setLastReceivedStatus] = useState6(QueryAgentStatusResponse.AgentStatus.UNKNOWN);
|
|
1434
1456
|
const [agentStatus, setAgentStatus] = useState6("getting");
|
|
1435
|
-
const agentHostingProviderClient = useAgentHostingClient();
|
|
1436
1457
|
const client = useClient3();
|
|
1458
|
+
const agentHostingEnabled = Boolean(client.config.values.runtime?.client?.edgeFeatures?.agents);
|
|
1459
|
+
const handleStatus = (status) => {
|
|
1460
|
+
switch (status) {
|
|
1461
|
+
case QueryAgentStatusResponse.AgentStatus.ACTIVE:
|
|
1462
|
+
case QueryAgentStatusResponse.AgentStatus.INACTIVE:
|
|
1463
|
+
setAgentStatus("created");
|
|
1464
|
+
break;
|
|
1465
|
+
case QueryAgentStatusResponse.AgentStatus.NOT_FOUND:
|
|
1466
|
+
setAgentStatus("creatable");
|
|
1467
|
+
break;
|
|
1468
|
+
case QueryAgentStatusResponse.AgentStatus.UNKNOWN:
|
|
1469
|
+
setAgentStatus("getting");
|
|
1470
|
+
break;
|
|
1471
|
+
}
|
|
1472
|
+
};
|
|
1473
|
+
useEffect2(() => {
|
|
1474
|
+
const stream = client.services.services.EdgeAgentService?.queryAgentStatus();
|
|
1475
|
+
stream?.subscribe(({ status }) => {
|
|
1476
|
+
setLastReceivedStatus(status);
|
|
1477
|
+
handleStatus(status);
|
|
1478
|
+
});
|
|
1479
|
+
return () => {
|
|
1480
|
+
void stream?.close().catch(() => {
|
|
1481
|
+
});
|
|
1482
|
+
};
|
|
1483
|
+
}, []);
|
|
1484
|
+
const onAgentCreate = async () => {
|
|
1485
|
+
invariant(identity, "Identity not found", {
|
|
1486
|
+
F: __dxlog_file3,
|
|
1487
|
+
L: 56,
|
|
1488
|
+
S: void 0,
|
|
1489
|
+
A: [
|
|
1490
|
+
"identity",
|
|
1491
|
+
"'Identity not found'"
|
|
1492
|
+
]
|
|
1493
|
+
});
|
|
1494
|
+
const service = client.services.services.EdgeAgentService;
|
|
1495
|
+
if (!service) {
|
|
1496
|
+
setAgentStatus("error");
|
|
1497
|
+
setValidationMessage("Agent service not initialized.");
|
|
1498
|
+
return;
|
|
1499
|
+
}
|
|
1500
|
+
if (!agentHostingEnabled) {
|
|
1501
|
+
setAgentStatus("error");
|
|
1502
|
+
setValidationMessage("Edge agents are disabled in config.");
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1505
|
+
setAgentStatus("creating");
|
|
1506
|
+
setValidationMessage("");
|
|
1507
|
+
try {
|
|
1508
|
+
await service.createAgent();
|
|
1509
|
+
setAgentStatus("created");
|
|
1510
|
+
} catch (err) {
|
|
1511
|
+
setAgentStatus("error");
|
|
1512
|
+
setValidationMessage(`Error creating an agent: ${err.message}`);
|
|
1513
|
+
}
|
|
1514
|
+
};
|
|
1515
|
+
const onAgentDestroy = async () => {
|
|
1516
|
+
setValidationMessage("Agents are non-destructible.");
|
|
1517
|
+
};
|
|
1518
|
+
const onAgentRefresh = async () => {
|
|
1519
|
+
setValidationMessage("");
|
|
1520
|
+
handleStatus(lastReceivedStatus);
|
|
1521
|
+
};
|
|
1522
|
+
return {
|
|
1523
|
+
onAgentCreate,
|
|
1524
|
+
onAgentDestroy,
|
|
1525
|
+
onAgentRefresh,
|
|
1526
|
+
validationMessage,
|
|
1527
|
+
agentStatus,
|
|
1528
|
+
agentHostingEnabled
|
|
1529
|
+
};
|
|
1530
|
+
};
|
|
1531
|
+
|
|
1532
|
+
// packages/sdk/shell/src/panels/IdentityPanel/useKubeAgentHandlers.ts
|
|
1533
|
+
import { useCallback as useCallback4, useEffect as useEffect3, useState as useState7 } from "react";
|
|
1534
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
1535
|
+
import { log as log4 } from "@dxos/log";
|
|
1536
|
+
import { useClient as useClient4, useAgentHostingClient } from "@dxos/react-client";
|
|
1537
|
+
import { Invitation as Invitation3, InvitationEncoder as InvitationEncoder2 } from "@dxos/react-client/invitations";
|
|
1538
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/IdentityPanel/useKubeAgentHandlers.ts";
|
|
1539
|
+
var useKubeAgentHandlers = ({ invitations, identity }) => {
|
|
1540
|
+
const [validationMessage, setValidationMessage] = useState7("");
|
|
1541
|
+
const [agentStatus, setAgentStatus] = useState7("getting");
|
|
1542
|
+
const agentHostingProviderClient = useAgentHostingClient();
|
|
1543
|
+
const client = useClient4();
|
|
1437
1544
|
const updateAgentStatus = async () => {
|
|
1438
1545
|
if (agentHostingProviderClient) {
|
|
1439
1546
|
setAgentStatus("getting");
|
|
@@ -1454,8 +1561,8 @@ var useAgentHandlers = ({ invitations, identity }) => {
|
|
|
1454
1561
|
}
|
|
1455
1562
|
};
|
|
1456
1563
|
const createAgent = async (invitationCode) => {
|
|
1457
|
-
|
|
1458
|
-
F:
|
|
1564
|
+
invariant2(identity, "Identity not found", {
|
|
1565
|
+
F: __dxlog_file4,
|
|
1459
1566
|
L: 50,
|
|
1460
1567
|
S: void 0,
|
|
1461
1568
|
A: [
|
|
@@ -1484,8 +1591,8 @@ var useAgentHandlers = ({ invitations, identity }) => {
|
|
|
1484
1591
|
}
|
|
1485
1592
|
};
|
|
1486
1593
|
const destroyAgent = async () => {
|
|
1487
|
-
|
|
1488
|
-
F:
|
|
1594
|
+
invariant2(identity, "Identity not found", {
|
|
1595
|
+
F: __dxlog_file4,
|
|
1489
1596
|
L: 73,
|
|
1490
1597
|
S: void 0,
|
|
1491
1598
|
A: [
|
|
@@ -1508,7 +1615,7 @@ var useAgentHandlers = ({ invitations, identity }) => {
|
|
|
1508
1615
|
setValidationMessage("No agent provider configured.");
|
|
1509
1616
|
}
|
|
1510
1617
|
};
|
|
1511
|
-
|
|
1618
|
+
useEffect3(() => {
|
|
1512
1619
|
void updateAgentStatus();
|
|
1513
1620
|
}, []);
|
|
1514
1621
|
const handleAgentCreate = useCallback4(async (invitation) => {
|
|
@@ -1518,7 +1625,7 @@ var useAgentHandlers = ({ invitations, identity }) => {
|
|
|
1518
1625
|
invitationCode,
|
|
1519
1626
|
authCode: invitation.authCode
|
|
1520
1627
|
}), void 0, {
|
|
1521
|
-
F:
|
|
1628
|
+
F: __dxlog_file4,
|
|
1522
1629
|
L: 97,
|
|
1523
1630
|
S: void 0,
|
|
1524
1631
|
C: (f, a) => f(...a)
|
|
@@ -1549,6 +1656,16 @@ var useAgentHandlers = ({ invitations, identity }) => {
|
|
|
1549
1656
|
};
|
|
1550
1657
|
};
|
|
1551
1658
|
|
|
1659
|
+
// packages/sdk/shell/src/panels/IdentityPanel/useAgentHandlers.ts
|
|
1660
|
+
var useAgentHandlers = (params) => {
|
|
1661
|
+
const client = useClient5();
|
|
1662
|
+
if (client.config.values?.runtime?.client?.edgeFeatures?.agents) {
|
|
1663
|
+
return useEdgeAgentHandlers(params);
|
|
1664
|
+
} else {
|
|
1665
|
+
return useKubeAgentHandlers(params);
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
|
|
1552
1669
|
// packages/sdk/shell/src/steps/InvitationManager.tsx
|
|
1553
1670
|
import { Check as Check4, X as X3 } from "@phosphor-icons/react";
|
|
1554
1671
|
import React27, { useMemo as useMemo2 } from "react";
|
|
@@ -1680,20 +1797,20 @@ var InvitationManager = ({ invitationUrl, active, send, status, multiUse, authCo
|
|
|
1680
1797
|
|
|
1681
1798
|
// packages/sdk/shell/src/steps/ConfirmReset.tsx
|
|
1682
1799
|
import { Warning } from "@phosphor-icons/react";
|
|
1683
|
-
import React28, { useState as
|
|
1800
|
+
import React28, { useState as useState8 } from "react";
|
|
1684
1801
|
import { log as log5 } from "@dxos/log";
|
|
1685
1802
|
import { Message, useTranslation as useTranslation13 } from "@dxos/react-ui";
|
|
1686
1803
|
import { getSize as getSize12, mx as mx21 } from "@dxos/react-ui-theme";
|
|
1687
|
-
var
|
|
1804
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/steps/ConfirmReset.tsx";
|
|
1688
1805
|
var ConfirmReset = ({ active, onCancel, onConfirm, mode }) => {
|
|
1689
1806
|
const { t } = useTranslation13("os");
|
|
1690
|
-
const [validationMessage, setValidationMessage] =
|
|
1691
|
-
const [pending, setPending] =
|
|
1807
|
+
const [validationMessage, setValidationMessage] = useState8("");
|
|
1808
|
+
const [pending, setPending] = useState8(false);
|
|
1692
1809
|
const processReset = async () => {
|
|
1693
1810
|
setPending(true);
|
|
1694
1811
|
return onConfirm?.().then(() => setPending(false), (error) => {
|
|
1695
1812
|
log5.catch(error, void 0, {
|
|
1696
|
-
F:
|
|
1813
|
+
F: __dxlog_file5,
|
|
1697
1814
|
L: 38,
|
|
1698
1815
|
S: void 0,
|
|
1699
1816
|
C: (f, a) => f(...a)
|
|
@@ -1714,8 +1831,8 @@ var ConfirmReset = ({ active, onCancel, onConfirm, mode }) => {
|
|
|
1714
1831
|
var ConfirmResetImpl = ({ disabled, pending, validationMessage, onConfirm, onCancel, mode }) => {
|
|
1715
1832
|
const { t } = useTranslation13("os");
|
|
1716
1833
|
const confirmationValue = t("confirmation value");
|
|
1717
|
-
const [inputValue, setInputValue] =
|
|
1718
|
-
const testIdAffix = mode === "join new identity" ? "join-new-identity" : "reset-storage";
|
|
1834
|
+
const [inputValue, setInputValue] = useState8("");
|
|
1835
|
+
const testIdAffix = mode === "join new identity" ? "join-new-identity" : mode === "recover" ? "recover" : "reset-storage";
|
|
1719
1836
|
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement("div", {
|
|
1720
1837
|
role: "none",
|
|
1721
1838
|
className: "grow flex flex-col gap-2 justify-center"
|
|
@@ -1727,7 +1844,7 @@ var ConfirmResetImpl = ({ disabled, pending, validationMessage, onConfirm, onCan
|
|
|
1727
1844
|
validationMessage,
|
|
1728
1845
|
label: /* @__PURE__ */ React28.createElement(StepHeading, {
|
|
1729
1846
|
className: "text-start mlb-2"
|
|
1730
|
-
}, t(mode === "join new identity" ? "join new identity input label" : "reset storage input label", {
|
|
1847
|
+
}, t(mode === "join new identity" ? "join new identity input label" : mode === "recover" ? "recover reset input label" : "reset storage input label", {
|
|
1731
1848
|
confirmationValue
|
|
1732
1849
|
})),
|
|
1733
1850
|
disabled,
|
|
@@ -1749,19 +1866,20 @@ var ConfirmResetImpl = ({ disabled, pending, validationMessage, onConfirm, onCan
|
|
|
1749
1866
|
};
|
|
1750
1867
|
|
|
1751
1868
|
// packages/sdk/shell/src/panels/IdentityPanel/IdentityPanel.tsx
|
|
1752
|
-
var
|
|
1869
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/IdentityPanel/IdentityPanel.tsx";
|
|
1753
1870
|
var viewStyles = "pbs-1 pbe-3 pli-3";
|
|
1754
1871
|
var getHueValue = (identity) => identity?.profile?.data?.hue || hexToHue2(identity?.identityKey.toHex() ?? "0");
|
|
1755
1872
|
var getEmojiValue = (identity) => identity?.profile?.data?.emoji || hexToEmoji4(identity?.identityKey.toHex() ?? "0");
|
|
1756
1873
|
var IdentityHeading = ({ titleId, title, identity, onDone, onUpdateProfile, connectionState, onChangeConnectionState }) => {
|
|
1874
|
+
const client = useClient6();
|
|
1757
1875
|
const fallbackValue = keyToFallback3(identity.identityKey);
|
|
1758
1876
|
const { t } = useTranslation14("os");
|
|
1759
|
-
const [displayName, setDisplayName] =
|
|
1760
|
-
const [emoji, setEmojiDirectly] =
|
|
1761
|
-
const [hue, setHueDirectly] =
|
|
1877
|
+
const [displayName, setDisplayName] = useState9(identity.profile?.displayName ?? "");
|
|
1878
|
+
const [emoji, setEmojiDirectly] = useState9(getEmojiValue(identity));
|
|
1879
|
+
const [hue, setHueDirectly] = useState9(getHueValue(identity));
|
|
1762
1880
|
const { textValue, setTextValue } = useClipboardContext();
|
|
1763
1881
|
const identityHex = identity.identityKey.toHex();
|
|
1764
|
-
const
|
|
1882
|
+
const publicKeyCopied = textValue === identityHex;
|
|
1765
1883
|
const setEmoji = (nextEmoji) => {
|
|
1766
1884
|
setEmojiDirectly(nextEmoji);
|
|
1767
1885
|
void onUpdateProfile?.({
|
|
@@ -1782,8 +1900,21 @@ var IdentityHeading = ({ titleId, title, identity, onDone, onUpdateProfile, conn
|
|
|
1782
1900
|
}
|
|
1783
1901
|
});
|
|
1784
1902
|
};
|
|
1903
|
+
const handleRecoveryCode = async () => {
|
|
1904
|
+
invariant3(client.services.services.IdentityService, "IdentityService not available", {
|
|
1905
|
+
F: __dxlog_file6,
|
|
1906
|
+
L: 76,
|
|
1907
|
+
S: void 0,
|
|
1908
|
+
A: [
|
|
1909
|
+
"client.services.services.IdentityService",
|
|
1910
|
+
"'IdentityService not available'"
|
|
1911
|
+
]
|
|
1912
|
+
});
|
|
1913
|
+
const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();
|
|
1914
|
+
void setTextValue(seedphrase);
|
|
1915
|
+
};
|
|
1785
1916
|
const isConnected = connectionState === ConnectionState2.ONLINE;
|
|
1786
|
-
const
|
|
1917
|
+
const isProduction = client.config.values.runtime?.app?.env?.DX_ENVIRONMENT === "production";
|
|
1787
1918
|
return /* @__PURE__ */ React29.createElement(Heading, {
|
|
1788
1919
|
titleId,
|
|
1789
1920
|
title,
|
|
@@ -1827,7 +1958,7 @@ var IdentityHeading = ({ titleId, title, identity, onDone, onUpdateProfile, conn
|
|
|
1827
1958
|
hue,
|
|
1828
1959
|
onChangeHue: setHue,
|
|
1829
1960
|
classNames: "bs-[--rail-action]"
|
|
1830
|
-
}),
|
|
1961
|
+
}), /* @__PURE__ */ React29.createElement(Tooltip7.Root, null, /* @__PURE__ */ React29.createElement(Tooltip7.Trigger, {
|
|
1831
1962
|
asChild: true
|
|
1832
1963
|
}, /* @__PURE__ */ React29.createElement(Toolbar3.Button, {
|
|
1833
1964
|
classNames: "bs-[--rail-action]",
|
|
@@ -1835,12 +1966,22 @@ var IdentityHeading = ({ titleId, title, identity, onDone, onUpdateProfile, conn
|
|
|
1835
1966
|
onClick: () => setTextValue(identityHex)
|
|
1836
1967
|
}, /* @__PURE__ */ React29.createElement("span", {
|
|
1837
1968
|
className: "sr-only"
|
|
1838
|
-
}, t(
|
|
1969
|
+
}, t(publicKeyCopied ? "copy success label" : "copy self public key label")), /* @__PURE__ */ React29.createElement(Key, {
|
|
1970
|
+
className: getSize13(5)
|
|
1971
|
+
}))), /* @__PURE__ */ React29.createElement(Tooltip7.Portal, null, /* @__PURE__ */ React29.createElement(Tooltip7.Content, {
|
|
1972
|
+
side: "bottom",
|
|
1973
|
+
classNames: "z-50"
|
|
1974
|
+
}, t(publicKeyCopied ? "copy success label" : "copy self public key label"), /* @__PURE__ */ React29.createElement(Tooltip7.Arrow, null)))), !isProduction && /* @__PURE__ */ React29.createElement(Tooltip7.Root, null, /* @__PURE__ */ React29.createElement(Tooltip7.Trigger, {
|
|
1975
|
+
asChild: true
|
|
1976
|
+
}, /* @__PURE__ */ React29.createElement(Toolbar3.Button, {
|
|
1977
|
+
classNames: "bs-[--rail-action]",
|
|
1978
|
+
onClick: handleRecoveryCode
|
|
1979
|
+
}, /* @__PURE__ */ React29.createElement(FirstAidKit2, {
|
|
1839
1980
|
className: getSize13(5)
|
|
1840
1981
|
}))), /* @__PURE__ */ React29.createElement(Tooltip7.Portal, null, /* @__PURE__ */ React29.createElement(Tooltip7.Content, {
|
|
1841
1982
|
side: "bottom",
|
|
1842
1983
|
classNames: "z-50"
|
|
1843
|
-
}, t(
|
|
1984
|
+
}, t("create recovery code label"), /* @__PURE__ */ React29.createElement(Tooltip7.Arrow, null)))), /* @__PURE__ */ React29.createElement(Tooltip7.Root, null, /* @__PURE__ */ React29.createElement(Tooltip7.Trigger, {
|
|
1844
1985
|
asChild: true
|
|
1845
1986
|
}, /* @__PURE__ */ React29.createElement(Toolbar3.Button, {
|
|
1846
1987
|
classNames: [
|
|
@@ -1857,10 +1998,10 @@ var IdentityHeading = ({ titleId, title, identity, onDone, onUpdateProfile, conn
|
|
|
1857
1998
|
}))), /* @__PURE__ */ React29.createElement(Tooltip7.Portal, null, /* @__PURE__ */ React29.createElement(Tooltip7.Content, {
|
|
1858
1999
|
side: "bottom",
|
|
1859
2000
|
classNames: "z-50"
|
|
1860
|
-
}, t(isConnected ? "disconnect label" : "connect label"), /* @__PURE__ */ React29.createElement(Tooltip7.Arrow, null)))))))
|
|
2001
|
+
}, t(isConnected ? "disconnect label" : "connect label"), /* @__PURE__ */ React29.createElement(Tooltip7.Arrow, null)))))));
|
|
1861
2002
|
};
|
|
1862
2003
|
var IdentityPanelImpl = (props) => {
|
|
1863
|
-
const { identity, titleId, activeView, onUpdateProfile, onResetStorage, onJoinNewIdentity, IdentityActionChooser: IdentityActionChooserComponent = IdentityActionChooser, InvitationManager: InvitationManagerComponent = InvitationManager, connectionState, onChangeConnectionState, onDone, ...rest } = props;
|
|
2004
|
+
const { identity, titleId, activeView, onUpdateProfile, onResetStorage, onRecover, onJoinNewIdentity, IdentityActionChooser: IdentityActionChooserComponent = IdentityActionChooser, InvitationManager: InvitationManagerComponent = InvitationManager, connectionState, onChangeConnectionState, onDone, ...rest } = props;
|
|
1864
2005
|
const { t } = useTranslation14("os");
|
|
1865
2006
|
const title = useMemo3(() => {
|
|
1866
2007
|
switch (activeView) {
|
|
@@ -1874,9 +2015,7 @@ var IdentityPanelImpl = (props) => {
|
|
|
1874
2015
|
t
|
|
1875
2016
|
]);
|
|
1876
2017
|
const onCancelReset = () => rest.send?.("unchooseAction");
|
|
1877
|
-
return /* @__PURE__ */ React29.createElement(
|
|
1878
|
-
density: "fine"
|
|
1879
|
-
}, /* @__PURE__ */ React29.createElement(IdentityHeading, {
|
|
2018
|
+
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(IdentityHeading, {
|
|
1880
2019
|
identity,
|
|
1881
2020
|
titleId,
|
|
1882
2021
|
title,
|
|
@@ -1909,6 +2048,15 @@ var IdentityPanelImpl = (props) => {
|
|
|
1909
2048
|
mode: "join new identity",
|
|
1910
2049
|
onConfirm: onJoinNewIdentity,
|
|
1911
2050
|
onCancel: onCancelReset
|
|
2051
|
+
})), /* @__PURE__ */ React29.createElement(Viewport.View, {
|
|
2052
|
+
classNames: viewStyles,
|
|
2053
|
+
id: "confirm recover"
|
|
2054
|
+
}, /* @__PURE__ */ React29.createElement(ConfirmReset, {
|
|
2055
|
+
active: activeView === "confirm recover",
|
|
2056
|
+
...rest,
|
|
2057
|
+
mode: "recover",
|
|
2058
|
+
onConfirm: onRecover,
|
|
2059
|
+
onCancel: onCancelReset
|
|
1912
2060
|
})), /* @__PURE__ */ React29.createElement(Viewport.View, {
|
|
1913
2061
|
classNames: viewStyles,
|
|
1914
2062
|
id: "confirm reset storage"
|
|
@@ -1929,7 +2077,7 @@ var IdentityPanelWithInvitationImpl = ({ invitation, ...props }) => {
|
|
|
1929
2077
|
};
|
|
1930
2078
|
var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => code, initialDisposition = "default", ...props }) => {
|
|
1931
2079
|
const titleId = useId6("identityPanel__heading", propsTitleId);
|
|
1932
|
-
const client =
|
|
2080
|
+
const client = useClient6();
|
|
1933
2081
|
const devices = useDevices();
|
|
1934
2082
|
const identity = useIdentity();
|
|
1935
2083
|
const invitations = useHaloInvitations2();
|
|
@@ -1939,8 +2087,8 @@ var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => co
|
|
|
1939
2087
|
});
|
|
1940
2088
|
if (!identity) {
|
|
1941
2089
|
log6.error("IdentityPanel rendered with no active identity.", void 0, {
|
|
1942
|
-
F:
|
|
1943
|
-
L:
|
|
2090
|
+
F: __dxlog_file6,
|
|
2091
|
+
L: 278,
|
|
1944
2092
|
S: void 0,
|
|
1945
2093
|
C: (f, a) => f(...a)
|
|
1946
2094
|
});
|
|
@@ -1953,11 +2101,11 @@ var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => co
|
|
|
1953
2101
|
});
|
|
1954
2102
|
const { swarm: connectionState } = useNetworkStatus();
|
|
1955
2103
|
const handleChangeConnectionState = async (nextState) => client?.mesh.updateConfig(nextState);
|
|
1956
|
-
|
|
2104
|
+
useEffect4(() => {
|
|
1957
2105
|
const subscription = identityService.subscribe((state) => {
|
|
1958
2106
|
log6("[state]", state, {
|
|
1959
|
-
F:
|
|
1960
|
-
L:
|
|
2107
|
+
F: __dxlog_file6,
|
|
2108
|
+
L: 291,
|
|
1961
2109
|
S: void 0,
|
|
1962
2110
|
C: (f, a) => f(...a)
|
|
1963
2111
|
});
|
|
@@ -1974,6 +2122,8 @@ var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => co
|
|
|
1974
2122
|
return "device invitation manager";
|
|
1975
2123
|
case identityState.matches("confirmingResetStorage"):
|
|
1976
2124
|
return "confirm reset storage";
|
|
2125
|
+
case identityState.matches("confirmingRecover"):
|
|
2126
|
+
return "confirm recover";
|
|
1977
2127
|
case identityState.matches("confirmingJoinNewIdentity"):
|
|
1978
2128
|
return "confirm join new identity";
|
|
1979
2129
|
default:
|
|
@@ -2008,11 +2158,11 @@ var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => co
|
|
|
2008
2158
|
};
|
|
2009
2159
|
|
|
2010
2160
|
// packages/sdk/shell/src/panels/JoinPanel/JoinPanel.tsx
|
|
2011
|
-
import React38, { useCallback as useCallback6, useEffect as
|
|
2161
|
+
import React38, { useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo4 } from "react";
|
|
2012
2162
|
import { log as log10 } from "@dxos/log";
|
|
2013
|
-
import { useClient as
|
|
2163
|
+
import { useClient as useClient8, useMulticastObservable } from "@dxos/react-client";
|
|
2014
2164
|
import { useIdentity as useIdentity2 } from "@dxos/react-client/halo";
|
|
2015
|
-
import {
|
|
2165
|
+
import { useId as useId8, useThemeContext as useThemeContext5 } from "@dxos/react-ui";
|
|
2016
2166
|
|
|
2017
2167
|
// packages/sdk/shell/src/panels/JoinPanel/JoinHeading.tsx
|
|
2018
2168
|
import { X as X4 } from "@phosphor-icons/react";
|
|
@@ -2054,10 +2204,10 @@ import { assign as assign2, createMachine as createMachine2 } from "xstate";
|
|
|
2054
2204
|
import { log as log7 } from "@dxos/log";
|
|
2055
2205
|
import { AlreadyJoinedError } from "@dxos/react-client";
|
|
2056
2206
|
import { Invitation as Invitation5, InvitationEncoder as InvitationEncoder3 } from "@dxos/react-client/invitations";
|
|
2057
|
-
var
|
|
2207
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/joinMachine.ts";
|
|
2058
2208
|
var getInvitationSubscribable = (Kind, invitation) => {
|
|
2059
2209
|
log7("[subscribing to invitation]", invitation, {
|
|
2060
|
-
F:
|
|
2210
|
+
F: __dxlog_file7,
|
|
2061
2211
|
L: 90,
|
|
2062
2212
|
S: void 0,
|
|
2063
2213
|
C: (f, a) => f(...a)
|
|
@@ -2070,7 +2220,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2070
2220
|
Kind,
|
|
2071
2221
|
invitation: invitation2
|
|
2072
2222
|
}, {
|
|
2073
|
-
F:
|
|
2223
|
+
F: __dxlog_file7,
|
|
2074
2224
|
L: 101,
|
|
2075
2225
|
S: void 0,
|
|
2076
2226
|
C: (f, a) => f(...a)
|
|
@@ -2085,7 +2235,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2085
2235
|
Kind,
|
|
2086
2236
|
invitation: invitation2
|
|
2087
2237
|
}, {
|
|
2088
|
-
F:
|
|
2238
|
+
F: __dxlog_file7,
|
|
2089
2239
|
L: 106,
|
|
2090
2240
|
S: void 0,
|
|
2091
2241
|
C: (f, a) => f(...a)
|
|
@@ -2100,7 +2250,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2100
2250
|
Kind,
|
|
2101
2251
|
invitation: invitation2
|
|
2102
2252
|
}, {
|
|
2103
|
-
F:
|
|
2253
|
+
F: __dxlog_file7,
|
|
2104
2254
|
L: 111,
|
|
2105
2255
|
S: void 0,
|
|
2106
2256
|
C: (f, a) => f(...a)
|
|
@@ -2115,7 +2265,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2115
2265
|
Kind,
|
|
2116
2266
|
invitation: invitation2
|
|
2117
2267
|
}, {
|
|
2118
|
-
F:
|
|
2268
|
+
F: __dxlog_file7,
|
|
2119
2269
|
L: 116,
|
|
2120
2270
|
S: void 0,
|
|
2121
2271
|
C: (f, a) => f(...a)
|
|
@@ -2130,7 +2280,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2130
2280
|
Kind,
|
|
2131
2281
|
invitation: invitation2
|
|
2132
2282
|
}, {
|
|
2133
|
-
F:
|
|
2283
|
+
F: __dxlog_file7,
|
|
2134
2284
|
L: 121,
|
|
2135
2285
|
S: void 0,
|
|
2136
2286
|
C: (f, a) => f(...a)
|
|
@@ -2145,7 +2295,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2145
2295
|
log7.warn("[invitation cancelled]", {
|
|
2146
2296
|
Kind
|
|
2147
2297
|
}, {
|
|
2148
|
-
F:
|
|
2298
|
+
F: __dxlog_file7,
|
|
2149
2299
|
L: 127,
|
|
2150
2300
|
S: void 0,
|
|
2151
2301
|
C: (f, a) => f(...a)
|
|
@@ -2159,7 +2309,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2159
2309
|
log7.error("[invitation timeout]", {
|
|
2160
2310
|
Kind
|
|
2161
2311
|
}, {
|
|
2162
|
-
F:
|
|
2312
|
+
F: __dxlog_file7,
|
|
2163
2313
|
L: 132,
|
|
2164
2314
|
S: void 0,
|
|
2165
2315
|
C: (f, a) => f(...a)
|
|
@@ -2176,7 +2326,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2176
2326
|
Kind,
|
|
2177
2327
|
error
|
|
2178
2328
|
}, {
|
|
2179
|
-
F:
|
|
2329
|
+
F: __dxlog_file7,
|
|
2180
2330
|
L: 139,
|
|
2181
2331
|
S: void 0,
|
|
2182
2332
|
C: (f, a) => f(...a)
|
|
@@ -2191,7 +2341,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2191
2341
|
Kind,
|
|
2192
2342
|
error
|
|
2193
2343
|
}, {
|
|
2194
|
-
F:
|
|
2344
|
+
F: __dxlog_file7,
|
|
2195
2345
|
L: 144,
|
|
2196
2346
|
S: void 0,
|
|
2197
2347
|
C: (f, a) => f(...a)
|
|
@@ -2384,6 +2534,11 @@ var joinMachine = createMachine2({
|
|
|
2384
2534
|
target: "#join.choosingIdentity.acceptingHaloInvitation",
|
|
2385
2535
|
actions: "log"
|
|
2386
2536
|
},
|
|
2537
|
+
{
|
|
2538
|
+
cond: "initiallyRecoveringIdentity",
|
|
2539
|
+
target: "#join.choosingIdentity.recoveringIdentity",
|
|
2540
|
+
actions: "log"
|
|
2541
|
+
},
|
|
2387
2542
|
{
|
|
2388
2543
|
cond: "noSelectedIdentity",
|
|
2389
2544
|
target: "choosingIdentity",
|
|
@@ -2395,6 +2550,7 @@ var joinMachine = createMachine2({
|
|
|
2395
2550
|
}
|
|
2396
2551
|
]
|
|
2397
2552
|
},
|
|
2553
|
+
// TODO(wittjosiah): Remove.
|
|
2398
2554
|
choosingIdentity: {
|
|
2399
2555
|
initial: "unknownAuthMethod",
|
|
2400
2556
|
states: {
|
|
@@ -2447,6 +2603,7 @@ var joinMachine = createMachine2({
|
|
|
2447
2603
|
}
|
|
2448
2604
|
}
|
|
2449
2605
|
},
|
|
2606
|
+
// TODO(wittjosiah): Factor out to a machine handling recovery and device invitations.
|
|
2450
2607
|
resettingIdentity: {},
|
|
2451
2608
|
acceptingSpaceInvitation: acceptingInvitationTemplate("Space", "#join.finishingJoiningSpace"),
|
|
2452
2609
|
finishingJoiningSpace: {
|
|
@@ -2467,6 +2624,7 @@ var joinMachine = createMachine2({
|
|
|
2467
2624
|
existingIdentity: ({ identity, mode }, _event) => mode === "halo-only" && !!identity,
|
|
2468
2625
|
noSelectedIdentity: ({ identity }, _event) => !identity,
|
|
2469
2626
|
initiallyAcceptingHaloInvitation: ({ identity, initialDisposition }, _event) => !identity && initialDisposition === "accept-halo-invitation",
|
|
2627
|
+
initiallyRecoveringIdentity: ({ identity, initialDisposition }, _event) => !identity && initialDisposition === "recover-identity",
|
|
2470
2628
|
hasHaloUnredeemedCode: ({ halo }, _event) => !!halo.unredeemedCode,
|
|
2471
2629
|
noSpaceInvitation: ({ space }, _event) => !space.invitation && !space.unredeemedCode
|
|
2472
2630
|
},
|
|
@@ -2523,8 +2681,8 @@ var joinMachine = createMachine2({
|
|
|
2523
2681
|
haloInvitation: context.halo.invitation,
|
|
2524
2682
|
spaceInvitation: context.space.invitation
|
|
2525
2683
|
}, {
|
|
2526
|
-
F:
|
|
2527
|
-
L:
|
|
2684
|
+
F: __dxlog_file7,
|
|
2685
|
+
L: 425,
|
|
2528
2686
|
S: void 0,
|
|
2529
2687
|
C: (f, a) => f(...a)
|
|
2530
2688
|
});
|
|
@@ -2537,8 +2695,8 @@ var defaultCodeFromUrl = (invitationType, text) => {
|
|
|
2537
2695
|
return searchParams.get(`${invitationType}InvitationCode`) ?? searchParams.get(`${invitationType}Invitation`) ?? searchParams.get("invitationCode") ?? searchParams.get("invitation") ?? text;
|
|
2538
2696
|
} catch (err) {
|
|
2539
2697
|
log7.catch(err, void 0, {
|
|
2540
|
-
F:
|
|
2541
|
-
L:
|
|
2698
|
+
F: __dxlog_file7,
|
|
2699
|
+
L: 452,
|
|
2542
2700
|
S: void 0,
|
|
2543
2701
|
C: (f, a) => f(...a)
|
|
2544
2702
|
});
|
|
@@ -2558,8 +2716,8 @@ var useJoinMachine = (client, options) => {
|
|
|
2558
2716
|
};
|
|
2559
2717
|
} catch (err) {
|
|
2560
2718
|
log7.error("Could not redeem device invitation code", err, {
|
|
2561
|
-
F:
|
|
2562
|
-
L:
|
|
2719
|
+
F: __dxlog_file7,
|
|
2720
|
+
L: 473,
|
|
2563
2721
|
S: void 0,
|
|
2564
2722
|
C: (f, a) => f(...a)
|
|
2565
2723
|
});
|
|
@@ -2583,8 +2741,8 @@ var useJoinMachine = (client, options) => {
|
|
|
2583
2741
|
};
|
|
2584
2742
|
} catch (err) {
|
|
2585
2743
|
log7.error("Could not redeem space invitation code", err, {
|
|
2586
|
-
F:
|
|
2587
|
-
L:
|
|
2744
|
+
F: __dxlog_file7,
|
|
2745
|
+
L: 495,
|
|
2588
2746
|
S: void 0,
|
|
2589
2747
|
C: (f, a) => f(...a)
|
|
2590
2748
|
});
|
|
@@ -2689,8 +2847,6 @@ var AdditionMethodChooser = (viewStateProps) => {
|
|
|
2689
2847
|
"data-testid": "identity-chooser.join-identity"
|
|
2690
2848
|
}, t("join identity label")), /* @__PURE__ */ React31.createElement(CompoundButton, {
|
|
2691
2849
|
...sharedButtonProps,
|
|
2692
|
-
// TODO(mykola): Implement recover.
|
|
2693
|
-
disabled: true,
|
|
2694
2850
|
description: t("recover identity description"),
|
|
2695
2851
|
before: /* @__PURE__ */ React31.createElement(Textbox, {
|
|
2696
2852
|
className: getSize15(6)
|
|
@@ -2747,34 +2903,53 @@ var IdentityAdded = (props) => {
|
|
|
2747
2903
|
};
|
|
2748
2904
|
|
|
2749
2905
|
// packages/sdk/shell/src/panels/JoinPanel/steps/IdentityInput.tsx
|
|
2750
|
-
import React33, { useState as
|
|
2906
|
+
import React33, { useState as useState10 } from "react";
|
|
2751
2907
|
import { log as log8 } from "@dxos/log";
|
|
2752
|
-
import { useClient as
|
|
2908
|
+
import { useClient as useClient7 } from "@dxos/react-client";
|
|
2753
2909
|
import { useTranslation as useTranslation18 } from "@dxos/react-ui";
|
|
2754
|
-
var
|
|
2910
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/steps/IdentityInput.tsx";
|
|
2755
2911
|
var IdentityInput = (props) => {
|
|
2756
2912
|
const { send, method } = props;
|
|
2757
2913
|
const isRecover = method === "recover identity";
|
|
2758
|
-
const client =
|
|
2914
|
+
const client = useClient7();
|
|
2759
2915
|
const { t } = useTranslation18("os");
|
|
2760
|
-
const [validationMessage, setValidationMessage] =
|
|
2761
|
-
const createIdentity = (
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2916
|
+
const [validationMessage, setValidationMessage] = useState10("");
|
|
2917
|
+
const createIdentity = (value) => {
|
|
2918
|
+
if (isRecover) {
|
|
2919
|
+
void client.halo.recoverIdentity({
|
|
2920
|
+
seedphrase: value
|
|
2921
|
+
}).then((identity) => {
|
|
2922
|
+
send?.({
|
|
2923
|
+
type: "selectIdentity",
|
|
2924
|
+
identity
|
|
2925
|
+
});
|
|
2926
|
+
}, (error) => {
|
|
2927
|
+
log8.catch(error, void 0, {
|
|
2928
|
+
F: __dxlog_file8,
|
|
2929
|
+
L: 38,
|
|
2930
|
+
S: void 0,
|
|
2931
|
+
C: (f, a) => f(...a)
|
|
2932
|
+
});
|
|
2933
|
+
setValidationMessage(t("failed to recover identity message"));
|
|
2768
2934
|
});
|
|
2769
|
-
}
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2935
|
+
} else {
|
|
2936
|
+
void client.halo.createIdentity({
|
|
2937
|
+
displayName: value
|
|
2938
|
+
}).then((identity) => {
|
|
2939
|
+
send?.({
|
|
2940
|
+
type: "selectIdentity",
|
|
2941
|
+
identity
|
|
2942
|
+
});
|
|
2943
|
+
}, (error) => {
|
|
2944
|
+
log8.catch(error, void 0, {
|
|
2945
|
+
F: __dxlog_file8,
|
|
2946
|
+
L: 48,
|
|
2947
|
+
S: void 0,
|
|
2948
|
+
C: (f, a) => f(...a)
|
|
2949
|
+
});
|
|
2950
|
+
setValidationMessage(t("failed to create identity message"));
|
|
2775
2951
|
});
|
|
2776
|
-
|
|
2777
|
-
});
|
|
2952
|
+
}
|
|
2778
2953
|
};
|
|
2779
2954
|
return /* @__PURE__ */ React33.createElement(IdentityInputImpl, {
|
|
2780
2955
|
...props,
|
|
@@ -2786,7 +2961,7 @@ var IdentityInputImpl = (props) => {
|
|
|
2786
2961
|
const { method, send, active, onDisplayNameConfirm, validationMessage } = props;
|
|
2787
2962
|
const disabled = !active;
|
|
2788
2963
|
const { t } = useTranslation18("os");
|
|
2789
|
-
const [inputValue, setInputValue] =
|
|
2964
|
+
const [inputValue, setInputValue] = useState10("");
|
|
2790
2965
|
const isRecover = method === "recover identity";
|
|
2791
2966
|
return /* @__PURE__ */ React33.createElement(React33.Fragment, null, /* @__PURE__ */ React33.createElement("div", {
|
|
2792
2967
|
role: "none",
|
|
@@ -2816,30 +2991,12 @@ var IdentityInputImpl = (props) => {
|
|
|
2816
2991
|
// packages/sdk/shell/src/panels/JoinPanel/steps/InvitationAccepted.tsx
|
|
2817
2992
|
import React34, { cloneElement as cloneElement3 } from "react";
|
|
2818
2993
|
import { useTranslation as useTranslation19 } from "@dxos/react-ui";
|
|
2819
|
-
var InvitationAccepted = (props) => {
|
|
2820
|
-
const { active, Kind, doneActionParent, onDone } = props;
|
|
2821
|
-
const disabled = !active;
|
|
2822
|
-
const { t } = useTranslation19("os");
|
|
2823
|
-
const doneAction = /* @__PURE__ */ React34.createElement(Action, {
|
|
2824
|
-
variant: "primary",
|
|
2825
|
-
onClick: onDone,
|
|
2826
|
-
disabled,
|
|
2827
|
-
"data-autofocus": `success${Kind}Invitation finishingJoining${Kind}`,
|
|
2828
|
-
"data-testid": `${Kind.toLowerCase()}-invitation-accepted-done`
|
|
2829
|
-
}, t("done label"));
|
|
2830
|
-
return /* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement("div", {
|
|
2831
|
-
role: "none",
|
|
2832
|
-
className: "grow flex flex-col justify-center"
|
|
2833
|
-
}, /* @__PURE__ */ React34.createElement("p", {
|
|
2834
|
-
className: "text-center text-sm font-normal"
|
|
2835
|
-
}, t("welcome message"))), /* @__PURE__ */ React34.createElement(Actions, null, doneActionParent ? /* @__PURE__ */ cloneElement3(doneActionParent, {}, doneAction) : doneAction));
|
|
2836
|
-
};
|
|
2837
2994
|
|
|
2838
2995
|
// packages/sdk/shell/src/panels/JoinPanel/steps/InvitationInput.tsx
|
|
2839
|
-
import React35, { useState as
|
|
2996
|
+
import React35, { useState as useState11, useEffect as useEffect5, cloneElement as cloneElement4 } from "react";
|
|
2840
2997
|
import { log as log9 } from "@dxos/log";
|
|
2841
2998
|
import { useTranslation as useTranslation20 } from "@dxos/react-ui";
|
|
2842
|
-
var
|
|
2999
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/steps/InvitationInput.tsx";
|
|
2843
3000
|
var invitationCodeFromUrl = (text) => {
|
|
2844
3001
|
try {
|
|
2845
3002
|
const searchParams = new URLSearchParams(text.substring(text.lastIndexOf("?")));
|
|
@@ -2847,7 +3004,7 @@ var invitationCodeFromUrl = (text) => {
|
|
|
2847
3004
|
return invitation ?? text;
|
|
2848
3005
|
} catch (err) {
|
|
2849
3006
|
log9.catch(err, void 0, {
|
|
2850
|
-
F:
|
|
3007
|
+
F: __dxlog_file9,
|
|
2851
3008
|
L: 25,
|
|
2852
3009
|
S: void 0,
|
|
2853
3010
|
C: (f, a) => f(...a)
|
|
@@ -2859,8 +3016,8 @@ var InvitationInput = (props) => {
|
|
|
2859
3016
|
const { Kind, active, send, unredeemedCode, onExit, exitActionParent, onDone, doneActionParent, succeededKeys } = props;
|
|
2860
3017
|
const disabled = !active;
|
|
2861
3018
|
const { t } = useTranslation20("os");
|
|
2862
|
-
const [inputValue, setInputValue] =
|
|
2863
|
-
|
|
3019
|
+
const [inputValue, setInputValue] = useState11(unredeemedCode ?? "");
|
|
3020
|
+
useEffect5(() => {
|
|
2864
3021
|
unredeemedCode && setInputValue(unredeemedCode ?? "");
|
|
2865
3022
|
}, [
|
|
2866
3023
|
unredeemedCode
|
|
@@ -2900,16 +3057,9 @@ var InvitationInput = (props) => {
|
|
|
2900
3057
|
"data-autofocus": `inputting${Kind}InvitationCode`,
|
|
2901
3058
|
"data-testid": `${Kind.toLowerCase()}-invitation-input`,
|
|
2902
3059
|
onKeyUp: ({ key }) => key === "Enter" && handleNext()
|
|
2903
|
-
})), /* @__PURE__ */ React35.createElement(Actions, null, Kind === "Halo" ? /* @__PURE__ */ React35.createElement(Action, {
|
|
2904
|
-
variant: "ghost",
|
|
2905
|
-
disabled,
|
|
2906
|
-
onClick: () => send({
|
|
2907
|
-
type: "deselectAuthMethod"
|
|
2908
|
-
}),
|
|
2909
|
-
"data-testid": `${Kind.toLowerCase()}-invitation-input-back`
|
|
2910
|
-
}, t("back label")) : exitActionParent ? /* @__PURE__ */ cloneElement4(exitActionParent, {}, exitAction) : doneActionParent ? /* @__PURE__ */ cloneElement4(doneActionParent, {}, exitAction) : exitAction, /* @__PURE__ */ React35.createElement(Action, {
|
|
3060
|
+
})), /* @__PURE__ */ React35.createElement(Actions, null, Kind === "Halo" ? null : exitActionParent ? /* @__PURE__ */ cloneElement4(exitActionParent, {}, exitAction) : doneActionParent ? /* @__PURE__ */ cloneElement4(doneActionParent, {}, exitAction) : exitAction, /* @__PURE__ */ React35.createElement(Action, {
|
|
2911
3061
|
variant: "primary",
|
|
2912
|
-
disabled,
|
|
3062
|
+
disabled: disabled || inputValue.trim().length === 0,
|
|
2913
3063
|
onClick: handleNext,
|
|
2914
3064
|
"data-testid": `${Kind.toLowerCase()}-invitation-input-continue`
|
|
2915
3065
|
}, t("continue label"))));
|
|
@@ -2978,15 +3128,17 @@ var InvitationRescuer = (props) => {
|
|
|
2978
3128
|
};
|
|
2979
3129
|
|
|
2980
3130
|
// packages/sdk/shell/src/panels/JoinPanel/steps/InvitationAuthenticator.tsx
|
|
2981
|
-
import React37, { useState as
|
|
3131
|
+
import React37, { useState as useState12 } from "react";
|
|
3132
|
+
import { Invitation as Invitation6 } from "@dxos/react-client/invitations";
|
|
2982
3133
|
import { Input as Input3, useTranslation as useTranslation22 } from "@dxos/react-ui";
|
|
3134
|
+
import { descriptionText as descriptionText11 } from "@dxos/react-ui-theme";
|
|
2983
3135
|
import { hexToEmoji as hexToEmoji5 } from "@dxos/util";
|
|
2984
3136
|
var pinLength = 6;
|
|
2985
|
-
var InvitationAuthenticator = ({ failed, Kind, active, pending, invitationId, onInvitationAuthenticate, onInvitationCancel }) => {
|
|
3137
|
+
var InvitationAuthenticator = ({ failed, Kind, authMethod, active, pending, invitationId, onInvitationAuthenticate, onInvitationCancel }) => {
|
|
2986
3138
|
const disabled = !active || pending;
|
|
2987
3139
|
const { t } = useTranslation22("os");
|
|
2988
3140
|
const invitationType = Kind.toLowerCase();
|
|
2989
|
-
const [authCode, setAuthCode] =
|
|
3141
|
+
const [authCode, setAuthCode] = useState12("");
|
|
2990
3142
|
const onChange = ({ target: { value } }) => {
|
|
2991
3143
|
setAuthCode(value);
|
|
2992
3144
|
if (value.length === pinLength) {
|
|
@@ -3000,7 +3152,12 @@ var InvitationAuthenticator = ({ failed, Kind, active, pending, invitationId, on
|
|
|
3000
3152
|
validationValence: "error"
|
|
3001
3153
|
}, /* @__PURE__ */ React37.createElement(Input3.Label, {
|
|
3002
3154
|
asChild: true
|
|
3003
|
-
}, /* @__PURE__ */ React37.createElement(StepHeading, null, t("auth code input label"))
|
|
3155
|
+
}, authMethod === Invitation6.AuthMethod.SHARED_SECRET ? /* @__PURE__ */ React37.createElement(StepHeading, null, t("auth code input label")) : /* @__PURE__ */ React37.createElement(React37.Fragment, null, /* @__PURE__ */ React37.createElement(StepHeading, {
|
|
3156
|
+
className: descriptionText11
|
|
3157
|
+
}, t("authenticating label")), /* @__PURE__ */ React37.createElement("div", {
|
|
3158
|
+
role: "none",
|
|
3159
|
+
className: "grow"
|
|
3160
|
+
}))), authMethod === Invitation6.AuthMethod.SHARED_SECRET && /* @__PURE__ */ React37.createElement(Input3.PinInput, {
|
|
3004
3161
|
disabled,
|
|
3005
3162
|
length: pinLength,
|
|
3006
3163
|
onChange,
|
|
@@ -3013,7 +3170,7 @@ var InvitationAuthenticator = ({ failed, Kind, active, pending, invitationId, on
|
|
|
3013
3170
|
"data-1p-ignore": true
|
|
3014
3171
|
}), failed && /* @__PURE__ */ React37.createElement(Input3.DescriptionAndValidation, {
|
|
3015
3172
|
classNames: "text-center"
|
|
3016
|
-
}, /* @__PURE__ */ React37.createElement(Input3.Validation, null, t("failed to authenticate message")))), invitationId && /* @__PURE__ */ React37.createElement(React37.Fragment, null, /* @__PURE__ */ React37.createElement(Label, null, t("auth other device emoji message")), /* @__PURE__ */ React37.createElement("div", {
|
|
3173
|
+
}, /* @__PURE__ */ React37.createElement(Input3.Validation, null, t("failed to authenticate message")))), invitationId && authMethod === Invitation6.AuthMethod.SHARED_SECRET && /* @__PURE__ */ React37.createElement(React37.Fragment, null, /* @__PURE__ */ React37.createElement(Label, null, t("auth other device emoji message")), /* @__PURE__ */ React37.createElement("div", {
|
|
3017
3174
|
className: "flex justify-center"
|
|
3018
3175
|
}, /* @__PURE__ */ React37.createElement(Emoji, {
|
|
3019
3176
|
text: hexToEmoji5(invitationId)
|
|
@@ -3035,7 +3192,7 @@ var InvitationAuthenticator = ({ failed, Kind, active, pending, invitationId, on
|
|
|
3035
3192
|
var stepStyles = "pbs-1 pbe-3 pli-3";
|
|
3036
3193
|
|
|
3037
3194
|
// packages/sdk/shell/src/styles/invitationStatusStyles.ts
|
|
3038
|
-
import { Invitation as
|
|
3195
|
+
import { Invitation as Invitation7 } from "@dxos/react-client/invitations";
|
|
3039
3196
|
var inactiveBgColor = "bg-neutral-100 dark:bg-neutral-600";
|
|
3040
3197
|
var activeBgColor = "bg-primary-500 dark:bg-primary-400";
|
|
3041
3198
|
var successBgColor = "bg-success-500 dark:bg-success-400";
|
|
@@ -3051,17 +3208,40 @@ var activeStrokeColor = "stroke-primary-400 dark:stroke-primary-150";
|
|
|
3051
3208
|
var successStrokeColor = "stroke-success-300 dark:stroke-primary-400";
|
|
3052
3209
|
var errorStrokeColor = "stroke-error-300 dark:stroke-error-500";
|
|
3053
3210
|
var cancelledStrokeColor = "stroke-warning-300 dark:stroke-warning-500";
|
|
3054
|
-
var resolvedStrokeColor = (status) => status ===
|
|
3055
|
-
var resolvedBgColor = (status) => status ===
|
|
3056
|
-
var resolvedTextColor = (status) => status ===
|
|
3211
|
+
var resolvedStrokeColor = (status) => status === Invitation7.State.ERROR ? errorStrokeColor : status === Invitation7.State.CANCELLED || status === Invitation7.State.TIMEOUT ? cancelledStrokeColor : successStrokeColor;
|
|
3212
|
+
var resolvedBgColor = (status) => status === Invitation7.State.ERROR ? errorBgColor : status === Invitation7.State.CANCELLED || status === Invitation7.State.TIMEOUT ? cancelledBgColor : successBgColor;
|
|
3213
|
+
var resolvedTextColor = (status) => status === Invitation7.State.ERROR ? errorTextColor : status === Invitation7.State.CANCELLED || status === Invitation7.State.TIMEOUT ? cancelledTextColor : successTextColor;
|
|
3057
3214
|
|
|
3058
3215
|
// packages/sdk/shell/src/panels/JoinPanel/JoinPanel.tsx
|
|
3059
|
-
var
|
|
3216
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/JoinPanel.tsx";
|
|
3060
3217
|
var JoinPanelImpl = (props) => {
|
|
3061
|
-
const {
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3218
|
+
const {
|
|
3219
|
+
titleId,
|
|
3220
|
+
send,
|
|
3221
|
+
activeView,
|
|
3222
|
+
failed,
|
|
3223
|
+
mode,
|
|
3224
|
+
unredeemedCodes,
|
|
3225
|
+
invitationIds,
|
|
3226
|
+
invitationStates,
|
|
3227
|
+
invitationAuthMethods,
|
|
3228
|
+
succeededKeys,
|
|
3229
|
+
failReasons,
|
|
3230
|
+
onExit,
|
|
3231
|
+
onHaloDone,
|
|
3232
|
+
// onSpaceDone,
|
|
3233
|
+
exitActionParent,
|
|
3234
|
+
doneActionParent,
|
|
3235
|
+
onHaloInvitationCancel,
|
|
3236
|
+
onSpaceInvitationCancel,
|
|
3237
|
+
onHaloInvitationAuthenticate,
|
|
3238
|
+
onSpaceInvitationAuthenticate,
|
|
3239
|
+
onCancelResetStorage,
|
|
3240
|
+
onConfirmResetStorage,
|
|
3241
|
+
IdentityInput: IdentityInputComponent = IdentityInput,
|
|
3242
|
+
ConfirmReset: ConfirmResetComponent = ConfirmReset
|
|
3243
|
+
} = props;
|
|
3244
|
+
return /* @__PURE__ */ React38.createElement(React38.Fragment, null, mode !== "halo-only" && /* @__PURE__ */ React38.createElement(JoinHeading, {
|
|
3065
3245
|
titleId,
|
|
3066
3246
|
mode,
|
|
3067
3247
|
onExit,
|
|
@@ -3127,21 +3307,13 @@ var JoinPanelImpl = (props) => {
|
|
|
3127
3307
|
send,
|
|
3128
3308
|
Kind: "Halo",
|
|
3129
3309
|
invitationId: invitationIds?.Halo,
|
|
3310
|
+
authMethod: invitationAuthMethods?.Halo,
|
|
3130
3311
|
active: activeView === "halo invitation authenticator",
|
|
3131
3312
|
onInvitationCancel: onHaloInvitationCancel,
|
|
3132
3313
|
onInvitationAuthenticate: onHaloInvitationAuthenticate,
|
|
3133
3314
|
...failed.has("Halo") && {
|
|
3134
3315
|
failed: true
|
|
3135
3316
|
}
|
|
3136
|
-
})), /* @__PURE__ */ React38.createElement(Viewport.View, {
|
|
3137
|
-
classNames: stepStyles,
|
|
3138
|
-
id: "halo invitation accepted"
|
|
3139
|
-
}, /* @__PURE__ */ React38.createElement(InvitationAccepted, {
|
|
3140
|
-
send,
|
|
3141
|
-
Kind: "Halo",
|
|
3142
|
-
active: activeView === "halo invitation accepted",
|
|
3143
|
-
doneActionParent,
|
|
3144
|
-
onDone: onHaloDone
|
|
3145
3317
|
})), /* @__PURE__ */ React38.createElement(Viewport.View, {
|
|
3146
3318
|
classNames: stepStyles,
|
|
3147
3319
|
id: "identity added"
|
|
@@ -3183,25 +3355,17 @@ var JoinPanelImpl = (props) => {
|
|
|
3183
3355
|
send,
|
|
3184
3356
|
Kind: "Space",
|
|
3185
3357
|
invitationId: invitationIds?.Space,
|
|
3358
|
+
authMethod: invitationAuthMethods?.Space,
|
|
3186
3359
|
active: activeView === "space invitation authenticator",
|
|
3187
3360
|
onInvitationCancel: onSpaceInvitationCancel,
|
|
3188
3361
|
onInvitationAuthenticate: onSpaceInvitationAuthenticate,
|
|
3189
3362
|
...failed.has("Space") && {
|
|
3190
3363
|
failed: true
|
|
3191
3364
|
}
|
|
3192
|
-
})), /* @__PURE__ */ React38.createElement(Viewport.View, {
|
|
3193
|
-
classNames: stepStyles,
|
|
3194
|
-
id: "space invitation accepted"
|
|
3195
|
-
}, /* @__PURE__ */ React38.createElement(InvitationAccepted, {
|
|
3196
|
-
send,
|
|
3197
|
-
Kind: "Space",
|
|
3198
|
-
active: activeView === "space invitation accepted",
|
|
3199
|
-
doneActionParent,
|
|
3200
|
-
onDone: onSpaceDone
|
|
3201
3365
|
})))));
|
|
3202
3366
|
};
|
|
3203
3367
|
var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition = "default", initialInvitationCode, exitActionParent, onExit, doneActionParent, onDone: propsOnDone, onCancelResetStorage }) => {
|
|
3204
|
-
const client =
|
|
3368
|
+
const client = useClient8();
|
|
3205
3369
|
const identity = useIdentity2();
|
|
3206
3370
|
const { hasIosKeyboard } = useThemeContext5();
|
|
3207
3371
|
const titleId = useId8("joinPanel__heading", propsTitleId);
|
|
@@ -3217,11 +3381,11 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition =
|
|
|
3217
3381
|
}
|
|
3218
3382
|
}
|
|
3219
3383
|
});
|
|
3220
|
-
|
|
3384
|
+
useEffect6(() => {
|
|
3221
3385
|
const subscription = joinService.subscribe((state) => {
|
|
3222
3386
|
log10("[state]", state, {
|
|
3223
|
-
F:
|
|
3224
|
-
L:
|
|
3387
|
+
F: __dxlog_file10,
|
|
3388
|
+
L: 210,
|
|
3225
3389
|
S: void 0,
|
|
3226
3390
|
C: (f, a) => f(...a)
|
|
3227
3391
|
});
|
|
@@ -3230,7 +3394,7 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition =
|
|
|
3230
3394
|
}, [
|
|
3231
3395
|
joinService
|
|
3232
3396
|
]);
|
|
3233
|
-
|
|
3397
|
+
useEffect6(() => {
|
|
3234
3398
|
const stateStack = joinState.configuration[0].id.split(".");
|
|
3235
3399
|
const innermostState = stateStack[stateStack.length - 1];
|
|
3236
3400
|
const autoFocusValue = innermostState === "finishingJoining" ? "successSpaceInvitation" : innermostState;
|
|
@@ -3363,6 +3527,18 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition =
|
|
|
3363
3527
|
}, [
|
|
3364
3528
|
joinState
|
|
3365
3529
|
]);
|
|
3530
|
+
useEffect6(() => {
|
|
3531
|
+
switch (activeView) {
|
|
3532
|
+
case "halo invitation accepted":
|
|
3533
|
+
onHaloDone();
|
|
3534
|
+
break;
|
|
3535
|
+
case "space invitation accepted":
|
|
3536
|
+
onSpaceDone();
|
|
3537
|
+
break;
|
|
3538
|
+
}
|
|
3539
|
+
}, [
|
|
3540
|
+
activeView
|
|
3541
|
+
]);
|
|
3366
3542
|
const failed = useMemo4(() => {
|
|
3367
3543
|
const result = /* @__PURE__ */ new Set();
|
|
3368
3544
|
switch (true) {
|
|
@@ -3405,6 +3581,12 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition =
|
|
|
3405
3581
|
}), [
|
|
3406
3582
|
joinState
|
|
3407
3583
|
]);
|
|
3584
|
+
const invitationAuthMethods = useMemo4(() => ({
|
|
3585
|
+
Halo: joinState.context.halo.invitationObservable?.get().authMethod,
|
|
3586
|
+
Space: joinState.context.space.invitationObservable?.get().authMethod
|
|
3587
|
+
}), [
|
|
3588
|
+
joinState
|
|
3589
|
+
]);
|
|
3408
3590
|
const invitationIds = useMemo4(() => ({
|
|
3409
3591
|
Halo: joinState.context.halo.invitationObservable?.get().invitationId,
|
|
3410
3592
|
Space: joinState.context.space.invitationObservable?.get().invitationId
|
|
@@ -3461,6 +3643,7 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition =
|
|
|
3461
3643
|
unredeemedCodes,
|
|
3462
3644
|
invitationIds,
|
|
3463
3645
|
invitationStates,
|
|
3646
|
+
invitationAuthMethods,
|
|
3464
3647
|
succeededKeys,
|
|
3465
3648
|
identity,
|
|
3466
3649
|
onExit,
|
|
@@ -3489,16 +3672,16 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition =
|
|
|
3489
3672
|
|
|
3490
3673
|
// packages/sdk/shell/src/panels/SpacePanel/SpacePanel.tsx
|
|
3491
3674
|
import { Planet } from "@phosphor-icons/react";
|
|
3492
|
-
import React40, { useEffect as
|
|
3675
|
+
import React40, { useEffect as useEffect7, useMemo as useMemo5 } from "react";
|
|
3493
3676
|
import { log as log13 } from "@dxos/log";
|
|
3494
3677
|
import { useInvitationStatus as useInvitationStatus3 } from "@dxos/react-client/invitations";
|
|
3495
|
-
import {
|
|
3678
|
+
import { useId as useId9, useTranslation as useTranslation24 } from "@dxos/react-ui";
|
|
3496
3679
|
|
|
3497
3680
|
// packages/sdk/shell/src/panels/SpacePanel/spaceMachine.ts
|
|
3498
3681
|
import { useMachine as useMachine3 } from "@xstate/react";
|
|
3499
3682
|
import { assign as assign3, createMachine as createMachine3 } from "xstate";
|
|
3500
3683
|
import { log as log11 } from "@dxos/log";
|
|
3501
|
-
var
|
|
3684
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/SpacePanel/spaceMachine.ts";
|
|
3502
3685
|
var spaceMachine = createMachine3({
|
|
3503
3686
|
id: "space",
|
|
3504
3687
|
predictableActionArguments: true,
|
|
@@ -3539,7 +3722,7 @@ var spaceMachine = createMachine3({
|
|
|
3539
3722
|
event,
|
|
3540
3723
|
context
|
|
3541
3724
|
}, {
|
|
3542
|
-
F:
|
|
3725
|
+
F: __dxlog_file11,
|
|
3543
3726
|
L: 53,
|
|
3544
3727
|
S: void 0,
|
|
3545
3728
|
C: (f, a) => f(...a)
|
|
@@ -3558,23 +3741,23 @@ var useSpaceMachine = (options) => {
|
|
|
3558
3741
|
|
|
3559
3742
|
// packages/sdk/shell/src/panels/SpacePanel/steps/SpaceManager.tsx
|
|
3560
3743
|
import { Placeholder as Placeholder2, UserPlus, UsersThree } from "@phosphor-icons/react";
|
|
3561
|
-
import React39, { useCallback as useCallback7, useState as
|
|
3744
|
+
import React39, { useCallback as useCallback7, useState as useState13 } from "react";
|
|
3562
3745
|
import { log as log12 } from "@dxos/log";
|
|
3563
3746
|
import { useConfig } from "@dxos/react-client";
|
|
3564
3747
|
import { useSpaceInvitations as useSpaceInvitations2 } from "@dxos/react-client/echo";
|
|
3565
|
-
import { Invitation as
|
|
3748
|
+
import { Invitation as Invitation8, InvitationEncoder as InvitationEncoder4 } from "@dxos/react-client/invitations";
|
|
3566
3749
|
import { ScrollArea, useTranslation as useTranslation23 } from "@dxos/react-ui";
|
|
3567
|
-
import { descriptionText as
|
|
3568
|
-
var
|
|
3750
|
+
import { descriptionText as descriptionText12, mx as mx24 } from "@dxos/react-ui-theme";
|
|
3751
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/SpacePanel/steps/SpaceManager.tsx";
|
|
3569
3752
|
var activeActionKey = "dxos:react-shell/space-manager/active-action";
|
|
3570
3753
|
var handleInvitationEvent = (invitation, subscription) => {
|
|
3571
3754
|
const invitationCode = InvitationEncoder4.encode(invitation);
|
|
3572
|
-
if (invitation.state ===
|
|
3755
|
+
if (invitation.state === Invitation8.State.CONNECTING) {
|
|
3573
3756
|
log12.info(JSON.stringify({
|
|
3574
3757
|
invitationCode,
|
|
3575
3758
|
authCode: invitation.authCode
|
|
3576
3759
|
}), void 0, {
|
|
3577
|
-
F:
|
|
3760
|
+
F: __dxlog_file12,
|
|
3578
3761
|
L: 40,
|
|
3579
3762
|
S: void 0,
|
|
3580
3763
|
C: (f, a) => f(...a)
|
|
@@ -3594,8 +3777,8 @@ var SpaceManager = (props) => {
|
|
|
3594
3777
|
icon: UserPlus,
|
|
3595
3778
|
onClick: useCallback7(() => {
|
|
3596
3779
|
const invitation = space.share?.({
|
|
3597
|
-
type:
|
|
3598
|
-
authMethod:
|
|
3780
|
+
type: Invitation8.Type.INTERACTIVE,
|
|
3781
|
+
authMethod: Invitation8.AuthMethod.SHARED_SECRET,
|
|
3599
3782
|
multiUse: false,
|
|
3600
3783
|
target
|
|
3601
3784
|
});
|
|
@@ -3612,8 +3795,8 @@ var SpaceManager = (props) => {
|
|
|
3612
3795
|
icon: UsersThree,
|
|
3613
3796
|
onClick: useCallback7(() => {
|
|
3614
3797
|
const invitation = space.share?.({
|
|
3615
|
-
type:
|
|
3616
|
-
authMethod:
|
|
3798
|
+
type: Invitation8.Type.DELEGATED,
|
|
3799
|
+
authMethod: Invitation8.AuthMethod.KNOWN_PUBLIC_KEY,
|
|
3617
3800
|
multiUse: true,
|
|
3618
3801
|
target
|
|
3619
3802
|
});
|
|
@@ -3644,20 +3827,20 @@ var SpaceManagerImpl = (props) => {
|
|
|
3644
3827
|
}
|
|
3645
3828
|
}
|
|
3646
3829
|
};
|
|
3647
|
-
const [activeAction, setInternalActiveAction] =
|
|
3830
|
+
const [activeAction, setInternalActiveAction] = useState13(localStorage.getItem(activeActionKey) ?? "inviteOne");
|
|
3648
3831
|
const setActiveAction = (nextAction) => {
|
|
3649
3832
|
setInternalActiveAction(nextAction);
|
|
3650
3833
|
localStorage.setItem(activeActionKey, nextAction);
|
|
3651
3834
|
};
|
|
3652
3835
|
const visibleInvitations = showInactiveInvitations ? invitations : invitations?.filter((invitation) => ![
|
|
3653
|
-
|
|
3836
|
+
Invitation8.State.CANCELLED
|
|
3654
3837
|
].includes(invitation.get().state));
|
|
3655
3838
|
return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(ScrollArea.Root, {
|
|
3656
3839
|
classNames: "grow shrink basis-28 -mli-2"
|
|
3657
3840
|
}, /* @__PURE__ */ React39.createElement(ScrollArea.Viewport, {
|
|
3658
3841
|
classNames: "is-full pie-2"
|
|
3659
3842
|
}, !!visibleInvitations?.length && /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement("h3", {
|
|
3660
|
-
className: mx24(headingFragment,
|
|
3843
|
+
className: mx24(headingFragment, descriptionText12)
|
|
3661
3844
|
}, t("invitation list heading")), /* @__PURE__ */ React39.createElement(InvitationListComponent, {
|
|
3662
3845
|
className: "mb-2",
|
|
3663
3846
|
send,
|
|
@@ -3665,7 +3848,7 @@ var SpaceManagerImpl = (props) => {
|
|
|
3665
3848
|
onClickRemove: (invitation) => invitation.cancel(),
|
|
3666
3849
|
createInvitationUrl
|
|
3667
3850
|
}), /* @__PURE__ */ React39.createElement("h3", {
|
|
3668
|
-
className: mx24(headingFragment,
|
|
3851
|
+
className: mx24(headingFragment, descriptionText12, "mbs-2")
|
|
3669
3852
|
}, t("space member list heading"))), /* @__PURE__ */ React39.createElement(SpaceMemberListComponent, {
|
|
3670
3853
|
spaceKey: space.key,
|
|
3671
3854
|
includeSelf: true
|
|
@@ -3681,7 +3864,7 @@ var SpaceManagerImpl = (props) => {
|
|
|
3681
3864
|
};
|
|
3682
3865
|
|
|
3683
3866
|
// packages/sdk/shell/src/panels/SpacePanel/SpacePanel.tsx
|
|
3684
|
-
var
|
|
3867
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/SpacePanel/SpacePanel.tsx";
|
|
3685
3868
|
var SpacePanelHeading = ({ titleId, space, onDone }) => {
|
|
3686
3869
|
const { t } = useTranslation24("os");
|
|
3687
3870
|
const name = space.properties.name;
|
|
@@ -3704,9 +3887,7 @@ var SpacePanelHeading = ({ titleId, space, onDone }) => {
|
|
|
3704
3887
|
};
|
|
3705
3888
|
var SpacePanelImpl = (props) => {
|
|
3706
3889
|
const { titleId, activeView, space, target, SpaceManager: SpaceManagerComponent = SpaceManager, InvitationManager: InvitationManagerComponent = InvitationManager, ...rest } = props;
|
|
3707
|
-
return /* @__PURE__ */ React40.createElement(
|
|
3708
|
-
density: "fine"
|
|
3709
|
-
}, /* @__PURE__ */ React40.createElement(SpacePanelHeading, {
|
|
3890
|
+
return /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(SpacePanelHeading, {
|
|
3710
3891
|
...rest,
|
|
3711
3892
|
titleId,
|
|
3712
3893
|
space
|
|
@@ -3744,10 +3925,10 @@ var SpacePanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => code,
|
|
|
3744
3925
|
space: props.space
|
|
3745
3926
|
}
|
|
3746
3927
|
});
|
|
3747
|
-
|
|
3928
|
+
useEffect7(() => {
|
|
3748
3929
|
const subscription = spaceService.subscribe((state) => {
|
|
3749
3930
|
log13("[state]", state, {
|
|
3750
|
-
F:
|
|
3931
|
+
F: __dxlog_file13,
|
|
3751
3932
|
L: 94,
|
|
3752
3933
|
S: void 0,
|
|
3753
3934
|
C: (f, a) => f(...a)
|
|
@@ -3858,9 +4039,9 @@ import { defaultTx } from "@dxos/react-ui-theme";
|
|
|
3858
4039
|
import { createIFramePort } from "@dxos/rpc-tunnel";
|
|
3859
4040
|
|
|
3860
4041
|
// packages/sdk/shell/src/composites/Shell/Shell.tsx
|
|
3861
|
-
import React46, { useEffect as
|
|
4042
|
+
import React46, { useEffect as useEffect8, useState as useState14 } from "react";
|
|
3862
4043
|
import { log as log14 } from "@dxos/log";
|
|
3863
|
-
import { useClient as
|
|
4044
|
+
import { useClient as useClient9 } from "@dxos/react-client";
|
|
3864
4045
|
import { ShellDisplay, ShellLayout } from "@dxos/react-client";
|
|
3865
4046
|
import { useSpace as useSpace2 } from "@dxos/react-client/echo";
|
|
3866
4047
|
|
|
@@ -3898,22 +4079,22 @@ var StatusDialog = () => {
|
|
|
3898
4079
|
};
|
|
3899
4080
|
|
|
3900
4081
|
// packages/sdk/shell/src/composites/Shell/Shell.tsx
|
|
3901
|
-
var
|
|
4082
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/composites/Shell/Shell.tsx";
|
|
3902
4083
|
var blurActiveElement = () => document.activeElement?.blur?.();
|
|
3903
4084
|
var Shell = ({ runtime }) => {
|
|
3904
|
-
const [{ layout, invitationCode, spaceKey, spaceId, target }, setLayout] =
|
|
4085
|
+
const [{ layout, invitationCode, spaceKey, spaceId, target }, setLayout] = useState14({
|
|
3905
4086
|
layout: runtime.layout,
|
|
3906
4087
|
invitationCode: runtime.invitationCode,
|
|
3907
4088
|
spaceKey: runtime.spaceKey,
|
|
3908
4089
|
spaceId: runtime.spaceId,
|
|
3909
4090
|
target: runtime.target
|
|
3910
4091
|
});
|
|
3911
|
-
const [{ invitationUrl, deviceInvitationParam, spaceInvitationParam }, setInvitationUrl] =
|
|
4092
|
+
const [{ invitationUrl, deviceInvitationParam, spaceInvitationParam }, setInvitationUrl] = useState14({
|
|
3912
4093
|
invitationUrl: runtime.invitationUrl,
|
|
3913
4094
|
deviceInvitationParam: runtime.deviceInvitationParam,
|
|
3914
4095
|
spaceInvitationParam: runtime.spaceInvitationParam
|
|
3915
4096
|
});
|
|
3916
|
-
const client =
|
|
4097
|
+
const client = useClient9();
|
|
3917
4098
|
const space = useSpace2(spaceId ?? spaceKey);
|
|
3918
4099
|
const createDeviceInvitationUrl = (invitationCode2) => {
|
|
3919
4100
|
const baseUrl = new URL(invitationUrl);
|
|
@@ -3925,7 +4106,7 @@ var Shell = ({ runtime }) => {
|
|
|
3925
4106
|
baseUrl.searchParams.set(spaceInvitationParam, invitationCode2);
|
|
3926
4107
|
return baseUrl.toString();
|
|
3927
4108
|
};
|
|
3928
|
-
|
|
4109
|
+
useEffect8(() => {
|
|
3929
4110
|
const unsubscribeLayout = runtime.layoutUpdate.on((request) => setLayout(request));
|
|
3930
4111
|
const unsubscribeInvitationUrl = runtime.invitationUrlUpdate.on((request) => setInvitationUrl(request));
|
|
3931
4112
|
return () => {
|
|
@@ -3935,10 +4116,10 @@ var Shell = ({ runtime }) => {
|
|
|
3935
4116
|
}, [
|
|
3936
4117
|
runtime
|
|
3937
4118
|
]);
|
|
3938
|
-
|
|
4119
|
+
useEffect8(() => {
|
|
3939
4120
|
if (layout === ShellLayout.SPACE && !space) {
|
|
3940
4121
|
log14.warn("No space found for shell space invitations.", void 0, {
|
|
3941
|
-
F:
|
|
4122
|
+
F: __dxlog_file14,
|
|
3942
4123
|
L: 67,
|
|
3943
4124
|
S: void 0,
|
|
3944
4125
|
C: (f, a) => f(...a)
|
|
@@ -3963,16 +4144,17 @@ var Shell = ({ runtime }) => {
|
|
|
3963
4144
|
return /* @__PURE__ */ React46.createElement(StatusDialog, null);
|
|
3964
4145
|
case ShellLayout.INITIALIZE_IDENTITY:
|
|
3965
4146
|
case ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION:
|
|
4147
|
+
case ShellLayout.INITIALIZE_IDENTITY_FROM_RECOVERY:
|
|
3966
4148
|
return /* @__PURE__ */ React46.createElement(JoinDialog, {
|
|
3967
4149
|
mode: "halo-only",
|
|
3968
|
-
initialDisposition: layout === ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION ? "accept-halo-invitation" : "default",
|
|
4150
|
+
initialDisposition: layout === ShellLayout.INITIALIZE_IDENTITY_FROM_RECOVERY ? "recover-identity" : layout === ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION ? "accept-halo-invitation" : "default",
|
|
3969
4151
|
initialInvitationCode: invitationCode,
|
|
3970
4152
|
onCancelResetStorage: () => runtime.setLayout({
|
|
3971
4153
|
layout: ShellLayout.IDENTITY
|
|
3972
4154
|
}),
|
|
3973
|
-
onDone: () => {
|
|
4155
|
+
onDone: async () => {
|
|
3974
4156
|
blurActiveElement();
|
|
3975
|
-
|
|
4157
|
+
await runtime.setAppContext({
|
|
3976
4158
|
display: ShellDisplay.NONE
|
|
3977
4159
|
});
|
|
3978
4160
|
runtime.setLayout({
|
|
@@ -3995,13 +4177,26 @@ var Shell = ({ runtime }) => {
|
|
|
3995
4177
|
reset: true
|
|
3996
4178
|
});
|
|
3997
4179
|
},
|
|
4180
|
+
onRecover: async () => {
|
|
4181
|
+
runtime.setLayout({
|
|
4182
|
+
layout: ShellLayout.STATUS
|
|
4183
|
+
});
|
|
4184
|
+
await client.reset();
|
|
4185
|
+
return runtime.setAppContext({
|
|
4186
|
+
display: ShellDisplay.NONE,
|
|
4187
|
+
reset: true,
|
|
4188
|
+
target: "recoverIdentity"
|
|
4189
|
+
});
|
|
4190
|
+
},
|
|
3998
4191
|
onJoinNewIdentity: async () => {
|
|
3999
4192
|
runtime.setLayout({
|
|
4000
4193
|
layout: ShellLayout.STATUS
|
|
4001
4194
|
});
|
|
4002
4195
|
await client.reset();
|
|
4003
|
-
return runtime.
|
|
4004
|
-
|
|
4196
|
+
return runtime.setAppContext({
|
|
4197
|
+
display: ShellDisplay.NONE,
|
|
4198
|
+
reset: true,
|
|
4199
|
+
target: "deviceInvitation"
|
|
4005
4200
|
});
|
|
4006
4201
|
},
|
|
4007
4202
|
onDone: async () => {
|
|
@@ -4063,10 +4258,10 @@ var Shell = ({ runtime }) => {
|
|
|
4063
4258
|
// packages/sdk/shell/src/composites/Shell/shell-runtime.ts
|
|
4064
4259
|
import { Event } from "@dxos/async";
|
|
4065
4260
|
import { appServiceBundle, shellServiceBundle } from "@dxos/client-protocol";
|
|
4066
|
-
import { invariant as
|
|
4261
|
+
import { invariant as invariant4 } from "@dxos/invariant";
|
|
4067
4262
|
import { ShellLayout as ShellLayout2 } from "@dxos/protocols/proto/dxos/iframe";
|
|
4068
4263
|
import { createProtoRpcPeer } from "@dxos/rpc";
|
|
4069
|
-
var
|
|
4264
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/composites/Shell/shell-runtime.ts";
|
|
4070
4265
|
var ShellRuntimeImpl = class {
|
|
4071
4266
|
constructor(_port) {
|
|
4072
4267
|
this._port = _port;
|
|
@@ -4122,8 +4317,8 @@ var ShellRuntimeImpl = class {
|
|
|
4122
4317
|
});
|
|
4123
4318
|
}
|
|
4124
4319
|
async setAppContext(context) {
|
|
4125
|
-
|
|
4126
|
-
F:
|
|
4320
|
+
invariant4(this._appRpc, "runtime not open", {
|
|
4321
|
+
F: __dxlog_file15,
|
|
4127
4322
|
L: 83,
|
|
4128
4323
|
S: this,
|
|
4129
4324
|
A: [
|
|
@@ -4201,7 +4396,7 @@ var os = {
|
|
|
4201
4396
|
"recover identity input label": "Type or paste your seed phrase",
|
|
4202
4397
|
"failed to create identity message": "Failed to create an identity.",
|
|
4203
4398
|
"failed to recover identity message": "Failed to recover an identity from the provided seed phrase.",
|
|
4204
|
-
"failed to authenticate message": "Incorrect
|
|
4399
|
+
"failed to authenticate message": "Incorrect code.",
|
|
4205
4400
|
"identity added label": "Created identity & added to this device:",
|
|
4206
4401
|
"join space as identity heading": "<part>as </part><part><icon/><label>{{labelValue}}</label></part>",
|
|
4207
4402
|
"error status label": "Failed",
|
|
@@ -4209,8 +4404,8 @@ var os = {
|
|
|
4209
4404
|
"cancelled status label": "Cancelled",
|
|
4210
4405
|
"init status label": "Ready to connect",
|
|
4211
4406
|
"connecting status label": "Connecting\u2026",
|
|
4212
|
-
"connected status label": "Enter
|
|
4213
|
-
"authenticating status label": "Enter
|
|
4407
|
+
"connected status label": "Enter authentication code",
|
|
4408
|
+
"authenticating status label": "Enter authentication code",
|
|
4214
4409
|
"success status label": "Success",
|
|
4215
4410
|
"cancel label": "Cancel",
|
|
4216
4411
|
"done label": "Done",
|
|
@@ -4313,7 +4508,10 @@ var os = {
|
|
|
4313
4508
|
"destroying agent label": "Stopping agent\u2026",
|
|
4314
4509
|
"getting agent label": "Checking agent status\u2026",
|
|
4315
4510
|
"agent requested label": "Agent requested",
|
|
4316
|
-
"agent requested description": "The agent service is creating an agent for you. Once the agent connects, it will display in the devices list."
|
|
4511
|
+
"agent requested description": "The agent service is creating an agent for you. Once the agent connects, it will display in the devices list.",
|
|
4512
|
+
"authenticating label": "Authenticating\u2026",
|
|
4513
|
+
"create recovery code label": "Create recovery code",
|
|
4514
|
+
"choose recover identity label": "Recover identity"
|
|
4317
4515
|
};
|
|
4318
4516
|
|
|
4319
4517
|
// packages/sdk/shell/src/translations/index.ts
|
|
@@ -4338,7 +4536,8 @@ var runShell = async (config = new Config()) => {
|
|
|
4338
4536
|
]
|
|
4339
4537
|
}, /* @__PURE__ */ React47.createElement(ClientProvider, {
|
|
4340
4538
|
config,
|
|
4341
|
-
services
|
|
4539
|
+
services,
|
|
4540
|
+
noBanner: true
|
|
4342
4541
|
}, /* @__PURE__ */ React47.createElement(ClipboardProvider, null, /* @__PURE__ */ React47.createElement(Tooltip8.Provider, null, /* @__PURE__ */ React47.createElement(AgentHostingProvider, null, /* @__PURE__ */ React47.createElement(Shell, {
|
|
4343
4542
|
runtime
|
|
4344
4543
|
}))))))));
|
|
@@ -4370,8 +4569,8 @@ var Fallback = ({ onClose }) => {
|
|
|
4370
4569
|
};
|
|
4371
4570
|
|
|
4372
4571
|
// packages/sdk/shell/src/composites/Shell/ShellContext.tsx
|
|
4373
|
-
import React48, { createContext as createContext2, useCallback as useCallback8, useContext as useContext2, useEffect as
|
|
4374
|
-
import { useClient as
|
|
4572
|
+
import React48, { createContext as createContext2, useCallback as useCallback8, useContext as useContext2, useEffect as useEffect9, useMemo as useMemo6, useState as useState15 } from "react";
|
|
4573
|
+
import { useClient as useClient10, ShellDisplay as ShellDisplay3, ShellLayout as ShellLayout4 } from "@dxos/react-client";
|
|
4375
4574
|
import { useIdentity as useIdentity3 } from "@dxos/react-client/halo";
|
|
4376
4575
|
import { mx as mx25 } from "@dxos/react-ui-theme";
|
|
4377
4576
|
|
|
@@ -4428,7 +4627,7 @@ var MemoryShellRuntime = class {
|
|
|
4428
4627
|
// packages/sdk/shell/src/composites/Shell/ShellContext.tsx
|
|
4429
4628
|
var ShellContext = /* @__PURE__ */ createContext2({});
|
|
4430
4629
|
var useShell = () => {
|
|
4431
|
-
const client =
|
|
4630
|
+
const client = useClient10();
|
|
4432
4631
|
const { runtime, setDisplay } = useContext2(ShellContext);
|
|
4433
4632
|
const setLayout = async (layout, options) => {
|
|
4434
4633
|
if (runtime) {
|
|
@@ -4449,9 +4648,9 @@ var useShell = () => {
|
|
|
4449
4648
|
};
|
|
4450
4649
|
};
|
|
4451
4650
|
var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoinedSpace, children }) => {
|
|
4452
|
-
const client =
|
|
4651
|
+
const client = useClient10();
|
|
4453
4652
|
const identity = useIdentity3();
|
|
4454
|
-
const [display, setDisplay] =
|
|
4653
|
+
const [display, setDisplay] = useState15(!identity || spaceInvitationCode || deviceInvitationCode ? ShellDisplay3.FULLSCREEN : ShellDisplay3.NONE);
|
|
4455
4654
|
const shellRuntime = useMemo6(() => {
|
|
4456
4655
|
if (client.config.get("runtime.app.env.DX_VAULT") !== "false") {
|
|
4457
4656
|
return;
|
|
@@ -4498,7 +4697,7 @@ var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoine
|
|
|
4498
4697
|
space,
|
|
4499
4698
|
shellRuntime
|
|
4500
4699
|
]);
|
|
4501
|
-
|
|
4700
|
+
useEffect9(() => {
|
|
4502
4701
|
if (!shellRuntime) {
|
|
4503
4702
|
return;
|
|
4504
4703
|
}
|
|
@@ -4508,7 +4707,7 @@ var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoine
|
|
|
4508
4707
|
shellRuntime,
|
|
4509
4708
|
handleKeyDown
|
|
4510
4709
|
]);
|
|
4511
|
-
|
|
4710
|
+
useEffect9(() => {
|
|
4512
4711
|
if (!shellRuntime) {
|
|
4513
4712
|
return;
|
|
4514
4713
|
}
|