@hosty-sdk/app 0.32.0 → 0.34.2
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/README.md +14 -0
- package/dist/activity-react.js +8 -8
- package/dist/app-code-exchange.d.ts +8 -0
- package/dist/app-code-exchange.js +31 -0
- package/dist/assets/jetbrains-mono-LICENSE.txt +93 -0
- package/dist/assets/jetbrains-mono-cyrillic.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-ext.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin.woff2 +0 -0
- package/dist/assets/plex-sans-LICENSE.txt +93 -0
- package/dist/assets/plex-sans-cyrillic.woff2 +0 -0
- package/dist/assets/plex-sans-latin-ext.woff2 +0 -0
- package/dist/assets/plex-sans-latin.woff2 +0 -0
- package/dist/auth-notice.d.ts +4 -4
- package/dist/auth-notice.js +12 -44
- package/dist/browser-auth.d.ts +1 -1
- package/dist/browser-auth.js +1 -1
- package/dist/chrome-mark.d.ts +3 -0
- package/dist/chrome-mark.js +7 -0
- package/dist/core-mark-geometry.d.ts +17 -0
- package/dist/core-mark-geometry.js +8 -0
- package/dist/install-react.js +7 -3
- package/dist/overlay-react.js +41 -25
- package/dist/permissions-react.js +9 -3
- package/dist/react.d.ts +1 -1
- package/dist/react.js +10 -19
- package/dist/sandbox-react.js +20 -9
- package/dist/sandbox-server.d.ts +2 -1
- package/dist/sandbox-server.js +5 -4
- package/dist/sdk-chrome.d.ts +13 -0
- package/dist/sdk-chrome.js +102 -0
- package/dist/ui-composition.d.ts +2 -2
- package/dist/ui-frame-layer.js +2 -1
- package/dist/ui-frame.js +4 -3
- package/dist/ui-host.d.ts +2 -1
- package/dist/ui-host.js +24 -3
- package/dist/ui-navigation-react.js +11 -11
- package/dist/ui-react.js +22 -18
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -81,6 +81,20 @@ rebuild, without editing this wiring. New mandatory Core capabilities can requir
|
|
|
81
81
|
`node packages/app-sdk/scripts/check-overlay-upgrade.mjs` checks the published export layout using
|
|
82
82
|
identical consumer source before and after a dependency-only presentation revision (run SDK build first).
|
|
83
83
|
|
|
84
|
+
Standard SDK presentation uses the Hosty ink/mist palette, lime interaction and focus treatment,
|
|
85
|
+
light/dark cards and notices, and reduced-motion-aware progress. The package carries its own local
|
|
86
|
+
IBM Plex Sans and JetBrains Mono subsets and OFL notices; a browser bundler resolves their static
|
|
87
|
+
asset URLs without a CDN or an app-side CSS/font import. Server markup and initial hydration use
|
|
88
|
+
identical base styles; mounted chrome shares one document-owned font sheet using browser-resolved
|
|
89
|
+
URLs. StrictMode and access-portal replay retain that sheet, and the last owner releases it.
|
|
90
|
+
The private family names apply only to SDK-owned controls. The app document keeps its own typography, palette and focus styles; the four
|
|
91
|
+
`--hosty-panel-*` overrides remain supported. This is scoped styling of the existing light-DOM
|
|
92
|
+
renderers, not a Shadow DOM boundary or a change to the composition/authentication contracts.
|
|
93
|
+
|
|
94
|
+
The installation dialog collects only the source, opens Core confirmation and reports Core's
|
|
95
|
+
actual outcome. Preparation and execution have indeterminate progress; installed does not imply
|
|
96
|
+
configured, running or healthy. Closing the dialog does not cancel a Core-confirmed operation.
|
|
97
|
+
|
|
84
98
|
Legacy `AppIdentityBridge` exports, `renderState` and `onSession` remain compatible for consumers
|
|
85
99
|
that have not migrated. See [Hosty Overlay](../../docs/features/hosty-overlay/feature.md) for behavior.
|
|
86
100
|
|
package/dist/activity-react.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { AuthNotice, AuthNoticeButton } from "./auth-notice.js";
|
|
5
|
+
import { exchangeAppCode } from "./app-code-exchange.js";
|
|
5
6
|
import { APP_SESSION_ENDED, APP_ACTIVITY_RENEWED, appActivityNeedsRenewal, configureAppActivity, updateAppActivity, renewAppActivity, cancelActivityRenewal } from "./browser-auth.js";
|
|
6
7
|
import { resolveLaunchMode, detectLaunchMode, normalizeLaunchMode, LAUNCH_MODE_ATTRIBUTE, LAUNCH_MODE_PARAM, LAUNCH_MODE_STORAGE_KEY } from "./index.js";
|
|
7
8
|
import { acceptAppAuthProtocol, refreshAppAuthProtocol } from "./browser-auth.js";
|
|
@@ -33,13 +34,12 @@ export function useAppActivity(options) {
|
|
|
33
34
|
const mode = normalizeLaunchMode(document.documentElement.getAttribute(LAUNCH_MODE_ATTRIBUTE)) ?? resolveLaunchMode({
|
|
34
35
|
param: new URL(window.location.href).searchParams.get(LAUNCH_MODE_PARAM), stored, heuristic: detectLaunchMode(window),
|
|
35
36
|
}).mode;
|
|
36
|
-
cleanup = configureAppActivity({ openUrl, appAuthProtocol: protocol, probePath, native: native ?? mode === "native", activeUntil, activityRequired, validateSession, exchangeCode: async (proof) => {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return body;
|
|
37
|
+
cleanup = configureAppActivity({ openUrl, appAuthProtocol: protocol, probePath, native: native ?? mode === "native", activeUntil, activityRequired, validateSession, exchangeCode: async (proof, signal) => {
|
|
38
|
+
const { ok, body } = await exchangeAppCode(appCodePath, proof, signal);
|
|
39
|
+
if (!ok)
|
|
40
|
+
throw new Error(typeof body?.message === "string" ? body.message : "Could not renew app activity.");
|
|
41
|
+
return { ...(typeof body?.accessToken === "string" ? { accessToken: body.accessToken } : {}),
|
|
42
|
+
...(typeof body?.activeUntil === "string" || body?.activeUntil === null ? { activeUntil: body.activeUntil } : {}) };
|
|
43
43
|
} });
|
|
44
44
|
};
|
|
45
45
|
if (appAuthProtocol !== undefined && !(appAuthProtocol === 1 && acceptAppAuthProtocol(new URL(openUrl).origin, 1) === null))
|
|
@@ -69,5 +69,5 @@ export function AppActivityBridge(options) {
|
|
|
69
69
|
const { needed, pending, error, renew, cancel } = useAppActivity(options);
|
|
70
70
|
if (!needed)
|
|
71
71
|
return null;
|
|
72
|
-
return _jsxs(AuthNotice, { children: [_jsx("span", { children: error || "Renew access through Core to continue. Your work stays on this page." }), _jsx(AuthNoticeButton, { disabled: pending, onClick: renew, children: pending ? "Waiting for Core…" : "Renew access" }), _jsx(AuthNoticeButton, { secondary: true, onClick: cancel, children: "Later" })] });
|
|
72
|
+
return _jsxs(AuthNotice, { busy: pending, children: [_jsx("span", { children: error || "Renew access through Core to continue. Your work stays on this page." }), _jsx(AuthNoticeButton, { disabled: pending, onClick: renew, children: pending ? "Waiting for Core…" : "Renew access" }), _jsx(AuthNoticeButton, { secondary: true, onClick: cancel, children: "Later" })] });
|
|
73
73
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AppSignInResult } from "./browser-auth.js";
|
|
2
|
+
type Exchange = {
|
|
3
|
+
ok: boolean;
|
|
4
|
+
body: Record<string, unknown> | null;
|
|
5
|
+
};
|
|
6
|
+
/** A one-use proof is submitted once; timeout or cancellation never retries it. */
|
|
7
|
+
export declare function exchangeAppCode(path: string, proof: AppSignInResult, signal?: AbortSignal): Promise<Exchange>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** A one-use proof is submitted once; timeout or cancellation never retries it. */
|
|
2
|
+
export async function exchangeAppCode(path, proof, signal) {
|
|
3
|
+
const url = new URL(path, window.location.href);
|
|
4
|
+
if (url.origin !== window.location.origin || url.username || url.password)
|
|
5
|
+
throw new Error("App sign-in requests must stay on this app's origin.");
|
|
6
|
+
if (signal?.aborted)
|
|
7
|
+
throw new DOMException("Sign-in was cancelled.", "AbortError");
|
|
8
|
+
const controller = new AbortController();
|
|
9
|
+
let interrupt;
|
|
10
|
+
const interrupted = new Promise((_resolve, reject) => { interrupt = reject; });
|
|
11
|
+
const abort = () => { controller.abort(); interrupt(new DOMException("Sign-in was cancelled.", "AbortError")); };
|
|
12
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
13
|
+
const timer = window.setTimeout(() => {
|
|
14
|
+
controller.abort();
|
|
15
|
+
interrupt(new Error("Hosty sign-in connection timed out. Please try again."));
|
|
16
|
+
}, 4_000);
|
|
17
|
+
const operation = (async () => {
|
|
18
|
+
const response = await fetch(url.href, { method: "POST", headers: { "Content-Type": "application/json" },
|
|
19
|
+
body: JSON.stringify(proof), credentials: "same-origin", redirect: "error", signal: controller.signal });
|
|
20
|
+
const value = await response.json().catch(() => null);
|
|
21
|
+
const body = value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
22
|
+
return { ok: response.ok, body };
|
|
23
|
+
})();
|
|
24
|
+
try {
|
|
25
|
+
return await Promise.race([operation, interrupted]);
|
|
26
|
+
}
|
|
27
|
+
finally {
|
|
28
|
+
window.clearTimeout(timer);
|
|
29
|
+
signal?.removeEventListener("abort", abort);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
|
|
5
|
+
This license is copied below, and is also available with a FAQ at: https://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
|
|
5
|
+
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/auth-notice.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ButtonHTMLAttributes,
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode } from "react";
|
|
2
2
|
/** Shared SDK chrome for sign-in and renewal, independent of the app's CSS framework. */
|
|
3
|
-
export declare function AuthNotice({ children }: {
|
|
3
|
+
export declare function AuthNotice({ children, busy }: {
|
|
4
4
|
children: ReactNode;
|
|
5
|
+
busy?: boolean;
|
|
5
6
|
}): import("react").JSX.Element;
|
|
6
|
-
export declare function AuthNoticeButton({ secondary,
|
|
7
|
+
export declare function AuthNoticeButton({ secondary, className, ...props }: ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
7
8
|
secondary?: boolean;
|
|
8
9
|
}): import("react").JSX.Element;
|
|
9
|
-
export declare const authNoticeActionStyle: CSSProperties;
|
package/dist/auth-notice.js
CHANGED
|
@@ -1,48 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { SdkBrand, SdkChromeStyles, SdkSpinner } from "./sdk-chrome.js";
|
|
3
4
|
/** Shared SDK chrome for sign-in and renewal, independent of the app's CSS framework. */
|
|
4
|
-
export function AuthNotice({ children }) {
|
|
5
|
-
return
|
|
5
|
+
export function AuthNotice({ children, busy = false }) {
|
|
6
|
+
return _jsxs("div", { "data-hosty-sdk": true, "data-hosty-activity-control": true, className: "hosty-auth-notice", role: "status", "aria-busy": busy, children: [_jsx(SdkChromeStyles, {}), _jsx("style", { children: styles }), _jsx(SdkBrand, {}), busy && _jsx(SdkSpinner, {}), _jsx("div", { className: "hosty-auth-notice-content", children: children })] });
|
|
6
7
|
}
|
|
7
|
-
export function AuthNoticeButton({ secondary = false,
|
|
8
|
-
return _jsx("button", { ...props, type: "button",
|
|
9
|
-
...authNoticeActionStyle,
|
|
10
|
-
...(secondary ? { background: "transparent", color: "#422006", boxShadow: "inset 0 0 0 1px #a16207" } : {}),
|
|
11
|
-
...(disabled ? { opacity: 0.65, cursor: "wait" } : {}),
|
|
12
|
-
} });
|
|
8
|
+
export function AuthNoticeButton({ secondary = false, className = "", ...props }) {
|
|
9
|
+
return _jsx("button", { ...props, type: "button", className: `hosty-sdk-button ${secondary ? "" : "hosty-sdk-primary"} ${className}` });
|
|
13
10
|
}
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
flexWrap: "wrap",
|
|
21
|
-
alignItems: "center",
|
|
22
|
-
justifyContent: "center",
|
|
23
|
-
gap: "12px",
|
|
24
|
-
padding: "12px 16px",
|
|
25
|
-
margin: 0,
|
|
26
|
-
border: 0,
|
|
27
|
-
borderTop: "1px solid #d97706",
|
|
28
|
-
boxSizing: "border-box",
|
|
29
|
-
background: "#fef3c7",
|
|
30
|
-
color: "#422006",
|
|
31
|
-
font: "500 14px/1.4 system-ui, sans-serif",
|
|
32
|
-
textAlign: "center",
|
|
33
|
-
boxShadow: "0 -2px 8px rgba(66,32,6,0.12)",
|
|
34
|
-
};
|
|
35
|
-
export const authNoticeActionStyle = {
|
|
36
|
-
display: "inline-block",
|
|
37
|
-
padding: "6px 14px",
|
|
38
|
-
margin: 0,
|
|
39
|
-
borderRadius: "8px",
|
|
40
|
-
background: "#422006",
|
|
41
|
-
color: "#fffbeb",
|
|
42
|
-
border: "none",
|
|
43
|
-
cursor: "pointer",
|
|
44
|
-
font: "650 14px/1.4 system-ui, sans-serif",
|
|
45
|
-
textDecoration: "none",
|
|
46
|
-
textTransform: "none",
|
|
47
|
-
letterSpacing: "normal",
|
|
48
|
-
};
|
|
11
|
+
const styles = `
|
|
12
|
+
.hosty-auth-notice{position:fixed;inset-inline:12px;bottom:max(12px,env(safe-area-inset-bottom));z-index:2147483647;display:flex;align-items:center;flex-wrap:wrap;gap:12px;box-sizing:border-box;margin:0;padding:12px 16px;border:1px solid var(--hs-warning-border);border-radius:10px;background:var(--hs-card);color:var(--hs-fg);box-shadow:0 4px 14px -4px #0F1B2D29;text-align:left}
|
|
13
|
+
.hosty-auth-notice-content{flex:1;display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;min-width:0}
|
|
14
|
+
.hosty-auth-notice-content>span{flex:1;min-width:min(100%,200px)}
|
|
15
|
+
@media(max-width:480px){.hosty-auth-notice{inset-inline:8px;padding:12px}.hosty-auth-notice-content{flex-basis:100%}}
|
|
16
|
+
`;
|
package/dist/browser-auth.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export type AppActivityConfig = {
|
|
|
56
56
|
probePath?: string;
|
|
57
57
|
activeUntil?: string | null;
|
|
58
58
|
activityRequired?: boolean;
|
|
59
|
-
exchangeCode: (result: AppSignInResult) => Promise<{
|
|
59
|
+
exchangeCode: (result: AppSignInResult, signal?: AbortSignal) => Promise<{
|
|
60
60
|
accessToken?: string;
|
|
61
61
|
activeUntil?: string | null;
|
|
62
62
|
}>;
|
package/dist/browser-auth.js
CHANGED
|
@@ -577,7 +577,7 @@ export function renewAppActivity() {
|
|
|
577
577
|
renewal = popup.then(async (proof) => {
|
|
578
578
|
if (config.appAuthProtocol === 1 && acceptAppAuthProtocol(new URL(config.openUrl).origin, 1) === null)
|
|
579
579
|
config.appAuthProtocol = 2;
|
|
580
|
-
const result = await config.exchangeCode(proof);
|
|
580
|
+
const result = await config.exchangeCode(proof, controller.signal);
|
|
581
581
|
if (controller.signal.aborted || activityConfig !== config || revision !== grantRevision)
|
|
582
582
|
throw new Error("Sign-in was cancelled.");
|
|
583
583
|
if (result.accessToken)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CORE_MARK, CORE_MARK_CELLS } from "./core-mark-geometry.js";
|
|
3
|
+
export { CORE_MARK_CELLS } from "./core-mark-geometry.js";
|
|
4
|
+
export function CoreMark(props) {
|
|
5
|
+
return _jsx("svg", { viewBox: "0 0 100 100", fill: "currentColor", "aria-hidden": "true", focusable: "false", ...props, children: CORE_MARK_CELLS.flatMap((row, y) => [...row].map((cell, x) => cell === "." ? null :
|
|
6
|
+
_jsx("rect", { x: CORE_MARK.plain.inset + x * (CORE_MARK.plain.size + CORE_MARK.plain.gap), y: CORE_MARK.plain.inset + y * (CORE_MARK.plain.size + CORE_MARK.plain.gap), width: CORE_MARK.plain.size, height: CORE_MARK.plain.size, fill: cell === "*" ? CORE_MARK.accent : "currentColor" }, `${x}:${y}`))) });
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Canonical seven-cell platform mark, shared by web chrome and generated brand assets. */
|
|
2
|
+
export declare const CORE_MARK: {
|
|
3
|
+
readonly cells: readonly ["X.X", "X*X", "X.X"];
|
|
4
|
+
readonly accent: "#A3E635";
|
|
5
|
+
readonly plain: {
|
|
6
|
+
readonly size: 22;
|
|
7
|
+
readonly gap: 7;
|
|
8
|
+
readonly inset: 10;
|
|
9
|
+
};
|
|
10
|
+
readonly tile: {
|
|
11
|
+
readonly size: 16;
|
|
12
|
+
readonly gap: 5.5;
|
|
13
|
+
readonly inset: 20.5;
|
|
14
|
+
readonly radius: 22;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare const CORE_MARK_CELLS: readonly ["X.X", "X*X", "X.X"];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Canonical seven-cell platform mark, shared by web chrome and generated brand assets. */
|
|
2
|
+
export const CORE_MARK = {
|
|
3
|
+
cells: ["X.X", "X*X", "X.X"],
|
|
4
|
+
accent: "#A3E635",
|
|
5
|
+
plain: { size: 22, gap: 7, inset: 10 },
|
|
6
|
+
tile: { size: 16, gap: 5.5, inset: 20.5, radius: 22 },
|
|
7
|
+
};
|
|
8
|
+
export const CORE_MARK_CELLS = CORE_MARK.cells;
|
package/dist/install-react.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
4
|
+
import { SdkBrand, SdkChromeStyles, SdkIcon, SdkProgress, SdkSpinner } from "./sdk-chrome.js";
|
|
4
5
|
import { InstallationFlow, openInstallationConfirmation, showInstallationConfirmation, } from "./install.js";
|
|
5
6
|
/** Custom dialogs can use this hook without adopting the default presentation. */
|
|
6
7
|
export function useInstallation(client) {
|
|
@@ -149,9 +150,12 @@ function InstallationSession({ client, source, confirmationWindow, onClose, onCh
|
|
|
149
150
|
return null;
|
|
150
151
|
}
|
|
151
152
|
})();
|
|
152
|
-
|
|
153
|
+
const preparing = busy && (!request || request.status === "draft");
|
|
154
|
+
return _jsxs("dialog", { ref: dialog, "data-hosty-sdk": true, className: "hosty-install", "aria-labelledby": titleId, onCancel: event => { event.preventDefault(); close(); }, children: [_jsx(SdkChromeStyles, {}), _jsx("style", { children: styles }), _jsxs("header", { children: [_jsxs("div", { children: [_jsx(SdkBrand, {}), _jsx("h2", { id: titleId, children: "Install app" })] }), _jsx("button", { type: "button", className: "hosty-sdk-button hosty-sdk-ghost hosty-sdk-icon-button", onClick: close, "aria-label": "Close installation", children: _jsx(SdkIcon, { name: "close" }) })] }), !hasSource && !request && _jsxs("form", { onSubmit: event => { event.preventDefault(); void install(); }, children: [_jsx("p", { className: "hosty-install-description", children: "Hosty reads the manifest and prepares a request. Review runtime, startup and permissions in Core." }), _jsxs("label", { children: ["Manifest, app directory, or URL", _jsx("input", { className: "hosty-sdk-input", value: manifestPath, onChange: event => setManifestPath(event.target.value), required: true, disabled: busy })] }), _jsx("button", { className: "hosty-sdk-button hosty-sdk-primary", disabled: busy || !manifestPath.trim(), children: "Install" })] }), preparing && _jsxs("section", { className: "hosty-install-state", role: "status", "aria-busy": "true", children: [_jsxs("p", { className: "hosty-sdk-status", children: [_jsx(SdkSpinner, {}), "Preparing Core confirmation\u2026"] }), _jsx(SdkProgress, { label: "Preparing Core confirmation" })] }), (error || presentationError) && _jsxs("div", { className: "hosty-install-error", role: "alert", children: [_jsxs("p", { children: [_jsx(SdkIcon, { name: "error" }), _jsx("span", { children: error || presentationError })] }), _jsxs("div", { className: "hosty-install-actions", children: [(!frozen || uncertainSubmit) && _jsx("button", { type: "button", className: "hosty-sdk-button", disabled: busy, onClick: () => void retry(), children: uncertainSubmit ? "Check request status" : "Retry" }), !frozen && onChooseSource && _jsx("button", { type: "button", className: "hosty-sdk-button hosty-sdk-ghost", disabled: busy, onClick: () => { closeUnusedPopup(); onChooseSource(); }, children: "Change source" })] })] }), uncertainSubmit && _jsx("p", { className: "hosty-install-description", role: "status", children: "Core may have received this request. Check its status before continuing." }), request && request.status !== "draft" && _jsxs("section", { className: "hosty-install-state", "data-state": request.status, role: "status", "aria-busy": request.status === "executing", children: [request.status === "executing" ? _jsx(SdkSpinner, {}) : _jsx("span", { className: "hosty-install-state-icon", children: _jsx(SdkIcon, { name: request.status === "pending" ? "external" : request.status === "succeeded" ? "check" : request.status === "denied" ? "close" : "error" }) }), _jsx("h3", { children: request.status === "pending" ? "Confirm in Hosty Core" : request.status === "executing" ? "Installing app" : request.status === "succeeded" ? "App installed" : request.status === "denied" ? "Installation cancelled" : "Installation failed" }), _jsx("p", { children: request.status === "pending" ? "Confirm runtime, automatic startup and permissions in Hosty Core." : request.status === "executing" ? "Core is installing your app…" : request.status === "succeeded" ? "App installed." : request.status === "denied" ? "Installation cancelled." : "Installation failed. Close this dialog to begin a new request." }), request.status === "executing" && _jsx(SdkProgress, { label: "Installing app" }), confirmationUrl && _jsxs("a", { className: "hosty-sdk-button", href: confirmationUrl, target: "_blank", rel: "noopener noreferrer", children: [_jsx(SdkIcon, { name: "external" }), "Open Core confirmation"] }), request.status === "succeeded" && _jsx("p", { className: "hosty-install-description", children: "Open Apps to check configuration and runtime status." }), _jsx("p", { children: _jsx("small", { children: "Closing this dialog does not cancel an operation already confirmed in Core." }) }), ["succeeded", "denied", "failed"].includes(request.status) && _jsx("button", { type: "button", className: "hosty-sdk-button hosty-sdk-primary", onClick: close, children: "Done" })] })] });
|
|
153
155
|
}
|
|
154
156
|
const styles = `
|
|
155
|
-
.hosty-install{box-sizing:border-box;width:min(
|
|
156
|
-
.hosty-install::backdrop{background:#
|
|
157
|
+
.hosty-install{box-sizing:border-box;width:min(440px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:24px;border:1px solid var(--hs-border);border-radius:14px;background:var(--hs-card);color:var(--hs-fg);overflow:auto;margin:auto;box-shadow:0 14px 34px -8px #0F1B2D3D}
|
|
158
|
+
.hosty-install::backdrop{background:#0F1B2D57}.hosty-install>header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:20px}.hosty-install header .hosty-sdk-brand{margin-bottom:8px}.hosty-install h2{font:600 20px/26px var(--hs-font);letter-spacing:-.02em;margin:0}.hosty-install h3{font:600 16px/22px var(--hs-font);margin:0}.hosty-install p{margin:0;font-size:14px;line-height:22px;color:var(--hs-muted)}.hosty-install small{font-size:12px;line-height:18px}.hosty-install form{display:flex;flex-direction:column;gap:16px}.hosty-install label{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:500}.hosty-install input.hosty-sdk-input{font-family:var(--hs-mono);font-size:13px}
|
|
159
|
+
.hosty-install-state{display:flex;flex-direction:column;align-items:flex-start;gap:12px}.hosty-install-state>.hosty-sdk-button{align-self:stretch}.hosty-install-state-icon{display:grid;place-items:center;width:36px;height:36px;border-radius:50%;background:var(--hs-danger-soft);color:var(--hs-danger)}.hosty-install-state[data-state=pending]>.hosty-install-state-icon{background:var(--hs-warning-soft);color:var(--hs-warning)}.hosty-install-state[data-state=succeeded]>.hosty-install-state-icon{background:var(--hs-success-soft);color:var(--hs-success)}.hosty-install-state[data-state=denied]>.hosty-install-state-icon{background:var(--hs-soft);color:var(--hs-muted)}.hosty-install-state[data-state=executing]>.hosty-sdk-spinner{width:24px;height:24px}.hosty-install .hosty-install-error{margin:16px 0;padding:12px;border-radius:10px;background:var(--hs-danger-soft)}.hosty-install-error>p{display:flex;align-items:flex-start;gap:8px;overflow-wrap:anywhere;color:var(--hs-danger)}.hosty-install-error svg{margin-top:3px}.hosty-install-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}.hosty-install>.hosty-install-description{margin:12px 0}
|
|
160
|
+
@media(max-width:480px){.hosty-install{padding:20px}.hosty-install input.hosty-sdk-input{font-size:16px}}
|
|
157
161
|
`;
|