@dxos/shell 0.6.13 → 0.6.14-main.1366248
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 +15995 -15601
- 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 +432 -230
- 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 +4766 -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 +4812 -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 +51 -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 +7 -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 +89 -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 +92 -48
- package/src/panels/IdentityPanel/IdentityPanelProps.ts +7 -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 +103 -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: agentProps.agentStatus === "created" ? onClickRecover : void 0,
|
|
1433
|
+
onClickReset,
|
|
1415
1434
|
onAgentDestroy: agentProps.onAgentDestroy
|
|
1416
1435
|
}), !managedDeviceAvailable && agentHostingEnabled && /* @__PURE__ */ React25.createElement(AgentConfig, agentProps));
|
|
1417
1436
|
};
|
|
@@ -1423,17 +1442,107 @@ 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 {
|
|
1430
|
-
import {
|
|
1431
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/IdentityPanel/
|
|
1432
|
-
var
|
|
1450
|
+
import { QueryAgentStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
|
|
1451
|
+
import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
1452
|
+
import { useClient as useClient3 } from "@dxos/react-client";
|
|
1453
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/IdentityPanel/useEdgeAgentsHandlers.ts";
|
|
1454
|
+
var useEdgeAgentHandlers = ({ identity }) => {
|
|
1433
1455
|
const [validationMessage, setValidationMessage] = useState6("");
|
|
1456
|
+
const [lastReceivedStatus, setLastReceivedStatus] = useState6(QueryAgentStatusResponse.AgentStatus.UNKNOWN);
|
|
1434
1457
|
const [agentStatus, setAgentStatus] = useState6("getting");
|
|
1435
|
-
const agentHostingProviderClient = useAgentHostingClient();
|
|
1436
1458
|
const client = useClient3();
|
|
1459
|
+
const agentHostingEnabled = Boolean(client.config.values.runtime?.client?.edgeFeatures?.agents);
|
|
1460
|
+
const handleStatus = (status) => {
|
|
1461
|
+
switch (status) {
|
|
1462
|
+
case QueryAgentStatusResponse.AgentStatus.ACTIVE:
|
|
1463
|
+
case QueryAgentStatusResponse.AgentStatus.INACTIVE:
|
|
1464
|
+
setAgentStatus("created");
|
|
1465
|
+
break;
|
|
1466
|
+
case QueryAgentStatusResponse.AgentStatus.NOT_FOUND:
|
|
1467
|
+
setAgentStatus("creatable");
|
|
1468
|
+
break;
|
|
1469
|
+
case QueryAgentStatusResponse.AgentStatus.UNKNOWN:
|
|
1470
|
+
setAgentStatus("getting");
|
|
1471
|
+
break;
|
|
1472
|
+
}
|
|
1473
|
+
};
|
|
1474
|
+
useEffect2(() => {
|
|
1475
|
+
const stream = client.services.services.EdgeAgentService?.queryAgentStatus();
|
|
1476
|
+
stream?.subscribe(({ status }) => {
|
|
1477
|
+
setLastReceivedStatus(status);
|
|
1478
|
+
handleStatus(status);
|
|
1479
|
+
});
|
|
1480
|
+
return () => {
|
|
1481
|
+
void stream?.close().catch(() => {
|
|
1482
|
+
});
|
|
1483
|
+
};
|
|
1484
|
+
}, []);
|
|
1485
|
+
const onAgentCreate = async () => {
|
|
1486
|
+
invariant(identity, "Identity not found", {
|
|
1487
|
+
F: __dxlog_file3,
|
|
1488
|
+
L: 58,
|
|
1489
|
+
S: void 0,
|
|
1490
|
+
A: [
|
|
1491
|
+
"identity",
|
|
1492
|
+
"'Identity not found'"
|
|
1493
|
+
]
|
|
1494
|
+
});
|
|
1495
|
+
const service = client.services.services.EdgeAgentService;
|
|
1496
|
+
if (!service) {
|
|
1497
|
+
setAgentStatus("error");
|
|
1498
|
+
setValidationMessage("Agent service not initialized.");
|
|
1499
|
+
return;
|
|
1500
|
+
}
|
|
1501
|
+
if (!agentHostingEnabled) {
|
|
1502
|
+
setAgentStatus("error");
|
|
1503
|
+
setValidationMessage("Edge agents are disabled in config.");
|
|
1504
|
+
return;
|
|
1505
|
+
}
|
|
1506
|
+
setAgentStatus("creating");
|
|
1507
|
+
setValidationMessage("");
|
|
1508
|
+
try {
|
|
1509
|
+
await service.createAgent();
|
|
1510
|
+
await Promise.all(client.spaces.get().map((space) => space?.internal.setEdgeReplicationPreference(EdgeReplicationSetting.ENABLED)));
|
|
1511
|
+
setAgentStatus("created");
|
|
1512
|
+
} catch (err) {
|
|
1513
|
+
setAgentStatus("error");
|
|
1514
|
+
setValidationMessage(`Error creating an agent: ${err.message}`);
|
|
1515
|
+
}
|
|
1516
|
+
};
|
|
1517
|
+
const onAgentDestroy = async () => {
|
|
1518
|
+
setValidationMessage("Agents are non-destructible.");
|
|
1519
|
+
};
|
|
1520
|
+
const onAgentRefresh = async () => {
|
|
1521
|
+
setValidationMessage("");
|
|
1522
|
+
handleStatus(lastReceivedStatus);
|
|
1523
|
+
};
|
|
1524
|
+
return {
|
|
1525
|
+
onAgentCreate,
|
|
1526
|
+
onAgentDestroy,
|
|
1527
|
+
onAgentRefresh,
|
|
1528
|
+
validationMessage,
|
|
1529
|
+
agentStatus,
|
|
1530
|
+
agentHostingEnabled
|
|
1531
|
+
};
|
|
1532
|
+
};
|
|
1533
|
+
|
|
1534
|
+
// packages/sdk/shell/src/panels/IdentityPanel/useKubeAgentHandlers.ts
|
|
1535
|
+
import { useCallback as useCallback4, useEffect as useEffect3, useState as useState7 } from "react";
|
|
1536
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
1537
|
+
import { log as log4 } from "@dxos/log";
|
|
1538
|
+
import { useClient as useClient4, useAgentHostingClient } from "@dxos/react-client";
|
|
1539
|
+
import { Invitation as Invitation3, InvitationEncoder as InvitationEncoder2 } from "@dxos/react-client/invitations";
|
|
1540
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/IdentityPanel/useKubeAgentHandlers.ts";
|
|
1541
|
+
var useKubeAgentHandlers = ({ invitations, identity }) => {
|
|
1542
|
+
const [validationMessage, setValidationMessage] = useState7("");
|
|
1543
|
+
const [agentStatus, setAgentStatus] = useState7("getting");
|
|
1544
|
+
const agentHostingProviderClient = useAgentHostingClient();
|
|
1545
|
+
const client = useClient4();
|
|
1437
1546
|
const updateAgentStatus = async () => {
|
|
1438
1547
|
if (agentHostingProviderClient) {
|
|
1439
1548
|
setAgentStatus("getting");
|
|
@@ -1454,8 +1563,8 @@ var useAgentHandlers = ({ invitations, identity }) => {
|
|
|
1454
1563
|
}
|
|
1455
1564
|
};
|
|
1456
1565
|
const createAgent = async (invitationCode) => {
|
|
1457
|
-
|
|
1458
|
-
F:
|
|
1566
|
+
invariant2(identity, "Identity not found", {
|
|
1567
|
+
F: __dxlog_file4,
|
|
1459
1568
|
L: 50,
|
|
1460
1569
|
S: void 0,
|
|
1461
1570
|
A: [
|
|
@@ -1484,8 +1593,8 @@ var useAgentHandlers = ({ invitations, identity }) => {
|
|
|
1484
1593
|
}
|
|
1485
1594
|
};
|
|
1486
1595
|
const destroyAgent = async () => {
|
|
1487
|
-
|
|
1488
|
-
F:
|
|
1596
|
+
invariant2(identity, "Identity not found", {
|
|
1597
|
+
F: __dxlog_file4,
|
|
1489
1598
|
L: 73,
|
|
1490
1599
|
S: void 0,
|
|
1491
1600
|
A: [
|
|
@@ -1508,7 +1617,7 @@ var useAgentHandlers = ({ invitations, identity }) => {
|
|
|
1508
1617
|
setValidationMessage("No agent provider configured.");
|
|
1509
1618
|
}
|
|
1510
1619
|
};
|
|
1511
|
-
|
|
1620
|
+
useEffect3(() => {
|
|
1512
1621
|
void updateAgentStatus();
|
|
1513
1622
|
}, []);
|
|
1514
1623
|
const handleAgentCreate = useCallback4(async (invitation) => {
|
|
@@ -1518,7 +1627,7 @@ var useAgentHandlers = ({ invitations, identity }) => {
|
|
|
1518
1627
|
invitationCode,
|
|
1519
1628
|
authCode: invitation.authCode
|
|
1520
1629
|
}), void 0, {
|
|
1521
|
-
F:
|
|
1630
|
+
F: __dxlog_file4,
|
|
1522
1631
|
L: 97,
|
|
1523
1632
|
S: void 0,
|
|
1524
1633
|
C: (f, a) => f(...a)
|
|
@@ -1549,6 +1658,16 @@ var useAgentHandlers = ({ invitations, identity }) => {
|
|
|
1549
1658
|
};
|
|
1550
1659
|
};
|
|
1551
1660
|
|
|
1661
|
+
// packages/sdk/shell/src/panels/IdentityPanel/useAgentHandlers.ts
|
|
1662
|
+
var useAgentHandlers = (params) => {
|
|
1663
|
+
const client = useClient5();
|
|
1664
|
+
if (client.config.values?.runtime?.client?.edgeFeatures?.agents) {
|
|
1665
|
+
return useEdgeAgentHandlers(params);
|
|
1666
|
+
} else {
|
|
1667
|
+
return useKubeAgentHandlers(params);
|
|
1668
|
+
}
|
|
1669
|
+
};
|
|
1670
|
+
|
|
1552
1671
|
// packages/sdk/shell/src/steps/InvitationManager.tsx
|
|
1553
1672
|
import { Check as Check4, X as X3 } from "@phosphor-icons/react";
|
|
1554
1673
|
import React27, { useMemo as useMemo2 } from "react";
|
|
@@ -1680,20 +1799,20 @@ var InvitationManager = ({ invitationUrl, active, send, status, multiUse, authCo
|
|
|
1680
1799
|
|
|
1681
1800
|
// packages/sdk/shell/src/steps/ConfirmReset.tsx
|
|
1682
1801
|
import { Warning } from "@phosphor-icons/react";
|
|
1683
|
-
import React28, { useState as
|
|
1802
|
+
import React28, { useState as useState8 } from "react";
|
|
1684
1803
|
import { log as log5 } from "@dxos/log";
|
|
1685
1804
|
import { Message, useTranslation as useTranslation13 } from "@dxos/react-ui";
|
|
1686
1805
|
import { getSize as getSize12, mx as mx21 } from "@dxos/react-ui-theme";
|
|
1687
|
-
var
|
|
1806
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/steps/ConfirmReset.tsx";
|
|
1688
1807
|
var ConfirmReset = ({ active, onCancel, onConfirm, mode }) => {
|
|
1689
1808
|
const { t } = useTranslation13("os");
|
|
1690
|
-
const [validationMessage, setValidationMessage] =
|
|
1691
|
-
const [pending, setPending] =
|
|
1809
|
+
const [validationMessage, setValidationMessage] = useState8("");
|
|
1810
|
+
const [pending, setPending] = useState8(false);
|
|
1692
1811
|
const processReset = async () => {
|
|
1693
1812
|
setPending(true);
|
|
1694
1813
|
return onConfirm?.().then(() => setPending(false), (error) => {
|
|
1695
1814
|
log5.catch(error, void 0, {
|
|
1696
|
-
F:
|
|
1815
|
+
F: __dxlog_file5,
|
|
1697
1816
|
L: 38,
|
|
1698
1817
|
S: void 0,
|
|
1699
1818
|
C: (f, a) => f(...a)
|
|
@@ -1714,8 +1833,8 @@ var ConfirmReset = ({ active, onCancel, onConfirm, mode }) => {
|
|
|
1714
1833
|
var ConfirmResetImpl = ({ disabled, pending, validationMessage, onConfirm, onCancel, mode }) => {
|
|
1715
1834
|
const { t } = useTranslation13("os");
|
|
1716
1835
|
const confirmationValue = t("confirmation value");
|
|
1717
|
-
const [inputValue, setInputValue] =
|
|
1718
|
-
const testIdAffix = mode === "join new identity" ? "join-new-identity" : "reset-storage";
|
|
1836
|
+
const [inputValue, setInputValue] = useState8("");
|
|
1837
|
+
const testIdAffix = mode === "join new identity" ? "join-new-identity" : mode === "recover" ? "recover" : "reset-storage";
|
|
1719
1838
|
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement("div", {
|
|
1720
1839
|
role: "none",
|
|
1721
1840
|
className: "grow flex flex-col gap-2 justify-center"
|
|
@@ -1727,7 +1846,7 @@ var ConfirmResetImpl = ({ disabled, pending, validationMessage, onConfirm, onCan
|
|
|
1727
1846
|
validationMessage,
|
|
1728
1847
|
label: /* @__PURE__ */ React28.createElement(StepHeading, {
|
|
1729
1848
|
className: "text-start mlb-2"
|
|
1730
|
-
}, t(mode === "join new identity" ? "join new identity input label" : "reset storage input label", {
|
|
1849
|
+
}, t(mode === "join new identity" ? "join new identity input label" : mode === "recover" ? "recover reset input label" : "reset storage input label", {
|
|
1731
1850
|
confirmationValue
|
|
1732
1851
|
})),
|
|
1733
1852
|
disabled,
|
|
@@ -1749,19 +1868,20 @@ var ConfirmResetImpl = ({ disabled, pending, validationMessage, onConfirm, onCan
|
|
|
1749
1868
|
};
|
|
1750
1869
|
|
|
1751
1870
|
// packages/sdk/shell/src/panels/IdentityPanel/IdentityPanel.tsx
|
|
1752
|
-
var
|
|
1871
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/IdentityPanel/IdentityPanel.tsx";
|
|
1753
1872
|
var viewStyles = "pbs-1 pbe-3 pli-3";
|
|
1754
1873
|
var getHueValue = (identity) => identity?.profile?.data?.hue || hexToHue2(identity?.identityKey.toHex() ?? "0");
|
|
1755
1874
|
var getEmojiValue = (identity) => identity?.profile?.data?.emoji || hexToEmoji4(identity?.identityKey.toHex() ?? "0");
|
|
1756
|
-
var IdentityHeading = ({ titleId, title, identity, onDone, onUpdateProfile, connectionState, onChangeConnectionState }) => {
|
|
1875
|
+
var IdentityHeading = ({ titleId, title, identity, hideRecover, onDone, onUpdateProfile, connectionState, onChangeConnectionState }) => {
|
|
1876
|
+
const client = useClient6();
|
|
1757
1877
|
const fallbackValue = keyToFallback3(identity.identityKey);
|
|
1758
1878
|
const { t } = useTranslation14("os");
|
|
1759
|
-
const [displayName, setDisplayName] =
|
|
1760
|
-
const [emoji, setEmojiDirectly] =
|
|
1761
|
-
const [hue, setHueDirectly] =
|
|
1879
|
+
const [displayName, setDisplayName] = useState9(identity.profile?.displayName ?? "");
|
|
1880
|
+
const [emoji, setEmojiDirectly] = useState9(getEmojiValue(identity));
|
|
1881
|
+
const [hue, setHueDirectly] = useState9(getHueValue(identity));
|
|
1762
1882
|
const { textValue, setTextValue } = useClipboardContext();
|
|
1763
1883
|
const identityHex = identity.identityKey.toHex();
|
|
1764
|
-
const
|
|
1884
|
+
const publicKeyCopied = textValue === identityHex;
|
|
1765
1885
|
const setEmoji = (nextEmoji) => {
|
|
1766
1886
|
setEmojiDirectly(nextEmoji);
|
|
1767
1887
|
void onUpdateProfile?.({
|
|
@@ -1782,8 +1902,20 @@ var IdentityHeading = ({ titleId, title, identity, onDone, onUpdateProfile, conn
|
|
|
1782
1902
|
}
|
|
1783
1903
|
});
|
|
1784
1904
|
};
|
|
1905
|
+
const handleRecoveryCode = async () => {
|
|
1906
|
+
invariant3(client.services.services.IdentityService, "IdentityService not available", {
|
|
1907
|
+
F: __dxlog_file6,
|
|
1908
|
+
L: 77,
|
|
1909
|
+
S: void 0,
|
|
1910
|
+
A: [
|
|
1911
|
+
"client.services.services.IdentityService",
|
|
1912
|
+
"'IdentityService not available'"
|
|
1913
|
+
]
|
|
1914
|
+
});
|
|
1915
|
+
const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();
|
|
1916
|
+
void setTextValue(seedphrase);
|
|
1917
|
+
};
|
|
1785
1918
|
const isConnected = connectionState === ConnectionState2.ONLINE;
|
|
1786
|
-
const debug = true;
|
|
1787
1919
|
return /* @__PURE__ */ React29.createElement(Heading, {
|
|
1788
1920
|
titleId,
|
|
1789
1921
|
title,
|
|
@@ -1827,7 +1959,7 @@ var IdentityHeading = ({ titleId, title, identity, onDone, onUpdateProfile, conn
|
|
|
1827
1959
|
hue,
|
|
1828
1960
|
onChangeHue: setHue,
|
|
1829
1961
|
classNames: "bs-[--rail-action]"
|
|
1830
|
-
}),
|
|
1962
|
+
}), /* @__PURE__ */ React29.createElement(Tooltip7.Root, null, /* @__PURE__ */ React29.createElement(Tooltip7.Trigger, {
|
|
1831
1963
|
asChild: true
|
|
1832
1964
|
}, /* @__PURE__ */ React29.createElement(Toolbar3.Button, {
|
|
1833
1965
|
classNames: "bs-[--rail-action]",
|
|
@@ -1835,12 +1967,22 @@ var IdentityHeading = ({ titleId, title, identity, onDone, onUpdateProfile, conn
|
|
|
1835
1967
|
onClick: () => setTextValue(identityHex)
|
|
1836
1968
|
}, /* @__PURE__ */ React29.createElement("span", {
|
|
1837
1969
|
className: "sr-only"
|
|
1838
|
-
}, t(
|
|
1970
|
+
}, t(publicKeyCopied ? "copy success label" : "copy self public key label")), /* @__PURE__ */ React29.createElement(Key, {
|
|
1971
|
+
className: getSize13(5)
|
|
1972
|
+
}))), /* @__PURE__ */ React29.createElement(Tooltip7.Portal, null, /* @__PURE__ */ React29.createElement(Tooltip7.Content, {
|
|
1973
|
+
side: "bottom",
|
|
1974
|
+
classNames: "z-50"
|
|
1975
|
+
}, t(publicKeyCopied ? "copy success label" : "copy self public key label"), /* @__PURE__ */ React29.createElement(Tooltip7.Arrow, null)))), !hideRecover && /* @__PURE__ */ React29.createElement(Tooltip7.Root, null, /* @__PURE__ */ React29.createElement(Tooltip7.Trigger, {
|
|
1976
|
+
asChild: true
|
|
1977
|
+
}, /* @__PURE__ */ React29.createElement(Toolbar3.Button, {
|
|
1978
|
+
classNames: "bs-[--rail-action]",
|
|
1979
|
+
onClick: handleRecoveryCode
|
|
1980
|
+
}, /* @__PURE__ */ React29.createElement(FirstAidKit2, {
|
|
1839
1981
|
className: getSize13(5)
|
|
1840
1982
|
}))), /* @__PURE__ */ React29.createElement(Tooltip7.Portal, null, /* @__PURE__ */ React29.createElement(Tooltip7.Content, {
|
|
1841
1983
|
side: "bottom",
|
|
1842
1984
|
classNames: "z-50"
|
|
1843
|
-
}, t(
|
|
1985
|
+
}, t("create recovery code label"), /* @__PURE__ */ React29.createElement(Tooltip7.Arrow, null)))), /* @__PURE__ */ React29.createElement(Tooltip7.Root, null, /* @__PURE__ */ React29.createElement(Tooltip7.Trigger, {
|
|
1844
1986
|
asChild: true
|
|
1845
1987
|
}, /* @__PURE__ */ React29.createElement(Toolbar3.Button, {
|
|
1846
1988
|
classNames: [
|
|
@@ -1857,10 +1999,10 @@ var IdentityHeading = ({ titleId, title, identity, onDone, onUpdateProfile, conn
|
|
|
1857
1999
|
}))), /* @__PURE__ */ React29.createElement(Tooltip7.Portal, null, /* @__PURE__ */ React29.createElement(Tooltip7.Content, {
|
|
1858
2000
|
side: "bottom",
|
|
1859
2001
|
classNames: "z-50"
|
|
1860
|
-
}, t(isConnected ? "disconnect label" : "connect label"), /* @__PURE__ */ React29.createElement(Tooltip7.Arrow, null)))))))
|
|
2002
|
+
}, t(isConnected ? "disconnect label" : "connect label"), /* @__PURE__ */ React29.createElement(Tooltip7.Arrow, null)))))));
|
|
1861
2003
|
};
|
|
1862
2004
|
var IdentityPanelImpl = (props) => {
|
|
1863
|
-
const { identity, titleId, activeView, onUpdateProfile, onResetStorage, onJoinNewIdentity, IdentityActionChooser: IdentityActionChooserComponent = IdentityActionChooser, InvitationManager: InvitationManagerComponent = InvitationManager, connectionState, onChangeConnectionState, onDone, ...rest } = props;
|
|
2005
|
+
const { identity, titleId, activeView, onUpdateProfile, onResetStorage, onRecover, onJoinNewIdentity, IdentityActionChooser: IdentityActionChooserComponent = IdentityActionChooser, InvitationManager: InvitationManagerComponent = InvitationManager, connectionState, onChangeConnectionState, onDone, ...rest } = props;
|
|
1864
2006
|
const { t } = useTranslation14("os");
|
|
1865
2007
|
const title = useMemo3(() => {
|
|
1866
2008
|
switch (activeView) {
|
|
@@ -1874,12 +2016,12 @@ var IdentityPanelImpl = (props) => {
|
|
|
1874
2016
|
t
|
|
1875
2017
|
]);
|
|
1876
2018
|
const onCancelReset = () => rest.send?.("unchooseAction");
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
}, /* @__PURE__ */ React29.createElement(IdentityHeading, {
|
|
2019
|
+
const hideRecover = rest.agentStatus !== "created";
|
|
2020
|
+
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(IdentityHeading, {
|
|
1880
2021
|
identity,
|
|
1881
2022
|
titleId,
|
|
1882
2023
|
title,
|
|
2024
|
+
hideRecover,
|
|
1883
2025
|
onDone,
|
|
1884
2026
|
onUpdateProfile,
|
|
1885
2027
|
connectionState,
|
|
@@ -1909,6 +2051,15 @@ var IdentityPanelImpl = (props) => {
|
|
|
1909
2051
|
mode: "join new identity",
|
|
1910
2052
|
onConfirm: onJoinNewIdentity,
|
|
1911
2053
|
onCancel: onCancelReset
|
|
2054
|
+
})), /* @__PURE__ */ React29.createElement(Viewport.View, {
|
|
2055
|
+
classNames: viewStyles,
|
|
2056
|
+
id: "confirm recover"
|
|
2057
|
+
}, /* @__PURE__ */ React29.createElement(ConfirmReset, {
|
|
2058
|
+
active: activeView === "confirm recover",
|
|
2059
|
+
...rest,
|
|
2060
|
+
mode: "recover",
|
|
2061
|
+
onConfirm: onRecover,
|
|
2062
|
+
onCancel: onCancelReset
|
|
1912
2063
|
})), /* @__PURE__ */ React29.createElement(Viewport.View, {
|
|
1913
2064
|
classNames: viewStyles,
|
|
1914
2065
|
id: "confirm reset storage"
|
|
@@ -1929,7 +2080,7 @@ var IdentityPanelWithInvitationImpl = ({ invitation, ...props }) => {
|
|
|
1929
2080
|
};
|
|
1930
2081
|
var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => code, initialDisposition = "default", ...props }) => {
|
|
1931
2082
|
const titleId = useId6("identityPanel__heading", propsTitleId);
|
|
1932
|
-
const client =
|
|
2083
|
+
const client = useClient6();
|
|
1933
2084
|
const devices = useDevices();
|
|
1934
2085
|
const identity = useIdentity();
|
|
1935
2086
|
const invitations = useHaloInvitations2();
|
|
@@ -1939,8 +2090,8 @@ var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => co
|
|
|
1939
2090
|
});
|
|
1940
2091
|
if (!identity) {
|
|
1941
2092
|
log6.error("IdentityPanel rendered with no active identity.", void 0, {
|
|
1942
|
-
F:
|
|
1943
|
-
L:
|
|
2093
|
+
F: __dxlog_file6,
|
|
2094
|
+
L: 288,
|
|
1944
2095
|
S: void 0,
|
|
1945
2096
|
C: (f, a) => f(...a)
|
|
1946
2097
|
});
|
|
@@ -1953,11 +2104,11 @@ var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => co
|
|
|
1953
2104
|
});
|
|
1954
2105
|
const { swarm: connectionState } = useNetworkStatus();
|
|
1955
2106
|
const handleChangeConnectionState = async (nextState) => client?.mesh.updateConfig(nextState);
|
|
1956
|
-
|
|
2107
|
+
useEffect4(() => {
|
|
1957
2108
|
const subscription = identityService.subscribe((state) => {
|
|
1958
2109
|
log6("[state]", state, {
|
|
1959
|
-
F:
|
|
1960
|
-
L:
|
|
2110
|
+
F: __dxlog_file6,
|
|
2111
|
+
L: 301,
|
|
1961
2112
|
S: void 0,
|
|
1962
2113
|
C: (f, a) => f(...a)
|
|
1963
2114
|
});
|
|
@@ -1974,6 +2125,8 @@ var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => co
|
|
|
1974
2125
|
return "device invitation manager";
|
|
1975
2126
|
case identityState.matches("confirmingResetStorage"):
|
|
1976
2127
|
return "confirm reset storage";
|
|
2128
|
+
case identityState.matches("confirmingRecover"):
|
|
2129
|
+
return "confirm recover";
|
|
1977
2130
|
case identityState.matches("confirmingJoinNewIdentity"):
|
|
1978
2131
|
return "confirm join new identity";
|
|
1979
2132
|
default:
|
|
@@ -2008,11 +2161,11 @@ var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => co
|
|
|
2008
2161
|
};
|
|
2009
2162
|
|
|
2010
2163
|
// packages/sdk/shell/src/panels/JoinPanel/JoinPanel.tsx
|
|
2011
|
-
import React38, { useCallback as useCallback6, useEffect as
|
|
2164
|
+
import React38, { useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo4 } from "react";
|
|
2012
2165
|
import { log as log10 } from "@dxos/log";
|
|
2013
|
-
import { useClient as
|
|
2166
|
+
import { useClient as useClient8, useMulticastObservable } from "@dxos/react-client";
|
|
2014
2167
|
import { useIdentity as useIdentity2 } from "@dxos/react-client/halo";
|
|
2015
|
-
import {
|
|
2168
|
+
import { useId as useId8, useThemeContext as useThemeContext5 } from "@dxos/react-ui";
|
|
2016
2169
|
|
|
2017
2170
|
// packages/sdk/shell/src/panels/JoinPanel/JoinHeading.tsx
|
|
2018
2171
|
import { X as X4 } from "@phosphor-icons/react";
|
|
@@ -2054,10 +2207,10 @@ import { assign as assign2, createMachine as createMachine2 } from "xstate";
|
|
|
2054
2207
|
import { log as log7 } from "@dxos/log";
|
|
2055
2208
|
import { AlreadyJoinedError } from "@dxos/react-client";
|
|
2056
2209
|
import { Invitation as Invitation5, InvitationEncoder as InvitationEncoder3 } from "@dxos/react-client/invitations";
|
|
2057
|
-
var
|
|
2210
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/joinMachine.ts";
|
|
2058
2211
|
var getInvitationSubscribable = (Kind, invitation) => {
|
|
2059
2212
|
log7("[subscribing to invitation]", invitation, {
|
|
2060
|
-
F:
|
|
2213
|
+
F: __dxlog_file7,
|
|
2061
2214
|
L: 90,
|
|
2062
2215
|
S: void 0,
|
|
2063
2216
|
C: (f, a) => f(...a)
|
|
@@ -2070,7 +2223,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2070
2223
|
Kind,
|
|
2071
2224
|
invitation: invitation2
|
|
2072
2225
|
}, {
|
|
2073
|
-
F:
|
|
2226
|
+
F: __dxlog_file7,
|
|
2074
2227
|
L: 101,
|
|
2075
2228
|
S: void 0,
|
|
2076
2229
|
C: (f, a) => f(...a)
|
|
@@ -2085,7 +2238,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2085
2238
|
Kind,
|
|
2086
2239
|
invitation: invitation2
|
|
2087
2240
|
}, {
|
|
2088
|
-
F:
|
|
2241
|
+
F: __dxlog_file7,
|
|
2089
2242
|
L: 106,
|
|
2090
2243
|
S: void 0,
|
|
2091
2244
|
C: (f, a) => f(...a)
|
|
@@ -2100,7 +2253,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2100
2253
|
Kind,
|
|
2101
2254
|
invitation: invitation2
|
|
2102
2255
|
}, {
|
|
2103
|
-
F:
|
|
2256
|
+
F: __dxlog_file7,
|
|
2104
2257
|
L: 111,
|
|
2105
2258
|
S: void 0,
|
|
2106
2259
|
C: (f, a) => f(...a)
|
|
@@ -2115,7 +2268,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2115
2268
|
Kind,
|
|
2116
2269
|
invitation: invitation2
|
|
2117
2270
|
}, {
|
|
2118
|
-
F:
|
|
2271
|
+
F: __dxlog_file7,
|
|
2119
2272
|
L: 116,
|
|
2120
2273
|
S: void 0,
|
|
2121
2274
|
C: (f, a) => f(...a)
|
|
@@ -2130,7 +2283,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2130
2283
|
Kind,
|
|
2131
2284
|
invitation: invitation2
|
|
2132
2285
|
}, {
|
|
2133
|
-
F:
|
|
2286
|
+
F: __dxlog_file7,
|
|
2134
2287
|
L: 121,
|
|
2135
2288
|
S: void 0,
|
|
2136
2289
|
C: (f, a) => f(...a)
|
|
@@ -2145,7 +2298,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2145
2298
|
log7.warn("[invitation cancelled]", {
|
|
2146
2299
|
Kind
|
|
2147
2300
|
}, {
|
|
2148
|
-
F:
|
|
2301
|
+
F: __dxlog_file7,
|
|
2149
2302
|
L: 127,
|
|
2150
2303
|
S: void 0,
|
|
2151
2304
|
C: (f, a) => f(...a)
|
|
@@ -2159,7 +2312,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2159
2312
|
log7.error("[invitation timeout]", {
|
|
2160
2313
|
Kind
|
|
2161
2314
|
}, {
|
|
2162
|
-
F:
|
|
2315
|
+
F: __dxlog_file7,
|
|
2163
2316
|
L: 132,
|
|
2164
2317
|
S: void 0,
|
|
2165
2318
|
C: (f, a) => f(...a)
|
|
@@ -2176,7 +2329,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2176
2329
|
Kind,
|
|
2177
2330
|
error
|
|
2178
2331
|
}, {
|
|
2179
|
-
F:
|
|
2332
|
+
F: __dxlog_file7,
|
|
2180
2333
|
L: 139,
|
|
2181
2334
|
S: void 0,
|
|
2182
2335
|
C: (f, a) => f(...a)
|
|
@@ -2191,7 +2344,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
2191
2344
|
Kind,
|
|
2192
2345
|
error
|
|
2193
2346
|
}, {
|
|
2194
|
-
F:
|
|
2347
|
+
F: __dxlog_file7,
|
|
2195
2348
|
L: 144,
|
|
2196
2349
|
S: void 0,
|
|
2197
2350
|
C: (f, a) => f(...a)
|
|
@@ -2384,6 +2537,11 @@ var joinMachine = createMachine2({
|
|
|
2384
2537
|
target: "#join.choosingIdentity.acceptingHaloInvitation",
|
|
2385
2538
|
actions: "log"
|
|
2386
2539
|
},
|
|
2540
|
+
{
|
|
2541
|
+
cond: "initiallyRecoveringIdentity",
|
|
2542
|
+
target: "#join.choosingIdentity.recoveringIdentity",
|
|
2543
|
+
actions: "log"
|
|
2544
|
+
},
|
|
2387
2545
|
{
|
|
2388
2546
|
cond: "noSelectedIdentity",
|
|
2389
2547
|
target: "choosingIdentity",
|
|
@@ -2395,6 +2553,7 @@ var joinMachine = createMachine2({
|
|
|
2395
2553
|
}
|
|
2396
2554
|
]
|
|
2397
2555
|
},
|
|
2556
|
+
// TODO(wittjosiah): Remove.
|
|
2398
2557
|
choosingIdentity: {
|
|
2399
2558
|
initial: "unknownAuthMethod",
|
|
2400
2559
|
states: {
|
|
@@ -2447,6 +2606,7 @@ var joinMachine = createMachine2({
|
|
|
2447
2606
|
}
|
|
2448
2607
|
}
|
|
2449
2608
|
},
|
|
2609
|
+
// TODO(wittjosiah): Factor out to a machine handling recovery and device invitations.
|
|
2450
2610
|
resettingIdentity: {},
|
|
2451
2611
|
acceptingSpaceInvitation: acceptingInvitationTemplate("Space", "#join.finishingJoiningSpace"),
|
|
2452
2612
|
finishingJoiningSpace: {
|
|
@@ -2467,6 +2627,7 @@ var joinMachine = createMachine2({
|
|
|
2467
2627
|
existingIdentity: ({ identity, mode }, _event) => mode === "halo-only" && !!identity,
|
|
2468
2628
|
noSelectedIdentity: ({ identity }, _event) => !identity,
|
|
2469
2629
|
initiallyAcceptingHaloInvitation: ({ identity, initialDisposition }, _event) => !identity && initialDisposition === "accept-halo-invitation",
|
|
2630
|
+
initiallyRecoveringIdentity: ({ identity, initialDisposition }, _event) => !identity && initialDisposition === "recover-identity",
|
|
2470
2631
|
hasHaloUnredeemedCode: ({ halo }, _event) => !!halo.unredeemedCode,
|
|
2471
2632
|
noSpaceInvitation: ({ space }, _event) => !space.invitation && !space.unredeemedCode
|
|
2472
2633
|
},
|
|
@@ -2523,8 +2684,8 @@ var joinMachine = createMachine2({
|
|
|
2523
2684
|
haloInvitation: context.halo.invitation,
|
|
2524
2685
|
spaceInvitation: context.space.invitation
|
|
2525
2686
|
}, {
|
|
2526
|
-
F:
|
|
2527
|
-
L:
|
|
2687
|
+
F: __dxlog_file7,
|
|
2688
|
+
L: 425,
|
|
2528
2689
|
S: void 0,
|
|
2529
2690
|
C: (f, a) => f(...a)
|
|
2530
2691
|
});
|
|
@@ -2537,8 +2698,8 @@ var defaultCodeFromUrl = (invitationType, text) => {
|
|
|
2537
2698
|
return searchParams.get(`${invitationType}InvitationCode`) ?? searchParams.get(`${invitationType}Invitation`) ?? searchParams.get("invitationCode") ?? searchParams.get("invitation") ?? text;
|
|
2538
2699
|
} catch (err) {
|
|
2539
2700
|
log7.catch(err, void 0, {
|
|
2540
|
-
F:
|
|
2541
|
-
L:
|
|
2701
|
+
F: __dxlog_file7,
|
|
2702
|
+
L: 452,
|
|
2542
2703
|
S: void 0,
|
|
2543
2704
|
C: (f, a) => f(...a)
|
|
2544
2705
|
});
|
|
@@ -2558,8 +2719,8 @@ var useJoinMachine = (client, options) => {
|
|
|
2558
2719
|
};
|
|
2559
2720
|
} catch (err) {
|
|
2560
2721
|
log7.error("Could not redeem device invitation code", err, {
|
|
2561
|
-
F:
|
|
2562
|
-
L:
|
|
2722
|
+
F: __dxlog_file7,
|
|
2723
|
+
L: 473,
|
|
2563
2724
|
S: void 0,
|
|
2564
2725
|
C: (f, a) => f(...a)
|
|
2565
2726
|
});
|
|
@@ -2583,8 +2744,8 @@ var useJoinMachine = (client, options) => {
|
|
|
2583
2744
|
};
|
|
2584
2745
|
} catch (err) {
|
|
2585
2746
|
log7.error("Could not redeem space invitation code", err, {
|
|
2586
|
-
F:
|
|
2587
|
-
L:
|
|
2747
|
+
F: __dxlog_file7,
|
|
2748
|
+
L: 495,
|
|
2588
2749
|
S: void 0,
|
|
2589
2750
|
C: (f, a) => f(...a)
|
|
2590
2751
|
});
|
|
@@ -2689,8 +2850,6 @@ var AdditionMethodChooser = (viewStateProps) => {
|
|
|
2689
2850
|
"data-testid": "identity-chooser.join-identity"
|
|
2690
2851
|
}, t("join identity label")), /* @__PURE__ */ React31.createElement(CompoundButton, {
|
|
2691
2852
|
...sharedButtonProps,
|
|
2692
|
-
// TODO(mykola): Implement recover.
|
|
2693
|
-
disabled: true,
|
|
2694
2853
|
description: t("recover identity description"),
|
|
2695
2854
|
before: /* @__PURE__ */ React31.createElement(Textbox, {
|
|
2696
2855
|
className: getSize15(6)
|
|
@@ -2747,34 +2906,53 @@ var IdentityAdded = (props) => {
|
|
|
2747
2906
|
};
|
|
2748
2907
|
|
|
2749
2908
|
// packages/sdk/shell/src/panels/JoinPanel/steps/IdentityInput.tsx
|
|
2750
|
-
import React33, { useState as
|
|
2909
|
+
import React33, { useState as useState10 } from "react";
|
|
2751
2910
|
import { log as log8 } from "@dxos/log";
|
|
2752
|
-
import { useClient as
|
|
2911
|
+
import { useClient as useClient7 } from "@dxos/react-client";
|
|
2753
2912
|
import { useTranslation as useTranslation18 } from "@dxos/react-ui";
|
|
2754
|
-
var
|
|
2913
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/steps/IdentityInput.tsx";
|
|
2755
2914
|
var IdentityInput = (props) => {
|
|
2756
2915
|
const { send, method } = props;
|
|
2757
2916
|
const isRecover = method === "recover identity";
|
|
2758
|
-
const client =
|
|
2917
|
+
const client = useClient7();
|
|
2759
2918
|
const { t } = useTranslation18("os");
|
|
2760
|
-
const [validationMessage, setValidationMessage] =
|
|
2761
|
-
const createIdentity = (
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2919
|
+
const [validationMessage, setValidationMessage] = useState10("");
|
|
2920
|
+
const createIdentity = (value) => {
|
|
2921
|
+
if (isRecover) {
|
|
2922
|
+
void client.halo.recoverIdentity({
|
|
2923
|
+
seedphrase: value
|
|
2924
|
+
}).then((identity) => {
|
|
2925
|
+
send?.({
|
|
2926
|
+
type: "selectIdentity",
|
|
2927
|
+
identity
|
|
2928
|
+
});
|
|
2929
|
+
}, (error) => {
|
|
2930
|
+
log8.catch(error, void 0, {
|
|
2931
|
+
F: __dxlog_file8,
|
|
2932
|
+
L: 38,
|
|
2933
|
+
S: void 0,
|
|
2934
|
+
C: (f, a) => f(...a)
|
|
2935
|
+
});
|
|
2936
|
+
setValidationMessage(t("failed to recover identity message"));
|
|
2768
2937
|
});
|
|
2769
|
-
}
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2938
|
+
} else {
|
|
2939
|
+
void client.halo.createIdentity({
|
|
2940
|
+
displayName: value
|
|
2941
|
+
}).then((identity) => {
|
|
2942
|
+
send?.({
|
|
2943
|
+
type: "selectIdentity",
|
|
2944
|
+
identity
|
|
2945
|
+
});
|
|
2946
|
+
}, (error) => {
|
|
2947
|
+
log8.catch(error, void 0, {
|
|
2948
|
+
F: __dxlog_file8,
|
|
2949
|
+
L: 48,
|
|
2950
|
+
S: void 0,
|
|
2951
|
+
C: (f, a) => f(...a)
|
|
2952
|
+
});
|
|
2953
|
+
setValidationMessage(t("failed to create identity message"));
|
|
2775
2954
|
});
|
|
2776
|
-
|
|
2777
|
-
});
|
|
2955
|
+
}
|
|
2778
2956
|
};
|
|
2779
2957
|
return /* @__PURE__ */ React33.createElement(IdentityInputImpl, {
|
|
2780
2958
|
...props,
|
|
@@ -2786,7 +2964,7 @@ var IdentityInputImpl = (props) => {
|
|
|
2786
2964
|
const { method, send, active, onDisplayNameConfirm, validationMessage } = props;
|
|
2787
2965
|
const disabled = !active;
|
|
2788
2966
|
const { t } = useTranslation18("os");
|
|
2789
|
-
const [inputValue, setInputValue] =
|
|
2967
|
+
const [inputValue, setInputValue] = useState10("");
|
|
2790
2968
|
const isRecover = method === "recover identity";
|
|
2791
2969
|
return /* @__PURE__ */ React33.createElement(React33.Fragment, null, /* @__PURE__ */ React33.createElement("div", {
|
|
2792
2970
|
role: "none",
|
|
@@ -2816,30 +2994,12 @@ var IdentityInputImpl = (props) => {
|
|
|
2816
2994
|
// packages/sdk/shell/src/panels/JoinPanel/steps/InvitationAccepted.tsx
|
|
2817
2995
|
import React34, { cloneElement as cloneElement3 } from "react";
|
|
2818
2996
|
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
2997
|
|
|
2838
2998
|
// packages/sdk/shell/src/panels/JoinPanel/steps/InvitationInput.tsx
|
|
2839
|
-
import React35, { useState as
|
|
2999
|
+
import React35, { useState as useState11, useEffect as useEffect5, cloneElement as cloneElement4 } from "react";
|
|
2840
3000
|
import { log as log9 } from "@dxos/log";
|
|
2841
3001
|
import { useTranslation as useTranslation20 } from "@dxos/react-ui";
|
|
2842
|
-
var
|
|
3002
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/steps/InvitationInput.tsx";
|
|
2843
3003
|
var invitationCodeFromUrl = (text) => {
|
|
2844
3004
|
try {
|
|
2845
3005
|
const searchParams = new URLSearchParams(text.substring(text.lastIndexOf("?")));
|
|
@@ -2847,7 +3007,7 @@ var invitationCodeFromUrl = (text) => {
|
|
|
2847
3007
|
return invitation ?? text;
|
|
2848
3008
|
} catch (err) {
|
|
2849
3009
|
log9.catch(err, void 0, {
|
|
2850
|
-
F:
|
|
3010
|
+
F: __dxlog_file9,
|
|
2851
3011
|
L: 25,
|
|
2852
3012
|
S: void 0,
|
|
2853
3013
|
C: (f, a) => f(...a)
|
|
@@ -2859,8 +3019,8 @@ var InvitationInput = (props) => {
|
|
|
2859
3019
|
const { Kind, active, send, unredeemedCode, onExit, exitActionParent, onDone, doneActionParent, succeededKeys } = props;
|
|
2860
3020
|
const disabled = !active;
|
|
2861
3021
|
const { t } = useTranslation20("os");
|
|
2862
|
-
const [inputValue, setInputValue] =
|
|
2863
|
-
|
|
3022
|
+
const [inputValue, setInputValue] = useState11(unredeemedCode ?? "");
|
|
3023
|
+
useEffect5(() => {
|
|
2864
3024
|
unredeemedCode && setInputValue(unredeemedCode ?? "");
|
|
2865
3025
|
}, [
|
|
2866
3026
|
unredeemedCode
|
|
@@ -2900,16 +3060,9 @@ var InvitationInput = (props) => {
|
|
|
2900
3060
|
"data-autofocus": `inputting${Kind}InvitationCode`,
|
|
2901
3061
|
"data-testid": `${Kind.toLowerCase()}-invitation-input`,
|
|
2902
3062
|
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, {
|
|
3063
|
+
})), /* @__PURE__ */ React35.createElement(Actions, null, Kind === "Halo" ? null : exitActionParent ? /* @__PURE__ */ cloneElement4(exitActionParent, {}, exitAction) : doneActionParent ? /* @__PURE__ */ cloneElement4(doneActionParent, {}, exitAction) : exitAction, /* @__PURE__ */ React35.createElement(Action, {
|
|
2911
3064
|
variant: "primary",
|
|
2912
|
-
disabled,
|
|
3065
|
+
disabled: disabled || inputValue.trim().length === 0,
|
|
2913
3066
|
onClick: handleNext,
|
|
2914
3067
|
"data-testid": `${Kind.toLowerCase()}-invitation-input-continue`
|
|
2915
3068
|
}, t("continue label"))));
|
|
@@ -2978,15 +3131,17 @@ var InvitationRescuer = (props) => {
|
|
|
2978
3131
|
};
|
|
2979
3132
|
|
|
2980
3133
|
// packages/sdk/shell/src/panels/JoinPanel/steps/InvitationAuthenticator.tsx
|
|
2981
|
-
import React37, { useState as
|
|
3134
|
+
import React37, { useState as useState12 } from "react";
|
|
3135
|
+
import { Invitation as Invitation6 } from "@dxos/react-client/invitations";
|
|
2982
3136
|
import { Input as Input3, useTranslation as useTranslation22 } from "@dxos/react-ui";
|
|
3137
|
+
import { descriptionText as descriptionText11 } from "@dxos/react-ui-theme";
|
|
2983
3138
|
import { hexToEmoji as hexToEmoji5 } from "@dxos/util";
|
|
2984
3139
|
var pinLength = 6;
|
|
2985
|
-
var InvitationAuthenticator = ({ failed, Kind, active, pending, invitationId, onInvitationAuthenticate, onInvitationCancel }) => {
|
|
3140
|
+
var InvitationAuthenticator = ({ failed, Kind, authMethod, active, pending, invitationId, onInvitationAuthenticate, onInvitationCancel }) => {
|
|
2986
3141
|
const disabled = !active || pending;
|
|
2987
3142
|
const { t } = useTranslation22("os");
|
|
2988
3143
|
const invitationType = Kind.toLowerCase();
|
|
2989
|
-
const [authCode, setAuthCode] =
|
|
3144
|
+
const [authCode, setAuthCode] = useState12("");
|
|
2990
3145
|
const onChange = ({ target: { value } }) => {
|
|
2991
3146
|
setAuthCode(value);
|
|
2992
3147
|
if (value.length === pinLength) {
|
|
@@ -3000,7 +3155,12 @@ var InvitationAuthenticator = ({ failed, Kind, active, pending, invitationId, on
|
|
|
3000
3155
|
validationValence: "error"
|
|
3001
3156
|
}, /* @__PURE__ */ React37.createElement(Input3.Label, {
|
|
3002
3157
|
asChild: true
|
|
3003
|
-
}, /* @__PURE__ */ React37.createElement(StepHeading, null, t("auth code input label"))
|
|
3158
|
+
}, 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, {
|
|
3159
|
+
className: descriptionText11
|
|
3160
|
+
}, t("authenticating label")), /* @__PURE__ */ React37.createElement("div", {
|
|
3161
|
+
role: "none",
|
|
3162
|
+
className: "grow"
|
|
3163
|
+
}))), authMethod === Invitation6.AuthMethod.SHARED_SECRET && /* @__PURE__ */ React37.createElement(Input3.PinInput, {
|
|
3004
3164
|
disabled,
|
|
3005
3165
|
length: pinLength,
|
|
3006
3166
|
onChange,
|
|
@@ -3013,7 +3173,7 @@ var InvitationAuthenticator = ({ failed, Kind, active, pending, invitationId, on
|
|
|
3013
3173
|
"data-1p-ignore": true
|
|
3014
3174
|
}), failed && /* @__PURE__ */ React37.createElement(Input3.DescriptionAndValidation, {
|
|
3015
3175
|
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", {
|
|
3176
|
+
}, /* @__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
3177
|
className: "flex justify-center"
|
|
3018
3178
|
}, /* @__PURE__ */ React37.createElement(Emoji, {
|
|
3019
3179
|
text: hexToEmoji5(invitationId)
|
|
@@ -3035,7 +3195,7 @@ var InvitationAuthenticator = ({ failed, Kind, active, pending, invitationId, on
|
|
|
3035
3195
|
var stepStyles = "pbs-1 pbe-3 pli-3";
|
|
3036
3196
|
|
|
3037
3197
|
// packages/sdk/shell/src/styles/invitationStatusStyles.ts
|
|
3038
|
-
import { Invitation as
|
|
3198
|
+
import { Invitation as Invitation7 } from "@dxos/react-client/invitations";
|
|
3039
3199
|
var inactiveBgColor = "bg-neutral-100 dark:bg-neutral-600";
|
|
3040
3200
|
var activeBgColor = "bg-primary-500 dark:bg-primary-400";
|
|
3041
3201
|
var successBgColor = "bg-success-500 dark:bg-success-400";
|
|
@@ -3051,17 +3211,40 @@ var activeStrokeColor = "stroke-primary-400 dark:stroke-primary-150";
|
|
|
3051
3211
|
var successStrokeColor = "stroke-success-300 dark:stroke-primary-400";
|
|
3052
3212
|
var errorStrokeColor = "stroke-error-300 dark:stroke-error-500";
|
|
3053
3213
|
var cancelledStrokeColor = "stroke-warning-300 dark:stroke-warning-500";
|
|
3054
|
-
var resolvedStrokeColor = (status) => status ===
|
|
3055
|
-
var resolvedBgColor = (status) => status ===
|
|
3056
|
-
var resolvedTextColor = (status) => status ===
|
|
3214
|
+
var resolvedStrokeColor = (status) => status === Invitation7.State.ERROR ? errorStrokeColor : status === Invitation7.State.CANCELLED || status === Invitation7.State.TIMEOUT ? cancelledStrokeColor : successStrokeColor;
|
|
3215
|
+
var resolvedBgColor = (status) => status === Invitation7.State.ERROR ? errorBgColor : status === Invitation7.State.CANCELLED || status === Invitation7.State.TIMEOUT ? cancelledBgColor : successBgColor;
|
|
3216
|
+
var resolvedTextColor = (status) => status === Invitation7.State.ERROR ? errorTextColor : status === Invitation7.State.CANCELLED || status === Invitation7.State.TIMEOUT ? cancelledTextColor : successTextColor;
|
|
3057
3217
|
|
|
3058
3218
|
// packages/sdk/shell/src/panels/JoinPanel/JoinPanel.tsx
|
|
3059
|
-
var
|
|
3219
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/JoinPanel.tsx";
|
|
3060
3220
|
var JoinPanelImpl = (props) => {
|
|
3061
|
-
const {
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3221
|
+
const {
|
|
3222
|
+
titleId,
|
|
3223
|
+
send,
|
|
3224
|
+
activeView,
|
|
3225
|
+
failed,
|
|
3226
|
+
mode,
|
|
3227
|
+
unredeemedCodes,
|
|
3228
|
+
invitationIds,
|
|
3229
|
+
invitationStates,
|
|
3230
|
+
invitationAuthMethods,
|
|
3231
|
+
succeededKeys,
|
|
3232
|
+
failReasons,
|
|
3233
|
+
onExit,
|
|
3234
|
+
onHaloDone,
|
|
3235
|
+
// onSpaceDone,
|
|
3236
|
+
exitActionParent,
|
|
3237
|
+
doneActionParent,
|
|
3238
|
+
onHaloInvitationCancel,
|
|
3239
|
+
onSpaceInvitationCancel,
|
|
3240
|
+
onHaloInvitationAuthenticate,
|
|
3241
|
+
onSpaceInvitationAuthenticate,
|
|
3242
|
+
onCancelResetStorage,
|
|
3243
|
+
onConfirmResetStorage,
|
|
3244
|
+
IdentityInput: IdentityInputComponent = IdentityInput,
|
|
3245
|
+
ConfirmReset: ConfirmResetComponent = ConfirmReset
|
|
3246
|
+
} = props;
|
|
3247
|
+
return /* @__PURE__ */ React38.createElement(React38.Fragment, null, mode !== "halo-only" && /* @__PURE__ */ React38.createElement(JoinHeading, {
|
|
3065
3248
|
titleId,
|
|
3066
3249
|
mode,
|
|
3067
3250
|
onExit,
|
|
@@ -3127,21 +3310,13 @@ var JoinPanelImpl = (props) => {
|
|
|
3127
3310
|
send,
|
|
3128
3311
|
Kind: "Halo",
|
|
3129
3312
|
invitationId: invitationIds?.Halo,
|
|
3313
|
+
authMethod: invitationAuthMethods?.Halo,
|
|
3130
3314
|
active: activeView === "halo invitation authenticator",
|
|
3131
3315
|
onInvitationCancel: onHaloInvitationCancel,
|
|
3132
3316
|
onInvitationAuthenticate: onHaloInvitationAuthenticate,
|
|
3133
3317
|
...failed.has("Halo") && {
|
|
3134
3318
|
failed: true
|
|
3135
3319
|
}
|
|
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
3320
|
})), /* @__PURE__ */ React38.createElement(Viewport.View, {
|
|
3146
3321
|
classNames: stepStyles,
|
|
3147
3322
|
id: "identity added"
|
|
@@ -3183,25 +3358,17 @@ var JoinPanelImpl = (props) => {
|
|
|
3183
3358
|
send,
|
|
3184
3359
|
Kind: "Space",
|
|
3185
3360
|
invitationId: invitationIds?.Space,
|
|
3361
|
+
authMethod: invitationAuthMethods?.Space,
|
|
3186
3362
|
active: activeView === "space invitation authenticator",
|
|
3187
3363
|
onInvitationCancel: onSpaceInvitationCancel,
|
|
3188
3364
|
onInvitationAuthenticate: onSpaceInvitationAuthenticate,
|
|
3189
3365
|
...failed.has("Space") && {
|
|
3190
3366
|
failed: true
|
|
3191
3367
|
}
|
|
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
3368
|
})))));
|
|
3202
3369
|
};
|
|
3203
3370
|
var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition = "default", initialInvitationCode, exitActionParent, onExit, doneActionParent, onDone: propsOnDone, onCancelResetStorage }) => {
|
|
3204
|
-
const client =
|
|
3371
|
+
const client = useClient8();
|
|
3205
3372
|
const identity = useIdentity2();
|
|
3206
3373
|
const { hasIosKeyboard } = useThemeContext5();
|
|
3207
3374
|
const titleId = useId8("joinPanel__heading", propsTitleId);
|
|
@@ -3217,11 +3384,11 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition =
|
|
|
3217
3384
|
}
|
|
3218
3385
|
}
|
|
3219
3386
|
});
|
|
3220
|
-
|
|
3387
|
+
useEffect6(() => {
|
|
3221
3388
|
const subscription = joinService.subscribe((state) => {
|
|
3222
3389
|
log10("[state]", state, {
|
|
3223
|
-
F:
|
|
3224
|
-
L:
|
|
3390
|
+
F: __dxlog_file10,
|
|
3391
|
+
L: 210,
|
|
3225
3392
|
S: void 0,
|
|
3226
3393
|
C: (f, a) => f(...a)
|
|
3227
3394
|
});
|
|
@@ -3230,7 +3397,7 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition =
|
|
|
3230
3397
|
}, [
|
|
3231
3398
|
joinService
|
|
3232
3399
|
]);
|
|
3233
|
-
|
|
3400
|
+
useEffect6(() => {
|
|
3234
3401
|
const stateStack = joinState.configuration[0].id.split(".");
|
|
3235
3402
|
const innermostState = stateStack[stateStack.length - 1];
|
|
3236
3403
|
const autoFocusValue = innermostState === "finishingJoining" ? "successSpaceInvitation" : innermostState;
|
|
@@ -3363,6 +3530,18 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition =
|
|
|
3363
3530
|
}, [
|
|
3364
3531
|
joinState
|
|
3365
3532
|
]);
|
|
3533
|
+
useEffect6(() => {
|
|
3534
|
+
switch (activeView) {
|
|
3535
|
+
case "halo invitation accepted":
|
|
3536
|
+
onHaloDone();
|
|
3537
|
+
break;
|
|
3538
|
+
case "space invitation accepted":
|
|
3539
|
+
onSpaceDone();
|
|
3540
|
+
break;
|
|
3541
|
+
}
|
|
3542
|
+
}, [
|
|
3543
|
+
activeView
|
|
3544
|
+
]);
|
|
3366
3545
|
const failed = useMemo4(() => {
|
|
3367
3546
|
const result = /* @__PURE__ */ new Set();
|
|
3368
3547
|
switch (true) {
|
|
@@ -3405,6 +3584,12 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition =
|
|
|
3405
3584
|
}), [
|
|
3406
3585
|
joinState
|
|
3407
3586
|
]);
|
|
3587
|
+
const invitationAuthMethods = useMemo4(() => ({
|
|
3588
|
+
Halo: joinState.context.halo.invitationObservable?.get().authMethod,
|
|
3589
|
+
Space: joinState.context.space.invitationObservable?.get().authMethod
|
|
3590
|
+
}), [
|
|
3591
|
+
joinState
|
|
3592
|
+
]);
|
|
3408
3593
|
const invitationIds = useMemo4(() => ({
|
|
3409
3594
|
Halo: joinState.context.halo.invitationObservable?.get().invitationId,
|
|
3410
3595
|
Space: joinState.context.space.invitationObservable?.get().invitationId
|
|
@@ -3461,6 +3646,7 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition =
|
|
|
3461
3646
|
unredeemedCodes,
|
|
3462
3647
|
invitationIds,
|
|
3463
3648
|
invitationStates,
|
|
3649
|
+
invitationAuthMethods,
|
|
3464
3650
|
succeededKeys,
|
|
3465
3651
|
identity,
|
|
3466
3652
|
onExit,
|
|
@@ -3489,16 +3675,16 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition =
|
|
|
3489
3675
|
|
|
3490
3676
|
// packages/sdk/shell/src/panels/SpacePanel/SpacePanel.tsx
|
|
3491
3677
|
import { Planet } from "@phosphor-icons/react";
|
|
3492
|
-
import React40, { useEffect as
|
|
3678
|
+
import React40, { useEffect as useEffect7, useMemo as useMemo5 } from "react";
|
|
3493
3679
|
import { log as log13 } from "@dxos/log";
|
|
3494
3680
|
import { useInvitationStatus as useInvitationStatus3 } from "@dxos/react-client/invitations";
|
|
3495
|
-
import {
|
|
3681
|
+
import { useId as useId9, useTranslation as useTranslation24 } from "@dxos/react-ui";
|
|
3496
3682
|
|
|
3497
3683
|
// packages/sdk/shell/src/panels/SpacePanel/spaceMachine.ts
|
|
3498
3684
|
import { useMachine as useMachine3 } from "@xstate/react";
|
|
3499
3685
|
import { assign as assign3, createMachine as createMachine3 } from "xstate";
|
|
3500
3686
|
import { log as log11 } from "@dxos/log";
|
|
3501
|
-
var
|
|
3687
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/SpacePanel/spaceMachine.ts";
|
|
3502
3688
|
var spaceMachine = createMachine3({
|
|
3503
3689
|
id: "space",
|
|
3504
3690
|
predictableActionArguments: true,
|
|
@@ -3539,7 +3725,7 @@ var spaceMachine = createMachine3({
|
|
|
3539
3725
|
event,
|
|
3540
3726
|
context
|
|
3541
3727
|
}, {
|
|
3542
|
-
F:
|
|
3728
|
+
F: __dxlog_file11,
|
|
3543
3729
|
L: 53,
|
|
3544
3730
|
S: void 0,
|
|
3545
3731
|
C: (f, a) => f(...a)
|
|
@@ -3558,23 +3744,23 @@ var useSpaceMachine = (options) => {
|
|
|
3558
3744
|
|
|
3559
3745
|
// packages/sdk/shell/src/panels/SpacePanel/steps/SpaceManager.tsx
|
|
3560
3746
|
import { Placeholder as Placeholder2, UserPlus, UsersThree } from "@phosphor-icons/react";
|
|
3561
|
-
import React39, { useCallback as useCallback7, useState as
|
|
3747
|
+
import React39, { useCallback as useCallback7, useState as useState13 } from "react";
|
|
3562
3748
|
import { log as log12 } from "@dxos/log";
|
|
3563
3749
|
import { useConfig } from "@dxos/react-client";
|
|
3564
3750
|
import { useSpaceInvitations as useSpaceInvitations2 } from "@dxos/react-client/echo";
|
|
3565
|
-
import { Invitation as
|
|
3751
|
+
import { Invitation as Invitation8, InvitationEncoder as InvitationEncoder4 } from "@dxos/react-client/invitations";
|
|
3566
3752
|
import { ScrollArea, useTranslation as useTranslation23 } from "@dxos/react-ui";
|
|
3567
|
-
import { descriptionText as
|
|
3568
|
-
var
|
|
3753
|
+
import { descriptionText as descriptionText12, mx as mx24 } from "@dxos/react-ui-theme";
|
|
3754
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/SpacePanel/steps/SpaceManager.tsx";
|
|
3569
3755
|
var activeActionKey = "dxos:react-shell/space-manager/active-action";
|
|
3570
3756
|
var handleInvitationEvent = (invitation, subscription) => {
|
|
3571
3757
|
const invitationCode = InvitationEncoder4.encode(invitation);
|
|
3572
|
-
if (invitation.state ===
|
|
3758
|
+
if (invitation.state === Invitation8.State.CONNECTING) {
|
|
3573
3759
|
log12.info(JSON.stringify({
|
|
3574
3760
|
invitationCode,
|
|
3575
3761
|
authCode: invitation.authCode
|
|
3576
3762
|
}), void 0, {
|
|
3577
|
-
F:
|
|
3763
|
+
F: __dxlog_file12,
|
|
3578
3764
|
L: 40,
|
|
3579
3765
|
S: void 0,
|
|
3580
3766
|
C: (f, a) => f(...a)
|
|
@@ -3594,8 +3780,8 @@ var SpaceManager = (props) => {
|
|
|
3594
3780
|
icon: UserPlus,
|
|
3595
3781
|
onClick: useCallback7(() => {
|
|
3596
3782
|
const invitation = space.share?.({
|
|
3597
|
-
type:
|
|
3598
|
-
authMethod:
|
|
3783
|
+
type: Invitation8.Type.INTERACTIVE,
|
|
3784
|
+
authMethod: Invitation8.AuthMethod.SHARED_SECRET,
|
|
3599
3785
|
multiUse: false,
|
|
3600
3786
|
target
|
|
3601
3787
|
});
|
|
@@ -3612,8 +3798,8 @@ var SpaceManager = (props) => {
|
|
|
3612
3798
|
icon: UsersThree,
|
|
3613
3799
|
onClick: useCallback7(() => {
|
|
3614
3800
|
const invitation = space.share?.({
|
|
3615
|
-
type:
|
|
3616
|
-
authMethod:
|
|
3801
|
+
type: Invitation8.Type.DELEGATED,
|
|
3802
|
+
authMethod: Invitation8.AuthMethod.KNOWN_PUBLIC_KEY,
|
|
3617
3803
|
multiUse: true,
|
|
3618
3804
|
target
|
|
3619
3805
|
});
|
|
@@ -3644,20 +3830,20 @@ var SpaceManagerImpl = (props) => {
|
|
|
3644
3830
|
}
|
|
3645
3831
|
}
|
|
3646
3832
|
};
|
|
3647
|
-
const [activeAction, setInternalActiveAction] =
|
|
3833
|
+
const [activeAction, setInternalActiveAction] = useState13(localStorage.getItem(activeActionKey) ?? "inviteOne");
|
|
3648
3834
|
const setActiveAction = (nextAction) => {
|
|
3649
3835
|
setInternalActiveAction(nextAction);
|
|
3650
3836
|
localStorage.setItem(activeActionKey, nextAction);
|
|
3651
3837
|
};
|
|
3652
3838
|
const visibleInvitations = showInactiveInvitations ? invitations : invitations?.filter((invitation) => ![
|
|
3653
|
-
|
|
3839
|
+
Invitation8.State.CANCELLED
|
|
3654
3840
|
].includes(invitation.get().state));
|
|
3655
3841
|
return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(ScrollArea.Root, {
|
|
3656
3842
|
classNames: "grow shrink basis-28 -mli-2"
|
|
3657
3843
|
}, /* @__PURE__ */ React39.createElement(ScrollArea.Viewport, {
|
|
3658
3844
|
classNames: "is-full pie-2"
|
|
3659
3845
|
}, !!visibleInvitations?.length && /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement("h3", {
|
|
3660
|
-
className: mx24(headingFragment,
|
|
3846
|
+
className: mx24(headingFragment, descriptionText12)
|
|
3661
3847
|
}, t("invitation list heading")), /* @__PURE__ */ React39.createElement(InvitationListComponent, {
|
|
3662
3848
|
className: "mb-2",
|
|
3663
3849
|
send,
|
|
@@ -3665,7 +3851,7 @@ var SpaceManagerImpl = (props) => {
|
|
|
3665
3851
|
onClickRemove: (invitation) => invitation.cancel(),
|
|
3666
3852
|
createInvitationUrl
|
|
3667
3853
|
}), /* @__PURE__ */ React39.createElement("h3", {
|
|
3668
|
-
className: mx24(headingFragment,
|
|
3854
|
+
className: mx24(headingFragment, descriptionText12, "mbs-2")
|
|
3669
3855
|
}, t("space member list heading"))), /* @__PURE__ */ React39.createElement(SpaceMemberListComponent, {
|
|
3670
3856
|
spaceKey: space.key,
|
|
3671
3857
|
includeSelf: true
|
|
@@ -3681,7 +3867,7 @@ var SpaceManagerImpl = (props) => {
|
|
|
3681
3867
|
};
|
|
3682
3868
|
|
|
3683
3869
|
// packages/sdk/shell/src/panels/SpacePanel/SpacePanel.tsx
|
|
3684
|
-
var
|
|
3870
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/SpacePanel/SpacePanel.tsx";
|
|
3685
3871
|
var SpacePanelHeading = ({ titleId, space, onDone }) => {
|
|
3686
3872
|
const { t } = useTranslation24("os");
|
|
3687
3873
|
const name = space.properties.name;
|
|
@@ -3704,9 +3890,7 @@ var SpacePanelHeading = ({ titleId, space, onDone }) => {
|
|
|
3704
3890
|
};
|
|
3705
3891
|
var SpacePanelImpl = (props) => {
|
|
3706
3892
|
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, {
|
|
3893
|
+
return /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(SpacePanelHeading, {
|
|
3710
3894
|
...rest,
|
|
3711
3895
|
titleId,
|
|
3712
3896
|
space
|
|
@@ -3744,10 +3928,10 @@ var SpacePanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => code,
|
|
|
3744
3928
|
space: props.space
|
|
3745
3929
|
}
|
|
3746
3930
|
});
|
|
3747
|
-
|
|
3931
|
+
useEffect7(() => {
|
|
3748
3932
|
const subscription = spaceService.subscribe((state) => {
|
|
3749
3933
|
log13("[state]", state, {
|
|
3750
|
-
F:
|
|
3934
|
+
F: __dxlog_file13,
|
|
3751
3935
|
L: 94,
|
|
3752
3936
|
S: void 0,
|
|
3753
3937
|
C: (f, a) => f(...a)
|
|
@@ -3858,9 +4042,9 @@ import { defaultTx } from "@dxos/react-ui-theme";
|
|
|
3858
4042
|
import { createIFramePort } from "@dxos/rpc-tunnel";
|
|
3859
4043
|
|
|
3860
4044
|
// packages/sdk/shell/src/composites/Shell/Shell.tsx
|
|
3861
|
-
import React46, { useEffect as
|
|
4045
|
+
import React46, { useEffect as useEffect8, useState as useState14 } from "react";
|
|
3862
4046
|
import { log as log14 } from "@dxos/log";
|
|
3863
|
-
import { useClient as
|
|
4047
|
+
import { useClient as useClient9 } from "@dxos/react-client";
|
|
3864
4048
|
import { ShellDisplay, ShellLayout } from "@dxos/react-client";
|
|
3865
4049
|
import { useSpace as useSpace2 } from "@dxos/react-client/echo";
|
|
3866
4050
|
|
|
@@ -3898,22 +4082,22 @@ var StatusDialog = () => {
|
|
|
3898
4082
|
};
|
|
3899
4083
|
|
|
3900
4084
|
// packages/sdk/shell/src/composites/Shell/Shell.tsx
|
|
3901
|
-
var
|
|
4085
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/composites/Shell/Shell.tsx";
|
|
3902
4086
|
var blurActiveElement = () => document.activeElement?.blur?.();
|
|
3903
4087
|
var Shell = ({ runtime }) => {
|
|
3904
|
-
const [{ layout, invitationCode, spaceKey, spaceId, target }, setLayout] =
|
|
4088
|
+
const [{ layout, invitationCode, spaceKey, spaceId, target }, setLayout] = useState14({
|
|
3905
4089
|
layout: runtime.layout,
|
|
3906
4090
|
invitationCode: runtime.invitationCode,
|
|
3907
4091
|
spaceKey: runtime.spaceKey,
|
|
3908
4092
|
spaceId: runtime.spaceId,
|
|
3909
4093
|
target: runtime.target
|
|
3910
4094
|
});
|
|
3911
|
-
const [{ invitationUrl, deviceInvitationParam, spaceInvitationParam }, setInvitationUrl] =
|
|
4095
|
+
const [{ invitationUrl, deviceInvitationParam, spaceInvitationParam }, setInvitationUrl] = useState14({
|
|
3912
4096
|
invitationUrl: runtime.invitationUrl,
|
|
3913
4097
|
deviceInvitationParam: runtime.deviceInvitationParam,
|
|
3914
4098
|
spaceInvitationParam: runtime.spaceInvitationParam
|
|
3915
4099
|
});
|
|
3916
|
-
const client =
|
|
4100
|
+
const client = useClient9();
|
|
3917
4101
|
const space = useSpace2(spaceId ?? spaceKey);
|
|
3918
4102
|
const createDeviceInvitationUrl = (invitationCode2) => {
|
|
3919
4103
|
const baseUrl = new URL(invitationUrl);
|
|
@@ -3925,7 +4109,7 @@ var Shell = ({ runtime }) => {
|
|
|
3925
4109
|
baseUrl.searchParams.set(spaceInvitationParam, invitationCode2);
|
|
3926
4110
|
return baseUrl.toString();
|
|
3927
4111
|
};
|
|
3928
|
-
|
|
4112
|
+
useEffect8(() => {
|
|
3929
4113
|
const unsubscribeLayout = runtime.layoutUpdate.on((request) => setLayout(request));
|
|
3930
4114
|
const unsubscribeInvitationUrl = runtime.invitationUrlUpdate.on((request) => setInvitationUrl(request));
|
|
3931
4115
|
return () => {
|
|
@@ -3935,10 +4119,10 @@ var Shell = ({ runtime }) => {
|
|
|
3935
4119
|
}, [
|
|
3936
4120
|
runtime
|
|
3937
4121
|
]);
|
|
3938
|
-
|
|
4122
|
+
useEffect8(() => {
|
|
3939
4123
|
if (layout === ShellLayout.SPACE && !space) {
|
|
3940
4124
|
log14.warn("No space found for shell space invitations.", void 0, {
|
|
3941
|
-
F:
|
|
4125
|
+
F: __dxlog_file14,
|
|
3942
4126
|
L: 67,
|
|
3943
4127
|
S: void 0,
|
|
3944
4128
|
C: (f, a) => f(...a)
|
|
@@ -3963,16 +4147,17 @@ var Shell = ({ runtime }) => {
|
|
|
3963
4147
|
return /* @__PURE__ */ React46.createElement(StatusDialog, null);
|
|
3964
4148
|
case ShellLayout.INITIALIZE_IDENTITY:
|
|
3965
4149
|
case ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION:
|
|
4150
|
+
case ShellLayout.INITIALIZE_IDENTITY_FROM_RECOVERY:
|
|
3966
4151
|
return /* @__PURE__ */ React46.createElement(JoinDialog, {
|
|
3967
4152
|
mode: "halo-only",
|
|
3968
|
-
initialDisposition: layout === ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION ? "accept-halo-invitation" : "default",
|
|
4153
|
+
initialDisposition: layout === ShellLayout.INITIALIZE_IDENTITY_FROM_RECOVERY ? "recover-identity" : layout === ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION ? "accept-halo-invitation" : "default",
|
|
3969
4154
|
initialInvitationCode: invitationCode,
|
|
3970
4155
|
onCancelResetStorage: () => runtime.setLayout({
|
|
3971
4156
|
layout: ShellLayout.IDENTITY
|
|
3972
4157
|
}),
|
|
3973
|
-
onDone: () => {
|
|
4158
|
+
onDone: async () => {
|
|
3974
4159
|
blurActiveElement();
|
|
3975
|
-
|
|
4160
|
+
await runtime.setAppContext({
|
|
3976
4161
|
display: ShellDisplay.NONE
|
|
3977
4162
|
});
|
|
3978
4163
|
runtime.setLayout({
|
|
@@ -3995,13 +4180,26 @@ var Shell = ({ runtime }) => {
|
|
|
3995
4180
|
reset: true
|
|
3996
4181
|
});
|
|
3997
4182
|
},
|
|
4183
|
+
onRecover: async () => {
|
|
4184
|
+
runtime.setLayout({
|
|
4185
|
+
layout: ShellLayout.STATUS
|
|
4186
|
+
});
|
|
4187
|
+
await client.reset();
|
|
4188
|
+
return runtime.setAppContext({
|
|
4189
|
+
display: ShellDisplay.NONE,
|
|
4190
|
+
reset: true,
|
|
4191
|
+
target: "recoverIdentity"
|
|
4192
|
+
});
|
|
4193
|
+
},
|
|
3998
4194
|
onJoinNewIdentity: async () => {
|
|
3999
4195
|
runtime.setLayout({
|
|
4000
4196
|
layout: ShellLayout.STATUS
|
|
4001
4197
|
});
|
|
4002
4198
|
await client.reset();
|
|
4003
|
-
return runtime.
|
|
4004
|
-
|
|
4199
|
+
return runtime.setAppContext({
|
|
4200
|
+
display: ShellDisplay.NONE,
|
|
4201
|
+
reset: true,
|
|
4202
|
+
target: "deviceInvitation"
|
|
4005
4203
|
});
|
|
4006
4204
|
},
|
|
4007
4205
|
onDone: async () => {
|
|
@@ -4063,10 +4261,10 @@ var Shell = ({ runtime }) => {
|
|
|
4063
4261
|
// packages/sdk/shell/src/composites/Shell/shell-runtime.ts
|
|
4064
4262
|
import { Event } from "@dxos/async";
|
|
4065
4263
|
import { appServiceBundle, shellServiceBundle } from "@dxos/client-protocol";
|
|
4066
|
-
import { invariant as
|
|
4264
|
+
import { invariant as invariant4 } from "@dxos/invariant";
|
|
4067
4265
|
import { ShellLayout as ShellLayout2 } from "@dxos/protocols/proto/dxos/iframe";
|
|
4068
4266
|
import { createProtoRpcPeer } from "@dxos/rpc";
|
|
4069
|
-
var
|
|
4267
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/composites/Shell/shell-runtime.ts";
|
|
4070
4268
|
var ShellRuntimeImpl = class {
|
|
4071
4269
|
constructor(_port) {
|
|
4072
4270
|
this._port = _port;
|
|
@@ -4122,8 +4320,8 @@ var ShellRuntimeImpl = class {
|
|
|
4122
4320
|
});
|
|
4123
4321
|
}
|
|
4124
4322
|
async setAppContext(context) {
|
|
4125
|
-
|
|
4126
|
-
F:
|
|
4323
|
+
invariant4(this._appRpc, "runtime not open", {
|
|
4324
|
+
F: __dxlog_file15,
|
|
4127
4325
|
L: 83,
|
|
4128
4326
|
S: this,
|
|
4129
4327
|
A: [
|
|
@@ -4201,7 +4399,7 @@ var os = {
|
|
|
4201
4399
|
"recover identity input label": "Type or paste your seed phrase",
|
|
4202
4400
|
"failed to create identity message": "Failed to create an identity.",
|
|
4203
4401
|
"failed to recover identity message": "Failed to recover an identity from the provided seed phrase.",
|
|
4204
|
-
"failed to authenticate message": "Incorrect
|
|
4402
|
+
"failed to authenticate message": "Incorrect code.",
|
|
4205
4403
|
"identity added label": "Created identity & added to this device:",
|
|
4206
4404
|
"join space as identity heading": "<part>as </part><part><icon/><label>{{labelValue}}</label></part>",
|
|
4207
4405
|
"error status label": "Failed",
|
|
@@ -4209,8 +4407,8 @@ var os = {
|
|
|
4209
4407
|
"cancelled status label": "Cancelled",
|
|
4210
4408
|
"init status label": "Ready to connect",
|
|
4211
4409
|
"connecting status label": "Connecting\u2026",
|
|
4212
|
-
"connected status label": "Enter
|
|
4213
|
-
"authenticating status label": "Enter
|
|
4410
|
+
"connected status label": "Enter authentication code",
|
|
4411
|
+
"authenticating status label": "Enter authentication code",
|
|
4214
4412
|
"success status label": "Success",
|
|
4215
4413
|
"cancel label": "Cancel",
|
|
4216
4414
|
"done label": "Done",
|
|
@@ -4313,7 +4511,10 @@ var os = {
|
|
|
4313
4511
|
"destroying agent label": "Stopping agent\u2026",
|
|
4314
4512
|
"getting agent label": "Checking agent status\u2026",
|
|
4315
4513
|
"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."
|
|
4514
|
+
"agent requested description": "The agent service is creating an agent for you. Once the agent connects, it will display in the devices list.",
|
|
4515
|
+
"authenticating label": "Authenticating\u2026",
|
|
4516
|
+
"create recovery code label": "Create recovery code",
|
|
4517
|
+
"choose recover identity label": "Recover identity"
|
|
4317
4518
|
};
|
|
4318
4519
|
|
|
4319
4520
|
// packages/sdk/shell/src/translations/index.ts
|
|
@@ -4338,7 +4539,8 @@ var runShell = async (config = new Config()) => {
|
|
|
4338
4539
|
]
|
|
4339
4540
|
}, /* @__PURE__ */ React47.createElement(ClientProvider, {
|
|
4340
4541
|
config,
|
|
4341
|
-
services
|
|
4542
|
+
services,
|
|
4543
|
+
noBanner: true
|
|
4342
4544
|
}, /* @__PURE__ */ React47.createElement(ClipboardProvider, null, /* @__PURE__ */ React47.createElement(Tooltip8.Provider, null, /* @__PURE__ */ React47.createElement(AgentHostingProvider, null, /* @__PURE__ */ React47.createElement(Shell, {
|
|
4343
4545
|
runtime
|
|
4344
4546
|
}))))))));
|
|
@@ -4370,8 +4572,8 @@ var Fallback = ({ onClose }) => {
|
|
|
4370
4572
|
};
|
|
4371
4573
|
|
|
4372
4574
|
// 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
|
|
4575
|
+
import React48, { createContext as createContext2, useCallback as useCallback8, useContext as useContext2, useEffect as useEffect9, useMemo as useMemo6, useState as useState15 } from "react";
|
|
4576
|
+
import { useClient as useClient10, ShellDisplay as ShellDisplay3, ShellLayout as ShellLayout4 } from "@dxos/react-client";
|
|
4375
4577
|
import { useIdentity as useIdentity3 } from "@dxos/react-client/halo";
|
|
4376
4578
|
import { mx as mx25 } from "@dxos/react-ui-theme";
|
|
4377
4579
|
|
|
@@ -4428,7 +4630,7 @@ var MemoryShellRuntime = class {
|
|
|
4428
4630
|
// packages/sdk/shell/src/composites/Shell/ShellContext.tsx
|
|
4429
4631
|
var ShellContext = /* @__PURE__ */ createContext2({});
|
|
4430
4632
|
var useShell = () => {
|
|
4431
|
-
const client =
|
|
4633
|
+
const client = useClient10();
|
|
4432
4634
|
const { runtime, setDisplay } = useContext2(ShellContext);
|
|
4433
4635
|
const setLayout = async (layout, options) => {
|
|
4434
4636
|
if (runtime) {
|
|
@@ -4449,9 +4651,9 @@ var useShell = () => {
|
|
|
4449
4651
|
};
|
|
4450
4652
|
};
|
|
4451
4653
|
var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoinedSpace, children }) => {
|
|
4452
|
-
const client =
|
|
4654
|
+
const client = useClient10();
|
|
4453
4655
|
const identity = useIdentity3();
|
|
4454
|
-
const [display, setDisplay] =
|
|
4656
|
+
const [display, setDisplay] = useState15(!identity || spaceInvitationCode || deviceInvitationCode ? ShellDisplay3.FULLSCREEN : ShellDisplay3.NONE);
|
|
4455
4657
|
const shellRuntime = useMemo6(() => {
|
|
4456
4658
|
if (client.config.get("runtime.app.env.DX_VAULT") !== "false") {
|
|
4457
4659
|
return;
|
|
@@ -4498,7 +4700,7 @@ var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoine
|
|
|
4498
4700
|
space,
|
|
4499
4701
|
shellRuntime
|
|
4500
4702
|
]);
|
|
4501
|
-
|
|
4703
|
+
useEffect9(() => {
|
|
4502
4704
|
if (!shellRuntime) {
|
|
4503
4705
|
return;
|
|
4504
4706
|
}
|
|
@@ -4508,7 +4710,7 @@ var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoine
|
|
|
4508
4710
|
shellRuntime,
|
|
4509
4711
|
handleKeyDown
|
|
4510
4712
|
]);
|
|
4511
|
-
|
|
4713
|
+
useEffect9(() => {
|
|
4512
4714
|
if (!shellRuntime) {
|
|
4513
4715
|
return;
|
|
4514
4716
|
}
|