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