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