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