@testerpaykit/api-client 1.1.0
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/.turbo/turbo-build.log +18 -0
- package/dist/index.d.mts +670 -0
- package/dist/index.d.ts +670 -0
- package/dist/index.js +563 -0
- package/dist/index.mjs +528 -0
- package/package.json +42 -0
- package/src/TesterPayKitApiClient.ts +1117 -0
- package/src/index.ts +1 -0
- package/tests/TesterPayKitApiClient.test.ts +367 -0
- package/tsconfig.json +10 -0
- package/vitest.config.ts +12 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
import { TokenManager, IApiClient, LoginRequest, LoginResponse, WeeklySummary, VoiceBugExtractResponse } from '@testerpaykit/core';
|
|
2
|
+
|
|
3
|
+
interface ApiClientConfig {
|
|
4
|
+
baseURL?: string;
|
|
5
|
+
apiKey: string;
|
|
6
|
+
tokenManager?: TokenManager;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* TesterPayKit API Client implementation using Axios.
|
|
10
|
+
*
|
|
11
|
+
* Features:
|
|
12
|
+
* - JWT token authentication with automatic refresh
|
|
13
|
+
* - Request/response interceptors for auth headers
|
|
14
|
+
* - Integration with TokenManager for token lifecycle
|
|
15
|
+
*/
|
|
16
|
+
declare class TesterPayKitApiClient implements IApiClient {
|
|
17
|
+
private client;
|
|
18
|
+
private tokenManager;
|
|
19
|
+
private apiKey;
|
|
20
|
+
constructor(config: ApiClientConfig);
|
|
21
|
+
/**
|
|
22
|
+
* Setup request/response interceptors for JWT authentication.
|
|
23
|
+
*/
|
|
24
|
+
private setupInterceptors;
|
|
25
|
+
/**
|
|
26
|
+
* Authenticate a tester with email/password.
|
|
27
|
+
* Stores tokens in TokenManager and sets up refresh callback.
|
|
28
|
+
*/
|
|
29
|
+
login(request: LoginRequest): Promise<LoginResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* Refresh access token using refresh token.
|
|
32
|
+
* Updates TokenManager with new access token.
|
|
33
|
+
*/
|
|
34
|
+
refreshToken(refreshToken: string): Promise<LoginResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Submit a weekly summary for payment.
|
|
37
|
+
* POST /v1/submissions
|
|
38
|
+
*/
|
|
39
|
+
submitSummary(summary: WeeklySummary): Promise<SubmissionResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* Get submissions for the authenticated tester.
|
|
42
|
+
* GET /v1/submissions
|
|
43
|
+
*/
|
|
44
|
+
getPendingSubmissions(params?: {
|
|
45
|
+
status?: string;
|
|
46
|
+
limit?: number;
|
|
47
|
+
offset?: number;
|
|
48
|
+
}): Promise<WeeklySummary[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Fetch the set of submission IDs the server already holds.
|
|
51
|
+
* GET /v1/submissions?limit=100
|
|
52
|
+
* Soft-fail: returns empty set on any error.
|
|
53
|
+
*/
|
|
54
|
+
fetchServerSubmissionIds(): Promise<Set<string>>;
|
|
55
|
+
/**
|
|
56
|
+
* Set access token manually (for testing or external auth flows).
|
|
57
|
+
*/
|
|
58
|
+
setAccessToken(token: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* Acquire an anonymous tester JWT by trading a {projectId, code}
|
|
61
|
+
* pair for an access + refresh token. No email/password required.
|
|
62
|
+
*
|
|
63
|
+
* Server-side this hits POST /auth/tester/anonymous; a synthetic
|
|
64
|
+
* email derived from {projectId, code} is the dedup key so the
|
|
65
|
+
* same code resolves to the same tester row every time.
|
|
66
|
+
*/
|
|
67
|
+
loginAnonymous(projectId: string, code: string): Promise<AnonymousLoginResponse & {
|
|
68
|
+
testerId?: string;
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* Request a passwordless magic-link sign-in for a tester (or coordinator).
|
|
72
|
+
* POST /auth/magic-link/request. The server emails a single-use link; when
|
|
73
|
+
* `returnUrl` is a first-party *.moinsen.dev origin the link returns there
|
|
74
|
+
* with the token, otherwise it points at the console. `country` (DE/AT/CH)
|
|
75
|
+
* enables open tester self-signup for unknown emails. Always resolves; the
|
|
76
|
+
* response is intentionally generic (no user enumeration).
|
|
77
|
+
*/
|
|
78
|
+
requestMagicLink(input: {
|
|
79
|
+
email: string;
|
|
80
|
+
returnUrl?: string;
|
|
81
|
+
country?: string;
|
|
82
|
+
then?: string;
|
|
83
|
+
}): Promise<{
|
|
84
|
+
ok?: boolean;
|
|
85
|
+
message?: string;
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* Consume a magic-link token (from the returned URL). POST
|
|
89
|
+
* /auth/magic-link/consume. On success stores the minted JWTs and returns
|
|
90
|
+
* the tester/coordinator payload.
|
|
91
|
+
*/
|
|
92
|
+
consumeMagicLink(token: string): Promise<{
|
|
93
|
+
accessToken: string;
|
|
94
|
+
refreshToken?: string;
|
|
95
|
+
userType?: string;
|
|
96
|
+
tester?: {
|
|
97
|
+
id: string;
|
|
98
|
+
email: string;
|
|
99
|
+
displayName?: string;
|
|
100
|
+
status?: string;
|
|
101
|
+
};
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* Submit a bug report to the server. Hits
|
|
105
|
+
* POST /v1/testers/me/bug-reports with the tester JWT already
|
|
106
|
+
* attached by the request interceptor (call loginAnonymous /
|
|
107
|
+
* loginCoordinator first).
|
|
108
|
+
*
|
|
109
|
+
* Server-side enum constraints are enforced — see the typedef
|
|
110
|
+
* for valid {type, severity, category} values. Sending an
|
|
111
|
+
* out-of-band string returns 500 with a detail message in
|
|
112
|
+
* development mode.
|
|
113
|
+
*/
|
|
114
|
+
submitBugReport(payload: Record<string, any>, options?: {
|
|
115
|
+
idempotencyKey?: string;
|
|
116
|
+
}): Promise<BugReportResponse>;
|
|
117
|
+
/**
|
|
118
|
+
* List the bug reports this tester submitted (newest first), with their
|
|
119
|
+
* current status. Hits GET /v1/testers/me/bug-reports. Mirrors the
|
|
120
|
+
* Flutter SDK's getMyBugReports — powers the "Meine Bugs" screen.
|
|
121
|
+
*/
|
|
122
|
+
listMyBugReports(params?: {
|
|
123
|
+
status?: string;
|
|
124
|
+
limit?: number;
|
|
125
|
+
page?: number;
|
|
126
|
+
}): Promise<MyBugReportsResponse>;
|
|
127
|
+
/**
|
|
128
|
+
* The tester's in-app notifications (newest first) + the unread count.
|
|
129
|
+
* GET /v1/testers/me/notifications. Mirrors the Flutter SDK's
|
|
130
|
+
* getMyNotifications — powers the "Nachrichten" inbox.
|
|
131
|
+
*/
|
|
132
|
+
getMyNotifications(params?: {
|
|
133
|
+
limit?: number;
|
|
134
|
+
unreadOnly?: boolean;
|
|
135
|
+
}): Promise<NotificationsResult>;
|
|
136
|
+
/**
|
|
137
|
+
* Mark notifications read. Pass an `id` to mark one, or omit to mark all.
|
|
138
|
+
* POST /v1/testers/me/notifications/read. Returns the new unread count.
|
|
139
|
+
*/
|
|
140
|
+
markNotificationsRead(params?: {
|
|
141
|
+
id?: string;
|
|
142
|
+
}): Promise<number>;
|
|
143
|
+
/**
|
|
144
|
+
* Attach a file (screenshot, log, voice note) to an already-
|
|
145
|
+
* submitted bug report. Hits POST /v1/testers/me/bug-reports/
|
|
146
|
+
* [id]/attachments. Base64-encoded payload, server stores blob
|
|
147
|
+
* + returns metadata.
|
|
148
|
+
*/
|
|
149
|
+
attachToBugReport(bugReportId: string, attachment: BugReportAttachmentInput): Promise<BugReportAttachmentResponse>;
|
|
150
|
+
/**
|
|
151
|
+
* Start a server-side tester session. The API uses snake_case
|
|
152
|
+
* field names here because this maps directly to the sessions
|
|
153
|
+
* table and existing Flutter SDK contract.
|
|
154
|
+
*/
|
|
155
|
+
startTesterSession(input: StartTesterSessionInput): Promise<TesterSessionResponse>;
|
|
156
|
+
/** End a server-side tester session with optional counters. */
|
|
157
|
+
endTesterSession(input: EndTesterSessionInput): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Add one or more timeline events to an active tester session.
|
|
160
|
+
* Hits POST /v1/testers/sessions/:id/events in batch mode.
|
|
161
|
+
*/
|
|
162
|
+
addSessionEvents(sessionId: string, events: SessionEventInput[]): Promise<SessionEventsResponse>;
|
|
163
|
+
/**
|
|
164
|
+
* Add one or more breadcrumbs to an active tester session.
|
|
165
|
+
* Hits POST /v1/testers/sessions/:id/breadcrumbs in batch mode.
|
|
166
|
+
*/
|
|
167
|
+
addSessionBreadcrumbs(sessionId: string, breadcrumbs: SessionBreadcrumbInput[]): Promise<SessionBreadcrumbsResponse>;
|
|
168
|
+
/**
|
|
169
|
+
* Fetch the tester's assigned tasks. Server-side filter by
|
|
170
|
+
* status / project_id. Hits GET /v1/testers/tasks.
|
|
171
|
+
*/
|
|
172
|
+
getMyTasks(filter?: TaskListFilter): Promise<TaskListResponse>;
|
|
173
|
+
/**
|
|
174
|
+
* Mark a task assignment in-progress. PUT /v1/testers/tasks/{id}/start.
|
|
175
|
+
* The server only completes an in-progress task, so callers start first.
|
|
176
|
+
*/
|
|
177
|
+
startTaskAssignment(assignmentId: string): Promise<void>;
|
|
178
|
+
/** Complete a task assignment. PUT /v1/testers/tasks/{id}/complete. */
|
|
179
|
+
completeTaskAssignment(assignmentId: string): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Enroll the authenticated tester in a project. Idempotent —
|
|
182
|
+
* a second enroll on the same project resolves to the existing
|
|
183
|
+
* enrollment row. POST /v1/testers/projects/:id/enroll.
|
|
184
|
+
*/
|
|
185
|
+
enrollInProject(projectId: string): Promise<EnrollmentResponse>;
|
|
186
|
+
/**
|
|
187
|
+
* Reverse of enrollInProject. POST /v1/testers/projects/:id/unenroll.
|
|
188
|
+
*/
|
|
189
|
+
unenrollFromProject(projectId: string): Promise<void>;
|
|
190
|
+
/**
|
|
191
|
+
* Tester profile (handle, points, rating, etc.).
|
|
192
|
+
* GET /v1/testers/me/profile.
|
|
193
|
+
*/
|
|
194
|
+
getMyProfile(): Promise<TesterProfile>;
|
|
195
|
+
/** GET /v1/testers/me/points — current point balance + breakdown. */
|
|
196
|
+
getMyPoints(): Promise<TesterPoints>;
|
|
197
|
+
/** GET /v1/testers/earnings/summary — totals, current balance, this month. */
|
|
198
|
+
getEarningsSummary(): Promise<EarningsSummary>;
|
|
199
|
+
/** GET /v1/testers/earnings/payouts — paginated payout history. */
|
|
200
|
+
getMyPayouts(params?: {
|
|
201
|
+
limit?: number;
|
|
202
|
+
offset?: number;
|
|
203
|
+
}): Promise<{
|
|
204
|
+
payouts: PayoutRecord[];
|
|
205
|
+
total: number;
|
|
206
|
+
}>;
|
|
207
|
+
/**
|
|
208
|
+
* GET /v1/testers/me/projects/:bundleIdOrUuid/knowledge-base
|
|
209
|
+
*
|
|
210
|
+
* Lists the markdown docs the coordinator attached to this project.
|
|
211
|
+
* Feeds the SDK widget's "ask a question about the project" flow.
|
|
212
|
+
* No content in the list response — call `getKnowledgeFile` for the
|
|
213
|
+
* full body. Accepts either the project's bundle id (what the host
|
|
214
|
+
* SDK already knows from its build) or its UUID.
|
|
215
|
+
*/
|
|
216
|
+
listKnowledgeFiles(bundleIdOrProjectId: string): Promise<{
|
|
217
|
+
projectId: string;
|
|
218
|
+
files: KnowledgeFileSummary[];
|
|
219
|
+
}>;
|
|
220
|
+
/**
|
|
221
|
+
* GET /v1/testers/me/projects/:bundleIdOrUuid/knowledge-base/:fileId
|
|
222
|
+
*
|
|
223
|
+
* Fetches one markdown doc's full content. Caller is expected to
|
|
224
|
+
* scope the fetch — passing the same `bundleIdOrProjectId` that
|
|
225
|
+
* `listKnowledgeFiles` was called with is the natural pattern.
|
|
226
|
+
*/
|
|
227
|
+
getKnowledgeFile(bundleIdOrProjectId: string, fileId: string): Promise<KnowledgeFile>;
|
|
228
|
+
/**
|
|
229
|
+
* POST /v1/testers/me/projects/:bundleIdOrUuid/knowledge-base/query
|
|
230
|
+
*
|
|
231
|
+
* RAG over the project's knowledge-base markdown files. Embeds the
|
|
232
|
+
* question, retrieves top-K nearest chunks via pgvector cosine
|
|
233
|
+
* similarity, and asks gpt-4o-mini to synthesise an answer that
|
|
234
|
+
* STRICTLY cites those chunks. Answer language tracks the
|
|
235
|
+
* question (English / German).
|
|
236
|
+
*
|
|
237
|
+
* Returns {answer, citations}. The widget UI surfaces the answer
|
|
238
|
+
* + a "Sources" disclosure with the citations so the tester knows
|
|
239
|
+
* which doc the answer came from. `citations[*].content` is the
|
|
240
|
+
* exact span the model saw — ready to render as a snippet.
|
|
241
|
+
*/
|
|
242
|
+
askKnowledgeBase(bundleIdOrProjectId: string, question: string): Promise<KnowledgeBaseAnswer>;
|
|
243
|
+
/**
|
|
244
|
+
* GET /v1/tasks
|
|
245
|
+
* List available task presets for a project.
|
|
246
|
+
*/
|
|
247
|
+
getTasks(params?: {
|
|
248
|
+
projectId?: string;
|
|
249
|
+
}): Promise<TaskPreset[]>;
|
|
250
|
+
/**
|
|
251
|
+
* POST /v1/testers/me/devices
|
|
252
|
+
* Register (or upsert) this device for push notifications.
|
|
253
|
+
* Server keys on device_token — a second POST with the same token updates the row.
|
|
254
|
+
*/
|
|
255
|
+
registerDevice(input: RegisterDeviceInput): Promise<TesterDeviceResponse>;
|
|
256
|
+
/**
|
|
257
|
+
* POST /v1/session-feedback
|
|
258
|
+
* Submit end-of-session feedback (rating, comments, etc.).
|
|
259
|
+
*/
|
|
260
|
+
submitSessionEndFeedback(payload: Record<string, unknown>): Promise<FeedbackResponse>;
|
|
261
|
+
/**
|
|
262
|
+
* Upload an attachment directly (not tied to a specific bug report).
|
|
263
|
+
* POST /v1/attachments — alternate path from the contract alongside
|
|
264
|
+
* /v1/testers/me/bug-reports/{id}/attachments.
|
|
265
|
+
*/
|
|
266
|
+
uploadAttachment(attachment: BugReportAttachmentInput): Promise<BugReportAttachmentResponse>;
|
|
267
|
+
/**
|
|
268
|
+
* GET /v1/testers/me/retests
|
|
269
|
+
* List bug reports assigned to this tester for re-verification.
|
|
270
|
+
*/
|
|
271
|
+
getMyRetests(params?: {
|
|
272
|
+
status?: string;
|
|
273
|
+
}): Promise<RetestItem[]>;
|
|
274
|
+
/**
|
|
275
|
+
* POST /v1/testers/me/retests/{bugId}/verify
|
|
276
|
+
* Mark a retest as verified (bug is fixed).
|
|
277
|
+
*/
|
|
278
|
+
verifyRetest(bugId: string): Promise<void>;
|
|
279
|
+
/**
|
|
280
|
+
* POST /v1/testers/me/retests/{bugId}/reopen
|
|
281
|
+
* Reopen a retest (bug is still present), optionally with a reason.
|
|
282
|
+
*/
|
|
283
|
+
reopenRetest(bugId: string, reason?: string): Promise<void>;
|
|
284
|
+
/**
|
|
285
|
+
* POST /v1/testers/me/bug-reports/voice-extract
|
|
286
|
+
* Contract: wire.bug_reports.voiceExtractBugFields
|
|
287
|
+
*
|
|
288
|
+
* Sends base64-encoded audio to the server. The server runs Whisper
|
|
289
|
+
* (transcription) + gpt-4o-mini (structured extraction) and returns
|
|
290
|
+
* pre-filled bug-report fields in the tester's language.
|
|
291
|
+
*
|
|
292
|
+
* Wire body uses snake_case per contract. Timeout is 60 s because
|
|
293
|
+
* Whisper + Chat round-trip can take 10-30 s on long recordings.
|
|
294
|
+
*/
|
|
295
|
+
voiceExtractBugFields(request: {
|
|
296
|
+
audioBase64: string;
|
|
297
|
+
mimeType: string;
|
|
298
|
+
sourceLanguage?: string;
|
|
299
|
+
projectId?: string;
|
|
300
|
+
preClassification?: string;
|
|
301
|
+
}): Promise<VoiceBugExtractResponse>;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Result from `askKnowledgeBase`.
|
|
305
|
+
*/
|
|
306
|
+
interface KnowledgeBaseAnswer {
|
|
307
|
+
/** The model's synthesised answer, scoped to the citation spans. */
|
|
308
|
+
answer: string;
|
|
309
|
+
/** Top-K chunks the model was given. Ordered by similarity. */
|
|
310
|
+
citations: KnowledgeBaseCitation[];
|
|
311
|
+
/** Resolved project UUID — useful for telemetry / dedup. */
|
|
312
|
+
projectId: string;
|
|
313
|
+
/** Echo of the model used for the answer (e.g. "gpt-4o-mini"). */
|
|
314
|
+
model?: string;
|
|
315
|
+
}
|
|
316
|
+
interface KnowledgeBaseCitation {
|
|
317
|
+
chunkId: string;
|
|
318
|
+
content: string;
|
|
319
|
+
/** Cosine distance — smaller = more similar. */
|
|
320
|
+
distance: number;
|
|
321
|
+
fileName: string;
|
|
322
|
+
fileId: string;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Knowledge-base file metadata. Listed without `content`; call
|
|
326
|
+
* `getKnowledgeFile` to fetch the markdown body.
|
|
327
|
+
*/
|
|
328
|
+
interface KnowledgeFileSummary {
|
|
329
|
+
id: string;
|
|
330
|
+
fileName: string;
|
|
331
|
+
byteLength: number;
|
|
332
|
+
description: string | null;
|
|
333
|
+
createdAt: string;
|
|
334
|
+
updatedAt: string;
|
|
335
|
+
}
|
|
336
|
+
interface KnowledgeFile extends KnowledgeFileSummary {
|
|
337
|
+
/** UTF-8 markdown. Hard-capped server-side at 1 MB. */
|
|
338
|
+
content: string;
|
|
339
|
+
}
|
|
340
|
+
/** Response from POST /auth/tester/anonymous */
|
|
341
|
+
interface AnonymousLoginResponse {
|
|
342
|
+
accessToken: string;
|
|
343
|
+
refreshToken: string;
|
|
344
|
+
userType: 'tester';
|
|
345
|
+
tester: {
|
|
346
|
+
id: string;
|
|
347
|
+
code: string;
|
|
348
|
+
projectId: string;
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
type BugReportType = 'bug' | 'crash' | 'uiIssue' | 'performance' | 'featureRequest' | 'generalFeedback';
|
|
352
|
+
type BugSeverity = 'critical' | 'high' | 'medium' | 'low';
|
|
353
|
+
type BugCategory = 'functional' | 'ui' | 'performance' | 'security' | 'compatibility' | 'localization' | 'accessibility';
|
|
354
|
+
/**
|
|
355
|
+
* Summary of a bug report this tester submitted, as returned by
|
|
356
|
+
* GET /v1/testers/me/bug-reports. Powers the "Meine Bugs" screen.
|
|
357
|
+
*/
|
|
358
|
+
interface MyBugReportSummary {
|
|
359
|
+
id: string;
|
|
360
|
+
title: string;
|
|
361
|
+
description?: string | null;
|
|
362
|
+
status: string;
|
|
363
|
+
severity?: string | null;
|
|
364
|
+
createdAt: string;
|
|
365
|
+
}
|
|
366
|
+
interface MyBugReportsResponse {
|
|
367
|
+
bugReports: MyBugReportSummary[];
|
|
368
|
+
pagination?: {
|
|
369
|
+
page: number;
|
|
370
|
+
limit: number;
|
|
371
|
+
totalCount: number;
|
|
372
|
+
totalPages: number;
|
|
373
|
+
hasNext: boolean;
|
|
374
|
+
hasPrev: boolean;
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* A tester-facing notification (bug accepted/fixed/rejected, retest assigned,
|
|
379
|
+
* reward). Returned by GET /v1/testers/me/notifications.
|
|
380
|
+
*/
|
|
381
|
+
interface TpkNotification {
|
|
382
|
+
id: string;
|
|
383
|
+
type: string;
|
|
384
|
+
title: string;
|
|
385
|
+
body?: string | null;
|
|
386
|
+
data?: Record<string, unknown>;
|
|
387
|
+
relatedBugId?: string | null;
|
|
388
|
+
isRead: boolean;
|
|
389
|
+
readAt?: string | null;
|
|
390
|
+
createdAt: string;
|
|
391
|
+
}
|
|
392
|
+
interface NotificationsResult {
|
|
393
|
+
notifications: TpkNotification[];
|
|
394
|
+
unreadCount: number;
|
|
395
|
+
}
|
|
396
|
+
/** Bug-report payload accepted by POST /v1/testers/me/bug-reports. */
|
|
397
|
+
interface BugReportPayload {
|
|
398
|
+
sessionId: string;
|
|
399
|
+
projectId: string;
|
|
400
|
+
type: BugReportType;
|
|
401
|
+
severity: BugSeverity;
|
|
402
|
+
category: BugCategory;
|
|
403
|
+
title: string;
|
|
404
|
+
description: string;
|
|
405
|
+
currentScreen: string;
|
|
406
|
+
deviceSnapshot: Record<string, unknown>;
|
|
407
|
+
appSnapshot: Record<string, unknown>;
|
|
408
|
+
reproductionSteps?: unknown[];
|
|
409
|
+
expectedBehavior?: string;
|
|
410
|
+
actualBehavior?: string;
|
|
411
|
+
breadcrumbs?: unknown[];
|
|
412
|
+
affectedFeature?: string;
|
|
413
|
+
frequency?: 'always' | 'often' | 'sometimes' | 'rarely';
|
|
414
|
+
/**
|
|
415
|
+
* Voice-bug split (A2): when `transcript` is set the report is
|
|
416
|
+
* voice-originated — the server treats title/description as the
|
|
417
|
+
* tester's approved O-Ton (their language), stores them verbatim
|
|
418
|
+
* in bug_reports.tester_*, and derives the English enriched
|
|
419
|
+
* canonical title/description/expected/actual. `sourceLanguage` is
|
|
420
|
+
* the ISO-639-1 code the tester spoke. Absent for typed reports.
|
|
421
|
+
*/
|
|
422
|
+
transcript?: string;
|
|
423
|
+
sourceLanguage?: string;
|
|
424
|
+
}
|
|
425
|
+
interface BugReportResponse {
|
|
426
|
+
id: string;
|
|
427
|
+
status: string;
|
|
428
|
+
createdAt: string;
|
|
429
|
+
submittedAt: string;
|
|
430
|
+
message?: string;
|
|
431
|
+
/**
|
|
432
|
+
* True when the server matched an existing bug_reports row by the
|
|
433
|
+
* client-supplied `X-Idempotency-Key` rather than inserting a new
|
|
434
|
+
* one. Lets the SDK tell "fresh submission" from "your retry won
|
|
435
|
+
* the race" without parsing status codes. Always present in
|
|
436
|
+
* server responses since migration 027; older API versions omit it
|
|
437
|
+
* and it stays undefined.
|
|
438
|
+
*/
|
|
439
|
+
deduplicated?: boolean;
|
|
440
|
+
}
|
|
441
|
+
/** Attachment upload input for an existing bug report. */
|
|
442
|
+
interface BugReportAttachmentInput {
|
|
443
|
+
fileName: string;
|
|
444
|
+
fileType: 'image' | 'screenshot' | 'voice_note' | 'screen_recording' | 'video' | 'audio' | 'log' | 'other';
|
|
445
|
+
fileSize: number;
|
|
446
|
+
/** Base64-encoded file contents. Required when filePath is absent. */
|
|
447
|
+
fileData?: string;
|
|
448
|
+
/** Server-side file reference (instead of fileData). */
|
|
449
|
+
filePath?: string;
|
|
450
|
+
mimeType?: string;
|
|
451
|
+
}
|
|
452
|
+
interface StartTesterSessionInput {
|
|
453
|
+
projectId: string;
|
|
454
|
+
deviceInfo?: Record<string, unknown>;
|
|
455
|
+
appVersion?: string;
|
|
456
|
+
sdkVersion?: string;
|
|
457
|
+
deviceId?: string;
|
|
458
|
+
}
|
|
459
|
+
interface TesterSessionResponse {
|
|
460
|
+
id: string;
|
|
461
|
+
project_id: string;
|
|
462
|
+
tester_id?: string;
|
|
463
|
+
started_at?: string;
|
|
464
|
+
ended_at?: string | null;
|
|
465
|
+
}
|
|
466
|
+
type TesterSessionEndReason = 'completed' | 'lifecycle_flush' | 'timeout' | 'abandoned';
|
|
467
|
+
interface EndTesterSessionInput {
|
|
468
|
+
sessionId: string;
|
|
469
|
+
endedAt?: Date;
|
|
470
|
+
bugsFound?: number;
|
|
471
|
+
tasksCompleted?: number;
|
|
472
|
+
endReason?: TesterSessionEndReason;
|
|
473
|
+
foregroundSeconds?: number;
|
|
474
|
+
}
|
|
475
|
+
interface SessionEventInput {
|
|
476
|
+
eventType: string;
|
|
477
|
+
eventData?: Record<string, unknown>;
|
|
478
|
+
screenRoute?: string;
|
|
479
|
+
timestamp?: Date | string;
|
|
480
|
+
}
|
|
481
|
+
interface SessionEventsResponse {
|
|
482
|
+
inserted: number;
|
|
483
|
+
events: Array<{
|
|
484
|
+
id: string;
|
|
485
|
+
timestamp: string;
|
|
486
|
+
}>;
|
|
487
|
+
}
|
|
488
|
+
interface SessionBreadcrumbInput {
|
|
489
|
+
breadcrumbType: string;
|
|
490
|
+
message: string;
|
|
491
|
+
metadata?: Record<string, unknown>;
|
|
492
|
+
timestamp?: Date | string;
|
|
493
|
+
}
|
|
494
|
+
interface SessionBreadcrumbsResponse {
|
|
495
|
+
inserted: number;
|
|
496
|
+
breadcrumbs: Array<{
|
|
497
|
+
id: string;
|
|
498
|
+
timestamp: string;
|
|
499
|
+
}>;
|
|
500
|
+
}
|
|
501
|
+
interface BugReportAttachmentResponse {
|
|
502
|
+
id: string;
|
|
503
|
+
fileName: string;
|
|
504
|
+
fileType: string;
|
|
505
|
+
fileSize: number;
|
|
506
|
+
uploadedAt: string;
|
|
507
|
+
}
|
|
508
|
+
interface TaskListFilter {
|
|
509
|
+
status?: 'pending' | 'in_progress' | 'completed';
|
|
510
|
+
project_id?: string;
|
|
511
|
+
}
|
|
512
|
+
interface TesterTask {
|
|
513
|
+
assignmentId: string;
|
|
514
|
+
taskPresetId: string;
|
|
515
|
+
status: 'pending' | 'in_progress' | 'completed';
|
|
516
|
+
assignedAt: string;
|
|
517
|
+
startedAt?: string | null;
|
|
518
|
+
completedAt?: string | null;
|
|
519
|
+
task: {
|
|
520
|
+
id: string;
|
|
521
|
+
name: string;
|
|
522
|
+
description: string | null;
|
|
523
|
+
rewardAmount: number | null;
|
|
524
|
+
estimatedDuration: number | null;
|
|
525
|
+
priority: string | null;
|
|
526
|
+
steps: unknown[];
|
|
527
|
+
relatedBugId?: string | null;
|
|
528
|
+
focusArea?: string | null;
|
|
529
|
+
};
|
|
530
|
+
project: {
|
|
531
|
+
id: string;
|
|
532
|
+
name: string;
|
|
533
|
+
bundleId: string;
|
|
534
|
+
};
|
|
535
|
+
build?: {
|
|
536
|
+
id: string;
|
|
537
|
+
version: string;
|
|
538
|
+
buildNumber: string;
|
|
539
|
+
} | null;
|
|
540
|
+
}
|
|
541
|
+
interface TaskListResponse {
|
|
542
|
+
tasks: TesterTask[];
|
|
543
|
+
total: number;
|
|
544
|
+
summary: {
|
|
545
|
+
pending: number;
|
|
546
|
+
inProgress: number;
|
|
547
|
+
completed: number;
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
interface EnrollmentResponse {
|
|
551
|
+
enrollmentId: string;
|
|
552
|
+
testerId: string;
|
|
553
|
+
projectId: string;
|
|
554
|
+
status: string;
|
|
555
|
+
enrolledAt: string;
|
|
556
|
+
}
|
|
557
|
+
interface TesterProfile {
|
|
558
|
+
id: string;
|
|
559
|
+
email?: string | null;
|
|
560
|
+
handle?: string | null;
|
|
561
|
+
fullName?: string | null;
|
|
562
|
+
rating?: number | null;
|
|
563
|
+
pointsTotal?: number | null;
|
|
564
|
+
status?: string;
|
|
565
|
+
createdAt?: string;
|
|
566
|
+
}
|
|
567
|
+
interface TesterPoints {
|
|
568
|
+
total: number;
|
|
569
|
+
breakdown?: Record<string, number>;
|
|
570
|
+
}
|
|
571
|
+
/** Response from GET /v1/testers/earnings/summary. */
|
|
572
|
+
interface EarningsSummary {
|
|
573
|
+
currentBalance: number;
|
|
574
|
+
totalEarnings: {
|
|
575
|
+
approved: number;
|
|
576
|
+
pending: number;
|
|
577
|
+
rejected: number;
|
|
578
|
+
};
|
|
579
|
+
submissions: {
|
|
580
|
+
pending: number;
|
|
581
|
+
approved: number;
|
|
582
|
+
rejected: number;
|
|
583
|
+
};
|
|
584
|
+
payouts: {
|
|
585
|
+
totalPaid: number;
|
|
586
|
+
count: number;
|
|
587
|
+
lastPayoutDate: string | null;
|
|
588
|
+
};
|
|
589
|
+
thisMonth: {
|
|
590
|
+
submissions: number;
|
|
591
|
+
earnings: number;
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
interface PayoutRecord {
|
|
595
|
+
id: string;
|
|
596
|
+
amount: number;
|
|
597
|
+
currency: string;
|
|
598
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
599
|
+
method?: string | null;
|
|
600
|
+
createdAt: string;
|
|
601
|
+
completedAt?: string | null;
|
|
602
|
+
}
|
|
603
|
+
/** Response from POST /v1/submissions */
|
|
604
|
+
interface SubmissionResponse {
|
|
605
|
+
id: string;
|
|
606
|
+
status: string;
|
|
607
|
+
message?: string;
|
|
608
|
+
}
|
|
609
|
+
/** Input for POST /v1/testers/me/devices */
|
|
610
|
+
interface RegisterDeviceInput {
|
|
611
|
+
deviceToken: string;
|
|
612
|
+
deviceType: string;
|
|
613
|
+
deviceModel?: string;
|
|
614
|
+
osVersion?: string;
|
|
615
|
+
appVersion?: string;
|
|
616
|
+
}
|
|
617
|
+
/** Response from POST /v1/testers/me/devices */
|
|
618
|
+
interface TesterDeviceResponse {
|
|
619
|
+
id: string;
|
|
620
|
+
deviceToken: string;
|
|
621
|
+
deviceType: string;
|
|
622
|
+
}
|
|
623
|
+
/** Response from POST /v1/session-feedback */
|
|
624
|
+
interface FeedbackResponse {
|
|
625
|
+
id: string;
|
|
626
|
+
status: string;
|
|
627
|
+
message?: string;
|
|
628
|
+
}
|
|
629
|
+
/** A single retest item from GET /v1/testers/me/retests */
|
|
630
|
+
interface RetestItem {
|
|
631
|
+
id: string;
|
|
632
|
+
title: string;
|
|
633
|
+
description?: string | null;
|
|
634
|
+
expectedBehavior?: string | null;
|
|
635
|
+
actualBehavior?: string | null;
|
|
636
|
+
reproductionSteps?: unknown[] | null;
|
|
637
|
+
fixedInVersion?: string | null;
|
|
638
|
+
status: string;
|
|
639
|
+
severity?: string | null;
|
|
640
|
+
type?: string | null;
|
|
641
|
+
retestAssignedAt?: string | null;
|
|
642
|
+
createdAt: string;
|
|
643
|
+
projectId: string;
|
|
644
|
+
screenshotPath?: string | null;
|
|
645
|
+
}
|
|
646
|
+
/** A task preset from GET /v1/tasks */
|
|
647
|
+
interface TaskPreset {
|
|
648
|
+
id: string;
|
|
649
|
+
projectId: string;
|
|
650
|
+
title: string;
|
|
651
|
+
description: string;
|
|
652
|
+
steps: TaskStep[];
|
|
653
|
+
isActive: boolean;
|
|
654
|
+
createdAt: string;
|
|
655
|
+
updatedAt: string;
|
|
656
|
+
releaseId?: string | null;
|
|
657
|
+
targetTesters?: number | null;
|
|
658
|
+
payoutRuleId?: string | null;
|
|
659
|
+
startsAt?: string | null;
|
|
660
|
+
endsAt?: string | null;
|
|
661
|
+
}
|
|
662
|
+
interface TaskStep {
|
|
663
|
+
order: number;
|
|
664
|
+
title: string;
|
|
665
|
+
description?: string | null;
|
|
666
|
+
required: boolean;
|
|
667
|
+
estimatedMinutes?: number | null;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export { type AnonymousLoginResponse, type ApiClientConfig, type BugCategory, type BugReportAttachmentInput, type BugReportAttachmentResponse, type BugReportPayload, type BugReportResponse, type BugReportType, type BugSeverity, type EarningsSummary, type EndTesterSessionInput, type EnrollmentResponse, type FeedbackResponse, type KnowledgeBaseAnswer, type KnowledgeBaseCitation, type KnowledgeFile, type KnowledgeFileSummary, type MyBugReportSummary, type MyBugReportsResponse, type NotificationsResult, type PayoutRecord, type RegisterDeviceInput, type RetestItem, type SessionBreadcrumbInput, type SessionBreadcrumbsResponse, type SessionEventInput, type SessionEventsResponse, type StartTesterSessionInput, type SubmissionResponse, type TaskListFilter, type TaskListResponse, type TaskPreset, type TaskStep, type TesterDeviceResponse, TesterPayKitApiClient, type TesterPoints, type TesterProfile, type TesterSessionEndReason, type TesterSessionResponse, type TesterTask, type TpkNotification };
|