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