@dxos/react-ui 0.1.31 → 0.1.32-next.86f5578
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/index.mjs +1018 -870
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/IdentityList/SpaceMemberListContainer.d.ts.map +1 -1
- package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts +2 -2
- package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +64 -0
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts +2 -5
- package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.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/JoinPanel/view-states/ViewState.d.ts +4 -6
- package/dist/types/src/panels/JoinPanel/view-states/ViewState.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/view-states/index.d.ts +0 -1
- package/dist/types/src/panels/JoinPanel/view-states/index.d.ts.map +1 -1
- package/dist/types/src/playwright/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/translations/locales/en-US.d.ts +3 -1
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/toEmoji.d.ts +2 -0
- package/dist/types/src/util/toEmoji.d.ts.map +1 -0
- package/package.json +18 -14
- package/src/components/IdentityList/SpaceMemberListContainer.tsx +6 -2
- package/src/components/InvitationList/InvitationList.stories.tsx +1 -1
- package/src/composites/JoinDialog/JoinDialog.stories.tsx +4 -2
- package/src/composites/Shell/Shell.stories.tsx +1 -1
- package/src/composites/Shell/Shell.tsx +1 -1
- package/src/panels/JoinPanel/JoinHeading.tsx +42 -40
- package/src/panels/JoinPanel/JoinPanel.tsx +140 -218
- package/src/panels/JoinPanel/JoinPanelProps.ts +1 -1
- package/src/panels/JoinPanel/joinMachine.ts +418 -0
- package/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx +9 -21
- package/src/panels/JoinPanel/view-states/IdentityAdded.tsx +6 -6
- package/src/panels/JoinPanel/view-states/IdentityInput.tsx +4 -4
- package/src/panels/JoinPanel/view-states/InvitationAccepted.tsx +22 -18
- package/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx +37 -28
- package/src/panels/JoinPanel/view-states/InvitationInput.tsx +21 -21
- package/src/panels/JoinPanel/view-states/InvitationRescuer.tsx +58 -41
- package/src/panels/JoinPanel/view-states/ViewState.tsx +11 -62
- package/src/panels/JoinPanel/view-states/index.ts +0 -1
- package/src/playwright/invitations-manager.ts +6 -2
- package/src/playwright/invitations.spec.ts +14 -5
- package/src/stories/Invitations.stories.tsx +2 -2
- package/src/translations/locales/en-US.ts +6 -4
- package/src/util/index.ts +1 -0
- package/src/util/toEmoji.ts +22 -0
- package/dist/types/src/panels/JoinPanel/view-states/IdentitySelector.d.ts +0 -7
- package/dist/types/src/panels/JoinPanel/view-states/IdentitySelector.d.ts.map +0 -1
- package/src/panels/JoinPanel/view-states/IdentitySelector.tsx +0 -100
|
@@ -100,7 +100,7 @@ import { useClient, useMembers } from "@dxos/react-client";
|
|
|
100
100
|
var SpaceMemberListContainer = ({ spaceKey, includeSelf, onSelect }) => {
|
|
101
101
|
const client = useClient();
|
|
102
102
|
const allUnsortedMembers = useMembers(spaceKey);
|
|
103
|
-
const members = useMemo(() => includeSelf ? allUnsortedMembers.sort((a) => a.identity.identityKey.equals(client.halo.identity.identityKey) ? -1 : 1) : allUnsortedMembers.filter((member) => !member.identity.identityKey.equals(client.halo.identity.identityKey)), [
|
|
103
|
+
const members = useMemo(() => includeSelf ? allUnsortedMembers.sort((a) => a.identity.identityKey.equals(client.halo.identity.get().identityKey) ? -1 : 1) : allUnsortedMembers.filter((member) => !member.identity.identityKey.equals(client.halo.identity.get().identityKey)), [
|
|
104
104
|
allUnsortedMembers
|
|
105
105
|
]);
|
|
106
106
|
return /* @__PURE__ */ React4.createElement(SpaceMemberList, {
|
|
@@ -181,6 +181,24 @@ var invitationStatusValue = /* @__PURE__ */ new Map([
|
|
|
181
181
|
]
|
|
182
182
|
]);
|
|
183
183
|
|
|
184
|
+
// packages/apps/patterns/react-ui/src/util/toEmoji.ts
|
|
185
|
+
import toArray from "lodash.toarray";
|
|
186
|
+
var emoji = toArray(
|
|
187
|
+
// When changing this set, please check the result in a console or e.g. RunKit (https://runkit.com/thure/642214441dd6ae000855a8de)
|
|
188
|
+
// Emoji sometimes use a combination of code points, and some code points aren't visible on their own, so by adding or deleting you may unintentionally create non-visible items.
|
|
189
|
+
// This set was chosen from the characters in Unicode Emoji v15.0 based on the following criteria:
|
|
190
|
+
// – not people or isolated anthropomorphic faces
|
|
191
|
+
// – not flags
|
|
192
|
+
// – more concrete than abstract
|
|
193
|
+
// – less culturally specific
|
|
194
|
+
// – less easily confused with another emoji in the set
|
|
195
|
+
// – requires less special knowledge to identify
|
|
196
|
+
// – less likely to evoke negative feelings (no meat, no drugs, no weapons, etc)
|
|
197
|
+
// – less common as a signifier in UX
|
|
198
|
+
"\u{1F479}\u{1F47B}\u{1F47D}\u{1F916}\u{1F383}\u{1F9BE}\u{1F9BF}\u{1F9B7}\u{1F463}\u{1F441}\uFE0F\u{1F9F6}\u{1F451}\u{1F412}\u{1F986}\u{1F989}\u{1F434}\u{1F984}\u{1F41D}\u{1F98B}\u{1F41E}\u{1FAB2}\u{1F422}\u{1F98E}\u{1F995}\u{1F991}\u{1F980}\u{1F420}\u{1F42C}\u{1F40B}\u{1F9AD}\u{1F405}\u{1F406}\u{1F993}\u{1F98D}\u{1F9A7}\u{1F418}\u{1F42B}\u{1F992}\u{1F998}\u{1F9AC}\u{1F416}\u{1F40F}\u{1F98C}\u{1F415}\u{1F408}\u{1F413}\u{1F99A}\u{1F99C}\u{1F9A2}\u{1F9A9}\u{1F9A6}\u{1F401}\u{1F43F}\uFE0F\u{1F335}\u{1F332}\u{1F333}\u{1FAB5}\u{1F331}\u{1F341}\u{1FABA}\u{1F344}\u{1F41A}\u{1FAB8}\u{1FAA8}\u{1F33E}\u{1F337}\u{1F33B}\u2600\uFE0F\u{1F319}\u{1FA90}\u2B50\uFE0F\u26A1\uFE0F\u2604\uFE0F\u{1F525}\u{1F308}\u2601\uFE0F\u{1F4A7}\u26F1\uFE0F\u{1F30A}\u{1F34E}\u{1F34B}\u{1F349}\u{1F347}\u{1FAD0}\u{1F348}\u{1F352}\u{1F351}\u{1F96D}\u{1F34D}\u{1F965}\u{1F95D}\u{1F951}\u{1F336}\uFE0F\u{1F33D}\u{1F955}\u{1F36C}\u{1F95C}\u{1FAD6}\u2615\uFE0F\u{1F375}\u{1F9CA}\u{1F9C2}\u{1F3D4}\uFE0F\u2693\uFE0F\u{1F6DF}\u{1F3DD}\uFE0F\u{1F6F6}\u{1F680}\u{1F6F0}\uFE0F\u26F2\uFE0F\u{1F3F0}\u{1F6B2}\u26FA\uFE0F\u{1F399}\uFE0F\u{1F9F2}\u2699\uFE0F\u{1F529}\u{1F52E}\u{1F52D}\u{1F52C}\u{1F9EC}\u{1F321}\uFE0F\u{1F9FA}\u{1F6CE}\uFE0F\u{1F511}\u{1FA91}\u{1F9F8}\u{1F388}\u{1F380}\u{1F38A}\u267B\uFE0F\u{1F3B5}"
|
|
199
|
+
);
|
|
200
|
+
var toEmoji = (keyAsHex) => emoji[parseInt(keyAsHex, 16) % emoji.length];
|
|
201
|
+
|
|
184
202
|
// packages/apps/patterns/react-ui/src/components/InvitationList/InvitationStatusAvatar.tsx
|
|
185
203
|
function _extends2() {
|
|
186
204
|
_extends2 = Object.assign || function(target) {
|
|
@@ -480,8 +498,8 @@ var SpaceListItem = /* @__PURE__ */ forwardRef(({ space, onClick }, ref) => {
|
|
|
480
498
|
});
|
|
481
499
|
|
|
482
500
|
// packages/apps/patterns/react-ui/src/composites/IdentityPopover/IdentityPopover.tsx
|
|
483
|
-
import
|
|
484
|
-
import { Avatar as
|
|
501
|
+
import React28 from "react";
|
|
502
|
+
import { Avatar as Avatar5, mx as mx21 } from "@dxos/react-components";
|
|
485
503
|
|
|
486
504
|
// packages/apps/patterns/react-ui/src/layouts/PanelPopover/PanelPopover.tsx
|
|
487
505
|
import React11 from "react";
|
|
@@ -789,17 +807,16 @@ var IdentityPanel = ({ identity, onClickManageProfile }) => {
|
|
|
789
807
|
};
|
|
790
808
|
|
|
791
809
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/JoinPanel.tsx
|
|
792
|
-
import
|
|
793
|
-
import {
|
|
794
|
-
import {
|
|
795
|
-
import { useClient as useClient6, useIdentity as useIdentity2 } from "@dxos/react-client";
|
|
810
|
+
import React26, { useEffect as useEffect2 } from "react";
|
|
811
|
+
import { log as log2 } from "@dxos/log";
|
|
812
|
+
import { useClient as useClient5, useIdentity as useIdentity2 } from "@dxos/react-client";
|
|
796
813
|
import { DensityProvider as DensityProvider4, useId as useId4 } from "@dxos/react-components";
|
|
797
814
|
|
|
798
815
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/JoinHeading.tsx
|
|
799
|
-
import {
|
|
816
|
+
import { X as X3 } from "@phosphor-icons/react";
|
|
800
817
|
import React17, { cloneElement as cloneElement2, forwardRef as forwardRef2 } from "react";
|
|
801
818
|
import { useSpace as useSpace2 } from "@dxos/react-client";
|
|
802
|
-
import {
|
|
819
|
+
import { Button as Button4, defaultDescription as defaultDescription2, getSize as getSize4, Heading, mx as mx12, useId as useId2, useTranslation as useTranslation7 } from "@dxos/react-components";
|
|
803
820
|
function _extends13() {
|
|
804
821
|
_extends13 = Object.assign || function(target) {
|
|
805
822
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -814,72 +831,483 @@ function _extends13() {
|
|
|
814
831
|
};
|
|
815
832
|
return _extends13.apply(this, arguments);
|
|
816
833
|
}
|
|
817
|
-
var JoinHeading = /* @__PURE__ */ forwardRef2(({ mode, titleId,
|
|
818
|
-
var _a, _b
|
|
834
|
+
var JoinHeading = /* @__PURE__ */ forwardRef2(({ mode, titleId, joinState, onExit, exitActionParent, preventExit }, ref) => {
|
|
835
|
+
var _a, _b;
|
|
819
836
|
const { t } = useTranslation7("os");
|
|
820
|
-
const space = useSpace2((_a =
|
|
821
|
-
const name =
|
|
837
|
+
const space = useSpace2((_a = joinState == null ? void 0 : joinState.context.space.invitation) == null ? void 0 : _a.spaceKey);
|
|
838
|
+
const name = space == null ? void 0 : space.properties.name;
|
|
822
839
|
const nameId = useId2(mode === "halo-only" ? "identityDisplayName" : "spaceDisplayName");
|
|
823
|
-
const invitationKey =
|
|
840
|
+
const invitationKey = (_b = joinState == null ? void 0 : joinState.context[mode === "halo-only" ? "halo" : "space"].invitation) == null ? void 0 : _b.invitationId;
|
|
841
|
+
const invitationEmoji = invitationKey && toEmoji(invitationKey);
|
|
824
842
|
const exitButton = /* @__PURE__ */ React17.createElement(Button4, _extends13({
|
|
825
843
|
variant: "ghost"
|
|
826
844
|
}, onExit && {
|
|
827
845
|
onClick: onExit
|
|
828
846
|
}, {
|
|
829
|
-
className: "
|
|
847
|
+
className: mx12(defaultDescription2, "plb-0 pli-2 absolute block-start-1.5 inline-end-2 z-[1]"),
|
|
830
848
|
"data-testid": "join-exit"
|
|
831
|
-
}), /* @__PURE__ */ React17.createElement(
|
|
832
|
-
|
|
849
|
+
}), /* @__PURE__ */ React17.createElement(X3, {
|
|
850
|
+
weight: "bold",
|
|
851
|
+
className: getSize4(4)
|
|
833
852
|
}), /* @__PURE__ */ React17.createElement("span", {
|
|
834
853
|
className: "sr-only"
|
|
835
854
|
}, t("exit label")));
|
|
836
855
|
return /* @__PURE__ */ React17.createElement("div", {
|
|
837
856
|
role: "none",
|
|
838
|
-
className: mx12(
|
|
857
|
+
className: mx12(defaultSurface, "pbs-3 pbe-1 rounded-bs-md relative"),
|
|
839
858
|
ref
|
|
840
|
-
}, /* @__PURE__ */ React17.createElement(
|
|
841
|
-
role: "group",
|
|
842
|
-
className: "flex items-center gap-2"
|
|
843
|
-
}, invitationKey ? /* @__PURE__ */ React17.createElement(Avatar4, {
|
|
844
|
-
fallbackValue: invitationKey,
|
|
845
|
-
labelId: nameId
|
|
846
|
-
}) : /* @__PURE__ */ React17.createElement("span", {
|
|
847
|
-
role: "none",
|
|
848
|
-
className: mx12(getSize4(10), "bg-neutral-300 dark:bg-neutral-700 rounded-full")
|
|
849
|
-
}), /* @__PURE__ */ React17.createElement(Heading, {
|
|
859
|
+
}, !preventExit && mode !== "halo-only" && (exitActionParent ? /* @__PURE__ */ cloneElement2(exitActionParent, {}, exitButton) : exitButton), /* @__PURE__ */ React17.createElement(Heading, {
|
|
850
860
|
level: 1,
|
|
851
|
-
className: "font-body font-normal text-
|
|
861
|
+
className: mx12(defaultDescription2, "font-body font-system-normal text-center text-sm grow pbe-2", mode === "halo-only" && (preventExit ? "sr-only" : "opacity-0")),
|
|
852
862
|
id: titleId
|
|
853
|
-
},
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
+
}, t(mode === "halo-only" ? "selecting identity heading" : "joining space heading")), /* @__PURE__ */ React17.createElement("div", {
|
|
864
|
+
role: "group",
|
|
865
|
+
className: "flex items-center justify-center gap-2"
|
|
866
|
+
}, /* @__PURE__ */ React17.createElement("span", {
|
|
867
|
+
role: "none",
|
|
868
|
+
className: mx12(getSize4(12), "bg-neutral-300 dark:bg-neutral-700 rounded-full text-center text-4xl leading-[3rem]")
|
|
869
|
+
}, invitationEmoji), name && /* @__PURE__ */ React17.createElement("p", {
|
|
870
|
+
id: nameId
|
|
871
|
+
}, name)));
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
// packages/apps/patterns/react-ui/src/panels/JoinPanel/joinMachine.ts
|
|
875
|
+
import { useMachine } from "@xstate/react";
|
|
876
|
+
import { useCallback as useCallback4 } from "react";
|
|
877
|
+
import { assign, createMachine } from "xstate";
|
|
878
|
+
import { Invitation as Invitation4, InvitationEncoder } from "@dxos/client";
|
|
879
|
+
import { log } from "@dxos/log";
|
|
880
|
+
var getInvitationSubscribable = (Domain, invitation) => {
|
|
881
|
+
log("[subscribing to invitation]", invitation, {
|
|
882
|
+
file: "joinMachine.ts",
|
|
883
|
+
line: 75,
|
|
884
|
+
scope: void 0,
|
|
885
|
+
callSite: (f, a) => f(...a)
|
|
886
|
+
});
|
|
887
|
+
return {
|
|
888
|
+
subscribe: (next, onError, complete) => {
|
|
889
|
+
const unsubscribe = invitation.subscribe({
|
|
890
|
+
onAuthenticating: (invitation2) => {
|
|
891
|
+
log("[invitation authenticating]", {
|
|
892
|
+
Domain,
|
|
893
|
+
invitation: invitation2
|
|
894
|
+
}, {
|
|
895
|
+
file: "joinMachine.ts",
|
|
896
|
+
line: 84,
|
|
897
|
+
scope: void 0,
|
|
898
|
+
callSite: (f, a) => f(...a)
|
|
899
|
+
});
|
|
900
|
+
return next({
|
|
901
|
+
type: `authenticate${Domain}Invitation`,
|
|
902
|
+
invitation: invitation2
|
|
903
|
+
});
|
|
904
|
+
},
|
|
905
|
+
onCancelled: () => {
|
|
906
|
+
log.warn("[invitation cancelled]", {
|
|
907
|
+
Domain
|
|
908
|
+
}, {
|
|
909
|
+
file: "joinMachine.ts",
|
|
910
|
+
line: 88,
|
|
911
|
+
scope: void 0,
|
|
912
|
+
callSite: (f, a) => f(...a)
|
|
913
|
+
});
|
|
914
|
+
return next({
|
|
915
|
+
type: `fail${Domain}Invitation`,
|
|
916
|
+
reason: "cancelled"
|
|
917
|
+
});
|
|
918
|
+
},
|
|
919
|
+
onTimeout: () => {
|
|
920
|
+
log.error("[invitation timeout]", {
|
|
921
|
+
Domain
|
|
922
|
+
}, {
|
|
923
|
+
file: "joinMachine.ts",
|
|
924
|
+
line: 92,
|
|
925
|
+
scope: void 0,
|
|
926
|
+
callSite: (f, a) => f(...a)
|
|
927
|
+
});
|
|
928
|
+
return next({
|
|
929
|
+
type: `fail${Domain}Invitation`,
|
|
930
|
+
reason: "timeout"
|
|
931
|
+
});
|
|
932
|
+
},
|
|
933
|
+
onConnecting: (invitation2) => {
|
|
934
|
+
log("[invitation connecting]", {
|
|
935
|
+
Domain,
|
|
936
|
+
invitation: invitation2
|
|
937
|
+
}, {
|
|
938
|
+
file: "joinMachine.ts",
|
|
939
|
+
line: 96,
|
|
940
|
+
scope: void 0,
|
|
941
|
+
callSite: (f, a) => f(...a)
|
|
942
|
+
});
|
|
943
|
+
return next({
|
|
944
|
+
type: `connect${Domain}Invitation`,
|
|
945
|
+
invitation: invitation2
|
|
946
|
+
});
|
|
947
|
+
},
|
|
948
|
+
onConnected: (invitation2) => {
|
|
949
|
+
log("[invitation connected]", {
|
|
950
|
+
Domain,
|
|
951
|
+
invitation: invitation2
|
|
952
|
+
}, {
|
|
953
|
+
file: "joinMachine.ts",
|
|
954
|
+
line: 100,
|
|
955
|
+
scope: void 0,
|
|
956
|
+
callSite: (f, a) => f(...a)
|
|
957
|
+
});
|
|
958
|
+
return next({
|
|
959
|
+
type: `connectionSuccess${Domain}Invitation`,
|
|
960
|
+
invitation: invitation2
|
|
961
|
+
});
|
|
962
|
+
},
|
|
963
|
+
onSuccess: () => {
|
|
964
|
+
log("[invitation success]", {
|
|
965
|
+
Domain
|
|
966
|
+
}, {
|
|
967
|
+
file: "joinMachine.ts",
|
|
968
|
+
line: 104,
|
|
969
|
+
scope: void 0,
|
|
970
|
+
callSite: (f, a) => f(...a)
|
|
971
|
+
});
|
|
972
|
+
next({
|
|
973
|
+
type: `succeed${Domain}Invitation`
|
|
974
|
+
});
|
|
975
|
+
return complete == null ? void 0 : complete();
|
|
976
|
+
},
|
|
977
|
+
onError: (error) => {
|
|
978
|
+
log.error("[invitation errored]", {
|
|
979
|
+
Domain,
|
|
980
|
+
error
|
|
981
|
+
}, {
|
|
982
|
+
file: "joinMachine.ts",
|
|
983
|
+
line: 109,
|
|
984
|
+
scope: void 0,
|
|
985
|
+
callSite: (f, a) => f(...a)
|
|
986
|
+
});
|
|
987
|
+
next({
|
|
988
|
+
type: `fail${Domain}Invitation`,
|
|
989
|
+
reason: "error"
|
|
990
|
+
});
|
|
991
|
+
return onError == null ? void 0 : onError(error);
|
|
992
|
+
}
|
|
993
|
+
});
|
|
994
|
+
return {
|
|
995
|
+
unsubscribe
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
};
|
|
1000
|
+
var acceptingInvitationTemplate = (Domain, successTarget) => {
|
|
1001
|
+
const config = {
|
|
1002
|
+
initial: `unknown${Domain}`,
|
|
1003
|
+
states: {
|
|
1004
|
+
[`unknown${Domain}`]: {
|
|
1005
|
+
always: [
|
|
1006
|
+
{
|
|
1007
|
+
cond: ({ mode }) => mode === "halo-only" && Domain === "Space",
|
|
1008
|
+
target: "#join.finishingJoiningHalo"
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
// cond: `no${Domain}Invitation`,
|
|
1012
|
+
target: `inputting${Domain}InvitationCode`,
|
|
1013
|
+
actions: "log"
|
|
1014
|
+
}
|
|
1015
|
+
]
|
|
1016
|
+
},
|
|
1017
|
+
[`inputting${Domain}InvitationCode`]: {},
|
|
1018
|
+
[`acceptingRedeemed${Domain}Invitation`]: {
|
|
1019
|
+
invoke: {
|
|
1020
|
+
src: (context) => context[Domain.toLowerCase()].invitationSubscribable
|
|
1021
|
+
},
|
|
1022
|
+
initial: `unknown${Domain}Invitation`,
|
|
1023
|
+
states: {
|
|
1024
|
+
[`unknown${Domain}Invitation`]: {
|
|
1025
|
+
always: [
|
|
1026
|
+
{
|
|
1027
|
+
cond: (context) => {
|
|
1028
|
+
const invitation = context[Domain.toLowerCase()].invitation;
|
|
1029
|
+
return !invitation || (invitation == null ? void 0 : invitation.state) === Invitation4.State.CONNECTING;
|
|
1030
|
+
},
|
|
1031
|
+
target: `connecting${Domain}Invitation`,
|
|
1032
|
+
actions: "log"
|
|
1033
|
+
},
|
|
1034
|
+
{
|
|
1035
|
+
target: `inputting${Domain}VerificationCode`,
|
|
1036
|
+
actions: "log"
|
|
1037
|
+
}
|
|
1038
|
+
]
|
|
1039
|
+
},
|
|
1040
|
+
[`connecting${Domain}Invitation`]: {},
|
|
1041
|
+
[`inputting${Domain}VerificationCode`]: {
|
|
1042
|
+
on: {
|
|
1043
|
+
[`authenticate${Domain}VerificationCode`]: {
|
|
1044
|
+
target: `authenticating${Domain}VerificationCode`,
|
|
1045
|
+
actions: "log"
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
[`authenticating${Domain}VerificationCode`]: {
|
|
1050
|
+
on: {
|
|
1051
|
+
[`authenticate${Domain}Invitation`]: {
|
|
1052
|
+
target: `authenticationFailing${Domain}VerificationCode`,
|
|
1053
|
+
actions: "log"
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
},
|
|
1057
|
+
[`authenticationFailing${Domain}VerificationCode`]: {},
|
|
1058
|
+
[`failing${Domain}Invitation`]: {},
|
|
1059
|
+
[`success${Domain}Invitation`]: {}
|
|
1060
|
+
},
|
|
1061
|
+
on: {
|
|
1062
|
+
[`reset${Domain}Invitation`]: {
|
|
1063
|
+
target: `#join${Domain === "Halo" ? ".choosingIdentity" : ""}.accepting${Domain}Invitation.unknown${Domain}`,
|
|
1064
|
+
actions: [
|
|
1065
|
+
"resetInvitation",
|
|
1066
|
+
"log"
|
|
1067
|
+
]
|
|
1068
|
+
},
|
|
1069
|
+
[`connect${Domain}Invitation`]: {
|
|
1070
|
+
target: `.connecting${Domain}Invitation`,
|
|
1071
|
+
actions: [
|
|
1072
|
+
"setInvitation",
|
|
1073
|
+
"log"
|
|
1074
|
+
]
|
|
1075
|
+
},
|
|
1076
|
+
[`connectionSuccess${Domain}Invitation`]: {
|
|
1077
|
+
target: `.inputting${Domain}VerificationCode`,
|
|
1078
|
+
actions: [
|
|
1079
|
+
"setInvitation",
|
|
1080
|
+
"log"
|
|
1081
|
+
]
|
|
1082
|
+
},
|
|
1083
|
+
[`succeed${Domain}Invitation`]: {
|
|
1084
|
+
target: successTarget,
|
|
1085
|
+
actions: "log"
|
|
1086
|
+
},
|
|
1087
|
+
[`fail${Domain}Invitation`]: {
|
|
1088
|
+
target: `.failing${Domain}Invitation`,
|
|
1089
|
+
actions: [
|
|
1090
|
+
assign({
|
|
1091
|
+
[Domain.toLowerCase()]: (context, event) => ({
|
|
1092
|
+
...context[Domain.toLowerCase()],
|
|
1093
|
+
failReason: event.reason
|
|
1094
|
+
})
|
|
1095
|
+
}),
|
|
1096
|
+
"log"
|
|
1097
|
+
]
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
863
1101
|
},
|
|
864
|
-
|
|
865
|
-
|
|
1102
|
+
on: {
|
|
1103
|
+
[`set${Domain}InvitationCode`]: {
|
|
1104
|
+
target: `.acceptingRedeemed${Domain}Invitation`,
|
|
1105
|
+
actions: [
|
|
1106
|
+
assign({
|
|
1107
|
+
[Domain.toLowerCase()]: (context, event) => ({
|
|
1108
|
+
...context[Domain.toLowerCase()],
|
|
1109
|
+
unredeemedCode: event.code
|
|
1110
|
+
})
|
|
1111
|
+
}),
|
|
1112
|
+
`redeem${Domain}InvitationCode`,
|
|
1113
|
+
"log"
|
|
1114
|
+
]
|
|
1115
|
+
}
|
|
866
1116
|
}
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
|
|
1117
|
+
};
|
|
1118
|
+
return config;
|
|
1119
|
+
};
|
|
1120
|
+
var joinMachine = createMachine({
|
|
1121
|
+
id: "join",
|
|
1122
|
+
predictableActionArguments: true,
|
|
1123
|
+
context: {
|
|
1124
|
+
mode: "default",
|
|
1125
|
+
identity: null,
|
|
1126
|
+
halo: {},
|
|
1127
|
+
space: {}
|
|
1128
|
+
},
|
|
1129
|
+
initial: "unknown",
|
|
1130
|
+
states: {
|
|
1131
|
+
unknown: {
|
|
1132
|
+
always: [
|
|
1133
|
+
{
|
|
1134
|
+
cond: "noSelectedIdentity",
|
|
1135
|
+
target: "choosingIdentity",
|
|
1136
|
+
actions: "log"
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
target: "acceptingSpaceInvitation",
|
|
1140
|
+
actions: "log"
|
|
1141
|
+
}
|
|
1142
|
+
]
|
|
1143
|
+
},
|
|
1144
|
+
choosingIdentity: {
|
|
1145
|
+
initial: "choosingAuthMethod",
|
|
1146
|
+
states: {
|
|
1147
|
+
choosingAuthMethod: {},
|
|
1148
|
+
recoveringIdentity: {},
|
|
1149
|
+
creatingIdentity: {},
|
|
1150
|
+
acceptingHaloInvitation: acceptingInvitationTemplate("Halo", "#join.acceptingSpaceInvitation"),
|
|
1151
|
+
confirmingAddedIdentity: {}
|
|
1152
|
+
},
|
|
1153
|
+
on: {
|
|
1154
|
+
recoverIdentity: {
|
|
1155
|
+
target: ".recoveringIdentity",
|
|
1156
|
+
actions: "log"
|
|
1157
|
+
},
|
|
1158
|
+
createIdentity: {
|
|
1159
|
+
target: ".creatingIdentity",
|
|
1160
|
+
actions: "log"
|
|
1161
|
+
},
|
|
1162
|
+
acceptHaloInvitation: {
|
|
1163
|
+
target: ".acceptingHaloInvitation",
|
|
1164
|
+
actions: "log"
|
|
1165
|
+
},
|
|
1166
|
+
addIdentity: {
|
|
1167
|
+
target: ".confirmingAddedIdentity",
|
|
1168
|
+
actions: "log"
|
|
1169
|
+
},
|
|
1170
|
+
selectIdentity: {
|
|
1171
|
+
target: "acceptingSpaceInvitation",
|
|
1172
|
+
actions: [
|
|
1173
|
+
"setIdentity",
|
|
1174
|
+
"log"
|
|
1175
|
+
]
|
|
1176
|
+
},
|
|
1177
|
+
deselectAuthMethod: {
|
|
1178
|
+
target: ".choosingAuthMethod",
|
|
1179
|
+
actions: "log"
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
},
|
|
1183
|
+
acceptingSpaceInvitation: acceptingInvitationTemplate("Space", "#join.finishingJoiningSpace"),
|
|
1184
|
+
finishingJoiningSpace: {
|
|
1185
|
+
type: "final"
|
|
1186
|
+
},
|
|
1187
|
+
finishingJoiningHalo: {
|
|
1188
|
+
type: "final"
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
}, {
|
|
1192
|
+
guards: {
|
|
1193
|
+
noSelectedIdentity: ({ identity }, _event) => !identity,
|
|
1194
|
+
noHaloInvitation: ({ halo }, _event) => !halo.invitation && !halo.unredeemedCode,
|
|
1195
|
+
noSpaceInvitation: ({ space }, _event) => !space.invitation && !space.unredeemedCode
|
|
1196
|
+
},
|
|
1197
|
+
actions: {
|
|
1198
|
+
setIdentity: assign({
|
|
1199
|
+
identity: (context, event) => event.identity
|
|
1200
|
+
}),
|
|
1201
|
+
unsetIdentity: assign({
|
|
1202
|
+
identity: () => null
|
|
1203
|
+
}),
|
|
1204
|
+
resetInvitation: assign({
|
|
1205
|
+
halo: (context, event) => event.type === "resetHaloInvitation" ? {
|
|
1206
|
+
...context.halo,
|
|
1207
|
+
invitation: void 0,
|
|
1208
|
+
invitationObservable: void 0,
|
|
1209
|
+
invitationSubscribable: void 0
|
|
1210
|
+
} : context.halo,
|
|
1211
|
+
space: (context, event) => event.type === "resetSpaceInvitation" ? {
|
|
1212
|
+
...context.space,
|
|
1213
|
+
invitation: void 0,
|
|
1214
|
+
invitationObservable: void 0,
|
|
1215
|
+
invitationSubscribable: void 0
|
|
1216
|
+
} : context.space
|
|
1217
|
+
}),
|
|
1218
|
+
setInvitation: assign({
|
|
1219
|
+
halo: (context, event) => event.type.includes("Halo") ? {
|
|
1220
|
+
...context.halo,
|
|
1221
|
+
invitation: event.invitation
|
|
1222
|
+
} : context.halo,
|
|
1223
|
+
space: (context, event) => event.type.includes("Space") ? {
|
|
1224
|
+
...context.space,
|
|
1225
|
+
invitation: event.invitation
|
|
1226
|
+
} : context.space
|
|
1227
|
+
}),
|
|
1228
|
+
log: (context, event) => {
|
|
1229
|
+
log("[transition]", {
|
|
1230
|
+
event,
|
|
1231
|
+
haloInvitation: context.halo.invitation,
|
|
1232
|
+
spaceInvitation: context.space.invitation
|
|
1233
|
+
}, {
|
|
1234
|
+
file: "joinMachine.ts",
|
|
1235
|
+
line: 341,
|
|
1236
|
+
scope: void 0,
|
|
1237
|
+
callSite: (f, a) => f(...a)
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
870
1241
|
});
|
|
1242
|
+
var defaultCodeFromUrl = (invitationType, text) => {
|
|
1243
|
+
var _a, _b, _c, _d;
|
|
1244
|
+
try {
|
|
1245
|
+
const searchParams = new URLSearchParams(text.substring(text.lastIndexOf("?")));
|
|
1246
|
+
return (_d = (_c = (_b = (_a = searchParams.get(`${invitationType}InvitationCode`)) != null ? _a : searchParams.get(`${invitationType}Invitation`)) != null ? _b : searchParams.get("invitationCode")) != null ? _c : searchParams.get("invitation")) != null ? _d : text;
|
|
1247
|
+
} catch (err) {
|
|
1248
|
+
log.catch(err, {}, {
|
|
1249
|
+
file: "joinMachine.ts",
|
|
1250
|
+
line: 367,
|
|
1251
|
+
scope: void 0,
|
|
1252
|
+
callSite: (f, a) => f(...a)
|
|
1253
|
+
});
|
|
1254
|
+
return text;
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
var useJoinMachine = (client, options) => {
|
|
1258
|
+
const redeemHaloInvitationCode = useCallback4(({ halo }) => {
|
|
1259
|
+
if (halo.unredeemedCode) {
|
|
1260
|
+
const invitationObservable = client.halo.acceptInvitation(InvitationEncoder.decode(defaultCodeFromUrl("halo", halo.unredeemedCode)));
|
|
1261
|
+
return {
|
|
1262
|
+
...halo,
|
|
1263
|
+
invitationObservable,
|
|
1264
|
+
invitationSubscribable: getInvitationSubscribable("Halo", invitationObservable)
|
|
1265
|
+
};
|
|
1266
|
+
} else {
|
|
1267
|
+
return halo;
|
|
1268
|
+
}
|
|
1269
|
+
}, [
|
|
1270
|
+
client
|
|
1271
|
+
]);
|
|
1272
|
+
const redeemSpaceInvitationCode = useCallback4(({ space }) => {
|
|
1273
|
+
if (space.unredeemedCode) {
|
|
1274
|
+
const invitationObservable = client.acceptInvitation(InvitationEncoder.decode(defaultCodeFromUrl("space", space.unredeemedCode)));
|
|
1275
|
+
return {
|
|
1276
|
+
...space,
|
|
1277
|
+
invitationObservable,
|
|
1278
|
+
invitationSubscribable: getInvitationSubscribable("Space", invitationObservable)
|
|
1279
|
+
};
|
|
1280
|
+
} else {
|
|
1281
|
+
return space;
|
|
1282
|
+
}
|
|
1283
|
+
}, [
|
|
1284
|
+
client
|
|
1285
|
+
]);
|
|
1286
|
+
return useMachine(joinMachine, {
|
|
1287
|
+
...options,
|
|
1288
|
+
actions: {
|
|
1289
|
+
...options == null ? void 0 : options.actions,
|
|
1290
|
+
redeemHaloInvitationCode: assign({
|
|
1291
|
+
halo: redeemHaloInvitationCode
|
|
1292
|
+
}),
|
|
1293
|
+
redeemSpaceInvitationCode: assign({
|
|
1294
|
+
space: redeemSpaceInvitationCode
|
|
1295
|
+
})
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
};
|
|
871
1299
|
|
|
872
1300
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx
|
|
873
|
-
import {
|
|
1301
|
+
import { CaretRight, Plus, QrCode as QrCode2, Textbox } from "@phosphor-icons/react";
|
|
874
1302
|
import React19 from "react";
|
|
875
|
-
import {
|
|
1303
|
+
import { CompoundButton, getSize as getSize6, useTranslation as useTranslation9 } from "@dxos/react-components";
|
|
876
1304
|
|
|
877
1305
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/ViewState.tsx
|
|
878
|
-
import { CheckCircle, HourglassSimple, X as
|
|
1306
|
+
import { CheckCircle, HourglassSimple, X as X4 } from "@phosphor-icons/react";
|
|
879
1307
|
import React18, { useMemo as useMemo2 } from "react";
|
|
880
|
-
import { Invitation as
|
|
1308
|
+
import { Invitation as Invitation5 } from "@dxos/client";
|
|
881
1309
|
import { useInvitationStatus as useInvitationStatus2 } from "@dxos/react-client";
|
|
882
|
-
import { mx as mx13, useTranslation as useTranslation8,
|
|
1310
|
+
import { mx as mx13, useTranslation as useTranslation8, useId as useId3, getSize as getSize5, strongShimmer } from "@dxos/react-components";
|
|
883
1311
|
function _extends14() {
|
|
884
1312
|
_extends14 = Object.assign || function(target) {
|
|
885
1313
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -897,136 +1325,19 @@ function _extends14() {
|
|
|
897
1325
|
var stripe = mx13("rounded-full grow", getSize5(3));
|
|
898
1326
|
var ViewStateHeading = ({ children, className, ...props }) => {
|
|
899
1327
|
return /* @__PURE__ */ React18.createElement("h2", _extends14({}, props, {
|
|
900
|
-
className: mx13("font-system-
|
|
1328
|
+
className: mx13("font-system-normal text-sm mbe-1 mli-1 text-center", className)
|
|
901
1329
|
}), children);
|
|
902
1330
|
};
|
|
903
|
-
var
|
|
904
|
-
const labelId = useId3("invitationState");
|
|
905
|
-
return /* @__PURE__ */ React18.createElement("div", {
|
|
906
|
-
role: "none",
|
|
907
|
-
className: mx13(defaultSurface, "pli-2 pbs-2")
|
|
908
|
-
}, /* @__PURE__ */ React18.createElement("div", {
|
|
909
|
-
role: "status",
|
|
910
|
-
"aria-labelledby": labelId,
|
|
911
|
-
className: "flex gap-2 items-center mlb-1"
|
|
912
|
-
}, /* @__PURE__ */ React18.createElement("div", {
|
|
913
|
-
role: "none",
|
|
914
|
-
className: mx13(stripe, !halted && cursor === 1 && strongShimmer, cursor === 2 ? halted ? resolvedColor : activeBgColor : cursor > 1 ? resolvedColor : inactiveBgColor)
|
|
915
|
-
}), /* @__PURE__ */ React18.createElement("div", {
|
|
916
|
-
role: "none",
|
|
917
|
-
className: mx13(stripe, !halted && cursor === 3 && strongShimmer, cursor === 3 ? halted ? resolvedColor : activeBgColor : cursor > 3 ? resolvedColor : inactiveBgColor)
|
|
918
|
-
}), /* @__PURE__ */ React18.createElement("div", {
|
|
919
|
-
role: "none",
|
|
920
|
-
className: mx13(stripe, cursor > 3 ? halted ? resolvedColor : resolvedColor : inactiveBgColor)
|
|
921
|
-
})), /* @__PURE__ */ React18.createElement(ViewStateHeading, {
|
|
922
|
-
id: labelId,
|
|
923
|
-
className: "mbs-2 flex justify-center items-center gap-2"
|
|
924
|
-
}, label));
|
|
925
|
-
};
|
|
926
|
-
var ViewStateInvitationStatus = ({ activeInvitation }) => {
|
|
927
|
-
const { t } = useTranslation8("os");
|
|
928
|
-
const { status, haltedAt } = useInvitationStatus2(activeInvitation);
|
|
929
|
-
const halted = status === Invitation4.State.CANCELLED || status === Invitation4.State.TIMEOUT || status === Invitation4.State.ERROR;
|
|
930
|
-
const cursor = invitationStatusValue.get(halted ? haltedAt : status);
|
|
931
|
-
const resolvedColor = resolvedBgColor(status);
|
|
932
|
-
const statusLabelMap = useMemo2(() => /* @__PURE__ */ new Map([
|
|
933
|
-
[
|
|
934
|
-
Invitation4.State.ERROR,
|
|
935
|
-
/* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(X3, {
|
|
936
|
-
weight: "bold",
|
|
937
|
-
className: mx13(getSize5(4), "text-error-600 dark:text-error-400")
|
|
938
|
-
}), /* @__PURE__ */ React18.createElement("span", null, t("error status label")))
|
|
939
|
-
],
|
|
940
|
-
[
|
|
941
|
-
Invitation4.State.TIMEOUT,
|
|
942
|
-
/* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(HourglassSimple, {
|
|
943
|
-
weight: "fill",
|
|
944
|
-
className: mx13(getSize5(4), "text-warning-600 dark:text-warning-400")
|
|
945
|
-
}), /* @__PURE__ */ React18.createElement("span", null, t("timeout status label")))
|
|
946
|
-
],
|
|
947
|
-
[
|
|
948
|
-
Invitation4.State.CANCELLED,
|
|
949
|
-
/* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(X3, {
|
|
950
|
-
weight: "bold",
|
|
951
|
-
className: mx13(getSize5(4), "text-warning-600 dark:text-warning-400")
|
|
952
|
-
}), /* @__PURE__ */ React18.createElement("span", null, t("cancelled status label")))
|
|
953
|
-
],
|
|
954
|
-
[
|
|
955
|
-
Invitation4.State.INIT,
|
|
956
|
-
t("init status label")
|
|
957
|
-
],
|
|
958
|
-
[
|
|
959
|
-
Invitation4.State.CONNECTING,
|
|
960
|
-
t("connecting status label")
|
|
961
|
-
],
|
|
962
|
-
[
|
|
963
|
-
Invitation4.State.CONNECTED,
|
|
964
|
-
t("connected status label")
|
|
965
|
-
],
|
|
966
|
-
[
|
|
967
|
-
Invitation4.State.AUTHENTICATING,
|
|
968
|
-
t("authenticating status label")
|
|
969
|
-
],
|
|
970
|
-
[
|
|
971
|
-
Invitation4.State.SUCCESS,
|
|
972
|
-
/* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(CheckCircle, {
|
|
973
|
-
weight: "fill",
|
|
974
|
-
className: mx13(getSize5(4), "text-success-600 dark:text-success-400")
|
|
975
|
-
}), /* @__PURE__ */ React18.createElement("span", null, t("success status label")))
|
|
976
|
-
]
|
|
977
|
-
]), [
|
|
978
|
-
t
|
|
979
|
-
]);
|
|
980
|
-
return /* @__PURE__ */ React18.createElement(PureViewStateInvitation, _extends14({}, {
|
|
981
|
-
label: statusLabelMap.get(status),
|
|
982
|
-
resolvedColor,
|
|
983
|
-
cursor,
|
|
984
|
-
halted
|
|
985
|
-
}));
|
|
986
|
-
};
|
|
987
|
-
var ViewState = ({ active, children, className, dispatch, selectedIdentity, activeInvitation, ...props }) => {
|
|
988
|
-
var _a, _b;
|
|
989
|
-
const { t } = useTranslation8("os");
|
|
990
|
-
const identityLabel = useId3("selectedIdentityLabel");
|
|
1331
|
+
var ViewState = ({ active, children, className, joinSend, joinState, ...props }) => {
|
|
991
1332
|
return /* @__PURE__ */ React18.createElement("div", _extends14({
|
|
992
1333
|
role: "none"
|
|
993
1334
|
}, props, !active && {
|
|
994
1335
|
"aria-hidden": true
|
|
995
1336
|
}, {
|
|
996
1337
|
className: mx13("is-[50%] flex flex-col", active ? "order-2" : "order-4", className)
|
|
997
|
-
}),
|
|
998
|
-
role: "none",
|
|
999
|
-
className: mx13(subduedSurface, "flex-none flex items-center gap-1 pli-2 pbe-1.5")
|
|
1000
|
-
}, /* @__PURE__ */ React18.createElement(Trans2, _extends14({}, {
|
|
1001
|
-
defaults: t("join space as identity heading"),
|
|
1002
|
-
components: {
|
|
1003
|
-
icon: /* @__PURE__ */ React18.createElement(Avatar5, {
|
|
1004
|
-
size: 4,
|
|
1005
|
-
fallbackValue: selectedIdentity === true ? "" : selectedIdentity.identityKey.toHex(),
|
|
1006
|
-
labelId: identityLabel
|
|
1007
|
-
}),
|
|
1008
|
-
label: /* @__PURE__ */ React18.createElement("span", {
|
|
1009
|
-
id: identityLabel
|
|
1010
|
-
}),
|
|
1011
|
-
part: /* @__PURE__ */ React18.createElement("span", {
|
|
1012
|
-
role: "none",
|
|
1013
|
-
className: "flex items-center gap-1 leading-none"
|
|
1014
|
-
})
|
|
1015
|
-
},
|
|
1016
|
-
values: {
|
|
1017
|
-
labelValue: selectedIdentity === true ? "\xA0" : (_b = (_a = selectedIdentity.profile) == null ? void 0 : _a.displayName) != null ? _b : selectedIdentity.identityKey.truncate()
|
|
1018
|
-
}
|
|
1019
|
-
}))), activeInvitation && (activeInvitation === true ? /* @__PURE__ */ React18.createElement(PureViewStateInvitation, _extends14({}, {
|
|
1020
|
-
halted: false,
|
|
1021
|
-
status: Invitation4.State.INIT,
|
|
1022
|
-
label: t("invitation input label"),
|
|
1023
|
-
cursor: 0,
|
|
1024
|
-
resolvedColor: inactiveBgColor
|
|
1025
|
-
})) : /* @__PURE__ */ React18.createElement(ViewStateInvitationStatus, _extends14({}, {
|
|
1026
|
-
activeInvitation
|
|
1027
|
-
}))), /* @__PURE__ */ React18.createElement("div", {
|
|
1338
|
+
}), /* @__PURE__ */ React18.createElement("div", {
|
|
1028
1339
|
role: "region",
|
|
1029
|
-
className: mx13(defaultSurface, "rounded-be-md grow shrink-0 flex flex-col gap-1 p-
|
|
1340
|
+
className: mx13(defaultSurface, "rounded-be-md grow shrink-0 flex flex-col gap-1 p-4 pbs-1")
|
|
1030
1341
|
}, children));
|
|
1031
1342
|
};
|
|
1032
1343
|
|
|
@@ -1045,9 +1356,9 @@ function _extends15() {
|
|
|
1045
1356
|
};
|
|
1046
1357
|
return _extends15.apply(this, arguments);
|
|
1047
1358
|
}
|
|
1048
|
-
var AdditionMethodSelector = (
|
|
1359
|
+
var AdditionMethodSelector = (viewStateProps) => {
|
|
1049
1360
|
const disabled = !viewStateProps.active;
|
|
1050
|
-
const {
|
|
1361
|
+
const { joinSend } = viewStateProps;
|
|
1051
1362
|
const { t } = useTranslation9("os");
|
|
1052
1363
|
const sharedButtonProps = {
|
|
1053
1364
|
disabled,
|
|
@@ -1069,20 +1380,18 @@ var AdditionMethodSelector = ({ availableIdentities, ...viewStateProps }) => {
|
|
|
1069
1380
|
before: /* @__PURE__ */ React19.createElement(Plus, {
|
|
1070
1381
|
className: getSize6(6)
|
|
1071
1382
|
}),
|
|
1072
|
-
onClick: () =>
|
|
1073
|
-
type: "
|
|
1074
|
-
method: "create identity"
|
|
1383
|
+
onClick: () => joinSend({
|
|
1384
|
+
type: "createIdentity"
|
|
1075
1385
|
}),
|
|
1076
|
-
"data-autofocus": "
|
|
1386
|
+
"data-autofocus": "choosingAuthMethod",
|
|
1077
1387
|
"data-testid": "create-identity"
|
|
1078
1388
|
}), t("create identity label")), /* @__PURE__ */ React19.createElement(CompoundButton, _extends15({}, sharedButtonProps, {
|
|
1079
1389
|
description: t("join identity description"),
|
|
1080
1390
|
before: /* @__PURE__ */ React19.createElement(QrCode2, {
|
|
1081
1391
|
className: getSize6(6)
|
|
1082
1392
|
}),
|
|
1083
|
-
onClick: () =>
|
|
1084
|
-
type: "
|
|
1085
|
-
method: "accept device invitation"
|
|
1393
|
+
onClick: () => joinSend({
|
|
1394
|
+
type: "acceptHaloInvitation"
|
|
1086
1395
|
}),
|
|
1087
1396
|
"data-testid": "join-identity"
|
|
1088
1397
|
}), t("join identity label")), /* @__PURE__ */ React19.createElement(CompoundButton, _extends15({}, sharedButtonProps, {
|
|
@@ -1092,32 +1401,17 @@ var AdditionMethodSelector = ({ availableIdentities, ...viewStateProps }) => {
|
|
|
1092
1401
|
before: /* @__PURE__ */ React19.createElement(Textbox, {
|
|
1093
1402
|
className: getSize6(6)
|
|
1094
1403
|
}),
|
|
1095
|
-
onClick: () =>
|
|
1096
|
-
type: "
|
|
1097
|
-
method: "recover identity"
|
|
1404
|
+
onClick: () => joinSend({
|
|
1405
|
+
type: "recoverIdentity"
|
|
1098
1406
|
}),
|
|
1099
1407
|
"data-testid": "recover-identity"
|
|
1100
|
-
}), t("recover identity label")))
|
|
1101
|
-
disabled: disabled || availableIdentities.length < 1,
|
|
1102
|
-
onClick: () => dispatch({
|
|
1103
|
-
type: "deselect identity"
|
|
1104
|
-
}),
|
|
1105
|
-
"data-testid": "deselect-identity"
|
|
1106
|
-
}, /* @__PURE__ */ React19.createElement(CaretLeft, {
|
|
1107
|
-
className: getSize6(4),
|
|
1108
|
-
weight: "bold"
|
|
1109
|
-
}), /* @__PURE__ */ React19.createElement("span", {
|
|
1110
|
-
className: "grow"
|
|
1111
|
-
}, t("deselect identity label")), /* @__PURE__ */ React19.createElement(CaretRight, {
|
|
1112
|
-
className: mx14(getSize6(4), "invisible"),
|
|
1113
|
-
weight: "bold"
|
|
1114
|
-
})));
|
|
1408
|
+
}), t("recover identity label"))));
|
|
1115
1409
|
};
|
|
1116
1410
|
|
|
1117
1411
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/IdentityAdded.tsx
|
|
1118
|
-
import { CaretLeft
|
|
1412
|
+
import { CaretLeft, CaretRight as CaretRight2, Check } from "@phosphor-icons/react";
|
|
1119
1413
|
import React20, { cloneElement as cloneElement3 } from "react";
|
|
1120
|
-
import { Avatar as
|
|
1414
|
+
import { Avatar as Avatar4, Button as Button5, getSize as getSize7, mx as mx14, useTranslation as useTranslation10 } from "@dxos/react-components";
|
|
1121
1415
|
function _extends16() {
|
|
1122
1416
|
_extends16 = Object.assign || function(target) {
|
|
1123
1417
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -1135,20 +1429,19 @@ function _extends16() {
|
|
|
1135
1429
|
var Done = ({ onDone, doneActionParent, active }) => {
|
|
1136
1430
|
const disabled = !active;
|
|
1137
1431
|
const { t } = useTranslation10("os");
|
|
1138
|
-
const doneButton = /* @__PURE__ */ React20.createElement(
|
|
1432
|
+
const doneButton = /* @__PURE__ */ React20.createElement(Button5, _extends16({}, onDone && {
|
|
1139
1433
|
onClick: () => onDone(null)
|
|
1140
1434
|
}, {
|
|
1141
1435
|
disabled,
|
|
1142
1436
|
className: "grow flex items-center gap-2 pli-2",
|
|
1143
|
-
"data-autofocus": "
|
|
1437
|
+
"data-autofocus": "confirmingAddedIdentity",
|
|
1144
1438
|
"data-testid": "identity-added-done"
|
|
1145
|
-
}), /* @__PURE__ */ React20.createElement(
|
|
1439
|
+
}), /* @__PURE__ */ React20.createElement(CaretLeft, {
|
|
1146
1440
|
weight: "bold",
|
|
1147
|
-
className:
|
|
1441
|
+
className: mx14(getSize7(2), "invisible")
|
|
1148
1442
|
}), /* @__PURE__ */ React20.createElement("span", {
|
|
1149
1443
|
className: "grow"
|
|
1150
1444
|
}, t("done label")), /* @__PURE__ */ React20.createElement(Check, {
|
|
1151
|
-
weight: "bold",
|
|
1152
1445
|
className: getSize7(4)
|
|
1153
1446
|
}));
|
|
1154
1447
|
return doneActionParent ? /* @__PURE__ */ cloneElement3(doneActionParent, {}, doneButton) : doneButton;
|
|
@@ -1156,16 +1449,16 @@ var Done = ({ onDone, doneActionParent, active }) => {
|
|
|
1156
1449
|
var IdentityAdded = ({ mode, addedIdentity, onDone, doneActionParent, ...viewStateProps }) => {
|
|
1157
1450
|
var _a, _b, _c, _d, _e;
|
|
1158
1451
|
const disabled = !viewStateProps.active;
|
|
1159
|
-
const {
|
|
1452
|
+
const { joinSend } = viewStateProps;
|
|
1160
1453
|
const { t } = useTranslation10("os");
|
|
1161
1454
|
return /* @__PURE__ */ React20.createElement(ViewState, _extends16({}, viewStateProps), /* @__PURE__ */ React20.createElement(ViewStateHeading, null, t("identity added label")), /* @__PURE__ */ React20.createElement("div", {
|
|
1162
1455
|
role: "none",
|
|
1163
1456
|
className: "grow flex flex-col items-center justify-center text-center gap-2"
|
|
1164
|
-
}, /* @__PURE__ */ React20.createElement(
|
|
1457
|
+
}, /* @__PURE__ */ React20.createElement(Avatar4, {
|
|
1165
1458
|
size: 20,
|
|
1166
1459
|
fallbackValue: (_a = addedIdentity == null ? void 0 : addedIdentity.identityKey.toHex()) != null ? _a : "",
|
|
1167
1460
|
label: /* @__PURE__ */ React20.createElement("p", {
|
|
1168
|
-
className:
|
|
1461
|
+
className: mx14("text-lg", !((_b = addedIdentity == null ? void 0 : addedIdentity.profile) == null ? void 0 : _b.displayName) && "font-mono")
|
|
1169
1462
|
}, (_e = (_d = (_c = addedIdentity == null ? void 0 : addedIdentity.profile) == null ? void 0 : _c.displayName) != null ? _d : addedIdentity == null ? void 0 : addedIdentity.identityKey.truncate()) != null ? _e : "\xA0"),
|
|
1170
1463
|
variant: "circle",
|
|
1171
1464
|
status: "active"
|
|
@@ -1174,39 +1467,39 @@ var IdentityAdded = ({ mode, addedIdentity, onDone, doneActionParent, ...viewSta
|
|
|
1174
1467
|
doneActionParent
|
|
1175
1468
|
}, viewStateProps)) : /* @__PURE__ */ React20.createElement("div", {
|
|
1176
1469
|
className: "flex gap-2"
|
|
1177
|
-
}, /* @__PURE__ */ React20.createElement(
|
|
1470
|
+
}, /* @__PURE__ */ React20.createElement(Button5, {
|
|
1178
1471
|
disabled: disabled || !addedIdentity,
|
|
1179
1472
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1180
|
-
onClick: () => addedIdentity &&
|
|
1181
|
-
type: "
|
|
1473
|
+
onClick: () => addedIdentity && joinSend({
|
|
1474
|
+
type: "selectIdentity",
|
|
1182
1475
|
identity: addedIdentity
|
|
1183
1476
|
}),
|
|
1184
|
-
"data-autofocus": "
|
|
1185
|
-
}, /* @__PURE__ */ React20.createElement(
|
|
1477
|
+
"data-autofocus": "confirmingAddedIdentity"
|
|
1478
|
+
}, /* @__PURE__ */ React20.createElement(CaretLeft, {
|
|
1186
1479
|
weight: "bold",
|
|
1187
|
-
className:
|
|
1480
|
+
className: mx14(getSize7(2), "invisible")
|
|
1188
1481
|
}), /* @__PURE__ */ React20.createElement("span", {
|
|
1189
1482
|
className: "grow"
|
|
1190
1483
|
}, t("continue label")), /* @__PURE__ */ React20.createElement(CaretRight2, {
|
|
1191
1484
|
weight: "bold",
|
|
1192
1485
|
className: getSize7(4)
|
|
1193
|
-
})), /* @__PURE__ */ React20.createElement(
|
|
1486
|
+
})), /* @__PURE__ */ React20.createElement(Button5, {
|
|
1194
1487
|
disabled,
|
|
1195
|
-
onClick: () =>
|
|
1196
|
-
type: "
|
|
1488
|
+
onClick: () => joinSend({
|
|
1489
|
+
type: "deselectAuthMethod"
|
|
1197
1490
|
}),
|
|
1198
1491
|
className: "flex items-center gap-2 pis-2 pie-4"
|
|
1199
|
-
}, /* @__PURE__ */ React20.createElement(
|
|
1492
|
+
}, /* @__PURE__ */ React20.createElement(CaretLeft, {
|
|
1200
1493
|
weight: "bold",
|
|
1201
1494
|
className: getSize7(4)
|
|
1202
1495
|
}), /* @__PURE__ */ React20.createElement("span", null, t("deselect identity label")))));
|
|
1203
1496
|
};
|
|
1204
1497
|
|
|
1205
|
-
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/
|
|
1206
|
-
import { CaretLeft as
|
|
1207
|
-
import
|
|
1208
|
-
import
|
|
1209
|
-
import {
|
|
1498
|
+
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/IdentityInput.tsx
|
|
1499
|
+
import { CaretLeft as CaretLeft2, CaretRight as CaretRight3 } from "@phosphor-icons/react";
|
|
1500
|
+
import React21, { useState as useState2 } from "react";
|
|
1501
|
+
import { useClient as useClient4 } from "@dxos/react-client";
|
|
1502
|
+
import { Button as Button6, getSize as getSize8, Input, mx as mx15, useTranslation as useTranslation11 } from "@dxos/react-components";
|
|
1210
1503
|
function _extends17() {
|
|
1211
1504
|
_extends17 = Object.assign || function(target) {
|
|
1212
1505
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -1221,126 +1514,36 @@ function _extends17() {
|
|
|
1221
1514
|
};
|
|
1222
1515
|
return _extends17.apply(this, arguments);
|
|
1223
1516
|
}
|
|
1224
|
-
var IdentitySelector = ({ availableIdentities, ...viewStateProps }) => {
|
|
1225
|
-
const { dispatch } = viewStateProps;
|
|
1226
|
-
const disabled = !viewStateProps.active;
|
|
1227
|
-
const { t } = useTranslation11("os");
|
|
1228
|
-
const [activeIdentity, setActiveIdentity] = useState2(availableIdentities[0]);
|
|
1229
|
-
const onValueChange = useCallback4((nextHex) => setActiveIdentity(availableIdentities.find((identity) => identity.identityKey.toHex() === nextHex) || activeIdentity), [
|
|
1230
|
-
availableIdentities
|
|
1231
|
-
]);
|
|
1232
|
-
return /* @__PURE__ */ React21.createElement(ViewState, _extends17({}, viewStateProps), /* @__PURE__ */ React21.createElement(ViewStateHeading, null, t("identity selector title")), /* @__PURE__ */ React21.createElement(RadioGroup.Root, {
|
|
1233
|
-
disabled,
|
|
1234
|
-
value: activeIdentity == null ? void 0 : activeIdentity.identityKey.toHex(),
|
|
1235
|
-
onValueChange,
|
|
1236
|
-
className: "overflow-y-auto grow shrink min-bs-10 pli-1 -mli-1",
|
|
1237
|
-
"aria-label": t("identity radio group title"),
|
|
1238
|
-
"data-autofocus": "identity selector"
|
|
1239
|
-
}, availableIdentities.map(({ profile, identityKey }) => {
|
|
1240
|
-
var _a, _b;
|
|
1241
|
-
const hex = identityKey.toHex();
|
|
1242
|
-
const inputId = `identitySelector__item--${hex}`;
|
|
1243
|
-
const labelId = `identitySelector__itemLabel--${hex}`;
|
|
1244
|
-
return /* @__PURE__ */ React21.createElement("label", {
|
|
1245
|
-
htmlFor: inputId,
|
|
1246
|
-
key: hex,
|
|
1247
|
-
className: "flex items-center mbe-2 gap-2 cursor-pointer"
|
|
1248
|
-
}, /* @__PURE__ */ React21.createElement(RadioGroup.Item, {
|
|
1249
|
-
id: inputId,
|
|
1250
|
-
"aria-labelledby": labelId,
|
|
1251
|
-
value: hex,
|
|
1252
|
-
className: mx16("peer relative w-4 h-4 rounded-full", "border border-transparent text-white", "radix-state-checked:bg-primary-600", "radix-state-unchecked:bg-neutral-100 dark:radix-state-unchecked:bg-neutral-900", themeVariantFocus("os")),
|
|
1253
|
-
"data-testid": "identity-selector-item"
|
|
1254
|
-
}, /* @__PURE__ */ React21.createElement(RadioGroup.Indicator, {
|
|
1255
|
-
className: "absolute inset-0 flex items-center justify-center leading-0"
|
|
1256
|
-
}, /* @__PURE__ */ React21.createElement("div", {
|
|
1257
|
-
className: "w-1.5 h-1.5 rounded-full bg-white"
|
|
1258
|
-
}))), /* @__PURE__ */ React21.createElement(Avatar7, {
|
|
1259
|
-
fallbackValue: hex,
|
|
1260
|
-
labelId,
|
|
1261
|
-
variant: "circle"
|
|
1262
|
-
}), /* @__PURE__ */ React21.createElement("span", {
|
|
1263
|
-
id: labelId,
|
|
1264
|
-
className: mx16(!(profile == null ? void 0 : profile.displayName) && "font-mono")
|
|
1265
|
-
}, (_b = (_a = profile == null ? void 0 : profile.displayName) != null ? _a : identityKey.truncate()) != null ? _b : ""));
|
|
1266
|
-
})), /* @__PURE__ */ React21.createElement(Button7, {
|
|
1267
|
-
disabled,
|
|
1268
|
-
onClick: () => dispatch({
|
|
1269
|
-
type: "add identity"
|
|
1270
|
-
}),
|
|
1271
|
-
className: "flex items-center gap-2 pli-2",
|
|
1272
|
-
"data-testid": "add-identity"
|
|
1273
|
-
}, /* @__PURE__ */ React21.createElement("span", null, t("add identity label")), /* @__PURE__ */ React21.createElement(UserPlus2, {
|
|
1274
|
-
weight: "bold",
|
|
1275
|
-
className: getSize8(3.5)
|
|
1276
|
-
})), /* @__PURE__ */ React21.createElement(Button7, {
|
|
1277
|
-
disabled: disabled || !activeIdentity,
|
|
1278
|
-
className: "flex items-center gap-2 pli-2",
|
|
1279
|
-
onClick: () => dispatch({
|
|
1280
|
-
type: "select identity",
|
|
1281
|
-
identity: activeIdentity
|
|
1282
|
-
}),
|
|
1283
|
-
"data-testid": "select-identity"
|
|
1284
|
-
}, /* @__PURE__ */ React21.createElement(CaretLeft3, {
|
|
1285
|
-
weight: "bold",
|
|
1286
|
-
className: mx16(getSize8(4), "invisible")
|
|
1287
|
-
}), /* @__PURE__ */ React21.createElement("span", {
|
|
1288
|
-
className: "grow"
|
|
1289
|
-
}, t("continue label")), /* @__PURE__ */ React21.createElement(CaretRight3, {
|
|
1290
|
-
weight: "bold",
|
|
1291
|
-
className: getSize8(4)
|
|
1292
|
-
})));
|
|
1293
|
-
};
|
|
1294
|
-
|
|
1295
|
-
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/IdentityInput.tsx
|
|
1296
|
-
import { CaretLeft as CaretLeft4, CaretRight as CaretRight4 } from "@phosphor-icons/react";
|
|
1297
|
-
import React22, { useState as useState3 } from "react";
|
|
1298
|
-
import { useClient as useClient4 } from "@dxos/react-client";
|
|
1299
|
-
import { Button as Button8, getSize as getSize9, Input, mx as mx17, useTranslation as useTranslation12 } from "@dxos/react-components";
|
|
1300
|
-
function _extends18() {
|
|
1301
|
-
_extends18 = Object.assign || function(target) {
|
|
1302
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1303
|
-
var source = arguments[i];
|
|
1304
|
-
for (var key in source) {
|
|
1305
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1306
|
-
target[key] = source[key];
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
return target;
|
|
1311
|
-
};
|
|
1312
|
-
return _extends18.apply(this, arguments);
|
|
1313
|
-
}
|
|
1314
1517
|
var IdentityInput = ({ method, ...viewStateProps }) => {
|
|
1315
1518
|
const disabled = !viewStateProps.active;
|
|
1316
|
-
const {
|
|
1317
|
-
const { t } =
|
|
1318
|
-
const [inputValue, setInputValue] =
|
|
1519
|
+
const { joinSend } = viewStateProps;
|
|
1520
|
+
const { t } = useTranslation11("os");
|
|
1521
|
+
const [inputValue, setInputValue] = useState2("");
|
|
1319
1522
|
const client = useClient4();
|
|
1320
|
-
const [validationMessage, setValidationMessage] =
|
|
1523
|
+
const [validationMessage, setValidationMessage] = useState2("");
|
|
1321
1524
|
const isRecover = method === "recover identity";
|
|
1322
1525
|
const handleNext = () => {
|
|
1323
1526
|
void client.halo.createIdentity({
|
|
1324
1527
|
[isRecover ? "seedphrase" : "displayName"]: inputValue
|
|
1325
1528
|
}).then((identity) => {
|
|
1326
|
-
|
|
1327
|
-
type: "
|
|
1529
|
+
joinSend({
|
|
1530
|
+
type: "selectIdentity",
|
|
1328
1531
|
identity
|
|
1329
1532
|
});
|
|
1330
1533
|
}, (_error) => {
|
|
1331
1534
|
setValidationMessage(t(isRecover ? "failed to recover identity message" : "failed to create identity message"));
|
|
1332
1535
|
});
|
|
1333
1536
|
};
|
|
1334
|
-
return /* @__PURE__ */
|
|
1537
|
+
return /* @__PURE__ */ React21.createElement(ViewState, _extends17({}, viewStateProps), /* @__PURE__ */ React21.createElement(Input, _extends17({
|
|
1335
1538
|
disabled,
|
|
1336
|
-
label: /* @__PURE__ */
|
|
1539
|
+
label: /* @__PURE__ */ React21.createElement(ViewStateHeading, null, t(isRecover ? "recover identity input label" : "new identity input label")),
|
|
1337
1540
|
onChange: ({ target: { value } }) => setInputValue(value),
|
|
1338
1541
|
slots: {
|
|
1339
1542
|
root: {
|
|
1340
1543
|
className: "m-0"
|
|
1341
1544
|
},
|
|
1342
1545
|
input: {
|
|
1343
|
-
"data-autofocus": isRecover ? "
|
|
1546
|
+
"data-autofocus": isRecover ? "recoveringIdentity" : "creatingIdentity",
|
|
1344
1547
|
onKeyUp: ({ key }) => key === "Enter" && handleNext()
|
|
1345
1548
|
}
|
|
1346
1549
|
}
|
|
@@ -1349,44 +1552,44 @@ var IdentityInput = ({ method, ...viewStateProps }) => {
|
|
|
1349
1552
|
validationMessage
|
|
1350
1553
|
}, {
|
|
1351
1554
|
"data-testid": "identity-input"
|
|
1352
|
-
})), /* @__PURE__ */
|
|
1555
|
+
})), /* @__PURE__ */ React21.createElement("div", {
|
|
1353
1556
|
role: "none",
|
|
1354
1557
|
className: "grow"
|
|
1355
|
-
}), /* @__PURE__ */
|
|
1558
|
+
}), /* @__PURE__ */ React21.createElement("div", {
|
|
1356
1559
|
className: "flex gap-2"
|
|
1357
|
-
}, /* @__PURE__ */
|
|
1560
|
+
}, /* @__PURE__ */ React21.createElement(Button6, {
|
|
1358
1561
|
disabled,
|
|
1359
1562
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1360
1563
|
onClick: handleNext,
|
|
1361
1564
|
"data-testid": `${method === "recover identity" ? "recover" : "create"}-identity-input-continue`
|
|
1362
|
-
}, /* @__PURE__ */
|
|
1565
|
+
}, /* @__PURE__ */ React21.createElement(CaretLeft2, {
|
|
1363
1566
|
weight: "bold",
|
|
1364
|
-
className:
|
|
1365
|
-
}), /* @__PURE__ */
|
|
1567
|
+
className: mx15(getSize8(2), "invisible")
|
|
1568
|
+
}), /* @__PURE__ */ React21.createElement("span", {
|
|
1366
1569
|
className: "grow"
|
|
1367
|
-
}, t("continue label")), /* @__PURE__ */
|
|
1570
|
+
}, t("continue label")), /* @__PURE__ */ React21.createElement(CaretRight3, {
|
|
1368
1571
|
weight: "bold",
|
|
1369
|
-
className:
|
|
1370
|
-
})), /* @__PURE__ */
|
|
1572
|
+
className: getSize8(4)
|
|
1573
|
+
})), /* @__PURE__ */ React21.createElement(Button6, {
|
|
1371
1574
|
disabled,
|
|
1372
|
-
onClick: () =>
|
|
1373
|
-
type: "
|
|
1575
|
+
onClick: () => joinSend({
|
|
1576
|
+
type: "deselectAuthMethod"
|
|
1374
1577
|
}),
|
|
1375
1578
|
className: "flex items-center gap-2 pis-2 pie-4",
|
|
1376
1579
|
"data-testid": `${method === "recover identity" ? "recover" : "create"}-identity-input-back`
|
|
1377
|
-
}, /* @__PURE__ */
|
|
1580
|
+
}, /* @__PURE__ */ React21.createElement(CaretLeft2, {
|
|
1378
1581
|
weight: "bold",
|
|
1379
|
-
className:
|
|
1380
|
-
}), /* @__PURE__ */
|
|
1582
|
+
className: getSize8(4)
|
|
1583
|
+
}), /* @__PURE__ */ React21.createElement("span", null, t("back label")))));
|
|
1381
1584
|
};
|
|
1382
1585
|
|
|
1383
1586
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationAccepted.tsx
|
|
1384
|
-
import { CaretLeft as
|
|
1385
|
-
import
|
|
1587
|
+
import { CaretLeft as CaretLeft3, Check as Check2 } from "@phosphor-icons/react";
|
|
1588
|
+
import React22, { cloneElement as cloneElement4 } from "react";
|
|
1386
1589
|
import { useInvitationStatus as useInvitationStatus3 } from "@dxos/react-client";
|
|
1387
|
-
import { Button as
|
|
1388
|
-
function
|
|
1389
|
-
|
|
1590
|
+
import { Button as Button7, getSize as getSize9, mx as mx16, useTranslation as useTranslation12 } from "@dxos/react-components";
|
|
1591
|
+
function _extends18() {
|
|
1592
|
+
_extends18 = Object.assign || function(target) {
|
|
1390
1593
|
for (var i = 1; i < arguments.length; i++) {
|
|
1391
1594
|
var source = arguments[i];
|
|
1392
1595
|
for (var key in source) {
|
|
@@ -1397,51 +1600,56 @@ function _extends19() {
|
|
|
1397
1600
|
}
|
|
1398
1601
|
return target;
|
|
1399
1602
|
};
|
|
1400
|
-
return
|
|
1603
|
+
return _extends18.apply(this, arguments);
|
|
1401
1604
|
}
|
|
1402
|
-
var PureInvitationAcceptedContent = ({ onDone, result,
|
|
1605
|
+
var PureInvitationAcceptedContent = ({ onDone, result, Domain, doneActionParent, active }) => {
|
|
1403
1606
|
const disabled = !active;
|
|
1404
|
-
const { t } =
|
|
1405
|
-
const doneButton = /* @__PURE__ */
|
|
1607
|
+
const { t } = useTranslation12("os");
|
|
1608
|
+
const doneButton = /* @__PURE__ */ React22.createElement(Button7, _extends18({}, onDone && {
|
|
1406
1609
|
onClick: () => onDone(result)
|
|
1407
1610
|
}, {
|
|
1408
1611
|
disabled,
|
|
1409
|
-
className: "
|
|
1410
|
-
"data-autofocus":
|
|
1411
|
-
"data-testid": `${
|
|
1412
|
-
}), /* @__PURE__ */
|
|
1612
|
+
className: "flex items-center gap-2 pli-2",
|
|
1613
|
+
"data-autofocus": `success${Domain}Invitation finishingJoining${Domain}`,
|
|
1614
|
+
"data-testid": `${Domain.toLowerCase()}-invitation-accepted-done`
|
|
1615
|
+
}), /* @__PURE__ */ React22.createElement(CaretLeft3, {
|
|
1413
1616
|
weight: "bold",
|
|
1414
|
-
className:
|
|
1415
|
-
}), /* @__PURE__ */
|
|
1617
|
+
className: mx16(getSize9(2), "invisible")
|
|
1618
|
+
}), /* @__PURE__ */ React22.createElement("span", {
|
|
1416
1619
|
className: "grow"
|
|
1417
|
-
}, t("done label")), /* @__PURE__ */
|
|
1418
|
-
|
|
1419
|
-
className: getSize10(4)
|
|
1620
|
+
}, t("done label")), /* @__PURE__ */ React22.createElement(Check2, {
|
|
1621
|
+
className: getSize9(4)
|
|
1420
1622
|
}));
|
|
1421
|
-
return
|
|
1623
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement("p", {
|
|
1624
|
+
className: "text-center text-sm font-system-normal"
|
|
1625
|
+
}, t("welcome message")), /* @__PURE__ */ React22.createElement("div", {
|
|
1626
|
+
role: "none",
|
|
1627
|
+
className: "grow"
|
|
1628
|
+
}), doneActionParent ? /* @__PURE__ */ cloneElement4(doneActionParent, {}, doneButton) : doneButton);
|
|
1422
1629
|
};
|
|
1423
1630
|
var InvitationAcceptedContent = (props) => {
|
|
1424
1631
|
const { result } = useInvitationStatus3(props.activeInvitation);
|
|
1425
|
-
return /* @__PURE__ */
|
|
1632
|
+
return /* @__PURE__ */ React22.createElement(PureInvitationAcceptedContent, _extends18({}, props, {
|
|
1426
1633
|
result
|
|
1427
1634
|
}));
|
|
1428
1635
|
};
|
|
1429
1636
|
var InvitationAccepted = (props) => {
|
|
1430
|
-
|
|
1431
|
-
const {
|
|
1432
|
-
|
|
1637
|
+
var _a;
|
|
1638
|
+
const { Domain, doneActionParent: _doneActionParent, onDone: _onDone, ...viewStateProps } = props;
|
|
1639
|
+
const activeInvitation = (_a = viewStateProps.joinState) == null ? void 0 : _a.context[Domain.toLowerCase()].invitationObservable;
|
|
1640
|
+
return /* @__PURE__ */ React22.createElement(ViewState, _extends18({}, viewStateProps), !activeInvitation ? /* @__PURE__ */ React22.createElement(PureInvitationAcceptedContent, _extends18({}, props, {
|
|
1433
1641
|
result: null
|
|
1434
|
-
})) : /* @__PURE__ */
|
|
1642
|
+
})) : /* @__PURE__ */ React22.createElement(InvitationAcceptedContent, _extends18({}, props, {
|
|
1643
|
+
activeInvitation
|
|
1644
|
+
})));
|
|
1435
1645
|
};
|
|
1436
1646
|
|
|
1437
1647
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationInput.tsx
|
|
1438
|
-
import { CaretLeft as
|
|
1439
|
-
import
|
|
1440
|
-
import {
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
function _extends20() {
|
|
1444
|
-
_extends20 = Object.assign || function(target) {
|
|
1648
|
+
import { CaretLeft as CaretLeft4, CaretRight as CaretRight4 } from "@phosphor-icons/react";
|
|
1649
|
+
import React23, { useEffect, useState as useState3 } from "react";
|
|
1650
|
+
import { Button as Button8, getSize as getSize10, Input as Input2, mx as mx17, useTranslation as useTranslation13 } from "@dxos/react-components";
|
|
1651
|
+
function _extends19() {
|
|
1652
|
+
_extends19 = Object.assign || function(target) {
|
|
1445
1653
|
for (var i = 1; i < arguments.length; i++) {
|
|
1446
1654
|
var source = arguments[i];
|
|
1447
1655
|
for (var key in source) {
|
|
@@ -1452,75 +1660,76 @@ function _extends20() {
|
|
|
1452
1660
|
}
|
|
1453
1661
|
return target;
|
|
1454
1662
|
};
|
|
1455
|
-
return
|
|
1663
|
+
return _extends19.apply(this, arguments);
|
|
1456
1664
|
}
|
|
1457
|
-
var InvitationInput = ({
|
|
1458
|
-
const client = useClient5();
|
|
1665
|
+
var InvitationInput = ({ Domain, ...viewStateProps }) => {
|
|
1459
1666
|
const disabled = !viewStateProps.active;
|
|
1460
|
-
const {
|
|
1461
|
-
const { t } =
|
|
1462
|
-
const
|
|
1463
|
-
const
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1667
|
+
const { joinSend, joinState } = viewStateProps;
|
|
1668
|
+
const { t } = useTranslation13("os");
|
|
1669
|
+
const contextUnredeemedCode = joinState == null ? void 0 : joinState.context[Domain.toLowerCase()].unredeemedCode;
|
|
1670
|
+
const [inputValue, setInputValue] = useState3(contextUnredeemedCode != null ? contextUnredeemedCode : "");
|
|
1671
|
+
useEffect(() => {
|
|
1672
|
+
contextUnredeemedCode && setInputValue(contextUnredeemedCode != null ? contextUnredeemedCode : "");
|
|
1673
|
+
}, [
|
|
1674
|
+
contextUnredeemedCode
|
|
1675
|
+
]);
|
|
1676
|
+
const handleNext = () => joinSend({
|
|
1677
|
+
type: `set${Domain}InvitationCode`,
|
|
1678
|
+
code: inputValue
|
|
1467
1679
|
});
|
|
1468
|
-
return /* @__PURE__ */
|
|
1680
|
+
return /* @__PURE__ */ React23.createElement(ViewState, _extends19({}, viewStateProps), /* @__PURE__ */ React23.createElement(Input2, {
|
|
1469
1681
|
disabled,
|
|
1470
|
-
label: /* @__PURE__ */
|
|
1682
|
+
label: /* @__PURE__ */ React23.createElement(ViewStateHeading, null, t("invitation input label")),
|
|
1683
|
+
value: inputValue,
|
|
1471
1684
|
onChange: ({ target: { value } }) => setInputValue(value),
|
|
1472
1685
|
slots: {
|
|
1473
1686
|
root: {
|
|
1474
1687
|
className: "m-0"
|
|
1475
1688
|
},
|
|
1476
|
-
label: {
|
|
1477
|
-
className: "sr-only"
|
|
1478
|
-
},
|
|
1479
1689
|
input: {
|
|
1480
|
-
"data-autofocus":
|
|
1481
|
-
"data-testid": `${
|
|
1690
|
+
"data-autofocus": `inputting${Domain}InvitationCode`,
|
|
1691
|
+
"data-testid": `${Domain.toLowerCase()}-invitation-input`,
|
|
1482
1692
|
onKeyUp: ({ key }) => key === "Enter" && handleNext()
|
|
1483
1693
|
}
|
|
1484
1694
|
}
|
|
1485
|
-
}), /* @__PURE__ */
|
|
1695
|
+
}), /* @__PURE__ */ React23.createElement("div", {
|
|
1486
1696
|
role: "none",
|
|
1487
1697
|
className: "grow"
|
|
1488
|
-
}), /* @__PURE__ */
|
|
1698
|
+
}), /* @__PURE__ */ React23.createElement("div", {
|
|
1489
1699
|
className: "flex gap-2"
|
|
1490
|
-
}, /* @__PURE__ */
|
|
1700
|
+
}, /* @__PURE__ */ React23.createElement(Button8, {
|
|
1491
1701
|
disabled,
|
|
1492
1702
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1493
1703
|
onClick: handleNext,
|
|
1494
|
-
"data-testid": `${
|
|
1495
|
-
}, /* @__PURE__ */
|
|
1704
|
+
"data-testid": `${Domain.toLowerCase()}-invitation-input-continue`
|
|
1705
|
+
}, /* @__PURE__ */ React23.createElement(CaretLeft4, {
|
|
1496
1706
|
weight: "bold",
|
|
1497
|
-
className:
|
|
1498
|
-
}), /* @__PURE__ */
|
|
1707
|
+
className: mx17(getSize10(2), "invisible")
|
|
1708
|
+
}), /* @__PURE__ */ React23.createElement("span", {
|
|
1499
1709
|
className: "grow"
|
|
1500
|
-
}, t("continue label")), /* @__PURE__ */
|
|
1710
|
+
}, t("continue label")), /* @__PURE__ */ React23.createElement(CaretRight4, {
|
|
1501
1711
|
weight: "bold",
|
|
1502
|
-
className:
|
|
1503
|
-
})), /* @__PURE__ */
|
|
1504
|
-
disabled,
|
|
1505
|
-
onClick: () =>
|
|
1506
|
-
type: "
|
|
1712
|
+
className: getSize10(4)
|
|
1713
|
+
})), /* @__PURE__ */ React23.createElement(Button8, {
|
|
1714
|
+
disabled: Domain === "Space",
|
|
1715
|
+
onClick: () => joinSend({
|
|
1716
|
+
type: "deselectAuthMethod"
|
|
1507
1717
|
}),
|
|
1508
1718
|
className: "flex items-center gap-2 pis-2 pie-4",
|
|
1509
|
-
"data-testid": `${
|
|
1510
|
-
}, /* @__PURE__ */
|
|
1719
|
+
"data-testid": `${Domain.toLowerCase()}-invitation-input-back`
|
|
1720
|
+
}, /* @__PURE__ */ React23.createElement(CaretLeft4, {
|
|
1511
1721
|
weight: "bold",
|
|
1512
|
-
className:
|
|
1513
|
-
}), /* @__PURE__ */
|
|
1722
|
+
className: getSize10(4)
|
|
1723
|
+
}), /* @__PURE__ */ React23.createElement("span", null, t("back label")))));
|
|
1514
1724
|
};
|
|
1515
1725
|
|
|
1516
1726
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationRescuer.tsx
|
|
1517
|
-
import { ArrowsClockwise, CaretLeft as
|
|
1518
|
-
import
|
|
1519
|
-
import { Invitation as
|
|
1520
|
-
import {
|
|
1521
|
-
|
|
1522
|
-
function
|
|
1523
|
-
_extends21 = Object.assign || function(target) {
|
|
1727
|
+
import { ArrowsClockwise, CaretLeft as CaretLeft5, CaretRight as CaretRight5 } from "@phosphor-icons/react";
|
|
1728
|
+
import React24 from "react";
|
|
1729
|
+
import { Invitation as Invitation6 } from "@dxos/client";
|
|
1730
|
+
import { Button as Button9, defaultDescription as defaultDescription3, getSize as getSize11, mx as mx18, useTranslation as useTranslation14 } from "@dxos/react-components";
|
|
1731
|
+
function _extends20() {
|
|
1732
|
+
_extends20 = Object.assign || function(target) {
|
|
1524
1733
|
for (var i = 1; i < arguments.length; i++) {
|
|
1525
1734
|
var source = arguments[i];
|
|
1526
1735
|
for (var key in source) {
|
|
@@ -1531,96 +1740,110 @@ function _extends21() {
|
|
|
1531
1740
|
}
|
|
1532
1741
|
return target;
|
|
1533
1742
|
};
|
|
1534
|
-
return
|
|
1743
|
+
return _extends20.apply(this, arguments);
|
|
1535
1744
|
}
|
|
1536
|
-
var InvitationActions = ({
|
|
1537
|
-
const {
|
|
1538
|
-
const
|
|
1539
|
-
switch (
|
|
1540
|
-
case
|
|
1541
|
-
return /* @__PURE__ */
|
|
1745
|
+
var InvitationActions = ({ invitationState, disabled, joinSend, joinState, Domain }) => {
|
|
1746
|
+
const { t } = useTranslation14("os");
|
|
1747
|
+
const invitationType = Domain.toLowerCase();
|
|
1748
|
+
switch (invitationState) {
|
|
1749
|
+
case Invitation6.State.CONNECTING:
|
|
1750
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(ViewStateHeading, {
|
|
1751
|
+
className: defaultDescription3
|
|
1752
|
+
}, t("connecting status label")), /* @__PURE__ */ React24.createElement("div", {
|
|
1542
1753
|
role: "none",
|
|
1543
1754
|
className: "grow"
|
|
1544
|
-
}), /* @__PURE__ */
|
|
1755
|
+
}), /* @__PURE__ */ React24.createElement("div", {
|
|
1545
1756
|
className: "flex gap-2"
|
|
1546
|
-
}, /* @__PURE__ */
|
|
1757
|
+
}, /* @__PURE__ */ React24.createElement(Button9, {
|
|
1547
1758
|
disabled: true,
|
|
1548
1759
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1549
1760
|
"data-testid": "next"
|
|
1550
|
-
}, /* @__PURE__ */
|
|
1761
|
+
}, /* @__PURE__ */ React24.createElement(CaretLeft5, {
|
|
1551
1762
|
weight: "bold",
|
|
1552
|
-
className:
|
|
1553
|
-
}), /* @__PURE__ */
|
|
1763
|
+
className: mx18(getSize11(2), "invisible")
|
|
1764
|
+
}), /* @__PURE__ */ React24.createElement("span", {
|
|
1554
1765
|
className: "grow"
|
|
1555
|
-
}, t("next label")), /* @__PURE__ */
|
|
1766
|
+
}, t("next label")), /* @__PURE__ */ React24.createElement(CaretRight5, {
|
|
1556
1767
|
weight: "bold",
|
|
1557
|
-
className:
|
|
1558
|
-
})), /* @__PURE__ */
|
|
1768
|
+
className: getSize11(4)
|
|
1769
|
+
})), /* @__PURE__ */ React24.createElement(Button9, {
|
|
1559
1770
|
disabled,
|
|
1560
1771
|
className: "flex items-center gap-2 pis-2 pie-4",
|
|
1561
|
-
onClick:
|
|
1562
|
-
|
|
1772
|
+
onClick: () => {
|
|
1773
|
+
var _a;
|
|
1774
|
+
return (_a = joinState == null ? void 0 : joinState.context[invitationType].invitationObservable) == null ? void 0 : _a.cancel();
|
|
1775
|
+
},
|
|
1563
1776
|
"data-testid": "invitation-rescuer-cancel"
|
|
1564
|
-
}, /* @__PURE__ */
|
|
1777
|
+
}, /* @__PURE__ */ React24.createElement(CaretLeft5, {
|
|
1565
1778
|
weight: "bold",
|
|
1566
|
-
className:
|
|
1567
|
-
}), /* @__PURE__ */
|
|
1568
|
-
case
|
|
1569
|
-
case
|
|
1570
|
-
case
|
|
1779
|
+
className: getSize11(4)
|
|
1780
|
+
}), /* @__PURE__ */ React24.createElement("span", null, t("cancel label")))));
|
|
1781
|
+
case Invitation6.State.TIMEOUT:
|
|
1782
|
+
case Invitation6.State.CANCELLED:
|
|
1783
|
+
case Invitation6.State.ERROR:
|
|
1571
1784
|
default:
|
|
1572
|
-
return /* @__PURE__ */
|
|
1785
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(ViewStateHeading, {
|
|
1786
|
+
className: defaultDescription3
|
|
1787
|
+
}, t(invitationState === Invitation6.State.TIMEOUT ? "timeout status label" : invitationState === Invitation6.State.CANCELLED ? "cancelled status label" : "error status label")), /* @__PURE__ */ React24.createElement("div", {
|
|
1788
|
+
role: "none",
|
|
1789
|
+
className: "grow"
|
|
1790
|
+
}), /* @__PURE__ */ React24.createElement(Button9, {
|
|
1573
1791
|
disabled,
|
|
1574
|
-
className: "
|
|
1575
|
-
onClick: () =>
|
|
1576
|
-
type:
|
|
1577
|
-
from: invitationType
|
|
1792
|
+
className: "flex items-center gap-2 pli-2",
|
|
1793
|
+
onClick: () => joinSend({
|
|
1794
|
+
type: `reset${Domain}Invitation`
|
|
1578
1795
|
}),
|
|
1579
|
-
"data-autofocus": `${invitationType} invitation acceptor; invitation rescuer`,
|
|
1580
1796
|
"data-testid": "invitation-rescuer-reset"
|
|
1581
|
-
}, /* @__PURE__ */
|
|
1797
|
+
}, /* @__PURE__ */ React24.createElement(CaretLeft5, {
|
|
1582
1798
|
weight: "bold",
|
|
1583
|
-
className:
|
|
1584
|
-
}), /* @__PURE__ */
|
|
1799
|
+
className: mx18(getSize11(5), "invisible")
|
|
1800
|
+
}), /* @__PURE__ */ React24.createElement("span", {
|
|
1585
1801
|
className: "grow"
|
|
1586
|
-
}, t("reset label")), /* @__PURE__ */
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
}));
|
|
1802
|
+
}, t("reset label")), /* @__PURE__ */ React24.createElement(ArrowsClockwise, {
|
|
1803
|
+
className: getSize11(4)
|
|
1804
|
+
})));
|
|
1590
1805
|
}
|
|
1591
1806
|
};
|
|
1592
|
-
var InvitationRescuer = ({
|
|
1807
|
+
var InvitationRescuer = ({ Domain, ...viewStateProps }) => {
|
|
1808
|
+
var _a;
|
|
1593
1809
|
const disabled = !viewStateProps.active;
|
|
1594
|
-
const {
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1810
|
+
const { joinSend, joinState } = viewStateProps;
|
|
1811
|
+
const invitationState = (_a = joinState == null ? void 0 : joinState.context[Domain.toLowerCase()].invitation) == null ? void 0 : _a.state;
|
|
1812
|
+
const { t } = useTranslation14("os");
|
|
1813
|
+
return /* @__PURE__ */ React24.createElement(ViewState, _extends20({}, viewStateProps), typeof invitationState === "undefined" ? /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement("div", {
|
|
1814
|
+
role: "none",
|
|
1815
|
+
className: "grow"
|
|
1816
|
+
}), /* @__PURE__ */ React24.createElement(Button9, {
|
|
1597
1817
|
disabled,
|
|
1598
|
-
className: "
|
|
1599
|
-
"data-autofocus":
|
|
1600
|
-
"data-testid": "invitation-rescuer-
|
|
1601
|
-
|
|
1818
|
+
className: "flex items-center gap-2 pli-2",
|
|
1819
|
+
"data-autofocus": `inputting${Domain}InvitationCode`,
|
|
1820
|
+
"data-testid": "invitation-rescuer-blank-reset",
|
|
1821
|
+
onClick: () => joinSend({
|
|
1822
|
+
type: `reset${Domain}Invitation`
|
|
1823
|
+
})
|
|
1824
|
+
}, /* @__PURE__ */ React24.createElement(CaretLeft5, {
|
|
1602
1825
|
weight: "bold",
|
|
1603
|
-
className:
|
|
1604
|
-
}), /* @__PURE__ */
|
|
1826
|
+
className: mx18(getSize11(5), "invisible")
|
|
1827
|
+
}), /* @__PURE__ */ React24.createElement("span", {
|
|
1605
1828
|
className: "grow"
|
|
1606
|
-
}, t("
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
activeInvitation,
|
|
1829
|
+
}, t("reset label")), /* @__PURE__ */ React24.createElement(ArrowsClockwise, {
|
|
1830
|
+
className: getSize11(5)
|
|
1831
|
+
}))) : /* @__PURE__ */ React24.createElement(InvitationActions, _extends20({}, {
|
|
1832
|
+
invitationState,
|
|
1611
1833
|
disabled,
|
|
1612
|
-
|
|
1613
|
-
|
|
1834
|
+
joinSend,
|
|
1835
|
+
joinState,
|
|
1836
|
+
Domain
|
|
1614
1837
|
})));
|
|
1615
1838
|
};
|
|
1616
1839
|
|
|
1617
1840
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx
|
|
1618
|
-
import { CaretLeft as
|
|
1619
|
-
import
|
|
1620
|
-
import { useInvitationStatus as
|
|
1621
|
-
import { Button as
|
|
1622
|
-
function
|
|
1623
|
-
|
|
1841
|
+
import { CaretLeft as CaretLeft6, CaretRight as CaretRight6 } from "@phosphor-icons/react";
|
|
1842
|
+
import React25, { useCallback as useCallback5, useState as useState4 } from "react";
|
|
1843
|
+
import { useInvitationStatus as useInvitationStatus4 } from "@dxos/react-client";
|
|
1844
|
+
import { Button as Button10, getSize as getSize12, Input as Input3, mx as mx19, useTranslation as useTranslation15 } from "@dxos/react-components";
|
|
1845
|
+
function _extends21() {
|
|
1846
|
+
_extends21 = Object.assign || function(target) {
|
|
1624
1847
|
for (var i = 1; i < arguments.length; i++) {
|
|
1625
1848
|
var source = arguments[i];
|
|
1626
1849
|
for (var key in source) {
|
|
@@ -1631,13 +1854,14 @@ function _extends22() {
|
|
|
1631
1854
|
}
|
|
1632
1855
|
return target;
|
|
1633
1856
|
};
|
|
1634
|
-
return
|
|
1857
|
+
return _extends21.apply(this, arguments);
|
|
1635
1858
|
}
|
|
1636
1859
|
var pinLength = 6;
|
|
1637
|
-
var PureInvitationAuthenticatorContent = ({ disabled, failed,
|
|
1638
|
-
const { t } =
|
|
1639
|
-
|
|
1640
|
-
|
|
1860
|
+
var PureInvitationAuthenticatorContent = ({ disabled, failed, joinSend, joinState, Domain, onChange, onAuthenticate }) => {
|
|
1861
|
+
const { t } = useTranslation15("os");
|
|
1862
|
+
const invitationType = Domain.toLowerCase();
|
|
1863
|
+
return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(Input3, _extends21({
|
|
1864
|
+
label: /* @__PURE__ */ React25.createElement(ViewStateHeading, null, t("auth code input label")),
|
|
1641
1865
|
size: "pin",
|
|
1642
1866
|
length: pinLength,
|
|
1643
1867
|
onChange,
|
|
@@ -1646,67 +1870,65 @@ var PureInvitationAuthenticatorContent = ({ disabled, failed, dispatch, invitati
|
|
|
1646
1870
|
root: {
|
|
1647
1871
|
className: "m-0"
|
|
1648
1872
|
},
|
|
1649
|
-
label: {
|
|
1650
|
-
className: "sr-only"
|
|
1651
|
-
},
|
|
1652
1873
|
description: {
|
|
1653
1874
|
className: "text-center"
|
|
1654
1875
|
},
|
|
1655
1876
|
input: {
|
|
1656
1877
|
disabled,
|
|
1657
1878
|
inputMode: "numeric",
|
|
1879
|
+
autoComplete: "off",
|
|
1658
1880
|
pattern: "\\d*",
|
|
1659
|
-
"data-autofocus":
|
|
1660
|
-
"data-testid": `${invitationType}-auth-code-input
|
|
1881
|
+
"data-autofocus": `connecting${Domain}Invitation inputting${Domain}VerificationCode authenticationFailing${Domain}VerificationCode authenticating${Domain}VerificationCode`,
|
|
1882
|
+
"data-testid": `${invitationType}-auth-code-input`,
|
|
1883
|
+
"data-1p-ignore": true
|
|
1661
1884
|
}
|
|
1662
1885
|
}
|
|
1663
1886
|
}, failed && {
|
|
1664
1887
|
validationValence: "error",
|
|
1665
1888
|
validationMessage: t("failed to authenticate message")
|
|
1666
|
-
})), /* @__PURE__ */
|
|
1889
|
+
})), /* @__PURE__ */ React25.createElement("div", {
|
|
1667
1890
|
role: "none",
|
|
1668
1891
|
className: "grow"
|
|
1669
|
-
}), /* @__PURE__ */
|
|
1892
|
+
}), /* @__PURE__ */ React25.createElement("div", {
|
|
1670
1893
|
className: "flex gap-2"
|
|
1671
|
-
}, /* @__PURE__ */
|
|
1894
|
+
}, /* @__PURE__ */ React25.createElement(Button10, {
|
|
1672
1895
|
disabled,
|
|
1673
1896
|
className: "grow flex items-center gap-2 pli-2 order-2",
|
|
1674
1897
|
onClick: onAuthenticate,
|
|
1675
1898
|
"data-autofocus-pinlength": invitationType,
|
|
1676
1899
|
"data-testid": `${invitationType}-invitation-authenticator-next`
|
|
1677
|
-
}, /* @__PURE__ */
|
|
1900
|
+
}, /* @__PURE__ */ React25.createElement(CaretLeft6, {
|
|
1678
1901
|
weight: "bold",
|
|
1679
|
-
className:
|
|
1680
|
-
}), /* @__PURE__ */
|
|
1902
|
+
className: mx19(getSize12(2), "invisible")
|
|
1903
|
+
}), /* @__PURE__ */ React25.createElement("span", {
|
|
1681
1904
|
className: "grow"
|
|
1682
|
-
}, t("next label")), /* @__PURE__ */
|
|
1905
|
+
}, t("next label")), /* @__PURE__ */ React25.createElement(CaretRight6, {
|
|
1683
1906
|
weight: "bold",
|
|
1684
|
-
className:
|
|
1685
|
-
})), /* @__PURE__ */
|
|
1907
|
+
className: getSize12(4)
|
|
1908
|
+
})), /* @__PURE__ */ React25.createElement(Button10, {
|
|
1686
1909
|
disabled,
|
|
1687
1910
|
className: "flex items-center gap-2 pis-2 pie-4",
|
|
1688
|
-
onClick: () =>
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
}
|
|
1911
|
+
onClick: () => {
|
|
1912
|
+
var _a;
|
|
1913
|
+
return (_a = joinState == null ? void 0 : joinState.context[invitationType].invitationObservable) == null ? void 0 : _a.cancel();
|
|
1914
|
+
},
|
|
1692
1915
|
"data-testid": `${invitationType}-invitation-authenticator-cancel`
|
|
1693
|
-
}, /* @__PURE__ */
|
|
1916
|
+
}, /* @__PURE__ */ React25.createElement(CaretLeft6, {
|
|
1694
1917
|
weight: "bold",
|
|
1695
|
-
className:
|
|
1696
|
-
}), /* @__PURE__ */
|
|
1918
|
+
className: getSize12(4)
|
|
1919
|
+
}), /* @__PURE__ */ React25.createElement("span", null, t("cancel label")))));
|
|
1697
1920
|
};
|
|
1698
|
-
var InvitationAuthenticatorContent = ({ disabled, invitation,
|
|
1699
|
-
const
|
|
1700
|
-
const
|
|
1921
|
+
var InvitationAuthenticatorContent = ({ joinSend, joinState, disabled, invitation, Domain, failed }) => {
|
|
1922
|
+
const invitationType = Domain.toLowerCase();
|
|
1923
|
+
const [pinValue, setPinValue] = useState4("");
|
|
1924
|
+
const { authenticate } = useInvitationStatus4(invitation);
|
|
1701
1925
|
const onAuthenticate = useCallback5(() => {
|
|
1702
|
-
|
|
1703
|
-
type:
|
|
1704
|
-
from: invitationType
|
|
1926
|
+
joinSend({
|
|
1927
|
+
type: `authenticate${Domain}VerificationCode`
|
|
1705
1928
|
});
|
|
1706
1929
|
void authenticate(pinValue);
|
|
1707
1930
|
}, [
|
|
1708
|
-
|
|
1709
|
-
invitationType,
|
|
1931
|
+
joinSend,
|
|
1710
1932
|
authenticate,
|
|
1711
1933
|
pinValue
|
|
1712
1934
|
]);
|
|
@@ -1720,39 +1942,46 @@ var InvitationAuthenticatorContent = ({ disabled, invitation, dispatch, invitati
|
|
|
1720
1942
|
authenticate,
|
|
1721
1943
|
pinValue
|
|
1722
1944
|
]);
|
|
1723
|
-
return /* @__PURE__ */
|
|
1945
|
+
return /* @__PURE__ */ React25.createElement(PureInvitationAuthenticatorContent, _extends21({}, {
|
|
1724
1946
|
disabled,
|
|
1725
1947
|
failed,
|
|
1726
|
-
|
|
1727
|
-
|
|
1948
|
+
joinSend,
|
|
1949
|
+
joinState,
|
|
1950
|
+
Domain,
|
|
1728
1951
|
onChange,
|
|
1729
1952
|
onAuthenticate
|
|
1730
1953
|
}));
|
|
1731
1954
|
};
|
|
1732
|
-
var InvitationAuthenticator = ({
|
|
1733
|
-
const
|
|
1734
|
-
const
|
|
1735
|
-
|
|
1955
|
+
var InvitationAuthenticator = ({ failed, Domain, ...viewStateProps }) => {
|
|
1956
|
+
const { joinSend, joinState } = viewStateProps;
|
|
1957
|
+
const disabled = !viewStateProps.active || [
|
|
1958
|
+
"connecting",
|
|
1959
|
+
"authenticating"
|
|
1960
|
+
].some((str) => joinState == null ? void 0 : joinState.configuration[0].id.includes(str));
|
|
1961
|
+
const activeInvitation = joinState == null ? void 0 : joinState.context[Domain.toLowerCase()].invitationObservable;
|
|
1962
|
+
return /* @__PURE__ */ React25.createElement(ViewState, _extends21({}, viewStateProps), !activeInvitation ? /* @__PURE__ */ React25.createElement(PureInvitationAuthenticatorContent, _extends21({}, {
|
|
1736
1963
|
disabled,
|
|
1737
1964
|
failed,
|
|
1738
|
-
|
|
1739
|
-
|
|
1965
|
+
joinSend,
|
|
1966
|
+
joinState,
|
|
1967
|
+
Domain,
|
|
1740
1968
|
onChange: () => {
|
|
1741
1969
|
},
|
|
1742
1970
|
onAuthenticate: () => {
|
|
1743
1971
|
}
|
|
1744
|
-
})) : /* @__PURE__ */
|
|
1972
|
+
})) : /* @__PURE__ */ React25.createElement(InvitationAuthenticatorContent, _extends21({}, {
|
|
1745
1973
|
disabled,
|
|
1746
1974
|
failed,
|
|
1747
1975
|
invitation: activeInvitation,
|
|
1748
|
-
|
|
1749
|
-
|
|
1976
|
+
joinSend,
|
|
1977
|
+
joinState,
|
|
1978
|
+
Domain
|
|
1750
1979
|
})));
|
|
1751
1980
|
};
|
|
1752
1981
|
|
|
1753
1982
|
// packages/apps/patterns/react-ui/src/panels/JoinPanel/JoinPanel.tsx
|
|
1754
|
-
function
|
|
1755
|
-
|
|
1983
|
+
function _extends22() {
|
|
1984
|
+
_extends22 = Object.assign || function(target) {
|
|
1756
1985
|
for (var i = 1; i < arguments.length; i++) {
|
|
1757
1986
|
var source = arguments[i];
|
|
1758
1987
|
for (var key in source) {
|
|
@@ -1763,322 +1992,239 @@ function _extends23() {
|
|
|
1763
1992
|
}
|
|
1764
1993
|
return target;
|
|
1765
1994
|
};
|
|
1766
|
-
return
|
|
1995
|
+
return _extends22.apply(this, arguments);
|
|
1767
1996
|
}
|
|
1768
|
-
var JoinPanel = ({ mode, initialInvitationCode,
|
|
1769
|
-
const client =
|
|
1770
|
-
const internalTitleId = useId4("joinPanel__title");
|
|
1771
|
-
const titleId = propsTitleId != null ? propsTitleId : internalTitleId;
|
|
1997
|
+
var JoinPanel = ({ mode = "default", initialInvitationCode, exitActionParent, onExit, doneActionParent, onDone, preventExit }) => {
|
|
1998
|
+
const client = useClient5();
|
|
1772
1999
|
const identity = useIdentity2();
|
|
1773
|
-
const
|
|
1774
|
-
const
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
};
|
|
1782
|
-
switch (action.type) {
|
|
1783
|
-
case "added identity":
|
|
1784
|
-
nextState.activeView = "identity added";
|
|
1785
|
-
nextState.selectedIdentity = action.identity;
|
|
1786
|
-
break;
|
|
1787
|
-
case "add identity":
|
|
1788
|
-
nextState.activeView = "addition method selector";
|
|
1789
|
-
break;
|
|
1790
|
-
case "select addition method":
|
|
1791
|
-
if (action.method === "accept device invitation") {
|
|
1792
|
-
nextState.activeView = "halo invitation acceptor";
|
|
1793
|
-
if (state.unredeemedHaloInvitationCode) {
|
|
1794
|
-
nextState.haloInvitation = client.halo.acceptInvitation(InvitationEncoder2.decode(state.unredeemedHaloInvitationCode));
|
|
1795
|
-
nextState.unredeemedHaloInvitationCode = void 0;
|
|
1796
|
-
nextState.haloViewState = "invitation authenticator";
|
|
1797
|
-
} else {
|
|
1798
|
-
nextState.haloViewState = "invitation input";
|
|
1799
|
-
}
|
|
1800
|
-
} else {
|
|
1801
|
-
nextState.activeView = "identity input";
|
|
1802
|
-
nextState.additionMethod = action.method;
|
|
1803
|
-
}
|
|
1804
|
-
break;
|
|
1805
|
-
case "select identity":
|
|
1806
|
-
nextState.selectedIdentity = action.identity;
|
|
1807
|
-
nextState.activeView = "space invitation acceptor";
|
|
1808
|
-
if (state.unredeemedSpaceInvitationCode) {
|
|
1809
|
-
nextState.spaceInvitation = client.echo.acceptInvitation(InvitationEncoder2.decode(state.unredeemedSpaceInvitationCode));
|
|
1810
|
-
nextState.unredeemedSpaceInvitationCode = void 0;
|
|
1811
|
-
nextState.spaceViewState = "invitation authenticator";
|
|
1812
|
-
} else {
|
|
1813
|
-
nextState.spaceViewState = "invitation input";
|
|
1814
|
-
}
|
|
1815
|
-
break;
|
|
1816
|
-
case "deselect identity":
|
|
1817
|
-
nextState.selectedIdentity = void 0;
|
|
1818
|
-
nextState.activeView = "identity selector";
|
|
1819
|
-
break;
|
|
1820
|
-
case "cancel invitation":
|
|
1821
|
-
if (action.from === "space" && ((_a = state.spaceInvitation) == null ? void 0 : _a.invitation)) {
|
|
1822
|
-
void ((_b = state.spaceInvitation) == null ? void 0 : _b.cancel());
|
|
1823
|
-
}
|
|
1824
|
-
if (action.from === "halo" && ((_c = state.haloInvitation) == null ? void 0 : _c.invitation)) {
|
|
1825
|
-
void ((_d = state.haloInvitation) == null ? void 0 : _d.cancel());
|
|
1826
|
-
}
|
|
1827
|
-
break;
|
|
1828
|
-
case "authenticating invitation":
|
|
1829
|
-
nextState[action.from === "halo" ? "haloInvitationAnnotation" : "spaceInvitationAnnotation"] = "authenticating";
|
|
1830
|
-
break;
|
|
1831
|
-
case "connecting invitation":
|
|
1832
|
-
nextState[action.from === "halo" ? "haloInvitation" : "spaceInvitation"] = action.invitation;
|
|
1833
|
-
case "cancelled invitation":
|
|
1834
|
-
case "fail invitation":
|
|
1835
|
-
case "timeout invitation":
|
|
1836
|
-
nextState[action.from === "halo" ? "haloViewState" : "spaceViewState"] = "invitation rescuer";
|
|
1837
|
-
break;
|
|
1838
|
-
case "connect invitation":
|
|
1839
|
-
case "authenticate invitation":
|
|
1840
|
-
if (action.from === "halo" && state.haloInvitationAnnotation === "authenticating") {
|
|
1841
|
-
nextState.haloInvitationAnnotation = "authentication failed";
|
|
1842
|
-
}
|
|
1843
|
-
if (action.from === "space" && state.spaceInvitationAnnotation === "authenticating") {
|
|
1844
|
-
nextState.spaceInvitationAnnotation = "authentication failed";
|
|
2000
|
+
const titleId = useId4("joinPanel__title");
|
|
2001
|
+
const [joinState, joinSend, joinService] = useJoinMachine(client, {
|
|
2002
|
+
context: {
|
|
2003
|
+
mode,
|
|
2004
|
+
identity,
|
|
2005
|
+
...initialInvitationCode && {
|
|
2006
|
+
[mode === "halo-only" ? "halo" : "space"]: {
|
|
2007
|
+
unredeemedCode: initialInvitationCode
|
|
1845
2008
|
}
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
case "accepted invitation":
|
|
1849
|
-
nextState[action.from === "halo" ? "haloViewState" : "spaceViewState"] = "invitation accepted";
|
|
1850
|
-
break;
|
|
1851
|
-
case "reset invitation":
|
|
1852
|
-
nextState[action.from === "halo" ? "haloInvitation" : "spaceInvitation"] = void 0;
|
|
1853
|
-
nextState[action.from === "halo" ? "haloInvitationAnnotation" : "spaceInvitationAnnotation"] = void 0;
|
|
1854
|
-
nextState[action.from === "halo" ? "unredeemedHaloInvitationCode" : "unredeemedSpaceInvitationCode"] = void 0;
|
|
1855
|
-
nextState[action.from === "halo" ? "haloViewState" : "spaceViewState"] = "invitation input";
|
|
1856
|
-
break;
|
|
1857
|
-
}
|
|
1858
|
-
log("[join panel reducer]", {
|
|
1859
|
-
action,
|
|
1860
|
-
nextState
|
|
1861
|
-
}, {
|
|
1862
|
-
file: "JoinPanel.tsx",
|
|
1863
|
-
line: 125,
|
|
1864
|
-
scope: void 0,
|
|
1865
|
-
callSite: (f, a) => f(...a)
|
|
1866
|
-
});
|
|
1867
|
-
return nextState;
|
|
1868
|
-
};
|
|
1869
|
-
const unredeemedHaloInvitationCode = mode === "halo-only" ? initialInvitationCode : void 0;
|
|
1870
|
-
const [joinState, dispatch] = useReducer2(reducer, {
|
|
1871
|
-
unredeemedHaloInvitationCode,
|
|
1872
|
-
unredeemedSpaceInvitationCode: mode === "halo-only" ? void 0 : initialInvitationCode,
|
|
1873
|
-
spaceInvitation: void 0,
|
|
1874
|
-
haloInvitation: void 0,
|
|
1875
|
-
activeView: availableIdentities.length > 0 ? "identity selector" : "addition method selector",
|
|
1876
|
-
selectedIdentity: void 0,
|
|
1877
|
-
additionMethod: void 0,
|
|
1878
|
-
spaceViewState: "invitation input",
|
|
1879
|
-
haloViewState: "invitation input"
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
1880
2011
|
});
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
useEffect(() => {
|
|
1889
|
-
if (unredeemedHaloInvitationCode) {
|
|
1890
|
-
dispatch({
|
|
1891
|
-
type: "select addition method",
|
|
1892
|
-
method: "accept device invitation"
|
|
2012
|
+
useEffect2(() => {
|
|
2013
|
+
const subscription = joinService.subscribe((state) => {
|
|
2014
|
+
log2("[state]", state, {
|
|
2015
|
+
file: "JoinPanel.tsx",
|
|
2016
|
+
line: 48,
|
|
2017
|
+
scope: void 0,
|
|
2018
|
+
callSite: (f, a) => f(...a)
|
|
1893
2019
|
});
|
|
1894
|
-
}
|
|
2020
|
+
});
|
|
2021
|
+
return subscription.unsubscribe;
|
|
1895
2022
|
}, [
|
|
1896
|
-
|
|
2023
|
+
joinService
|
|
1897
2024
|
]);
|
|
1898
|
-
|
|
1899
|
-
const
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
file: "JoinPanel.tsx",
|
|
1904
|
-
line: 163,
|
|
1905
|
-
scope: void 0,
|
|
1906
|
-
callSite: (f, a) => f(...a)
|
|
1907
|
-
});
|
|
1908
|
-
const $nextAutofocus = document.querySelector(`[data-autofocus="${attrValue}"]`);
|
|
2025
|
+
useEffect2(() => {
|
|
2026
|
+
const stateStack = joinState.configuration[0].id.split(".");
|
|
2027
|
+
const innermostState = stateStack[stateStack.length - 1];
|
|
2028
|
+
const autoFocusValue = innermostState === "finishingJoining" ? "successSpaceInvitation" : innermostState;
|
|
2029
|
+
const $nextAutofocus = document.querySelector(`[data-autofocus~="${autoFocusValue}"]`);
|
|
1909
2030
|
if ($nextAutofocus) {
|
|
1910
2031
|
$nextAutofocus.focus();
|
|
1911
2032
|
}
|
|
1912
2033
|
}, [
|
|
1913
|
-
joinState.
|
|
1914
|
-
joinState.spaceViewState,
|
|
1915
|
-
joinState.haloViewState
|
|
2034
|
+
joinState.value
|
|
1916
2035
|
]);
|
|
1917
|
-
|
|
1918
|
-
var _a;
|
|
1919
|
-
return (_a = joinState.spaceInvitation) == null ? void 0 : _a.subscribe({
|
|
1920
|
-
onAuthenticating: () => dispatch({
|
|
1921
|
-
type: "authenticate invitation",
|
|
1922
|
-
from: "space"
|
|
1923
|
-
}),
|
|
1924
|
-
onCancelled: () => dispatch({
|
|
1925
|
-
type: "cancelled invitation",
|
|
1926
|
-
from: "space"
|
|
1927
|
-
}),
|
|
1928
|
-
onConnected: () => dispatch({
|
|
1929
|
-
type: "connect invitation",
|
|
1930
|
-
from: "space"
|
|
1931
|
-
}),
|
|
1932
|
-
onError: () => dispatch({
|
|
1933
|
-
type: "fail invitation",
|
|
1934
|
-
from: "space"
|
|
1935
|
-
}),
|
|
1936
|
-
onSuccess: () => dispatch({
|
|
1937
|
-
type: "accepted invitation",
|
|
1938
|
-
from: "space"
|
|
1939
|
-
}),
|
|
1940
|
-
onTimeout: () => dispatch({
|
|
1941
|
-
type: "timeout invitation",
|
|
1942
|
-
from: "space"
|
|
1943
|
-
})
|
|
1944
|
-
});
|
|
1945
|
-
}, [
|
|
1946
|
-
joinState.spaceInvitation
|
|
1947
|
-
]);
|
|
1948
|
-
useEffect(() => {
|
|
1949
|
-
var _a;
|
|
1950
|
-
return (_a = joinState.haloInvitation) == null ? void 0 : _a.subscribe({
|
|
1951
|
-
onAuthenticating: () => dispatch({
|
|
1952
|
-
type: "authenticate invitation",
|
|
1953
|
-
from: "halo"
|
|
1954
|
-
}),
|
|
1955
|
-
onCancelled: () => dispatch({
|
|
1956
|
-
type: "cancelled invitation",
|
|
1957
|
-
from: "halo"
|
|
1958
|
-
}),
|
|
1959
|
-
onConnected: () => dispatch({
|
|
1960
|
-
type: "connect invitation",
|
|
1961
|
-
from: "halo"
|
|
1962
|
-
}),
|
|
1963
|
-
onError: () => dispatch({
|
|
1964
|
-
type: "fail invitation",
|
|
1965
|
-
from: "halo"
|
|
1966
|
-
}),
|
|
1967
|
-
onSuccess: () => dispatch({
|
|
1968
|
-
type: "accepted invitation",
|
|
1969
|
-
from: "halo"
|
|
1970
|
-
}),
|
|
1971
|
-
onTimeout: () => dispatch({
|
|
1972
|
-
type: "timeout invitation",
|
|
1973
|
-
from: "halo"
|
|
1974
|
-
})
|
|
1975
|
-
});
|
|
1976
|
-
}, [
|
|
1977
|
-
joinState.haloInvitation
|
|
1978
|
-
]);
|
|
1979
|
-
return /* @__PURE__ */ React27.createElement(DensityProvider4, {
|
|
2036
|
+
return /* @__PURE__ */ React26.createElement(DensityProvider4, {
|
|
1980
2037
|
density: "fine"
|
|
1981
|
-
}, /* @__PURE__ */
|
|
2038
|
+
}, /* @__PURE__ */ React26.createElement(JoinHeading, _extends22({}, {
|
|
1982
2039
|
mode,
|
|
1983
2040
|
titleId,
|
|
1984
|
-
|
|
2041
|
+
joinState,
|
|
1985
2042
|
onExit,
|
|
1986
2043
|
exitActionParent,
|
|
1987
2044
|
preventExit
|
|
1988
|
-
})), /* @__PURE__ */
|
|
2045
|
+
})), /* @__PURE__ */ React26.createElement("div", {
|
|
1989
2046
|
role: "none",
|
|
1990
2047
|
className: "is-full overflow-hidden"
|
|
1991
|
-
}, /* @__PURE__ */
|
|
2048
|
+
}, /* @__PURE__ */ React26.createElement("div", {
|
|
1992
2049
|
role: "none",
|
|
1993
|
-
className: "flex is-[
|
|
2050
|
+
className: "flex is-[1200%]",
|
|
1994
2051
|
"aria-live": "polite"
|
|
1995
|
-
}, /* @__PURE__ */
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
active: joinState.
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2052
|
+
}, /* @__PURE__ */ React26.createElement(AdditionMethodSelector, _extends22({}, {
|
|
2053
|
+
joinState,
|
|
2054
|
+
joinSend,
|
|
2055
|
+
active: joinState.matches({
|
|
2056
|
+
choosingIdentity: "choosingAuthMethod"
|
|
2057
|
+
})
|
|
2058
|
+
})), /* @__PURE__ */ React26.createElement(IdentityInput, _extends22({}, {
|
|
2059
|
+
joinState,
|
|
2060
|
+
joinSend,
|
|
2061
|
+
active: joinState.matches({
|
|
2062
|
+
choosingIdentity: "creatingIdentity"
|
|
2063
|
+
}),
|
|
2006
2064
|
method: "create identity"
|
|
2007
|
-
})), /* @__PURE__ */
|
|
2008
|
-
|
|
2009
|
-
|
|
2065
|
+
})), /* @__PURE__ */ React26.createElement(IdentityInput, _extends22({}, {
|
|
2066
|
+
joinState,
|
|
2067
|
+
joinSend,
|
|
2068
|
+
active: joinState.matches({
|
|
2069
|
+
choosingIdentity: "recoveringIdentity"
|
|
2070
|
+
}),
|
|
2010
2071
|
method: "recover identity"
|
|
2011
|
-
})), /* @__PURE__ */
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
active: joinState.
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2072
|
+
})), /* @__PURE__ */ React26.createElement(InvitationInput, _extends22({}, {
|
|
2073
|
+
joinState,
|
|
2074
|
+
joinSend,
|
|
2075
|
+
active: joinState.matches({
|
|
2076
|
+
choosingIdentity: {
|
|
2077
|
+
acceptingHaloInvitation: "inputtingHaloInvitationCode"
|
|
2078
|
+
}
|
|
2079
|
+
}),
|
|
2080
|
+
Domain: "Halo"
|
|
2081
|
+
})), /* @__PURE__ */ React26.createElement(InvitationRescuer, _extends22({}, {
|
|
2082
|
+
joinState,
|
|
2083
|
+
joinSend,
|
|
2084
|
+
active: [
|
|
2085
|
+
{
|
|
2086
|
+
choosingIdentity: {
|
|
2087
|
+
acceptingHaloInvitation: {
|
|
2088
|
+
acceptingRedeemedHaloInvitation: "connectingHaloInvitation"
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
},
|
|
2092
|
+
{
|
|
2093
|
+
choosingIdentity: {
|
|
2094
|
+
acceptingHaloInvitation: {
|
|
2095
|
+
acceptingRedeemedHaloInvitation: "failingHaloInvitation"
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
].some(joinState.matches),
|
|
2100
|
+
Domain: "Halo"
|
|
2101
|
+
})), /* @__PURE__ */ React26.createElement(InvitationAuthenticator, _extends22({}, {
|
|
2102
|
+
joinState,
|
|
2103
|
+
joinSend,
|
|
2104
|
+
active: [
|
|
2105
|
+
{
|
|
2106
|
+
choosingIdentity: {
|
|
2107
|
+
acceptingHaloInvitation: {
|
|
2108
|
+
acceptingRedeemedHaloInvitation: "inputtingHaloVerificationCode"
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
},
|
|
2112
|
+
{
|
|
2113
|
+
choosingIdentity: {
|
|
2114
|
+
acceptingHaloInvitation: {
|
|
2115
|
+
acceptingRedeemedHaloInvitation: "authenticatingHaloVerificationCode"
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
},
|
|
2119
|
+
{
|
|
2120
|
+
choosingIdentity: {
|
|
2121
|
+
acceptingHaloInvitation: {
|
|
2122
|
+
acceptingRedeemedHaloInvitation: "authenticationFailingHaloVerificationCode"
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
].some(joinState.matches),
|
|
2127
|
+
Domain: "Halo",
|
|
2128
|
+
...joinState.matches({
|
|
2129
|
+
acceptingHaloInvitation: {
|
|
2130
|
+
acceptingRedeemedHaloInvitation: "authenticationFailingHaloVerificationCode"
|
|
2131
|
+
}
|
|
2132
|
+
}) && {
|
|
2027
2133
|
failed: true
|
|
2028
2134
|
}
|
|
2029
|
-
})), /* @__PURE__ */
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
active:
|
|
2033
|
-
|
|
2135
|
+
})), /* @__PURE__ */ React26.createElement(InvitationAccepted, _extends22({}, {
|
|
2136
|
+
joinState,
|
|
2137
|
+
joinSend,
|
|
2138
|
+
active: [
|
|
2139
|
+
{
|
|
2140
|
+
choosingIdentity: {
|
|
2141
|
+
acceptingHaloInvitation: {
|
|
2142
|
+
acceptingRedeemedHaloInvitation: "successHaloInvitation"
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
},
|
|
2146
|
+
"finishingJoiningHalo"
|
|
2147
|
+
].some(joinState.matches),
|
|
2148
|
+
Domain: "Halo",
|
|
2034
2149
|
doneActionParent,
|
|
2035
2150
|
onDone
|
|
2036
|
-
})), /* @__PURE__ */
|
|
2151
|
+
})), /* @__PURE__ */ React26.createElement(IdentityAdded, _extends22({}, {
|
|
2152
|
+
joinState,
|
|
2153
|
+
joinSend,
|
|
2037
2154
|
mode,
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2155
|
+
active: joinState.matches({
|
|
2156
|
+
choosingIdentity: "confirmingAddedIdentity"
|
|
2157
|
+
}),
|
|
2041
2158
|
doneActionParent,
|
|
2042
2159
|
onDone
|
|
2043
|
-
})), /* @__PURE__ */
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
active:
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2160
|
+
})), /* @__PURE__ */ React26.createElement(InvitationInput, _extends22({}, {
|
|
2161
|
+
joinState,
|
|
2162
|
+
joinSend,
|
|
2163
|
+
active: joinState.matches({
|
|
2164
|
+
acceptingSpaceInvitation: "inputtingSpaceInvitationCode"
|
|
2165
|
+
}),
|
|
2166
|
+
Domain: "Space"
|
|
2167
|
+
})), /* @__PURE__ */ React26.createElement(InvitationRescuer, _extends22({}, {
|
|
2168
|
+
joinState,
|
|
2169
|
+
joinSend,
|
|
2170
|
+
active: [
|
|
2171
|
+
{
|
|
2172
|
+
acceptingSpaceInvitation: {
|
|
2173
|
+
acceptingRedeemedSpaceInvitation: "connectingSpaceInvitation"
|
|
2174
|
+
}
|
|
2175
|
+
},
|
|
2176
|
+
{
|
|
2177
|
+
acceptingSpaceInvitation: {
|
|
2178
|
+
acceptingRedeemedSpaceInvitation: "failingSpaceInvitation"
|
|
2179
|
+
}
|
|
2180
|
+
}
|
|
2181
|
+
].some(joinState.matches),
|
|
2182
|
+
Domain: "Space"
|
|
2183
|
+
})), /* @__PURE__ */ React26.createElement(InvitationAuthenticator, _extends22({}, {
|
|
2184
|
+
joinState,
|
|
2185
|
+
joinSend,
|
|
2186
|
+
active: [
|
|
2187
|
+
{
|
|
2188
|
+
acceptingSpaceInvitation: {
|
|
2189
|
+
acceptingRedeemedSpaceInvitation: "inputtingSpaceVerificationCode"
|
|
2190
|
+
}
|
|
2191
|
+
},
|
|
2192
|
+
{
|
|
2193
|
+
acceptingSpaceInvitation: {
|
|
2194
|
+
acceptingRedeemedSpaceInvitation: "authenticatingSpaceVerificationCode"
|
|
2195
|
+
}
|
|
2196
|
+
},
|
|
2197
|
+
{
|
|
2198
|
+
acceptingSpaceInvitation: {
|
|
2199
|
+
acceptingRedeemedSpaceInvitation: "authenticationFailingSpaceVerificationCode"
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
].some(joinState.matches),
|
|
2203
|
+
Domain: "Space",
|
|
2204
|
+
...joinState.matches({
|
|
2205
|
+
acceptingSpaceInvitation: {
|
|
2206
|
+
acceptingRedeemedSpaceInvitation: "authenticationFailingSpaceVerificationCode"
|
|
2207
|
+
}
|
|
2208
|
+
}) && {
|
|
2062
2209
|
failed: true
|
|
2063
2210
|
}
|
|
2064
|
-
})), /* @__PURE__ */
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
invitationType: "space",
|
|
2211
|
+
})), /* @__PURE__ */ React26.createElement(InvitationAccepted, _extends22({}, {
|
|
2212
|
+
joinState,
|
|
2213
|
+
joinSend,
|
|
2214
|
+
active: joinState.matches("finishingJoiningSpace"),
|
|
2215
|
+
Domain: "Space",
|
|
2070
2216
|
doneActionParent,
|
|
2071
2217
|
onDone
|
|
2072
2218
|
})))));
|
|
2073
2219
|
};
|
|
2074
2220
|
|
|
2075
2221
|
// packages/apps/patterns/react-ui/src/panels/SpacePanel/SpacePanel.tsx
|
|
2076
|
-
import { UserPlus as
|
|
2077
|
-
import
|
|
2222
|
+
import { UserPlus as UserPlus2 } from "@phosphor-icons/react";
|
|
2223
|
+
import React27, { useReducer as useReducer2 } from "react";
|
|
2078
2224
|
import { useSpaceInvitations as useSpaceInvitations2, observer } from "@dxos/react-client";
|
|
2079
|
-
import { Button as
|
|
2080
|
-
function
|
|
2081
|
-
|
|
2225
|
+
import { Button as Button11, DensityProvider as DensityProvider5, getSize as getSize13, mx as mx20, useTranslation as useTranslation16 } from "@dxos/react-components";
|
|
2226
|
+
function _extends23() {
|
|
2227
|
+
_extends23 = Object.assign || function(target) {
|
|
2082
2228
|
for (var i = 1; i < arguments.length; i++) {
|
|
2083
2229
|
var source = arguments[i];
|
|
2084
2230
|
for (var key in source) {
|
|
@@ -2089,39 +2235,39 @@ function _extends24() {
|
|
|
2089
2235
|
}
|
|
2090
2236
|
return target;
|
|
2091
2237
|
};
|
|
2092
|
-
return
|
|
2238
|
+
return _extends23.apply(this, arguments);
|
|
2093
2239
|
}
|
|
2094
2240
|
var CurrentSpaceView = observer(({ space, createInvitationUrl, titleId }) => {
|
|
2095
|
-
const { t } =
|
|
2241
|
+
const { t } = useTranslation16("os");
|
|
2096
2242
|
const invitations = useSpaceInvitations2(space == null ? void 0 : space.key);
|
|
2097
2243
|
const name = space == null ? void 0 : space.properties.name;
|
|
2098
2244
|
if (!space) {
|
|
2099
2245
|
return null;
|
|
2100
2246
|
}
|
|
2101
|
-
return /* @__PURE__ */
|
|
2247
|
+
return /* @__PURE__ */ React27.createElement("div", {
|
|
2102
2248
|
role: "none",
|
|
2103
2249
|
className: "flex flex-col"
|
|
2104
|
-
}, /* @__PURE__ */
|
|
2250
|
+
}, /* @__PURE__ */ React27.createElement("div", {
|
|
2105
2251
|
role: "none",
|
|
2106
|
-
className:
|
|
2107
|
-
}, /* @__PURE__ */
|
|
2252
|
+
className: mx20(subduedSurface, "rounded-bs-md flex items-center p-2 gap-2")
|
|
2253
|
+
}, /* @__PURE__ */ React27.createElement("h2", {
|
|
2108
2254
|
id: titleId,
|
|
2109
|
-
className:
|
|
2110
|
-
}, name != null ? name : space.key.truncate())), /* @__PURE__ */
|
|
2255
|
+
className: mx20("grow font-system-medium", !name && "font-mono")
|
|
2256
|
+
}, name != null ? name : space.key.truncate())), /* @__PURE__ */ React27.createElement("div", {
|
|
2111
2257
|
role: "region",
|
|
2112
|
-
className:
|
|
2113
|
-
}, /* @__PURE__ */
|
|
2258
|
+
className: mx20(defaultSurface, "rounded-be-md p-2")
|
|
2259
|
+
}, /* @__PURE__ */ React27.createElement(InvitationList, {
|
|
2114
2260
|
invitations,
|
|
2115
2261
|
onClickRemove: ({ invitation }) => invitation && (space == null ? void 0 : space.removeInvitation(invitation.invitationId)),
|
|
2116
2262
|
createInvitationUrl
|
|
2117
|
-
}), /* @__PURE__ */
|
|
2263
|
+
}), /* @__PURE__ */ React27.createElement(Button11, {
|
|
2118
2264
|
className: "is-full flex gap-2 mbs-2",
|
|
2119
2265
|
onClick: () => space == null ? void 0 : space.createInvitation(),
|
|
2120
2266
|
"data-testid": "spaces-panel.create-invitation"
|
|
2121
|
-
}, /* @__PURE__ */
|
|
2122
|
-
className:
|
|
2267
|
+
}, /* @__PURE__ */ React27.createElement("span", null, t("create space invitation label")), /* @__PURE__ */ React27.createElement(UserPlus2, {
|
|
2268
|
+
className: getSize13(4),
|
|
2123
2269
|
weight: "bold"
|
|
2124
|
-
})), /* @__PURE__ */
|
|
2270
|
+
})), /* @__PURE__ */ React27.createElement(PanelSeparator, null), /* @__PURE__ */ React27.createElement(SpaceMemberListContainer, {
|
|
2125
2271
|
spaceKey: space.key,
|
|
2126
2272
|
includeSelf: true
|
|
2127
2273
|
})));
|
|
@@ -2136,17 +2282,17 @@ var SpacePanel = (props) => {
|
|
|
2136
2282
|
}
|
|
2137
2283
|
return nextState;
|
|
2138
2284
|
};
|
|
2139
|
-
const [panelState] =
|
|
2285
|
+
const [panelState] = useReducer2(reducer, {
|
|
2140
2286
|
activeView: "current space"
|
|
2141
2287
|
});
|
|
2142
|
-
return /* @__PURE__ */
|
|
2288
|
+
return /* @__PURE__ */ React27.createElement(DensityProvider5, {
|
|
2143
2289
|
density: "fine"
|
|
2144
|
-
}, panelState.activeView === "current space" ? /* @__PURE__ */
|
|
2290
|
+
}, panelState.activeView === "current space" ? /* @__PURE__ */ React27.createElement(CurrentSpaceView, _extends23({}, props)) : null);
|
|
2145
2291
|
};
|
|
2146
2292
|
|
|
2147
2293
|
// packages/apps/patterns/react-ui/src/composites/IdentityPopover/IdentityPopover.tsx
|
|
2148
|
-
function
|
|
2149
|
-
|
|
2294
|
+
function _extends24() {
|
|
2295
|
+
_extends24 = Object.assign || function(target) {
|
|
2150
2296
|
for (var i = 1; i < arguments.length; i++) {
|
|
2151
2297
|
var source = arguments[i];
|
|
2152
2298
|
for (var key in source) {
|
|
@@ -2157,12 +2303,12 @@ function _extends25() {
|
|
|
2157
2303
|
}
|
|
2158
2304
|
return target;
|
|
2159
2305
|
};
|
|
2160
|
-
return
|
|
2306
|
+
return _extends24.apply(this, arguments);
|
|
2161
2307
|
}
|
|
2162
2308
|
var IdentityPopover = ({ identity, openTrigger, slots, triggerIsInToolbar = true, onClickManageProfile, ...popoverProps }) => {
|
|
2163
2309
|
var _a, _b, _c;
|
|
2164
|
-
return /* @__PURE__ */
|
|
2165
|
-
openTrigger: openTrigger != null ? openTrigger : /* @__PURE__ */
|
|
2310
|
+
return /* @__PURE__ */ React28.createElement(PanelPopover, _extends24({}, popoverProps, {
|
|
2311
|
+
openTrigger: openTrigger != null ? openTrigger : /* @__PURE__ */ React28.createElement(Avatar5, {
|
|
2166
2312
|
size: 10,
|
|
2167
2313
|
variant: "circle",
|
|
2168
2314
|
fallbackValue: identity.identityKey.toHex(),
|
|
@@ -2172,11 +2318,11 @@ var IdentityPopover = ({ identity, openTrigger, slots, triggerIsInToolbar = true
|
|
|
2172
2318
|
...slots,
|
|
2173
2319
|
trigger: {
|
|
2174
2320
|
...slots == null ? void 0 : slots.trigger,
|
|
2175
|
-
className:
|
|
2321
|
+
className: mx21("flex justify-self-end pointer-events-auto bg-white dark:bg-neutral-700 p-0.5 button-elevation rounded-full", (_c = slots == null ? void 0 : slots.trigger) == null ? void 0 : _c.className)
|
|
2176
2322
|
}
|
|
2177
2323
|
},
|
|
2178
2324
|
triggerIsInToolbar
|
|
2179
|
-
}), /* @__PURE__ */
|
|
2325
|
+
}), /* @__PURE__ */ React28.createElement(IdentityPanel, _extends24({}, {
|
|
2180
2326
|
identity,
|
|
2181
2327
|
onClickManageProfile
|
|
2182
2328
|
})));
|
|
@@ -2184,10 +2330,10 @@ var IdentityPopover = ({ identity, openTrigger, slots, triggerIsInToolbar = true
|
|
|
2184
2330
|
|
|
2185
2331
|
// packages/apps/patterns/react-ui/src/composites/JoinDialog/JoinDialog.tsx
|
|
2186
2332
|
import { Action, Cancel } from "@radix-ui/react-alert-dialog";
|
|
2187
|
-
import
|
|
2333
|
+
import React29 from "react";
|
|
2188
2334
|
import { ThemeContext as ThemeContext2, useId as useId5 } from "@dxos/react-components";
|
|
2189
|
-
function
|
|
2190
|
-
|
|
2335
|
+
function _extends25() {
|
|
2336
|
+
_extends25 = Object.assign || function(target) {
|
|
2191
2337
|
for (var i = 1; i < arguments.length; i++) {
|
|
2192
2338
|
var source = arguments[i];
|
|
2193
2339
|
for (var key in source) {
|
|
@@ -2198,41 +2344,41 @@ function _extends26() {
|
|
|
2198
2344
|
}
|
|
2199
2345
|
return target;
|
|
2200
2346
|
};
|
|
2201
|
-
return
|
|
2347
|
+
return _extends25.apply(this, arguments);
|
|
2202
2348
|
}
|
|
2203
2349
|
var JoinDialog = ({ slots, ...joinPanelProps }) => {
|
|
2204
2350
|
const titleId = useId5("joinDialog__title");
|
|
2205
|
-
return /* @__PURE__ */
|
|
2351
|
+
return /* @__PURE__ */ React29.createElement(PanelAlertDialog, _extends25({}, {
|
|
2206
2352
|
slots,
|
|
2207
2353
|
titleId
|
|
2208
|
-
}), /* @__PURE__ */
|
|
2354
|
+
}), /* @__PURE__ */ React29.createElement(ThemeContext2.Provider, {
|
|
2209
2355
|
value: {
|
|
2210
2356
|
themeVariant: "os"
|
|
2211
2357
|
}
|
|
2212
|
-
}, /* @__PURE__ */
|
|
2358
|
+
}, /* @__PURE__ */ React29.createElement(JoinPanel, _extends25({}, {
|
|
2213
2359
|
...joinPanelProps,
|
|
2214
2360
|
titleId,
|
|
2215
|
-
exitActionParent: /* @__PURE__ */
|
|
2361
|
+
exitActionParent: /* @__PURE__ */ React29.createElement(Cancel, {
|
|
2216
2362
|
asChild: true
|
|
2217
2363
|
}),
|
|
2218
|
-
doneActionParent: /* @__PURE__ */
|
|
2364
|
+
doneActionParent: /* @__PURE__ */ React29.createElement(Action, {
|
|
2219
2365
|
asChild: true
|
|
2220
2366
|
})
|
|
2221
2367
|
}))));
|
|
2222
2368
|
};
|
|
2223
2369
|
|
|
2224
2370
|
// packages/apps/patterns/react-ui/src/composites/Shell/Shell.tsx
|
|
2225
|
-
import
|
|
2226
|
-
import { log as
|
|
2371
|
+
import React32, { useEffect as useEffect3, useState as useState5 } from "react";
|
|
2372
|
+
import { log as log3 } from "@dxos/log";
|
|
2227
2373
|
import { ShellDisplay, ShellLayout } from "@dxos/protocols/proto/dxos/iframe";
|
|
2228
|
-
import { useClient as
|
|
2374
|
+
import { useClient as useClient6, useSpace as useSpace3, useSpaces } from "@dxos/react-client";
|
|
2229
2375
|
|
|
2230
2376
|
// packages/apps/patterns/react-ui/src/composites/DevicesDialog/DevicesDialog.tsx
|
|
2231
2377
|
import { Close } from "@radix-ui/react-dialog";
|
|
2232
|
-
import
|
|
2378
|
+
import React30 from "react";
|
|
2233
2379
|
import { ThemeContext as ThemeContext3, useId as useId6 } from "@dxos/react-components";
|
|
2234
|
-
function
|
|
2235
|
-
|
|
2380
|
+
function _extends26() {
|
|
2381
|
+
_extends26 = Object.assign || function(target) {
|
|
2236
2382
|
for (var i = 1; i < arguments.length; i++) {
|
|
2237
2383
|
var source = arguments[i];
|
|
2238
2384
|
for (var key in source) {
|
|
@@ -2243,11 +2389,11 @@ function _extends27() {
|
|
|
2243
2389
|
}
|
|
2244
2390
|
return target;
|
|
2245
2391
|
};
|
|
2246
|
-
return
|
|
2392
|
+
return _extends26.apply(this, arguments);
|
|
2247
2393
|
}
|
|
2248
2394
|
var DevicesDialog = ({ slots, ...devicesDialogProps }) => {
|
|
2249
2395
|
const titleId = useId6("spaceDialog__title");
|
|
2250
|
-
return /* @__PURE__ */
|
|
2396
|
+
return /* @__PURE__ */ React30.createElement(PanelDialog, _extends26({}, {
|
|
2251
2397
|
slots: {
|
|
2252
2398
|
...slots,
|
|
2253
2399
|
root: {
|
|
@@ -2259,14 +2405,14 @@ var DevicesDialog = ({ slots, ...devicesDialogProps }) => {
|
|
|
2259
2405
|
}
|
|
2260
2406
|
},
|
|
2261
2407
|
titleId
|
|
2262
|
-
}), /* @__PURE__ */
|
|
2408
|
+
}), /* @__PURE__ */ React30.createElement(ThemeContext3.Provider, {
|
|
2263
2409
|
value: {
|
|
2264
2410
|
themeVariant: "os"
|
|
2265
2411
|
}
|
|
2266
|
-
}, /* @__PURE__ */
|
|
2412
|
+
}, /* @__PURE__ */ React30.createElement(DevicesPanel, _extends26({}, {
|
|
2267
2413
|
...devicesDialogProps,
|
|
2268
2414
|
titleId,
|
|
2269
|
-
doneActionParent: /* @__PURE__ */
|
|
2415
|
+
doneActionParent: /* @__PURE__ */ React30.createElement(Close, {
|
|
2270
2416
|
asChild: true
|
|
2271
2417
|
})
|
|
2272
2418
|
}))));
|
|
@@ -2274,10 +2420,10 @@ var DevicesDialog = ({ slots, ...devicesDialogProps }) => {
|
|
|
2274
2420
|
|
|
2275
2421
|
// packages/apps/patterns/react-ui/src/composites/SpaceDialog/SpaceDialog.tsx
|
|
2276
2422
|
import { Close as Close2 } from "@radix-ui/react-dialog";
|
|
2277
|
-
import
|
|
2423
|
+
import React31 from "react";
|
|
2278
2424
|
import { ThemeContext as ThemeContext4, useId as useId7 } from "@dxos/react-components";
|
|
2279
|
-
function
|
|
2280
|
-
|
|
2425
|
+
function _extends27() {
|
|
2426
|
+
_extends27 = Object.assign || function(target) {
|
|
2281
2427
|
for (var i = 1; i < arguments.length; i++) {
|
|
2282
2428
|
var source = arguments[i];
|
|
2283
2429
|
for (var key in source) {
|
|
@@ -2288,11 +2434,11 @@ function _extends28() {
|
|
|
2288
2434
|
}
|
|
2289
2435
|
return target;
|
|
2290
2436
|
};
|
|
2291
|
-
return
|
|
2437
|
+
return _extends27.apply(this, arguments);
|
|
2292
2438
|
}
|
|
2293
2439
|
var SpaceDialog = ({ slots, ...spacePanelProps }) => {
|
|
2294
2440
|
const titleId = useId7("spaceDialog__title");
|
|
2295
|
-
return /* @__PURE__ */
|
|
2441
|
+
return /* @__PURE__ */ React31.createElement(PanelDialog, _extends27({}, {
|
|
2296
2442
|
slots: {
|
|
2297
2443
|
...slots,
|
|
2298
2444
|
root: {
|
|
@@ -2304,14 +2450,14 @@ var SpaceDialog = ({ slots, ...spacePanelProps }) => {
|
|
|
2304
2450
|
}
|
|
2305
2451
|
},
|
|
2306
2452
|
titleId
|
|
2307
|
-
}), /* @__PURE__ */
|
|
2453
|
+
}), /* @__PURE__ */ React31.createElement(ThemeContext4.Provider, {
|
|
2308
2454
|
value: {
|
|
2309
2455
|
themeVariant: "os"
|
|
2310
2456
|
}
|
|
2311
|
-
}, /* @__PURE__ */
|
|
2457
|
+
}, /* @__PURE__ */ React31.createElement(SpacePanel, _extends27({}, {
|
|
2312
2458
|
...spacePanelProps,
|
|
2313
2459
|
titleId,
|
|
2314
|
-
doneActionParent: /* @__PURE__ */
|
|
2460
|
+
doneActionParent: /* @__PURE__ */ React31.createElement(Close2, {
|
|
2315
2461
|
asChild: true
|
|
2316
2462
|
})
|
|
2317
2463
|
}))));
|
|
@@ -2319,22 +2465,22 @@ var SpaceDialog = ({ slots, ...spacePanelProps }) => {
|
|
|
2319
2465
|
|
|
2320
2466
|
// packages/apps/patterns/react-ui/src/composites/Shell/Shell.tsx
|
|
2321
2467
|
var Shell = ({ runtime, origin }) => {
|
|
2322
|
-
const [{ layout, invitationCode, spaceKey }, setLayout] =
|
|
2468
|
+
const [{ layout, invitationCode, spaceKey }, setLayout] = useState5({
|
|
2323
2469
|
layout: runtime.layout,
|
|
2324
2470
|
invitationCode: runtime.invitationCode,
|
|
2325
2471
|
spaceKey: runtime.spaceKey
|
|
2326
2472
|
});
|
|
2327
|
-
const client =
|
|
2473
|
+
const client = useClient6();
|
|
2328
2474
|
const spaces = useSpaces();
|
|
2329
2475
|
const space = useSpace3(spaceKey);
|
|
2330
|
-
|
|
2476
|
+
useEffect3(() => {
|
|
2331
2477
|
return runtime.layoutUpdate.on((request) => setLayout(request));
|
|
2332
2478
|
}, [
|
|
2333
2479
|
runtime
|
|
2334
2480
|
]);
|
|
2335
|
-
|
|
2481
|
+
useEffect3(() => {
|
|
2336
2482
|
if (layout === ShellLayout.SPACE_INVITATIONS && !space) {
|
|
2337
|
-
|
|
2483
|
+
log3.warn("No space found for shell space invitations.", {}, {
|
|
2338
2484
|
file: "Shell.tsx",
|
|
2339
2485
|
line: 33,
|
|
2340
2486
|
scope: void 0,
|
|
@@ -2355,11 +2501,11 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2355
2501
|
]);
|
|
2356
2502
|
switch (layout) {
|
|
2357
2503
|
case ShellLayout.INITIALIZE_IDENTITY:
|
|
2358
|
-
return /* @__PURE__ */
|
|
2504
|
+
return /* @__PURE__ */ React32.createElement(JoinDialog, {
|
|
2359
2505
|
mode: "halo-only",
|
|
2360
2506
|
initialInvitationCode: invitationCode,
|
|
2361
2507
|
onDone: async () => {
|
|
2362
|
-
spaces.length > 0 || await client.
|
|
2508
|
+
spaces.length > 0 || await client.createSpace();
|
|
2363
2509
|
await runtime.setAppContext({
|
|
2364
2510
|
display: ShellDisplay.NONE
|
|
2365
2511
|
});
|
|
@@ -2367,7 +2513,7 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2367
2513
|
}
|
|
2368
2514
|
});
|
|
2369
2515
|
case ShellLayout.DEVICE_INVITATIONS:
|
|
2370
|
-
return /* @__PURE__ */
|
|
2516
|
+
return /* @__PURE__ */ React32.createElement(DevicesDialog, {
|
|
2371
2517
|
createInvitationUrl: (invitationCode2) => `${origin}?haloInvitationCode=${invitationCode2}`,
|
|
2372
2518
|
onDone: async () => {
|
|
2373
2519
|
await runtime.setAppContext({
|
|
@@ -2377,7 +2523,7 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2377
2523
|
}
|
|
2378
2524
|
});
|
|
2379
2525
|
case ShellLayout.SPACE_INVITATIONS:
|
|
2380
|
-
return space ? /* @__PURE__ */
|
|
2526
|
+
return space ? /* @__PURE__ */ React32.createElement(SpaceDialog, {
|
|
2381
2527
|
space,
|
|
2382
2528
|
createInvitationUrl: (invitationCode2) => `${origin}?spaceInvitationCode=${invitationCode2}`,
|
|
2383
2529
|
onDone: async () => {
|
|
@@ -2388,7 +2534,7 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2388
2534
|
}
|
|
2389
2535
|
}) : null;
|
|
2390
2536
|
case ShellLayout.JOIN_SPACE:
|
|
2391
|
-
return /* @__PURE__ */
|
|
2537
|
+
return /* @__PURE__ */ React32.createElement(JoinDialog, {
|
|
2392
2538
|
initialInvitationCode: invitationCode,
|
|
2393
2539
|
onDone: async (result) => {
|
|
2394
2540
|
var _a;
|
|
@@ -2411,14 +2557,14 @@ var Shell = ({ runtime, origin }) => {
|
|
|
2411
2557
|
};
|
|
2412
2558
|
|
|
2413
2559
|
// packages/apps/patterns/react-ui/src/composites/Shell/ShellContext.tsx
|
|
2414
|
-
import
|
|
2560
|
+
import React33, { createContext as createContext2, useCallback as useCallback6, useContext as useContext2, useEffect as useEffect4, useMemo as useMemo3, useState as useState6 } from "react";
|
|
2415
2561
|
import { IFrameClientServicesProxy, ShellDisplay as ShellDisplay2, ShellLayout as ShellLayout2 } from "@dxos/client";
|
|
2416
2562
|
import { MemoryShellRuntime } from "@dxos/client-services";
|
|
2417
|
-
import { useClient as
|
|
2418
|
-
import { mx as
|
|
2563
|
+
import { useClient as useClient7, useIdentity as useIdentity3 } from "@dxos/react-client";
|
|
2564
|
+
import { mx as mx22 } from "@dxos/react-components";
|
|
2419
2565
|
var ShellContext = /* @__PURE__ */ createContext2({});
|
|
2420
2566
|
var useShell = () => {
|
|
2421
|
-
const client =
|
|
2567
|
+
const client = useClient7();
|
|
2422
2568
|
const { runtime, setDisplay } = useContext2(ShellContext);
|
|
2423
2569
|
const setLayout = async (layout, options) => {
|
|
2424
2570
|
if (runtime) {
|
|
@@ -2438,21 +2584,21 @@ var useShell = () => {
|
|
|
2438
2584
|
};
|
|
2439
2585
|
};
|
|
2440
2586
|
var ShellProvider = ({ space, haloInvitationCode, spaceInvitationCode, onJoinedSpace, children }) => {
|
|
2441
|
-
|
|
2587
|
+
useEffect4(() => {
|
|
2442
2588
|
if (client.services instanceof IFrameClientServicesProxy && onJoinedSpace) {
|
|
2443
2589
|
return client.services.joinedSpace.on(onJoinedSpace);
|
|
2444
2590
|
}
|
|
2445
2591
|
}, []);
|
|
2446
|
-
|
|
2592
|
+
useEffect4(() => {
|
|
2447
2593
|
if (client.services instanceof IFrameClientServicesProxy) {
|
|
2448
2594
|
client.services.setSpaceProvider(() => space == null ? void 0 : space.key);
|
|
2449
2595
|
}
|
|
2450
2596
|
}, [
|
|
2451
2597
|
space
|
|
2452
2598
|
]);
|
|
2453
|
-
const client =
|
|
2599
|
+
const client = useClient7();
|
|
2454
2600
|
const identity = useIdentity3();
|
|
2455
|
-
const [display, setDisplay] =
|
|
2601
|
+
const [display, setDisplay] = useState6(!identity || spaceInvitationCode || haloInvitationCode ? ShellDisplay2.FULLSCREEN : ShellDisplay2.NONE);
|
|
2456
2602
|
const shellRuntime = useMemo3(() => {
|
|
2457
2603
|
if (client.config.get("runtime.app.env.DX_VAULT") === "true") {
|
|
2458
2604
|
return;
|
|
@@ -2491,7 +2637,7 @@ var ShellProvider = ({ space, haloInvitationCode, spaceInvitationCode, onJoinedS
|
|
|
2491
2637
|
space,
|
|
2492
2638
|
shellRuntime
|
|
2493
2639
|
]);
|
|
2494
|
-
|
|
2640
|
+
useEffect4(() => {
|
|
2495
2641
|
if (!shellRuntime) {
|
|
2496
2642
|
return;
|
|
2497
2643
|
}
|
|
@@ -2501,7 +2647,7 @@ var ShellProvider = ({ space, haloInvitationCode, spaceInvitationCode, onJoinedS
|
|
|
2501
2647
|
shellRuntime,
|
|
2502
2648
|
handleKeyDown
|
|
2503
2649
|
]);
|
|
2504
|
-
|
|
2650
|
+
useEffect4(() => {
|
|
2505
2651
|
if (!shellRuntime) {
|
|
2506
2652
|
return;
|
|
2507
2653
|
}
|
|
@@ -2512,12 +2658,12 @@ var ShellProvider = ({ space, haloInvitationCode, spaceInvitationCode, onJoinedS
|
|
|
2512
2658
|
}, [
|
|
2513
2659
|
shellRuntime
|
|
2514
2660
|
]);
|
|
2515
|
-
return /* @__PURE__ */
|
|
2516
|
-
className:
|
|
2517
|
-
}, /* @__PURE__ */
|
|
2661
|
+
return /* @__PURE__ */ React33.createElement(React33.Fragment, null, shellRuntime && /* @__PURE__ */ React33.createElement("div", {
|
|
2662
|
+
className: mx22(display === ShellDisplay2.NONE ? "hidden" : "")
|
|
2663
|
+
}, /* @__PURE__ */ React33.createElement(Shell, {
|
|
2518
2664
|
runtime: shellRuntime,
|
|
2519
2665
|
origin: window.location.origin
|
|
2520
|
-
})), /* @__PURE__ */
|
|
2666
|
+
})), /* @__PURE__ */ React33.createElement(ShellContext.Provider, {
|
|
2521
2667
|
value: {
|
|
2522
2668
|
runtime: shellRuntime,
|
|
2523
2669
|
setDisplay
|
|
@@ -2536,7 +2682,7 @@ var os = {
|
|
|
2536
2682
|
"sidebar label": "DXOS sidebar",
|
|
2537
2683
|
"copy invitation code label": "Copy",
|
|
2538
2684
|
"open share panel label": "Share",
|
|
2539
|
-
"joining heading": "
|
|
2685
|
+
"joining space heading": "Joining space",
|
|
2540
2686
|
"join space heading": "Join a space",
|
|
2541
2687
|
"halo heading": "Initialize device identity",
|
|
2542
2688
|
"exit label": "Exit",
|
|
@@ -2555,7 +2701,7 @@ var os = {
|
|
|
2555
2701
|
"join identity label": "Use an authed device",
|
|
2556
2702
|
"join identity description": "Add this device to an identity you\u2019re already logged into on another device.",
|
|
2557
2703
|
"deselect identity label": "Back to identities",
|
|
2558
|
-
"addition method selector title": "
|
|
2704
|
+
"addition method selector title": "An identity is required to continue",
|
|
2559
2705
|
"new identity input label": "Add a display name",
|
|
2560
2706
|
"recover identity input label": "Type or paste your seed phrase",
|
|
2561
2707
|
"failed to create identity message": "Failed to create an identity.",
|
|
@@ -2576,7 +2722,7 @@ var os = {
|
|
|
2576
2722
|
"cancel label": "Cancel",
|
|
2577
2723
|
"done label": "Done",
|
|
2578
2724
|
"reset label": "Start over",
|
|
2579
|
-
"auth code input label": "
|
|
2725
|
+
"auth code input label": "Enter the verification code",
|
|
2580
2726
|
"invitation input label": "Paste an invitation code or URL",
|
|
2581
2727
|
"create device invitation label": "Invite",
|
|
2582
2728
|
"create space invitation label": "Invite",
|
|
@@ -2590,7 +2736,9 @@ var os = {
|
|
|
2590
2736
|
"view space invitations label": "View space invitations",
|
|
2591
2737
|
"toggle sidebar label": "Open/close sidebar",
|
|
2592
2738
|
"open sidebar label": "Open sidebar",
|
|
2593
|
-
"close sidebar label": "Close sidebar"
|
|
2739
|
+
"close sidebar label": "Close sidebar",
|
|
2740
|
+
"welcome message": "Welcome",
|
|
2741
|
+
"selecting identity heading": "Selecting identity"
|
|
2594
2742
|
};
|
|
2595
2743
|
|
|
2596
2744
|
// packages/apps/patterns/react-ui/src/translations/index.ts
|