@bitbitpress/client 1.1.1 → 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.
- package/README.md +39 -19
- package/dist/data/assets.d.ts +11 -3
- package/dist/data/assets.d.ts.map +1 -1
- package/dist/data/assets.js +2 -2
- package/dist/data/assets.js.map +1 -1
- package/dist/data/index.d.ts +2 -2
- package/dist/generated/openapi.d.ts +41 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/react/index.d.ts +16 -11
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +37 -10
- package/dist/react/index.js.map +1 -1
- package/dist/react-native-expo/BitBitView.d.ts +32 -0
- package/dist/react-native-expo/BitBitView.d.ts.map +1 -0
- package/dist/react-native-expo/BitBitView.js +130 -0
- package/dist/react-native-expo/BitBitView.js.map +1 -0
- package/dist/react-native-expo/bootstrapHtml.d.ts +20 -0
- package/dist/react-native-expo/bootstrapHtml.d.ts.map +1 -0
- package/dist/react-native-expo/bootstrapHtml.js +79 -0
- package/dist/react-native-expo/bootstrapHtml.js.map +1 -0
- package/dist/react-native-expo/index.d.ts +2 -0
- package/dist/react-native-expo/index.d.ts.map +1 -1
- package/dist/react-native-expo/index.js +1 -0
- package/dist/react-native-expo/index.js.map +1 -1
- package/dist/runtime/index.d.ts +13 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/synthesisUi/context.d.ts +2 -2
- package/dist/synthesisUi/context.js +1 -1
- package/dist/synthesisUi/types.d.ts +14 -2
- package/dist/synthesisUi/types.d.ts.map +1 -1
- package/dist/user/index.d.ts +5 -5
- package/dist/user/interaction.d.ts +2 -4
- package/dist/user/interaction.d.ts.map +1 -1
- package/dist/user/interaction.js +2 -4
- package/dist/user/interaction.js.map +1 -1
- package/dist/user/synthesize.d.ts +16 -15
- package/dist/user/synthesize.d.ts.map +1 -1
- package/dist/user/synthesize.js +2 -1
- package/dist/user/synthesize.js.map +1 -1
- package/dist/user/synthesizeUi.d.ts +35 -13
- package/dist/user/synthesizeUi.d.ts.map +1 -1
- package/dist/user/synthesizeUi.js +38 -9
- package/dist/user/synthesizeUi.js.map +1 -1
- package/dist/user/typeDefs.d.ts +13 -0
- package/dist/user/typeDefs.d.ts.map +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -56,8 +56,8 @@ More details can also be found in your control room's API docs @ https://your-co
|
|
|
56
56
|
- [signalItem](#signalitem)
|
|
57
57
|
- [synthesizeItem](#synthesizeitem)
|
|
58
58
|
- [synthesize](#synthesize)
|
|
59
|
-
- [interactions](#interactions)
|
|
60
|
-
- [respondToInteraction](#respondtointeraction)
|
|
59
|
+
- [interactions (deprecated)](#interactions)
|
|
60
|
+
- [respondToInteraction (deprecated)](#respondtointeraction)
|
|
61
61
|
- [Data Methods](#data-methods)
|
|
62
62
|
- [assets](#assets)
|
|
63
63
|
- [Types](#types)
|
|
@@ -450,6 +450,7 @@ client.user.submit(options: SubmitRequest): Promise<SubmitResponse>
|
|
|
450
450
|
|
|
451
451
|
```typescript
|
|
452
452
|
const { synthesisOutputId } = await client.user.synthesizeItem(pollItem);
|
|
453
|
+
if (!synthesisOutputId) throw new Error('Poll output is missing synthesisOutputId');
|
|
453
454
|
await client.user.submit({ synthesisOutputId, data: { response: 'yes' } });
|
|
454
455
|
```
|
|
455
456
|
|
|
@@ -625,12 +626,12 @@ client.user.synthesizeItem(
|
|
|
625
626
|
|
|
626
627
|
##### Parameters
|
|
627
628
|
|
|
628
|
-
- `item` (required): A single synthesize item (same shape as items in `synthesize`): `inputs`, `output` (schema as JSON string or Zod 4 schema), optional `configurationKeyName`, optional `synthesisHistoryLimit` (how many recent stored outputs to expose in `
|
|
629
|
+
- `item` (required): A single synthesize item (same shape as items in `synthesize`): `inputs`, `output` (schema as JSON string or Zod 4 schema), optional `configurationKeyName`, optional `synthesisHistoryLimit` (how many recent stored outputs to expose in `synthesisHistoryEntries`; defaults to `0` — no history emitted), optional `searchOptionsOverrides` (e.g. `{ lookbackMinutes: 1440 }` for 24-hour lookback)
|
|
629
630
|
- `onStreamingData` (optional): Callback invoked with streaming data whenever a stream event has `complete: false` for this item. Type: `(data: unknown) => void`.
|
|
630
631
|
|
|
631
632
|
##### Returns
|
|
632
633
|
|
|
633
|
-
- `Promise<SynthesizeItemResponse>`: Resolves with the final data event for this item — `data` is the synthesized object (keys match your output schema) when present; `
|
|
634
|
+
- `Promise<SynthesizeItemResponse>`: Resolves with the final data event for this item — `data` is the synthesized object (keys match your output schema) when present; `synthesisOutputId` identifies the current output for submissions; `synthesisHistoryEntries` is an array of recent stored `{ synthesisOutputId, data }` entries when `synthesisHistoryLimit > 0` (most-recent first; the first entry is the current synthesis itself); deprecated `synthesisHistory` may also be present as bare payloads; `error` is set on failure
|
|
634
635
|
|
|
635
636
|
##### Behavior
|
|
636
637
|
|
|
@@ -685,7 +686,7 @@ client.user.synthesize(
|
|
|
685
686
|
- `inputs` (optional): Context for synthesis — array of `{ type: "externalId" | "text" | "excludeExternalIds", value: string }` (article ID, freeform text, or comma-separated external IDs to exclude)
|
|
686
687
|
- `output`: `{ schema: string | ZodType }` — output schema as a JSON string or Zod 4 schema (top-level type must be `"object"`; supports object, string, number, boolean, array, and enum)
|
|
687
688
|
- `configurationKeyName` (optional): Key name for configuration
|
|
688
|
-
- `synthesisHistoryLimit` (optional): How many recent stored synthesis outputs to expose in the final data event's `
|
|
689
|
+
- `synthesisHistoryLimit` (optional): How many recent stored synthesis outputs to expose in the final data event's `synthesisHistoryEntries` field. Defaults to `0` (no history emitted). When `> 0`, the final event includes a `synthesisHistoryEntries` array of up to N `{ synthesisOutputId, data }` entries (most-recent first; first entry is the current synthesis itself). A deprecated `synthesisHistory` array of bare payloads may also be present for retrocompatibility.
|
|
689
690
|
- `searchOptionsOverrides` (optional): Per-request overrides, e.g. `{ lookbackMinutes: 1440 }` for 24-hour lookback.
|
|
690
691
|
- `options` (optional): `{ onStreamingData?: (index: number, data: unknown) => void }` — if provided, `onStreamingData` is called for each data event with `complete: false`, with the item's index and streaming data
|
|
691
692
|
|
|
@@ -697,7 +698,7 @@ client.user.synthesize(
|
|
|
697
698
|
|
|
698
699
|
- `{ type: "connected" }`: Connection established
|
|
699
700
|
- `{ type: "complete" }`: Stream complete
|
|
700
|
-
- `{ index, data?, synthesisHistory?, complete, error? }`: Data event for that item. Multiple events may be sent per index as partial updates; the final event has `complete: true` and the validated object. When `complete` is false, `data` is streaming data (partial object). `
|
|
701
|
+
- `{ index, data?, synthesisOutputId?, synthesisHistoryEntries?, synthesisHistory?, complete, error? }`: Data event for that item. Multiple events may be sent per index as partial updates; the final event has `complete: true` and the validated object. When `complete` is false, `data` is streaming data (partial object). `synthesisHistoryEntries` (only on the final event, only when `synthesisHistoryLimit > 0`) is an array of recent stored `{ synthesisOutputId, data }` entries, most-recent first. `synthesisHistory` is deprecated and contains the same entries as bare payloads. `error` is set on failure.
|
|
701
702
|
|
|
702
703
|
##### Example
|
|
703
704
|
|
|
@@ -753,6 +754,8 @@ for await (const event of stream) {
|
|
|
753
754
|
|
|
754
755
|
#### interactions
|
|
755
756
|
|
|
757
|
+
**Deprecated:** use `client.user.submissionState({ synthesisOutputId })`, keyed by the poll's synthesis output. This legacy method is kept for retrocompatibility.
|
|
758
|
+
|
|
756
759
|
Batch-resolve interaction state for items from a synthesis output. Returns aggregates and whether the current user has already responded to each.
|
|
757
760
|
|
|
758
761
|
```typescript
|
|
@@ -803,6 +806,8 @@ for (const item of interactions) {
|
|
|
803
806
|
|
|
804
807
|
#### respondToInteraction
|
|
805
808
|
|
|
809
|
+
**Deprecated:** use `client.user.submit({ synthesisOutputId, data })`, keyed by the poll's synthesis output. This legacy method is kept for retrocompatibility.
|
|
810
|
+
|
|
806
811
|
Submit or update a response to an interaction (e.g. a poll answer). Returns updated aggregates.
|
|
807
812
|
|
|
808
813
|
```typescript
|
|
@@ -849,7 +854,7 @@ Data methods require authentication. Call `client.user.authenticate()` before us
|
|
|
849
854
|
|
|
850
855
|
#### assets
|
|
851
856
|
|
|
852
|
-
Fetch assets by IDs and return requested fields.
|
|
857
|
+
Fetch assets by internal IDs or external IDs, and return requested fields.
|
|
853
858
|
|
|
854
859
|
```typescript
|
|
855
860
|
client.data.assets(options: AssetsRequest): Promise<AssetsResponse>
|
|
@@ -857,7 +862,8 @@ client.data.assets(options: AssetsRequest): Promise<AssetsResponse>
|
|
|
857
862
|
|
|
858
863
|
##### Parameters
|
|
859
864
|
|
|
860
|
-
- `options.assetIds` (required): List of asset IDs to fetch
|
|
865
|
+
- `options.assetIds` (required unless `externalIds` is provided): List of BitBitPress asset IDs to fetch
|
|
866
|
+
- `options.externalIds` (required unless `assetIds` is provided): List of source-system external IDs to fetch
|
|
861
867
|
- `options.assetFields` (required): Asset fields to return (dot or bracket notation, e.g. `tags[0]`, `images[1].src`). Allowed: `assetId`, `title`, `tags`, `images`, `videos`, `audios`, `publishedAt`, `externalId`, `externalData`, `assetType`, `sourceUrl`, `dataSource.name`, and subfields. Empty array returns objects with only `assetId`.
|
|
862
868
|
|
|
863
869
|
##### Returns
|
|
@@ -1072,7 +1078,7 @@ Request body for POST `/v1/user/synthesize` (from OpenAPI). Each item has `input
|
|
|
1072
1078
|
type SynthesizeRequest = {
|
|
1073
1079
|
items: Array<{
|
|
1074
1080
|
configurationKeyName?: string;
|
|
1075
|
-
synthesisHistoryLimit?: number; // how many recent stored outputs to include in
|
|
1081
|
+
synthesisHistoryLimit?: number; // how many recent stored outputs to include in synthesisHistoryEntries; defaults to 0 (no history emitted)
|
|
1076
1082
|
searchOptionsOverrides?: { lookbackMinutes?: number };
|
|
1077
1083
|
inputs?: Array<{ type: 'externalId' | 'text' | 'excludeExternalIds'; value: string }>;
|
|
1078
1084
|
output: {
|
|
@@ -1092,16 +1098,24 @@ Same shape as the request items above, but `output.schema` may be a **string or
|
|
|
1092
1098
|
|
|
1093
1099
|
#### SynthesizeEvent
|
|
1094
1100
|
|
|
1095
|
-
Stream events (SSE). Connection events use `type`; data events use `index`, optional `data`, required `complete`, and optional `error`. Multiple data events may be sent per index as partial object updates; the final event for an index has `complete: true` and the validated object.
|
|
1101
|
+
Stream events (SSE). Connection events use `type`; data events use `index`, optional `data`, optional `synthesisOutputId`, optional history fields, required `complete`, and optional `error`. Multiple data events may be sent per index as partial object updates; the final event for an index has `complete: true` and the validated object.
|
|
1096
1102
|
|
|
1097
1103
|
```typescript
|
|
1098
1104
|
type SynthesizeEvent =
|
|
1099
1105
|
| { type: 'connected' }
|
|
1100
1106
|
| { type: 'complete' }
|
|
1101
|
-
| {
|
|
1107
|
+
| {
|
|
1108
|
+
index: number;
|
|
1109
|
+
data?: unknown;
|
|
1110
|
+
synthesisOutputId?: string;
|
|
1111
|
+
synthesisHistoryEntries?: Array<{ synthesisOutputId: string; data: unknown }>;
|
|
1112
|
+
synthesisHistory?: unknown[]; // deprecated bare-payload history
|
|
1113
|
+
complete: boolean;
|
|
1114
|
+
error?: string;
|
|
1115
|
+
};
|
|
1102
1116
|
```
|
|
1103
1117
|
|
|
1104
|
-
When `complete` is true, `data` is the full synthesized object (keys match your output schema). When `complete` is false, `data` is streaming data (partial update). When the request set `synthesisHistoryLimit > 0`, the final event also includes `
|
|
1118
|
+
When `complete` is true, `data` is the full synthesized object (keys match your output schema). When `complete` is false, `data` is streaming data (partial update). `synthesisOutputId` identifies the current output and can be passed to `submit`, `submissionState`, or `submissionFeed`. When the request set `synthesisHistoryLimit > 0`, the final event also includes `synthesisHistoryEntries`: an array of recent stored `{ synthesisOutputId, data }` entries (most-recent first; first entry is the current synthesis itself). Deprecated `synthesisHistory` may also be present as index-aligned bare payloads. `error` is set on failure.
|
|
1105
1119
|
|
|
1106
1120
|
#### SynthesizeItemResponse
|
|
1107
1121
|
|
|
@@ -1109,9 +1123,11 @@ Return type of `synthesizeItem`. Same shape as a data event payload (without `in
|
|
|
1109
1123
|
|
|
1110
1124
|
```typescript
|
|
1111
1125
|
type SynthesizeItemResponse = {
|
|
1112
|
-
data?: unknown;
|
|
1113
|
-
|
|
1114
|
-
|
|
1126
|
+
data?: unknown; // synthesized object when present
|
|
1127
|
+
synthesisOutputId?: string; // current output id for submissions
|
|
1128
|
+
synthesisHistoryEntries?: Array<{ synthesisOutputId: string; data: unknown }>; // preferred history with output ids
|
|
1129
|
+
synthesisHistory?: unknown[]; // deprecated bare-payload history
|
|
1130
|
+
error?: string; // set on failure
|
|
1115
1131
|
};
|
|
1116
1132
|
```
|
|
1117
1133
|
|
|
@@ -1121,9 +1137,13 @@ Request body for POST `/v1/data/assets`.
|
|
|
1121
1137
|
|
|
1122
1138
|
```typescript
|
|
1123
1139
|
type AssetsRequest = {
|
|
1124
|
-
assetIds
|
|
1140
|
+
assetIds?: string[];
|
|
1141
|
+
externalIds?: string[];
|
|
1125
1142
|
assetFields: string[];
|
|
1126
|
-
}
|
|
1143
|
+
} & (
|
|
1144
|
+
| { assetIds: string[]; externalIds?: string[] }
|
|
1145
|
+
| { assetIds?: string[]; externalIds: string[] }
|
|
1146
|
+
);
|
|
1127
1147
|
```
|
|
1128
1148
|
|
|
1129
1149
|
#### AssetsResponse
|
|
@@ -1156,7 +1176,7 @@ interface SynthesizeOptions {
|
|
|
1156
1176
|
|
|
1157
1177
|
#### InteractionsRequest
|
|
1158
1178
|
|
|
1159
|
-
|
|
1179
|
+
Deprecated request body for POST `/v1/user/interactions`. Prefer `submissionState({ synthesisOutputId })`.
|
|
1160
1180
|
|
|
1161
1181
|
```typescript
|
|
1162
1182
|
type InteractionsRequest = {
|
|
@@ -1192,7 +1212,7 @@ type InteractionsResponse = InteractionItem[];
|
|
|
1192
1212
|
|
|
1193
1213
|
#### InteractionResponseRequest
|
|
1194
1214
|
|
|
1195
|
-
|
|
1215
|
+
Deprecated request body for POST `/v1/user/interactions/:interactionId/responses`. Prefer `submit({ synthesisOutputId, data })`.
|
|
1196
1216
|
|
|
1197
1217
|
```typescript
|
|
1198
1218
|
type InteractionResponseRequest = {
|
package/dist/data/assets.d.ts
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import type { paths } from '../generated/openapi.js';
|
|
2
2
|
import type { RequestConfig } from '../request.js';
|
|
3
|
-
|
|
3
|
+
type OpenApiAssetsRequest = paths['/v1/data/assets']['post']['requestBody']['content']['application/json'];
|
|
4
|
+
export type AssetsRequest = OpenApiAssetsRequest & ({
|
|
5
|
+
assetIds: string[];
|
|
6
|
+
externalIds?: string[];
|
|
7
|
+
} | {
|
|
8
|
+
assetIds?: string[];
|
|
9
|
+
externalIds: string[];
|
|
10
|
+
});
|
|
4
11
|
export type AssetsResponse = paths['/v1/data/assets']['post']['responses'][200]['content']['application/json']['data'];
|
|
5
12
|
/**
|
|
6
|
-
* Fetch assets by IDs and return requested fields.
|
|
13
|
+
* Fetch assets by internal and/or external IDs and return requested fields.
|
|
7
14
|
*
|
|
8
15
|
* @param config - Request configuration with base URL, timeout, fetch, and token
|
|
9
|
-
* @param options -
|
|
16
|
+
* @param options - assetFields and at least one of assetIds or externalIds
|
|
10
17
|
* @returns Promise that resolves with assets array
|
|
11
18
|
*/
|
|
12
19
|
export declare function assets(config: RequestConfig, options: AssetsRequest): Promise<AssetsResponse>;
|
|
20
|
+
export {};
|
|
13
21
|
//# sourceMappingURL=assets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/data/assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/data/assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,KAAK,oBAAoB,GACvB,KAAK,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAEjF,MAAM,MAAM,aAAa,GAAG,oBAAoB,GAC9C,CAAC;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAAC;AAEpG,MAAM,MAAM,cAAc,GACxB,KAAK,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5F;;;;;;GAMG;AACH,wBAAsB,MAAM,CAC1B,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,cAAc,CAAC,CAYzB"}
|
package/dist/data/assets.js
CHANGED
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assets = assets;
|
|
4
4
|
const request_js_1 = require("../request.js");
|
|
5
5
|
/**
|
|
6
|
-
* Fetch assets by IDs and return requested fields.
|
|
6
|
+
* Fetch assets by internal and/or external IDs and return requested fields.
|
|
7
7
|
*
|
|
8
8
|
* @param config - Request configuration with base URL, timeout, fetch, and token
|
|
9
|
-
* @param options -
|
|
9
|
+
* @param options - assetFields and at least one of assetIds or externalIds
|
|
10
10
|
* @returns Promise that resolves with assets array
|
|
11
11
|
*/
|
|
12
12
|
async function assets(config, options) {
|
package/dist/data/assets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../../src/data/assets.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../../src/data/assets.ts"],"names":[],"mappings":";;AAoBA,wBAeC;AAjCD,8CAA4C;AAW5C;;;;;;GAMG;AACI,KAAK,UAAU,MAAM,CAC1B,MAAqB,EACrB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAiB,MAAM,EAAE;QACzD,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/data/index.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ import { type AssetsRequest, type AssetsResponse } from './assets.js';
|
|
|
5
5
|
*/
|
|
6
6
|
export interface DataMethods {
|
|
7
7
|
/**
|
|
8
|
-
* Fetch assets by IDs and return requested fields.
|
|
8
|
+
* Fetch assets by internal and/or external IDs and return requested fields.
|
|
9
9
|
*
|
|
10
|
-
* @param options -
|
|
10
|
+
* @param options - assetFields and at least one of assetIds or externalIds
|
|
11
11
|
* @returns Promise that resolves with assets array
|
|
12
12
|
*/
|
|
13
13
|
assets(options: AssetsRequest): Promise<AssetsResponse>;
|
|
@@ -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`
|
|
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 `
|
|
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`.
|
|
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
|
};
|
|
@@ -1053,8 +1075,10 @@ export interface paths {
|
|
|
1053
1075
|
get?: never;
|
|
1054
1076
|
put?: never;
|
|
1055
1077
|
/**
|
|
1056
|
-
* Synthesis - Get User Interactions
|
|
1057
|
-
* @description **
|
|
1078
|
+
* Synthesis - Get User Interactions (DEPRECATED)
|
|
1079
|
+
* @description **DEPRECATED** — use `GET /v1/user/submissions` (submission state), keyed by the poll's `synthesisOutputId`. Kept for older app builds.
|
|
1080
|
+
*
|
|
1081
|
+
* **POST** `/v1/user/interactions`
|
|
1058
1082
|
*
|
|
1059
1083
|
* Batch-resolve interaction state for items from a synthesis output. Returns aggregates and whether the current user has already responded to each.
|
|
1060
1084
|
*/
|
|
@@ -1165,8 +1189,10 @@ export interface paths {
|
|
|
1165
1189
|
get?: never;
|
|
1166
1190
|
put?: never;
|
|
1167
1191
|
/**
|
|
1168
|
-
* Synthesis - Create User Interaction Response
|
|
1169
|
-
* @description **
|
|
1192
|
+
* Synthesis - Create User Interaction Response (DEPRECATED)
|
|
1193
|
+
* @description **DEPRECATED** — use `POST /v1/user/submissions` (submit), keyed by the poll's `synthesisOutputId`. Kept for older app builds.
|
|
1194
|
+
*
|
|
1195
|
+
* **POST** `/v1/user/interactions/:interactionId/responses`
|
|
1170
1196
|
*
|
|
1171
1197
|
* Submit or update a response to an interaction. Returns updated aggregates.
|
|
1172
1198
|
*/
|
|
@@ -1501,13 +1527,14 @@ export interface paths {
|
|
|
1501
1527
|
put?: never;
|
|
1502
1528
|
/**
|
|
1503
1529
|
* Data - Get Assets
|
|
1504
|
-
* @description **POST** `/v1/data/assets` Fetches assets by IDs and returns requested fields.
|
|
1530
|
+
* @description **POST** `/v1/data/assets` Fetches assets by internal or external IDs and returns requested fields.
|
|
1505
1531
|
*
|
|
1506
1532
|
* #### Request body
|
|
1507
1533
|
*
|
|
1508
1534
|
* | Field | Type | Required | Description |
|
|
1509
1535
|
* |-------|------|----------|-------------|
|
|
1510
|
-
* | `assetIds` | string[] | yes | List of asset IDs to fetch |
|
|
1536
|
+
* | `assetIds` | string[] | yes, unless `externalIds` is provided | List of internal asset IDs to fetch |
|
|
1537
|
+
* | `externalIds` | string[] | yes, unless `assetIds` is provided | List of external IDs to fetch |
|
|
1511
1538
|
* | `assetFields` | string[] | yes | Fields to return (dot or bracket notation, e.g. tags[0], images[1].src). Allowed: assetId, title, tags, images, videos, publishedAt, externalId, externalData, sourceUrl, dataSource.name, and subfields. Empty array returns objects with only `assetId`. `externalData`'s subfields are unique to your source data. |
|
|
1512
1539
|
*/
|
|
1513
1540
|
post: {
|
|
@@ -1524,10 +1551,12 @@ export interface paths {
|
|
|
1524
1551
|
content: {
|
|
1525
1552
|
"application/json": {
|
|
1526
1553
|
/** @description List of asset IDs to fetch */
|
|
1527
|
-
assetIds
|
|
1554
|
+
assetIds?: string[];
|
|
1555
|
+
/** @description List of external IDs to fetch */
|
|
1556
|
+
externalIds?: string[];
|
|
1528
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. */
|
|
1529
1558
|
assetFields: string[];
|
|
1530
|
-
};
|
|
1559
|
+
} & (unknown | unknown);
|
|
1531
1560
|
};
|
|
1532
1561
|
};
|
|
1533
1562
|
responses: {
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type { RecommendationsRequest, RecommendationsResponse } from './user/rec
|
|
|
17
17
|
export type { ReportRequest, ReportResponse } from './user/report.js';
|
|
18
18
|
export type { Signal, SignalRequest, SignalResponse } from './user/signal.js';
|
|
19
19
|
export type { CreateUserSubmissionRequest, CreateUserSubmissionResponse, ListUserSubmissionsRequest, ListUserSubmissionsResponse, PublicSubmission, SubmissionAggregate, SubmissionFeed, SubmissionFile, SubmissionState, SubmitRequest, SubmitResponse, } from './user/submissions.js';
|
|
20
|
-
export type { SynthesizeEvent, SynthesizeItemResponse, SynthesizeOptions, } from './user/synthesize.js';
|
|
20
|
+
export type { SynthesisHistoryEntry, SynthesizeEvent, SynthesizeItemResponse, SynthesizeOptions, } from './user/synthesize.js';
|
|
21
21
|
export type { SynthesizeOnStreamingData } from './user/synthesize-batch-manager.js';
|
|
22
22
|
export type { TokenRequest, TokenResponse } from './user/token.js';
|
|
23
23
|
export type { BitBitPressSynthesizeRequest, RecommendationsRequestBody, SynthesizeInput, SynthesizeItem, SynthesizeItems, SynthesizeOutputSchema, SynthesizeRequest, } from './user/typeDefs.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,mBAAmB,wBAAwB,CAAC;AAC5C,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,WAAW,EACX,QAAQ,GACT,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EACV,eAAe,EACf,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACjG,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtE,YAAY,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oB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACjG,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC9E,YAAY,EACV,2BAA2B,EAC3B,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AACpF,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,YAAY,EACV,4BAA4B,EAC5B,0BAA0B,EAC1B,eAAe,EACf,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC"}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|
11
|
-
* preview the
|
|
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
|
|
24
|
-
* `data` into the mounted view as it streams in.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
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
|
|
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,EAAE,MAAM,2BAA2B,CAAC;AACpF,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,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,EAAE,MAAM,2BAA2B,CAAC;AACpF,YAAY,EACV,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,GACpB,CAAC;AAEF;;;mCAGmC;AACnC,MAAM,WAAW,eAAgB,SAAQ,wBAAwB;IAC/D;uBACmB;IACnB,MAAM,CAAC,EAAE,mBAAmB,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"}
|
package/dist/react/index.js
CHANGED
|
@@ -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
|
|
10
|
-
* `data` into the mounted view as it streams in.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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
|
|
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({
|
|
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(
|
|
69
|
+
handle.update(props);
|
|
58
70
|
}
|
|
59
71
|
else {
|
|
60
|
-
|
|
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
|
-
}, [
|
|
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
|
package/dist/react/index.js.map
CHANGED
|
@@ -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;
|
|
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;AAa7D,OAAO,EAA2B,cAAc,EAAE,MAAM,2BAA2B,CAAC;AA6BpF,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEtB;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,MAAM,EAAE,UAAU,EAClB,OAAO,EACP,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,OAAO,EACP,UAAU,EACV,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;IAC3C,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC7C,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAA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C;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"}
|