@ethisyscore/plugin-ui 1.88.0 → 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.
@@ -315,12 +315,18 @@ declare const ORGANISATION_SETTINGS_URI = "ethisys:organisation-settings";
315
315
  * effect is also keyed on the active organisation id, so switching organisation
316
316
  * without a remount refetches.
317
317
  *
318
- * Fails open. It resolves the transport via the OPTIONAL accessor (not
319
- * `useMcpResource`, which throws when no provider is present) so a surface that
320
- * renders without a host transport — a standalone/mock-mode run or an isolated
321
- * unit test — degrades to a no-op and the formatters use the UK fallback, rather
322
- * than crashing the page. On a rejected/failed fetch the refs are reset to the UK
323
- * fallback rather than left holding a previous organisation's format.
318
+ * Fails open in both directions, which is two distinct cases:
319
+ *
320
+ * - No TRANSPORT. It resolves the transport via the OPTIONAL accessor (not
321
+ * `useMcpResource`, which throws when no provider is present) so a surface that
322
+ * renders without a host transport — a standalone/mock-mode run or an isolated
323
+ * unit test — degrades to a no-op and the formatters use the UK fallback.
324
+ * - No ACCESSOR. A host realm older than SDK 1.88.0 does not expose the accessor
325
+ * at all; see the module-scope resolution above for why an import binding
326
+ * cannot be relied on here and what it cost when it was.
327
+ *
328
+ * On a rejected/failed fetch the refs are reset to the UK fallback rather than
329
+ * left holding a previous organisation's format.
324
330
  */
325
331
  declare function useOrgFormatSync(): void;
326
332
 
@@ -315,12 +315,18 @@ declare const ORGANISATION_SETTINGS_URI = "ethisys:organisation-settings";
315
315
  * effect is also keyed on the active organisation id, so switching organisation
316
316
  * without a remount refetches.
317
317
  *
318
- * Fails open. It resolves the transport via the OPTIONAL accessor (not
319
- * `useMcpResource`, which throws when no provider is present) so a surface that
320
- * renders without a host transport — a standalone/mock-mode run or an isolated
321
- * unit test — degrades to a no-op and the formatters use the UK fallback, rather
322
- * than crashing the page. On a rejected/failed fetch the refs are reset to the UK
323
- * fallback rather than left holding a previous organisation's format.
318
+ * Fails open in both directions, which is two distinct cases:
319
+ *
320
+ * - No TRANSPORT. It resolves the transport via the OPTIONAL accessor (not
321
+ * `useMcpResource`, which throws when no provider is present) so a surface that
322
+ * renders without a host transport — a standalone/mock-mode run or an isolated
323
+ * unit test — degrades to a no-op and the formatters use the UK fallback.
324
+ * - No ACCESSOR. A host realm older than SDK 1.88.0 does not expose the accessor
325
+ * at all; see the module-scope resolution above for why an import binding
326
+ * cannot be relied on here and what it cost when it was.
327
+ *
328
+ * On a rejected/failed fetch the refs are reset to the UK fallback rather than
329
+ * left holding a previous organisation's format.
324
330
  */
325
331
  declare function useOrgFormatSync(): void;
326
332
 
@@ -1,7 +1,8 @@
1
1
  import { createContext, useEffect, useContext, useState, useMemo, createElement, useRef, useCallback, useSyncExternalStore } from 'react';
2
2
  import { QueryClient, useQuery, useQueries, QueryClientProvider } from '@tanstack/react-query';
3
3
  import { definePlatformReactPage, emitNavigation } from '@ethisyscore/components-react';
4
- import { useHostIdentity, useOptionalExtensionRuntimeTransport, useMcpTool, usePluginRealtimeSource, useExtensionRuntimeTransport } from '@ethisyscore/extension-runtime/plugin';
4
+ import * as extensionRuntime from '@ethisyscore/extension-runtime/plugin';
5
+ import { useHostIdentity, useMcpTool, usePluginRealtimeSource, useExtensionRuntimeTransport } from '@ethisyscore/extension-runtime/plugin';
5
6
  import { useTheme, ThemeProvider } from '@mui/material';
6
7
  import { jsxs, jsx } from 'react/jsx-runtime';
7
8
  import { setOrgFormats } from '@ethisyscore/core-utils/date/org-format';
@@ -148,10 +149,20 @@ function PluginPortalScope({ children }) {
148
149
  /* @__PURE__ */ jsx("div", { ref: setContainer, className: EHX_PLUGIN_PORTAL_CLASS, ...{ [EHX_PLUGIN_PORTAL_ATTR]: "" } })
149
150
  ] });
150
151
  }
152
+ var warnedAboutMissingAccessor = false;
153
+ var useOptionalExtensionRuntimeTransport2 = typeof extensionRuntime.useOptionalExtensionRuntimeTransport === "function" ? extensionRuntime.useOptionalExtensionRuntimeTransport : () => {
154
+ if (!warnedAboutMissingAccessor) {
155
+ warnedAboutMissingAccessor = true;
156
+ console.warn(
157
+ "[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."
158
+ );
159
+ }
160
+ return null;
161
+ };
151
162
  var ORGANISATION_SETTINGS_URI = "ethisys:organisation-settings";
152
163
  function useOrgFormatSync() {
153
- const transport = useOptionalExtensionRuntimeTransport();
154
- const organisationId = useHostIdentity()?.organisationId ?? null;
164
+ const transport = useOptionalExtensionRuntimeTransport2();
165
+ const organisationId = extensionRuntime.useHostIdentity()?.organisationId ?? null;
155
166
  const [, bumpVersion] = useState(0);
156
167
  useEffect(() => {
157
168
  setOrgFormats(null, null);