@ethisyscore/plugin-ui 1.88.1 → 1.88.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/dist/platform-react/index.cjs +39 -9
- package/dist/platform-react/index.cjs.map +1 -1
- package/dist/platform-react/index.d.cts +12 -6
- package/dist/platform-react/index.d.ts +12 -6
- package/dist/platform-react/index.js +14 -3
- package/dist/platform-react/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,11 +3,31 @@
|
|
|
3
3
|
var react = require('react');
|
|
4
4
|
var reactQuery = require('@tanstack/react-query');
|
|
5
5
|
var componentsReact = require('@ethisyscore/components-react');
|
|
6
|
-
var
|
|
6
|
+
var extensionRuntime = require('@ethisyscore/extension-runtime/plugin');
|
|
7
7
|
var material = require('@mui/material');
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
var orgFormat = require('@ethisyscore/core-utils/date/org-format');
|
|
10
10
|
|
|
11
|
+
function _interopNamespace(e) {
|
|
12
|
+
if (e && e.__esModule) return e;
|
|
13
|
+
var n = Object.create(null);
|
|
14
|
+
if (e) {
|
|
15
|
+
Object.keys(e).forEach(function (k) {
|
|
16
|
+
if (k !== 'default') {
|
|
17
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return e[k]; }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
n.default = e;
|
|
26
|
+
return Object.freeze(n);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var extensionRuntime__namespace = /*#__PURE__*/_interopNamespace(extensionRuntime);
|
|
30
|
+
|
|
11
31
|
// src/platform-react/definePlatformReactPluginPage.tsx
|
|
12
32
|
var TemplateContext = react.createContext(null);
|
|
13
33
|
function injectPluginStyles(id, css) {
|
|
@@ -67,7 +87,7 @@ function buildSurfaceUrl(base, sub = "", suffix = "") {
|
|
|
67
87
|
}
|
|
68
88
|
function useSurfaceUrl() {
|
|
69
89
|
const ctx = react.useContext(SurfaceBaseContext);
|
|
70
|
-
const identity =
|
|
90
|
+
const identity = extensionRuntime.useHostIdentity();
|
|
71
91
|
return (sub = "", suffix = "") => {
|
|
72
92
|
const resolved = resolveSurfaceBase({
|
|
73
93
|
basePath: ctx?.basePath,
|
|
@@ -150,10 +170,20 @@ function PluginPortalScope({ children }) {
|
|
|
150
170
|
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: setContainer, className: EHX_PLUGIN_PORTAL_CLASS, ...{ [EHX_PLUGIN_PORTAL_ATTR]: "" } })
|
|
151
171
|
] });
|
|
152
172
|
}
|
|
173
|
+
var warnedAboutMissingAccessor = false;
|
|
174
|
+
var useOptionalExtensionRuntimeTransport2 = typeof extensionRuntime__namespace.useOptionalExtensionRuntimeTransport === "function" ? extensionRuntime__namespace.useOptionalExtensionRuntimeTransport : () => {
|
|
175
|
+
if (!warnedAboutMissingAccessor) {
|
|
176
|
+
warnedAboutMissingAccessor = true;
|
|
177
|
+
console.warn(
|
|
178
|
+
"[plugin-ui] The host realm does not expose useOptionalExtensionRuntimeTransport (host SDK predates 1.88.0). Organisation date/time formats fall back to the UK default for this bundle. Bump the host's @ethisyscore/extension-runtime pin to restore them."
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
return null;
|
|
182
|
+
};
|
|
153
183
|
var ORGANISATION_SETTINGS_URI = "ethisys:organisation-settings";
|
|
154
184
|
function useOrgFormatSync() {
|
|
155
|
-
const transport =
|
|
156
|
-
const organisationId =
|
|
185
|
+
const transport = useOptionalExtensionRuntimeTransport2();
|
|
186
|
+
const organisationId = extensionRuntime__namespace.useHostIdentity()?.organisationId ?? null;
|
|
157
187
|
const [, bumpVersion] = react.useState(0);
|
|
158
188
|
react.useEffect(() => {
|
|
159
189
|
orgFormat.setOrgFormats(null, null);
|
|
@@ -309,12 +339,12 @@ function notViaMcp(serviceName, method) {
|
|
|
309
339
|
throw new Error(`${serviceName}.${method} has no MCP tool \u2014 pending per-surface aggregation.`);
|
|
310
340
|
}
|
|
311
341
|
function useToolInvoker(toolName) {
|
|
312
|
-
return
|
|
342
|
+
return extensionRuntime.useMcpTool(toolName).invoke;
|
|
313
343
|
}
|
|
314
344
|
function useToolInvokerMap(tools) {
|
|
315
345
|
const invokers = {};
|
|
316
346
|
for (const name of tools) {
|
|
317
|
-
invokers[name] =
|
|
347
|
+
invokers[name] = extensionRuntime.useMcpTool(name).invoke;
|
|
318
348
|
}
|
|
319
349
|
return react.useMemo(
|
|
320
350
|
() => (name, args) => {
|
|
@@ -425,7 +455,7 @@ function createReactRouterShim(options = {}) {
|
|
|
425
455
|
}
|
|
426
456
|
function useParams() {
|
|
427
457
|
const ctx = react.useContext(SurfaceBaseContext);
|
|
428
|
-
const identity =
|
|
458
|
+
const identity = extensionRuntime.useHostIdentity();
|
|
429
459
|
const resolved = resolveSurfaceBase({
|
|
430
460
|
basePath: ctx?.basePath,
|
|
431
461
|
pageId: ctx?.pageId,
|
|
@@ -496,7 +526,7 @@ function createReactRouterShim(options = {}) {
|
|
|
496
526
|
return { useNavigate, useParams, useSearchParams, useMatch, useLocation, Link, NavLink: Link };
|
|
497
527
|
}
|
|
498
528
|
function usePluginRealtime(typeCode, handler) {
|
|
499
|
-
const source =
|
|
529
|
+
const source = extensionRuntime.usePluginRealtimeSource();
|
|
500
530
|
const ref = react.useRef(handler);
|
|
501
531
|
ref.current = handler;
|
|
502
532
|
react.useEffect(() => {
|
|
@@ -506,7 +536,7 @@ function usePluginRealtime(typeCode, handler) {
|
|
|
506
536
|
}
|
|
507
537
|
var DEFAULT_MAX_UPLOAD_BYTES = 30 * 1024 * 1024;
|
|
508
538
|
function useMcpUpload(opts) {
|
|
509
|
-
const transport =
|
|
539
|
+
const transport = extensionRuntime.useExtensionRuntimeTransport(opts?.transport);
|
|
510
540
|
const maxSizeBytes = opts?.maxSizeBytes ?? DEFAULT_MAX_UPLOAD_BYTES;
|
|
511
541
|
const [progress, setProgress] = react.useState(0);
|
|
512
542
|
const [loading, setLoading] = react.useState(false);
|