@dxos/shell 0.3.11-main.008b7c6 → 0.3.11-main.0b0bfb1
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 +36585 -0
- package/dist/bundle/shell.mjs.map +1 -0
- package/dist/bundle/shell.umd.js +210 -0
- package/dist/bundle/shell.umd.js.map +1 -0
- package/dist/bundle/style.css +1 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react.mjs +717 -416
- package/dist/lib/browser/react.mjs.map +4 -4
- package/dist/types/src/components/IdentityList/DeviceList.d.ts.map +1 -1
- package/dist/types/src/components/IdentityList/DeviceList.js +5 -3
- package/dist/types/src/components/IdentityList/DeviceList.js.map +1 -1
- package/dist/types/src/components/Panel/Action.js +1 -1
- package/dist/types/src/components/Panel/Action.js.map +1 -1
- package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -1
- package/dist/types/src/composites/Shell/Shell.js +15 -5
- package/dist/types/src/composites/Shell/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 +19 -6
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts +6 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js +26 -3
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts +10 -7
- 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 +12 -3
- package/dist/types/src/panels/IdentityPanel/identityMachine.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/AgentPanel.d.ts +19 -0
- package/dist/types/src/panels/IdentityPanel/steps/AgentPanel.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/AgentPanel.js +122 -0
- package/dist/types/src/panels/IdentityPanel/steps/AgentPanel.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.d.ts +10 -0
- package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.js +23 -0
- package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +9 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts +0 -1
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js +2 -3
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.d.ts +16 -0
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.js +40 -0
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/index.d.ts +3 -0
- package/dist/types/src/panels/IdentityPanel/steps/index.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/index.js +3 -0
- package/dist/types/src/panels/IdentityPanel/steps/index.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.js +4 -3
- package/dist/types/src/panels/JoinPanel/JoinPanel.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.js +1 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.js.map +1 -1
- package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts.map +1 -1
- package/dist/types/src/panels/SpacePanel/SpacePanel.js +5 -3
- package/dist/types/src/panels/SpacePanel/SpacePanel.js.map +1 -1
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.d.ts.map +1 -1
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.js +2 -2
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.js.map +1 -1
- package/dist/types/src/panels/SpacePanel/SpacePanelProps.d.ts +1 -0
- package/dist/types/src/panels/SpacePanel/SpacePanelProps.d.ts.map +1 -1
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts +1 -0
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts.map +1 -1
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js +3 -1
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js.map +1 -1
- package/dist/types/src/translations/locales/en-US.d.ts +6 -0
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
- package/dist/types/src/translations/locales/en-US.js +7 -1
- package/dist/types/src/translations/locales/en-US.js.map +1 -1
- package/package.json +18 -17
- package/src/components/IdentityList/DeviceList.tsx +7 -5
- package/src/components/Panel/Action.tsx +1 -1
- package/src/composites/Shell/Shell.tsx +16 -3
- package/src/panels/IdentityPanel/IdentityPanel.stories.tsx +44 -2
- package/src/panels/IdentityPanel/IdentityPanel.tsx +30 -7
- package/src/panels/IdentityPanel/IdentityPanelProps.ts +16 -7
- package/src/panels/IdentityPanel/identityMachine.ts +13 -4
- package/src/panels/IdentityPanel/steps/AgentPanel.tsx +165 -0
- package/src/panels/IdentityPanel/steps/DeviceManager.tsx +41 -0
- package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +12 -7
- package/src/panels/IdentityPanel/steps/ProfileForm.tsx +1 -1
- package/src/panels/IdentityPanel/steps/SignOutChooser.tsx +82 -0
- package/src/panels/IdentityPanel/steps/index.ts +3 -0
- package/src/panels/JoinPanel/JoinPanel.tsx +2 -2
- package/src/panels/JoinPanel/joinMachine.ts +1 -1
- package/src/panels/SpacePanel/SpacePanel.stories.tsx +2 -1
- package/src/panels/SpacePanel/SpacePanel.tsx +4 -1
- package/src/panels/SpacePanel/SpacePanelProps.ts +1 -0
- package/src/panels/SpacePanel/steps/SpaceManager.tsx +4 -1
- package/src/translations/locales/en-US.ts +7 -1
|
@@ -182,9 +182,9 @@ var DeviceList = ({ devices, onSelect }) => {
|
|
|
182
182
|
}, devices.map((device) => {
|
|
183
183
|
const identity = {
|
|
184
184
|
identityKey: device.deviceKey,
|
|
185
|
-
profile: {
|
|
185
|
+
profile: device.profile ? {
|
|
186
186
|
displayName: `${device.profile?.platform} (${device.profile?.platformVersion}) on ${device.profile?.os} (${device.profile?.osVersion}) ${device.profile?.architecture ?? "Unknown"}-bit`
|
|
187
|
-
}
|
|
187
|
+
} : void 0
|
|
188
188
|
};
|
|
189
189
|
return /* @__PURE__ */ React5.createElement(IdentityListItem, {
|
|
190
190
|
key: device.deviceKey.toHex(),
|
|
@@ -598,8 +598,8 @@ var Action = /* @__PURE__ */ forwardRef2((props, forwardedRef) => {
|
|
|
598
598
|
classNames: [
|
|
599
599
|
isFull && "is-full",
|
|
600
600
|
"bs-11 flex gap-2 mbs-2",
|
|
601
|
-
|
|
602
|
-
|
|
601
|
+
...buttonColorFragment(props),
|
|
602
|
+
classNames
|
|
603
603
|
],
|
|
604
604
|
ref: forwardedRef,
|
|
605
605
|
variant
|
|
@@ -813,17 +813,17 @@ var SpaceListItem = /* @__PURE__ */ forwardRef7(({ space, onClick }, ref) => {
|
|
|
813
813
|
});
|
|
814
814
|
|
|
815
815
|
// packages/sdk/shell/src/composites/IdentityDialog/IdentityDialog.tsx
|
|
816
|
-
import
|
|
816
|
+
import React40 from "react";
|
|
817
817
|
import { Dialog, useId as useId9 } from "@dxos/react-ui";
|
|
818
818
|
|
|
819
819
|
// packages/sdk/shell/src/panels/IdentityPanel/IdentityPanel.tsx
|
|
820
|
-
import
|
|
820
|
+
import React27, { useEffect as useEffect3, useMemo as useMemo3 } from "react";
|
|
821
821
|
import { generateName as generateName2 } from "@dxos/display-name";
|
|
822
822
|
import { log as log3 } from "@dxos/log";
|
|
823
|
-
import { useClient as
|
|
824
|
-
import { useIdentity } from "@dxos/react-client/halo";
|
|
823
|
+
import { useClient as useClient4 } from "@dxos/react-client";
|
|
824
|
+
import { useIdentity, useDevices } from "@dxos/react-client/halo";
|
|
825
825
|
import { useInvitationStatus as useInvitationStatus2 } from "@dxos/react-client/invitations";
|
|
826
|
-
import { Avatar as Avatar4, DensityProvider as DensityProvider2, useId as useId5, useJdenticonHref as useJdenticonHref3, useTranslation as
|
|
826
|
+
import { Avatar as Avatar4, DensityProvider as DensityProvider2, useId as useId5, useJdenticonHref as useJdenticonHref3, useTranslation as useTranslation13 } from "@dxos/react-ui";
|
|
827
827
|
|
|
828
828
|
// packages/sdk/shell/src/panels/IdentityPanel/identityMachine.ts
|
|
829
829
|
import { useMachine } from "@xstate/react";
|
|
@@ -844,6 +844,14 @@ var identityMachine = createMachine({
|
|
|
844
844
|
states: {
|
|
845
845
|
choosingAction: {},
|
|
846
846
|
managingDeviceInvitation: {},
|
|
847
|
+
managingAgent: {
|
|
848
|
+
initial: "idle",
|
|
849
|
+
states: {
|
|
850
|
+
idle: {},
|
|
851
|
+
pending: {}
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
managingDevices: {},
|
|
847
855
|
managingProfile: {
|
|
848
856
|
initial: "idle",
|
|
849
857
|
states: {
|
|
@@ -863,7 +871,8 @@ var identityMachine = createMachine({
|
|
|
863
871
|
actions: "log"
|
|
864
872
|
}
|
|
865
873
|
}
|
|
866
|
-
}
|
|
874
|
+
},
|
|
875
|
+
signingOut: {}
|
|
867
876
|
},
|
|
868
877
|
on: {
|
|
869
878
|
unchooseAction: {
|
|
@@ -873,13 +882,6 @@ var identityMachine = createMachine({
|
|
|
873
882
|
"log"
|
|
874
883
|
]
|
|
875
884
|
},
|
|
876
|
-
chooseDevices: {
|
|
877
|
-
target: ".managingDeviceInvitation",
|
|
878
|
-
actions: [
|
|
879
|
-
"unsetInvitation",
|
|
880
|
-
"log"
|
|
881
|
-
]
|
|
882
|
-
},
|
|
883
885
|
deselectInvitation: {
|
|
884
886
|
target: ".choosingAction",
|
|
885
887
|
actions: [
|
|
@@ -894,9 +896,21 @@ var identityMachine = createMachine({
|
|
|
894
896
|
"log"
|
|
895
897
|
]
|
|
896
898
|
},
|
|
899
|
+
chooseDevices: {
|
|
900
|
+
target: ".managingDevices",
|
|
901
|
+
actions: "log"
|
|
902
|
+
},
|
|
897
903
|
chooseProfile: {
|
|
898
904
|
target: ".managingProfile",
|
|
899
905
|
actions: "log"
|
|
906
|
+
},
|
|
907
|
+
chooseSignOut: {
|
|
908
|
+
target: ".signingOut",
|
|
909
|
+
actions: "log"
|
|
910
|
+
},
|
|
911
|
+
chooseAgent: {
|
|
912
|
+
target: ".managingAgent",
|
|
913
|
+
actions: "log"
|
|
900
914
|
}
|
|
901
915
|
}
|
|
902
916
|
}, {
|
|
@@ -916,7 +930,7 @@ var identityMachine = createMachine({
|
|
|
916
930
|
context
|
|
917
931
|
}, {
|
|
918
932
|
F: __dxlog_file,
|
|
919
|
-
L:
|
|
933
|
+
L: 104,
|
|
920
934
|
S: void 0,
|
|
921
935
|
C: (f, a) => f(...a)
|
|
922
936
|
});
|
|
@@ -937,33 +951,183 @@ var useIdentityMachine = (client, options) => {
|
|
|
937
951
|
});
|
|
938
952
|
};
|
|
939
953
|
|
|
940
|
-
// packages/sdk/shell/src/panels/IdentityPanel/steps/
|
|
941
|
-
import {
|
|
942
|
-
import
|
|
943
|
-
import { useClient as useClient2 } from "@dxos/react-client";
|
|
954
|
+
// packages/sdk/shell/src/panels/IdentityPanel/steps/AgentPanel.tsx
|
|
955
|
+
import React21, { useState as useState3, useCallback as useCallback4, useEffect as useEffect2 } from "react";
|
|
956
|
+
import { invariant } from "@dxos/invariant";
|
|
957
|
+
import { useClient as useClient2, useAgentHostingProviderClient } from "@dxos/react-client";
|
|
944
958
|
import { useHaloInvitations } from "@dxos/react-client/halo";
|
|
945
959
|
import { Invitation as Invitation3, InvitationEncoder } from "@dxos/react-client/invitations";
|
|
946
|
-
import {
|
|
947
|
-
|
|
948
|
-
var
|
|
949
|
-
const {
|
|
960
|
+
import { useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
961
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/IdentityPanel/steps/AgentPanel.tsx";
|
|
962
|
+
var AgentForm = (props) => {
|
|
963
|
+
const { identity } = props;
|
|
964
|
+
const [validationMessage, setValidationMessage] = useState3("");
|
|
965
|
+
const [agentStatus, setAgentStatus] = useState3("");
|
|
966
|
+
const [agentActive, setAgentActive] = useState3(false);
|
|
950
967
|
const client = useClient2();
|
|
951
968
|
const invitations = useHaloInvitations();
|
|
952
|
-
const
|
|
969
|
+
const agentHostingProviderClient = useAgentHostingProviderClient(client.config);
|
|
970
|
+
useEffect2(() => {
|
|
971
|
+
const fetchAgentStatus = async () => {
|
|
972
|
+
if (agentHostingProviderClient) {
|
|
973
|
+
const agentStatus2 = await agentHostingProviderClient?.getAgent(identity?.identityKey.truncate() ?? "foo");
|
|
974
|
+
if (agentStatus2) {
|
|
975
|
+
setAgentActive(true);
|
|
976
|
+
setAgentStatus(agentStatus2);
|
|
977
|
+
} else {
|
|
978
|
+
setAgentActive(false);
|
|
979
|
+
setValidationMessage("No agent deployed via provider.");
|
|
980
|
+
}
|
|
981
|
+
} else {
|
|
982
|
+
setValidationMessage("No agent provider configured.");
|
|
983
|
+
}
|
|
984
|
+
};
|
|
985
|
+
void fetchAgentStatus();
|
|
986
|
+
}, []);
|
|
987
|
+
const onAgentCreateEvent = useCallback4(async (invitation) => {
|
|
953
988
|
const invitationCode = InvitationEncoder.encode(invitation);
|
|
954
989
|
if (invitation.state === Invitation3.State.CONNECTING) {
|
|
955
990
|
console.log(JSON.stringify({
|
|
956
991
|
invitationCode,
|
|
957
992
|
authCode: invitation.authCode
|
|
958
993
|
}));
|
|
994
|
+
invariant(identity, "Identity not found", {
|
|
995
|
+
F: __dxlog_file2,
|
|
996
|
+
L: 65,
|
|
997
|
+
S: void 0,
|
|
998
|
+
A: [
|
|
999
|
+
"identity",
|
|
1000
|
+
"'Identity not found'"
|
|
1001
|
+
]
|
|
1002
|
+
});
|
|
1003
|
+
if (agentHostingProviderClient) {
|
|
1004
|
+
try {
|
|
1005
|
+
const res = await agentHostingProviderClient?.createAgent(invitationCode, identity.identityKey.truncate());
|
|
1006
|
+
setAgentStatus(res);
|
|
1007
|
+
setAgentActive(true);
|
|
1008
|
+
setValidationMessage("");
|
|
1009
|
+
} catch (err) {
|
|
1010
|
+
setValidationMessage(`error creating agent: ${err.message}`);
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
}, []);
|
|
1015
|
+
const handleAgentCreate = async () => {
|
|
1016
|
+
invitations.forEach((invitation2) => invitation2.cancel());
|
|
1017
|
+
const invitation = client.halo.share({
|
|
1018
|
+
type: Invitation3.Type.MULTIUSE,
|
|
1019
|
+
authMethod: Invitation3.AuthMethod.NONE
|
|
1020
|
+
});
|
|
1021
|
+
invitation.subscribe(onAgentCreateEvent);
|
|
1022
|
+
};
|
|
1023
|
+
const handleAgentDestroy = async () => {
|
|
1024
|
+
const identity2 = client.halo.identity.get();
|
|
1025
|
+
invariant(identity2, "Identity not found", {
|
|
1026
|
+
F: __dxlog_file2,
|
|
1027
|
+
L: 91,
|
|
1028
|
+
S: void 0,
|
|
1029
|
+
A: [
|
|
1030
|
+
"identity",
|
|
1031
|
+
"'Identity not found'"
|
|
1032
|
+
]
|
|
1033
|
+
});
|
|
1034
|
+
try {
|
|
1035
|
+
await agentHostingProviderClient?.destroyAgent(identity2.identityKey.truncate());
|
|
1036
|
+
setValidationMessage("No agent deployed via provider.");
|
|
1037
|
+
setAgentStatus("");
|
|
1038
|
+
setAgentActive(false);
|
|
1039
|
+
} catch (err) {
|
|
1040
|
+
setValidationMessage(`error destroying agent: ${err.message}`);
|
|
1041
|
+
}
|
|
1042
|
+
};
|
|
1043
|
+
return /* @__PURE__ */ React21.createElement(AgentFormImpl, {
|
|
1044
|
+
...props,
|
|
1045
|
+
onAgentCreate: handleAgentCreate,
|
|
1046
|
+
onAgentDestroy: handleAgentDestroy,
|
|
1047
|
+
validationMessage,
|
|
1048
|
+
agentStatus,
|
|
1049
|
+
agentActive,
|
|
1050
|
+
agentProviderDisabled: !agentHostingProviderClient
|
|
1051
|
+
});
|
|
1052
|
+
};
|
|
1053
|
+
var AgentFormImpl = (props) => {
|
|
1054
|
+
const { active, onAgentCreate, onAgentDestroy, send, validationMessage, agentStatus, agentActive, agentProviderDisabled } = props;
|
|
1055
|
+
const disabled = !active;
|
|
1056
|
+
const { t } = useTranslation7("os");
|
|
1057
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement("div", {
|
|
1058
|
+
role: "none",
|
|
1059
|
+
className: "grow flex flex-col justify-center"
|
|
1060
|
+
}, /* @__PURE__ */ React21.createElement(Input, {
|
|
1061
|
+
validationMessage,
|
|
1062
|
+
label: /* @__PURE__ */ React21.createElement(StepHeading, null, "Agent Status"),
|
|
1063
|
+
disabled,
|
|
1064
|
+
"data-testid": "agent-status",
|
|
1065
|
+
value: agentStatus
|
|
1066
|
+
})), /* @__PURE__ */ React21.createElement(Actions, null, /* @__PURE__ */ React21.createElement(Action, {
|
|
1067
|
+
disabled: agentActive || agentProviderDisabled,
|
|
1068
|
+
onClick: () => onAgentCreate?.(),
|
|
1069
|
+
"data-testid": "create-agent"
|
|
1070
|
+
}, "Create Agent"), /* @__PURE__ */ React21.createElement(Action, {
|
|
1071
|
+
disabled: !agentActive || agentProviderDisabled,
|
|
1072
|
+
onClick: () => onAgentDestroy?.(),
|
|
1073
|
+
"data-testid": "destroy-agent"
|
|
1074
|
+
}, "Destroy Agent"), /* @__PURE__ */ React21.createElement(Action, {
|
|
1075
|
+
disabled,
|
|
1076
|
+
onClick: () => send?.({
|
|
1077
|
+
type: "unchooseAction"
|
|
1078
|
+
}),
|
|
1079
|
+
"data-testid": "update-profile-form-back"
|
|
1080
|
+
}, t("back label"))));
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
// packages/sdk/shell/src/panels/IdentityPanel/steps/DeviceManager.tsx
|
|
1084
|
+
import React22 from "react";
|
|
1085
|
+
import { useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
1086
|
+
var DeviceManager = ({ devices, active, send }) => {
|
|
1087
|
+
const { t } = useTranslation8("os");
|
|
1088
|
+
const disabled = !active;
|
|
1089
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement("div", {
|
|
1090
|
+
role: "none",
|
|
1091
|
+
className: "grow"
|
|
1092
|
+
}, /* @__PURE__ */ React22.createElement(DeviceList, {
|
|
1093
|
+
devices
|
|
1094
|
+
})), /* @__PURE__ */ React22.createElement(Actions, null, /* @__PURE__ */ React22.createElement(Action, {
|
|
1095
|
+
variant: "ghost",
|
|
1096
|
+
disabled,
|
|
1097
|
+
onClick: () => send?.({
|
|
1098
|
+
type: "unchooseAction"
|
|
1099
|
+
}),
|
|
1100
|
+
"data-testid": "manage-devices-back"
|
|
1101
|
+
}, t("back label"))));
|
|
1102
|
+
};
|
|
1103
|
+
|
|
1104
|
+
// packages/sdk/shell/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx
|
|
1105
|
+
import { CaretRight, Devices, Plus, Power, UserGear, HardDrive } from "@phosphor-icons/react";
|
|
1106
|
+
import React23, { useCallback as useCallback5 } from "react";
|
|
1107
|
+
import { useClient as useClient3 } from "@dxos/react-client";
|
|
1108
|
+
import { useHaloInvitations as useHaloInvitations2 } from "@dxos/react-client/halo";
|
|
1109
|
+
import { Invitation as Invitation4, InvitationEncoder as InvitationEncoder2 } from "@dxos/react-client/invitations";
|
|
1110
|
+
import { DensityProvider, useTranslation as useTranslation9 } from "@dxos/react-ui";
|
|
1111
|
+
import { getSize as getSize6 } from "@dxos/react-ui-theme";
|
|
1112
|
+
var IdentityActionChooser = (props) => {
|
|
1113
|
+
const { send } = props;
|
|
1114
|
+
const client = useClient3();
|
|
1115
|
+
const invitations = useHaloInvitations2();
|
|
1116
|
+
const onInvitationEvent = useCallback5((invitation) => {
|
|
1117
|
+
const invitationCode = InvitationEncoder2.encode(invitation);
|
|
1118
|
+
if (invitation.state === Invitation4.State.CONNECTING) {
|
|
1119
|
+
console.log(JSON.stringify({
|
|
1120
|
+
invitationCode,
|
|
1121
|
+
authCode: invitation.authCode
|
|
1122
|
+
}));
|
|
959
1123
|
}
|
|
960
1124
|
}, []);
|
|
961
1125
|
const createInvitation = (e) => {
|
|
962
1126
|
const testing = e.altKey && e.shiftKey;
|
|
963
1127
|
invitations.forEach((invitation2) => invitation2.cancel());
|
|
964
1128
|
const invitation = client.halo.share(testing ? {
|
|
965
|
-
type:
|
|
966
|
-
authMethod:
|
|
1129
|
+
type: Invitation4.Type.MULTIUSE,
|
|
1130
|
+
authMethod: Invitation4.AuthMethod.NONE
|
|
967
1131
|
} : void 0);
|
|
968
1132
|
if (true) {
|
|
969
1133
|
invitation.subscribe(onInvitationEvent);
|
|
@@ -973,74 +1137,100 @@ var IdentityActionChooser = (props) => {
|
|
|
973
1137
|
invitation
|
|
974
1138
|
});
|
|
975
1139
|
};
|
|
976
|
-
return /* @__PURE__ */
|
|
1140
|
+
return /* @__PURE__ */ React23.createElement(IdentityActionChooserImpl, {
|
|
977
1141
|
...props,
|
|
978
1142
|
onCreateInvitationClick: (e) => createInvitation(e)
|
|
979
1143
|
});
|
|
980
1144
|
};
|
|
981
1145
|
var IdentityActionChooserImpl = ({ onCreateInvitationClick, active, send, onDone, doneActionParent }) => {
|
|
982
|
-
const { t } =
|
|
983
|
-
return /* @__PURE__ */
|
|
1146
|
+
const { t } = useTranslation9("os");
|
|
1147
|
+
return /* @__PURE__ */ React23.createElement("div", {
|
|
984
1148
|
role: "none",
|
|
985
1149
|
className: "grow flex flex-col gap-1"
|
|
986
|
-
}, /* @__PURE__ */
|
|
1150
|
+
}, /* @__PURE__ */ React23.createElement(DensityProvider, {
|
|
987
1151
|
density: "coarse"
|
|
988
|
-
}, /* @__PURE__ */
|
|
1152
|
+
}, /* @__PURE__ */ React23.createElement("div", {
|
|
989
1153
|
className: "grow justify-center flex flex-col gap-1"
|
|
990
|
-
}, /* @__PURE__ */
|
|
1154
|
+
}, /* @__PURE__ */ React23.createElement(Action, {
|
|
1155
|
+
"data-testid": "manage-agent",
|
|
1156
|
+
onClick: () => send?.({
|
|
1157
|
+
type: "chooseAgent"
|
|
1158
|
+
}),
|
|
1159
|
+
classNames: "plb-4"
|
|
1160
|
+
}, /* @__PURE__ */ React23.createElement(HardDrive, {
|
|
1161
|
+
className: getSize6(6)
|
|
1162
|
+
}), /* @__PURE__ */ React23.createElement("span", {
|
|
1163
|
+
className: "grow mli-3"
|
|
1164
|
+
}, "Manage Agent"), /* @__PURE__ */ React23.createElement(CaretRight, {
|
|
1165
|
+
weight: "bold",
|
|
1166
|
+
className: getSize6(4)
|
|
1167
|
+
})), /* @__PURE__ */ React23.createElement(Action, {
|
|
991
1168
|
disabled: !active,
|
|
992
1169
|
"data-testid": "devices-panel.create-invitation",
|
|
993
1170
|
onClick: onCreateInvitationClick,
|
|
994
1171
|
classNames: "plb-4"
|
|
995
|
-
}, /* @__PURE__ */
|
|
1172
|
+
}, /* @__PURE__ */ React23.createElement(Plus, {
|
|
1173
|
+
className: getSize6(6)
|
|
1174
|
+
}), /* @__PURE__ */ React23.createElement("span", {
|
|
1175
|
+
className: "grow mli-3"
|
|
1176
|
+
}, t("choose add device label")), /* @__PURE__ */ React23.createElement(CaretRight, {
|
|
1177
|
+
weight: "bold",
|
|
1178
|
+
className: getSize6(4)
|
|
1179
|
+
})), /* @__PURE__ */ React23.createElement(Action, {
|
|
1180
|
+
"data-testid": "manage-devices",
|
|
1181
|
+
onClick: () => send?.({
|
|
1182
|
+
type: "chooseDevices"
|
|
1183
|
+
}),
|
|
1184
|
+
classNames: "plb-4"
|
|
1185
|
+
}, /* @__PURE__ */ React23.createElement(Devices, {
|
|
996
1186
|
className: getSize6(6)
|
|
997
|
-
}), /* @__PURE__ */
|
|
1187
|
+
}), /* @__PURE__ */ React23.createElement("span", {
|
|
998
1188
|
className: "grow mli-3"
|
|
999
|
-
}, t("choose devices label")), /* @__PURE__ */
|
|
1189
|
+
}, t("choose devices label")), /* @__PURE__ */ React23.createElement(CaretRight, {
|
|
1000
1190
|
weight: "bold",
|
|
1001
1191
|
className: getSize6(4)
|
|
1002
|
-
})), /* @__PURE__ */
|
|
1192
|
+
})), /* @__PURE__ */ React23.createElement(Action, {
|
|
1003
1193
|
"data-testid": "manage-profile",
|
|
1004
1194
|
onClick: () => send?.({
|
|
1005
1195
|
type: "chooseProfile"
|
|
1006
1196
|
}),
|
|
1007
1197
|
classNames: "plb-4"
|
|
1008
|
-
}, /* @__PURE__ */
|
|
1198
|
+
}, /* @__PURE__ */ React23.createElement(UserGear, {
|
|
1009
1199
|
className: getSize6(6)
|
|
1010
|
-
}), /* @__PURE__ */
|
|
1200
|
+
}), /* @__PURE__ */ React23.createElement("span", {
|
|
1011
1201
|
className: "grow mli-3"
|
|
1012
|
-
}, t("choose profile label")), /* @__PURE__ */
|
|
1202
|
+
}, t("choose profile label")), /* @__PURE__ */ React23.createElement(CaretRight, {
|
|
1013
1203
|
weight: "bold",
|
|
1014
1204
|
className: getSize6(4)
|
|
1015
|
-
})), /* @__PURE__ */
|
|
1016
|
-
disabled: true,
|
|
1205
|
+
})), /* @__PURE__ */ React23.createElement(Action, {
|
|
1017
1206
|
"data-testid": "sign-out",
|
|
1018
|
-
onClick: () => {
|
|
1019
|
-
|
|
1207
|
+
onClick: () => send?.({
|
|
1208
|
+
type: "chooseSignOut"
|
|
1209
|
+
}),
|
|
1020
1210
|
classNames: "plb-4"
|
|
1021
|
-
}, /* @__PURE__ */
|
|
1211
|
+
}, /* @__PURE__ */ React23.createElement(Power, {
|
|
1022
1212
|
className: getSize6(6)
|
|
1023
|
-
}), /* @__PURE__ */
|
|
1213
|
+
}), /* @__PURE__ */ React23.createElement("span", {
|
|
1024
1214
|
className: "grow mli-3"
|
|
1025
|
-
}, t("choose sign out label")), /* @__PURE__ */
|
|
1215
|
+
}, t("choose sign out label")), /* @__PURE__ */ React23.createElement(CaretRight, {
|
|
1026
1216
|
weight: "bold",
|
|
1027
1217
|
className: getSize6(4)
|
|
1028
1218
|
})))));
|
|
1029
1219
|
};
|
|
1030
1220
|
|
|
1031
1221
|
// packages/sdk/shell/src/panels/IdentityPanel/steps/ProfileForm.tsx
|
|
1032
|
-
import
|
|
1222
|
+
import React24, { useState as useState4 } from "react";
|
|
1033
1223
|
import { log as log2 } from "@dxos/log";
|
|
1034
|
-
import { useTranslation as
|
|
1035
|
-
var
|
|
1224
|
+
import { useTranslation as useTranslation10 } from "@dxos/react-ui";
|
|
1225
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/IdentityPanel/steps/ProfileForm.tsx";
|
|
1036
1226
|
var ProfileForm = (props) => {
|
|
1037
1227
|
const { onUpdateProfile } = props;
|
|
1038
|
-
const { t } =
|
|
1039
|
-
const [validationMessage, setValidationMessage] =
|
|
1228
|
+
const { t } = useTranslation10("os");
|
|
1229
|
+
const [validationMessage, setValidationMessage] = useState4("");
|
|
1040
1230
|
const handleUpdateProfile = async (profile) => {
|
|
1041
1231
|
await onUpdateProfile?.(profile).catch((error) => {
|
|
1042
1232
|
log2.catch(error, void 0, {
|
|
1043
|
-
F:
|
|
1233
|
+
F: __dxlog_file3,
|
|
1044
1234
|
L: 32,
|
|
1045
1235
|
S: void 0,
|
|
1046
1236
|
C: (f, a) => f(...a)
|
|
@@ -1048,7 +1238,7 @@ var ProfileForm = (props) => {
|
|
|
1048
1238
|
setValidationMessage(t("failed to update profile message"));
|
|
1049
1239
|
});
|
|
1050
1240
|
};
|
|
1051
|
-
return /* @__PURE__ */
|
|
1241
|
+
return /* @__PURE__ */ React24.createElement(ProfileFormImpl, {
|
|
1052
1242
|
...props,
|
|
1053
1243
|
onUpdateProfile: handleUpdateProfile,
|
|
1054
1244
|
validationMessage
|
|
@@ -1057,14 +1247,14 @@ var ProfileForm = (props) => {
|
|
|
1057
1247
|
var ProfileFormImpl = (props) => {
|
|
1058
1248
|
const { active, profile, send, onUpdateProfile, validationMessage } = props;
|
|
1059
1249
|
const disabled = !active;
|
|
1060
|
-
const { t } =
|
|
1061
|
-
const [inputValue, setInputValue] =
|
|
1062
|
-
return /* @__PURE__ */
|
|
1250
|
+
const { t } = useTranslation10("os");
|
|
1251
|
+
const [inputValue, setInputValue] = useState4(profile?.displayName ?? "");
|
|
1252
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement("div", {
|
|
1063
1253
|
role: "none",
|
|
1064
1254
|
className: "grow flex flex-col justify-center"
|
|
1065
|
-
}, /* @__PURE__ */
|
|
1255
|
+
}, /* @__PURE__ */ React24.createElement(Input, {
|
|
1066
1256
|
validationMessage,
|
|
1067
|
-
label: /* @__PURE__ */
|
|
1257
|
+
label: /* @__PURE__ */ React24.createElement(StepHeading, null, t("display name input label")),
|
|
1068
1258
|
disabled,
|
|
1069
1259
|
"data-testid": "display-name-input",
|
|
1070
1260
|
placeholder: t("display name input placeholder"),
|
|
@@ -1073,14 +1263,14 @@ var ProfileFormImpl = (props) => {
|
|
|
1073
1263
|
onKeyDown: ({ key }) => key === "Enter" && onUpdateProfile?.({
|
|
1074
1264
|
displayName: inputValue
|
|
1075
1265
|
})
|
|
1076
|
-
})), /* @__PURE__ */
|
|
1266
|
+
})), /* @__PURE__ */ React24.createElement(Actions, null, /* @__PURE__ */ React24.createElement(Action, {
|
|
1077
1267
|
variant: "ghost",
|
|
1078
1268
|
disabled,
|
|
1079
1269
|
onClick: () => send?.({
|
|
1080
1270
|
type: "unchooseAction"
|
|
1081
1271
|
}),
|
|
1082
1272
|
"data-testid": "update-profile-form-back"
|
|
1083
|
-
}, t("back label")), /* @__PURE__ */
|
|
1273
|
+
}, t("back label")), /* @__PURE__ */ React24.createElement(Action, {
|
|
1084
1274
|
variant: "primary",
|
|
1085
1275
|
disabled,
|
|
1086
1276
|
onClick: () => onUpdateProfile?.({
|
|
@@ -1090,23 +1280,69 @@ var ProfileFormImpl = (props) => {
|
|
|
1090
1280
|
}, t("done label"))));
|
|
1091
1281
|
};
|
|
1092
1282
|
|
|
1283
|
+
// packages/sdk/shell/src/panels/IdentityPanel/steps/SignOutChooser.tsx
|
|
1284
|
+
import { Warning } from "@phosphor-icons/react";
|
|
1285
|
+
import React25 from "react";
|
|
1286
|
+
import { Message, useTranslation as useTranslation11 } from "@dxos/react-ui";
|
|
1287
|
+
import { getSize as getSize7, mx as mx18 } from "@dxos/react-ui-theme";
|
|
1288
|
+
var SignOutChooser = (props) => {
|
|
1289
|
+
const { t } = useTranslation11("os");
|
|
1290
|
+
const onResetDevice = () => {
|
|
1291
|
+
if (window.confirm(t("reset device confirm message"))) {
|
|
1292
|
+
void props.onResetDevice?.();
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
return /* @__PURE__ */ React25.createElement(SignOutChooserImpl, {
|
|
1296
|
+
disabled: !props.active,
|
|
1297
|
+
onBack: () => props.send?.({
|
|
1298
|
+
type: "unchooseAction"
|
|
1299
|
+
}),
|
|
1300
|
+
onResetDevice,
|
|
1301
|
+
onJoinNewIdentity: props.onJoinNewIdentity
|
|
1302
|
+
});
|
|
1303
|
+
};
|
|
1304
|
+
var SignOutChooserImpl = ({ disabled, onResetDevice, onJoinNewIdentity, onBack }) => {
|
|
1305
|
+
const { t } = useTranslation11("os");
|
|
1306
|
+
return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement("div", {
|
|
1307
|
+
role: "none",
|
|
1308
|
+
className: "grow flex flex-col justify-center"
|
|
1309
|
+
}, /* @__PURE__ */ React25.createElement(Message.Root, {
|
|
1310
|
+
valence: "error"
|
|
1311
|
+
}, /* @__PURE__ */ React25.createElement(Message.Title, null, /* @__PURE__ */ React25.createElement(Warning, {
|
|
1312
|
+
className: mx18(getSize7(6), "inline mie-2")
|
|
1313
|
+
}), t("sign out chooser title")), /* @__PURE__ */ React25.createElement(Message.Body, null, t("sign out chooser message")))), /* @__PURE__ */ React25.createElement(Actions, null, /* @__PURE__ */ React25.createElement(Action, {
|
|
1314
|
+
disabled,
|
|
1315
|
+
onClick: onBack
|
|
1316
|
+
}, t("back label")), /* @__PURE__ */ React25.createElement(Action, {
|
|
1317
|
+
variant: "primary",
|
|
1318
|
+
classNames: "!bg-error-500 hover:!bg-error-550",
|
|
1319
|
+
disabled,
|
|
1320
|
+
onClick: onJoinNewIdentity
|
|
1321
|
+
}, t("join new identity label")), /* @__PURE__ */ React25.createElement(Action, {
|
|
1322
|
+
variant: "primary",
|
|
1323
|
+
classNames: "!bg-error-500 hover:!bg-error-550",
|
|
1324
|
+
disabled,
|
|
1325
|
+
onClick: onResetDevice
|
|
1326
|
+
}, t("reset device label"))));
|
|
1327
|
+
};
|
|
1328
|
+
|
|
1093
1329
|
// packages/sdk/shell/src/steps/InvitationManager.tsx
|
|
1094
1330
|
import { Check as Check3, X as X3 } from "@phosphor-icons/react";
|
|
1095
|
-
import
|
|
1331
|
+
import React26, { useMemo as useMemo2 } from "react";
|
|
1096
1332
|
import { QR } from "react-qr-rounded";
|
|
1097
|
-
import { Invitation as
|
|
1098
|
-
import { useId as useId4, useTranslation as
|
|
1099
|
-
import { descriptionText as descriptionText7, getSize as
|
|
1333
|
+
import { Invitation as Invitation5 } from "@dxos/react-client/invitations";
|
|
1334
|
+
import { useId as useId4, useTranslation as useTranslation12 } from "@dxos/react-ui";
|
|
1335
|
+
import { descriptionText as descriptionText7, getSize as getSize8, mx as mx19 } from "@dxos/react-ui-theme";
|
|
1100
1336
|
var InvitationManagerView = ({ children, ...props }) => {
|
|
1101
|
-
return /* @__PURE__ */
|
|
1337
|
+
return /* @__PURE__ */ React26.createElement(Viewport.View, {
|
|
1102
1338
|
...props,
|
|
1103
1339
|
classNames: "grow flex flex-col justify-around items-center"
|
|
1104
1340
|
}, children);
|
|
1105
1341
|
};
|
|
1106
1342
|
var InvitationManager = ({ invitationUrl, active, send, status, type, authCode, id }) => {
|
|
1107
|
-
const { t } =
|
|
1343
|
+
const { t } = useTranslation12("os");
|
|
1108
1344
|
const qrLabel = useId4("invitation-manager__qr-code");
|
|
1109
|
-
const statusValue = type ===
|
|
1345
|
+
const statusValue = type === Invitation5.Type.MULTIUSE ? 0 : invitationStatusValue.get(status) ?? 0;
|
|
1110
1346
|
const showAuthCode = statusValue === 3;
|
|
1111
1347
|
const emoji2 = toEmoji(id ?? "");
|
|
1112
1348
|
const activeView = useMemo2(() => {
|
|
@@ -1122,50 +1358,50 @@ var InvitationManager = ({ invitationUrl, active, send, status, type, authCode,
|
|
|
1122
1358
|
}, [
|
|
1123
1359
|
statusValue
|
|
1124
1360
|
]);
|
|
1125
|
-
return /* @__PURE__ */
|
|
1361
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(Viewport.Root, {
|
|
1126
1362
|
activeView,
|
|
1127
1363
|
classNames: "grow plb-1"
|
|
1128
|
-
}, /* @__PURE__ */
|
|
1364
|
+
}, /* @__PURE__ */ React26.createElement(Viewport.Views, null, /* @__PURE__ */ React26.createElement(InvitationManagerView, {
|
|
1129
1365
|
id: "showing qr",
|
|
1130
1366
|
emoji: emoji2
|
|
1131
|
-
}, /* @__PURE__ */
|
|
1367
|
+
}, /* @__PURE__ */ React26.createElement("p", {
|
|
1132
1368
|
className: "text-sm mlb-1 font-normal text-center"
|
|
1133
|
-
}, t(type ===
|
|
1369
|
+
}, t(type === Invitation5.Type.MULTIUSE ? "invite many qr label" : "invite one qr label")), /* @__PURE__ */ React26.createElement("div", {
|
|
1134
1370
|
role: "none",
|
|
1135
|
-
className:
|
|
1136
|
-
}, /* @__PURE__ */
|
|
1371
|
+
className: mx19(descriptionText7, "is-full max-is-[14rem] relative")
|
|
1372
|
+
}, /* @__PURE__ */ React26.createElement(QR, {
|
|
1137
1373
|
rounding: 100,
|
|
1138
1374
|
backgroundColor: "transparent",
|
|
1139
1375
|
color: "currentColor",
|
|
1140
|
-
className:
|
|
1376
|
+
className: mx19("is-full bs-full p-2", showAuthCode && "invisible"),
|
|
1141
1377
|
"aria-labelledby": qrLabel,
|
|
1142
1378
|
errorCorrectionLevel: "Q",
|
|
1143
1379
|
cutout: true
|
|
1144
|
-
}, invitationUrl ?? "never"), /* @__PURE__ */
|
|
1380
|
+
}, invitationUrl ?? "never"), /* @__PURE__ */ React26.createElement(Centered, null, /* @__PURE__ */ React26.createElement(Emoji, {
|
|
1145
1381
|
text: emoji2
|
|
1146
|
-
}))), /* @__PURE__ */
|
|
1382
|
+
}))), /* @__PURE__ */ React26.createElement("span", {
|
|
1147
1383
|
id: qrLabel,
|
|
1148
1384
|
className: "sr-only"
|
|
1149
|
-
}, t("qr label")), /* @__PURE__ */
|
|
1385
|
+
}, t("qr label")), /* @__PURE__ */ React26.createElement(CopyButton, {
|
|
1150
1386
|
variant: "ghost",
|
|
1151
1387
|
value: invitationUrl ?? "never"
|
|
1152
|
-
})), /* @__PURE__ */
|
|
1388
|
+
})), /* @__PURE__ */ React26.createElement(InvitationManagerView, {
|
|
1153
1389
|
id: "showing auth code"
|
|
1154
|
-
}, /* @__PURE__ */
|
|
1390
|
+
}, /* @__PURE__ */ React26.createElement(Label, null, t("auth code message")), /* @__PURE__ */ React26.createElement(AuthCode, {
|
|
1155
1391
|
code: authCode,
|
|
1156
1392
|
large: true,
|
|
1157
1393
|
classNames: "text-black dark:text-white"
|
|
1158
|
-
}), /* @__PURE__ */
|
|
1394
|
+
}), /* @__PURE__ */ React26.createElement(Label, null, "Be sure the other device is showing this symbol:"), emoji2 && /* @__PURE__ */ React26.createElement(Emoji, {
|
|
1159
1395
|
text: emoji2
|
|
1160
|
-
})), /* @__PURE__ */
|
|
1396
|
+
})), /* @__PURE__ */ React26.createElement(InvitationManagerView, {
|
|
1161
1397
|
id: "showing final"
|
|
1162
|
-
}, statusValue > 0 ? /* @__PURE__ */
|
|
1163
|
-
className:
|
|
1164
|
-
}) : /* @__PURE__ */
|
|
1165
|
-
className:
|
|
1166
|
-
})))), /* @__PURE__ */
|
|
1398
|
+
}, statusValue > 0 ? /* @__PURE__ */ React26.createElement(Check3, {
|
|
1399
|
+
className: mx19("m-1.5", getSize8(6))
|
|
1400
|
+
}) : /* @__PURE__ */ React26.createElement(X3, {
|
|
1401
|
+
className: mx19("m-1.5", getSize8(6))
|
|
1402
|
+
})))), /* @__PURE__ */ React26.createElement(Actions, {
|
|
1167
1403
|
classNames: "mbs-4"
|
|
1168
|
-
}, /* @__PURE__ */
|
|
1404
|
+
}, /* @__PURE__ */ React26.createElement(Action, {
|
|
1169
1405
|
disabled: !active,
|
|
1170
1406
|
onClick: () => send?.({
|
|
1171
1407
|
type: "deselectInvitation"
|
|
@@ -1174,36 +1410,37 @@ var InvitationManager = ({ invitationUrl, active, send, status, type, authCode,
|
|
|
1174
1410
|
};
|
|
1175
1411
|
|
|
1176
1412
|
// packages/sdk/shell/src/panels/IdentityPanel/IdentityPanel.tsx
|
|
1177
|
-
var
|
|
1413
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/IdentityPanel/IdentityPanel.tsx";
|
|
1178
1414
|
var viewStyles = "pbs-1 pbe-3 pli-3";
|
|
1179
1415
|
var IdentityHeading = ({ titleId, title, identity, onDone }) => {
|
|
1180
1416
|
const fallbackHref = useJdenticonHref3(identity.identityKey.toHex(), 12);
|
|
1181
|
-
return /* @__PURE__ */
|
|
1417
|
+
return /* @__PURE__ */ React27.createElement(Heading, {
|
|
1182
1418
|
titleId,
|
|
1183
1419
|
title,
|
|
1184
|
-
corner: /* @__PURE__ */
|
|
1420
|
+
corner: /* @__PURE__ */ React27.createElement(CloseButton, {
|
|
1185
1421
|
onDone
|
|
1186
1422
|
})
|
|
1187
|
-
}, /* @__PURE__ */
|
|
1423
|
+
}, /* @__PURE__ */ React27.createElement(Avatar4.Root, {
|
|
1188
1424
|
size: 12,
|
|
1189
1425
|
variant: "circle",
|
|
1190
1426
|
status: "active"
|
|
1191
|
-
}, /* @__PURE__ */
|
|
1427
|
+
}, /* @__PURE__ */ React27.createElement(Avatar4.Frame, {
|
|
1192
1428
|
classNames: "block mbs-4 mbe-2 mli-auto chromatic-ignore"
|
|
1193
|
-
}, /* @__PURE__ */
|
|
1429
|
+
}, /* @__PURE__ */ React27.createElement(Avatar4.Fallback, {
|
|
1194
1430
|
href: fallbackHref
|
|
1195
|
-
})), /* @__PURE__ */
|
|
1431
|
+
})), /* @__PURE__ */ React27.createElement(Avatar4.Label, {
|
|
1196
1432
|
classNames: "block text-center font-light text-xl"
|
|
1197
1433
|
}, identity.profile?.displayName ?? generateName2(identity.identityKey.toHex()))));
|
|
1198
1434
|
};
|
|
1199
1435
|
var IdentityPanelImpl = (props) => {
|
|
1200
|
-
const { identity, titleId, activeView, onUpdateProfile, IdentityActionChooser: IdentityActionChooserComponent = IdentityActionChooser, InvitationManager: InvitationManagerComponent = InvitationManager, onDone, ...rest } = props;
|
|
1201
|
-
const { t } =
|
|
1436
|
+
const { identity, titleId, activeView, onUpdateProfile, onResetDevice, onJoinNewIdentity, IdentityActionChooser: IdentityActionChooserComponent = IdentityActionChooser, InvitationManager: InvitationManagerComponent = InvitationManager, onDone, ...rest } = props;
|
|
1437
|
+
const { t } = useTranslation13("os");
|
|
1202
1438
|
const title = useMemo3(() => {
|
|
1203
1439
|
switch (activeView) {
|
|
1204
|
-
case "
|
|
1440
|
+
case "agent manager":
|
|
1441
|
+
return "Manage Agent";
|
|
1205
1442
|
case "device invitation manager":
|
|
1206
|
-
return t("choose
|
|
1443
|
+
return t("choose add device label");
|
|
1207
1444
|
default:
|
|
1208
1445
|
return t("identity heading");
|
|
1209
1446
|
}
|
|
@@ -1211,59 +1448,81 @@ var IdentityPanelImpl = (props) => {
|
|
|
1211
1448
|
activeView,
|
|
1212
1449
|
t
|
|
1213
1450
|
]);
|
|
1214
|
-
return /* @__PURE__ */
|
|
1451
|
+
return /* @__PURE__ */ React27.createElement(DensityProvider2, {
|
|
1215
1452
|
density: "fine"
|
|
1216
|
-
}, /* @__PURE__ */
|
|
1453
|
+
}, /* @__PURE__ */ React27.createElement(IdentityHeading, {
|
|
1217
1454
|
identity,
|
|
1218
1455
|
titleId,
|
|
1219
1456
|
title,
|
|
1220
1457
|
onDone
|
|
1221
|
-
}), /* @__PURE__ */
|
|
1458
|
+
}), /* @__PURE__ */ React27.createElement(Viewport.Root, {
|
|
1222
1459
|
activeView
|
|
1223
|
-
}, /* @__PURE__ */
|
|
1460
|
+
}, /* @__PURE__ */ React27.createElement(Viewport.Views, null, /* @__PURE__ */ React27.createElement(Viewport.View, {
|
|
1224
1461
|
id: "identity action chooser",
|
|
1225
1462
|
classNames: viewStyles
|
|
1226
|
-
}, /* @__PURE__ */
|
|
1463
|
+
}, /* @__PURE__ */ React27.createElement(IdentityActionChooserComponent, {
|
|
1227
1464
|
active: activeView === "identity action chooser",
|
|
1228
1465
|
...rest
|
|
1229
|
-
})), /* @__PURE__ */
|
|
1466
|
+
})), /* @__PURE__ */ React27.createElement(Viewport.View, {
|
|
1230
1467
|
id: "device invitation manager",
|
|
1231
1468
|
classNames: viewStyles
|
|
1232
|
-
}, /* @__PURE__ */
|
|
1469
|
+
}, /* @__PURE__ */ React27.createElement(InvitationManagerComponent, {
|
|
1233
1470
|
active: activeView === "device invitation manager",
|
|
1234
1471
|
...rest,
|
|
1235
1472
|
invitationUrl: rest.createInvitationUrl(rest.invitationCode)
|
|
1236
|
-
})), /* @__PURE__ */
|
|
1473
|
+
})), /* @__PURE__ */ React27.createElement(Viewport.View, {
|
|
1474
|
+
id: "device manager",
|
|
1475
|
+
classNames: viewStyles
|
|
1476
|
+
}, /* @__PURE__ */ React27.createElement(DeviceManager, {
|
|
1477
|
+
active: activeView === "device manager",
|
|
1478
|
+
...rest
|
|
1479
|
+
})), /* @__PURE__ */ React27.createElement(Viewport.View, {
|
|
1237
1480
|
classNames: viewStyles,
|
|
1238
1481
|
id: "update profile form"
|
|
1239
|
-
}, /* @__PURE__ */
|
|
1482
|
+
}, /* @__PURE__ */ React27.createElement(ProfileForm, {
|
|
1240
1483
|
send: rest.send,
|
|
1241
1484
|
active: activeView === "update profile form",
|
|
1242
1485
|
profile: identity.profile,
|
|
1243
1486
|
onUpdateProfile
|
|
1487
|
+
})), /* @__PURE__ */ React27.createElement(Viewport.View, {
|
|
1488
|
+
classNames: viewStyles,
|
|
1489
|
+
id: "signing out"
|
|
1490
|
+
}, /* @__PURE__ */ React27.createElement(SignOutChooser, {
|
|
1491
|
+
send: rest.send,
|
|
1492
|
+
active: activeView === "signing out",
|
|
1493
|
+
onResetDevice,
|
|
1494
|
+
onJoinNewIdentity
|
|
1495
|
+
})), /* @__PURE__ */ React27.createElement(Viewport.View, {
|
|
1496
|
+
classNames: viewStyles,
|
|
1497
|
+
id: "agent manager"
|
|
1498
|
+
}, /* @__PURE__ */ React27.createElement(AgentForm, {
|
|
1499
|
+
send: rest.send,
|
|
1500
|
+
active: activeView === "agent manager",
|
|
1501
|
+
identity
|
|
1244
1502
|
})))));
|
|
1245
1503
|
};
|
|
1246
1504
|
var IdentityPanelWithInvitationImpl = ({ invitation, ...props }) => {
|
|
1247
1505
|
const invitationStatus = useInvitationStatus2(invitation);
|
|
1248
|
-
return /* @__PURE__ */
|
|
1506
|
+
return /* @__PURE__ */ React27.createElement(IdentityPanelImpl, {
|
|
1249
1507
|
...props,
|
|
1250
1508
|
...invitationStatus
|
|
1251
1509
|
});
|
|
1252
1510
|
};
|
|
1253
1511
|
var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => code, ...props }) => {
|
|
1254
1512
|
const titleId = useId5("identityPanel__heading", propsTitleId);
|
|
1255
|
-
const client =
|
|
1513
|
+
const client = useClient4();
|
|
1514
|
+
const devices = useDevices();
|
|
1256
1515
|
const identity = useIdentity();
|
|
1257
1516
|
if (!identity) {
|
|
1258
1517
|
console.error("IdentityPanel rendered with no active identity.");
|
|
1259
1518
|
return null;
|
|
1260
1519
|
}
|
|
1261
1520
|
const [identityState, identitySend, identityService] = useIdentityMachine(client);
|
|
1262
|
-
|
|
1521
|
+
useEffect3(() => {
|
|
1263
1522
|
const subscription = identityService.subscribe((state) => {
|
|
1264
1523
|
log3("[state]", state, {
|
|
1265
|
-
F:
|
|
1266
|
-
L:
|
|
1524
|
+
F: __dxlog_file4,
|
|
1525
|
+
L: 135,
|
|
1267
1526
|
S: void 0,
|
|
1268
1527
|
C: (f, a) => f(...a)
|
|
1269
1528
|
});
|
|
@@ -1278,6 +1537,8 @@ var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => co
|
|
|
1278
1537
|
return "identity action chooser";
|
|
1279
1538
|
case identityState.matches("managingDeviceInvitation"):
|
|
1280
1539
|
return "device invitation manager";
|
|
1540
|
+
case identityState.matches("managingDevices"):
|
|
1541
|
+
return "device manager";
|
|
1281
1542
|
case [
|
|
1282
1543
|
{
|
|
1283
1544
|
managingProfile: "idle"
|
|
@@ -1287,6 +1548,17 @@ var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => co
|
|
|
1287
1548
|
}
|
|
1288
1549
|
].some(identityState.matches):
|
|
1289
1550
|
return "update profile form";
|
|
1551
|
+
case identityState.matches("signingOut"):
|
|
1552
|
+
return "signing out";
|
|
1553
|
+
case [
|
|
1554
|
+
{
|
|
1555
|
+
managingAgent: "idle"
|
|
1556
|
+
},
|
|
1557
|
+
{
|
|
1558
|
+
managingAgent: "pending"
|
|
1559
|
+
}
|
|
1560
|
+
].some(identityState.matches):
|
|
1561
|
+
return "agent manager";
|
|
1290
1562
|
default:
|
|
1291
1563
|
return "identity action chooser";
|
|
1292
1564
|
}
|
|
@@ -1302,46 +1574,47 @@ var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => co
|
|
|
1302
1574
|
const implProps = {
|
|
1303
1575
|
...props,
|
|
1304
1576
|
identity,
|
|
1577
|
+
devices,
|
|
1305
1578
|
activeView,
|
|
1306
1579
|
send: identitySend,
|
|
1307
1580
|
titleId,
|
|
1308
1581
|
createInvitationUrl,
|
|
1309
1582
|
onUpdateProfile
|
|
1310
1583
|
};
|
|
1311
|
-
return identityState.context.invitation ? /* @__PURE__ */
|
|
1584
|
+
return identityState.context.invitation ? /* @__PURE__ */ React27.createElement(IdentityPanelWithInvitationImpl, {
|
|
1312
1585
|
...implProps,
|
|
1313
1586
|
invitation: identityState.context.invitation
|
|
1314
|
-
}) : /* @__PURE__ */
|
|
1587
|
+
}) : /* @__PURE__ */ React27.createElement(IdentityPanelImpl, implProps);
|
|
1315
1588
|
};
|
|
1316
1589
|
|
|
1317
1590
|
// packages/sdk/shell/src/panels/JoinPanel/JoinPanel.tsx
|
|
1318
|
-
import
|
|
1591
|
+
import React37, { useCallback as useCallback7, useEffect as useEffect5, useMemo as useMemo4 } from "react";
|
|
1319
1592
|
import { log as log8 } from "@dxos/log";
|
|
1320
|
-
import { useClient as
|
|
1593
|
+
import { useClient as useClient7, useMulticastObservable } from "@dxos/react-client";
|
|
1321
1594
|
import { useIdentity as useIdentity2 } from "@dxos/react-client/halo";
|
|
1322
1595
|
import { DensityProvider as DensityProvider3, useId as useId7, useThemeContext as useThemeContext3 } from "@dxos/react-ui";
|
|
1323
1596
|
|
|
1324
1597
|
// packages/sdk/shell/src/panels/JoinPanel/JoinHeading.tsx
|
|
1325
1598
|
import { X as X4 } from "@phosphor-icons/react";
|
|
1326
|
-
import
|
|
1327
|
-
import { Button as Button5, useTranslation as
|
|
1328
|
-
import { descriptionText as descriptionText8, getSize as
|
|
1599
|
+
import React28, { cloneElement, forwardRef as forwardRef8 } from "react";
|
|
1600
|
+
import { Button as Button5, useTranslation as useTranslation14 } from "@dxos/react-ui";
|
|
1601
|
+
import { descriptionText as descriptionText8, getSize as getSize9, mx as mx20 } from "@dxos/react-ui-theme";
|
|
1329
1602
|
var JoinHeading = /* @__PURE__ */ forwardRef8(({ mode, titleId, onExit, exitActionParent }, forwardedRef) => {
|
|
1330
|
-
const { t } =
|
|
1331
|
-
const exitButton = /* @__PURE__ */
|
|
1603
|
+
const { t } = useTranslation14("os");
|
|
1604
|
+
const exitButton = /* @__PURE__ */ React28.createElement(Button5, {
|
|
1332
1605
|
variant: "ghost",
|
|
1333
1606
|
...onExit && {
|
|
1334
1607
|
onClick: onExit
|
|
1335
1608
|
},
|
|
1336
|
-
classNames:
|
|
1609
|
+
classNames: mx20(descriptionText8, "plb-0 pli-2 absolute block-start-0 inline-end-0 z-[1]"),
|
|
1337
1610
|
"data-testid": "join-exit"
|
|
1338
|
-
}, /* @__PURE__ */
|
|
1611
|
+
}, /* @__PURE__ */ React28.createElement(X4, {
|
|
1339
1612
|
weight: "bold",
|
|
1340
|
-
className:
|
|
1341
|
-
}), /* @__PURE__ */
|
|
1613
|
+
className: getSize9(4)
|
|
1614
|
+
}), /* @__PURE__ */ React28.createElement("span", {
|
|
1342
1615
|
className: "sr-only"
|
|
1343
1616
|
}, t("exit label")));
|
|
1344
|
-
return /* @__PURE__ */
|
|
1617
|
+
return /* @__PURE__ */ React28.createElement(Heading, {
|
|
1345
1618
|
ref: forwardedRef,
|
|
1346
1619
|
titleId,
|
|
1347
1620
|
title: t(mode === "halo-only" ? "selecting identity heading" : "joining space heading"),
|
|
@@ -1356,14 +1629,14 @@ var JoinHeading = /* @__PURE__ */ forwardRef8(({ mode, titleId, onExit, exitActi
|
|
|
1356
1629
|
|
|
1357
1630
|
// packages/sdk/shell/src/panels/JoinPanel/joinMachine.ts
|
|
1358
1631
|
import { useMachine as useMachine2 } from "@xstate/react";
|
|
1359
|
-
import { useCallback as
|
|
1632
|
+
import { useCallback as useCallback6 } from "react";
|
|
1360
1633
|
import { assign as assign2, createMachine as createMachine2 } from "xstate";
|
|
1361
1634
|
import { log as log4 } from "@dxos/log";
|
|
1362
|
-
import { Invitation as
|
|
1363
|
-
var
|
|
1635
|
+
import { Invitation as Invitation6, InvitationEncoder as InvitationEncoder3 } from "@dxos/react-client/invitations";
|
|
1636
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/joinMachine.ts";
|
|
1364
1637
|
var getInvitationSubscribable = (Kind, invitation) => {
|
|
1365
1638
|
log4("[subscribing to invitation]", invitation, {
|
|
1366
|
-
F:
|
|
1639
|
+
F: __dxlog_file5,
|
|
1367
1640
|
L: 88,
|
|
1368
1641
|
S: void 0,
|
|
1369
1642
|
C: (f, a) => f(...a)
|
|
@@ -1371,12 +1644,12 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
1371
1644
|
return {
|
|
1372
1645
|
subscribe: (next, onError, complete) => invitation.subscribe((invitation2) => {
|
|
1373
1646
|
switch (invitation2.state) {
|
|
1374
|
-
case
|
|
1647
|
+
case Invitation6.State.CONNECTING: {
|
|
1375
1648
|
log4("[invitation connecting]", {
|
|
1376
1649
|
Kind,
|
|
1377
1650
|
invitation: invitation2
|
|
1378
1651
|
}, {
|
|
1379
|
-
F:
|
|
1652
|
+
F: __dxlog_file5,
|
|
1380
1653
|
L: 99,
|
|
1381
1654
|
S: void 0,
|
|
1382
1655
|
C: (f, a) => f(...a)
|
|
@@ -1386,12 +1659,12 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
1386
1659
|
invitation: invitation2
|
|
1387
1660
|
});
|
|
1388
1661
|
}
|
|
1389
|
-
case
|
|
1662
|
+
case Invitation6.State.CONNECTED: {
|
|
1390
1663
|
log4("[invitation connected]", {
|
|
1391
1664
|
Kind,
|
|
1392
1665
|
invitation: invitation2
|
|
1393
1666
|
}, {
|
|
1394
|
-
F:
|
|
1667
|
+
F: __dxlog_file5,
|
|
1395
1668
|
L: 104,
|
|
1396
1669
|
S: void 0,
|
|
1397
1670
|
C: (f, a) => f(...a)
|
|
@@ -1401,12 +1674,12 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
1401
1674
|
invitation: invitation2
|
|
1402
1675
|
});
|
|
1403
1676
|
}
|
|
1404
|
-
case
|
|
1677
|
+
case Invitation6.State.READY_FOR_AUTHENTICATION: {
|
|
1405
1678
|
log4("[invitation ready for authentication]", {
|
|
1406
1679
|
Kind,
|
|
1407
1680
|
invitation: invitation2
|
|
1408
1681
|
}, {
|
|
1409
|
-
F:
|
|
1682
|
+
F: __dxlog_file5,
|
|
1410
1683
|
L: 109,
|
|
1411
1684
|
S: void 0,
|
|
1412
1685
|
C: (f, a) => f(...a)
|
|
@@ -1416,12 +1689,12 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
1416
1689
|
invitation: invitation2
|
|
1417
1690
|
});
|
|
1418
1691
|
}
|
|
1419
|
-
case
|
|
1692
|
+
case Invitation6.State.AUTHENTICATING: {
|
|
1420
1693
|
log4("[invitation authenticating]", {
|
|
1421
1694
|
Kind,
|
|
1422
1695
|
invitation: invitation2
|
|
1423
1696
|
}, {
|
|
1424
|
-
F:
|
|
1697
|
+
F: __dxlog_file5,
|
|
1425
1698
|
L: 114,
|
|
1426
1699
|
S: void 0,
|
|
1427
1700
|
C: (f, a) => f(...a)
|
|
@@ -1431,12 +1704,12 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
1431
1704
|
invitation: invitation2
|
|
1432
1705
|
});
|
|
1433
1706
|
}
|
|
1434
|
-
case
|
|
1707
|
+
case Invitation6.State.SUCCESS: {
|
|
1435
1708
|
log4("[invitation success]", {
|
|
1436
1709
|
Kind,
|
|
1437
1710
|
invitation: invitation2
|
|
1438
1711
|
}, {
|
|
1439
|
-
F:
|
|
1712
|
+
F: __dxlog_file5,
|
|
1440
1713
|
L: 119,
|
|
1441
1714
|
S: void 0,
|
|
1442
1715
|
C: (f, a) => f(...a)
|
|
@@ -1447,11 +1720,11 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
1447
1720
|
});
|
|
1448
1721
|
return complete?.();
|
|
1449
1722
|
}
|
|
1450
|
-
case
|
|
1723
|
+
case Invitation6.State.CANCELLED: {
|
|
1451
1724
|
log4.warn("[invitation cancelled]", {
|
|
1452
1725
|
Kind
|
|
1453
1726
|
}, {
|
|
1454
|
-
F:
|
|
1727
|
+
F: __dxlog_file5,
|
|
1455
1728
|
L: 125,
|
|
1456
1729
|
S: void 0,
|
|
1457
1730
|
C: (f, a) => f(...a)
|
|
@@ -1461,11 +1734,11 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
1461
1734
|
reason: "cancelled"
|
|
1462
1735
|
});
|
|
1463
1736
|
}
|
|
1464
|
-
case
|
|
1737
|
+
case Invitation6.State.TIMEOUT: {
|
|
1465
1738
|
log4.error("[invitation timeout]", {
|
|
1466
1739
|
Kind
|
|
1467
1740
|
}, {
|
|
1468
|
-
F:
|
|
1741
|
+
F: __dxlog_file5,
|
|
1469
1742
|
L: 130,
|
|
1470
1743
|
S: void 0,
|
|
1471
1744
|
C: (f, a) => f(...a)
|
|
@@ -1481,7 +1754,7 @@ var getInvitationSubscribable = (Kind, invitation) => {
|
|
|
1481
1754
|
Kind,
|
|
1482
1755
|
error
|
|
1483
1756
|
}, {
|
|
1484
|
-
F:
|
|
1757
|
+
F: __dxlog_file5,
|
|
1485
1758
|
L: 136,
|
|
1486
1759
|
S: void 0,
|
|
1487
1760
|
C: (f, a) => f(...a)
|
|
@@ -1544,7 +1817,7 @@ var acceptingInvitationTemplate = (Kind, successTarget) => {
|
|
|
1544
1817
|
{
|
|
1545
1818
|
cond: (context) => {
|
|
1546
1819
|
const invitation = context[Kind.toLowerCase()].invitation;
|
|
1547
|
-
return !invitation || invitation?.state ===
|
|
1820
|
+
return !invitation || invitation?.state === Invitation6.State.CONNECTING;
|
|
1548
1821
|
},
|
|
1549
1822
|
target: `connecting${Kind}Invitation`,
|
|
1550
1823
|
actions: "log"
|
|
@@ -1801,12 +2074,12 @@ var joinMachine = createMachine2({
|
|
|
1801
2074
|
} : context.space
|
|
1802
2075
|
}),
|
|
1803
2076
|
log: (context, event) => {
|
|
1804
|
-
log4
|
|
2077
|
+
log4("[transition]", {
|
|
1805
2078
|
event,
|
|
1806
2079
|
haloInvitation: context.halo.invitation,
|
|
1807
2080
|
spaceInvitation: context.space.invitation
|
|
1808
2081
|
}, {
|
|
1809
|
-
F:
|
|
2082
|
+
F: __dxlog_file5,
|
|
1810
2083
|
L: 400,
|
|
1811
2084
|
S: void 0,
|
|
1812
2085
|
C: (f, a) => f(...a)
|
|
@@ -1820,7 +2093,7 @@ var defaultCodeFromUrl = (invitationType, text) => {
|
|
|
1820
2093
|
return searchParams.get(`${invitationType}InvitationCode`) ?? searchParams.get(`${invitationType}Invitation`) ?? searchParams.get("invitationCode") ?? searchParams.get("invitation") ?? text;
|
|
1821
2094
|
} catch (err) {
|
|
1822
2095
|
log4.catch(err, void 0, {
|
|
1823
|
-
F:
|
|
2096
|
+
F: __dxlog_file5,
|
|
1824
2097
|
L: 427,
|
|
1825
2098
|
S: void 0,
|
|
1826
2099
|
C: (f, a) => f(...a)
|
|
@@ -1829,10 +2102,10 @@ var defaultCodeFromUrl = (invitationType, text) => {
|
|
|
1829
2102
|
}
|
|
1830
2103
|
};
|
|
1831
2104
|
var useJoinMachine = (client, options) => {
|
|
1832
|
-
const redeemHaloInvitationCode =
|
|
2105
|
+
const redeemHaloInvitationCode = useCallback6(({ halo }) => {
|
|
1833
2106
|
if (halo.unredeemedCode) {
|
|
1834
2107
|
try {
|
|
1835
|
-
const invitationObservable = client.halo.join(
|
|
2108
|
+
const invitationObservable = client.halo.join(InvitationEncoder3.decode(defaultCodeFromUrl("halo", halo.unredeemedCode)));
|
|
1836
2109
|
return {
|
|
1837
2110
|
...halo,
|
|
1838
2111
|
invitationObservable,
|
|
@@ -1840,7 +2113,7 @@ var useJoinMachine = (client, options) => {
|
|
|
1840
2113
|
};
|
|
1841
2114
|
} catch (err) {
|
|
1842
2115
|
log4.error("Could not redeem device invitation code", err, {
|
|
1843
|
-
F:
|
|
2116
|
+
F: __dxlog_file5,
|
|
1844
2117
|
L: 449,
|
|
1845
2118
|
S: void 0,
|
|
1846
2119
|
C: (f, a) => f(...a)
|
|
@@ -1853,10 +2126,10 @@ var useJoinMachine = (client, options) => {
|
|
|
1853
2126
|
}, [
|
|
1854
2127
|
client
|
|
1855
2128
|
]);
|
|
1856
|
-
const redeemSpaceInvitationCode =
|
|
2129
|
+
const redeemSpaceInvitationCode = useCallback6(({ space }) => {
|
|
1857
2130
|
if (space.unredeemedCode) {
|
|
1858
2131
|
try {
|
|
1859
|
-
const invitation =
|
|
2132
|
+
const invitation = InvitationEncoder3.decode(defaultCodeFromUrl("space", space.unredeemedCode));
|
|
1860
2133
|
if (space.succeededKeys?.has(invitation.spaceKey?.toHex() ?? "never")) {
|
|
1861
2134
|
return {
|
|
1862
2135
|
...space,
|
|
@@ -1872,7 +2145,7 @@ var useJoinMachine = (client, options) => {
|
|
|
1872
2145
|
}
|
|
1873
2146
|
} catch (err) {
|
|
1874
2147
|
log4.error("Could not redeem space invitation code", err, {
|
|
1875
|
-
F:
|
|
2148
|
+
F: __dxlog_file5,
|
|
1876
2149
|
L: 479,
|
|
1877
2150
|
S: void 0,
|
|
1878
2151
|
C: (f, a) => f(...a)
|
|
@@ -1885,7 +2158,7 @@ var useJoinMachine = (client, options) => {
|
|
|
1885
2158
|
}, [
|
|
1886
2159
|
client
|
|
1887
2160
|
]);
|
|
1888
|
-
const invalidateHaloInvitationCode =
|
|
2161
|
+
const invalidateHaloInvitationCode = useCallback6(({ halo }) => {
|
|
1889
2162
|
if (halo.unredeemedCode) {
|
|
1890
2163
|
options?.onInvalidateInvitationCode?.(halo.unredeemedCode);
|
|
1891
2164
|
return {
|
|
@@ -1898,7 +2171,7 @@ var useJoinMachine = (client, options) => {
|
|
|
1898
2171
|
}, [
|
|
1899
2172
|
options?.onInvalidateInvitationCode
|
|
1900
2173
|
]);
|
|
1901
|
-
const invalidateSpaceInvitationCode =
|
|
2174
|
+
const invalidateSpaceInvitationCode = useCallback6(({ space }) => {
|
|
1902
2175
|
if (space.unredeemedCode) {
|
|
1903
2176
|
options?.onInvalidateInvitationCode?.(space.unredeemedCode);
|
|
1904
2177
|
return {
|
|
@@ -1933,17 +2206,17 @@ var useJoinMachine = (client, options) => {
|
|
|
1933
2206
|
|
|
1934
2207
|
// packages/sdk/shell/src/panels/JoinPanel/steps/AdditionMethodChooser.tsx
|
|
1935
2208
|
import { CaretRight as CaretRight2, Plus as Plus2, QrCode, Textbox } from "@phosphor-icons/react";
|
|
1936
|
-
import
|
|
1937
|
-
import { useTranslation as
|
|
1938
|
-
import { getSize as
|
|
2209
|
+
import React29 from "react";
|
|
2210
|
+
import { useTranslation as useTranslation15 } from "@dxos/react-ui";
|
|
2211
|
+
import { getSize as getSize10 } from "@dxos/react-ui-theme";
|
|
1939
2212
|
var AdditionMethodChooser = (viewStateProps) => {
|
|
1940
2213
|
const disabled = !viewStateProps.active;
|
|
1941
2214
|
const { send } = viewStateProps;
|
|
1942
|
-
const { t } =
|
|
2215
|
+
const { t } = useTranslation15("os");
|
|
1943
2216
|
const sharedButtonProps = {
|
|
1944
2217
|
disabled,
|
|
1945
|
-
after: /* @__PURE__ */
|
|
1946
|
-
className:
|
|
2218
|
+
after: /* @__PURE__ */ React29.createElement(CaretRight2, {
|
|
2219
|
+
className: getSize10(4),
|
|
1947
2220
|
weight: "bold"
|
|
1948
2221
|
}),
|
|
1949
2222
|
slots: {
|
|
@@ -1952,37 +2225,37 @@ var AdditionMethodChooser = (viewStateProps) => {
|
|
|
1952
2225
|
}
|
|
1953
2226
|
}
|
|
1954
2227
|
};
|
|
1955
|
-
return /* @__PURE__ */
|
|
2228
|
+
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(StepHeading, null, t("addition method chooser title")), /* @__PURE__ */ React29.createElement("div", {
|
|
1956
2229
|
role: "none",
|
|
1957
2230
|
className: "flex flex-col gap-1 grow"
|
|
1958
|
-
}, /* @__PURE__ */
|
|
2231
|
+
}, /* @__PURE__ */ React29.createElement(CompoundButton, {
|
|
1959
2232
|
...sharedButtonProps,
|
|
1960
2233
|
description: t("create identity description"),
|
|
1961
|
-
before: /* @__PURE__ */
|
|
1962
|
-
className:
|
|
2234
|
+
before: /* @__PURE__ */ React29.createElement(Plus2, {
|
|
2235
|
+
className: getSize10(6)
|
|
1963
2236
|
}),
|
|
1964
2237
|
onClick: () => send({
|
|
1965
2238
|
type: "createIdentity"
|
|
1966
2239
|
}),
|
|
1967
2240
|
"data-autofocus": "choosingAuthMethod",
|
|
1968
2241
|
"data-testid": "create-identity"
|
|
1969
|
-
}, t("create identity label")), /* @__PURE__ */
|
|
2242
|
+
}, t("create identity label")), /* @__PURE__ */ React29.createElement(CompoundButton, {
|
|
1970
2243
|
...sharedButtonProps,
|
|
1971
2244
|
description: t("join identity description"),
|
|
1972
|
-
before: /* @__PURE__ */
|
|
1973
|
-
className:
|
|
2245
|
+
before: /* @__PURE__ */ React29.createElement(QrCode, {
|
|
2246
|
+
className: getSize10(6)
|
|
1974
2247
|
}),
|
|
1975
2248
|
onClick: () => send({
|
|
1976
2249
|
type: "acceptHaloInvitation"
|
|
1977
2250
|
}),
|
|
1978
2251
|
"data-testid": "join-identity"
|
|
1979
|
-
}, t("join identity label")), /* @__PURE__ */
|
|
2252
|
+
}, t("join identity label")), /* @__PURE__ */ React29.createElement(CompoundButton, {
|
|
1980
2253
|
...sharedButtonProps,
|
|
1981
2254
|
// TODO(mykola): Implement recover.
|
|
1982
2255
|
disabled: true,
|
|
1983
2256
|
description: t("recover identity description"),
|
|
1984
|
-
before: /* @__PURE__ */
|
|
1985
|
-
className:
|
|
2257
|
+
before: /* @__PURE__ */ React29.createElement(Textbox, {
|
|
2258
|
+
className: getSize10(6)
|
|
1986
2259
|
}),
|
|
1987
2260
|
onClick: () => send({
|
|
1988
2261
|
type: "recoverIdentity"
|
|
@@ -1992,37 +2265,37 @@ var AdditionMethodChooser = (viewStateProps) => {
|
|
|
1992
2265
|
};
|
|
1993
2266
|
|
|
1994
2267
|
// packages/sdk/shell/src/panels/JoinPanel/steps/IdentityAdded.tsx
|
|
1995
|
-
import
|
|
2268
|
+
import React30, { cloneElement as cloneElement2 } from "react";
|
|
1996
2269
|
import { generateName as generateName3 } from "@dxos/display-name";
|
|
1997
|
-
import { Avatar as Avatar5, useId as useId6, useJdenticonHref as useJdenticonHref4, useTranslation as
|
|
1998
|
-
import { mx as
|
|
2270
|
+
import { Avatar as Avatar5, useId as useId6, useJdenticonHref as useJdenticonHref4, useTranslation as useTranslation16 } from "@dxos/react-ui";
|
|
2271
|
+
import { mx as mx21 } from "@dxos/react-ui-theme";
|
|
1999
2272
|
var IdentityAdded = (props) => {
|
|
2000
2273
|
const { mode, addedIdentity, active, send, onDone, doneActionParent } = props;
|
|
2001
2274
|
const disabled = !active;
|
|
2002
|
-
const { t } =
|
|
2275
|
+
const { t } = useTranslation16("os");
|
|
2003
2276
|
const fallbackValue = addedIdentity?.identityKey.toHex();
|
|
2004
2277
|
const labelId = useId6("identityListItem__label");
|
|
2005
2278
|
const jdenticon = useJdenticonHref4(fallbackValue ?? "", 12);
|
|
2006
2279
|
const displayName = addedIdentity?.profile?.displayName ?? (addedIdentity && generateName3(addedIdentity?.identityKey.toHex()));
|
|
2007
|
-
const doneAction = /* @__PURE__ */
|
|
2280
|
+
const doneAction = /* @__PURE__ */ React30.createElement(Action, {
|
|
2008
2281
|
...onDone && {
|
|
2009
2282
|
onClick: () => onDone(null)
|
|
2010
2283
|
},
|
|
2011
2284
|
disabled,
|
|
2012
2285
|
"data-autofocus": "confirmingAddedIdentity",
|
|
2013
2286
|
"data-testid": "identity-added-done"
|
|
2014
|
-
}, /* @__PURE__ */
|
|
2015
|
-
return /* @__PURE__ */
|
|
2287
|
+
}, /* @__PURE__ */ React30.createElement("span", null, t("done label")));
|
|
2288
|
+
return /* @__PURE__ */ React30.createElement(React30.Fragment, null, /* @__PURE__ */ React30.createElement(StepHeading, null, t("identity added label")), /* @__PURE__ */ React30.createElement("div", {
|
|
2016
2289
|
role: "none",
|
|
2017
2290
|
className: "grow flex flex-col items-center justify-center text-center gap-2"
|
|
2018
|
-
}, /* @__PURE__ */
|
|
2291
|
+
}, /* @__PURE__ */ React30.createElement(Avatar5.Root, {
|
|
2019
2292
|
status: "active",
|
|
2020
2293
|
labelId
|
|
2021
|
-
}, /* @__PURE__ */
|
|
2294
|
+
}, /* @__PURE__ */ React30.createElement(Avatar5.Frame, null, /* @__PURE__ */ React30.createElement(Avatar5.Fallback, {
|
|
2022
2295
|
href: jdenticon
|
|
2023
|
-
})), /* @__PURE__ */
|
|
2024
|
-
classNames:
|
|
2025
|
-
}, displayName))), /* @__PURE__ */
|
|
2296
|
+
})), /* @__PURE__ */ React30.createElement(Avatar5.Label, {
|
|
2297
|
+
classNames: mx21("text-lg truncate", !addedIdentity?.profile?.displayName && "font-mono")
|
|
2298
|
+
}, displayName))), /* @__PURE__ */ React30.createElement(Actions, null, mode === "halo-only" ? doneActionParent ? /* @__PURE__ */ cloneElement2(doneActionParent, {}, doneAction) : doneAction : /* @__PURE__ */ React30.createElement(Action, {
|
|
2026
2299
|
variant: "primary",
|
|
2027
2300
|
disabled: disabled || !addedIdentity,
|
|
2028
2301
|
onClick: () => addedIdentity && send({
|
|
@@ -2034,17 +2307,17 @@ var IdentityAdded = (props) => {
|
|
|
2034
2307
|
};
|
|
2035
2308
|
|
|
2036
2309
|
// packages/sdk/shell/src/panels/JoinPanel/steps/IdentityInput.tsx
|
|
2037
|
-
import
|
|
2310
|
+
import React31, { useState as useState5 } from "react";
|
|
2038
2311
|
import { log as log5 } from "@dxos/log";
|
|
2039
|
-
import { useClient as
|
|
2040
|
-
import { useTranslation as
|
|
2041
|
-
var
|
|
2312
|
+
import { useClient as useClient5 } from "@dxos/react-client";
|
|
2313
|
+
import { useTranslation as useTranslation17 } from "@dxos/react-ui";
|
|
2314
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/steps/IdentityInput.tsx";
|
|
2042
2315
|
var IdentityInput = (props) => {
|
|
2043
2316
|
const { send, method } = props;
|
|
2044
2317
|
const isRecover = method === "recover identity";
|
|
2045
|
-
const client =
|
|
2046
|
-
const { t } =
|
|
2047
|
-
const [validationMessage, setValidationMessage] =
|
|
2318
|
+
const client = useClient5();
|
|
2319
|
+
const { t } = useTranslation17("os");
|
|
2320
|
+
const [validationMessage, setValidationMessage] = useState5("");
|
|
2048
2321
|
const createIdentity = (displayName) => {
|
|
2049
2322
|
void client.halo.createIdentity({
|
|
2050
2323
|
[isRecover ? "seedphrase" : "displayName"]: displayName
|
|
@@ -2055,7 +2328,7 @@ var IdentityInput = (props) => {
|
|
|
2055
2328
|
});
|
|
2056
2329
|
}, (error) => {
|
|
2057
2330
|
log5.catch(error, void 0, {
|
|
2058
|
-
F:
|
|
2331
|
+
F: __dxlog_file6,
|
|
2059
2332
|
L: 37,
|
|
2060
2333
|
S: void 0,
|
|
2061
2334
|
C: (f, a) => f(...a)
|
|
@@ -2063,7 +2336,7 @@ var IdentityInput = (props) => {
|
|
|
2063
2336
|
setValidationMessage(t(isRecover ? "failed to recover identity message" : "failed to create identity message"));
|
|
2064
2337
|
});
|
|
2065
2338
|
};
|
|
2066
|
-
return /* @__PURE__ */
|
|
2339
|
+
return /* @__PURE__ */ React31.createElement(IdentityInputImpl, {
|
|
2067
2340
|
...props,
|
|
2068
2341
|
onDisplayNameConfirm: createIdentity,
|
|
2069
2342
|
validationMessage
|
|
@@ -2072,27 +2345,27 @@ var IdentityInput = (props) => {
|
|
|
2072
2345
|
var IdentityInputImpl = (props) => {
|
|
2073
2346
|
const { method, send, active, onDisplayNameConfirm, validationMessage } = props;
|
|
2074
2347
|
const disabled = !active;
|
|
2075
|
-
const { t } =
|
|
2076
|
-
const [inputValue, setInputValue] =
|
|
2348
|
+
const { t } = useTranslation17("os");
|
|
2349
|
+
const [inputValue, setInputValue] = useState5("");
|
|
2077
2350
|
const isRecover = method === "recover identity";
|
|
2078
|
-
return /* @__PURE__ */
|
|
2351
|
+
return /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement("div", {
|
|
2079
2352
|
role: "none",
|
|
2080
2353
|
className: "grow flex flex-col justify-center"
|
|
2081
|
-
}, /* @__PURE__ */
|
|
2354
|
+
}, /* @__PURE__ */ React31.createElement(Input, {
|
|
2082
2355
|
validationMessage,
|
|
2083
|
-
label: /* @__PURE__ */
|
|
2356
|
+
label: /* @__PURE__ */ React31.createElement(StepHeading, null, t(isRecover ? "recover identity input label" : "new identity input label")),
|
|
2084
2357
|
disabled,
|
|
2085
2358
|
"data-testid": "identity-input",
|
|
2086
2359
|
placeholder: isRecover ? "Type your recovery phrase" : "Type a display name",
|
|
2087
2360
|
onChange: ({ target: { value } }) => setInputValue(value)
|
|
2088
|
-
})), /* @__PURE__ */
|
|
2361
|
+
})), /* @__PURE__ */ React31.createElement(Actions, null, /* @__PURE__ */ React31.createElement(Action, {
|
|
2089
2362
|
variant: "ghost",
|
|
2090
2363
|
disabled,
|
|
2091
2364
|
onClick: () => send?.({
|
|
2092
2365
|
type: "deselectAuthMethod"
|
|
2093
2366
|
}),
|
|
2094
2367
|
"data-testid": `${method === "recover identity" ? "recover" : "create"}-identity-input-back`
|
|
2095
|
-
}, t("back label")), /* @__PURE__ */
|
|
2368
|
+
}, t("back label")), /* @__PURE__ */ React31.createElement(Action, {
|
|
2096
2369
|
variant: "primary",
|
|
2097
2370
|
disabled,
|
|
2098
2371
|
onClick: () => onDisplayNameConfirm?.(inputValue),
|
|
@@ -2101,32 +2374,32 @@ var IdentityInputImpl = (props) => {
|
|
|
2101
2374
|
};
|
|
2102
2375
|
|
|
2103
2376
|
// packages/sdk/shell/src/panels/JoinPanel/steps/InvitationAccepted.tsx
|
|
2104
|
-
import
|
|
2105
|
-
import { useTranslation as
|
|
2377
|
+
import React32, { cloneElement as cloneElement3 } from "react";
|
|
2378
|
+
import { useTranslation as useTranslation18 } from "@dxos/react-ui";
|
|
2106
2379
|
var InvitationAccepted = (props) => {
|
|
2107
2380
|
const { active, Kind, doneActionParent, onDone } = props;
|
|
2108
2381
|
const disabled = !active;
|
|
2109
|
-
const { t } =
|
|
2110
|
-
const doneAction = /* @__PURE__ */
|
|
2382
|
+
const { t } = useTranslation18("os");
|
|
2383
|
+
const doneAction = /* @__PURE__ */ React32.createElement(Action, {
|
|
2111
2384
|
variant: "primary",
|
|
2112
2385
|
onClick: onDone,
|
|
2113
2386
|
disabled,
|
|
2114
2387
|
"data-autofocus": `success${Kind}Invitation finishingJoining${Kind}`,
|
|
2115
2388
|
"data-testid": `${Kind.toLowerCase()}-invitation-accepted-done`
|
|
2116
2389
|
}, t("done label"));
|
|
2117
|
-
return /* @__PURE__ */
|
|
2390
|
+
return /* @__PURE__ */ React32.createElement(React32.Fragment, null, /* @__PURE__ */ React32.createElement("div", {
|
|
2118
2391
|
role: "none",
|
|
2119
2392
|
className: "grow flex flex-col justify-center"
|
|
2120
|
-
}, /* @__PURE__ */
|
|
2393
|
+
}, /* @__PURE__ */ React32.createElement("p", {
|
|
2121
2394
|
className: "text-center text-sm font-normal"
|
|
2122
|
-
}, t("welcome message"))), /* @__PURE__ */
|
|
2395
|
+
}, t("welcome message"))), /* @__PURE__ */ React32.createElement(Actions, null, doneActionParent ? /* @__PURE__ */ cloneElement3(doneActionParent, {}, doneAction) : doneAction));
|
|
2123
2396
|
};
|
|
2124
2397
|
|
|
2125
2398
|
// packages/sdk/shell/src/panels/JoinPanel/steps/InvitationInput.tsx
|
|
2126
|
-
import
|
|
2399
|
+
import React33, { useState as useState6, useEffect as useEffect4, cloneElement as cloneElement4 } from "react";
|
|
2127
2400
|
import { log as log6 } from "@dxos/log";
|
|
2128
|
-
import { useTranslation as
|
|
2129
|
-
var
|
|
2401
|
+
import { useTranslation as useTranslation19 } from "@dxos/react-ui";
|
|
2402
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/steps/InvitationInput.tsx";
|
|
2130
2403
|
var invitationCodeFromUrl = (text) => {
|
|
2131
2404
|
try {
|
|
2132
2405
|
const searchParams = new URLSearchParams(text.substring(text.lastIndexOf("?")));
|
|
@@ -2134,7 +2407,7 @@ var invitationCodeFromUrl = (text) => {
|
|
|
2134
2407
|
return invitation ?? text;
|
|
2135
2408
|
} catch (err) {
|
|
2136
2409
|
log6.catch(err, void 0, {
|
|
2137
|
-
F:
|
|
2410
|
+
F: __dxlog_file7,
|
|
2138
2411
|
L: 25,
|
|
2139
2412
|
S: void 0,
|
|
2140
2413
|
C: (f, a) => f(...a)
|
|
@@ -2145,9 +2418,9 @@ var invitationCodeFromUrl = (text) => {
|
|
|
2145
2418
|
var InvitationInput = (props) => {
|
|
2146
2419
|
const { Kind, active, send, unredeemedCode, onExit, exitActionParent, onDone, doneActionParent, succeededKeys } = props;
|
|
2147
2420
|
const disabled = !active;
|
|
2148
|
-
const { t } =
|
|
2149
|
-
const [inputValue, setInputValue] =
|
|
2150
|
-
|
|
2421
|
+
const { t } = useTranslation19("os");
|
|
2422
|
+
const [inputValue, setInputValue] = useState6(unredeemedCode ?? "");
|
|
2423
|
+
useEffect4(() => {
|
|
2151
2424
|
unredeemedCode && setInputValue(unredeemedCode ?? "");
|
|
2152
2425
|
}, [
|
|
2153
2426
|
unredeemedCode
|
|
@@ -2159,7 +2432,7 @@ var InvitationInput = (props) => {
|
|
|
2159
2432
|
succeededKeys
|
|
2160
2433
|
}
|
|
2161
2434
|
});
|
|
2162
|
-
const exitAction = /* @__PURE__ */
|
|
2435
|
+
const exitAction = /* @__PURE__ */ React33.createElement(Action, {
|
|
2163
2436
|
variant: "ghost",
|
|
2164
2437
|
disabled,
|
|
2165
2438
|
...onExit ? {
|
|
@@ -2169,11 +2442,11 @@ var InvitationInput = (props) => {
|
|
|
2169
2442
|
},
|
|
2170
2443
|
"data-testid": "join-exit"
|
|
2171
2444
|
}, t("cancel label"));
|
|
2172
|
-
return /* @__PURE__ */
|
|
2445
|
+
return /* @__PURE__ */ React33.createElement(React33.Fragment, null, /* @__PURE__ */ React33.createElement("div", {
|
|
2173
2446
|
role: "none",
|
|
2174
2447
|
className: "grow flex flex-col justify-center"
|
|
2175
|
-
}, /* @__PURE__ */
|
|
2176
|
-
label: /* @__PURE__ */
|
|
2448
|
+
}, /* @__PURE__ */ React33.createElement(Input, {
|
|
2449
|
+
label: /* @__PURE__ */ React33.createElement(StepHeading, null, t("invitation input label")),
|
|
2177
2450
|
placeholder: "Type an invitation code",
|
|
2178
2451
|
disabled,
|
|
2179
2452
|
value: inputValue,
|
|
@@ -2181,14 +2454,14 @@ var InvitationInput = (props) => {
|
|
|
2181
2454
|
"data-autofocus": `inputting${Kind}InvitationCode`,
|
|
2182
2455
|
"data-testid": `${Kind.toLowerCase()}-invitation-input`,
|
|
2183
2456
|
onKeyUp: ({ key }) => key === "Enter" && handleNext()
|
|
2184
|
-
})), /* @__PURE__ */
|
|
2457
|
+
})), /* @__PURE__ */ React33.createElement(Actions, null, Kind === "Halo" ? /* @__PURE__ */ React33.createElement(Action, {
|
|
2185
2458
|
variant: "ghost",
|
|
2186
2459
|
disabled,
|
|
2187
2460
|
onClick: () => send({
|
|
2188
2461
|
type: "deselectAuthMethod"
|
|
2189
2462
|
}),
|
|
2190
2463
|
"data-testid": `${Kind.toLowerCase()}-invitation-input-back`
|
|
2191
|
-
}, t("back label")) : exitActionParent ? /* @__PURE__ */ cloneElement4(exitActionParent, {}, exitAction) : doneActionParent ? /* @__PURE__ */ cloneElement4(doneActionParent, {}, exitAction) : exitAction, /* @__PURE__ */
|
|
2464
|
+
}, t("back label")) : exitActionParent ? /* @__PURE__ */ cloneElement4(exitActionParent, {}, exitAction) : doneActionParent ? /* @__PURE__ */ cloneElement4(doneActionParent, {}, exitAction) : exitAction, /* @__PURE__ */ React33.createElement(Action, {
|
|
2192
2465
|
variant: "primary",
|
|
2193
2466
|
disabled,
|
|
2194
2467
|
onClick: handleNext,
|
|
@@ -2197,8 +2470,8 @@ var InvitationInput = (props) => {
|
|
|
2197
2470
|
};
|
|
2198
2471
|
|
|
2199
2472
|
// packages/sdk/shell/src/panels/JoinPanel/steps/InvitationRescuer.tsx
|
|
2200
|
-
import
|
|
2201
|
-
import { useTranslation as
|
|
2473
|
+
import React34 from "react";
|
|
2474
|
+
import { useTranslation as useTranslation20 } from "@dxos/react-ui";
|
|
2202
2475
|
import { descriptionText as descriptionText9 } from "@dxos/react-ui-theme";
|
|
2203
2476
|
var InvitationActions = ({
|
|
2204
2477
|
// `invitationState` does report correct state, but here we evaluate whether `failReason` is a better source of truth
|
|
@@ -2210,14 +2483,14 @@ var InvitationActions = ({
|
|
|
2210
2483
|
Kind,
|
|
2211
2484
|
failReason
|
|
2212
2485
|
}) => {
|
|
2213
|
-
const { t } =
|
|
2486
|
+
const { t } = useTranslation20("os");
|
|
2214
2487
|
if (failReason) {
|
|
2215
|
-
return /* @__PURE__ */
|
|
2488
|
+
return /* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement(StepHeading, {
|
|
2216
2489
|
className: descriptionText9
|
|
2217
|
-
}, t(failReason === "timeout" ? "timeout status label" : failReason === "cancelled" ? "cancelled status label" : "error status label")), /* @__PURE__ */
|
|
2490
|
+
}, t(failReason === "timeout" ? "timeout status label" : failReason === "cancelled" ? "cancelled status label" : "error status label")), /* @__PURE__ */ React34.createElement("div", {
|
|
2218
2491
|
role: "none",
|
|
2219
2492
|
className: "grow"
|
|
2220
|
-
}), /* @__PURE__ */
|
|
2493
|
+
}), /* @__PURE__ */ React34.createElement(Actions, null, /* @__PURE__ */ React34.createElement(Action, {
|
|
2221
2494
|
disabled: !active,
|
|
2222
2495
|
onClick: () => send({
|
|
2223
2496
|
type: `reset${Kind}Invitation`
|
|
@@ -2225,16 +2498,16 @@ var InvitationActions = ({
|
|
|
2225
2498
|
"data-testid": "invitation-rescuer-reset"
|
|
2226
2499
|
}, t("reset label"))));
|
|
2227
2500
|
} else {
|
|
2228
|
-
return /* @__PURE__ */
|
|
2501
|
+
return /* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement(StepHeading, {
|
|
2229
2502
|
className: descriptionText9
|
|
2230
|
-
}, t("connecting status label")), /* @__PURE__ */
|
|
2503
|
+
}, t("connecting status label")), /* @__PURE__ */ React34.createElement("div", {
|
|
2231
2504
|
role: "none",
|
|
2232
2505
|
className: "grow"
|
|
2233
|
-
}), /* @__PURE__ */
|
|
2506
|
+
}), /* @__PURE__ */ React34.createElement(Actions, null, /* @__PURE__ */ React34.createElement(Action, {
|
|
2234
2507
|
disabled: true,
|
|
2235
2508
|
classNames: "order-2",
|
|
2236
2509
|
"data-testid": "next"
|
|
2237
|
-
}, t("next label")), /* @__PURE__ */
|
|
2510
|
+
}, t("next label")), /* @__PURE__ */ React34.createElement(Action, {
|
|
2238
2511
|
disabled: !active,
|
|
2239
2512
|
onClick: onInvitationCancel,
|
|
2240
2513
|
"data-testid": "invitation-rescuer-cancel"
|
|
@@ -2243,46 +2516,46 @@ var InvitationActions = ({
|
|
|
2243
2516
|
};
|
|
2244
2517
|
var InvitationRescuer = (props) => {
|
|
2245
2518
|
const { Kind, invitationState, active, send } = props;
|
|
2246
|
-
const { t } =
|
|
2247
|
-
return /* @__PURE__ */
|
|
2519
|
+
const { t } = useTranslation20("os");
|
|
2520
|
+
return /* @__PURE__ */ React34.createElement(React34.Fragment, null, typeof invitationState === "undefined" ? /* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement("div", {
|
|
2248
2521
|
role: "none",
|
|
2249
2522
|
className: "grow flex flex-col justify-center"
|
|
2250
|
-
}, /* @__PURE__ */
|
|
2523
|
+
}, /* @__PURE__ */ React34.createElement(StepHeading, {
|
|
2251
2524
|
className: descriptionText9
|
|
2252
|
-
}, "There was a problem joining the space")), /* @__PURE__ */
|
|
2525
|
+
}, "There was a problem joining the space")), /* @__PURE__ */ React34.createElement(Actions, null, /* @__PURE__ */ React34.createElement(Action, {
|
|
2253
2526
|
disabled: !active,
|
|
2254
2527
|
"data-testid": "invitation-rescuer-blank-reset",
|
|
2255
2528
|
onClick: () => send({
|
|
2256
2529
|
type: `reset${Kind}Invitation`
|
|
2257
2530
|
})
|
|
2258
|
-
}, t("reset label")))) : /* @__PURE__ */
|
|
2531
|
+
}, t("reset label")))) : /* @__PURE__ */ React34.createElement(InvitationActions, props));
|
|
2259
2532
|
};
|
|
2260
2533
|
|
|
2261
2534
|
// packages/sdk/shell/src/panels/JoinPanel/steps/InvitationAuthenticator.tsx
|
|
2262
|
-
import
|
|
2263
|
-
import { Input as Input2, useTranslation as
|
|
2535
|
+
import React35, { useState as useState7 } from "react";
|
|
2536
|
+
import { Input as Input2, useTranslation as useTranslation21 } from "@dxos/react-ui";
|
|
2264
2537
|
var pinLength = 6;
|
|
2265
2538
|
var InvitationAuthenticator = ({ failed, Kind, active, pending, invitationId, onInvitationAuthenticate, onInvitationCancel }) => {
|
|
2266
2539
|
const disabled = !active || pending;
|
|
2267
|
-
const { t } =
|
|
2540
|
+
const { t } = useTranslation21("os");
|
|
2268
2541
|
const invitationType = Kind.toLowerCase();
|
|
2269
|
-
const [authCode, setAuthCode] =
|
|
2542
|
+
const [authCode, setAuthCode] = useState7("");
|
|
2270
2543
|
const onChange = ({ target: { value } }) => {
|
|
2271
2544
|
setAuthCode(value);
|
|
2272
2545
|
if (value.length === pinLength) {
|
|
2273
2546
|
document.querySelector(`[data-autofocus-pinlength="${invitationType}"]`)?.focus();
|
|
2274
2547
|
}
|
|
2275
2548
|
};
|
|
2276
|
-
return /* @__PURE__ */
|
|
2549
|
+
return /* @__PURE__ */ React35.createElement(React35.Fragment, null, /* @__PURE__ */ React35.createElement("div", {
|
|
2277
2550
|
role: "none",
|
|
2278
2551
|
className: "grow flex flex-col justify-center"
|
|
2279
|
-
}, invitationId && /* @__PURE__ */
|
|
2552
|
+
}, invitationId && /* @__PURE__ */ React35.createElement(Emoji, {
|
|
2280
2553
|
text: toEmoji(invitationId)
|
|
2281
|
-
}), /* @__PURE__ */
|
|
2554
|
+
}), /* @__PURE__ */ React35.createElement(Input2.Root, failed && {
|
|
2282
2555
|
validationValence: "error"
|
|
2283
|
-
}, /* @__PURE__ */
|
|
2556
|
+
}, /* @__PURE__ */ React35.createElement(Input2.Label, {
|
|
2284
2557
|
asChild: true
|
|
2285
|
-
}, /* @__PURE__ */
|
|
2558
|
+
}, /* @__PURE__ */ React35.createElement(StepHeading, null, t("auth code input label"))), /* @__PURE__ */ React35.createElement(Input2.PinInput, {
|
|
2286
2559
|
disabled,
|
|
2287
2560
|
length: pinLength,
|
|
2288
2561
|
onChange,
|
|
@@ -2293,14 +2566,14 @@ var InvitationAuthenticator = ({ failed, Kind, active, pending, invitationId, on
|
|
|
2293
2566
|
"data-prevent-ios-autofocus": true,
|
|
2294
2567
|
"data-testid": `${invitationType}-auth-code-input`,
|
|
2295
2568
|
"data-1p-ignore": true
|
|
2296
|
-
}), failed && /* @__PURE__ */
|
|
2569
|
+
}), failed && /* @__PURE__ */ React35.createElement(Input2.DescriptionAndValidation, {
|
|
2297
2570
|
classNames: "text-center"
|
|
2298
|
-
}, /* @__PURE__ */
|
|
2571
|
+
}, /* @__PURE__ */ React35.createElement(Input2.Validation, null, t("failed to authenticate message"))))), /* @__PURE__ */ React35.createElement(Actions, null, /* @__PURE__ */ React35.createElement(Action, {
|
|
2299
2572
|
variant: "ghost",
|
|
2300
2573
|
disabled,
|
|
2301
2574
|
onClick: () => onInvitationCancel?.(),
|
|
2302
2575
|
"data-testid": `${invitationType}-invitation-authenticator-cancel`
|
|
2303
|
-
}, t("cancel label")), /* @__PURE__ */
|
|
2576
|
+
}, t("cancel label")), /* @__PURE__ */ React35.createElement(Action, {
|
|
2304
2577
|
variant: "primary",
|
|
2305
2578
|
disabled,
|
|
2306
2579
|
onClick: () => onInvitationAuthenticate?.(authCode),
|
|
@@ -2310,21 +2583,21 @@ var InvitationAuthenticator = ({ failed, Kind, active, pending, invitationId, on
|
|
|
2310
2583
|
};
|
|
2311
2584
|
|
|
2312
2585
|
// packages/sdk/shell/src/panels/JoinPanel/steps/ResetIdentity.tsx
|
|
2313
|
-
import
|
|
2586
|
+
import React36, { useState as useState8 } from "react";
|
|
2314
2587
|
import { log as log7 } from "@dxos/log";
|
|
2315
|
-
import { useClient as
|
|
2316
|
-
import { useTranslation as
|
|
2317
|
-
var
|
|
2588
|
+
import { useClient as useClient6 } from "@dxos/react-client";
|
|
2589
|
+
import { useTranslation as useTranslation22 } from "@dxos/react-ui";
|
|
2590
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/steps/ResetIdentity.tsx";
|
|
2318
2591
|
var ResetIdentity = ({ send, active }) => {
|
|
2319
|
-
const client =
|
|
2320
|
-
const { t } =
|
|
2321
|
-
const [validationMessage, setValidationMessage] =
|
|
2592
|
+
const client = useClient6();
|
|
2593
|
+
const { t } = useTranslation22("os");
|
|
2594
|
+
const [validationMessage, setValidationMessage] = useState8("");
|
|
2322
2595
|
const resetIdentity = () => {
|
|
2323
2596
|
void client.reset().then(() => send?.({
|
|
2324
2597
|
type: "resetIdentity"
|
|
2325
2598
|
}), (error) => {
|
|
2326
2599
|
log7.catch(error, void 0, {
|
|
2327
|
-
F:
|
|
2600
|
+
F: __dxlog_file8,
|
|
2328
2601
|
L: 32,
|
|
2329
2602
|
S: void 0,
|
|
2330
2603
|
C: (f, a) => f(...a)
|
|
@@ -2332,29 +2605,29 @@ var ResetIdentity = ({ send, active }) => {
|
|
|
2332
2605
|
setValidationMessage(t("failed to reset identity message"));
|
|
2333
2606
|
});
|
|
2334
2607
|
};
|
|
2335
|
-
return /* @__PURE__ */
|
|
2608
|
+
return /* @__PURE__ */ React36.createElement(ResetIdentityImpl, {
|
|
2336
2609
|
disabled: !active,
|
|
2337
2610
|
validationMessage,
|
|
2338
2611
|
onConfirm: () => resetIdentity()
|
|
2339
2612
|
});
|
|
2340
2613
|
};
|
|
2341
2614
|
var ResetIdentityImpl = ({ disabled, validationMessage, onConfirm }) => {
|
|
2342
|
-
const { t } =
|
|
2615
|
+
const { t } = useTranslation22("os");
|
|
2343
2616
|
const confirmationValue = t("confirmation value");
|
|
2344
|
-
const [inputValue, setInputValue] =
|
|
2345
|
-
return /* @__PURE__ */
|
|
2617
|
+
const [inputValue, setInputValue] = useState8("");
|
|
2618
|
+
return /* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement("div", {
|
|
2346
2619
|
role: "none",
|
|
2347
2620
|
className: "grow flex flex-col justify-center"
|
|
2348
|
-
}, /* @__PURE__ */
|
|
2621
|
+
}, /* @__PURE__ */ React36.createElement(Input, {
|
|
2349
2622
|
validationMessage,
|
|
2350
|
-
label: /* @__PURE__ */
|
|
2623
|
+
label: /* @__PURE__ */ React36.createElement(StepHeading, null, t("reset identity input label", {
|
|
2351
2624
|
confirmationValue
|
|
2352
2625
|
})),
|
|
2353
2626
|
disabled,
|
|
2354
2627
|
"data-testid": "identity-input",
|
|
2355
2628
|
placeholder: confirmationValue,
|
|
2356
2629
|
onChange: ({ target: { value } }) => setInputValue(value)
|
|
2357
|
-
})), /* @__PURE__ */
|
|
2630
|
+
})), /* @__PURE__ */ React36.createElement(Actions, null, /* @__PURE__ */ React36.createElement(Action, {
|
|
2358
2631
|
// TODO(wittjosiah): Probably make this red?
|
|
2359
2632
|
variant: "primary",
|
|
2360
2633
|
disabled: disabled || inputValue !== confirmationValue,
|
|
@@ -2367,7 +2640,7 @@ var ResetIdentityImpl = ({ disabled, validationMessage, onConfirm }) => {
|
|
|
2367
2640
|
var stepStyles = "pbs-1 pbe-3 pli-3";
|
|
2368
2641
|
|
|
2369
2642
|
// packages/sdk/shell/src/styles/invitationStatusStyles.ts
|
|
2370
|
-
import { Invitation as
|
|
2643
|
+
import { Invitation as Invitation7 } from "@dxos/react-client/invitations";
|
|
2371
2644
|
var inactiveBgColor = "bg-neutral-100 dark:bg-neutral-600";
|
|
2372
2645
|
var activeBgColor = "bg-primary-500 dark:bg-primary-400";
|
|
2373
2646
|
var successBgColor = "bg-success-500 dark:bg-success-400";
|
|
@@ -2383,55 +2656,55 @@ var activeStrokeColor = "stroke-primary-400 dark:stroke-primary-150";
|
|
|
2383
2656
|
var successStrokeColor = "stroke-success-300 dark:stroke-primary-400";
|
|
2384
2657
|
var errorStrokeColor = "stroke-error-300 dark:stroke-error-500";
|
|
2385
2658
|
var cancelledStrokeColor = "stroke-warning-300 dark:stroke-warning-500";
|
|
2386
|
-
var resolvedStrokeColor = (status) => status ===
|
|
2387
|
-
var resolvedBgColor = (status) => status ===
|
|
2388
|
-
var resolvedTextColor = (status) => status ===
|
|
2659
|
+
var resolvedStrokeColor = (status) => status === Invitation7.State.ERROR ? errorStrokeColor : status === Invitation7.State.CANCELLED || status === Invitation7.State.TIMEOUT ? cancelledStrokeColor : successStrokeColor;
|
|
2660
|
+
var resolvedBgColor = (status) => status === Invitation7.State.ERROR ? errorBgColor : status === Invitation7.State.CANCELLED || status === Invitation7.State.TIMEOUT ? cancelledBgColor : successBgColor;
|
|
2661
|
+
var resolvedTextColor = (status) => status === Invitation7.State.ERROR ? errorTextColor : status === Invitation7.State.CANCELLED || status === Invitation7.State.TIMEOUT ? cancelledTextColor : successTextColor;
|
|
2389
2662
|
|
|
2390
2663
|
// packages/sdk/shell/src/panels/JoinPanel/JoinPanel.tsx
|
|
2391
|
-
var
|
|
2664
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/JoinPanel.tsx";
|
|
2392
2665
|
var JoinPanelImpl = (props) => {
|
|
2393
2666
|
const { titleId, send, activeView, failed, mode, unredeemedCodes, invitationStates, succeededKeys, failReasons, onExit, onHaloDone, onSpaceDone, exitActionParent, doneActionParent, onHaloInvitationCancel, onSpaceInvitationCancel, onHaloInvitationAuthenticate, onSpaceInvitationAuthenticate, IdentityInput: IdentityInputComponent = IdentityInput, ResetIdentity: ResetIdentityComponent = ResetIdentity } = props;
|
|
2394
|
-
return /* @__PURE__ */
|
|
2667
|
+
return /* @__PURE__ */ React37.createElement(DensityProvider3, {
|
|
2395
2668
|
density: "fine"
|
|
2396
|
-
}, mode !== "halo-only" && /* @__PURE__ */
|
|
2669
|
+
}, mode !== "halo-only" && /* @__PURE__ */ React37.createElement(JoinHeading, {
|
|
2397
2670
|
titleId,
|
|
2398
2671
|
mode,
|
|
2399
2672
|
onExit,
|
|
2400
2673
|
exitActionParent
|
|
2401
|
-
}), /* @__PURE__ */
|
|
2674
|
+
}), /* @__PURE__ */ React37.createElement(Viewport.Root, {
|
|
2402
2675
|
focusManaged: true,
|
|
2403
2676
|
activeView
|
|
2404
|
-
}, /* @__PURE__ */
|
|
2677
|
+
}, /* @__PURE__ */ React37.createElement(Viewport.Views, null, /* @__PURE__ */ React37.createElement(Viewport.View, {
|
|
2405
2678
|
classNames: stepStyles,
|
|
2406
2679
|
id: "addition method chooser"
|
|
2407
|
-
}, /* @__PURE__ */
|
|
2680
|
+
}, /* @__PURE__ */ React37.createElement(AdditionMethodChooser, {
|
|
2408
2681
|
send,
|
|
2409
2682
|
active: activeView === "addition method chooser"
|
|
2410
|
-
})), /* @__PURE__ */
|
|
2683
|
+
})), /* @__PURE__ */ React37.createElement(Viewport.View, {
|
|
2411
2684
|
classNames: stepStyles,
|
|
2412
2685
|
id: "reset identity confirmation"
|
|
2413
|
-
}, /* @__PURE__ */
|
|
2686
|
+
}, /* @__PURE__ */ React37.createElement(ResetIdentityComponent, {
|
|
2414
2687
|
send,
|
|
2415
2688
|
method: "reset identity",
|
|
2416
2689
|
active: activeView === "reset identity confirmation"
|
|
2417
|
-
})), /* @__PURE__ */
|
|
2690
|
+
})), /* @__PURE__ */ React37.createElement(Viewport.View, {
|
|
2418
2691
|
classNames: stepStyles,
|
|
2419
2692
|
id: "create identity input"
|
|
2420
|
-
}, /* @__PURE__ */
|
|
2693
|
+
}, /* @__PURE__ */ React37.createElement(IdentityInputComponent, {
|
|
2421
2694
|
send,
|
|
2422
2695
|
method: "create identity",
|
|
2423
2696
|
active: activeView === "create identity input"
|
|
2424
|
-
})), /* @__PURE__ */
|
|
2697
|
+
})), /* @__PURE__ */ React37.createElement(Viewport.View, {
|
|
2425
2698
|
classNames: stepStyles,
|
|
2426
2699
|
id: "recover identity input"
|
|
2427
|
-
}, /* @__PURE__ */
|
|
2700
|
+
}, /* @__PURE__ */ React37.createElement(IdentityInputComponent, {
|
|
2428
2701
|
send,
|
|
2429
2702
|
method: "recover identity",
|
|
2430
2703
|
active: activeView === "recover identity input"
|
|
2431
|
-
})), /* @__PURE__ */
|
|
2704
|
+
})), /* @__PURE__ */ React37.createElement(Viewport.View, {
|
|
2432
2705
|
classNames: stepStyles,
|
|
2433
2706
|
id: "halo invitation input"
|
|
2434
|
-
}, /* @__PURE__ */
|
|
2707
|
+
}, /* @__PURE__ */ React37.createElement(InvitationInput, {
|
|
2435
2708
|
send,
|
|
2436
2709
|
Kind: "Halo",
|
|
2437
2710
|
active: activeView === "halo invitation input",
|
|
@@ -2441,20 +2714,20 @@ var JoinPanelImpl = (props) => {
|
|
|
2441
2714
|
...succeededKeys?.Halo && {
|
|
2442
2715
|
succeededKeys: succeededKeys.Halo
|
|
2443
2716
|
}
|
|
2444
|
-
})), /* @__PURE__ */
|
|
2717
|
+
})), /* @__PURE__ */ React37.createElement(Viewport.View, {
|
|
2445
2718
|
classNames: stepStyles,
|
|
2446
2719
|
id: "halo invitation rescuer"
|
|
2447
|
-
}, /* @__PURE__ */
|
|
2720
|
+
}, /* @__PURE__ */ React37.createElement(InvitationRescuer, {
|
|
2448
2721
|
send,
|
|
2449
2722
|
Kind: "Halo",
|
|
2450
2723
|
active: activeView === "halo invitation rescuer",
|
|
2451
2724
|
invitationState: invitationStates?.Halo,
|
|
2452
2725
|
onInvitationCancel: onHaloInvitationCancel,
|
|
2453
2726
|
failReason: failReasons?.Halo
|
|
2454
|
-
})), /* @__PURE__ */
|
|
2727
|
+
})), /* @__PURE__ */ React37.createElement(Viewport.View, {
|
|
2455
2728
|
classNames: stepStyles,
|
|
2456
2729
|
id: "halo invitation authenticator"
|
|
2457
|
-
}, /* @__PURE__ */
|
|
2730
|
+
}, /* @__PURE__ */ React37.createElement(InvitationAuthenticator, {
|
|
2458
2731
|
send,
|
|
2459
2732
|
Kind: "Halo",
|
|
2460
2733
|
active: activeView === "halo invitation authenticator",
|
|
@@ -2463,28 +2736,28 @@ var JoinPanelImpl = (props) => {
|
|
|
2463
2736
|
...failed.has("Halo") && {
|
|
2464
2737
|
failed: true
|
|
2465
2738
|
}
|
|
2466
|
-
})), /* @__PURE__ */
|
|
2739
|
+
})), /* @__PURE__ */ React37.createElement(Viewport.View, {
|
|
2467
2740
|
classNames: stepStyles,
|
|
2468
2741
|
id: "halo invitation accepted"
|
|
2469
|
-
}, /* @__PURE__ */
|
|
2742
|
+
}, /* @__PURE__ */ React37.createElement(InvitationAccepted, {
|
|
2470
2743
|
send,
|
|
2471
2744
|
Kind: "Halo",
|
|
2472
2745
|
active: activeView === "halo invitation accepted",
|
|
2473
2746
|
doneActionParent,
|
|
2474
2747
|
onDone: onHaloDone
|
|
2475
|
-
})), /* @__PURE__ */
|
|
2748
|
+
})), /* @__PURE__ */ React37.createElement(Viewport.View, {
|
|
2476
2749
|
classNames: stepStyles,
|
|
2477
2750
|
id: "identity added"
|
|
2478
|
-
}, /* @__PURE__ */
|
|
2751
|
+
}, /* @__PURE__ */ React37.createElement(IdentityAdded, {
|
|
2479
2752
|
send,
|
|
2480
2753
|
mode,
|
|
2481
2754
|
active: activeView === "identity added",
|
|
2482
2755
|
doneActionParent,
|
|
2483
2756
|
onDone: onHaloDone
|
|
2484
|
-
})), /* @__PURE__ */
|
|
2757
|
+
})), /* @__PURE__ */ React37.createElement(Viewport.View, {
|
|
2485
2758
|
classNames: stepStyles,
|
|
2486
2759
|
id: "space invitation input"
|
|
2487
|
-
}, /* @__PURE__ */
|
|
2760
|
+
}, /* @__PURE__ */ React37.createElement(InvitationInput, {
|
|
2488
2761
|
send,
|
|
2489
2762
|
Kind: "Space",
|
|
2490
2763
|
active: activeView === "space invitation input",
|
|
@@ -2496,20 +2769,20 @@ var JoinPanelImpl = (props) => {
|
|
|
2496
2769
|
},
|
|
2497
2770
|
onExit,
|
|
2498
2771
|
exitActionParent
|
|
2499
|
-
})), /* @__PURE__ */
|
|
2772
|
+
})), /* @__PURE__ */ React37.createElement(Viewport.View, {
|
|
2500
2773
|
classNames: stepStyles,
|
|
2501
2774
|
id: "space invitation rescuer"
|
|
2502
|
-
}, /* @__PURE__ */
|
|
2775
|
+
}, /* @__PURE__ */ React37.createElement(InvitationRescuer, {
|
|
2503
2776
|
send,
|
|
2504
2777
|
Kind: "Space",
|
|
2505
2778
|
active: activeView === "space invitation rescuer",
|
|
2506
2779
|
invitationState: invitationStates?.Space,
|
|
2507
2780
|
onInvitationCancel: onSpaceInvitationCancel,
|
|
2508
2781
|
failReason: failReasons?.Space
|
|
2509
|
-
})), /* @__PURE__ */
|
|
2782
|
+
})), /* @__PURE__ */ React37.createElement(Viewport.View, {
|
|
2510
2783
|
classNames: stepStyles,
|
|
2511
2784
|
id: "space invitation authenticator"
|
|
2512
|
-
}, /* @__PURE__ */
|
|
2785
|
+
}, /* @__PURE__ */ React37.createElement(InvitationAuthenticator, {
|
|
2513
2786
|
send,
|
|
2514
2787
|
Kind: "Space",
|
|
2515
2788
|
active: activeView === "space invitation authenticator",
|
|
@@ -2518,10 +2791,10 @@ var JoinPanelImpl = (props) => {
|
|
|
2518
2791
|
...failed.has("Space") && {
|
|
2519
2792
|
failed: true
|
|
2520
2793
|
}
|
|
2521
|
-
})), /* @__PURE__ */
|
|
2794
|
+
})), /* @__PURE__ */ React37.createElement(Viewport.View, {
|
|
2522
2795
|
classNames: stepStyles,
|
|
2523
2796
|
id: "space invitation accepted"
|
|
2524
|
-
}, /* @__PURE__ */
|
|
2797
|
+
}, /* @__PURE__ */ React37.createElement(InvitationAccepted, {
|
|
2525
2798
|
send,
|
|
2526
2799
|
Kind: "Space",
|
|
2527
2800
|
active: activeView === "space invitation accepted",
|
|
@@ -2530,7 +2803,7 @@ var JoinPanelImpl = (props) => {
|
|
|
2530
2803
|
})))));
|
|
2531
2804
|
};
|
|
2532
2805
|
var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialInvitationCode, exitActionParent, onExit, doneActionParent, onDone: propsOnDone }) => {
|
|
2533
|
-
const client =
|
|
2806
|
+
const client = useClient7();
|
|
2534
2807
|
const identity = useIdentity2();
|
|
2535
2808
|
const { hasIosKeyboard } = useThemeContext3();
|
|
2536
2809
|
const titleId = useId7("joinPanel__heading", propsTitleId);
|
|
@@ -2545,12 +2818,11 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialInvitationCod
|
|
|
2545
2818
|
}
|
|
2546
2819
|
}
|
|
2547
2820
|
});
|
|
2548
|
-
|
|
2549
|
-
useEffect4(() => {
|
|
2821
|
+
useEffect5(() => {
|
|
2550
2822
|
const subscription = joinService.subscribe((state) => {
|
|
2551
2823
|
log8("[state]", state, {
|
|
2552
|
-
F:
|
|
2553
|
-
L:
|
|
2824
|
+
F: __dxlog_file9,
|
|
2825
|
+
L: 198,
|
|
2554
2826
|
S: void 0,
|
|
2555
2827
|
C: (f, a) => f(...a)
|
|
2556
2828
|
});
|
|
@@ -2559,7 +2831,7 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialInvitationCod
|
|
|
2559
2831
|
}, [
|
|
2560
2832
|
joinService
|
|
2561
2833
|
]);
|
|
2562
|
-
|
|
2834
|
+
useEffect5(() => {
|
|
2563
2835
|
const stateStack = joinState.configuration[0].id.split(".");
|
|
2564
2836
|
const innermostState = stateStack[stateStack.length - 1];
|
|
2565
2837
|
const autoFocusValue = innermostState === "finishingJoining" ? "successSpaceInvitation" : innermostState;
|
|
@@ -2740,27 +3012,29 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialInvitationCod
|
|
|
2740
3012
|
}), [
|
|
2741
3013
|
joinState
|
|
2742
3014
|
]);
|
|
2743
|
-
const onHaloDone =
|
|
3015
|
+
const onHaloDone = useCallback7(() => {
|
|
2744
3016
|
propsOnDone?.({
|
|
2745
3017
|
identityKey: joinState.context.halo.invitation?.identityKey ?? null,
|
|
2746
3018
|
swarmKey: joinState.context.halo.invitation?.swarmKey ?? null,
|
|
2747
|
-
spaceKey: joinState.context.halo.invitation?.spaceKey ?? null
|
|
3019
|
+
spaceKey: joinState.context.halo.invitation?.spaceKey ?? null,
|
|
3020
|
+
target: joinState.context.halo.invitation?.target ?? null
|
|
2748
3021
|
});
|
|
2749
3022
|
}, [
|
|
2750
3023
|
joinState,
|
|
2751
3024
|
propsOnDone
|
|
2752
3025
|
]);
|
|
2753
|
-
const onSpaceDone =
|
|
3026
|
+
const onSpaceDone = useCallback7(() => {
|
|
2754
3027
|
propsOnDone?.({
|
|
2755
3028
|
identityKey: joinState.context.space.invitation?.identityKey ?? null,
|
|
2756
3029
|
swarmKey: joinState.context.space.invitation?.swarmKey ?? null,
|
|
2757
|
-
spaceKey: joinState.context.space.invitation?.spaceKey ?? null
|
|
3030
|
+
spaceKey: joinState.context.space.invitation?.spaceKey ?? null,
|
|
3031
|
+
target: joinState.context.space.invitation?.target ?? null
|
|
2758
3032
|
});
|
|
2759
3033
|
}, [
|
|
2760
3034
|
joinState,
|
|
2761
3035
|
propsOnDone
|
|
2762
3036
|
]);
|
|
2763
|
-
return /* @__PURE__ */
|
|
3037
|
+
return /* @__PURE__ */ React37.createElement(JoinPanelImpl, {
|
|
2764
3038
|
titleId,
|
|
2765
3039
|
mode,
|
|
2766
3040
|
send: joinSend,
|
|
@@ -2799,16 +3073,16 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialInvitationCod
|
|
|
2799
3073
|
|
|
2800
3074
|
// packages/sdk/shell/src/panels/SpacePanel/SpacePanel.tsx
|
|
2801
3075
|
import { Planet } from "@phosphor-icons/react";
|
|
2802
|
-
import
|
|
3076
|
+
import React39, { useEffect as useEffect6, useMemo as useMemo5 } from "react";
|
|
2803
3077
|
import { log as log10 } from "@dxos/log";
|
|
2804
3078
|
import { useInvitationStatus as useInvitationStatus3 } from "@dxos/react-client/invitations";
|
|
2805
|
-
import { DensityProvider as DensityProvider4, useId as useId8, useTranslation as
|
|
3079
|
+
import { DensityProvider as DensityProvider4, useId as useId8, useTranslation as useTranslation24 } from "@dxos/react-ui";
|
|
2806
3080
|
|
|
2807
3081
|
// packages/sdk/shell/src/panels/SpacePanel/spaceMachine.ts
|
|
2808
3082
|
import { useMachine as useMachine3 } from "@xstate/react";
|
|
2809
3083
|
import { assign as assign3, createMachine as createMachine3 } from "xstate";
|
|
2810
3084
|
import { log as log9 } from "@dxos/log";
|
|
2811
|
-
var
|
|
3085
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/SpacePanel/spaceMachine.ts";
|
|
2812
3086
|
var spaceMachine = createMachine3({
|
|
2813
3087
|
id: "space",
|
|
2814
3088
|
predictableActionArguments: true,
|
|
@@ -2849,7 +3123,7 @@ var spaceMachine = createMachine3({
|
|
|
2849
3123
|
event,
|
|
2850
3124
|
context
|
|
2851
3125
|
}, {
|
|
2852
|
-
F:
|
|
3126
|
+
F: __dxlog_file10,
|
|
2853
3127
|
L: 53,
|
|
2854
3128
|
S: void 0,
|
|
2855
3129
|
C: (f, a) => f(...a)
|
|
@@ -2868,21 +3142,21 @@ var useSpaceMachine = (options) => {
|
|
|
2868
3142
|
|
|
2869
3143
|
// packages/sdk/shell/src/panels/SpacePanel/steps/SpaceManager.tsx
|
|
2870
3144
|
import { Placeholder as Placeholder2, UserPlus, UsersThree } from "@phosphor-icons/react";
|
|
2871
|
-
import
|
|
3145
|
+
import React38, { useCallback as useCallback8, useState as useState9 } from "react";
|
|
2872
3146
|
import { useConfig } from "@dxos/react-client";
|
|
2873
3147
|
import { useSpaceInvitations as useSpaceInvitations2 } from "@dxos/react-client/echo";
|
|
2874
|
-
import { Invitation as
|
|
2875
|
-
import { ScrollArea, useTranslation as
|
|
2876
|
-
import { descriptionText as descriptionText10, mx as
|
|
3148
|
+
import { Invitation as Invitation8, InvitationEncoder as InvitationEncoder4 } from "@dxos/react-client/invitations";
|
|
3149
|
+
import { ScrollArea, useTranslation as useTranslation23 } from "@dxos/react-ui";
|
|
3150
|
+
import { descriptionText as descriptionText10, mx as mx22 } from "@dxos/react-ui-theme";
|
|
2877
3151
|
var activeActionKey = "dxos:react-shell/space-manager/active-action";
|
|
2878
3152
|
var SpaceManager = (props) => {
|
|
2879
|
-
const { space } = props;
|
|
2880
|
-
const { t } =
|
|
3153
|
+
const { space, target } = props;
|
|
3154
|
+
const { t } = useTranslation23("os");
|
|
2881
3155
|
const config = useConfig();
|
|
2882
3156
|
const invitations = useSpaceInvitations2(space?.key);
|
|
2883
|
-
const onInvitationEvent =
|
|
2884
|
-
const invitationCode =
|
|
2885
|
-
if (invitation.state ===
|
|
3157
|
+
const onInvitationEvent = useCallback8((invitation) => {
|
|
3158
|
+
const invitationCode = InvitationEncoder4.encode(invitation);
|
|
3159
|
+
if (invitation.state === Invitation8.State.CONNECTING) {
|
|
2886
3160
|
console.log(JSON.stringify({
|
|
2887
3161
|
invitationCode,
|
|
2888
3162
|
authCode: invitation.authCode
|
|
@@ -2894,10 +3168,11 @@ var SpaceManager = (props) => {
|
|
|
2894
3168
|
label: t("invite one label"),
|
|
2895
3169
|
description: t("invite one description"),
|
|
2896
3170
|
icon: UserPlus,
|
|
2897
|
-
onClick:
|
|
3171
|
+
onClick: useCallback8(() => {
|
|
2898
3172
|
const invitation = space.share?.({
|
|
2899
|
-
type:
|
|
2900
|
-
authMethod:
|
|
3173
|
+
type: Invitation8.Type.INTERACTIVE,
|
|
3174
|
+
authMethod: Invitation8.AuthMethod.SHARED_SECRET,
|
|
3175
|
+
target
|
|
2901
3176
|
});
|
|
2902
3177
|
if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== "production") {
|
|
2903
3178
|
invitation.subscribe(onInvitationEvent);
|
|
@@ -2910,10 +3185,11 @@ var SpaceManager = (props) => {
|
|
|
2910
3185
|
label: t("invite many label"),
|
|
2911
3186
|
description: t("invite many description"),
|
|
2912
3187
|
icon: UsersThree,
|
|
2913
|
-
onClick:
|
|
3188
|
+
onClick: useCallback8(() => {
|
|
2914
3189
|
const invitation = space.share?.({
|
|
2915
|
-
type:
|
|
2916
|
-
authMethod:
|
|
3190
|
+
type: Invitation8.Type.MULTIUSE,
|
|
3191
|
+
authMethod: Invitation8.AuthMethod.NONE,
|
|
3192
|
+
target
|
|
2917
3193
|
});
|
|
2918
3194
|
if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== "production") {
|
|
2919
3195
|
invitation.subscribe(onInvitationEvent);
|
|
@@ -2923,7 +3199,7 @@ var SpaceManager = (props) => {
|
|
|
2923
3199
|
])
|
|
2924
3200
|
}
|
|
2925
3201
|
};
|
|
2926
|
-
return /* @__PURE__ */
|
|
3202
|
+
return /* @__PURE__ */ React38.createElement(SpaceManagerImpl, {
|
|
2927
3203
|
...props,
|
|
2928
3204
|
invitations,
|
|
2929
3205
|
inviteActions
|
|
@@ -2932,7 +3208,7 @@ var SpaceManager = (props) => {
|
|
|
2932
3208
|
var headingFragment = "pis-3 pie-1 plb-1 mbe-1 font-medium";
|
|
2933
3209
|
var SpaceManagerImpl = (props) => {
|
|
2934
3210
|
const { active, space, createInvitationUrl, send, inviteActions: propsInviteActions, invitations, showInactiveInvitations, SpaceMemberList: SpaceMemberListComponent = SpaceMemberList, InvitationList: InvitationListComponent = InvitationList } = props;
|
|
2935
|
-
const { t } =
|
|
3211
|
+
const { t } = useTranslation23("os");
|
|
2936
3212
|
const inviteActions = propsInviteActions ?? {
|
|
2937
3213
|
noopInvite: {
|
|
2938
3214
|
label: t("create space invitation label"),
|
|
@@ -2942,34 +3218,34 @@ var SpaceManagerImpl = (props) => {
|
|
|
2942
3218
|
}
|
|
2943
3219
|
}
|
|
2944
3220
|
};
|
|
2945
|
-
const [activeAction, setInternalActiveAction] =
|
|
3221
|
+
const [activeAction, setInternalActiveAction] = useState9(localStorage.getItem(activeActionKey) ?? "inviteOne");
|
|
2946
3222
|
const setActiveAction = (nextAction) => {
|
|
2947
3223
|
setInternalActiveAction(nextAction);
|
|
2948
3224
|
localStorage.setItem(activeActionKey, nextAction);
|
|
2949
3225
|
};
|
|
2950
3226
|
const visibleInvitations = showInactiveInvitations ? invitations : invitations?.filter((invitation) => ![
|
|
2951
|
-
|
|
3227
|
+
Invitation8.State.CANCELLED
|
|
2952
3228
|
].includes(invitation.get().state));
|
|
2953
|
-
return /* @__PURE__ */
|
|
3229
|
+
return /* @__PURE__ */ React38.createElement(React38.Fragment, null, /* @__PURE__ */ React38.createElement(ScrollArea.Root, {
|
|
2954
3230
|
classNames: "grow shrink basis-28 -mli-2"
|
|
2955
|
-
}, /* @__PURE__ */
|
|
3231
|
+
}, /* @__PURE__ */ React38.createElement(ScrollArea.Viewport, {
|
|
2956
3232
|
classNames: "is-full pie-2"
|
|
2957
|
-
}, !!visibleInvitations?.length && /* @__PURE__ */
|
|
2958
|
-
className:
|
|
2959
|
-
}, t("invitation list heading")), /* @__PURE__ */
|
|
3233
|
+
}, !!visibleInvitations?.length && /* @__PURE__ */ React38.createElement(React38.Fragment, null, /* @__PURE__ */ React38.createElement("h3", {
|
|
3234
|
+
className: mx22(headingFragment, descriptionText10)
|
|
3235
|
+
}, t("invitation list heading")), /* @__PURE__ */ React38.createElement(InvitationListComponent, {
|
|
2960
3236
|
className: "mb-2",
|
|
2961
3237
|
send,
|
|
2962
3238
|
invitations: visibleInvitations ?? [],
|
|
2963
3239
|
onClickRemove: (invitation) => invitation.cancel(),
|
|
2964
3240
|
createInvitationUrl
|
|
2965
|
-
}), /* @__PURE__ */
|
|
2966
|
-
className:
|
|
2967
|
-
}, t("space member list heading"))), /* @__PURE__ */
|
|
3241
|
+
}), /* @__PURE__ */ React38.createElement("h3", {
|
|
3242
|
+
className: mx22(headingFragment, descriptionText10, "mbs-2")
|
|
3243
|
+
}, t("space member list heading"))), /* @__PURE__ */ React38.createElement(SpaceMemberListComponent, {
|
|
2968
3244
|
spaceKey: space.key,
|
|
2969
3245
|
includeSelf: true
|
|
2970
|
-
})), /* @__PURE__ */
|
|
3246
|
+
})), /* @__PURE__ */ React38.createElement(ScrollArea.Scrollbar, {
|
|
2971
3247
|
orientation: "vertical"
|
|
2972
|
-
}, /* @__PURE__ */
|
|
3248
|
+
}, /* @__PURE__ */ React38.createElement(ScrollArea.Thumb, null))), /* @__PURE__ */ React38.createElement(Actions, null, /* @__PURE__ */ React38.createElement(BifurcatedAction, {
|
|
2973
3249
|
disabled: !active,
|
|
2974
3250
|
actions: inviteActions,
|
|
2975
3251
|
activeAction,
|
|
@@ -2979,47 +3255,48 @@ var SpaceManagerImpl = (props) => {
|
|
|
2979
3255
|
};
|
|
2980
3256
|
|
|
2981
3257
|
// packages/sdk/shell/src/panels/SpacePanel/SpacePanel.tsx
|
|
2982
|
-
var
|
|
3258
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/SpacePanel/SpacePanel.tsx";
|
|
2983
3259
|
var SpacePanelHeading = ({ titleId, space, onDone }) => {
|
|
2984
|
-
const { t } =
|
|
3260
|
+
const { t } = useTranslation24("os");
|
|
2985
3261
|
const name = space.properties.name;
|
|
2986
|
-
return /* @__PURE__ */
|
|
3262
|
+
return /* @__PURE__ */ React39.createElement(Heading, {
|
|
2987
3263
|
titleId,
|
|
2988
3264
|
title: t("space panel heading"),
|
|
2989
|
-
corner: /* @__PURE__ */
|
|
3265
|
+
corner: /* @__PURE__ */ React39.createElement(CloseButton, {
|
|
2990
3266
|
"data-testid": "identity-panel-done",
|
|
2991
3267
|
onDone
|
|
2992
3268
|
})
|
|
2993
|
-
}, /* @__PURE__ */
|
|
3269
|
+
}, /* @__PURE__ */ React39.createElement("div", {
|
|
2994
3270
|
role: "none",
|
|
2995
3271
|
className: "flex gap-4 items-center justify-center mlb-4"
|
|
2996
|
-
}, /* @__PURE__ */
|
|
3272
|
+
}, /* @__PURE__ */ React39.createElement(Planet, {
|
|
2997
3273
|
size: 32
|
|
2998
|
-
}), /* @__PURE__ */
|
|
3274
|
+
}), /* @__PURE__ */ React39.createElement("div", {
|
|
2999
3275
|
className: "block text-start font-light text-xl"
|
|
3000
3276
|
}, name ?? space.key.truncate())));
|
|
3001
3277
|
};
|
|
3002
3278
|
var SpacePanelImpl = (props) => {
|
|
3003
|
-
const { titleId, activeView, space, SpaceManager: SpaceManagerComponent = SpaceManager, InvitationManager: InvitationManagerComponent = InvitationManager, ...rest } = props;
|
|
3004
|
-
return /* @__PURE__ */
|
|
3279
|
+
const { titleId, activeView, space, target, SpaceManager: SpaceManagerComponent = SpaceManager, InvitationManager: InvitationManagerComponent = InvitationManager, ...rest } = props;
|
|
3280
|
+
return /* @__PURE__ */ React39.createElement(DensityProvider4, {
|
|
3005
3281
|
density: "fine"
|
|
3006
|
-
}, /* @__PURE__ */
|
|
3282
|
+
}, /* @__PURE__ */ React39.createElement(SpacePanelHeading, {
|
|
3007
3283
|
...rest,
|
|
3008
3284
|
titleId,
|
|
3009
3285
|
space
|
|
3010
|
-
}), /* @__PURE__ */
|
|
3286
|
+
}), /* @__PURE__ */ React39.createElement(Viewport.Root, {
|
|
3011
3287
|
activeView
|
|
3012
|
-
}, /* @__PURE__ */
|
|
3288
|
+
}, /* @__PURE__ */ React39.createElement(Viewport.Views, null, /* @__PURE__ */ React39.createElement(Viewport.View, {
|
|
3013
3289
|
id: "space manager",
|
|
3014
3290
|
classNames: stepStyles
|
|
3015
|
-
}, /* @__PURE__ */
|
|
3291
|
+
}, /* @__PURE__ */ React39.createElement(SpaceManagerComponent, {
|
|
3016
3292
|
active: activeView === "space manager",
|
|
3017
3293
|
space,
|
|
3294
|
+
target,
|
|
3018
3295
|
...rest
|
|
3019
|
-
})), /* @__PURE__ */
|
|
3296
|
+
})), /* @__PURE__ */ React39.createElement(Viewport.View, {
|
|
3020
3297
|
id: "space invitation manager",
|
|
3021
3298
|
classNames: stepStyles
|
|
3022
|
-
}, /* @__PURE__ */
|
|
3299
|
+
}, /* @__PURE__ */ React39.createElement(InvitationManagerComponent, {
|
|
3023
3300
|
active: activeView === "space invitation manager",
|
|
3024
3301
|
...rest,
|
|
3025
3302
|
invitationUrl: props.invitationUrl
|
|
@@ -3027,7 +3304,7 @@ var SpacePanelImpl = (props) => {
|
|
|
3027
3304
|
};
|
|
3028
3305
|
var SpacePanelWithInvitationImpl = ({ invitation, ...props }) => {
|
|
3029
3306
|
const invitationStatus = useInvitationStatus3(invitation);
|
|
3030
|
-
return /* @__PURE__ */
|
|
3307
|
+
return /* @__PURE__ */ React39.createElement(SpacePanelImpl, {
|
|
3031
3308
|
...props,
|
|
3032
3309
|
...invitationStatus,
|
|
3033
3310
|
invitationUrl: props.createInvitationUrl(invitationStatus.invitationCode)
|
|
@@ -3040,11 +3317,11 @@ var SpacePanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => code,
|
|
|
3040
3317
|
space: props.space
|
|
3041
3318
|
}
|
|
3042
3319
|
});
|
|
3043
|
-
|
|
3320
|
+
useEffect6(() => {
|
|
3044
3321
|
const subscription = spaceService.subscribe((state) => {
|
|
3045
3322
|
log10("[state]", state, {
|
|
3046
|
-
F:
|
|
3047
|
-
L:
|
|
3323
|
+
F: __dxlog_file11,
|
|
3324
|
+
L: 94,
|
|
3048
3325
|
S: void 0,
|
|
3049
3326
|
C: (f, a) => f(...a)
|
|
3050
3327
|
});
|
|
@@ -3072,62 +3349,65 @@ var SpacePanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => code,
|
|
|
3072
3349
|
titleId,
|
|
3073
3350
|
createInvitationUrl
|
|
3074
3351
|
};
|
|
3075
|
-
return spaceState.context.invitation ?
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3352
|
+
return spaceState.context.invitation ? (
|
|
3353
|
+
// TODO(wittjosiah): Unused? Remove?
|
|
3354
|
+
/* @__PURE__ */ React39.createElement(SpacePanelWithInvitationImpl, {
|
|
3355
|
+
...implProps,
|
|
3356
|
+
invitation: spaceState.context.invitation
|
|
3357
|
+
})
|
|
3358
|
+
) : /* @__PURE__ */ React39.createElement(SpacePanelImpl, implProps);
|
|
3079
3359
|
};
|
|
3080
3360
|
|
|
3081
3361
|
// packages/sdk/shell/src/composites/IdentityDialog/IdentityDialog.tsx
|
|
3082
3362
|
var IdentityDialog = (props) => {
|
|
3083
3363
|
const titleId = useId9("spaceDialog__title");
|
|
3084
|
-
return /* @__PURE__ */
|
|
3364
|
+
return /* @__PURE__ */ React40.createElement(Dialog.Root, {
|
|
3085
3365
|
defaultOpen: true,
|
|
3086
3366
|
onOpenChange: (open) => open || props.onDone?.()
|
|
3087
|
-
}, /* @__PURE__ */
|
|
3367
|
+
}, /* @__PURE__ */ React40.createElement(Dialog.Portal, null, /* @__PURE__ */ React40.createElement(Dialog.Overlay, null, /* @__PURE__ */ React40.createElement(Dialog.Content, {
|
|
3088
3368
|
"aria-labelledby": titleId,
|
|
3089
3369
|
onOpenAutoFocus: (e) => e.preventDefault()
|
|
3090
|
-
}, /* @__PURE__ */
|
|
3370
|
+
}, /* @__PURE__ */ React40.createElement(ClipboardProvider, null, /* @__PURE__ */ React40.createElement(IdentityPanel, {
|
|
3091
3371
|
...props,
|
|
3092
3372
|
titleId,
|
|
3093
|
-
doneActionParent: /* @__PURE__ */
|
|
3373
|
+
doneActionParent: /* @__PURE__ */ React40.createElement(Dialog.Close, {
|
|
3094
3374
|
asChild: true
|
|
3095
3375
|
})
|
|
3096
3376
|
}))))));
|
|
3097
3377
|
};
|
|
3098
3378
|
|
|
3099
3379
|
// packages/sdk/shell/src/composites/JoinDialog/JoinDialog.tsx
|
|
3100
|
-
import
|
|
3380
|
+
import React41 from "react";
|
|
3101
3381
|
import { AlertDialog, useId as useId10, useVisualViewport } from "@dxos/react-ui";
|
|
3102
3382
|
var JoinDialog = (joinPanelProps) => {
|
|
3103
3383
|
const titleId = useId10("joinDialog__title");
|
|
3104
3384
|
const { height } = useVisualViewport();
|
|
3105
|
-
return /* @__PURE__ */
|
|
3385
|
+
return /* @__PURE__ */ React41.createElement(AlertDialog.Root, {
|
|
3106
3386
|
defaultOpen: true,
|
|
3107
3387
|
onOpenChange: (open) => open || (joinPanelProps.onExit ? joinPanelProps.onExit() : joinPanelProps.onDone?.(null))
|
|
3108
|
-
}, /* @__PURE__ */
|
|
3388
|
+
}, /* @__PURE__ */ React41.createElement(AlertDialog.Portal, null, /* @__PURE__ */ React41.createElement(AlertDialog.Overlay, {
|
|
3109
3389
|
classNames: "backdrop-blur",
|
|
3110
3390
|
...height && {
|
|
3111
3391
|
style: {
|
|
3112
3392
|
blockSize: `${height}px`
|
|
3113
3393
|
}
|
|
3114
3394
|
}
|
|
3115
|
-
}, /* @__PURE__ */
|
|
3395
|
+
}, /* @__PURE__ */ React41.createElement(AlertDialog.Content, {
|
|
3116
3396
|
"aria-labelledby": titleId
|
|
3117
|
-
}, /* @__PURE__ */
|
|
3397
|
+
}, /* @__PURE__ */ React41.createElement(JoinPanel, {
|
|
3118
3398
|
...joinPanelProps,
|
|
3119
3399
|
titleId,
|
|
3120
|
-
exitActionParent: /* @__PURE__ */
|
|
3400
|
+
exitActionParent: /* @__PURE__ */ React41.createElement(AlertDialog.Cancel, {
|
|
3121
3401
|
asChild: true
|
|
3122
3402
|
}),
|
|
3123
|
-
doneActionParent: /* @__PURE__ */
|
|
3403
|
+
doneActionParent: /* @__PURE__ */ React41.createElement(AlertDialog.Action, {
|
|
3124
3404
|
asChild: true
|
|
3125
3405
|
})
|
|
3126
3406
|
})))));
|
|
3127
3407
|
};
|
|
3128
3408
|
|
|
3129
3409
|
// packages/sdk/shell/src/composites/Shell/run-shell.tsx
|
|
3130
|
-
import
|
|
3410
|
+
import React44, { StrictMode } from "react";
|
|
3131
3411
|
import { createRoot } from "react-dom/client";
|
|
3132
3412
|
import { DEFAULT_CLIENT_CHANNEL, DEFAULT_SHELL_CHANNEL } from "@dxos/client-protocol";
|
|
3133
3413
|
import { ShellRuntimeImpl } from "@dxos/client-services";
|
|
@@ -3137,49 +3417,51 @@ import { defaultTx } from "@dxos/react-ui-theme";
|
|
|
3137
3417
|
import { createIFramePort } from "@dxos/rpc-tunnel";
|
|
3138
3418
|
|
|
3139
3419
|
// packages/sdk/shell/src/composites/Shell/Shell.tsx
|
|
3140
|
-
import
|
|
3420
|
+
import React43, { useEffect as useEffect7, useState as useState10 } from "react";
|
|
3141
3421
|
import { log as log11 } from "@dxos/log";
|
|
3142
|
-
import { ShellDisplay, ShellLayout } from "@dxos/react-client";
|
|
3422
|
+
import { ShellDisplay, ShellLayout, useClient as useClient8 } from "@dxos/react-client";
|
|
3143
3423
|
import { useSpace as useSpace2 } from "@dxos/react-client/echo";
|
|
3144
3424
|
|
|
3145
3425
|
// packages/sdk/shell/src/composites/SpaceDialog/SpaceDialog.tsx
|
|
3146
|
-
import
|
|
3426
|
+
import React42 from "react";
|
|
3147
3427
|
import { Dialog as Dialog2, useId as useId11 } from "@dxos/react-ui";
|
|
3148
3428
|
var SpaceDialog = (spacePanelProps) => {
|
|
3149
3429
|
const titleId = useId11("spaceDialog__title");
|
|
3150
|
-
return /* @__PURE__ */
|
|
3430
|
+
return /* @__PURE__ */ React42.createElement(Dialog2.Root, {
|
|
3151
3431
|
defaultOpen: true,
|
|
3152
3432
|
onOpenChange: (open) => open || spacePanelProps.onDone?.()
|
|
3153
|
-
}, /* @__PURE__ */
|
|
3433
|
+
}, /* @__PURE__ */ React42.createElement(Dialog2.Portal, null, /* @__PURE__ */ React42.createElement(Dialog2.Overlay, null, /* @__PURE__ */ React42.createElement(Dialog2.Content, {
|
|
3154
3434
|
"aria-labelledby": titleId
|
|
3155
|
-
}, /* @__PURE__ */
|
|
3435
|
+
}, /* @__PURE__ */ React42.createElement(ClipboardProvider, null, /* @__PURE__ */ React42.createElement(SpacePanel, {
|
|
3156
3436
|
...spacePanelProps,
|
|
3157
3437
|
titleId,
|
|
3158
|
-
doneActionParent: /* @__PURE__ */
|
|
3438
|
+
doneActionParent: /* @__PURE__ */ React42.createElement(Dialog2.Close, {
|
|
3159
3439
|
asChild: true
|
|
3160
3440
|
})
|
|
3161
3441
|
}))))));
|
|
3162
3442
|
};
|
|
3163
3443
|
|
|
3164
3444
|
// packages/sdk/shell/src/composites/Shell/Shell.tsx
|
|
3165
|
-
var
|
|
3445
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/composites/Shell/Shell.tsx";
|
|
3166
3446
|
var Shell = ({ runtime, origin }) => {
|
|
3167
|
-
const [{ layout, invitationCode, spaceKey }, setLayout] =
|
|
3447
|
+
const [{ layout, invitationCode, spaceKey, target }, setLayout] = useState10({
|
|
3168
3448
|
layout: runtime.layout,
|
|
3169
3449
|
invitationCode: runtime.invitationCode,
|
|
3170
|
-
spaceKey: runtime.spaceKey
|
|
3450
|
+
spaceKey: runtime.spaceKey,
|
|
3451
|
+
target: runtime.target
|
|
3171
3452
|
});
|
|
3453
|
+
const client = useClient8();
|
|
3172
3454
|
const space = useSpace2(spaceKey);
|
|
3173
|
-
|
|
3455
|
+
useEffect7(() => {
|
|
3174
3456
|
return runtime.layoutUpdate.on((request) => setLayout(request));
|
|
3175
3457
|
}, [
|
|
3176
3458
|
runtime
|
|
3177
3459
|
]);
|
|
3178
|
-
|
|
3460
|
+
useEffect7(() => {
|
|
3179
3461
|
if (layout === ShellLayout.SPACE && !space) {
|
|
3180
3462
|
log11.warn("No space found for shell space invitations.", void 0, {
|
|
3181
|
-
F:
|
|
3182
|
-
L:
|
|
3463
|
+
F: __dxlog_file12,
|
|
3464
|
+
L: 32,
|
|
3183
3465
|
S: void 0,
|
|
3184
3466
|
C: (f, a) => f(...a)
|
|
3185
3467
|
});
|
|
@@ -3200,7 +3482,7 @@ var Shell = ({ runtime, origin }) => {
|
|
|
3200
3482
|
]);
|
|
3201
3483
|
switch (layout) {
|
|
3202
3484
|
case ShellLayout.INITIALIZE_IDENTITY:
|
|
3203
|
-
return /* @__PURE__ */
|
|
3485
|
+
return /* @__PURE__ */ React43.createElement(JoinDialog, {
|
|
3204
3486
|
mode: "halo-only",
|
|
3205
3487
|
initialInvitationCode: invitationCode,
|
|
3206
3488
|
onDone: () => {
|
|
@@ -3215,8 +3497,18 @@ var Shell = ({ runtime, origin }) => {
|
|
|
3215
3497
|
case ShellLayout.IDENTITY:
|
|
3216
3498
|
case ShellLayout.SHARE_IDENTITY:
|
|
3217
3499
|
case ShellLayout.EDIT_PROFILE:
|
|
3218
|
-
return /* @__PURE__ */
|
|
3500
|
+
return /* @__PURE__ */ React43.createElement(IdentityDialog, {
|
|
3219
3501
|
createInvitationUrl: (invitationCode2) => `${origin}?deviceInvitationCode=${invitationCode2}`,
|
|
3502
|
+
onResetDevice: async () => {
|
|
3503
|
+
await client.reset();
|
|
3504
|
+
await runtime.setAppContext({
|
|
3505
|
+
display: ShellDisplay.NONE,
|
|
3506
|
+
reload: true
|
|
3507
|
+
});
|
|
3508
|
+
},
|
|
3509
|
+
onJoinNewIdentity: () => runtime.setLayout({
|
|
3510
|
+
layout: ShellLayout.INITIALIZE_IDENTITY
|
|
3511
|
+
}),
|
|
3220
3512
|
onDone: async () => {
|
|
3221
3513
|
await runtime.setAppContext({
|
|
3222
3514
|
display: ShellDisplay.NONE
|
|
@@ -3227,8 +3519,9 @@ var Shell = ({ runtime, origin }) => {
|
|
|
3227
3519
|
}
|
|
3228
3520
|
});
|
|
3229
3521
|
case ShellLayout.SPACE:
|
|
3230
|
-
return space ? /* @__PURE__ */
|
|
3522
|
+
return space ? /* @__PURE__ */ React43.createElement(SpaceDialog, {
|
|
3231
3523
|
space,
|
|
3524
|
+
target,
|
|
3232
3525
|
createInvitationUrl: (invitationCode2) => `${origin}?spaceInvitationCode=${invitationCode2}`,
|
|
3233
3526
|
onDone: async () => {
|
|
3234
3527
|
await runtime.setAppContext({
|
|
@@ -3240,12 +3533,14 @@ var Shell = ({ runtime, origin }) => {
|
|
|
3240
3533
|
}
|
|
3241
3534
|
}) : null;
|
|
3242
3535
|
case ShellLayout.JOIN_SPACE:
|
|
3243
|
-
return /* @__PURE__ */
|
|
3536
|
+
return /* @__PURE__ */ React43.createElement(JoinDialog, {
|
|
3244
3537
|
initialInvitationCode: invitationCode,
|
|
3245
3538
|
onDone: async (result) => {
|
|
3539
|
+
const target2 = result?.target ?? void 0;
|
|
3246
3540
|
await runtime.setAppContext({
|
|
3247
3541
|
display: ShellDisplay.NONE,
|
|
3248
|
-
spaceKey: result?.spaceKey ?? void 0
|
|
3542
|
+
spaceKey: result?.spaceKey ?? void 0,
|
|
3543
|
+
target: target2
|
|
3249
3544
|
});
|
|
3250
3545
|
runtime.setLayout({
|
|
3251
3546
|
layout: ShellLayout.DEFAULT
|
|
@@ -3337,7 +3632,8 @@ var os = {
|
|
|
3337
3632
|
"selecting identity heading": "Selecting identity",
|
|
3338
3633
|
"devices heading": "Devices",
|
|
3339
3634
|
"identity heading": "Profile settings",
|
|
3340
|
-
"choose
|
|
3635
|
+
"choose add device label": "Add device",
|
|
3636
|
+
"choose devices label": "Manage devices",
|
|
3341
3637
|
"choose profile label": "Edit profile",
|
|
3342
3638
|
"choose sign out label": "Sign out",
|
|
3343
3639
|
"empty space members message": "There is nobody in this space yet.",
|
|
@@ -3364,7 +3660,12 @@ var os = {
|
|
|
3364
3660
|
"confirm label": "Confirm",
|
|
3365
3661
|
"reset identity input label": "This will clear this device and all associated data. Type {{confirmationValue}} and confirm to continue.",
|
|
3366
3662
|
"failed to reset identity message": "Failed to reset identity.",
|
|
3367
|
-
"confirmation value": "CONFIRM"
|
|
3663
|
+
"confirmation value": "CONFIRM",
|
|
3664
|
+
"sign out chooser title": "DANGER ZONE",
|
|
3665
|
+
"sign out chooser message": "Proceeding with either action below will erase all data on this device.",
|
|
3666
|
+
"join new identity label": "Join a new identity",
|
|
3667
|
+
"reset device label": "Reset device",
|
|
3668
|
+
"reset device confirm message": "Are you sure you want to reset your device? All data will be lost."
|
|
3368
3669
|
};
|
|
3369
3670
|
|
|
3370
3671
|
// packages/sdk/shell/src/translations/index.ts
|
|
@@ -3388,27 +3689,27 @@ var runShell = async (config = new Config()) => {
|
|
|
3388
3689
|
runtime.open(),
|
|
3389
3690
|
client.initialize()
|
|
3390
3691
|
]);
|
|
3391
|
-
createRoot(document.getElementById("root")).render(/* @__PURE__ */
|
|
3692
|
+
createRoot(document.getElementById("root")).render(/* @__PURE__ */ React44.createElement(StrictMode, null, /* @__PURE__ */ React44.createElement(ThemeProvider, {
|
|
3392
3693
|
tx: defaultTx,
|
|
3393
3694
|
resourceExtensions: [
|
|
3394
3695
|
osTranslations
|
|
3395
3696
|
]
|
|
3396
|
-
}, /* @__PURE__ */
|
|
3697
|
+
}, /* @__PURE__ */ React44.createElement(ClientContext.Provider, {
|
|
3397
3698
|
value: {
|
|
3398
3699
|
client,
|
|
3399
3700
|
status: SystemStatus.ACTIVE
|
|
3400
3701
|
}
|
|
3401
|
-
}, /* @__PURE__ */
|
|
3702
|
+
}, /* @__PURE__ */ React44.createElement(ClipboardProvider, null, /* @__PURE__ */ React44.createElement(Tooltip3.Provider, null, /* @__PURE__ */ React44.createElement(Shell, {
|
|
3402
3703
|
runtime,
|
|
3403
3704
|
origin: location.origin
|
|
3404
3705
|
})))))));
|
|
3405
3706
|
};
|
|
3406
3707
|
|
|
3407
3708
|
// packages/sdk/shell/src/composites/Shell/ShellContext.tsx
|
|
3408
|
-
import
|
|
3409
|
-
import { ShellDisplay as ShellDisplay2, ShellLayout as ShellLayout3, useClient as
|
|
3709
|
+
import React45, { createContext as createContext2, useCallback as useCallback9, useContext as useContext2, useEffect as useEffect8, useMemo as useMemo6, useState as useState11 } from "react";
|
|
3710
|
+
import { ShellDisplay as ShellDisplay2, ShellLayout as ShellLayout3, useClient as useClient9 } from "@dxos/react-client";
|
|
3410
3711
|
import { useIdentity as useIdentity3 } from "@dxos/react-client/halo";
|
|
3411
|
-
import { mx as
|
|
3712
|
+
import { mx as mx23 } from "@dxos/react-ui-theme";
|
|
3412
3713
|
|
|
3413
3714
|
// packages/sdk/shell/src/composites/Shell/memory-shell-runtime.ts
|
|
3414
3715
|
import { Event } from "@dxos/async";
|
|
@@ -3444,7 +3745,7 @@ var MemoryShellRuntime = class {
|
|
|
3444
3745
|
// packages/sdk/shell/src/composites/Shell/ShellContext.tsx
|
|
3445
3746
|
var ShellContext = /* @__PURE__ */ createContext2({});
|
|
3446
3747
|
var useShell = () => {
|
|
3447
|
-
const client =
|
|
3748
|
+
const client = useClient9();
|
|
3448
3749
|
const { runtime, setDisplay } = useContext2(ShellContext);
|
|
3449
3750
|
const setLayout = async (layout, options) => {
|
|
3450
3751
|
if (runtime) {
|
|
@@ -3465,9 +3766,9 @@ var useShell = () => {
|
|
|
3465
3766
|
};
|
|
3466
3767
|
};
|
|
3467
3768
|
var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoinedSpace, children }) => {
|
|
3468
|
-
const client =
|
|
3769
|
+
const client = useClient9();
|
|
3469
3770
|
const identity = useIdentity3();
|
|
3470
|
-
const [display, setDisplay] =
|
|
3771
|
+
const [display, setDisplay] = useState11(!identity || spaceInvitationCode || deviceInvitationCode ? ShellDisplay2.FULLSCREEN : ShellDisplay2.NONE);
|
|
3471
3772
|
const shellRuntime = useMemo6(() => {
|
|
3472
3773
|
if (client.config.get("runtime.app.env.DX_VAULT") !== "false") {
|
|
3473
3774
|
return;
|
|
@@ -3493,7 +3794,7 @@ var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoine
|
|
|
3493
3794
|
spaceInvitationCode,
|
|
3494
3795
|
deviceInvitationCode
|
|
3495
3796
|
]);
|
|
3496
|
-
const handleKeyDown =
|
|
3797
|
+
const handleKeyDown = useCallback9((event) => {
|
|
3497
3798
|
if (!space || !shellRuntime) {
|
|
3498
3799
|
return;
|
|
3499
3800
|
}
|
|
@@ -3514,7 +3815,7 @@ var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoine
|
|
|
3514
3815
|
space,
|
|
3515
3816
|
shellRuntime
|
|
3516
3817
|
]);
|
|
3517
|
-
|
|
3818
|
+
useEffect8(() => {
|
|
3518
3819
|
if (!shellRuntime) {
|
|
3519
3820
|
return;
|
|
3520
3821
|
}
|
|
@@ -3524,7 +3825,7 @@ var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoine
|
|
|
3524
3825
|
shellRuntime,
|
|
3525
3826
|
handleKeyDown
|
|
3526
3827
|
]);
|
|
3527
|
-
|
|
3828
|
+
useEffect8(() => {
|
|
3528
3829
|
if (!shellRuntime) {
|
|
3529
3830
|
return;
|
|
3530
3831
|
}
|
|
@@ -3537,12 +3838,12 @@ var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoine
|
|
|
3537
3838
|
}, [
|
|
3538
3839
|
shellRuntime
|
|
3539
3840
|
]);
|
|
3540
|
-
return /* @__PURE__ */
|
|
3541
|
-
className:
|
|
3542
|
-
}, /* @__PURE__ */
|
|
3841
|
+
return /* @__PURE__ */ React45.createElement(React45.Fragment, null, shellRuntime && /* @__PURE__ */ React45.createElement("div", {
|
|
3842
|
+
className: mx23(display === ShellDisplay2.NONE ? "hidden" : "")
|
|
3843
|
+
}, /* @__PURE__ */ React45.createElement(Shell, {
|
|
3543
3844
|
runtime: shellRuntime,
|
|
3544
3845
|
origin: window.location.origin
|
|
3545
|
-
})), /* @__PURE__ */
|
|
3846
|
+
})), /* @__PURE__ */ React45.createElement(ShellContext.Provider, {
|
|
3546
3847
|
value: {
|
|
3547
3848
|
runtime: shellRuntime,
|
|
3548
3849
|
setDisplay
|