@testerpaykit/expo 0.10.0 → 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 +61 -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 +2264 -562
- package/dist/index.mjs +2288 -617
- package/dist/storage-RD3WGNGX.mjs +6 -0
- package/package.json +4 -4
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",
|
|
@@ -2604,7 +2654,7 @@ function WidgetTour({
|
|
|
2604
2654
|
style: styles.skipButton,
|
|
2605
2655
|
hitSlop: 8
|
|
2606
2656
|
},
|
|
2607
|
-
/* @__PURE__ */ import_react6.default.createElement(import_react_native4.Text, { style: styles.skipLabel }, t.skip)
|
|
2657
|
+
/* @__PURE__ */ import_react6.default.createElement(import_react_native4.Text, { maxFontSizeMultiplier: MAX_FONT_SCALE, style: styles.skipLabel }, t.skip)
|
|
2608
2658
|
)),
|
|
2609
2659
|
/* @__PURE__ */ import_react6.default.createElement(
|
|
2610
2660
|
import_react_native4.ScrollView,
|
|
@@ -2652,7 +2702,7 @@ function WidgetTour({
|
|
|
2652
2702
|
onPress: () => goTo(index - 1),
|
|
2653
2703
|
style: [styles.backButton, isFirst && styles.backButtonHidden]
|
|
2654
2704
|
},
|
|
2655
|
-
/* @__PURE__ */ import_react6.default.createElement(import_react_native4.Text, { style: styles.backLabel }, t.back)
|
|
2705
|
+
/* @__PURE__ */ import_react6.default.createElement(import_react_native4.Text, { maxFontSizeMultiplier: MAX_FONT_SCALE, style: styles.backLabel }, t.back)
|
|
2656
2706
|
), /* @__PURE__ */ import_react6.default.createElement(
|
|
2657
2707
|
import_react_native4.Pressable,
|
|
2658
2708
|
{
|
|
@@ -2664,7 +2714,7 @@ function WidgetTour({
|
|
|
2664
2714
|
pressed && styles.primaryButtonPressed
|
|
2665
2715
|
]
|
|
2666
2716
|
},
|
|
2667
|
-
/* @__PURE__ */ import_react6.default.createElement(import_react_native4.Text, { style: styles.primaryLabel }, isLast ? t.done : t.next)
|
|
2717
|
+
/* @__PURE__ */ import_react6.default.createElement(import_react_native4.Text, { maxFontSizeMultiplier: MAX_FONT_SCALE, style: styles.primaryLabel }, isLast ? t.done : t.next)
|
|
2668
2718
|
))
|
|
2669
2719
|
))
|
|
2670
2720
|
);
|
|
@@ -2681,13 +2731,21 @@ function Card({
|
|
|
2681
2731
|
accessibilityLabel: `${card.title}. ${card.body}`,
|
|
2682
2732
|
style: [styles.card, card.hero && styles.cardHero]
|
|
2683
2733
|
},
|
|
2684
|
-
/* @__PURE__ */ import_react6.default.createElement(import_react_native4.View, { style: [styles.emojiWrap, card.hero && styles.emojiWrapHero] }, /* @__PURE__ */ import_react6.default.createElement(import_react_native4.Text, { style: styles.emoji }, card.emoji)),
|
|
2685
|
-
card.hero && /* @__PURE__ */ import_react6.default.createElement(import_react_native4.View, { style: styles.heroBadge }, /* @__PURE__ */ import_react6.default.createElement(import_react_native4.Text, { style: styles.heroBadgeLabel }, newBadge)),
|
|
2686
|
-
/* @__PURE__ */ import_react6.default.createElement(
|
|
2687
|
-
|
|
2734
|
+
/* @__PURE__ */ import_react6.default.createElement(import_react_native4.View, { style: [styles.emojiWrap, card.hero && styles.emojiWrapHero] }, /* @__PURE__ */ import_react6.default.createElement(import_react_native4.Text, { allowFontScaling: false, style: styles.emoji }, card.emoji)),
|
|
2735
|
+
card.hero && /* @__PURE__ */ import_react6.default.createElement(import_react_native4.View, { style: styles.heroBadge }, /* @__PURE__ */ import_react6.default.createElement(import_react_native4.Text, { maxFontSizeMultiplier: MAX_FONT_SCALE, style: styles.heroBadgeLabel }, newBadge)),
|
|
2736
|
+
/* @__PURE__ */ import_react6.default.createElement(
|
|
2737
|
+
import_react_native4.Text,
|
|
2738
|
+
{
|
|
2739
|
+
maxFontSizeMultiplier: MAX_FONT_SCALE,
|
|
2740
|
+
style: [styles.cardTitle, card.hero && styles.cardTitleHero]
|
|
2741
|
+
},
|
|
2742
|
+
card.title
|
|
2743
|
+
),
|
|
2744
|
+
/* @__PURE__ */ import_react6.default.createElement(import_react_native4.Text, { maxFontSizeMultiplier: MAX_FONT_SCALE, style: styles.cardBody }, card.body)
|
|
2688
2745
|
));
|
|
2689
2746
|
}
|
|
2690
2747
|
var SHEET_PADDING = 20;
|
|
2748
|
+
var MAX_FONT_SCALE = 1.5;
|
|
2691
2749
|
var styles = import_react_native4.StyleSheet.create({
|
|
2692
2750
|
backdrop: {
|
|
2693
2751
|
flex: 1,
|
|
@@ -2698,6 +2756,8 @@ var styles = import_react_native4.StyleSheet.create({
|
|
|
2698
2756
|
sheet: {
|
|
2699
2757
|
width: "100%",
|
|
2700
2758
|
maxWidth: 420,
|
|
2759
|
+
// Very large text sizes must not push "Überspringen" off the top.
|
|
2760
|
+
maxHeight: "90%",
|
|
2701
2761
|
backgroundColor: "#FFFFFF",
|
|
2702
2762
|
borderTopLeftRadius: 24,
|
|
2703
2763
|
borderTopRightRadius: 24,
|
|
@@ -2735,7 +2795,10 @@ var styles = import_react_native4.StyleSheet.create({
|
|
|
2735
2795
|
alignItems: "stretch"
|
|
2736
2796
|
},
|
|
2737
2797
|
card: {
|
|
2738
|
-
flex: 1,
|
|
2798
|
+
// flexGrow, not flex: 1 — flex: 1 sets flexBasis 0, and inside the
|
|
2799
|
+
// horizontal ScrollView (no fixed height) every card then collapses
|
|
2800
|
+
// to its padding, so the tour showed only a sliver of the emoji.
|
|
2801
|
+
flexGrow: 1,
|
|
2739
2802
|
alignItems: "center",
|
|
2740
2803
|
paddingVertical: 28,
|
|
2741
2804
|
paddingHorizontal: 20,
|
|
@@ -2932,6 +2995,11 @@ function FloatingFeedbackButton({
|
|
|
2932
2995
|
onShowMessages,
|
|
2933
2996
|
unreadMessageCount = 0,
|
|
2934
2997
|
onAutoTest,
|
|
2998
|
+
onShowChecklist,
|
|
2999
|
+
checklistCount = 0,
|
|
3000
|
+
onSendToClaude,
|
|
3001
|
+
onToggleLiveLink,
|
|
3002
|
+
liveLinkConnected = false,
|
|
2935
3003
|
onLongPressVoiceBug,
|
|
2936
3004
|
onFlushCachedCrashes,
|
|
2937
3005
|
notificationCount = 0,
|
|
@@ -3067,6 +3135,33 @@ function FloatingFeedbackButton({
|
|
|
3067
3135
|
onTap: () => handleAction(onGeneralFeedback)
|
|
3068
3136
|
}
|
|
3069
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
|
+
}
|
|
3070
3165
|
if (onAutoTest) {
|
|
3071
3166
|
opts.push({
|
|
3072
3167
|
key: "auto-test",
|
|
@@ -3160,6 +3255,11 @@ function FloatingFeedbackButton({
|
|
|
3160
3255
|
onShowMessages,
|
|
3161
3256
|
unreadMessageCount,
|
|
3162
3257
|
onAutoTest,
|
|
3258
|
+
onShowChecklist,
|
|
3259
|
+
checklistCount,
|
|
3260
|
+
onSendToClaude,
|
|
3261
|
+
onToggleLiveLink,
|
|
3262
|
+
liveLinkConnected,
|
|
3163
3263
|
onFlushCachedCrashes,
|
|
3164
3264
|
notificationCount,
|
|
3165
3265
|
handleAction,
|
|
@@ -4966,6 +5066,7 @@ var styles3 = import_react_native8.StyleSheet.create({
|
|
|
4966
5066
|
});
|
|
4967
5067
|
|
|
4968
5068
|
// src/index.ts
|
|
5069
|
+
init_storage();
|
|
4969
5070
|
init_network();
|
|
4970
5071
|
|
|
4971
5072
|
// src/sensitive.tsx
|
|
@@ -7510,13 +7611,383 @@ var styles9 = import_react_native15.StyleSheet.create({
|
|
|
7510
7611
|
btnOutline: { borderWidth: 1, borderColor: "#CBD5E1" }
|
|
7511
7612
|
});
|
|
7512
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
|
+
|
|
7513
7984
|
// src/ScreenshotAnnotationEditor.tsx
|
|
7514
|
-
var
|
|
7515
|
-
var
|
|
7985
|
+
var import_react18 = __toESM(require("react"));
|
|
7986
|
+
var import_react_native18 = require("react-native");
|
|
7516
7987
|
|
|
7517
7988
|
// src/TpkAnnotationOverlay.tsx
|
|
7518
|
-
var
|
|
7519
|
-
var
|
|
7989
|
+
var import_react17 = __toESM(require("react"));
|
|
7990
|
+
var import_react_native17 = require("react-native");
|
|
7520
7991
|
|
|
7521
7992
|
// src/drawing.ts
|
|
7522
7993
|
var DEFAULT_STYLE = {
|
|
@@ -7621,7 +8092,7 @@ function arrowHeadPoints(arrow) {
|
|
|
7621
8092
|
}
|
|
7622
8093
|
|
|
7623
8094
|
// src/TpkAnnotationOverlay.tsx
|
|
7624
|
-
var TpkAnnotationOverlay = (0,
|
|
8095
|
+
var TpkAnnotationOverlay = (0, import_react17.forwardRef)(function TpkAnnotationOverlay2(props, ref) {
|
|
7625
8096
|
const {
|
|
7626
8097
|
imageUri,
|
|
7627
8098
|
imageWidth,
|
|
@@ -7632,32 +8103,32 @@ var TpkAnnotationOverlay = (0, import_react16.forwardRef)(function TpkAnnotation
|
|
|
7632
8103
|
onShapesChange,
|
|
7633
8104
|
textValue
|
|
7634
8105
|
} = props;
|
|
7635
|
-
const [shapes, setShapesState] = (0,
|
|
8106
|
+
const [shapes, setShapesState] = (0, import_react17.useState)(
|
|
7636
8107
|
initialShapes ?? []
|
|
7637
8108
|
);
|
|
7638
|
-
const draftRef = (0,
|
|
7639
|
-
const layoutRef = (0,
|
|
8109
|
+
const draftRef = (0, import_react17.useRef)(null);
|
|
8110
|
+
const layoutRef = (0, import_react17.useRef)({
|
|
7640
8111
|
width: imageWidth,
|
|
7641
8112
|
height: imageHeight
|
|
7642
8113
|
});
|
|
7643
|
-
const surfaceRef = (0,
|
|
7644
|
-
const SvgModRef = (0,
|
|
7645
|
-
const [svgReady, setSvgReady] = (0,
|
|
7646
|
-
|
|
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(() => {
|
|
7647
8118
|
import("react-native-svg").then((mod) => {
|
|
7648
8119
|
SvgModRef.current = mod;
|
|
7649
8120
|
setSvgReady(true);
|
|
7650
8121
|
}).catch(() => {
|
|
7651
8122
|
});
|
|
7652
8123
|
}, []);
|
|
7653
|
-
const commitShapes = (0,
|
|
8124
|
+
const commitShapes = (0, import_react17.useCallback)(
|
|
7654
8125
|
(next) => {
|
|
7655
8126
|
setShapesState(next);
|
|
7656
8127
|
onShapesChange?.(next);
|
|
7657
8128
|
},
|
|
7658
8129
|
[onShapesChange]
|
|
7659
8130
|
);
|
|
7660
|
-
const toImageCoords = (0,
|
|
8131
|
+
const toImageCoords = (0, import_react17.useCallback)(
|
|
7661
8132
|
(e) => {
|
|
7662
8133
|
const { width, height } = layoutRef.current;
|
|
7663
8134
|
const scaleX = imageWidth / Math.max(1, width);
|
|
@@ -7669,8 +8140,8 @@ var TpkAnnotationOverlay = (0, import_react16.forwardRef)(function TpkAnnotation
|
|
|
7669
8140
|
},
|
|
7670
8141
|
[imageWidth, imageHeight]
|
|
7671
8142
|
);
|
|
7672
|
-
const panResponder = (0,
|
|
7673
|
-
() =>
|
|
8143
|
+
const panResponder = (0, import_react17.useMemo)(
|
|
8144
|
+
() => import_react_native17.PanResponder.create({
|
|
7674
8145
|
onStartShouldSetPanResponder: () => tool !== "select",
|
|
7675
8146
|
onMoveShouldSetPanResponder: () => tool !== "select",
|
|
7676
8147
|
onPanResponderGrant: (e) => {
|
|
@@ -7695,13 +8166,13 @@ var TpkAnnotationOverlay = (0, import_react16.forwardRef)(function TpkAnnotation
|
|
|
7695
8166
|
}),
|
|
7696
8167
|
[tool, style, textValue, toImageCoords, shapes, commitShapes]
|
|
7697
8168
|
);
|
|
7698
|
-
const onLayout = (0,
|
|
8169
|
+
const onLayout = (0, import_react17.useCallback)((e) => {
|
|
7699
8170
|
layoutRef.current = {
|
|
7700
8171
|
width: e.nativeEvent.layout.width,
|
|
7701
8172
|
height: e.nativeEvent.layout.height
|
|
7702
8173
|
};
|
|
7703
8174
|
}, []);
|
|
7704
|
-
(0,
|
|
8175
|
+
(0, import_react17.useImperativeHandle)(
|
|
7705
8176
|
ref,
|
|
7706
8177
|
() => ({
|
|
7707
8178
|
getShapes: () => shapes,
|
|
@@ -7729,32 +8200,32 @@ var TpkAnnotationOverlay = (0, import_react16.forwardRef)(function TpkAnnotation
|
|
|
7729
8200
|
}),
|
|
7730
8201
|
[shapes, commitShapes]
|
|
7731
8202
|
);
|
|
7732
|
-
return /* @__PURE__ */
|
|
7733
|
-
|
|
8203
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
8204
|
+
import_react_native17.View,
|
|
7734
8205
|
{
|
|
7735
8206
|
ref: surfaceRef,
|
|
7736
|
-
style: [
|
|
8207
|
+
style: [styles11.surface, { aspectRatio: imageWidth / imageHeight }],
|
|
7737
8208
|
onLayout,
|
|
7738
8209
|
...panResponder.panHandlers
|
|
7739
8210
|
},
|
|
7740
|
-
/* @__PURE__ */
|
|
7741
|
-
|
|
8211
|
+
/* @__PURE__ */ import_react17.default.createElement(
|
|
8212
|
+
import_react_native17.Image,
|
|
7742
8213
|
{
|
|
7743
8214
|
source: { uri: imageUri },
|
|
7744
|
-
style:
|
|
8215
|
+
style: import_react_native17.StyleSheet.absoluteFill,
|
|
7745
8216
|
resizeMode: "contain"
|
|
7746
8217
|
}
|
|
7747
8218
|
),
|
|
7748
|
-
svgReady && SvgModRef.current ? /* @__PURE__ */
|
|
8219
|
+
svgReady && SvgModRef.current ? /* @__PURE__ */ import_react17.default.createElement(ShapeLayer, { shapes, svgMod: SvgModRef.current, viewBox: `0 0 ${imageWidth} ${imageHeight}` }) : null
|
|
7749
8220
|
);
|
|
7750
8221
|
});
|
|
7751
8222
|
function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
7752
8223
|
const Svg = svgMod.default ?? svgMod.Svg;
|
|
7753
8224
|
const { Rect, Circle, Polygon, Path, Text: SvgText, Line: SvgLine, G } = svgMod;
|
|
7754
|
-
return /* @__PURE__ */
|
|
8225
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
7755
8226
|
Svg,
|
|
7756
8227
|
{
|
|
7757
|
-
style:
|
|
8228
|
+
style: import_react_native17.StyleSheet.absoluteFill,
|
|
7758
8229
|
viewBox,
|
|
7759
8230
|
preserveAspectRatio: "xMidYMid meet"
|
|
7760
8231
|
},
|
|
@@ -7764,7 +8235,7 @@ function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
|
7764
8235
|
const opacity = s.kind === "blur" ? 1 : s.style.opacity ?? 1;
|
|
7765
8236
|
switch (s.kind) {
|
|
7766
8237
|
case "rect":
|
|
7767
|
-
return /* @__PURE__ */
|
|
8238
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
7768
8239
|
Rect,
|
|
7769
8240
|
{
|
|
7770
8241
|
key: s.id,
|
|
@@ -7779,7 +8250,7 @@ function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
|
7779
8250
|
}
|
|
7780
8251
|
);
|
|
7781
8252
|
case "circle":
|
|
7782
|
-
return /* @__PURE__ */
|
|
8253
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
7783
8254
|
Circle,
|
|
7784
8255
|
{
|
|
7785
8256
|
key: s.id,
|
|
@@ -7794,7 +8265,7 @@ function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
|
7794
8265
|
);
|
|
7795
8266
|
case "arrow": {
|
|
7796
8267
|
const head = arrowHeadPoints(s);
|
|
7797
|
-
return /* @__PURE__ */
|
|
8268
|
+
return /* @__PURE__ */ import_react17.default.createElement(G, { key: s.id, opacity }, /* @__PURE__ */ import_react17.default.createElement(
|
|
7798
8269
|
SvgLine,
|
|
7799
8270
|
{
|
|
7800
8271
|
x1: s.from.x,
|
|
@@ -7804,7 +8275,7 @@ function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
|
7804
8275
|
stroke,
|
|
7805
8276
|
strokeWidth
|
|
7806
8277
|
}
|
|
7807
|
-
), /* @__PURE__ */
|
|
8278
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
7808
8279
|
Polygon,
|
|
7809
8280
|
{
|
|
7810
8281
|
points: head.map((p) => `${p.x},${p.y}`).join(" "),
|
|
@@ -7813,7 +8284,7 @@ function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
|
7813
8284
|
));
|
|
7814
8285
|
}
|
|
7815
8286
|
case "path":
|
|
7816
|
-
return /* @__PURE__ */
|
|
8287
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
7817
8288
|
Path,
|
|
7818
8289
|
{
|
|
7819
8290
|
key: s.id,
|
|
@@ -7825,7 +8296,7 @@ function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
|
7825
8296
|
}
|
|
7826
8297
|
);
|
|
7827
8298
|
case "text":
|
|
7828
|
-
return /* @__PURE__ */
|
|
8299
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
7829
8300
|
SvgText,
|
|
7830
8301
|
{
|
|
7831
8302
|
key: s.id,
|
|
@@ -7838,7 +8309,7 @@ function ShapeLayer({ shapes, svgMod, viewBox }) {
|
|
|
7838
8309
|
s.text
|
|
7839
8310
|
);
|
|
7840
8311
|
case "blur":
|
|
7841
|
-
return /* @__PURE__ */
|
|
8312
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
7842
8313
|
Rect,
|
|
7843
8314
|
{
|
|
7844
8315
|
key: s.id,
|
|
@@ -7937,7 +8408,7 @@ function estimateBase64Bytes2(b64) {
|
|
|
7937
8408
|
const padding = b64.endsWith("==") ? 2 : b64.endsWith("=") ? 1 : 0;
|
|
7938
8409
|
return Math.floor(b64.length * 3 / 4) - padding;
|
|
7939
8410
|
}
|
|
7940
|
-
var
|
|
8411
|
+
var styles11 = import_react_native17.StyleSheet.create({
|
|
7941
8412
|
surface: {
|
|
7942
8413
|
width: "100%",
|
|
7943
8414
|
backgroundColor: "#000"
|
|
@@ -8013,15 +8484,15 @@ function ScreenshotAnnotationEditor({
|
|
|
8013
8484
|
testID = "tpk-screenshot-annotation-editor"
|
|
8014
8485
|
}) {
|
|
8015
8486
|
const t = STRINGS6[useTpkLanguage()];
|
|
8016
|
-
const editorRef = (0,
|
|
8017
|
-
const [tool, setTool] = (0,
|
|
8018
|
-
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)(
|
|
8019
8490
|
DEFAULT_STYLE
|
|
8020
8491
|
);
|
|
8021
|
-
const [textValue, setTextValue] = (0,
|
|
8022
|
-
const [processing, setProcessing] = (0,
|
|
8023
|
-
const [error, setError] = (0,
|
|
8024
|
-
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 () => {
|
|
8025
8496
|
if (!editorRef.current) {
|
|
8026
8497
|
setError(t.errorNotReady);
|
|
8027
8498
|
return;
|
|
@@ -8041,21 +8512,21 @@ function ScreenshotAnnotationEditor({
|
|
|
8041
8512
|
setProcessing(false);
|
|
8042
8513
|
}
|
|
8043
8514
|
}, [format, quality, onSave, t]);
|
|
8044
|
-
const setColor = (0,
|
|
8515
|
+
const setColor = (0, import_react18.useCallback)((color) => {
|
|
8045
8516
|
setAnnotationStyle((cur) => ({ ...cur, color }));
|
|
8046
8517
|
}, []);
|
|
8047
|
-
const setStrokeWidth = (0,
|
|
8518
|
+
const setStrokeWidth = (0, import_react18.useCallback)((strokeWidth) => {
|
|
8048
8519
|
setAnnotationStyle((cur) => ({ ...cur, strokeWidth }));
|
|
8049
8520
|
}, []);
|
|
8050
|
-
return /* @__PURE__ */
|
|
8051
|
-
|
|
8521
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
8522
|
+
import_react_native18.Modal,
|
|
8052
8523
|
{
|
|
8053
8524
|
animationType: "slide",
|
|
8054
8525
|
onRequestClose: processing ? void 0 : onCancel,
|
|
8055
8526
|
transparent: false,
|
|
8056
8527
|
visible
|
|
8057
8528
|
},
|
|
8058
|
-
/* @__PURE__ */
|
|
8529
|
+
/* @__PURE__ */ import_react18.default.createElement(import_react_native18.View, { style: [styles12.root, style], testID }, /* @__PURE__ */ import_react18.default.createElement(
|
|
8059
8530
|
Header2,
|
|
8060
8531
|
{
|
|
8061
8532
|
onCancel,
|
|
@@ -8064,7 +8535,7 @@ function ScreenshotAnnotationEditor({
|
|
|
8064
8535
|
onClear: () => editorRef.current?.clear(),
|
|
8065
8536
|
t
|
|
8066
8537
|
}
|
|
8067
|
-
), /* @__PURE__ */
|
|
8538
|
+
), /* @__PURE__ */ import_react18.default.createElement(
|
|
8068
8539
|
Toolbar,
|
|
8069
8540
|
{
|
|
8070
8541
|
tool,
|
|
@@ -8074,17 +8545,17 @@ function ScreenshotAnnotationEditor({
|
|
|
8074
8545
|
onStrokeWidthChange: setStrokeWidth,
|
|
8075
8546
|
t
|
|
8076
8547
|
}
|
|
8077
|
-
), tool === "text" && /* @__PURE__ */
|
|
8078
|
-
|
|
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,
|
|
8079
8550
|
{
|
|
8080
8551
|
autoFocus: true,
|
|
8081
8552
|
placeholder: t.textPlaceholder,
|
|
8082
8553
|
placeholderTextColor: "#94A3B8",
|
|
8083
|
-
style:
|
|
8554
|
+
style: styles12.textInput,
|
|
8084
8555
|
value: textValue,
|
|
8085
8556
|
onChangeText: setTextValue
|
|
8086
8557
|
}
|
|
8087
|
-
)), /* @__PURE__ */
|
|
8558
|
+
)), /* @__PURE__ */ import_react18.default.createElement(import_react_native18.View, { style: styles12.canvasWrap }, /* @__PURE__ */ import_react18.default.createElement(
|
|
8088
8559
|
TpkAnnotationOverlay,
|
|
8089
8560
|
{
|
|
8090
8561
|
ref: editorRef,
|
|
@@ -8095,7 +8566,7 @@ function ScreenshotAnnotationEditor({
|
|
|
8095
8566
|
style: annotationStyle,
|
|
8096
8567
|
textValue
|
|
8097
8568
|
}
|
|
8098
|
-
)), 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(
|
|
8099
8570
|
Footer2,
|
|
8100
8571
|
{
|
|
8101
8572
|
processing,
|
|
@@ -8113,36 +8584,36 @@ function Header2({
|
|
|
8113
8584
|
onClear,
|
|
8114
8585
|
t
|
|
8115
8586
|
}) {
|
|
8116
|
-
return /* @__PURE__ */
|
|
8117
|
-
|
|
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,
|
|
8118
8589
|
{
|
|
8119
8590
|
accessibilityRole: "button",
|
|
8120
8591
|
accessibilityLabel: t.cancelA11y,
|
|
8121
8592
|
disabled: processing,
|
|
8122
8593
|
onPress: onCancel,
|
|
8123
|
-
style:
|
|
8594
|
+
style: styles12.headerIconButton
|
|
8124
8595
|
},
|
|
8125
|
-
/* @__PURE__ */
|
|
8126
|
-
), /* @__PURE__ */
|
|
8127
|
-
|
|
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,
|
|
8128
8599
|
{
|
|
8129
8600
|
accessibilityRole: "button",
|
|
8130
8601
|
accessibilityLabel: t.undoA11y,
|
|
8131
8602
|
disabled: processing,
|
|
8132
8603
|
onPress: onUndo,
|
|
8133
|
-
style:
|
|
8604
|
+
style: styles12.headerIconButton
|
|
8134
8605
|
},
|
|
8135
|
-
/* @__PURE__ */
|
|
8136
|
-
), /* @__PURE__ */
|
|
8137
|
-
|
|
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,
|
|
8138
8609
|
{
|
|
8139
8610
|
accessibilityRole: "button",
|
|
8140
8611
|
accessibilityLabel: t.clearA11y,
|
|
8141
8612
|
disabled: processing,
|
|
8142
8613
|
onPress: onClear,
|
|
8143
|
-
style:
|
|
8614
|
+
style: styles12.headerIconButton
|
|
8144
8615
|
},
|
|
8145
|
-
/* @__PURE__ */
|
|
8616
|
+
/* @__PURE__ */ import_react18.default.createElement(import_react_native18.Text, { style: styles12.headerIconLabel }, "\u232B")
|
|
8146
8617
|
));
|
|
8147
8618
|
}
|
|
8148
8619
|
function Toolbar({
|
|
@@ -8153,17 +8624,17 @@ function Toolbar({
|
|
|
8153
8624
|
onStrokeWidthChange,
|
|
8154
8625
|
t
|
|
8155
8626
|
}) {
|
|
8156
|
-
return /* @__PURE__ */
|
|
8157
|
-
|
|
8627
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react_native18.View, { style: styles12.toolbar }, /* @__PURE__ */ import_react18.default.createElement(
|
|
8628
|
+
import_react_native18.ScrollView,
|
|
8158
8629
|
{
|
|
8159
8630
|
horizontal: true,
|
|
8160
8631
|
showsHorizontalScrollIndicator: false,
|
|
8161
|
-
contentContainerStyle:
|
|
8632
|
+
contentContainerStyle: styles12.toolbarRow
|
|
8162
8633
|
},
|
|
8163
8634
|
TOOLS.map((item) => {
|
|
8164
8635
|
const active = tool === item.value;
|
|
8165
|
-
return /* @__PURE__ */
|
|
8166
|
-
|
|
8636
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
8637
|
+
import_react_native18.Pressable,
|
|
8167
8638
|
{
|
|
8168
8639
|
key: item.value,
|
|
8169
8640
|
accessibilityRole: "radio",
|
|
@@ -8171,11 +8642,11 @@ function Toolbar({
|
|
|
8171
8642
|
accessibilityLabel: t.tools[item.value],
|
|
8172
8643
|
onPress: () => onToolChange(item.value),
|
|
8173
8644
|
style: [
|
|
8174
|
-
|
|
8175
|
-
active &&
|
|
8645
|
+
styles12.toolButton,
|
|
8646
|
+
active && styles12.toolButtonActive
|
|
8176
8647
|
]
|
|
8177
8648
|
},
|
|
8178
|
-
/* @__PURE__ */
|
|
8649
|
+
/* @__PURE__ */ import_react18.default.createElement(
|
|
8179
8650
|
TpkIcon,
|
|
8180
8651
|
{
|
|
8181
8652
|
name: item.icon,
|
|
@@ -8183,48 +8654,48 @@ function Toolbar({
|
|
|
8183
8654
|
color: active ? "#FAFAF7" : "#94A3B8"
|
|
8184
8655
|
}
|
|
8185
8656
|
),
|
|
8186
|
-
/* @__PURE__ */
|
|
8187
|
-
|
|
8657
|
+
/* @__PURE__ */ import_react18.default.createElement(
|
|
8658
|
+
import_react_native18.Text,
|
|
8188
8659
|
{
|
|
8189
8660
|
style: [
|
|
8190
|
-
|
|
8191
|
-
active &&
|
|
8661
|
+
styles12.toolLabel,
|
|
8662
|
+
active && styles12.toolLabelActive
|
|
8192
8663
|
]
|
|
8193
8664
|
},
|
|
8194
8665
|
t.tools[item.value]
|
|
8195
8666
|
)
|
|
8196
8667
|
);
|
|
8197
8668
|
})
|
|
8198
|
-
), /* @__PURE__ */
|
|
8199
|
-
|
|
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,
|
|
8200
8671
|
{
|
|
8201
8672
|
key: c,
|
|
8202
8673
|
accessibilityRole: "button",
|
|
8203
8674
|
accessibilityLabel: t.colorA11y(c),
|
|
8204
8675
|
onPress: () => onColorChange(c),
|
|
8205
8676
|
style: [
|
|
8206
|
-
|
|
8677
|
+
styles12.swatch,
|
|
8207
8678
|
{ backgroundColor: c },
|
|
8208
|
-
annotationStyle.color === c &&
|
|
8679
|
+
annotationStyle.color === c && styles12.swatchActive
|
|
8209
8680
|
]
|
|
8210
8681
|
}
|
|
8211
|
-
))), /* @__PURE__ */
|
|
8212
|
-
|
|
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,
|
|
8213
8684
|
{
|
|
8214
8685
|
key: w,
|
|
8215
8686
|
accessibilityRole: "button",
|
|
8216
8687
|
accessibilityLabel: t.strokeA11y(w),
|
|
8217
8688
|
onPress: () => onStrokeWidthChange(w),
|
|
8218
8689
|
style: [
|
|
8219
|
-
|
|
8220
|
-
annotationStyle.strokeWidth === w &&
|
|
8690
|
+
styles12.strokeButton,
|
|
8691
|
+
annotationStyle.strokeWidth === w && styles12.strokeButtonActive
|
|
8221
8692
|
]
|
|
8222
8693
|
},
|
|
8223
|
-
/* @__PURE__ */
|
|
8224
|
-
|
|
8694
|
+
/* @__PURE__ */ import_react18.default.createElement(
|
|
8695
|
+
import_react_native18.View,
|
|
8225
8696
|
{
|
|
8226
8697
|
style: [
|
|
8227
|
-
|
|
8698
|
+
styles12.strokeIndicator,
|
|
8228
8699
|
{
|
|
8229
8700
|
height: w,
|
|
8230
8701
|
backgroundColor: annotationStyle.strokeWidth === w ? "#FAFAF7" : "#94A3B8"
|
|
@@ -8240,45 +8711,45 @@ function Footer2({
|
|
|
8240
8711
|
onSave,
|
|
8241
8712
|
t
|
|
8242
8713
|
}) {
|
|
8243
|
-
return /* @__PURE__ */
|
|
8244
|
-
|
|
8714
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
8715
|
+
import_react_native18.View,
|
|
8245
8716
|
{
|
|
8246
8717
|
style: [
|
|
8247
|
-
|
|
8718
|
+
styles12.footer,
|
|
8248
8719
|
{ paddingBottom: Math.max(14, getModalInsets().bottom) }
|
|
8249
8720
|
]
|
|
8250
8721
|
},
|
|
8251
|
-
/* @__PURE__ */
|
|
8252
|
-
|
|
8722
|
+
/* @__PURE__ */ import_react18.default.createElement(
|
|
8723
|
+
import_react_native18.Pressable,
|
|
8253
8724
|
{
|
|
8254
8725
|
accessibilityRole: "button",
|
|
8255
8726
|
disabled: processing,
|
|
8256
8727
|
onPress: onCancel,
|
|
8257
8728
|
style: ({ pressed }) => [
|
|
8258
|
-
|
|
8729
|
+
styles12.footerSecondary,
|
|
8259
8730
|
pressed && { opacity: 0.7 }
|
|
8260
8731
|
]
|
|
8261
8732
|
},
|
|
8262
|
-
/* @__PURE__ */
|
|
8733
|
+
/* @__PURE__ */ import_react18.default.createElement(import_react_native18.Text, { style: styles12.footerSecondaryLabel }, t.cancel)
|
|
8263
8734
|
),
|
|
8264
|
-
/* @__PURE__ */
|
|
8265
|
-
|
|
8735
|
+
/* @__PURE__ */ import_react18.default.createElement(
|
|
8736
|
+
import_react_native18.Pressable,
|
|
8266
8737
|
{
|
|
8267
8738
|
accessibilityRole: "button",
|
|
8268
8739
|
accessibilityLabel: t.save,
|
|
8269
8740
|
disabled: processing,
|
|
8270
8741
|
onPress: onSave,
|
|
8271
8742
|
style: ({ pressed }) => [
|
|
8272
|
-
|
|
8273
|
-
processing &&
|
|
8743
|
+
styles12.footerPrimary,
|
|
8744
|
+
processing && styles12.footerPrimaryDisabled,
|
|
8274
8745
|
pressed && { opacity: 0.85 }
|
|
8275
8746
|
]
|
|
8276
8747
|
},
|
|
8277
|
-
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)
|
|
8278
8749
|
)
|
|
8279
8750
|
);
|
|
8280
8751
|
}
|
|
8281
|
-
var
|
|
8752
|
+
var styles12 = import_react_native18.StyleSheet.create({
|
|
8282
8753
|
root: {
|
|
8283
8754
|
flex: 1,
|
|
8284
8755
|
backgroundColor: "#0F172A"
|
|
@@ -8291,7 +8762,7 @@ var styles11 = import_react_native17.StyleSheet.create({
|
|
|
8291
8762
|
paddingTop: 12,
|
|
8292
8763
|
paddingBottom: 12,
|
|
8293
8764
|
backgroundColor: "#020617",
|
|
8294
|
-
borderBottomWidth:
|
|
8765
|
+
borderBottomWidth: import_react_native18.StyleSheet.hairlineWidth,
|
|
8295
8766
|
borderBottomColor: "#1F2A24"
|
|
8296
8767
|
},
|
|
8297
8768
|
headerIconButton: {
|
|
@@ -8323,7 +8794,7 @@ var styles11 = import_react_native17.StyleSheet.create({
|
|
|
8323
8794
|
toolbar: {
|
|
8324
8795
|
backgroundColor: "#020617",
|
|
8325
8796
|
paddingVertical: 8,
|
|
8326
|
-
borderBottomWidth:
|
|
8797
|
+
borderBottomWidth: import_react_native18.StyleSheet.hairlineWidth,
|
|
8327
8798
|
borderBottomColor: "#1F2A24"
|
|
8328
8799
|
},
|
|
8329
8800
|
toolbarRow: {
|
|
@@ -8397,7 +8868,7 @@ var styles11 = import_react_native17.StyleSheet.create({
|
|
|
8397
8868
|
backgroundColor: "#020617",
|
|
8398
8869
|
paddingHorizontal: 12,
|
|
8399
8870
|
paddingVertical: 10,
|
|
8400
|
-
borderBottomWidth:
|
|
8871
|
+
borderBottomWidth: import_react_native18.StyleSheet.hairlineWidth,
|
|
8401
8872
|
borderBottomColor: "#1F2A24"
|
|
8402
8873
|
},
|
|
8403
8874
|
textInput: {
|
|
@@ -8429,7 +8900,7 @@ var styles11 = import_react_native17.StyleSheet.create({
|
|
|
8429
8900
|
gap: 10,
|
|
8430
8901
|
padding: 14,
|
|
8431
8902
|
backgroundColor: "#020617",
|
|
8432
|
-
borderTopWidth:
|
|
8903
|
+
borderTopWidth: import_react_native18.StyleSheet.hairlineWidth,
|
|
8433
8904
|
borderTopColor: "#1F2A24"
|
|
8434
8905
|
},
|
|
8435
8906
|
footerSecondary: {
|
|
@@ -8506,8 +8977,8 @@ async function readFileSize(uri) {
|
|
|
8506
8977
|
}
|
|
8507
8978
|
|
|
8508
8979
|
// src/VoiceBugInputSheet.tsx
|
|
8509
|
-
var
|
|
8510
|
-
var
|
|
8980
|
+
var import_react19 = __toESM(require("react"));
|
|
8981
|
+
var import_react_native19 = require("react-native");
|
|
8511
8982
|
|
|
8512
8983
|
// src/voice-extract.ts
|
|
8513
8984
|
async function extractVoiceBug(tpk, audio) {
|
|
@@ -8662,23 +9133,23 @@ function VoiceBugInputSheet({
|
|
|
8662
9133
|
testID = "tpk-voice-bug-sheet"
|
|
8663
9134
|
}) {
|
|
8664
9135
|
const uiLanguage = useTpkLanguage();
|
|
8665
|
-
const S = (0,
|
|
9136
|
+
const S = (0, import_react19.useMemo)(
|
|
8666
9137
|
() => ({
|
|
8667
9138
|
...uiLanguage === "de" ? DEFAULT_STRINGS_DE : DEFAULT_STRINGS_EN,
|
|
8668
9139
|
...strings ?? {}
|
|
8669
9140
|
}),
|
|
8670
9141
|
[strings, uiLanguage]
|
|
8671
9142
|
);
|
|
8672
|
-
const [phase, setPhase] = (0,
|
|
8673
|
-
const [classification, setClassification] = (0,
|
|
8674
|
-
const [seconds, setSeconds] = (0,
|
|
8675
|
-
const [error, setError] = (0,
|
|
8676
|
-
const [result, setResult] = (0,
|
|
8677
|
-
const [quickMode, setQuickMode] = (0,
|
|
8678
|
-
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)(
|
|
8679
9150
|
voiceLanguage ?? "auto"
|
|
8680
9151
|
);
|
|
8681
|
-
(0,
|
|
9152
|
+
(0, import_react19.useEffect)(() => {
|
|
8682
9153
|
if (voiceLanguage !== void 0) {
|
|
8683
9154
|
setLanguage(voiceLanguage);
|
|
8684
9155
|
return;
|
|
@@ -8696,28 +9167,28 @@ function VoiceBugInputSheet({
|
|
|
8696
9167
|
cancelled = true;
|
|
8697
9168
|
};
|
|
8698
9169
|
}, [voiceLanguage]);
|
|
8699
|
-
const recorderRef = (0,
|
|
8700
|
-
const tickerRef = (0,
|
|
8701
|
-
const meterAnim = (0,
|
|
8702
|
-
const pulseAnim = (0,
|
|
8703
|
-
(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)(() => {
|
|
8704
9175
|
if (phase !== "recording") {
|
|
8705
9176
|
pulseAnim.stopAnimation();
|
|
8706
9177
|
pulseAnim.setValue(0);
|
|
8707
9178
|
return;
|
|
8708
9179
|
}
|
|
8709
|
-
const loop =
|
|
8710
|
-
|
|
8711
|
-
|
|
9180
|
+
const loop = import_react_native19.Animated.loop(
|
|
9181
|
+
import_react_native19.Animated.sequence([
|
|
9182
|
+
import_react_native19.Animated.timing(pulseAnim, {
|
|
8712
9183
|
toValue: 1,
|
|
8713
9184
|
duration: 700,
|
|
8714
|
-
easing:
|
|
9185
|
+
easing: import_react_native19.Easing.inOut(import_react_native19.Easing.ease),
|
|
8715
9186
|
useNativeDriver: true
|
|
8716
9187
|
}),
|
|
8717
|
-
|
|
9188
|
+
import_react_native19.Animated.timing(pulseAnim, {
|
|
8718
9189
|
toValue: 0,
|
|
8719
9190
|
duration: 700,
|
|
8720
|
-
easing:
|
|
9191
|
+
easing: import_react_native19.Easing.inOut(import_react_native19.Easing.ease),
|
|
8721
9192
|
useNativeDriver: true
|
|
8722
9193
|
})
|
|
8723
9194
|
])
|
|
@@ -8725,15 +9196,15 @@ function VoiceBugInputSheet({
|
|
|
8725
9196
|
loop.start();
|
|
8726
9197
|
return () => loop.stop();
|
|
8727
9198
|
}, [pulseAnim, phase]);
|
|
8728
|
-
const dimAnim = (0,
|
|
8729
|
-
(0,
|
|
8730
|
-
|
|
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, {
|
|
8731
9202
|
toValue: phase === "recording" ? 0.1 : 1,
|
|
8732
9203
|
duration: 200,
|
|
8733
9204
|
useNativeDriver: true
|
|
8734
9205
|
}).start();
|
|
8735
9206
|
}, [dimAnim, phase]);
|
|
8736
|
-
(0,
|
|
9207
|
+
(0, import_react19.useEffect)(() => {
|
|
8737
9208
|
if (visible) {
|
|
8738
9209
|
setPhase("idle");
|
|
8739
9210
|
setClassification("bug");
|
|
@@ -8749,12 +9220,12 @@ function VoiceBugInputSheet({
|
|
|
8749
9220
|
}
|
|
8750
9221
|
}
|
|
8751
9222
|
}, [visible]);
|
|
8752
|
-
(0,
|
|
9223
|
+
(0, import_react19.useEffect)(() => {
|
|
8753
9224
|
if (phase === "recording" && seconds >= maxSeconds) {
|
|
8754
9225
|
void stop();
|
|
8755
9226
|
}
|
|
8756
9227
|
}, [phase, seconds, maxSeconds]);
|
|
8757
|
-
const start = (0,
|
|
9228
|
+
const start = (0, import_react19.useCallback)(async () => {
|
|
8758
9229
|
setError(null);
|
|
8759
9230
|
setSeconds(0);
|
|
8760
9231
|
meterAnim.setValue(0);
|
|
@@ -8773,7 +9244,7 @@ function VoiceBugInputSheet({
|
|
|
8773
9244
|
);
|
|
8774
9245
|
}
|
|
8775
9246
|
}, [meterAnim]);
|
|
8776
|
-
const stop = (0,
|
|
9247
|
+
const stop = (0, import_react19.useCallback)(async () => {
|
|
8777
9248
|
if (phase !== "recording") return;
|
|
8778
9249
|
if (tickerRef.current) {
|
|
8779
9250
|
clearInterval(tickerRef.current);
|
|
@@ -8809,7 +9280,7 @@ function VoiceBugInputSheet({
|
|
|
8809
9280
|
);
|
|
8810
9281
|
}
|
|
8811
9282
|
}, [phase, tpk, language, meterAnim]);
|
|
8812
|
-
const cancel = (0,
|
|
9283
|
+
const cancel = (0, import_react19.useCallback)(async () => {
|
|
8813
9284
|
if (tickerRef.current) {
|
|
8814
9285
|
clearInterval(tickerRef.current);
|
|
8815
9286
|
tickerRef.current = null;
|
|
@@ -8818,7 +9289,7 @@ function VoiceBugInputSheet({
|
|
|
8818
9289
|
recorderRef.current = null;
|
|
8819
9290
|
onCancel();
|
|
8820
9291
|
}, [onCancel]);
|
|
8821
|
-
const runQuick = (0,
|
|
9292
|
+
const runQuick = (0, import_react19.useCallback)(
|
|
8822
9293
|
async (action) => {
|
|
8823
9294
|
if (phase !== "idle" || !captureScreen) return;
|
|
8824
9295
|
setQuickMode(true);
|
|
@@ -8844,17 +9315,17 @@ function VoiceBugInputSheet({
|
|
|
8844
9315
|
},
|
|
8845
9316
|
[phase, captureScreen, tpk, currentScreen, language, S]
|
|
8846
9317
|
);
|
|
8847
|
-
const useResult = (0,
|
|
9318
|
+
const useResult = (0, import_react19.useCallback)(() => {
|
|
8848
9319
|
if (result) onExtracted(result, classification);
|
|
8849
9320
|
}, [result, classification, onExtracted]);
|
|
8850
|
-
const retryFresh = (0,
|
|
9321
|
+
const retryFresh = (0, import_react19.useCallback)(() => {
|
|
8851
9322
|
setQuickMode(false);
|
|
8852
9323
|
setResult(null);
|
|
8853
9324
|
setSeconds(0);
|
|
8854
9325
|
setError(null);
|
|
8855
9326
|
setPhase("idle");
|
|
8856
9327
|
}, []);
|
|
8857
|
-
const headline = (0,
|
|
9328
|
+
const headline = (0, import_react19.useMemo)(() => {
|
|
8858
9329
|
switch (phase) {
|
|
8859
9330
|
case "idle":
|
|
8860
9331
|
return S.idleHeadline;
|
|
@@ -8868,7 +9339,7 @@ function VoiceBugInputSheet({
|
|
|
8868
9339
|
return S.errorHeadline;
|
|
8869
9340
|
}
|
|
8870
9341
|
}, [phase, S]);
|
|
8871
|
-
const description = (0,
|
|
9342
|
+
const description = (0, import_react19.useMemo)(() => {
|
|
8872
9343
|
switch (phase) {
|
|
8873
9344
|
case "idle":
|
|
8874
9345
|
return S.idleDescription;
|
|
@@ -8882,7 +9353,7 @@ function VoiceBugInputSheet({
|
|
|
8882
9353
|
return error ?? S.errorDescriptionFallback;
|
|
8883
9354
|
}
|
|
8884
9355
|
}, [phase, error, S, quickMode]);
|
|
8885
|
-
const classificationLabel = (0,
|
|
9356
|
+
const classificationLabel = (0, import_react19.useCallback)(
|
|
8886
9357
|
(c) => {
|
|
8887
9358
|
switch (c) {
|
|
8888
9359
|
case "bug":
|
|
@@ -8897,7 +9368,7 @@ function VoiceBugInputSheet({
|
|
|
8897
9368
|
},
|
|
8898
9369
|
[S]
|
|
8899
9370
|
);
|
|
8900
|
-
const languageLabel = (0,
|
|
9371
|
+
const languageLabel = (0, import_react19.useCallback)(
|
|
8901
9372
|
(l, s) => {
|
|
8902
9373
|
if (l === "auto") return s.languagePickerLabel;
|
|
8903
9374
|
return l.toUpperCase();
|
|
@@ -8916,33 +9387,35 @@ function VoiceBugInputSheet({
|
|
|
8916
9387
|
const isExtracted = phase === "extracted";
|
|
8917
9388
|
const isError = phase === "error";
|
|
8918
9389
|
const opacity = Math.max(0, Math.min(1, sheetOpacity));
|
|
8919
|
-
const
|
|
8920
|
-
const
|
|
8921
|
-
|
|
8922
|
-
|
|
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,
|
|
8923
9396
|
{
|
|
8924
9397
|
animationType: "slide",
|
|
8925
9398
|
onRequestClose: isUploading ? void 0 : cancel,
|
|
8926
9399
|
transparent: true,
|
|
8927
9400
|
visible
|
|
8928
9401
|
},
|
|
8929
|
-
/* @__PURE__ */
|
|
8930
|
-
|
|
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,
|
|
8931
9404
|
{
|
|
8932
9405
|
accessibilityRole: "button",
|
|
8933
9406
|
accessibilityLabel: S.cancel,
|
|
8934
9407
|
disabled: isUploading,
|
|
8935
9408
|
onPress: () => void cancel(),
|
|
8936
|
-
style:
|
|
9409
|
+
style: styles13.backdropSpacer
|
|
8937
9410
|
}
|
|
8938
|
-
), /* @__PURE__ */
|
|
8939
|
-
|
|
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,
|
|
8940
9413
|
{
|
|
8941
|
-
style: [
|
|
9414
|
+
style: [styles13.dimmable, { opacity: dimAnim }],
|
|
8942
9415
|
pointerEvents: isRecording ? "none" : "auto"
|
|
8943
9416
|
},
|
|
8944
|
-
/* @__PURE__ */
|
|
8945
|
-
|
|
9417
|
+
/* @__PURE__ */ import_react19.default.createElement(import_react_native19.View, { style: styles13.languagePickerRow }, /* @__PURE__ */ import_react19.default.createElement(
|
|
9418
|
+
import_react_native19.Pressable,
|
|
8946
9419
|
{
|
|
8947
9420
|
accessibilityRole: "button",
|
|
8948
9421
|
accessibilityLabel: `Current language: ${languageLabel(language, S)}. Tap to change.`,
|
|
@@ -8952,22 +9425,22 @@ function VoiceBugInputSheet({
|
|
|
8952
9425
|
(cur) => cur === "auto" ? "de" : cur === "de" ? "en" : "auto"
|
|
8953
9426
|
);
|
|
8954
9427
|
},
|
|
8955
|
-
style: [
|
|
9428
|
+
style: [styles13.languageChip, !isIdle && { opacity: 0.5 }]
|
|
8956
9429
|
},
|
|
8957
|
-
/* @__PURE__ */
|
|
8958
|
-
/* @__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))
|
|
8959
9432
|
)),
|
|
8960
|
-
/* @__PURE__ */
|
|
8961
|
-
|
|
9433
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
9434
|
+
import_react_native19.ScrollView,
|
|
8962
9435
|
{
|
|
8963
9436
|
horizontal: true,
|
|
8964
9437
|
showsHorizontalScrollIndicator: false,
|
|
8965
|
-
contentContainerStyle:
|
|
9438
|
+
contentContainerStyle: styles13.classificationRow
|
|
8966
9439
|
},
|
|
8967
9440
|
CLASSIFICATIONS.map((c) => {
|
|
8968
9441
|
const active = classification === c;
|
|
8969
|
-
return /* @__PURE__ */
|
|
8970
|
-
|
|
9442
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
9443
|
+
import_react_native19.Pressable,
|
|
8971
9444
|
{
|
|
8972
9445
|
key: c,
|
|
8973
9446
|
accessibilityRole: "radio",
|
|
@@ -8976,7 +9449,7 @@ function VoiceBugInputSheet({
|
|
|
8976
9449
|
disabled: !isIdle,
|
|
8977
9450
|
onPress: () => setClassification(c),
|
|
8978
9451
|
style: [
|
|
8979
|
-
|
|
9452
|
+
styles13.classificationChip,
|
|
8980
9453
|
active && {
|
|
8981
9454
|
backgroundColor: accentColor,
|
|
8982
9455
|
borderColor: accentColor
|
|
@@ -8984,7 +9457,7 @@ function VoiceBugInputSheet({
|
|
|
8984
9457
|
!isIdle && { opacity: 0.5 }
|
|
8985
9458
|
]
|
|
8986
9459
|
},
|
|
8987
|
-
active && /* @__PURE__ */
|
|
9460
|
+
active && /* @__PURE__ */ import_react19.default.createElement(
|
|
8988
9461
|
TpkIcon,
|
|
8989
9462
|
{
|
|
8990
9463
|
name: "check",
|
|
@@ -8993,12 +9466,12 @@ function VoiceBugInputSheet({
|
|
|
8993
9466
|
style: { marginRight: 4 }
|
|
8994
9467
|
}
|
|
8995
9468
|
),
|
|
8996
|
-
/* @__PURE__ */
|
|
8997
|
-
|
|
9469
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
9470
|
+
import_react_native19.Text,
|
|
8998
9471
|
{
|
|
8999
9472
|
style: [
|
|
9000
|
-
|
|
9001
|
-
active &&
|
|
9473
|
+
styles13.classificationChipLabel,
|
|
9474
|
+
active && styles13.classificationChipLabelActive
|
|
9002
9475
|
]
|
|
9003
9476
|
},
|
|
9004
9477
|
classificationLabel(c)
|
|
@@ -9006,13 +9479,13 @@ function VoiceBugInputSheet({
|
|
|
9006
9479
|
);
|
|
9007
9480
|
})
|
|
9008
9481
|
),
|
|
9009
|
-
/* @__PURE__ */
|
|
9010
|
-
/* @__PURE__ */
|
|
9011
|
-
), isRecording && /* @__PURE__ */
|
|
9012
|
-
|
|
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,
|
|
9013
9486
|
{
|
|
9014
9487
|
style: [
|
|
9015
|
-
|
|
9488
|
+
styles13.meterFill,
|
|
9016
9489
|
{
|
|
9017
9490
|
backgroundColor: accentColor,
|
|
9018
9491
|
transform: [
|
|
@@ -9026,38 +9499,38 @@ function VoiceBugInputSheet({
|
|
|
9026
9499
|
}
|
|
9027
9500
|
]
|
|
9028
9501
|
}
|
|
9029
|
-
))), isExtracted && result && /* @__PURE__ */
|
|
9030
|
-
|
|
9502
|
+
))), isExtracted && result && /* @__PURE__ */ import_react19.default.createElement(
|
|
9503
|
+
import_react_native19.ScrollView,
|
|
9031
9504
|
{
|
|
9032
|
-
style:
|
|
9033
|
-
contentContainerStyle:
|
|
9505
|
+
style: styles13.extractedScroll,
|
|
9506
|
+
contentContainerStyle: styles13.extractedScrollContent
|
|
9034
9507
|
},
|
|
9035
|
-
quickMode ? null : /* @__PURE__ */
|
|
9036
|
-
/* @__PURE__ */
|
|
9037
|
-
/* @__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(
|
|
9038
9511
|
ExtractField,
|
|
9039
9512
|
{
|
|
9040
9513
|
label: "Description",
|
|
9041
9514
|
value: result.description
|
|
9042
9515
|
}
|
|
9043
9516
|
),
|
|
9044
|
-
/* @__PURE__ */
|
|
9517
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
9045
9518
|
ExtractField,
|
|
9046
9519
|
{
|
|
9047
9520
|
label: "Expected",
|
|
9048
9521
|
value: result.expectedBehavior
|
|
9049
9522
|
}
|
|
9050
9523
|
),
|
|
9051
|
-
/* @__PURE__ */
|
|
9524
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
9052
9525
|
ExtractField,
|
|
9053
9526
|
{
|
|
9054
9527
|
label: "Actual",
|
|
9055
9528
|
value: result.actualBehavior
|
|
9056
9529
|
}
|
|
9057
9530
|
),
|
|
9058
|
-
/* @__PURE__ */
|
|
9059
|
-
), isIdle && captureScreen ? /* @__PURE__ */
|
|
9060
|
-
|
|
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,
|
|
9061
9534
|
{
|
|
9062
9535
|
key: a.kind,
|
|
9063
9536
|
accessibilityRole: "button",
|
|
@@ -9065,29 +9538,29 @@ function VoiceBugInputSheet({
|
|
|
9065
9538
|
testID: `tpk-quick-${a.kind}`,
|
|
9066
9539
|
onPress: () => void runQuick(a),
|
|
9067
9540
|
style: ({ pressed }) => [
|
|
9068
|
-
|
|
9541
|
+
styles13.quickButton,
|
|
9069
9542
|
pressed && { opacity: 0.8 }
|
|
9070
9543
|
]
|
|
9071
9544
|
},
|
|
9072
|
-
/* @__PURE__ */
|
|
9073
|
-
/* @__PURE__ */
|
|
9074
|
-
)))) : null, /* @__PURE__ */
|
|
9075
|
-
|
|
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,
|
|
9076
9549
|
{
|
|
9077
9550
|
accessibilityRole: "button",
|
|
9078
9551
|
accessibilityLabel: "Start recording",
|
|
9079
9552
|
onPress: () => void start(),
|
|
9080
9553
|
style: [
|
|
9081
|
-
|
|
9554
|
+
styles13.micButton,
|
|
9082
9555
|
{ backgroundColor: accentColor, shadowColor: accentColor }
|
|
9083
9556
|
]
|
|
9084
9557
|
},
|
|
9085
|
-
/* @__PURE__ */
|
|
9086
|
-
), isRecording && /* @__PURE__ */
|
|
9087
|
-
|
|
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,
|
|
9088
9561
|
{
|
|
9089
9562
|
style: [
|
|
9090
|
-
|
|
9563
|
+
styles13.micButton,
|
|
9091
9564
|
{
|
|
9092
9565
|
backgroundColor: accentColor,
|
|
9093
9566
|
shadowColor: accentColor,
|
|
@@ -9095,49 +9568,49 @@ function VoiceBugInputSheet({
|
|
|
9095
9568
|
}
|
|
9096
9569
|
]
|
|
9097
9570
|
},
|
|
9098
|
-
/* @__PURE__ */
|
|
9099
|
-
|
|
9571
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
9572
|
+
import_react_native19.Pressable,
|
|
9100
9573
|
{
|
|
9101
9574
|
accessibilityRole: "button",
|
|
9102
9575
|
accessibilityLabel: "Stop recording",
|
|
9103
9576
|
onPress: () => void stop(),
|
|
9104
|
-
style:
|
|
9577
|
+
style: styles13.micPressable
|
|
9105
9578
|
},
|
|
9106
|
-
/* @__PURE__ */
|
|
9579
|
+
/* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: styles13.micButtonStop }, "\u25A0")
|
|
9107
9580
|
)
|
|
9108
|
-
), isUploading && /* @__PURE__ */
|
|
9109
|
-
|
|
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,
|
|
9110
9583
|
{
|
|
9111
9584
|
accessibilityRole: "button",
|
|
9112
9585
|
onPress: retryFresh,
|
|
9113
9586
|
style: ({ pressed }) => [
|
|
9114
|
-
|
|
9587
|
+
styles13.secondaryButton,
|
|
9115
9588
|
pressed && { opacity: 0.85 }
|
|
9116
9589
|
]
|
|
9117
9590
|
},
|
|
9118
|
-
/* @__PURE__ */
|
|
9119
|
-
), isExtracted && /* @__PURE__ */
|
|
9120
|
-
|
|
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,
|
|
9121
9594
|
{
|
|
9122
9595
|
accessibilityRole: "button",
|
|
9123
9596
|
accessibilityLabel: S.useExtracted,
|
|
9124
9597
|
onPress: useResult,
|
|
9125
9598
|
style: ({ pressed }) => [
|
|
9126
|
-
|
|
9599
|
+
styles13.primaryButton,
|
|
9127
9600
|
{ backgroundColor: accentColor },
|
|
9128
9601
|
pressed && { opacity: 0.85 }
|
|
9129
9602
|
]
|
|
9130
9603
|
},
|
|
9131
|
-
/* @__PURE__ */
|
|
9132
|
-
))), /* @__PURE__ */
|
|
9133
|
-
|
|
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,
|
|
9134
9607
|
{
|
|
9135
9608
|
accessibilityRole: "button",
|
|
9136
9609
|
disabled: isUploading,
|
|
9137
9610
|
onPress: () => void cancel(),
|
|
9138
|
-
style:
|
|
9611
|
+
style: styles13.cancelButton
|
|
9139
9612
|
},
|
|
9140
|
-
/* @__PURE__ */
|
|
9613
|
+
/* @__PURE__ */ import_react19.default.createElement(import_react_native19.Text, { style: [styles13.cancelLabel, { color: accentColor }] }, S.cancel)
|
|
9141
9614
|
)))
|
|
9142
9615
|
);
|
|
9143
9616
|
}
|
|
@@ -9145,20 +9618,20 @@ function ExtractField({
|
|
|
9145
9618
|
label,
|
|
9146
9619
|
value
|
|
9147
9620
|
}) {
|
|
9148
|
-
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"));
|
|
9149
9622
|
}
|
|
9150
9623
|
async function startRecording(opts = {}) {
|
|
9151
|
-
if (
|
|
9624
|
+
if (import_react_native19.Platform.OS === "web") return startWebRecording(opts);
|
|
9152
9625
|
return startNativeRecording();
|
|
9153
9626
|
}
|
|
9154
9627
|
async function stopRecording(handle) {
|
|
9155
|
-
if (
|
|
9628
|
+
if (import_react_native19.Platform.OS === "web") return stopWebRecording(handle);
|
|
9156
9629
|
return stopNativeRecording(handle);
|
|
9157
9630
|
}
|
|
9158
9631
|
async function cleanupRecorder(handle) {
|
|
9159
9632
|
if (!handle) return;
|
|
9160
9633
|
try {
|
|
9161
|
-
if (
|
|
9634
|
+
if (import_react_native19.Platform.OS === "web") {
|
|
9162
9635
|
const w = handle;
|
|
9163
9636
|
w.stopMeter?.();
|
|
9164
9637
|
w.mediaRecorder.stream.getTracks().forEach((t) => t.stop());
|
|
@@ -9264,7 +9737,7 @@ async function startNativeRecording() {
|
|
|
9264
9737
|
});
|
|
9265
9738
|
} catch {
|
|
9266
9739
|
}
|
|
9267
|
-
const rec = new Recorder(nativeRecordingOptions(mod,
|
|
9740
|
+
const rec = new Recorder(nativeRecordingOptions(mod, import_react_native19.Platform.OS));
|
|
9268
9741
|
await rec.prepareToRecordAsync();
|
|
9269
9742
|
rec.record();
|
|
9270
9743
|
return rec;
|
|
@@ -9324,7 +9797,7 @@ function formatTime(seconds) {
|
|
|
9324
9797
|
const s = (seconds % 60).toString().padStart(2, "0");
|
|
9325
9798
|
return `${m}:${s}`;
|
|
9326
9799
|
}
|
|
9327
|
-
var
|
|
9800
|
+
var styles13 = import_react_native19.StyleSheet.create({
|
|
9328
9801
|
backdrop: {
|
|
9329
9802
|
flex: 1,
|
|
9330
9803
|
backgroundColor: "rgba(0,0,0,0.55)",
|
|
@@ -9572,7 +10045,7 @@ var styles12 = import_react_native18.StyleSheet.create({
|
|
|
9572
10045
|
},
|
|
9573
10046
|
extractRow: {
|
|
9574
10047
|
paddingVertical: 8,
|
|
9575
|
-
borderBottomWidth:
|
|
10048
|
+
borderBottomWidth: import_react_native19.StyleSheet.hairlineWidth,
|
|
9576
10049
|
borderBottomColor: "rgba(255,255,255,0.1)"
|
|
9577
10050
|
},
|
|
9578
10051
|
extractLabel: {
|
|
@@ -9591,8 +10064,8 @@ var styles12 = import_react_native18.StyleSheet.create({
|
|
|
9591
10064
|
});
|
|
9592
10065
|
|
|
9593
10066
|
// src/SessionEndDialog.tsx
|
|
9594
|
-
var
|
|
9595
|
-
var
|
|
10067
|
+
var import_react20 = __toESM(require("react"));
|
|
10068
|
+
var import_react_native20 = require("react-native");
|
|
9596
10069
|
var ISSUE_KEYS = ["bugs", "crashes", "performance", "ui"];
|
|
9597
10070
|
var ISSUE_LABELS = {
|
|
9598
10071
|
bugs: "Bugs / unexpected behaviour",
|
|
@@ -9674,24 +10147,24 @@ function SessionEndDialog({
|
|
|
9674
10147
|
style
|
|
9675
10148
|
}) {
|
|
9676
10149
|
const t = STRINGS7[useTpkLanguage()];
|
|
9677
|
-
const [ratings, setRatings] = (0,
|
|
10150
|
+
const [ratings, setRatings] = (0, import_react20.useState)({
|
|
9678
10151
|
overall: 3,
|
|
9679
10152
|
stability: 3,
|
|
9680
10153
|
usability: 3,
|
|
9681
10154
|
experience: 3
|
|
9682
10155
|
});
|
|
9683
|
-
const [issues, setIssues] = (0,
|
|
10156
|
+
const [issues, setIssues] = (0, import_react20.useState)({
|
|
9684
10157
|
bugs: false,
|
|
9685
10158
|
crashes: false,
|
|
9686
10159
|
performance: false,
|
|
9687
10160
|
ui: false
|
|
9688
10161
|
});
|
|
9689
|
-
const [positive, setPositive] = (0,
|
|
9690
|
-
const [negative, setNegative] = (0,
|
|
9691
|
-
const [suggestions, setSuggestions] = (0,
|
|
9692
|
-
const [submitting, setSubmitting] = (0,
|
|
9693
|
-
const [error, setError] = (0,
|
|
9694
|
-
(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)(() => {
|
|
9695
10168
|
if (visible) {
|
|
9696
10169
|
setRatings({ overall: 3, stability: 3, usability: 3, experience: 3 });
|
|
9697
10170
|
setIssues({ bugs: false, crashes: false, performance: false, ui: false });
|
|
@@ -9701,13 +10174,13 @@ function SessionEndDialog({
|
|
|
9701
10174
|
setError(null);
|
|
9702
10175
|
}
|
|
9703
10176
|
}, [visible]);
|
|
9704
|
-
const hasFeedback = (0,
|
|
10177
|
+
const hasFeedback = (0, import_react20.useMemo)(() => {
|
|
9705
10178
|
if (positive.trim() || negative.trim() || suggestions.trim()) return true;
|
|
9706
10179
|
if (Object.values(issues).some(Boolean)) return true;
|
|
9707
10180
|
if (Object.values(ratings).some((r) => r !== 3)) return true;
|
|
9708
10181
|
return false;
|
|
9709
10182
|
}, [positive, negative, suggestions, issues, ratings]);
|
|
9710
|
-
const submit = (0,
|
|
10183
|
+
const submit = (0, import_react20.useCallback)(async () => {
|
|
9711
10184
|
if (!tpk) return;
|
|
9712
10185
|
setSubmitting(true);
|
|
9713
10186
|
setError(null);
|
|
@@ -9763,41 +10236,41 @@ function SessionEndDialog({
|
|
|
9763
10236
|
onError,
|
|
9764
10237
|
t
|
|
9765
10238
|
]);
|
|
9766
|
-
return /* @__PURE__ */
|
|
9767
|
-
|
|
10239
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
10240
|
+
import_react_native20.Modal,
|
|
9768
10241
|
{
|
|
9769
10242
|
animationType: "slide",
|
|
9770
10243
|
onRequestClose: submitting ? void 0 : onClose,
|
|
9771
10244
|
transparent: false,
|
|
9772
10245
|
visible
|
|
9773
10246
|
},
|
|
9774
|
-
/* @__PURE__ */
|
|
9775
|
-
|
|
10247
|
+
/* @__PURE__ */ import_react20.default.createElement(import_react_native20.View, { style: [styles14.root, style] }, /* @__PURE__ */ import_react20.default.createElement(
|
|
10248
|
+
import_react_native20.View,
|
|
9776
10249
|
{
|
|
9777
|
-
style: [
|
|
10250
|
+
style: [styles14.header, { paddingTop: 12 + getModalInsets().top }]
|
|
9778
10251
|
},
|
|
9779
|
-
/* @__PURE__ */
|
|
9780
|
-
|
|
10252
|
+
/* @__PURE__ */ import_react20.default.createElement(
|
|
10253
|
+
import_react_native20.Pressable,
|
|
9781
10254
|
{
|
|
9782
10255
|
accessibilityRole: "button",
|
|
9783
10256
|
accessibilityLabel: t.cancel,
|
|
9784
10257
|
disabled: submitting,
|
|
9785
10258
|
onPress: onClose,
|
|
9786
|
-
style:
|
|
10259
|
+
style: styles14.headerClose
|
|
9787
10260
|
},
|
|
9788
|
-
/* @__PURE__ */
|
|
10261
|
+
/* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.headerCloseLabel }, "\xD7")
|
|
9789
10262
|
),
|
|
9790
|
-
/* @__PURE__ */
|
|
9791
|
-
/* @__PURE__ */
|
|
9792
|
-
), /* @__PURE__ */
|
|
9793
|
-
|
|
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,
|
|
9794
10267
|
{
|
|
9795
|
-
contentContainerStyle:
|
|
10268
|
+
contentContainerStyle: styles14.body,
|
|
9796
10269
|
keyboardShouldPersistTaps: "handled"
|
|
9797
10270
|
},
|
|
9798
|
-
/* @__PURE__ */
|
|
9799
|
-
/* @__PURE__ */
|
|
9800
|
-
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(
|
|
9801
10274
|
RatingRow,
|
|
9802
10275
|
{
|
|
9803
10276
|
key: k,
|
|
@@ -9807,8 +10280,8 @@ function SessionEndDialog({
|
|
|
9807
10280
|
onChange: (v) => setRatings((cur) => ({ ...cur, [k]: v }))
|
|
9808
10281
|
}
|
|
9809
10282
|
)),
|
|
9810
|
-
/* @__PURE__ */
|
|
9811
|
-
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(
|
|
9812
10285
|
IssueRow,
|
|
9813
10286
|
{
|
|
9814
10287
|
key: k,
|
|
@@ -9817,78 +10290,78 @@ function SessionEndDialog({
|
|
|
9817
10290
|
onChange: (v) => setIssues((cur) => ({ ...cur, [k]: v }))
|
|
9818
10291
|
}
|
|
9819
10292
|
)),
|
|
9820
|
-
/* @__PURE__ */
|
|
9821
|
-
/* @__PURE__ */
|
|
9822
|
-
/* @__PURE__ */
|
|
9823
|
-
|
|
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,
|
|
9824
10297
|
{
|
|
9825
10298
|
multiline: true,
|
|
9826
10299
|
onChangeText: setPositive,
|
|
9827
10300
|
placeholder: t.positivePlaceholder,
|
|
9828
|
-
style: [
|
|
10301
|
+
style: [styles14.input, styles14.textarea],
|
|
9829
10302
|
textAlignVertical: "top",
|
|
9830
10303
|
value: positive
|
|
9831
10304
|
}
|
|
9832
10305
|
),
|
|
9833
|
-
/* @__PURE__ */
|
|
9834
|
-
/* @__PURE__ */
|
|
9835
|
-
|
|
10306
|
+
/* @__PURE__ */ import_react20.default.createElement(FieldLabel2, { text: t.negativeLabel }),
|
|
10307
|
+
/* @__PURE__ */ import_react20.default.createElement(
|
|
10308
|
+
import_react_native20.TextInput,
|
|
9836
10309
|
{
|
|
9837
10310
|
multiline: true,
|
|
9838
10311
|
onChangeText: setNegative,
|
|
9839
10312
|
placeholder: t.negativePlaceholder,
|
|
9840
|
-
style: [
|
|
10313
|
+
style: [styles14.input, styles14.textarea],
|
|
9841
10314
|
textAlignVertical: "top",
|
|
9842
10315
|
value: negative
|
|
9843
10316
|
}
|
|
9844
10317
|
),
|
|
9845
|
-
/* @__PURE__ */
|
|
9846
|
-
/* @__PURE__ */
|
|
9847
|
-
|
|
10318
|
+
/* @__PURE__ */ import_react20.default.createElement(FieldLabel2, { text: t.suggestionsLabel }),
|
|
10319
|
+
/* @__PURE__ */ import_react20.default.createElement(
|
|
10320
|
+
import_react_native20.TextInput,
|
|
9848
10321
|
{
|
|
9849
10322
|
multiline: true,
|
|
9850
10323
|
onChangeText: setSuggestions,
|
|
9851
10324
|
placeholder: t.suggestionsPlaceholder,
|
|
9852
|
-
style: [
|
|
10325
|
+
style: [styles14.input, styles14.textarea],
|
|
9853
10326
|
textAlignVertical: "top",
|
|
9854
10327
|
value: suggestions
|
|
9855
10328
|
}
|
|
9856
10329
|
),
|
|
9857
|
-
error && /* @__PURE__ */
|
|
9858
|
-
), /* @__PURE__ */
|
|
9859
|
-
|
|
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,
|
|
9860
10333
|
{
|
|
9861
10334
|
style: [
|
|
9862
|
-
|
|
10335
|
+
styles14.footer,
|
|
9863
10336
|
{ paddingBottom: Math.max(14, getModalInsets().bottom) }
|
|
9864
10337
|
]
|
|
9865
10338
|
},
|
|
9866
|
-
/* @__PURE__ */
|
|
9867
|
-
|
|
10339
|
+
/* @__PURE__ */ import_react20.default.createElement(
|
|
10340
|
+
import_react_native20.Pressable,
|
|
9868
10341
|
{
|
|
9869
10342
|
accessibilityRole: "button",
|
|
9870
10343
|
disabled: submitting,
|
|
9871
10344
|
onPress: onClose,
|
|
9872
10345
|
style: ({ pressed }) => [
|
|
9873
|
-
|
|
10346
|
+
styles14.cancelButton,
|
|
9874
10347
|
pressed && { opacity: 0.7 }
|
|
9875
10348
|
]
|
|
9876
10349
|
},
|
|
9877
|
-
/* @__PURE__ */
|
|
10350
|
+
/* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.cancelLabel }, t.cancel)
|
|
9878
10351
|
),
|
|
9879
|
-
/* @__PURE__ */
|
|
9880
|
-
|
|
10352
|
+
/* @__PURE__ */ import_react20.default.createElement(
|
|
10353
|
+
import_react_native20.Pressable,
|
|
9881
10354
|
{
|
|
9882
10355
|
accessibilityRole: "button",
|
|
9883
10356
|
disabled: !tpk || submitting,
|
|
9884
10357
|
onPress: () => void submit(),
|
|
9885
10358
|
style: ({ pressed }) => [
|
|
9886
|
-
|
|
9887
|
-
(!tpk || submitting) &&
|
|
10359
|
+
styles14.endButton,
|
|
10360
|
+
(!tpk || submitting) && styles14.endButtonDisabled,
|
|
9888
10361
|
pressed && { opacity: 0.85 }
|
|
9889
10362
|
]
|
|
9890
10363
|
},
|
|
9891
|
-
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)
|
|
9892
10365
|
)
|
|
9893
10366
|
))
|
|
9894
10367
|
);
|
|
@@ -9898,19 +10371,19 @@ function StatsSection({
|
|
|
9898
10371
|
t
|
|
9899
10372
|
}) {
|
|
9900
10373
|
const duration = stats?.durationSeconds ?? 0;
|
|
9901
|
-
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(
|
|
9902
10375
|
StatTile,
|
|
9903
10376
|
{
|
|
9904
10377
|
label: t.statScreens,
|
|
9905
10378
|
value: String(stats?.screensVisited ?? 0)
|
|
9906
10379
|
}
|
|
9907
|
-
), /* @__PURE__ */
|
|
10380
|
+
), /* @__PURE__ */ import_react20.default.createElement(
|
|
9908
10381
|
StatTile,
|
|
9909
10382
|
{
|
|
9910
10383
|
label: t.statBugs,
|
|
9911
10384
|
value: String(stats?.bugsReported ?? 0)
|
|
9912
10385
|
}
|
|
9913
|
-
), /* @__PURE__ */
|
|
10386
|
+
), /* @__PURE__ */ import_react20.default.createElement(
|
|
9914
10387
|
StatTile,
|
|
9915
10388
|
{
|
|
9916
10389
|
label: t.statTasks,
|
|
@@ -9922,13 +10395,13 @@ function StatTile({
|
|
|
9922
10395
|
label,
|
|
9923
10396
|
value
|
|
9924
10397
|
}) {
|
|
9925
|
-
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));
|
|
9926
10399
|
}
|
|
9927
10400
|
function SectionLabel({ text }) {
|
|
9928
|
-
return /* @__PURE__ */
|
|
10401
|
+
return /* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.sectionLabel }, text);
|
|
9929
10402
|
}
|
|
9930
10403
|
function FieldLabel2({ text }) {
|
|
9931
|
-
return /* @__PURE__ */
|
|
10404
|
+
return /* @__PURE__ */ import_react20.default.createElement(import_react_native20.Text, { style: styles14.fieldLabel }, text);
|
|
9932
10405
|
}
|
|
9933
10406
|
function RatingRow({
|
|
9934
10407
|
label,
|
|
@@ -9936,8 +10409,8 @@ function RatingRow({
|
|
|
9936
10409
|
onChange,
|
|
9937
10410
|
starsA11y
|
|
9938
10411
|
}) {
|
|
9939
|
-
return /* @__PURE__ */
|
|
9940
|
-
|
|
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,
|
|
9941
10414
|
{
|
|
9942
10415
|
key: i,
|
|
9943
10416
|
accessibilityRole: "button",
|
|
@@ -9945,11 +10418,11 @@ function RatingRow({
|
|
|
9945
10418
|
accessibilityState: { selected: value === i },
|
|
9946
10419
|
onPress: () => onChange(i),
|
|
9947
10420
|
style: ({ pressed }) => [
|
|
9948
|
-
|
|
10421
|
+
styles14.starButton,
|
|
9949
10422
|
pressed && { opacity: 0.7 }
|
|
9950
10423
|
]
|
|
9951
10424
|
},
|
|
9952
|
-
/* @__PURE__ */
|
|
10425
|
+
/* @__PURE__ */ import_react20.default.createElement(
|
|
9953
10426
|
TpkIcon,
|
|
9954
10427
|
{
|
|
9955
10428
|
name: i <= value ? "star_filled" : "star_outline",
|
|
@@ -9964,7 +10437,7 @@ function IssueRow({
|
|
|
9964
10437
|
value,
|
|
9965
10438
|
onChange
|
|
9966
10439
|
}) {
|
|
9967
|
-
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 }));
|
|
9968
10441
|
}
|
|
9969
10442
|
function formatDuration(seconds) {
|
|
9970
10443
|
if (seconds < 60) return `${seconds}s`;
|
|
@@ -10008,7 +10481,7 @@ function composeFeedbackDescription(input) {
|
|
|
10008
10481
|
}
|
|
10009
10482
|
return lines.join("\n");
|
|
10010
10483
|
}
|
|
10011
|
-
var
|
|
10484
|
+
var styles14 = import_react_native20.StyleSheet.create({
|
|
10012
10485
|
root: {
|
|
10013
10486
|
flex: 1,
|
|
10014
10487
|
backgroundColor: "#FAFAF7"
|
|
@@ -10019,7 +10492,7 @@ var styles13 = import_react_native19.StyleSheet.create({
|
|
|
10019
10492
|
paddingHorizontal: 12,
|
|
10020
10493
|
paddingVertical: 12,
|
|
10021
10494
|
backgroundColor: "#FFFFFF",
|
|
10022
|
-
borderBottomWidth:
|
|
10495
|
+
borderBottomWidth: import_react_native20.StyleSheet.hairlineWidth,
|
|
10023
10496
|
borderBottomColor: "#E5E7EB"
|
|
10024
10497
|
},
|
|
10025
10498
|
headerClose: {
|
|
@@ -10158,7 +10631,7 @@ var styles13 = import_react_native19.StyleSheet.create({
|
|
|
10158
10631
|
gap: 10,
|
|
10159
10632
|
padding: 14,
|
|
10160
10633
|
backgroundColor: "#FFFFFF",
|
|
10161
|
-
borderTopWidth:
|
|
10634
|
+
borderTopWidth: import_react_native20.StyleSheet.hairlineWidth,
|
|
10162
10635
|
borderTopColor: "#E5E7EB"
|
|
10163
10636
|
},
|
|
10164
10637
|
cancelButton: {
|
|
@@ -10192,8 +10665,8 @@ var styles13 = import_react_native19.StyleSheet.create({
|
|
|
10192
10665
|
});
|
|
10193
10666
|
|
|
10194
10667
|
// src/MyBugsSheet.tsx
|
|
10195
|
-
var
|
|
10196
|
-
var
|
|
10668
|
+
var import_react21 = __toESM(require("react"));
|
|
10669
|
+
var import_react_native21 = require("react-native");
|
|
10197
10670
|
|
|
10198
10671
|
// src/bug-status.ts
|
|
10199
10672
|
var STATUS_STYLES = {
|
|
@@ -10263,11 +10736,11 @@ function MyBugsSheet({
|
|
|
10263
10736
|
const theme = useTpkTheme();
|
|
10264
10737
|
const language = useTpkLanguage();
|
|
10265
10738
|
const t = STRINGS8[language];
|
|
10266
|
-
const [loading, setLoading] = (0,
|
|
10267
|
-
const [error, setError] = (0,
|
|
10268
|
-
const [bugs, setBugs] = (0,
|
|
10269
|
-
const [selected, setSelected] = (0,
|
|
10270
|
-
(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)(() => {
|
|
10271
10744
|
if (!visible || !tpk) return;
|
|
10272
10745
|
let cancelled = false;
|
|
10273
10746
|
setLoading(true);
|
|
@@ -10283,30 +10756,30 @@ function MyBugsSheet({
|
|
|
10283
10756
|
cancelled = true;
|
|
10284
10757
|
};
|
|
10285
10758
|
}, [visible, tpk]);
|
|
10286
|
-
return /* @__PURE__ */
|
|
10287
|
-
|
|
10759
|
+
return /* @__PURE__ */ import_react21.default.createElement(
|
|
10760
|
+
import_react_native21.Modal,
|
|
10288
10761
|
{
|
|
10289
10762
|
visible,
|
|
10290
10763
|
transparent: true,
|
|
10291
10764
|
animationType: "slide",
|
|
10292
10765
|
onRequestClose: onClose
|
|
10293
10766
|
},
|
|
10294
|
-
/* @__PURE__ */
|
|
10295
|
-
|
|
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,
|
|
10296
10769
|
{
|
|
10297
10770
|
onPress: onClose,
|
|
10298
10771
|
hitSlop: 8,
|
|
10299
10772
|
accessibilityLabel: t.close,
|
|
10300
10773
|
testID: "tpk-my-bugs-close"
|
|
10301
10774
|
},
|
|
10302
|
-
/* @__PURE__ */
|
|
10303
|
-
)), loading ? /* @__PURE__ */
|
|
10304
|
-
|
|
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,
|
|
10305
10778
|
{
|
|
10306
10779
|
data: bugs,
|
|
10307
10780
|
keyExtractor: (b) => b.id,
|
|
10308
|
-
contentContainerStyle:
|
|
10309
|
-
renderItem: ({ item }) => /* @__PURE__ */
|
|
10781
|
+
contentContainerStyle: styles15.listBody,
|
|
10782
|
+
renderItem: ({ item }) => /* @__PURE__ */ import_react21.default.createElement(
|
|
10310
10783
|
BugRow,
|
|
10311
10784
|
{
|
|
10312
10785
|
bug: item,
|
|
@@ -10317,7 +10790,7 @@ function MyBugsSheet({
|
|
|
10317
10790
|
)
|
|
10318
10791
|
}
|
|
10319
10792
|
))),
|
|
10320
|
-
/* @__PURE__ */
|
|
10793
|
+
/* @__PURE__ */ import_react21.default.createElement(
|
|
10321
10794
|
BugDetailModal,
|
|
10322
10795
|
{
|
|
10323
10796
|
bug: selected,
|
|
@@ -10334,15 +10807,15 @@ function StatusBadge2({
|
|
|
10334
10807
|
language
|
|
10335
10808
|
}) {
|
|
10336
10809
|
const { label, color } = bugStatusStyle(status, language);
|
|
10337
|
-
return /* @__PURE__ */
|
|
10338
|
-
|
|
10810
|
+
return /* @__PURE__ */ import_react21.default.createElement(
|
|
10811
|
+
import_react_native21.View,
|
|
10339
10812
|
{
|
|
10340
10813
|
style: [
|
|
10341
|
-
|
|
10814
|
+
styles15.badge,
|
|
10342
10815
|
{ backgroundColor: `${color}1F`, borderColor: `${color}66` }
|
|
10343
10816
|
]
|
|
10344
10817
|
},
|
|
10345
|
-
/* @__PURE__ */
|
|
10818
|
+
/* @__PURE__ */ import_react21.default.createElement(import_react_native21.Text, { style: [styles15.badgeText, { color }] }, label)
|
|
10346
10819
|
);
|
|
10347
10820
|
}
|
|
10348
10821
|
function metaLine(bug, language) {
|
|
@@ -10359,15 +10832,15 @@ function BugRow({
|
|
|
10359
10832
|
textColor,
|
|
10360
10833
|
onPress
|
|
10361
10834
|
}) {
|
|
10362
|
-
return /* @__PURE__ */
|
|
10363
|
-
|
|
10835
|
+
return /* @__PURE__ */ import_react21.default.createElement(
|
|
10836
|
+
import_react_native21.Pressable,
|
|
10364
10837
|
{
|
|
10365
|
-
style:
|
|
10838
|
+
style: styles15.row,
|
|
10366
10839
|
onPress,
|
|
10367
10840
|
testID: `tpk-my-bug-${bug.id}`
|
|
10368
10841
|
},
|
|
10369
|
-
/* @__PURE__ */
|
|
10370
|
-
/* @__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 })
|
|
10371
10844
|
);
|
|
10372
10845
|
}
|
|
10373
10846
|
function BugDetailModal({
|
|
@@ -10377,25 +10850,25 @@ function BugDetailModal({
|
|
|
10377
10850
|
surface,
|
|
10378
10851
|
textColor
|
|
10379
10852
|
}) {
|
|
10380
|
-
return /* @__PURE__ */
|
|
10381
|
-
|
|
10853
|
+
return /* @__PURE__ */ import_react21.default.createElement(
|
|
10854
|
+
import_react_native21.Modal,
|
|
10382
10855
|
{
|
|
10383
10856
|
visible: bug != null,
|
|
10384
10857
|
transparent: true,
|
|
10385
10858
|
animationType: "fade",
|
|
10386
10859
|
onRequestClose: onClose
|
|
10387
10860
|
},
|
|
10388
|
-
/* @__PURE__ */
|
|
10389
|
-
|
|
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,
|
|
10390
10863
|
{
|
|
10391
|
-
style: [
|
|
10864
|
+
style: [styles15.detailCard, { backgroundColor: surface }],
|
|
10392
10865
|
onPress: () => void 0
|
|
10393
10866
|
},
|
|
10394
|
-
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
|
|
10395
10868
|
))
|
|
10396
10869
|
);
|
|
10397
10870
|
}
|
|
10398
|
-
var
|
|
10871
|
+
var styles15 = import_react_native21.StyleSheet.create({
|
|
10399
10872
|
backdrop: {
|
|
10400
10873
|
flex: 1,
|
|
10401
10874
|
backgroundColor: "rgba(0,0,0,0.4)",
|
|
@@ -10424,7 +10897,7 @@ var styles14 = import_react_native20.StyleSheet.create({
|
|
|
10424
10897
|
flexDirection: "row",
|
|
10425
10898
|
alignItems: "center",
|
|
10426
10899
|
paddingVertical: 14,
|
|
10427
|
-
borderBottomWidth:
|
|
10900
|
+
borderBottomWidth: import_react_native21.StyleSheet.hairlineWidth,
|
|
10428
10901
|
borderBottomColor: "#E2E8F0"
|
|
10429
10902
|
},
|
|
10430
10903
|
rowMain: { flex: 1, paddingRight: 12 },
|
|
@@ -10452,8 +10925,8 @@ var styles14 = import_react_native20.StyleSheet.create({
|
|
|
10452
10925
|
});
|
|
10453
10926
|
|
|
10454
10927
|
// src/SessionDetailsSheet.tsx
|
|
10455
|
-
var
|
|
10456
|
-
var
|
|
10928
|
+
var import_react22 = __toESM(require("react"));
|
|
10929
|
+
var import_react_native22 = require("react-native");
|
|
10457
10930
|
var STRINGS9 = {
|
|
10458
10931
|
en: {
|
|
10459
10932
|
title: "Session Details",
|
|
@@ -10498,7 +10971,7 @@ function SessionDetailsSheet({
|
|
|
10498
10971
|
const language = useTpkLanguage();
|
|
10499
10972
|
const t = STRINGS9[language];
|
|
10500
10973
|
const money = (amount) => formatTpkMoney(amount, earningsCurrency, language);
|
|
10501
|
-
const data = (0,
|
|
10974
|
+
const data = (0, import_react22.useMemo)(() => {
|
|
10502
10975
|
if (!visible || !tpk) {
|
|
10503
10976
|
return { taps: 0, screenViews: 0, activeMinutes: 0, paidMinutes: 0 };
|
|
10504
10977
|
}
|
|
@@ -10510,8 +10983,8 @@ function SessionDetailsSheet({
|
|
|
10510
10983
|
paidMinutes: tpk.getEngagedMinutes()
|
|
10511
10984
|
};
|
|
10512
10985
|
}, [visible, tpk]);
|
|
10513
|
-
const [tasks, setTasks] = (0,
|
|
10514
|
-
(0,
|
|
10986
|
+
const [tasks, setTasks] = (0, import_react22.useState)(null);
|
|
10987
|
+
(0, import_react22.useEffect)(() => {
|
|
10515
10988
|
if (!visible || !tpk) return;
|
|
10516
10989
|
let cancelled = false;
|
|
10517
10990
|
tpk.getTaskProgress().then((p) => {
|
|
@@ -10522,37 +10995,37 @@ function SessionDetailsSheet({
|
|
|
10522
10995
|
};
|
|
10523
10996
|
}, [visible, tpk]);
|
|
10524
10997
|
const expected = earningsBaseAmount + data.paidMinutes * earningsPerMinuteRate;
|
|
10525
|
-
return /* @__PURE__ */
|
|
10526
|
-
|
|
10998
|
+
return /* @__PURE__ */ import_react22.default.createElement(
|
|
10999
|
+
import_react_native22.Modal,
|
|
10527
11000
|
{
|
|
10528
11001
|
visible,
|
|
10529
11002
|
transparent: true,
|
|
10530
11003
|
animationType: "slide",
|
|
10531
11004
|
onRequestClose: onClose
|
|
10532
11005
|
},
|
|
10533
|
-
/* @__PURE__ */
|
|
10534
|
-
|
|
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,
|
|
10535
11008
|
{
|
|
10536
11009
|
onPress: onClose,
|
|
10537
11010
|
hitSlop: 8,
|
|
10538
11011
|
accessibilityLabel: t.close,
|
|
10539
11012
|
testID: "tpk-session-details-close"
|
|
10540
11013
|
},
|
|
10541
|
-
/* @__PURE__ */
|
|
10542
|
-
)), /* @__PURE__ */
|
|
10543
|
-
|
|
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,
|
|
10544
11017
|
{
|
|
10545
|
-
style: [
|
|
11018
|
+
style: [styles16.earnings, { borderColor: theme.primary }],
|
|
10546
11019
|
testID: "tpk-session-details-earnings"
|
|
10547
11020
|
},
|
|
10548
|
-
/* @__PURE__ */
|
|
10549
|
-
/* @__PURE__ */
|
|
10550
|
-
/* @__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(
|
|
10551
11024
|
money(earningsBaseAmount),
|
|
10552
11025
|
data.paidMinutes,
|
|
10553
11026
|
money(earningsPerMinuteRate)
|
|
10554
11027
|
))
|
|
10555
|
-
), /* @__PURE__ */
|
|
11028
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
10556
11029
|
Metric,
|
|
10557
11030
|
{
|
|
10558
11031
|
label: t.activeTime,
|
|
@@ -10560,7 +11033,7 @@ function SessionDetailsSheet({
|
|
|
10560
11033
|
hint: t.activeTimeHint,
|
|
10561
11034
|
color: theme.onSurface
|
|
10562
11035
|
}
|
|
10563
|
-
), /* @__PURE__ */
|
|
11036
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
10564
11037
|
Metric,
|
|
10565
11038
|
{
|
|
10566
11039
|
label: t.paidTime,
|
|
@@ -10568,21 +11041,21 @@ function SessionDetailsSheet({
|
|
|
10568
11041
|
hint: t.paidTimeHint,
|
|
10569
11042
|
color: theme.onSurface
|
|
10570
11043
|
}
|
|
10571
|
-
), /* @__PURE__ */
|
|
11044
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
10572
11045
|
Metric,
|
|
10573
11046
|
{
|
|
10574
11047
|
label: t.taps,
|
|
10575
11048
|
value: String(data.taps),
|
|
10576
11049
|
color: theme.onSurface
|
|
10577
11050
|
}
|
|
10578
|
-
), /* @__PURE__ */
|
|
11051
|
+
), /* @__PURE__ */ import_react22.default.createElement(
|
|
10579
11052
|
Metric,
|
|
10580
11053
|
{
|
|
10581
11054
|
label: t.screens,
|
|
10582
11055
|
value: String(data.screenViews),
|
|
10583
11056
|
color: theme.onSurface
|
|
10584
11057
|
}
|
|
10585
|
-
), tasks?.hasTasks ? /* @__PURE__ */
|
|
11058
|
+
), tasks?.hasTasks ? /* @__PURE__ */ import_react22.default.createElement(
|
|
10586
11059
|
Metric,
|
|
10587
11060
|
{
|
|
10588
11061
|
label: t.tasks,
|
|
@@ -10598,9 +11071,9 @@ function Metric({
|
|
|
10598
11071
|
hint,
|
|
10599
11072
|
color
|
|
10600
11073
|
}) {
|
|
10601
|
-
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));
|
|
10602
11075
|
}
|
|
10603
|
-
var
|
|
11076
|
+
var styles16 = import_react_native22.StyleSheet.create({
|
|
10604
11077
|
backdrop: {
|
|
10605
11078
|
flex: 1,
|
|
10606
11079
|
backgroundColor: "rgba(0,0,0,0.4)",
|
|
@@ -10637,7 +11110,7 @@ var styles15 = import_react_native21.StyleSheet.create({
|
|
|
10637
11110
|
alignItems: "center",
|
|
10638
11111
|
justifyContent: "space-between",
|
|
10639
11112
|
paddingVertical: 12,
|
|
10640
|
-
borderBottomWidth:
|
|
11113
|
+
borderBottomWidth: import_react_native22.StyleSheet.hairlineWidth,
|
|
10641
11114
|
borderBottomColor: "#E2E8F0"
|
|
10642
11115
|
},
|
|
10643
11116
|
metricLabelCol: { flex: 1, paddingRight: 12 },
|
|
@@ -10647,8 +11120,8 @@ var styles15 = import_react_native21.StyleSheet.create({
|
|
|
10647
11120
|
});
|
|
10648
11121
|
|
|
10649
11122
|
// src/NotificationsSheet.tsx
|
|
10650
|
-
var
|
|
10651
|
-
var
|
|
11123
|
+
var import_react23 = __toESM(require("react"));
|
|
11124
|
+
var import_react_native23 = require("react-native");
|
|
10652
11125
|
var STRINGS10 = {
|
|
10653
11126
|
en: {
|
|
10654
11127
|
title: "Messages",
|
|
@@ -10679,10 +11152,10 @@ function NotificationsSheet({
|
|
|
10679
11152
|
}) {
|
|
10680
11153
|
const theme = useTpkTheme();
|
|
10681
11154
|
const t = STRINGS10[useTpkLanguage()];
|
|
10682
|
-
const [loading, setLoading] = (0,
|
|
10683
|
-
const [error, setError] = (0,
|
|
10684
|
-
const [items, setItems] = (0,
|
|
10685
|
-
(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)(() => {
|
|
10686
11159
|
if (!visible || !tpk) return;
|
|
10687
11160
|
let cancelled = false;
|
|
10688
11161
|
setLoading(true);
|
|
@@ -10717,60 +11190,60 @@ function NotificationsSheet({
|
|
|
10717
11190
|
tpk.markNotificationsRead().then((unread) => onUnreadChange?.(unread)).catch(() => void 0);
|
|
10718
11191
|
};
|
|
10719
11192
|
const hasUnread = items.some((x) => !x.isRead);
|
|
10720
|
-
return /* @__PURE__ */
|
|
10721
|
-
|
|
11193
|
+
return /* @__PURE__ */ import_react23.default.createElement(
|
|
11194
|
+
import_react_native23.Modal,
|
|
10722
11195
|
{
|
|
10723
11196
|
visible,
|
|
10724
11197
|
transparent: true,
|
|
10725
11198
|
animationType: "slide",
|
|
10726
11199
|
onRequestClose: onClose
|
|
10727
11200
|
},
|
|
10728
|
-
/* @__PURE__ */
|
|
10729
|
-
|
|
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,
|
|
10730
11203
|
{
|
|
10731
11204
|
onPress: markAll,
|
|
10732
11205
|
hitSlop: 8,
|
|
10733
11206
|
testID: "tpk-notifications-mark-all"
|
|
10734
11207
|
},
|
|
10735
|
-
/* @__PURE__ */
|
|
10736
|
-
) : null, /* @__PURE__ */
|
|
10737
|
-
|
|
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,
|
|
10738
11211
|
{
|
|
10739
11212
|
onPress: onClose,
|
|
10740
11213
|
hitSlop: 8,
|
|
10741
11214
|
accessibilityLabel: t.close,
|
|
10742
11215
|
testID: "tpk-notifications-close"
|
|
10743
11216
|
},
|
|
10744
|
-
/* @__PURE__ */
|
|
10745
|
-
))), loading ? /* @__PURE__ */
|
|
10746
|
-
|
|
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,
|
|
10747
11220
|
{
|
|
10748
11221
|
data: items,
|
|
10749
11222
|
keyExtractor: (n) => n.id,
|
|
10750
|
-
contentContainerStyle:
|
|
10751
|
-
renderItem: ({ item }) => /* @__PURE__ */
|
|
10752
|
-
|
|
11223
|
+
contentContainerStyle: styles17.listBody,
|
|
11224
|
+
renderItem: ({ item }) => /* @__PURE__ */ import_react23.default.createElement(
|
|
11225
|
+
import_react_native23.Pressable,
|
|
10753
11226
|
{
|
|
10754
|
-
style:
|
|
11227
|
+
style: styles17.row,
|
|
10755
11228
|
onPress: () => markOne(item),
|
|
10756
11229
|
testID: `tpk-notification-${item.id}`
|
|
10757
11230
|
},
|
|
10758
|
-
/* @__PURE__ */
|
|
10759
|
-
|
|
11231
|
+
/* @__PURE__ */ import_react23.default.createElement(
|
|
11232
|
+
import_react_native23.View,
|
|
10760
11233
|
{
|
|
10761
11234
|
style: [
|
|
10762
|
-
|
|
11235
|
+
styles17.dot,
|
|
10763
11236
|
{
|
|
10764
11237
|
backgroundColor: item.isRead ? "transparent" : theme.primary
|
|
10765
11238
|
}
|
|
10766
11239
|
]
|
|
10767
11240
|
}
|
|
10768
11241
|
),
|
|
10769
|
-
/* @__PURE__ */
|
|
10770
|
-
|
|
11242
|
+
/* @__PURE__ */ import_react23.default.createElement(import_react_native23.View, { style: styles17.rowMain }, /* @__PURE__ */ import_react23.default.createElement(
|
|
11243
|
+
import_react_native23.Text,
|
|
10771
11244
|
{
|
|
10772
11245
|
style: [
|
|
10773
|
-
|
|
11246
|
+
styles17.rowTitle,
|
|
10774
11247
|
{
|
|
10775
11248
|
color: theme.onSurface,
|
|
10776
11249
|
fontWeight: item.isRead ? "500" : "700"
|
|
@@ -10779,20 +11252,20 @@ function NotificationsSheet({
|
|
|
10779
11252
|
numberOfLines: 2
|
|
10780
11253
|
},
|
|
10781
11254
|
item.title
|
|
10782
|
-
), item.body ? /* @__PURE__ */
|
|
10783
|
-
|
|
11255
|
+
), item.body ? /* @__PURE__ */ import_react23.default.createElement(
|
|
11256
|
+
import_react_native23.Text,
|
|
10784
11257
|
{
|
|
10785
|
-
style: [
|
|
11258
|
+
style: [styles17.rowBody, { color: theme.onSurface }],
|
|
10786
11259
|
numberOfLines: 3
|
|
10787
11260
|
},
|
|
10788
11261
|
item.body
|
|
10789
|
-
) : null, /* @__PURE__ */
|
|
11262
|
+
) : null, /* @__PURE__ */ import_react23.default.createElement(import_react_native23.Text, { style: styles17.muted }, formatDate2(item.createdAt)))
|
|
10790
11263
|
)
|
|
10791
11264
|
}
|
|
10792
11265
|
)))
|
|
10793
11266
|
);
|
|
10794
11267
|
}
|
|
10795
|
-
var
|
|
11268
|
+
var styles17 = import_react_native23.StyleSheet.create({
|
|
10796
11269
|
backdrop: {
|
|
10797
11270
|
flex: 1,
|
|
10798
11271
|
backgroundColor: "rgba(0,0,0,0.4)",
|
|
@@ -10823,7 +11296,7 @@ var styles16 = import_react_native22.StyleSheet.create({
|
|
|
10823
11296
|
flexDirection: "row",
|
|
10824
11297
|
alignItems: "flex-start",
|
|
10825
11298
|
paddingVertical: 14,
|
|
10826
|
-
borderBottomWidth:
|
|
11299
|
+
borderBottomWidth: import_react_native23.StyleSheet.hairlineWidth,
|
|
10827
11300
|
borderBottomColor: "#E2E8F0"
|
|
10828
11301
|
},
|
|
10829
11302
|
dot: { width: 8, height: 8, borderRadius: 4, marginTop: 6, marginRight: 10 },
|
|
@@ -10833,8 +11306,8 @@ var styles16 = import_react_native22.StyleSheet.create({
|
|
|
10833
11306
|
});
|
|
10834
11307
|
|
|
10835
11308
|
// src/InviteCodeScreen.tsx
|
|
10836
|
-
var
|
|
10837
|
-
var
|
|
11309
|
+
var import_react24 = __toESM(require("react"));
|
|
11310
|
+
var import_react_native24 = require("react-native");
|
|
10838
11311
|
var STRINGS11 = {
|
|
10839
11312
|
en: {
|
|
10840
11313
|
invalidCode: "Code invalid or not recognised. Please check what you entered.",
|
|
@@ -10864,9 +11337,9 @@ function InviteCodeScreen({
|
|
|
10864
11337
|
}) {
|
|
10865
11338
|
const theme = useTpkTheme();
|
|
10866
11339
|
const t = STRINGS11[useTpkLanguage()];
|
|
10867
|
-
const [code, setCode] = (0,
|
|
10868
|
-
const [loading, setLoading] = (0,
|
|
10869
|
-
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);
|
|
10870
11343
|
const trimmed = code.trim();
|
|
10871
11344
|
const canSubmit = trimmed.length > 0 && !loading && tpk != null;
|
|
10872
11345
|
const submit = () => {
|
|
@@ -10882,32 +11355,32 @@ function InviteCodeScreen({
|
|
|
10882
11355
|
setError(true);
|
|
10883
11356
|
});
|
|
10884
11357
|
};
|
|
10885
|
-
return /* @__PURE__ */
|
|
10886
|
-
|
|
11358
|
+
return /* @__PURE__ */ import_react24.default.createElement(
|
|
11359
|
+
import_react_native24.Modal,
|
|
10887
11360
|
{
|
|
10888
11361
|
visible,
|
|
10889
11362
|
transparent: true,
|
|
10890
11363
|
animationType: "fade",
|
|
10891
11364
|
onRequestClose: onClose
|
|
10892
11365
|
},
|
|
10893
|
-
/* @__PURE__ */
|
|
10894
|
-
|
|
11366
|
+
/* @__PURE__ */ import_react24.default.createElement(
|
|
11367
|
+
import_react_native24.KeyboardAvoidingView,
|
|
10895
11368
|
{
|
|
10896
|
-
behavior:
|
|
10897
|
-
style:
|
|
11369
|
+
behavior: import_react_native24.Platform.OS === "ios" ? "padding" : void 0,
|
|
11370
|
+
style: styles18.backdrop
|
|
10898
11371
|
},
|
|
10899
|
-
/* @__PURE__ */
|
|
10900
|
-
|
|
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,
|
|
10901
11374
|
{
|
|
10902
11375
|
onPress: onClose,
|
|
10903
11376
|
hitSlop: 8,
|
|
10904
|
-
style:
|
|
11377
|
+
style: styles18.close,
|
|
10905
11378
|
accessibilityLabel: t.close,
|
|
10906
11379
|
testID: "tpk-invite-close"
|
|
10907
11380
|
},
|
|
10908
|
-
/* @__PURE__ */
|
|
10909
|
-
) : null, /* @__PURE__ */
|
|
10910
|
-
|
|
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,
|
|
10911
11384
|
{
|
|
10912
11385
|
value: code,
|
|
10913
11386
|
onChangeText: (t2) => {
|
|
@@ -10922,7 +11395,7 @@ function InviteCodeScreen({
|
|
|
10922
11395
|
onSubmitEditing: submit,
|
|
10923
11396
|
returnKeyType: "go",
|
|
10924
11397
|
style: [
|
|
10925
|
-
|
|
11398
|
+
styles18.input,
|
|
10926
11399
|
{
|
|
10927
11400
|
color: theme.onSurface,
|
|
10928
11401
|
borderColor: error ? theme.errorColour : "#CBD5E1"
|
|
@@ -10930,23 +11403,23 @@ function InviteCodeScreen({
|
|
|
10930
11403
|
],
|
|
10931
11404
|
testID: "tpk-invite-input"
|
|
10932
11405
|
}
|
|
10933
|
-
), error ? /* @__PURE__ */
|
|
10934
|
-
|
|
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,
|
|
10935
11408
|
{
|
|
10936
11409
|
onPress: submit,
|
|
10937
11410
|
disabled: !canSubmit,
|
|
10938
11411
|
style: [
|
|
10939
|
-
|
|
11412
|
+
styles18.button,
|
|
10940
11413
|
{ backgroundColor: theme.primary, opacity: canSubmit ? 1 : 0.5 }
|
|
10941
11414
|
],
|
|
10942
11415
|
testID: "tpk-invite-submit"
|
|
10943
11416
|
},
|
|
10944
|
-
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)
|
|
10945
11418
|
))
|
|
10946
11419
|
)
|
|
10947
11420
|
);
|
|
10948
11421
|
}
|
|
10949
|
-
var
|
|
11422
|
+
var styles18 = import_react_native24.StyleSheet.create({
|
|
10950
11423
|
backdrop: {
|
|
10951
11424
|
flex: 1,
|
|
10952
11425
|
backgroundColor: "rgba(0,0,0,0.5)",
|
|
@@ -10992,12 +11465,12 @@ var styles17 = import_react_native23.StyleSheet.create({
|
|
|
10992
11465
|
});
|
|
10993
11466
|
|
|
10994
11467
|
// src/TesterPayKitWrapper.tsx
|
|
10995
|
-
var
|
|
10996
|
-
var
|
|
11468
|
+
var import_react28 = __toESM(require("react"));
|
|
11469
|
+
var import_react_native29 = require("react-native");
|
|
10997
11470
|
|
|
10998
11471
|
// src/ai-tester/AiRemoteControl.tsx
|
|
10999
|
-
var
|
|
11000
|
-
var
|
|
11472
|
+
var import_react25 = __toESM(require("react"));
|
|
11473
|
+
var import_react_native25 = require("react-native");
|
|
11001
11474
|
var import_ai_tester = require("@testerpaykit/ai-tester");
|
|
11002
11475
|
var PLATFORM = typeof document !== "undefined" ? "expo-web" : "expo-native";
|
|
11003
11476
|
var StartSessionError = class extends Error {
|
|
@@ -11054,17 +11527,17 @@ function AiRemoteControl({
|
|
|
11054
11527
|
onSessionEnded,
|
|
11055
11528
|
style
|
|
11056
11529
|
}) {
|
|
11057
|
-
const [status, setStatus] = (0,
|
|
11058
|
-
const [actionCount, setActionCount] = (0,
|
|
11530
|
+
const [status, setStatus] = (0, import_react25.useState)("choosing");
|
|
11531
|
+
const [actionCount, setActionCount] = (0, import_react25.useState)(0);
|
|
11059
11532
|
const language = useTpkLanguage();
|
|
11060
11533
|
const t = STRINGS12[language];
|
|
11061
|
-
const [errorMessage2, setErrorMessage] = (0,
|
|
11062
|
-
const [sessionId, setSessionId] = (0,
|
|
11063
|
-
const [personas, setPersonas] = (0,
|
|
11064
|
-
const [selectedPersona, setSelectedPersona] = (0,
|
|
11065
|
-
const wsRef = (0,
|
|
11066
|
-
const closedRef = (0,
|
|
11067
|
-
(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)(() => {
|
|
11068
11541
|
if (!visible) {
|
|
11069
11542
|
const ws = wsRef.current;
|
|
11070
11543
|
if (ws && ws.readyState <= 1) {
|
|
@@ -11109,7 +11582,7 @@ function AiRemoteControl({
|
|
|
11109
11582
|
cancelled = true;
|
|
11110
11583
|
};
|
|
11111
11584
|
}, [visible, apiBaseUrl, coordinatorToken, remoteSession]);
|
|
11112
|
-
const _start = (0,
|
|
11585
|
+
const _start = (0, import_react25.useCallback)(
|
|
11113
11586
|
() => {
|
|
11114
11587
|
setStatus("starting");
|
|
11115
11588
|
void (async () => {
|
|
@@ -11165,7 +11638,7 @@ function AiRemoteControl({
|
|
|
11165
11638
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11166
11639
|
[apiBaseUrl, coordinatorToken, projectId, configuration, selectedPersona]
|
|
11167
11640
|
);
|
|
11168
|
-
(0,
|
|
11641
|
+
(0, import_react25.useEffect)(() => {
|
|
11169
11642
|
if (status !== "running") return;
|
|
11170
11643
|
const handler = (ev) => {
|
|
11171
11644
|
if ((0, import_ai_tester.isSyntheticEvent)(ev)) return;
|
|
@@ -11182,7 +11655,7 @@ function AiRemoteControl({
|
|
|
11182
11655
|
document.addEventListener("pointerdown", handler, true);
|
|
11183
11656
|
return () => document.removeEventListener("pointerdown", handler, true);
|
|
11184
11657
|
}, [status]);
|
|
11185
|
-
const _openSocket = (0,
|
|
11658
|
+
const _openSocket = (0, import_react25.useCallback)(
|
|
11186
11659
|
(wsUrl) => {
|
|
11187
11660
|
const ws = new WebSocket(wsUrl);
|
|
11188
11661
|
wsRef.current = ws;
|
|
@@ -11246,7 +11719,7 @@ function AiRemoteControl({
|
|
|
11246
11719
|
},
|
|
11247
11720
|
[]
|
|
11248
11721
|
);
|
|
11249
|
-
const _finishSession = (0,
|
|
11722
|
+
const _finishSession = (0, import_react25.useCallback)(
|
|
11250
11723
|
(s) => {
|
|
11251
11724
|
closedRef.current = true;
|
|
11252
11725
|
setStatus("ended");
|
|
@@ -11261,7 +11734,7 @@ function AiRemoteControl({
|
|
|
11261
11734
|
},
|
|
11262
11735
|
[onSessionEnded, sessionId]
|
|
11263
11736
|
);
|
|
11264
|
-
const onStopPress = (0,
|
|
11737
|
+
const onStopPress = (0, import_react25.useCallback)(() => {
|
|
11265
11738
|
const ws = wsRef.current;
|
|
11266
11739
|
if (ws && ws.readyState === 1) {
|
|
11267
11740
|
ws.send(JSON.stringify({ type: "goodbye", reason: "manual_stop" }));
|
|
@@ -11270,21 +11743,21 @@ function AiRemoteControl({
|
|
|
11270
11743
|
onClose();
|
|
11271
11744
|
}, [_finishSession, onClose]);
|
|
11272
11745
|
if (!visible) return null;
|
|
11273
|
-
return /* @__PURE__ */
|
|
11274
|
-
|
|
11746
|
+
return /* @__PURE__ */ import_react25.default.createElement(
|
|
11747
|
+
import_react_native25.Modal,
|
|
11275
11748
|
{
|
|
11276
11749
|
animationType: "fade",
|
|
11277
11750
|
onRequestClose: onClose,
|
|
11278
11751
|
transparent: true,
|
|
11279
11752
|
visible
|
|
11280
11753
|
},
|
|
11281
|
-
/* @__PURE__ */
|
|
11282
|
-
|
|
11754
|
+
/* @__PURE__ */ import_react25.default.createElement(
|
|
11755
|
+
import_react_native25.View,
|
|
11283
11756
|
{
|
|
11284
|
-
style: [
|
|
11757
|
+
style: [styles19.backdrop, style],
|
|
11285
11758
|
dataSet: { "tpk-ai-overlay": "true" }
|
|
11286
11759
|
},
|
|
11287
|
-
/* @__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 : [
|
|
11288
11761
|
{
|
|
11289
11762
|
slug: "junior_tester",
|
|
11290
11763
|
displayName: t.defaultPersonaName,
|
|
@@ -11292,58 +11765,58 @@ function AiRemoteControl({
|
|
|
11292
11765
|
}
|
|
11293
11766
|
]).map((p) => {
|
|
11294
11767
|
const sel = p.slug === selectedPersona;
|
|
11295
|
-
return /* @__PURE__ */
|
|
11296
|
-
|
|
11768
|
+
return /* @__PURE__ */ import_react25.default.createElement(
|
|
11769
|
+
import_react_native25.Pressable,
|
|
11297
11770
|
{
|
|
11298
11771
|
key: p.slug,
|
|
11299
11772
|
accessibilityRole: "button",
|
|
11300
11773
|
accessibilityState: { selected: sel },
|
|
11301
11774
|
onPress: () => setSelectedPersona(p.slug),
|
|
11302
11775
|
style: [
|
|
11303
|
-
|
|
11304
|
-
sel &&
|
|
11776
|
+
styles19.personaChip,
|
|
11777
|
+
sel && styles19.personaChipSelected
|
|
11305
11778
|
]
|
|
11306
11779
|
},
|
|
11307
|
-
/* @__PURE__ */
|
|
11308
|
-
|
|
11780
|
+
/* @__PURE__ */ import_react25.default.createElement(
|
|
11781
|
+
import_react_native25.Text,
|
|
11309
11782
|
{
|
|
11310
11783
|
style: [
|
|
11311
|
-
|
|
11312
|
-
sel &&
|
|
11784
|
+
styles19.personaChipText,
|
|
11785
|
+
sel && styles19.personaChipTextSelected
|
|
11313
11786
|
]
|
|
11314
11787
|
},
|
|
11315
11788
|
p.displayName
|
|
11316
11789
|
)
|
|
11317
11790
|
);
|
|
11318
|
-
})), personas.find((p) => p.slug === selectedPersona)?.description ? /* @__PURE__ */
|
|
11319
|
-
|
|
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,
|
|
11320
11793
|
{
|
|
11321
11794
|
accessibilityRole: "button",
|
|
11322
11795
|
onPress: onClose,
|
|
11323
|
-
style:
|
|
11796
|
+
style: styles19.cancelButton
|
|
11324
11797
|
},
|
|
11325
|
-
/* @__PURE__ */
|
|
11326
|
-
), /* @__PURE__ */
|
|
11327
|
-
|
|
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,
|
|
11328
11801
|
{
|
|
11329
11802
|
accessibilityRole: "button",
|
|
11330
11803
|
onPress: _start,
|
|
11331
|
-
style:
|
|
11804
|
+
style: styles19.startButton
|
|
11332
11805
|
},
|
|
11333
|
-
/* @__PURE__ */
|
|
11334
|
-
))) : /* @__PURE__ */
|
|
11335
|
-
|
|
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,
|
|
11336
11809
|
{
|
|
11337
11810
|
accessibilityRole: "button",
|
|
11338
11811
|
onPress: onStopPress,
|
|
11339
|
-
style:
|
|
11812
|
+
style: styles19.stopButton
|
|
11340
11813
|
},
|
|
11341
|
-
/* @__PURE__ */
|
|
11814
|
+
/* @__PURE__ */ import_react25.default.createElement(import_react_native25.Text, { style: styles19.stopText }, status === "ended" ? t.close : t.stop)
|
|
11342
11815
|
)))
|
|
11343
11816
|
)
|
|
11344
11817
|
);
|
|
11345
11818
|
}
|
|
11346
|
-
var
|
|
11819
|
+
var styles19 = import_react_native25.StyleSheet.create({
|
|
11347
11820
|
backdrop: {
|
|
11348
11821
|
flex: 1,
|
|
11349
11822
|
backgroundColor: "rgba(124, 58, 237, 0.18)",
|
|
@@ -11450,7 +11923,1003 @@ var styles18 = import_react_native24.StyleSheet.create({
|
|
|
11450
11923
|
}
|
|
11451
11924
|
});
|
|
11452
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
|
+
|
|
11453
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
|
+
}
|
|
11454
12923
|
var SHAKE_MIN_INTERVAL_MS = 1500;
|
|
11455
12924
|
function TesterPayKitWrapper({
|
|
11456
12925
|
children,
|
|
@@ -11471,46 +12940,63 @@ function TesterPayKitWrapper({
|
|
|
11471
12940
|
aiCoordinatorToken,
|
|
11472
12941
|
aiRemoteTrigger = false,
|
|
11473
12942
|
aiRemotePollSeconds = 15,
|
|
12943
|
+
enableLiveLink = false,
|
|
11474
12944
|
aiProjectId,
|
|
11475
12945
|
aiApiBaseUrl,
|
|
11476
12946
|
theme,
|
|
11477
12947
|
language,
|
|
11478
12948
|
testID = "tpk-wrapper"
|
|
11479
12949
|
}) {
|
|
11480
|
-
const rootRef = (0,
|
|
11481
|
-
const
|
|
11482
|
-
const
|
|
11483
|
-
const [
|
|
11484
|
-
const [
|
|
11485
|
-
const [
|
|
11486
|
-
const [
|
|
11487
|
-
const [
|
|
11488
|
-
const [
|
|
11489
|
-
const [
|
|
11490
|
-
const [
|
|
11491
|
-
const [
|
|
11492
|
-
const [
|
|
11493
|
-
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)(() => {
|
|
11494
12966
|
if (!tpk || retestCount !== void 0) return;
|
|
11495
12967
|
void tpk.ready.then(() => tpk.api.getMyRetests()).then((list) => setOpenRetests(list.length)).catch(() => void 0);
|
|
11496
12968
|
}, [tpk, retestCount]);
|
|
11497
|
-
(0,
|
|
12969
|
+
(0, import_react28.useEffect)(() => {
|
|
11498
12970
|
refreshRetests();
|
|
11499
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]);
|
|
11500
12986
|
const aiReady = Boolean(aiCoordinatorToken && aiProjectId && aiApiBaseUrl);
|
|
11501
12987
|
const onAutoTest = aiReady ? () => setAiOpen(true) : void 0;
|
|
11502
|
-
const [remoteSession, setRemoteSession] = (0,
|
|
12988
|
+
const [remoteSession, setRemoteSession] = (0, import_react28.useState)(
|
|
11503
12989
|
null
|
|
11504
12990
|
);
|
|
11505
|
-
const remoteSessionRef = (0,
|
|
11506
|
-
(0,
|
|
12991
|
+
const remoteSessionRef = (0, import_react28.useRef)(null);
|
|
12992
|
+
(0, import_react28.useEffect)(() => {
|
|
11507
12993
|
remoteSessionRef.current = remoteSession;
|
|
11508
12994
|
}, [remoteSession]);
|
|
11509
|
-
(0,
|
|
12995
|
+
(0, import_react28.useEffect)(() => {
|
|
11510
12996
|
if (!aiRemoteTrigger || !tpk || aiOpen) return;
|
|
11511
12997
|
let busy = false;
|
|
11512
12998
|
const poll = async () => {
|
|
11513
|
-
if (busy ||
|
|
12999
|
+
if (busy || import_react_native29.AppState.currentState !== "active") return;
|
|
11514
13000
|
busy = true;
|
|
11515
13001
|
try {
|
|
11516
13002
|
const claimed = await tpk.claimRemoteAiSession();
|
|
@@ -11527,7 +13013,7 @@ function TesterPayKitWrapper({
|
|
|
11527
13013
|
const timer = setInterval(poll, aiRemotePollSeconds * 1e3);
|
|
11528
13014
|
return () => clearInterval(timer);
|
|
11529
13015
|
}, [aiRemoteTrigger, aiRemotePollSeconds, tpk, aiOpen]);
|
|
11530
|
-
(0,
|
|
13016
|
+
(0, import_react28.useEffect)(() => {
|
|
11531
13017
|
if (!aiOpen) return;
|
|
11532
13018
|
const g = globalThis;
|
|
11533
13019
|
g.__tpkCaptureScreenshot = async () => (await captureView(rootRef))?.base64 ?? null;
|
|
@@ -11535,19 +13021,187 @@ function TesterPayKitWrapper({
|
|
|
11535
13021
|
delete g.__tpkCaptureScreenshot;
|
|
11536
13022
|
};
|
|
11537
13023
|
}, [aiOpen]);
|
|
11538
|
-
const
|
|
11539
|
-
(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)(() => {
|
|
11540
13194
|
if (sessionStartedAt) {
|
|
11541
13195
|
sessionAnchor.current = sessionStartedAt;
|
|
11542
13196
|
} else if (tpk && !sessionAnchor.current) {
|
|
11543
13197
|
sessionAnchor.current = /* @__PURE__ */ new Date();
|
|
11544
13198
|
}
|
|
11545
13199
|
}, [tpk, sessionStartedAt]);
|
|
11546
|
-
(0,
|
|
13200
|
+
(0, import_react28.useEffect)(() => {
|
|
11547
13201
|
if (!tpk || !currentScreen) return;
|
|
11548
13202
|
tpk.trackScreenView(currentScreen);
|
|
11549
13203
|
}, [tpk, currentScreen]);
|
|
11550
|
-
(0,
|
|
13204
|
+
(0, import_react28.useEffect)(() => {
|
|
11551
13205
|
if (!tpk) return;
|
|
11552
13206
|
let cancelled = false;
|
|
11553
13207
|
tpk.getNotifications({ limit: 1 }).then((res) => {
|
|
@@ -11557,9 +13211,9 @@ function TesterPayKitWrapper({
|
|
|
11557
13211
|
cancelled = true;
|
|
11558
13212
|
};
|
|
11559
13213
|
}, [tpk]);
|
|
11560
|
-
(0,
|
|
13214
|
+
(0, import_react28.useEffect)(() => {
|
|
11561
13215
|
if (!enableWrapper || !enableShake) return;
|
|
11562
|
-
if (
|
|
13216
|
+
if (import_react_native29.Platform.OS === "web") return;
|
|
11563
13217
|
let teardown = null;
|
|
11564
13218
|
let cancelled = false;
|
|
11565
13219
|
let lastShakeAt = 0;
|
|
@@ -11596,14 +13250,14 @@ function TesterPayKitWrapper({
|
|
|
11596
13250
|
voiceOpen,
|
|
11597
13251
|
sessionEndOpen
|
|
11598
13252
|
]);
|
|
11599
|
-
const onReportBug = (0,
|
|
11600
|
-
const onGeneralFeedback = (0,
|
|
11601
|
-
const onEndSession = (0,
|
|
11602
|
-
const onLongPressVoiceBug = (0,
|
|
11603
|
-
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)(() => {
|
|
11604
13258
|
tpk?.trackTap(currentScreen ?? "unknown", "auto-tap");
|
|
11605
13259
|
}, [tpk, currentScreen]);
|
|
11606
|
-
const handleVoiceExtracted = (0,
|
|
13260
|
+
const handleVoiceExtracted = (0, import_react28.useCallback)(
|
|
11607
13261
|
(result, classification) => {
|
|
11608
13262
|
setBugInitialDraft({
|
|
11609
13263
|
type: classification === "idea" ? "featureRequest" : classification === "issue" ? "uiIssue" : classification,
|
|
@@ -11625,18 +13279,27 @@ function TesterPayKitWrapper({
|
|
|
11625
13279
|
[]
|
|
11626
13280
|
);
|
|
11627
13281
|
if (!enableWrapper) {
|
|
11628
|
-
return /* @__PURE__ */
|
|
13282
|
+
return /* @__PURE__ */ import_react28.default.createElement(import_react28.default.Fragment, null, children);
|
|
11629
13283
|
}
|
|
11630
|
-
return /* @__PURE__ */
|
|
11631
|
-
|
|
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,
|
|
11632
13286
|
{
|
|
11633
13287
|
ref: rootRef,
|
|
11634
|
-
style: [
|
|
13288
|
+
style: [styles22.root, style],
|
|
11635
13289
|
testID,
|
|
11636
13290
|
collapsable: false
|
|
11637
13291
|
},
|
|
11638
|
-
/* @__PURE__ */
|
|
11639
|
-
|
|
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(
|
|
11640
13303
|
FloatingFeedbackButton,
|
|
11641
13304
|
{
|
|
11642
13305
|
position: buttonPosition,
|
|
@@ -11646,6 +13309,11 @@ function TesterPayKitWrapper({
|
|
|
11646
13309
|
onEndSession,
|
|
11647
13310
|
onShowDebugLogs,
|
|
11648
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",
|
|
11649
13317
|
onLongPressVoiceBug,
|
|
11650
13318
|
onFlushCachedCrashes,
|
|
11651
13319
|
onShowRetests: onShowRetests ?? (() => setRetestsOpen(true)),
|
|
@@ -11658,7 +13326,7 @@ function TesterPayKitWrapper({
|
|
|
11658
13326
|
sessionStartedAt: sessionAnchor.current ?? void 0
|
|
11659
13327
|
}
|
|
11660
13328
|
),
|
|
11661
|
-
(aiReady || remoteSession) && /* @__PURE__ */
|
|
13329
|
+
(aiReady || remoteSession) && /* @__PURE__ */ import_react28.default.createElement(
|
|
11662
13330
|
AiRemoteControl,
|
|
11663
13331
|
{
|
|
11664
13332
|
visible: aiOpen,
|
|
@@ -11679,7 +13347,30 @@ function TesterPayKitWrapper({
|
|
|
11679
13347
|
}
|
|
11680
13348
|
}
|
|
11681
13349
|
),
|
|
11682
|
-
/* @__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(
|
|
11683
13374
|
BugReportSheet,
|
|
11684
13375
|
{
|
|
11685
13376
|
visible: bugOpen,
|
|
@@ -11701,7 +13392,7 @@ function TesterPayKitWrapper({
|
|
|
11701
13392
|
}
|
|
11702
13393
|
}
|
|
11703
13394
|
),
|
|
11704
|
-
/* @__PURE__ */
|
|
13395
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11705
13396
|
GeneralFeedbackDialog,
|
|
11706
13397
|
{
|
|
11707
13398
|
visible: feedbackOpen,
|
|
@@ -11710,7 +13401,7 @@ function TesterPayKitWrapper({
|
|
|
11710
13401
|
onClose: () => setFeedbackOpen(false)
|
|
11711
13402
|
}
|
|
11712
13403
|
),
|
|
11713
|
-
/* @__PURE__ */
|
|
13404
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11714
13405
|
VoiceBugInputSheet,
|
|
11715
13406
|
{
|
|
11716
13407
|
visible: voiceOpen,
|
|
@@ -11721,7 +13412,7 @@ function TesterPayKitWrapper({
|
|
|
11721
13412
|
captureScreen: async () => (await captureView(rootRef))?.base64 ?? null
|
|
11722
13413
|
}
|
|
11723
13414
|
),
|
|
11724
|
-
/* @__PURE__ */
|
|
13415
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11725
13416
|
SessionEndDialog,
|
|
11726
13417
|
{
|
|
11727
13418
|
visible: sessionEndOpen,
|
|
@@ -11741,7 +13432,7 @@ function TesterPayKitWrapper({
|
|
|
11741
13432
|
}
|
|
11742
13433
|
}
|
|
11743
13434
|
),
|
|
11744
|
-
/* @__PURE__ */
|
|
13435
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11745
13436
|
MyBugsSheet,
|
|
11746
13437
|
{
|
|
11747
13438
|
visible: myBugsOpen,
|
|
@@ -11749,7 +13440,7 @@ function TesterPayKitWrapper({
|
|
|
11749
13440
|
onClose: () => setMyBugsOpen(false)
|
|
11750
13441
|
}
|
|
11751
13442
|
),
|
|
11752
|
-
/* @__PURE__ */
|
|
13443
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11753
13444
|
SessionDetailsSheet,
|
|
11754
13445
|
{
|
|
11755
13446
|
visible: sessionDetailsOpen,
|
|
@@ -11757,7 +13448,7 @@ function TesterPayKitWrapper({
|
|
|
11757
13448
|
onClose: () => setSessionDetailsOpen(false)
|
|
11758
13449
|
}
|
|
11759
13450
|
),
|
|
11760
|
-
/* @__PURE__ */
|
|
13451
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11761
13452
|
NotificationsSheet,
|
|
11762
13453
|
{
|
|
11763
13454
|
visible: messagesOpen,
|
|
@@ -11766,7 +13457,7 @@ function TesterPayKitWrapper({
|
|
|
11766
13457
|
onUnreadChange: setUnreadMessages
|
|
11767
13458
|
}
|
|
11768
13459
|
),
|
|
11769
|
-
/* @__PURE__ */
|
|
13460
|
+
/* @__PURE__ */ import_react28.default.createElement(
|
|
11770
13461
|
RetestSheet,
|
|
11771
13462
|
{
|
|
11772
13463
|
visible: retestsOpen,
|
|
@@ -11777,7 +13468,7 @@ function TesterPayKitWrapper({
|
|
|
11777
13468
|
)
|
|
11778
13469
|
)));
|
|
11779
13470
|
}
|
|
11780
|
-
var
|
|
13471
|
+
var styles22 = import_react_native29.StyleSheet.create({
|
|
11781
13472
|
root: {
|
|
11782
13473
|
flex: 1
|
|
11783
13474
|
},
|
|
@@ -11787,7 +13478,7 @@ var styles19 = import_react_native25.StyleSheet.create({
|
|
|
11787
13478
|
});
|
|
11788
13479
|
|
|
11789
13480
|
// src/TpkAnnotated.tsx
|
|
11790
|
-
var
|
|
13481
|
+
var import_react29 = require("react");
|
|
11791
13482
|
function TpkAnnotated({
|
|
11792
13483
|
task,
|
|
11793
13484
|
focusArea,
|
|
@@ -11800,16 +13491,16 @@ function TpkAnnotated({
|
|
|
11800
13491
|
metadata,
|
|
11801
13492
|
children
|
|
11802
13493
|
}) {
|
|
11803
|
-
const child =
|
|
11804
|
-
if (!(0,
|
|
13494
|
+
const child = import_react29.Children.only(children);
|
|
13495
|
+
if (!(0, import_react29.isValidElement)(child)) {
|
|
11805
13496
|
throw new Error("TpkAnnotated expects exactly one React element child.");
|
|
11806
13497
|
}
|
|
11807
|
-
const ref = (0,
|
|
11808
|
-
const annotationIdRef = (0,
|
|
13498
|
+
const ref = (0, import_react29.useRef)(null);
|
|
13499
|
+
const annotationIdRef = (0, import_react29.useRef)(null);
|
|
11809
13500
|
const childProps = child.props;
|
|
11810
13501
|
const resolvedKey = elementKey ?? childProps.testID;
|
|
11811
13502
|
const resolvedType = elementType ?? inferElementType(child);
|
|
11812
|
-
(0,
|
|
13503
|
+
(0, import_react29.useEffect)(() => {
|
|
11813
13504
|
const id = annotations.register({
|
|
11814
13505
|
taskId: task,
|
|
11815
13506
|
focusAreaId: focusArea,
|
|
@@ -11828,7 +13519,7 @@ function TpkAnnotated({
|
|
|
11828
13519
|
annotationIdRef.current = null;
|
|
11829
13520
|
};
|
|
11830
13521
|
}, [task, focusArea, resolvedKey]);
|
|
11831
|
-
(0,
|
|
13522
|
+
(0, import_react29.useEffect)(() => {
|
|
11832
13523
|
if (!annotationIdRef.current) return;
|
|
11833
13524
|
annotations.update(annotationIdRef.current, {
|
|
11834
13525
|
semanticLabels: labels,
|
|
@@ -11846,13 +13537,13 @@ function TpkAnnotated({
|
|
|
11846
13537
|
versionRange,
|
|
11847
13538
|
metadata
|
|
11848
13539
|
]);
|
|
11849
|
-
(0,
|
|
13540
|
+
(0, import_react29.useEffect)(() => {
|
|
11850
13541
|
if (completionTrigger !== "on-visible") return;
|
|
11851
13542
|
if (annotationIdRef.current) {
|
|
11852
13543
|
annotations.recordInteraction(annotationIdRef.current);
|
|
11853
13544
|
}
|
|
11854
13545
|
}, [completionTrigger]);
|
|
11855
|
-
const wrapHandler = (0,
|
|
13546
|
+
const wrapHandler = (0, import_react29.useCallback)(
|
|
11856
13547
|
(handler) => {
|
|
11857
13548
|
const wrapped = ((...args) => {
|
|
11858
13549
|
const id = annotationIdRef.current;
|
|
@@ -11863,7 +13554,7 @@ function TpkAnnotated({
|
|
|
11863
13554
|
},
|
|
11864
13555
|
[]
|
|
11865
13556
|
);
|
|
11866
|
-
const triggeredHandlerName = (0,
|
|
13557
|
+
const triggeredHandlerName = (0, import_react29.useMemo)(() => {
|
|
11867
13558
|
switch (completionTrigger) {
|
|
11868
13559
|
case "on-tap":
|
|
11869
13560
|
return "onPress";
|
|
@@ -11879,12 +13570,12 @@ function TpkAnnotated({
|
|
|
11879
13570
|
childProps[triggeredHandlerName]
|
|
11880
13571
|
);
|
|
11881
13572
|
}
|
|
11882
|
-
return (0,
|
|
13573
|
+
return (0, import_react29.cloneElement)(child, overrideProps);
|
|
11883
13574
|
}
|
|
11884
13575
|
function useTaskAnnotation(options) {
|
|
11885
|
-
const ref = (0,
|
|
11886
|
-
const idRef = (0,
|
|
11887
|
-
(0,
|
|
13576
|
+
const ref = (0, import_react29.useRef)(null);
|
|
13577
|
+
const idRef = (0, import_react29.useRef)(null);
|
|
13578
|
+
(0, import_react29.useEffect)(() => {
|
|
11888
13579
|
const id = annotations.register({
|
|
11889
13580
|
taskId: options.taskId,
|
|
11890
13581
|
focusAreaId: options.focusAreaId,
|
|
@@ -11903,7 +13594,7 @@ function useTaskAnnotation(options) {
|
|
|
11903
13594
|
idRef.current = null;
|
|
11904
13595
|
};
|
|
11905
13596
|
}, [options.taskId, options.focusAreaId, options.elementKey]);
|
|
11906
|
-
const recordInteraction = (0,
|
|
13597
|
+
const recordInteraction = (0, import_react29.useCallback)(() => {
|
|
11907
13598
|
if (idRef.current) annotations.recordInteraction(idRef.current);
|
|
11908
13599
|
}, []);
|
|
11909
13600
|
return { ref, id: idRef.current, recordInteraction };
|
|
@@ -12129,12 +13820,12 @@ function hasRecorder(recorder) {
|
|
|
12129
13820
|
}
|
|
12130
13821
|
|
|
12131
13822
|
// src/earnings.ts
|
|
12132
|
-
var
|
|
13823
|
+
var import_react30 = require("react");
|
|
12133
13824
|
function useTpkEarnings(tpk, options = {}) {
|
|
12134
|
-
const [data, setData] = (0,
|
|
12135
|
-
const [loading, setLoading] = (0,
|
|
12136
|
-
const [error, setError] = (0,
|
|
12137
|
-
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 () => {
|
|
12138
13829
|
if (!tpk) return;
|
|
12139
13830
|
setLoading(true);
|
|
12140
13831
|
setError(null);
|
|
@@ -12150,7 +13841,7 @@ function useTpkEarnings(tpk, options = {}) {
|
|
|
12150
13841
|
setLoading(false);
|
|
12151
13842
|
}
|
|
12152
13843
|
}, [tpk, options.payoutLimit]);
|
|
12153
|
-
(0,
|
|
13844
|
+
(0, import_react30.useEffect)(() => {
|
|
12154
13845
|
if (tpk) refresh();
|
|
12155
13846
|
}, [tpk, refresh]);
|
|
12156
13847
|
return { data, loading, error, refresh };
|
|
@@ -12161,14 +13852,17 @@ function useTpkEarnings(tpk, options = {}) {
|
|
|
12161
13852
|
AttachmentQueue,
|
|
12162
13853
|
Breadcrumbs,
|
|
12163
13854
|
BugReportSheet,
|
|
13855
|
+
ChecklistPanel,
|
|
12164
13856
|
CrashQueue,
|
|
12165
13857
|
DEFAULT_STYLE,
|
|
12166
13858
|
DEFAULT_TPK_THEME,
|
|
13859
|
+
DENY_LABEL_PATTERNS,
|
|
12167
13860
|
ExpoStorage,
|
|
12168
13861
|
FloatingFeedbackButton,
|
|
12169
13862
|
GeneralFeedbackDialog,
|
|
12170
13863
|
INTERACTION_NAV_WEIGHT,
|
|
12171
13864
|
InviteCodeScreen,
|
|
13865
|
+
LiveNoteDialog,
|
|
12172
13866
|
MIN_INTERACTIONS_PER_ACTIVE_MINUTE,
|
|
12173
13867
|
MyBugsSheet,
|
|
12174
13868
|
NotificationsSheet,
|
|
@@ -12191,6 +13885,7 @@ function useTpkEarnings(tpk, options = {}) {
|
|
|
12191
13885
|
TpkIcon,
|
|
12192
13886
|
TpkIconsProvider,
|
|
12193
13887
|
TpkLanguageProvider,
|
|
13888
|
+
TpkLiveLink,
|
|
12194
13889
|
TpkOnboarding,
|
|
12195
13890
|
TpkSensitive,
|
|
12196
13891
|
TpkTalker,
|
|
@@ -12209,6 +13904,7 @@ function useTpkEarnings(tpk, options = {}) {
|
|
|
12209
13904
|
bugSeverityLabel,
|
|
12210
13905
|
bugStatusStyle,
|
|
12211
13906
|
canSubmitBugReportDraft,
|
|
13907
|
+
captureLiveSnapshot,
|
|
12212
13908
|
captureView,
|
|
12213
13909
|
classificationToBugType,
|
|
12214
13910
|
createBugReportDraft,
|
|
@@ -12232,18 +13928,24 @@ function useTpkEarnings(tpk, options = {}) {
|
|
|
12232
13928
|
hasWelcomeBriefBeenSeen,
|
|
12233
13929
|
installCrashHandler,
|
|
12234
13930
|
installNetworkCapture,
|
|
13931
|
+
loadChecklist,
|
|
12235
13932
|
markOnboardingComplete,
|
|
12236
13933
|
markWelcomeBriefAsSeen,
|
|
12237
13934
|
markWidgetTourSeen,
|
|
13935
|
+
parseLiveAction,
|
|
12238
13936
|
parseVersionRange,
|
|
12239
13937
|
pathToSvgD,
|
|
12240
13938
|
quickDraftBug,
|
|
13939
|
+
readLiveState,
|
|
13940
|
+
readScreenTexts,
|
|
12241
13941
|
resetOnboardingState,
|
|
12242
13942
|
resetWelcomeBriefAck,
|
|
12243
13943
|
resetWidgetTourSeen,
|
|
13944
|
+
runLiveAction,
|
|
12244
13945
|
simplifyPath,
|
|
12245
13946
|
submitBugReportDraft,
|
|
12246
13947
|
subscribeNativeCaptureMode,
|
|
13948
|
+
toStepResults,
|
|
12247
13949
|
uploadScreenshotAttachment,
|
|
12248
13950
|
useShake,
|
|
12249
13951
|
useTaskAnnotation,
|