@dxos/shell 0.5.1-next.260c093 → 0.5.1-next.26de2f3

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 +6964 -6943
  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 +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
@@ -153,7 +153,7 @@ export const ShellProvider = ({
153
153
  <>
154
154
  {shellRuntime && (
155
155
  <div className={mx(display === ShellDisplay.NONE ? 'hidden' : '')}>
156
- <Shell runtime={shellRuntime} origin={window.location.origin} />
156
+ <Shell runtime={shellRuntime} />
157
157
  </div>
158
158
  )}
159
159
 
@@ -4,25 +4,40 @@
4
4
 
5
5
  import { Event } from '@dxos/async';
6
6
  import {
7
+ ShellLayout,
7
8
  type AppContextRequest,
9
+ type InvitationUrlRequest,
8
10
  type LayoutRequest,
9
11
  type PublicKey,
10
- ShellLayout,
11
12
  type ShellRuntime,
12
13
  } from '@dxos/react-client';
13
14
 
14
15
  // TODO(wittjosiah): Remove?
15
16
  export class MemoryShellRuntime implements ShellRuntime {
16
17
  readonly layoutUpdate = new Event<LayoutRequest>();
18
+ readonly invitationUrlUpdate = new Event<InvitationUrlRequest>();
17
19
  readonly contextUpdate = new Event<AppContextRequest>();
18
20
  private _layout: ShellLayout;
19
21
  private _invitationCode?: string;
20
22
  private _spaceKey?: PublicKey;
23
+ private _invitationUrl: string;
24
+ private _deviceInvitationParam: string;
25
+ private _spaceInvitationParam: string;
21
26
 
22
- constructor({ layout, invitationCode, spaceKey }: Partial<LayoutRequest> & Partial<AppContextRequest> = {}) {
27
+ constructor({
28
+ layout,
29
+ invitationCode,
30
+ spaceKey,
31
+ invitationUrl,
32
+ deviceInvitationParam,
33
+ spaceInvitationParam,
34
+ }: Partial<LayoutRequest> & Partial<AppContextRequest> & Partial<InvitationUrlRequest> = {}) {
23
35
  this._layout = layout ?? ShellLayout.DEFAULT;
24
36
  this._invitationCode = invitationCode;
25
37
  this._spaceKey = spaceKey;
38
+ this._invitationUrl = invitationUrl ?? window.location.origin;
39
+ this._deviceInvitationParam = deviceInvitationParam ?? 'deviceInvitationCode';
40
+ this._spaceInvitationParam = spaceInvitationParam ?? 'spaceInvitationCode';
26
41
  }
27
42
 
28
43
  get layout() {
@@ -37,6 +52,18 @@ export class MemoryShellRuntime implements ShellRuntime {
37
52
  return this._spaceKey;
38
53
  }
39
54
 
55
+ get invitationUrl() {
56
+ return this._invitationUrl;
57
+ }
58
+
59
+ get deviceInvitationParam() {
60
+ return this._deviceInvitationParam;
61
+ }
62
+
63
+ get spaceInvitationParam() {
64
+ return this._spaceInvitationParam;
65
+ }
66
+
40
67
  setLayout(request: LayoutRequest) {
41
68
  this._layout = request.layout;
42
69
  this._invitationCode = request.invitationCode;
@@ -44,6 +71,13 @@ export class MemoryShellRuntime implements ShellRuntime {
44
71
  this.layoutUpdate.emit(request);
45
72
  }
46
73
 
74
+ setInvitationUrl(request: InvitationUrlRequest) {
75
+ this._invitationUrl = request.invitationUrl;
76
+ this._deviceInvitationParam = request.deviceInvitationParam;
77
+ this._spaceInvitationParam = request.spaceInvitationParam;
78
+ this.invitationUrlUpdate.emit(request);
79
+ }
80
+
47
81
  async setAppContext(context: AppContextRequest) {
48
82
  this.contextUpdate.emit(context);
49
83
  }
@@ -41,7 +41,7 @@ export const runShell = async (config: Config = new Config()) => {
41
41
  <ClipboardProvider>
42
42
  <Tooltip.Provider>
43
43
  <AgentHostingProvider>
44
- <Shell runtime={runtime} origin={location.origin} />
44
+ <Shell runtime={runtime} />
45
45
  </AgentHostingProvider>
46
46
  </Tooltip.Provider>
47
47
  </ClipboardProvider>
@@ -60,7 +60,7 @@ export const JoinPanelImpl = (props: JoinPanelImplProps) => {
60
60
  <Viewport.View classNames={stepStyles} id='reset storage confirmation'>
61
61
  <ConfirmResetComponent
62
62
  send={send}
63
- active={activeView === 'reset identity confirmation'}
63
+ active={activeView === 'reset storage confirmation'}
64
64
  onCancel={onCancelResetStorage}
65
65
  onConfirm={onConfirmResetStorage}
66
66
  />
@@ -222,7 +222,7 @@ export const JoinPanel = ({
222
222
  case joinState.matches({ choosingIdentity: 'choosingAuthMethod' }):
223
223
  return 'addition method chooser';
224
224
  case joinState.matches('resettingIdentity'):
225
- return 'reset identity confirmation';
225
+ return 'reset storage confirmation';
226
226
  case joinState.matches({ choosingIdentity: 'creatingIdentity' }):
227
227
  return 'create identity input';
228
228
  case joinState.matches({ choosingIdentity: 'recoveringIdentity' }):
@@ -73,8 +73,8 @@ export const SpaceManager = (props: SpaceManagerProps) => {
73
73
  icon: UsersThree,
74
74
  onClick: useCallback(() => {
75
75
  const invitation = space.share?.({
76
- type: Invitation.Type.INTERACTIVE,
77
- authMethod: Invitation.AuthMethod.NONE,
76
+ type: Invitation.Type.DELEGATED,
77
+ authMethod: Invitation.AuthMethod.KNOWN_PUBLIC_KEY,
78
78
  multiUse: true,
79
79
  target,
80
80
  });
@@ -83,22 +83,6 @@ export const SpaceManager = (props: SpaceManagerProps) => {
83
83
  }
84
84
  }, [space]),
85
85
  },
86
- // inviteNonPersistent: {
87
- // label: 'Invite one (nonpersistent)',
88
- // description: 'Only one user may join. Invitation does not resume if client is restarted.',
89
- // icon: UserPlus,
90
- // onClick: useCallback(() => {
91
- // const invitation = space.share?.({
92
- // type: Invitation.Type.INTERACTIVE,
93
- // authMethod: Invitation.AuthMethod.SHARED_SECRET,
94
- // persistent: false,
95
- // target,
96
- // });
97
- // if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== 'production') {
98
- // invitation.subscribe(onInvitationEvent);
99
- // }
100
- // }, [space]),
101
- // },
102
86
  };
103
87
 
104
88
  return <SpaceManagerImpl {...props} invitations={invitations} inviteActions={inviteActions} />;
@@ -53,6 +53,9 @@ export const InvitationManager = ({
53
53
  const showAuthCode = statusValue === 3;
54
54
  const emoji = hexToEmoji(id);
55
55
  const activeView = useMemo(() => {
56
+ if (multiUse) {
57
+ return 'showing qr';
58
+ }
56
59
  switch (true) {
57
60
  case statusValue === 5:
58
61
  case statusValue < 0:
@@ -85,14 +85,14 @@ export const os = {
85
85
  'auth code message': 'Enter the following auth code on the joining device.',
86
86
  'display name input label': 'Display name',
87
87
  'display name input placeholder': 'Enter a display name',
88
- 'invite one label': 'Invite one',
88
+ 'invite one label': 'Single-use invitation',
89
89
  'invite one description': 'Only one user may join.',
90
- 'invite one qr label': 'Single-use',
90
+ 'invite one qr label': 'Single-use invitation',
91
91
  'invite one list item label': 'Active single-use invitation',
92
- 'invite many label': 'Invite many',
92
+ 'invite many label': 'Standing invitation',
93
93
  'invite many description': 'Anyone with the link can join.',
94
- 'invite many qr label': 'Multiple-use',
95
- 'invite many list item label': 'Active multiple-use invitation',
94
+ 'invite many qr label': 'Standing invitation',
95
+ 'invite many list item label': 'Active standing invitation',
96
96
  'invite options label': 'Change the active invite option.',
97
97
  'reset in progress label': 'Resetting...',
98
98
  'confirm label': 'Confirm',