@bitbitpress/client 1.1.3 → 1.2.2
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 +8 -152
- package/dist/generated/openapi.d.ts +802 -314
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/react/index.d.ts +76 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +122 -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/BitBitView.d.ts.map +1 -1
- package/dist/react-native-expo/BitBitView.js +21 -2
- package/dist/react-native-expo/BitBitView.js.map +1 -1
- 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/synthesisUi/types.d.ts +3 -0
- package/dist/synthesisUi/types.d.ts.map +1 -1
- package/dist/user/index.d.ts +42 -19
- package/dist/user/index.d.ts.map +1 -1
- package/dist/user/index.js +8 -3
- package/dist/user/index.js.map +1 -1
- package/dist/user/profile.d.ts +2 -2
- package/dist/user/profile.js +2 -2
- package/dist/user/submissions.d.ts +0 -21
- package/dist/user/submissions.d.ts.map +1 -1
- package/dist/user/submissions.js +0 -39
- package/dist/user/submissions.js.map +1 -1
- package/dist/user/synthesisOutputTts.d.ts +21 -0
- package/dist/user/synthesisOutputTts.d.ts.map +1 -0
- package/dist/user/synthesisOutputTts.js +32 -0
- package/dist/user/synthesisOutputTts.js.map +1 -0
- 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
package/dist/user/index.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ import { type ProfileResponse, type ProfileUpdateRequest } from './profile.js';
|
|
|
5
5
|
import { type RecommendationsRequest, type RecommendationsResponse } from './recommendations.js';
|
|
6
6
|
import { type ReportRequest, type ReportResponse } from './report.js';
|
|
7
7
|
import { type Signal, type SignalRequest, type SignalResponse } from './signal.js';
|
|
8
|
-
import { type
|
|
8
|
+
import { type SubmissionFeed, type SubmissionState, type SubmitRequest, type SubmitResponse } from './submissions.js';
|
|
9
|
+
import { type SynthesisOutputTtsRef } from './synthesisOutputTts.js';
|
|
10
|
+
import { type SynthesisPieceResponse, type SynthesisPieceTtsRef } from './synthesisPiece.js';
|
|
9
11
|
import { type SynthesizeEvent, type SynthesizeItemResponse } from './synthesize.js';
|
|
10
12
|
import { type SynthesizeOnStreamingData } from './synthesize-batch-manager.js';
|
|
11
13
|
import { type SynthesisUiStreamEvent, type SynthesizeUiEvent, type SynthesizeUiRequest, type SynthesizeUiRequestItem } from './synthesizeUi.js';
|
|
@@ -31,16 +33,17 @@ export interface UserMethods {
|
|
|
31
33
|
*/
|
|
32
34
|
token(ssoToken: TokenRequest['ssoToken']): Promise<TokenResponse>;
|
|
33
35
|
/**
|
|
34
|
-
* Get user profile (interest tags, suggested topics,
|
|
36
|
+
* Get user profile (interest tags, suggested topics, and custom attributes).
|
|
35
37
|
*
|
|
36
38
|
* @returns Promise that resolves with profile data
|
|
37
39
|
*/
|
|
38
40
|
profile(): Promise<NonNullable<ProfileResponse>>;
|
|
39
41
|
/**
|
|
40
42
|
* Update user profile. Full replace interest tags via interestTags, add/remove
|
|
41
|
-
* via addInterestTags/removeInterestTags, and set
|
|
43
|
+
* via addInterestTags/removeInterestTags, and set customAttributes (validated
|
|
44
|
+
* against the deployment's active app-user profile schema).
|
|
42
45
|
*
|
|
43
|
-
* @param options - interestTags, addInterestTags, removeInterestTags,
|
|
46
|
+
* @param options - interestTags, addInterestTags, removeInterestTags, or customAttributes
|
|
44
47
|
* @returns Promise that resolves with updated profile data
|
|
45
48
|
*/
|
|
46
49
|
updateProfile(options: ProfileUpdateRequest): Promise<NonNullable<ProfileResponse>>;
|
|
@@ -58,21 +61,6 @@ export interface UserMethods {
|
|
|
58
61
|
* @returns Promise that resolves when the report is accepted
|
|
59
62
|
*/
|
|
60
63
|
report(options: ReportRequest): Promise<NonNullable<ReportResponse>>;
|
|
61
|
-
/**
|
|
62
|
-
* Create a structured user submission and optional presigned file upload URLs.
|
|
63
|
-
*
|
|
64
|
-
* @param options - schema keyName, structured data, and optional file descriptors
|
|
65
|
-
* @returns Created submission and any presigned upload URLs
|
|
66
|
-
*/
|
|
67
|
-
createSubmission(options: CreateUserSubmissionRequest): Promise<NonNullable<CreateUserSubmissionResponse>>;
|
|
68
|
-
/**
|
|
69
|
-
* List live submissions for a user submission schema.
|
|
70
|
-
*
|
|
71
|
-
* @param keyName - User submission schema key name
|
|
72
|
-
* @param options - Optional pagination parameters
|
|
73
|
-
* @returns Live submissions and pagination cursor
|
|
74
|
-
*/
|
|
75
|
-
submissions(keyName: string, options?: ListUserSubmissionsRequest): Promise<NonNullable<ListUserSubmissionsResponse>>;
|
|
76
64
|
/**
|
|
77
65
|
* Submit content (a poll vote or a contest entry) tied to a synthesis output.
|
|
78
66
|
* One submission per user per piece — re-submitting overwrites the prior one.
|
|
@@ -129,6 +117,13 @@ export interface UserMethods {
|
|
|
129
117
|
* @param event - Single event to record
|
|
130
118
|
*/
|
|
131
119
|
trackItem(event: TrackEvent): Promise<NonNullable<TrackResponse>>;
|
|
120
|
+
/**
|
|
121
|
+
* Record a single SynthesisPiece embed event (batched) — the piece counterpart of `trackItem`,
|
|
122
|
+
* posted to the dedicated piece-events endpoint so a shared keyName is never misattributed.
|
|
123
|
+
*
|
|
124
|
+
* @param event - Single event to record
|
|
125
|
+
*/
|
|
126
|
+
trackPieceItem(event: TrackEvent): Promise<NonNullable<TrackResponse>>;
|
|
132
127
|
/**
|
|
133
128
|
* Synthesize content items personalized to the user (streaming SSE).
|
|
134
129
|
*
|
|
@@ -180,6 +175,34 @@ export interface UserMethods {
|
|
|
180
175
|
* (bundles + theme) then per-item data events, index-matched to `items`.
|
|
181
176
|
*/
|
|
182
177
|
synthesizeUis(items: SynthesizeUiRequestItem[], platform?: SynthesizeUiRequest['platform']): Promise<AsyncIterable<SynthesizeUiEvent>>;
|
|
178
|
+
/**
|
|
179
|
+
* Resolve a published synthesis piece for embedding by `keyName` — its generated
|
|
180
|
+
* web bundle, current field values (incl. pre-generated `audioData.url`s), and
|
|
181
|
+
* deployment theme. This is the path `<BitBitPiece keyName>` uses under the hood.
|
|
182
|
+
*
|
|
183
|
+
* @param keyName - Stable identifier of the piece to embed
|
|
184
|
+
*/
|
|
185
|
+
getSynthesisPiece(keyName: string): Promise<SynthesisPieceResponse>;
|
|
186
|
+
/**
|
|
187
|
+
* Mint a short-lived streaming audio URL for a published piece's spoken turns — the
|
|
188
|
+
* on-demand TTS a rendered audio player calls on play. Pass one turn for a single narration,
|
|
189
|
+
* or several (each its own voice) for a multi-speaker dialogue synthesized as one clip. Every
|
|
190
|
+
* turn's `text` must be part of the piece (`keyName`). This is the path `<BitBitPiece
|
|
191
|
+
* keyName>` wires into `ctx.tts` under the hood.
|
|
192
|
+
*
|
|
193
|
+
* @param keyName - Stable identifier of the piece the turns belong to
|
|
194
|
+
* @param turns - The ordered turns to synthesize
|
|
195
|
+
*/
|
|
196
|
+
synthesisPieceTtsUrl(keyName: string, ref?: SynthesisPieceTtsRef): Promise<string>;
|
|
197
|
+
/**
|
|
198
|
+
* Mint a short-lived HLS URL for the app user's own stored synthesis output — the on-demand TTS
|
|
199
|
+
* entry point a rendered SynthesisUI's audio player calls on play. `<BitBitView>` wires this into
|
|
200
|
+
* `ctx.tts` under the hood, keyed by the streamed output's `synthesisOutputId`.
|
|
201
|
+
*
|
|
202
|
+
* @param synthesisOutputId - The output to voice (from the synthesis result)
|
|
203
|
+
* @param ref - Optional reference into the output's spoken content
|
|
204
|
+
*/
|
|
205
|
+
synthesisOutputTtsUrl(synthesisOutputId: string, ref?: SynthesisOutputTtsRef): Promise<string>;
|
|
183
206
|
}
|
|
184
207
|
/**
|
|
185
208
|
* User-related API methods (uses shared auth store).
|
package/dist/user/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/user/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAE1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,KA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EnC;;;;;;;;;OASG;IACH,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAEvF;;;;;;;;;OASG;IACH,oBAAoB,CAClB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC,CAAC;IAErD;;;;OAIG;IACH,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAE3F;;;OAGG;IACH,aAAa,CACX,KAAK,EAAE,uBAAuB,EAAE,EAChC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,UAAU,CAAC,GACzC,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAE7C;;;;;;OAMG;IACH,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACpE;;;;;;;;;OASG;IACH,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnF;;;;;;;OAOG;IACH,qBAAqB,CAAC,iBAAiB,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAChG;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,aAAa,EACrB,sBAAsB,GAAE,MAAY,EACpC,kBAAkB,GAAE,MAAY,GAC/B,WAAW,CAwFb"}
|
package/dist/user/index.js
CHANGED
|
@@ -8,6 +8,8 @@ const report_js_1 = require("./report.js");
|
|
|
8
8
|
const signal_js_1 = require("./signal.js");
|
|
9
9
|
const signal_batch_manager_js_1 = require("./signal-batch-manager.js");
|
|
10
10
|
const submissions_js_1 = require("./submissions.js");
|
|
11
|
+
const synthesisOutputTts_js_1 = require("./synthesisOutputTts.js");
|
|
12
|
+
const synthesisPiece_js_1 = require("./synthesisPiece.js");
|
|
11
13
|
const synthesize_js_1 = require("./synthesize.js");
|
|
12
14
|
const synthesize_batch_manager_js_1 = require("./synthesize-batch-manager.js");
|
|
13
15
|
const synthesizeUi_js_1 = require("./synthesizeUi.js");
|
|
@@ -21,7 +23,8 @@ function createUserMethods(authStore, config, synthesizeBatchTimeout = 250, sign
|
|
|
21
23
|
const getConfigWithToken = authStore.getConfigWithToken.bind(authStore);
|
|
22
24
|
const synthesizeBatchManager = new synthesize_batch_manager_js_1.SynthesizeBatchManager(getConfigWithToken, synthesizeBatchTimeout);
|
|
23
25
|
const signalBatchManager = new signal_batch_manager_js_1.SignalBatchManager(getConfigWithToken, signalBatchTimeout);
|
|
24
|
-
const trackBatchManager = new track_batch_manager_js_1.TrackBatchManager(getConfigWithToken, signalBatchTimeout);
|
|
26
|
+
const trackBatchManager = new track_batch_manager_js_1.TrackBatchManager(getConfigWithToken, signalBatchTimeout, track_js_1.recordEvents);
|
|
27
|
+
const pieceTrackBatchManager = new track_batch_manager_js_1.TrackBatchManager(getConfigWithToken, signalBatchTimeout, track_js_1.recordPieceEvents);
|
|
25
28
|
return {
|
|
26
29
|
authenticate: authStore.authenticate.bind(authStore),
|
|
27
30
|
token: (ssoToken) => (0, token_js_1.exchangeToken)(config, ssoToken),
|
|
@@ -29,8 +32,6 @@ function createUserMethods(authStore, config, synthesizeBatchTimeout = 250, sign
|
|
|
29
32
|
updateProfile: (options) => getConfigWithToken().then((cfg) => (0, profile_js_1.putProfile)(cfg, options)),
|
|
30
33
|
recommendations: (options) => getConfigWithToken().then((cfg) => (0, recommendations_js_1.getRecommendations)(cfg, options)),
|
|
31
34
|
report: (options) => getConfigWithToken().then((cfg) => (0, report_js_1.reportBit)(cfg, options)),
|
|
32
|
-
createSubmission: (options) => getConfigWithToken().then((cfg) => (0, submissions_js_1.createUserSubmission)(cfg, options)),
|
|
33
|
-
submissions: (keyName, options) => getConfigWithToken().then((cfg) => (0, submissions_js_1.listUserSubmissions)(cfg, keyName, options)),
|
|
34
35
|
submit: (options) => getConfigWithToken().then((cfg) => (0, submissions_js_1.submit)(cfg, options)),
|
|
35
36
|
submissionState: (options) => getConfigWithToken().then((cfg) => (0, submissions_js_1.getSubmissionState)(cfg, options)),
|
|
36
37
|
submissionFeed: (options) => getConfigWithToken().then((cfg) => (0, submissions_js_1.listSubmissionFeed)(cfg, options)),
|
|
@@ -38,12 +39,16 @@ function createUserMethods(authStore, config, synthesizeBatchTimeout = 250, sign
|
|
|
38
39
|
signalItem: (signal) => signalBatchManager.addSignal(signal),
|
|
39
40
|
track: (options) => getConfigWithToken().then((cfg) => (0, track_js_1.recordEvents)(cfg, options)),
|
|
40
41
|
trackItem: (event) => trackBatchManager.addEvent(event),
|
|
42
|
+
trackPieceItem: (event) => pieceTrackBatchManager.addEvent(event),
|
|
41
43
|
synthesize: (items, options) => getConfigWithToken().then((cfg) => (0, synthesize_js_1.synthesize)(cfg, items, options)),
|
|
42
44
|
synthesizeItem: (item, onStreamingData) => synthesizeBatchManager.addItem(item, onStreamingData),
|
|
43
45
|
interactions: (options) => getConfigWithToken().then((cfg) => (0, interaction_js_1.getInteractions)(cfg, options)),
|
|
44
46
|
respondToInteraction: (interactionId, options) => getConfigWithToken().then((cfg) => (0, interaction_js_1.respondToInteraction)(cfg, interactionId, options)),
|
|
45
47
|
synthesizeUi: (request) => getConfigWithToken().then((cfg) => (0, synthesizeUi_js_1.synthesizeUi)(cfg, request)),
|
|
46
48
|
synthesizeUis: (items, platform) => getConfigWithToken().then((cfg) => (0, synthesizeUi_js_1.synthesizeUis)(cfg, items, platform)),
|
|
49
|
+
getSynthesisPiece: (keyName) => getConfigWithToken().then((cfg) => (0, synthesisPiece_js_1.getSynthesisPiece)(cfg, keyName)),
|
|
50
|
+
synthesisPieceTtsUrl: (keyName, ref) => getConfigWithToken().then((cfg) => (0, synthesisPiece_js_1.synthesisPieceTtsUrl)(cfg, keyName, ref)),
|
|
51
|
+
synthesisOutputTtsUrl: (synthesisOutputId, ref) => getConfigWithToken().then((cfg) => (0, synthesisOutputTts_js_1.synthesisOutputTtsUrl)(cfg, synthesisOutputId, ref)),
|
|
47
52
|
};
|
|
48
53
|
}
|
|
49
54
|
//# sourceMappingURL=index.js.map
|
package/dist/user/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/user/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/user/index.ts"],"names":[],"mappings":";;AAgSA,8CA6FC;AA3XD,qDAO0B;AAC1B,6CAKsB;AACtB,6DAI8B;AAC9B,2CAAiF;AACjF,2CAAiG;AACjG,uEAA+D;AAC/D,qDAQ0B;AAC1B,mEAA4F;AAC5F,2DAK6B;AAC7B,mDAAgG;AAChG,+EAGuC;AACvC,uDAO2B;AAC3B,yCAAkF;AAClF,yCAMoB;AACpB,qEAA6D;AAgO7D;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,SAAoB,EACpB,MAAqB,EACrB,yBAAiC,GAAG,EACpC,qBAA6B,GAAG;IAEhC,MAAM,kBAAkB,GAAG,SAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAExE,MAAM,sBAAsB,GAAG,IAAI,oDAAsB,CACvD,kBAAkB,EAClB,sBAAsB,CACvB,CAAC;IACF,MAAM,kBAAkB,GAAG,IAAI,4CAAkB,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;IAC1F,MAAM,iBAAiB,GAAG,IAAI,0CAAiB,CAC7C,kBAAkB,EAClB,kBAAkB,EAClB,uBAAY,CACb,CAAC;IACF,MAAM,sBAAsB,GAAG,IAAI,0CAAiB,CAClD,kBAAkB,EAClB,kBAAkB,EAClB,4BAAiB,CAClB,CAAC;IAEF,OAAO;QACL,YAAY,EAAE,SAA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,EAAE,CAAC,OAA4B,EAAE,EAAE,CAC7C,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,8BAAY,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAEhE,aAAa,EAAE,CAAC,KAAgC,EAAE,QAA0C,EAAE,EAAE,CAC9F,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,+BAAa,EAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAEzE,iBAAiB,EAAE,CAAC,OAAe,EAAE,EAAE,CACrC,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,qCAAiB,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAErE,oBAAoB,EAAE,CAAC,OAAe,EAAE,GAA0B,EAAE,EAAE,CACpE,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,wCAAoB,EAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAE7E,qBAAqB,EAAE,CAAC,iBAAyB,EAAE,GAA2B,EAAE,EAAE,CAChF,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,6CAAqB,EAAC,GAAG,EAAE,iBAAiB,EAAE,GAAG,CAAC,CAAC;KACzF,CAAC;AACJ,CAAC"}
|
package/dist/user/profile.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ export type ProfileUpdateRequest = paths['/v1/user/profile']['put']['requestBody
|
|
|
11
11
|
export declare function getProfile(config: RequestConfig): Promise<NonNullable<ProfileResponse>>;
|
|
12
12
|
/**
|
|
13
13
|
* Update user profile. Supports full interest tag replace via interestTags,
|
|
14
|
-
* add/remove via addInterestTags and removeInterestTags, and
|
|
15
|
-
*
|
|
14
|
+
* add/remove via addInterestTags and removeInterestTags, and customAttributes
|
|
15
|
+
* (validated against the deployment's active app-user profile schema).
|
|
16
16
|
*
|
|
17
17
|
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
18
18
|
* @param options - Profile update payload
|
package/dist/user/profile.js
CHANGED
|
@@ -21,8 +21,8 @@ async function getProfile(config) {
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Update user profile. Supports full interest tag replace via interestTags,
|
|
24
|
-
* add/remove via addInterestTags and removeInterestTags, and
|
|
25
|
-
*
|
|
24
|
+
* add/remove via addInterestTags and removeInterestTags, and customAttributes
|
|
25
|
+
* (validated against the deployment's active app-user profile schema).
|
|
26
26
|
*
|
|
27
27
|
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
28
28
|
* @param options - Profile update payload
|
|
@@ -1,26 +1,5 @@
|
|
|
1
1
|
import type { paths } from '../generated/openapi.js';
|
|
2
2
|
import type { RequestConfig } from '../request.js';
|
|
3
|
-
export type CreateUserSubmissionRequest = paths['/v1/user-submissions']['post']['requestBody']['content']['application/json'];
|
|
4
|
-
export type CreateUserSubmissionResponse = paths['/v1/user-submissions']['post']['responses'][200]['content']['application/json']['data'];
|
|
5
|
-
export type ListUserSubmissionsRequest = NonNullable<paths['/v1/user-submission-schemas/{keyName}/submissions']['get']['parameters']['query']>;
|
|
6
|
-
export type ListUserSubmissionsResponse = paths['/v1/user-submission-schemas/{keyName}/submissions']['get']['responses'][200]['content']['application/json']['data'];
|
|
7
|
-
/**
|
|
8
|
-
* Create a structured user submission and optional presigned file upload URLs.
|
|
9
|
-
*
|
|
10
|
-
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
11
|
-
* @param options - schema keyName, structured data, and optional file descriptors
|
|
12
|
-
* @returns Created submission and any presigned upload URLs
|
|
13
|
-
*/
|
|
14
|
-
export declare function createUserSubmission(config: RequestConfig, options: CreateUserSubmissionRequest): Promise<NonNullable<CreateUserSubmissionResponse>>;
|
|
15
|
-
/**
|
|
16
|
-
* List live submissions for a user submission schema.
|
|
17
|
-
*
|
|
18
|
-
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
19
|
-
* @param keyName - User submission schema key name
|
|
20
|
-
* @param options - Optional pagination parameters
|
|
21
|
-
* @returns Live submissions and pagination cursor
|
|
22
|
-
*/
|
|
23
|
-
export declare function listUserSubmissions(config: RequestConfig, keyName: string, options?: ListUserSubmissionsRequest): Promise<NonNullable<ListUserSubmissionsResponse>>;
|
|
24
3
|
export type SubmitRequest = paths['/v1/user/submissions']['post']['requestBody']['content']['application/json'];
|
|
25
4
|
export type SubmitResponse = paths['/v1/user/submissions']['post']['responses'][200]['content']['application/json']['data'];
|
|
26
5
|
/** Tallies for one submittable piece. `submissionCounts` is keyed by the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submissions.d.ts","sourceRoot":"","sources":["../../src/user/submissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"submissions.d.ts","sourceRoot":"","sources":["../../src/user/submissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AASnD,MAAM,MAAM,aAAa,GACvB,KAAK,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AACtF,MAAM,MAAM,cAAc,GACxB,KAAK,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjG;uEACuE;AACvE,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd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CAAC,EAAE,MAAM,CAAA;CAAE,GACrE,OAAO,CAAC,cAAc,CAAC,CAYzB"}
|
package/dist/user/submissions.js
CHANGED
|
@@ -1,48 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createUserSubmission = createUserSubmission;
|
|
4
|
-
exports.listUserSubmissions = listUserSubmissions;
|
|
5
3
|
exports.submit = submit;
|
|
6
4
|
exports.getSubmissionState = getSubmissionState;
|
|
7
5
|
exports.listSubmissionFeed = listSubmissionFeed;
|
|
8
6
|
const request_js_1 = require("../request.js");
|
|
9
|
-
/**
|
|
10
|
-
* Create a structured user submission and optional presigned file upload URLs.
|
|
11
|
-
*
|
|
12
|
-
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
13
|
-
* @param options - schema keyName, structured data, and optional file descriptors
|
|
14
|
-
* @returns Created submission and any presigned upload URLs
|
|
15
|
-
*/
|
|
16
|
-
async function createUserSubmission(config, options) {
|
|
17
|
-
const response = await (0, request_js_1.makeRequest)(config, {
|
|
18
|
-
method: 'POST',
|
|
19
|
-
path: '/v1/user-submissions',
|
|
20
|
-
body: options,
|
|
21
|
-
});
|
|
22
|
-
if (!response) {
|
|
23
|
-
throw new Error('Failed to create user submission: no data in response');
|
|
24
|
-
}
|
|
25
|
-
return response;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* List live submissions for a user submission schema.
|
|
29
|
-
*
|
|
30
|
-
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
31
|
-
* @param keyName - User submission schema key name
|
|
32
|
-
* @param options - Optional pagination parameters
|
|
33
|
-
* @returns Live submissions and pagination cursor
|
|
34
|
-
*/
|
|
35
|
-
async function listUserSubmissions(config, keyName, options) {
|
|
36
|
-
const response = await (0, request_js_1.makeRequest)(config, {
|
|
37
|
-
method: 'GET',
|
|
38
|
-
path: `/v1/user-submission-schemas/${encodeURIComponent(keyName)}/submissions`,
|
|
39
|
-
params: options,
|
|
40
|
-
});
|
|
41
|
-
if (!response) {
|
|
42
|
-
throw new Error('Failed to list user submissions: no data in response');
|
|
43
|
-
}
|
|
44
|
-
return response;
|
|
45
|
-
}
|
|
46
7
|
/**
|
|
47
8
|
* Submit content (a poll vote or a contest entry) tied to a synthesis output.
|
|
48
9
|
* One submission per user per piece — re-submitting overwrites the prior one.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submissions.js","sourceRoot":"","sources":["../../src/user/submissions.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"submissions.js","sourceRoot":"","sources":["../../src/user/submissions.ts"],"names":[],"mappings":";;AA4DA,wBAeC;AASD,gDAeC;AAQD,gDAeC;AAxHD,8CAA4C;AAkD5C;;;;;;;GAOG;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,sBAAsB;QAC5B,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,kBAAkB,CACtC,MAAqB,EACrB,OAA0E;IAE1E,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAkB,MAAM,EAAE;QAC1D,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,sBAAsB;QAC5B,MAAM,EAAE,OAAO;KAChB,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,kBAAkB,CACtC,MAAqB,EACrB,OAAsE;IAEtE,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAiB,MAAM,EAAE;QACzD,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,sBAAsB;QAC5B,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE;KACnC,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { paths } from '../generated/openapi.js';
|
|
2
|
+
import type { RequestConfig } from '../request.js';
|
|
3
|
+
type SynthesisOutputTtsBody = paths['/v1/user/synthesis/tts']['post']['requestBody']['content']['application/json'];
|
|
4
|
+
/** A reference into a synthesis output's spoken content — omit for the whole output, `field` scopes
|
|
5
|
+
* to a top-level field, `index` picks a single turn. The text lives in the stored output. */
|
|
6
|
+
export type SynthesisOutputTtsRef = Pick<SynthesisOutputTtsBody, 'field' | 'index'>;
|
|
7
|
+
/**
|
|
8
|
+
* Mint a short-lived HLS URL for the authenticated app user's own stored synthesis output — the
|
|
9
|
+
* on-demand TTS entry point a rendered SynthesisUI's audio player calls on play (via `ctx.tts`).
|
|
10
|
+
* The request REFERENCES the output's content by `synthesisOutputId` (from the synthesis result);
|
|
11
|
+
* the server reloads the turns from the stored output and gates issuance by ownership. Play the
|
|
12
|
+
* returned URL via `ctx.playMedia`.
|
|
13
|
+
*
|
|
14
|
+
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
15
|
+
* @param synthesisOutputId - The output to voice (returned with the synthesis result)
|
|
16
|
+
* @param ref - Optional reference into the output's spoken content
|
|
17
|
+
* @returns Promise resolving with the playable streaming URL
|
|
18
|
+
*/
|
|
19
|
+
export declare function synthesisOutputTtsUrl(config: RequestConfig, synthesisOutputId: string, ref?: SynthesisOutputTtsRef): Promise<string>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=synthesisOutputTts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesisOutputTts.d.ts","sourceRoot":"","sources":["../../src/user/synthesisOutputTts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,KAAK,sBAAsB,GACzB,KAAK,CAAC,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAIxF;8FAC8F;AAC9F,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC;AAEpF;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,iBAAiB,EAAE,MAAM,EACzB,GAAG,CAAC,EAAE,qBAAqB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAcjB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.synthesisOutputTtsUrl = synthesisOutputTtsUrl;
|
|
4
|
+
const request_js_1 = require("../request.js");
|
|
5
|
+
/**
|
|
6
|
+
* Mint a short-lived HLS URL for the authenticated app user's own stored synthesis output — the
|
|
7
|
+
* on-demand TTS entry point a rendered SynthesisUI's audio player calls on play (via `ctx.tts`).
|
|
8
|
+
* The request REFERENCES the output's content by `synthesisOutputId` (from the synthesis result);
|
|
9
|
+
* the server reloads the turns from the stored output and gates issuance by ownership. Play the
|
|
10
|
+
* returned URL via `ctx.playMedia`.
|
|
11
|
+
*
|
|
12
|
+
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
13
|
+
* @param synthesisOutputId - The output to voice (returned with the synthesis result)
|
|
14
|
+
* @param ref - Optional reference into the output's spoken content
|
|
15
|
+
* @returns Promise resolving with the playable streaming URL
|
|
16
|
+
*/
|
|
17
|
+
async function synthesisOutputTtsUrl(config, synthesisOutputId, ref) {
|
|
18
|
+
const response = await (0, request_js_1.makeRequest)(config, {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
path: '/v1/user/synthesis/tts',
|
|
21
|
+
body: {
|
|
22
|
+
synthesisOutputId,
|
|
23
|
+
...(ref?.field != null ? { field: ref.field } : {}),
|
|
24
|
+
...(ref?.index != null ? { index: ref.index } : {}),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
if (!response?.url) {
|
|
28
|
+
throw new Error(response?.error ?? 'Failed to synthesize audio');
|
|
29
|
+
}
|
|
30
|
+
return response.url;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=synthesisOutputTts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesisOutputTts.js","sourceRoot":"","sources":["../../src/user/synthesisOutputTts.ts"],"names":[],"mappings":";;AAyBA,sDAkBC;AAzCD,8CAA4C;AAW5C;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,qBAAqB,CACzC,MAAqB,EACrB,iBAAyB,EACzB,GAA2B;IAE3B,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAyB,MAAM,EAAE;QACjE,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE;YACJ,iBAAiB;YACjB,GAAG,CAAC,GAAG,EAAE,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnD,GAAG,CAAC,GAAG,EAAE,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACpD;KACF,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,KAAK,IAAI,4BAA4B,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,QAAQ,CAAC,GAAG,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { paths } from '../generated/openapi.js';
|
|
2
|
+
import type { RequestConfig } from '../request.js';
|
|
3
|
+
/** A resolved published piece: its generated web bundle + current field values +
|
|
4
|
+
* deployment theme, ready to mount via `<BitBitPiece>`. */
|
|
5
|
+
export type SynthesisPieceResponse = {
|
|
6
|
+
uiWebCode: string;
|
|
7
|
+
fields: Record<string, unknown>;
|
|
8
|
+
theme: Record<string, string>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Resolve a published synthesis piece for embedding by its `keyName`: the
|
|
12
|
+
* generated web bundle (`uiWebCode`), current field values (`fields`, including
|
|
13
|
+
* any pre-generated `audioData.url`s), and deployment `theme`. Used by
|
|
14
|
+
* `<BitBitPiece keyName>`. Hits the batch endpoint with a single item.
|
|
15
|
+
*
|
|
16
|
+
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
17
|
+
* @param keyName - Stable identifier of the piece to embed
|
|
18
|
+
* @returns Promise resolving with the piece's bundle, fields, and theme
|
|
19
|
+
*/
|
|
20
|
+
export declare function getSynthesisPiece(config: RequestConfig, keyName: string): Promise<SynthesisPieceResponse>;
|
|
21
|
+
type SynthesisPieceTtsBody = paths['/v1/user/synthesis-piece/tts']['post']['requestBody']['content']['application/json'];
|
|
22
|
+
/** A reference into a published piece's spoken content — omit for the whole piece, `field` scopes
|
|
23
|
+
* to a top-level field, `index` picks a single turn. The text lives in the piece. */
|
|
24
|
+
export type SynthesisPieceTtsRef = Pick<SynthesisPieceTtsBody, 'field' | 'index'>;
|
|
25
|
+
/**
|
|
26
|
+
* Mint a short-lived HLS URL for a published piece's spoken content — the on-demand TTS entry
|
|
27
|
+
* point a rendered audio player calls on play (via `ctx.tts`). The request REFERENCES the piece's
|
|
28
|
+
* content (omit `ref` for the whole piece, `field` to scope, `index` for a single turn); the
|
|
29
|
+
* server resolves the turns from the piece itself. Play the returned URL via `ctx.playMedia`.
|
|
30
|
+
*
|
|
31
|
+
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
32
|
+
* @param keyName - Stable identifier of the piece to voice
|
|
33
|
+
* @param ref - Optional reference into the piece's spoken content
|
|
34
|
+
* @returns Promise resolving with the playable streaming URL
|
|
35
|
+
*/
|
|
36
|
+
export declare function synthesisPieceTtsUrl(config: RequestConfig, keyName: string, ref?: SynthesisPieceTtsRef): Promise<string>;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=synthesisPiece.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesisPiece.d.ts","sourceRoot":"","sources":["../../src/user/synthesisPiece.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAMnD;4DAC4D;AAC5D,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,sBAAsB,CAAC,CAgBjC;AAED,KAAK,qBAAqB,GACxB,KAAK,CAAC,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAI9F;sFACsF;AACtF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC;AAElF;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,oBAAoB,GACzB,OAAO,CAAC,MAAM,CAAC,CAcjB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSynthesisPiece = getSynthesisPiece;
|
|
4
|
+
exports.synthesisPieceTtsUrl = synthesisPieceTtsUrl;
|
|
5
|
+
const request_js_1 = require("../request.js");
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a published synthesis piece for embedding by its `keyName`: the
|
|
8
|
+
* generated web bundle (`uiWebCode`), current field values (`fields`, including
|
|
9
|
+
* any pre-generated `audioData.url`s), and deployment `theme`. Used by
|
|
10
|
+
* `<BitBitPiece keyName>`. Hits the batch endpoint with a single item.
|
|
11
|
+
*
|
|
12
|
+
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
13
|
+
* @param keyName - Stable identifier of the piece to embed
|
|
14
|
+
* @returns Promise resolving with the piece's bundle, fields, and theme
|
|
15
|
+
*/
|
|
16
|
+
async function getSynthesisPiece(config, keyName) {
|
|
17
|
+
const response = await (0, request_js_1.makeRequest)(config, {
|
|
18
|
+
method: 'POST',
|
|
19
|
+
path: '/v1/user/synthesis-piece',
|
|
20
|
+
body: { items: [{ keyName }] },
|
|
21
|
+
});
|
|
22
|
+
const item = response?.items?.[0];
|
|
23
|
+
if (!item || item.error || typeof item.uiWebCode !== 'string') {
|
|
24
|
+
throw new Error(item?.error ?? 'Failed to load piece: no data in response');
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
uiWebCode: item.uiWebCode,
|
|
28
|
+
fields: (item.fields ?? {}),
|
|
29
|
+
theme: response.theme,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Mint a short-lived HLS URL for a published piece's spoken content — the on-demand TTS entry
|
|
34
|
+
* point a rendered audio player calls on play (via `ctx.tts`). The request REFERENCES the piece's
|
|
35
|
+
* content (omit `ref` for the whole piece, `field` to scope, `index` for a single turn); the
|
|
36
|
+
* server resolves the turns from the piece itself. Play the returned URL via `ctx.playMedia`.
|
|
37
|
+
*
|
|
38
|
+
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
39
|
+
* @param keyName - Stable identifier of the piece to voice
|
|
40
|
+
* @param ref - Optional reference into the piece's spoken content
|
|
41
|
+
* @returns Promise resolving with the playable streaming URL
|
|
42
|
+
*/
|
|
43
|
+
async function synthesisPieceTtsUrl(config, keyName, ref) {
|
|
44
|
+
const response = await (0, request_js_1.makeRequest)(config, {
|
|
45
|
+
method: 'POST',
|
|
46
|
+
path: '/v1/user/synthesis-piece/tts',
|
|
47
|
+
body: {
|
|
48
|
+
keyName,
|
|
49
|
+
...(ref?.field != null ? { field: ref.field } : {}),
|
|
50
|
+
...(ref?.index != null ? { index: ref.index } : {}),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
if (!response?.url) {
|
|
54
|
+
throw new Error(response?.error ?? 'Failed to synthesize audio');
|
|
55
|
+
}
|
|
56
|
+
return response.url;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=synthesisPiece.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesisPiece.js","sourceRoot":"","sources":["../../src/user/synthesisPiece.ts"],"names":[],"mappings":";;AAyBA,8CAmBC;AAsBD,oDAkBC;AAlFD,8CAA4C;AAa5C;;;;;;;;;GASG;AACI,KAAK,UAAU,iBAAiB,CACrC,MAAqB,EACrB,OAAe;IAEf,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAA0B,MAAM,EAAE;QAClE,MAAM,EAAE,MAAM;QACd,IA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GAAG,CAAC;AACtB,CAAC"}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import type { RequestConfig } from '../request.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { TrackEvent, TrackResponse } from './track.js';
|
|
3
|
+
/** Sends a batch of events to a specific endpoint (UI `/events` or piece `/piece-events`). */
|
|
4
|
+
type RecordFn = (config: RequestConfig, options: {
|
|
5
|
+
events: TrackEvent[];
|
|
6
|
+
}) => Promise<NonNullable<TrackResponse>>;
|
|
3
7
|
/**
|
|
4
|
-
* Batch manager for `trackItem` — batches individual events and sends them
|
|
5
|
-
* together after the timeout. Mirrors SignalBatchManager.
|
|
8
|
+
* Batch manager for `trackItem` / `trackPieceItem` — batches individual events and sends them
|
|
9
|
+
* together after the timeout via the injected `record` function. Mirrors SignalBatchManager.
|
|
6
10
|
*/
|
|
7
11
|
export declare class TrackBatchManager {
|
|
8
12
|
private queue;
|
|
9
13
|
private timer;
|
|
10
14
|
private getConfig;
|
|
11
15
|
private batchTimeout;
|
|
12
|
-
|
|
16
|
+
private record;
|
|
17
|
+
constructor(getConfig: () => Promise<RequestConfig>, batchTimeout: number, record: RecordFn);
|
|
13
18
|
updateConfig(config: RequestConfig): void;
|
|
14
19
|
addEvent(event: TrackEvent): Promise<NonNullable<TrackResponse>>;
|
|
15
20
|
private flush;
|
|
16
21
|
}
|
|
22
|
+
export {};
|
|
17
23
|
//# sourceMappingURL=track-batch-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track-batch-manager.d.ts","sourceRoot":"","sources":["../../src/user/track-batch-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"track-batch-manager.d.ts","sourceRoot":"","sources":["../../src/user/track-batch-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAK5D,8FAA8F;AAC9F,KAAK,QAAQ,GAAG,CACd,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE;IAAE,MAAM,EAAE,UAAU,EAAE,CAAA;CAAE,KAC9B,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;AAEzC;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,KAAK,CAIL;IACR,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,MAAM,CAAW;gBAEb,SAAS,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ;IAM3F,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAIzC,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;YAQlD,KAAK;CAqBpB"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TrackBatchManager = void 0;
|
|
4
|
-
const track_js_1 = require("./track.js");
|
|
5
4
|
/**
|
|
6
|
-
* Batch manager for `trackItem` — batches individual events and sends them
|
|
7
|
-
* together after the timeout. Mirrors SignalBatchManager.
|
|
5
|
+
* Batch manager for `trackItem` / `trackPieceItem` — batches individual events and sends them
|
|
6
|
+
* together after the timeout via the injected `record` function. Mirrors SignalBatchManager.
|
|
8
7
|
*/
|
|
9
8
|
class TrackBatchManager {
|
|
10
9
|
queue = [];
|
|
11
10
|
timer = null;
|
|
12
11
|
getConfig;
|
|
13
12
|
batchTimeout;
|
|
14
|
-
|
|
13
|
+
record;
|
|
14
|
+
constructor(getConfig, batchTimeout, record) {
|
|
15
15
|
this.getConfig = getConfig;
|
|
16
16
|
this.batchTimeout = batchTimeout;
|
|
17
|
+
this.record = record;
|
|
17
18
|
}
|
|
18
19
|
updateConfig(config) {
|
|
19
20
|
this.getConfig = () => Promise.resolve(config);
|
|
@@ -35,7 +36,7 @@ class TrackBatchManager {
|
|
|
35
36
|
try {
|
|
36
37
|
const config = await this.getConfig();
|
|
37
38
|
const events = batch.map((b) => b.event);
|
|
38
|
-
const response = await
|
|
39
|
+
const response = await this.record(config, { events });
|
|
39
40
|
for (const { resolve } of batch) {
|
|
40
41
|
resolve(response);
|
|
41
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track-batch-manager.js","sourceRoot":"","sources":["../../src/user/track-batch-manager.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"track-batch-manager.js","sourceRoot":"","sources":["../../src/user/track-batch-manager.ts"],"names":[],"mappings":";;;AAYA;;;GAGG;AACH,MAAa,iBAAiB;IACpB,KAAK,GAIR,EAAE,CAAC;IACA,KAAK,GAAiB,IAAI,CAAC;IAC3B,SAAS,CAA+B;IACxC,YAAY,CAAS;IACrB,MAAM,CAAW;IAEzB,YAAY,SAAuC,EAAE,YAAoB,EAAE,MAAgB;QACzF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,YAAY,CAAC,MAAqB;QAChC,IAAI,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;IAED,QAAQ,CAAC,KAAiB;QACxB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;YAC5C,IAAI,IAAI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@ export type TrackResponse = paths['/v1/user/events']['post']['responses'][200]['
|
|
|
5
5
|
/** One event from the events array. `type` is VIEW or CLICK; `name` is the
|
|
6
6
|
* action/label for CLICK, omitted for VIEW. */
|
|
7
7
|
export type TrackEvent = TrackRequest['events'][number];
|
|
8
|
+
export type PieceTrackRequest = paths['/v1/user/piece-events']['post']['requestBody']['content']['application/json'];
|
|
9
|
+
export type PieceTrackResponse = paths['/v1/user/piece-events']['post']['responses'][200]['content']['application/json']['data'];
|
|
10
|
+
export type PieceTrackEvent = PieceTrackRequest['events'][number];
|
|
8
11
|
/**
|
|
9
12
|
* Record behavioral events (views, clicks) for synthesis UIs, addressed by
|
|
10
13
|
* `keyName`. Powers UI analytics.
|
|
@@ -14,4 +17,10 @@ export type TrackEvent = TrackRequest['events'][number];
|
|
|
14
17
|
* @returns Promise that resolves with response data (recorded: boolean)
|
|
15
18
|
*/
|
|
16
19
|
export declare function recordEvents(config: RequestConfig, options: TrackRequest): Promise<NonNullable<TrackResponse>>;
|
|
20
|
+
/**
|
|
21
|
+
* Record behavioral events for a SynthesisPiece embed, addressed by the piece's `keyName`. Powers
|
|
22
|
+
* per-piece engagement. Distinct from {@link recordEvents} (SynthesisUIs) so a shared keyName is
|
|
23
|
+
* never misattributed across the two entity namespaces.
|
|
24
|
+
*/
|
|
25
|
+
export declare function recordPieceEvents(config: RequestConfig, options: PieceTrackRequest): Promise<NonNullable<PieceTrackResponse>>;
|
|
17
26
|
//# sourceMappingURL=track.d.ts.map
|
package/dist/user/track.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track.d.ts","sourceRoot":"","sources":["../../src/user/track.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,MAAM,MAAM,YAAY,GACtB,KAAK,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAA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