@bitbitpress/client 1.1.2 → 1.1.3

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 (36) hide show
  1. package/dist/generated/openapi.d.ts +29 -7
  2. package/dist/react/index.d.ts +16 -11
  3. package/dist/react/index.d.ts.map +1 -1
  4. package/dist/react/index.js +37 -10
  5. package/dist/react/index.js.map +1 -1
  6. package/dist/react-native-expo/BitBitView.d.ts +32 -0
  7. package/dist/react-native-expo/BitBitView.d.ts.map +1 -0
  8. package/dist/react-native-expo/BitBitView.js +130 -0
  9. package/dist/react-native-expo/BitBitView.js.map +1 -0
  10. package/dist/react-native-expo/bootstrapHtml.d.ts +20 -0
  11. package/dist/react-native-expo/bootstrapHtml.d.ts.map +1 -0
  12. package/dist/react-native-expo/bootstrapHtml.js +79 -0
  13. package/dist/react-native-expo/bootstrapHtml.js.map +1 -0
  14. package/dist/react-native-expo/index.d.ts +2 -0
  15. package/dist/react-native-expo/index.d.ts.map +1 -1
  16. package/dist/react-native-expo/index.js +1 -0
  17. package/dist/react-native-expo/index.js.map +1 -1
  18. package/dist/runtime/index.d.ts +13 -0
  19. package/dist/runtime/index.d.ts.map +1 -1
  20. package/dist/runtime/index.js.map +1 -1
  21. package/dist/synthesisUi/context.d.ts +2 -2
  22. package/dist/synthesisUi/context.js +1 -1
  23. package/dist/synthesisUi/types.d.ts +14 -2
  24. package/dist/synthesisUi/types.d.ts.map +1 -1
  25. package/dist/user/index.d.ts +1 -1
  26. package/dist/user/synthesize.d.ts +4 -0
  27. package/dist/user/synthesize.d.ts.map +1 -1
  28. package/dist/user/synthesize.js +1 -0
  29. package/dist/user/synthesize.js.map +1 -1
  30. package/dist/user/synthesizeUi.d.ts +35 -13
  31. package/dist/user/synthesizeUi.d.ts.map +1 -1
  32. package/dist/user/synthesizeUi.js +38 -9
  33. package/dist/user/synthesizeUi.js.map +1 -1
  34. package/dist/user/typeDefs.d.ts +13 -0
  35. package/dist/user/typeDefs.d.ts.map +1 -1
  36. package/package.json +7 -6
@@ -799,7 +799,7 @@ export interface paths {
799
799
  items: {
800
800
  /** @description Optional configuration key name. Loads an existing synthesis config by this name; omit for default configuration. */
801
801
  configurationKeyName?: string;
802
- /** @description How many recent stored synthesis outputs to expose in the streamed `synthesisHistory` / `synthesisHistoryEntries` fields. Defaults to 0 (no history emitted). When > 0, the final data event includes a `synthesisHistoryEntries` array of up to N `{ synthesisOutputId, data }` (most-recent first; each row's payload paired with its output id, so submissions can attach to a specific historical output), and — DEPRECATED, for retrocompatibility — an index-aligned `synthesisHistory` array of the same bare `data` payloads. The first entry is the current synthesis itself — the same payload `data` is derived from — and the remaining entries are older stored rows. */
802
+ /** @description How many recent stored synthesis outputs to expose in the streamed `synthesisHistory` / `synthesisHistoryEntries` fields. Defaults to 0 (no history emitted). When > 0, the final data event includes a `synthesisHistoryEntries` array of up to N `{ synthesisOutputId, data }` (most-recent first; each row's payload paired with its output id, so submissions can attach to a specific historical output), and — DEPRECATED, for older app builds — an index-aligned `synthesisHistory` array of the same bare `data` payloads. The first entry is the current synthesis itself — the same payload `data` is derived from — and the remaining entries are older stored rows. */
803
803
  synthesisHistoryLimit?: number;
804
804
  /** @description Per-request overrides for search options. */
805
805
  searchOptionsOverrides?: {
@@ -845,7 +845,7 @@ export interface paths {
845
845
  * ```
846
846
  * `data` is always a single synthesized object (keys match your output schema). `complete` is `false` for partial streaming updates and `true` for the final validated payload.
847
847
  *
848
- * When `synthesisHistoryLimit > 0`, the final event additionally includes `synthesisHistoryEntries`: an array of up to N entries (most-recent first), each `{ synthesisOutputId, data }`, so a client can attach submissions (e.g. poll votes) to a specific historical output. The first entry is the current synthesis itself — the raw payload `data` is derived from (identical to `data` when reranking isn't configured; the unreranked source when it is) — and the remaining entries are older stored rows. A DEPRECATED `synthesisHistory` field (index-aligned bare `data` payloads) is also included for retrocompatibility. The primary `data` field stays a single object — when user reranking is configured, it is built by pooling items at the reranking field across the fetched rows and scoring against the user profile.
848
+ * When `synthesisHistoryLimit > 0`, the final event additionally includes `synthesisHistoryEntries`: an array of up to N entries (most-recent first), each `{ synthesisOutputId, data }`, so a client can attach submissions (e.g. poll votes) to a specific historical output. The first entry is the current synthesis itself — the raw payload `data` is derived from (identical to `data` when reranking isn't configured; the unreranked source when it is) — and the remaining entries are older stored rows. A DEPRECATED `synthesisHistory` field (index-aligned bare `data` payloads) is also included for older app builds. The primary `data` field stays a single object — when user reranking is configured, it is built by pooling items at the reranking field across the fetched rows and scoring against the user profile.
849
849
  *
850
850
  * **Data Events (error):**
851
851
  * ```json
@@ -926,9 +926,9 @@ export interface paths {
926
926
  * Synthesis - Synthesize UI
927
927
  * @description **POST** `/v1/user/synthesize-ui`
928
928
  *
929
- * Resolve one or more generated UIs in a single request, each identified by its `keyName`. Streams results as Server-Sent Events so the client can load the (cacheable) code bundle immediately and render synthesis `data` as it arrives the same streaming model as `/v1/user/synthesize`.
929
+ * Resolve one or more generated UIs in a single request, each identified by its `keyName`. Works exactly like `/v1/user/synthesize` — same per-item synthesis inputs (`inputs`, `output.schema`, `searchOptionsOverrides`, `synthesisHistoryLimit`) and the same personalized, streamed `data` — except it additionally returns the UI code bundle to render that data. The synthesis runs against the config attached to each UI.
930
930
  *
931
- * The code bundle is immutable per published version and identical for every app user, so it is served from a CDN by versioned `bundleUrl` and cached once across renders and users. `data` is the per-request, per-user piece and may stream in partials before a final `complete: true` event. `theme` is deployment-level and emitted once in the `manifest`. (`bundleSource` is an inlined fallback used only while bundles are served inline, before CDN delivery.)
931
+ * Streams as Server-Sent Events so the client can load the (cacheable) code bundle immediately and render synthesis `data` as it arrives. The code bundle is immutable per published version and identical for every app user, so it is served from a CDN by versioned `bundleUrl` and cached once across renders and users. `data` is the per-request, per-user piece and may stream in partials before a final `complete: true` event. `theme` is deployment-level and emitted once in the `manifest`. (`bundleSource` is an inlined fallback used only while bundles are served inline, before CDN delivery.)
932
932
  */
933
933
  post: {
934
934
  parameters: {
@@ -952,6 +952,28 @@ export interface paths {
952
952
  items: {
953
953
  /** @description Stable identifier of the UI to load. Configured in the CMS. */
954
954
  keyName: string;
955
+ /** @description How many recent stored synthesis outputs to expose in the streamed `synthesisHistory` / `synthesisHistoryEntries` fields. Defaults to 0. See `/v1/user/synthesize` for the full semantics. */
956
+ synthesisHistoryLimit?: number;
957
+ /** @description Per-request overrides for search options. */
958
+ searchOptionsOverrides?: {
959
+ /** @description Override for search lookback window in minutes (e.g. 1440 for last 24 hours). */
960
+ lookbackMinutes?: number;
961
+ };
962
+ /** @description Inputs used as context for the synthesis: externalId (article ID), or text (freeform text). */
963
+ inputs?: {
964
+ /**
965
+ * @description Type of input: externalId (article) or text (freeform).
966
+ * @enum {string}
967
+ */
968
+ type: "externalId" | "text" | "excludeExternalIds";
969
+ /** @description External ID (e.g. article) for externalId, freeform text for text, or comma-separated list of external IDs to exclude */
970
+ value: string;
971
+ }[];
972
+ /** @description Optional output definition. Omit to use the output schema declared on the UI's attached config (`output.outputSchema`). */
973
+ output?: {
974
+ /** @description Output schema as a JSON string. Top-level type must be "object". See `/v1/user/synthesize` for the format. */
975
+ schema: string;
976
+ };
955
977
  }[];
956
978
  };
957
979
  };
@@ -1054,7 +1076,7 @@ export interface paths {
1054
1076
  put?: never;
1055
1077
  /**
1056
1078
  * Synthesis - Get User Interactions (DEPRECATED)
1057
- * @description **DEPRECATED** — use `GET /v1/user/submissions` (submission state), keyed by the poll's `synthesisOutputId`. Kept for retrocompatibility.
1079
+ * @description **DEPRECATED** — use `GET /v1/user/submissions` (submission state), keyed by the poll's `synthesisOutputId`. Kept for older app builds.
1058
1080
  *
1059
1081
  * **POST** `/v1/user/interactions`
1060
1082
  *
@@ -1168,7 +1190,7 @@ export interface paths {
1168
1190
  put?: never;
1169
1191
  /**
1170
1192
  * Synthesis - Create User Interaction Response (DEPRECATED)
1171
- * @description **DEPRECATED** — use `POST /v1/user/submissions` (submit), keyed by the poll's `synthesisOutputId`. Kept for retrocompatibility.
1193
+ * @description **DEPRECATED** — use `POST /v1/user/submissions` (submit), keyed by the poll's `synthesisOutputId`. Kept for older app builds.
1172
1194
  *
1173
1195
  * **POST** `/v1/user/interactions/:interactionId/responses`
1174
1196
  *
@@ -1534,7 +1556,7 @@ export interface paths {
1534
1556
  externalIds?: string[];
1535
1557
  /** @description Asset fields to return (dot or bracket notation). Allowed: assetId, title, tags, images, videos, publishedAt, externalId, externalData, assetType, sourceUrl, dataSource.name, and subfields. Empty array returns objects with only assetId. */
1536
1558
  assetFields: string[];
1537
- };
1559
+ } & (unknown | unknown);
1538
1560
  };
1539
1561
  };
1540
1562
  responses: {
@@ -1,14 +1,19 @@
1
- import type { SynthesisUiPlatform, SynthesisUiStreamEvent, SynthesizeUiFetcher } from '../synthesisUi/types.js';
1
+ import type { SynthesisUiPlatform, SynthesisUiRequestInputs, SynthesisUiStreamEvent, SynthesizeUiFetcher } from '../synthesisUi/types.js';
2
2
  export type { BitBitViewContext, GeneratedUiModule, GeneratedUiViewHandle, } from '../runtime/index.js';
3
3
  export { type BitBitContextValue, BitBitProvider } from '../synthesisUi/context.js';
4
- export type { SynthesisUiPlatform, SynthesisUiStreamEvent, SynthesizeUiFetcher };
5
- export interface BitBitSynthesisProps {
4
+ export type { SynthesisUiPlatform, SynthesisUiRequestInputs, SynthesisUiStreamEvent, SynthesizeUiFetcher, };
5
+ /** `SynthesisUiRequestInputs` (`inputs`, `output`, `searchOptionsOverrides`,
6
+ * `synthesisHistoryLimit`) are forwarded to the synthesis request. Non-primitive
7
+ * values (e.g. `inputs`) should be stable/memoized — a new identity re-subscribes
8
+ * the stream (re-synthesizes). */
9
+ export interface BitBitViewProps extends SynthesisUiRequestInputs {
6
10
  /** Client to fetch the UI through. Optional when a `<BitBitProvider client>`
7
11
  * is in scope. */
8
12
  client?: SynthesizeUiFetcher;
9
13
  keyName: string;
10
- /** Target platform. Defaults to `web`; the studio passes `mobile` to
11
- * preview the react-native-web bundle. */
14
+ /** Target platform. Defaults to `web`. The CMS studio passes `mobile` to
15
+ * preview the mobile bundle in a browser; a real native app renders mobile
16
+ * through the `react-native-expo` entry (a WebView), not this one. */
12
17
  platform?: SynthesisUiPlatform;
13
18
  /** Brand analytics / link tracking. */
14
19
  onTrack?: (event: string, payload?: unknown) => void;
@@ -20,13 +25,13 @@ export interface BitBitSynthesisProps {
20
25
  /**
21
26
  * Web view for a server-generated SynthesisUI. Streams the UI by `keyName`
22
27
  * through `client` (or the `<BitBitProvider client>` in scope): loads and
23
- * mounts the built bundle (which owns its React) on the `manifest`, then pushes
24
- * `data` into the mounted view as it streams in. Web mounts in a Shadow DOM;
25
- * the `mobile` preview (react-native-web) mounts in the light DOM so rn-web's
26
- * global stylesheet applies. Native delivery (React Native via Re.Pack) is a
27
- * separate entry.
28
+ * mounts the built bundle (which owns its own framework) on the `manifest`, then
29
+ * pushes `data` into the mounted view as it streams in. Both web and mobile
30
+ * bundles are plain DOM, so both mount here (web in a Shadow DOM; the studio's
31
+ * `mobile` preview in the light DOM). Native delivery renders the same mobile
32
+ * bundle in a WebView via the `react-native-expo` entry.
28
33
  */
29
- export declare function BitBitSynthesis({ client: clientProp, keyName, platform, onTrack, onEvent, onNavigate, }: BitBitSynthesisProps): import("react").DetailedReactHTMLElement<{
34
+ export declare function BitBitView({ client: clientProp, keyName, platform, onTrack, onEvent, onNavigate, inputs, output, searchOptionsOverrides, synthesisHistoryLimit, }: BitBitViewProps): import("react").DetailedReactHTMLElement<{
30
35
  ref: import("react").RefObject<HTMLDivElement>;
31
36
  style: {
32
37
  height: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,kBAAkB,EAAE,cAAc,EAA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BAAmB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB;;2EAEuE;IACvE,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,uCAAuC;IACvC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACrD,+DAA+D;IAC/D,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACpD,0CAA0C;IAC1C,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAID;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,EACzB,MAAM,EAAE,UAAU,EAClB,OAAO,EACP,QAAgB,EAChB,OAAO,EACP,OAAO,EACP,UAAU,EACV,MAAM,EACN,MAAM,EACN,sBAAsB,EACtB,qBAAqB,GACtB,EAAE,eAAe;;;;;mBAwFjB"}
@@ -6,13 +6,13 @@ const noop = () => { };
6
6
  /**
7
7
  * Web view for a server-generated SynthesisUI. Streams the UI by `keyName`
8
8
  * through `client` (or the `<BitBitProvider client>` in scope): loads and
9
- * mounts the built bundle (which owns its React) on the `manifest`, then pushes
10
- * `data` into the mounted view as it streams in. Web mounts in a Shadow DOM;
11
- * the `mobile` preview (react-native-web) mounts in the light DOM so rn-web's
12
- * global stylesheet applies. Native delivery (React Native via Re.Pack) is a
13
- * separate entry.
9
+ * mounts the built bundle (which owns its own framework) on the `manifest`, then
10
+ * pushes `data` into the mounted view as it streams in. Both web and mobile
11
+ * bundles are plain DOM, so both mount here (web in a Shadow DOM; the studio's
12
+ * `mobile` preview in the light DOM). Native delivery renders the same mobile
13
+ * bundle in a WebView via the `react-native-expo` entry.
14
14
  */
15
- export function BitBitSynthesis({ client: clientProp, keyName, platform = 'web', onTrack, onEvent, onNavigate, }) {
15
+ export function BitBitView({ client: clientProp, keyName, platform = 'web', onTrack, onEvent, onNavigate, inputs, output, searchOptionsOverrides, synthesisHistoryLimit, }) {
16
16
  const contextClient = useBitBitContext()?.client;
17
17
  const client = clientProp ?? contextClient;
18
18
  const hostRef = useRef(null);
@@ -41,7 +41,14 @@ export function BitBitSynthesis({ client: clientProp, keyName, platform = 'web',
41
41
  navigate: onNavigate,
42
42
  });
43
43
  void (async () => {
44
- const stream = await client.user.synthesizeUi({ keyName, platform });
44
+ const stream = await client.user.synthesizeUi({
45
+ keyName,
46
+ platform,
47
+ inputs,
48
+ output,
49
+ searchOptionsOverrides,
50
+ synthesisHistoryLimit,
51
+ });
45
52
  for await (const event of stream) {
46
53
  if (cancelled)
47
54
  break;
@@ -53,11 +60,20 @@ export function BitBitSynthesis({ client: clientProp, keyName, platform = 'web',
53
60
  }
54
61
  else if (event.type === 'data' && mod) {
55
62
  // Mount on the first data event (bundle is ready); update thereafter.
63
+ const props = {
64
+ data: event.data,
65
+ history: event.synthesisHistoryEntries,
66
+ ctx: makeCtx(),
67
+ };
56
68
  if (handle) {
57
- handle.update({ data: event.data, ctx: makeCtx() });
69
+ handle.update(props);
58
70
  }
59
71
  else {
60
- handle = mountGeneratedView(host, mod, { data: event.data, ctx: makeCtx() }, { isolateStyles: platform !== 'mobile' });
72
+ // Web isolates styles in a Shadow DOM; the studio's mobile preview
73
+ // mounts in the light DOM.
74
+ handle = mountGeneratedView(host, mod, props, {
75
+ isolateStyles: platform !== 'mobile',
76
+ });
61
77
  beacon('VIEW');
62
78
  }
63
79
  }
@@ -67,7 +83,18 @@ export function BitBitSynthesis({ client: clientProp, keyName, platform = 'web',
67
83
  cancelled = true;
68
84
  handle?.unmount();
69
85
  };
70
- }, [client, keyName, platform, onTrack, onEvent, onNavigate]);
86
+ }, [
87
+ client,
88
+ keyName,
89
+ platform,
90
+ onTrack,
91
+ onEvent,
92
+ onNavigate,
93
+ inputs,
94
+ output,
95
+ searchOptionsOverrides,
96
+ synthesisHistoryLimit,
97
+ ]);
71
98
  return createElement('div', { ref: hostRef, style: { height: '100%' } });
72
99
  }
73
100
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAIL,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAY7D,OAAO,EAA2B,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAmBpF,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEtB;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,MAAM,EAAE,UAAU,EAClB,OAAO,EACP,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,OAAO,EACP,UAAU,GACW;IACrB,MAAM,aAAa,GAAG,gBAAgB,EAAE,EAAE,MAAM,CAAC;IACjD,MAAM,MAAM,GAAG,UAAU,IAAI,aAAa,CAAC;IAC3C,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC7C,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QAC7B,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,MAAyC,CAAC;QAC9C,IAAI,GAAkC,CAAC;QACvC,IAAI,KAAK,GAA2B,EAAE,CAAC;QACvC,0EAA0E;QAC1E,4EAA4E;QAC5E,uDAAuD;QACvD,MAAM,SAAS,GACb,MAAM,CAAC,IAQR,CAAC,SAAS,CAAC;QACZ,MAAM,MAAM,GAAG,CAAC,IAAsB,EAAE,IAAa,EAAE,OAAiB,EAAE,EAAE;YAC1E,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI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AAO;QACP,UAAU;QACV,MAAM;QACN,MAAM;QACN,sBAAsB;QACtB,qBAAqB;KACtB,CAAC,CAAC;IACH,OAAO,aAAa,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;AAC3E,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { WebView } from 'react-native-webview';
2
+ import type { SynthesisUiPlatform, SynthesisUiRequestInputs, SynthesizeUiFetcher } from '../synthesisUi/types.js';
3
+ /** `SynthesisUiRequestInputs` (`inputs`, `output`, `searchOptionsOverrides`,
4
+ * `synthesisHistoryLimit`) are forwarded to the synthesis request. Non-primitive
5
+ * values (e.g. `inputs`) should be stable/memoized — a new identity re-subscribes
6
+ * the stream (re-synthesizes). */
7
+ export interface BitBitViewProps extends SynthesisUiRequestInputs {
8
+ /** Client to fetch the UI through. Optional when a `<BitBitProvider client>`
9
+ * is in scope. */
10
+ client?: SynthesizeUiFetcher;
11
+ keyName: string;
12
+ /** Target platform. Defaults to `mobile` (the DOM bundle hosted in the
13
+ * WebView). */
14
+ platform?: SynthesisUiPlatform;
15
+ /** Brand analytics / link tracking. */
16
+ onTrack?: (event: string, payload?: unknown) => void;
17
+ /** Host slot callbacks (developer-supplied event handlers). */
18
+ onEvent?: (name: string, payload?: unknown) => void;
19
+ /** Navigate a link the view requested (the WebView never navigates itself). */
20
+ onNavigate?: (href: string) => void;
21
+ /** Style for the hosting WebView. Defaults to `{ flex: 1 }`. */
22
+ style?: Record<string, unknown>;
23
+ }
24
+ /**
25
+ * React Native view for a server-generated mobile SynthesisUI. The generated
26
+ * bundle is plain DOM (Preact + htm), so it runs in a `WebView`: this streams
27
+ * the UI by `keyName`, loads the bundle in the WebView, pushes `data` in as it
28
+ * streams, and relays the view's `track`/`onEvent`/`navigate` back out. Mirrors
29
+ * the web `<BitBitView>` API + auto-beaconing.
30
+ */
31
+ export declare function BitBitView({ client: clientProp, keyName, platform, onTrack, onEvent, onNavigate, style, inputs, output, searchOptionsOverrides, synthesisHistoryLimit, }: BitBitViewProps): import("react").CElement<import("react-native-webview").WebViewProps, WebView> | null;
32
+ //# sourceMappingURL=BitBitView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BitBitView.d.ts","sourceRoot":"","sources":["../../src/react-native-expo/BitBitView.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAA4B,MAAM,sBAAsB,CAAC;AAEzE,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAGjC;;;mCAGmC;AACnC,MAAM,WAAW,eAAgB,SAAQ,wBAAwB;IAC/D;uBACmB;IACnB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB;oBACgB;IAChB,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,uCAAuC;IACvC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACrD,+DAA+D;IAC/D,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACpD,+EAA+E;IAC/E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAUD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EACzB,MAAM,EAAE,UAAU,EAClB,OAAO,EACP,QAAmB,EACnB,OAAO,EACP,OAAO,EACP,UAAU,EACV,KAAK,EACL,MAAM,EACN,MAAM,EACN,sBAAsB,EACtB,qBAAqB,GACtB,EAAE,eAAe,yFAsIjB"}
@@ -0,0 +1,130 @@
1
+ import { createElement, useCallback, useEffect, useRef, useState } from 'react';
2
+ import { WebView } from 'react-native-webview';
3
+ import { useBitBitContext } from '../synthesisUi/context.js';
4
+ import { buildBootstrapHtml } from './bootstrapHtml.js';
5
+ /**
6
+ * React Native view for a server-generated mobile SynthesisUI. The generated
7
+ * bundle is plain DOM (Preact + htm), so it runs in a `WebView`: this streams
8
+ * the UI by `keyName`, loads the bundle in the WebView, pushes `data` in as it
9
+ * streams, and relays the view's `track`/`onEvent`/`navigate` back out. Mirrors
10
+ * the web `<BitBitView>` API + auto-beaconing.
11
+ */
12
+ export function BitBitView({ client: clientProp, keyName, platform = 'mobile', onTrack, onEvent, onNavigate, style, inputs, output, searchOptionsOverrides, synthesisHistoryLimit, }) {
13
+ const contextClient = useBitBitContext()?.client;
14
+ const client = clientProp ?? contextClient;
15
+ const webRef = useRef(null);
16
+ const [html, setHtml] = useState(null);
17
+ // Latest streamed data + history + whether the WebView has loaded the bundle
18
+ // and can receive it. Refs (not state) so streaming doesn't churn renders.
19
+ const dataRef = useRef(undefined);
20
+ const historyRef = useRef(undefined);
21
+ const readyRef = useRef(false);
22
+ // Auto-beacon when `client` is a full BitBitPressClient (the bare preview
23
+ // fetcher has no `trackItem`). Failures are swallowed — analytics never break
24
+ // the view.
25
+ const trackItem = client?.user?.trackItem;
26
+ const beacon = useCallback((type, name, payload) => {
27
+ trackItem?.({ keyName, type, ...(name != null && { name }), payload })?.catch?.(() => { });
28
+ }, [trackItem, keyName]);
29
+ const pushData = useCallback((data, history) => {
30
+ webRef.current?.injectJavaScript(`window.__bb && window.__bb.update(${JSON.stringify(data)}, ${JSON.stringify(history)}); true;`);
31
+ }, []);
32
+ // Stream the UI: `manifest` builds the WebView document; `data` events push
33
+ // into the (already-loaded) WebView, or stash until it signals `ready`.
34
+ useEffect(() => {
35
+ if (!client)
36
+ return;
37
+ let cancelled = false;
38
+ readyRef.current = false;
39
+ dataRef.current = undefined;
40
+ historyRef.current = undefined;
41
+ setHtml(null);
42
+ void (async () => {
43
+ try {
44
+ const stream = await client.user.synthesizeUi({
45
+ keyName,
46
+ platform,
47
+ inputs,
48
+ output,
49
+ searchOptionsOverrides,
50
+ synthesisHistoryLimit,
51
+ });
52
+ for await (const event of stream) {
53
+ if (cancelled)
54
+ break;
55
+ if (event.type === 'manifest') {
56
+ const bundle = event.bundleUrl ?? event.bundleSource;
57
+ if (bundle)
58
+ setHtml(buildBootstrapHtml({ bundle, theme: event.theme }));
59
+ }
60
+ else if (event.type === 'data') {
61
+ dataRef.current = event.data;
62
+ historyRef.current = event.synthesisHistoryEntries;
63
+ if (readyRef.current)
64
+ pushData(event.data, event.synthesisHistoryEntries);
65
+ }
66
+ }
67
+ }
68
+ catch {
69
+ // A failed stream leaves the view unrendered rather than crashing.
70
+ }
71
+ })();
72
+ return () => {
73
+ cancelled = true;
74
+ };
75
+ }, [
76
+ client,
77
+ keyName,
78
+ platform,
79
+ pushData,
80
+ inputs,
81
+ output,
82
+ searchOptionsOverrides,
83
+ synthesisHistoryLimit,
84
+ ]);
85
+ const onMessage = useCallback((e) => {
86
+ let msg;
87
+ try {
88
+ msg = JSON.parse(e.nativeEvent.data);
89
+ }
90
+ catch {
91
+ return;
92
+ }
93
+ switch (msg.kind) {
94
+ case 'ready':
95
+ readyRef.current = true;
96
+ if (dataRef.current !== undefined)
97
+ pushData(dataRef.current, historyRef.current);
98
+ break;
99
+ case 'view':
100
+ beacon('VIEW');
101
+ break;
102
+ case 'track':
103
+ onTrack?.(msg.event, msg.payload);
104
+ beacon('CLICK', msg.event, msg.payload);
105
+ break;
106
+ case 'event':
107
+ onEvent?.(msg.name, msg.payload);
108
+ break;
109
+ case 'navigate':
110
+ onNavigate?.(msg.href);
111
+ break;
112
+ }
113
+ }, [beacon, onTrack, onEvent, onNavigate, pushData]);
114
+ if (!html)
115
+ return null;
116
+ return createElement(WebView, {
117
+ ref: webRef,
118
+ source: { html, baseUrl: 'https://localhost/' },
119
+ originWhitelist: ['*'],
120
+ onMessage,
121
+ javaScriptEnabled: true,
122
+ domStorageEnabled: true,
123
+ allowsInlineMediaPlayback: true,
124
+ mediaPlaybackRequiresUserAction: false,
125
+ // Links go to `onNavigate`, never in-WebView navigation.
126
+ onShouldStartLoadWithRequest: (request) => request.url === 'https://localhost/' || request.url.startsWith('about:'),
127
+ style: style ?? { flex: 1, backgroundColor: 'transparent' },
128
+ });
129
+ }
130
+ //# sourceMappingURL=BitBitView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BitBitView.js","sourceRoot":"","sources":["../../src/react-native-expo/BitBitView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,OAAO,EAA4B,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAM7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAgCxD;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,MAAM,EAAE,UAAU,EAClB,OAAO,EACP,QAAQ,GAAG,QAAQ,EACnB,OAAO,EACP,OAAO,EACP,UAAU,EACV,KAAK,EACL,MAAM,EACN,MAAM,EACN,sBAAsB,EACtB,qBAAqB,GACL;IAChB,MAAM,aAAa,GAAG,gBAAgB,EAAE,EAAE,MAAM,CAAC;IACjD,MAAM,MAAM,GAAG,UAAU,IAAI,aAAa,CAAC;IAE3C,MAAM,MAAM,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC5C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACtD,6EAA6E;IAC7E,2EAA2E;IAC3E,MAAM,OAAO,GAAG,MAAM,CAAU,SAAS,CAAC,CAAC;IAC3C,MAAM,UAAU,GAAG,MAAM,CAAU,SAAS,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,MAAM,CAAC,K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,QAAQ,CAAC;QAC1E,KAAK,EAAE,KAAK,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE;KAC5D,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The HTML document a mobile SynthesisUI WebView loads. It runs the generated
3
+ * bundle (Preact + htm DOM) inside the WebView and bridges both directions:
4
+ *
5
+ * - **data in**: native calls `window.__bb.update(data, history)` (via
6
+ * `injectJavaScript`) on each streamed `data` event; it mounts on the first
7
+ * one, updates after. `history` is forwarded into the view's props.
8
+ * - **events out**: the bundle's `ctx.track/onEvent/navigate` post `{ kind, … }`
9
+ * messages to native through `window.ReactNativeWebView.postMessage`, plus
10
+ * lifecycle signals (`ready`, `view`).
11
+ *
12
+ * `theme` and the bundle ref (a CDN `bundleUrl` or inline `bundleSource`) are
13
+ * baked in as JSON so there's no string-escaping surprise. Loading a bundle is
14
+ * the same blob→import dance the web runtime uses, but run inside the WebView.
15
+ */
16
+ export declare function buildBootstrapHtml(params: {
17
+ bundle: string;
18
+ theme: Record<string, string>;
19
+ }): string;
20
+ //# sourceMappingURL=bootstrapHtml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrapHtml.d.ts","sourceRoot":"","sources":["../../src/react-native-expo/bootstrapHtml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,GAAG,MAAM,CA8DT"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * The HTML document a mobile SynthesisUI WebView loads. It runs the generated
3
+ * bundle (Preact + htm DOM) inside the WebView and bridges both directions:
4
+ *
5
+ * - **data in**: native calls `window.__bb.update(data, history)` (via
6
+ * `injectJavaScript`) on each streamed `data` event; it mounts on the first
7
+ * one, updates after. `history` is forwarded into the view's props.
8
+ * - **events out**: the bundle's `ctx.track/onEvent/navigate` post `{ kind, … }`
9
+ * messages to native through `window.ReactNativeWebView.postMessage`, plus
10
+ * lifecycle signals (`ready`, `view`).
11
+ *
12
+ * `theme` and the bundle ref (a CDN `bundleUrl` or inline `bundleSource`) are
13
+ * baked in as JSON so there's no string-escaping surprise. Loading a bundle is
14
+ * the same blob→import dance the web runtime uses, but run inside the WebView.
15
+ */
16
+ export function buildBootstrapHtml(params) {
17
+ const bundle = JSON.stringify(params.bundle);
18
+ const theme = JSON.stringify(params.theme);
19
+ return `<!doctype html>
20
+ <html>
21
+ <head>
22
+ <meta charset="utf-8">
23
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover">
24
+ <style>
25
+ html, body { margin: 0; padding: 0; }
26
+ /* Viewport units (not %) so the app fills the WebView height without a
27
+ definite parent-height chain, which collapses in a WebView. */
28
+ body { min-height: 100vh; min-height: 100dvh; }
29
+ #bb-root {
30
+ min-height: 100vh;
31
+ min-height: 100dvh;
32
+ display: flex;
33
+ flex-direction: column;
34
+ }
35
+ /* Let the mounted app grow to fill the height (still scrolls when taller). */
36
+ #bb-root > * { flex: 1 0 auto; }
37
+ * { box-sizing: border-box; }
38
+ :root { -webkit-tap-highlight-color: transparent; }
39
+ </style>
40
+ </head>
41
+ <body>
42
+ <div id="bb-root"></div>
43
+ <script type="module">
44
+ const post = (m) => { try { window.ReactNativeWebView.postMessage(JSON.stringify(m)); } catch (e) {} };
45
+ const bb = (window.__bb = { theme: ${theme}, mod: null, handle: null, pending: null, viewed: false });
46
+ const wrap = (h) => (typeof h === 'function' ? { update() {}, unmount: h } : h);
47
+ const ctx = () => ({
48
+ theme: bb.theme,
49
+ track: (event, payload) => post({ kind: 'track', event, payload }),
50
+ onEvent: (name, payload) => post({ kind: 'event', name, payload }),
51
+ navigate: (href) => post({ kind: 'navigate', href }),
52
+ });
53
+ // Called by native (injectJavaScript) with each streamed data payload (+ the
54
+ // optional history array, forwarded into the view's props).
55
+ bb.update = (data, history) => {
56
+ if (!bb.mod) { bb.pending = { data, history }; return; }
57
+ const el = document.getElementById('bb-root');
58
+ const props = { data, history, ctx: ctx() };
59
+ if (bb.handle) { bb.handle.update(props); return; }
60
+ bb.handle = wrap(bb.mod.mount(el, props));
61
+ if (!bb.viewed) { bb.viewed = true; post({ kind: 'view' }); }
62
+ };
63
+ (async () => {
64
+ try {
65
+ const src = ${bundle};
66
+ const url = /^(https?:|blob:|data:|\\/)/.test(src)
67
+ ? src
68
+ : URL.createObjectURL(new Blob([src], { type: 'text/javascript' }));
69
+ bb.mod = await import(url);
70
+ if (typeof bb.mod.mount !== 'function') throw new Error('generated bundle has no mount()');
71
+ post({ kind: 'ready' });
72
+ if (bb.pending != null) bb.update(bb.pending.data, bb.pending.history);
73
+ } catch (e) {}
74
+ })();
75
+ </script>
76
+ </body>
77
+ </html>`;
78
+ }
79
+ //# sourceMappingURL=bootstrapHtml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrapHtml.js","sourceRoot":"","sources":["../../src/react-native-expo/bootstrapHtml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAGlC;IACC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;qCA0B4B,KAAK;;;;;;;;;;;;;;;;;;;;kBAoBxB,MAAM;;;;;;;;;;;;QAYhB,CAAC;AACT,CAAC"}
@@ -1,2 +1,4 @@
1
1
  export { type BitBitContextValue, BitBitProvider } from '../synthesisUi/context.js';
2
+ export type { SynthesisUiPlatform, SynthesisUiStreamEvent, SynthesizeUiFetcher, } from '../synthesisUi/types.js';
3
+ export { BitBitView, type BitBitViewProps } from './BitBitView.js';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react-native-expo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react-native-expo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACpF,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export { BitBitProvider } from '../synthesisUi/context.js';
2
+ export { BitBitView } from './BitBitView.js';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react-native-expo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react-native-expo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMpF,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAC"}
@@ -8,11 +8,24 @@
8
8
  * never shares a React instance with the bundle, sidestepping duplicate-React
9
9
  * hook errors. The contract here is types + DOM glue only (no React import).
10
10
  */
11
+ /** A prior synthesis output exposed to the view alongside the current `data`
12
+ * (same output schema). Present only when the request set
13
+ * `synthesisHistoryLimit > 0`. */
14
+ export interface SynthesisUiHistoryEntry<T = unknown> {
15
+ /** Id of this historical `SynthesisOutput` — pass to the submission methods to
16
+ * attach/read app-user submissions against that specific output. */
17
+ synthesisOutputId?: string;
18
+ data: T;
19
+ }
11
20
  /** Props every generated view receives. `data` is the synthesis output
12
21
  * (typed from the config's output schema); `ctx` is the host-provided
13
22
  * runtime. This is a shared TYPE, not a runtime dependency. */
14
23
  export interface BitBitViewProps<T = unknown> {
15
24
  data: T;
25
+ /** Recent prior outputs, most-recent first (the first entry is the current
26
+ * output). Empty/absent unless the request set `synthesisHistoryLimit > 0`.
27
+ * The view may ignore it or render it (e.g. a feed of past results). */
28
+ history?: SynthesisUiHistoryEntry<T>[];
16
29
  ctx: BitBitViewContext;
17
30
  }
18
31
  export interface BitBitViewContext {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;gEAEgE;AAChE,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC1C,IAAI,EAAE,CAAC,CAAC;IACR,GAAG,EAAE,iBAAiB,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,0CAA0C;IAC1C,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC9C,+DAA+D;IAC/D,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/C,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;qBACqB;AACrB,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IACrC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;0CAG0C;AAC1C,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,GA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IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAC5D,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import type { SynthesizeUiFetcher } from './types.js';
3
3
  export type BitBitContextValue = {
4
- /** Client `<BitBitSynthesis>` fetches generated UIs through, so it can be
4
+ /** Client `<BitBitView>` fetches generated UIs through, so it can be
5
5
  * set once here instead of passed to every instance. */
6
6
  client?: SynthesizeUiFetcher;
7
7
  };
8
8
  /**
9
- * Registers shared SDK config: the `client` `<BitBitSynthesis>` fetches
9
+ * Registers shared SDK config: the `client` `<BitBitView>` fetches
10
10
  * generated UIs through. Platform-agnostic, so this provider is shared by the
11
11
  * web and native entries.
12
12
  */
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createContext, useContext } from 'react';
3
3
  const BitBitContext = createContext(null);
4
4
  /**
5
- * Registers shared SDK config: the `client` `<BitBitSynthesis>` fetches
5
+ * Registers shared SDK config: the `client` `<BitBitView>` fetches
6
6
  * generated UIs through. Platform-agnostic, so this provider is shared by the
7
7
  * web and native entries.
8
8
  */
@@ -1,3 +1,5 @@
1
+ import type { paths } from '../generated/openapi.js';
2
+ import type { SynthesisUiHistoryEntry } from '../runtime/index.js';
1
3
  export type SynthesisUiPlatform = 'web' | 'mobile';
2
4
  /** Per-UI stream event the fetcher yields: a `manifest` (bundle ref + theme),
3
5
  * then `data` events as the synthesis output streams in. */
@@ -10,12 +12,22 @@ export type SynthesisUiStreamEvent = {
10
12
  type: 'data';
11
13
  data: unknown;
12
14
  complete: boolean;
15
+ /** Recent prior outputs (when `synthesisHistoryLimit > 0`), most-recent
16
+ * first. Forwarded into the view's `history` prop. */
17
+ synthesisHistoryEntries?: SynthesisUiHistoryEntry[];
13
18
  } | {
14
19
  type: 'error';
15
20
  error: string;
16
21
  };
17
22
  /**
18
- * Minimal structural shape `<BitBitSynthesis>` needs to fetch a UI. A
23
+ * Optional per-request synthesis inputs a UI request may carry — mirrors
24
+ * `/v1/user/synthesize` (the UI synthesizes against its attached config). Derived
25
+ * from the OpenAPI `/v1/user/synthesize-ui` item (minus `keyName`); all optional.
26
+ * Set `synthesisHistoryLimit > 0` to populate the view's `history` prop.
27
+ */
28
+ export type SynthesisUiRequestInputs = Omit<paths['/v1/user/synthesize-ui']['post']['requestBody']['content']['application/json']['items'][number], 'keyName'>;
29
+ /**
30
+ * Minimal structural shape `<BitBitView>` needs to fetch a UI. A
19
31
  * `BitBitPressClient` satisfies it via `client.user.synthesizeUi(...)`; the
20
32
  * CMS studio passes a preview fetcher that resolves the draft instead.
21
33
  */
@@ -24,7 +36,7 @@ export interface SynthesizeUiFetcher {
24
36
  synthesizeUi(request: {
25
37
  keyName: string;
26
38
  platform?: SynthesisUiPlatform;
27
- }): AsyncIterable<SynthesisUiStreamEvent> | Promise<AsyncIterable<SynthesisUiStreamEvent>>;
39
+ } & SynthesisUiRequestInputs): AsyncIterable<SynthesisUiStreamEvent> | Promise<AsyncIterable<SynthesisUiStreamEvent>>;
28
40
  };
29
41
  }
30
42
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/synthesisUi/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEnD;6DAC6D;AAC7D,MAAM,MAAM,sBAAsB,GAC9B;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,GACD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,OA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AC,CAAC,MAAM,CAAC,EACtG,SAAS,CACV,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE;QACJ,YAAY,CACV,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAC;YAChB,QAAQ,CAAC,EAAE,mBAAmB,CAAC;SAChC,GAAG,wBAAwB,GAC3B,aAAa,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAAC;KAC3F,CAAC;CACH"}
@@ -171,7 +171,7 @@ export interface UserMethods {
171
171
  respondToInteraction(interactionId: string, options: InteractionResponseRequest): Promise<NonNullable<InteractionResponseResponse>>;
172
172
  /**
173
173
  * Resolve a generated SynthesisUI by `keyName` for a platform, as a per-UI
174
- * stream (manifest, then data). This is the path `<BitBitSynthesis>` uses
174
+ * stream (manifest, then data). This is the path `<BitBitView>` uses
175
175
  * under the hood.
176
176
  */
177
177
  synthesizeUi(request: SynthesizeUiRequest): Promise<AsyncIterable<SynthesisUiStreamEvent>>;
@@ -55,6 +55,10 @@ export type SynthesizeEvent = {
55
55
  complete: boolean;
56
56
  error?: string;
57
57
  };
58
+ /** Detect Zod 4 schema (has _zod internals). */
59
+ export declare function isZodSchema(value: unknown): value is {
60
+ _zod: unknown;
61
+ };
58
62
  /** Options for synthesize stream: optional callback for streaming data updates per item index. */
59
63
  export interface SynthesizeOptions {
60
64
  /** Called for each data event with complete: false, with (index, streaming data). */
@@ -1 +1 @@
1
- {"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../src/user/synthesize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,eAAe,CAAC;AAExE,MAAM,MAAM,qBAAqB,GAAG;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEjF,MAAM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O,KAAK,IAAI,CAAC;CAC1D;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,eAAe,EACtB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAsBzC;AAED,wEAAwE;AACxE,MAAM,MAAM,yBAAyB,GACnC,OAAO,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC"}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isZodSchema = isZodSchema;
3
4
  exports.synthesize = synthesize;
4
5
  const zod_1 = require("zod");
5
6
  const request_js_1 = require("../request.js");
@@ -1 +1 @@
1
- {"version":3,"file":"synthesize.js","sourceRoot":"","sources":["../../src/user/synthesize.ts"],"names":[],"mappings":";;AAsGA,gCA0BC;AAhID,6BAAmC;AAEnC,8CAA4C;AAyD5C,gDAAgD;AAChD,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC;AACxE,CAAC;AAED;;;;;GAKG;AACH,SAAS,wBAAwB,CAAC,KAAsB;IACtD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAsC,EAAE;QAC5D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;QACnC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;YAC1C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IA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AK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACjC,IACE,OAAO,IAAI,KAAK;gBAChB,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;gBAC/B,KAAK,CAAC,QAAQ,KAAK,KAAK;gBACxB,KAAK,CAAC,KAAK,IAAI,IAAI,EACnB,CAAC;gBACD,eAAe,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3C,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;AACP,CAAC"}
@@ -1,23 +1,32 @@
1
1
  import type { RequestConfig } from '../request.js';
2
+ import { type SynthesisHistoryEntry } from './synthesize.js';
3
+ import type { SynthesizeUiItem } from './typeDefs.js';
2
4
  export type SynthesisUiPlatform = 'web' | 'mobile';
3
- /** One UI to resolve in a `synthesizeUis` request. */
4
- export interface SynthesizeUiRequestItem {
5
- /** Stable identifier of the UI to load. Configured in the BitBitPress CMS;
6
- * same value you pass as `<BitBitSynthesis keyName="…">`. */
7
- keyName: string;
8
- }
5
+ /**
6
+ * One UI to resolve in a `synthesizeUis` request. Derived from the OpenAPI
7
+ * `/v1/user/synthesize-ui` request schema.
8
+ *
9
+ * Beyond `keyName`, this accepts the same per-item synthesis inputs as
10
+ * `/v1/user/synthesize` (`inputs`, `output.schema`, `searchOptionsOverrides`,
11
+ * `synthesisHistoryLimit`) — the UI's synthesis runs against the config attached
12
+ * to it. All synthesis fields are optional; omit them to render the UI's default,
13
+ * config-driven content.
14
+ */
15
+ export type SynthesizeUiRequestItem = SynthesizeUiItem;
9
16
  /** Request to resolve a single generated UI by `keyName` for a platform. */
10
- export interface SynthesizeUiRequest extends SynthesizeUiRequestItem {
17
+ export type SynthesizeUiRequest = SynthesizeUiRequestItem & {
11
18
  /** Target platform for the artifact. Defaults to `web`. */
12
19
  platform?: SynthesisUiPlatform;
13
- }
20
+ };
14
21
  /**
15
22
  * Streamed `/v1/user/synthesize-ui` events (SSE):
16
23
  * - `connected` / `complete` — connection lifecycle.
17
24
  * - `manifest` — emitted once: the deployment `theme` and, per index-matched
18
25
  * item, the bundle reference. The SDK loads bundles as soon as this arrives.
19
26
  * - data — `{ index, data, complete }`; may stream partials before the final
20
- * `complete: true`. `{ index, error }` on failure.
27
+ * `complete: true`. Mirrors `/v1/user/synthesize`: the final event may also
28
+ * carry `synthesisOutputId` and, when `synthesisHistoryLimit > 0`,
29
+ * `synthesisHistoryEntries`. `{ index, error }` on failure.
21
30
  */
22
31
  export type SynthesizeUiEvent = {
23
32
  type: 'connected';
@@ -35,9 +44,15 @@ export type SynthesizeUiEvent = {
35
44
  index: number;
36
45
  data?: unknown;
37
46
  complete: boolean;
47
+ /** Id of the `SynthesisOutput` this result corresponds to — pass it to the
48
+ * submission methods to attach/read app-user submissions. */
49
+ synthesisOutputId?: string;
50
+ /** @deprecated Legacy bare-payload form; prefer `synthesisHistoryEntries`. */
51
+ synthesisHistory?: unknown[];
52
+ synthesisHistoryEntries?: SynthesisHistoryEntry[];
38
53
  error?: string;
39
54
  };
40
- /** Per-UI stream event `<BitBitSynthesis>` consumes (one UI, not the batch). */
55
+ /** Per-UI stream event `<BitBitView>` consumes (one UI, not the batch). */
41
56
  export type SynthesisUiStreamEvent = {
42
57
  type: 'manifest';
43
58
  bundleUrl?: string | null;
@@ -47,6 +62,10 @@ export type SynthesisUiStreamEvent = {
47
62
  type: 'data';
48
63
  data: unknown;
49
64
  complete: boolean;
65
+ synthesisOutputId?: string;
66
+ /** @deprecated Legacy bare-payload form; prefer `synthesisHistoryEntries`. */
67
+ synthesisHistory?: unknown[];
68
+ synthesisHistoryEntries?: SynthesisHistoryEntry[];
50
69
  } | {
51
70
  type: 'error';
52
71
  error: string;
@@ -55,13 +74,16 @@ export type SynthesisUiStreamEvent = {
55
74
  * Resolve generated SynthesisUIs by `keyName` for a platform. Streams a
56
75
  * `manifest` (bundles + theme) followed by per-item `data` events, index-matched
57
76
  * to `items`. The bundle is served from a CDN by versioned `bundleUrl` and
58
- * cached across renders/users; `data` is the per-request piece.
77
+ * cached across renders/users; `data` is the per-request, per-user piece
78
+ * synthesized against each UI's attached config (same inputs/streaming as
79
+ * `/v1/user/synthesize`).
59
80
  */
60
81
  export declare function synthesizeUis(config: RequestConfig, items: SynthesizeUiRequestItem[], platform?: SynthesisUiPlatform): Promise<AsyncIterable<SynthesizeUiEvent>>;
61
82
  /**
62
83
  * Resolve a single generated SynthesisUI by `keyName`, as a per-UI stream
63
- * (manifest, then data). Most apps reach this through `<BitBitSynthesis
64
- * keyName="…">` rather than calling it directly.
84
+ * (manifest, then data). Most apps reach this through `<BitBitView
85
+ * keyName="…">` rather than calling it directly. Accepts the same optional
86
+ * synthesis inputs as `synthesizeUis` (forwarded through to the one item).
65
87
  */
66
88
  export declare function synthesizeUi(config: RequestConfig, request: SynthesizeUiRequest): Promise<AsyncIterable<SynthesisUiStreamEvent>>;
67
89
  //# sourceMappingURL=synthesizeUi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"synthesizeUi.d.ts","sourceRoot":"","sources":["../../src/user/synthesizeUi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEnD,sDAAsD;AACtD,MAAM,WAAW,uBAAuB;IACtC;kEAC8D;IAC9D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,4EAA4E;AAC5E,MAAM,WAAW,mBAAoB,SAAQ,uBAAuB;IAClE,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM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,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC;IAC7B,uBAAuB,CAAC,EAAE,qBAAqB,EAAE,CAAC;CACnD,GACD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAmBrC;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,uBAAuB,EAAE,EAChC,QAAQ,CAAC,EAAE,mBAAmB,GAC7B,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAM3C;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAgChD"}
@@ -2,36 +2,58 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.synthesizeUis = synthesizeUis;
4
4
  exports.synthesizeUi = synthesizeUi;
5
+ const zod_1 = require("zod");
5
6
  const request_js_1 = require("../request.js");
7
+ const synthesize_js_1 = require("./synthesize.js");
8
+ /** Convert an item's `output.schema` to the wire form (a JSON-schema string),
9
+ * dropping `output` entirely when no schema is set so the server falls back to
10
+ * the config's declared schema. Zod 4 schemas are serialized to JSON schema. */
11
+ function toWireItem(item) {
12
+ const schema = item.output?.schema;
13
+ if (schema === undefined) {
14
+ const { output: _output, ...rest } = item;
15
+ return rest;
16
+ }
17
+ return {
18
+ ...item,
19
+ output: {
20
+ schema: (0, synthesize_js_1.isZodSchema)(schema) ? JSON.stringify((0, zod_1.toJSONSchema)(schema)) : schema,
21
+ },
22
+ };
23
+ }
6
24
  /**
7
25
  * Resolve generated SynthesisUIs by `keyName` for a platform. Streams a
8
26
  * `manifest` (bundles + theme) followed by per-item `data` events, index-matched
9
27
  * to `items`. The bundle is served from a CDN by versioned `bundleUrl` and
10
- * cached across renders/users; `data` is the per-request piece.
28
+ * cached across renders/users; `data` is the per-request, per-user piece
29
+ * synthesized against each UI's attached config (same inputs/streaming as
30
+ * `/v1/user/synthesize`).
11
31
  */
12
32
  async function synthesizeUis(config, items, platform) {
13
33
  return (0, request_js_1.makeRequest)(config, {
14
34
  method: 'POST',
15
35
  path: '/v1/user/synthesize-ui',
16
- body: { platform, items },
36
+ body: { platform, items: items.map(toWireItem) },
17
37
  });
18
38
  }
19
39
  /**
20
40
  * Resolve a single generated SynthesisUI by `keyName`, as a per-UI stream
21
- * (manifest, then data). Most apps reach this through `<BitBitSynthesis
22
- * keyName="…">` rather than calling it directly.
41
+ * (manifest, then data). Most apps reach this through `<BitBitView
42
+ * keyName="…">` rather than calling it directly. Accepts the same optional
43
+ * synthesis inputs as `synthesizeUis` (forwarded through to the one item).
23
44
  */
24
45
  async function synthesizeUi(config, request) {
25
- const stream = await synthesizeUis(config, [{ keyName: request.keyName }], request.platform);
46
+ const { platform, ...item } = request;
47
+ const stream = await synthesizeUis(config, [item], platform);
26
48
  return (async function* perUi() {
27
49
  for await (const event of stream) {
28
50
  if ('type' in event) {
29
51
  if (event.type === 'manifest') {
30
- const item = event.items.find((i) => i.index === 0);
52
+ const manifestItem = event.items.find((i) => i.index === 0);
31
53
  yield {
32
54
  type: 'manifest',
33
- bundleUrl: item?.bundleUrl,
34
- bundleSource: item?.bundleSource,
55
+ bundleUrl: manifestItem?.bundleUrl,
56
+ bundleSource: manifestItem?.bundleSource,
35
57
  theme: event.theme,
36
58
  };
37
59
  }
@@ -43,7 +65,14 @@ async function synthesizeUi(config, request) {
43
65
  yield { type: 'error', error: event.error };
44
66
  }
45
67
  else {
46
- yield { type: 'data', data: event.data, complete: event.complete };
68
+ yield {
69
+ type: 'data',
70
+ data: event.data,
71
+ complete: event.complete,
72
+ synthesisOutputId: event.synthesisOutputId,
73
+ synthesisHistory: event.synthesisHistory,
74
+ synthesisHistoryEntries: event.synthesisHistoryEntries,
75
+ };
47
76
  }
48
77
  }
49
78
  })();
@@ -1 +1 @@
1
- {"version":3,"file":"synthesizeUi.js","sourceRoot":"","sources":["../../src/user/synthesizeUi.ts"],"names":[],"mappings":";;AAqDA,sCAUC;AAOD,oCA2BC;AAhGD,8CAA4C;AA8C5C;;;;;GAKG;AACI,KAAK,UAAU,aAAa,CACjC,MAAqB,EACrB,KAAgC,EAChC,QAA8B;IAE9B,OAAO,IAAA,wBAAW,EAAmC,MAAM,EAAE;QAC3D,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE;KAC1B,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,YAAY,CAChC,MAAqB,EACrB,OAA4B;IAE5B,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7F,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,KAAK;QAC3B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACjC,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;oBAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;oBACpD,MAAM;wBACJ,IAAI,EAAE,UAAU;wBAChB,SAAS,EA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,CAAC;YAC9C,CAAC;iBAAM,CAAC;gBACN,MAAM;oBACJ,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;oBACxB,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;oBAC1C,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;oBACxC,uBAAuB,EAAE,KAAK,CAAC,uBAAuB;iBACvD,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;AACP,CAAC"}
@@ -20,6 +20,19 @@ export type SynthesizeItem = Omit<SynthesizeRequest['items'][number], 'output'>
20
20
  };
21
21
  /** Single input in an item's inputs array (externalId, text, or excludeExternalIds). */
22
22
  export type SynthesizeInput = NonNullable<SynthesizeItem['inputs']>[number];
23
+ /** Request body for POST /v1/user/synthesize-ui */
24
+ export type SynthesizeUiRequestBody = paths['/v1/user/synthesize-ui']['post']['requestBody']['content']['application/json'];
25
+ /**
26
+ * Single synthesize-ui request item (API shape), with `output` widened to accept
27
+ * a Zod 4 schema (converted to a JSON-schema string before sending), matching
28
+ * {@link SynthesizeItem}. Carries `keyName` (the UI) plus the same optional
29
+ * synthesis inputs as `/v1/user/synthesize`.
30
+ */
31
+ export type SynthesizeUiItem = Omit<SynthesizeUiRequestBody['items'][number], 'output'> & {
32
+ output?: {
33
+ schema?: SynthesizeOutputSchema;
34
+ };
35
+ };
23
36
  /** Output schema for a synthesize item: JSON schema as string, or a Zod 4 schema (converted to JSON schema string when sending). */
24
37
  export type SynthesizeOutputSchema = string | ZodType;
25
38
  /** Request body for POST /v1/user/recommendations (optional body) */
@@ -1 +1 @@
1
- {"version":3,"file":"typeDefs.d.ts","sourceRoot":"","sources":["../../src/user/typeDefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC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AM,4BAA4B,GAAG,iBAAiB,CAAC;AAE7D,6CAA6C;AAC7C,MAAM,MAAM,eAAe,GAAG,cAAc,EAAE,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG;IAChF,MAAM,CAAC,EAAE;QACP,MAAM,CAAC,EAAE,sBAAsB,CAAC;KACjC,CAAC;CACH,CAAC;AAEF,wFAAwF;AACxF,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,mDAAmD;AACnD,MAAM,MAAM,uBAAuB,GACjC,KAAK,CAAC,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAExF;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG;IACxF,MAAM,CAAC,EAAE;QACP,MAAM,CAAC,EAAE,sBAAsB,CAAC;KACjC,CAAC;CACH,CAAC;AAEF,oIAAoI;AACpI,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,OAAO,CAAC;AAEtD,qEAAqE;AACrE,MAAM,MAAM,0BAA0B,GAAG,WAAW,CAClD,KAAK,CAAC,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CACzD,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitbitpress/client",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "BitBitPress TypeScript client library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -79,19 +79,20 @@
79
79
  "@types/react-native": "*",
80
80
  "expo-linear-gradient": ">=12",
81
81
  "react": ">=18",
82
- "react-native": ">=0.76"
82
+ "react-native": ">=0.76",
83
+ "react-native-webview": ">=13"
83
84
  },
84
85
  "peerDependenciesMeta": {
85
- "@types/react-native": {
86
+ "react-native": {
86
87
  "optional": true
87
88
  },
88
- "expo-linear-gradient": {
89
+ "react-native-webview": {
89
90
  "optional": true
90
91
  },
91
- "react": {
92
+ "expo-linear-gradient": {
92
93
  "optional": true
93
94
  },
94
- "react-native": {
95
+ "@types/react-native": {
95
96
  "optional": true
96
97
  }
97
98
  }