@dxos/shell 0.5.1-main.befa1bc → 0.5.1-main.c4f37e4

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 (49) hide show
  1. package/dist/bundle/shell.mjs +6996 -6965
  2. package/dist/bundle/shell.mjs.map +1 -1
  3. package/dist/bundle/shell.umd.js +63 -63
  4. package/dist/bundle/shell.umd.js.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/react.mjs +69 -26
  7. package/dist/lib/browser/react.mjs.map +3 -3
  8. package/dist/lib/browser/testing/index.mjs +3 -2
  9. package/dist/lib/browser/testing/index.mjs.map +3 -3
  10. package/dist/types/src/components/DeviceList/DeviceListItem.js +1 -1
  11. package/dist/types/src/components/DeviceList/DeviceListItem.js.map +1 -1
  12. package/dist/types/src/composites/Shell/Shell.d.ts +1 -2
  13. package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -1
  14. package/dist/types/src/composites/Shell/Shell.js +24 -4
  15. package/dist/types/src/composites/Shell/Shell.js.map +1 -1
  16. package/dist/types/src/composites/Shell/ShellContext.js +1 -1
  17. package/dist/types/src/composites/Shell/ShellContext.js.map +1 -1
  18. package/dist/types/src/composites/Shell/memory-shell-runtime.d.ts +10 -2
  19. package/dist/types/src/composites/Shell/memory-shell-runtime.d.ts.map +1 -1
  20. package/dist/types/src/composites/Shell/memory-shell-runtime.js +20 -1
  21. package/dist/types/src/composites/Shell/memory-shell-runtime.js.map +1 -1
  22. package/dist/types/src/composites/Shell/run-shell.js +1 -1
  23. package/dist/types/src/composites/Shell/run-shell.js.map +1 -1
  24. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts.map +1 -1
  25. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js +2 -18
  26. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js.map +1 -1
  27. package/dist/types/src/steps/ConfirmReset.js +1 -1
  28. package/dist/types/src/steps/ConfirmReset.js.map +1 -1
  29. package/dist/types/src/steps/InvitationManager.d.ts.map +1 -1
  30. package/dist/types/src/steps/InvitationManager.js +3 -0
  31. package/dist/types/src/steps/InvitationManager.js.map +1 -1
  32. package/dist/types/src/testing/shell-manager.d.ts.map +1 -1
  33. package/dist/types/src/testing/shell-manager.js +3 -2
  34. package/dist/types/src/testing/shell-manager.js.map +1 -1
  35. package/dist/types/src/translations/locales/en-US.d.ts +1 -0
  36. package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
  37. package/dist/types/src/translations/locales/en-US.js +10 -9
  38. package/dist/types/src/translations/locales/en-US.js.map +1 -1
  39. package/package.json +21 -21
  40. package/src/components/DeviceList/DeviceListItem.tsx +1 -1
  41. package/src/composites/Shell/Shell.tsx +36 -5
  42. package/src/composites/Shell/ShellContext.tsx +1 -1
  43. package/src/composites/Shell/memory-shell-runtime.ts +36 -2
  44. package/src/composites/Shell/run-shell.tsx +1 -1
  45. package/src/panels/SpacePanel/steps/SpaceManager.tsx +2 -18
  46. package/src/steps/ConfirmReset.tsx +1 -1
  47. package/src/steps/InvitationManager.tsx +3 -0
  48. package/src/testing/shell-manager.ts +4 -2
  49. package/src/translations/locales/en-US.ts +10 -9
@@ -582,11 +582,11 @@ var DeviceListItem = /* @__PURE__ */ forwardRef2(({ device, onClickAdd, onClickE
582
582
  DeviceType.AGENT_MANAGED
583
583
  ].includes(device.profile.type) ? /* @__PURE__ */ React9.createElement(Robot, iconProps) : device.profile.type === DeviceType.MOBILE ? /* @__PURE__ */ React9.createElement(DeviceMobile, iconProps) : /* @__PURE__ */ React9.createElement(Devices, iconProps) : /* @__PURE__ */ React9.createElement(Avatar3.Fallback, {
584
584
  text: fallbackValue.emoji
585
- })), isCurrent && /* @__PURE__ */ React9.createElement(Tag, {
586
- color: "primary"
587
- }, t("current device tag label")), /* @__PURE__ */ React9.createElement(Avatar3.Label, {
585
+ })), /* @__PURE__ */ React9.createElement(Avatar3.Label, {
588
586
  classNames: "flex-1 text-sm truncate"
589
- }, displayName), device.kind === DeviceKind.CURRENT && /* @__PURE__ */ React9.createElement(DropdownMenu2.Root, null, /* @__PURE__ */ React9.createElement(DropdownMenu2.Trigger, {
587
+ }, displayName), isCurrent && /* @__PURE__ */ React9.createElement(Tag, {
588
+ color: "primary"
589
+ }, t("current device tag label")), device.kind === DeviceKind.CURRENT && /* @__PURE__ */ React9.createElement(DropdownMenu2.Root, null, /* @__PURE__ */ React9.createElement(DropdownMenu2.Trigger, {
590
590
  asChild: true
591
591
  }, /* @__PURE__ */ React9.createElement(Button5, {
592
592
  variant: "ghost",
@@ -1524,6 +1524,9 @@ var InvitationManager = ({ invitationUrl, active, send, status, multiUse, authCo
1524
1524
  const showAuthCode = statusValue === 3;
1525
1525
  const emoji = hexToEmoji3(id);
1526
1526
  const activeView = useMemo2(() => {
1527
+ if (multiUse) {
1528
+ return "showing qr";
1529
+ }
1527
1530
  switch (true) {
1528
1531
  case statusValue === 5:
1529
1532
  case statusValue < 0:
@@ -1641,7 +1644,9 @@ var ConfirmResetImpl = ({ disabled, pending, validationMessage, onConfirm, onCan
1641
1644
  })),
1642
1645
  disabled,
1643
1646
  "data-testid": `${testIdAffix}.reset-identity-input`,
1644
- placeholder: confirmationValue,
1647
+ placeholder: t("confirmation placeholder", {
1648
+ confirmationValue
1649
+ }),
1645
1650
  onChange: ({ target: { value } }) => setInputValue(value)
1646
1651
  })), /* @__PURE__ */ React28.createElement(Actions, null, onCancel && /* @__PURE__ */ React28.createElement(Action, {
1647
1652
  disabled,
@@ -3505,8 +3510,8 @@ var SpaceManager = (props) => {
3505
3510
  icon: UsersThree,
3506
3511
  onClick: useCallback8(() => {
3507
3512
  const invitation = space.share?.({
3508
- type: Invitation7.Type.INTERACTIVE,
3509
- authMethod: Invitation7.AuthMethod.NONE,
3513
+ type: Invitation7.Type.DELEGATED,
3514
+ authMethod: Invitation7.AuthMethod.KNOWN_PUBLIC_KEY,
3510
3515
  multiUse: true,
3511
3516
  target
3512
3517
  });
@@ -3792,17 +3797,37 @@ var StatusDialog = () => {
3792
3797
 
3793
3798
  // packages/sdk/shell/src/composites/Shell/Shell.tsx
3794
3799
  var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/composites/Shell/Shell.tsx";
3795
- var Shell = ({ runtime, origin }) => {
3800
+ var Shell = ({ runtime }) => {
3796
3801
  const [{ layout, invitationCode, spaceKey, target }, setLayout] = useState13({
3797
3802
  layout: runtime.layout,
3798
3803
  invitationCode: runtime.invitationCode,
3799
3804
  spaceKey: runtime.spaceKey,
3800
3805
  target: runtime.target
3801
3806
  });
3807
+ const [{ invitationUrl, deviceInvitationParam, spaceInvitationParam }, setInvitationUrl] = useState13({
3808
+ invitationUrl: runtime.invitationUrl,
3809
+ deviceInvitationParam: runtime.deviceInvitationParam,
3810
+ spaceInvitationParam: runtime.spaceInvitationParam
3811
+ });
3802
3812
  const client = useClient7();
3803
3813
  const space = useSpace2(spaceKey);
3814
+ const createDeviceInvitationUrl = (invitationCode2) => {
3815
+ const baseUrl = new URL(invitationUrl);
3816
+ baseUrl.searchParams.set(deviceInvitationParam, invitationCode2);
3817
+ return baseUrl.toString();
3818
+ };
3819
+ const createSpaceInvitationUrl = (invitationCode2) => {
3820
+ const baseUrl = new URL(invitationUrl);
3821
+ baseUrl.searchParams.set(spaceInvitationParam, invitationCode2);
3822
+ return baseUrl.toString();
3823
+ };
3804
3824
  useEffect7(() => {
3805
- return runtime.layoutUpdate.on((request) => setLayout(request));
3825
+ const unsubscribeLayout = runtime.layoutUpdate.on((request) => setLayout(request));
3826
+ const unsubscribeInvitationUrl = runtime.invitationUrlUpdate.on((request) => setInvitationUrl(request));
3827
+ return () => {
3828
+ unsubscribeLayout();
3829
+ unsubscribeInvitationUrl();
3830
+ };
3806
3831
  }, [
3807
3832
  runtime
3808
3833
  ]);
@@ -3810,7 +3835,7 @@ var Shell = ({ runtime, origin }) => {
3810
3835
  if (layout === ShellLayout.SPACE && !space) {
3811
3836
  log14.warn("No space found for shell space invitations.", void 0, {
3812
3837
  F: __dxlog_file13,
3813
- L: 33,
3838
+ L: 64,
3814
3839
  S: void 0,
3815
3840
  C: (f, a) => f(...a)
3816
3841
  });
@@ -3854,7 +3879,7 @@ var Shell = ({ runtime, origin }) => {
3854
3879
  case ShellLayout.SHARE_IDENTITY:
3855
3880
  case ShellLayout.EDIT_PROFILE:
3856
3881
  return /* @__PURE__ */ React46.createElement(IdentityDialog, {
3857
- createInvitationUrl: (invitationCode2) => `${origin}?deviceInvitationCode=${invitationCode2}`,
3882
+ createInvitationUrl: createDeviceInvitationUrl,
3858
3883
  onResetStorage: async () => {
3859
3884
  runtime.setLayout({
3860
3885
  layout: ShellLayout.STATUS
@@ -3888,7 +3913,7 @@ var Shell = ({ runtime, origin }) => {
3888
3913
  return space ? /* @__PURE__ */ React46.createElement(SpaceDialog, {
3889
3914
  space,
3890
3915
  target,
3891
- createInvitationUrl: (invitationCode2) => `${origin}?spaceInvitationCode=${invitationCode2}`,
3916
+ createInvitationUrl: createSpaceInvitationUrl,
3892
3917
  onDone: async () => {
3893
3918
  await runtime.setAppContext({
3894
3919
  display: ShellDisplay.NONE
@@ -4014,21 +4039,22 @@ var os = {
4014
4039
  "auth code message": "Enter the following auth code on the joining device.",
4015
4040
  "display name input label": "Display name",
4016
4041
  "display name input placeholder": "Enter a display name",
4017
- "invite one label": "Invite one",
4042
+ "invite one label": "Single-use invitation",
4018
4043
  "invite one description": "Only one user may join.",
4019
- "invite one qr label": "Single-use",
4044
+ "invite one qr label": "Single-use invitation",
4020
4045
  "invite one list item label": "Active single-use invitation",
4021
- "invite many label": "Invite many",
4046
+ "invite many label": "Standing invitation",
4022
4047
  "invite many description": "Anyone with the link can join.",
4023
- "invite many qr label": "Multiple-use",
4024
- "invite many list item label": "Active multiple-use invitation",
4048
+ "invite many qr label": "Standing invitation",
4049
+ "invite many list item label": "Active standing invitation",
4025
4050
  "invite options label": "Change the active invite option.",
4026
4051
  "reset in progress label": "Resetting...",
4027
4052
  "confirm label": "Confirm",
4028
- "reset storage input label": "This will clear this device and all associated data. Type {{confirmationValue}} and confirm to continue.",
4029
- "join new identity input label": "In order to join an existing device, storage on this device must be cleared first. Type {{confirmationValue}} to continue.",
4053
+ "reset storage input label": "WARNING: This will delete all data on this device. Type {{confirmationValue}} to continue.",
4054
+ "join new identity input label": "WARNING: To join an existing device all data on this device will be deleted. Type {{confirmationValue}} to continue.",
4030
4055
  "failed to reset identity message": "Failed to reset identity.",
4031
- "confirmation value": "CONFIRM",
4056
+ "confirmation value": "RESET",
4057
+ "confirmation placeholder": "Enter {{confirmationValue}} to continue.",
4032
4058
  "sign out chooser title": "Danger zone",
4033
4059
  "sign out chooser message": "Proceeding with the action below will erase all data on this device.",
4034
4060
  "join new identity label": "Join a new identity",
@@ -4038,7 +4064,7 @@ var os = {
4038
4064
  "clear label": "Use default",
4039
4065
  "select emoji label": "Choose an emoji to use in your avatar",
4040
4066
  "select hue label": "Choose a hue to use in your avatar",
4041
- "resetting message": "One moment while things are reset\u2026",
4067
+ "resetting message": "One moment while the device is reset\u2026",
4042
4068
  "red label": "Red",
4043
4069
  "orange label": "Orange",
4044
4070
  "amber label": "Amber",
@@ -4102,8 +4128,7 @@ var runShell = async (config = new Config()) => {
4102
4128
  status: SystemStatus.ACTIVE
4103
4129
  }
4104
4130
  }, /* @__PURE__ */ React47.createElement(ClipboardProvider, null, /* @__PURE__ */ React47.createElement(Tooltip7.Provider, null, /* @__PURE__ */ React47.createElement(AgentHostingProvider, null, /* @__PURE__ */ React47.createElement(Shell, {
4105
- runtime,
4106
- origin: location.origin
4131
+ runtime
4107
4132
  }))))))));
4108
4133
  } catch {
4109
4134
  createRoot(document.getElementById("root")).render(/* @__PURE__ */ React47.createElement(StrictMode, null, /* @__PURE__ */ React47.createElement(ThemeProvider, {
@@ -4142,12 +4167,16 @@ import { mx as mx25 } from "@dxos/react-ui-theme";
4142
4167
  import { Event } from "@dxos/async";
4143
4168
  import { ShellLayout as ShellLayout2 } from "@dxos/react-client";
4144
4169
  var MemoryShellRuntime = class {
4145
- constructor({ layout, invitationCode, spaceKey } = {}) {
4170
+ constructor({ layout, invitationCode, spaceKey, invitationUrl, deviceInvitationParam, spaceInvitationParam } = {}) {
4146
4171
  this.layoutUpdate = new Event();
4172
+ this.invitationUrlUpdate = new Event();
4147
4173
  this.contextUpdate = new Event();
4148
4174
  this._layout = layout ?? ShellLayout2.DEFAULT;
4149
4175
  this._invitationCode = invitationCode;
4150
4176
  this._spaceKey = spaceKey;
4177
+ this._invitationUrl = invitationUrl ?? window.location.origin;
4178
+ this._deviceInvitationParam = deviceInvitationParam ?? "deviceInvitationCode";
4179
+ this._spaceInvitationParam = spaceInvitationParam ?? "spaceInvitationCode";
4151
4180
  }
4152
4181
  get layout() {
4153
4182
  return this._layout;
@@ -4158,12 +4187,27 @@ var MemoryShellRuntime = class {
4158
4187
  get spaceKey() {
4159
4188
  return this._spaceKey;
4160
4189
  }
4190
+ get invitationUrl() {
4191
+ return this._invitationUrl;
4192
+ }
4193
+ get deviceInvitationParam() {
4194
+ return this._deviceInvitationParam;
4195
+ }
4196
+ get spaceInvitationParam() {
4197
+ return this._spaceInvitationParam;
4198
+ }
4161
4199
  setLayout(request) {
4162
4200
  this._layout = request.layout;
4163
4201
  this._invitationCode = request.invitationCode;
4164
4202
  this._spaceKey = request.spaceKey;
4165
4203
  this.layoutUpdate.emit(request);
4166
4204
  }
4205
+ setInvitationUrl(request) {
4206
+ this._invitationUrl = request.invitationUrl;
4207
+ this._deviceInvitationParam = request.deviceInvitationParam;
4208
+ this._spaceInvitationParam = request.spaceInvitationParam;
4209
+ this.invitationUrlUpdate.emit(request);
4210
+ }
4167
4211
  async setAppContext(context) {
4168
4212
  this.contextUpdate.emit(context);
4169
4213
  }
@@ -4268,8 +4312,7 @@ var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoine
4268
4312
  return /* @__PURE__ */ React48.createElement(React48.Fragment, null, shellRuntime && /* @__PURE__ */ React48.createElement("div", {
4269
4313
  className: mx25(display === ShellDisplay3.NONE ? "hidden" : "")
4270
4314
  }, /* @__PURE__ */ React48.createElement(Shell, {
4271
- runtime: shellRuntime,
4272
- origin: window.location.origin
4315
+ runtime: shellRuntime
4273
4316
  })), /* @__PURE__ */ React48.createElement(ShellContext.Provider, {
4274
4317
  value: {
4275
4318
  runtime: shellRuntime,