@testerpaykit/expo 0.7.5 → 0.8.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/CHANGELOG.md +25 -0
- package/README.md +21 -0
- package/dist/index.d.mts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +74 -6
- package/dist/index.mjs +75 -6
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@testerpaykit/expo` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.8.0 — 2026-10-25
|
|
6
|
+
|
|
7
|
+
**AI test runs can be started from outside the app.**
|
|
8
|
+
|
|
9
|
+
Requires `@testerpaykit/core` 1.1.0, `@testerpaykit/api-client` 1.3.0 and
|
|
10
|
+
`@testerpaykit/ai-tester` 0.5.0 (published together), and an API that has
|
|
11
|
+
`POST /v1/testers/me/ai-sessions/claim` (api.testerpaykit.com from
|
|
12
|
+
2026-10-25).
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- `TesterPayKitWrapper` takes `aiRemoteTrigger` (and `aiRemotePollSeconds`,
|
|
16
|
+
default 15). With it on, the app picks up AI runs started from the
|
|
17
|
+
console ("Start on device") or `tpk autotest`, lets the AI drive it, and
|
|
18
|
+
closes the overlay on its own when the run ends.
|
|
19
|
+
- `TpkExpo.claimRemoteAiSession()` — the call behind it
|
|
20
|
+
(`POST /v1/testers/me/ai-sessions/claim`).
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- The AI tester was blind on the web: the shared executor asked for a
|
|
24
|
+
screenshot hook nobody installed, so the model only saw the widget list
|
|
25
|
+
and could not tell whether a tap changed anything. The wrapper now
|
|
26
|
+
installs it while a run is open.
|
|
27
|
+
- The AI tester could tap the Stop button of its own overlay and end the
|
|
28
|
+
run. Overlay controls are no longer offered to it.
|
|
29
|
+
|
|
5
30
|
## 0.7.5 — 2026-10-24
|
|
6
31
|
|
|
7
32
|
**A spoken bug report opens on Review, ready to submit.**
|
package/README.md
CHANGED
|
@@ -323,6 +323,27 @@ if (note) {
|
|
|
323
323
|
}
|
|
324
324
|
```
|
|
325
325
|
|
|
326
|
+
## AI test runs started from outside
|
|
327
|
+
|
|
328
|
+
The wrapper can hand the app to an AI tester that a coordinator starts
|
|
329
|
+
from the console ("Start on device" on the project page) or from a
|
|
330
|
+
terminal (`tpk autotest --project <id>`). Nobody has to touch the device:
|
|
331
|
+
|
|
332
|
+
```tsx
|
|
333
|
+
<TesterPayKitWrapper tpk={tpk} aiRemoteTrigger>
|
|
334
|
+
<YourApp />
|
|
335
|
+
</TesterPayKitWrapper>
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
While the app is in the foreground the wrapper asks the API every 15
|
|
339
|
+
seconds (`aiRemotePollSeconds`) whether a run is waiting for its project.
|
|
340
|
+
When one is, the AI overlay opens, a server-side model drives the app
|
|
341
|
+
(taps, typing, scrolling, with a screenshot per step) and files findings
|
|
342
|
+
into the console's AI Findings. When the run ends the overlay closes and
|
|
343
|
+
the app waits for the next one. Tap anywhere outside the overlay to pause
|
|
344
|
+
a run. Off by default; enable it only in builds you want remote-controlled.
|
|
345
|
+
The project's organisation must have AI features enabled.
|
|
346
|
+
|
|
326
347
|
## What this package is NOT
|
|
327
348
|
|
|
328
349
|
- **Not** a full console app. The provider, floating button, and
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _testerpaykit_api_client from '@testerpaykit/api-client';
|
|
2
2
|
import { SessionEventInput, BugReportAttachmentInput, BugReportAttachmentResponse, BugReportPayload, BugReportResponse, TaskListResponse, TesterTask, TesterPayKitApiClient, AnonymousLoginResponse, BugReportType, BugSeverity, BugCategory, MyBugReportSummary, NotificationsResult, TesterSessionEndReason, TesterProfile, TesterPoints, EarningsSummary, PayoutRecord } from '@testerpaykit/api-client';
|
|
3
3
|
export { BugCategory, BugReportAttachmentInput, BugReportAttachmentResponse, BugReportType, BugSeverity, EarningsSummary, EnrollmentResponse, MyBugReportSummary, MyBugReportsResponse, NotificationsResult, PayoutRecord, TaskListFilter, TaskListResponse, TesterPoints, TesterProfile, TesterTask, TpkNotification } from '@testerpaykit/api-client';
|
|
4
|
+
import { RemoteAiSession } from '@testerpaykit/core';
|
|
4
5
|
import React, { RefObject, ReactNode } from 'react';
|
|
5
6
|
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
6
7
|
|
|
@@ -692,6 +693,12 @@ declare class TpkExpo {
|
|
|
692
693
|
markNotificationsRead(params?: {
|
|
693
694
|
id?: string;
|
|
694
695
|
}): Promise<number>;
|
|
696
|
+
/**
|
|
697
|
+
* Claim an AI-tester run started from outside (console or
|
|
698
|
+
* `tpk autotest`) for this app's project. Null when nothing waits.
|
|
699
|
+
* Used by the wrapper's `aiRemoteTrigger` poll.
|
|
700
|
+
*/
|
|
701
|
+
claimRemoteAiSession(): Promise<RemoteAiSession | null>;
|
|
695
702
|
/**
|
|
696
703
|
* Onboard with a runtime invite code (instead of the baked-in
|
|
697
704
|
* config.testerCode): authenticate anonymously with `code`, persist the
|
|
@@ -1905,6 +1912,14 @@ interface TesterPayKitWrapperProps {
|
|
|
1905
1912
|
aiCoordinatorToken?: string;
|
|
1906
1913
|
aiProjectId?: string;
|
|
1907
1914
|
aiApiBaseUrl?: string;
|
|
1915
|
+
/** Let AI-tester runs started from outside (console "Start AI test",
|
|
1916
|
+
* `tpk autotest`) drive this app: while in the foreground the wrapper
|
|
1917
|
+
* asks the API every `aiRemotePollSeconds` whether a run is waiting
|
|
1918
|
+
* for this project and, if so, hands the app to it. Off by default —
|
|
1919
|
+
* only enable it in builds you want remote-controlled. */
|
|
1920
|
+
aiRemoteTrigger?: boolean;
|
|
1921
|
+
/** Poll interval for `aiRemoteTrigger`. Default 15. */
|
|
1922
|
+
aiRemotePollSeconds?: number;
|
|
1908
1923
|
/** Currently active route — flows through to bug reports. */
|
|
1909
1924
|
currentScreen?: string;
|
|
1910
1925
|
/** When the session started — drives the earnings clock + the
|
|
@@ -1917,7 +1932,7 @@ interface TesterPayKitWrapperProps {
|
|
|
1917
1932
|
theme?: Partial<TpkTheme>;
|
|
1918
1933
|
testID?: string;
|
|
1919
1934
|
}
|
|
1920
|
-
declare function TesterPayKitWrapper({ children, tpk, enableWrapper, enableShake, shakeThresholdG, style, onShowDebugLogs, notificationCount, onFlushCachedCrashes, retestCount, onShowRetests, onViewDashboard, buttonPosition, currentScreen, sessionStartedAt, aiCoordinatorToken, aiProjectId, aiApiBaseUrl, theme, testID, }: TesterPayKitWrapperProps): React.ReactElement;
|
|
1935
|
+
declare function TesterPayKitWrapper({ children, tpk, enableWrapper, enableShake, shakeThresholdG, style, onShowDebugLogs, notificationCount, onFlushCachedCrashes, retestCount, onShowRetests, onViewDashboard, buttonPosition, currentScreen, sessionStartedAt, aiCoordinatorToken, aiRemoteTrigger, aiRemotePollSeconds, aiProjectId, aiApiBaseUrl, theme, testID, }: TesterPayKitWrapperProps): React.ReactElement;
|
|
1921
1936
|
|
|
1922
1937
|
interface TpkAnnotatedProps {
|
|
1923
1938
|
/** Task this element belongs to. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _testerpaykit_api_client from '@testerpaykit/api-client';
|
|
2
2
|
import { SessionEventInput, BugReportAttachmentInput, BugReportAttachmentResponse, BugReportPayload, BugReportResponse, TaskListResponse, TesterTask, TesterPayKitApiClient, AnonymousLoginResponse, BugReportType, BugSeverity, BugCategory, MyBugReportSummary, NotificationsResult, TesterSessionEndReason, TesterProfile, TesterPoints, EarningsSummary, PayoutRecord } from '@testerpaykit/api-client';
|
|
3
3
|
export { BugCategory, BugReportAttachmentInput, BugReportAttachmentResponse, BugReportType, BugSeverity, EarningsSummary, EnrollmentResponse, MyBugReportSummary, MyBugReportsResponse, NotificationsResult, PayoutRecord, TaskListFilter, TaskListResponse, TesterPoints, TesterProfile, TesterTask, TpkNotification } from '@testerpaykit/api-client';
|
|
4
|
+
import { RemoteAiSession } from '@testerpaykit/core';
|
|
4
5
|
import React, { RefObject, ReactNode } from 'react';
|
|
5
6
|
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
6
7
|
|
|
@@ -692,6 +693,12 @@ declare class TpkExpo {
|
|
|
692
693
|
markNotificationsRead(params?: {
|
|
693
694
|
id?: string;
|
|
694
695
|
}): Promise<number>;
|
|
696
|
+
/**
|
|
697
|
+
* Claim an AI-tester run started from outside (console or
|
|
698
|
+
* `tpk autotest`) for this app's project. Null when nothing waits.
|
|
699
|
+
* Used by the wrapper's `aiRemoteTrigger` poll.
|
|
700
|
+
*/
|
|
701
|
+
claimRemoteAiSession(): Promise<RemoteAiSession | null>;
|
|
695
702
|
/**
|
|
696
703
|
* Onboard with a runtime invite code (instead of the baked-in
|
|
697
704
|
* config.testerCode): authenticate anonymously with `code`, persist the
|
|
@@ -1905,6 +1912,14 @@ interface TesterPayKitWrapperProps {
|
|
|
1905
1912
|
aiCoordinatorToken?: string;
|
|
1906
1913
|
aiProjectId?: string;
|
|
1907
1914
|
aiApiBaseUrl?: string;
|
|
1915
|
+
/** Let AI-tester runs started from outside (console "Start AI test",
|
|
1916
|
+
* `tpk autotest`) drive this app: while in the foreground the wrapper
|
|
1917
|
+
* asks the API every `aiRemotePollSeconds` whether a run is waiting
|
|
1918
|
+
* for this project and, if so, hands the app to it. Off by default —
|
|
1919
|
+
* only enable it in builds you want remote-controlled. */
|
|
1920
|
+
aiRemoteTrigger?: boolean;
|
|
1921
|
+
/** Poll interval for `aiRemoteTrigger`. Default 15. */
|
|
1922
|
+
aiRemotePollSeconds?: number;
|
|
1908
1923
|
/** Currently active route — flows through to bug reports. */
|
|
1909
1924
|
currentScreen?: string;
|
|
1910
1925
|
/** When the session started — drives the earnings clock + the
|
|
@@ -1917,7 +1932,7 @@ interface TesterPayKitWrapperProps {
|
|
|
1917
1932
|
theme?: Partial<TpkTheme>;
|
|
1918
1933
|
testID?: string;
|
|
1919
1934
|
}
|
|
1920
|
-
declare function TesterPayKitWrapper({ children, tpk, enableWrapper, enableShake, shakeThresholdG, style, onShowDebugLogs, notificationCount, onFlushCachedCrashes, retestCount, onShowRetests, onViewDashboard, buttonPosition, currentScreen, sessionStartedAt, aiCoordinatorToken, aiProjectId, aiApiBaseUrl, theme, testID, }: TesterPayKitWrapperProps): React.ReactElement;
|
|
1935
|
+
declare function TesterPayKitWrapper({ children, tpk, enableWrapper, enableShake, shakeThresholdG, style, onShowDebugLogs, notificationCount, onFlushCachedCrashes, retestCount, onShowRetests, onViewDashboard, buttonPosition, currentScreen, sessionStartedAt, aiCoordinatorToken, aiRemoteTrigger, aiRemotePollSeconds, aiProjectId, aiApiBaseUrl, theme, testID, }: TesterPayKitWrapperProps): React.ReactElement;
|
|
1921
1936
|
|
|
1922
1937
|
interface TpkAnnotatedProps {
|
|
1923
1938
|
/** Task this element belongs to. */
|
package/dist/index.js
CHANGED
|
@@ -1208,7 +1208,7 @@ function findAssignmentForTask(tasks, key) {
|
|
|
1208
1208
|
}
|
|
1209
1209
|
|
|
1210
1210
|
// package.json
|
|
1211
|
-
var version = "0.
|
|
1211
|
+
var version = "0.8.0";
|
|
1212
1212
|
|
|
1213
1213
|
// src/version.ts
|
|
1214
1214
|
var SDK_VERSION = `@testerpaykit/expo/${version}`;
|
|
@@ -1519,6 +1519,14 @@ var TpkExpo = class _TpkExpo {
|
|
|
1519
1519
|
async markNotificationsRead(params) {
|
|
1520
1520
|
return this.api.markNotificationsRead(params);
|
|
1521
1521
|
}
|
|
1522
|
+
/**
|
|
1523
|
+
* Claim an AI-tester run started from outside (console or
|
|
1524
|
+
* `tpk autotest`) for this app's project. Null when nothing waits.
|
|
1525
|
+
* Used by the wrapper's `aiRemoteTrigger` poll.
|
|
1526
|
+
*/
|
|
1527
|
+
async claimRemoteAiSession() {
|
|
1528
|
+
return this.api.claimRemoteAiSession(this.config.projectId);
|
|
1529
|
+
}
|
|
1522
1530
|
/**
|
|
1523
1531
|
* Onboard with a runtime invite code (instead of the baked-in
|
|
1524
1532
|
* config.testerCode): authenticate anonymously with `code`, persist the
|
|
@@ -9852,6 +9860,7 @@ function AiRemoteControl({
|
|
|
9852
9860
|
apiBaseUrl,
|
|
9853
9861
|
coordinatorToken,
|
|
9854
9862
|
projectId,
|
|
9863
|
+
remoteSession,
|
|
9855
9864
|
configuration,
|
|
9856
9865
|
onClose,
|
|
9857
9866
|
onSessionEnded,
|
|
@@ -9877,12 +9886,19 @@ function AiRemoteControl({
|
|
|
9877
9886
|
wsRef.current = null;
|
|
9878
9887
|
return;
|
|
9879
9888
|
}
|
|
9880
|
-
setStatus("choosing");
|
|
9881
9889
|
setActionCount(0);
|
|
9882
9890
|
setErrorMessage(null);
|
|
9883
|
-
setSessionId(null);
|
|
9884
9891
|
closedRef.current = false;
|
|
9885
9892
|
(0, import_ai_tester.resetWidgetIds)();
|
|
9893
|
+
if (remoteSession) {
|
|
9894
|
+
setStatus("starting");
|
|
9895
|
+
setSessionId(remoteSession.sessionId);
|
|
9896
|
+
_openSocket(remoteSession.wsUrl);
|
|
9897
|
+
return;
|
|
9898
|
+
}
|
|
9899
|
+
setStatus("choosing");
|
|
9900
|
+
setSessionId(null);
|
|
9901
|
+
if (!apiBaseUrl || !coordinatorToken) return;
|
|
9886
9902
|
let cancelled = false;
|
|
9887
9903
|
void (async () => {
|
|
9888
9904
|
try {
|
|
@@ -9902,12 +9918,15 @@ function AiRemoteControl({
|
|
|
9902
9918
|
return () => {
|
|
9903
9919
|
cancelled = true;
|
|
9904
9920
|
};
|
|
9905
|
-
}, [visible, apiBaseUrl, coordinatorToken]);
|
|
9921
|
+
}, [visible, apiBaseUrl, coordinatorToken, remoteSession]);
|
|
9906
9922
|
const _start = (0, import_react22.useCallback)(
|
|
9907
9923
|
() => {
|
|
9908
9924
|
setStatus("starting");
|
|
9909
9925
|
void (async () => {
|
|
9910
9926
|
try {
|
|
9927
|
+
if (!apiBaseUrl || !coordinatorToken || !projectId) {
|
|
9928
|
+
throw new Error("AI test needs apiBaseUrl, coordinatorToken and projectId");
|
|
9929
|
+
}
|
|
9911
9930
|
const resp = await fetch(
|
|
9912
9931
|
`${apiBaseUrl}/v1/coordinator/projects/${projectId}/ai-sessions`,
|
|
9913
9932
|
{
|
|
@@ -10246,6 +10265,8 @@ function TesterPayKitWrapper({
|
|
|
10246
10265
|
currentScreen,
|
|
10247
10266
|
sessionStartedAt,
|
|
10248
10267
|
aiCoordinatorToken,
|
|
10268
|
+
aiRemoteTrigger = false,
|
|
10269
|
+
aiRemotePollSeconds = 15,
|
|
10249
10270
|
aiProjectId,
|
|
10250
10271
|
aiApiBaseUrl,
|
|
10251
10272
|
theme,
|
|
@@ -10264,6 +10285,42 @@ function TesterPayKitWrapper({
|
|
|
10264
10285
|
const [unreadMessages, setUnreadMessages] = (0, import_react23.useState)(0);
|
|
10265
10286
|
const aiReady = Boolean(aiCoordinatorToken && aiProjectId && aiApiBaseUrl);
|
|
10266
10287
|
const onAutoTest = aiReady ? () => setAiOpen(true) : void 0;
|
|
10288
|
+
const [remoteSession, setRemoteSession] = (0, import_react23.useState)(
|
|
10289
|
+
null
|
|
10290
|
+
);
|
|
10291
|
+
const remoteSessionRef = (0, import_react23.useRef)(null);
|
|
10292
|
+
(0, import_react23.useEffect)(() => {
|
|
10293
|
+
remoteSessionRef.current = remoteSession;
|
|
10294
|
+
}, [remoteSession]);
|
|
10295
|
+
(0, import_react23.useEffect)(() => {
|
|
10296
|
+
if (!aiRemoteTrigger || !tpk || aiOpen) return;
|
|
10297
|
+
let busy = false;
|
|
10298
|
+
const poll = async () => {
|
|
10299
|
+
if (busy || import_react_native23.AppState.currentState !== "active") return;
|
|
10300
|
+
busy = true;
|
|
10301
|
+
try {
|
|
10302
|
+
const claimed = await tpk.claimRemoteAiSession();
|
|
10303
|
+
if (claimed) {
|
|
10304
|
+
setRemoteSession(claimed);
|
|
10305
|
+
setAiOpen(true);
|
|
10306
|
+
}
|
|
10307
|
+
} catch {
|
|
10308
|
+
} finally {
|
|
10309
|
+
busy = false;
|
|
10310
|
+
}
|
|
10311
|
+
};
|
|
10312
|
+
void poll();
|
|
10313
|
+
const timer = setInterval(poll, aiRemotePollSeconds * 1e3);
|
|
10314
|
+
return () => clearInterval(timer);
|
|
10315
|
+
}, [aiRemoteTrigger, aiRemotePollSeconds, tpk, aiOpen]);
|
|
10316
|
+
(0, import_react23.useEffect)(() => {
|
|
10317
|
+
if (!aiOpen) return;
|
|
10318
|
+
const g = globalThis;
|
|
10319
|
+
g.__tpkCaptureScreenshot = async () => (await captureView(rootRef))?.base64 ?? null;
|
|
10320
|
+
return () => {
|
|
10321
|
+
delete g.__tpkCaptureScreenshot;
|
|
10322
|
+
};
|
|
10323
|
+
}, [aiOpen]);
|
|
10267
10324
|
const sessionAnchor = (0, import_react23.useRef)(sessionStartedAt ?? null);
|
|
10268
10325
|
(0, import_react23.useEffect)(() => {
|
|
10269
10326
|
if (sessionStartedAt) {
|
|
@@ -10386,14 +10443,25 @@ function TesterPayKitWrapper({
|
|
|
10386
10443
|
sessionStartedAt: sessionAnchor.current ?? void 0
|
|
10387
10444
|
}
|
|
10388
10445
|
),
|
|
10389
|
-
aiReady && /* @__PURE__ */ import_react23.default.createElement(
|
|
10446
|
+
(aiReady || remoteSession) && /* @__PURE__ */ import_react23.default.createElement(
|
|
10390
10447
|
AiRemoteControl,
|
|
10391
10448
|
{
|
|
10392
10449
|
visible: aiOpen,
|
|
10393
10450
|
apiBaseUrl: aiApiBaseUrl,
|
|
10394
10451
|
coordinatorToken: aiCoordinatorToken,
|
|
10395
10452
|
projectId: aiProjectId,
|
|
10396
|
-
|
|
10453
|
+
remoteSession,
|
|
10454
|
+
onClose: () => {
|
|
10455
|
+
setAiOpen(false);
|
|
10456
|
+
setRemoteSession(null);
|
|
10457
|
+
},
|
|
10458
|
+
onSessionEnded: () => {
|
|
10459
|
+
if (!remoteSessionRef.current) return;
|
|
10460
|
+
setTimeout(() => {
|
|
10461
|
+
setAiOpen(false);
|
|
10462
|
+
setRemoteSession(null);
|
|
10463
|
+
}, 3e3);
|
|
10464
|
+
}
|
|
10397
10465
|
}
|
|
10398
10466
|
),
|
|
10399
10467
|
/* @__PURE__ */ import_react23.default.createElement(
|
package/dist/index.mjs
CHANGED
|
@@ -1003,7 +1003,7 @@ function findAssignmentForTask(tasks, key) {
|
|
|
1003
1003
|
}
|
|
1004
1004
|
|
|
1005
1005
|
// package.json
|
|
1006
|
-
var version = "0.
|
|
1006
|
+
var version = "0.8.0";
|
|
1007
1007
|
|
|
1008
1008
|
// src/version.ts
|
|
1009
1009
|
var SDK_VERSION = `@testerpaykit/expo/${version}`;
|
|
@@ -1314,6 +1314,14 @@ var TpkExpo = class _TpkExpo {
|
|
|
1314
1314
|
async markNotificationsRead(params) {
|
|
1315
1315
|
return this.api.markNotificationsRead(params);
|
|
1316
1316
|
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Claim an AI-tester run started from outside (console or
|
|
1319
|
+
* `tpk autotest`) for this app's project. Null when nothing waits.
|
|
1320
|
+
* Used by the wrapper's `aiRemoteTrigger` poll.
|
|
1321
|
+
*/
|
|
1322
|
+
async claimRemoteAiSession() {
|
|
1323
|
+
return this.api.claimRemoteAiSession(this.config.projectId);
|
|
1324
|
+
}
|
|
1317
1325
|
/**
|
|
1318
1326
|
* Onboard with a runtime invite code (instead of the baked-in
|
|
1319
1327
|
* config.testerCode): authenticate anonymously with `code`, persist the
|
|
@@ -9796,6 +9804,7 @@ import React21, {
|
|
|
9796
9804
|
useState as useState18
|
|
9797
9805
|
} from "react";
|
|
9798
9806
|
import {
|
|
9807
|
+
AppState as AppState3,
|
|
9799
9808
|
Platform as Platform8,
|
|
9800
9809
|
StyleSheet as StyleSheet18,
|
|
9801
9810
|
View as View18
|
|
@@ -9821,6 +9830,7 @@ function AiRemoteControl({
|
|
|
9821
9830
|
apiBaseUrl,
|
|
9822
9831
|
coordinatorToken,
|
|
9823
9832
|
projectId,
|
|
9833
|
+
remoteSession,
|
|
9824
9834
|
configuration,
|
|
9825
9835
|
onClose,
|
|
9826
9836
|
onSessionEnded,
|
|
@@ -9846,12 +9856,19 @@ function AiRemoteControl({
|
|
|
9846
9856
|
wsRef.current = null;
|
|
9847
9857
|
return;
|
|
9848
9858
|
}
|
|
9849
|
-
setStatus("choosing");
|
|
9850
9859
|
setActionCount(0);
|
|
9851
9860
|
setErrorMessage(null);
|
|
9852
|
-
setSessionId(null);
|
|
9853
9861
|
closedRef.current = false;
|
|
9854
9862
|
resetWidgetIds();
|
|
9863
|
+
if (remoteSession) {
|
|
9864
|
+
setStatus("starting");
|
|
9865
|
+
setSessionId(remoteSession.sessionId);
|
|
9866
|
+
_openSocket(remoteSession.wsUrl);
|
|
9867
|
+
return;
|
|
9868
|
+
}
|
|
9869
|
+
setStatus("choosing");
|
|
9870
|
+
setSessionId(null);
|
|
9871
|
+
if (!apiBaseUrl || !coordinatorToken) return;
|
|
9855
9872
|
let cancelled = false;
|
|
9856
9873
|
void (async () => {
|
|
9857
9874
|
try {
|
|
@@ -9871,12 +9888,15 @@ function AiRemoteControl({
|
|
|
9871
9888
|
return () => {
|
|
9872
9889
|
cancelled = true;
|
|
9873
9890
|
};
|
|
9874
|
-
}, [visible, apiBaseUrl, coordinatorToken]);
|
|
9891
|
+
}, [visible, apiBaseUrl, coordinatorToken, remoteSession]);
|
|
9875
9892
|
const _start = useCallback9(
|
|
9876
9893
|
() => {
|
|
9877
9894
|
setStatus("starting");
|
|
9878
9895
|
void (async () => {
|
|
9879
9896
|
try {
|
|
9897
|
+
if (!apiBaseUrl || !coordinatorToken || !projectId) {
|
|
9898
|
+
throw new Error("AI test needs apiBaseUrl, coordinatorToken and projectId");
|
|
9899
|
+
}
|
|
9880
9900
|
const resp = await fetch(
|
|
9881
9901
|
`${apiBaseUrl}/v1/coordinator/projects/${projectId}/ai-sessions`,
|
|
9882
9902
|
{
|
|
@@ -10215,6 +10235,8 @@ function TesterPayKitWrapper({
|
|
|
10215
10235
|
currentScreen,
|
|
10216
10236
|
sessionStartedAt,
|
|
10217
10237
|
aiCoordinatorToken,
|
|
10238
|
+
aiRemoteTrigger = false,
|
|
10239
|
+
aiRemotePollSeconds = 15,
|
|
10218
10240
|
aiProjectId,
|
|
10219
10241
|
aiApiBaseUrl,
|
|
10220
10242
|
theme,
|
|
@@ -10233,6 +10255,42 @@ function TesterPayKitWrapper({
|
|
|
10233
10255
|
const [unreadMessages, setUnreadMessages] = useState18(0);
|
|
10234
10256
|
const aiReady = Boolean(aiCoordinatorToken && aiProjectId && aiApiBaseUrl);
|
|
10235
10257
|
const onAutoTest = aiReady ? () => setAiOpen(true) : void 0;
|
|
10258
|
+
const [remoteSession, setRemoteSession] = useState18(
|
|
10259
|
+
null
|
|
10260
|
+
);
|
|
10261
|
+
const remoteSessionRef = useRef10(null);
|
|
10262
|
+
useEffect14(() => {
|
|
10263
|
+
remoteSessionRef.current = remoteSession;
|
|
10264
|
+
}, [remoteSession]);
|
|
10265
|
+
useEffect14(() => {
|
|
10266
|
+
if (!aiRemoteTrigger || !tpk || aiOpen) return;
|
|
10267
|
+
let busy = false;
|
|
10268
|
+
const poll = async () => {
|
|
10269
|
+
if (busy || AppState3.currentState !== "active") return;
|
|
10270
|
+
busy = true;
|
|
10271
|
+
try {
|
|
10272
|
+
const claimed = await tpk.claimRemoteAiSession();
|
|
10273
|
+
if (claimed) {
|
|
10274
|
+
setRemoteSession(claimed);
|
|
10275
|
+
setAiOpen(true);
|
|
10276
|
+
}
|
|
10277
|
+
} catch {
|
|
10278
|
+
} finally {
|
|
10279
|
+
busy = false;
|
|
10280
|
+
}
|
|
10281
|
+
};
|
|
10282
|
+
void poll();
|
|
10283
|
+
const timer = setInterval(poll, aiRemotePollSeconds * 1e3);
|
|
10284
|
+
return () => clearInterval(timer);
|
|
10285
|
+
}, [aiRemoteTrigger, aiRemotePollSeconds, tpk, aiOpen]);
|
|
10286
|
+
useEffect14(() => {
|
|
10287
|
+
if (!aiOpen) return;
|
|
10288
|
+
const g = globalThis;
|
|
10289
|
+
g.__tpkCaptureScreenshot = async () => (await captureView(rootRef))?.base64 ?? null;
|
|
10290
|
+
return () => {
|
|
10291
|
+
delete g.__tpkCaptureScreenshot;
|
|
10292
|
+
};
|
|
10293
|
+
}, [aiOpen]);
|
|
10236
10294
|
const sessionAnchor = useRef10(sessionStartedAt ?? null);
|
|
10237
10295
|
useEffect14(() => {
|
|
10238
10296
|
if (sessionStartedAt) {
|
|
@@ -10355,14 +10413,25 @@ function TesterPayKitWrapper({
|
|
|
10355
10413
|
sessionStartedAt: sessionAnchor.current ?? void 0
|
|
10356
10414
|
}
|
|
10357
10415
|
),
|
|
10358
|
-
aiReady && /* @__PURE__ */ React21.createElement(
|
|
10416
|
+
(aiReady || remoteSession) && /* @__PURE__ */ React21.createElement(
|
|
10359
10417
|
AiRemoteControl,
|
|
10360
10418
|
{
|
|
10361
10419
|
visible: aiOpen,
|
|
10362
10420
|
apiBaseUrl: aiApiBaseUrl,
|
|
10363
10421
|
coordinatorToken: aiCoordinatorToken,
|
|
10364
10422
|
projectId: aiProjectId,
|
|
10365
|
-
|
|
10423
|
+
remoteSession,
|
|
10424
|
+
onClose: () => {
|
|
10425
|
+
setAiOpen(false);
|
|
10426
|
+
setRemoteSession(null);
|
|
10427
|
+
},
|
|
10428
|
+
onSessionEnded: () => {
|
|
10429
|
+
if (!remoteSessionRef.current) return;
|
|
10430
|
+
setTimeout(() => {
|
|
10431
|
+
setAiOpen(false);
|
|
10432
|
+
setRemoteSession(null);
|
|
10433
|
+
}, 3e3);
|
|
10434
|
+
}
|
|
10366
10435
|
}
|
|
10367
10436
|
),
|
|
10368
10437
|
/* @__PURE__ */ React21.createElement(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testerpaykit/expo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "TesterPayKit Expo / React-Native bindings — shake-to-report, device info, bug-report hook",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"CHANGELOG.md"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@testerpaykit/ai-tester": "0.
|
|
24
|
-
"@testerpaykit/api-client": "1.
|
|
25
|
-
"@testerpaykit/core": "1.0
|
|
23
|
+
"@testerpaykit/ai-tester": "0.5.0",
|
|
24
|
+
"@testerpaykit/api-client": "1.3.0",
|
|
25
|
+
"@testerpaykit/core": "1.1.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@expo/vector-icons": ">=14.0.0",
|