@hanzo/app 0.3.8 → 0.3.9
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/Account.js +3 -5
- package/dist/Gate.js +2 -3
- package/dist/lib/session.d.ts +9 -0
- package/dist/lib/session.js +17 -3
- package/package.json +1 -1
package/dist/Account.js
CHANGED
|
@@ -43,7 +43,7 @@ import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, DropdownMenuC
|
|
|
43
43
|
import { api } from './lib/api.js';
|
|
44
44
|
import { createOrg, say } from './lib/org.js';
|
|
45
45
|
import { list } from './lib/list.js';
|
|
46
|
-
import { choose, org as current, orgs,
|
|
46
|
+
import { choose, org as current, orgs, renew, reopen, scope, superAdmin } from './lib/session.js';
|
|
47
47
|
import { ENTRY, settings } from './lib/host.js';
|
|
48
48
|
import { leave } from './dev.js';
|
|
49
49
|
import { payUrl } from './lib/pay.js';
|
|
@@ -277,12 +277,11 @@ function Create({ open, onOpenChange }) {
|
|
|
277
277
|
catch {
|
|
278
278
|
/* the next load simply says nothing */
|
|
279
279
|
}
|
|
280
|
-
pick(org);
|
|
281
280
|
renew();
|
|
282
281
|
// The app again, where the person is, in the new organization. Not `/`: on
|
|
283
282
|
// hanzo.ai that is the landing for everyone (owner, 2026-10-29), so a
|
|
284
283
|
// person who made an organization from /chat was left on the marketing page.
|
|
285
|
-
|
|
284
|
+
reopen(org);
|
|
286
285
|
}
|
|
287
286
|
catch (e) {
|
|
288
287
|
setRefused(say(e, t));
|
|
@@ -310,8 +309,7 @@ export function Made() {
|
|
|
310
309
|
return sessionStorage.removeItem(MADE);
|
|
311
310
|
// Still out of the token: go on working where the person was.
|
|
312
311
|
if (kept.from && current() !== kept.from && orgs().includes(kept.from)) {
|
|
313
|
-
|
|
314
|
-
return window.location.reload();
|
|
312
|
+
return reopen(kept.from);
|
|
315
313
|
}
|
|
316
314
|
setMade({ org: kept.org, name: kept.name || kept.org });
|
|
317
315
|
}
|
package/dist/Gate.js
CHANGED
|
@@ -44,7 +44,7 @@ import { useHostname } from './lib/hostname.js';
|
|
|
44
44
|
import { useHydrated } from './lib/hydrated.js';
|
|
45
45
|
import { api } from './lib/api.js';
|
|
46
46
|
import { usePersonal, useTier } from './lib/tier.js';
|
|
47
|
-
import { CHOOSE, ORG, assumed, bearer, hasSession, org, orgs as claimed, pick, renew, role, scope, superAdmin, support } from './lib/session.js';
|
|
47
|
+
import { CHOOSE, ORG, assumed, bearer, hasSession, org, orgs as claimed, pick, renew, reopen, role, scope, superAdmin, support } from './lib/session.js';
|
|
48
48
|
import { matches, refusal, slugify } from './lib/orgname.js';
|
|
49
49
|
import { team as workspace } from './lib/host.js';
|
|
50
50
|
import { checkoutUrl, money } from './lib/pay.js';
|
|
@@ -713,8 +713,7 @@ function Found({ onClose }) {
|
|
|
713
713
|
throw new Error(t('{org} is made, and it is still called {org}: {reason}', { org: made, reason: say(err, t) }));
|
|
714
714
|
});
|
|
715
715
|
}
|
|
716
|
-
|
|
717
|
-
window.location.reload();
|
|
716
|
+
reopen(made);
|
|
718
717
|
}
|
|
719
718
|
catch (err) {
|
|
720
719
|
setRefused(say(err, t));
|
package/dist/lib/session.d.ts
CHANGED
|
@@ -188,6 +188,15 @@ export declare const ORG = "hanzo:org";
|
|
|
188
188
|
* answers, so the gate does not ask for it again.
|
|
189
189
|
*/
|
|
190
190
|
export declare function pick(o: string): void;
|
|
191
|
+
/**
|
|
192
|
+
* Open the app again in this organization: the SDK's selection, written and
|
|
193
|
+
* NOT announced, then the reload. For an organization the token in memory does
|
|
194
|
+
* not name yet (one just made, one stepped into): announced, the rooms remount
|
|
195
|
+
* before the reload under that token, and @hanzo/iam's provider, finding the
|
|
196
|
+
* organization missing from it, writes the token's first organization back over
|
|
197
|
+
* the choice (useOrganizations), so the reload opened the wrong one.
|
|
198
|
+
*/
|
|
199
|
+
export declare function reopen(o: string): void;
|
|
191
200
|
/** Fired on `window` to open the organization chooser over the shell. */
|
|
192
201
|
export declare const CHOOSE = "hanzo:org:choose";
|
|
193
202
|
/** Open the chooser (`Gate`): every organization of the person's, and every one for a SuperAdmin. */
|
package/dist/lib/session.js
CHANGED
|
@@ -459,13 +459,28 @@ export const ORG = 'hanzo:org';
|
|
|
459
459
|
* answers, so the gate does not ask for it again.
|
|
460
460
|
*/
|
|
461
461
|
export function pick(o) {
|
|
462
|
+
keep(o);
|
|
463
|
+
window.dispatchEvent(new Event(ORG));
|
|
464
|
+
}
|
|
465
|
+
function keep(o) {
|
|
462
466
|
try {
|
|
463
467
|
window.localStorage.setItem(`${PREFIX}current_org`, o);
|
|
464
468
|
}
|
|
465
469
|
catch {
|
|
466
470
|
/* the choice lives only in this page */
|
|
467
471
|
}
|
|
468
|
-
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Open the app again in this organization: the SDK's selection, written and
|
|
475
|
+
* NOT announced, then the reload. For an organization the token in memory does
|
|
476
|
+
* not name yet (one just made, one stepped into): announced, the rooms remount
|
|
477
|
+
* before the reload under that token, and @hanzo/iam's provider, finding the
|
|
478
|
+
* organization missing from it, writes the token's first organization back over
|
|
479
|
+
* the choice (useOrganizations), so the reload opened the wrong one.
|
|
480
|
+
*/
|
|
481
|
+
export function reopen(o) {
|
|
482
|
+
keep(o);
|
|
483
|
+
window.location.reload();
|
|
469
484
|
}
|
|
470
485
|
/** Fired on `window` to open the organization chooser over the shell. */
|
|
471
486
|
export const CHOOSE = 'hanzo:org:choose';
|
|
@@ -518,8 +533,7 @@ export async function support(org) {
|
|
|
518
533
|
throw new Error(body?.msg || `IAM answered ${res.status}.`);
|
|
519
534
|
tokens().setItem(ACCESS, next);
|
|
520
535
|
tokens().setItem(EXPIRES, String(exp * 1000));
|
|
521
|
-
|
|
522
|
-
window.location.reload();
|
|
536
|
+
reopen(org ?? opened(next)[0] ?? '');
|
|
523
537
|
}
|
|
524
538
|
/**
|
|
525
539
|
* Leave support mode when IAM cannot answer the step out: the stored token is
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/app",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
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",
|