@ethisyscore/plugin-ui 1.27.1 → 1.30.0
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/index.cjs +23 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,20 @@
|
|
|
3
3
|
var plugin = require('@ethisyscore/extension-runtime/plugin');
|
|
4
4
|
var componentsReact = require('@ethisyscore/components-react');
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/index.ts
|
|
7
|
+
function useCurrentUser() {
|
|
8
|
+
const identity = plugin.useHostIdentity();
|
|
9
|
+
const user = identity?.user ?? null;
|
|
10
|
+
if (!user) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
id: user.id,
|
|
15
|
+
// The host binds `fullName`; fall back to composing first + last so a host
|
|
16
|
+
// that only sets the parts still yields a usable display name.
|
|
17
|
+
displayName: user.fullName?.trim() || `${user.firstName ?? ""} ${user.lastName ?? ""}`.trim()
|
|
18
|
+
};
|
|
19
|
+
}
|
|
7
20
|
|
|
8
21
|
Object.defineProperty(exports, "BridgeClientContext", {
|
|
9
22
|
enumerable: true,
|
|
@@ -13,6 +26,10 @@ Object.defineProperty(exports, "ExtensionRuntimeProvider", {
|
|
|
13
26
|
enumerable: true,
|
|
14
27
|
get: function () { return plugin.ExtensionRuntimeProvider; }
|
|
15
28
|
});
|
|
29
|
+
Object.defineProperty(exports, "HostIdentityContext", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return plugin.HostIdentityContext; }
|
|
32
|
+
});
|
|
16
33
|
Object.defineProperty(exports, "createPortBridgeClient", {
|
|
17
34
|
enumerable: true,
|
|
18
35
|
get: function () { return plugin.createPortBridgeClient; }
|
|
@@ -33,6 +50,10 @@ Object.defineProperty(exports, "useBridgeTheme", {
|
|
|
33
50
|
enumerable: true,
|
|
34
51
|
get: function () { return plugin.useBridgeTheme; }
|
|
35
52
|
});
|
|
53
|
+
Object.defineProperty(exports, "useHostIdentity", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () { return plugin.useHostIdentity; }
|
|
56
|
+
});
|
|
36
57
|
Object.defineProperty(exports, "useMcpQuery", {
|
|
37
58
|
enumerable: true,
|
|
38
59
|
get: function () { return plugin.useMcpQuery; }
|
|
@@ -53,5 +74,6 @@ Object.defineProperty(exports, "emitNavigation", {
|
|
|
53
74
|
enumerable: true,
|
|
54
75
|
get: function () { return componentsReact.emitNavigation; }
|
|
55
76
|
});
|
|
77
|
+
exports.useCurrentUser = useCurrentUser;
|
|
56
78
|
//# sourceMappingURL=index.cjs.map
|
|
57
79
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs","sourcesContent":[]}
|
|
1
|
+
{"version":3,"sources":["../src/currentUser.ts"],"names":["useHostIdentity"],"mappings":";;;;;;AAiDO,SAAS,cAAA,GAAqC;AACnD,EAAA,MAAM,WAAWA,sBAAA,EAAgB;AACjC,EAAA,MAAM,IAAA,GAAO,UAAU,IAAA,IAAQ,IAAA;AAC/B,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,OAAO;AAAA,IACL,IAAI,IAAA,CAAK,EAAA;AAAA;AAAA;AAAA,IAGT,WAAA,EACE,IAAA,CAAK,QAAA,EAAU,IAAA,MAAU,CAAA,EAAG,IAAA,CAAK,SAAA,IAAa,EAAE,CAAA,CAAA,EAAI,IAAA,CAAK,QAAA,IAAY,EAAE,GAAG,IAAA;AAAK,GACnF;AACF","file":"index.cjs","sourcesContent":["/**\n * `useCurrentUser` — the display-only current-user hook for plugin frontends\n * (WI 5154 follow-up #2, plugin-ui host-identity).\n *\n * A plugin page often needs the signed-in user for UX bits — a \"you are signed\n * in as …\" hint, pre-selecting the caller in a sign-off panel, or a\n * \"my acknowledgements\" heading. This hook surfaces that identity from the\n * host without the plugin importing the lower-level {@link useHostIdentity}\n * seam directly.\n *\n * It is a thin adapter over the host-provided {@link HostIdentity} context\n * (bound by the host through `ExtensionRuntimeProvider`'s `identity` prop):\n * it projects the host's richer {@link HostIdentityUser} down to the minimal\n * `{ id, displayName }` shape a plugin page needs for display.\n *\n * ⚠️ SECURITY — DISPLAY ONLY. This is presentation/UX data, NOT an\n * authorization source. Authorization is enforced HOST-SIDE at the MCP\n * boundary: the plugin backend re-authorises every tool/resource call from the\n * trusted server session. Never gate a mutation or a data read on this value.\n *\n * Returns `null` when the host has not provided an identity — standalone / mock\n * hosts, a host that predates the identity seam, or while host auth is still\n * loading or the caller is unauthenticated. Callers MUST handle `null`\n * (this matches the pre-existing plugin `useAuth().user` shim, which returned\n * `undefined`, so adopting this hook is a no-regression change).\n */\nimport { useHostIdentity } from \"@ethisyscore/extension-runtime/plugin\";\n\n/**\n * Minimal current-user shape a plugin page reads for display. Mirrors the\n * identity the host authenticates: a stable `id` and a human-readable\n * `displayName`. (No email — the host identity seam does not currently\n * forward one; if that changes, extend {@link HostIdentityUser} first and\n * project it here.)\n */\nexport interface CurrentUser {\n /** Stable user id (matches the host's authenticated caller id). */\n id: string;\n /** Human-readable display name (the host's full name). */\n displayName: string;\n}\n\n/**\n * Returns the host-authenticated current user projected to the display-only\n * {@link CurrentUser} shape, or `null` when no host identity is available.\n *\n * Display-only — see the module doc: authorization stays host-enforced at the\n * MCP boundary. Do NOT use the returned value as an authorization decision.\n */\nexport function useCurrentUser(): CurrentUser | null {\n const identity = useHostIdentity();\n const user = identity?.user ?? null;\n if (!user) {\n return null;\n }\n return {\n id: user.id,\n // The host binds `fullName`; fall back to composing first + last so a host\n // that only sets the parts still yields a usable display name.\n displayName:\n user.fullName?.trim() || `${user.firstName ?? \"\"} ${user.lastName ?? \"\"}`.trim(),\n };\n}\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,2 +1,26 @@
|
|
|
1
|
-
export { A11yPayload, BridgeClientContext, BridgePortShim, DensityPayload, ExtensionRuntimeProvider, ExtensionRuntimeProviderProps, ItemsResponse, LocalePayload, McpTransport, NavPayload, PortBridgeClient, SessionTokenPayload, ThemePayload, UseMcpQueryOptions, UseMcpQueryResult, UseMcpResourceOptions, UseMcpResourceResult, UseMcpToolOptions, UseMcpToolResult, createPortBridgeClient, unwrapItems, useBridgeClient, useBridgeLocale, useBridgeTheme, useMcpQuery, useMcpResource, useMcpTool } from '@ethisyscore/extension-runtime/plugin';
|
|
1
|
+
export { A11yPayload, BridgeClientContext, BridgePortShim, DensityPayload, ExtensionRuntimeProvider, ExtensionRuntimeProviderProps, HostIdentity, HostIdentityContext, HostIdentityUser, HostPermission, ItemsResponse, LocalePayload, McpTransport, NavPayload, PortBridgeClient, SessionTokenPayload, ThemePayload, UseMcpQueryOptions, UseMcpQueryResult, UseMcpResourceOptions, UseMcpResourceResult, UseMcpToolOptions, UseMcpToolResult, createPortBridgeClient, unwrapItems, useBridgeClient, useBridgeLocale, useBridgeTheme, useHostIdentity, useMcpQuery, useMcpResource, useMcpTool } from '@ethisyscore/extension-runtime/plugin';
|
|
2
2
|
export { PlatformReactPageProps, definePlatformReactPage, emitNavigation } from '@ethisyscore/components-react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Minimal current-user shape a plugin page reads for display. Mirrors the
|
|
6
|
+
* identity the host authenticates: a stable `id` and a human-readable
|
|
7
|
+
* `displayName`. (No email — the host identity seam does not currently
|
|
8
|
+
* forward one; if that changes, extend {@link HostIdentityUser} first and
|
|
9
|
+
* project it here.)
|
|
10
|
+
*/
|
|
11
|
+
interface CurrentUser {
|
|
12
|
+
/** Stable user id (matches the host's authenticated caller id). */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Human-readable display name (the host's full name). */
|
|
15
|
+
displayName: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns the host-authenticated current user projected to the display-only
|
|
19
|
+
* {@link CurrentUser} shape, or `null` when no host identity is available.
|
|
20
|
+
*
|
|
21
|
+
* Display-only — see the module doc: authorization stays host-enforced at the
|
|
22
|
+
* MCP boundary. Do NOT use the returned value as an authorization decision.
|
|
23
|
+
*/
|
|
24
|
+
declare function useCurrentUser(): CurrentUser | null;
|
|
25
|
+
|
|
26
|
+
export { type CurrentUser, useCurrentUser };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,26 @@
|
|
|
1
|
-
export { A11yPayload, BridgeClientContext, BridgePortShim, DensityPayload, ExtensionRuntimeProvider, ExtensionRuntimeProviderProps, ItemsResponse, LocalePayload, McpTransport, NavPayload, PortBridgeClient, SessionTokenPayload, ThemePayload, UseMcpQueryOptions, UseMcpQueryResult, UseMcpResourceOptions, UseMcpResourceResult, UseMcpToolOptions, UseMcpToolResult, createPortBridgeClient, unwrapItems, useBridgeClient, useBridgeLocale, useBridgeTheme, useMcpQuery, useMcpResource, useMcpTool } from '@ethisyscore/extension-runtime/plugin';
|
|
1
|
+
export { A11yPayload, BridgeClientContext, BridgePortShim, DensityPayload, ExtensionRuntimeProvider, ExtensionRuntimeProviderProps, HostIdentity, HostIdentityContext, HostIdentityUser, HostPermission, ItemsResponse, LocalePayload, McpTransport, NavPayload, PortBridgeClient, SessionTokenPayload, ThemePayload, UseMcpQueryOptions, UseMcpQueryResult, UseMcpResourceOptions, UseMcpResourceResult, UseMcpToolOptions, UseMcpToolResult, createPortBridgeClient, unwrapItems, useBridgeClient, useBridgeLocale, useBridgeTheme, useHostIdentity, useMcpQuery, useMcpResource, useMcpTool } from '@ethisyscore/extension-runtime/plugin';
|
|
2
2
|
export { PlatformReactPageProps, definePlatformReactPage, emitNavigation } from '@ethisyscore/components-react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Minimal current-user shape a plugin page reads for display. Mirrors the
|
|
6
|
+
* identity the host authenticates: a stable `id` and a human-readable
|
|
7
|
+
* `displayName`. (No email — the host identity seam does not currently
|
|
8
|
+
* forward one; if that changes, extend {@link HostIdentityUser} first and
|
|
9
|
+
* project it here.)
|
|
10
|
+
*/
|
|
11
|
+
interface CurrentUser {
|
|
12
|
+
/** Stable user id (matches the host's authenticated caller id). */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Human-readable display name (the host's full name). */
|
|
15
|
+
displayName: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns the host-authenticated current user projected to the display-only
|
|
19
|
+
* {@link CurrentUser} shape, or `null` when no host identity is available.
|
|
20
|
+
*
|
|
21
|
+
* Display-only — see the module doc: authorization stays host-enforced at the
|
|
22
|
+
* MCP boundary. Do NOT use the returned value as an authorization decision.
|
|
23
|
+
*/
|
|
24
|
+
declare function useCurrentUser(): CurrentUser | null;
|
|
25
|
+
|
|
26
|
+
export { type CurrentUser, useCurrentUser };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import { useHostIdentity } from '@ethisyscore/extension-runtime/plugin';
|
|
2
|
+
export { BridgeClientContext, ExtensionRuntimeProvider, HostIdentityContext, createPortBridgeClient, unwrapItems, useBridgeClient, useBridgeLocale, useBridgeTheme, useHostIdentity, useMcpQuery, useMcpResource, useMcpTool } from '@ethisyscore/extension-runtime/plugin';
|
|
2
3
|
export { definePlatformReactPage, emitNavigation } from '@ethisyscore/components-react';
|
|
4
|
+
|
|
5
|
+
// src/index.ts
|
|
6
|
+
function useCurrentUser() {
|
|
7
|
+
const identity = useHostIdentity();
|
|
8
|
+
const user = identity?.user ?? null;
|
|
9
|
+
if (!user) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
id: user.id,
|
|
14
|
+
// The host binds `fullName`; fall back to composing first + last so a host
|
|
15
|
+
// that only sets the parts still yields a usable display name.
|
|
16
|
+
displayName: user.fullName?.trim() || `${user.firstName ?? ""} ${user.lastName ?? ""}`.trim()
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { useCurrentUser };
|
|
3
21
|
//# sourceMappingURL=index.js.map
|
|
4
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
|
|
1
|
+
{"version":3,"sources":["../src/currentUser.ts"],"names":[],"mappings":";;;;;AAiDO,SAAS,cAAA,GAAqC;AACnD,EAAA,MAAM,WAAW,eAAA,EAAgB;AACjC,EAAA,MAAM,IAAA,GAAO,UAAU,IAAA,IAAQ,IAAA;AAC/B,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,OAAO;AAAA,IACL,IAAI,IAAA,CAAK,EAAA;AAAA;AAAA;AAAA,IAGT,WAAA,EACE,IAAA,CAAK,QAAA,EAAU,IAAA,MAAU,CAAA,EAAG,IAAA,CAAK,SAAA,IAAa,EAAE,CAAA,CAAA,EAAI,IAAA,CAAK,QAAA,IAAY,EAAE,GAAG,IAAA;AAAK,GACnF;AACF","file":"index.js","sourcesContent":["/**\n * `useCurrentUser` — the display-only current-user hook for plugin frontends\n * (WI 5154 follow-up #2, plugin-ui host-identity).\n *\n * A plugin page often needs the signed-in user for UX bits — a \"you are signed\n * in as …\" hint, pre-selecting the caller in a sign-off panel, or a\n * \"my acknowledgements\" heading. This hook surfaces that identity from the\n * host without the plugin importing the lower-level {@link useHostIdentity}\n * seam directly.\n *\n * It is a thin adapter over the host-provided {@link HostIdentity} context\n * (bound by the host through `ExtensionRuntimeProvider`'s `identity` prop):\n * it projects the host's richer {@link HostIdentityUser} down to the minimal\n * `{ id, displayName }` shape a plugin page needs for display.\n *\n * ⚠️ SECURITY — DISPLAY ONLY. This is presentation/UX data, NOT an\n * authorization source. Authorization is enforced HOST-SIDE at the MCP\n * boundary: the plugin backend re-authorises every tool/resource call from the\n * trusted server session. Never gate a mutation or a data read on this value.\n *\n * Returns `null` when the host has not provided an identity — standalone / mock\n * hosts, a host that predates the identity seam, or while host auth is still\n * loading or the caller is unauthenticated. Callers MUST handle `null`\n * (this matches the pre-existing plugin `useAuth().user` shim, which returned\n * `undefined`, so adopting this hook is a no-regression change).\n */\nimport { useHostIdentity } from \"@ethisyscore/extension-runtime/plugin\";\n\n/**\n * Minimal current-user shape a plugin page reads for display. Mirrors the\n * identity the host authenticates: a stable `id` and a human-readable\n * `displayName`. (No email — the host identity seam does not currently\n * forward one; if that changes, extend {@link HostIdentityUser} first and\n * project it here.)\n */\nexport interface CurrentUser {\n /** Stable user id (matches the host's authenticated caller id). */\n id: string;\n /** Human-readable display name (the host's full name). */\n displayName: string;\n}\n\n/**\n * Returns the host-authenticated current user projected to the display-only\n * {@link CurrentUser} shape, or `null` when no host identity is available.\n *\n * Display-only — see the module doc: authorization stays host-enforced at the\n * MCP boundary. Do NOT use the returned value as an authorization decision.\n */\nexport function useCurrentUser(): CurrentUser | null {\n const identity = useHostIdentity();\n const user = identity?.user ?? null;\n if (!user) {\n return null;\n }\n return {\n id: user.id,\n // The host binds `fullName`; fall back to composing first + last so a host\n // that only sets the parts still yields a usable display name.\n displayName:\n user.fullName?.trim() || `${user.firstName ?? \"\"} ${user.lastName ?? \"\"}`.trim(),\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethisyscore/plugin-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"description": "Plugin-UI umbrella SDK: client bridge + a11y/l10n primitives + brokered-MCP client (WI 4858).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"lint": "tsc --noEmit"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@ethisyscore/components-react": "^1.
|
|
80
|
+
"@ethisyscore/components-react": "^1.27.0",
|
|
81
81
|
"@ethisyscore/extension-runtime": "^1.27.0"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|