@dxos/shell 0.5.1-main.d3f3a55 → 0.5.1-main.ea79cb0

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.
@@ -3792,17 +3792,37 @@ var StatusDialog = () => {
3792
3792
 
3793
3793
  // packages/sdk/shell/src/composites/Shell/Shell.tsx
3794
3794
  var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/composites/Shell/Shell.tsx";
3795
- var Shell = ({ runtime, origin }) => {
3795
+ var Shell = ({ runtime }) => {
3796
3796
  const [{ layout, invitationCode, spaceKey, target }, setLayout] = useState13({
3797
3797
  layout: runtime.layout,
3798
3798
  invitationCode: runtime.invitationCode,
3799
3799
  spaceKey: runtime.spaceKey,
3800
3800
  target: runtime.target
3801
3801
  });
3802
+ const [{ invitationUrl, deviceInvitationParam, spaceInvitationParam }, setInvitationUrl] = useState13({
3803
+ invitationUrl: runtime.invitationUrl,
3804
+ deviceInvitationParam: runtime.deviceInvitationParam,
3805
+ spaceInvitationParam: runtime.spaceInvitationParam
3806
+ });
3802
3807
  const client = useClient7();
3803
3808
  const space = useSpace2(spaceKey);
3809
+ const createDeviceInvitationUrl = (invitationCode2) => {
3810
+ const baseUrl = new URL(invitationUrl);
3811
+ baseUrl.searchParams.set(deviceInvitationParam, invitationCode2);
3812
+ return baseUrl.toString();
3813
+ };
3814
+ const createSpaceInvitationUrl = (invitationCode2) => {
3815
+ const baseUrl = new URL(invitationUrl);
3816
+ baseUrl.searchParams.set(spaceInvitationParam, invitationCode2);
3817
+ return baseUrl.toString();
3818
+ };
3804
3819
  useEffect7(() => {
3805
- return runtime.layoutUpdate.on((request) => setLayout(request));
3820
+ const unsubscribeLayout = runtime.layoutUpdate.on((request) => setLayout(request));
3821
+ const unsubscribeInvitationUrl = runtime.invitationUrlUpdate.on((request) => setInvitationUrl(request));
3822
+ return () => {
3823
+ unsubscribeLayout();
3824
+ unsubscribeInvitationUrl();
3825
+ };
3806
3826
  }, [
3807
3827
  runtime
3808
3828
  ]);
@@ -3810,7 +3830,7 @@ var Shell = ({ runtime, origin }) => {
3810
3830
  if (layout === ShellLayout.SPACE && !space) {
3811
3831
  log14.warn("No space found for shell space invitations.", void 0, {
3812
3832
  F: __dxlog_file13,
3813
- L: 33,
3833
+ L: 64,
3814
3834
  S: void 0,
3815
3835
  C: (f, a) => f(...a)
3816
3836
  });
@@ -3854,7 +3874,7 @@ var Shell = ({ runtime, origin }) => {
3854
3874
  case ShellLayout.SHARE_IDENTITY:
3855
3875
  case ShellLayout.EDIT_PROFILE:
3856
3876
  return /* @__PURE__ */ React46.createElement(IdentityDialog, {
3857
- createInvitationUrl: (invitationCode2) => `${origin}?deviceInvitationCode=${invitationCode2}`,
3877
+ createInvitationUrl: createDeviceInvitationUrl,
3858
3878
  onResetStorage: async () => {
3859
3879
  runtime.setLayout({
3860
3880
  layout: ShellLayout.STATUS
@@ -3888,7 +3908,7 @@ var Shell = ({ runtime, origin }) => {
3888
3908
  return space ? /* @__PURE__ */ React46.createElement(SpaceDialog, {
3889
3909
  space,
3890
3910
  target,
3891
- createInvitationUrl: (invitationCode2) => `${origin}?spaceInvitationCode=${invitationCode2}`,
3911
+ createInvitationUrl: createSpaceInvitationUrl,
3892
3912
  onDone: async () => {
3893
3913
  await runtime.setAppContext({
3894
3914
  display: ShellDisplay.NONE
@@ -4102,8 +4122,7 @@ var runShell = async (config = new Config()) => {
4102
4122
  status: SystemStatus.ACTIVE
4103
4123
  }
4104
4124
  }, /* @__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
4125
+ runtime
4107
4126
  }))))))));
4108
4127
  } catch {
4109
4128
  createRoot(document.getElementById("root")).render(/* @__PURE__ */ React47.createElement(StrictMode, null, /* @__PURE__ */ React47.createElement(ThemeProvider, {
@@ -4142,12 +4161,16 @@ import { mx as mx25 } from "@dxos/react-ui-theme";
4142
4161
  import { Event } from "@dxos/async";
4143
4162
  import { ShellLayout as ShellLayout2 } from "@dxos/react-client";
4144
4163
  var MemoryShellRuntime = class {
4145
- constructor({ layout, invitationCode, spaceKey } = {}) {
4164
+ constructor({ layout, invitationCode, spaceKey, invitationUrl, deviceInvitationParam, spaceInvitationParam } = {}) {
4146
4165
  this.layoutUpdate = new Event();
4166
+ this.invitationUrlUpdate = new Event();
4147
4167
  this.contextUpdate = new Event();
4148
4168
  this._layout = layout ?? ShellLayout2.DEFAULT;
4149
4169
  this._invitationCode = invitationCode;
4150
4170
  this._spaceKey = spaceKey;
4171
+ this._invitationUrl = invitationUrl ?? window.location.origin;
4172
+ this._deviceInvitationParam = deviceInvitationParam ?? "deviceInvitationCode";
4173
+ this._spaceInvitationParam = spaceInvitationParam ?? "spaceInvitationCode";
4151
4174
  }
4152
4175
  get layout() {
4153
4176
  return this._layout;
@@ -4158,12 +4181,27 @@ var MemoryShellRuntime = class {
4158
4181
  get spaceKey() {
4159
4182
  return this._spaceKey;
4160
4183
  }
4184
+ get invitationUrl() {
4185
+ return this._invitationUrl;
4186
+ }
4187
+ get deviceInvitationParam() {
4188
+ return this._deviceInvitationParam;
4189
+ }
4190
+ get spaceInvitationParam() {
4191
+ return this._spaceInvitationParam;
4192
+ }
4161
4193
  setLayout(request) {
4162
4194
  this._layout = request.layout;
4163
4195
  this._invitationCode = request.invitationCode;
4164
4196
  this._spaceKey = request.spaceKey;
4165
4197
  this.layoutUpdate.emit(request);
4166
4198
  }
4199
+ setInvitationUrl(request) {
4200
+ this._invitationUrl = request.invitationUrl;
4201
+ this._deviceInvitationParam = request.deviceInvitationParam;
4202
+ this._spaceInvitationParam = request.spaceInvitationParam;
4203
+ this.invitationUrlUpdate.emit(request);
4204
+ }
4167
4205
  async setAppContext(context) {
4168
4206
  this.contextUpdate.emit(context);
4169
4207
  }
@@ -4268,8 +4306,7 @@ var ShellProvider = ({ space, deviceInvitationCode, spaceInvitationCode, onJoine
4268
4306
  return /* @__PURE__ */ React48.createElement(React48.Fragment, null, shellRuntime && /* @__PURE__ */ React48.createElement("div", {
4269
4307
  className: mx25(display === ShellDisplay3.NONE ? "hidden" : "")
4270
4308
  }, /* @__PURE__ */ React48.createElement(Shell, {
4271
- runtime: shellRuntime,
4272
- origin: window.location.origin
4309
+ runtime: shellRuntime
4273
4310
  })), /* @__PURE__ */ React48.createElement(ShellContext.Provider, {
4274
4311
  value: {
4275
4312
  runtime: shellRuntime,