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