@dxos/react-ui 0.1.34 → 0.1.36-next.ef27157
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/lib/browser/chunk-5VRACIDE.mjs +10 -0
- package/dist/lib/browser/chunk-5VRACIDE.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +225 -174
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +43 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts.map +1 -1
- package/dist/types/src/components/InvitationList/InvitationListItem.d.ts.map +1 -1
- package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts.map +1 -1
- package/dist/types/src/composites/Shell/ShellContext.d.ts.map +1 -1
- package/dist/types/src/panels/DevicesPanel/DevicesPanel.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +5 -5
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts +2 -2
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts +2 -2
- package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts +2 -2
- package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts.map +1 -1
- package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts.map +1 -1
- package/dist/types/src/playwright/invitations-manager.d.ts +8 -17
- package/dist/types/src/playwright/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/shell-manager.d.ts +16 -0
- package/dist/types/src/testing/shell-manager.d.ts.map +1 -0
- package/dist/types/src/util/invitationStatusValue.d.ts.map +1 -1
- package/package.json +25 -14
- package/src/components/InvitationList/InvitationList.tsx +2 -2
- package/src/components/InvitationList/InvitationListContainer.tsx +3 -2
- package/src/components/InvitationList/InvitationListItem.tsx +4 -8
- package/src/composites/JoinDialog/JoinDialog.stories.tsx +3 -12
- package/src/composites/Shell/Shell.tsx +1 -1
- package/src/composites/Shell/ShellContext.tsx +11 -8
- package/src/panels/DevicesPanel/DevicesPanel.tsx +3 -1
- package/src/panels/JoinPanel/JoinPanel.tsx +8 -8
- package/src/panels/JoinPanel/joinMachine.ts +108 -98
- package/src/panels/JoinPanel/view-states/InvitationAccepted.tsx +6 -6
- package/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx +14 -14
- package/src/panels/JoinPanel/view-states/InvitationInput.tsx +9 -9
- package/src/panels/JoinPanel/view-states/InvitationRescuer.tsx +10 -10
- package/src/panels/SpacePanel/SpacePanel.tsx +19 -4
- package/src/playwright/invitations-manager.ts +23 -78
- package/src/playwright/invitations.spec.ts +79 -117
- package/src/testing/index.ts +5 -0
- package/src/testing/shell-manager.ts +59 -0
- package/src/util/invitationStatusValue.ts +3 -2
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-5VRACIDE.mjs";
|
|
6
4
|
|
|
7
5
|
// packages/apps/patterns/react-ui/src/components/Clipboard/CopyButton.tsx
|
|
8
6
|
import { Check, Copy } from "@phosphor-icons/react";
|
|
@@ -197,12 +195,16 @@ var invitationStatusValue = /* @__PURE__ */ new Map([
|
|
|
197
195
|
2
|
|
198
196
|
],
|
|
199
197
|
[
|
|
200
|
-
Invitation.State.
|
|
198
|
+
Invitation.State.READY_FOR_AUTHENTICATION,
|
|
201
199
|
3
|
|
202
200
|
],
|
|
203
201
|
[
|
|
204
|
-
Invitation.State.
|
|
202
|
+
Invitation.State.AUTHENTICATING,
|
|
205
203
|
4
|
|
204
|
+
],
|
|
205
|
+
[
|
|
206
|
+
Invitation.State.SUCCESS,
|
|
207
|
+
5
|
|
206
208
|
]
|
|
207
209
|
]);
|
|
208
210
|
|
|
@@ -364,12 +366,12 @@ function _extends4() {
|
|
|
364
366
|
return _extends4.apply(this, arguments);
|
|
365
367
|
}
|
|
366
368
|
var InvitationListItem = ({ invitation, value, onClickRemove, createInvitationUrl }) => {
|
|
367
|
-
var _a
|
|
369
|
+
var _a;
|
|
368
370
|
const { t } = useTranslation3("os");
|
|
369
371
|
const qrLabel = useId("qrLabel");
|
|
370
|
-
const { cancel, status, haltedAt, invitationCode,
|
|
372
|
+
const { cancel, status, haltedAt, invitationCode, authCode } = useInvitationStatus(invitation);
|
|
371
373
|
const statusValue = (_a = invitationStatusValue.get(status)) != null ? _a : 0;
|
|
372
|
-
const isCancellable = statusValue <
|
|
374
|
+
const isCancellable = statusValue < 5 && statusValue >= 0;
|
|
373
375
|
const showShare = statusValue < 3 && statusValue >= 0;
|
|
374
376
|
const showAuthCode = statusValue === 3;
|
|
375
377
|
const handleClickRemove = useCallback2(() => onClickRemove(invitation), [
|
|
@@ -385,7 +387,7 @@ var InvitationListItem = ({ invitation, value, onClickRemove, createInvitationUr
|
|
|
385
387
|
status,
|
|
386
388
|
haltedAt,
|
|
387
389
|
size: 8,
|
|
388
|
-
invitationId:
|
|
390
|
+
invitationId: invitation == null ? void 0 : invitation.get().invitationId
|
|
389
391
|
})), showShare && invitationUrl ? /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(AccordionPrimitive.Trigger, {
|
|
390
392
|
asChild: true
|
|
391
393
|
}, /* @__PURE__ */ React9.createElement(Button2, {
|
|
@@ -398,7 +400,7 @@ var InvitationListItem = ({ invitation, value, onClickRemove, createInvitationUr
|
|
|
398
400
|
value: invitationUrl
|
|
399
401
|
})) : showAuthCode ? /* @__PURE__ */ React9.createElement("p", {
|
|
400
402
|
className: "grow text-xl text-center text-success-500 dark:text-success-300 font-mono"
|
|
401
|
-
},
|
|
403
|
+
}, authCode) : /* @__PURE__ */ React9.createElement("span", {
|
|
402
404
|
role: "none",
|
|
403
405
|
className: "grow"
|
|
404
406
|
}), isCancellable ? /* @__PURE__ */ React9.createElement(Button2, {
|
|
@@ -465,9 +467,8 @@ var InvitationList = ({ invitations, ...invitationProps }) => {
|
|
|
465
467
|
className: "flex flex-col gap-1"
|
|
466
468
|
}, /* @__PURE__ */ React10.createElement(DensityProvider, {
|
|
467
469
|
density: "fine"
|
|
468
|
-
}, /* @__PURE__ */ React10.createElement(ClipboardProvider, null, invitations.map((invitation
|
|
469
|
-
|
|
470
|
-
const value = (_b = (_a = invitation.invitation) == null ? void 0 : _a.invitationId) != null ? _b : `inv_${index}`;
|
|
470
|
+
}, /* @__PURE__ */ React10.createElement(ClipboardProvider, null, invitations.map((invitation) => {
|
|
471
|
+
const value = invitation.get().invitationId;
|
|
471
472
|
return /* @__PURE__ */ React10.createElement(InvitationListItem, _extends5({
|
|
472
473
|
key: value,
|
|
473
474
|
value,
|
|
@@ -496,8 +497,9 @@ function _extends6() {
|
|
|
496
497
|
var InvitationListContainer = ({ spaceKey, createInvitationUrl }) => {
|
|
497
498
|
const space = useSpace(spaceKey);
|
|
498
499
|
const invitations = useSpaceInvitations(spaceKey);
|
|
499
|
-
const onClickRemove = useCallback3((
|
|
500
|
-
|
|
500
|
+
const onClickRemove = useCallback3((invitation) => {
|
|
501
|
+
const invitationId = invitation.get().invitationId;
|
|
502
|
+
invitationId && (space == null ? void 0 : space.removeInvitation(invitationId));
|
|
501
503
|
}, [
|
|
502
504
|
space
|
|
503
505
|
]);
|
|
@@ -823,7 +825,7 @@ var DeviceListView = ({ createInvitationUrl, titleId, onDone, doneActionParent }
|
|
|
823
825
|
className: mx13(defaultSurface, "rounded-be-md p-2")
|
|
824
826
|
}, /* @__PURE__ */ React18.createElement(InvitationList, {
|
|
825
827
|
invitations,
|
|
826
|
-
onClickRemove: (
|
|
828
|
+
onClickRemove: (invitation) => invitation.get() && client.halo.removeInvitation(invitation.get().invitationId),
|
|
827
829
|
createInvitationUrl
|
|
828
830
|
}), /* @__PURE__ */ React18.createElement(Button3, {
|
|
829
831
|
className: "is-full flex gap-2 mbs-2",
|
|
@@ -957,219 +959,245 @@ import { useCallback as useCallback5 } from "react";
|
|
|
957
959
|
import { assign, createMachine } from "xstate";
|
|
958
960
|
import { Invitation as Invitation4, InvitationEncoder } from "@dxos/client";
|
|
959
961
|
import { log } from "@dxos/log";
|
|
960
|
-
var getInvitationSubscribable = (
|
|
962
|
+
var getInvitationSubscribable = (Kind, invitation) => {
|
|
961
963
|
log("[subscribing to invitation]", invitation, {
|
|
962
964
|
file: "joinMachine.ts",
|
|
963
|
-
line:
|
|
965
|
+
line: 77,
|
|
964
966
|
scope: void 0,
|
|
965
967
|
callSite: (f, a) => f(...a)
|
|
966
968
|
});
|
|
967
969
|
return {
|
|
968
|
-
subscribe: (next, onError, complete) => {
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
log("[invitation
|
|
972
|
-
|
|
970
|
+
subscribe: (next, onError, complete) => invitation.subscribe((invitation2) => {
|
|
971
|
+
switch (invitation2.state) {
|
|
972
|
+
case Invitation4.State.CONNECTING: {
|
|
973
|
+
log("[invitation connecting]", {
|
|
974
|
+
Kind,
|
|
973
975
|
invitation: invitation2
|
|
974
976
|
}, {
|
|
975
977
|
file: "joinMachine.ts",
|
|
976
|
-
line:
|
|
978
|
+
line: 88,
|
|
977
979
|
scope: void 0,
|
|
978
980
|
callSite: (f, a) => f(...a)
|
|
979
981
|
});
|
|
980
982
|
return next({
|
|
981
|
-
type: `
|
|
983
|
+
type: `connecting${Kind}Invitation`,
|
|
982
984
|
invitation: invitation2
|
|
983
985
|
});
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
log
|
|
987
|
-
|
|
986
|
+
}
|
|
987
|
+
case Invitation4.State.CONNECTED: {
|
|
988
|
+
log("[invitation connected]", {
|
|
989
|
+
Kind,
|
|
990
|
+
invitation: invitation2
|
|
988
991
|
}, {
|
|
989
992
|
file: "joinMachine.ts",
|
|
990
|
-
line:
|
|
993
|
+
line: 93,
|
|
991
994
|
scope: void 0,
|
|
992
995
|
callSite: (f, a) => f(...a)
|
|
993
996
|
});
|
|
994
997
|
return next({
|
|
995
|
-
type: `
|
|
996
|
-
|
|
998
|
+
type: `connected${Kind}Invitation`,
|
|
999
|
+
invitation: invitation2
|
|
997
1000
|
});
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
log
|
|
1001
|
-
|
|
1001
|
+
}
|
|
1002
|
+
case Invitation4.State.READY_FOR_AUTHENTICATION: {
|
|
1003
|
+
log("[invitation ready for authentication]", {
|
|
1004
|
+
Kind,
|
|
1005
|
+
invitation: invitation2
|
|
1002
1006
|
}, {
|
|
1003
1007
|
file: "joinMachine.ts",
|
|
1004
|
-
line:
|
|
1008
|
+
line: 98,
|
|
1005
1009
|
scope: void 0,
|
|
1006
1010
|
callSite: (f, a) => f(...a)
|
|
1007
1011
|
});
|
|
1008
1012
|
return next({
|
|
1009
|
-
type: `
|
|
1010
|
-
|
|
1013
|
+
type: `readyForAuthentication${Kind}Invitation`,
|
|
1014
|
+
invitation: invitation2
|
|
1011
1015
|
});
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
log("[invitation
|
|
1015
|
-
|
|
1016
|
+
}
|
|
1017
|
+
case Invitation4.State.AUTHENTICATING: {
|
|
1018
|
+
log("[invitation authenticating]", {
|
|
1019
|
+
Kind,
|
|
1016
1020
|
invitation: invitation2
|
|
1017
1021
|
}, {
|
|
1018
1022
|
file: "joinMachine.ts",
|
|
1019
|
-
line:
|
|
1023
|
+
line: 103,
|
|
1020
1024
|
scope: void 0,
|
|
1021
1025
|
callSite: (f, a) => f(...a)
|
|
1022
1026
|
});
|
|
1023
1027
|
return next({
|
|
1024
|
-
type: `
|
|
1028
|
+
type: `authenticating${Kind}Invitation`,
|
|
1025
1029
|
invitation: invitation2
|
|
1026
1030
|
});
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
log("[invitation
|
|
1030
|
-
|
|
1031
|
+
}
|
|
1032
|
+
case Invitation4.State.SUCCESS: {
|
|
1033
|
+
log("[invitation success]", {
|
|
1034
|
+
Kind,
|
|
1031
1035
|
invitation: invitation2
|
|
1032
1036
|
}, {
|
|
1033
1037
|
file: "joinMachine.ts",
|
|
1034
|
-
line:
|
|
1038
|
+
line: 108,
|
|
1035
1039
|
scope: void 0,
|
|
1036
1040
|
callSite: (f, a) => f(...a)
|
|
1037
1041
|
});
|
|
1038
|
-
|
|
1039
|
-
type: `
|
|
1042
|
+
next({
|
|
1043
|
+
type: `success${Kind}Invitation`,
|
|
1040
1044
|
invitation: invitation2
|
|
1041
1045
|
});
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
+
return complete == null ? void 0 : complete();
|
|
1047
|
+
}
|
|
1048
|
+
case Invitation4.State.CANCELLED: {
|
|
1049
|
+
log.warn("[invitation cancelled]", {
|
|
1050
|
+
Kind
|
|
1046
1051
|
}, {
|
|
1047
1052
|
file: "joinMachine.ts",
|
|
1048
|
-
line:
|
|
1053
|
+
line: 114,
|
|
1049
1054
|
scope: void 0,
|
|
1050
1055
|
callSite: (f, a) => f(...a)
|
|
1051
1056
|
});
|
|
1052
|
-
next({
|
|
1053
|
-
type: `
|
|
1057
|
+
return next({
|
|
1058
|
+
type: `fail${Kind}Invitation`,
|
|
1059
|
+
reason: "cancelled"
|
|
1054
1060
|
});
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
Domain,
|
|
1060
|
-
error
|
|
1061
|
+
}
|
|
1062
|
+
case Invitation4.State.TIMEOUT: {
|
|
1063
|
+
log.error("[invitation timeout]", {
|
|
1064
|
+
Kind
|
|
1061
1065
|
}, {
|
|
1062
1066
|
file: "joinMachine.ts",
|
|
1063
|
-
line:
|
|
1067
|
+
line: 119,
|
|
1064
1068
|
scope: void 0,
|
|
1065
1069
|
callSite: (f, a) => f(...a)
|
|
1066
1070
|
});
|
|
1067
|
-
next({
|
|
1068
|
-
type: `fail${
|
|
1069
|
-
reason: "
|
|
1071
|
+
return next({
|
|
1072
|
+
type: `fail${Kind}Invitation`,
|
|
1073
|
+
reason: "timeout"
|
|
1070
1074
|
});
|
|
1071
|
-
return onError == null ? void 0 : onError(error);
|
|
1072
1075
|
}
|
|
1076
|
+
}
|
|
1077
|
+
}, (error) => {
|
|
1078
|
+
log.error("[invitation errored]", {
|
|
1079
|
+
Kind,
|
|
1080
|
+
error
|
|
1081
|
+
}, {
|
|
1082
|
+
file: "joinMachine.ts",
|
|
1083
|
+
line: 125,
|
|
1084
|
+
scope: void 0,
|
|
1085
|
+
callSite: (f, a) => f(...a)
|
|
1073
1086
|
});
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1087
|
+
next({
|
|
1088
|
+
type: `fail${Kind}Invitation`,
|
|
1089
|
+
reason: "error"
|
|
1090
|
+
});
|
|
1091
|
+
return onError == null ? void 0 : onError(error);
|
|
1092
|
+
})
|
|
1078
1093
|
};
|
|
1079
1094
|
};
|
|
1080
|
-
var acceptingInvitationTemplate = (
|
|
1095
|
+
var acceptingInvitationTemplate = (Kind, successTarget) => {
|
|
1081
1096
|
const config = {
|
|
1082
|
-
initial: `unknown${
|
|
1097
|
+
initial: `unknown${Kind}`,
|
|
1083
1098
|
states: {
|
|
1084
|
-
[`unknown${
|
|
1099
|
+
[`unknown${Kind}`]: {
|
|
1085
1100
|
always: [
|
|
1086
1101
|
{
|
|
1087
|
-
cond: ({ mode }) => mode === "halo-only" &&
|
|
1102
|
+
cond: ({ mode }) => mode === "halo-only" && Kind === "Space",
|
|
1088
1103
|
target: "#join.finishingJoiningHalo"
|
|
1089
1104
|
},
|
|
1090
1105
|
{
|
|
1091
|
-
// cond: `no${
|
|
1092
|
-
target: `inputting${
|
|
1106
|
+
// cond: `no${Kind}Invitation`,
|
|
1107
|
+
target: `inputting${Kind}InvitationCode`,
|
|
1093
1108
|
actions: "log"
|
|
1094
1109
|
}
|
|
1095
1110
|
]
|
|
1096
1111
|
},
|
|
1097
|
-
[`inputting${
|
|
1098
|
-
[`acceptingRedeemed${
|
|
1112
|
+
[`inputting${Kind}InvitationCode`]: {},
|
|
1113
|
+
[`acceptingRedeemed${Kind}Invitation`]: {
|
|
1099
1114
|
invoke: {
|
|
1100
|
-
src: (context) => context[
|
|
1115
|
+
src: (context) => context[Kind.toLowerCase()].invitationSubscribable
|
|
1101
1116
|
},
|
|
1102
|
-
initial: `unknown${
|
|
1117
|
+
initial: `unknown${Kind}Invitation`,
|
|
1103
1118
|
states: {
|
|
1104
|
-
[`unknown${
|
|
1119
|
+
[`unknown${Kind}Invitation`]: {
|
|
1105
1120
|
always: [
|
|
1106
1121
|
{
|
|
1107
1122
|
cond: (context) => {
|
|
1108
|
-
const invitation = context[
|
|
1123
|
+
const invitation = context[Kind.toLowerCase()].invitation;
|
|
1109
1124
|
return !invitation || (invitation == null ? void 0 : invitation.state) === Invitation4.State.CONNECTING;
|
|
1110
1125
|
},
|
|
1111
|
-
target: `connecting${
|
|
1126
|
+
target: `connecting${Kind}Invitation`,
|
|
1112
1127
|
actions: "log"
|
|
1113
1128
|
},
|
|
1114
1129
|
{
|
|
1115
|
-
target: `inputting${
|
|
1130
|
+
target: `inputting${Kind}VerificationCode`,
|
|
1116
1131
|
actions: "log"
|
|
1117
1132
|
}
|
|
1118
1133
|
]
|
|
1119
1134
|
},
|
|
1120
|
-
[`connecting${
|
|
1121
|
-
[`inputting${
|
|
1135
|
+
[`connecting${Kind}Invitation`]: {},
|
|
1136
|
+
[`inputting${Kind}VerificationCode`]: {},
|
|
1137
|
+
[`authenticating${Kind}VerificationCode`]: {
|
|
1122
1138
|
on: {
|
|
1123
|
-
[`
|
|
1124
|
-
target: `
|
|
1125
|
-
actions:
|
|
1139
|
+
[`readyForAuthentication${Kind}Invitation`]: {
|
|
1140
|
+
target: `authenticationFailing${Kind}VerificationCode`,
|
|
1141
|
+
actions: [
|
|
1142
|
+
"setInvitation",
|
|
1143
|
+
"log"
|
|
1144
|
+
]
|
|
1126
1145
|
}
|
|
1127
1146
|
}
|
|
1128
1147
|
},
|
|
1129
|
-
[`
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
target: `authenticationFailing${Domain}VerificationCode`,
|
|
1133
|
-
actions: "log"
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
},
|
|
1137
|
-
[`authenticationFailing${Domain}VerificationCode`]: {},
|
|
1138
|
-
[`failing${Domain}Invitation`]: {},
|
|
1139
|
-
[`success${Domain}Invitation`]: {}
|
|
1148
|
+
[`authenticationFailing${Kind}VerificationCode`]: {},
|
|
1149
|
+
[`failing${Kind}Invitation`]: {},
|
|
1150
|
+
[`success${Kind}Invitation`]: {}
|
|
1140
1151
|
},
|
|
1141
1152
|
on: {
|
|
1142
|
-
[`reset${
|
|
1143
|
-
target: `#join${
|
|
1153
|
+
[`reset${Kind}Invitation`]: {
|
|
1154
|
+
target: `#join${Kind === "Halo" ? ".choosingIdentity" : ""}.accepting${Kind}Invitation.unknown${Kind}`,
|
|
1144
1155
|
actions: [
|
|
1145
1156
|
"resetInvitation",
|
|
1146
1157
|
"log"
|
|
1147
1158
|
]
|
|
1148
1159
|
},
|
|
1149
|
-
[`
|
|
1150
|
-
target: `.connecting${
|
|
1160
|
+
[`connecting${Kind}Invitation`]: {
|
|
1161
|
+
target: `.connecting${Kind}Invitation`,
|
|
1151
1162
|
actions: [
|
|
1152
1163
|
"setInvitation",
|
|
1153
1164
|
"log"
|
|
1154
1165
|
]
|
|
1155
1166
|
},
|
|
1156
|
-
[`
|
|
1157
|
-
target: `.
|
|
1167
|
+
[`connected${Kind}Invitation`]: {
|
|
1168
|
+
target: `.connecting${Kind}Invitation`,
|
|
1158
1169
|
actions: [
|
|
1159
1170
|
"setInvitation",
|
|
1160
1171
|
"log"
|
|
1161
1172
|
]
|
|
1162
1173
|
},
|
|
1163
|
-
[`
|
|
1174
|
+
[`readyForAuthentication${Kind}Invitation`]: {
|
|
1175
|
+
target: `.inputting${Kind}VerificationCode`,
|
|
1176
|
+
actions: [
|
|
1177
|
+
"setInvitation",
|
|
1178
|
+
"log"
|
|
1179
|
+
]
|
|
1180
|
+
},
|
|
1181
|
+
[`authenticating${Kind}Invitation`]: {
|
|
1182
|
+
target: `.authenticating${Kind}VerificationCode`,
|
|
1183
|
+
actions: [
|
|
1184
|
+
"setInvitation",
|
|
1185
|
+
"log"
|
|
1186
|
+
]
|
|
1187
|
+
},
|
|
1188
|
+
[`success${Kind}Invitation`]: {
|
|
1164
1189
|
target: successTarget,
|
|
1165
|
-
actions:
|
|
1190
|
+
actions: [
|
|
1191
|
+
"setInvitation",
|
|
1192
|
+
"log"
|
|
1193
|
+
]
|
|
1166
1194
|
},
|
|
1167
|
-
[`fail${
|
|
1168
|
-
target: `.failing${
|
|
1195
|
+
[`fail${Kind}Invitation`]: {
|
|
1196
|
+
target: `.failing${Kind}Invitation`,
|
|
1169
1197
|
actions: [
|
|
1170
1198
|
assign({
|
|
1171
|
-
[
|
|
1172
|
-
...context[
|
|
1199
|
+
[Kind.toLowerCase()]: (context, event) => ({
|
|
1200
|
+
...context[Kind.toLowerCase()],
|
|
1173
1201
|
failReason: event.reason
|
|
1174
1202
|
})
|
|
1175
1203
|
}),
|
|
@@ -1180,16 +1208,16 @@ var acceptingInvitationTemplate = (Domain, successTarget) => {
|
|
|
1180
1208
|
}
|
|
1181
1209
|
},
|
|
1182
1210
|
on: {
|
|
1183
|
-
[`set${
|
|
1184
|
-
target: `.acceptingRedeemed${
|
|
1211
|
+
[`set${Kind}InvitationCode`]: {
|
|
1212
|
+
target: `.acceptingRedeemed${Kind}Invitation`,
|
|
1185
1213
|
actions: [
|
|
1186
1214
|
assign({
|
|
1187
|
-
[
|
|
1188
|
-
...context[
|
|
1215
|
+
[Kind.toLowerCase()]: (context, event) => ({
|
|
1216
|
+
...context[Kind.toLowerCase()],
|
|
1189
1217
|
unredeemedCode: event.code
|
|
1190
1218
|
})
|
|
1191
1219
|
}),
|
|
1192
|
-
`redeem${
|
|
1220
|
+
`redeem${Kind}InvitationCode`,
|
|
1193
1221
|
"log"
|
|
1194
1222
|
]
|
|
1195
1223
|
}
|
|
@@ -1312,7 +1340,7 @@ var joinMachine = createMachine({
|
|
|
1312
1340
|
spaceInvitation: context.space.invitation
|
|
1313
1341
|
}, {
|
|
1314
1342
|
file: "joinMachine.ts",
|
|
1315
|
-
line:
|
|
1343
|
+
line: 351,
|
|
1316
1344
|
scope: void 0,
|
|
1317
1345
|
callSite: (f, a) => f(...a)
|
|
1318
1346
|
});
|
|
@@ -1327,7 +1355,7 @@ var defaultCodeFromUrl = (invitationType, text) => {
|
|
|
1327
1355
|
} catch (err) {
|
|
1328
1356
|
log.catch(err, {}, {
|
|
1329
1357
|
file: "joinMachine.ts",
|
|
1330
|
-
line:
|
|
1358
|
+
line: 377,
|
|
1331
1359
|
scope: void 0,
|
|
1332
1360
|
callSite: (f, a) => f(...a)
|
|
1333
1361
|
});
|
|
@@ -1682,7 +1710,7 @@ function _extends19() {
|
|
|
1682
1710
|
};
|
|
1683
1711
|
return _extends19.apply(this, arguments);
|
|
1684
1712
|
}
|
|
1685
|
-
var PureInvitationAcceptedContent = ({ onDone, result,
|
|
1713
|
+
var PureInvitationAcceptedContent = ({ onDone, result, Kind, doneActionParent, active }) => {
|
|
1686
1714
|
const disabled = !active;
|
|
1687
1715
|
const { t } = useTranslation13("os");
|
|
1688
1716
|
const doneButton = /* @__PURE__ */ React25.createElement(Button8, _extends19({}, onDone && {
|
|
@@ -1690,8 +1718,8 @@ var PureInvitationAcceptedContent = ({ onDone, result, Domain, doneActionParent,
|
|
|
1690
1718
|
}, {
|
|
1691
1719
|
disabled,
|
|
1692
1720
|
className: "flex items-center gap-2 pli-2",
|
|
1693
|
-
"data-autofocus": `success${
|
|
1694
|
-
"data-testid": `${
|
|
1721
|
+
"data-autofocus": `success${Kind}Invitation finishingJoining${Kind}`,
|
|
1722
|
+
"data-testid": `${Kind.toLowerCase()}-invitation-accepted-done`
|
|
1695
1723
|
}), /* @__PURE__ */ React25.createElement(CaretLeft3, {
|
|
1696
1724
|
weight: "bold",
|
|
1697
1725
|
className: mx18(getSize11(2), "invisible")
|
|
@@ -1715,8 +1743,8 @@ var InvitationAcceptedContent = (props) => {
|
|
|
1715
1743
|
};
|
|
1716
1744
|
var InvitationAccepted = (props) => {
|
|
1717
1745
|
var _a;
|
|
1718
|
-
const {
|
|
1719
|
-
const activeInvitation = (_a = viewStateProps.joinState) == null ? void 0 : _a.context[
|
|
1746
|
+
const { Kind, doneActionParent: _doneActionParent, onDone: _onDone, ...viewStateProps } = props;
|
|
1747
|
+
const activeInvitation = (_a = viewStateProps.joinState) == null ? void 0 : _a.context[Kind.toLowerCase()].invitationObservable;
|
|
1720
1748
|
return /* @__PURE__ */ React25.createElement(ViewState, _extends19({}, viewStateProps), !activeInvitation ? /* @__PURE__ */ React25.createElement(PureInvitationAcceptedContent, _extends19({}, props, {
|
|
1721
1749
|
result: null
|
|
1722
1750
|
})) : /* @__PURE__ */ React25.createElement(InvitationAcceptedContent, _extends19({}, props, {
|
|
@@ -1742,11 +1770,11 @@ function _extends20() {
|
|
|
1742
1770
|
};
|
|
1743
1771
|
return _extends20.apply(this, arguments);
|
|
1744
1772
|
}
|
|
1745
|
-
var InvitationInput = ({
|
|
1773
|
+
var InvitationInput = ({ Kind, ...viewStateProps }) => {
|
|
1746
1774
|
const disabled = !viewStateProps.active;
|
|
1747
1775
|
const { joinSend, joinState } = viewStateProps;
|
|
1748
1776
|
const { t } = useTranslation14("os");
|
|
1749
|
-
const contextUnredeemedCode = joinState == null ? void 0 : joinState.context[
|
|
1777
|
+
const contextUnredeemedCode = joinState == null ? void 0 : joinState.context[Kind.toLowerCase()].unredeemedCode;
|
|
1750
1778
|
const [inputValue, setInputValue] = useState4(contextUnredeemedCode != null ? contextUnredeemedCode : "");
|
|
1751
1779
|
useEffect(() => {
|
|
1752
1780
|
contextUnredeemedCode && setInputValue(contextUnredeemedCode != null ? contextUnredeemedCode : "");
|
|
@@ -1754,7 +1782,7 @@ var InvitationInput = ({ Domain, ...viewStateProps }) => {
|
|
|
1754
1782
|
contextUnredeemedCode
|
|
1755
1783
|
]);
|
|
1756
1784
|
const handleNext = () => joinSend({
|
|
1757
|
-
type: `set${
|
|
1785
|
+
type: `set${Kind}InvitationCode`,
|
|
1758
1786
|
code: inputValue
|
|
1759
1787
|
});
|
|
1760
1788
|
return /* @__PURE__ */ React26.createElement(ViewState, _extends20({}, viewStateProps), /* @__PURE__ */ React26.createElement(Input2, {
|
|
@@ -1767,8 +1795,8 @@ var InvitationInput = ({ Domain, ...viewStateProps }) => {
|
|
|
1767
1795
|
className: "m-0"
|
|
1768
1796
|
},
|
|
1769
1797
|
input: {
|
|
1770
|
-
"data-autofocus": `inputting${
|
|
1771
|
-
"data-testid": `${
|
|
1798
|
+
"data-autofocus": `inputting${Kind}InvitationCode`,
|
|
1799
|
+
"data-testid": `${Kind.toLowerCase()}-invitation-input`,
|
|
1772
1800
|
onKeyUp: ({ key }) => key === "Enter" && handleNext()
|
|
1773
1801
|
}
|
|
1774
1802
|
}
|
|
@@ -1781,7 +1809,7 @@ var InvitationInput = ({ Domain, ...viewStateProps }) => {
|
|
|
1781
1809
|
disabled,
|
|
1782
1810
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1783
1811
|
onClick: handleNext,
|
|
1784
|
-
"data-testid": `${
|
|
1812
|
+
"data-testid": `${Kind.toLowerCase()}-invitation-input-continue`
|
|
1785
1813
|
}, /* @__PURE__ */ React26.createElement(CaretLeft4, {
|
|
1786
1814
|
weight: "bold",
|
|
1787
1815
|
className: mx19(getSize12(2), "invisible")
|
|
@@ -1791,12 +1819,12 @@ var InvitationInput = ({ Domain, ...viewStateProps }) => {
|
|
|
1791
1819
|
weight: "bold",
|
|
1792
1820
|
className: getSize12(4)
|
|
1793
1821
|
})), /* @__PURE__ */ React26.createElement(Button9, {
|
|
1794
|
-
disabled:
|
|
1822
|
+
disabled: disabled || Kind === "Space",
|
|
1795
1823
|
onClick: () => joinSend({
|
|
1796
1824
|
type: "deselectAuthMethod"
|
|
1797
1825
|
}),
|
|
1798
1826
|
className: "flex items-center gap-2 pis-2 pie-4",
|
|
1799
|
-
"data-testid": `${
|
|
1827
|
+
"data-testid": `${Kind.toLowerCase()}-invitation-input-back`
|
|
1800
1828
|
}, /* @__PURE__ */ React26.createElement(CaretLeft4, {
|
|
1801
1829
|
weight: "bold",
|
|
1802
1830
|
className: getSize12(4)
|
|
@@ -1822,9 +1850,9 @@ function _extends21() {
|
|
|
1822
1850
|
};
|
|
1823
1851
|
return _extends21.apply(this, arguments);
|
|
1824
1852
|
}
|
|
1825
|
-
var InvitationActions = ({ invitationState, disabled, joinSend, joinState,
|
|
1853
|
+
var InvitationActions = ({ invitationState, disabled, joinSend, joinState, Kind }) => {
|
|
1826
1854
|
const { t } = useTranslation15("os");
|
|
1827
|
-
const invitationType =
|
|
1855
|
+
const invitationType = Kind.toLowerCase();
|
|
1828
1856
|
switch (invitationState) {
|
|
1829
1857
|
case Invitation6.State.CONNECTING:
|
|
1830
1858
|
return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(ViewStateHeading, {
|
|
@@ -1871,7 +1899,7 @@ var InvitationActions = ({ invitationState, disabled, joinSend, joinState, Domai
|
|
|
1871
1899
|
disabled,
|
|
1872
1900
|
className: "flex items-center gap-2 pli-2",
|
|
1873
1901
|
onClick: () => joinSend({
|
|
1874
|
-
type: `reset${
|
|
1902
|
+
type: `reset${Kind}Invitation`
|
|
1875
1903
|
}),
|
|
1876
1904
|
"data-testid": "invitation-rescuer-reset"
|
|
1877
1905
|
}, /* @__PURE__ */ React27.createElement(CaretLeft5, {
|
|
@@ -1884,11 +1912,11 @@ var InvitationActions = ({ invitationState, disabled, joinSend, joinState, Domai
|
|
|
1884
1912
|
})));
|
|
1885
1913
|
}
|
|
1886
1914
|
};
|
|
1887
|
-
var InvitationRescuer = ({
|
|
1915
|
+
var InvitationRescuer = ({ Kind, ...viewStateProps }) => {
|
|
1888
1916
|
var _a;
|
|
1889
1917
|
const disabled = !viewStateProps.active;
|
|
1890
1918
|
const { joinSend, joinState } = viewStateProps;
|
|
1891
|
-
const invitationState = (_a = joinState == null ? void 0 : joinState.context[
|
|
1919
|
+
const invitationState = (_a = joinState == null ? void 0 : joinState.context[Kind.toLowerCase()].invitation) == null ? void 0 : _a.state;
|
|
1892
1920
|
const { t } = useTranslation15("os");
|
|
1893
1921
|
return /* @__PURE__ */ React27.createElement(ViewState, _extends21({}, viewStateProps), typeof invitationState === "undefined" ? /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement("div", {
|
|
1894
1922
|
role: "none",
|
|
@@ -1896,10 +1924,10 @@ var InvitationRescuer = ({ Domain, ...viewStateProps }) => {
|
|
|
1896
1924
|
}), /* @__PURE__ */ React27.createElement(Button10, {
|
|
1897
1925
|
disabled,
|
|
1898
1926
|
className: "flex items-center gap-2 pli-2",
|
|
1899
|
-
"data-autofocus": `inputting${
|
|
1927
|
+
"data-autofocus": `inputting${Kind}InvitationCode`,
|
|
1900
1928
|
"data-testid": "invitation-rescuer-blank-reset",
|
|
1901
1929
|
onClick: () => joinSend({
|
|
1902
|
-
type: `reset${
|
|
1930
|
+
type: `reset${Kind}Invitation`
|
|
1903
1931
|
})
|
|
1904
1932
|
}, /* @__PURE__ */ React27.createElement(CaretLeft5, {
|
|
1905
1933
|
weight: "bold",
|
|
@@ -1913,7 +1941,7 @@ var InvitationRescuer = ({ Domain, ...viewStateProps }) => {
|
|
|
1913
1941
|
disabled,
|
|
1914
1942
|
joinSend,
|
|
1915
1943
|
joinState,
|
|
1916
|
-
|
|
1944
|
+
Kind
|
|
1917
1945
|
})));
|
|
1918
1946
|
};
|
|
1919
1947
|
|
|
@@ -1937,9 +1965,9 @@ function _extends22() {
|
|
|
1937
1965
|
return _extends22.apply(this, arguments);
|
|
1938
1966
|
}
|
|
1939
1967
|
var pinLength = 6;
|
|
1940
|
-
var PureInvitationAuthenticatorContent = ({ disabled, failed, joinSend, joinState,
|
|
1968
|
+
var PureInvitationAuthenticatorContent = ({ disabled, failed, joinSend, joinState, Kind, onChange, onAuthenticate }) => {
|
|
1941
1969
|
const { t } = useTranslation16("os");
|
|
1942
|
-
const invitationType =
|
|
1970
|
+
const invitationType = Kind.toLowerCase();
|
|
1943
1971
|
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Input3, _extends22({
|
|
1944
1972
|
label: /* @__PURE__ */ React28.createElement(ViewStateHeading, null, t("auth code input label")),
|
|
1945
1973
|
size: "pin",
|
|
@@ -1958,7 +1986,7 @@ var PureInvitationAuthenticatorContent = ({ disabled, failed, joinSend, joinStat
|
|
|
1958
1986
|
inputMode: "numeric",
|
|
1959
1987
|
autoComplete: "off",
|
|
1960
1988
|
pattern: "\\d*",
|
|
1961
|
-
"data-autofocus": `connecting${
|
|
1989
|
+
"data-autofocus": `connecting${Kind}Invitation inputting${Kind}VerificationCode authenticationFailing${Kind}VerificationCode authenticating${Kind}VerificationCode`,
|
|
1962
1990
|
"data-prevent-ios-autofocus": true,
|
|
1963
1991
|
"data-testid": `${invitationType}-auth-code-input`,
|
|
1964
1992
|
"data-1p-ignore": true
|
|
@@ -1999,13 +2027,13 @@ var PureInvitationAuthenticatorContent = ({ disabled, failed, joinSend, joinStat
|
|
|
1999
2027
|
className: getSize14(4)
|
|
2000
2028
|
}), /* @__PURE__ */ React28.createElement("span", null, t("cancel label")))));
|
|
2001
2029
|
};
|
|
2002
|
-
var InvitationAuthenticatorContent = ({ joinSend, joinState, disabled, invitation,
|
|
2003
|
-
const invitationType =
|
|
2030
|
+
var InvitationAuthenticatorContent = ({ joinSend, joinState, disabled, invitation, Kind, failed }) => {
|
|
2031
|
+
const invitationType = Kind.toLowerCase();
|
|
2004
2032
|
const [pinValue, setPinValue] = useState5("");
|
|
2005
2033
|
const { authenticate } = useInvitationStatus4(invitation);
|
|
2006
2034
|
const onAuthenticate = useCallback6(() => {
|
|
2007
2035
|
joinSend({
|
|
2008
|
-
type: `authenticate${
|
|
2036
|
+
type: `authenticate${Kind}VerificationCode`
|
|
2009
2037
|
});
|
|
2010
2038
|
void authenticate(pinValue);
|
|
2011
2039
|
}, [
|
|
@@ -2028,24 +2056,24 @@ var InvitationAuthenticatorContent = ({ joinSend, joinState, disabled, invitatio
|
|
|
2028
2056
|
failed,
|
|
2029
2057
|
joinSend,
|
|
2030
2058
|
joinState,
|
|
2031
|
-
|
|
2059
|
+
Kind,
|
|
2032
2060
|
onChange,
|
|
2033
2061
|
onAuthenticate
|
|
2034
2062
|
}));
|
|
2035
2063
|
};
|
|
2036
|
-
var InvitationAuthenticator = ({ failed,
|
|
2064
|
+
var InvitationAuthenticator = ({ failed, Kind, ...viewStateProps }) => {
|
|
2037
2065
|
const { joinSend, joinState } = viewStateProps;
|
|
2038
2066
|
const disabled = !viewStateProps.active || [
|
|
2039
2067
|
"connecting",
|
|
2040
2068
|
"authenticating"
|
|
2041
2069
|
].some((str) => joinState == null ? void 0 : joinState.configuration[0].id.includes(str));
|
|
2042
|
-
const activeInvitation = joinState == null ? void 0 : joinState.context[
|
|
2070
|
+
const activeInvitation = joinState == null ? void 0 : joinState.context[Kind.toLowerCase()].invitationObservable;
|
|
2043
2071
|
return /* @__PURE__ */ React28.createElement(ViewState, _extends22({}, viewStateProps), !activeInvitation ? /* @__PURE__ */ React28.createElement(PureInvitationAuthenticatorContent, _extends22({}, {
|
|
2044
2072
|
disabled,
|
|
2045
2073
|
failed,
|
|
2046
2074
|
joinSend,
|
|
2047
2075
|
joinState,
|
|
2048
|
-
|
|
2076
|
+
Kind,
|
|
2049
2077
|
onChange: () => {
|
|
2050
2078
|
},
|
|
2051
2079
|
onAuthenticate: () => {
|
|
@@ -2056,7 +2084,7 @@ var InvitationAuthenticator = ({ failed, Domain, ...viewStateProps }) => {
|
|
|
2056
2084
|
invitation: activeInvitation,
|
|
2057
2085
|
joinSend,
|
|
2058
2086
|
joinState,
|
|
2059
|
-
|
|
2087
|
+
Kind
|
|
2060
2088
|
})));
|
|
2061
2089
|
};
|
|
2062
2090
|
|
|
@@ -2160,7 +2188,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2160
2188
|
acceptingHaloInvitation: "inputtingHaloInvitationCode"
|
|
2161
2189
|
}
|
|
2162
2190
|
}),
|
|
2163
|
-
|
|
2191
|
+
Kind: "Halo"
|
|
2164
2192
|
})), /* @__PURE__ */ React29.createElement(InvitationRescuer, _extends23({}, {
|
|
2165
2193
|
joinState,
|
|
2166
2194
|
joinSend,
|
|
@@ -2180,7 +2208,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2180
2208
|
}
|
|
2181
2209
|
}
|
|
2182
2210
|
].some(joinState.matches),
|
|
2183
|
-
|
|
2211
|
+
Kind: "Halo"
|
|
2184
2212
|
})), /* @__PURE__ */ React29.createElement(InvitationAuthenticator, _extends23({}, {
|
|
2185
2213
|
joinState,
|
|
2186
2214
|
joinSend,
|
|
@@ -2207,7 +2235,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2207
2235
|
}
|
|
2208
2236
|
}
|
|
2209
2237
|
].some(joinState.matches),
|
|
2210
|
-
|
|
2238
|
+
Kind: "Halo",
|
|
2211
2239
|
...joinState.matches({
|
|
2212
2240
|
acceptingHaloInvitation: {
|
|
2213
2241
|
acceptingRedeemedHaloInvitation: "authenticationFailingHaloVerificationCode"
|
|
@@ -2228,7 +2256,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2228
2256
|
},
|
|
2229
2257
|
"finishingJoiningHalo"
|
|
2230
2258
|
].some(joinState.matches),
|
|
2231
|
-
|
|
2259
|
+
Kind: "Halo",
|
|
2232
2260
|
doneActionParent,
|
|
2233
2261
|
onDone
|
|
2234
2262
|
})), /* @__PURE__ */ React29.createElement(IdentityAdded, _extends23({}, {
|
|
@@ -2246,7 +2274,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2246
2274
|
active: joinState.matches({
|
|
2247
2275
|
acceptingSpaceInvitation: "inputtingSpaceInvitationCode"
|
|
2248
2276
|
}),
|
|
2249
|
-
|
|
2277
|
+
Kind: "Space"
|
|
2250
2278
|
})), /* @__PURE__ */ React29.createElement(InvitationRescuer, _extends23({}, {
|
|
2251
2279
|
joinState,
|
|
2252
2280
|
joinSend,
|
|
@@ -2262,7 +2290,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2262
2290
|
}
|
|
2263
2291
|
}
|
|
2264
2292
|
].some(joinState.matches),
|
|
2265
|
-
|
|
2293
|
+
Kind: "Space"
|
|
2266
2294
|
})), /* @__PURE__ */ React29.createElement(InvitationAuthenticator, _extends23({}, {
|
|
2267
2295
|
joinState,
|
|
2268
2296
|
joinSend,
|
|
@@ -2283,7 +2311,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2283
2311
|
}
|
|
2284
2312
|
}
|
|
2285
2313
|
].some(joinState.matches),
|
|
2286
|
-
|
|
2314
|
+
Kind: "Space",
|
|
2287
2315
|
...joinState.matches({
|
|
2288
2316
|
acceptingSpaceInvitation: {
|
|
2289
2317
|
acceptingRedeemedSpaceInvitation: "authenticationFailingSpaceVerificationCode"
|
|
@@ -2295,7 +2323,7 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2295
2323
|
joinState,
|
|
2296
2324
|
joinSend,
|
|
2297
2325
|
active: joinState.matches("finishingJoiningSpace"),
|
|
2298
|
-
|
|
2326
|
+
Kind: "Space",
|
|
2299
2327
|
doneActionParent,
|
|
2300
2328
|
onDone
|
|
2301
2329
|
})))));
|
|
@@ -2303,7 +2331,8 @@ var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, on
|
|
|
2303
2331
|
|
|
2304
2332
|
// packages/apps/patterns/react-ui/src/panels/SpacePanel/SpacePanel.tsx
|
|
2305
2333
|
import { UserPlus as UserPlus2 } from "@phosphor-icons/react";
|
|
2306
|
-
import React30, { useReducer as useReducer2 } from "react";
|
|
2334
|
+
import React30, { useCallback as useCallback7, useReducer as useReducer2 } from "react";
|
|
2335
|
+
import { InvitationEncoder as InvitationEncoder2 } from "@dxos/client";
|
|
2307
2336
|
import { useSpaceInvitations as useSpaceInvitations2, observer } from "@dxos/react-client";
|
|
2308
2337
|
import { Button as Button12, DensityProvider as DensityProvider5, getSize as getSize15, mx as mx22, useTranslation as useTranslation17 } from "@dxos/react-components";
|
|
2309
2338
|
function _extends24() {
|
|
@@ -2324,9 +2353,21 @@ var CurrentSpaceView = observer(({ space, createInvitationUrl, titleId }) => {
|
|
|
2324
2353
|
const { t } = useTranslation17("os");
|
|
2325
2354
|
const invitations = useSpaceInvitations2(space == null ? void 0 : space.key);
|
|
2326
2355
|
const name = space == null ? void 0 : space.properties.name;
|
|
2356
|
+
console.log("[space panel]", "development");
|
|
2327
2357
|
if (!space) {
|
|
2328
2358
|
return null;
|
|
2329
2359
|
}
|
|
2360
|
+
const onInvitationEvent = useCallback7((invitation) => {
|
|
2361
|
+
const invitationCode = InvitationEncoder2.encode(invitation);
|
|
2362
|
+
console.log(JSON.stringify({
|
|
2363
|
+
invitationCode
|
|
2364
|
+
}));
|
|
2365
|
+
if (invitation.authCode) {
|
|
2366
|
+
console.log(JSON.stringify({
|
|
2367
|
+
authCode: invitation.authCode
|
|
2368
|
+
}));
|
|
2369
|
+
}
|
|
2370
|
+
}, []);
|
|
2330
2371
|
return /* @__PURE__ */ React30.createElement("div", {
|
|
2331
2372
|
role: "none",
|
|
2332
2373
|
className: "flex flex-col"
|
|
@@ -2341,11 +2382,16 @@ var CurrentSpaceView = observer(({ space, createInvitationUrl, titleId }) => {
|
|
|
2341
2382
|
className: mx22(defaultSurface, "rounded-be-md p-2")
|
|
2342
2383
|
}, /* @__PURE__ */ React30.createElement(InvitationList, {
|
|
2343
2384
|
invitations,
|
|
2344
|
-
onClickRemove: (
|
|
2385
|
+
onClickRemove: (invitation) => invitation.get() && (space == null ? void 0 : space.removeInvitation(invitation.get().invitationId)),
|
|
2345
2386
|
createInvitationUrl
|
|
2346
2387
|
}), /* @__PURE__ */ React30.createElement(Button12, {
|
|
2347
2388
|
className: "is-full flex gap-2 mbs-2",
|
|
2348
|
-
onClick: () =>
|
|
2389
|
+
onClick: () => {
|
|
2390
|
+
const invitation = space == null ? void 0 : space.createInvitation();
|
|
2391
|
+
if (true) {
|
|
2392
|
+
invitation.subscribe(onInvitationEvent);
|
|
2393
|
+
}
|
|
2394
|
+
},
|
|
2349
2395
|
"data-testid": "spaces-panel.create-invitation"
|
|
2350
2396
|
}, /* @__PURE__ */ React30.createElement("span", null, t("create space invitation label")), /* @__PURE__ */ React30.createElement(UserPlus2, {
|
|
2351
2397
|
className: getSize15(4),
|
|
@@ -2646,7 +2692,7 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2646
2692
|
};
|
|
2647
2693
|
|
|
2648
2694
|
// packages/apps/patterns/react-ui/src/composites/Shell/ShellContext.tsx
|
|
2649
|
-
import React36, { createContext as createContext3, useCallback as
|
|
2695
|
+
import React36, { createContext as createContext3, useCallback as useCallback8, useContext as useContext3, useEffect as useEffect4, useMemo as useMemo3, useState as useState7 } from "react";
|
|
2650
2696
|
import { IFrameClientServicesProxy, ShellDisplay as ShellDisplay2, ShellLayout as ShellLayout2 } from "@dxos/client";
|
|
2651
2697
|
import { MemoryShellRuntime } from "@dxos/client-services";
|
|
2652
2698
|
import { useClient as useClient7, useIdentity as useIdentity3 } from "@dxos/react-client";
|
|
@@ -2689,7 +2735,7 @@ var ShellProvider = ({ space, haloInvitationCode, spaceInvitationCode, onJoinedS
|
|
|
2689
2735
|
const identity = useIdentity3();
|
|
2690
2736
|
const [display, setDisplay] = useState7(!identity || spaceInvitationCode || haloInvitationCode ? ShellDisplay2.FULLSCREEN : ShellDisplay2.NONE);
|
|
2691
2737
|
const shellRuntime = useMemo3(() => {
|
|
2692
|
-
if (client.config.get("runtime.app.env.DX_VAULT")
|
|
2738
|
+
if (client.config.get("runtime.app.env.DX_VAULT") !== "false") {
|
|
2693
2739
|
return;
|
|
2694
2740
|
}
|
|
2695
2741
|
if (spaceInvitationCode) {
|
|
@@ -2698,9 +2744,14 @@ var ShellProvider = ({ space, haloInvitationCode, spaceInvitationCode, onJoinedS
|
|
|
2698
2744
|
invitationCode: spaceInvitationCode
|
|
2699
2745
|
});
|
|
2700
2746
|
}
|
|
2747
|
+
if (haloInvitationCode) {
|
|
2748
|
+
return new MemoryShellRuntime({
|
|
2749
|
+
layout: ShellLayout2.INITIALIZE_IDENTITY,
|
|
2750
|
+
invitationCode: haloInvitationCode
|
|
2751
|
+
});
|
|
2752
|
+
}
|
|
2701
2753
|
return new MemoryShellRuntime({
|
|
2702
|
-
layout:
|
|
2703
|
-
invitationCode: haloInvitationCode != null ? haloInvitationCode : void 0
|
|
2754
|
+
layout: ShellLayout2.DEFAULT
|
|
2704
2755
|
});
|
|
2705
2756
|
}, [
|
|
2706
2757
|
client,
|
|
@@ -2708,7 +2759,7 @@ var ShellProvider = ({ space, haloInvitationCode, spaceInvitationCode, onJoinedS
|
|
|
2708
2759
|
spaceInvitationCode,
|
|
2709
2760
|
haloInvitationCode
|
|
2710
2761
|
]);
|
|
2711
|
-
const handleKeyDown =
|
|
2762
|
+
const handleKeyDown = useCallback8((event) => {
|
|
2712
2763
|
if (!space || !shellRuntime) {
|
|
2713
2764
|
return;
|
|
2714
2765
|
}
|
|
@@ -2757,7 +2808,7 @@ var ShellProvider = ({ space, haloInvitationCode, spaceInvitationCode, onJoinedS
|
|
|
2757
2808
|
runtime: shellRuntime,
|
|
2758
2809
|
setDisplay
|
|
2759
2810
|
}
|
|
2760
|
-
},
|
|
2811
|
+
}, children));
|
|
2761
2812
|
};
|
|
2762
2813
|
|
|
2763
2814
|
// packages/apps/patterns/react-ui/src/translations/locales/en-US.ts
|