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