@testerpaykit/expo 0.10.1 → 0.11.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 +51 -0
- package/README.md +29 -0
- package/dist/chunk-M6XDJUYN.mjs +36 -0
- package/dist/index.d.mts +229 -6
- package/dist/index.d.ts +229 -6
- package/dist/index.js +2244 -555
- package/dist/index.mjs +2263 -605
- package/dist/storage-RD3WGNGX.mjs +6 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -35,6 +35,49 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
35
35
|
));
|
|
36
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
37
|
|
|
38
|
+
// src/storage.ts
|
|
39
|
+
var storage_exports = {};
|
|
40
|
+
__export(storage_exports, {
|
|
41
|
+
ExpoStorage: () => ExpoStorage
|
|
42
|
+
});
|
|
43
|
+
var import_async_storage, PREFIX, ExpoStorage;
|
|
44
|
+
var init_storage = __esm({
|
|
45
|
+
"src/storage.ts"() {
|
|
46
|
+
"use strict";
|
|
47
|
+
import_async_storage = __toESM(require("@react-native-async-storage/async-storage"));
|
|
48
|
+
PREFIX = "@testerpaykit/";
|
|
49
|
+
ExpoStorage = class {
|
|
50
|
+
/**
|
|
51
|
+
* Read a JSON-serializable value, returning `null` if the key is
|
|
52
|
+
* absent or the stored value can't be parsed.
|
|
53
|
+
*/
|
|
54
|
+
async get(key) {
|
|
55
|
+
const raw = await import_async_storage.default.getItem(PREFIX + key);
|
|
56
|
+
if (raw == null) return null;
|
|
57
|
+
try {
|
|
58
|
+
return JSON.parse(raw);
|
|
59
|
+
} catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async set(key, value) {
|
|
64
|
+
await import_async_storage.default.setItem(PREFIX + key, JSON.stringify(value));
|
|
65
|
+
}
|
|
66
|
+
async remove(key) {
|
|
67
|
+
await import_async_storage.default.removeItem(PREFIX + key);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* List every key this SDK has written. Useful for inspection /
|
|
71
|
+
* debug dashboards; not used internally.
|
|
72
|
+
*/
|
|
73
|
+
async keys() {
|
|
74
|
+
const all = await import_async_storage.default.getAllKeys();
|
|
75
|
+
return all.filter((k) => k.startsWith(PREFIX)).map((k) => k.slice(PREFIX.length));
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
38
81
|
// src/network.ts
|
|
39
82
|
var network_exports = {};
|
|
40
83
|
__export(network_exports, {
|
|
@@ -113,14 +156,17 @@ __export(index_exports, {
|
|
|
113
156
|
AttachmentQueue: () => AttachmentQueue,
|
|
114
157
|
Breadcrumbs: () => Breadcrumbs,
|
|
115
158
|
BugReportSheet: () => BugReportSheet,
|
|
159
|
+
ChecklistPanel: () => ChecklistPanel,
|
|
116
160
|
CrashQueue: () => CrashQueue,
|
|
117
161
|
DEFAULT_STYLE: () => DEFAULT_STYLE,
|
|
118
162
|
DEFAULT_TPK_THEME: () => DEFAULT_TPK_THEME,
|
|
163
|
+
DENY_LABEL_PATTERNS: () => DENY_LABEL_PATTERNS,
|
|
119
164
|
ExpoStorage: () => ExpoStorage,
|
|
120
165
|
FloatingFeedbackButton: () => FloatingFeedbackButton,
|
|
121
166
|
GeneralFeedbackDialog: () => GeneralFeedbackDialog,
|
|
122
167
|
INTERACTION_NAV_WEIGHT: () => INTERACTION_NAV_WEIGHT,
|
|
123
168
|
InviteCodeScreen: () => InviteCodeScreen,
|
|
169
|
+
LiveNoteDialog: () => LiveNoteDialog,
|
|
124
170
|
MIN_INTERACTIONS_PER_ACTIVE_MINUTE: () => MIN_INTERACTIONS_PER_ACTIVE_MINUTE,
|
|
125
171
|
MyBugsSheet: () => MyBugsSheet,
|
|
126
172
|
NotificationsSheet: () => NotificationsSheet,
|
|
@@ -143,6 +189,7 @@ __export(index_exports, {
|
|
|
143
189
|
TpkIcon: () => TpkIcon,
|
|
144
190
|
TpkIconsProvider: () => TpkIconsProvider,
|
|
145
191
|
TpkLanguageProvider: () => TpkLanguageProvider,
|
|
192
|
+
TpkLiveLink: () => TpkLiveLink,
|
|
146
193
|
TpkOnboarding: () => TpkOnboarding,
|
|
147
194
|
TpkSensitive: () => TpkSensitive,
|
|
148
195
|
TpkTalker: () => TpkTalker,
|
|
@@ -161,6 +208,7 @@ __export(index_exports, {
|
|
|
161
208
|
bugSeverityLabel: () => bugSeverityLabel,
|
|
162
209
|
bugStatusStyle: () => bugStatusStyle,
|
|
163
210
|
canSubmitBugReportDraft: () => canSubmitBugReportDraft,
|
|
211
|
+
captureLiveSnapshot: () => captureLiveSnapshot,
|
|
164
212
|
captureView: () => captureView,
|
|
165
213
|
classificationToBugType: () => classificationToBugType,
|
|
166
214
|
createBugReportDraft: () => createBugReportDraft,
|
|
@@ -184,18 +232,24 @@ __export(index_exports, {
|
|
|
184
232
|
hasWelcomeBriefBeenSeen: () => hasWelcomeBriefBeenSeen,
|
|
185
233
|
installCrashHandler: () => installCrashHandler,
|
|
186
234
|
installNetworkCapture: () => installNetworkCapture,
|
|
235
|
+
loadChecklist: () => loadChecklist,
|
|
187
236
|
markOnboardingComplete: () => markOnboardingComplete,
|
|
188
237
|
markWelcomeBriefAsSeen: () => markWelcomeBriefAsSeen,
|
|
189
238
|
markWidgetTourSeen: () => markWidgetTourSeen,
|
|
239
|
+
parseLiveAction: () => parseLiveAction,
|
|
190
240
|
parseVersionRange: () => parseVersionRange,
|
|
191
241
|
pathToSvgD: () => pathToSvgD,
|
|
192
242
|
quickDraftBug: () => quickDraftBug,
|
|
243
|
+
readLiveState: () => readLiveState,
|
|
244
|
+
readScreenTexts: () => readScreenTexts,
|
|
193
245
|
resetOnboardingState: () => resetOnboardingState,
|
|
194
246
|
resetWelcomeBriefAck: () => resetWelcomeBriefAck,
|
|
195
247
|
resetWidgetTourSeen: () => resetWidgetTourSeen,
|
|
248
|
+
runLiveAction: () => runLiveAction,
|
|
196
249
|
simplifyPath: () => simplifyPath,
|
|
197
250
|
submitBugReportDraft: () => submitBugReportDraft,
|
|
198
251
|
subscribeNativeCaptureMode: () => subscribeNativeCaptureMode,
|
|
252
|
+
toStepResults: () => toStepResults,
|
|
199
253
|
uploadScreenshotAttachment: () => uploadScreenshotAttachment,
|
|
200
254
|
useShake: () => useShake,
|
|
201
255
|
useTaskAnnotation: () => useTaskAnnotation,
|
|
@@ -367,39 +421,7 @@ function uuidv4() {
|
|
|
367
421
|
|
|
368
422
|
// src/client.ts
|
|
369
423
|
var import_react_native2 = require("react-native");
|
|
370
|
-
|
|
371
|
-
// src/storage.ts
|
|
372
|
-
var import_async_storage = __toESM(require("@react-native-async-storage/async-storage"));
|
|
373
|
-
var PREFIX = "@testerpaykit/";
|
|
374
|
-
var ExpoStorage = class {
|
|
375
|
-
/**
|
|
376
|
-
* Read a JSON-serializable value, returning `null` if the key is
|
|
377
|
-
* absent or the stored value can't be parsed.
|
|
378
|
-
*/
|
|
379
|
-
async get(key) {
|
|
380
|
-
const raw = await import_async_storage.default.getItem(PREFIX + key);
|
|
381
|
-
if (raw == null) return null;
|
|
382
|
-
try {
|
|
383
|
-
return JSON.parse(raw);
|
|
384
|
-
} catch {
|
|
385
|
-
return null;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
async set(key, value) {
|
|
389
|
-
await import_async_storage.default.setItem(PREFIX + key, JSON.stringify(value));
|
|
390
|
-
}
|
|
391
|
-
async remove(key) {
|
|
392
|
-
await import_async_storage.default.removeItem(PREFIX + key);
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* List every key this SDK has written. Useful for inspection /
|
|
396
|
-
* debug dashboards; not used internally.
|
|
397
|
-
*/
|
|
398
|
-
async keys() {
|
|
399
|
-
const all = await import_async_storage.default.getAllKeys();
|
|
400
|
-
return all.filter((k) => k.startsWith(PREFIX)).map((k) => k.slice(PREFIX.length));
|
|
401
|
-
}
|
|
402
|
-
};
|
|
424
|
+
init_storage();
|
|
403
425
|
|
|
404
426
|
// src/device.ts
|
|
405
427
|
var import_react_native = require("react-native");
|
|
@@ -1211,7 +1233,7 @@ function findAssignmentForTask(tasks, key) {
|
|
|
1211
1233
|
}
|
|
1212
1234
|
|
|
1213
1235
|
// package.json
|
|
1214
|
-
var version = "0.
|
|
1236
|
+
var version = "0.11.0";
|
|
1215
1237
|
|
|
1216
1238
|
// src/version.ts
|
|
1217
1239
|
var SDK_VERSION = `@testerpaykit/expo/${version}`;
|
|
@@ -1241,6 +1263,15 @@ var TpkExpo = class _TpkExpo {
|
|
|
1241
1263
|
* tpk.annotations.snapshot({ taskId: 'task-1' });
|
|
1242
1264
|
*/
|
|
1243
1265
|
this.annotations = annotations;
|
|
1266
|
+
/**
|
|
1267
|
+
* Extra state for the live link to Claude Code (`enableLiveLink` on
|
|
1268
|
+
* the wrapper): what this returns goes into every `device_snapshot`
|
|
1269
|
+
* and "Send to Claude" note as `app_state`. Set it anywhere the state
|
|
1270
|
+
* is reachable, e.g. `tpk.liveStateProvider = () => ({ cart, user })`.
|
|
1271
|
+
* Round-tripped through JSON; a throwing or non-serialisable provider
|
|
1272
|
+
* yields `{error}` instead of breaking the snapshot.
|
|
1273
|
+
*/
|
|
1274
|
+
this.liveStateProvider = null;
|
|
1244
1275
|
this.sessionEvents = [];
|
|
1245
1276
|
this.uninstallDurableSync = null;
|
|
1246
1277
|
this.uninstallTaskBinding = null;
|
|
@@ -1263,6 +1294,10 @@ var TpkExpo = class _TpkExpo {
|
|
|
1263
1294
|
get ready() {
|
|
1264
1295
|
return this._ready;
|
|
1265
1296
|
}
|
|
1297
|
+
/** The project this client reports into. */
|
|
1298
|
+
get projectId() {
|
|
1299
|
+
return this.config.projectId;
|
|
1300
|
+
}
|
|
1266
1301
|
static async init(config) {
|
|
1267
1302
|
runSetupCheck();
|
|
1268
1303
|
const storage = config.storage ?? new ExpoStorage();
|
|
@@ -1528,7 +1563,8 @@ var TpkExpo = class _TpkExpo {
|
|
|
1528
1563
|
* Used by the wrapper's `aiRemoteTrigger` poll.
|
|
1529
1564
|
*/
|
|
1530
1565
|
async claimRemoteAiSession() {
|
|
1531
|
-
|
|
1566
|
+
const { version: version2 } = await getAppSnapshot();
|
|
1567
|
+
return this.api.claimRemoteAiSession(this.config.projectId, version2);
|
|
1532
1568
|
}
|
|
1533
1569
|
/**
|
|
1534
1570
|
* Onboard with a runtime invite code (instead of the baked-in
|
|
@@ -2106,7 +2142,10 @@ var DEFAULT_GLYPH_MAP = {
|
|
|
2106
2142
|
shape_circle: "radio-button-unchecked",
|
|
2107
2143
|
shape_arrow: "arrow-forward",
|
|
2108
2144
|
text: "text-fields",
|
|
2109
|
-
blur: "blur-on"
|
|
2145
|
+
blur: "blur-on",
|
|
2146
|
+
link: "link",
|
|
2147
|
+
link_off: "link-off",
|
|
2148
|
+
send: "send"
|
|
2110
2149
|
};
|
|
2111
2150
|
var EMOJI_FALLBACK_MAP = {
|
|
2112
2151
|
bug_report: "\u{1F41E}",
|
|
@@ -2140,7 +2179,10 @@ var EMOJI_FALLBACK_MAP = {
|
|
|
2140
2179
|
shape_circle: "\u2B55",
|
|
2141
2180
|
shape_arrow: "\u27A1\uFE0F",
|
|
2142
2181
|
text: "\u{1F163}",
|
|
2143
|
-
blur: "\u{1F7E6}"
|
|
2182
|
+
blur: "\u{1F7E6}",
|
|
2183
|
+
link: "\u{1F517}",
|
|
2184
|
+
link_off: "\u26D3\uFE0F\u200D\u{1F4A5}",
|
|
2185
|
+
send: "\u{1F4E4}"
|
|
2144
2186
|
};
|
|
2145
2187
|
var TpkIconsContext = (0, import_react3.createContext)({});
|
|
2146
2188
|
function TpkIconsProvider({
|
|
@@ -2265,6 +2307,10 @@ var TPK_STRINGS = {
|
|
|
2265
2307
|
menuReportBug: "Bug melden",
|
|
2266
2308
|
menuFeedback: "Feedback",
|
|
2267
2309
|
menuAutoTest: "Auto-Test (KI)",
|
|
2310
|
+
menuChecklist: "Was testen?",
|
|
2311
|
+
menuSendToClaude: "An Claude senden",
|
|
2312
|
+
menuConnectClaude: "Mit Claude verbinden",
|
|
2313
|
+
menuDisconnectClaude: "Von Claude trennen",
|
|
2268
2314
|
menuCachedCrashes: (n) => n === 1 ? "1 gespeicherten Absturz senden" : `${n} gespeicherte Abst\xFCrze senden`,
|
|
2269
2315
|
menuWorkboard: "Meine \xDCbersicht",
|
|
2270
2316
|
menuMyBugs: "Meine Bugs",
|
|
@@ -2361,6 +2407,10 @@ var TPK_STRINGS = {
|
|
|
2361
2407
|
menuReportBug: "Report Bug",
|
|
2362
2408
|
menuFeedback: "Feedback",
|
|
2363
2409
|
menuAutoTest: "Auto Test (AI)",
|
|
2410
|
+
menuChecklist: "What to test",
|
|
2411
|
+
menuSendToClaude: "Send to Claude",
|
|
2412
|
+
menuConnectClaude: "Connect to Claude",
|
|
2413
|
+
menuDisconnectClaude: "Disconnect from Claude",
|
|
2364
2414
|
menuCachedCrashes: (n) => `Send ${n} cached ${n === 1 ? "crash" : "crashes"}`,
|
|
2365
2415
|
menuWorkboard: "My Workboard",
|
|
2366
2416
|
menuMyBugs: "My Bugs",
|
|
@@ -2945,6 +2995,11 @@ function FloatingFeedbackButton({
|
|
|
2945
2995
|
onShowMessages,
|
|
2946
2996
|
unreadMessageCount = 0,
|
|
2947
2997
|
onAutoTest,
|
|
2998
|
+
onShowChecklist,
|
|
2999
|
+
checklistCount = 0,
|
|
3000
|
+
onSendToClaude,
|
|
3001
|
+
onToggleLiveLink,
|
|
3002
|
+
liveLinkConnected = false,
|
|
2948
3003
|
onLongPressVoiceBug,
|
|
2949
3004
|
onFlushCachedCrashes,
|
|
2950
3005
|
notificationCount = 0,
|
|
@@ -3080,6 +3135,33 @@ function FloatingFeedbackButton({
|
|
|
3080
3135
|
onTap: () => handleAction(onGeneralFeedback)
|
|
3081
3136
|
}
|
|
3082
3137
|
];
|
|
3138
|
+
if (onShowChecklist) {
|
|
3139
|
+
opts.push({
|
|
3140
|
+
key: "checklist",
|
|
3141
|
+
icon: "check",
|
|
3142
|
+
label: checklistCount > 0 ? `${S.menuChecklist} (${checklistCount})` : S.menuChecklist,
|
|
3143
|
+
color: "#0D9488",
|
|
3144
|
+
onTap: () => handleAction(onShowChecklist)
|
|
3145
|
+
});
|
|
3146
|
+
}
|
|
3147
|
+
if (onSendToClaude) {
|
|
3148
|
+
opts.push({
|
|
3149
|
+
key: "send-to-claude",
|
|
3150
|
+
icon: "send",
|
|
3151
|
+
label: S.menuSendToClaude,
|
|
3152
|
+
color: "#D97757",
|
|
3153
|
+
onTap: () => handleAction(onSendToClaude)
|
|
3154
|
+
});
|
|
3155
|
+
}
|
|
3156
|
+
if (onToggleLiveLink) {
|
|
3157
|
+
opts.push({
|
|
3158
|
+
key: "live-link",
|
|
3159
|
+
icon: liveLinkConnected ? "link_off" : "link",
|
|
3160
|
+
label: liveLinkConnected ? S.menuDisconnectClaude : S.menuConnectClaude,
|
|
3161
|
+
color: "#D97757",
|
|
3162
|
+
onTap: () => handleAction(onToggleLiveLink)
|
|
3163
|
+
});
|
|
3164
|
+
}
|
|
3083
3165
|
if (onAutoTest) {
|
|
3084
3166
|
opts.push({
|
|
3085
3167
|
key: "auto-test",
|
|
@@ -3173,6 +3255,11 @@ function FloatingFeedbackButton({
|
|
|
3173
3255
|
onShowMessages,
|
|
3174
3256
|
unreadMessageCount,
|
|
3175
3257
|
onAutoTest,
|
|
3258
|
+
onShowChecklist,
|
|
3259
|
+
checklistCount,
|
|
3260
|
+
onSendToClaude,
|
|
3261
|
+
onToggleLiveLink,
|
|
3262
|
+
liveLinkConnected,
|
|
3176
3263
|
onFlushCachedCrashes,
|
|
3177
3264
|
notificationCount,
|
|
3178
3265
|
handleAction,
|
|
@@ -4979,6 +5066,7 @@ var styles3 = import_react_native8.StyleSheet.create({
|
|
|
4979
5066
|
});
|
|
4980
5067
|
|
|
4981
5068
|
// src/index.ts
|
|
5069
|
+
init_storage();
|
|
4982
5070
|
init_network();
|
|
4983
5071
|
|
|
4984
5072
|
// src/sensitive.tsx
|
|
@@ -7523,13 +7611,383 @@ var styles9 = import_react_native15.StyleSheet.create({
|
|
|
7523
7611
|
btnOutline: { borderWidth: 1, borderColor: "#CBD5E1" }
|
|
7524
7612
|
});
|
|
7525
7613
|
|
|
7614
|
+
// src/ChecklistPanel.tsx
|
|
7615
|
+
var import_react16 = __toESM(require("react"));
|
|
7616
|
+
var import_react_native16 = require("react-native");
|
|
7617
|
+
|
|
7618
|
+
// src/checklist.ts
|
|
7619
|
+
async function loadChecklist(tpk) {
|
|
7620
|
+
if (!tpk) return [];
|
|
7621
|
+
try {
|
|
7622
|
+
await tpk.ready;
|
|
7623
|
+
const tasks = await tpk.api.getChecklist(tpk.projectId);
|
|
7624
|
+
return Array.isArray(tasks) ? tasks.filter((t) => t && typeof t.id === "string" && Array.isArray(t.steps)) : [];
|
|
7625
|
+
} catch {
|
|
7626
|
+
return [];
|
|
7627
|
+
}
|
|
7628
|
+
}
|
|
7629
|
+
function newDraft(task) {
|
|
7630
|
+
return task.steps.map(() => ({ passed: null, note: "" }));
|
|
7631
|
+
}
|
|
7632
|
+
function toggleVerdict(draft, index, passed) {
|
|
7633
|
+
return draft.map(
|
|
7634
|
+
(s, i) => i === index ? { ...s, passed: s.passed === passed ? null : passed } : s
|
|
7635
|
+
);
|
|
7636
|
+
}
|
|
7637
|
+
function setNote(draft, index, note) {
|
|
7638
|
+
return draft.map((s, i) => i === index ? { ...s, note } : s);
|
|
7639
|
+
}
|
|
7640
|
+
function toStepResults(draft) {
|
|
7641
|
+
const out = [];
|
|
7642
|
+
draft.forEach((s, i) => {
|
|
7643
|
+
if (s.passed === null) return;
|
|
7644
|
+
const note = s.note.trim();
|
|
7645
|
+
out.push({ step: i + 1, passed: s.passed, ...note ? { note } : {} });
|
|
7646
|
+
});
|
|
7647
|
+
return out;
|
|
7648
|
+
}
|
|
7649
|
+
function canSend(draft) {
|
|
7650
|
+
return draft.some((s) => s.passed !== null);
|
|
7651
|
+
}
|
|
7652
|
+
function nextOpenStep(draft) {
|
|
7653
|
+
return draft.findIndex((s) => s.passed === null);
|
|
7654
|
+
}
|
|
7655
|
+
function draftProgress(draft) {
|
|
7656
|
+
return {
|
|
7657
|
+
judged: draft.filter((s) => s.passed !== null).length,
|
|
7658
|
+
failed: draft.filter((s) => s.passed === false).length,
|
|
7659
|
+
total: draft.length
|
|
7660
|
+
};
|
|
7661
|
+
}
|
|
7662
|
+
function openTaskCount(tasks) {
|
|
7663
|
+
return tasks.filter((t) => t.mine?.status !== "passed").length;
|
|
7664
|
+
}
|
|
7665
|
+
function runTone(run) {
|
|
7666
|
+
if (!run) return "none";
|
|
7667
|
+
if (run.status === "passed" || run.status === "failed" || run.status === "incomplete") return run.status;
|
|
7668
|
+
return "incomplete";
|
|
7669
|
+
}
|
|
7670
|
+
var STATUS_TEXT = {
|
|
7671
|
+
de: { passed: "Bestanden", failed: "Fehler gefunden", incomplete: "Unvollst\xE4ndig", none: "Noch offen" },
|
|
7672
|
+
en: { passed: "Passed", failed: "Failed", incomplete: "Incomplete", none: "Not tested yet" }
|
|
7673
|
+
};
|
|
7674
|
+
function runStatusText(run, language) {
|
|
7675
|
+
return STATUS_TEXT[language][runTone(run)];
|
|
7676
|
+
}
|
|
7677
|
+
var RUN_TONE_COLOR = {
|
|
7678
|
+
passed: "#16A34A",
|
|
7679
|
+
failed: "#DC2626",
|
|
7680
|
+
incomplete: "#EA580C",
|
|
7681
|
+
none: "#64748B"
|
|
7682
|
+
};
|
|
7683
|
+
function lastStepVerdict(run, index) {
|
|
7684
|
+
const s = run?.steps?.find((r) => r && r.step === index + 1);
|
|
7685
|
+
return typeof s?.passed === "boolean" ? s.passed : null;
|
|
7686
|
+
}
|
|
7687
|
+
|
|
7688
|
+
// src/ChecklistPanel.tsx
|
|
7689
|
+
var PASS = "#16A34A";
|
|
7690
|
+
var FAIL = "#DC2626";
|
|
7691
|
+
function ChecklistPanel({
|
|
7692
|
+
visible,
|
|
7693
|
+
tpk,
|
|
7694
|
+
tasks,
|
|
7695
|
+
onReload,
|
|
7696
|
+
onClose
|
|
7697
|
+
}) {
|
|
7698
|
+
const theme = useTpkTheme();
|
|
7699
|
+
const tr = useTr();
|
|
7700
|
+
const language = useTpkLanguage();
|
|
7701
|
+
const [taskId, setTaskId] = (0, import_react16.useState)(null);
|
|
7702
|
+
const [draft, setDraft] = (0, import_react16.useState)([]);
|
|
7703
|
+
const [noteOpen, setNoteOpen] = (0, import_react16.useState)(null);
|
|
7704
|
+
const [collapsed, setCollapsed] = (0, import_react16.useState)(false);
|
|
7705
|
+
const [dockTop, setDockTop] = (0, import_react16.useState)(false);
|
|
7706
|
+
const [typing, setTyping] = (0, import_react16.useState)(false);
|
|
7707
|
+
const [sending, setSending] = (0, import_react16.useState)(false);
|
|
7708
|
+
const [message, setMessage] = (0, import_react16.useState)(null);
|
|
7709
|
+
const task = (0, import_react16.useMemo)(() => tasks.find((t) => t.id === taskId) ?? null, [tasks, taskId]);
|
|
7710
|
+
(0, import_react16.useEffect)(() => {
|
|
7711
|
+
if (!visible) {
|
|
7712
|
+
setTaskId(null);
|
|
7713
|
+
setCollapsed(false);
|
|
7714
|
+
setMessage(null);
|
|
7715
|
+
}
|
|
7716
|
+
}, [visible]);
|
|
7717
|
+
const openTask = (0, import_react16.useCallback)((t) => {
|
|
7718
|
+
setTaskId(t.id);
|
|
7719
|
+
setDraft(newDraft(t));
|
|
7720
|
+
setNoteOpen(null);
|
|
7721
|
+
setMessage(null);
|
|
7722
|
+
}, []);
|
|
7723
|
+
const send = (0, import_react16.useCallback)(async () => {
|
|
7724
|
+
if (!tpk || !task || !canSend(draft)) return;
|
|
7725
|
+
setSending(true);
|
|
7726
|
+
setMessage(null);
|
|
7727
|
+
try {
|
|
7728
|
+
await tpk.ready;
|
|
7729
|
+
const status = await tpk.api.submitChecklistRun({
|
|
7730
|
+
projectId: tpk.projectId,
|
|
7731
|
+
taskId: task.id,
|
|
7732
|
+
stepResults: toStepResults(draft)
|
|
7733
|
+
});
|
|
7734
|
+
const text = runStatusText({ status, steps: [], at: "" }, language);
|
|
7735
|
+
setMessage({ text: tr({ en: `Sent \u2014 ${text}`, de: `Gesendet \u2014 ${text}` }), error: false });
|
|
7736
|
+
setTaskId(null);
|
|
7737
|
+
onReload();
|
|
7738
|
+
} catch (e) {
|
|
7739
|
+
setMessage({
|
|
7740
|
+
text: tr({ en: "Could not send. ", de: "Senden fehlgeschlagen. " }) + (e instanceof Error ? e.message : String(e)),
|
|
7741
|
+
error: true
|
|
7742
|
+
});
|
|
7743
|
+
} finally {
|
|
7744
|
+
setSending(false);
|
|
7745
|
+
}
|
|
7746
|
+
}, [tpk, task, draft, language, tr, onReload]);
|
|
7747
|
+
if (!visible) return null;
|
|
7748
|
+
const win = (() => {
|
|
7749
|
+
try {
|
|
7750
|
+
return import_react_native16.Dimensions.get("window");
|
|
7751
|
+
} catch {
|
|
7752
|
+
return { width: 390, height: 800 };
|
|
7753
|
+
}
|
|
7754
|
+
})();
|
|
7755
|
+
const insets = getModalInsets();
|
|
7756
|
+
const atTop = dockTop || typing;
|
|
7757
|
+
const progress = task ? draftProgress(draft) : null;
|
|
7758
|
+
const current = task ? nextOpenStep(draft) : -1;
|
|
7759
|
+
const title = task ? task.title : tr({ en: "What to test", de: "Was testen?" });
|
|
7760
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
7761
|
+
import_react_native16.View,
|
|
7762
|
+
{
|
|
7763
|
+
pointerEvents: "box-none",
|
|
7764
|
+
style: [
|
|
7765
|
+
styles10.dock,
|
|
7766
|
+
atTop ? { top: insets.top + 8 } : { bottom: insets.bottom + 8 }
|
|
7767
|
+
],
|
|
7768
|
+
testID: "tpk-checklist-panel"
|
|
7769
|
+
},
|
|
7770
|
+
/* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: [styles10.panel, { backgroundColor: theme.surface, maxHeight: collapsed ? void 0 : Math.round(win.height * 0.42) }] }, /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles10.header }, task && !collapsed ? /* @__PURE__ */ import_react16.default.createElement(
|
|
7771
|
+
import_react_native16.Pressable,
|
|
7772
|
+
{
|
|
7773
|
+
onPress: () => setTaskId(null),
|
|
7774
|
+
hitSlop: 8,
|
|
7775
|
+
accessibilityLabel: tr({ en: "All tasks", de: "Alle Aufgaben" }),
|
|
7776
|
+
testID: "tpk-checklist-back"
|
|
7777
|
+
},
|
|
7778
|
+
/* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: [styles10.headerBtn, { color: theme.primary }] }, "\u2039")
|
|
7779
|
+
) : null, /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: [styles10.title, { color: theme.onSurface }], numberOfLines: 1 }, title), progress ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: styles10.progress, testID: "tpk-checklist-progress" }, progress.judged, "/", progress.total) : null, /* @__PURE__ */ import_react16.default.createElement(
|
|
7780
|
+
import_react_native16.Pressable,
|
|
7781
|
+
{
|
|
7782
|
+
onPress: () => setDockTop((v) => !v),
|
|
7783
|
+
hitSlop: 8,
|
|
7784
|
+
accessibilityLabel: tr({ en: "Move panel", de: "Leiste verschieben" }),
|
|
7785
|
+
testID: "tpk-checklist-dock"
|
|
7786
|
+
},
|
|
7787
|
+
/* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: [styles10.headerBtn, { color: theme.onSurface }] }, atTop ? "\u2193" : "\u2191")
|
|
7788
|
+
), /* @__PURE__ */ import_react16.default.createElement(
|
|
7789
|
+
import_react_native16.Pressable,
|
|
7790
|
+
{
|
|
7791
|
+
onPress: () => setCollapsed((v) => !v),
|
|
7792
|
+
hitSlop: 8,
|
|
7793
|
+
accessibilityLabel: collapsed ? tr({ en: "Expand", de: "Aufklappen" }) : tr({ en: "Collapse", de: "Einklappen" }),
|
|
7794
|
+
testID: "tpk-checklist-collapse"
|
|
7795
|
+
},
|
|
7796
|
+
/* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: [styles10.headerBtn, { color: theme.onSurface }] }, collapsed ? "\u25B4" : "\u25BE")
|
|
7797
|
+
), /* @__PURE__ */ import_react16.default.createElement(
|
|
7798
|
+
import_react_native16.Pressable,
|
|
7799
|
+
{
|
|
7800
|
+
onPress: onClose,
|
|
7801
|
+
hitSlop: 8,
|
|
7802
|
+
accessibilityLabel: tr({ en: "Close", de: "Schlie\xDFen" }),
|
|
7803
|
+
testID: "tpk-checklist-close"
|
|
7804
|
+
},
|
|
7805
|
+
/* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: [styles10.headerBtn, { color: theme.onSurface }] }, "\u2715")
|
|
7806
|
+
)), collapsed ? task && current >= 0 ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: styles10.collapsedStep, numberOfLines: 1, testID: "tpk-checklist-current" }, current + 1, ". ", task.steps[current]) : null : /* @__PURE__ */ import_react16.default.createElement(import_react_native16.ScrollView, { style: styles10.body, keyboardShouldPersistTaps: "handled" }, message ? /* @__PURE__ */ import_react16.default.createElement(
|
|
7807
|
+
import_react_native16.Text,
|
|
7808
|
+
{
|
|
7809
|
+
style: [styles10.message, { color: message.error ? FAIL : PASS }],
|
|
7810
|
+
testID: "tpk-checklist-message"
|
|
7811
|
+
},
|
|
7812
|
+
message.text
|
|
7813
|
+
) : null, !task ? tasks.length === 0 ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: styles10.muted }, tr({ en: "Nothing to test right now.", de: "Gerade gibt es nichts zu testen." })) : tasks.map((t) => {
|
|
7814
|
+
const tone = runTone(t.mine);
|
|
7815
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
7816
|
+
import_react_native16.Pressable,
|
|
7817
|
+
{
|
|
7818
|
+
key: t.id,
|
|
7819
|
+
onPress: () => openTask(t),
|
|
7820
|
+
style: styles10.taskRow,
|
|
7821
|
+
testID: `tpk-checklist-task-${t.id}`
|
|
7822
|
+
},
|
|
7823
|
+
/* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { flex: 1 } }, /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: [styles10.taskTitle, { color: theme.onSurface }], numberOfLines: 2 }, t.title), /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: styles10.muted }, tr({
|
|
7824
|
+
en: `${t.steps.length} step${t.steps.length === 1 ? "" : "s"}`,
|
|
7825
|
+
de: `${t.steps.length} Schritt${t.steps.length === 1 ? "" : "e"}`
|
|
7826
|
+
}))),
|
|
7827
|
+
/* @__PURE__ */ import_react16.default.createElement(
|
|
7828
|
+
import_react_native16.Text,
|
|
7829
|
+
{
|
|
7830
|
+
style: [styles10.chip, { color: RUN_TONE_COLOR[tone], borderColor: RUN_TONE_COLOR[tone] }],
|
|
7831
|
+
testID: `tpk-checklist-status-${t.id}`
|
|
7832
|
+
},
|
|
7833
|
+
runStatusText(t.mine, language)
|
|
7834
|
+
)
|
|
7835
|
+
);
|
|
7836
|
+
}) : /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, task.description ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: styles10.description }, task.description) : null, task.steps.map((step, i) => {
|
|
7837
|
+
const d = draft[i] ?? { passed: null, note: "" };
|
|
7838
|
+
const last = lastStepVerdict(task.mine, i);
|
|
7839
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
7840
|
+
import_react_native16.View,
|
|
7841
|
+
{
|
|
7842
|
+
key: i,
|
|
7843
|
+
style: [styles10.stepRow, i === current && styles10.stepCurrent],
|
|
7844
|
+
testID: `tpk-checklist-step-${i + 1}`
|
|
7845
|
+
},
|
|
7846
|
+
/* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles10.stepLine }, /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: [styles10.stepText, { color: theme.onSurface }] }, i + 1, ". ", step, last !== null && d.passed === null ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: { color: last ? PASS : FAIL } }, " ", last ? "\u2713" : "\u2717") : null), /* @__PURE__ */ import_react16.default.createElement(
|
|
7847
|
+
import_react_native16.Pressable,
|
|
7848
|
+
{
|
|
7849
|
+
onPress: () => setDraft((dr) => toggleVerdict(dr, i, true)),
|
|
7850
|
+
style: [styles10.verdict, d.passed === true && { backgroundColor: PASS, borderColor: PASS }],
|
|
7851
|
+
accessibilityLabel: tr({ en: `Step ${i + 1} works`, de: `Schritt ${i + 1} klappt` }),
|
|
7852
|
+
testID: `tpk-checklist-pass-${i + 1}`
|
|
7853
|
+
},
|
|
7854
|
+
/* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: [styles10.verdictText, { color: d.passed === true ? "#FFF" : PASS }] }, "\u2713")
|
|
7855
|
+
), /* @__PURE__ */ import_react16.default.createElement(
|
|
7856
|
+
import_react_native16.Pressable,
|
|
7857
|
+
{
|
|
7858
|
+
onPress: () => {
|
|
7859
|
+
setDraft((dr) => toggleVerdict(dr, i, false));
|
|
7860
|
+
if (d.passed !== false) setNoteOpen(i);
|
|
7861
|
+
},
|
|
7862
|
+
style: [styles10.verdict, d.passed === false && { backgroundColor: FAIL, borderColor: FAIL }],
|
|
7863
|
+
accessibilityLabel: tr({ en: `Step ${i + 1} fails`, de: `Schritt ${i + 1} klappt nicht` }),
|
|
7864
|
+
testID: `tpk-checklist-fail-${i + 1}`
|
|
7865
|
+
},
|
|
7866
|
+
/* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: [styles10.verdictText, { color: d.passed === false ? "#FFF" : FAIL }] }, "\u2717")
|
|
7867
|
+
)),
|
|
7868
|
+
noteOpen === i ? /* @__PURE__ */ import_react16.default.createElement(
|
|
7869
|
+
import_react_native16.TextInput,
|
|
7870
|
+
{
|
|
7871
|
+
value: d.note,
|
|
7872
|
+
onChangeText: (v) => setDraft((dr) => setNote(dr, i, v)),
|
|
7873
|
+
placeholder: tr({ en: "What happened? (optional)", de: "Was ist passiert? (optional)" }),
|
|
7874
|
+
placeholderTextColor: "#94A3B8",
|
|
7875
|
+
style: [styles10.note, { color: theme.onSurface }],
|
|
7876
|
+
onFocus: () => setTyping(true),
|
|
7877
|
+
onBlur: () => setTyping(false),
|
|
7878
|
+
multiline: true,
|
|
7879
|
+
testID: `tpk-checklist-note-${i + 1}`
|
|
7880
|
+
}
|
|
7881
|
+
) : /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Pressable, { onPress: () => setNoteOpen(i), hitSlop: 4, testID: `tpk-checklist-add-note-${i + 1}` }, /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: styles10.addNote }, d.note.trim() ? `\u201C${d.note.trim()}\u201D` : tr({ en: "+ note", de: "+ Notiz" })))
|
|
7882
|
+
);
|
|
7883
|
+
}), /* @__PURE__ */ import_react16.default.createElement(
|
|
7884
|
+
import_react_native16.Pressable,
|
|
7885
|
+
{
|
|
7886
|
+
onPress: () => void send(),
|
|
7887
|
+
disabled: !canSend(draft) || sending,
|
|
7888
|
+
style: [
|
|
7889
|
+
styles10.send,
|
|
7890
|
+
{ backgroundColor: theme.primary },
|
|
7891
|
+
(!canSend(draft) || sending) && styles10.sendDisabled
|
|
7892
|
+
],
|
|
7893
|
+
testID: "tpk-checklist-send"
|
|
7894
|
+
},
|
|
7895
|
+
sending ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.ActivityIndicator, { color: "#FFF" }) : /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Text, { style: styles10.sendText }, tr({ en: "Send", de: "Senden" }))
|
|
7896
|
+
))))
|
|
7897
|
+
);
|
|
7898
|
+
}
|
|
7899
|
+
var styles10 = import_react_native16.StyleSheet.create({
|
|
7900
|
+
dock: {
|
|
7901
|
+
position: "absolute",
|
|
7902
|
+
left: 8,
|
|
7903
|
+
right: 8
|
|
7904
|
+
},
|
|
7905
|
+
panel: {
|
|
7906
|
+
borderRadius: 14,
|
|
7907
|
+
paddingHorizontal: 12,
|
|
7908
|
+
paddingVertical: 8,
|
|
7909
|
+
opacity: 0.96,
|
|
7910
|
+
shadowColor: "#000",
|
|
7911
|
+
shadowOpacity: 0.18,
|
|
7912
|
+
shadowRadius: 10,
|
|
7913
|
+
shadowOffset: { width: 0, height: 2 },
|
|
7914
|
+
elevation: 8
|
|
7915
|
+
},
|
|
7916
|
+
header: {
|
|
7917
|
+
flexDirection: "row",
|
|
7918
|
+
alignItems: "center",
|
|
7919
|
+
gap: 12,
|
|
7920
|
+
minHeight: 32
|
|
7921
|
+
},
|
|
7922
|
+
headerBtn: { fontSize: 18, fontWeight: "600", paddingHorizontal: 2 },
|
|
7923
|
+
title: { flex: 1, fontSize: 15, fontWeight: "700" },
|
|
7924
|
+
progress: { fontSize: 13, color: "#64748B", fontVariant: ["tabular-nums"] },
|
|
7925
|
+
body: { marginTop: 4 },
|
|
7926
|
+
collapsedStep: { fontSize: 13, color: "#334155", marginTop: 2 },
|
|
7927
|
+
message: { fontSize: 13, fontWeight: "600", marginBottom: 6 },
|
|
7928
|
+
muted: { fontSize: 12, color: "#64748B" },
|
|
7929
|
+
description: { fontSize: 13, color: "#475569", marginBottom: 6 },
|
|
7930
|
+
taskRow: {
|
|
7931
|
+
flexDirection: "row",
|
|
7932
|
+
alignItems: "center",
|
|
7933
|
+
gap: 8,
|
|
7934
|
+
paddingVertical: 8,
|
|
7935
|
+
borderBottomWidth: import_react_native16.StyleSheet.hairlineWidth,
|
|
7936
|
+
borderBottomColor: "#E2E8F0"
|
|
7937
|
+
},
|
|
7938
|
+
taskTitle: { fontSize: 14, fontWeight: "600" },
|
|
7939
|
+
chip: {
|
|
7940
|
+
fontSize: 11,
|
|
7941
|
+
fontWeight: "700",
|
|
7942
|
+
borderWidth: 1,
|
|
7943
|
+
borderRadius: 10,
|
|
7944
|
+
paddingHorizontal: 8,
|
|
7945
|
+
paddingVertical: 2,
|
|
7946
|
+
overflow: "hidden"
|
|
7947
|
+
},
|
|
7948
|
+
stepRow: { paddingVertical: 6, paddingHorizontal: 4, borderRadius: 8 },
|
|
7949
|
+
stepCurrent: { backgroundColor: "rgba(37, 99, 235, 0.07)" },
|
|
7950
|
+
stepLine: { flexDirection: "row", alignItems: "center", gap: 8 },
|
|
7951
|
+
stepText: { flex: 1, fontSize: 14 },
|
|
7952
|
+
verdict: {
|
|
7953
|
+
width: 36,
|
|
7954
|
+
height: 32,
|
|
7955
|
+
borderRadius: 8,
|
|
7956
|
+
borderWidth: 1.5,
|
|
7957
|
+
borderColor: "#CBD5E1",
|
|
7958
|
+
alignItems: "center",
|
|
7959
|
+
justifyContent: "center"
|
|
7960
|
+
},
|
|
7961
|
+
verdictText: { fontSize: 16, fontWeight: "800" },
|
|
7962
|
+
addNote: { fontSize: 12, color: "#64748B", marginTop: 2 },
|
|
7963
|
+
note: {
|
|
7964
|
+
marginTop: 4,
|
|
7965
|
+
borderWidth: 1,
|
|
7966
|
+
borderColor: "#CBD5E1",
|
|
7967
|
+
borderRadius: 8,
|
|
7968
|
+
paddingHorizontal: 8,
|
|
7969
|
+
paddingVertical: 6,
|
|
7970
|
+
fontSize: 13,
|
|
7971
|
+
minHeight: 36
|
|
7972
|
+
},
|
|
7973
|
+
send: {
|
|
7974
|
+
marginTop: 8,
|
|
7975
|
+
marginBottom: 4,
|
|
7976
|
+
borderRadius: 10,
|
|
7977
|
+
paddingVertical: 10,
|
|
7978
|
+
alignItems: "center"
|
|
7979
|
+
},
|
|
7980
|
+
sendDisabled: { opacity: 0.4 },
|
|
7981
|
+
sendText: { color: "#FFF", fontWeight: "700", fontSize: 15 }
|
|
7982
|
+
});
|
|
7983
|
+
|
|
7526
7984
|
// src/ScreenshotAnnotationEditor.tsx
|
|
7527
|
-
var
|
|
7528
|
-
var
|
|
7985
|
+
var import_react18 = __toESM(require("react"));
|
|
7986
|
+
var import_react_native18 = require("react-native");
|
|
7529
7987
|
|
|
7530
7988
|
// src/TpkAnnotationOverlay.tsx
|
|
7531
|
-
var
|
|
7532
|
-
var
|
|
7989
|
+
var import_react17 = __toESM(require("react"));
|
|
7990
|
+
var import_react_native17 = require("react-native");
|
|
7533
7991
|
|
|
7534
7992
|
// src/drawing.ts
|
|
7535
7993
|
var DEFAULT_STYLE = {
|
|
@@ -7634,7 +8092,7 @@ function arrowHeadPoints(arrow) {
|
|
|
7634
8092
|
}
|
|
7635
8093
|
|
|
7636
8094
|
// src/TpkAnnotationOverlay.tsx
|
|
7637
|
-
var TpkAnnotationOverlay = (0,
|
|
8095
|
+
var TpkAnnotationOverlay = (0, import_react17.forwardRef)(function TpkAnnotationOverlay2(props, ref) {
|
|
7638
8096
|
const {
|
|
7639
8097
|
imageUri,
|
|
7640
8098
|
imageWidth,
|
|
@@ -7645,32 +8103,32 @@ var TpkAnnotationOverlay = (0, import_react16.forwardRef)(function TpkAnnotation
|
|
|
7645
8103
|
onShapesChange,
|
|
7646
8104
|
textValue
|
|
7647
8105
|
} = props;
|
|
7648
|
-
const [shapes, setShapesState] = (0,
|
|
8106
|
+
const [shapes, setShapesState] = (0, import_react17.useState)(
|
|
7649
8107
|
initialShapes ?? []
|
|
7650
8108
|
);
|
|
7651
|
-
const draftRef = (0,
|
|
7652
|
-
const layoutRef = (0,
|
|
8109
|
+
const draftRef = (0, import_react17.useRef)(null);
|
|
8110
|
+
const layoutRef = (0, import_react17.useRef)({
|
|
7653
8111
|
width: imageWidth,
|
|
7654
8112
|
height: imageHeight
|
|
7655
8113
|
});
|
|
7656
|
-
const surfaceRef = (0,
|
|
7657
|
-
const SvgModRef = (0,
|
|
7658
|
-
const [svgReady, setSvgReady] = (0,
|
|
7659
|
-
|
|
8114
|
+
const surfaceRef = (0, import_react17.useRef)(null);
|
|
8115
|
+
const SvgModRef = (0, import_react17.useRef)(null);
|
|
8116
|
+
const [svgReady, setSvgReady] = (0, import_react17.useState)(false);
|
|
8117
|
+
import_react17.default.useEffect(() => {
|
|
7660
8118
|
import("react-native-svg").then((mod) => {
|
|
7661
8119
|
SvgModRef.current = mod;
|
|
7662
8120
|
setSvgReady(true);
|
|
7663
8121
|
}).catch(() => {
|
|
7664
8122
|
});
|
|
7665
8123
|
}, []);
|
|
7666
|
-
const commitShapes = (0,
|
|
8124
|
+
const commitShapes = (0, import_react17.useCallback)(
|
|
7667
8125
|
(next) => {
|
|
7668
8126
|
setShapesState(next);
|
|
7669
8127
|
onShapesChange?.(next);
|
|
7670
8128
|
},
|
|
7671
8129
|
[onShapesChange]
|
|
7672
8130
|
);
|
|
7673
|
-
const toImageCoords = (0,
|
|
8131
|
+
const toImageCoords = (0, import_react17.useCallback)(
|
|
7674
8132
|
(e) => {
|
|
7675
8133
|
const { width, height } = layoutRef.current;
|
|
7676
8134
|
const scaleX = imageWidth / Math.max(1, width);
|
|
@@ -7682,8 +8140,8 @@ var TpkAnnotationOverlay = (0, import_react16.forwardRef)(function TpkAnnotation
|
|
|
7682
8140
|
},
|
|
7683
8141
|
[imageWidth, imageHeight]
|
|
7684
8142
|
);
|
|
7685
|
-
const panResponder = (0,
|
|
7686
|
-
() =>
|
|
8143
|
+
const panResponder = (0, import_react17.useMemo)(
|
|
8144
|
+
() => import_react_native17.PanResponder.create({
|
|
7687
8145
|
onStartShouldSetPanResponder: () => tool !== "select",
|
|
7688
8146
|
onMoveShouldSetPanResponder: () => tool !== "select",
|
|
7689
8147
|
onPanResponderGrant: (e) => {
|
|
@@ -7708,13 +8166,13 @@ var TpkAnnotationOverlay = (0, import_react16.forwardRef)(function TpkAnnotation
|
|
|
7708
8166
|
}),
|
|
7709
8167
|
[tool, style, textValue, toImageCoords, shapes, commitShapes]
|
|
7710
8168
|
);
|
|
7711
|
-
const onLayout = (0,
|
|
8169
|
+
const onLayout = (0, import_react17.useCallback)((e) => {
|
|
7712
8170
|
layoutRef.current = {
|
|
7713
8171
|
width: e.nativeEvent.layout.width,
|
|
7714
8172
|
height: e.nativeEvent.layout.height
|
|
7715
8173
|
};
|
|
7716
8174
|
}, []);
|
|
7717
|
-
(0,
|
|
8175
|
+
(0, import_react17.useImperativeHandle)(
|
|
7718
8176
|
ref,
|
|
7719
8177
|
() => ({
|
|
7720
8178
|
getShapes: () => shapes,
|
|
@@ -7742,32 +8200,32 @@ var TpkAnnotationOverlay = (0, import_react16.forwardRef)(function TpkAnnotation
|
|
|
7742
8200
|
}),
|
|
7743
8201
|
[shapes, commitShapes]
|
|
7744
8202
|
);
|
|
7745
|
-
return /* @__PURE__ */
|
|
7746
|
-
|
|
8203
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
8204
|
+
import_react_native17.View,
|
|
7747
8205
|
{
|
|
7748
8206
|
ref: surfaceRef,
|
|
7749
|
-
style: [
|
|
8207
|
+
style: [styles11.surface, { aspectRatio: imageWidth / imageHeight }],
|
|
7750
8208
|
onLayout,
|
|
7751
8209
|
...panResponder.panHandlers
|
|
7752
8210
|
},
|
|
7753
|
-
/* @__PURE__ */
|
|
7754
|
-
|
|
8211
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
8212
|
+
import_react_native17.Image,
|
|
7755
8213
|
{
|
|
7756
8214
|
source: { uri: imageUri },
|
|
7757
|
-
style:
|
|
8215
|
+
style: import_react_native17.StyleSheet.absoluteFill,
|
|
7758
8216
|
resizeMode: "contain"
|
|
7759
8217
|
}
|
|
7760
8218
|
),
|
|
7761
|
-
svgReady && SvgModRef.current ? /* @__PURE__ */
|
|
8219
|
+
svgReady && SvgModRef.current ? /* @__PURE__ */ import_react17.default.createElement(ShapeLayer, { shapes, svgMod: SvgModRef.current, viewBox: `0 0 ${imageWidth} ${imageHeight}` }) : null
|
|
7762
8220
|
);
|
|
7763
8221
|
});
|
|
7764
8222
|
function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
7765
8223
|
const Svg = svgMod.default ?? svgMod.Svg;
|
|
7766
8224
|
const { Rect, Circle, Polygon, Path, Text: SvgText, Line: SvgLine, G } = svgMod;
|
|
7767
|
-
return /* @__PURE__ */
|
|
8225
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
7768
8226
|
Svg,
|
|
7769
8227
|
{
|
|
7770
|
-
style:
|
|
8228
|
+
style: import_react_native17.StyleSheet.absoluteFill,
|
|
7771
8229
|
viewBox,
|
|
7772
8230
|
preserveAspectRatio: "xMidYMid meet"
|
|
7773
8231
|
},
|
|
@@ -7777,7 +8235,7 @@ function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
|
7777
8235
|
const opacity = s.kind === "blur" ? 1 : s.style.opacity ?? 1;
|
|
7778
8236
|
switch (s.kind) {
|
|
7779
8237
|
case "rect":
|
|
7780
|
-
return /* @__PURE__ */
|
|
8238
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
7781
8239
|
Rect,
|
|
7782
8240
|
{
|
|
7783
8241
|
key: s.id,
|
|
@@ -7792,7 +8250,7 @@ function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
|
7792
8250
|
}
|
|
7793
8251
|
);
|
|
7794
8252
|
case "circle":
|
|
7795
|
-
return /* @__PURE__ */
|
|
8253
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
7796
8254
|
Circle,
|
|
7797
8255
|
{
|
|
7798
8256
|
key: s.id,
|
|
@@ -7807,7 +8265,7 @@ function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
|
7807
8265
|
);
|
|
7808
8266
|
case "arrow": {
|
|
7809
8267
|
const head = arrowHeadPoints(s);
|
|
7810
|
-
return /* @__PURE__ */
|
|
8268
|
+
return /* @__PURE__ */ import_react17.default.createElement(G, { key: s.id, opacity }, /* @__PURE__ */ import_react17.default.createElement(
|
|
7811
8269
|
SvgLine,
|
|
7812
8270
|
{
|
|
7813
8271
|
x1: s.from.x,
|
|
@@ -7817,7 +8275,7 @@ function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
|
7817
8275
|
stroke,
|
|
7818
8276
|
strokeWidth
|
|
7819
8277
|
}
|
|
7820
|
-
), /* @__PURE__ */
|
|
8278
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
7821
8279
|
Polygon,
|
|
7822
8280
|
{
|
|
7823
8281
|
points: head.map((p) => `${p.x},${p.y}`).join(" "),
|
|
@@ -7826,7 +8284,7 @@ function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
|
7826
8284
|
));
|
|
7827
8285
|
}
|
|
7828
8286
|
case "path":
|
|
7829
|
-
return /* @__PURE__ */
|
|
8287
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
7830
8288
|
Path,
|
|
7831
8289
|
{
|
|
7832
8290
|
key: s.id,
|
|
@@ -7838,7 +8296,7 @@ function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
|
7838
8296
|
}
|
|
7839
8297
|
);
|
|
7840
8298
|
case "text":
|
|
7841
|
-
return /* @__PURE__ */
|
|
8299
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
7842
8300
|
SvgText,
|
|
7843
8301
|
{
|
|
7844
8302
|
key: s.id,
|
|
@@ -7851,7 +8309,7 @@ function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
|
7851
8309
|
s.text
|
|
7852
8310
|
);
|
|
7853
8311
|
case "blur":
|
|
7854
|
-
return /* @__PURE__ */
|
|
8312
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
7855
8313
|
Rect,
|
|
7856
8314
|
{
|
|
7857
8315
|
key: s.id,
|
|
@@ -7950,7 +8408,7 @@ function estimateBase64Bytes2(b64) {
|
|
|
7950
8408
|
const padding = b64.endsWith("==") ? 2 : b64.endsWith("=") ? 1 : 0;
|
|
7951
8409
|
return Math.floor(b64.length * 3 / 4) - padding;
|
|
7952
8410
|
}
|
|
7953
|
-
var
|
|
8411
|
+
var styles11 = import_react_native17.StyleSheet.create({
|
|
7954
8412
|
surface: {
|
|
7955
8413
|
width: "100%",
|
|
7956
8414
|
backgroundColor: "#000"
|
|
@@ -8026,15 +8484,15 @@ function ScreenshotAnnotationEditor({
|
|
|
8026
8484
|
testID = "tpk-screenshot-annotation-editor"
|
|
8027
8485
|
}) {
|
|
8028
8486
|
const t = STRINGS6[useTpkLanguage()];
|
|
8029
|
-
const editorRef = (0,
|
|
8030
|
-
const [tool, setTool] = (0,
|
|
8031
|
-
const [annotationStyle, setAnnotationStyle] = (0,
|
|
8487
|
+
const editorRef = (0, import_react18.useRef)(null);
|
|
8488
|
+
const [tool, setTool] = (0, import_react18.useState)("arrow");
|
|
8489
|
+
const [annotationStyle, setAnnotationStyle] = (0, import_react18.useState)(
|
|
8032
8490
|
DEFAULT_STYLE
|
|
8033
8491
|
);
|
|
8034
|
-
const [textValue, setTextValue] = (0,
|
|
8035
|
-
const [processing, setProcessing] = (0,
|
|
8036
|
-
const [error, setError] = (0,
|
|
8037
|
-
const handleSave = (0,
|
|
8492
|
+
const [textValue, setTextValue] = (0, import_react18.useState)("");
|
|
8493
|
+
const [processing, setProcessing] = (0, import_react18.useState)(false);
|
|
8494
|
+
const [error, setError] = (0, import_react18.useState)(null);
|
|
8495
|
+
const handleSave = (0, import_react18.useCallback)(async () => {
|
|
8038
8496
|
if (!editorRef.current) {
|
|
8039
8497
|
setError(t.errorNotReady);
|
|
8040
8498
|
return;
|
|
@@ -8054,21 +8512,21 @@ function ScreenshotAnnotationEditor({
|
|
|
8054
8512
|
setProcessing(false);
|
|
8055
8513
|
}
|
|
8056
8514
|
}, [format, quality, onSave, t]);
|
|
8057
|
-
const setColor = (0,
|
|
8515
|
+
const setColor = (0, import_react18.useCallback)((color) => {
|
|
8058
8516
|
setAnnotationStyle((cur) => ({ ...cur, color }));
|
|
8059
8517
|
}, []);
|
|
8060
|
-
const setStrokeWidth = (0,
|
|
8518
|
+
const setStrokeWidth = (0, import_react18.useCallback)((strokeWidth) => {
|
|
8061
8519
|
setAnnotationStyle((cur) => ({ ...cur, strokeWidth }));
|
|
8062
8520
|
}, []);
|
|
8063
|
-
return /* @__PURE__ */
|
|
8064
|
-
|
|
8521
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
8522
|
+
import_react_native18.Modal,
|
|
8065
8523
|
{
|
|
8066
8524
|
animationType: "slide",
|
|
8067
8525
|
onRequestClose: processing ? void 0 : onCancel,
|
|
8068
8526
|
transparent: false,
|
|
8069
8527
|
visible
|
|
8070
8528
|
},
|
|
8071
|
-
/* @__PURE__ */
|
|
8529
|
+
/* @__PURE__ */ import_react18.default.createElement(import_react_native18.View, { style: [styles12.root, style], testID }, /* @__PURE__ */ import_react18.default.createElement(
|
|
8072
8530
|
Header2,
|
|
8073
8531
|
{
|
|
8074
8532
|
onCancel,
|
|
@@ -8077,7 +8535,7 @@ function ScreenshotAnnotationEditor({
|
|
|
8077
8535
|
onClear: () => editorRef.current?.clear(),
|
|
8078
8536
|
t
|
|
8079
8537
|
}
|
|
8080
|
-
), /* @__PURE__ */
|
|
8538
|
+
), /* @__PURE__ */ import_react18.default.createElement(
|
|
8081
8539
|
Toolbar,
|
|
8082
8540
|
{
|
|
8083
8541
|
tool,
|
|
@@ -8087,17 +8545,17 @@ function ScreenshotAnnotationEditor({
|
|
|
8087
8545
|
onStrokeWidthChange: setStrokeWidth,
|
|
8088
8546
|
t
|
|
8089
8547
|
}
|
|
8090
|
-
), tool === "text" && /* @__PURE__ */
|
|
8091
|
-
|
|
8548
|
+
), tool === "text" && /* @__PURE__ */ import_react18.default.createElement(import_react_native18.View, { style: styles12.textInputRow }, /* @__PURE__ */ import_react18.default.createElement(
|
|
8549
|
+
import_react_native18.TextInput,
|
|
8092
8550
|
{
|
|
8093
8551
|
autoFocus: true,
|
|
8094
8552
|
placeholder: t.textPlaceholder,
|
|
8095
8553
|
placeholderTextColor: "#94A3B8",
|
|
8096
|
-
style:
|
|
8554
|
+
style: styles12.textInput,
|
|
8097
8555
|
value: textValue,
|
|
8098
8556
|
onChangeText: setTextValue
|
|
8099
8557
|
}
|
|
8100
|
-
)), /* @__PURE__ */
|
|
8558
|
+
)), /* @__PURE__ */ import_react18.default.createElement(import_react_native18.View, { style: styles12.canvasWrap }, /* @__PURE__ */ import_react18.default.createElement(
|
|
8101
8559
|
TpkAnnotationOverlay,
|
|
8102
8560
|
{
|
|
8103
8561
|
ref: editorRef,
|
|
@@ -8108,7 +8566,7 @@ function ScreenshotAnnotationEditor({
|
|
|
8108
8566
|
style: annotationStyle,
|
|
8109
8567
|
textValue
|
|
8110
8568
|
}
|
|
8111
|
-
)), error && /* @__PURE__ */
|
|
8569
|
+
)), error && /* @__PURE__ */ import_react18.default.createElement(import_react_native18.View, { style: styles12.errorBanner }, /* @__PURE__ */ import_react18.default.createElement(import_react_native18.Text, { style: styles12.errorLabel }, error)), /* @__PURE__ */ import_react18.default.createElement(
|
|
8112
8570
|
Footer2,
|
|
8113
8571
|
{
|
|
8114
8572
|
processing,
|
|
@@ -8126,36 +8584,36 @@ function Header2({
|
|
|
8126
8584
|
onClear,
|
|
8127
8585
|
t
|
|
8128
8586
|
}) {
|
|
8129
|
-
return /* @__PURE__ */
|
|
8130
|
-
|
|
8587
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react_native18.View, { style: [styles12.header, { paddingTop: 12 + getModalInsets().top }] }, /* @__PURE__ */ import_react18.default.createElement(
|
|
8588
|
+
import_react_native18.Pressable,
|
|
8131
8589
|
{
|
|
8132
8590
|
accessibilityRole: "button",
|
|
8133
8591
|
accessibilityLabel: t.cancelA11y,
|
|
8134
8592
|
disabled: processing,
|
|
8135
8593
|
onPress: onCancel,
|
|
8136
|
-
style:
|
|
8594
|
+
style: styles12.headerIconButton
|
|
8137
8595
|
},
|
|
8138
|
-
/* @__PURE__ */
|
|
8139
|
-
), /* @__PURE__ */
|
|
8140
|
-
|
|
8596
|
+
/* @__PURE__ */ import_react18.default.createElement(TpkIcon, { name: "close", size: 20, color: "#FAFAF7" })
|
|
8597
|
+
), /* @__PURE__ */ import_react18.default.createElement(import_react_native18.View, { style: styles12.headerTitleRow }, /* @__PURE__ */ import_react18.default.createElement(TpkIcon, { name: "edit_pen", size: 20, color: "#FAFAF7" }), /* @__PURE__ */ import_react18.default.createElement(import_react_native18.Text, { style: styles12.headerTitle }, t.title)), /* @__PURE__ */ import_react18.default.createElement(
|
|
8598
|
+
import_react_native18.Pressable,
|
|
8141
8599
|
{
|
|
8142
8600
|
accessibilityRole: "button",
|
|
8143
8601
|
accessibilityLabel: t.undoA11y,
|
|
8144
8602
|
disabled: processing,
|
|
8145
8603
|
onPress: onUndo,
|
|
8146
|
-
style:
|
|
8604
|
+
style: styles12.headerIconButton
|
|
8147
8605
|
},
|
|
8148
|
-
/* @__PURE__ */
|
|
8149
|
-
), /* @__PURE__ */
|
|
8150
|
-
|
|
8606
|
+
/* @__PURE__ */ import_react18.default.createElement(import_react_native18.Text, { style: styles12.headerIconLabel }, "\u21B6")
|
|
8607
|
+
), /* @__PURE__ */ import_react18.default.createElement(
|
|
8608
|
+
import_react_native18.Pressable,
|
|
8151
8609
|
{
|
|
8152
8610
|
accessibilityRole: "button",
|
|
8153
8611
|
accessibilityLabel: t.clearA11y,
|
|
8154
8612
|
disabled: processing,
|
|
8155
8613
|
onPress: onClear,
|
|
8156
|
-
style:
|
|
8614
|
+
style: styles12.headerIconButton
|
|
8157
8615
|
},
|
|
8158
|
-
/* @__PURE__ */
|
|
8616
|
+
/* @__PURE__ */ import_react18.default.createElement(import_react_native18.Text, { style: styles12.headerIconLabel }, "\u232B")
|
|
8159
8617
|
));
|
|
8160
8618
|
}
|
|
8161
8619
|
function Toolbar({
|
|
@@ -8166,17 +8624,17 @@ function Toolbar({
|
|
|
8166
8624
|
onStrokeWidthChange,
|
|
8167
8625
|
t
|
|
8168
8626
|
}) {
|
|
8169
|
-
return /* @__PURE__ */
|
|
8170
|
-
|
|
8627
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react_native18.View, { style: styles12.toolbar }, /* @__PURE__ */ import_react18.default.createElement(
|
|
8628
|
+
import_react_native18.ScrollView,
|
|
8171
8629
|
{
|
|
8172
8630
|
horizontal: true,
|
|
8173
8631
|
showsHorizontalScrollIndicator: false,
|
|
8174
|
-
contentContainerStyle:
|
|
8632
|
+
contentContainerStyle: styles12.toolbarRow
|
|
8175
8633
|
},
|
|
8176
8634
|
TOOLS.map((item) => {
|
|
8177
8635
|
const active = tool === item.value;
|
|
8178
|
-
return /* @__PURE__ */
|
|
8179
|
-
|
|
8636
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
8637
|
+
import_react_native18.Pressable,
|
|
8180
8638
|
{
|
|
8181
8639
|
key: item.value,
|
|
8182
8640
|
accessibilityRole: "radio",
|
|
@@ -8184,11 +8642,11 @@ function Toolbar({
|
|
|
8184
8642
|
accessibilityLabel: t.tools[item.value],
|
|
8185
8643
|
onPress: () => onToolChange(item.value),
|
|
8186
8644
|
style: [
|
|
8187
|
-
|
|
8188
|
-
active &&
|
|
8645
|
+
styles12.toolButton,
|
|
8646
|
+
active && styles12.toolButtonActive
|
|
8189
8647
|
]
|
|
8190
8648
|
},
|
|
8191
|
-
/* @__PURE__ */
|
|
8649
|
+
/* @__PURE__ */ import_react18.default.createElement(
|
|
8192
8650
|
TpkIcon,
|
|
8193
8651
|
{
|
|
8194
8652
|
name: item.icon,
|
|
@@ -8196,48 +8654,48 @@ function Toolbar({
|
|
|
8196
8654
|
color: active ? "#FAFAF7" : "#94A3B8"
|
|
8197
8655
|
}
|
|
8198
8656
|
),
|
|
8199
|
-
/* @__PURE__ */
|
|
8200
|
-
|
|
8657
|
+
/* @__PURE__ */ import_react18.default.createElement(
|
|
8658
|
+
import_react_native18.Text,
|
|
8201
8659
|
{
|
|
8202
8660
|
style: [
|
|
8203
|
-
|
|
8204
|
-
active &&
|
|
8661
|
+
styles12.toolLabel,
|
|
8662
|
+
active && styles12.toolLabelActive
|
|
8205
8663
|
]
|
|
8206
8664
|
},
|
|
8207
8665
|
t.tools[item.value]
|
|
8208
8666
|
)
|
|
8209
8667
|
);
|
|
8210
8668
|
})
|
|
8211
|
-
), /* @__PURE__ */
|
|
8212
|
-
|
|
8669
|
+
), /* @__PURE__ */ import_react18.default.createElement(import_react_native18.View, { style: styles12.toolbarBottomRow }, /* @__PURE__ */ import_react18.default.createElement(import_react_native18.View, { style: styles12.swatchRow }, ANNOTATION_PALETTE.map((c) => /* @__PURE__ */ import_react18.default.createElement(
|
|
8670
|
+
import_react_native18.Pressable,
|
|
8213
8671
|
{
|
|
8214
8672
|
key: c,
|
|
8215
8673
|
accessibilityRole: "button",
|
|
8216
8674
|
accessibilityLabel: t.colorA11y(c),
|
|
8217
8675
|
onPress: () => onColorChange(c),
|
|
8218
8676
|
style: [
|
|
8219
|
-
|
|
8677
|
+
styles12.swatch,
|
|
8220
8678
|
{ backgroundColor: c },
|
|
8221
|
-
annotationStyle.color === c &&
|
|
8679
|
+
annotationStyle.color === c && styles12.swatchActive
|
|
8222
8680
|
]
|
|
8223
8681
|
}
|
|
8224
|
-
))), /* @__PURE__ */
|
|
8225
|
-
|
|
8682
|
+
))), /* @__PURE__ */ import_react18.default.createElement(import_react_native18.View, { style: styles12.strokeRow }, STROKE_WIDTHS.map((w) => /* @__PURE__ */ import_react18.default.createElement(
|
|
8683
|
+
import_react_native18.Pressable,
|
|
8226
8684
|
{
|
|
8227
8685
|
key: w,
|
|
8228
8686
|
accessibilityRole: "button",
|
|
8229
8687
|
accessibilityLabel: t.strokeA11y(w),
|
|
8230
8688
|
onPress: () => onStrokeWidthChange(w),
|
|
8231
8689
|
style: [
|
|
8232
|
-
|
|
8233
|
-
annotationStyle.strokeWidth === w &&
|
|
8690
|
+
styles12.strokeButton,
|
|
8691
|
+
annotationStyle.strokeWidth === w && styles12.strokeButtonActive
|
|
8234
8692
|
]
|
|
8235
8693
|
},
|
|
8236
|
-
/* @__PURE__ */
|
|
8237
|
-
|
|
8694
|
+
/* @__PURE__ */ import_react18.default.createElement(
|
|
8695
|
+
import_react_native18.View,
|
|
8238
8696
|
{
|
|
8239
8697
|
style: [
|
|
8240
|
-
|
|
8698
|
+
styles12.strokeIndicator,
|
|
8241
8699
|
{
|
|
8242
8700
|
height: w,
|
|
8243
8701
|
backgroundColor: annotationStyle.strokeWidth === w ? "#FAFAF7" : "#94A3B8"
|
|
@@ -8253,45 +8711,45 @@ function Footer2({
|
|
|
8253
8711
|
onSave,
|
|
8254
8712
|
t
|
|
8255
8713
|
}) {
|
|
8256
|
-
return /* @__PURE__ */
|
|
8257
|
-
|
|
8714
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
8715
|
+
import_react_native18.View,
|
|
8258
8716
|
{
|
|
8259
8717
|
style: [
|
|
8260
|
-
|
|
8718
|
+
styles12.footer,
|
|
8261
8719
|
{ paddingBottom: Math.max(14, getModalInsets().bottom) }
|
|
8262
8720
|
]
|
|
8263
8721
|
},
|
|
8264
|
-
/* @__PURE__ */
|
|
8265
|
-
|
|
8722
|
+
/* @__PURE__ */ import_react18.default.createElement(
|
|
8723
|
+
import_react_native18.Pressable,
|
|
8266
8724
|
{
|
|
8267
8725
|
accessibilityRole: "button",
|
|
8268
8726
|
disabled: processing,
|
|
8269
8727
|
onPress: onCancel,
|
|
8270
8728
|
style: ({ pressed }) => [
|
|
8271
|
-
|
|
8729
|
+
styles12.footerSecondary,
|
|
8272
8730
|
pressed && { opacity: 0.7 }
|
|
8273
8731
|
]
|
|
8274
8732
|
},
|
|
8275
|
-
/* @__PURE__ */
|
|
8733
|
+
/* @__PURE__ */ import_react18.default.createElement(import_react_native18.Text, { style: styles12.footerSecondaryLabel }, t.cancel)
|
|
8276
8734
|
),
|
|
8277
|
-
/* @__PURE__ */
|
|
8278
|
-
|
|
8735
|
+
/* @__PURE__ */ import_react18.default.createElement(
|
|
8736
|
+
import_react_native18.Pressable,
|
|
8279
8737
|
{
|
|
8280
8738
|
accessibilityRole: "button",
|
|
8281
8739
|
accessibilityLabel: t.save,
|
|
8282
8740
|
disabled: processing,
|
|
8283
8741
|
onPress: onSave,
|
|
8284
8742
|
style: ({ pressed }) => [
|
|
8285
|
-
|
|
8286
|
-
processing &&
|
|
8743
|
+
styles12.footerPrimary,
|
|
8744
|
+
processing && styles12.footerPrimaryDisabled,
|
|
8287
8745
|
pressed && { opacity: 0.85 }
|
|
8288
8746
|
]
|
|
8289
8747
|
},
|
|
8290
|
-
processing ? /* @__PURE__ */
|
|
8748
|
+
processing ? /* @__PURE__ */ import_react18.default.createElement(import_react_native18.ActivityIndicator, { color: "#FAFAF7" }) : /* @__PURE__ */ import_react18.default.createElement(import_react_native18.Text, { style: styles12.footerPrimaryLabel }, t.save)
|
|
8291
8749
|
)
|
|
8292
8750
|
);
|
|
8293
8751
|
}
|
|
8294
|
-
var
|
|
8752
|
+
var styles12 = import_react_native18.StyleSheet.create({
|
|
8295
8753
|
root: {
|
|
8296
8754
|
flex: 1,
|
|
8297
8755
|
backgroundColor: "#0F172A"
|
|
@@ -8304,7 +8762,7 @@ var styles11 = import_react_native17.StyleSheet.create({
|
|
|
8304
8762
|
paddingTop: 12,
|
|
8305
8763
|
paddingBottom: 12,
|
|
8306
8764
|
backgroundColor: "#020617",
|
|
8307
|
-
borderBottomWidth:
|
|
8765
|
+
borderBottomWidth: import_react_native18.StyleSheet.hairlineWidth,
|
|
8308
8766
|
borderBottomColor: "#1F2A24"
|
|
8309
8767
|
},
|
|
8310
8768
|
headerIconButton: {
|
|
@@ -8336,7 +8794,7 @@ var styles11 = import_react_native17.StyleSheet.create({
|
|
|
8336
8794
|
toolbar: {
|
|
8337
8795
|
backgroundColor: "#020617",
|
|
8338
8796
|
paddingVertical: 8,
|
|
8339
|
-
borderBottomWidth:
|
|
8797
|
+
borderBottomWidth: import_react_native18.StyleSheet.hairlineWidth,
|
|
8340
8798
|
borderBottomColor: "#1F2A24"
|
|
8341
8799
|
},
|
|
8342
8800
|
toolbarRow: {
|
|
@@ -8410,7 +8868,7 @@ var styles11 = import_react_native17.StyleSheet.create({
|
|
|
8410
8868
|
backgroundColor: "#020617",
|
|
8411
8869
|
paddingHorizontal: 12,
|
|
8412
8870
|
paddingVertical: 10,
|
|
8413
|
-
borderBottomWidth:
|
|
8871
|
+
borderBottomWidth: import_react_native18.StyleSheet.hairlineWidth,
|
|
8414
8872
|
borderBottomColor: "#1F2A24"
|
|
8415
8873
|
},
|
|
8416
8874
|
textInput: {
|
|
@@ -8442,7 +8900,7 @@ var styles11 = import_react_native17.StyleSheet.create({
|
|
|
8442
8900
|
gap: 10,
|
|
8443
8901
|
padding: 14,
|
|
8444
8902
|
backgroundColor: "#020617",
|
|
8445
|
-
borderTopWidth:
|
|
8903
|
+
borderTopWidth: import_react_native18.StyleSheet.hairlineWidth,
|
|
8446
8904
|
borderTopColor: "#1F2A24"
|
|
8447
8905
|
},
|
|
8448
8906
|
footerSecondary: {
|
|
@@ -8519,8 +8977,8 @@ async function readFileSize(uri) {
|
|
|
8519
8977
|
}
|
|
8520
8978
|
|
|
8521
8979
|
// src/VoiceBugInputSheet.tsx
|
|
8522
|
-
var
|
|
8523
|
-
var
|
|
8980
|
+
var import_react19 = __toESM(require("react"));
|
|
8981
|
+
var import_react_native19 = require("react-native");
|
|
8524
8982
|
|
|
8525
8983
|
// src/voice-extract.ts
|
|
8526
8984
|
async function extractVoiceBug(tpk, audio) {
|
|
@@ -8675,23 +9133,23 @@ function VoiceBugInputSheet({
|
|
|
8675
9133
|
testID = "tpk-voice-bug-sheet"
|
|
8676
9134
|
}) {
|
|
8677
9135
|
const uiLanguage = useTpkLanguage();
|
|
8678
|
-
const S = (0,
|
|
9136
|
+
const S = (0, import_react19.useMemo)(
|
|
8679
9137
|
() => ({
|
|
8680
9138
|
...uiLanguage === "de" ? DEFAULT_STRINGS_DE : DEFAULT_STRINGS_EN,
|
|
8681
9139
|
...strings ?? {}
|
|
8682
9140
|
}),
|
|
8683
9141
|
[strings, uiLanguage]
|
|
8684
9142
|
);
|
|
8685
|
-
const [phase, setPhase] = (0,
|
|
8686
|
-
const [classification, setClassification] = (0,
|
|
8687
|
-
const [seconds, setSeconds] = (0,
|
|
8688
|
-
const [error, setError] = (0,
|
|
8689
|
-
const [result, setResult] = (0,
|
|
8690
|
-
const [quickMode, setQuickMode] = (0,
|
|
8691
|
-
const [language, setLanguage] = (0,
|
|
9143
|
+
const [phase, setPhase] = (0, import_react19.useState)("idle");
|
|
9144
|
+
const [classification, setClassification] = (0, import_react19.useState)("bug");
|
|
9145
|
+
const [seconds, setSeconds] = (0, import_react19.useState)(0);
|
|
9146
|
+
const [error, setError] = (0, import_react19.useState)(null);
|
|
9147
|
+
const [result, setResult] = (0, import_react19.useState)(null);
|
|
9148
|
+
const [quickMode, setQuickMode] = (0, import_react19.useState)(false);
|
|
9149
|
+
const [language, setLanguage] = (0, import_react19.useState)(
|
|
8692
9150
|
voiceLanguage ?? "auto"
|
|
8693
9151
|
);
|
|
8694
|
-
(0,
|
|
9152
|
+
(0, import_react19.useEffect)(() => {
|
|
8695
9153
|
if (voiceLanguage !== void 0) {
|
|
8696
9154
|
setLanguage(voiceLanguage);
|
|
8697
9155
|
return;
|
|
@@ -8709,28 +9167,28 @@ function VoiceBugInputSheet({
|
|
|
8709
9167
|
cancelled = true;
|
|
8710
9168
|
};
|
|
8711
9169
|
}, [voiceLanguage]);
|
|
8712
|
-
const recorderRef = (0,
|
|
8713
|
-
const tickerRef = (0,
|
|
8714
|
-
const meterAnim = (0,
|
|
8715
|
-
const pulseAnim = (0,
|
|
8716
|
-
(0,
|
|
9170
|
+
const recorderRef = (0, import_react19.useRef)(null);
|
|
9171
|
+
const tickerRef = (0, import_react19.useRef)(null);
|
|
9172
|
+
const meterAnim = (0, import_react19.useRef)(new import_react_native19.Animated.Value(0)).current;
|
|
9173
|
+
const pulseAnim = (0, import_react19.useRef)(new import_react_native19.Animated.Value(0)).current;
|
|
9174
|
+
(0, import_react19.useEffect)(() => {
|
|
8717
9175
|
if (phase !== "recording") {
|
|
8718
9176
|
pulseAnim.stopAnimation();
|
|
8719
9177
|
pulseAnim.setValue(0);
|
|
8720
9178
|
return;
|
|
8721
9179
|
}
|
|
8722
|
-
const loop =
|
|
8723
|
-
|
|
8724
|
-
|
|
9180
|
+
const loop = import_react_native19.Animated.loop(
|
|
9181
|
+
import_react_native19.Animated.sequence([
|
|
9182
|
+
import_react_native19.Animated.timing(pulseAnim, {
|
|
8725
9183
|
toValue: 1,
|
|
8726
9184
|
duration: 700,
|
|
8727
|
-
easing:
|
|
9185
|
+
easing: import_react_native19.Easing.inOut(import_react_native19.Easing.ease),
|
|
8728
9186
|
useNativeDriver: true
|
|
8729
9187
|
}),
|
|
8730
|
-
|
|
9188
|
+
import_react_native19.Animated.timing(pulseAnim, {
|
|
8731
9189
|
toValue: 0,
|
|
8732
9190
|
duration: 700,
|
|
8733
|
-
easing:
|
|
9191
|
+
easing: import_react_native19.Easing.inOut(import_react_native19.Easing.ease),
|
|
8734
9192
|
useNativeDriver: true
|
|
8735
9193
|
})
|
|
8736
9194
|
])
|
|
@@ -8738,15 +9196,15 @@ function VoiceBugInputSheet({
|
|
|
8738
9196
|
loop.start();
|
|
8739
9197
|
return () => loop.stop();
|
|
8740
9198
|
}, [pulseAnim, phase]);
|
|
8741
|
-
const dimAnim = (0,
|
|
8742
|
-
(0,
|
|
8743
|
-
|
|
9199
|
+
const dimAnim = (0, import_react19.useRef)(new import_react_native19.Animated.Value(1)).current;
|
|
9200
|
+
(0, import_react19.useEffect)(() => {
|
|
9201
|
+
import_react_native19.Animated.timing(dimAnim, {
|
|
8744
9202
|
toValue: phase === "recording" ? 0.1 : 1,
|
|
8745
9203
|
duration: 200,
|
|
8746
9204
|
useNativeDriver: true
|
|
8747
9205
|
}).start();
|
|
8748
9206
|
}, [dimAnim, phase]);
|
|
8749
|
-
(0,
|
|
9207
|
+
(0, import_react19.useEffect)(() => {
|
|
8750
9208
|
if (visible) {
|
|
8751
9209
|
setPhase("idle");
|
|
8752
9210
|
setClassification("bug");
|
|
@@ -8762,12 +9220,12 @@ function VoiceBugInputSheet({
|
|
|
8762
9220
|
}
|
|
8763
9221
|
}
|
|
8764
9222
|
}, [visible]);
|
|
8765
|
-
(0,
|
|
9223
|
+
(0, import_react19.useEffect)(() => {
|
|
8766
9224
|
if (phase === "recording" && seconds >= maxSeconds) {
|
|
8767
9225
|
void stop();
|
|
8768
9226
|
}
|
|
8769
9227
|
}, [phase, seconds, maxSeconds]);
|
|
8770
|
-
const start = (0,
|
|
9228
|
+
const start = (0, import_react19.useCallback)(async () => {
|
|
8771
9229
|
setError(null);
|
|
8772
9230
|
setSeconds(0);
|
|
8773
9231
|
meterAnim.setValue(0);
|
|
@@ -8786,7 +9244,7 @@ function VoiceBugInputSheet({
|
|
|
8786
9244
|
);
|
|
8787
9245
|
}
|
|
8788
9246
|
}, [meterAnim]);
|
|
8789
|
-
const stop = (0,
|
|
9247
|
+
const stop = (0, import_react19.useCallback)(async () => {
|
|
8790
9248
|
if (phase !== "recording") return;
|
|
8791
9249
|
if (tickerRef.current) {
|
|
8792
9250
|
clearInterval(tickerRef.current);
|
|
@@ -8822,7 +9280,7 @@ function VoiceBugInputSheet({
|
|
|
8822
9280
|
);
|
|
8823
9281
|
}
|
|
8824
9282
|
}, [phase, tpk, language, meterAnim]);
|
|
8825
|
-
const cancel = (0,
|
|
9283
|
+
const cancel = (0, import_react19.useCallback)(async () => {
|
|
8826
9284
|
if (tickerRef.current) {
|
|
8827
9285
|
clearInterval(tickerRef.current);
|
|
8828
9286
|
tickerRef.current = null;
|
|
@@ -8831,7 +9289,7 @@ function VoiceBugInputSheet({
|
|
|
8831
9289
|
recorderRef.current = null;
|
|
8832
9290
|
onCancel();
|
|
8833
9291
|
}, [onCancel]);
|
|
8834
|
-
const runQuick = (0,
|
|
9292
|
+
const runQuick = (0, import_react19.useCallback)(
|
|
8835
9293
|
async (action) => {
|
|
8836
9294
|
if (phase !== "idle" || !captureScreen) return;
|
|
8837
9295
|
setQuickMode(true);
|
|
@@ -8857,17 +9315,17 @@ function VoiceBugInputSheet({
|
|
|
8857
9315
|
},
|
|
8858
9316
|
[phase, captureScreen, tpk, currentScreen, language, S]
|
|
8859
9317
|
);
|
|
8860
|
-
const useResult = (0,
|
|
9318
|
+
const useResult = (0, import_react19.useCallback)(() => {
|
|
8861
9319
|
if (result) onExtracted(result, classification);
|
|
8862
9320
|
}, [result, classification, onExtracted]);
|
|
8863
|
-
const retryFresh = (0,
|
|
9321
|
+
const retryFresh = (0, import_react19.useCallback)(() => {
|
|
8864
9322
|
setQuickMode(false);
|
|
8865
9323
|
setResult(null);
|
|
8866
9324
|
setSeconds(0);
|
|
8867
9325
|
setError(null);
|
|
8868
9326
|
setPhase("idle");
|
|
8869
9327
|
}, []);
|
|
8870
|
-
const headline = (0,
|
|
9328
|
+
const headline = (0, import_react19.useMemo)(() => {
|
|
8871
9329
|
switch (phase) {
|
|
8872
9330
|
case "idle":
|
|
8873
9331
|
return S.idleHeadline;
|
|
@@ -8881,7 +9339,7 @@ function VoiceBugInputSheet({
|
|
|
8881
9339
|
return S.errorHeadline;
|
|
8882
9340
|
}
|
|
8883
9341
|
}, [phase, S]);
|
|
8884
|
-
const description = (0,
|
|
9342
|
+
const description = (0, import_react19.useMemo)(() => {
|
|
8885
9343
|
switch (phase) {
|
|
8886
9344
|
case "idle":
|
|
8887
9345
|
return S.idleDescription;
|
|
@@ -8895,7 +9353,7 @@ function VoiceBugInputSheet({
|
|
|
8895
9353
|
return error ?? S.errorDescriptionFallback;
|
|
8896
9354
|
}
|
|
8897
9355
|
}, [phase, error, S, quickMode]);
|
|
8898
|
-
const classificationLabel = (0,
|
|
9356
|
+
const classificationLabel = (0, import_react19.useCallback)(
|
|
8899
9357
|
(c) => {
|
|
8900
9358
|
switch (c) {
|
|
8901
9359
|
case "bug":
|
|
@@ -8910,7 +9368,7 @@ function VoiceBugInputSheet({
|
|
|
8910
9368
|
},
|
|
8911
9369
|
[S]
|
|
8912
9370
|
);
|
|
8913
|
-
const languageLabel = (0,
|
|
9371
|
+
const languageLabel = (0, import_react19.useCallback)(
|
|
8914
9372
|
(l, s) => {
|
|
8915
9373
|
if (l === "auto") return s.languagePickerLabel;
|
|
8916
9374
|
return l.toUpperCase();
|
|
@@ -8929,33 +9387,35 @@ function VoiceBugInputSheet({
|
|
|
8929
9387
|
const isExtracted = phase === "extracted";
|
|
8930
9388
|
const isError = phase === "error";
|
|
8931
9389
|
const opacity = Math.max(0, Math.min(1, sheetOpacity));
|
|
8932
|
-
const
|
|
8933
|
-
const
|
|
8934
|
-
|
|
8935
|
-
|
|
9390
|
+
const backdropAlpha = isRecording ? 0.08 : 0.55 * opacity;
|
|
9391
|
+
const sheetAlpha = isRecording ? 0.15 : opacity;
|
|
9392
|
+
const backdropOverride = { backgroundColor: `rgba(0,0,0,${backdropAlpha})` };
|
|
9393
|
+
const sheetOverride = { backgroundColor: `rgba(17,24,39,${sheetAlpha})` };
|
|
9394
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
9395
|
+
import_react_native19.Modal,
|
|
8936
9396
|
{
|
|
8937
9397
|
animationType: "slide",
|
|
8938
9398
|
onRequestClose: isUploading ? void 0 : cancel,
|
|
8939
9399
|
transparent: true,
|
|
8940
9400
|
visible
|
|
8941
9401
|
},
|
|
8942
|
-
/* @__PURE__ */
|
|
8943
|
-
|
|
9402
|
+
/* @__PURE__ */ import_react19.default.createElement(import_react_native19.View, { style: [styles13.backdrop, backdropOverride, style], testID }, /* @__PURE__ */ import_react19.default.createElement(
|
|
9403
|
+
import_react_native19.Pressable,
|
|
8944
9404
|
{
|
|
8945
9405
|
accessibilityRole: "button",
|
|
8946
9406
|
accessibilityLabel: S.cancel,
|
|
8947
9407
|
disabled: isUploading,
|
|
8948
9408
|
onPress: () => void cancel(),
|
|
8949
|
-
style:
|
|
9409
|
+
style: styles13.backdropSpacer
|
|
8950
9410
|
}
|
|
8951
|
-
), /* @__PURE__ */
|
|
8952
|
-
|
|
9411
|
+
), /* @__PURE__ */ import_react19.default.createElement(import_react_native19.View, { style: [styles13.sheet, sheetOverride] }, /* @__PURE__ */ import_react19.default.createElement(import_react_native19.View, { style: styles13.grabber }), /* @__PURE__ */ import_react19.default.createElement(
|
|
9412
|
+
import_react_native19.Animated.View,
|
|
8953
9413
|
{
|
|
8954
|
-
style: [
|
|
9414
|
+
style: [styles13.dimmable, { opacity: dimAnim }],
|
|
8955
9415
|
pointerEvents: isRecording ? "none" : "auto"
|
|
8956
9416
|
},
|
|
8957
|
-
/* @__PURE__ */
|
|
8958
|
-
|
|
9417
|
+
/* @__PURE__ */ import_react19.default.createElement(import_react_native19.View, { style: styles13.languagePickerRow }, /* @__PURE__ */ import_react19.default.createElement(
|
|
9418
|
+
import_react_native19.Pressable,
|
|
8959
9419
|
{
|
|
8960
9420
|
accessibilityRole: "button",
|
|
8961
9421
|
accessibilityLabel: `Current language: ${languageLabel(language, S)}. Tap to change.`,
|
|
@@ -8965,22 +9425,22 @@ function VoiceBugInputSheet({
|
|
|
8965
9425
|
(cur) => cur === "auto" ? "de" : cur === "de" ? "en" : "auto"
|
|
8966
9426
|
);
|
|
8967
9427
|
},
|
|
8968
|
-
style: [
|
|
9428
|
+
style: [styles13.languageChip, !isIdle && { opacity: 0.5 }]
|
|
8969
9429
|
},
|
|
8970
|
-
/* @__PURE__ */
|
|
8971
|
-
/* @__PURE__ */
|
|
9430
|
+
/* @__PURE__ */ import_react19.default.createElement(TpkIcon, { name: "language", size: 14, color: "#475569" }),
|
|
9431
|
+
/* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: styles13.languageChipLabel }, languageLabel(language, S))
|
|
8972
9432
|
)),
|
|
8973
|
-
/* @__PURE__ */
|
|
8974
|
-
|
|
9433
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
9434
|
+
import_react_native19.ScrollView,
|
|
8975
9435
|
{
|
|
8976
9436
|
horizontal: true,
|
|
8977
9437
|
showsHorizontalScrollIndicator: false,
|
|
8978
|
-
contentContainerStyle:
|
|
9438
|
+
contentContainerStyle: styles13.classificationRow
|
|
8979
9439
|
},
|
|
8980
9440
|
CLASSIFICATIONS.map((c) => {
|
|
8981
9441
|
const active = classification === c;
|
|
8982
|
-
return /* @__PURE__ */
|
|
8983
|
-
|
|
9442
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
9443
|
+
import_react_native19.Pressable,
|
|
8984
9444
|
{
|
|
8985
9445
|
key: c,
|
|
8986
9446
|
accessibilityRole: "radio",
|
|
@@ -8989,7 +9449,7 @@ function VoiceBugInputSheet({
|
|
|
8989
9449
|
disabled: !isIdle,
|
|
8990
9450
|
onPress: () => setClassification(c),
|
|
8991
9451
|
style: [
|
|
8992
|
-
|
|
9452
|
+
styles13.classificationChip,
|
|
8993
9453
|
active && {
|
|
8994
9454
|
backgroundColor: accentColor,
|
|
8995
9455
|
borderColor: accentColor
|
|
@@ -8997,7 +9457,7 @@ function VoiceBugInputSheet({
|
|
|
8997
9457
|
!isIdle && { opacity: 0.5 }
|
|
8998
9458
|
]
|
|
8999
9459
|
},
|
|
9000
|
-
active && /* @__PURE__ */
|
|
9460
|
+
active && /* @__PURE__ */ import_react19.default.createElement(
|
|
9001
9461
|
TpkIcon,
|
|
9002
9462
|
{
|
|
9003
9463
|
name: "check",
|
|
@@ -9006,12 +9466,12 @@ function VoiceBugInputSheet({
|
|
|
9006
9466
|
style: { marginRight: 4 }
|
|
9007
9467
|
}
|
|
9008
9468
|
),
|
|
9009
|
-
/* @__PURE__ */
|
|
9010
|
-
|
|
9469
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
9470
|
+
import_react_native19.Text,
|
|
9011
9471
|
{
|
|
9012
9472
|
style: [
|
|
9013
|
-
|
|
9014
|
-
active &&
|
|
9473
|
+
styles13.classificationChipLabel,
|
|
9474
|
+
active && styles13.classificationChipLabelActive
|
|
9015
9475
|
]
|
|
9016
9476
|
},
|
|
9017
9477
|
classificationLabel(c)
|
|
@@ -9019,13 +9479,13 @@ function VoiceBugInputSheet({
|
|
|
9019
9479
|
);
|
|
9020
9480
|
})
|
|
9021
9481
|
),
|
|
9022
|
-
/* @__PURE__ */
|
|
9023
|
-
/* @__PURE__ */
|
|
9024
|
-
), isRecording && /* @__PURE__ */
|
|
9025
|
-
|
|
9482
|
+
/* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: styles13.headline }, headline),
|
|
9483
|
+
/* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: styles13.description }, description)
|
|
9484
|
+
), isRecording && /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: [styles13.timer, { color: accentColor }] }, formatTime(seconds)), /* @__PURE__ */ import_react19.default.createElement(import_react_native19.View, { style: styles13.meterTrack }, /* @__PURE__ */ import_react19.default.createElement(
|
|
9485
|
+
import_react_native19.Animated.View,
|
|
9026
9486
|
{
|
|
9027
9487
|
style: [
|
|
9028
|
-
|
|
9488
|
+
styles13.meterFill,
|
|
9029
9489
|
{
|
|
9030
9490
|
backgroundColor: accentColor,
|
|
9031
9491
|
transform: [
|
|
@@ -9039,38 +9499,38 @@ function VoiceBugInputSheet({
|
|
|
9039
9499
|
}
|
|
9040
9500
|
]
|
|
9041
9501
|
}
|
|
9042
|
-
))), isExtracted && result && /* @__PURE__ */
|
|
9043
|
-
|
|
9502
|
+
))), isExtracted && result && /* @__PURE__ */ import_react19.default.createElement(
|
|
9503
|
+
import_react_native19.ScrollView,
|
|
9044
9504
|
{
|
|
9045
|
-
style:
|
|
9046
|
-
contentContainerStyle:
|
|
9505
|
+
style: styles13.extractedScroll,
|
|
9506
|
+
contentContainerStyle: styles13.extractedScrollContent
|
|
9047
9507
|
},
|
|
9048
|
-
quickMode ? null : /* @__PURE__ */
|
|
9049
|
-
/* @__PURE__ */
|
|
9050
|
-
/* @__PURE__ */
|
|
9508
|
+
quickMode ? null : /* @__PURE__ */ import_react19.default.createElement(import_react_native19.View, { style: styles13.transcriptCard }, /* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: styles13.transcriptLabel }, "Transcript"), /* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: styles13.transcriptText }, result.transcript || "(empty)")),
|
|
9509
|
+
/* @__PURE__ */ import_react19.default.createElement(ExtractField, { label: "Title", value: result.title }),
|
|
9510
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
9051
9511
|
ExtractField,
|
|
9052
9512
|
{
|
|
9053
9513
|
label: "Description",
|
|
9054
9514
|
value: result.description
|
|
9055
9515
|
}
|
|
9056
9516
|
),
|
|
9057
|
-
/* @__PURE__ */
|
|
9517
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
9058
9518
|
ExtractField,
|
|
9059
9519
|
{
|
|
9060
9520
|
label: "Expected",
|
|
9061
9521
|
value: result.expectedBehavior
|
|
9062
9522
|
}
|
|
9063
9523
|
),
|
|
9064
|
-
/* @__PURE__ */
|
|
9524
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
9065
9525
|
ExtractField,
|
|
9066
9526
|
{
|
|
9067
9527
|
label: "Actual",
|
|
9068
9528
|
value: result.actualBehavior
|
|
9069
9529
|
}
|
|
9070
9530
|
),
|
|
9071
|
-
/* @__PURE__ */
|
|
9072
|
-
), isIdle && captureScreen ? /* @__PURE__ */
|
|
9073
|
-
|
|
9531
|
+
/* @__PURE__ */ import_react19.default.createElement(ExtractField, { label: "Frequency", value: result.frequency })
|
|
9532
|
+
), isIdle && captureScreen ? /* @__PURE__ */ import_react19.default.createElement(import_react_native19.View, { style: styles13.quickBlock }, /* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: styles13.quickHint }, S.quickHint), /* @__PURE__ */ import_react19.default.createElement(import_react_native19.View, { style: styles13.quickGrid }, QUICK_ACTIONS.map((a) => /* @__PURE__ */ import_react19.default.createElement(
|
|
9533
|
+
import_react_native19.Pressable,
|
|
9074
9534
|
{
|
|
9075
9535
|
key: a.kind,
|
|
9076
9536
|
accessibilityRole: "button",
|
|
@@ -9078,29 +9538,29 @@ function VoiceBugInputSheet({
|
|
|
9078
9538
|
testID: `tpk-quick-${a.kind}`,
|
|
9079
9539
|
onPress: () => void runQuick(a),
|
|
9080
9540
|
style: ({ pressed }) => [
|
|
9081
|
-
|
|
9541
|
+
styles13.quickButton,
|
|
9082
9542
|
pressed && { opacity: 0.8 }
|
|
9083
9543
|
]
|
|
9084
9544
|
},
|
|
9085
|
-
/* @__PURE__ */
|
|
9086
|
-
/* @__PURE__ */
|
|
9087
|
-
)))) : null, /* @__PURE__ */
|
|
9088
|
-
|
|
9545
|
+
/* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: styles13.quickEmoji }, a.emoji),
|
|
9546
|
+
/* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: styles13.quickLabel }, S[a.label])
|
|
9547
|
+
)))) : null, /* @__PURE__ */ import_react19.default.createElement(import_react_native19.View, { style: styles13.primaryRow }, isIdle && /* @__PURE__ */ import_react19.default.createElement(
|
|
9548
|
+
import_react_native19.Pressable,
|
|
9089
9549
|
{
|
|
9090
9550
|
accessibilityRole: "button",
|
|
9091
9551
|
accessibilityLabel: "Start recording",
|
|
9092
9552
|
onPress: () => void start(),
|
|
9093
9553
|
style: [
|
|
9094
|
-
|
|
9554
|
+
styles13.micButton,
|
|
9095
9555
|
{ backgroundColor: accentColor, shadowColor: accentColor }
|
|
9096
9556
|
]
|
|
9097
9557
|
},
|
|
9098
|
-
/* @__PURE__ */
|
|
9099
|
-
), isRecording && /* @__PURE__ */
|
|
9100
|
-
|
|
9558
|
+
/* @__PURE__ */ import_react19.default.createElement(TpkIcon, { name: "voice", size: 42, color: "#FFFFFF" })
|
|
9559
|
+
), isRecording && /* @__PURE__ */ import_react19.default.createElement(
|
|
9560
|
+
import_react_native19.Animated.View,
|
|
9101
9561
|
{
|
|
9102
9562
|
style: [
|
|
9103
|
-
|
|
9563
|
+
styles13.micButton,
|
|
9104
9564
|
{
|
|
9105
9565
|
backgroundColor: accentColor,
|
|
9106
9566
|
shadowColor: accentColor,
|
|
@@ -9108,49 +9568,49 @@ function VoiceBugInputSheet({
|
|
|
9108
9568
|
}
|
|
9109
9569
|
]
|
|
9110
9570
|
},
|
|
9111
|
-
/* @__PURE__ */
|
|
9112
|
-
|
|
9113
|
-
{
|
|
9571
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
9572
|
+
import_react_native19.Pressable,
|
|
9573
|
+
{
|
|
9114
9574
|
accessibilityRole: "button",
|
|
9115
9575
|
accessibilityLabel: "Stop recording",
|
|
9116
9576
|
onPress: () => void stop(),
|
|
9117
|
-
style:
|
|
9577
|
+
style: styles13.micPressable
|
|
9118
9578
|
},
|
|
9119
|
-
/* @__PURE__ */
|
|
9579
|
+
/* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: styles13.micButtonStop }, "\u25A0")
|
|
9120
9580
|
)
|
|
9121
|
-
), isUploading && /* @__PURE__ */
|
|
9122
|
-
|
|
9581
|
+
), isUploading && /* @__PURE__ */ import_react19.default.createElement(import_react_native19.View, { style: styles13.spinnerSlot }, /* @__PURE__ */ import_react19.default.createElement(import_react_native19.ActivityIndicator, { size: "large", color: accentColor })), (isExtracted || isError) && /* @__PURE__ */ import_react19.default.createElement(import_react_native19.View, { style: styles13.actionsRow }, /* @__PURE__ */ import_react19.default.createElement(
|
|
9582
|
+
import_react_native19.Pressable,
|
|
9123
9583
|
{
|
|
9124
9584
|
accessibilityRole: "button",
|
|
9125
9585
|
onPress: retryFresh,
|
|
9126
9586
|
style: ({ pressed }) => [
|
|
9127
|
-
|
|
9587
|
+
styles13.secondaryButton,
|
|
9128
9588
|
pressed && { opacity: 0.85 }
|
|
9129
9589
|
]
|
|
9130
9590
|
},
|
|
9131
|
-
/* @__PURE__ */
|
|
9132
|
-
), isExtracted && /* @__PURE__ */
|
|
9133
|
-
|
|
9591
|
+
/* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: styles13.secondaryButtonLabel }, quickMode ? S.back : isError ? S.retry : S.rerecord)
|
|
9592
|
+
), isExtracted && /* @__PURE__ */ import_react19.default.createElement(
|
|
9593
|
+
import_react_native19.Pressable,
|
|
9134
9594
|
{
|
|
9135
9595
|
accessibilityRole: "button",
|
|
9136
9596
|
accessibilityLabel: S.useExtracted,
|
|
9137
9597
|
onPress: useResult,
|
|
9138
9598
|
style: ({ pressed }) => [
|
|
9139
|
-
|
|
9599
|
+
styles13.primaryButton,
|
|
9140
9600
|
{ backgroundColor: accentColor },
|
|
9141
9601
|
pressed && { opacity: 0.85 }
|
|
9142
9602
|
]
|
|
9143
9603
|
},
|
|
9144
|
-
/* @__PURE__ */
|
|
9145
|
-
))), /* @__PURE__ */
|
|
9146
|
-
|
|
9604
|
+
/* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: styles13.primaryButtonLabel }, S.useExtracted)
|
|
9605
|
+
))), /* @__PURE__ */ import_react19.default.createElement(
|
|
9606
|
+
import_react_native19.Pressable,
|
|
9147
9607
|
{
|
|
9148
9608
|
accessibilityRole: "button",
|
|
9149
9609
|
disabled: isUploading,
|
|
9150
9610
|
onPress: () => void cancel(),
|
|
9151
|
-
style:
|
|
9611
|
+
style: styles13.cancelButton
|
|
9152
9612
|
},
|
|
9153
|
-
/* @__PURE__ */
|
|
9613
|
+
/* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: [styles13.cancelLabel, { color: accentColor }] }, S.cancel)
|
|
9154
9614
|
)))
|
|
9155
9615
|
);
|
|
9156
9616
|
}
|
|
@@ -9158,20 +9618,20 @@ function ExtractField({
|
|
|
9158
9618
|
label,
|
|
9159
9619
|
value
|
|
9160
9620
|
}) {
|
|
9161
|
-
return /* @__PURE__ */
|
|
9621
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_react_native19.View, { style: styles13.extractRow }, /* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: styles13.extractLabel }, label), /* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: styles13.extractValue }, value || "\u2014"));
|
|
9162
9622
|
}
|
|
9163
9623
|
async function startRecording(opts = {}) {
|
|
9164
|
-
if (
|
|
9624
|
+
if (import_react_native19.Platform.OS === "web") return startWebRecording(opts);
|
|
9165
9625
|
return startNativeRecording();
|
|
9166
9626
|
}
|
|
9167
9627
|
async function stopRecording(handle) {
|
|
9168
|
-
if (
|
|
9628
|
+
if (import_react_native19.Platform.OS === "web") return stopWebRecording(handle);
|
|
9169
9629
|
return stopNativeRecording(handle);
|
|
9170
9630
|
}
|
|
9171
9631
|
async function cleanupRecorder(handle) {
|
|
9172
9632
|
if (!handle) return;
|
|
9173
9633
|
try {
|
|
9174
|
-
if (
|
|
9634
|
+
if (import_react_native19.Platform.OS === "web") {
|
|
9175
9635
|
const w = handle;
|
|
9176
9636
|
w.stopMeter?.();
|
|
9177
9637
|
w.mediaRecorder.stream.getTracks().forEach((t) => t.stop());
|
|
@@ -9277,7 +9737,7 @@ async function startNativeRecording() {
|
|
|
9277
9737
|
});
|
|
9278
9738
|
} catch {
|
|
9279
9739
|
}
|
|
9280
|
-
const rec = new Recorder(nativeRecordingOptions(mod,
|
|
9740
|
+
const rec = new Recorder(nativeRecordingOptions(mod, import_react_native19.Platform.OS));
|
|
9281
9741
|
await rec.prepareToRecordAsync();
|
|
9282
9742
|
rec.record();
|
|
9283
9743
|
return rec;
|
|
@@ -9337,7 +9797,7 @@ function formatTime(seconds) {
|
|
|
9337
9797
|
const s = (seconds % 60).toString().padStart(2, "0");
|
|
9338
9798
|
return `${m}:${s}`;
|
|
9339
9799
|
}
|
|
9340
|
-
var
|
|
9800
|
+
var styles13 = import_react_native19.StyleSheet.create({
|
|
9341
9801
|
backdrop: {
|
|
9342
9802
|
flex: 1,
|
|
9343
9803
|
backgroundColor: "rgba(0,0,0,0.55)",
|
|
@@ -9585,7 +10045,7 @@ var styles12 = import_react_native18.StyleSheet.create({
|
|
|
9585
10045
|
},
|
|
9586
10046
|
extractRow: {
|
|
9587
10047
|
paddingVertical: 8,
|
|
9588
|
-
borderBottomWidth:
|
|
10048
|
+
borderBottomWidth: import_react_native19.StyleSheet.hairlineWidth,
|
|
9589
10049
|
borderBottomColor: "rgba(255,255,255,0.1)"
|
|
9590
10050
|
},
|
|
9591
10051
|
extractLabel: {
|
|
@@ -9604,8 +10064,8 @@ var styles12 = import_react_native18.StyleSheet.create({
|
|
|
9604
10064
|
});
|
|
9605
10065
|
|
|
9606
10066
|
// src/SessionEndDialog.tsx
|
|
9607
|
-
var
|
|
9608
|
-
var
|
|
10067
|
+
var import_react20 = __toESM(require("react"));
|
|
10068
|
+
var import_react_native20 = require("react-native");
|
|
9609
10069
|
var ISSUE_KEYS = ["bugs", "crashes", "performance", "ui"];
|
|
9610
10070
|
var ISSUE_LABELS = {
|
|
9611
10071
|
bugs: "Bugs / unexpected behaviour",
|
|
@@ -9687,24 +10147,24 @@ function SessionEndDialog({
|
|
|
9687
10147
|
style
|
|
9688
10148
|
}) {
|
|
9689
10149
|
const t = STRINGS7[useTpkLanguage()];
|
|
9690
|
-
const [ratings, setRatings] = (0,
|
|
10150
|
+
const [ratings, setRatings] = (0, import_react20.useState)({
|
|
9691
10151
|
overall: 3,
|
|
9692
10152
|
stability: 3,
|
|
9693
10153
|
usability: 3,
|
|
9694
10154
|
experience: 3
|
|
9695
10155
|
});
|
|
9696
|
-
const [issues, setIssues] = (0,
|
|
10156
|
+
const [issues, setIssues] = (0, import_react20.useState)({
|
|
9697
10157
|
bugs: false,
|
|
9698
10158
|
crashes: false,
|
|
9699
10159
|
performance: false,
|
|
9700
10160
|
ui: false
|
|
9701
10161
|
});
|
|
9702
|
-
const [positive, setPositive] = (0,
|
|
9703
|
-
const [negative, setNegative] = (0,
|
|
9704
|
-
const [suggestions, setSuggestions] = (0,
|
|
9705
|
-
const [submitting, setSubmitting] = (0,
|
|
9706
|
-
const [error, setError] = (0,
|
|
9707
|
-
(0,
|
|
10162
|
+
const [positive, setPositive] = (0, import_react20.useState)("");
|
|
10163
|
+
const [negative, setNegative] = (0, import_react20.useState)("");
|
|
10164
|
+
const [suggestions, setSuggestions] = (0, import_react20.useState)("");
|
|
10165
|
+
const [submitting, setSubmitting] = (0, import_react20.useState)(false);
|
|
10166
|
+
const [error, setError] = (0, import_react20.useState)(null);
|
|
10167
|
+
(0, import_react20.useEffect)(() => {
|
|
9708
10168
|
if (visible) {
|
|
9709
10169
|
setRatings({ overall: 3, stability: 3, usability: 3, experience: 3 });
|
|
9710
10170
|
setIssues({ bugs: false, crashes: false, performance: false, ui: false });
|
|
@@ -9714,13 +10174,13 @@ function SessionEndDialog({
|
|
|
9714
10174
|
setError(null);
|
|
9715
10175
|
}
|
|
9716
10176
|
}, [visible]);
|
|
9717
|
-
const hasFeedback = (0,
|
|
10177
|
+
const hasFeedback = (0, import_react20.useMemo)(() => {
|
|
9718
10178
|
if (positive.trim() || negative.trim() || suggestions.trim()) return true;
|
|
9719
10179
|
if (Object.values(issues).some(Boolean)) return true;
|
|
9720
10180
|
if (Object.values(ratings).some((r) => r !== 3)) return true;
|
|
9721
10181
|
return false;
|
|
9722
10182
|
}, [positive, negative, suggestions, issues, ratings]);
|
|
9723
|
-
const submit = (0,
|
|
10183
|
+
const submit = (0, import_react20.useCallback)(async () => {
|
|
9724
10184
|
if (!tpk) return;
|
|
9725
10185
|
setSubmitting(true);
|
|
9726
10186
|
setError(null);
|
|
@@ -9776,41 +10236,41 @@ function SessionEndDialog({
|
|
|
9776
10236
|
onError,
|
|
9777
10237
|
t
|
|
9778
10238
|
]);
|
|
9779
|
-
return /* @__PURE__ */
|
|
9780
|
-
|
|
10239
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
10240
|
+
import_react_native20.Modal,
|
|
9781
10241
|
{
|
|
9782
10242
|
animationType: "slide",
|
|
9783
10243
|
onRequestClose: submitting ? void 0 : onClose,
|
|
9784
10244
|
transparent: false,
|
|
9785
10245
|
visible
|
|
9786
10246
|
},
|
|
9787
|
-
/* @__PURE__ */
|
|
9788
|
-
|
|
10247
|
+
/* @__PURE__ */ import_react20.default.createElement(import_react_native20.View, { style: [styles14.root, style] }, /* @__PURE__ */ import_react20.default.createElement(
|
|
10248
|
+
import_react_native20.View,
|
|
9789
10249
|
{
|
|
9790
|
-
style: [
|
|
10250
|
+
style: [styles14.header, { paddingTop: 12 + getModalInsets().top }]
|
|
9791
10251
|
},
|
|
9792
|
-
/* @__PURE__ */
|
|
9793
|
-
|
|
10252
|
+
/* @__PURE__ */ import_react20.default.createElement(
|
|
10253
|
+
import_react_native20.Pressable,
|
|
9794
10254
|
{
|
|
9795
10255
|
accessibilityRole: "button",
|
|
9796
10256
|
accessibilityLabel: t.cancel,
|
|
9797
10257
|
disabled: submitting,
|
|
9798
10258
|
onPress: onClose,
|
|
9799
|
-
style:
|
|
10259
|
+
style: styles14.headerClose
|
|
9800
10260
|
},
|
|
9801
|
-
/* @__PURE__ */
|
|
10261
|
+
/* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.headerCloseLabel }, "\xD7")
|
|
9802
10262
|
),
|
|
9803
|
-
/* @__PURE__ */
|
|
9804
|
-
/* @__PURE__ */
|
|
9805
|
-
), /* @__PURE__ */
|
|
9806
|
-
|
|
10263
|
+
/* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.headerTitle }, t.title),
|
|
10264
|
+
/* @__PURE__ */ import_react20.default.createElement(import_react_native20.View, { style: { width: 36 } })
|
|
10265
|
+
), /* @__PURE__ */ import_react20.default.createElement(
|
|
10266
|
+
import_react_native20.ScrollView,
|
|
9807
10267
|
{
|
|
9808
|
-
contentContainerStyle:
|
|
10268
|
+
contentContainerStyle: styles14.body,
|
|
9809
10269
|
keyboardShouldPersistTaps: "handled"
|
|
9810
10270
|
},
|
|
9811
|
-
/* @__PURE__ */
|
|
9812
|
-
/* @__PURE__ */
|
|
9813
|
-
RATING_KEYS.map((k) => /* @__PURE__ */
|
|
10271
|
+
/* @__PURE__ */ import_react20.default.createElement(StatsSection, { stats, t }),
|
|
10272
|
+
/* @__PURE__ */ import_react20.default.createElement(SectionLabel, { text: t.howWasIt }),
|
|
10273
|
+
RATING_KEYS.map((k) => /* @__PURE__ */ import_react20.default.createElement(
|
|
9814
10274
|
RatingRow,
|
|
9815
10275
|
{
|
|
9816
10276
|
key: k,
|
|
@@ -9820,8 +10280,8 @@ function SessionEndDialog({
|
|
|
9820
10280
|
onChange: (v) => setRatings((cur) => ({ ...cur, [k]: v }))
|
|
9821
10281
|
}
|
|
9822
10282
|
)),
|
|
9823
|
-
/* @__PURE__ */
|
|
9824
|
-
ISSUE_KEYS.map((k) => /* @__PURE__ */
|
|
10283
|
+
/* @__PURE__ */ import_react20.default.createElement(SectionLabel, { text: t.didYouEncounter }),
|
|
10284
|
+
ISSUE_KEYS.map((k) => /* @__PURE__ */ import_react20.default.createElement(
|
|
9825
10285
|
IssueRow,
|
|
9826
10286
|
{
|
|
9827
10287
|
key: k,
|
|
@@ -9830,78 +10290,78 @@ function SessionEndDialog({
|
|
|
9830
10290
|
onChange: (v) => setIssues((cur) => ({ ...cur, [k]: v }))
|
|
9831
10291
|
}
|
|
9832
10292
|
)),
|
|
9833
|
-
/* @__PURE__ */
|
|
9834
|
-
/* @__PURE__ */
|
|
9835
|
-
/* @__PURE__ */
|
|
9836
|
-
|
|
10293
|
+
/* @__PURE__ */ import_react20.default.createElement(SectionLabel, { text: t.comments }),
|
|
10294
|
+
/* @__PURE__ */ import_react20.default.createElement(FieldLabel2, { text: t.positiveLabel }),
|
|
10295
|
+
/* @__PURE__ */ import_react20.default.createElement(
|
|
10296
|
+
import_react_native20.TextInput,
|
|
9837
10297
|
{
|
|
9838
10298
|
multiline: true,
|
|
9839
10299
|
onChangeText: setPositive,
|
|
9840
10300
|
placeholder: t.positivePlaceholder,
|
|
9841
|
-
style: [
|
|
10301
|
+
style: [styles14.input, styles14.textarea],
|
|
9842
10302
|
textAlignVertical: "top",
|
|
9843
10303
|
value: positive
|
|
9844
10304
|
}
|
|
9845
10305
|
),
|
|
9846
|
-
/* @__PURE__ */
|
|
9847
|
-
/* @__PURE__ */
|
|
9848
|
-
|
|
10306
|
+
/* @__PURE__ */ import_react20.default.createElement(FieldLabel2, { text: t.negativeLabel }),
|
|
10307
|
+
/* @__PURE__ */ import_react20.default.createElement(
|
|
10308
|
+
import_react_native20.TextInput,
|
|
9849
10309
|
{
|
|
9850
10310
|
multiline: true,
|
|
9851
10311
|
onChangeText: setNegative,
|
|
9852
10312
|
placeholder: t.negativePlaceholder,
|
|
9853
|
-
style: [
|
|
10313
|
+
style: [styles14.input, styles14.textarea],
|
|
9854
10314
|
textAlignVertical: "top",
|
|
9855
10315
|
value: negative
|
|
9856
10316
|
}
|
|
9857
10317
|
),
|
|
9858
|
-
/* @__PURE__ */
|
|
9859
|
-
/* @__PURE__ */
|
|
9860
|
-
|
|
10318
|
+
/* @__PURE__ */ import_react20.default.createElement(FieldLabel2, { text: t.suggestionsLabel }),
|
|
10319
|
+
/* @__PURE__ */ import_react20.default.createElement(
|
|
10320
|
+
import_react_native20.TextInput,
|
|
9861
10321
|
{
|
|
9862
10322
|
multiline: true,
|
|
9863
10323
|
onChangeText: setSuggestions,
|
|
9864
10324
|
placeholder: t.suggestionsPlaceholder,
|
|
9865
|
-
style: [
|
|
10325
|
+
style: [styles14.input, styles14.textarea],
|
|
9866
10326
|
textAlignVertical: "top",
|
|
9867
10327
|
value: suggestions
|
|
9868
10328
|
}
|
|
9869
10329
|
),
|
|
9870
|
-
error && /* @__PURE__ */
|
|
9871
|
-
), /* @__PURE__ */
|
|
9872
|
-
|
|
10330
|
+
error && /* @__PURE__ */ import_react20.default.createElement(import_react_native20.View, { style: styles14.errorBox }, /* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.errorLabel }, error))
|
|
10331
|
+
), /* @__PURE__ */ import_react20.default.createElement(
|
|
10332
|
+
import_react_native20.View,
|
|
9873
10333
|
{
|
|
9874
10334
|
style: [
|
|
9875
|
-
|
|
10335
|
+
styles14.footer,
|
|
9876
10336
|
{ paddingBottom: Math.max(14, getModalInsets().bottom) }
|
|
9877
10337
|
]
|
|
9878
10338
|
},
|
|
9879
|
-
/* @__PURE__ */
|
|
9880
|
-
|
|
10339
|
+
/* @__PURE__ */ import_react20.default.createElement(
|
|
10340
|
+
import_react_native20.Pressable,
|
|
9881
10341
|
{
|
|
9882
10342
|
accessibilityRole: "button",
|
|
9883
10343
|
disabled: submitting,
|
|
9884
10344
|
onPress: onClose,
|
|
9885
10345
|
style: ({ pressed }) => [
|
|
9886
|
-
|
|
10346
|
+
styles14.cancelButton,
|
|
9887
10347
|
pressed && { opacity: 0.7 }
|
|
9888
10348
|
]
|
|
9889
10349
|
},
|
|
9890
|
-
/* @__PURE__ */
|
|
10350
|
+
/* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.cancelLabel }, t.cancel)
|
|
9891
10351
|
),
|
|
9892
|
-
/* @__PURE__ */
|
|
9893
|
-
|
|
10352
|
+
/* @__PURE__ */ import_react20.default.createElement(
|
|
10353
|
+
import_react_native20.Pressable,
|
|
9894
10354
|
{
|
|
9895
10355
|
accessibilityRole: "button",
|
|
9896
10356
|
disabled: !tpk || submitting,
|
|
9897
10357
|
onPress: () => void submit(),
|
|
9898
10358
|
style: ({ pressed }) => [
|
|
9899
|
-
|
|
9900
|
-
(!tpk || submitting) &&
|
|
10359
|
+
styles14.endButton,
|
|
10360
|
+
(!tpk || submitting) && styles14.endButtonDisabled,
|
|
9901
10361
|
pressed && { opacity: 0.85 }
|
|
9902
10362
|
]
|
|
9903
10363
|
},
|
|
9904
|
-
submitting ? /* @__PURE__ */
|
|
10364
|
+
submitting ? /* @__PURE__ */ import_react20.default.createElement(import_react_native20.ActivityIndicator, { color: "#FAFAF7" }) : /* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.endLabel }, t.endSession)
|
|
9905
10365
|
)
|
|
9906
10366
|
))
|
|
9907
10367
|
);
|
|
@@ -9911,19 +10371,19 @@ function StatsSection({
|
|
|
9911
10371
|
t
|
|
9912
10372
|
}) {
|
|
9913
10373
|
const duration = stats?.durationSeconds ?? 0;
|
|
9914
|
-
return /* @__PURE__ */
|
|
10374
|
+
return /* @__PURE__ */ import_react20.default.createElement(import_react_native20.View, { style: styles14.statsGrid }, /* @__PURE__ */ import_react20.default.createElement(StatTile, { label: t.statDuration, value: formatDuration(duration) }), /* @__PURE__ */ import_react20.default.createElement(
|
|
9915
10375
|
StatTile,
|
|
9916
10376
|
{
|
|
9917
10377
|
label: t.statScreens,
|
|
9918
10378
|
value: String(stats?.screensVisited ?? 0)
|
|
9919
10379
|
}
|
|
9920
|
-
), /* @__PURE__ */
|
|
10380
|
+
), /* @__PURE__ */ import_react20.default.createElement(
|
|
9921
10381
|
StatTile,
|
|
9922
10382
|
{
|
|
9923
10383
|
label: t.statBugs,
|
|
9924
10384
|
value: String(stats?.bugsReported ?? 0)
|
|
9925
10385
|
}
|
|
9926
|
-
), /* @__PURE__ */
|
|
10386
|
+
), /* @__PURE__ */ import_react20.default.createElement(
|
|
9927
10387
|
StatTile,
|
|
9928
10388
|
{
|
|
9929
10389
|
label: t.statTasks,
|
|
@@ -9935,13 +10395,13 @@ function StatTile({
|
|
|
9935
10395
|
label,
|
|
9936
10396
|
value
|
|
9937
10397
|
}) {
|
|
9938
|
-
return /* @__PURE__ */
|
|
10398
|
+
return /* @__PURE__ */ import_react20.default.createElement(import_react_native20.View, { style: styles14.statTile }, /* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.statValue }, value), /* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.statLabel }, label));
|
|
9939
10399
|
}
|
|
9940
10400
|
function SectionLabel({ text }) {
|
|
9941
|
-
return /* @__PURE__ */
|
|
10401
|
+
return /* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.sectionLabel }, text);
|
|
9942
10402
|
}
|
|
9943
10403
|
function FieldLabel2({ text }) {
|
|
9944
|
-
return /* @__PURE__ */
|
|
10404
|
+
return /* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.fieldLabel }, text);
|
|
9945
10405
|
}
|
|
9946
10406
|
function RatingRow({
|
|
9947
10407
|
label,
|
|
@@ -9949,8 +10409,8 @@ function RatingRow({
|
|
|
9949
10409
|
onChange,
|
|
9950
10410
|
starsA11y
|
|
9951
10411
|
}) {
|
|
9952
|
-
return /* @__PURE__ */
|
|
9953
|
-
|
|
10412
|
+
return /* @__PURE__ */ import_react20.default.createElement(import_react_native20.View, { style: styles14.ratingRow }, /* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.ratingLabel }, label), /* @__PURE__ */ import_react20.default.createElement(import_react_native20.View, { style: styles14.starRow }, [1, 2, 3, 4, 5].map((i) => /* @__PURE__ */ import_react20.default.createElement(
|
|
10413
|
+
import_react_native20.Pressable,
|
|
9954
10414
|
{
|
|
9955
10415
|
key: i,
|
|
9956
10416
|
accessibilityRole: "button",
|
|
@@ -9958,11 +10418,11 @@ function RatingRow({
|
|
|
9958
10418
|
accessibilityState: { selected: value === i },
|
|
9959
10419
|
onPress: () => onChange(i),
|
|
9960
10420
|
style: ({ pressed }) => [
|
|
9961
|
-
|
|
10421
|
+
styles14.starButton,
|
|
9962
10422
|
pressed && { opacity: 0.7 }
|
|
9963
10423
|
]
|
|
9964
10424
|
},
|
|
9965
|
-
/* @__PURE__ */
|
|
10425
|
+
/* @__PURE__ */ import_react20.default.createElement(
|
|
9966
10426
|
TpkIcon,
|
|
9967
10427
|
{
|
|
9968
10428
|
name: i <= value ? "star_filled" : "star_outline",
|
|
@@ -9977,7 +10437,7 @@ function IssueRow({
|
|
|
9977
10437
|
value,
|
|
9978
10438
|
onChange
|
|
9979
10439
|
}) {
|
|
9980
|
-
return /* @__PURE__ */
|
|
10440
|
+
return /* @__PURE__ */ import_react20.default.createElement(import_react_native20.View, { style: styles14.issueRow }, /* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.issueLabel }, label), /* @__PURE__ */ import_react20.default.createElement(import_react_native20.Switch, { value, onValueChange: onChange }));
|
|
9981
10441
|
}
|
|
9982
10442
|
function formatDuration(seconds) {
|
|
9983
10443
|
if (seconds < 60) return `${seconds}s`;
|
|
@@ -10021,7 +10481,7 @@ function composeFeedbackDescription(input) {
|
|
|
10021
10481
|
}
|
|
10022
10482
|
return lines.join("\n");
|
|
10023
10483
|
}
|
|
10024
|
-
var
|
|
10484
|
+
var styles14 = import_react_native20.StyleSheet.create({
|
|
10025
10485
|
root: {
|
|
10026
10486
|
flex: 1,
|
|
10027
10487
|
backgroundColor: "#FAFAF7"
|
|
@@ -10032,7 +10492,7 @@ var styles13 = import_react_native19.StyleSheet.create({
|
|
|
10032
10492
|
paddingHorizontal: 12,
|
|
10033
10493
|
paddingVertical: 12,
|
|
10034
10494
|
backgroundColor: "#FFFFFF",
|
|
10035
|
-
borderBottomWidth:
|
|
10495
|
+
borderBottomWidth: import_react_native20.StyleSheet.hairlineWidth,
|
|
10036
10496
|
borderBottomColor: "#E5E7EB"
|
|
10037
10497
|
},
|
|
10038
10498
|
headerClose: {
|
|
@@ -10171,7 +10631,7 @@ var styles13 = import_react_native19.StyleSheet.create({
|
|
|
10171
10631
|
gap: 10,
|
|
10172
10632
|
padding: 14,
|
|
10173
10633
|
backgroundColor: "#FFFFFF",
|
|
10174
|
-
borderTopWidth:
|
|
10634
|
+
borderTopWidth: import_react_native20.StyleSheet.hairlineWidth,
|
|
10175
10635
|
borderTopColor: "#E5E7EB"
|
|
10176
10636
|
},
|
|
10177
10637
|
cancelButton: {
|
|
@@ -10205,8 +10665,8 @@ var styles13 = import_react_native19.StyleSheet.create({
|
|
|
10205
10665
|
});
|
|
10206
10666
|
|
|
10207
10667
|
// src/MyBugsSheet.tsx
|
|
10208
|
-
var
|
|
10209
|
-
var
|
|
10668
|
+
var import_react21 = __toESM(require("react"));
|
|
10669
|
+
var import_react_native21 = require("react-native");
|
|
10210
10670
|
|
|
10211
10671
|
// src/bug-status.ts
|
|
10212
10672
|
var STATUS_STYLES = {
|
|
@@ -10276,11 +10736,11 @@ function MyBugsSheet({
|
|
|
10276
10736
|
const theme = useTpkTheme();
|
|
10277
10737
|
const language = useTpkLanguage();
|
|
10278
10738
|
const t = STRINGS8[language];
|
|
10279
|
-
const [loading, setLoading] = (0,
|
|
10280
|
-
const [error, setError] = (0,
|
|
10281
|
-
const [bugs, setBugs] = (0,
|
|
10282
|
-
const [selected, setSelected] = (0,
|
|
10283
|
-
(0,
|
|
10739
|
+
const [loading, setLoading] = (0, import_react21.useState)(false);
|
|
10740
|
+
const [error, setError] = (0, import_react21.useState)(false);
|
|
10741
|
+
const [bugs, setBugs] = (0, import_react21.useState)([]);
|
|
10742
|
+
const [selected, setSelected] = (0, import_react21.useState)(null);
|
|
10743
|
+
(0, import_react21.useEffect)(() => {
|
|
10284
10744
|
if (!visible || !tpk) return;
|
|
10285
10745
|
let cancelled = false;
|
|
10286
10746
|
setLoading(true);
|
|
@@ -10296,30 +10756,30 @@ function MyBugsSheet({
|
|
|
10296
10756
|
cancelled = true;
|
|
10297
10757
|
};
|
|
10298
10758
|
}, [visible, tpk]);
|
|
10299
|
-
return /* @__PURE__ */
|
|
10300
|
-
|
|
10759
|
+
return /* @__PURE__ */ import_react21.default.createElement(
|
|
10760
|
+
import_react_native21.Modal,
|
|
10301
10761
|
{
|
|
10302
10762
|
visible,
|
|
10303
10763
|
transparent: true,
|
|
10304
10764
|
animationType: "slide",
|
|
10305
10765
|
onRequestClose: onClose
|
|
10306
10766
|
},
|
|
10307
|
-
/* @__PURE__ */
|
|
10308
|
-
|
|
10767
|
+
/* @__PURE__ */ import_react21.default.createElement(import_react_native21.View, { style: styles15.backdrop }, /* @__PURE__ */ import_react21.default.createElement(import_react_native21.View, { style: [styles15.sheet, { backgroundColor: theme.surface }] }, /* @__PURE__ */ import_react21.default.createElement(import_react_native21.View, { style: styles15.header }, /* @__PURE__ */ import_react21.default.createElement(import_react_native21.Text, { style: [styles15.title, { color: theme.onSurface }] }, t.title), /* @__PURE__ */ import_react21.default.createElement(
|
|
10768
|
+
import_react_native21.Pressable,
|
|
10309
10769
|
{
|
|
10310
10770
|
onPress: onClose,
|
|
10311
10771
|
hitSlop: 8,
|
|
10312
10772
|
accessibilityLabel: t.close,
|
|
10313
10773
|
testID: "tpk-my-bugs-close"
|
|
10314
10774
|
},
|
|
10315
|
-
/* @__PURE__ */
|
|
10316
|
-
)), loading ? /* @__PURE__ */
|
|
10317
|
-
|
|
10775
|
+
/* @__PURE__ */ import_react21.default.createElement(TpkIcon, { name: "close", size: 24, color: theme.onSurface })
|
|
10776
|
+
)), loading ? /* @__PURE__ */ import_react21.default.createElement(import_react_native21.View, { style: styles15.center }, /* @__PURE__ */ import_react21.default.createElement(import_react_native21.ActivityIndicator, { color: theme.primary })) : error ? /* @__PURE__ */ import_react21.default.createElement(import_react_native21.View, { style: styles15.center }, /* @__PURE__ */ import_react21.default.createElement(import_react_native21.Text, { style: styles15.muted }, t.loadFailed)) : bugs.length === 0 ? /* @__PURE__ */ import_react21.default.createElement(import_react_native21.View, { style: styles15.center }, /* @__PURE__ */ import_react21.default.createElement(TpkIcon, { name: "check", size: 48, color: "#CBD5E1" }), /* @__PURE__ */ import_react21.default.createElement(import_react_native21.Text, { style: [styles15.empty, { marginTop: 12 }] }, t.empty)) : /* @__PURE__ */ import_react21.default.createElement(
|
|
10777
|
+
import_react_native21.FlatList,
|
|
10318
10778
|
{
|
|
10319
10779
|
data: bugs,
|
|
10320
10780
|
keyExtractor: (b) => b.id,
|
|
10321
|
-
contentContainerStyle:
|
|
10322
|
-
renderItem: ({ item }) => /* @__PURE__ */
|
|
10781
|
+
contentContainerStyle: styles15.listBody,
|
|
10782
|
+
renderItem: ({ item }) => /* @__PURE__ */ import_react21.default.createElement(
|
|
10323
10783
|
BugRow,
|
|
10324
10784
|
{
|
|
10325
10785
|
bug: item,
|
|
@@ -10330,7 +10790,7 @@ function MyBugsSheet({
|
|
|
10330
10790
|
)
|
|
10331
10791
|
}
|
|
10332
10792
|
))),
|
|
10333
|
-
/* @__PURE__ */
|
|
10793
|
+
/* @__PURE__ */ import_react21.default.createElement(
|
|
10334
10794
|
BugDetailModal,
|
|
10335
10795
|
{
|
|
10336
10796
|
bug: selected,
|
|
@@ -10347,15 +10807,15 @@ function StatusBadge2({
|
|
|
10347
10807
|
language
|
|
10348
10808
|
}) {
|
|
10349
10809
|
const { label, color } = bugStatusStyle(status, language);
|
|
10350
|
-
return /* @__PURE__ */
|
|
10351
|
-
|
|
10810
|
+
return /* @__PURE__ */ import_react21.default.createElement(
|
|
10811
|
+
import_react_native21.View,
|
|
10352
10812
|
{
|
|
10353
10813
|
style: [
|
|
10354
|
-
|
|
10814
|
+
styles15.badge,
|
|
10355
10815
|
{ backgroundColor: `${color}1F`, borderColor: `${color}66` }
|
|
10356
10816
|
]
|
|
10357
10817
|
},
|
|
10358
|
-
/* @__PURE__ */
|
|
10818
|
+
/* @__PURE__ */ import_react21.default.createElement(import_react_native21.Text, { style: [styles15.badgeText, { color }] }, label)
|
|
10359
10819
|
);
|
|
10360
10820
|
}
|
|
10361
10821
|
function metaLine(bug, language) {
|
|
@@ -10372,15 +10832,15 @@ function BugRow({
|
|
|
10372
10832
|
textColor,
|
|
10373
10833
|
onPress
|
|
10374
10834
|
}) {
|
|
10375
|
-
return /* @__PURE__ */
|
|
10376
|
-
|
|
10835
|
+
return /* @__PURE__ */ import_react21.default.createElement(
|
|
10836
|
+
import_react_native21.Pressable,
|
|
10377
10837
|
{
|
|
10378
|
-
style:
|
|
10838
|
+
style: styles15.row,
|
|
10379
10839
|
onPress,
|
|
10380
10840
|
testID: `tpk-my-bug-${bug.id}`
|
|
10381
10841
|
},
|
|
10382
|
-
/* @__PURE__ */
|
|
10383
|
-
/* @__PURE__ */
|
|
10842
|
+
/* @__PURE__ */ import_react21.default.createElement(import_react_native21.View, { style: styles15.rowMain }, /* @__PURE__ */ import_react21.default.createElement(import_react_native21.Text, { style: [styles15.rowTitle, { color: textColor }], numberOfLines: 2 }, bug.title), /* @__PURE__ */ import_react21.default.createElement(import_react_native21.Text, { style: styles15.muted }, metaLine(bug, language))),
|
|
10843
|
+
/* @__PURE__ */ import_react21.default.createElement(StatusBadge2, { status: bug.status, language })
|
|
10384
10844
|
);
|
|
10385
10845
|
}
|
|
10386
10846
|
function BugDetailModal({
|
|
@@ -10390,25 +10850,25 @@ function BugDetailModal({
|
|
|
10390
10850
|
surface,
|
|
10391
10851
|
textColor
|
|
10392
10852
|
}) {
|
|
10393
|
-
return /* @__PURE__ */
|
|
10394
|
-
|
|
10853
|
+
return /* @__PURE__ */ import_react21.default.createElement(
|
|
10854
|
+
import_react_native21.Modal,
|
|
10395
10855
|
{
|
|
10396
10856
|
visible: bug != null,
|
|
10397
10857
|
transparent: true,
|
|
10398
10858
|
animationType: "fade",
|
|
10399
10859
|
onRequestClose: onClose
|
|
10400
10860
|
},
|
|
10401
|
-
/* @__PURE__ */
|
|
10402
|
-
|
|
10861
|
+
/* @__PURE__ */ import_react21.default.createElement(import_react_native21.Pressable, { style: styles15.detailBackdrop, onPress: onClose }, /* @__PURE__ */ import_react21.default.createElement(
|
|
10862
|
+
import_react_native21.Pressable,
|
|
10403
10863
|
{
|
|
10404
|
-
style: [
|
|
10864
|
+
style: [styles15.detailCard, { backgroundColor: surface }],
|
|
10405
10865
|
onPress: () => void 0
|
|
10406
10866
|
},
|
|
10407
|
-
bug ? /* @__PURE__ */
|
|
10867
|
+
bug ? /* @__PURE__ */ import_react21.default.createElement(import_react_native21.ScrollView, { contentContainerStyle: styles15.detailBody }, /* @__PURE__ */ import_react21.default.createElement(import_react_native21.Text, { style: [styles15.detailTitle, { color: textColor }] }, bug.title), /* @__PURE__ */ import_react21.default.createElement(import_react_native21.View, { style: styles15.detailBadgeRow }, /* @__PURE__ */ import_react21.default.createElement(StatusBadge2, { status: bug.status, language })), /* @__PURE__ */ import_react21.default.createElement(import_react_native21.Text, { style: styles15.muted }, metaLine(bug, language)), bug.description ? /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, /* @__PURE__ */ import_react21.default.createElement(import_react_native21.Text, { style: [styles15.detailLabel, { color: textColor }] }, STRINGS8[language].description), /* @__PURE__ */ import_react21.default.createElement(import_react_native21.Text, { style: [styles15.detailDesc, { color: textColor }] }, bug.description)) : null) : null
|
|
10408
10868
|
))
|
|
10409
10869
|
);
|
|
10410
10870
|
}
|
|
10411
|
-
var
|
|
10871
|
+
var styles15 = import_react_native21.StyleSheet.create({
|
|
10412
10872
|
backdrop: {
|
|
10413
10873
|
flex: 1,
|
|
10414
10874
|
backgroundColor: "rgba(0,0,0,0.4)",
|
|
@@ -10437,7 +10897,7 @@ var styles14 = import_react_native20.StyleSheet.create({
|
|
|
10437
10897
|
flexDirection: "row",
|
|
10438
10898
|
alignItems: "center",
|
|
10439
10899
|
paddingVertical: 14,
|
|
10440
|
-
borderBottomWidth:
|
|
10900
|
+
borderBottomWidth: import_react_native21.StyleSheet.hairlineWidth,
|
|
10441
10901
|
borderBottomColor: "#E2E8F0"
|
|
10442
10902
|
},
|
|
10443
10903
|
rowMain: { flex: 1, paddingRight: 12 },
|
|
@@ -10465,8 +10925,8 @@ var styles14 = import_react_native20.StyleSheet.create({
|
|
|
10465
10925
|
});
|
|
10466
10926
|
|
|
10467
10927
|
// src/SessionDetailsSheet.tsx
|
|
10468
|
-
var
|
|
10469
|
-
var
|
|
10928
|
+
var import_react22 = __toESM(require("react"));
|
|
10929
|
+
var import_react_native22 = require("react-native");
|
|
10470
10930
|
var STRINGS9 = {
|
|
10471
10931
|
en: {
|
|
10472
10932
|
title: "Session Details",
|
|
@@ -10511,7 +10971,7 @@ function SessionDetailsSheet({
|
|
|
10511
10971
|
const language = useTpkLanguage();
|
|
10512
10972
|
const t = STRINGS9[language];
|
|
10513
10973
|
const money = (amount) => formatTpkMoney(amount, earningsCurrency, language);
|
|
10514
|
-
const data = (0,
|
|
10974
|
+
const data = (0, import_react22.useMemo)(() => {
|
|
10515
10975
|
if (!visible || !tpk) {
|
|
10516
10976
|
return { taps: 0, screenViews: 0, activeMinutes: 0, paidMinutes: 0 };
|
|
10517
10977
|
}
|
|
@@ -10523,8 +10983,8 @@ function SessionDetailsSheet({
|
|
|
10523
10983
|
paidMinutes: tpk.getEngagedMinutes()
|
|
10524
10984
|
};
|
|
10525
10985
|
}, [visible, tpk]);
|
|
10526
|
-
const [tasks, setTasks] = (0,
|
|
10527
|
-
(0,
|
|
10986
|
+
const [tasks, setTasks] = (0, import_react22.useState)(null);
|
|
10987
|
+
(0, import_react22.useEffect)(() => {
|
|
10528
10988
|
if (!visible || !tpk) return;
|
|
10529
10989
|
let cancelled = false;
|
|
10530
10990
|
tpk.getTaskProgress().then((p) => {
|
|
@@ -10535,37 +10995,37 @@ function SessionDetailsSheet({
|
|
|
10535
10995
|
};
|
|
10536
10996
|
}, [visible, tpk]);
|
|
10537
10997
|
const expected = earningsBaseAmount + data.paidMinutes * earningsPerMinuteRate;
|
|
10538
|
-
return /* @__PURE__ */
|
|
10539
|
-
|
|
10998
|
+
return /* @__PURE__ */ import_react22.default.createElement(
|
|
10999
|
+
import_react_native22.Modal,
|
|
10540
11000
|
{
|
|
10541
11001
|
visible,
|
|
10542
11002
|
transparent: true,
|
|
10543
11003
|
animationType: "slide",
|
|
10544
11004
|
onRequestClose: onClose
|
|
10545
11005
|
},
|
|
10546
|
-
/* @__PURE__ */
|
|
10547
|
-
|
|
11006
|
+
/* @__PURE__ */ import_react22.default.createElement(import_react_native22.View, { style: styles16.backdrop }, /* @__PURE__ */ import_react22.default.createElement(import_react_native22.View, { style: [styles16.sheet, { backgroundColor: theme.surface }] }, /* @__PURE__ */ import_react22.default.createElement(import_react_native22.View, { style: styles16.header }, /* @__PURE__ */ import_react22.default.createElement(import_react_native22.Text, { style: [styles16.title, { color: theme.onSurface }] }, t.title), /* @__PURE__ */ import_react22.default.createElement(
|
|
11007
|
+
import_react_native22.Pressable,
|
|
10548
11008
|
{
|
|
10549
11009
|
onPress: onClose,
|
|
10550
11010
|
hitSlop: 8,
|
|
10551
11011
|
accessibilityLabel: t.close,
|
|
10552
11012
|
testID: "tpk-session-details-close"
|
|
10553
11013
|
},
|
|
10554
|
-
/* @__PURE__ */
|
|
10555
|
-
)), /* @__PURE__ */
|
|
10556
|
-
|
|
11014
|
+
/* @__PURE__ */ import_react22.default.createElement(TpkIcon, { name: "close", size: 24, color: theme.onSurface })
|
|
11015
|
+
)), /* @__PURE__ */ import_react22.default.createElement(import_react_native22.ScrollView, { contentContainerStyle: styles16.body }, /* @__PURE__ */ import_react22.default.createElement(
|
|
11016
|
+
import_react_native22.View,
|
|
10557
11017
|
{
|
|
10558
|
-
style: [
|
|
11018
|
+
style: [styles16.earnings, { borderColor: theme.primary }],
|
|
10559
11019
|
testID: "tpk-session-details-earnings"
|
|
10560
11020
|
},
|
|
10561
|
-
/* @__PURE__ */
|
|
10562
|
-
/* @__PURE__ */
|
|
10563
|
-
/* @__PURE__ */
|
|
11021
|
+
/* @__PURE__ */ import_react22.default.createElement(import_react_native22.Text, { style: [styles16.earningsLabel, { color: theme.onSurface }] }, t.expectedEarnings),
|
|
11022
|
+
/* @__PURE__ */ import_react22.default.createElement(import_react_native22.Text, { style: [styles16.earningsValue, { color: theme.primary }] }, money(expected)),
|
|
11023
|
+
/* @__PURE__ */ import_react22.default.createElement(import_react_native22.Text, { style: styles16.earningsHint }, t.earningsHint(
|
|
10564
11024
|
money(earningsBaseAmount),
|
|
10565
11025
|
data.paidMinutes,
|
|
10566
11026
|
money(earningsPerMinuteRate)
|
|
10567
11027
|
))
|
|
10568
|
-
), /* @__PURE__ */
|
|
11028
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
10569
11029
|
Metric,
|
|
10570
11030
|
{
|
|
10571
11031
|
label: t.activeTime,
|
|
@@ -10573,7 +11033,7 @@ function SessionDetailsSheet({
|
|
|
10573
11033
|
hint: t.activeTimeHint,
|
|
10574
11034
|
color: theme.onSurface
|
|
10575
11035
|
}
|
|
10576
|
-
), /* @__PURE__ */
|
|
11036
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
10577
11037
|
Metric,
|
|
10578
11038
|
{
|
|
10579
11039
|
label: t.paidTime,
|
|
@@ -10581,21 +11041,21 @@ function SessionDetailsSheet({
|
|
|
10581
11041
|
hint: t.paidTimeHint,
|
|
10582
11042
|
color: theme.onSurface
|
|
10583
11043
|
}
|
|
10584
|
-
), /* @__PURE__ */
|
|
11044
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
10585
11045
|
Metric,
|
|
10586
11046
|
{
|
|
10587
11047
|
label: t.taps,
|
|
10588
11048
|
value: String(data.taps),
|
|
10589
11049
|
color: theme.onSurface
|
|
10590
11050
|
}
|
|
10591
|
-
), /* @__PURE__ */
|
|
11051
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
10592
11052
|
Metric,
|
|
10593
11053
|
{
|
|
10594
11054
|
label: t.screens,
|
|
10595
11055
|
value: String(data.screenViews),
|
|
10596
11056
|
color: theme.onSurface
|
|
10597
11057
|
}
|
|
10598
|
-
), tasks?.hasTasks ? /* @__PURE__ */
|
|
11058
|
+
), tasks?.hasTasks ? /* @__PURE__ */ import_react22.default.createElement(
|
|
10599
11059
|
Metric,
|
|
10600
11060
|
{
|
|
10601
11061
|
label: t.tasks,
|
|
@@ -10611,9 +11071,9 @@ function Metric({
|
|
|
10611
11071
|
hint,
|
|
10612
11072
|
color
|
|
10613
11073
|
}) {
|
|
10614
|
-
return /* @__PURE__ */
|
|
11074
|
+
return /* @__PURE__ */ import_react22.default.createElement(import_react_native22.View, { style: styles16.metricRow }, /* @__PURE__ */ import_react22.default.createElement(import_react_native22.View, { style: styles16.metricLabelCol }, /* @__PURE__ */ import_react22.default.createElement(import_react_native22.Text, { style: [styles16.metricLabel, { color }] }, label), hint ? /* @__PURE__ */ import_react22.default.createElement(import_react_native22.Text, { style: styles16.metricHint }, hint) : null), /* @__PURE__ */ import_react22.default.createElement(import_react_native22.Text, { style: [styles16.metricValue, { color }] }, value));
|
|
10615
11075
|
}
|
|
10616
|
-
var
|
|
11076
|
+
var styles16 = import_react_native22.StyleSheet.create({
|
|
10617
11077
|
backdrop: {
|
|
10618
11078
|
flex: 1,
|
|
10619
11079
|
backgroundColor: "rgba(0,0,0,0.4)",
|
|
@@ -10650,7 +11110,7 @@ var styles15 = import_react_native21.StyleSheet.create({
|
|
|
10650
11110
|
alignItems: "center",
|
|
10651
11111
|
justifyContent: "space-between",
|
|
10652
11112
|
paddingVertical: 12,
|
|
10653
|
-
borderBottomWidth:
|
|
11113
|
+
borderBottomWidth: import_react_native22.StyleSheet.hairlineWidth,
|
|
10654
11114
|
borderBottomColor: "#E2E8F0"
|
|
10655
11115
|
},
|
|
10656
11116
|
metricLabelCol: { flex: 1, paddingRight: 12 },
|
|
@@ -10660,8 +11120,8 @@ var styles15 = import_react_native21.StyleSheet.create({
|
|
|
10660
11120
|
});
|
|
10661
11121
|
|
|
10662
11122
|
// src/NotificationsSheet.tsx
|
|
10663
|
-
var
|
|
10664
|
-
var
|
|
11123
|
+
var import_react23 = __toESM(require("react"));
|
|
11124
|
+
var import_react_native23 = require("react-native");
|
|
10665
11125
|
var STRINGS10 = {
|
|
10666
11126
|
en: {
|
|
10667
11127
|
title: "Messages",
|
|
@@ -10692,10 +11152,10 @@ function NotificationsSheet({
|
|
|
10692
11152
|
}) {
|
|
10693
11153
|
const theme = useTpkTheme();
|
|
10694
11154
|
const t = STRINGS10[useTpkLanguage()];
|
|
10695
|
-
const [loading, setLoading] = (0,
|
|
10696
|
-
const [error, setError] = (0,
|
|
10697
|
-
const [items, setItems] = (0,
|
|
10698
|
-
(0,
|
|
11155
|
+
const [loading, setLoading] = (0, import_react23.useState)(false);
|
|
11156
|
+
const [error, setError] = (0, import_react23.useState)(false);
|
|
11157
|
+
const [items, setItems] = (0, import_react23.useState)([]);
|
|
11158
|
+
(0, import_react23.useEffect)(() => {
|
|
10699
11159
|
if (!visible || !tpk) return;
|
|
10700
11160
|
let cancelled = false;
|
|
10701
11161
|
setLoading(true);
|
|
@@ -10730,60 +11190,60 @@ function NotificationsSheet({
|
|
|
10730
11190
|
tpk.markNotificationsRead().then((unread) => onUnreadChange?.(unread)).catch(() => void 0);
|
|
10731
11191
|
};
|
|
10732
11192
|
const hasUnread = items.some((x) => !x.isRead);
|
|
10733
|
-
return /* @__PURE__ */
|
|
10734
|
-
|
|
11193
|
+
return /* @__PURE__ */ import_react23.default.createElement(
|
|
11194
|
+
import_react_native23.Modal,
|
|
10735
11195
|
{
|
|
10736
11196
|
visible,
|
|
10737
11197
|
transparent: true,
|
|
10738
11198
|
animationType: "slide",
|
|
10739
11199
|
onRequestClose: onClose
|
|
10740
11200
|
},
|
|
10741
|
-
/* @__PURE__ */
|
|
10742
|
-
|
|
11201
|
+
/* @__PURE__ */ import_react23.default.createElement(import_react_native23.View, { style: styles17.backdrop }, /* @__PURE__ */ import_react23.default.createElement(import_react_native23.View, { style: [styles17.sheet, { backgroundColor: theme.surface }] }, /* @__PURE__ */ import_react23.default.createElement(import_react_native23.View, { style: styles17.header }, /* @__PURE__ */ import_react23.default.createElement(import_react_native23.Text, { style: [styles17.title, { color: theme.onSurface }] }, t.title), /* @__PURE__ */ import_react23.default.createElement(import_react_native23.View, { style: styles17.headerActions }, hasUnread ? /* @__PURE__ */ import_react23.default.createElement(
|
|
11202
|
+
import_react_native23.Pressable,
|
|
10743
11203
|
{
|
|
10744
11204
|
onPress: markAll,
|
|
10745
11205
|
hitSlop: 8,
|
|
10746
11206
|
testID: "tpk-notifications-mark-all"
|
|
10747
11207
|
},
|
|
10748
|
-
/* @__PURE__ */
|
|
10749
|
-
) : null, /* @__PURE__ */
|
|
10750
|
-
|
|
11208
|
+
/* @__PURE__ */ import_react23.default.createElement(import_react_native23.Text, { style: [styles17.markAll, { color: theme.primary }] }, t.markAll)
|
|
11209
|
+
) : null, /* @__PURE__ */ import_react23.default.createElement(
|
|
11210
|
+
import_react_native23.Pressable,
|
|
10751
11211
|
{
|
|
10752
11212
|
onPress: onClose,
|
|
10753
11213
|
hitSlop: 8,
|
|
10754
11214
|
accessibilityLabel: t.close,
|
|
10755
11215
|
testID: "tpk-notifications-close"
|
|
10756
11216
|
},
|
|
10757
|
-
/* @__PURE__ */
|
|
10758
|
-
))), loading ? /* @__PURE__ */
|
|
10759
|
-
|
|
11217
|
+
/* @__PURE__ */ import_react23.default.createElement(TpkIcon, { name: "close", size: 24, color: theme.onSurface })
|
|
11218
|
+
))), loading ? /* @__PURE__ */ import_react23.default.createElement(import_react_native23.View, { style: styles17.center }, /* @__PURE__ */ import_react23.default.createElement(import_react_native23.ActivityIndicator, { color: theme.primary })) : error ? /* @__PURE__ */ import_react23.default.createElement(import_react_native23.View, { style: styles17.center }, /* @__PURE__ */ import_react23.default.createElement(import_react_native23.Text, { style: styles17.muted }, t.loadFailed)) : items.length === 0 ? /* @__PURE__ */ import_react23.default.createElement(import_react_native23.View, { style: styles17.center }, /* @__PURE__ */ import_react23.default.createElement(TpkIcon, { name: "feedback", size: 48, color: "#CBD5E1" }), /* @__PURE__ */ import_react23.default.createElement(import_react_native23.Text, { style: [styles17.empty, { marginTop: 12 }] }, t.empty)) : /* @__PURE__ */ import_react23.default.createElement(
|
|
11219
|
+
import_react_native23.FlatList,
|
|
10760
11220
|
{
|
|
10761
11221
|
data: items,
|
|
10762
11222
|
keyExtractor: (n) => n.id,
|
|
10763
|
-
contentContainerStyle:
|
|
10764
|
-
renderItem: ({ item }) => /* @__PURE__ */
|
|
10765
|
-
|
|
11223
|
+
contentContainerStyle: styles17.listBody,
|
|
11224
|
+
renderItem: ({ item }) => /* @__PURE__ */ import_react23.default.createElement(
|
|
11225
|
+
import_react_native23.Pressable,
|
|
10766
11226
|
{
|
|
10767
|
-
style:
|
|
11227
|
+
style: styles17.row,
|
|
10768
11228
|
onPress: () => markOne(item),
|
|
10769
11229
|
testID: `tpk-notification-${item.id}`
|
|
10770
11230
|
},
|
|
10771
|
-
/* @__PURE__ */
|
|
10772
|
-
|
|
11231
|
+
/* @__PURE__ */ import_react23.default.createElement(
|
|
11232
|
+
import_react_native23.View,
|
|
10773
11233
|
{
|
|
10774
11234
|
style: [
|
|
10775
|
-
|
|
11235
|
+
styles17.dot,
|
|
10776
11236
|
{
|
|
10777
11237
|
backgroundColor: item.isRead ? "transparent" : theme.primary
|
|
10778
11238
|
}
|
|
10779
11239
|
]
|
|
10780
11240
|
}
|
|
10781
11241
|
),
|
|
10782
|
-
/* @__PURE__ */
|
|
10783
|
-
|
|
11242
|
+
/* @__PURE__ */ import_react23.default.createElement(import_react_native23.View, { style: styles17.rowMain }, /* @__PURE__ */ import_react23.default.createElement(
|
|
11243
|
+
import_react_native23.Text,
|
|
10784
11244
|
{
|
|
10785
11245
|
style: [
|
|
10786
|
-
|
|
11246
|
+
styles17.rowTitle,
|
|
10787
11247
|
{
|
|
10788
11248
|
color: theme.onSurface,
|
|
10789
11249
|
fontWeight: item.isRead ? "500" : "700"
|
|
@@ -10792,20 +11252,20 @@ function NotificationsSheet({
|
|
|
10792
11252
|
numberOfLines: 2
|
|
10793
11253
|
},
|
|
10794
11254
|
item.title
|
|
10795
|
-
), item.body ? /* @__PURE__ */
|
|
10796
|
-
|
|
11255
|
+
), item.body ? /* @__PURE__ */ import_react23.default.createElement(
|
|
11256
|
+
import_react_native23.Text,
|
|
10797
11257
|
{
|
|
10798
|
-
style: [
|
|
11258
|
+
style: [styles17.rowBody, { color: theme.onSurface }],
|
|
10799
11259
|
numberOfLines: 3
|
|
10800
11260
|
},
|
|
10801
11261
|
item.body
|
|
10802
|
-
) : null, /* @__PURE__ */
|
|
11262
|
+
) : null, /* @__PURE__ */ import_react23.default.createElement(import_react_native23.Text, { style: styles17.muted }, formatDate2(item.createdAt)))
|
|
10803
11263
|
)
|
|
10804
11264
|
}
|
|
10805
11265
|
)))
|
|
10806
11266
|
);
|
|
10807
11267
|
}
|
|
10808
|
-
var
|
|
11268
|
+
var styles17 = import_react_native23.StyleSheet.create({
|
|
10809
11269
|
backdrop: {
|
|
10810
11270
|
flex: 1,
|
|
10811
11271
|
backgroundColor: "rgba(0,0,0,0.4)",
|
|
@@ -10836,7 +11296,7 @@ var styles16 = import_react_native22.StyleSheet.create({
|
|
|
10836
11296
|
flexDirection: "row",
|
|
10837
11297
|
alignItems: "flex-start",
|
|
10838
11298
|
paddingVertical: 14,
|
|
10839
|
-
borderBottomWidth:
|
|
11299
|
+
borderBottomWidth: import_react_native23.StyleSheet.hairlineWidth,
|
|
10840
11300
|
borderBottomColor: "#E2E8F0"
|
|
10841
11301
|
},
|
|
10842
11302
|
dot: { width: 8, height: 8, borderRadius: 4, marginTop: 6, marginRight: 10 },
|
|
@@ -10846,8 +11306,8 @@ var styles16 = import_react_native22.StyleSheet.create({
|
|
|
10846
11306
|
});
|
|
10847
11307
|
|
|
10848
11308
|
// src/InviteCodeScreen.tsx
|
|
10849
|
-
var
|
|
10850
|
-
var
|
|
11309
|
+
var import_react24 = __toESM(require("react"));
|
|
11310
|
+
var import_react_native24 = require("react-native");
|
|
10851
11311
|
var STRINGS11 = {
|
|
10852
11312
|
en: {
|
|
10853
11313
|
invalidCode: "Code invalid or not recognised. Please check what you entered.",
|
|
@@ -10877,9 +11337,9 @@ function InviteCodeScreen({
|
|
|
10877
11337
|
}) {
|
|
10878
11338
|
const theme = useTpkTheme();
|
|
10879
11339
|
const t = STRINGS11[useTpkLanguage()];
|
|
10880
|
-
const [code, setCode] = (0,
|
|
10881
|
-
const [loading, setLoading] = (0,
|
|
10882
|
-
const [error, setError] = (0,
|
|
11340
|
+
const [code, setCode] = (0, import_react24.useState)("");
|
|
11341
|
+
const [loading, setLoading] = (0, import_react24.useState)(false);
|
|
11342
|
+
const [error, setError] = (0, import_react24.useState)(false);
|
|
10883
11343
|
const trimmed = code.trim();
|
|
10884
11344
|
const canSubmit = trimmed.length > 0 && !loading && tpk != null;
|
|
10885
11345
|
const submit = () => {
|
|
@@ -10895,32 +11355,32 @@ function InviteCodeScreen({
|
|
|
10895
11355
|
setError(true);
|
|
10896
11356
|
});
|
|
10897
11357
|
};
|
|
10898
|
-
return /* @__PURE__ */
|
|
10899
|
-
|
|
11358
|
+
return /* @__PURE__ */ import_react24.default.createElement(
|
|
11359
|
+
import_react_native24.Modal,
|
|
10900
11360
|
{
|
|
10901
11361
|
visible,
|
|
10902
11362
|
transparent: true,
|
|
10903
11363
|
animationType: "fade",
|
|
10904
11364
|
onRequestClose: onClose
|
|
10905
11365
|
},
|
|
10906
|
-
/* @__PURE__ */
|
|
10907
|
-
|
|
11366
|
+
/* @__PURE__ */ import_react24.default.createElement(
|
|
11367
|
+
import_react_native24.KeyboardAvoidingView,
|
|
10908
11368
|
{
|
|
10909
|
-
behavior:
|
|
10910
|
-
style:
|
|
11369
|
+
behavior: import_react_native24.Platform.OS === "ios" ? "padding" : void 0,
|
|
11370
|
+
style: styles18.backdrop
|
|
10911
11371
|
},
|
|
10912
|
-
/* @__PURE__ */
|
|
10913
|
-
|
|
11372
|
+
/* @__PURE__ */ import_react24.default.createElement(import_react_native24.View, { style: [styles18.card, { backgroundColor: theme.surface }] }, onClose ? /* @__PURE__ */ import_react24.default.createElement(
|
|
11373
|
+
import_react_native24.Pressable,
|
|
10914
11374
|
{
|
|
10915
11375
|
onPress: onClose,
|
|
10916
11376
|
hitSlop: 8,
|
|
10917
|
-
style:
|
|
11377
|
+
style: styles18.close,
|
|
10918
11378
|
accessibilityLabel: t.close,
|
|
10919
11379
|
testID: "tpk-invite-close"
|
|
10920
11380
|
},
|
|
10921
|
-
/* @__PURE__ */
|
|
10922
|
-
) : null, /* @__PURE__ */
|
|
10923
|
-
|
|
11381
|
+
/* @__PURE__ */ import_react24.default.createElement(TpkIcon, { name: "close", size: 22, color: theme.onSurface })
|
|
11382
|
+
) : null, /* @__PURE__ */ import_react24.default.createElement(TpkIcon, { name: "rocket", size: 40, color: theme.primary }), /* @__PURE__ */ import_react24.default.createElement(import_react_native24.Text, { style: [styles18.title, { color: theme.onSurface }] }, projectName ? t.testProject(projectName) : t.becomeTester), /* @__PURE__ */ import_react24.default.createElement(import_react_native24.Text, { style: styles18.subtitle }, t.subtitle), /* @__PURE__ */ import_react24.default.createElement(
|
|
11383
|
+
import_react_native24.TextInput,
|
|
10924
11384
|
{
|
|
10925
11385
|
value: code,
|
|
10926
11386
|
onChangeText: (t2) => {
|
|
@@ -10935,7 +11395,7 @@ function InviteCodeScreen({
|
|
|
10935
11395
|
onSubmitEditing: submit,
|
|
10936
11396
|
returnKeyType: "go",
|
|
10937
11397
|
style: [
|
|
10938
|
-
|
|
11398
|
+
styles18.input,
|
|
10939
11399
|
{
|
|
10940
11400
|
color: theme.onSurface,
|
|
10941
11401
|
borderColor: error ? theme.errorColour : "#CBD5E1"
|
|
@@ -10943,23 +11403,23 @@ function InviteCodeScreen({
|
|
|
10943
11403
|
],
|
|
10944
11404
|
testID: "tpk-invite-input"
|
|
10945
11405
|
}
|
|
10946
|
-
), error ? /* @__PURE__ */
|
|
10947
|
-
|
|
11406
|
+
), error ? /* @__PURE__ */ import_react24.default.createElement(import_react_native24.Text, { style: [styles18.error, { color: theme.errorColour }] }, t.invalidCode) : null, /* @__PURE__ */ import_react24.default.createElement(
|
|
11407
|
+
import_react_native24.Pressable,
|
|
10948
11408
|
{
|
|
10949
11409
|
onPress: submit,
|
|
10950
11410
|
disabled: !canSubmit,
|
|
10951
11411
|
style: [
|
|
10952
|
-
|
|
11412
|
+
styles18.button,
|
|
10953
11413
|
{ backgroundColor: theme.primary, opacity: canSubmit ? 1 : 0.5 }
|
|
10954
11414
|
],
|
|
10955
11415
|
testID: "tpk-invite-submit"
|
|
10956
11416
|
},
|
|
10957
|
-
loading ? /* @__PURE__ */
|
|
11417
|
+
loading ? /* @__PURE__ */ import_react24.default.createElement(import_react_native24.ActivityIndicator, { color: "#FFFFFF" }) : /* @__PURE__ */ import_react24.default.createElement(import_react_native24.Text, { style: styles18.buttonText }, t.start)
|
|
10958
11418
|
))
|
|
10959
11419
|
)
|
|
10960
11420
|
);
|
|
10961
11421
|
}
|
|
10962
|
-
var
|
|
11422
|
+
var styles18 = import_react_native24.StyleSheet.create({
|
|
10963
11423
|
backdrop: {
|
|
10964
11424
|
flex: 1,
|
|
10965
11425
|
backgroundColor: "rgba(0,0,0,0.5)",
|
|
@@ -11005,12 +11465,12 @@ var styles17 = import_react_native23.StyleSheet.create({
|
|
|
11005
11465
|
});
|
|
11006
11466
|
|
|
11007
11467
|
// src/TesterPayKitWrapper.tsx
|
|
11008
|
-
var
|
|
11009
|
-
var
|
|
11468
|
+
var import_react28 = __toESM(require("react"));
|
|
11469
|
+
var import_react_native29 = require("react-native");
|
|
11010
11470
|
|
|
11011
11471
|
// src/ai-tester/AiRemoteControl.tsx
|
|
11012
|
-
var
|
|
11013
|
-
var
|
|
11472
|
+
var import_react25 = __toESM(require("react"));
|
|
11473
|
+
var import_react_native25 = require("react-native");
|
|
11014
11474
|
var import_ai_tester = require("@testerpaykit/ai-tester");
|
|
11015
11475
|
var PLATFORM = typeof document !== "undefined" ? "expo-web" : "expo-native";
|
|
11016
11476
|
var StartSessionError = class extends Error {
|
|
@@ -11067,17 +11527,17 @@ function AiRemoteControl({
|
|
|
11067
11527
|
onSessionEnded,
|
|
11068
11528
|
style
|
|
11069
11529
|
}) {
|
|
11070
|
-
const [status, setStatus] = (0,
|
|
11071
|
-
const [actionCount, setActionCount] = (0,
|
|
11530
|
+
const [status, setStatus] = (0, import_react25.useState)("choosing");
|
|
11531
|
+
const [actionCount, setActionCount] = (0, import_react25.useState)(0);
|
|
11072
11532
|
const language = useTpkLanguage();
|
|
11073
11533
|
const t = STRINGS12[language];
|
|
11074
|
-
const [errorMessage2, setErrorMessage] = (0,
|
|
11075
|
-
const [sessionId, setSessionId] = (0,
|
|
11076
|
-
const [personas, setPersonas] = (0,
|
|
11077
|
-
const [selectedPersona, setSelectedPersona] = (0,
|
|
11078
|
-
const wsRef = (0,
|
|
11079
|
-
const closedRef = (0,
|
|
11080
|
-
(0,
|
|
11534
|
+
const [errorMessage2, setErrorMessage] = (0, import_react25.useState)(null);
|
|
11535
|
+
const [sessionId, setSessionId] = (0, import_react25.useState)(null);
|
|
11536
|
+
const [personas, setPersonas] = (0, import_react25.useState)([]);
|
|
11537
|
+
const [selectedPersona, setSelectedPersona] = (0, import_react25.useState)("junior_tester");
|
|
11538
|
+
const wsRef = (0, import_react25.useRef)(null);
|
|
11539
|
+
const closedRef = (0, import_react25.useRef)(false);
|
|
11540
|
+
(0, import_react25.useEffect)(() => {
|
|
11081
11541
|
if (!visible) {
|
|
11082
11542
|
const ws = wsRef.current;
|
|
11083
11543
|
if (ws && ws.readyState <= 1) {
|
|
@@ -11122,7 +11582,7 @@ function AiRemoteControl({
|
|
|
11122
11582
|
cancelled = true;
|
|
11123
11583
|
};
|
|
11124
11584
|
}, [visible, apiBaseUrl, coordinatorToken, remoteSession]);
|
|
11125
|
-
const _start = (0,
|
|
11585
|
+
const _start = (0, import_react25.useCallback)(
|
|
11126
11586
|
() => {
|
|
11127
11587
|
setStatus("starting");
|
|
11128
11588
|
void (async () => {
|
|
@@ -11178,7 +11638,7 @@ function AiRemoteControl({
|
|
|
11178
11638
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11179
11639
|
[apiBaseUrl, coordinatorToken, projectId, configuration, selectedPersona]
|
|
11180
11640
|
);
|
|
11181
|
-
(0,
|
|
11641
|
+
(0, import_react25.useEffect)(() => {
|
|
11182
11642
|
if (status !== "running") return;
|
|
11183
11643
|
const handler = (ev) => {
|
|
11184
11644
|
if ((0, import_ai_tester.isSyntheticEvent)(ev)) return;
|
|
@@ -11195,7 +11655,7 @@ function AiRemoteControl({
|
|
|
11195
11655
|
document.addEventListener("pointerdown", handler, true);
|
|
11196
11656
|
return () => document.removeEventListener("pointerdown", handler, true);
|
|
11197
11657
|
}, [status]);
|
|
11198
|
-
const _openSocket = (0,
|
|
11658
|
+
const _openSocket = (0, import_react25.useCallback)(
|
|
11199
11659
|
(wsUrl) => {
|
|
11200
11660
|
const ws = new WebSocket(wsUrl);
|
|
11201
11661
|
wsRef.current = ws;
|
|
@@ -11259,7 +11719,7 @@ function AiRemoteControl({
|
|
|
11259
11719
|
},
|
|
11260
11720
|
[]
|
|
11261
11721
|
);
|
|
11262
|
-
const _finishSession = (0,
|
|
11722
|
+
const _finishSession = (0, import_react25.useCallback)(
|
|
11263
11723
|
(s) => {
|
|
11264
11724
|
closedRef.current = true;
|
|
11265
11725
|
setStatus("ended");
|
|
@@ -11274,7 +11734,7 @@ function AiRemoteControl({
|
|
|
11274
11734
|
},
|
|
11275
11735
|
[onSessionEnded, sessionId]
|
|
11276
11736
|
);
|
|
11277
|
-
const onStopPress = (0,
|
|
11737
|
+
const onStopPress = (0, import_react25.useCallback)(() => {
|
|
11278
11738
|
const ws = wsRef.current;
|
|
11279
11739
|
if (ws && ws.readyState === 1) {
|
|
11280
11740
|
ws.send(JSON.stringify({ type: "goodbye", reason: "manual_stop" }));
|
|
@@ -11283,21 +11743,21 @@ function AiRemoteControl({
|
|
|
11283
11743
|
onClose();
|
|
11284
11744
|
}, [_finishSession, onClose]);
|
|
11285
11745
|
if (!visible) return null;
|
|
11286
|
-
return /* @__PURE__ */
|
|
11287
|
-
|
|
11746
|
+
return /* @__PURE__ */ import_react25.default.createElement(
|
|
11747
|
+
import_react_native25.Modal,
|
|
11288
11748
|
{
|
|
11289
11749
|
animationType: "fade",
|
|
11290
11750
|
onRequestClose: onClose,
|
|
11291
11751
|
transparent: true,
|
|
11292
11752
|
visible
|
|
11293
11753
|
},
|
|
11294
|
-
/* @__PURE__ */
|
|
11295
|
-
|
|
11754
|
+
/* @__PURE__ */ import_react25.default.createElement(
|
|
11755
|
+
import_react_native25.View,
|
|
11296
11756
|
{
|
|
11297
|
-
style: [
|
|
11757
|
+
style: [styles19.backdrop, style],
|
|
11298
11758
|
dataSet: { "tpk-ai-overlay": "true" }
|
|
11299
11759
|
},
|
|
11300
|
-
/* @__PURE__ */
|
|
11760
|
+
/* @__PURE__ */ import_react25.default.createElement(import_react_native25.View, { style: styles19.card }, /* @__PURE__ */ import_react25.default.createElement(import_react_native25.View, { style: styles19.header }, /* @__PURE__ */ import_react25.default.createElement(TpkIcon, { name: "sparkle", size: 28, color: "#7C3AED" }), /* @__PURE__ */ import_react25.default.createElement(import_react_native25.Text, { style: styles19.title }, status === "choosing" ? t.chooseTester : t.aiTesting)), status === "choosing" ? /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, /* @__PURE__ */ import_react25.default.createElement(import_react_native25.Text, { style: styles19.subtitle }, t.pickPersona), /* @__PURE__ */ import_react25.default.createElement(import_react_native25.View, { style: styles19.personaList }, (personas.length ? personas : [
|
|
11301
11761
|
{
|
|
11302
11762
|
slug: "junior_tester",
|
|
11303
11763
|
displayName: t.defaultPersonaName,
|
|
@@ -11305,58 +11765,58 @@ function AiRemoteControl({
|
|
|
11305
11765
|
}
|
|
11306
11766
|
]).map((p) => {
|
|
11307
11767
|
const sel = p.slug === selectedPersona;
|
|
11308
|
-
return /* @__PURE__ */
|
|
11309
|
-
|
|
11768
|
+
return /* @__PURE__ */ import_react25.default.createElement(
|
|
11769
|
+
import_react_native25.Pressable,
|
|
11310
11770
|
{
|
|
11311
11771
|
key: p.slug,
|
|
11312
11772
|
accessibilityRole: "button",
|
|
11313
11773
|
accessibilityState: { selected: sel },
|
|
11314
11774
|
onPress: () => setSelectedPersona(p.slug),
|
|
11315
11775
|
style: [
|
|
11316
|
-
|
|
11317
|
-
sel &&
|
|
11776
|
+
styles19.personaChip,
|
|
11777
|
+
sel && styles19.personaChipSelected
|
|
11318
11778
|
]
|
|
11319
11779
|
},
|
|
11320
|
-
/* @__PURE__ */
|
|
11321
|
-
|
|
11780
|
+
/* @__PURE__ */ import_react25.default.createElement(
|
|
11781
|
+
import_react_native25.Text,
|
|
11322
11782
|
{
|
|
11323
11783
|
style: [
|
|
11324
|
-
|
|
11325
|
-
sel &&
|
|
11784
|
+
styles19.personaChipText,
|
|
11785
|
+
sel && styles19.personaChipTextSelected
|
|
11326
11786
|
]
|
|
11327
11787
|
},
|
|
11328
11788
|
p.displayName
|
|
11329
11789
|
)
|
|
11330
11790
|
);
|
|
11331
|
-
})), personas.find((p) => p.slug === selectedPersona)?.description ? /* @__PURE__ */
|
|
11332
|
-
|
|
11791
|
+
})), personas.find((p) => p.slug === selectedPersona)?.description ? /* @__PURE__ */ import_react25.default.createElement(import_react_native25.Text, { style: styles19.personaDesc }, personas.find((p) => p.slug === selectedPersona)?.description) : null, /* @__PURE__ */ import_react25.default.createElement(import_react_native25.View, { style: styles19.choosingActions }, /* @__PURE__ */ import_react25.default.createElement(
|
|
11792
|
+
import_react_native25.Pressable,
|
|
11333
11793
|
{
|
|
11334
11794
|
accessibilityRole: "button",
|
|
11335
11795
|
onPress: onClose,
|
|
11336
|
-
style:
|
|
11796
|
+
style: styles19.cancelButton
|
|
11337
11797
|
},
|
|
11338
|
-
/* @__PURE__ */
|
|
11339
|
-
), /* @__PURE__ */
|
|
11340
|
-
|
|
11798
|
+
/* @__PURE__ */ import_react25.default.createElement(import_react_native25.Text, { style: styles19.cancelText }, t.cancel)
|
|
11799
|
+
), /* @__PURE__ */ import_react25.default.createElement(
|
|
11800
|
+
import_react_native25.Pressable,
|
|
11341
11801
|
{
|
|
11342
11802
|
accessibilityRole: "button",
|
|
11343
11803
|
onPress: _start,
|
|
11344
|
-
style:
|
|
11804
|
+
style: styles19.startButton
|
|
11345
11805
|
},
|
|
11346
|
-
/* @__PURE__ */
|
|
11347
|
-
))) : /* @__PURE__ */
|
|
11348
|
-
|
|
11806
|
+
/* @__PURE__ */ import_react25.default.createElement(import_react_native25.Text, { style: styles19.stopText }, t.startTest)
|
|
11807
|
+
))) : /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, /* @__PURE__ */ import_react25.default.createElement(import_react_native25.Text, { style: styles19.subtitle }, status === "starting" && t.starting, status === "running" && t.running(actionCount), status === "paused" && t.paused, status === "ended" && t.ended, status === "error" && (errorMessage2?.[language] ?? t.error)), status === "running" || status === "paused" ? /* @__PURE__ */ import_react25.default.createElement(import_react_native25.Text, { style: styles19.hint }, t.hint) : null, /* @__PURE__ */ import_react25.default.createElement(
|
|
11808
|
+
import_react_native25.Pressable,
|
|
11349
11809
|
{
|
|
11350
11810
|
accessibilityRole: "button",
|
|
11351
11811
|
onPress: onStopPress,
|
|
11352
|
-
style:
|
|
11812
|
+
style: styles19.stopButton
|
|
11353
11813
|
},
|
|
11354
|
-
/* @__PURE__ */
|
|
11814
|
+
/* @__PURE__ */ import_react25.default.createElement(import_react_native25.Text, { style: styles19.stopText }, status === "ended" ? t.close : t.stop)
|
|
11355
11815
|
)))
|
|
11356
11816
|
)
|
|
11357
11817
|
);
|
|
11358
11818
|
}
|
|
11359
|
-
var
|
|
11819
|
+
var styles19 = import_react_native25.StyleSheet.create({
|
|
11360
11820
|
backdrop: {
|
|
11361
11821
|
flex: 1,
|
|
11362
11822
|
backgroundColor: "rgba(124, 58, 237, 0.18)",
|
|
@@ -11463,7 +11923,1003 @@ var styles18 = import_react_native24.StyleSheet.create({
|
|
|
11463
11923
|
}
|
|
11464
11924
|
});
|
|
11465
11925
|
|
|
11926
|
+
// src/live/live-link.ts
|
|
11927
|
+
var OPEN = 1;
|
|
11928
|
+
var TpkLiveLink = class {
|
|
11929
|
+
constructor(opts) {
|
|
11930
|
+
this.socket = null;
|
|
11931
|
+
this.retry = null;
|
|
11932
|
+
this.wanted = false;
|
|
11933
|
+
this.failures = 0;
|
|
11934
|
+
/** Bumped on every connect attempt and on stop, so late callbacks of
|
|
11935
|
+
* an abandoned socket do nothing. */
|
|
11936
|
+
this.generation = 0;
|
|
11937
|
+
this._status = "off";
|
|
11938
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
11939
|
+
this.opts = opts;
|
|
11940
|
+
}
|
|
11941
|
+
get status() {
|
|
11942
|
+
return this._status;
|
|
11943
|
+
}
|
|
11944
|
+
/** Subscribe to status changes. Returns the unsubscribe function. */
|
|
11945
|
+
onStatus(listener) {
|
|
11946
|
+
this.listeners.add(listener);
|
|
11947
|
+
return () => {
|
|
11948
|
+
this.listeners.delete(listener);
|
|
11949
|
+
};
|
|
11950
|
+
}
|
|
11951
|
+
/** Opens the link and keeps it open until `stop`. */
|
|
11952
|
+
start() {
|
|
11953
|
+
if (this.wanted) return;
|
|
11954
|
+
this.wanted = true;
|
|
11955
|
+
this.failures = 0;
|
|
11956
|
+
void this.connect();
|
|
11957
|
+
}
|
|
11958
|
+
stop() {
|
|
11959
|
+
this.wanted = false;
|
|
11960
|
+
this.generation++;
|
|
11961
|
+
if (this.retry) clearTimeout(this.retry);
|
|
11962
|
+
this.retry = null;
|
|
11963
|
+
this.close();
|
|
11964
|
+
this.setStatus("off");
|
|
11965
|
+
}
|
|
11966
|
+
dispose() {
|
|
11967
|
+
this.stop();
|
|
11968
|
+
this.listeners.clear();
|
|
11969
|
+
}
|
|
11970
|
+
setStatus(s) {
|
|
11971
|
+
if (this._status === s) return;
|
|
11972
|
+
this._status = s;
|
|
11973
|
+
for (const l of this.listeners) {
|
|
11974
|
+
try {
|
|
11975
|
+
l(s);
|
|
11976
|
+
} catch {
|
|
11977
|
+
}
|
|
11978
|
+
}
|
|
11979
|
+
}
|
|
11980
|
+
async connect() {
|
|
11981
|
+
if (!this.wanted) return;
|
|
11982
|
+
const gen = ++this.generation;
|
|
11983
|
+
this.setStatus("connecting");
|
|
11984
|
+
let url;
|
|
11985
|
+
try {
|
|
11986
|
+
url = await this.opts.openChannel();
|
|
11987
|
+
} catch (e) {
|
|
11988
|
+
if (gen === this.generation) this.fail(`open failed: ${errText(e)}`);
|
|
11989
|
+
return;
|
|
11990
|
+
}
|
|
11991
|
+
if (!this.wanted || gen !== this.generation) return;
|
|
11992
|
+
let ws;
|
|
11993
|
+
try {
|
|
11994
|
+
ws = this.opts.createSocket ? this.opts.createSocket(url) : new WebSocket(url);
|
|
11995
|
+
} catch (e) {
|
|
11996
|
+
this.fail(`socket failed: ${errText(e)}`);
|
|
11997
|
+
return;
|
|
11998
|
+
}
|
|
11999
|
+
this.socket = ws;
|
|
12000
|
+
let dropped = false;
|
|
12001
|
+
const drop = (why) => {
|
|
12002
|
+
if (dropped || gen !== this.generation) return;
|
|
12003
|
+
dropped = true;
|
|
12004
|
+
this.fail(why);
|
|
12005
|
+
};
|
|
12006
|
+
ws.onopen = () => {
|
|
12007
|
+
if (gen !== this.generation) return;
|
|
12008
|
+
void (async () => {
|
|
12009
|
+
let hello = {};
|
|
12010
|
+
try {
|
|
12011
|
+
hello = await this.opts.hello();
|
|
12012
|
+
} catch {
|
|
12013
|
+
}
|
|
12014
|
+
if (gen !== this.generation) return;
|
|
12015
|
+
this.send(ws, { type: "hello", ...hello });
|
|
12016
|
+
this.failures = 0;
|
|
12017
|
+
this.setStatus("connected");
|
|
12018
|
+
TpkTalker.info("Live link connected");
|
|
12019
|
+
})();
|
|
12020
|
+
};
|
|
12021
|
+
ws.onmessage = (ev) => {
|
|
12022
|
+
if (gen !== this.generation) return;
|
|
12023
|
+
void this.onFrame(ws, ev.data);
|
|
12024
|
+
};
|
|
12025
|
+
ws.onerror = () => drop("socket error");
|
|
12026
|
+
ws.onclose = () => drop("socket closed");
|
|
12027
|
+
}
|
|
12028
|
+
fail(why) {
|
|
12029
|
+
TpkTalker.warn(`Live link: ${why}`);
|
|
12030
|
+
this.close();
|
|
12031
|
+
if (!this.wanted) return;
|
|
12032
|
+
this.setStatus("connecting");
|
|
12033
|
+
this.failures++;
|
|
12034
|
+
const seconds = Math.min(30, 2 ** Math.min(this.failures, 5));
|
|
12035
|
+
if (this.retry) clearTimeout(this.retry);
|
|
12036
|
+
this.retry = setTimeout(() => {
|
|
12037
|
+
this.retry = null;
|
|
12038
|
+
void this.connect();
|
|
12039
|
+
}, seconds * 1e3);
|
|
12040
|
+
}
|
|
12041
|
+
close() {
|
|
12042
|
+
const ws = this.socket;
|
|
12043
|
+
this.socket = null;
|
|
12044
|
+
if (!ws) return;
|
|
12045
|
+
ws.onopen = ws.onmessage = ws.onerror = ws.onclose = null;
|
|
12046
|
+
try {
|
|
12047
|
+
ws.close(1e3, "bye");
|
|
12048
|
+
} catch {
|
|
12049
|
+
}
|
|
12050
|
+
}
|
|
12051
|
+
send(ws, msg) {
|
|
12052
|
+
try {
|
|
12053
|
+
if (ws.readyState === OPEN) ws.send(JSON.stringify(msg));
|
|
12054
|
+
} catch (e) {
|
|
12055
|
+
TpkTalker.warn(`Live link: send failed: ${errText(e)}`);
|
|
12056
|
+
}
|
|
12057
|
+
}
|
|
12058
|
+
async onFrame(ws, raw) {
|
|
12059
|
+
let msg;
|
|
12060
|
+
try {
|
|
12061
|
+
msg = JSON.parse(typeof raw === "string" ? raw : String(raw));
|
|
12062
|
+
} catch {
|
|
12063
|
+
return;
|
|
12064
|
+
}
|
|
12065
|
+
if (!msg || typeof msg !== "object") return;
|
|
12066
|
+
const requestId = msg.requestId;
|
|
12067
|
+
let reply;
|
|
12068
|
+
if (msg.type === "snapshot_request") {
|
|
12069
|
+
try {
|
|
12070
|
+
reply = { type: "snapshot", requestId, data: await this.opts.capture() };
|
|
12071
|
+
} catch (e) {
|
|
12072
|
+
reply = { type: "snapshot", requestId, error: errText(e) };
|
|
12073
|
+
}
|
|
12074
|
+
} else if (msg.type === "action") {
|
|
12075
|
+
try {
|
|
12076
|
+
if (!this.opts.act) throw new Error("This app does not accept device actions");
|
|
12077
|
+
reply = { type: "action_result", requestId, data: await this.opts.act(msg) };
|
|
12078
|
+
} catch (e) {
|
|
12079
|
+
reply = { type: "action_result", requestId, error: errText(e) };
|
|
12080
|
+
}
|
|
12081
|
+
} else {
|
|
12082
|
+
return;
|
|
12083
|
+
}
|
|
12084
|
+
this.send(ws, reply);
|
|
12085
|
+
}
|
|
12086
|
+
};
|
|
12087
|
+
function errText(e) {
|
|
12088
|
+
return e instanceof Error ? e.message : String(e);
|
|
12089
|
+
}
|
|
12090
|
+
|
|
12091
|
+
// src/live/screen-text.ts
|
|
12092
|
+
var import_react_native26 = require("react-native");
|
|
12093
|
+
var HOST_COMPONENT = 5;
|
|
12094
|
+
var HOST_TEXT = 6;
|
|
12095
|
+
var OFFSCREEN = 22;
|
|
12096
|
+
var MAX_ENTRIES = 300;
|
|
12097
|
+
var MAX_TEXT = 300;
|
|
12098
|
+
var MEASURE_TIMEOUT_MS = 400;
|
|
12099
|
+
var ccLike = /\b(?:\d[ -]?){13,19}\b/g;
|
|
12100
|
+
var ibanLike = /\b[A-Z]{2}\d{2}[A-Z0-9]{10,30}\b/g;
|
|
12101
|
+
function propsOf(f) {
|
|
12102
|
+
const p = f.memoizedProps;
|
|
12103
|
+
return p && typeof p === "object" ? p : {};
|
|
12104
|
+
}
|
|
12105
|
+
function isButton(p) {
|
|
12106
|
+
return p.accessibilityRole === "button" || p.role === "button" || typeof p.onPress === "function";
|
|
12107
|
+
}
|
|
12108
|
+
function isTextInput(f) {
|
|
12109
|
+
if (f.tag !== HOST_COMPONENT || typeof f.type !== "string") return false;
|
|
12110
|
+
return /TextInput/i.test(f.type) || f.type === "input" || f.type === "textarea";
|
|
12111
|
+
}
|
|
12112
|
+
function isSecure(p) {
|
|
12113
|
+
if (p.secureTextEntry === true || p.type === "password") return true;
|
|
12114
|
+
const hint = `${p.textContentType ?? ""} ${p.autoComplete ?? ""}`.toLowerCase();
|
|
12115
|
+
return /password|cc-|creditcard|one-time-code/.test(hint);
|
|
12116
|
+
}
|
|
12117
|
+
function scrub(text) {
|
|
12118
|
+
return text.replace(ccLike, "[redacted]").replace(ibanLike, "[redacted]");
|
|
12119
|
+
}
|
|
12120
|
+
function clip(text) {
|
|
12121
|
+
const t = text.replace(/\s+/g, " ").trim();
|
|
12122
|
+
return t.length > MAX_TEXT ? `${t.slice(0, MAX_TEXT)}\u2026` : t;
|
|
12123
|
+
}
|
|
12124
|
+
function collectTexts(root) {
|
|
12125
|
+
const out = [];
|
|
12126
|
+
const walk = (f, inButton, host) => {
|
|
12127
|
+
let produced = false;
|
|
12128
|
+
for (let cur = f; cur && out.length < MAX_ENTRIES; cur = cur.sibling) {
|
|
12129
|
+
if (cur.type === TpkSensitive) continue;
|
|
12130
|
+
if (cur.tag === OFFSCREEN && cur.memoizedState != null) continue;
|
|
12131
|
+
const p = propsOf(cur);
|
|
12132
|
+
const button = inButton || isButton(p);
|
|
12133
|
+
if (cur.tag === HOST_TEXT) {
|
|
12134
|
+
const s = typeof cur.memoizedProps === "string" ? cur.memoizedProps : "";
|
|
12135
|
+
if (s.trim()) {
|
|
12136
|
+
const last = out[out.length - 1];
|
|
12137
|
+
if (last && last.node === host && host != null) {
|
|
12138
|
+
last.text += s;
|
|
12139
|
+
} else {
|
|
12140
|
+
out.push({ tag: button ? "button" : "text", text: s, node: host });
|
|
12141
|
+
}
|
|
12142
|
+
produced = true;
|
|
12143
|
+
}
|
|
12144
|
+
continue;
|
|
12145
|
+
}
|
|
12146
|
+
if (isTextInput(cur)) {
|
|
12147
|
+
const raw = p.value ?? p.text ?? p.defaultValue;
|
|
12148
|
+
const value = typeof raw === "string" ? raw : "";
|
|
12149
|
+
const placeholder = typeof p.placeholder === "string" ? p.placeholder : "";
|
|
12150
|
+
let text;
|
|
12151
|
+
if (isSecure(p)) {
|
|
12152
|
+
text = placeholder ? `[secure: ${placeholder}]` : "[secure]";
|
|
12153
|
+
} else {
|
|
12154
|
+
text = value || (placeholder ? `[placeholder: ${placeholder}]` : "");
|
|
12155
|
+
}
|
|
12156
|
+
if (text) {
|
|
12157
|
+
out.push({ tag: "textfield", text, node: cur.stateNode });
|
|
12158
|
+
produced = true;
|
|
12159
|
+
}
|
|
12160
|
+
continue;
|
|
12161
|
+
}
|
|
12162
|
+
const own = p.children;
|
|
12163
|
+
if (cur.tag === HOST_COMPONENT && (typeof own === "string" || typeof own === "number")) {
|
|
12164
|
+
const s = String(own);
|
|
12165
|
+
if (s.trim()) {
|
|
12166
|
+
out.push({ tag: button ? "button" : "text", text: s, node: cur.stateNode });
|
|
12167
|
+
produced = true;
|
|
12168
|
+
continue;
|
|
12169
|
+
}
|
|
12170
|
+
}
|
|
12171
|
+
const nextHost = cur.tag === HOST_COMPONENT ? cur.stateNode : host;
|
|
12172
|
+
const childProduced = walk(cur.child, button, nextHost);
|
|
12173
|
+
produced = produced || childProduced;
|
|
12174
|
+
if (!childProduced && cur.tag === HOST_COMPONENT) {
|
|
12175
|
+
const label = p.accessibilityLabel ?? p["aria-label"];
|
|
12176
|
+
if (typeof label === "string" && label.trim()) {
|
|
12177
|
+
out.push({ tag: button ? "button" : "label", text: label, node: cur.stateNode });
|
|
12178
|
+
produced = true;
|
|
12179
|
+
}
|
|
12180
|
+
}
|
|
12181
|
+
}
|
|
12182
|
+
return produced;
|
|
12183
|
+
};
|
|
12184
|
+
try {
|
|
12185
|
+
walk(root, false, null);
|
|
12186
|
+
} catch {
|
|
12187
|
+
return [];
|
|
12188
|
+
}
|
|
12189
|
+
return out;
|
|
12190
|
+
}
|
|
12191
|
+
function measure(node) {
|
|
12192
|
+
return new Promise((resolve) => {
|
|
12193
|
+
const done = (r) => resolve(r);
|
|
12194
|
+
const timer = setTimeout(() => done(null), MEASURE_TIMEOUT_MS);
|
|
12195
|
+
const finish = (r) => {
|
|
12196
|
+
clearTimeout(timer);
|
|
12197
|
+
done(r);
|
|
12198
|
+
};
|
|
12199
|
+
try {
|
|
12200
|
+
if (!node || typeof node !== "object") return finish(null);
|
|
12201
|
+
const n = node;
|
|
12202
|
+
if (typeof n.getBoundingClientRect === "function") {
|
|
12203
|
+
const r = n.getBoundingClientRect();
|
|
12204
|
+
return finish({ x: r.left, y: r.top, width: r.width, height: r.height });
|
|
12205
|
+
}
|
|
12206
|
+
const inst = n.canonical?.publicInstance ?? node;
|
|
12207
|
+
const cb = (x, y, width, height) => finish({ x, y, width, height });
|
|
12208
|
+
if (typeof inst.measureInWindow === "function") {
|
|
12209
|
+
inst.measureInWindow(cb);
|
|
12210
|
+
return;
|
|
12211
|
+
}
|
|
12212
|
+
const fabric = globalThis.nativeFabricUIManager;
|
|
12213
|
+
if (n.node && typeof fabric?.measureInWindow === "function") {
|
|
12214
|
+
fabric.measureInWindow(n.node, cb);
|
|
12215
|
+
return;
|
|
12216
|
+
}
|
|
12217
|
+
finish(null);
|
|
12218
|
+
} catch {
|
|
12219
|
+
finish(null);
|
|
12220
|
+
}
|
|
12221
|
+
});
|
|
12222
|
+
}
|
|
12223
|
+
async function readScreenTexts(root) {
|
|
12224
|
+
const found = collectTexts(root);
|
|
12225
|
+
if (found.length === 0) return [];
|
|
12226
|
+
let win = { width: Infinity, height: Infinity };
|
|
12227
|
+
try {
|
|
12228
|
+
const d = import_react_native26.Dimensions.get("window");
|
|
12229
|
+
if (d.width > 0 && d.height > 0) win = d;
|
|
12230
|
+
} catch {
|
|
12231
|
+
}
|
|
12232
|
+
const rects = await Promise.all(found.map((f) => measure(f.node)));
|
|
12233
|
+
const rows = [];
|
|
12234
|
+
found.forEach((f, i) => {
|
|
12235
|
+
const r = rects[i];
|
|
12236
|
+
if (r) {
|
|
12237
|
+
if (r.width <= 0 && r.height <= 0) return;
|
|
12238
|
+
if (r.y >= win.height || r.y + r.height <= 0) return;
|
|
12239
|
+
if (r.x >= win.width || r.x + r.width <= 0) return;
|
|
12240
|
+
}
|
|
12241
|
+
const text = clip(f.tag === "textfield" && f.text.startsWith("[secure") ? f.text : scrub(f.text));
|
|
12242
|
+
if (!text) return;
|
|
12243
|
+
rows.push({
|
|
12244
|
+
tag: f.tag,
|
|
12245
|
+
text,
|
|
12246
|
+
x: r ? Math.round(r.x) : 0,
|
|
12247
|
+
y: r ? Math.round(r.y) : 0,
|
|
12248
|
+
order: i,
|
|
12249
|
+
measured: r != null
|
|
12250
|
+
});
|
|
12251
|
+
});
|
|
12252
|
+
if (rows.every((r) => r.measured)) {
|
|
12253
|
+
rows.sort((a, b) => a.y - b.y || a.x - b.x || a.order - b.order);
|
|
12254
|
+
}
|
|
12255
|
+
return rows.map(({ tag, text, x, y }) => ({ tag, text, x, y }));
|
|
12256
|
+
}
|
|
12257
|
+
var HOST_ROOT = 3;
|
|
12258
|
+
function currentFiberOf(instance) {
|
|
12259
|
+
try {
|
|
12260
|
+
const start = instance?._reactInternals;
|
|
12261
|
+
if (!start) return null;
|
|
12262
|
+
let top = start;
|
|
12263
|
+
while (top && top.tag !== HOST_ROOT) top = top.return;
|
|
12264
|
+
const current = top?.stateNode?.current;
|
|
12265
|
+
if (!current) return start;
|
|
12266
|
+
const stack = [current];
|
|
12267
|
+
let budget = 5e3;
|
|
12268
|
+
while (stack.length && budget-- > 0) {
|
|
12269
|
+
const f = stack.pop();
|
|
12270
|
+
if (f.stateNode === instance) return f;
|
|
12271
|
+
if (f.sibling) stack.push(f.sibling);
|
|
12272
|
+
if (f.child) stack.push(f.child);
|
|
12273
|
+
}
|
|
12274
|
+
return start;
|
|
12275
|
+
} catch {
|
|
12276
|
+
return null;
|
|
12277
|
+
}
|
|
12278
|
+
}
|
|
12279
|
+
|
|
12280
|
+
// src/live/live-snapshot.ts
|
|
12281
|
+
function readLiveState(provider) {
|
|
12282
|
+
if (!provider) return void 0;
|
|
12283
|
+
try {
|
|
12284
|
+
const value = provider();
|
|
12285
|
+
if (value === void 0) return void 0;
|
|
12286
|
+
const json = JSON.stringify(value);
|
|
12287
|
+
return json === void 0 ? void 0 : JSON.parse(json);
|
|
12288
|
+
} catch (e) {
|
|
12289
|
+
return { error: `liveStateProvider failed: ${e instanceof Error ? e.message : String(e)}` };
|
|
12290
|
+
}
|
|
12291
|
+
}
|
|
12292
|
+
function recentLogs(limit = 30) {
|
|
12293
|
+
try {
|
|
12294
|
+
return TpkTalker.instance.history().slice(-limit).map((e) => `${new Date(e.timestamp).toISOString()} ${e.level} ${e.message}`);
|
|
12295
|
+
} catch {
|
|
12296
|
+
return [];
|
|
12297
|
+
}
|
|
12298
|
+
}
|
|
12299
|
+
async function safe(fn, fallback) {
|
|
12300
|
+
try {
|
|
12301
|
+
return await fn();
|
|
12302
|
+
} catch {
|
|
12303
|
+
return fallback;
|
|
12304
|
+
}
|
|
12305
|
+
}
|
|
12306
|
+
async function captureLiveSnapshot(src) {
|
|
12307
|
+
const crumbs = (() => {
|
|
12308
|
+
try {
|
|
12309
|
+
return src.breadcrumbs().slice(-15);
|
|
12310
|
+
} catch {
|
|
12311
|
+
return [];
|
|
12312
|
+
}
|
|
12313
|
+
})();
|
|
12314
|
+
const allCrumbs = (() => {
|
|
12315
|
+
try {
|
|
12316
|
+
return src.breadcrumbs();
|
|
12317
|
+
} catch {
|
|
12318
|
+
return [];
|
|
12319
|
+
}
|
|
12320
|
+
})();
|
|
12321
|
+
const screen = [...allCrumbs].reverse().find((b) => b.action === "navigation" && b.screen)?.screen;
|
|
12322
|
+
const read = src.readTexts ?? readScreenTexts;
|
|
12323
|
+
const texts = await safe(() => read(src.rootFiber?.() ?? null), []);
|
|
12324
|
+
const [app, shot] = await Promise.all([
|
|
12325
|
+
safe(src.app, {}),
|
|
12326
|
+
src.screenshot ? safe(src.screenshot, null) : Promise.resolve(null)
|
|
12327
|
+
]);
|
|
12328
|
+
const appState = readLiveState(src.liveStateProvider);
|
|
12329
|
+
const out = {
|
|
12330
|
+
captured_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
12331
|
+
};
|
|
12332
|
+
if (screen) out.screen = screen;
|
|
12333
|
+
out.navigation = deriveNavigationPath(allCrumbs, 10);
|
|
12334
|
+
out.texts = texts;
|
|
12335
|
+
if (appState !== void 0) out.app_state = appState;
|
|
12336
|
+
out.app = app;
|
|
12337
|
+
out.breadcrumbs = crumbs.map((b) => {
|
|
12338
|
+
const row = { type: b.action, at: b.t };
|
|
12339
|
+
if (b.screen) row.screen = b.screen;
|
|
12340
|
+
const message = b.target ?? (typeof b.data?.message === "string" ? b.data.message : void 0);
|
|
12341
|
+
if (message) row.message = message;
|
|
12342
|
+
return row;
|
|
12343
|
+
});
|
|
12344
|
+
out.logs = recentLogs();
|
|
12345
|
+
if (shot) out.screenshot = shot;
|
|
12346
|
+
return out;
|
|
12347
|
+
}
|
|
12348
|
+
async function liveAppInfo() {
|
|
12349
|
+
try {
|
|
12350
|
+
const A = await import("expo-application");
|
|
12351
|
+
return {
|
|
12352
|
+
name: A.applicationName ?? void 0,
|
|
12353
|
+
version: A.nativeApplicationVersion ?? void 0,
|
|
12354
|
+
build: A.nativeBuildVersion ?? void 0,
|
|
12355
|
+
bundleId: A.applicationId ?? void 0
|
|
12356
|
+
};
|
|
12357
|
+
} catch {
|
|
12358
|
+
return {};
|
|
12359
|
+
}
|
|
12360
|
+
}
|
|
12361
|
+
|
|
12362
|
+
// src/live/LiveNoteDialog.tsx
|
|
12363
|
+
var import_react26 = __toESM(require("react"));
|
|
12364
|
+
var import_react_native27 = require("react-native");
|
|
12365
|
+
var CLAUDE_COLOR = "#D97757";
|
|
12366
|
+
function LiveNoteDialog({
|
|
12367
|
+
visible,
|
|
12368
|
+
sending = false,
|
|
12369
|
+
onCancel,
|
|
12370
|
+
onSend
|
|
12371
|
+
}) {
|
|
12372
|
+
const tr = useTr();
|
|
12373
|
+
const [text, setText] = (0, import_react26.useState)("");
|
|
12374
|
+
(0, import_react26.useEffect)(() => {
|
|
12375
|
+
if (visible) setText("");
|
|
12376
|
+
}, [visible]);
|
|
12377
|
+
if (!visible) return null;
|
|
12378
|
+
return /* @__PURE__ */ import_react26.default.createElement(import_react_native27.Modal, { transparent: true, animationType: "fade", visible: true, onRequestClose: onCancel }, /* @__PURE__ */ import_react26.default.createElement(
|
|
12379
|
+
import_react_native27.KeyboardAvoidingView,
|
|
12380
|
+
{
|
|
12381
|
+
style: styles20.backdrop,
|
|
12382
|
+
behavior: import_react_native27.Platform.OS === "ios" ? "padding" : void 0
|
|
12383
|
+
},
|
|
12384
|
+
/* @__PURE__ */ import_react26.default.createElement(import_react_native27.View, { style: styles20.card, testID: "tpk-live-note-dialog" }, /* @__PURE__ */ import_react26.default.createElement(import_react_native27.Text, { style: styles20.title }, tr({ en: "Send to Claude", de: "An Claude senden" })), /* @__PURE__ */ import_react26.default.createElement(
|
|
12385
|
+
import_react_native27.TextInput,
|
|
12386
|
+
{
|
|
12387
|
+
style: styles20.input,
|
|
12388
|
+
value: text,
|
|
12389
|
+
onChangeText: setText,
|
|
12390
|
+
autoFocus: true,
|
|
12391
|
+
multiline: true,
|
|
12392
|
+
autoCapitalize: "sentences",
|
|
12393
|
+
placeholder: tr({
|
|
12394
|
+
en: "What do you notice on this screen?",
|
|
12395
|
+
de: "Was f\xE4llt dir auf diesem Screen auf?"
|
|
12396
|
+
}),
|
|
12397
|
+
placeholderTextColor: "#94A3B8",
|
|
12398
|
+
testID: "tpk-live-note-input"
|
|
12399
|
+
}
|
|
12400
|
+
), /* @__PURE__ */ import_react26.default.createElement(import_react_native27.Text, { style: styles20.helper }, tr({
|
|
12401
|
+
en: "Screenshot and screen contents are attached.",
|
|
12402
|
+
de: "Screenshot und Bildschirminhalt gehen mit."
|
|
12403
|
+
})), /* @__PURE__ */ import_react26.default.createElement(import_react_native27.View, { style: styles20.actions }, /* @__PURE__ */ import_react26.default.createElement(import_react_native27.Pressable, { onPress: onCancel, style: styles20.button, testID: "tpk-live-note-cancel" }, /* @__PURE__ */ import_react26.default.createElement(import_react_native27.Text, { style: styles20.cancel }, tr({ en: "Cancel", de: "Abbrechen" }))), /* @__PURE__ */ import_react26.default.createElement(
|
|
12404
|
+
import_react_native27.Pressable,
|
|
12405
|
+
{
|
|
12406
|
+
onPress: () => onSend(text),
|
|
12407
|
+
disabled: sending,
|
|
12408
|
+
style: [styles20.button, styles20.send],
|
|
12409
|
+
testID: "tpk-live-note-send"
|
|
12410
|
+
},
|
|
12411
|
+
sending ? /* @__PURE__ */ import_react26.default.createElement(import_react_native27.ActivityIndicator, { color: "#FFFFFF" }) : /* @__PURE__ */ import_react26.default.createElement(import_react_native27.Text, { style: styles20.sendText }, tr({ en: "Send", de: "Senden" }))
|
|
12412
|
+
)))
|
|
12413
|
+
));
|
|
12414
|
+
}
|
|
12415
|
+
var styles20 = import_react_native27.StyleSheet.create({
|
|
12416
|
+
backdrop: {
|
|
12417
|
+
flex: 1,
|
|
12418
|
+
backgroundColor: "rgba(15,23,42,0.45)",
|
|
12419
|
+
justifyContent: "center",
|
|
12420
|
+
padding: 24
|
|
12421
|
+
},
|
|
12422
|
+
card: {
|
|
12423
|
+
backgroundColor: "#FFFFFF",
|
|
12424
|
+
borderRadius: 16,
|
|
12425
|
+
padding: 20,
|
|
12426
|
+
maxWidth: 480,
|
|
12427
|
+
width: "100%",
|
|
12428
|
+
alignSelf: "center"
|
|
12429
|
+
},
|
|
12430
|
+
title: { fontSize: 18, fontWeight: "600", color: "#0F172A", marginBottom: 12 },
|
|
12431
|
+
input: {
|
|
12432
|
+
minHeight: 64,
|
|
12433
|
+
maxHeight: 160,
|
|
12434
|
+
borderWidth: 1,
|
|
12435
|
+
borderColor: "#CBD5E1",
|
|
12436
|
+
borderRadius: 10,
|
|
12437
|
+
padding: 10,
|
|
12438
|
+
fontSize: 16,
|
|
12439
|
+
color: "#0F172A",
|
|
12440
|
+
textAlignVertical: "top"
|
|
12441
|
+
},
|
|
12442
|
+
helper: { fontSize: 12, color: "#64748B", marginTop: 6 },
|
|
12443
|
+
actions: { flexDirection: "row", justifyContent: "flex-end", marginTop: 16, gap: 8 },
|
|
12444
|
+
button: { paddingHorizontal: 16, paddingVertical: 10, borderRadius: 10, minWidth: 80, alignItems: "center" },
|
|
12445
|
+
cancel: { color: "#334155", fontSize: 15 },
|
|
12446
|
+
send: { backgroundColor: CLAUDE_COLOR },
|
|
12447
|
+
sendText: { color: "#FFFFFF", fontSize: 15, fontWeight: "600" }
|
|
12448
|
+
});
|
|
12449
|
+
|
|
12450
|
+
// src/live/live-actions.ts
|
|
12451
|
+
var DENY_LABEL_PATTERNS = [
|
|
12452
|
+
/\bdelete\s+(account|profile|user|workspace)\b/i,
|
|
12453
|
+
/\b(cancel|stop)\s+(subscription|plan|membership)\b/i,
|
|
12454
|
+
/\bprocess\s+payment\b/i,
|
|
12455
|
+
/\b(pay|charge|withdraw|transfer)\s+now\b/i,
|
|
12456
|
+
/\bsign\s*out\b/i,
|
|
12457
|
+
/\blog\s*out\b/i,
|
|
12458
|
+
/\b(löschen|kündigen|abmelden)\b/i
|
|
12459
|
+
];
|
|
12460
|
+
function deniedBy(label) {
|
|
12461
|
+
for (const re of DENY_LABEL_PATTERNS) if (re.test(label)) return re;
|
|
12462
|
+
return null;
|
|
12463
|
+
}
|
|
12464
|
+
function parseLiveAction(raw) {
|
|
12465
|
+
const m = raw && typeof raw === "object" ? raw : {};
|
|
12466
|
+
const kind = m.kind;
|
|
12467
|
+
if (kind !== "tap" && kind !== "type" && kind !== "scroll" && kind !== "back") {
|
|
12468
|
+
throw new Error(`Unknown action kind: ${String(kind)}`);
|
|
12469
|
+
}
|
|
12470
|
+
const action = { kind };
|
|
12471
|
+
const t = m.target;
|
|
12472
|
+
if (t && typeof t === "object") {
|
|
12473
|
+
const tt = t;
|
|
12474
|
+
if (typeof tt.text === "string" && tt.text.trim()) action.target = { text: tt.text };
|
|
12475
|
+
else if (typeof tt.x === "number" && typeof tt.y === "number") action.target = { x: tt.x, y: tt.y };
|
|
12476
|
+
}
|
|
12477
|
+
if (typeof m.text === "string") action.text = m.text;
|
|
12478
|
+
if (m.submit === true) action.submit = true;
|
|
12479
|
+
if (m.direction === "up" || m.direction === "down" || m.direction === "left" || m.direction === "right") {
|
|
12480
|
+
action.direction = m.direction;
|
|
12481
|
+
}
|
|
12482
|
+
return action;
|
|
12483
|
+
}
|
|
12484
|
+
var MAX_FIBERS = 8e3;
|
|
12485
|
+
function walkFibers(root) {
|
|
12486
|
+
const out = [];
|
|
12487
|
+
const stack = [{ f: root, depth: 0 }];
|
|
12488
|
+
while (stack.length && out.length < MAX_FIBERS) {
|
|
12489
|
+
const { f, depth } = stack.pop();
|
|
12490
|
+
if (!f) continue;
|
|
12491
|
+
if (f.sibling) stack.push({ f: f.sibling, depth });
|
|
12492
|
+
if (f.type === TpkSensitive) continue;
|
|
12493
|
+
if (f.tag === OFFSCREEN && f.memoizedState != null) continue;
|
|
12494
|
+
out.push({ fiber: f, depth, order: out.length });
|
|
12495
|
+
if (f.child) stack.push({ f: f.child, depth: depth + 1 });
|
|
12496
|
+
}
|
|
12497
|
+
return out;
|
|
12498
|
+
}
|
|
12499
|
+
function norm(s) {
|
|
12500
|
+
return s.replace(/\s+/g, " ").trim().toLowerCase();
|
|
12501
|
+
}
|
|
12502
|
+
function ownText(f) {
|
|
12503
|
+
if (f.tag !== HOST_COMPONENT) return "";
|
|
12504
|
+
const p = propsOf(f);
|
|
12505
|
+
if (typeof p.children === "string" || typeof p.children === "number") return String(p.children);
|
|
12506
|
+
let s = "";
|
|
12507
|
+
for (let c = f.child; c; c = c.sibling) {
|
|
12508
|
+
if (c.tag === HOST_TEXT && typeof c.memoizedProps === "string") s += c.memoizedProps;
|
|
12509
|
+
}
|
|
12510
|
+
return s;
|
|
12511
|
+
}
|
|
12512
|
+
function a11yLabel(p) {
|
|
12513
|
+
const l = p.accessibilityLabel ?? p["aria-label"];
|
|
12514
|
+
return typeof l === "string" ? l : "";
|
|
12515
|
+
}
|
|
12516
|
+
function subtreeText(f) {
|
|
12517
|
+
const parts = [];
|
|
12518
|
+
const own = a11yLabel(propsOf(f));
|
|
12519
|
+
if (own) parts.push(own);
|
|
12520
|
+
for (const v of walkFibers(f.child)) {
|
|
12521
|
+
if (v.fiber.tag === HOST_TEXT && typeof v.fiber.memoizedProps === "string") parts.push(v.fiber.memoizedProps);
|
|
12522
|
+
else if (v.fiber.tag === HOST_COMPONENT) {
|
|
12523
|
+
const p = propsOf(v.fiber);
|
|
12524
|
+
if (typeof p.children === "string") parts.push(p.children);
|
|
12525
|
+
const l = a11yLabel(p);
|
|
12526
|
+
if (l) parts.push(l);
|
|
12527
|
+
}
|
|
12528
|
+
if (parts.length > 40) break;
|
|
12529
|
+
}
|
|
12530
|
+
return parts.join(" ");
|
|
12531
|
+
}
|
|
12532
|
+
function hostNodeOf(f) {
|
|
12533
|
+
if (f.tag === HOST_COMPONENT) return f.stateNode;
|
|
12534
|
+
for (const v of walkFibers(f.child)) {
|
|
12535
|
+
if (v.fiber.tag === HOST_COMPONENT) return v.fiber.stateNode;
|
|
12536
|
+
}
|
|
12537
|
+
return null;
|
|
12538
|
+
}
|
|
12539
|
+
function isDisabled(p) {
|
|
12540
|
+
const st = p.accessibilityState;
|
|
12541
|
+
return p.disabled === true || st?.disabled === true || p["aria-disabled"] === true;
|
|
12542
|
+
}
|
|
12543
|
+
function pressableAncestor(f, root) {
|
|
12544
|
+
const stop = root.return ?? null;
|
|
12545
|
+
for (let cur = f; cur && cur !== stop; cur = cur.return) {
|
|
12546
|
+
const p = propsOf(cur);
|
|
12547
|
+
if (typeof p.onPress === "function" || typeof p.onClick === "function") return cur;
|
|
12548
|
+
}
|
|
12549
|
+
return null;
|
|
12550
|
+
}
|
|
12551
|
+
function fakeEvent(target, x = 0, y = 0) {
|
|
12552
|
+
const noop2 = () => void 0;
|
|
12553
|
+
return {
|
|
12554
|
+
type: "press",
|
|
12555
|
+
nativeEvent: { pageX: x, pageY: y, locationX: 0, locationY: 0, timestamp: Date.now() },
|
|
12556
|
+
target,
|
|
12557
|
+
currentTarget: target,
|
|
12558
|
+
persist: noop2,
|
|
12559
|
+
preventDefault: noop2,
|
|
12560
|
+
stopPropagation: noop2,
|
|
12561
|
+
isDefaultPrevented: () => false,
|
|
12562
|
+
isPropagationStopped: () => false
|
|
12563
|
+
};
|
|
12564
|
+
}
|
|
12565
|
+
function invoke(fn, ...args) {
|
|
12566
|
+
const r = fn(...args);
|
|
12567
|
+
if (r && typeof r.catch === "function") {
|
|
12568
|
+
r.catch(() => void 0);
|
|
12569
|
+
}
|
|
12570
|
+
}
|
|
12571
|
+
async function visibleRect(env, node) {
|
|
12572
|
+
const m = env.measure ?? measure;
|
|
12573
|
+
let rect;
|
|
12574
|
+
try {
|
|
12575
|
+
rect = await m(node);
|
|
12576
|
+
} catch {
|
|
12577
|
+
rect = null;
|
|
12578
|
+
}
|
|
12579
|
+
if (!rect) return { rect: null, visible: true };
|
|
12580
|
+
const w = env.window?.width ?? Infinity;
|
|
12581
|
+
const h = env.window?.height ?? Infinity;
|
|
12582
|
+
const visible = (rect.width > 0 || rect.height > 0) && rect.y < h && rect.y + rect.height > 0 && rect.x < w && rect.x + rect.width > 0;
|
|
12583
|
+
return { rect, visible };
|
|
12584
|
+
}
|
|
12585
|
+
function unwrapSnapshotLabel(q) {
|
|
12586
|
+
const m = /^\[(?:placeholder|secure):\s*(.*)\]$/i.exec(q.trim());
|
|
12587
|
+
return m ? m[1] : q;
|
|
12588
|
+
}
|
|
12589
|
+
function score(label, query) {
|
|
12590
|
+
const l = norm(label);
|
|
12591
|
+
if (!l) return 0;
|
|
12592
|
+
if (l === query) return 3;
|
|
12593
|
+
if (query.length >= 2 && l.startsWith(query)) return 2;
|
|
12594
|
+
if (query.length >= 2 && l.includes(query)) return 1;
|
|
12595
|
+
return 0;
|
|
12596
|
+
}
|
|
12597
|
+
async function pickBest(env, cands) {
|
|
12598
|
+
if (!cands.length) return null;
|
|
12599
|
+
const top = Math.max(...cands.map((c) => c.score));
|
|
12600
|
+
const best = cands.filter((c) => c.score === top);
|
|
12601
|
+
const vis = await Promise.all(best.map((c) => visibleRect(env, hostNodeOf(c.fiber))));
|
|
12602
|
+
const shown = best.filter((_, i) => vis[i].visible);
|
|
12603
|
+
const pool = shown.length ? shown : best;
|
|
12604
|
+
return pool[pool.length - 1];
|
|
12605
|
+
}
|
|
12606
|
+
function refuseIfDenied(...labels) {
|
|
12607
|
+
for (const l of labels) {
|
|
12608
|
+
const re = l ? deniedBy(l) : null;
|
|
12609
|
+
if (re) throw new Error(`Refused: "${l.trim().slice(0, 60)}" matches the deny list (${re.source})`);
|
|
12610
|
+
}
|
|
12611
|
+
}
|
|
12612
|
+
function press(target, label, x, y) {
|
|
12613
|
+
const p = propsOf(target);
|
|
12614
|
+
if (isDisabled(p)) throw new Error(`"${label}" is disabled`);
|
|
12615
|
+
refuseIfDenied(label, subtreeText(target));
|
|
12616
|
+
const host = hostNodeOf(target);
|
|
12617
|
+
if (isTextInput(target)) {
|
|
12618
|
+
const n = host;
|
|
12619
|
+
if (typeof n?.focus === "function") n.focus();
|
|
12620
|
+
return { ok: true, matched: label, focused: true };
|
|
12621
|
+
}
|
|
12622
|
+
const fn = typeof p.onPress === "function" ? p.onPress : p.onClick;
|
|
12623
|
+
if (!fn) throw new Error(`"${label}" cannot be tapped (no onPress)`);
|
|
12624
|
+
invoke(fn, fakeEvent(host, x, y));
|
|
12625
|
+
return { ok: true, matched: label };
|
|
12626
|
+
}
|
|
12627
|
+
async function tapText(env, root, text) {
|
|
12628
|
+
const query = norm(unwrapSnapshotLabel(text));
|
|
12629
|
+
if (!query) throw new Error("Say what to tap");
|
|
12630
|
+
const cands = [];
|
|
12631
|
+
for (const v of walkFibers(root)) {
|
|
12632
|
+
const f = v.fiber;
|
|
12633
|
+
if (f.tag !== HOST_COMPONENT) continue;
|
|
12634
|
+
const p = propsOf(f);
|
|
12635
|
+
const labels = [ownText(f), a11yLabel(p)];
|
|
12636
|
+
if (isTextInput(f) && typeof p.placeholder === "string") labels.push(p.placeholder);
|
|
12637
|
+
const s = Math.max(...labels.map((l) => score(l, query)));
|
|
12638
|
+
if (s > 0) cands.push({ fiber: f, label: labels.find((l) => score(l, query) === s) ?? text, score: s, order: v.order });
|
|
12639
|
+
}
|
|
12640
|
+
const pressable = [];
|
|
12641
|
+
for (const c of cands) {
|
|
12642
|
+
const target = isTextInput(c.fiber) ? c.fiber : pressableAncestor(c.fiber, root);
|
|
12643
|
+
if (target) pressable.push({ ...c, fiber: target });
|
|
12644
|
+
}
|
|
12645
|
+
const hit = await pickBest(env, pressable);
|
|
12646
|
+
if (!hit) {
|
|
12647
|
+
if (cands.length) {
|
|
12648
|
+
refuseIfDenied(cands[cands.length - 1].label);
|
|
12649
|
+
throw new Error(`"${text}" is on screen but nothing tappable holds it`);
|
|
12650
|
+
}
|
|
12651
|
+
throw new Error(`Nothing on screen matches "${text}"`);
|
|
12652
|
+
}
|
|
12653
|
+
return press(hit.fiber, hit.label.trim() || text);
|
|
12654
|
+
}
|
|
12655
|
+
async function tapPoint(env, root, x, y) {
|
|
12656
|
+
const targets = [];
|
|
12657
|
+
for (const v of walkFibers(root)) {
|
|
12658
|
+
const p = propsOf(v.fiber);
|
|
12659
|
+
if (typeof p.onPress === "function" || typeof p.onClick === "function" || isTextInput(v.fiber)) {
|
|
12660
|
+
targets.push(v);
|
|
12661
|
+
if (targets.length >= 300) break;
|
|
12662
|
+
}
|
|
12663
|
+
}
|
|
12664
|
+
const rects = await Promise.all(targets.map((v) => visibleRect(env, hostNodeOf(v.fiber))));
|
|
12665
|
+
let best = null;
|
|
12666
|
+
targets.forEach((v, i) => {
|
|
12667
|
+
const r = rects[i].rect;
|
|
12668
|
+
if (!r || !rects[i].visible) return;
|
|
12669
|
+
if (x < r.x || x > r.x + r.width || y < r.y || y > r.y + r.height) return;
|
|
12670
|
+
const area = r.width * r.height;
|
|
12671
|
+
if (!best || area <= best.area) best = { v, area };
|
|
12672
|
+
});
|
|
12673
|
+
if (!best) throw new Error(`Nothing tappable at ${Math.round(x)}, ${Math.round(y)}`);
|
|
12674
|
+
const f = best.v.fiber;
|
|
12675
|
+
const label = subtreeText(f).trim().slice(0, 80) || `${Math.round(x)}, ${Math.round(y)}`;
|
|
12676
|
+
return press(f, label, x, y);
|
|
12677
|
+
}
|
|
12678
|
+
function inputLabel(p) {
|
|
12679
|
+
return typeof p.placeholder === "string" && p.placeholder || a11yLabel(p) || "";
|
|
12680
|
+
}
|
|
12681
|
+
function sameInstance(stateNode, focused) {
|
|
12682
|
+
if (!stateNode || !focused) return false;
|
|
12683
|
+
if (stateNode === focused) return true;
|
|
12684
|
+
const s = stateNode;
|
|
12685
|
+
return s.canonical?.publicInstance === focused;
|
|
12686
|
+
}
|
|
12687
|
+
function handlerUp(f, root, name) {
|
|
12688
|
+
const stop = root.return ?? null;
|
|
12689
|
+
let hops = 0;
|
|
12690
|
+
for (let cur = f; cur && cur !== stop && hops < 6; cur = cur.return, hops++) {
|
|
12691
|
+
const fn = propsOf(cur)[name];
|
|
12692
|
+
if (typeof fn === "function") return { fn, at: cur };
|
|
12693
|
+
}
|
|
12694
|
+
return null;
|
|
12695
|
+
}
|
|
12696
|
+
function isDomInput(node) {
|
|
12697
|
+
return !!node && typeof node.dispatchEvent === "function" && "value" in node;
|
|
12698
|
+
}
|
|
12699
|
+
async function typeText(env, root, action) {
|
|
12700
|
+
const text = action.text ?? "";
|
|
12701
|
+
const inputs = walkFibers(root).filter((v) => isTextInput(v.fiber) && propsOf(v.fiber).editable !== false && !isDisabled(propsOf(v.fiber))).map((v) => v.fiber);
|
|
12702
|
+
if (!inputs.length) throw new Error("No text field on screen");
|
|
12703
|
+
let field;
|
|
12704
|
+
let label;
|
|
12705
|
+
if (action.target?.text) {
|
|
12706
|
+
const query = norm(unwrapSnapshotLabel(action.target.text));
|
|
12707
|
+
const cands = [];
|
|
12708
|
+
inputs.forEach((f, order) => {
|
|
12709
|
+
const p = propsOf(f);
|
|
12710
|
+
const value = typeof p.value === "string" ? p.value : "";
|
|
12711
|
+
const s = Math.max(score(inputLabel(p), query), score(a11yLabel(p), query), value ? score(value, query) : 0);
|
|
12712
|
+
if (s > 0) cands.push({ fiber: f, label: inputLabel(p) || action.target.text, score: s, order });
|
|
12713
|
+
});
|
|
12714
|
+
const hit = await pickBest(env, cands);
|
|
12715
|
+
if (!hit) throw new Error(`No text field matches "${action.target.text}"`);
|
|
12716
|
+
field = hit.fiber;
|
|
12717
|
+
label = hit.label;
|
|
12718
|
+
} else {
|
|
12719
|
+
let focused = null;
|
|
12720
|
+
try {
|
|
12721
|
+
focused = env.focusedInput?.() ?? null;
|
|
12722
|
+
} catch {
|
|
12723
|
+
focused = null;
|
|
12724
|
+
}
|
|
12725
|
+
if (!focused && typeof document !== "undefined") focused = document.activeElement;
|
|
12726
|
+
field = inputs.find((f) => sameInstance(f.stateNode, focused)) ?? null;
|
|
12727
|
+
if (!field && inputs.length === 1) field = inputs[0];
|
|
12728
|
+
if (!field) throw new Error("No field is focused \u2014 say which one (into: its placeholder or label)");
|
|
12729
|
+
label = inputLabel(propsOf(field)) || "focused field";
|
|
12730
|
+
}
|
|
12731
|
+
const node = field.stateNode;
|
|
12732
|
+
if (isDomInput(node)) {
|
|
12733
|
+
const proto = Object.getPrototypeOf(node);
|
|
12734
|
+
const setter = Object.getOwnPropertyDescriptor(proto, "value")?.set;
|
|
12735
|
+
if (setter) setter.call(node, text);
|
|
12736
|
+
else node.value = text;
|
|
12737
|
+
const Ev = node.ownerDocument?.defaultView?.Event ?? Event;
|
|
12738
|
+
node.dispatchEvent(new Ev("input", { bubbles: true }));
|
|
12739
|
+
} else {
|
|
12740
|
+
const change = handlerUp(field, root, "onChangeText");
|
|
12741
|
+
if (change) {
|
|
12742
|
+
invoke(change.fn, text);
|
|
12743
|
+
} else {
|
|
12744
|
+
const onChange = handlerUp(field, root, "onChange");
|
|
12745
|
+
if (onChange) invoke(onChange.fn, { nativeEvent: { text }, target: node });
|
|
12746
|
+
}
|
|
12747
|
+
const composite = change?.at ?? field;
|
|
12748
|
+
if (propsOf(composite).value === void 0) {
|
|
12749
|
+
const inst = node?.canonical?.publicInstance ?? node;
|
|
12750
|
+
try {
|
|
12751
|
+
inst?.setNativeProps?.({ text });
|
|
12752
|
+
} catch {
|
|
12753
|
+
}
|
|
12754
|
+
}
|
|
12755
|
+
}
|
|
12756
|
+
let submitted = false;
|
|
12757
|
+
if (action.submit) {
|
|
12758
|
+
const submit = handlerUp(field, root, "onSubmitEditing");
|
|
12759
|
+
if (submit) {
|
|
12760
|
+
refuseIfDenied(label);
|
|
12761
|
+
invoke(submit.fn, { nativeEvent: { text }, target: node });
|
|
12762
|
+
submitted = true;
|
|
12763
|
+
} else if (isDomInput(node)) {
|
|
12764
|
+
const form = node.form;
|
|
12765
|
+
if (form && typeof form.requestSubmit === "function") {
|
|
12766
|
+
form.requestSubmit();
|
|
12767
|
+
submitted = true;
|
|
12768
|
+
}
|
|
12769
|
+
}
|
|
12770
|
+
}
|
|
12771
|
+
return { ok: true, matched: label, ...action.submit ? { submitted } : {} };
|
|
12772
|
+
}
|
|
12773
|
+
var lastOffset = /* @__PURE__ */ new WeakMap();
|
|
12774
|
+
function nameOf(f) {
|
|
12775
|
+
const t = f.type;
|
|
12776
|
+
if (typeof t === "string") return t;
|
|
12777
|
+
return t?.displayName || t?.name || "list";
|
|
12778
|
+
}
|
|
12779
|
+
async function scroll(env, root, direction) {
|
|
12780
|
+
const horizontal = direction === "left" || direction === "right";
|
|
12781
|
+
const seenHosts = /* @__PURE__ */ new Set();
|
|
12782
|
+
const found = [];
|
|
12783
|
+
for (const v of walkFibers(root)) {
|
|
12784
|
+
const inst = v.fiber.stateNode;
|
|
12785
|
+
if (!inst || typeof inst !== "object") continue;
|
|
12786
|
+
if (typeof inst.scrollTo !== "function" && typeof inst.scrollToOffset !== "function") continue;
|
|
12787
|
+
if (v.fiber.tag === HOST_COMPONENT) continue;
|
|
12788
|
+
if (propsOf(v.fiber).horizontal === true !== horizontal) continue;
|
|
12789
|
+
const host = hostNodeOf(v.fiber);
|
|
12790
|
+
if (host && seenHosts.has(host)) continue;
|
|
12791
|
+
seenHosts.add(host);
|
|
12792
|
+
found.push({ f: v.fiber, inst, host, order: v.order });
|
|
12793
|
+
}
|
|
12794
|
+
if (!found.length) throw new Error(`Nothing on screen scrolls ${horizontal ? "sideways" : "vertically"}`);
|
|
12795
|
+
const rects = await Promise.all(found.map((c2) => visibleRect(env, c2.host)));
|
|
12796
|
+
let pick = found.length - 1;
|
|
12797
|
+
let bestArea = -1;
|
|
12798
|
+
found.forEach((_, i) => {
|
|
12799
|
+
const r = rects[i];
|
|
12800
|
+
if (!r.visible) return;
|
|
12801
|
+
const area = r.rect ? r.rect.width * r.rect.height : 0;
|
|
12802
|
+
if (area >= bestArea) {
|
|
12803
|
+
bestArea = area;
|
|
12804
|
+
pick = i;
|
|
12805
|
+
}
|
|
12806
|
+
});
|
|
12807
|
+
const c = found[pick];
|
|
12808
|
+
const rect = rects[pick].rect;
|
|
12809
|
+
const frame = horizontal ? rect?.width : rect?.height;
|
|
12810
|
+
const win = horizontal ? env.window?.width : env.window?.height;
|
|
12811
|
+
const step = Math.round(0.8 * (frame && frame > 0 ? frame : win && Number.isFinite(win) ? win : 600));
|
|
12812
|
+
const metrics = c.inst._listRef?._scrollMetrics ?? c.inst._scrollMetrics;
|
|
12813
|
+
const dom = c.host;
|
|
12814
|
+
const domOffset = horizontal ? dom?.scrollLeft : dom?.scrollTop;
|
|
12815
|
+
const current = typeof metrics?.offset === "number" ? metrics.offset : typeof domOffset === "number" ? domOffset : lastOffset.get(c.inst) ?? 0;
|
|
12816
|
+
let next = direction === "down" || direction === "right" ? current + step : current - step;
|
|
12817
|
+
if (typeof metrics?.contentLength === "number" && typeof metrics.visibleLength === "number" && metrics.contentLength > 0) {
|
|
12818
|
+
next = Math.min(next, Math.max(0, metrics.contentLength - metrics.visibleLength));
|
|
12819
|
+
}
|
|
12820
|
+
next = Math.max(0, Math.round(next));
|
|
12821
|
+
if (typeof c.inst.scrollToOffset === "function") {
|
|
12822
|
+
c.inst.scrollToOffset({ offset: next, animated: false });
|
|
12823
|
+
} else {
|
|
12824
|
+
c.inst.scrollTo(horizontal ? { x: next, animated: false } : { y: next, animated: false });
|
|
12825
|
+
}
|
|
12826
|
+
lastOffset.set(c.inst, next);
|
|
12827
|
+
return { ok: true, matched: nameOf(c.f), offset: next, moved: next !== current };
|
|
12828
|
+
}
|
|
12829
|
+
function back(env, root) {
|
|
12830
|
+
let best = null;
|
|
12831
|
+
for (const v of walkFibers(root)) {
|
|
12832
|
+
const p = propsOf(v.fiber);
|
|
12833
|
+
const nav = p.navigation;
|
|
12834
|
+
if (!nav || typeof nav !== "object" || typeof nav.goBack !== "function") continue;
|
|
12835
|
+
let ok;
|
|
12836
|
+
try {
|
|
12837
|
+
ok = (nav.isFocused?.() ?? true) && (nav.canGoBack?.() ?? false);
|
|
12838
|
+
} catch {
|
|
12839
|
+
ok = false;
|
|
12840
|
+
}
|
|
12841
|
+
if (!ok) continue;
|
|
12842
|
+
if (!best || v.depth >= best.depth) {
|
|
12843
|
+
const route = p.route?.name;
|
|
12844
|
+
best = { nav, depth: v.depth, route };
|
|
12845
|
+
}
|
|
12846
|
+
}
|
|
12847
|
+
if (best) {
|
|
12848
|
+
best.nav.goBack();
|
|
12849
|
+
return { ok: true, matched: best.route ? `back from ${best.route}` : "back" };
|
|
12850
|
+
}
|
|
12851
|
+
if (env.historyBack?.()) return { ok: true, matched: "history.back" };
|
|
12852
|
+
throw new Error(
|
|
12853
|
+
"Back is not supported here: no react-navigation / expo-router screen that can go back"
|
|
12854
|
+
);
|
|
12855
|
+
}
|
|
12856
|
+
async function runLiveAction(raw, env) {
|
|
12857
|
+
const action = parseLiveAction(raw);
|
|
12858
|
+
const root = env.root;
|
|
12859
|
+
if (!root) throw new Error("The app shows nothing the SDK can reach");
|
|
12860
|
+
switch (action.kind) {
|
|
12861
|
+
case "tap": {
|
|
12862
|
+
const t = action.target;
|
|
12863
|
+
if (t?.text) return tapText(env, root, t.text);
|
|
12864
|
+
if (t && typeof t.x === "number" && typeof t.y === "number") return tapPoint(env, root, t.x, t.y);
|
|
12865
|
+
throw new Error("Say what to tap: text or x/y");
|
|
12866
|
+
}
|
|
12867
|
+
case "type":
|
|
12868
|
+
if (typeof action.text !== "string") throw new Error("type needs text");
|
|
12869
|
+
return typeText(env, root, action);
|
|
12870
|
+
case "scroll":
|
|
12871
|
+
return scroll(env, root, action.direction ?? "down");
|
|
12872
|
+
case "back":
|
|
12873
|
+
return back(env, root);
|
|
12874
|
+
}
|
|
12875
|
+
}
|
|
12876
|
+
|
|
12877
|
+
// src/live/LiveActionHint.tsx
|
|
12878
|
+
var import_react27 = __toESM(require("react"));
|
|
12879
|
+
var import_react_native28 = require("react-native");
|
|
12880
|
+
function liveActionHintText(kind, label, language) {
|
|
12881
|
+
const l = label.trim().slice(0, 60);
|
|
12882
|
+
const de = language === "de";
|
|
12883
|
+
switch (kind) {
|
|
12884
|
+
case "tap":
|
|
12885
|
+
return de ? `Claude tippt: ${l}` : `Claude taps: ${l}`;
|
|
12886
|
+
case "type":
|
|
12887
|
+
return de ? `Claude schreibt: ${l}` : `Claude types: ${l}`;
|
|
12888
|
+
case "scroll": {
|
|
12889
|
+
const dir = de ? { up: "hoch", down: "runter", left: "nach links", right: "nach rechts" }[l] ?? l : l;
|
|
12890
|
+
return de ? `Claude scrollt ${dir}` : `Claude scrolls ${dir}`;
|
|
12891
|
+
}
|
|
12892
|
+
case "back":
|
|
12893
|
+
return de ? "Claude geht zur\xFCck" : "Claude goes back";
|
|
12894
|
+
}
|
|
12895
|
+
}
|
|
12896
|
+
function LiveActionHint({ text, top }) {
|
|
12897
|
+
if (!text) return null;
|
|
12898
|
+
return /* @__PURE__ */ import_react27.default.createElement(import_react_native28.View, { pointerEvents: "none", style: [styles21.wrap, { top }], testID: "tpk-live-action-hint" }, /* @__PURE__ */ import_react27.default.createElement(import_react_native28.View, { style: styles21.pill }, /* @__PURE__ */ import_react27.default.createElement(import_react_native28.Text, { style: styles21.text, numberOfLines: 1 }, text)));
|
|
12899
|
+
}
|
|
12900
|
+
var styles21 = import_react_native28.StyleSheet.create({
|
|
12901
|
+
wrap: { position: "absolute", left: 0, right: 0, alignItems: "center" },
|
|
12902
|
+
pill: {
|
|
12903
|
+
backgroundColor: "rgba(217, 119, 87, 0.95)",
|
|
12904
|
+
borderRadius: 16,
|
|
12905
|
+
paddingHorizontal: 14,
|
|
12906
|
+
paddingVertical: 6,
|
|
12907
|
+
maxWidth: "90%"
|
|
12908
|
+
},
|
|
12909
|
+
text: { color: "#FFF", fontSize: 13, fontWeight: "700" }
|
|
12910
|
+
});
|
|
12911
|
+
|
|
11466
12912
|
// src/TesterPayKitWrapper.tsx
|
|
12913
|
+
var LiveContentAnchor = class extends import_react28.default.Component {
|
|
12914
|
+
render() {
|
|
12915
|
+
return this.props.children;
|
|
12916
|
+
}
|
|
12917
|
+
};
|
|
12918
|
+
var LIVE_LINK_STORAGE_KEY = "live-link-on";
|
|
12919
|
+
async function liveStorage() {
|
|
12920
|
+
const { ExpoStorage: ExpoStorage2 } = await Promise.resolve().then(() => (init_storage(), storage_exports));
|
|
12921
|
+
return new ExpoStorage2();
|
|
12922
|
+
}
|
|
11467
12923
|
var SHAKE_MIN_INTERVAL_MS = 1500;
|
|
11468
12924
|
function TesterPayKitWrapper({
|
|
11469
12925
|
children,
|
|
@@ -11484,46 +12940,63 @@ function TesterPayKitWrapper({
|
|
|
11484
12940
|
aiCoordinatorToken,
|
|
11485
12941
|
aiRemoteTrigger = false,
|
|
11486
12942
|
aiRemotePollSeconds = 15,
|
|
12943
|
+
enableLiveLink = false,
|
|
11487
12944
|
aiProjectId,
|
|
11488
12945
|
aiApiBaseUrl,
|
|
11489
12946
|
theme,
|
|
11490
12947
|
language,
|
|
11491
12948
|
testID = "tpk-wrapper"
|
|
11492
12949
|
}) {
|
|
11493
|
-
const rootRef = (0,
|
|
11494
|
-
const
|
|
11495
|
-
const
|
|
11496
|
-
const [
|
|
11497
|
-
const [
|
|
11498
|
-
const [
|
|
11499
|
-
const [
|
|
11500
|
-
const [
|
|
11501
|
-
const [
|
|
11502
|
-
const [
|
|
11503
|
-
const [
|
|
11504
|
-
const [
|
|
11505
|
-
const [
|
|
11506
|
-
const
|
|
12950
|
+
const rootRef = (0, import_react28.useRef)(null);
|
|
12951
|
+
const contentRef = (0, import_react28.useRef)(null);
|
|
12952
|
+
const anchorRef = (0, import_react28.useRef)(null);
|
|
12953
|
+
const [bugOpen, setBugOpen] = (0, import_react28.useState)(false);
|
|
12954
|
+
const [bugInitialDraft, setBugInitialDraft] = (0, import_react28.useState)(null);
|
|
12955
|
+
const [feedbackOpen, setFeedbackOpen] = (0, import_react28.useState)(false);
|
|
12956
|
+
const [voiceOpen, setVoiceOpen] = (0, import_react28.useState)(false);
|
|
12957
|
+
const [sessionEndOpen, setSessionEndOpen] = (0, import_react28.useState)(false);
|
|
12958
|
+
const [aiOpen, setAiOpen] = (0, import_react28.useState)(false);
|
|
12959
|
+
const [myBugsOpen, setMyBugsOpen] = (0, import_react28.useState)(false);
|
|
12960
|
+
const [sessionDetailsOpen, setSessionDetailsOpen] = (0, import_react28.useState)(false);
|
|
12961
|
+
const [messagesOpen, setMessagesOpen] = (0, import_react28.useState)(false);
|
|
12962
|
+
const [unreadMessages, setUnreadMessages] = (0, import_react28.useState)(0);
|
|
12963
|
+
const [retestsOpen, setRetestsOpen] = (0, import_react28.useState)(false);
|
|
12964
|
+
const [openRetests, setOpenRetests] = (0, import_react28.useState)(0);
|
|
12965
|
+
const refreshRetests = (0, import_react28.useCallback)(() => {
|
|
11507
12966
|
if (!tpk || retestCount !== void 0) return;
|
|
11508
12967
|
void tpk.ready.then(() => tpk.api.getMyRetests()).then((list) => setOpenRetests(list.length)).catch(() => void 0);
|
|
11509
12968
|
}, [tpk, retestCount]);
|
|
11510
|
-
(0,
|
|
12969
|
+
(0, import_react28.useEffect)(() => {
|
|
11511
12970
|
refreshRetests();
|
|
11512
12971
|
}, [refreshRetests]);
|
|
12972
|
+
const [checklist, setChecklist] = (0, import_react28.useState)([]);
|
|
12973
|
+
const [checklistOpen, setChecklistOpen] = (0, import_react28.useState)(false);
|
|
12974
|
+
const refreshChecklist = (0, import_react28.useCallback)(() => {
|
|
12975
|
+
if (!enableWrapper || !tpk) return;
|
|
12976
|
+
void loadChecklist(tpk).then(setChecklist);
|
|
12977
|
+
}, [enableWrapper, tpk]);
|
|
12978
|
+
(0, import_react28.useEffect)(() => {
|
|
12979
|
+
if (!enableWrapper || !tpk) return;
|
|
12980
|
+
refreshChecklist();
|
|
12981
|
+
const sub = import_react_native29.AppState.addEventListener?.("change", (state) => {
|
|
12982
|
+
if (state === "active") refreshChecklist();
|
|
12983
|
+
});
|
|
12984
|
+
return () => sub?.remove();
|
|
12985
|
+
}, [enableWrapper, tpk, refreshChecklist]);
|
|
11513
12986
|
const aiReady = Boolean(aiCoordinatorToken && aiProjectId && aiApiBaseUrl);
|
|
11514
12987
|
const onAutoTest = aiReady ? () => setAiOpen(true) : void 0;
|
|
11515
|
-
const [remoteSession, setRemoteSession] = (0,
|
|
12988
|
+
const [remoteSession, setRemoteSession] = (0, import_react28.useState)(
|
|
11516
12989
|
null
|
|
11517
12990
|
);
|
|
11518
|
-
const remoteSessionRef = (0,
|
|
11519
|
-
(0,
|
|
12991
|
+
const remoteSessionRef = (0, import_react28.useRef)(null);
|
|
12992
|
+
(0, import_react28.useEffect)(() => {
|
|
11520
12993
|
remoteSessionRef.current = remoteSession;
|
|
11521
12994
|
}, [remoteSession]);
|
|
11522
|
-
(0,
|
|
12995
|
+
(0, import_react28.useEffect)(() => {
|
|
11523
12996
|
if (!aiRemoteTrigger || !tpk || aiOpen) return;
|
|
11524
12997
|
let busy = false;
|
|
11525
12998
|
const poll = async () => {
|
|
11526
|
-
if (busy ||
|
|
12999
|
+
if (busy || import_react_native29.AppState.currentState !== "active") return;
|
|
11527
13000
|
busy = true;
|
|
11528
13001
|
try {
|
|
11529
13002
|
const claimed = await tpk.claimRemoteAiSession();
|
|
@@ -11540,7 +13013,7 @@ function TesterPayKitWrapper({
|
|
|
11540
13013
|
const timer = setInterval(poll, aiRemotePollSeconds * 1e3);
|
|
11541
13014
|
return () => clearInterval(timer);
|
|
11542
13015
|
}, [aiRemoteTrigger, aiRemotePollSeconds, tpk, aiOpen]);
|
|
11543
|
-
(0,
|
|
13016
|
+
(0, import_react28.useEffect)(() => {
|
|
11544
13017
|
if (!aiOpen) return;
|
|
11545
13018
|
const g = globalThis;
|
|
11546
13019
|
g.__tpkCaptureScreenshot = async () => (await captureView(rootRef))?.base64 ?? null;
|
|
@@ -11548,19 +13021,187 @@ function TesterPayKitWrapper({
|
|
|
11548
13021
|
delete g.__tpkCaptureScreenshot;
|
|
11549
13022
|
};
|
|
11550
13023
|
}, [aiOpen]);
|
|
11551
|
-
const
|
|
11552
|
-
(0,
|
|
13024
|
+
const liveEnabled = enableWrapper && enableLiveLink && tpk != null;
|
|
13025
|
+
const liveLinkRef = (0, import_react28.useRef)(null);
|
|
13026
|
+
const liveOnRef = (0, import_react28.useRef)(false);
|
|
13027
|
+
const [liveStatus, setLiveStatus] = (0, import_react28.useState)("off");
|
|
13028
|
+
const [noteOpen, setNoteOpen] = (0, import_react28.useState)(false);
|
|
13029
|
+
const [noteSending, setNoteSending] = (0, import_react28.useState)(false);
|
|
13030
|
+
const noteSnapshotRef = (0, import_react28.useRef)(null);
|
|
13031
|
+
const captureLive = (0, import_react28.useCallback)(async () => {
|
|
13032
|
+
if (!tpk) throw new Error("TPK client not ready");
|
|
13033
|
+
return captureLiveSnapshot({
|
|
13034
|
+
breadcrumbs: () => tpk.breadcrumbs.snapshot(),
|
|
13035
|
+
liveStateProvider: tpk.liveStateProvider,
|
|
13036
|
+
app: async () => {
|
|
13037
|
+
const { name, version: version2, build } = await liveAppInfo();
|
|
13038
|
+
return { name, version: version2, build };
|
|
13039
|
+
},
|
|
13040
|
+
rootFiber: () => currentFiberOf(anchorRef.current)?.child ?? null,
|
|
13041
|
+
screenshot: async () => (await captureView(contentRef))?.base64 ?? null
|
|
13042
|
+
});
|
|
13043
|
+
}, [tpk]);
|
|
13044
|
+
const [actionHint, setActionHint] = (0, import_react28.useState)(null);
|
|
13045
|
+
const hintTimer = (0, import_react28.useRef)(null);
|
|
13046
|
+
const showActionHint = (0, import_react28.useCallback)((text) => {
|
|
13047
|
+
setActionHint(text);
|
|
13048
|
+
if (hintTimer.current) clearTimeout(hintTimer.current);
|
|
13049
|
+
hintTimer.current = setTimeout(() => setActionHint(null), 1800);
|
|
13050
|
+
}, []);
|
|
13051
|
+
(0, import_react28.useEffect)(() => () => {
|
|
13052
|
+
if (hintTimer.current) clearTimeout(hintTimer.current);
|
|
13053
|
+
}, []);
|
|
13054
|
+
const runAction = (0, import_react28.useCallback)(
|
|
13055
|
+
async (raw) => {
|
|
13056
|
+
const action = parseLiveAction(raw);
|
|
13057
|
+
const result = await runLiveAction(action, {
|
|
13058
|
+
root: currentFiberOf(anchorRef.current)?.child ?? null,
|
|
13059
|
+
window: (() => {
|
|
13060
|
+
try {
|
|
13061
|
+
return import_react_native29.Dimensions.get("window");
|
|
13062
|
+
} catch {
|
|
13063
|
+
return void 0;
|
|
13064
|
+
}
|
|
13065
|
+
})(),
|
|
13066
|
+
focusedInput: () => import_react_native29.TextInput.State?.currentlyFocusedInput?.() ?? null,
|
|
13067
|
+
historyBack: () => {
|
|
13068
|
+
if (import_react_native29.Platform.OS !== "web") return false;
|
|
13069
|
+
const h = globalThis.history;
|
|
13070
|
+
if (!h || h.length <= 1) return false;
|
|
13071
|
+
h.back();
|
|
13072
|
+
return true;
|
|
13073
|
+
}
|
|
13074
|
+
});
|
|
13075
|
+
const label = action.kind === "scroll" ? action.direction ?? "down" : String(result.matched ?? "");
|
|
13076
|
+
showActionHint(
|
|
13077
|
+
liveActionHintText(action.kind, label, language ?? detectDeviceLanguage())
|
|
13078
|
+
);
|
|
13079
|
+
TpkTalker.info(`Live link: ${action.kind} ${label}`.trim());
|
|
13080
|
+
return result;
|
|
13081
|
+
},
|
|
13082
|
+
[showActionHint, language]
|
|
13083
|
+
);
|
|
13084
|
+
const runActionRef = (0, import_react28.useRef)(runAction);
|
|
13085
|
+
(0, import_react28.useEffect)(() => {
|
|
13086
|
+
runActionRef.current = runAction;
|
|
13087
|
+
}, [runAction]);
|
|
13088
|
+
const captureLiveRef = (0, import_react28.useRef)(captureLive);
|
|
13089
|
+
(0, import_react28.useEffect)(() => {
|
|
13090
|
+
captureLiveRef.current = captureLive;
|
|
13091
|
+
}, [captureLive]);
|
|
13092
|
+
(0, import_react28.useEffect)(() => {
|
|
13093
|
+
if (!liveEnabled || !tpk) return;
|
|
13094
|
+
const link = new TpkLiveLink({
|
|
13095
|
+
openChannel: async () => {
|
|
13096
|
+
await tpk.ready;
|
|
13097
|
+
return tpk.api.openLiveLink(tpk.projectId);
|
|
13098
|
+
},
|
|
13099
|
+
hello: async () => {
|
|
13100
|
+
const app = await liveAppInfo();
|
|
13101
|
+
return {
|
|
13102
|
+
app: app.bundleId ?? app.name ?? "unknown",
|
|
13103
|
+
appVersion: [app.version, app.build].filter(Boolean).join("+"),
|
|
13104
|
+
platform: import_react_native29.Platform.OS
|
|
13105
|
+
};
|
|
13106
|
+
},
|
|
13107
|
+
capture: () => captureLiveRef.current(),
|
|
13108
|
+
act: (action) => runActionRef.current(action)
|
|
13109
|
+
});
|
|
13110
|
+
liveLinkRef.current = link;
|
|
13111
|
+
const unsubscribe = link.onStatus(setLiveStatus);
|
|
13112
|
+
let cancelled = false;
|
|
13113
|
+
void (async () => {
|
|
13114
|
+
try {
|
|
13115
|
+
liveOnRef.current = await (await liveStorage()).get(LIVE_LINK_STORAGE_KEY) === true;
|
|
13116
|
+
} catch {
|
|
13117
|
+
liveOnRef.current = false;
|
|
13118
|
+
}
|
|
13119
|
+
if (!cancelled && liveOnRef.current && import_react_native29.AppState.currentState !== "background") {
|
|
13120
|
+
link.start();
|
|
13121
|
+
}
|
|
13122
|
+
})();
|
|
13123
|
+
const sub = import_react_native29.AppState.addEventListener?.("change", (state) => {
|
|
13124
|
+
if (state === "active") {
|
|
13125
|
+
if (liveOnRef.current) link.start();
|
|
13126
|
+
} else if (state === "background") {
|
|
13127
|
+
link.stop();
|
|
13128
|
+
}
|
|
13129
|
+
});
|
|
13130
|
+
return () => {
|
|
13131
|
+
cancelled = true;
|
|
13132
|
+
sub?.remove();
|
|
13133
|
+
unsubscribe();
|
|
13134
|
+
link.dispose();
|
|
13135
|
+
liveLinkRef.current = null;
|
|
13136
|
+
setLiveStatus("off");
|
|
13137
|
+
};
|
|
13138
|
+
}, [liveEnabled, tpk]);
|
|
13139
|
+
const onToggleLiveLink = (0, import_react28.useCallback)(() => {
|
|
13140
|
+
const link = liveLinkRef.current;
|
|
13141
|
+
if (!link) return;
|
|
13142
|
+
liveOnRef.current = !liveOnRef.current;
|
|
13143
|
+
if (liveOnRef.current) link.start();
|
|
13144
|
+
else link.stop();
|
|
13145
|
+
const on = liveOnRef.current;
|
|
13146
|
+
void liveStorage().then((st) => st.set(LIVE_LINK_STORAGE_KEY, on)).catch(() => void 0);
|
|
13147
|
+
}, []);
|
|
13148
|
+
const onSendToClaude = (0, import_react28.useCallback)(() => {
|
|
13149
|
+
void (async () => {
|
|
13150
|
+
try {
|
|
13151
|
+
noteSnapshotRef.current = await captureLiveRef.current();
|
|
13152
|
+
} catch (e) {
|
|
13153
|
+
TpkTalker.warn(`Send to Claude: capture failed: ${String(e)}`);
|
|
13154
|
+
noteSnapshotRef.current = {};
|
|
13155
|
+
}
|
|
13156
|
+
setNoteOpen(true);
|
|
13157
|
+
})();
|
|
13158
|
+
}, []);
|
|
13159
|
+
const sendNote = (0, import_react28.useCallback)(
|
|
13160
|
+
(text) => {
|
|
13161
|
+
if (!tpk) return;
|
|
13162
|
+
const snapshot = { ...noteSnapshotRef.current ?? {} };
|
|
13163
|
+
const screenshot = typeof snapshot.screenshot === "string" ? snapshot.screenshot : null;
|
|
13164
|
+
delete snapshot.screenshot;
|
|
13165
|
+
setNoteSending(true);
|
|
13166
|
+
void (async () => {
|
|
13167
|
+
try {
|
|
13168
|
+
await tpk.ready;
|
|
13169
|
+
await tpk.api.sendLiveNote({
|
|
13170
|
+
projectId: tpk.projectId,
|
|
13171
|
+
text,
|
|
13172
|
+
snapshot,
|
|
13173
|
+
screenshotBase64: screenshot
|
|
13174
|
+
});
|
|
13175
|
+
TpkTalker.info("Sent to Claude");
|
|
13176
|
+
setNoteOpen(false);
|
|
13177
|
+
noteSnapshotRef.current = null;
|
|
13178
|
+
} catch (e) {
|
|
13179
|
+
TpkTalker.warn(`Send to Claude failed: ${String(e)}`);
|
|
13180
|
+
const de = (language ?? detectDeviceLanguage()) === "de";
|
|
13181
|
+
import_react_native29.Alert.alert(
|
|
13182
|
+
de ? "Senden fehlgeschlagen" : "Could not send",
|
|
13183
|
+
e instanceof Error ? e.message : String(e)
|
|
13184
|
+
);
|
|
13185
|
+
} finally {
|
|
13186
|
+
setNoteSending(false);
|
|
13187
|
+
}
|
|
13188
|
+
})();
|
|
13189
|
+
},
|
|
13190
|
+
[tpk, language]
|
|
13191
|
+
);
|
|
13192
|
+
const sessionAnchor = (0, import_react28.useRef)(sessionStartedAt ?? null);
|
|
13193
|
+
(0, import_react28.useEffect)(() => {
|
|
11553
13194
|
if (sessionStartedAt) {
|
|
11554
13195
|
sessionAnchor.current = sessionStartedAt;
|
|
11555
13196
|
} else if (tpk && !sessionAnchor.current) {
|
|
11556
13197
|
sessionAnchor.current = /* @__PURE__ */ new Date();
|
|
11557
13198
|
}
|
|
11558
13199
|
}, [tpk, sessionStartedAt]);
|
|
11559
|
-
(0,
|
|
13200
|
+
(0, import_react28.useEffect)(() => {
|
|
11560
13201
|
if (!tpk || !currentScreen) return;
|
|
11561
13202
|
tpk.trackScreenView(currentScreen);
|
|
11562
13203
|
}, [tpk, currentScreen]);
|
|
11563
|
-
(0,
|
|
13204
|
+
(0, import_react28.useEffect)(() => {
|
|
11564
13205
|
if (!tpk) return;
|
|
11565
13206
|
let cancelled = false;
|
|
11566
13207
|
tpk.getNotifications({ limit: 1 }).then((res) => {
|
|
@@ -11570,9 +13211,9 @@ function TesterPayKitWrapper({
|
|
|
11570
13211
|
cancelled = true;
|
|
11571
13212
|
};
|
|
11572
13213
|
}, [tpk]);
|
|
11573
|
-
(0,
|
|
13214
|
+
(0, import_react28.useEffect)(() => {
|
|
11574
13215
|
if (!enableWrapper || !enableShake) return;
|
|
11575
|
-
if (
|
|
13216
|
+
if (import_react_native29.Platform.OS === "web") return;
|
|
11576
13217
|
let teardown = null;
|
|
11577
13218
|
let cancelled = false;
|
|
11578
13219
|
let lastShakeAt = 0;
|
|
@@ -11609,14 +13250,14 @@ function TesterPayKitWrapper({
|
|
|
11609
13250
|
voiceOpen,
|
|
11610
13251
|
sessionEndOpen
|
|
11611
13252
|
]);
|
|
11612
|
-
const onReportBug = (0,
|
|
11613
|
-
const onGeneralFeedback = (0,
|
|
11614
|
-
const onEndSession = (0,
|
|
11615
|
-
const onLongPressVoiceBug = (0,
|
|
11616
|
-
const handleAutoTap = (0,
|
|
13253
|
+
const onReportBug = (0, import_react28.useCallback)(() => setBugOpen(true), []);
|
|
13254
|
+
const onGeneralFeedback = (0, import_react28.useCallback)(() => setFeedbackOpen(true), []);
|
|
13255
|
+
const onEndSession = (0, import_react28.useCallback)(() => setSessionEndOpen(true), []);
|
|
13256
|
+
const onLongPressVoiceBug = (0, import_react28.useCallback)(() => setVoiceOpen(true), []);
|
|
13257
|
+
const handleAutoTap = (0, import_react28.useCallback)(() => {
|
|
11617
13258
|
tpk?.trackTap(currentScreen ?? "unknown", "auto-tap");
|
|
11618
13259
|
}, [tpk, currentScreen]);
|
|
11619
|
-
const handleVoiceExtracted = (0,
|
|
13260
|
+
const handleVoiceExtracted = (0, import_react28.useCallback)(
|
|
11620
13261
|
(result, classification) => {
|
|
11621
13262
|
setBugInitialDraft({
|
|
11622
13263
|
type: classification === "idea" ? "featureRequest" : classification === "issue" ? "uiIssue" : classification,
|
|
@@ -11638,18 +13279,27 @@ function TesterPayKitWrapper({
|
|
|
11638
13279
|
[]
|
|
11639
13280
|
);
|
|
11640
13281
|
if (!enableWrapper) {
|
|
11641
|
-
return /* @__PURE__ */
|
|
13282
|
+
return /* @__PURE__ */ import_react28.default.createElement(import_react28.default.Fragment, null, children);
|
|
11642
13283
|
}
|
|
11643
|
-
return /* @__PURE__ */
|
|
11644
|
-
|
|
13284
|
+
return /* @__PURE__ */ import_react28.default.createElement(TpkThemeProvider, { theme }, /* @__PURE__ */ import_react28.default.createElement(TpkLanguageProvider, { language }, /* @__PURE__ */ import_react28.default.createElement(
|
|
13285
|
+
import_react_native29.View,
|
|
11645
13286
|
{
|
|
11646
13287
|
ref: rootRef,
|
|
11647
|
-
style: [
|
|
13288
|
+
style: [styles22.root, style],
|
|
11648
13289
|
testID,
|
|
11649
13290
|
collapsable: false
|
|
11650
13291
|
},
|
|
11651
|
-
/* @__PURE__ */
|
|
11652
|
-
|
|
13292
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
13293
|
+
import_react_native29.View,
|
|
13294
|
+
{
|
|
13295
|
+
ref: contentRef,
|
|
13296
|
+
style: styles22.content,
|
|
13297
|
+
onTouchStart: handleAutoTap,
|
|
13298
|
+
collapsable: false
|
|
13299
|
+
},
|
|
13300
|
+
/* @__PURE__ */ import_react28.default.createElement(LiveContentAnchor, { ref: anchorRef }, children)
|
|
13301
|
+
),
|
|
13302
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11653
13303
|
FloatingFeedbackButton,
|
|
11654
13304
|
{
|
|
11655
13305
|
position: buttonPosition,
|
|
@@ -11659,6 +13309,11 @@ function TesterPayKitWrapper({
|
|
|
11659
13309
|
onEndSession,
|
|
11660
13310
|
onShowDebugLogs,
|
|
11661
13311
|
onAutoTest,
|
|
13312
|
+
onShowChecklist: checklist.length > 0 ? () => setChecklistOpen(true) : void 0,
|
|
13313
|
+
checklistCount: openTaskCount(checklist),
|
|
13314
|
+
onSendToClaude: liveEnabled ? onSendToClaude : void 0,
|
|
13315
|
+
onToggleLiveLink: liveEnabled ? onToggleLiveLink : void 0,
|
|
13316
|
+
liveLinkConnected: liveStatus !== "off",
|
|
11662
13317
|
onLongPressVoiceBug,
|
|
11663
13318
|
onFlushCachedCrashes,
|
|
11664
13319
|
onShowRetests: onShowRetests ?? (() => setRetestsOpen(true)),
|
|
@@ -11671,7 +13326,7 @@ function TesterPayKitWrapper({
|
|
|
11671
13326
|
sessionStartedAt: sessionAnchor.current ?? void 0
|
|
11672
13327
|
}
|
|
11673
13328
|
),
|
|
11674
|
-
(aiReady || remoteSession) && /* @__PURE__ */
|
|
13329
|
+
(aiReady || remoteSession) && /* @__PURE__ */ import_react28.default.createElement(
|
|
11675
13330
|
AiRemoteControl,
|
|
11676
13331
|
{
|
|
11677
13332
|
visible: aiOpen,
|
|
@@ -11692,7 +13347,30 @@ function TesterPayKitWrapper({
|
|
|
11692
13347
|
}
|
|
11693
13348
|
}
|
|
11694
13349
|
),
|
|
11695
|
-
/* @__PURE__ */
|
|
13350
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
13351
|
+
ChecklistPanel,
|
|
13352
|
+
{
|
|
13353
|
+
visible: checklistOpen,
|
|
13354
|
+
tpk,
|
|
13355
|
+
tasks: checklist,
|
|
13356
|
+
onReload: refreshChecklist,
|
|
13357
|
+
onClose: () => setChecklistOpen(false)
|
|
13358
|
+
}
|
|
13359
|
+
),
|
|
13360
|
+
liveEnabled && /* @__PURE__ */ import_react28.default.createElement(LiveActionHint, { text: actionHint, top: getModalInsets().top + 8 }),
|
|
13361
|
+
liveEnabled && /* @__PURE__ */ import_react28.default.createElement(
|
|
13362
|
+
LiveNoteDialog,
|
|
13363
|
+
{
|
|
13364
|
+
visible: noteOpen,
|
|
13365
|
+
sending: noteSending,
|
|
13366
|
+
onCancel: () => {
|
|
13367
|
+
setNoteOpen(false);
|
|
13368
|
+
noteSnapshotRef.current = null;
|
|
13369
|
+
},
|
|
13370
|
+
onSend: sendNote
|
|
13371
|
+
}
|
|
13372
|
+
),
|
|
13373
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11696
13374
|
BugReportSheet,
|
|
11697
13375
|
{
|
|
11698
13376
|
visible: bugOpen,
|
|
@@ -11714,7 +13392,7 @@ function TesterPayKitWrapper({
|
|
|
11714
13392
|
}
|
|
11715
13393
|
}
|
|
11716
13394
|
),
|
|
11717
|
-
/* @__PURE__ */
|
|
13395
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11718
13396
|
GeneralFeedbackDialog,
|
|
11719
13397
|
{
|
|
11720
13398
|
visible: feedbackOpen,
|
|
@@ -11723,7 +13401,7 @@ function TesterPayKitWrapper({
|
|
|
11723
13401
|
onClose: () => setFeedbackOpen(false)
|
|
11724
13402
|
}
|
|
11725
13403
|
),
|
|
11726
|
-
/* @__PURE__ */
|
|
13404
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11727
13405
|
VoiceBugInputSheet,
|
|
11728
13406
|
{
|
|
11729
13407
|
visible: voiceOpen,
|
|
@@ -11734,7 +13412,7 @@ function TesterPayKitWrapper({
|
|
|
11734
13412
|
captureScreen: async () => (await captureView(rootRef))?.base64 ?? null
|
|
11735
13413
|
}
|
|
11736
13414
|
),
|
|
11737
|
-
/* @__PURE__ */
|
|
13415
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11738
13416
|
SessionEndDialog,
|
|
11739
13417
|
{
|
|
11740
13418
|
visible: sessionEndOpen,
|
|
@@ -11754,7 +13432,7 @@ function TesterPayKitWrapper({
|
|
|
11754
13432
|
}
|
|
11755
13433
|
}
|
|
11756
13434
|
),
|
|
11757
|
-
/* @__PURE__ */
|
|
13435
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11758
13436
|
MyBugsSheet,
|
|
11759
13437
|
{
|
|
11760
13438
|
visible: myBugsOpen,
|
|
@@ -11762,7 +13440,7 @@ function TesterPayKitWrapper({
|
|
|
11762
13440
|
onClose: () => setMyBugsOpen(false)
|
|
11763
13441
|
}
|
|
11764
13442
|
),
|
|
11765
|
-
/* @__PURE__ */
|
|
13443
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11766
13444
|
SessionDetailsSheet,
|
|
11767
13445
|
{
|
|
11768
13446
|
visible: sessionDetailsOpen,
|
|
@@ -11770,7 +13448,7 @@ function TesterPayKitWrapper({
|
|
|
11770
13448
|
onClose: () => setSessionDetailsOpen(false)
|
|
11771
13449
|
}
|
|
11772
13450
|
),
|
|
11773
|
-
/* @__PURE__ */
|
|
13451
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11774
13452
|
NotificationsSheet,
|
|
11775
13453
|
{
|
|
11776
13454
|
visible: messagesOpen,
|
|
@@ -11779,7 +13457,7 @@ function TesterPayKitWrapper({
|
|
|
11779
13457
|
onUnreadChange: setUnreadMessages
|
|
11780
13458
|
}
|
|
11781
13459
|
),
|
|
11782
|
-
/* @__PURE__ */
|
|
13460
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11783
13461
|
RetestSheet,
|
|
11784
13462
|
{
|
|
11785
13463
|
visible: retestsOpen,
|
|
@@ -11790,7 +13468,7 @@ function TesterPayKitWrapper({
|
|
|
11790
13468
|
)
|
|
11791
13469
|
)));
|
|
11792
13470
|
}
|
|
11793
|
-
var
|
|
13471
|
+
var styles22 = import_react_native29.StyleSheet.create({
|
|
11794
13472
|
root: {
|
|
11795
13473
|
flex: 1
|
|
11796
13474
|
},
|
|
@@ -11800,7 +13478,7 @@ var styles19 = import_react_native25.StyleSheet.create({
|
|
|
11800
13478
|
});
|
|
11801
13479
|
|
|
11802
13480
|
// src/TpkAnnotated.tsx
|
|
11803
|
-
var
|
|
13481
|
+
var import_react29 = require("react");
|
|
11804
13482
|
function TpkAnnotated({
|
|
11805
13483
|
task,
|
|
11806
13484
|
focusArea,
|
|
@@ -11813,16 +13491,16 @@ function TpkAnnotated({
|
|
|
11813
13491
|
metadata,
|
|
11814
13492
|
children
|
|
11815
13493
|
}) {
|
|
11816
|
-
const child =
|
|
11817
|
-
if (!(0,
|
|
13494
|
+
const child = import_react29.Children.only(children);
|
|
13495
|
+
if (!(0, import_react29.isValidElement)(child)) {
|
|
11818
13496
|
throw new Error("TpkAnnotated expects exactly one React element child.");
|
|
11819
13497
|
}
|
|
11820
|
-
const ref = (0,
|
|
11821
|
-
const annotationIdRef = (0,
|
|
13498
|
+
const ref = (0, import_react29.useRef)(null);
|
|
13499
|
+
const annotationIdRef = (0, import_react29.useRef)(null);
|
|
11822
13500
|
const childProps = child.props;
|
|
11823
13501
|
const resolvedKey = elementKey ?? childProps.testID;
|
|
11824
13502
|
const resolvedType = elementType ?? inferElementType(child);
|
|
11825
|
-
(0,
|
|
13503
|
+
(0, import_react29.useEffect)(() => {
|
|
11826
13504
|
const id = annotations.register({
|
|
11827
13505
|
taskId: task,
|
|
11828
13506
|
focusAreaId: focusArea,
|
|
@@ -11841,7 +13519,7 @@ function TpkAnnotated({
|
|
|
11841
13519
|
annotationIdRef.current = null;
|
|
11842
13520
|
};
|
|
11843
13521
|
}, [task, focusArea, resolvedKey]);
|
|
11844
|
-
(0,
|
|
13522
|
+
(0, import_react29.useEffect)(() => {
|
|
11845
13523
|
if (!annotationIdRef.current) return;
|
|
11846
13524
|
annotations.update(annotationIdRef.current, {
|
|
11847
13525
|
semanticLabels: labels,
|
|
@@ -11859,13 +13537,13 @@ function TpkAnnotated({
|
|
|
11859
13537
|
versionRange,
|
|
11860
13538
|
metadata
|
|
11861
13539
|
]);
|
|
11862
|
-
(0,
|
|
13540
|
+
(0, import_react29.useEffect)(() => {
|
|
11863
13541
|
if (completionTrigger !== "on-visible") return;
|
|
11864
13542
|
if (annotationIdRef.current) {
|
|
11865
13543
|
annotations.recordInteraction(annotationIdRef.current);
|
|
11866
13544
|
}
|
|
11867
13545
|
}, [completionTrigger]);
|
|
11868
|
-
const wrapHandler = (0,
|
|
13546
|
+
const wrapHandler = (0, import_react29.useCallback)(
|
|
11869
13547
|
(handler) => {
|
|
11870
13548
|
const wrapped = ((...args) => {
|
|
11871
13549
|
const id = annotationIdRef.current;
|
|
@@ -11876,7 +13554,7 @@ function TpkAnnotated({
|
|
|
11876
13554
|
},
|
|
11877
13555
|
[]
|
|
11878
13556
|
);
|
|
11879
|
-
const triggeredHandlerName = (0,
|
|
13557
|
+
const triggeredHandlerName = (0, import_react29.useMemo)(() => {
|
|
11880
13558
|
switch (completionTrigger) {
|
|
11881
13559
|
case "on-tap":
|
|
11882
13560
|
return "onPress";
|
|
@@ -11892,12 +13570,12 @@ function TpkAnnotated({
|
|
|
11892
13570
|
childProps[triggeredHandlerName]
|
|
11893
13571
|
);
|
|
11894
13572
|
}
|
|
11895
|
-
return (0,
|
|
13573
|
+
return (0, import_react29.cloneElement)(child, overrideProps);
|
|
11896
13574
|
}
|
|
11897
13575
|
function useTaskAnnotation(options) {
|
|
11898
|
-
const ref = (0,
|
|
11899
|
-
const idRef = (0,
|
|
11900
|
-
(0,
|
|
13576
|
+
const ref = (0, import_react29.useRef)(null);
|
|
13577
|
+
const idRef = (0, import_react29.useRef)(null);
|
|
13578
|
+
(0, import_react29.useEffect)(() => {
|
|
11901
13579
|
const id = annotations.register({
|
|
11902
13580
|
taskId: options.taskId,
|
|
11903
13581
|
focusAreaId: options.focusAreaId,
|
|
@@ -11916,7 +13594,7 @@ function useTaskAnnotation(options) {
|
|
|
11916
13594
|
idRef.current = null;
|
|
11917
13595
|
};
|
|
11918
13596
|
}, [options.taskId, options.focusAreaId, options.elementKey]);
|
|
11919
|
-
const recordInteraction = (0,
|
|
13597
|
+
const recordInteraction = (0, import_react29.useCallback)(() => {
|
|
11920
13598
|
if (idRef.current) annotations.recordInteraction(idRef.current);
|
|
11921
13599
|
}, []);
|
|
11922
13600
|
return { ref, id: idRef.current, recordInteraction };
|
|
@@ -12142,12 +13820,12 @@ function hasRecorder(recorder) {
|
|
|
12142
13820
|
}
|
|
12143
13821
|
|
|
12144
13822
|
// src/earnings.ts
|
|
12145
|
-
var
|
|
13823
|
+
var import_react30 = require("react");
|
|
12146
13824
|
function useTpkEarnings(tpk, options = {}) {
|
|
12147
|
-
const [data, setData] = (0,
|
|
12148
|
-
const [loading, setLoading] = (0,
|
|
12149
|
-
const [error, setError] = (0,
|
|
12150
|
-
const refresh = (0,
|
|
13825
|
+
const [data, setData] = (0, import_react30.useState)(null);
|
|
13826
|
+
const [loading, setLoading] = (0, import_react30.useState)(false);
|
|
13827
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
13828
|
+
const refresh = (0, import_react30.useCallback)(async () => {
|
|
12151
13829
|
if (!tpk) return;
|
|
12152
13830
|
setLoading(true);
|
|
12153
13831
|
setError(null);
|
|
@@ -12163,7 +13841,7 @@ function useTpkEarnings(tpk, options = {}) {
|
|
|
12163
13841
|
setLoading(false);
|
|
12164
13842
|
}
|
|
12165
13843
|
}, [tpk, options.payoutLimit]);
|
|
12166
|
-
(0,
|
|
13844
|
+
(0, import_react30.useEffect)(() => {
|
|
12167
13845
|
if (tpk) refresh();
|
|
12168
13846
|
}, [tpk, refresh]);
|
|
12169
13847
|
return { data, loading, error, refresh };
|
|
@@ -12174,14 +13852,17 @@ function useTpkEarnings(tpk, options = {}) {
|
|
|
12174
13852
|
AttachmentQueue,
|
|
12175
13853
|
Breadcrumbs,
|
|
12176
13854
|
BugReportSheet,
|
|
13855
|
+
ChecklistPanel,
|
|
12177
13856
|
CrashQueue,
|
|
12178
13857
|
DEFAULT_STYLE,
|
|
12179
13858
|
DEFAULT_TPK_THEME,
|
|
13859
|
+
DENY_LABEL_PATTERNS,
|
|
12180
13860
|
ExpoStorage,
|
|
12181
13861
|
FloatingFeedbackButton,
|
|
12182
13862
|
GeneralFeedbackDialog,
|
|
12183
13863
|
INTERACTION_NAV_WEIGHT,
|
|
12184
13864
|
InviteCodeScreen,
|
|
13865
|
+
LiveNoteDialog,
|
|
12185
13866
|
MIN_INTERACTIONS_PER_ACTIVE_MINUTE,
|
|
12186
13867
|
MyBugsSheet,
|
|
12187
13868
|
NotificationsSheet,
|
|
@@ -12204,6 +13885,7 @@ function useTpkEarnings(tpk, options = {}) {
|
|
|
12204
13885
|
TpkIcon,
|
|
12205
13886
|
TpkIconsProvider,
|
|
12206
13887
|
TpkLanguageProvider,
|
|
13888
|
+
TpkLiveLink,
|
|
12207
13889
|
TpkOnboarding,
|
|
12208
13890
|
TpkSensitive,
|
|
12209
13891
|
TpkTalker,
|
|
@@ -12222,6 +13904,7 @@ function useTpkEarnings(tpk, options = {}) {
|
|
|
12222
13904
|
bugSeverityLabel,
|
|
12223
13905
|
bugStatusStyle,
|
|
12224
13906
|
canSubmitBugReportDraft,
|
|
13907
|
+
captureLiveSnapshot,
|
|
12225
13908
|
captureView,
|
|
12226
13909
|
classificationToBugType,
|
|
12227
13910
|
createBugReportDraft,
|
|
@@ -12245,18 +13928,24 @@ function useTpkEarnings(tpk, options = {}) {
|
|
|
12245
13928
|
hasWelcomeBriefBeenSeen,
|
|
12246
13929
|
installCrashHandler,
|
|
12247
13930
|
installNetworkCapture,
|
|
13931
|
+
loadChecklist,
|
|
12248
13932
|
markOnboardingComplete,
|
|
12249
13933
|
markWelcomeBriefAsSeen,
|
|
12250
13934
|
markWidgetTourSeen,
|
|
13935
|
+
parseLiveAction,
|
|
12251
13936
|
parseVersionRange,
|
|
12252
13937
|
pathToSvgD,
|
|
12253
13938
|
quickDraftBug,
|
|
13939
|
+
readLiveState,
|
|
13940
|
+
readScreenTexts,
|
|
12254
13941
|
resetOnboardingState,
|
|
12255
13942
|
resetWelcomeBriefAck,
|
|
12256
13943
|
resetWidgetTourSeen,
|
|
13944
|
+
runLiveAction,
|
|
12257
13945
|
simplifyPath,
|
|
12258
13946
|
submitBugReportDraft,
|
|
12259
13947
|
subscribeNativeCaptureMode,
|
|
13948
|
+
toStepResults,
|
|
12260
13949
|
uploadScreenshotAttachment,
|
|
12261
13950
|
useShake,
|
|
12262
13951
|
useTaskAnnotation,
|