@dxos/shell 0.3.11-main.d56f337 → 0.3.11-main.d8b8a39

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 (56) hide show
  1. package/dist/bundle/shell.mjs +5756 -5654
  2. package/dist/bundle/shell.mjs.map +1 -1
  3. package/dist/bundle/shell.umd.js +58 -58
  4. package/dist/bundle/shell.umd.js.map +1 -1
  5. package/dist/bundle/style.css +1 -1
  6. package/dist/lib/browser/meta.json +1 -1
  7. package/dist/lib/browser/react.mjs +55 -43
  8. package/dist/lib/browser/react.mjs.map +3 -3
  9. package/dist/lib/browser/testing/index.mjs +35 -14
  10. package/dist/lib/browser/testing/index.mjs.map +3 -3
  11. package/dist/types/src/components/IdentityList/SpaceMemberList.js +1 -1
  12. package/dist/types/src/components/IdentityList/SpaceMemberList.js.map +1 -1
  13. package/dist/types/src/components/Panel/Action.d.ts.map +1 -1
  14. package/dist/types/src/components/Panel/Action.js +3 -18
  15. package/dist/types/src/components/Panel/Action.js.map +1 -1
  16. package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +1 -1
  17. package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -1
  18. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts.map +1 -1
  19. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +1 -1
  20. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -1
  21. package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.js +2 -2
  22. package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.js.map +1 -1
  23. package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +1 -1
  24. package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -1
  25. package/dist/types/src/panels/JoinPanel/joinMachine.js +14 -17
  26. package/dist/types/src/panels/JoinPanel/joinMachine.js.map +1 -1
  27. package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.js +3 -3
  28. package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.js.map +1 -1
  29. package/dist/types/src/panels/JoinPanel/steps/InvitationInput.d.ts.map +1 -1
  30. package/dist/types/src/panels/JoinPanel/steps/InvitationInput.js +13 -6
  31. package/dist/types/src/panels/JoinPanel/steps/InvitationInput.js.map +1 -1
  32. package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.js +1 -1
  33. package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.js.map +1 -1
  34. package/dist/types/src/playwright/invitations-manager.d.ts +1 -0
  35. package/dist/types/src/playwright/invitations-manager.d.ts.map +1 -1
  36. package/dist/types/src/playwright/invitations-manager.js +4 -1
  37. package/dist/types/src/playwright/invitations-manager.js.map +1 -1
  38. package/dist/types/src/playwright/invitations.spec.js +15 -0
  39. package/dist/types/src/playwright/invitations.spec.js.map +1 -1
  40. package/dist/types/src/testing/shell-manager.d.ts +5 -4
  41. package/dist/types/src/testing/shell-manager.d.ts.map +1 -1
  42. package/dist/types/src/testing/shell-manager.js +36 -12
  43. package/dist/types/src/testing/shell-manager.js.map +1 -1
  44. package/package.json +18 -18
  45. package/src/components/IdentityList/SpaceMemberList.tsx +1 -1
  46. package/src/components/Panel/Action.tsx +4 -19
  47. package/src/panels/IdentityPanel/IdentityPanel.tsx +1 -1
  48. package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +5 -1
  49. package/src/panels/IdentityPanel/steps/SignOutChooser.tsx +2 -0
  50. package/src/panels/JoinPanel/joinMachine.ts +15 -18
  51. package/src/panels/JoinPanel/steps/AdditionMethodChooser.tsx +3 -3
  52. package/src/panels/JoinPanel/steps/InvitationInput.tsx +7 -1
  53. package/src/panels/JoinPanel/steps/ResetIdentity.tsx +1 -1
  54. package/src/playwright/invitations-manager.ts +5 -1
  55. package/src/playwright/invitations.spec.ts +19 -0
  56. package/src/testing/shell-manager.ts +40 -13
@@ -220,7 +220,8 @@ var SpaceMemberListImpl = ({ members, onSelect }) => {
220
220
  const { t } = useTranslation3("os");
221
221
  const visibleMembers = members.filter((member) => member.identity);
222
222
  return visibleMembers.length > 0 ? /* @__PURE__ */ React6.createElement(List2, {
223
- classNames: "flex flex-col gap-2"
223
+ classNames: "flex flex-col gap-2",
224
+ "data-testid": "space-members-list"
224
225
  }, visibleMembers.map((member) => {
225
226
  return /* @__PURE__ */ React6.createElement(IdentityListItem, {
226
227
  key: member.identity.identityKey.toHex(),
@@ -521,12 +522,6 @@ import { useControllableState } from "@radix-ui/react-use-controllable-state";
521
522
  import React11, { forwardRef as forwardRef2 } from "react";
522
523
  import { Button as Button3, DropdownMenu, useTranslation as useTranslation5 } from "@dxos/react-ui";
523
524
  import { descriptionText as descriptionText4, getSize as getSize3, mx as mx9 } from "@dxos/react-ui-theme";
524
- var buttonColorFragment = (props) => {
525
- const resolvedVariant = props.variant ?? "default";
526
- return [
527
- !props.disabled ? resolvedVariant === "default" ? "bg-neutral-25 hover:bg-white hover:text-primary-500 active:bg-neutral-25 dark:active:bg-neutral-800" : resolvedVariant === "ghost" ? "active:bg-neutral-125 dark:active:bg-neutral-800" : resolvedVariant === "primary" ? "active:bg-primary-700 dark:active:bg-primary-500" : "" : ""
528
- ];
529
- };
530
525
  var defaultActions = {
531
526
  noopAction: {
532
527
  label: "No-op",
@@ -552,8 +547,7 @@ var BifurcatedAction = /* @__PURE__ */ forwardRef2((props, forwardedRef) => {
552
547
  ...rest,
553
548
  classNames: [
554
549
  "bs-11 flex-1 min-is-0 flex gap-2 rounded-ie-none",
555
- classNames,
556
- ...buttonColorFragment(props)
550
+ classNames
557
551
  ],
558
552
  ref: forwardedRef,
559
553
  variant,
@@ -563,8 +557,7 @@ var BifurcatedAction = /* @__PURE__ */ forwardRef2((props, forwardedRef) => {
563
557
  }, /* @__PURE__ */ React11.createElement(Button3, {
564
558
  classNames: [
565
559
  "bs-11 flex-none rounded-is-none",
566
- classNames,
567
- ...buttonColorFragment(props)
560
+ classNames
568
561
  ]
569
562
  }, /* @__PURE__ */ React11.createElement("span", {
570
563
  className: "sr-only"
@@ -598,7 +591,6 @@ var Action = /* @__PURE__ */ forwardRef2((props, forwardedRef) => {
598
591
  classNames: [
599
592
  isFull && "is-full",
600
593
  "bs-11 flex gap-2 mbs-2",
601
- ...buttonColorFragment(props),
602
594
  classNames
603
595
  ],
604
596
  ref: forwardedRef,
@@ -1107,7 +1099,7 @@ var IdentityActionChooserImpl = ({ onCreateInvitationClick, active, send, onDone
1107
1099
  weight: "bold",
1108
1100
  className: getSize6(4)
1109
1101
  })), /* @__PURE__ */ React23.createElement(Action, {
1110
- "data-testid": "sign-out",
1102
+ "data-testid": "devices-panel.sign-out",
1111
1103
  onClick: () => send?.({
1112
1104
  type: "chooseSignOut"
1113
1105
  }),
@@ -1219,11 +1211,13 @@ var SignOutChooserImpl = ({ disabled, onResetDevice, onJoinNewIdentity, onBack }
1219
1211
  onClick: onBack
1220
1212
  }, t("back label")), /* @__PURE__ */ React25.createElement(Action, {
1221
1213
  variant: "primary",
1214
+ "data-testid": "sign-out.join-new-identity",
1222
1215
  classNames: "!bg-error-500 hover:!bg-error-550",
1223
1216
  disabled,
1224
1217
  onClick: onJoinNewIdentity
1225
1218
  }, t("join new identity label")), /* @__PURE__ */ React25.createElement(Action, {
1226
1219
  variant: "primary",
1220
+ "data-testid": "sign-out.reset-device",
1227
1221
  classNames: "!bg-error-500 hover:!bg-error-550",
1228
1222
  disabled,
1229
1223
  onClick: onResetDevice
@@ -1426,7 +1420,8 @@ var IdentityHeading = ({ titleId, title, identity, onDone }) => {
1426
1420
  }, /* @__PURE__ */ React27.createElement(Avatar4.Fallback, {
1427
1421
  href: fallbackHref
1428
1422
  })), /* @__PURE__ */ React27.createElement(Avatar4.Label, {
1429
- classNames: "block text-center font-light text-xl"
1423
+ classNames: "block text-center font-light text-xl",
1424
+ "data-testid": "identityHeading.displayName"
1430
1425
  }, identity.profile?.displayName ?? generateName2(identity.identityKey.toHex()))));
1431
1426
  };
1432
1427
  var IdentityPanelImpl = (props) => {
@@ -1636,6 +1631,7 @@ import { useMachine as useMachine2 } from "@xstate/react";
1636
1631
  import { useCallback as useCallback6 } from "react";
1637
1632
  import { assign as assign2, createMachine as createMachine2 } from "xstate";
1638
1633
  import { log as log4 } from "@dxos/log";
1634
+ import { AlreadyJoinedError } from "@dxos/react-client";
1639
1635
  import { Invitation as Invitation6, InvitationEncoder as InvitationEncoder3 } from "@dxos/react-client/invitations";
1640
1636
  var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/JoinPanel/joinMachine.ts";
1641
1637
  var getInvitationSubscribable = (Kind, invitation) => {
@@ -1754,12 +1750,28 @@ var getInvitationSubscribable = (Kind, invitation) => {
1754
1750
  }
1755
1751
  }
1756
1752
  }, (error) => {
1753
+ if (error instanceof AlreadyJoinedError) {
1754
+ log4("[already joined]", {
1755
+ Kind,
1756
+ error
1757
+ }, {
1758
+ F: __dxlog_file5,
1759
+ L: 137,
1760
+ S: void 0,
1761
+ C: (f, a) => f(...a)
1762
+ });
1763
+ next({
1764
+ type: `success${Kind}Invitation`,
1765
+ invitation: invitation.get()
1766
+ });
1767
+ return complete?.();
1768
+ }
1757
1769
  log4.error("[invitation errored]", {
1758
1770
  Kind,
1759
1771
  error
1760
1772
  }, {
1761
1773
  F: __dxlog_file5,
1762
- L: 136,
1774
+ L: 142,
1763
1775
  S: void 0,
1764
1776
  C: (f, a) => f(...a)
1765
1777
  });
@@ -2084,7 +2096,7 @@ var joinMachine = createMachine2({
2084
2096
  spaceInvitation: context.space.invitation
2085
2097
  }, {
2086
2098
  F: __dxlog_file5,
2087
- L: 400,
2099
+ L: 406,
2088
2100
  S: void 0,
2089
2101
  C: (f, a) => f(...a)
2090
2102
  });
@@ -2098,7 +2110,7 @@ var defaultCodeFromUrl = (invitationType, text) => {
2098
2110
  } catch (err) {
2099
2111
  log4.catch(err, void 0, {
2100
2112
  F: __dxlog_file5,
2101
- L: 427,
2113
+ L: 433,
2102
2114
  S: void 0,
2103
2115
  C: (f, a) => f(...a)
2104
2116
  });
@@ -2109,7 +2121,8 @@ var useJoinMachine = (client, options) => {
2109
2121
  const redeemHaloInvitationCode = useCallback6(({ halo }) => {
2110
2122
  if (halo.unredeemedCode) {
2111
2123
  try {
2112
- const invitationObservable = client.halo.join(InvitationEncoder3.decode(defaultCodeFromUrl("halo", halo.unredeemedCode)));
2124
+ const invitation = InvitationEncoder3.decode(defaultCodeFromUrl("halo", halo.unredeemedCode));
2125
+ const invitationObservable = client.halo.join(invitation);
2113
2126
  return {
2114
2127
  ...halo,
2115
2128
  invitationObservable,
@@ -2118,7 +2131,7 @@ var useJoinMachine = (client, options) => {
2118
2131
  } catch (err) {
2119
2132
  log4.error("Could not redeem device invitation code", err, {
2120
2133
  F: __dxlog_file5,
2121
- L: 449,
2134
+ L: 454,
2122
2135
  S: void 0,
2123
2136
  C: (f, a) => f(...a)
2124
2137
  });
@@ -2134,23 +2147,16 @@ var useJoinMachine = (client, options) => {
2134
2147
  if (space.unredeemedCode) {
2135
2148
  try {
2136
2149
  const invitation = InvitationEncoder3.decode(defaultCodeFromUrl("space", space.unredeemedCode));
2137
- if (space.succeededKeys?.has(invitation.spaceKey?.toHex() ?? "never")) {
2138
- return {
2139
- ...space,
2140
- invitation
2141
- };
2142
- } else {
2143
- const invitationObservable = client.spaces.join(invitation);
2144
- return {
2145
- ...space,
2146
- invitationObservable,
2147
- invitationSubscribable: getInvitationSubscribable("Space", invitationObservable)
2148
- };
2149
- }
2150
+ const invitationObservable = client.spaces.join(invitation);
2151
+ return {
2152
+ ...space,
2153
+ invitationObservable,
2154
+ invitationSubscribable: getInvitationSubscribable("Space", invitationObservable)
2155
+ };
2150
2156
  } catch (err) {
2151
2157
  log4.error("Could not redeem space invitation code", err, {
2152
2158
  F: __dxlog_file5,
2153
- L: 479,
2159
+ L: 476,
2154
2160
  S: void 0,
2155
2161
  C: (f, a) => f(...a)
2156
2162
  });
@@ -2242,7 +2248,7 @@ var AdditionMethodChooser = (viewStateProps) => {
2242
2248
  type: "createIdentity"
2243
2249
  }),
2244
2250
  "data-autofocus": "choosingAuthMethod",
2245
- "data-testid": "create-identity"
2251
+ "data-testid": "identity-chooser.create-identity"
2246
2252
  }, t("create identity label")), /* @__PURE__ */ React29.createElement(CompoundButton, {
2247
2253
  ...sharedButtonProps,
2248
2254
  description: t("join identity description"),
@@ -2252,7 +2258,7 @@ var AdditionMethodChooser = (viewStateProps) => {
2252
2258
  onClick: () => send({
2253
2259
  type: "acceptHaloInvitation"
2254
2260
  }),
2255
- "data-testid": "join-identity"
2261
+ "data-testid": "identity-chooser.join-identity"
2256
2262
  }, t("join identity label")), /* @__PURE__ */ React29.createElement(CompoundButton, {
2257
2263
  ...sharedButtonProps,
2258
2264
  // TODO(mykola): Implement recover.
@@ -2264,7 +2270,7 @@ var AdditionMethodChooser = (viewStateProps) => {
2264
2270
  onClick: () => send({
2265
2271
  type: "recoverIdentity"
2266
2272
  }),
2267
- "data-testid": "recover-identity"
2273
+ "data-testid": "identity-chooser.recover-identity"
2268
2274
  }, t("recover identity label"))));
2269
2275
  };
2270
2276
 
@@ -2429,13 +2435,18 @@ var InvitationInput = (props) => {
2429
2435
  }, [
2430
2436
  unredeemedCode
2431
2437
  ]);
2432
- const handleNext = () => send({
2433
- type: `set${Kind}InvitationCode`,
2434
- code: invitationCodeFromUrl(inputValue),
2435
- ...Kind === "Space" && {
2436
- succeededKeys
2438
+ const handleNext = () => {
2439
+ if (inputValue.trim().length === 0) {
2440
+ return;
2437
2441
  }
2438
- });
2442
+ send({
2443
+ type: `set${Kind}InvitationCode`,
2444
+ code: invitationCodeFromUrl(inputValue),
2445
+ ...Kind === "Space" && {
2446
+ succeededKeys
2447
+ }
2448
+ });
2449
+ };
2439
2450
  const exitAction = /* @__PURE__ */ React33.createElement(Action, {
2440
2451
  variant: "ghost",
2441
2452
  disabled,
@@ -2451,6 +2462,7 @@ var InvitationInput = (props) => {
2451
2462
  className: "grow flex flex-col justify-center"
2452
2463
  }, /* @__PURE__ */ React33.createElement(Input, {
2453
2464
  label: /* @__PURE__ */ React33.createElement(StepHeading, null, t("invitation input label")),
2465
+ // TODO(burdon): Translation.
2454
2466
  placeholder: "Type an invitation code",
2455
2467
  disabled,
2456
2468
  value: inputValue,
@@ -2628,7 +2640,7 @@ var ResetIdentityImpl = ({ disabled, validationMessage, onConfirm }) => {
2628
2640
  confirmationValue
2629
2641
  })),
2630
2642
  disabled,
2631
- "data-testid": "identity-input",
2643
+ "data-testid": "reset-identity-input",
2632
2644
  placeholder: confirmationValue,
2633
2645
  onChange: ({ target: { value } }) => setInputValue(value)
2634
2646
  })), /* @__PURE__ */ React36.createElement(Actions, null, /* @__PURE__ */ React36.createElement(Action, {