@dxos/shell 0.5.1-next.260c093 → 0.5.1-next.39e0ee2

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 (38) hide show
  1. package/dist/bundle/shell.mjs +1101 -1100
  2. package/dist/bundle/shell.mjs.map +1 -1
  3. package/dist/bundle/shell.umd.js +29 -29
  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 +59 -19
  7. package/dist/lib/browser/react.mjs.map +3 -3
  8. package/dist/types/src/composites/Shell/Shell.d.ts +1 -2
  9. package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -1
  10. package/dist/types/src/composites/Shell/Shell.js +24 -4
  11. package/dist/types/src/composites/Shell/Shell.js.map +1 -1
  12. package/dist/types/src/composites/Shell/ShellContext.js +1 -1
  13. package/dist/types/src/composites/Shell/ShellContext.js.map +1 -1
  14. package/dist/types/src/composites/Shell/memory-shell-runtime.d.ts +10 -2
  15. package/dist/types/src/composites/Shell/memory-shell-runtime.d.ts.map +1 -1
  16. package/dist/types/src/composites/Shell/memory-shell-runtime.js +20 -1
  17. package/dist/types/src/composites/Shell/memory-shell-runtime.js.map +1 -1
  18. package/dist/types/src/composites/Shell/run-shell.js +1 -1
  19. package/dist/types/src/composites/Shell/run-shell.js.map +1 -1
  20. package/dist/types/src/panels/JoinPanel/JoinPanel.js +2 -2
  21. package/dist/types/src/panels/JoinPanel/JoinPanel.js.map +1 -1
  22. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts.map +1 -1
  23. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js +2 -18
  24. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js.map +1 -1
  25. package/dist/types/src/steps/InvitationManager.d.ts.map +1 -1
  26. package/dist/types/src/steps/InvitationManager.js +3 -0
  27. package/dist/types/src/steps/InvitationManager.js.map +1 -1
  28. package/dist/types/src/translations/locales/en-US.js +5 -5
  29. package/dist/types/src/translations/locales/en-US.js.map +1 -1
  30. package/package.json +21 -21
  31. package/src/composites/Shell/Shell.tsx +36 -5
  32. package/src/composites/Shell/ShellContext.tsx +1 -1
  33. package/src/composites/Shell/memory-shell-runtime.ts +36 -2
  34. package/src/composites/Shell/run-shell.tsx +1 -1
  35. package/src/panels/JoinPanel/JoinPanel.tsx +2 -2
  36. package/src/panels/SpacePanel/steps/SpaceManager.tsx +2 -18
  37. package/src/steps/InvitationManager.tsx +3 -0
  38. package/src/translations/locales/en-US.ts +5 -5
@@ -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:
@@ -2983,7 +2986,7 @@ var JoinPanelImpl = (props) => {
2983
2986
  id: "reset storage confirmation"
2984
2987
  }, /* @__PURE__ */ React38.createElement(ConfirmResetComponent, {
2985
2988
  send,
2986
- active: activeView === "reset identity confirmation",
2989
+ active: activeView === "reset storage confirmation",
2987
2990
  onCancel: onCancelResetStorage,
2988
2991
  onConfirm: onConfirmResetStorage
2989
2992
  })), /* @__PURE__ */ React38.createElement(Viewport.View, {
@@ -3150,7 +3153,7 @@ var JoinPanel = ({ titleId: propsTitleId, mode = "default", initialDisposition =
3150
3153
  }):
3151
3154
  return "addition method chooser";
3152
3155
  case joinState.matches("resettingIdentity"):
3153
- return "reset identity confirmation";
3156
+ return "reset storage confirmation";
3154
3157
  case joinState.matches({
3155
3158
  choosingIdentity: "creatingIdentity"
3156
3159
  }):
@@ -3505,8 +3508,8 @@ var SpaceManager = (props) => {
3505
3508
  icon: UsersThree,
3506
3509
  onClick: useCallback8(() => {
3507
3510
  const invitation = space.share?.({
3508
- type: Invitation7.Type.INTERACTIVE,
3509
- authMethod: Invitation7.AuthMethod.NONE,
3511
+ type: Invitation7.Type.DELEGATED,
3512
+ authMethod: Invitation7.AuthMethod.KNOWN_PUBLIC_KEY,
3510
3513
  multiUse: true,
3511
3514
  target
3512
3515
  });
@@ -3792,17 +3795,37 @@ var StatusDialog = () => {
3792
3795
 
3793
3796
  // packages/sdk/shell/src/composites/Shell/Shell.tsx
3794
3797
  var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/composites/Shell/Shell.tsx";
3795
- var Shell = ({ runtime, origin }) => {
3798
+ var Shell = ({ runtime }) => {
3796
3799
  const [{ layout, invitationCode, spaceKey, target }, setLayout] = useState13({
3797
3800
  layout: runtime.layout,
3798
3801
  invitationCode: runtime.invitationCode,
3799
3802
  spaceKey: runtime.spaceKey,
3800
3803
  target: runtime.target
3801
3804
  });
3805
+ const [{ invitationUrl, deviceInvitationParam, spaceInvitationParam }, setInvitationUrl] = useState13({
3806
+ invitationUrl: runtime.invitationUrl,
3807
+ deviceInvitationParam: runtime.deviceInvitationParam,
3808
+ spaceInvitationParam: runtime.spaceInvitationParam
3809
+ });
3802
3810
  const client = useClient7();
3803
3811
  const space = useSpace2(spaceKey);
3812
+ const createDeviceInvitationUrl = (invitationCode2) => {
3813
+ const baseUrl = new URL(invitationUrl);
3814
+ baseUrl.searchParams.set(deviceInvitationParam, invitationCode2);
3815
+ return baseUrl.toString();
3816
+ };
3817
+ const createSpaceInvitationUrl = (invitationCode2) => {
3818
+ const baseUrl = new URL(invitationUrl);
3819
+ baseUrl.searchParams.set(spaceInvitationParam, invitationCode2);
3820
+ return baseUrl.toString();
3821
+ };
3804
3822
  useEffect7(() => {
3805
- return runtime.layoutUpdate.on((request) => setLayout(request));
3823
+ const unsubscribeLayout = runtime.layoutUpdate.on((request) => setLayout(request));
3824
+ const unsubscribeInvitationUrl = runtime.invitationUrlUpdate.on((request) => setInvitationUrl(request));
3825
+ return () => {
3826
+ unsubscribeLayout();
3827
+ unsubscribeInvitationUrl();
3828
+ };
3806
3829
  }, [
3807
3830
  runtime
3808
3831
  ]);
@@ -3810,7 +3833,7 @@ var Shell = ({ runtime, origin }) => {
3810
3833
  if (layout === ShellLayout.SPACE && !space) {
3811
3834
  log14.warn("No space found for shell space invitations.", void 0, {
3812
3835
  F: __dxlog_file13,
3813
- L: 33,
3836
+ L: 64,
3814
3837
  S: void 0,
3815
3838
  C: (f, a) => f(...a)
3816
3839
  });
@@ -3854,7 +3877,7 @@ var Shell = ({ runtime, origin }) => {
3854
3877
  case ShellLayout.SHARE_IDENTITY:
3855
3878
  case ShellLayout.EDIT_PROFILE:
3856
3879
  return /* @__PURE__ */ React46.createElement(IdentityDialog, {
3857
- createInvitationUrl: (invitationCode2) => `${origin}?deviceInvitationCode=${invitationCode2}`,
3880
+ createInvitationUrl: createDeviceInvitationUrl,
3858
3881
  onResetStorage: async () => {
3859
3882
  runtime.setLayout({
3860
3883
  layout: ShellLayout.STATUS
@@ -3888,7 +3911,7 @@ var Shell = ({ runtime, origin }) => {
3888
3911
  return space ? /* @__PURE__ */ React46.createElement(SpaceDialog, {
3889
3912
  space,
3890
3913
  target,
3891
- createInvitationUrl: (invitationCode2) => `${origin}?spaceInvitationCode=${invitationCode2}`,
3914
+ createInvitationUrl: createSpaceInvitationUrl,
3892
3915
  onDone: async () => {
3893
3916
  await runtime.setAppContext({
3894
3917
  display: ShellDisplay.NONE
@@ -4014,14 +4037,14 @@ var os = {
4014
4037
  "auth code message": "Enter the following auth code on the joining device.",
4015
4038
  "display name input label": "Display name",
4016
4039
  "display name input placeholder": "Enter a display name",
4017
- "invite one label": "Invite one",
4040
+ "invite one label": "Single-use invitation",
4018
4041
  "invite one description": "Only one user may join.",
4019
- "invite one qr label": "Single-use",
4042
+ "invite one qr label": "Single-use invitation",
4020
4043
  "invite one list item label": "Active single-use invitation",
4021
- "invite many label": "Invite many",
4044
+ "invite many label": "Standing invitation",
4022
4045
  "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",
4046
+ "invite many qr label": "Standing invitation",
4047
+ "invite many list item label": "Active standing invitation",
4025
4048
  "invite options label": "Change the active invite option.",
4026
4049
  "reset in progress label": "Resetting...",
4027
4050
  "confirm label": "Confirm",
@@ -4102,8 +4125,7 @@ var runShell = async (config = new Config()) => {
4102
4125
  status: SystemStatus.ACTIVE
4103
4126
  }
4104
4127
  }, /* @__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
4128
+ runtime
4107
4129
  }))))))));
4108
4130
  } catch {
4109
4131
  createRoot(document.getElementById("root")).render(/* @__PURE__ */ React47.createElement(StrictMode, null, /* @__PURE__ */ React47.createElement(ThemeProvider, {
@@ -4142,12 +4164,16 @@ import { mx as mx25 } from "@dxos/react-ui-theme";
4142
4164
  import { Event } from "@dxos/async";
4143
4165
  import { ShellLayout as ShellLayout2 } from "@dxos/react-client";
4144
4166
  var MemoryShellRuntime = class {
4145
- constructor({ layout, invitationCode, spaceKey } = {}) {
4167
+ constructor({ layout, invitationCode, spaceKey, invitationUrl, deviceInvitationParam, spaceInvitationParam } = {}) {
4146
4168
  this.layoutUpdate = new Event();
4169
+ this.invitationUrlUpdate = new Event();
4147
4170
  this.contextUpdate = new Event();
4148
4171
  this._layout = layout ?? ShellLayout2.DEFAULT;
4149
4172
  this._invitationCode = invitationCode;
4150
4173
  this._spaceKey = spaceKey;
4174
+ this._invitationUrl = invitationUrl ?? window.location.origin;
4175
+ this._deviceInvitationParam = deviceInvitationParam ?? "deviceInvitationCode";
4176
+ this._spaceInvitationParam = spaceInvitationParam ?? "spaceInvitationCode";
4151
4177
  }
4152
4178
  get layout() {
4153
4179
  return this._layout;
@@ -4158,12 +4184,27 @@ var MemoryShellRuntime = class {
4158
4184
  get spaceKey() {
4159
4185
  return this._spaceKey;
4160
4186
  }
4187
+ get invitationUrl() {
4188
+ return this._invitationUrl;
4189
+ }
4190
+ get deviceInvitationParam() {
4191
+ return this._deviceInvitationParam;
4192
+ }
4193
+ get spaceInvitationParam() {
4194
+ return this._spaceInvitationParam;
4195
+ }
4161
4196
  setLayout(request) {
4162
4197
  this._layout = request.layout;
4163
4198
  this._invitationCode = request.invitationCode;
4164
4199
  this._spaceKey = request.spaceKey;
4165
4200
  this.layoutUpdate.emit(request);
4166
4201
  }
4202
+ setInvitationUrl(request) {
4203
+ this._invitationUrl = request.invitationUrl;
4204
+ this._deviceInvitationParam = request.deviceInvitationParam;
4205
+ this._spaceInvitationParam = request.spaceInvitationParam;
4206
+ this.invitationUrlUpdate.emit(request);
4207
+ }
4167
4208
  async setAppContext(context) {
4168
4209
  this.contextUpdate.emit(context);
4169
4210
  }
@@ -4268,8 +4309,7 @@ var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoine
4268
4309
  return /* @__PURE__ */ React48.createElement(React48.Fragment, null, shellRuntime && /* @__PURE__ */ React48.createElement("div", {
4269
4310
  className: mx25(display === ShellDisplay3.NONE ? "hidden" : "")
4270
4311
  }, /* @__PURE__ */ React48.createElement(Shell, {
4271
- runtime: shellRuntime,
4272
- origin: window.location.origin
4312
+ runtime: shellRuntime
4273
4313
  })), /* @__PURE__ */ React48.createElement(ShellContext.Provider, {
4274
4314
  value: {
4275
4315
  runtime: shellRuntime,