@bitbitpress/client 1.1.3 → 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.
- package/dist/generated/openapi.d.ts +420 -0
- package/dist/react/index.d.ts +76 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +110 -3
- package/dist/react/index.js.map +1 -1
- package/dist/react-native-expo/BitBitPiece.d.ts +64 -0
- package/dist/react-native-expo/BitBitPiece.d.ts.map +1 -0
- package/dist/react-native-expo/BitBitPiece.js +164 -0
- package/dist/react-native-expo/BitBitPiece.js.map +1 -0
- package/dist/react-native-expo/bootstrapHtml.d.ts +13 -0
- package/dist/react-native-expo/bootstrapHtml.d.ts.map +1 -1
- package/dist/react-native-expo/bootstrapHtml.js +108 -12
- package/dist/react-native-expo/bootstrapHtml.js.map +1 -1
- package/dist/react-native-expo/index.d.ts +1 -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 +32 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +68 -2
- package/dist/runtime/index.js.map +1 -1
- package/dist/studio/BitBitMobilePreview.d.ts +33 -0
- package/dist/studio/BitBitMobilePreview.d.ts.map +1 -0
- package/dist/studio/BitBitMobilePreview.js +120 -0
- package/dist/studio/BitBitMobilePreview.js.map +1 -0
- package/dist/studio/index.d.ts +7 -0
- package/dist/studio/index.d.ts.map +1 -0
- package/dist/studio/index.js +7 -0
- package/dist/studio/index.js.map +1 -0
- package/dist/user/index.d.ts +27 -0
- package/dist/user/index.d.ts.map +1 -1
- package/dist/user/index.js +6 -1
- package/dist/user/index.js.map +1 -1
- package/dist/user/synthesisPiece.d.ts +38 -0
- package/dist/user/synthesisPiece.d.ts.map +1 -0
- package/dist/user/synthesisPiece.js +58 -0
- package/dist/user/synthesisPiece.js.map +1 -0
- package/dist/user/track-batch-manager.d.ts +10 -4
- package/dist/user/track-batch-manager.d.ts.map +1 -1
- package/dist/user/track-batch-manager.js +6 -5
- package/dist/user/track-batch-manager.js.map +1 -1
- package/dist/user/track.d.ts +9 -0
- package/dist/user/track.d.ts.map +1 -1
- package/dist/user/track.js +17 -0
- package/dist/user/track.js.map +1 -1
- package/package.json +5 -1
|
@@ -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;
|
|
@@ -1065,6 +1261,230 @@ export interface paths {
|
|
|
1065
1261
|
patch?: never;
|
|
1066
1262
|
trace?: never;
|
|
1067
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
|
+
};
|
|
1068
1488
|
"/v1/user/interactions": {
|
|
1069
1489
|
parameters: {
|
|
1070
1490
|
query?: never;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type BitBitTtsRef } from '../runtime/index.js';
|
|
1
2
|
import type { SynthesisUiPlatform, SynthesisUiRequestInputs, SynthesisUiStreamEvent, SynthesizeUiFetcher } from '../synthesisUi/types.js';
|
|
2
|
-
export type { BitBitViewContext, GeneratedUiModule, GeneratedUiViewHandle, } from '../runtime/index.js';
|
|
3
|
+
export type { BitBitTtsRef, BitBitViewContext, GeneratedUiModule, GeneratedUiViewHandle, } from '../runtime/index.js';
|
|
3
4
|
export { type BitBitContextValue, BitBitProvider } from '../synthesisUi/context.js';
|
|
4
5
|
export type { SynthesisUiPlatform, SynthesisUiRequestInputs, SynthesisUiStreamEvent, SynthesizeUiFetcher, };
|
|
5
6
|
/** `SynthesisUiRequestInputs` (`inputs`, `output`, `searchOptionsOverrides`,
|
|
@@ -21,6 +22,8 @@ export interface BitBitViewProps extends SynthesisUiRequestInputs {
|
|
|
21
22
|
onEvent?: (name: string, payload?: unknown) => void;
|
|
22
23
|
/** Navigate a link the view requested. */
|
|
23
24
|
onNavigate?: (href: string) => void;
|
|
25
|
+
/** Resolve an on-demand audio URL for a voice player (`ctx.tts`). */
|
|
26
|
+
onTts?: (ref?: BitBitTtsRef) => Promise<string>;
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
29
|
* Web view for a server-generated SynthesisUI. Streams the UI by `keyName`
|
|
@@ -31,7 +34,78 @@ export interface BitBitViewProps extends SynthesisUiRequestInputs {
|
|
|
31
34
|
* `mobile` preview in the light DOM). Native delivery renders the same mobile
|
|
32
35
|
* bundle in a WebView via the `react-native-expo` entry.
|
|
33
36
|
*/
|
|
34
|
-
export declare function BitBitView({ client: clientProp, keyName, platform, onTrack, onEvent, onNavigate, inputs, output, searchOptionsOverrides, synthesisHistoryLimit, }: BitBitViewProps): 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<{
|
|
35
109
|
ref: import("react").RefObject<HTMLDivElement>;
|
|
36
110
|
style: {
|
|
37
111
|
height: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,YAAY,EAMlB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,k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