@athenaintel/react 0.16.3 → 0.17.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.
@@ -18,10 +18,14 @@ export interface AthenaProviderConfig {
18
18
  * sync host); pass 'legacy' to opt back onto the legacy Iris chat stream.
19
19
  * Threads created on one transport are read-only from the other. */
20
20
  transport?: AthenaTransport;
21
- /** Statewire sync base URL override (the `…/v2/threads` mount). Defaults to
22
- * the `apiUrl` host + `/v2/threads`. Only used when transport is 'statewire'. */
21
+ /** Statewire sync base URL override (the `…/v2/threads` mount). Only used
22
+ * when transport is 'statewire'. Resolution order: this value, then the
23
+ * `statewireSyncUrl` a Marathon host mints via `/_athena/auth` (or a
24
+ * trusted parent posts), then the effective `apiUrl` host + `/v2/threads`. */
23
25
  statewireSyncUrl?: string;
24
- /** URL for the Athena backend API. Defaults to the matching Athena environment. */
26
+ /** URL for the Athena backend API the bare Agora base or the legacy
27
+ * `…/api/assistant-ui` endpoint (REST helpers accept both). Defaults to
28
+ * the host-provided value, then the matching Athena environment. */
25
29
  backendUrl?: string;
26
30
  /** URL for the Athena frontend app origin. Defaults to the matching Athena environment. */
27
31
  appUrl?: string;
@@ -1,15 +1,44 @@
1
1
  export interface ParentBridgeState {
2
2
  /** PropelAuth access token from the parent window. */
3
3
  token: string | null;
4
- /** Sync server chat URL provided by the Marathon wrapper. */
4
+ /** Legacy Iris chat stream URL (`…/api/chat`) provided by the host. */
5
5
  apiUrl: string | null;
6
- /** Athena backend URL provided by the Marathon wrapper. */
6
+ /** Legacy Athena backend URL (`…/api/assistant-ui`) provided by the host. */
7
7
  backendUrl: string | null;
8
+ /**
9
+ * Statewire sync mount (`…/v2/threads`) minted by the host. `null` when the
10
+ * host predates the statewire-native mint fields; the provider then derives
11
+ * it from `apiUrl`'s origin.
12
+ */
13
+ statewireSyncUrl: string | null;
14
+ /**
15
+ * Bare Agora API base (no path) minted by the host. `null` when the host
16
+ * only serves the legacy `backendUrl`; REST helpers strip that URL's
17
+ * `/api/assistant-ui` suffix themselves.
18
+ */
19
+ backendBaseUrl: string | null;
8
20
  /** Athena frontend origin provided by the parent wrapper. */
9
21
  appUrl: string | null;
10
22
  /** True once config has been received from the parent (or timeout fired). */
11
23
  ready: boolean;
12
24
  }
25
+ declare const BRIDGE_URL_FIELDS: readonly ['apiUrl', 'backendUrl', 'statewireSyncUrl', 'backendBaseUrl', 'appUrl'];
26
+ type BridgeUrlField = (typeof BRIDGE_URL_FIELDS)[number];
27
+ /** The URL half of {@link ParentBridgeState} — what a host can hand the SDK. */
28
+ export type ParentBridgeUrls = Pick<ParentBridgeState, BridgeUrlField>;
29
+ /**
30
+ * Fold an `athena-config` postMessage payload over the current URL set. A
31
+ * field is taken only when it is a string; anything else keeps the previous
32
+ * value. A parent that predates the statewire-native fields therefore leaves
33
+ * `statewireSyncUrl`/`backendBaseUrl` at `null`, and the provider falls back
34
+ * to deriving them from the legacy URLs.
35
+ */
36
+ export declare function mergeBridgeConfigMessage(previous: ParentBridgeUrls, payload: Partial<Record<BridgeUrlField, unknown>>): ParentBridgeUrls;
37
+ /**
38
+ * Read the URL set out of a `/_athena/auth` mint body. Non-string fields are
39
+ * `null` — an older Marathon serves only the legacy `apiUrl`/`backendUrl`.
40
+ */
41
+ export declare function readAuthMintUrls(data: Partial<Record<BridgeUrlField, unknown>>): ParentBridgeUrls;
13
42
  export interface ParentBridgeOptions {
14
43
  /**
15
44
  * Exact parent origins that are allowed to send auth/config via postMessage.
@@ -31,8 +60,11 @@ export declare const getAuthRetryDelay: (retryAttempt: number) => number;
31
60
  * 2. **Standalone (Marathon-served deploy URL)**: top-level navigation, no
32
61
  * parent. The hook fetches `/_athena/auth` on its own origin. Marathon
33
62
  * validates its session cookie (sent by the browser automatically) and
34
- * returns `{ token, apiUrl, backendUrl, appUrl }`. A 404 means we're not
35
- * on a Marathon origin — the hook falls through with empty state.
63
+ * returns `{ token, statewireSyncUrl, backendBaseUrl, apiUrl, backendUrl,
64
+ * appUrl }` — the statewire-native mount and bare Agora base alongside
65
+ * the legacy chat-wire URLs, so old and new hosts both resolve. A 404
66
+ * means we're not on a Marathon origin — the hook falls through with
67
+ * empty state.
36
68
  *
37
69
  * In both modes a timeout safety net flips `ready: true` so the app never
38
70
  * blocks indefinitely.
@@ -43,3 +75,4 @@ export declare function useParentBridge({ trustedOrigins, }?: ParentBridgeOption
43
75
  * Prefer useParentBridge() for new code.
44
76
  */
45
77
  export declare function useParentAuth(): string | null;
78
+ export {};
@@ -13,18 +13,20 @@ export type AthenaTransport = (typeof ATHENA_TRANSPORTS)[keyof typeof ATHENA_TRA
13
13
  export declare const DEFAULT_ATHENA_TRANSPORT: AthenaTransport;
14
14
  export interface ResolvedAthenaTransport {
15
15
  transport: AthenaTransport;
16
- /** Human-readable reason when the requested transport could not be honored. */
16
+ /**
17
+ * @deprecated Always `null`. Both provider modes (standalone and thread
18
+ * list) run both transports, so a requested transport is never overridden.
19
+ * Kept on the type so existing consumers keep compiling.
20
+ */
17
21
  fallbackReason: string | null;
18
22
  }
19
23
  /**
20
- * Resolve the effective chat transport for a provider configuration.
21
- *
22
- * Both provider modes (standalone and thread-list) support both transports;
23
- * the resolver exists so a future incompatible combination can fall back
24
- * with a reported reason instead of silently running the wrong transport.
24
+ * Resolve the effective chat transport for a provider configuration: the
25
+ * requested transport, or {@link DEFAULT_ATHENA_TRANSPORT} when unset.
25
26
  */
26
27
  export declare function resolveAthenaTransport({ transport, }: {
27
28
  transport?: AthenaTransport;
29
+ /** @deprecated Ignored — the thread list runs on both transports. */
28
30
  enableThreadList?: boolean;
29
31
  }): ResolvedAthenaTransport;
30
32
  /**
@@ -63,7 +63,7 @@ function _interopNamespaceDefault(e) {
63
63
  }
64
64
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
65
65
  const ReactDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactDOM);
66
- const version = "0.16.3";
66
+ const version = "0.17.0";
67
67
  const packageJson = {
68
68
  version
69
69
  };
@@ -36814,4 +36814,4 @@ exports.useRestConversationHistory = useRestConversationHistory;
36814
36814
  exports.useStore = useStore;
36815
36815
  exports.withCaptureGateBypass = withCaptureGateBypass;
36816
36816
  exports.wrapPosthogClient = wrapPosthogClient;
36817
- //# sourceMappingURL=use-rest-conversation-history-CMuTZmsp.cjs.map
36817
+ //# sourceMappingURL=use-rest-conversation-history-BdnG8jEP.cjs.map