@wippy-fe/types-global-proxy 0.0.27 → 0.0.28

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.
Files changed (2) hide show
  1. package/index.d.ts +61 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -115,9 +115,16 @@ type HostFloatingDef = HostOverlayContent & HostOverlayBase & {
115
115
  /**
116
116
  * Modal def — centered overlay. Size is either a single `ModalSize`
117
117
  * or a breakpoint-keyed map (desktop centered / mobile fullscreen).
118
+ *
119
+ * `useNativeDialog` defaults to `true` — the modal renders via
120
+ * `<dialog showModal()>` (top-layer stacking, focus trap, inert
121
+ * propagation). Set `false` to opt back into the legacy div-overlay
122
+ * implementation while consumers migrate; the legacy path is
123
+ * `@deprecated` and will be removed in the next major.
118
124
  */
119
125
  type HostModalDef = HostOverlayContent & HostOverlayBase & {
120
126
  size?: ModalSize | Record<string, ModalSize>;
127
+ useNativeDialog?: boolean;
121
128
  };
122
129
  /**
123
130
  * Coordinator def — headless coordinator app. Same content kinds as
@@ -449,6 +456,19 @@ interface HostConfig {
449
456
  * Ignored by `iframe.html` / `chat-iframe.html` shells.
450
457
  */
451
458
  layout?: HostLayoutDeclaration;
459
+ /**
460
+ * Lazy WebSocket connection: defer the WS handshake until the first
461
+ * `useSubscription()` registers, and disconnect when the last
462
+ * subscriber unmounts. Saves a connection (and the matching server
463
+ * resource) for shells that don't actually consume push events at
464
+ * boot — chat-only iframes and panels that page through artifacts
465
+ * via REST.
466
+ *
467
+ * Apps that call `wsClient.sendMessage(...)` directly without
468
+ * subscribing first should NOT enable this — sendMessage will throw
469
+ * "WebSocket is not connected". Default is `false` (eager connect).
470
+ */
471
+ lazyWS?: boolean;
452
472
  }
453
473
  interface AppContext {
454
474
  resourceId: string;
@@ -1025,6 +1045,19 @@ interface LayoutApi {
1025
1045
  * top-level fields replace wholesale.
1026
1046
  */
1027
1047
  updatePanel: (panelId: string, def: Partial<HostPanelDef>) => void;
1048
+ /**
1049
+ * Open a modal at runtime. The author's tagged-union content shape
1050
+ * (`kind: 'page' | 'artifact' | 'component' | 'builtin'`) is mirrored
1051
+ * into the host declaration so the modal's component / props can be
1052
+ * resolved from the host side. Re-opening an already-open id is a
1053
+ * silent no-op (matches host-side `manager.openModal`'s thrown
1054
+ * `LayoutValidationError`, but downgraded for cross-boundary callers).
1055
+ *
1056
+ * Defaults to `<dialog showModal()>` rendering for top-layer stacking,
1057
+ * focus trap, and inert propagation. Pass `def.useNativeDialog: false`
1058
+ * to opt back into the legacy div-overlay path during migration.
1059
+ */
1060
+ openModal: (id: string, def: HostModalDef) => void;
1028
1061
  /** Close a currently-open modal by id. */
1029
1062
  closeModal: (modalId: string) => void;
1030
1063
  /** Add a floating panel at runtime. Existing id is overwritten. */
@@ -1334,3 +1367,31 @@ declare global {
1334
1367
  [GLOBAL_PROXY_CONFIG_VAR]?: ProxyConfig;
1335
1368
  }
1336
1369
  }
1370
+
1371
+ // Augment axios's request config so consumers can opt out of the proxy
1372
+ // api's default auth handling on a per-request basis. The proxy's createApi
1373
+ // reads `skipDefaultAuth` in both the request and response interceptors;
1374
+ // see `gen-2-chat:src/proxy/shared/api.ts` for the runtime semantics.
1375
+ declare module 'axios' {
1376
+ interface AxiosRequestConfig {
1377
+ /**
1378
+ * Skip the proxy api's default auth handling for THIS request.
1379
+ *
1380
+ * When `true`:
1381
+ * - the request interceptor will NOT attach `Authorization: Bearer <token>`
1382
+ * - the response interceptor will NOT call `host.handleError('auth-expired')` on 401
1383
+ *
1384
+ * Use for:
1385
+ * - calls to a backend that uses a different auth domain
1386
+ * - calls that legitimately probe an unauthenticated endpoint
1387
+ * - calls where a 401 is meaningful but should not log the user out
1388
+ *
1389
+ * Cross-origin requests (URL with a different origin from the api's
1390
+ * `baseURL`) auto-skip the Wippy default regardless of this flag.
1391
+ */
1392
+ skipDefaultAuth?: boolean;
1393
+ }
1394
+ interface InternalAxiosRequestConfig {
1395
+ skipDefaultAuth?: boolean;
1396
+ }
1397
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wippy-fe/types-global-proxy",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "description": "Global type declarations for Wippy iframe proxy (window.getWippyApi, $W, etc.)",
5
5
  "license": "UNLICENSED",
6
6
  "types": "index.d.ts"