@bitbitpress/client 1.1.2 → 1.1.4

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 (64) hide show
  1. package/dist/generated/openapi.d.ts +449 -7
  2. package/dist/react/index.d.ts +91 -12
  3. package/dist/react/index.d.ts.map +1 -1
  4. package/dist/react/index.js +146 -12
  5. package/dist/react/index.js.map +1 -1
  6. package/dist/react-native-expo/BitBitPiece.d.ts +64 -0
  7. package/dist/react-native-expo/BitBitPiece.d.ts.map +1 -0
  8. package/dist/react-native-expo/BitBitPiece.js +164 -0
  9. package/dist/react-native-expo/BitBitPiece.js.map +1 -0
  10. package/dist/react-native-expo/BitBitView.d.ts +32 -0
  11. package/dist/react-native-expo/BitBitView.d.ts.map +1 -0
  12. package/dist/react-native-expo/BitBitView.js +130 -0
  13. package/dist/react-native-expo/BitBitView.js.map +1 -0
  14. package/dist/react-native-expo/bootstrapHtml.d.ts +33 -0
  15. package/dist/react-native-expo/bootstrapHtml.d.ts.map +1 -0
  16. package/dist/react-native-expo/bootstrapHtml.js +175 -0
  17. package/dist/react-native-expo/bootstrapHtml.js.map +1 -0
  18. package/dist/react-native-expo/index.d.ts +3 -0
  19. package/dist/react-native-expo/index.d.ts.map +1 -1
  20. package/dist/react-native-expo/index.js +2 -0
  21. package/dist/react-native-expo/index.js.map +1 -1
  22. package/dist/runtime/index.d.ts +45 -0
  23. package/dist/runtime/index.d.ts.map +1 -1
  24. package/dist/runtime/index.js +68 -2
  25. package/dist/runtime/index.js.map +1 -1
  26. package/dist/studio/BitBitMobilePreview.d.ts +33 -0
  27. package/dist/studio/BitBitMobilePreview.d.ts.map +1 -0
  28. package/dist/studio/BitBitMobilePreview.js +120 -0
  29. package/dist/studio/BitBitMobilePreview.js.map +1 -0
  30. package/dist/studio/index.d.ts +7 -0
  31. package/dist/studio/index.d.ts.map +1 -0
  32. package/dist/studio/index.js +7 -0
  33. package/dist/studio/index.js.map +1 -0
  34. package/dist/synthesisUi/context.d.ts +2 -2
  35. package/dist/synthesisUi/context.js +1 -1
  36. package/dist/synthesisUi/types.d.ts +14 -2
  37. package/dist/synthesisUi/types.d.ts.map +1 -1
  38. package/dist/user/index.d.ts +28 -1
  39. package/dist/user/index.d.ts.map +1 -1
  40. package/dist/user/index.js +6 -1
  41. package/dist/user/index.js.map +1 -1
  42. package/dist/user/synthesisPiece.d.ts +38 -0
  43. package/dist/user/synthesisPiece.d.ts.map +1 -0
  44. package/dist/user/synthesisPiece.js +58 -0
  45. package/dist/user/synthesisPiece.js.map +1 -0
  46. package/dist/user/synthesize.d.ts +4 -0
  47. package/dist/user/synthesize.d.ts.map +1 -1
  48. package/dist/user/synthesize.js +1 -0
  49. package/dist/user/synthesize.js.map +1 -1
  50. package/dist/user/synthesizeUi.d.ts +35 -13
  51. package/dist/user/synthesizeUi.d.ts.map +1 -1
  52. package/dist/user/synthesizeUi.js +38 -9
  53. package/dist/user/synthesizeUi.js.map +1 -1
  54. package/dist/user/track-batch-manager.d.ts +10 -4
  55. package/dist/user/track-batch-manager.d.ts.map +1 -1
  56. package/dist/user/track-batch-manager.js +6 -5
  57. package/dist/user/track-batch-manager.js.map +1 -1
  58. package/dist/user/track.d.ts +9 -0
  59. package/dist/user/track.d.ts.map +1 -1
  60. package/dist/user/track.js +17 -0
  61. package/dist/user/track.js.map +1 -1
  62. package/dist/user/typeDefs.d.ts +13 -0
  63. package/dist/user/typeDefs.d.ts.map +1 -1
  64. package/package.json +11 -6
@@ -4,6 +4,86 @@
4
4
  */
5
5
 
6
6
  export interface paths {
7
+ "/v1/auth/magic-link": {
8
+ parameters: {
9
+ query?: never;
10
+ header?: never;
11
+ path?: never;
12
+ cookie?: never;
13
+ };
14
+ get?: never;
15
+ put?: never;
16
+ /**
17
+ * Auth - Send Magic Link
18
+ * @description **POST** `/v1/auth/magic-link`
19
+ *
20
+ * Send a one-time sign-in link by email. The callback must be registered for the supplied client. The token in the link is exchanged through `POST /v1/auth/token`.
21
+ */
22
+ post: {
23
+ parameters: {
24
+ query?: never;
25
+ header?: never;
26
+ path?: never;
27
+ cookie?: never;
28
+ };
29
+ requestBody: {
30
+ content: {
31
+ "application/json": {
32
+ email: string;
33
+ /** @description Public identifier of the app requesting the sign-in link */
34
+ clientId: string;
35
+ /** @description Registered callback URL. Optional when the client has a default callback. */
36
+ redirectUri?: string;
37
+ };
38
+ };
39
+ };
40
+ responses: {
41
+ /** @description Default Response */
42
+ 200: {
43
+ headers: {
44
+ [name: string]: unknown;
45
+ };
46
+ content: {
47
+ "application/json": {
48
+ /** @example true */
49
+ success: boolean;
50
+ };
51
+ };
52
+ };
53
+ /** @description Bad request - missing or invalid parameters */
54
+ 400: {
55
+ headers: {
56
+ [name: string]: unknown;
57
+ };
58
+ content: {
59
+ "application/json": {
60
+ /** @example Bad request */
61
+ error?: string;
62
+ };
63
+ };
64
+ };
65
+ /** @description Internal server error */
66
+ 500: {
67
+ headers: {
68
+ [name: string]: unknown;
69
+ };
70
+ content: {
71
+ "application/json": {
72
+ /** @example false */
73
+ success?: boolean;
74
+ /** @example Internal server error: An unknown error occurred */
75
+ error?: string;
76
+ };
77
+ };
78
+ };
79
+ };
80
+ };
81
+ delete?: never;
82
+ options?: never;
83
+ head?: never;
84
+ patch?: never;
85
+ trace?: never;
86
+ };
7
87
  "/v1/auth/token": {
8
88
  parameters: {
9
89
  query?: never;
@@ -767,6 +847,122 @@ export interface paths {
767
847
  patch?: never;
768
848
  trace?: never;
769
849
  };
850
+ "/v1/user/piece-events": {
851
+ parameters: {
852
+ query?: never;
853
+ header?: never;
854
+ path?: never;
855
+ cookie?: never;
856
+ };
857
+ get?: never;
858
+ put?: never;
859
+ /**
860
+ * Synthesis - Record Piece Events
861
+ * @description **POST** `/v1/user/piece-events` Records behavioral events (views, clicks) for a SynthesisPiece embed, addressed by the piece's `keyName`. Batched by the SDK; powers per-piece engagement. Distinct from `/v1/user/events` (SynthesisUIs) so a keyName shared across the two entity namespaces is never misattributed.
862
+ */
863
+ post: {
864
+ parameters: {
865
+ query?: never;
866
+ header: {
867
+ /** @description Bearer token for authentication */
868
+ authorization: string;
869
+ };
870
+ path?: never;
871
+ cookie?: never;
872
+ };
873
+ requestBody: {
874
+ content: {
875
+ "application/json": {
876
+ /** @description Events to record. */
877
+ events: {
878
+ /** @description The piece's load id (`<BitBitPiece keyName>`) the event belongs to. */
879
+ keyName: string;
880
+ /**
881
+ * @description VIEW (the piece was shown) or CLICK (a tracked interaction).
882
+ * @enum {string}
883
+ */
884
+ type: "VIEW" | "CLICK";
885
+ /** @description For CLICK: the human-readable action name. Omit for VIEW. */
886
+ name?: string;
887
+ /** @description Arbitrary event properties (retained for analytics drill-down). */
888
+ payload?: {
889
+ [key: string]: unknown;
890
+ };
891
+ /** @description ISO timestamp the event occurred; defaults to server time. */
892
+ occurredAt?: string;
893
+ }[];
894
+ };
895
+ };
896
+ };
897
+ responses: {
898
+ /** @description Events recorded */
899
+ 200: {
900
+ headers: {
901
+ [name: string]: unknown;
902
+ };
903
+ content: {
904
+ "application/json": {
905
+ /** @example true */
906
+ success: boolean;
907
+ data: {
908
+ /**
909
+ * @description Whether any event resolved to a known piece and was recorded.
910
+ * @example true
911
+ */
912
+ recorded: boolean;
913
+ };
914
+ };
915
+ };
916
+ };
917
+ /** @description Bad request - missing or invalid parameters */
918
+ 400: {
919
+ headers: {
920
+ [name: string]: unknown;
921
+ };
922
+ content: {
923
+ "application/json": {
924
+ /** @example Bad request */
925
+ error?: string;
926
+ };
927
+ };
928
+ };
929
+ /** @description Unauthorized errors */
930
+ 401: {
931
+ headers: {
932
+ [name: string]: unknown;
933
+ };
934
+ content: {
935
+ "application/json": {
936
+ /**
937
+ * @example Unauthorized: No authentication token provided
938
+ * @enum {string}
939
+ */
940
+ error?: "Unauthorized: No authentication token provided" | "Unauthorized: Token has expired" | "Unauthorized: Invalid token" | "Unauthorized: Authentication failed";
941
+ };
942
+ };
943
+ };
944
+ /** @description Internal server error */
945
+ 500: {
946
+ headers: {
947
+ [name: string]: unknown;
948
+ };
949
+ content: {
950
+ "application/json": {
951
+ /** @example false */
952
+ success?: boolean;
953
+ /** @example Internal server error: An unknown error occurred */
954
+ error?: string;
955
+ };
956
+ };
957
+ };
958
+ };
959
+ };
960
+ delete?: never;
961
+ options?: never;
962
+ head?: never;
963
+ patch?: never;
964
+ trace?: never;
965
+ };
770
966
  "/v1/user/synthesize": {
771
967
  parameters: {
772
968
  query?: never;
@@ -799,7 +995,7 @@ export interface paths {
799
995
  items: {
800
996
  /** @description Optional configuration key name. Loads an existing synthesis config by this name; omit for default configuration. */
801
997
  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. */
998
+ /** @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
999
  synthesisHistoryLimit?: number;
804
1000
  /** @description Per-request overrides for search options. */
805
1001
  searchOptionsOverrides?: {
@@ -845,7 +1041,7 @@ export interface paths {
845
1041
  * ```
846
1042
  * `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
1043
  *
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.
1044
+ * 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
1045
  *
850
1046
  * **Data Events (error):**
851
1047
  * ```json
@@ -926,9 +1122,9 @@ export interface paths {
926
1122
  * Synthesis - Synthesize UI
927
1123
  * @description **POST** `/v1/user/synthesize-ui`
928
1124
  *
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`.
1125
+ * 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
1126
  *
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.)
1127
+ * 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
1128
  */
933
1129
  post: {
934
1130
  parameters: {
@@ -952,6 +1148,28 @@ export interface paths {
952
1148
  items: {
953
1149
  /** @description Stable identifier of the UI to load. Configured in the CMS. */
954
1150
  keyName: string;
1151
+ /** @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. */
1152
+ synthesisHistoryLimit?: number;
1153
+ /** @description Per-request overrides for search options. */
1154
+ searchOptionsOverrides?: {
1155
+ /** @description Override for search lookback window in minutes (e.g. 1440 for last 24 hours). */
1156
+ lookbackMinutes?: number;
1157
+ };
1158
+ /** @description Inputs used as context for the synthesis: externalId (article ID), or text (freeform text). */
1159
+ inputs?: {
1160
+ /**
1161
+ * @description Type of input: externalId (article) or text (freeform).
1162
+ * @enum {string}
1163
+ */
1164
+ type: "externalId" | "text" | "excludeExternalIds";
1165
+ /** @description External ID (e.g. article) for externalId, freeform text for text, or comma-separated list of external IDs to exclude */
1166
+ value: string;
1167
+ }[];
1168
+ /** @description Optional output definition. Omit to use the output schema declared on the UI's attached config (`output.outputSchema`). */
1169
+ output?: {
1170
+ /** @description Output schema as a JSON string. Top-level type must be "object". See `/v1/user/synthesize` for the format. */
1171
+ schema: string;
1172
+ };
955
1173
  }[];
956
1174
  };
957
1175
  };
@@ -1043,6 +1261,230 @@ export interface paths {
1043
1261
  patch?: never;
1044
1262
  trace?: never;
1045
1263
  };
1264
+ "/v1/user/synthesis-piece": {
1265
+ parameters: {
1266
+ query?: never;
1267
+ header?: never;
1268
+ path?: never;
1269
+ cookie?: never;
1270
+ };
1271
+ get?: never;
1272
+ put?: never;
1273
+ /**
1274
+ * User - Get Synthesis Pieces
1275
+ * @description **POST** `/v1/user/synthesis-piece`
1276
+ *
1277
+ * Fetch one or more published pieces to display, each by its `keyName`. For every requested piece you receive its ready-to-render view (`uiWebCode`), its current content (`fields`), and your workspace's display theme (`theme`, the same for every piece). Render the view and give it the content as its data. Results come back in the same order as the pieces you requested; if a piece can't be found or isn't published, its result contains an `error` message in place of the content.
1278
+ */
1279
+ post: {
1280
+ parameters: {
1281
+ query?: never;
1282
+ header: {
1283
+ /** @description Bearer token for authentication */
1284
+ authorization: string;
1285
+ };
1286
+ path?: never;
1287
+ cookie?: never;
1288
+ };
1289
+ requestBody: {
1290
+ content: {
1291
+ "application/json": {
1292
+ /** @description The pieces to fetch, each by its key. */
1293
+ items: {
1294
+ /** @description The piece's unique key. */
1295
+ keyName: string;
1296
+ }[];
1297
+ };
1298
+ };
1299
+ };
1300
+ responses: {
1301
+ /** @description Successful response */
1302
+ 200: {
1303
+ headers: {
1304
+ [name: string]: unknown;
1305
+ };
1306
+ content: {
1307
+ "application/json": {
1308
+ /** @example true */
1309
+ success: boolean;
1310
+ data: {
1311
+ /** @description Your workspace's brand theme as CSS custom properties (the same for every piece). */
1312
+ theme: {
1313
+ [key: string]: string;
1314
+ };
1315
+ /** @description One result per requested piece, in the same order. */
1316
+ items: ({
1317
+ /** @description Position of this result in the requested list. */
1318
+ index: number;
1319
+ /** @description The piece's ready-to-render view. */
1320
+ uiWebCode?: string;
1321
+ /** @description The piece's current content, given to the view as its data (includes ready-to-play audio for audio pieces). */
1322
+ fields?: {
1323
+ [key: string]: unknown;
1324
+ };
1325
+ /** @description A message explaining why this piece couldn't be returned. */
1326
+ error?: string;
1327
+ } & {
1328
+ [key: string]: unknown;
1329
+ })[];
1330
+ };
1331
+ };
1332
+ };
1333
+ };
1334
+ /** @description Bad request - missing or invalid parameters */
1335
+ 400: {
1336
+ headers: {
1337
+ [name: string]: unknown;
1338
+ };
1339
+ content: {
1340
+ "application/json": {
1341
+ /** @example Bad request */
1342
+ error?: string;
1343
+ };
1344
+ };
1345
+ };
1346
+ /** @description Unauthorized errors */
1347
+ 401: {
1348
+ headers: {
1349
+ [name: string]: unknown;
1350
+ };
1351
+ content: {
1352
+ "application/json": {
1353
+ /**
1354
+ * @example Unauthorized: No authentication token provided
1355
+ * @enum {string}
1356
+ */
1357
+ error?: "Unauthorized: No authentication token provided" | "Unauthorized: Token has expired" | "Unauthorized: Invalid token" | "Unauthorized: Authentication failed";
1358
+ };
1359
+ };
1360
+ };
1361
+ /** @description Internal server error */
1362
+ 500: {
1363
+ headers: {
1364
+ [name: string]: unknown;
1365
+ };
1366
+ content: {
1367
+ "application/json": {
1368
+ /** @example false */
1369
+ success?: boolean;
1370
+ /** @example Internal server error: An unknown error occurred */
1371
+ error?: string;
1372
+ };
1373
+ };
1374
+ };
1375
+ };
1376
+ };
1377
+ delete?: never;
1378
+ options?: never;
1379
+ head?: never;
1380
+ patch?: never;
1381
+ trace?: never;
1382
+ };
1383
+ "/v1/user/synthesis-piece/tts": {
1384
+ parameters: {
1385
+ query?: never;
1386
+ header?: never;
1387
+ path?: never;
1388
+ cookie?: never;
1389
+ };
1390
+ get?: never;
1391
+ put?: never;
1392
+ /**
1393
+ * User - Synthesize Piece Audio
1394
+ * @description **POST** `/v1/user/synthesis-piece/tts`
1395
+ *
1396
+ * Mint a short-lived, self-authenticating HLS URL for a published piece's spoken content. A media player calls this when the listener presses play, then plays the returned `url` (via the SDK's `ctx.playMedia`) to stream the synthesized speech on demand. The request REFERENCES the piece's content — omit `field` for the whole piece's spoken content, pass a top-level `field` to scope to it, and/or `index` for a single turn — and the server resolves the turns from the piece itself (so the URL never carries the text). The URL is gated at issue time (a few-minute expiry, and only PUBLISHED pieces), so a fresh URL can't be minted after a piece is unpublished. Note: the URL is an HLS playlist whose audio segments are content-addressed and cached long-lived — a player that already loaded a URL may keep playing that audio from cache after the URL expires or the piece is unpublished.
1397
+ */
1398
+ post: {
1399
+ parameters: {
1400
+ query?: never;
1401
+ header: {
1402
+ /** @description Bearer token for authentication */
1403
+ authorization: string;
1404
+ };
1405
+ path?: never;
1406
+ cookie?: never;
1407
+ };
1408
+ requestBody: {
1409
+ content: {
1410
+ "application/json": {
1411
+ /** @description The piece's unique key. */
1412
+ keyName: string;
1413
+ /** @description Top-level field to voice. Omit for the whole piece's spoken content. */
1414
+ field?: string;
1415
+ /** @description A single turn index within the resolved content. Omit for all turns. */
1416
+ index?: number;
1417
+ };
1418
+ };
1419
+ };
1420
+ responses: {
1421
+ /** @description Successful response */
1422
+ 200: {
1423
+ headers: {
1424
+ [name: string]: unknown;
1425
+ };
1426
+ content: {
1427
+ "application/json": {
1428
+ /** @example true */
1429
+ success: boolean;
1430
+ data: {
1431
+ /** @description A short-lived streaming URL to point an `<audio>` element at. */
1432
+ url?: string;
1433
+ /** @description Set instead of `url` when audio can't be produced (piece not found/published, or the text isn't part of the piece). */
1434
+ error?: string;
1435
+ };
1436
+ };
1437
+ };
1438
+ };
1439
+ /** @description Bad request - missing or invalid parameters */
1440
+ 400: {
1441
+ headers: {
1442
+ [name: string]: unknown;
1443
+ };
1444
+ content: {
1445
+ "application/json": {
1446
+ /** @example Bad request */
1447
+ error?: string;
1448
+ };
1449
+ };
1450
+ };
1451
+ /** @description Unauthorized errors */
1452
+ 401: {
1453
+ headers: {
1454
+ [name: string]: unknown;
1455
+ };
1456
+ content: {
1457
+ "application/json": {
1458
+ /**
1459
+ * @example Unauthorized: No authentication token provided
1460
+ * @enum {string}
1461
+ */
1462
+ error?: "Unauthorized: No authentication token provided" | "Unauthorized: Token has expired" | "Unauthorized: Invalid token" | "Unauthorized: Authentication failed";
1463
+ };
1464
+ };
1465
+ };
1466
+ /** @description Internal server error */
1467
+ 500: {
1468
+ headers: {
1469
+ [name: string]: unknown;
1470
+ };
1471
+ content: {
1472
+ "application/json": {
1473
+ /** @example false */
1474
+ success?: boolean;
1475
+ /** @example Internal server error: An unknown error occurred */
1476
+ error?: string;
1477
+ };
1478
+ };
1479
+ };
1480
+ };
1481
+ };
1482
+ delete?: never;
1483
+ options?: never;
1484
+ head?: never;
1485
+ patch?: never;
1486
+ trace?: never;
1487
+ };
1046
1488
  "/v1/user/interactions": {
1047
1489
  parameters: {
1048
1490
  query?: never;
@@ -1054,7 +1496,7 @@ export interface paths {
1054
1496
  put?: never;
1055
1497
  /**
1056
1498
  * Synthesis - Get User Interactions (DEPRECATED)
1057
- * @description **DEPRECATED** — use `GET /v1/user/submissions` (submission state), keyed by the poll's `synthesisOutputId`. Kept for retrocompatibility.
1499
+ * @description **DEPRECATED** — use `GET /v1/user/submissions` (submission state), keyed by the poll's `synthesisOutputId`. Kept for older app builds.
1058
1500
  *
1059
1501
  * **POST** `/v1/user/interactions`
1060
1502
  *
@@ -1168,7 +1610,7 @@ export interface paths {
1168
1610
  put?: never;
1169
1611
  /**
1170
1612
  * Synthesis - Create User Interaction Response (DEPRECATED)
1171
- * @description **DEPRECATED** — use `POST /v1/user/submissions` (submit), keyed by the poll's `synthesisOutputId`. Kept for retrocompatibility.
1613
+ * @description **DEPRECATED** — use `POST /v1/user/submissions` (submit), keyed by the poll's `synthesisOutputId`. Kept for older app builds.
1172
1614
  *
1173
1615
  * **POST** `/v1/user/interactions/:interactionId/responses`
1174
1616
  *
@@ -1534,7 +1976,7 @@ export interface paths {
1534
1976
  externalIds?: string[];
1535
1977
  /** @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
1978
  assetFields: string[];
1537
- };
1979
+ } & (unknown | unknown);
1538
1980
  };
1539
1981
  };
1540
1982
  responses: {
@@ -1,14 +1,20 @@
1
- import type { SynthesisUiPlatform, SynthesisUiStreamEvent, SynthesizeUiFetcher } from '../synthesisUi/types.js';
2
- export type { BitBitViewContext, GeneratedUiModule, GeneratedUiViewHandle, } from '../runtime/index.js';
1
+ import { type BitBitTtsRef } from '../runtime/index.js';
2
+ import type { SynthesisUiPlatform, SynthesisUiRequestInputs, SynthesisUiStreamEvent, SynthesizeUiFetcher } from '../synthesisUi/types.js';
3
+ export type { BitBitTtsRef, BitBitViewContext, GeneratedUiModule, GeneratedUiViewHandle, } from '../runtime/index.js';
3
4
  export { type BitBitContextValue, BitBitProvider } from '../synthesisUi/context.js';
4
- export type { SynthesisUiPlatform, SynthesisUiStreamEvent, SynthesizeUiFetcher };
5
- export interface BitBitSynthesisProps {
5
+ export type { SynthesisUiPlatform, SynthesisUiRequestInputs, SynthesisUiStreamEvent, SynthesizeUiFetcher, };
6
+ /** `SynthesisUiRequestInputs` (`inputs`, `output`, `searchOptionsOverrides`,
7
+ * `synthesisHistoryLimit`) are forwarded to the synthesis request. Non-primitive
8
+ * values (e.g. `inputs`) should be stable/memoized — a new identity re-subscribes
9
+ * the stream (re-synthesizes). */
10
+ export interface BitBitViewProps extends SynthesisUiRequestInputs {
6
11
  /** Client to fetch the UI through. Optional when a `<BitBitProvider client>`
7
12
  * is in scope. */
8
13
  client?: SynthesizeUiFetcher;
9
14
  keyName: string;
10
- /** Target platform. Defaults to `web`; the studio passes `mobile` to
11
- * preview the react-native-web bundle. */
15
+ /** Target platform. Defaults to `web`. The CMS studio passes `mobile` to
16
+ * preview the mobile bundle in a browser; a real native app renders mobile
17
+ * through the `react-native-expo` entry (a WebView), not this one. */
12
18
  platform?: SynthesisUiPlatform;
13
19
  /** Brand analytics / link tracking. */
14
20
  onTrack?: (event: string, payload?: unknown) => void;
@@ -16,17 +22,90 @@ export interface BitBitSynthesisProps {
16
22
  onEvent?: (name: string, payload?: unknown) => void;
17
23
  /** Navigate a link the view requested. */
18
24
  onNavigate?: (href: string) => void;
25
+ /** Resolve an on-demand audio URL for a voice player (`ctx.tts`). */
26
+ onTts?: (ref?: BitBitTtsRef) => Promise<string>;
19
27
  }
20
28
  /**
21
29
  * Web view for a server-generated SynthesisUI. Streams the UI by `keyName`
22
30
  * 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.
31
+ * mounts the built bundle (which owns its own framework) on the `manifest`, then
32
+ * pushes `data` into the mounted view as it streams in. Both web and mobile
33
+ * bundles are plain DOM, so both mount here (web in a Shadow DOM; the studio's
34
+ * `mobile` preview in the light DOM). Native delivery renders the same mobile
35
+ * bundle in a WebView via the `react-native-expo` entry.
28
36
  */
29
- export declare function BitBitSynthesis({ client: clientProp, keyName, platform, onTrack, onEvent, onNavigate, }: BitBitSynthesisProps): import("react").DetailedReactHTMLElement<{
37
+ export declare function BitBitView({ client: clientProp, keyName, platform, onTrack, onEvent, onNavigate, onTts, inputs, output, searchOptionsOverrides, synthesisHistoryLimit, }: BitBitViewProps): import("react").DetailedReactHTMLElement<{
38
+ ref: import("react").RefObject<HTMLDivElement>;
39
+ style: {
40
+ height: string;
41
+ };
42
+ }, HTMLDivElement>;
43
+ /** What `<BitBitPiece keyName>` needs from a client: resolve a piece for embedding.
44
+ * A full `BitBitPressClient` satisfies this; the piece studio's static preview
45
+ * doesn't need it (it uses `code`+`data`). */
46
+ export interface BitBitPieceFetcher {
47
+ user: {
48
+ getSynthesisPiece(keyName: string): Promise<{
49
+ uiWebCode: string;
50
+ fields: unknown;
51
+ theme?: Record<string, string>;
52
+ }>;
53
+ /** Mint an on-demand audio URL for a piece's spoken turns. When present, embed mode
54
+ * (`keyName`) wires it into `ctx.tts` so audio players play without host setup. */
55
+ synthesisPieceTtsUrl?(keyName: string, ref?: BitBitTtsRef): Promise<string>;
56
+ };
57
+ }
58
+ interface BitBitPieceCommonProps {
59
+ /** Brand tokens → CSS custom properties + `ctx.theme`. In `keyName` mode the
60
+ * fetched deployment theme is used unless this overrides it. */
61
+ theme?: Record<string, string>;
62
+ /** Web (Shadow DOM isolation) or the studio's light-DOM mobile preview. */
63
+ platform?: SynthesisUiPlatform;
64
+ /** Force the rendered scheme (`ctx.colorScheme`). Leave unset to let a
65
+ * dual-mode piece follow the browser's `prefers-color-scheme`. */
66
+ colorScheme?: 'light' | 'dark';
67
+ onTrack?: (event: string, payload?: unknown) => void;
68
+ onEvent?: (name: string, payload?: unknown) => void;
69
+ onNavigate?: (href: string) => void;
70
+ /** Resolve an on-demand audio URL for a voice player (`ctx.tts`). */
71
+ onTts?: (ref?: BitBitTtsRef) => Promise<string>;
72
+ /** Bump to force a clean re-mount (reusing the loaded module) — the editor uses this
73
+ * to recover after a structural in-place edit that would corrupt the framework's
74
+ * own reconciliation. */
75
+ remountToken?: number;
76
+ }
77
+ /** Direct mode — the bundle source + data are already in hand (editor-side
78
+ * previews, e.g. the piece studio). No fetch, no client. */
79
+ export interface BitBitPieceCodeProps extends BitBitPieceCommonProps {
80
+ /** The generated self-contained ESM bundle — source string or a URL. */
81
+ code: string;
82
+ /** Field values passed to the bundle as `props.data`. */
83
+ data: unknown;
84
+ keyName?: never;
85
+ client?: never;
86
+ }
87
+ /** Embed mode — resolve the piece by `keyName` through `client` (or the
88
+ * `<BitBitProvider client>` in scope), exactly like `<BitBitView keyName>`. */
89
+ export interface BitBitPieceKeyNameProps extends BitBitPieceCommonProps {
90
+ keyName: string;
91
+ /** Client to fetch through. Optional when a `<BitBitProvider client>` is in scope. */
92
+ client?: BitBitPieceFetcher;
93
+ code?: never;
94
+ data?: never;
95
+ }
96
+ export type BitBitPieceProps = BitBitPieceCodeProps | BitBitPieceKeyNameProps;
97
+ /**
98
+ * Render a generated piece bundle (its `uiWebCode`). Two modes:
99
+ * - **Direct** (`code` + `data`): mounts the module from source in hand — editor
100
+ * previews where code and data are already available (the piece studio).
101
+ * - **Embed** (`keyName` + `client`): resolves the piece's bundle, field values
102
+ * (incl. pre-generated `audioData.url`s), and theme by `keyName` through the
103
+ * client (like `<BitBitView keyName>`).
104
+ *
105
+ * Either way the module mounts on the host (web: Shadow DOM) and `data` is pushed
106
+ * in, re-rendering in place when it changes.
107
+ */
108
+ export declare function BitBitPiece(props: BitBitPieceProps): import("react").DetailedReactHTMLElement<{
30
109
  ref: import("react").RefObject<HTMLDivElement>;
31
110
  style: {
32
111
  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,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,CAAC;AAEjF,MAAM,WAAW,oBAAoB;IACnC;uBACmB;IACnB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB;+CAC2C;IAC3C,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,eAAe,CAAC,EAC9B,MAAM,EAAE,UAAU,EAClB,OAAO,EACP,QAAgB,EAChB,OAAO,EACP,OAAO,EACP,UAAU,GACX,EAAE,oBAAoB;;;;;mBAkEtB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts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