@hanzo/app 0.3.58 → 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/Gate.js CHANGED
@@ -27,7 +27,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
27
27
  // a team without a live plan is offered that plan, a personal organization on
28
28
  // Free is offered a team, and an open one is sent on (`forward`). Behind the
29
29
  // door, and only there, nothing opens without a live plan.
30
- import { dev } from './lib/host.js';
30
+ import { CHAT, chat, dev } from './lib/host.js';
31
31
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
32
32
  import { useIam } from '@hanzo/iam/react';
33
33
  import { phrase, english } from '@hanzo/i18n';
@@ -62,14 +62,14 @@ const SETUP = 'hanzo:org:template';
62
62
  /** Checkout for a plan, coming back to this page. */
63
63
  function checkout(plan) {
64
64
  const origin = typeof window !== 'undefined' ? window.location.origin : 'https://hanzo.app';
65
- const path = typeof window !== 'undefined' ? window.location.pathname : '/chat';
65
+ const path = typeof window !== 'undefined' ? window.location.pathname : chat();
66
66
  return checkoutUrl(plan.id, `${origin}${path}`);
67
67
  }
68
- /** Whether the current /chat navigation is an anonymous preview session. */
68
+ /** Whether the current Chat navigation is an anonymous preview session. */
69
69
  function isAnonChat() {
70
70
  if (typeof window === 'undefined' || hasSession())
71
71
  return false;
72
- if (window.location.pathname !== '/chat')
72
+ if (window.location.pathname !== CHAT && window.location.pathname !== chat())
73
73
  return false;
74
74
  const win = window;
75
75
  const q = new URLSearchParams(window.location.search);
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.58",
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",