@hanzo/app 0.3.79 → 0.3.80
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/lib/destination.d.ts +5 -0
- package/dist/lib/destination.js +25 -1
- package/package.json +1 -1
|
@@ -80,6 +80,11 @@ export declare function onward(search: string): string | undefined;
|
|
|
80
80
|
* lists its callback), and hanzo.ai opened with no app's authorize request in
|
|
81
81
|
* its address, where a session would land on the site rather than in the app.
|
|
82
82
|
* hanzo.app starts its own request and comes back to hanzo.ai's page with it.
|
|
83
|
+
*
|
|
84
|
+
* Except a sign-in that goes on to hanzo.ai's checkout (`paying`): the session
|
|
85
|
+
* has to land on the site, since the checkout is the site's, so hanzo.ai signs
|
|
86
|
+
* that one in itself.
|
|
87
|
+
*
|
|
83
88
|
* Anywhere else, do nothing and report false so the caller signs in here.
|
|
84
89
|
*/
|
|
85
90
|
export declare function handoff(address: string): boolean;
|
package/dist/lib/destination.js
CHANGED
|
@@ -161,12 +161,36 @@ export function onward(search) {
|
|
|
161
161
|
const next = new URLSearchParams(search).get("next");
|
|
162
162
|
return next && safe(next, "") === next ? next : undefined;
|
|
163
163
|
}
|
|
164
|
+
/** hanzo.ai's checkout: hanzo-inc/pay mounted at hanzo.ai/pay (lib/pay `BILLING_URL`), and every path under it. */
|
|
165
|
+
const CHECKOUT = /^\/pay(?:\/|$)/;
|
|
166
|
+
/**
|
|
167
|
+
* Whether the sign-in at `address` goes on to hanzo.ai's checkout: its `next`
|
|
168
|
+
* (or `redirect`, which the sign-in page reads too) is a path on this site
|
|
169
|
+
* (`safe`) under /pay. pay sends a buyer with no session there exactly so
|
|
170
|
+
* (hanzo-inc/pay lib/auth `login`, `/login?next=/pay/…`).
|
|
171
|
+
*
|
|
172
|
+
* The checkout is served on hanzo.ai alone and reads the session hanzo.ai's
|
|
173
|
+
* origin keeps. hanzo.app answers /pay by sending it to hanzo.ai/pay, so a
|
|
174
|
+
* session made on hanzo.app never reaches the checkout, which finds none and
|
|
175
|
+
* sends the buyer to sign in again: hanzo.ai/pay, hanzo.ai/login, hanzo.app/login,
|
|
176
|
+
* hanzo.app/pay, hanzo.ai/pay, without end ("Add funds", 2026-11-13).
|
|
177
|
+
*/
|
|
178
|
+
function paying(address) {
|
|
179
|
+
const q = new URLSearchParams(address.split("#")[0].split("?")[1] ?? "");
|
|
180
|
+
const to = safe(q.get("next") || q.get("redirect"), "");
|
|
181
|
+
return to !== "" && CHECKOUT.test(new URL(to, HERE).pathname);
|
|
182
|
+
}
|
|
164
183
|
/**
|
|
165
184
|
* Send this sign-in to `address` on hanzo.app, the app's host, and report that
|
|
166
185
|
* it left, from a host that cannot start one for itself: a `guest` (no client
|
|
167
186
|
* lists its callback), and hanzo.ai opened with no app's authorize request in
|
|
168
187
|
* its address, where a session would land on the site rather than in the app.
|
|
169
188
|
* hanzo.app starts its own request and comes back to hanzo.ai's page with it.
|
|
189
|
+
*
|
|
190
|
+
* Except a sign-in that goes on to hanzo.ai's checkout (`paying`): the session
|
|
191
|
+
* has to land on the site, since the checkout is the site's, so hanzo.ai signs
|
|
192
|
+
* that one in itself.
|
|
193
|
+
*
|
|
170
194
|
* Anywhere else, do nothing and report false so the caller signs in here.
|
|
171
195
|
*/
|
|
172
196
|
export function handoff(address) {
|
|
@@ -174,7 +198,7 @@ export function handoff(address) {
|
|
|
174
198
|
return false;
|
|
175
199
|
const host = window.location.hostname;
|
|
176
200
|
const asked = new URLSearchParams(address.split("#")[0].split("?")[1] ?? "").has("client_id");
|
|
177
|
-
if (!guest(host) && !(signs(host) && !asked))
|
|
201
|
+
if (!guest(host) && !(signs(host) && !asked && !paying(address)))
|
|
178
202
|
return false;
|
|
179
203
|
window.location.assign(HOST + address);
|
|
180
204
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/app",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.80",
|
|
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",
|