@helpai/elements 0.29.1 → 0.30.1
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/elements-web-component.esm.js +29 -29
- package/elements-web-component.esm.js.map +4 -4
- package/elements.cjs.js +24 -24
- package/elements.cjs.js.map +4 -4
- package/elements.esm.js +24 -24
- package/elements.esm.js.map +4 -4
- package/elements.js +24 -24
- package/elements.js.map +4 -4
- package/index.d.ts +59 -30
- package/index.mjs +600 -523
- package/package.json +1 -1
- package/schema.d.ts +49 -49
- package/web-component.d.ts +11 -5
- package/web-component.mjs +399 -325
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, H as HandshakeResponse, L as Link, S as ServerConfig, b as SiteConfig, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial } from './deployment-
|
|
1
|
+
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, H as HandshakeResponse, L as Link, S as ServerConfig, b as SiteConfig, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial } from './deployment-rva7dkso.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1120,13 +1120,21 @@ interface ResolvedOptions {
|
|
|
1120
1120
|
accept: string;
|
|
1121
1121
|
};
|
|
1122
1122
|
/**
|
|
1123
|
-
* Active locale used to compute {@link ResolvedOptions.strings}
|
|
1124
|
-
*
|
|
1123
|
+
* Active locale used to compute {@link ResolvedOptions.strings} and carried
|
|
1124
|
+
* on every request envelope. Concrete (`"auto"` already resolved to a
|
|
1125
|
+
* BCP-47 tag) and clamped into {@link ResolvedOptions.availableLocales}.
|
|
1125
1126
|
*/
|
|
1126
1127
|
locale: string;
|
|
1127
1128
|
/**
|
|
1128
|
-
*
|
|
1129
|
-
*
|
|
1129
|
+
* Deployment fallback locale — concrete. The clamp target when the
|
|
1130
|
+
* detected / persisted / picked locale isn't in `availableLocales`.
|
|
1131
|
+
* Server-authoritative (`config.i18n.defaultLocale` wins over `init`).
|
|
1132
|
+
*/
|
|
1133
|
+
defaultLocale: string;
|
|
1134
|
+
/**
|
|
1135
|
+
* Locales offered in the language switcher — the deployment's supported
|
|
1136
|
+
* set, server-authoritative (`config.i18n.availableLocales` wins over
|
|
1137
|
+
* `init`). Single-entry hides the language action.
|
|
1130
1138
|
*/
|
|
1131
1139
|
availableLocales: string[];
|
|
1132
1140
|
startMinimized: boolean;
|
|
@@ -1384,6 +1392,52 @@ interface EventMap {
|
|
|
1384
1392
|
}
|
|
1385
1393
|
type EventName = keyof EventMap;
|
|
1386
1394
|
|
|
1395
|
+
/**
|
|
1396
|
+
* Derives the `data-mode` attribute value from App state.
|
|
1397
|
+
*
|
|
1398
|
+
* Kept as a pure helper (no DOM, no React) so tests can pin the critical
|
|
1399
|
+
* invariants cheaply:
|
|
1400
|
+
*
|
|
1401
|
+
* - `isOpen === false` → `"closed"` regardless of `panelSize`.
|
|
1402
|
+
* This is the reason closing from fullscreen doesn't hide the launcher:
|
|
1403
|
+
* the `[data-mode="fullscreen"] .__P__-fab { display: none }` rule never
|
|
1404
|
+
* matches when the widget is closed.
|
|
1405
|
+
* - `panelSize` is preserved across close → open, so reopening the widget
|
|
1406
|
+
* restores the user's last layout (normal / expanded / fullscreen).
|
|
1407
|
+
* - Inline + standalone are terminal modes: they override any panelSize
|
|
1408
|
+
* because the widget isn't a popover and can't be "closed".
|
|
1409
|
+
*/
|
|
1410
|
+
|
|
1411
|
+
type HostMode = "page" | "standalone" | "inline" | "modal" | "drawer" | "fullscreen" | "expanded" | "open" | "closed";
|
|
1412
|
+
|
|
1413
|
+
/**
|
|
1414
|
+
* Shared widget runtime — the one composition both entry points wrap around
|
|
1415
|
+
* `<App>`.
|
|
1416
|
+
*
|
|
1417
|
+
* `mount()` (`src/index.ts`, programmatic, `widgetId`-keyed registry, returns a
|
|
1418
|
+
* handle) and `<web-ai-chat>` (`src/web-component.ts`, declarative, N-per-page,
|
|
1419
|
+
* no registry) used to each hand-roll the same four things around the App tree:
|
|
1420
|
+
* the ErrorBoundary wrapper, the handshake-config merge, the usage tracker, and
|
|
1421
|
+
* the host-attribute application (position / theme / `data-mode`). That parallel
|
|
1422
|
+
* code drifted three separate times (mode-merge, tracker, ErrorBoundary). This
|
|
1423
|
+
* module is the single source of that composition so it can't drift again — both
|
|
1424
|
+
* entry points only own what's genuinely theirs (mount: iframe + handle + hooks
|
|
1425
|
+
* + registry; web-component: attribute parsing + the custom-element lifecycle).
|
|
1426
|
+
*/
|
|
1427
|
+
|
|
1428
|
+
/**
|
|
1429
|
+
* Determine what `data-mode` the host should start at — matching what App's
|
|
1430
|
+
* mount-time `useEffect` will produce on its first render. Used for the initial
|
|
1431
|
+
* paint in both entry points (and `mount()`'s iframe sizing); after that, App
|
|
1432
|
+
* owns `data-mode` for the lifetime of the instance.
|
|
1433
|
+
*
|
|
1434
|
+
* `resolveInitialPanelState` is the one source of truth for "what does the first
|
|
1435
|
+
* render look like" — App.tsx uses it too. If these two paths ever pick
|
|
1436
|
+
* different initial states, an iframe physically resizes between mount and App's
|
|
1437
|
+
* first effect (the closed→open→closed flicker this pins against).
|
|
1438
|
+
*/
|
|
1439
|
+
declare function resolveInitialHostMode(options: ResolvedOptions): HostMode;
|
|
1440
|
+
|
|
1387
1441
|
/**
|
|
1388
1442
|
* Global lifecycle-hook registry.
|
|
1389
1443
|
*
|
|
@@ -1429,24 +1483,6 @@ declare const HOOK_WILDCARD = "*";
|
|
|
1429
1483
|
*/
|
|
1430
1484
|
type HookListener = (instance: ChatWidgetInstance, event: EventName, data: unknown) => void;
|
|
1431
1485
|
|
|
1432
|
-
/**
|
|
1433
|
-
* Derives the `data-mode` attribute value from App state.
|
|
1434
|
-
*
|
|
1435
|
-
* Kept as a pure helper (no DOM, no React) so tests can pin the critical
|
|
1436
|
-
* invariants cheaply:
|
|
1437
|
-
*
|
|
1438
|
-
* - `isOpen === false` → `"closed"` regardless of `panelSize`.
|
|
1439
|
-
* This is the reason closing from fullscreen doesn't hide the launcher:
|
|
1440
|
-
* the `[data-mode="fullscreen"] .__P__-fab { display: none }` rule never
|
|
1441
|
-
* matches when the widget is closed.
|
|
1442
|
-
* - `panelSize` is preserved across close → open, so reopening the widget
|
|
1443
|
-
* restores the user's last layout (normal / expanded / fullscreen).
|
|
1444
|
-
* - Inline + standalone are terminal modes: they override any panelSize
|
|
1445
|
-
* because the widget isn't a popover and can't be "closed".
|
|
1446
|
-
*/
|
|
1447
|
-
|
|
1448
|
-
type HostMode = "page" | "standalone" | "inline" | "modal" | "drawer" | "fullscreen" | "expanded" | "open" | "closed";
|
|
1449
|
-
|
|
1450
1486
|
/**
|
|
1451
1487
|
* Public ESM entry for `@<brand>/elements`.
|
|
1452
1488
|
*
|
|
@@ -1644,12 +1680,5 @@ declare const brand: {
|
|
|
1644
1680
|
readonly domain: string;
|
|
1645
1681
|
readonly siteUrl: string;
|
|
1646
1682
|
};
|
|
1647
|
-
/**
|
|
1648
|
-
* Determine what `data-mode` the host should start at — matching what
|
|
1649
|
-
* App's mount-time `useEffect` will produce on its first render. Exposed
|
|
1650
|
-
* only for the initial paint path in `mount()` (and the test suite);
|
|
1651
|
-
* after that, App owns `data-mode` for the lifetime of the instance.
|
|
1652
|
-
*/
|
|
1653
|
-
declare function resolveInitialHostMode(options: ResolvedOptions): HostMode;
|
|
1654
1683
|
|
|
1655
1684
|
export { type ChatWidgetInstance, type ChatWidgetOptions, type EventMap, type EventName, HOOK_WILDCARD, type HookListener, type LogEntry, type LogLevel, type ResolvedOptions, brand, destroy, getAllInstances, getInstance, hook, init, mount, resolveInitialHostMode, version };
|