@hanzo/app 0.3.59 → 0.3.60

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.
package/dist/Hosted.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  /** How long a frame may take to load before the pane says it did not. */
2
2
  export declare const PATIENCE = 20000;
3
- /** What the host tells a frame about how it looks. */
3
+ /** What the host tells a frame about how it looks and who is signed in. */
4
4
  export interface Hostly {
5
5
  type: 'hanzo:host';
6
6
  theme: 'light' | 'dark';
7
7
  accent?: string;
8
8
  density?: string;
9
9
  org?: string;
10
+ token?: string;
10
11
  }
11
12
  export declare function HostedPane({ id, go }: {
12
13
  id: string;
package/dist/Hosted.js CHANGED
@@ -33,6 +33,7 @@ import { useOrg } from './host.js';
33
33
  import { BETAS } from './lib/betas.js';
34
34
  import { go as replace, hosted } from './lib/host.js';
35
35
  import { frameUrl, hostedApp, origin, pathOn } from './lib/hosted.js';
36
+ import { bearer } from './lib/session.js';
36
37
  /** How long a frame may take to load before the pane says it did not. */
37
38
  export const PATIENCE = 20_000;
38
39
  /** What the frame may use of the browser: the clipboard and full screen, which the apps' own pages ask for. */
@@ -100,12 +101,13 @@ function Frame({ app }) {
100
101
  const [turn, setTurn] = useState(0);
101
102
  const [state, setState] = useState('loading');
102
103
  const host = origin(app);
103
- // What the frame is told: each time it loads, and whenever the look or the organization changes after.
104
+ // What the frame is told: each time it loads, when it announces ready, and whenever the look or the organization changes after.
104
105
  const tell = useCallback(() => {
105
106
  const to = frame.current?.contentWindow;
106
107
  if (!to)
107
108
  return;
108
- const said = { type: 'hanzo:host', ...looks, org: org.id };
109
+ const token = bearer();
110
+ const said = { type: 'hanzo:host', ...looks, org: org.id, ...(token ? { token } : {}) };
109
111
  try {
110
112
  to.postMessage(said, host);
111
113
  }
@@ -131,8 +133,10 @@ function Frame({ app }) {
131
133
  if (e.origin !== host || e.source !== frame.current?.contentWindow)
132
134
  return;
133
135
  const said = e.data;
134
- if (said?.type === 'hanzo:ready')
136
+ if (said?.type === 'hanzo:ready') {
135
137
  setState('ready');
138
+ tell();
139
+ }
136
140
  else if (said?.type === 'hanzo:navigate' && typeof said.href === 'string') {
137
141
  const to = pathOn(app, said.href);
138
142
  if (!to)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.3.59",
3
+ "version": "0.3.60",
4
4
  "description": "Hanzo's app: the shell and its apps (Home, Chat, Inbox, Contacts, Meet, Calendar, Drive, Board, Work, Bots), once, for every Hanzo surface.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",