@appilots/sdk 0.13.0 → 0.14.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/dist/.build-meta.json +3 -3
- package/dist/{chunk-UYBKXULM.mjs → chunk-6JWU3NBT.mjs} +52 -24
- package/dist/{chunk-HRWBK35Y.mjs → chunk-AKAMWKO6.mjs} +61 -10
- package/dist/{chunk-ALJGKORS.js → chunk-GDCBLSYT.js} +8 -8
- package/dist/{chunk-AJDHZRBN.js → chunk-JGUDXRXN.js} +369 -340
- package/dist/{chunk-L3SY3Q4K.mjs → chunk-N66DUP54.mjs} +1 -1
- package/dist/{chunk-UZ2D4BVX.js → chunk-QAZ4TN3Z.js} +64 -9
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +11 -11
- package/dist/hooks/index.mjs +2 -2
- package/dist/{index-CI4jmSoP.d.mts → index-wMMetyrj.d.mts} +33 -0
- package/dist/{index-CI4jmSoP.d.ts → index-wMMetyrj.d.ts} +33 -0
- package/dist/index.d.mts +115 -62
- package/dist/index.d.ts +115 -62
- package/dist/index.js +504 -179
- package/dist/index.mjs +399 -78
- package/dist/navigation/index.js +13 -13
- package/dist/navigation/index.mjs +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQAZ4TN3Z_js = require('./chunk-QAZ4TN3Z.js');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var reactNative = require('react-native');
|
|
6
6
|
|
|
@@ -19,6 +19,7 @@ var ptBR = {
|
|
|
19
19
|
statusAnalyzing: "Analisando a tela...",
|
|
20
20
|
statusWaitingApp: "Aguardando o app responder...",
|
|
21
21
|
statusAdjusting: "Ajustando o plano...",
|
|
22
|
+
stillWorking: "Ainda trabalhando\u2026 {seconds} s",
|
|
22
23
|
poweredBy: "Powered by Appilots",
|
|
23
24
|
approve: "Aprovar",
|
|
24
25
|
reject: "Rejeitar",
|
|
@@ -30,6 +31,7 @@ var ptBR = {
|
|
|
30
31
|
confirmApprove: "Confirmar",
|
|
31
32
|
confirmCancel: "Cancelar",
|
|
32
33
|
confirmThisAction: "esta a\xE7\xE3o",
|
|
34
|
+
confirmExpired: "Esta confirma\xE7\xE3o expirou. Pe\xE7a de novo ao assistente para continuar.",
|
|
33
35
|
unknownAction: "A\xE7\xE3o desconhecida",
|
|
34
36
|
somethingWentWrong: "Algo deu errado",
|
|
35
37
|
openChatA11y: "Abrir chat do assistente",
|
|
@@ -52,6 +54,8 @@ var ptBR = {
|
|
|
52
54
|
missionCancel: "Cancelar tarefa",
|
|
53
55
|
missionPaused: "Pausada",
|
|
54
56
|
pillDone: "Pronto \u2014 toque para ver",
|
|
57
|
+
a11yAwaitingApproval: "O assistente precisa da sua confirma\xE7\xE3o para continuar.",
|
|
58
|
+
a11yTurnDone: "O assistente terminou.",
|
|
55
59
|
micStartA11y: "Segurar para falar",
|
|
56
60
|
micStopA11y: "Soltar para enviar",
|
|
57
61
|
micListening: "Ouvindo..."
|
|
@@ -68,6 +72,7 @@ var en = {
|
|
|
68
72
|
statusAnalyzing: "Reading the screen...",
|
|
69
73
|
statusWaitingApp: "Waiting for the app...",
|
|
70
74
|
statusAdjusting: "Adjusting the plan...",
|
|
75
|
+
stillWorking: "Still working\u2026 {seconds} s",
|
|
71
76
|
poweredBy: "Powered by Appilots",
|
|
72
77
|
approve: "Approve",
|
|
73
78
|
reject: "Reject",
|
|
@@ -79,6 +84,7 @@ var en = {
|
|
|
79
84
|
confirmApprove: "Confirm",
|
|
80
85
|
confirmCancel: "Cancel",
|
|
81
86
|
confirmThisAction: "this action",
|
|
87
|
+
confirmExpired: "This confirmation expired. Ask the assistant again to continue.",
|
|
82
88
|
unknownAction: "Unknown action",
|
|
83
89
|
somethingWentWrong: "Something went wrong",
|
|
84
90
|
openChatA11y: "Open assistant chat",
|
|
@@ -101,6 +107,8 @@ var en = {
|
|
|
101
107
|
missionCancel: "Cancel task",
|
|
102
108
|
missionPaused: "Paused",
|
|
103
109
|
pillDone: "Done \u2014 tap to read",
|
|
110
|
+
a11yAwaitingApproval: "The assistant needs your confirmation to continue.",
|
|
111
|
+
a11yTurnDone: "The assistant finished.",
|
|
104
112
|
micStartA11y: "Hold to talk",
|
|
105
113
|
micStopA11y: "Release to send",
|
|
106
114
|
micListening: "Listening..."
|
|
@@ -117,6 +125,7 @@ var es = {
|
|
|
117
125
|
statusAnalyzing: "Analizando la pantalla...",
|
|
118
126
|
statusWaitingApp: "Esperando a la app...",
|
|
119
127
|
statusAdjusting: "Ajustando el plan...",
|
|
128
|
+
stillWorking: "Sigo trabajando\u2026 {seconds} s",
|
|
120
129
|
poweredBy: "Hecho con Appilots",
|
|
121
130
|
approve: "Aprobar",
|
|
122
131
|
reject: "Rechazar",
|
|
@@ -128,6 +137,7 @@ var es = {
|
|
|
128
137
|
confirmApprove: "Confirmar",
|
|
129
138
|
confirmCancel: "Cancelar",
|
|
130
139
|
confirmThisAction: "esta acci\xF3n",
|
|
140
|
+
confirmExpired: "Esta confirmaci\xF3n expir\xF3. Pide de nuevo al asistente para continuar.",
|
|
131
141
|
unknownAction: "Acci\xF3n desconocida",
|
|
132
142
|
somethingWentWrong: "Algo sali\xF3 mal",
|
|
133
143
|
openChatA11y: "Abrir chat del asistente",
|
|
@@ -150,6 +160,8 @@ var es = {
|
|
|
150
160
|
missionCancel: "Cancelar tarea",
|
|
151
161
|
missionPaused: "Pausada",
|
|
152
162
|
pillDone: "Listo \u2014 toca para ver",
|
|
163
|
+
a11yAwaitingApproval: "El asistente necesita tu confirmaci\xF3n para continuar.",
|
|
164
|
+
a11yTurnDone: "El asistente termin\xF3.",
|
|
153
165
|
micStartA11y: "Mantener para hablar",
|
|
154
166
|
micStopA11y: "Soltar para enviar",
|
|
155
167
|
micListening: "Escuchando..."
|
|
@@ -166,6 +178,7 @@ var fr = {
|
|
|
166
178
|
statusAnalyzing: "Lecture de l\u2019\xE9cran\u2026",
|
|
167
179
|
statusWaitingApp: "En attente de l\u2019application\u2026",
|
|
168
180
|
statusAdjusting: "Ajustement du plan\u2026",
|
|
181
|
+
stillWorking: "Toujours en cours\u2026 {seconds} s",
|
|
169
182
|
poweredBy: "Propuls\xE9 par Appilots",
|
|
170
183
|
approve: "Approuver",
|
|
171
184
|
reject: "Refuser",
|
|
@@ -177,6 +190,7 @@ var fr = {
|
|
|
177
190
|
confirmApprove: "Confirmer",
|
|
178
191
|
confirmCancel: "Annuler",
|
|
179
192
|
confirmThisAction: "cette action",
|
|
193
|
+
confirmExpired: "Cette confirmation a expir\xE9. Redemandez \xE0 l\u2019assistant pour continuer.",
|
|
180
194
|
unknownAction: "Action inconnue",
|
|
181
195
|
somethingWentWrong: "Une erreur est survenue",
|
|
182
196
|
openChatA11y: "Ouvrir la conversation avec l\u2019assistant",
|
|
@@ -199,6 +213,8 @@ var fr = {
|
|
|
199
213
|
missionCancel: "Annuler la t\xE2che",
|
|
200
214
|
missionPaused: "En pause",
|
|
201
215
|
pillDone: "Termin\xE9 \u2014 touchez pour lire",
|
|
216
|
+
a11yAwaitingApproval: "L\u2019assistant a besoin de votre confirmation pour continuer.",
|
|
217
|
+
a11yTurnDone: "L\u2019assistant a termin\xE9.",
|
|
202
218
|
micStartA11y: "Maintenez pour parler",
|
|
203
219
|
micStopA11y: "Rel\xE2chez pour envoyer",
|
|
204
220
|
micListening: "\xC9coute en cours\u2026"
|
|
@@ -220,7 +236,7 @@ function detectDeviceLocale() {
|
|
|
220
236
|
const settings = manager?.getConstants?.()?.settings ?? manager?.settings;
|
|
221
237
|
const languages = Array.isArray(settings?.AppleLanguages) ? settings.AppleLanguages : [];
|
|
222
238
|
for (const language of languages) {
|
|
223
|
-
const locale =
|
|
239
|
+
const locale = chunkQAZ4TN3Z_js.normalizeAppilotsLocale(language);
|
|
224
240
|
if (locale) return locale;
|
|
225
241
|
}
|
|
226
242
|
raw = settings?.AppleLocale;
|
|
@@ -229,7 +245,7 @@ function detectDeviceLocale() {
|
|
|
229
245
|
raw = manager?.getConstants?.()?.localeIdentifier ?? manager?.localeIdentifier;
|
|
230
246
|
}
|
|
231
247
|
if (!raw || typeof raw !== "string") return null;
|
|
232
|
-
return
|
|
248
|
+
return chunkQAZ4TN3Z_js.normalizeAppilotsLocale(raw) ?? null;
|
|
233
249
|
} catch {
|
|
234
250
|
return null;
|
|
235
251
|
}
|
|
@@ -278,9 +294,9 @@ function fiberSliderMatches(fiber, registryId, registryLabel) {
|
|
|
278
294
|
function reconcileSliders(snapshot) {
|
|
279
295
|
const fiberSliders = snapshot.sliders;
|
|
280
296
|
const out = [];
|
|
281
|
-
for (const { id, kind } of
|
|
297
|
+
for (const { id, kind } of chunkQAZ4TN3Z_js.componentRegistry.snapshot()) {
|
|
282
298
|
if (kind !== "slider") continue;
|
|
283
|
-
const entry =
|
|
299
|
+
const entry = chunkQAZ4TN3Z_js.componentRegistry.getSlider(id);
|
|
284
300
|
if (!entry) continue;
|
|
285
301
|
const fiber = fiberSliders.find((s) => fiberSliderMatches(s, id, entry.label));
|
|
286
302
|
const visible = !!fiber || typeof entry.screen === "string" && entry.screen === snapshot.route;
|
|
@@ -308,7 +324,7 @@ function normalizeFieldKey(value) {
|
|
|
308
324
|
}
|
|
309
325
|
function canonicalizeRegisteredFields(snapshot) {
|
|
310
326
|
const claimed = /* @__PURE__ */ new Set();
|
|
311
|
-
for (const { id, kind, label } of
|
|
327
|
+
for (const { id, kind, label } of chunkQAZ4TN3Z_js.componentRegistry.snapshot()) {
|
|
312
328
|
if (kind !== "field") continue;
|
|
313
329
|
if (snapshot.inputs.some((input) => input.id === id)) continue;
|
|
314
330
|
const registryLabel = (label ?? "").toLowerCase();
|
|
@@ -327,7 +343,7 @@ function canonicalizeRegisteredFields(snapshot) {
|
|
|
327
343
|
}
|
|
328
344
|
}
|
|
329
345
|
function mergeRegisteredLists(snapshot) {
|
|
330
|
-
const registered =
|
|
346
|
+
const registered = chunkQAZ4TN3Z_js.listRegistry.snapshot();
|
|
331
347
|
if (registered.length === 0) return;
|
|
332
348
|
const byId = /* @__PURE__ */ new Map();
|
|
333
349
|
for (const list of snapshot.lists) {
|
|
@@ -356,7 +372,7 @@ function mergeRegisteredLists(snapshot) {
|
|
|
356
372
|
let measured = 0;
|
|
357
373
|
let inViewport = 0;
|
|
358
374
|
for (const item of existing.items) {
|
|
359
|
-
const rect =
|
|
375
|
+
const rect = chunkQAZ4TN3Z_js.rectForNode(item);
|
|
360
376
|
if (!rect) continue;
|
|
361
377
|
measured++;
|
|
362
378
|
item.onScreen = rect.width > 0 && rect.height > 0 && rect.x < viewport.x + viewport.width && rect.x + rect.width > viewport.x && rect.y < viewport.y + viewport.height && rect.y + rect.height > viewport.y;
|
|
@@ -392,7 +408,7 @@ function mergeRegisteredLists(snapshot) {
|
|
|
392
408
|
}
|
|
393
409
|
}
|
|
394
410
|
function mergeRegisteredScrollables(snapshot) {
|
|
395
|
-
const registered =
|
|
411
|
+
const registered = chunkQAZ4TN3Z_js.listRegistry.snapshot().filter((e) => e.kind === "scroll");
|
|
396
412
|
if (registered.length === 0) return;
|
|
397
413
|
const listsById = /* @__PURE__ */ new Map();
|
|
398
414
|
for (const list of snapshot.lists) {
|
|
@@ -425,7 +441,7 @@ function mergeRegisteredScrollables(snapshot) {
|
|
|
425
441
|
if (out.length > 0) snapshot.scrollables = out;
|
|
426
442
|
}
|
|
427
443
|
function mergeNativeDialog(snapshot) {
|
|
428
|
-
const dialog =
|
|
444
|
+
const dialog = chunkQAZ4TN3Z_js.getOpenNativeDialog();
|
|
429
445
|
if (!dialog) return;
|
|
430
446
|
snapshot.nativeDialog = {
|
|
431
447
|
id: dialog.id,
|
|
@@ -440,11 +456,11 @@ function mergeNativeDialog(snapshot) {
|
|
|
440
456
|
}
|
|
441
457
|
var MIN_FIBERS_FOR_BLINDNESS = 200;
|
|
442
458
|
function recordBlindWalk() {
|
|
443
|
-
const walk =
|
|
459
|
+
const walk = chunkQAZ4TN3Z_js.getLastWalkDiagnostics();
|
|
444
460
|
if (!walk) return;
|
|
445
461
|
if (walk.visitedFibers < MIN_FIBERS_FOR_BLINDNESS) return;
|
|
446
|
-
if (
|
|
447
|
-
|
|
462
|
+
if (chunkQAZ4TN3Z_js.totalDetectorHits(walk.detectors) > 0) return;
|
|
463
|
+
chunkQAZ4TN3Z_js.recordIntrospectionFailure("walk-recognized-nothing", null);
|
|
448
464
|
}
|
|
449
465
|
function mergeRegisteredFieldValues(snapshot) {
|
|
450
466
|
const present = new Set(snapshot.inputs.map((i) => normalizeFieldKey(i.id)));
|
|
@@ -455,16 +471,16 @@ function mergeRegisteredFieldValues(snapshot) {
|
|
|
455
471
|
const onScreenLabels = new Set(
|
|
456
472
|
[...snapshot.buttons.map((b) => b.label), ...snapshot.texts].filter((l) => !!l).map((l) => l.toLowerCase())
|
|
457
473
|
);
|
|
458
|
-
for (const { id, kind, screen, label } of
|
|
474
|
+
for (const { id, kind, screen, label } of chunkQAZ4TN3Z_js.componentRegistry.snapshot()) {
|
|
459
475
|
if (kind !== "field") continue;
|
|
460
476
|
const key = normalizeFieldKey(id);
|
|
461
477
|
if (!key || present.has(key)) continue;
|
|
462
|
-
const entry =
|
|
478
|
+
const entry = chunkQAZ4TN3Z_js.componentRegistry.getField(id);
|
|
463
479
|
if (!entry) continue;
|
|
464
480
|
const fieldType = entry.fieldType ?? "";
|
|
465
481
|
if (fieldType === "text" || fieldType === "") continue;
|
|
466
482
|
const declaresRoute = typeof screen === "string" && screen === snapshot.route;
|
|
467
|
-
if (screen && !declaresRoute && !
|
|
483
|
+
if (screen && !declaresRoute && !chunkQAZ4TN3Z_js.getActiveRouteNames().includes(screen)) continue;
|
|
468
484
|
const idEvidence = onScreenIds.some((candidate) => candidate.split(/[^a-z0-9]+/).includes(key));
|
|
469
485
|
const labelEvidence = !!entry.label && onScreenLabels.has(entry.label.toLowerCase());
|
|
470
486
|
if (!declaresRoute && !idEvidence && !labelEvidence) continue;
|
|
@@ -484,14 +500,14 @@ function mergeRegisteredFieldValues(snapshot) {
|
|
|
484
500
|
}
|
|
485
501
|
}
|
|
486
502
|
function captureSnapshot() {
|
|
487
|
-
const root =
|
|
503
|
+
const root = chunkQAZ4TN3Z_js.getFiberRoot();
|
|
488
504
|
if (!root) {
|
|
489
|
-
|
|
505
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn(
|
|
490
506
|
"captureSnapshot: fiber root not captured yet. Ensure <AppilotsProvider> has rendered before calling this."
|
|
491
507
|
);
|
|
492
|
-
|
|
508
|
+
chunkQAZ4TN3Z_js.recordIntrospectionFailure("never-mounted", null);
|
|
493
509
|
return {
|
|
494
|
-
route:
|
|
510
|
+
route: chunkQAZ4TN3Z_js.getCurrentScreen(),
|
|
495
511
|
texts: [],
|
|
496
512
|
inputs: [],
|
|
497
513
|
buttons: [],
|
|
@@ -505,9 +521,9 @@ function captureSnapshot() {
|
|
|
505
521
|
};
|
|
506
522
|
}
|
|
507
523
|
const start = Date.now();
|
|
508
|
-
const snapshot =
|
|
524
|
+
const snapshot = chunkQAZ4TN3Z_js.walkFiber(root);
|
|
509
525
|
recordBlindWalk();
|
|
510
|
-
const activePath =
|
|
526
|
+
const activePath = chunkQAZ4TN3Z_js.getActiveRouteNames();
|
|
511
527
|
const deepestRoute = activePath[activePath.length - 1];
|
|
512
528
|
if (deepestRoute) snapshot.route = deepestRoute;
|
|
513
529
|
mergeRegisteredLists(snapshot);
|
|
@@ -516,15 +532,15 @@ function captureSnapshot() {
|
|
|
516
532
|
reconcileSliders(snapshot);
|
|
517
533
|
canonicalizeRegisteredFields(snapshot);
|
|
518
534
|
mergeRegisteredFieldValues(snapshot);
|
|
519
|
-
|
|
520
|
-
const entries =
|
|
535
|
+
chunkQAZ4TN3Z_js.clampSnapshotToWireLimits(snapshot);
|
|
536
|
+
const entries = chunkQAZ4TN3Z_js.deriveInteractionElements(snapshot, { rectOf: chunkQAZ4TN3Z_js.rectForNode });
|
|
521
537
|
const rectById = new Map(
|
|
522
538
|
entries.flatMap((entry) => entry.rect ? [[entry.id, entry.rect]] : [])
|
|
523
539
|
);
|
|
524
|
-
snapshot.elements = entries.map(
|
|
525
|
-
snapshot.choiceGroups =
|
|
526
|
-
|
|
527
|
-
|
|
540
|
+
snapshot.elements = entries.map(chunkQAZ4TN3Z_js.toWireElement);
|
|
541
|
+
snapshot.choiceGroups = chunkQAZ4TN3Z_js.attachElementIdsToChoiceGroups(snapshot.choiceGroups, snapshot.elements);
|
|
542
|
+
chunkQAZ4TN3Z_js.clampSnapshotToWireLimits(snapshot);
|
|
543
|
+
chunkQAZ4TN3Z_js.elementRegistry.replaceAll(
|
|
528
544
|
snapshot.elements.map((element) => {
|
|
529
545
|
const rect = rectById.get(element.id);
|
|
530
546
|
return rect ? { ...element, rect } : element;
|
|
@@ -536,10 +552,10 @@ function captureSnapshot() {
|
|
|
536
552
|
(acc, l) => acc + (typeof l.itemCount === "number" ? l.itemCount : 0),
|
|
537
553
|
0
|
|
538
554
|
);
|
|
539
|
-
|
|
555
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
540
556
|
`captureSnapshot: route="${snapshot.route}" texts=${snapshot.texts.length} inputs=${snapshot.inputs.length} buttons=${snapshot.buttons.length} toggles=${snapshot.toggles.length} sliders=${snapshot.sliders.length} loading=${snapshot.loading} modal=${snapshot.modalOpen} lists=${snapshot.lists.length}(visibleItems=${totalListItems}, dataItems=${totalListDataItems}) choices=${snapshot.choiceGroups.length} elements=${snapshot.elements.length} ` + (snapshot.truncated ? "truncated=true " : "") + `(walked ${snapshot.stats?.visitedFibers ?? 0} fibers, skipped ${snapshot.stats?.skippedHidden ?? 0} hidden, ${elapsed}ms)`
|
|
541
557
|
);
|
|
542
|
-
|
|
558
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
543
559
|
`captureSnapshot detail: lists=[${snapshot.lists.map((l) => `${l.containerType}:${l.id ?? l.label ?? "?"}(rows=${l.items.length})`).join(", ")}] inputs=[${snapshot.inputs.map((i) => i.id ?? i.label ?? "?").slice(0, 12).join(", ")}] buttons=[${snapshot.buttons.map((b) => b.id ?? b.label ?? "?").slice(0, 15).join(", ")}]`
|
|
544
560
|
);
|
|
545
561
|
return snapshot;
|
|
@@ -550,10 +566,10 @@ function registryCounts() {
|
|
|
550
566
|
toggles: 0,
|
|
551
567
|
sliders: 0,
|
|
552
568
|
targets: 0,
|
|
553
|
-
lists:
|
|
554
|
-
elements:
|
|
569
|
+
lists: chunkQAZ4TN3Z_js.listRegistry.snapshot().length,
|
|
570
|
+
elements: chunkQAZ4TN3Z_js.elementRegistry.size
|
|
555
571
|
};
|
|
556
|
-
for (const { kind } of
|
|
572
|
+
for (const { kind } of chunkQAZ4TN3Z_js.componentRegistry.snapshot()) {
|
|
557
573
|
if (kind === "field") counts.fields++;
|
|
558
574
|
else if (kind === "toggle") counts.toggles++;
|
|
559
575
|
else if (kind === "slider") counts.sliders++;
|
|
@@ -562,26 +578,26 @@ function registryCounts() {
|
|
|
562
578
|
return counts;
|
|
563
579
|
}
|
|
564
580
|
function appilotsSelfCheck() {
|
|
565
|
-
const root =
|
|
581
|
+
const root = chunkQAZ4TN3Z_js.getFiberRoot();
|
|
566
582
|
const start = Date.now();
|
|
567
|
-
if (root)
|
|
583
|
+
if (root) chunkQAZ4TN3Z_js.walkFiber(root);
|
|
568
584
|
const elapsedMs = Date.now() - start;
|
|
569
|
-
const walk =
|
|
585
|
+
const walk = chunkQAZ4TN3Z_js.getLastWalkDiagnostics();
|
|
570
586
|
return {
|
|
571
|
-
sdkVersion:
|
|
587
|
+
sdkVersion: chunkQAZ4TN3Z_js.SDK_VERSION,
|
|
572
588
|
reactVersion: React__default.default.version ?? null,
|
|
573
|
-
route:
|
|
574
|
-
introspection:
|
|
575
|
-
autoTracking:
|
|
589
|
+
route: chunkQAZ4TN3Z_js.getCurrentScreen() || null,
|
|
590
|
+
introspection: chunkQAZ4TN3Z_js.getIntrospectionDiagnostics(),
|
|
591
|
+
autoTracking: chunkQAZ4TN3Z_js.getAutoTrackingState(),
|
|
576
592
|
walk: {
|
|
577
593
|
visitedFibers: root ? walk?.visitedFibers ?? 0 : 0,
|
|
578
594
|
skippedHidden: root ? walk?.skippedHidden ?? 0 : 0,
|
|
579
595
|
elapsedMs
|
|
580
596
|
},
|
|
581
|
-
detectors: root ? walk?.detectors ??
|
|
597
|
+
detectors: root ? walk?.detectors ?? chunkQAZ4TN3Z_js.emptyDetectorCounts() : chunkQAZ4TN3Z_js.emptyDetectorCounts(),
|
|
582
598
|
registry: registryCounts(),
|
|
583
|
-
nameMangling:
|
|
584
|
-
geometry: { availability:
|
|
599
|
+
nameMangling: chunkQAZ4TN3Z_js.getNameManglingProbe(),
|
|
600
|
+
geometry: { availability: chunkQAZ4TN3Z_js.geometryAvailability(), ...chunkQAZ4TN3Z_js.geometryStats() }
|
|
585
601
|
};
|
|
586
602
|
}
|
|
587
603
|
|
|
@@ -594,7 +610,7 @@ function declaredState(props) {
|
|
|
594
610
|
return typeof checked === "boolean" ? checked : void 0;
|
|
595
611
|
}
|
|
596
612
|
function isReactNativeSwitch(fiber) {
|
|
597
|
-
return
|
|
613
|
+
return chunkQAZ4TN3Z_js.getTypeName(fiber?.type) === "Switch" || chunkQAZ4TN3Z_js.getTypeName(fiber?.elementType) === "Switch";
|
|
598
614
|
}
|
|
599
615
|
var SWITCH_FLIP_HANDLERS = ["onValueChange", "onChange", "onPress"];
|
|
600
616
|
function flipSwitchFiber(fiber, next) {
|
|
@@ -697,7 +713,7 @@ function shouldSkipSubtree2(fiber) {
|
|
|
697
713
|
const typeName = getTypeName2(fiber.type) ?? getTypeName2(fiber.elementType);
|
|
698
714
|
if (typeName && SELF_REFERENTIAL_COMPONENTS.has(typeName)) return true;
|
|
699
715
|
if (isAppilotsSkipMarked(props)) return true;
|
|
700
|
-
if (
|
|
716
|
+
if (chunkQAZ4TN3Z_js.isModalFiber(fiber) && props.visible === false) return true;
|
|
701
717
|
if (matchesName(fiber, "Screen") && props.activityState === 0) return true;
|
|
702
718
|
const style = props.style;
|
|
703
719
|
if (style) {
|
|
@@ -707,11 +723,14 @@ function shouldSkipSubtree2(fiber) {
|
|
|
707
723
|
}
|
|
708
724
|
return false;
|
|
709
725
|
}
|
|
710
|
-
|
|
726
|
+
function isSecureInput(props) {
|
|
727
|
+
return !!props.secureTextEntry || chunkQAZ4TN3Z_js.isAppilotsSensitiveMarked(props);
|
|
728
|
+
}
|
|
729
|
+
var normalize = chunkQAZ4TN3Z_js.foldForCompare;
|
|
711
730
|
function scoreMatchDetail(fiber, queryNorm, queryRaw) {
|
|
712
731
|
const props = fiber.memoizedProps ?? {};
|
|
713
|
-
if (
|
|
714
|
-
const matches =
|
|
732
|
+
if (chunkQAZ4TN3Z_js.isSourceControlId(queryRaw)) {
|
|
733
|
+
const matches = chunkQAZ4TN3Z_js.sourceControlId(fiber) === queryRaw;
|
|
715
734
|
const disabled = props.disabled === true || props.accessibilityState?.disabled === true;
|
|
716
735
|
return { score: matches ? disabled ? 60 : 120 : 0, named: matches, disabled };
|
|
717
736
|
}
|
|
@@ -728,14 +747,20 @@ function scoreMatchDetail(fiber, queryNorm, queryRaw) {
|
|
|
728
747
|
if (childText) candidates.push({ val: childText, weight: 80 });
|
|
729
748
|
}
|
|
730
749
|
let best = 0;
|
|
750
|
+
let exact = false;
|
|
731
751
|
for (const { val, weight } of candidates) {
|
|
732
752
|
const vNorm = normalize(val);
|
|
733
753
|
if (!vNorm) continue;
|
|
734
|
-
if (val === queryRaw)
|
|
735
|
-
|
|
736
|
-
|
|
754
|
+
if (val === queryRaw) {
|
|
755
|
+
best = Math.max(best, weight + 20);
|
|
756
|
+
exact = true;
|
|
757
|
+
} else if (vNorm === queryNorm) {
|
|
758
|
+
best = Math.max(best, weight + 10);
|
|
759
|
+
exact = true;
|
|
760
|
+
} else if (!isPositionalControlId(queryRaw) && queryNorm && (vNorm.includes(queryNorm) || queryNorm.includes(vNorm)))
|
|
737
761
|
best = Math.max(best, weight - 20);
|
|
738
762
|
}
|
|
763
|
+
if (!exact && isSecureInput(props)) best = 0;
|
|
739
764
|
const named = best >= IDENTITY_MATCH_SCORE;
|
|
740
765
|
const disabledProp = props.disabled === true || props.editable === false || props.readOnly === true;
|
|
741
766
|
const disabledA11y = typeof props.accessibilityState === "object" && props.accessibilityState !== null && props.accessibilityState.disabled === true;
|
|
@@ -758,7 +783,7 @@ function wrapTextInput(fiber) {
|
|
|
758
783
|
controlIdentity: identity,
|
|
759
784
|
label: getProps().accessibilityLabel ?? getProps().label ?? getProps().placeholder ?? getProps().testID,
|
|
760
785
|
getValue: () => getProps().value,
|
|
761
|
-
finishEditing: () =>
|
|
786
|
+
finishEditing: () => chunkQAZ4TN3Z_js.endTextInputEditing(getProps()),
|
|
762
787
|
setValue: (value) => {
|
|
763
788
|
const { onChangeText, onChange } = getProps();
|
|
764
789
|
if (typeof onChangeText === "function") {
|
|
@@ -793,7 +818,7 @@ function wrapSwitch(fiber) {
|
|
|
793
818
|
// `accessibilityRole="switch"`) has only the former, and reporting
|
|
794
819
|
// `false` for a control that is on is worse than reporting nothing:
|
|
795
820
|
// the caller inverts this to decide where to move.
|
|
796
|
-
getValue: () =>
|
|
821
|
+
getValue: () => chunkQAZ4TN3Z_js.switchValue(getProps()),
|
|
797
822
|
setValue: (value) => {
|
|
798
823
|
const boolVal = typeof value === "boolean" ? value : value === "true" || value === true;
|
|
799
824
|
const flipped = flipSwitchFiber(fiber, boolVal);
|
|
@@ -848,9 +873,9 @@ function isDescendantOf(fiber, ancestor, parents) {
|
|
|
848
873
|
return false;
|
|
849
874
|
}
|
|
850
875
|
function findInteractiveByIdentifier(query, options = {}) {
|
|
851
|
-
const root =
|
|
876
|
+
const root = chunkQAZ4TN3Z_js.getFiberRoot();
|
|
852
877
|
if (!root) {
|
|
853
|
-
|
|
878
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn("findInteractiveByIdentifier: fiber root not captured yet");
|
|
854
879
|
return null;
|
|
855
880
|
}
|
|
856
881
|
const queryNorm = normalize(query);
|
|
@@ -876,7 +901,7 @@ function findInteractiveByIdentifier(query, options = {}) {
|
|
|
876
901
|
const props = fiber.memoizedProps ?? {};
|
|
877
902
|
let kind = null;
|
|
878
903
|
if (matchesName(fiber, "TextInput")) kind = "field";
|
|
879
|
-
else if (
|
|
904
|
+
else if (chunkQAZ4TN3Z_js.isSwitchLike(fiber, props)) kind = "toggle";
|
|
880
905
|
else if (isPressableTarget(fiber)) kind = "target";
|
|
881
906
|
if (kind && (!options.kind || options.kind === kind)) {
|
|
882
907
|
const detail = scoreMatchDetail(fiber, queryNorm, queryRaw);
|
|
@@ -894,8 +919,8 @@ function findInteractiveByIdentifier(query, options = {}) {
|
|
|
894
919
|
bestId = describeCandidate(fiber, kind);
|
|
895
920
|
if (kind === "field") bestHandle = wrapTextInput(fiber);
|
|
896
921
|
else if (kind === "toggle") bestHandle = wrapSwitch(fiber);
|
|
897
|
-
else if (
|
|
898
|
-
const bound =
|
|
922
|
+
else if (chunkQAZ4TN3Z_js.isSourceControlId(queryRaw)) {
|
|
923
|
+
const bound = chunkQAZ4TN3Z_js.sourceControlTarget(fiber);
|
|
899
924
|
if (!bound || bound.disabled) bestHandle = null;
|
|
900
925
|
else bestHandle = wrapTouchable(bound.fiber, findChildText(fiber));
|
|
901
926
|
} else bestHandle = wrapTouchable(fiber, findChildText(fiber));
|
|
@@ -905,7 +930,7 @@ function findInteractiveByIdentifier(query, options = {}) {
|
|
|
905
930
|
if (fiber.child) stack.push({ fiber: fiber.child, parent: fiber });
|
|
906
931
|
}
|
|
907
932
|
if (bestHandle && bestScore < (options.minScore ?? 0)) {
|
|
908
|
-
|
|
933
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
909
934
|
`findInteractiveByIdentifier: query="${query}" \u2192 best match scored ${bestScore}, below the requested floor of ${options.minScore} \u2014 refusing it`
|
|
910
935
|
);
|
|
911
936
|
return null;
|
|
@@ -920,20 +945,21 @@ function findInteractiveByIdentifier(query, options = {}) {
|
|
|
920
945
|
bestHandle.named = bestNamed;
|
|
921
946
|
bestHandle.disabled = bestDisabled;
|
|
922
947
|
const measured = bestFiber;
|
|
923
|
-
bestHandle.measure = () =>
|
|
948
|
+
bestHandle.measure = () => chunkQAZ4TN3Z_js.rectOfFiber(measured);
|
|
924
949
|
const candidates = independent.map(({ fiber, kind }) => describeCandidate(fiber, kind)).filter((id) => typeof id === "string" && id.length > 0).slice(0, 8);
|
|
925
950
|
if (candidates.length > 0) bestHandle.matchCandidates = candidates;
|
|
926
|
-
|
|
951
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
927
952
|
`findInteractiveByIdentifier: query="${query}" \u2192 kind=${bestHandle.kind} label="${bestHandle.label ?? bestId}" score=${bestScore} named=${bestNamed} disabled=${bestDisabled} tied=${independent.length}`
|
|
928
953
|
);
|
|
929
954
|
} else {
|
|
930
|
-
|
|
955
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(`findInteractiveByIdentifier: query="${query}" \u2192 no match`);
|
|
931
956
|
}
|
|
932
957
|
return bestHandle;
|
|
933
958
|
}
|
|
934
959
|
|
|
935
960
|
// src/introspection/spotlightTarget.ts
|
|
936
961
|
var listeners = /* @__PURE__ */ new Set();
|
|
962
|
+
var announcementListeners = /* @__PURE__ */ new Set();
|
|
937
963
|
var current = null;
|
|
938
964
|
var seq = 0;
|
|
939
965
|
var expiry = null;
|
|
@@ -948,13 +974,14 @@ function getSpotlightMode() {
|
|
|
948
974
|
function emit() {
|
|
949
975
|
for (const listener of listeners) listener(current);
|
|
950
976
|
}
|
|
951
|
-
function setSpotlightTarget(rect, label) {
|
|
977
|
+
function setSpotlightTarget(rect, label, verb) {
|
|
978
|
+
if (label && verb) for (const listener of announcementListeners) listener(label, verb);
|
|
952
979
|
if (expiry) {
|
|
953
980
|
clearTimeout(expiry);
|
|
954
981
|
expiry = null;
|
|
955
982
|
}
|
|
956
983
|
if (!rect) {
|
|
957
|
-
|
|
984
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
958
985
|
`setSpotlightTarget: cleared${label ? ` (was about to mark "${label}")` : ""}`
|
|
959
986
|
);
|
|
960
987
|
if (current === null) return;
|
|
@@ -963,7 +990,7 @@ function setSpotlightTarget(rect, label) {
|
|
|
963
990
|
return;
|
|
964
991
|
}
|
|
965
992
|
current = { rect, label, seq: ++seq };
|
|
966
|
-
|
|
993
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
967
994
|
`setSpotlightTarget: seq=${current.seq} label="${label ?? ""}" rect=${Math.round(rect.x)},${Math.round(rect.y)} ${Math.round(rect.width)}x${Math.round(rect.height)}`
|
|
968
995
|
);
|
|
969
996
|
emit();
|
|
@@ -982,6 +1009,12 @@ function subscribeSpotlight(listener) {
|
|
|
982
1009
|
listeners.delete(listener);
|
|
983
1010
|
};
|
|
984
1011
|
}
|
|
1012
|
+
function subscribeSpotlightAnnouncement(listener) {
|
|
1013
|
+
announcementListeners.add(listener);
|
|
1014
|
+
return () => {
|
|
1015
|
+
announcementListeners.delete(listener);
|
|
1016
|
+
};
|
|
1017
|
+
}
|
|
985
1018
|
|
|
986
1019
|
// src/introspection/scrollIntoView.ts
|
|
987
1020
|
var REVEAL_MARGIN = 24;
|
|
@@ -1011,9 +1044,9 @@ function clamp(value, min, max) {
|
|
|
1011
1044
|
|
|
1012
1045
|
// src/introspection/revealTarget.ts
|
|
1013
1046
|
function revealTarget(rect) {
|
|
1014
|
-
const host =
|
|
1047
|
+
const host = chunkQAZ4TN3Z_js.getGeometryHost();
|
|
1015
1048
|
if (!host) return { rect, scrolled: false };
|
|
1016
|
-
if (
|
|
1049
|
+
if (chunkQAZ4TN3Z_js.isRectOnScreen(rect, host.window)) return { rect, scrolled: false };
|
|
1017
1050
|
const scrollable = resolveScrollable();
|
|
1018
1051
|
if (!scrollable) return { rect, scrolled: false };
|
|
1019
1052
|
const metrics = scrollable.getScrollMetrics?.();
|
|
@@ -1024,21 +1057,21 @@ function revealTarget(rect) {
|
|
|
1024
1057
|
if (target === null) return { rect, scrolled: false };
|
|
1025
1058
|
const moved = scrollable.scrollToOffset?.(target) ?? false;
|
|
1026
1059
|
if (!moved) {
|
|
1027
|
-
|
|
1060
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(`revealTarget: "${scrollable.id}" refused scrollToOffset(${target})`);
|
|
1028
1061
|
return { rect, scrolled: false };
|
|
1029
1062
|
}
|
|
1030
1063
|
const delta = target - metrics.offset;
|
|
1031
|
-
|
|
1064
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
1032
1065
|
`revealTarget: scrolled "${scrollable.id}" by ${Math.round(delta)}px (${Math.round(metrics.offset)} \u2192 ${Math.round(target)})`
|
|
1033
1066
|
);
|
|
1034
1067
|
return { rect: { ...rect, y: rect.y - delta }, scrolled: true };
|
|
1035
1068
|
}
|
|
1036
1069
|
function resolveScrollable() {
|
|
1037
|
-
const screen =
|
|
1038
|
-
const candidates =
|
|
1070
|
+
const screen = chunkQAZ4TN3Z_js.getCurrentScreen();
|
|
1071
|
+
const candidates = chunkQAZ4TN3Z_js.listRegistry.snapshot().filter((entry) => entry.scrollToOffset && entry.getScrollMetrics).filter((entry) => !screen || !entry.screen || entry.screen === screen);
|
|
1039
1072
|
if (candidates.length === 1) return candidates[0];
|
|
1040
1073
|
if (candidates.length > 1) {
|
|
1041
|
-
|
|
1074
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
1042
1075
|
`revealTarget: ${candidates.length} scrollables on "${screen ?? "?"}" \u2014 cannot tell which holds the target, so not scrolling.`
|
|
1043
1076
|
);
|
|
1044
1077
|
}
|
|
@@ -1100,7 +1133,7 @@ function safeNavigate(nav, screenName, params, path) {
|
|
|
1100
1133
|
);
|
|
1101
1134
|
}
|
|
1102
1135
|
const { root, nestedParams } = buildNestedParams(path, screenName, params);
|
|
1103
|
-
|
|
1136
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
1104
1137
|
`safeNavigate: using path-based navigation \u2014 root="${root}", nested=${JSON.stringify(nestedParams)}`
|
|
1105
1138
|
);
|
|
1106
1139
|
nav.navigate(root, nestedParams);
|
|
@@ -1115,23 +1148,23 @@ function safeNavigate(nav, screenName, params, path) {
|
|
|
1115
1148
|
`Screen "${screenName}" is not registered in any navigator. The screen may have been removed, may live inside a flow that is not currently mounted (e.g. Auth stack after login), or the MCP doc is stale.`
|
|
1116
1149
|
);
|
|
1117
1150
|
}
|
|
1118
|
-
|
|
1151
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
1119
1152
|
`safeNavigate: screen exists in nested navigator, attempting direct navigation to "${screenName}"`
|
|
1120
1153
|
);
|
|
1121
1154
|
nav.navigate(screenName, params);
|
|
1122
1155
|
}
|
|
1123
1156
|
function navigateHandler(payload, context) {
|
|
1124
|
-
|
|
1157
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
1125
1158
|
// Params carry record ids and, on some screens, the user's own
|
|
1126
1159
|
// data — the count answers "were params passed?" and nothing else.
|
|
1127
|
-
`navigateHandler called: screenName="${payload.screenName}" action="${payload.navigationAction}" params=${
|
|
1160
|
+
`navigateHandler called: screenName="${payload.screenName}" action="${payload.navigationAction}" params=${chunkQAZ4TN3Z_js.describeValue(payload.params)}`
|
|
1128
1161
|
);
|
|
1129
1162
|
const { navigationRef, permissions } = context;
|
|
1130
1163
|
const nav = navigationRef.current;
|
|
1131
1164
|
if (!permissions.canNavigate) {
|
|
1132
1165
|
return {
|
|
1133
1166
|
success: false,
|
|
1134
|
-
error:
|
|
1167
|
+
error: chunkQAZ4TN3Z_js.permissionDeniedMessage("Navigation", "canNavigate"),
|
|
1135
1168
|
diagnose: { category: "unknown", screen: payload.screenName, recoverable: false }
|
|
1136
1169
|
};
|
|
1137
1170
|
}
|
|
@@ -1217,12 +1250,12 @@ function navigateHandler(payload, context) {
|
|
|
1217
1250
|
diagnose: { category: "unknown", screen: payload.screenName }
|
|
1218
1251
|
};
|
|
1219
1252
|
}
|
|
1220
|
-
|
|
1253
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
1221
1254
|
`navigateHandler: navigation succeeded for "${payload.screenName}" (action="${payload.navigationAction}")`
|
|
1222
1255
|
);
|
|
1223
1256
|
return { success: true };
|
|
1224
1257
|
} catch (err) {
|
|
1225
|
-
|
|
1258
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn(
|
|
1226
1259
|
`navigateHandler: navigation failed for "${payload.screenName}": ${err?.message}`
|
|
1227
1260
|
);
|
|
1228
1261
|
const msg = String(err?.message ?? "Navigation failed");
|
|
@@ -1270,18 +1303,18 @@ function markedItemIndexFromFiber(fiber) {
|
|
|
1270
1303
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
1271
1304
|
}
|
|
1272
1305
|
function normalize2(value) {
|
|
1273
|
-
return
|
|
1306
|
+
return chunkQAZ4TN3Z_js.foldForCompare(String(value ?? ""));
|
|
1274
1307
|
}
|
|
1275
1308
|
function hasPressHandler2(fiber) {
|
|
1276
1309
|
const props = fiber?.memoizedProps ?? {};
|
|
1277
1310
|
return typeof props.onPress === "function" || typeof props.onPressIn === "function";
|
|
1278
1311
|
}
|
|
1279
1312
|
function isPressableFiber(fiber) {
|
|
1280
|
-
const typeName =
|
|
1281
|
-
return
|
|
1313
|
+
const typeName = chunkQAZ4TN3Z_js.getTypeName(fiber.type) ?? chunkQAZ4TN3Z_js.getTypeName(fiber.elementType) ?? "";
|
|
1314
|
+
return chunkQAZ4TN3Z_js.TOUCHABLE_NAMES.has(typeName) || hasPressHandler2(fiber);
|
|
1282
1315
|
}
|
|
1283
1316
|
function findListContainers(options = {}) {
|
|
1284
|
-
const root =
|
|
1317
|
+
const root = chunkQAZ4TN3Z_js.getFiberRoot();
|
|
1285
1318
|
if (!root) return [];
|
|
1286
1319
|
const containers = [];
|
|
1287
1320
|
const visited = /* @__PURE__ */ new WeakSet();
|
|
@@ -1292,17 +1325,17 @@ function findListContainers(options = {}) {
|
|
|
1292
1325
|
if (!fiber || visited.has(fiber)) continue;
|
|
1293
1326
|
visited.add(fiber);
|
|
1294
1327
|
if (fiber.sibling) stack.push(fiber.sibling);
|
|
1295
|
-
if (
|
|
1296
|
-
if (
|
|
1297
|
-
const minItems =
|
|
1298
|
-
const items =
|
|
1328
|
+
if (chunkQAZ4TN3Z_js.shouldSkipSubtree(fiber)) continue;
|
|
1329
|
+
if (chunkQAZ4TN3Z_js.isAlwaysListContainer(fiber) || chunkQAZ4TN3Z_js.isHeuristicListContainer(fiber)) {
|
|
1330
|
+
const minItems = chunkQAZ4TN3Z_js.isAlwaysListContainer(fiber) || options.allowSingleHeuristic ? 1 : 2;
|
|
1331
|
+
const items = chunkQAZ4TN3Z_js.findListItems(fiber, minItems);
|
|
1299
1332
|
if (items && items.length >= minItems) {
|
|
1300
1333
|
containers.push({
|
|
1301
1334
|
container: fiber,
|
|
1302
1335
|
items,
|
|
1303
1336
|
listId: listIdFromContainer(fiber),
|
|
1304
1337
|
listLabel: listLabelFromContainer(fiber),
|
|
1305
|
-
containerType:
|
|
1338
|
+
containerType: chunkQAZ4TN3Z_js.getTypeName(fiber.type) ?? chunkQAZ4TN3Z_js.getTypeName(fiber.elementType) ?? "List"
|
|
1306
1339
|
});
|
|
1307
1340
|
continue;
|
|
1308
1341
|
}
|
|
@@ -1321,7 +1354,7 @@ function findFirstTouchable(item) {
|
|
|
1321
1354
|
const { fiber, includeSibling } = stack.pop();
|
|
1322
1355
|
if (!fiber || visited.has(fiber)) continue;
|
|
1323
1356
|
visited.add(fiber);
|
|
1324
|
-
if (
|
|
1357
|
+
if (chunkQAZ4TN3Z_js.shouldSkipSubtree(fiber)) continue;
|
|
1325
1358
|
if (isPressableFiber(fiber)) {
|
|
1326
1359
|
const props = fiber.memoizedProps ?? {};
|
|
1327
1360
|
if (typeof props.onPress === "function" || typeof props.onPressIn === "function") {
|
|
@@ -1348,7 +1381,7 @@ function findTouchableFibers(item) {
|
|
|
1348
1381
|
const { fiber, includeSibling } = stack.pop();
|
|
1349
1382
|
if (!fiber || visited.has(fiber)) continue;
|
|
1350
1383
|
visited.add(fiber);
|
|
1351
|
-
if (
|
|
1384
|
+
if (chunkQAZ4TN3Z_js.shouldSkipSubtree(fiber)) continue;
|
|
1352
1385
|
const props = fiber.memoizedProps ?? {};
|
|
1353
1386
|
if (isPressableFiber(fiber) && (typeof props.onPress === "function" || typeof props.onPressIn === "function")) {
|
|
1354
1387
|
found.push(fiber);
|
|
@@ -1392,7 +1425,7 @@ function findFirstText(fiber) {
|
|
|
1392
1425
|
const node = stack.pop();
|
|
1393
1426
|
if (!node || visited.has(node)) continue;
|
|
1394
1427
|
visited.add(node);
|
|
1395
|
-
const typeName =
|
|
1428
|
+
const typeName = chunkQAZ4TN3Z_js.getTypeName(node.type) ?? chunkQAZ4TN3Z_js.getTypeName(node.elementType) ?? "";
|
|
1396
1429
|
if (typeName === "Text") {
|
|
1397
1430
|
const text = textFromChildren(node.memoizedProps?.children).trim();
|
|
1398
1431
|
if (text) return text;
|
|
@@ -1411,7 +1444,7 @@ function collectTexts(fiber) {
|
|
|
1411
1444
|
const node = stack.pop();
|
|
1412
1445
|
if (!node || visited.has(node)) continue;
|
|
1413
1446
|
visited.add(node);
|
|
1414
|
-
const typeName =
|
|
1447
|
+
const typeName = chunkQAZ4TN3Z_js.getTypeName(node.type) ?? chunkQAZ4TN3Z_js.getTypeName(node.elementType) ?? "";
|
|
1415
1448
|
if (typeName === "Text") {
|
|
1416
1449
|
const text = textFromChildren(node.memoizedProps?.children).trim();
|
|
1417
1450
|
if (text) out.push(text);
|
|
@@ -1423,10 +1456,10 @@ function collectTexts(fiber) {
|
|
|
1423
1456
|
}
|
|
1424
1457
|
function hasUsefulTouchableIdentity(fiber) {
|
|
1425
1458
|
const props = fiber?.memoizedProps ?? {};
|
|
1426
|
-
if (
|
|
1427
|
-
if (
|
|
1428
|
-
if (
|
|
1429
|
-
return
|
|
1459
|
+
if (chunkQAZ4TN3Z_js.isReferenceable(props.testID)) return true;
|
|
1460
|
+
if (chunkQAZ4TN3Z_js.isReferenceable(props.accessibilityLabel)) return true;
|
|
1461
|
+
if (chunkQAZ4TN3Z_js.isReferenceable(props.label)) return true;
|
|
1462
|
+
return chunkQAZ4TN3Z_js.isReferenceable(findFirstText(fiber));
|
|
1430
1463
|
}
|
|
1431
1464
|
function describeTouchable(fiber) {
|
|
1432
1465
|
const props = fiber?.memoizedProps ?? {};
|
|
@@ -1437,10 +1470,10 @@ function describeTouchable(fiber) {
|
|
|
1437
1470
|
}
|
|
1438
1471
|
function touchableLooksDestructive(fiber) {
|
|
1439
1472
|
const descriptor = describeTouchable(fiber);
|
|
1440
|
-
if (descriptor &&
|
|
1473
|
+
if (descriptor && chunkQAZ4TN3Z_js.looksDestructiveActionLabel(descriptor)) return true;
|
|
1441
1474
|
const props = fiber?.memoizedProps ?? {};
|
|
1442
1475
|
const haystack = [props.testID, props.accessibilityLabel, props.accessibilityHint, props.label].filter((value) => typeof value === "string").join(" ");
|
|
1443
|
-
return
|
|
1476
|
+
return chunkQAZ4TN3Z_js.looksDestructiveActionLabel(haystack);
|
|
1444
1477
|
}
|
|
1445
1478
|
function describeItemCandidate(listIndex, zeroBasedIndex, item) {
|
|
1446
1479
|
const syntheticId = `list-${listIndex}-item-${zeroBasedIndex + 1}`;
|
|
@@ -1491,7 +1524,7 @@ function pressResolvedListItem(list, itemFiber, listIndex, itemIndex) {
|
|
|
1491
1524
|
if (primaryWrapsNestedTargets) {
|
|
1492
1525
|
const outer = describeTouchable(touchable) ?? "?";
|
|
1493
1526
|
const nested = safeIdentifiableTouchables.filter((candidate) => candidate !== touchable && containsFiber(touchable, candidate)).map((candidate) => describeTouchable(candidate) ?? "?").slice(0, 6);
|
|
1494
|
-
|
|
1527
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
1495
1528
|
`listItemDispatch: item "list-${listIndex}-item-${itemIndex}" has nested pressables; pressing outer row target [outer=${outer}] [nested=${nested.join(", ")}] [outerHasOnPress=${typeof touchable?.memoizedProps?.onPress === "function"}]`
|
|
1496
1529
|
);
|
|
1497
1530
|
} else {
|
|
@@ -1526,14 +1559,14 @@ function pressResolvedListItem(list, itemFiber, listIndex, itemIndex) {
|
|
|
1526
1559
|
}
|
|
1527
1560
|
return {
|
|
1528
1561
|
ok: true,
|
|
1529
|
-
containerType:
|
|
1562
|
+
containerType: chunkQAZ4TN3Z_js.getTypeName(container.type) ?? chunkQAZ4TN3Z_js.getTypeName(container.elementType) ?? list.containerType
|
|
1530
1563
|
};
|
|
1531
1564
|
} catch (err) {
|
|
1532
1565
|
return {
|
|
1533
1566
|
ok: false,
|
|
1534
1567
|
reason: "press-threw",
|
|
1535
1568
|
error: err?.message ?? "press handler threw",
|
|
1536
|
-
containerType:
|
|
1569
|
+
containerType: chunkQAZ4TN3Z_js.getTypeName(container.type) ?? chunkQAZ4TN3Z_js.getTypeName(container.elementType) ?? list.containerType
|
|
1537
1570
|
};
|
|
1538
1571
|
}
|
|
1539
1572
|
}
|
|
@@ -1591,7 +1624,7 @@ function candidateLists(containers, locator) {
|
|
|
1591
1624
|
return containers.map((list, listIndex) => ({ list, listIndex }));
|
|
1592
1625
|
}
|
|
1593
1626
|
function pressListItemAtOrdinal(listIndex, itemIndex) {
|
|
1594
|
-
if (!
|
|
1627
|
+
if (!chunkQAZ4TN3Z_js.getFiberRoot()) return { ok: false, reason: "no-fiber-root" };
|
|
1595
1628
|
const containers = findListContainers({ allowSingleHeuristic: true });
|
|
1596
1629
|
if (listIndex < 0 || listIndex >= containers.length) {
|
|
1597
1630
|
return { ok: false, reason: "list-not-found" };
|
|
@@ -1605,7 +1638,7 @@ function pressListItemAtOrdinal(listIndex, itemIndex) {
|
|
|
1605
1638
|
return pressResolvedListItem(list, items[zeroBased], listIndex, itemIndex);
|
|
1606
1639
|
}
|
|
1607
1640
|
function resolveListItemByIdentity(locator) {
|
|
1608
|
-
if (!
|
|
1641
|
+
if (!chunkQAZ4TN3Z_js.getFiberRoot()) return { ok: false, result: { ok: false, reason: "no-fiber-root" } };
|
|
1609
1642
|
const parsed = locator.syntheticId ? parseSyntheticListItemId(locator.syntheticId) : null;
|
|
1610
1643
|
const effective = parsed ? { ...locator, listIndex: parsed.listIndex, itemIndex: parsed.itemIndex } : locator;
|
|
1611
1644
|
const containers = findListContainers({ allowSingleHeuristic: true });
|
|
@@ -1666,9 +1699,9 @@ function findSwitchFibers(item) {
|
|
|
1666
1699
|
const { fiber, includeSibling } = stack.pop();
|
|
1667
1700
|
if (!fiber || visited.has(fiber)) continue;
|
|
1668
1701
|
visited.add(fiber);
|
|
1669
|
-
if (
|
|
1702
|
+
if (chunkQAZ4TN3Z_js.shouldSkipSubtree(fiber)) continue;
|
|
1670
1703
|
const props = fiber.memoizedProps ?? {};
|
|
1671
|
-
if (
|
|
1704
|
+
if (chunkQAZ4TN3Z_js.isSwitchLike(fiber, props)) {
|
|
1672
1705
|
if (props.__appilotsInternal !== true) found.push(fiber);
|
|
1673
1706
|
if (includeSibling && fiber.sibling) {
|
|
1674
1707
|
stack.push({ fiber: fiber.sibling, includeSibling: true });
|
|
@@ -1702,7 +1735,7 @@ function toggleListItemByIdentity(locator, options) {
|
|
|
1702
1735
|
}
|
|
1703
1736
|
const target = switches[0];
|
|
1704
1737
|
const props = target?.memoizedProps ?? {};
|
|
1705
|
-
const current2 =
|
|
1738
|
+
const current2 = chunkQAZ4TN3Z_js.switchValue(props);
|
|
1706
1739
|
if (options?.expected !== void 0 && current2 === options.expected) {
|
|
1707
1740
|
return { ok: true, containerType: list.containerType, value: current2, noop: true };
|
|
1708
1741
|
}
|
|
@@ -1741,7 +1774,7 @@ function screenDiagnose(targetId, category = "component-not-found") {
|
|
|
1741
1774
|
return {
|
|
1742
1775
|
category,
|
|
1743
1776
|
targetId,
|
|
1744
|
-
screen:
|
|
1777
|
+
screen: chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0
|
|
1745
1778
|
};
|
|
1746
1779
|
}
|
|
1747
1780
|
function isPressLike(action) {
|
|
@@ -1761,10 +1794,10 @@ function elementLookupKey(value) {
|
|
|
1761
1794
|
return canonicalElementId(value).toLowerCase().replace(/[\s_]+/g, "-");
|
|
1762
1795
|
}
|
|
1763
1796
|
function findRegisteredElement(elementId) {
|
|
1764
|
-
const direct =
|
|
1797
|
+
const direct = chunkQAZ4TN3Z_js.elementRegistry.get(elementId) ?? chunkQAZ4TN3Z_js.elementRegistry.get(canonicalElementId(elementId));
|
|
1765
1798
|
if (direct) return direct;
|
|
1766
1799
|
const wanted = elementLookupKey(elementId);
|
|
1767
|
-
return
|
|
1800
|
+
return chunkQAZ4TN3Z_js.elementRegistry.snapshot().find((element) => elementLookupKey(element.id) === wanted);
|
|
1768
1801
|
}
|
|
1769
1802
|
function resolveInteractionElement(elementId) {
|
|
1770
1803
|
return getLatestElement(elementId);
|
|
@@ -1884,7 +1917,7 @@ function dispatchIdentifiedToggle(targetId, action) {
|
|
|
1884
1917
|
diagnose: { ...screenDiagnose(targetId, "unknown"), recoverable: true }
|
|
1885
1918
|
};
|
|
1886
1919
|
}
|
|
1887
|
-
|
|
1920
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
1888
1921
|
`elementDispatch: "${action}" on "${targetId}" names a switch \u2014 flipping it instead of pressing, so the verb cannot land on an ancestor`
|
|
1889
1922
|
);
|
|
1890
1923
|
try {
|
|
@@ -1919,10 +1952,11 @@ function dispatchFiberTarget(targetId, action) {
|
|
|
1919
1952
|
};
|
|
1920
1953
|
}
|
|
1921
1954
|
const measured = handle.measure?.() ?? null;
|
|
1955
|
+
const verb = action === "scroll" ? void 0 : action === "toggle" || action === "focus" ? action : "press";
|
|
1922
1956
|
if (measured && getSpotlightMode() === "guided") {
|
|
1923
|
-
setSpotlightTarget(revealTarget(measured).rect, handle.label);
|
|
1957
|
+
setSpotlightTarget(revealTarget(measured).rect, handle.label, verb);
|
|
1924
1958
|
} else {
|
|
1925
|
-
setSpotlightTarget(measured, handle.label);
|
|
1959
|
+
setSpotlightTarget(measured, handle.label, verb);
|
|
1926
1960
|
}
|
|
1927
1961
|
try {
|
|
1928
1962
|
if (isPressLike(action) && handle.kind === "target" && handle.press) {
|
|
@@ -2113,7 +2147,7 @@ function dispatchToggleElement(element, registry) {
|
|
|
2113
2147
|
}
|
|
2114
2148
|
function dispatchStructuredElementId(identifier, action) {
|
|
2115
2149
|
if (!isElementIdentifier(identifier) || !isPressLike(action)) return null;
|
|
2116
|
-
const parsed =
|
|
2150
|
+
const parsed = chunkQAZ4TN3Z_js.parseStableElementId(identifier);
|
|
2117
2151
|
if (!parsed || parsed.role !== "option") return null;
|
|
2118
2152
|
if (!parsed.itemKey && !parsed.listId) return null;
|
|
2119
2153
|
const pressed = pressListItemByIdentity({
|
|
@@ -2123,7 +2157,7 @@ function dispatchStructuredElementId(identifier, action) {
|
|
|
2123
2157
|
texts: parsed.itemKey ? [parsed.itemKey] : void 0
|
|
2124
2158
|
});
|
|
2125
2159
|
if (pressed.ok) {
|
|
2126
|
-
|
|
2160
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2127
2161
|
`elementDispatch: resolved stale el id "${identifier}" via structural identity (listId="${parsed.listId}", itemKey="${parsed.itemKey}")`
|
|
2128
2162
|
);
|
|
2129
2163
|
return { success: true };
|
|
@@ -2154,20 +2188,20 @@ function normalize4(value) {
|
|
|
2154
2188
|
return value.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]/g, "");
|
|
2155
2189
|
}
|
|
2156
2190
|
function resolveScreenForFormFields() {
|
|
2157
|
-
const activePath =
|
|
2191
|
+
const activePath = chunkQAZ4TN3Z_js.getActiveRouteNames();
|
|
2158
2192
|
for (let i = activePath.length - 1; i >= 0; i--) {
|
|
2159
2193
|
const name = activePath[i];
|
|
2160
|
-
const meta = name ?
|
|
2194
|
+
const meta = name ? chunkQAZ4TN3Z_js.getScreenMetadata(name) : void 0;
|
|
2161
2195
|
if (name && Array.isArray(meta?.fields) && meta.fields.length > 0) return name;
|
|
2162
2196
|
}
|
|
2163
|
-
return
|
|
2197
|
+
return chunkQAZ4TN3Z_js.getCurrentScreen();
|
|
2164
2198
|
}
|
|
2165
2199
|
function collectKnownFormFields(registry) {
|
|
2166
2200
|
const registryFields = registry.snapshot().filter((entry) => entry.kind === "field" || entry.kind === "slider").map((entry) => ({ id: entry.id, label: entry.label }));
|
|
2167
2201
|
if (registryFields.length >= 2) return registryFields;
|
|
2168
2202
|
const screen = resolveScreenForFormFields();
|
|
2169
2203
|
if (screen) {
|
|
2170
|
-
const metaFields =
|
|
2204
|
+
const metaFields = chunkQAZ4TN3Z_js.getScreenMetadata(screen)?.fields;
|
|
2171
2205
|
if (Array.isArray(metaFields) && metaFields.length > 0) {
|
|
2172
2206
|
return metaFields.filter((field) => !!field && typeof field.id === "string").map((field) => ({
|
|
2173
2207
|
id: field.id,
|
|
@@ -2177,7 +2211,7 @@ function collectKnownFormFields(registry) {
|
|
|
2177
2211
|
}));
|
|
2178
2212
|
}
|
|
2179
2213
|
}
|
|
2180
|
-
for (const meta of
|
|
2214
|
+
for (const meta of chunkQAZ4TN3Z_js.getAllScreens()) {
|
|
2181
2215
|
if (Array.isArray(meta.fields) && meta.fields.length > 0) {
|
|
2182
2216
|
return meta.fields.filter((field) => !!field && typeof field.id === "string").map((field) => ({
|
|
2183
2217
|
id: field.id,
|
|
@@ -2189,19 +2223,9 @@ function collectKnownFormFields(registry) {
|
|
|
2189
2223
|
}
|
|
2190
2224
|
return registryFields;
|
|
2191
2225
|
}
|
|
2192
|
-
function isMisplacedFieldId(fieldId
|
|
2226
|
+
function isMisplacedFieldId(fieldId) {
|
|
2193
2227
|
const trimmed = fieldId.trim();
|
|
2194
|
-
|
|
2195
|
-
if (LIST_ORDINAL_RE.test(trimmed)) return true;
|
|
2196
|
-
if (/^\d+$/.test(trimmed)) return true;
|
|
2197
|
-
const normalized = normalize4(trimmed);
|
|
2198
|
-
if (knownIds.has(normalized)) return false;
|
|
2199
|
-
for (const known of knownIds) {
|
|
2200
|
-
if (known.length >= 4 && (known.includes(normalized) || normalized.includes(known))) {
|
|
2201
|
-
return false;
|
|
2202
|
-
}
|
|
2203
|
-
}
|
|
2204
|
-
return true;
|
|
2228
|
+
return !trimmed || LIST_ORDINAL_RE.test(trimmed) || /^\d+$/.test(trimmed);
|
|
2205
2229
|
}
|
|
2206
2230
|
function valueMatchesOption(field, rawValue) {
|
|
2207
2231
|
const value = normalize4(String(rawValue ?? ""));
|
|
@@ -2258,6 +2282,7 @@ function fieldTypeMatchesShape(field, shape) {
|
|
|
2258
2282
|
function fieldAcceptsFreeText(field, shape) {
|
|
2259
2283
|
const type = normalize4(field.type ?? "text");
|
|
2260
2284
|
if (CHOICE_FIELD_TYPES.has(type)) return false;
|
|
2285
|
+
if (type === "password") return false;
|
|
2261
2286
|
if (NUMERIC_FIELD_TYPES.has(type)) return shape === "number";
|
|
2262
2287
|
if (DATE_FIELD_TYPES.has(type)) return shape === "date";
|
|
2263
2288
|
if (EMAIL_FIELD_TYPES.has(type)) return shape === "email";
|
|
@@ -2278,19 +2303,18 @@ function inferFieldIdForValue(rawValue, fields, used) {
|
|
|
2278
2303
|
function rewriteMisplacedFormFillFields(fields, registry) {
|
|
2279
2304
|
const knownFields = collectKnownFormFields(registry);
|
|
2280
2305
|
if (knownFields.length === 0) return fields;
|
|
2281
|
-
const
|
|
2282
|
-
const needsRewrite = fields.some((field) => isMisplacedFieldId(field.fieldId, knownIds));
|
|
2306
|
+
const needsRewrite = fields.some((field) => isMisplacedFieldId(field.fieldId));
|
|
2283
2307
|
if (!needsRewrite) return fields;
|
|
2284
2308
|
const used = /* @__PURE__ */ new Set();
|
|
2285
2309
|
return fields.map((field) => {
|
|
2286
|
-
if (!isMisplacedFieldId(field.fieldId
|
|
2310
|
+
if (!isMisplacedFieldId(field.fieldId)) {
|
|
2287
2311
|
used.add(field.fieldId);
|
|
2288
2312
|
return field;
|
|
2289
2313
|
}
|
|
2290
2314
|
const inferred = inferFieldIdForValue(String(field.value ?? ""), knownFields, used);
|
|
2291
2315
|
if (!inferred) return field;
|
|
2292
2316
|
used.add(inferred);
|
|
2293
|
-
|
|
2317
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn(
|
|
2294
2318
|
`formFieldRewrite: ${field.fieldId} \u2192 ${inferred} (value=${JSON.stringify(field.value)})`
|
|
2295
2319
|
);
|
|
2296
2320
|
return { ...field, fieldId: inferred };
|
|
@@ -2298,8 +2322,8 @@ function rewriteMisplacedFormFillFields(fields, registry) {
|
|
|
2298
2322
|
}
|
|
2299
2323
|
|
|
2300
2324
|
// src/executor/formValidation.ts
|
|
2301
|
-
var FORM_VALIDATION_TEXT_RE2 =
|
|
2302
|
-
var FORM_SUCCESS_TEXT_RE =
|
|
2325
|
+
var FORM_VALIDATION_TEXT_RE2 = chunkQAZ4TN3Z_js.FORM_VALIDATION_TEXT_RE;
|
|
2326
|
+
var FORM_SUCCESS_TEXT_RE = chunkQAZ4TN3Z_js.FORM_WRITE_SUCCESS_TEXT_RE;
|
|
2303
2327
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
2304
2328
|
function inferValidationFieldId(message, inputs) {
|
|
2305
2329
|
const haystack = normalizeText(message);
|
|
@@ -2327,10 +2351,10 @@ function readVisibleFormValidation(snap, beforeTexts) {
|
|
|
2327
2351
|
if (!snap) return void 0;
|
|
2328
2352
|
const invalid = snap.inputs?.find((input) => input.invalid === true);
|
|
2329
2353
|
const hasSubmitControl = snap.buttons?.some(
|
|
2330
|
-
(button) =>
|
|
2354
|
+
(button) => chunkQAZ4TN3Z_js.SUBMIT_CONTROL_RE.test(button.label ?? button.id ?? "")
|
|
2331
2355
|
);
|
|
2332
2356
|
for (const text of snap.texts ?? []) {
|
|
2333
|
-
if (!text?.trim() || !
|
|
2357
|
+
if (!text?.trim() || !chunkQAZ4TN3Z_js.isVisibleValidationText(text, { invalid: !!invalid, hasSubmitControl, beforeTexts }))
|
|
2334
2358
|
continue;
|
|
2335
2359
|
return { fieldId: inferValidationFieldId(text, snap.inputs), message: text };
|
|
2336
2360
|
}
|
|
@@ -2342,7 +2366,7 @@ function readVisibleFormSuccess(snap) {
|
|
|
2342
2366
|
return (snap.texts ?? []).find((text) => text?.trim() && FORM_SUCCESS_TEXT_RE.test(text));
|
|
2343
2367
|
}
|
|
2344
2368
|
function submitAsyncStillPending(submitTargetId) {
|
|
2345
|
-
const probe =
|
|
2369
|
+
const probe = chunkQAZ4TN3Z_js.probeLoadingState(submitTargetId ?? null, chunkQAZ4TN3Z_js.getCurrentScreen());
|
|
2346
2370
|
if (probe.loading) return true;
|
|
2347
2371
|
if (submitTargetId && probe.pressedFound && probe.pressedDisabled) return true;
|
|
2348
2372
|
return false;
|
|
@@ -2354,7 +2378,7 @@ function evaluatePostSubmitSnapshot(snap, activePath, beforeTexts) {
|
|
|
2354
2378
|
}
|
|
2355
2379
|
const successText = readVisibleFormSuccess(snap);
|
|
2356
2380
|
if (successText) return { status: "success", message: successText };
|
|
2357
|
-
if (!
|
|
2381
|
+
if (!chunkQAZ4TN3Z_js.snapshotShowsOpenCreateForm(snap, activePath)) {
|
|
2358
2382
|
return {
|
|
2359
2383
|
status: "unverified",
|
|
2360
2384
|
message: "The form closed without a visible success receipt. Inspect the resulting record before claiming the goal is complete."
|
|
@@ -2373,7 +2397,7 @@ async function waitForPostSubmitOutcome(options) {
|
|
|
2373
2397
|
continue;
|
|
2374
2398
|
}
|
|
2375
2399
|
const snap2 = captureSnapshot();
|
|
2376
|
-
const activePath2 =
|
|
2400
|
+
const activePath2 = chunkQAZ4TN3Z_js.getActiveRouteNames();
|
|
2377
2401
|
const outcome2 = evaluatePostSubmitSnapshot(snap2, activePath2, options?.beforeTexts);
|
|
2378
2402
|
if (outcome2) return outcome2;
|
|
2379
2403
|
await sleep(pollMs);
|
|
@@ -2385,7 +2409,7 @@ async function waitForPostSubmitOutcome(options) {
|
|
|
2385
2409
|
};
|
|
2386
2410
|
}
|
|
2387
2411
|
const snap = captureSnapshot();
|
|
2388
|
-
const activePath =
|
|
2412
|
+
const activePath = chunkQAZ4TN3Z_js.getActiveRouteNames();
|
|
2389
2413
|
const outcome = evaluatePostSubmitSnapshot(snap, activePath, options?.beforeTexts);
|
|
2390
2414
|
if (outcome) return outcome;
|
|
2391
2415
|
return {
|
|
@@ -2406,16 +2430,16 @@ function findSnapshotButton(targetId) {
|
|
|
2406
2430
|
}
|
|
2407
2431
|
}
|
|
2408
2432
|
function buildUiDiagnose(targetId, cause) {
|
|
2409
|
-
const activePath =
|
|
2410
|
-
const screen = activePath[activePath.length - 1] ??
|
|
2433
|
+
const activePath = chunkQAZ4TN3Z_js.getActiveRouteNames();
|
|
2434
|
+
const screen = activePath[activePath.length - 1] ?? chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0;
|
|
2411
2435
|
const screenPath = activePath.length > 1 ? activePath.join("/") : screen;
|
|
2412
2436
|
const diagnose = {
|
|
2413
2437
|
category: cause === "not-found" ? "component-not-found" : cause === "disabled" ? "disabled" : "unknown",
|
|
2414
2438
|
targetId,
|
|
2415
2439
|
screen: screenPath
|
|
2416
2440
|
};
|
|
2417
|
-
if (
|
|
2418
|
-
diagnose.visibleMessage =
|
|
2441
|
+
if (chunkQAZ4TN3Z_js.isOptionalStepAutomationFailure(targetId, screenPath, activePath)) {
|
|
2442
|
+
diagnose.visibleMessage = chunkQAZ4TN3Z_js.OPTIONAL_STEP_AUTOMATION_HINT;
|
|
2419
2443
|
diagnose.recoverable = true;
|
|
2420
2444
|
}
|
|
2421
2445
|
return diagnose;
|
|
@@ -2466,7 +2490,7 @@ function stripComponentPrefix(componentId) {
|
|
|
2466
2490
|
return null;
|
|
2467
2491
|
}
|
|
2468
2492
|
function resolveComponentId(componentId, registry, action) {
|
|
2469
|
-
if (
|
|
2493
|
+
if (chunkQAZ4TN3Z_js.isSourceControlId(componentId)) return componentId;
|
|
2470
2494
|
if (registry.getTarget(componentId) || registry.getToggle(componentId) || registry.getField(componentId) || registry.getSlider(componentId)) {
|
|
2471
2495
|
return componentId;
|
|
2472
2496
|
}
|
|
@@ -2474,16 +2498,16 @@ function resolveComponentId(componentId, registry, action) {
|
|
|
2474
2498
|
const snapshot = registry.snapshot();
|
|
2475
2499
|
for (const comp of snapshot) {
|
|
2476
2500
|
if (comp.id.toLowerCase() === lower) {
|
|
2477
|
-
|
|
2501
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2478
2502
|
`resolveComponentId: case-insensitive match "${componentId}" \u2192 "${comp.id}"`
|
|
2479
2503
|
);
|
|
2480
2504
|
return comp.id;
|
|
2481
2505
|
}
|
|
2482
2506
|
}
|
|
2483
2507
|
if (isPositionalControlId(componentId)) return componentId;
|
|
2484
|
-
const currentScreen =
|
|
2508
|
+
const currentScreen = chunkQAZ4TN3Z_js.getCurrentScreen();
|
|
2485
2509
|
if (currentScreen) {
|
|
2486
|
-
const screenMeta =
|
|
2510
|
+
const screenMeta = chunkQAZ4TN3Z_js.getScreenMetadata(currentScreen);
|
|
2487
2511
|
const actions = screenMeta?.actions;
|
|
2488
2512
|
if (actions && Array.isArray(actions)) {
|
|
2489
2513
|
const metaAction = actions.find(
|
|
@@ -2492,14 +2516,14 @@ function resolveComponentId(componentId, registry, action) {
|
|
|
2492
2516
|
if (metaAction && typeof metaAction === "object" && metaAction.label) {
|
|
2493
2517
|
const metaLabel = metaAction.label;
|
|
2494
2518
|
const normalizedMetaLabel = metaLabel.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]/g, "");
|
|
2495
|
-
|
|
2519
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2496
2520
|
`resolveComponentId: found screen metadata for "${componentId}" \u2192 label="${metaLabel}"`
|
|
2497
2521
|
);
|
|
2498
2522
|
for (const comp of snapshot) {
|
|
2499
2523
|
if (!comp.label) continue;
|
|
2500
2524
|
const compLabel = comp.label.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]/g, "");
|
|
2501
2525
|
if (compLabel === normalizedMetaLabel || compLabel.includes(normalizedMetaLabel) || normalizedMetaLabel.includes(compLabel)) {
|
|
2502
|
-
|
|
2526
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2503
2527
|
`resolveComponentId: FOUND via metadata: "${componentId}" \u2192 "${comp.id}" (label="${comp.label}")`
|
|
2504
2528
|
);
|
|
2505
2529
|
return comp.id;
|
|
@@ -2514,9 +2538,9 @@ function resolveComponentId(componentId, registry, action) {
|
|
|
2514
2538
|
label: c.label,
|
|
2515
2539
|
kind: c.kind
|
|
2516
2540
|
}));
|
|
2517
|
-
const match =
|
|
2541
|
+
const match = chunkQAZ4TN3Z_js.resolveTarget(componentId, candidates, { action });
|
|
2518
2542
|
if (match.status === "matched") {
|
|
2519
|
-
|
|
2543
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2520
2544
|
`resolveComponentId: matched "${componentId}" -> "${match.id}" (tier=${match.tier})`
|
|
2521
2545
|
);
|
|
2522
2546
|
return match.id;
|
|
@@ -2606,7 +2630,7 @@ function setValueHandler(rawComponentId, requested, registry) {
|
|
|
2606
2630
|
try {
|
|
2607
2631
|
slider.setValue(applied);
|
|
2608
2632
|
if (applied !== requestedValue) {
|
|
2609
|
-
|
|
2633
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2610
2634
|
`uiInteractionHandler: set_value snapped ${requestedValue} \u2192 ${applied} for "${componentId}" (step=${step})`
|
|
2611
2635
|
);
|
|
2612
2636
|
}
|
|
@@ -2641,7 +2665,7 @@ function checkModalOcclusion(rawComponentId, action) {
|
|
|
2641
2665
|
return null;
|
|
2642
2666
|
}
|
|
2643
2667
|
if (typeof rawComponentId !== "string" || rawComponentId.trim().length === 0) return null;
|
|
2644
|
-
const dialog =
|
|
2668
|
+
const dialog = chunkQAZ4TN3Z_js.getOpenNativeDialog();
|
|
2645
2669
|
if (dialog) {
|
|
2646
2670
|
const needle = normalizeIdent(rawComponentId);
|
|
2647
2671
|
if (dialog.buttons.some((b) => normalizeIdent(b.label) === needle)) return null;
|
|
@@ -2651,16 +2675,16 @@ function checkModalOcclusion(rawComponentId, action) {
|
|
|
2651
2675
|
diagnose: {
|
|
2652
2676
|
category: "ambiguous-target",
|
|
2653
2677
|
targetId: rawComponentId,
|
|
2654
|
-
screen:
|
|
2678
|
+
screen: chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0,
|
|
2655
2679
|
candidates: dialog.buttons.map((b) => b.label).slice(0, 8)
|
|
2656
2680
|
}
|
|
2657
2681
|
};
|
|
2658
2682
|
}
|
|
2659
|
-
const fiberRoot =
|
|
2683
|
+
const fiberRoot = chunkQAZ4TN3Z_js.getFiberRoot();
|
|
2660
2684
|
if (!fiberRoot) return null;
|
|
2661
2685
|
let snap;
|
|
2662
2686
|
try {
|
|
2663
|
-
snap =
|
|
2687
|
+
snap = chunkQAZ4TN3Z_js.walkFiber(fiberRoot);
|
|
2664
2688
|
} catch {
|
|
2665
2689
|
return null;
|
|
2666
2690
|
}
|
|
@@ -2722,11 +2746,11 @@ function checkModalOcclusion(rawComponentId, action) {
|
|
|
2722
2746
|
}
|
|
2723
2747
|
function uiInteractionHandler(payload, context) {
|
|
2724
2748
|
const { permissions } = context;
|
|
2725
|
-
const registry = context.registry ??
|
|
2749
|
+
const registry = context.registry ?? chunkQAZ4TN3Z_js.componentRegistry;
|
|
2726
2750
|
if (!permissions.canInteractUI) {
|
|
2727
2751
|
return {
|
|
2728
2752
|
success: false,
|
|
2729
|
-
error:
|
|
2753
|
+
error: chunkQAZ4TN3Z_js.permissionDeniedMessage("UI interaction", "canInteractUI"),
|
|
2730
2754
|
diagnose: {
|
|
2731
2755
|
...buildUiDiagnose(
|
|
2732
2756
|
payload.componentId ?? payload.targetId ?? "",
|
|
@@ -2747,7 +2771,7 @@ function uiInteractionHandler(payload, context) {
|
|
|
2747
2771
|
if (sliderId) {
|
|
2748
2772
|
const smuggled = payload.value ?? payload.params?.value;
|
|
2749
2773
|
if (smuggled !== void 0) {
|
|
2750
|
-
|
|
2774
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2751
2775
|
`uiInteractionHandler: "${actionStr}" on slider "${sliderId}" carried value=${JSON.stringify(smuggled)} \u2014 routing to set_value`
|
|
2752
2776
|
);
|
|
2753
2777
|
return setValueHandler(rawComponentId, smuggled, registry);
|
|
@@ -2758,23 +2782,23 @@ function uiInteractionHandler(payload, context) {
|
|
|
2758
2782
|
diagnose: { ...buildUiDiagnose(sliderId, "unknown"), recoverable: true }
|
|
2759
2783
|
};
|
|
2760
2784
|
}
|
|
2761
|
-
const openDialog =
|
|
2785
|
+
const openDialog = chunkQAZ4TN3Z_js.getOpenNativeDialog();
|
|
2762
2786
|
const isPressVerb = actionStr === "press" || actionStr === "tap" || actionStr === "click";
|
|
2763
2787
|
if (openDialog && isPressVerb) {
|
|
2764
2788
|
const needle = normalizeIdent(rawComponentId);
|
|
2765
2789
|
const button = openDialog.buttons.find((b) => normalizeIdent(b.label) === needle);
|
|
2766
2790
|
if (button) {
|
|
2767
2791
|
button.press();
|
|
2768
|
-
|
|
2792
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(`uiInteractionHandler: pressed native dialog button "${button.label}"`);
|
|
2769
2793
|
return { success: true, effect: "changed" };
|
|
2770
2794
|
}
|
|
2771
2795
|
}
|
|
2772
2796
|
if (!openDialog && isPressVerb) {
|
|
2773
|
-
const answered =
|
|
2797
|
+
const answered = chunkQAZ4TN3Z_js.getLastAnsweredNativeDialog();
|
|
2774
2798
|
const needle = normalizeIdent(rawComponentId);
|
|
2775
2799
|
if (answered && needle) {
|
|
2776
2800
|
if (answered.answeredWith && normalizeIdent(answered.answeredWith) === needle) {
|
|
2777
|
-
|
|
2801
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2778
2802
|
`uiInteractionHandler: native dialog button "${answered.answeredWith}" was already pressed and the dialog is closed \u2014 treating the repeat as done`
|
|
2779
2803
|
);
|
|
2780
2804
|
return { success: true, effect: "completed" };
|
|
@@ -2786,7 +2810,7 @@ function uiInteractionHandler(payload, context) {
|
|
|
2786
2810
|
diagnose: {
|
|
2787
2811
|
category: "component-not-found",
|
|
2788
2812
|
targetId: rawComponentId,
|
|
2789
|
-
screen:
|
|
2813
|
+
screen: chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0,
|
|
2790
2814
|
recoverable: false
|
|
2791
2815
|
}
|
|
2792
2816
|
};
|
|
@@ -2795,7 +2819,7 @@ function uiInteractionHandler(payload, context) {
|
|
|
2795
2819
|
}
|
|
2796
2820
|
const occluded = checkModalOcclusion(rawComponentId, actionStr);
|
|
2797
2821
|
if (occluded) {
|
|
2798
|
-
|
|
2822
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2799
2823
|
`uiInteractionHandler: blocked "${actionStr}" on "${rawComponentId}" \u2014 target is behind an open modal`
|
|
2800
2824
|
);
|
|
2801
2825
|
return occluded;
|
|
@@ -2803,7 +2827,7 @@ function uiInteractionHandler(payload, context) {
|
|
|
2803
2827
|
if (typeof rawComponentId === "string" && rawComponentId.trim().toLowerCase().startsWith("el:")) {
|
|
2804
2828
|
const result = dispatchElementOrTarget(rawComponentId, registry, actionStr);
|
|
2805
2829
|
if (result.success) {
|
|
2806
|
-
|
|
2830
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2807
2831
|
`uiInteractionHandler: interaction element dispatch succeeded for "${rawComponentId}"`
|
|
2808
2832
|
);
|
|
2809
2833
|
}
|
|
@@ -2811,17 +2835,17 @@ function uiInteractionHandler(payload, context) {
|
|
|
2811
2835
|
}
|
|
2812
2836
|
const ordinal = parseSyntheticListItemId(rawComponentId);
|
|
2813
2837
|
if (ordinal && (action === "press" || actionStr === "tap" || actionStr === "click" || actionStr === "longPress")) {
|
|
2814
|
-
|
|
2838
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2815
2839
|
`uiInteractionHandler: dispatching synthetic list ordinal \u2014 componentId="${rawComponentId}" list=${ordinal.listIndex} item=${ordinal.itemIndex}`
|
|
2816
2840
|
);
|
|
2817
2841
|
const result = pressListItemAtOrdinal(ordinal.listIndex, ordinal.itemIndex);
|
|
2818
2842
|
if (result.ok) {
|
|
2819
|
-
|
|
2843
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2820
2844
|
`uiInteractionHandler: synthetic ordinal press succeeded (container=${result.containerType ?? "List"})`
|
|
2821
2845
|
);
|
|
2822
2846
|
return { success: true };
|
|
2823
2847
|
}
|
|
2824
|
-
const screen =
|
|
2848
|
+
const screen = chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0;
|
|
2825
2849
|
if (result.reason === "list-not-found" || result.reason === "item-not-found") {
|
|
2826
2850
|
return {
|
|
2827
2851
|
success: false,
|
|
@@ -2862,7 +2886,7 @@ function uiInteractionHandler(payload, context) {
|
|
|
2862
2886
|
};
|
|
2863
2887
|
}
|
|
2864
2888
|
const componentId = resolveComponentId(rawComponentId, registry, actionStr);
|
|
2865
|
-
|
|
2889
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2866
2890
|
`uiInteractionHandler: resolved componentId="${payload.componentId}" \u2192 "${componentId}"`
|
|
2867
2891
|
);
|
|
2868
2892
|
const target = registry.getTarget(componentId);
|
|
@@ -2915,7 +2939,7 @@ function uiInteractionHandler(payload, context) {
|
|
|
2915
2939
|
return { success: false, error: err?.message ?? "Focus failed" };
|
|
2916
2940
|
}
|
|
2917
2941
|
}
|
|
2918
|
-
|
|
2942
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2919
2943
|
`uiInteractionHandler: registry miss for "${componentId}", falling back to fiber tree`
|
|
2920
2944
|
);
|
|
2921
2945
|
const namedToggle = dispatchIdentifiedToggle(componentId, actionStr);
|
|
@@ -2927,7 +2951,7 @@ function uiInteractionHandler(payload, context) {
|
|
|
2927
2951
|
try {
|
|
2928
2952
|
if (actionStr === "press" && handle.kind === "target" && handle.press) {
|
|
2929
2953
|
handle.press();
|
|
2930
|
-
|
|
2954
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
2931
2955
|
`uiInteractionHandler: fiber fallback press succeeded for "${componentId}"`
|
|
2932
2956
|
);
|
|
2933
2957
|
return { success: true };
|
|
@@ -3012,7 +3036,7 @@ function submitLabelHintsSubmit(label) {
|
|
|
3012
3036
|
return SUBMIT_LABEL_HINT_RE.test(trimmed);
|
|
3013
3037
|
}
|
|
3014
3038
|
function screenDeclaresSubmitAction(screenName) {
|
|
3015
|
-
const meta =
|
|
3039
|
+
const meta = chunkQAZ4TN3Z_js.getScreenMetadata(screenName);
|
|
3016
3040
|
return Array.isArray(meta?.actions) && meta.actions.some(
|
|
3017
3041
|
(action) => typeof action === "object" && action !== null && action.type === "submit"
|
|
3018
3042
|
);
|
|
@@ -3045,7 +3069,7 @@ function resolveFormScreensForSubmit(screen, activePath, registry) {
|
|
|
3045
3069
|
} else {
|
|
3046
3070
|
push(screen);
|
|
3047
3071
|
}
|
|
3048
|
-
push(
|
|
3072
|
+
push(chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0);
|
|
3049
3073
|
const withSubmit = [];
|
|
3050
3074
|
const rest = [];
|
|
3051
3075
|
for (const name of ordered) {
|
|
@@ -3063,7 +3087,7 @@ function collectSubmitTargetCandidates(screens, registry) {
|
|
|
3063
3087
|
candidates.push(id);
|
|
3064
3088
|
};
|
|
3065
3089
|
for (const screenName of screens) {
|
|
3066
|
-
const meta =
|
|
3090
|
+
const meta = chunkQAZ4TN3Z_js.getScreenMetadata(screenName);
|
|
3067
3091
|
const submitMeta = Array.isArray(meta?.actions) ? meta.actions.find(
|
|
3068
3092
|
(action) => typeof action === "object" && action !== null && action.type === "submit"
|
|
3069
3093
|
) : void 0;
|
|
@@ -3107,8 +3131,8 @@ function readVisibleValidation(fieldId, label) {
|
|
|
3107
3131
|
return void 0;
|
|
3108
3132
|
}
|
|
3109
3133
|
function resolveScreenContext() {
|
|
3110
|
-
const activePath =
|
|
3111
|
-
const screen = activePath[activePath.length - 1] ??
|
|
3134
|
+
const activePath = chunkQAZ4TN3Z_js.getActiveRouteNames();
|
|
3135
|
+
const screen = activePath[activePath.length - 1] ?? chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0;
|
|
3112
3136
|
return { screen, activePath };
|
|
3113
3137
|
}
|
|
3114
3138
|
function selectValueApplied(fieldId, requestedValue, currentValue, registry) {
|
|
@@ -3116,36 +3140,36 @@ function selectValueApplied(fieldId, requestedValue, currentValue, registry) {
|
|
|
3116
3140
|
if (!requested) return false;
|
|
3117
3141
|
const meta = getMetadataField(fieldId, registry);
|
|
3118
3142
|
const options = Array.isArray(meta?.options) ? meta.options : [];
|
|
3119
|
-
const requestedNorm =
|
|
3120
|
-
const currentNorm =
|
|
3143
|
+
const requestedNorm = chunkQAZ4TN3Z_js.normalize3(requested);
|
|
3144
|
+
const currentNorm = chunkQAZ4TN3Z_js.normalize3(currentValue);
|
|
3121
3145
|
if (currentNorm === requestedNorm) return true;
|
|
3122
3146
|
for (const option of options) {
|
|
3123
3147
|
const value = typeof option?.value === "string" ? option.value : "";
|
|
3124
3148
|
const label = typeof option?.label === "string" ? option.label : "";
|
|
3125
|
-
if (
|
|
3126
|
-
if (
|
|
3127
|
-
if (
|
|
3149
|
+
if (chunkQAZ4TN3Z_js.normalize3(value) === requestedNorm && chunkQAZ4TN3Z_js.normalize3(label) === currentNorm) return true;
|
|
3150
|
+
if (chunkQAZ4TN3Z_js.normalize3(label) === requestedNorm && chunkQAZ4TN3Z_js.normalize3(label) === currentNorm) return true;
|
|
3151
|
+
if (chunkQAZ4TN3Z_js.normalize3(value) === requestedNorm && chunkQAZ4TN3Z_js.normalize3(value) === currentNorm) return true;
|
|
3128
3152
|
}
|
|
3129
3153
|
return false;
|
|
3130
3154
|
}
|
|
3131
3155
|
function getMetadataField(fieldId, registry) {
|
|
3132
3156
|
const screens = /* @__PURE__ */ new Set();
|
|
3133
|
-
for (const name of
|
|
3134
|
-
const current2 =
|
|
3157
|
+
for (const name of chunkQAZ4TN3Z_js.getActiveRouteNames()) screens.add(name);
|
|
3158
|
+
const current2 = chunkQAZ4TN3Z_js.getCurrentScreen();
|
|
3135
3159
|
if (current2) screens.add(current2);
|
|
3136
3160
|
if (registry) {
|
|
3137
3161
|
for (const comp of registry.snapshot()) {
|
|
3138
3162
|
if (comp.kind === "field" && comp.screen) screens.add(comp.screen);
|
|
3139
3163
|
}
|
|
3140
3164
|
}
|
|
3141
|
-
const needle =
|
|
3165
|
+
const needle = chunkQAZ4TN3Z_js.normalize3(fieldId);
|
|
3142
3166
|
for (const screenName of screens) {
|
|
3143
|
-
const screenMeta =
|
|
3167
|
+
const screenMeta = chunkQAZ4TN3Z_js.getScreenMetadata(screenName);
|
|
3144
3168
|
const fields = Array.isArray(screenMeta?.fields) ? screenMeta.fields : [];
|
|
3145
3169
|
const match = fields.find((field) => {
|
|
3146
3170
|
if (!field || typeof field !== "object") return false;
|
|
3147
|
-
const id = typeof field.id === "string" ?
|
|
3148
|
-
const label = typeof field.label === "string" ?
|
|
3171
|
+
const id = typeof field.id === "string" ? chunkQAZ4TN3Z_js.normalize3(field.id) : "";
|
|
3172
|
+
const label = typeof field.label === "string" ? chunkQAZ4TN3Z_js.normalize3(field.label) : "";
|
|
3149
3173
|
return id === needle || label === needle;
|
|
3150
3174
|
});
|
|
3151
3175
|
if (match) return match;
|
|
@@ -3157,11 +3181,11 @@ function resolveSelectOption(fieldId, value, registry) {
|
|
|
3157
3181
|
if (!requested) return void 0;
|
|
3158
3182
|
const meta = getMetadataField(fieldId, registry);
|
|
3159
3183
|
const options = Array.isArray(meta?.options) ? meta.options : [];
|
|
3160
|
-
const requestedNorm =
|
|
3184
|
+
const requestedNorm = chunkQAZ4TN3Z_js.normalize3(requested);
|
|
3161
3185
|
for (const option of options) {
|
|
3162
3186
|
const optionValue = typeof option?.value === "string" ? option.value : "";
|
|
3163
3187
|
const optionLabel = typeof option?.label === "string" ? option.label : "";
|
|
3164
|
-
if (
|
|
3188
|
+
if (chunkQAZ4TN3Z_js.normalize3(optionValue) === requestedNorm || chunkQAZ4TN3Z_js.normalize3(optionLabel) === requestedNorm) {
|
|
3165
3189
|
return { value: optionValue, label: optionLabel };
|
|
3166
3190
|
}
|
|
3167
3191
|
}
|
|
@@ -3211,12 +3235,12 @@ async function tryPressSelectOption(fieldId, value, registry, options = {}) {
|
|
|
3211
3235
|
return {
|
|
3212
3236
|
success: false,
|
|
3213
3237
|
error: `No pressable option found for select field "${fieldId}"`,
|
|
3214
|
-
diagnose: { category: "component-not-found", fieldId, screen:
|
|
3238
|
+
diagnose: { category: "component-not-found", fieldId, screen: chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0 }
|
|
3215
3239
|
};
|
|
3216
3240
|
}
|
|
3217
3241
|
function normalizeFieldType(type) {
|
|
3218
3242
|
if (typeof type !== "string") return void 0;
|
|
3219
|
-
const normalized =
|
|
3243
|
+
const normalized = chunkQAZ4TN3Z_js.normalize3(type);
|
|
3220
3244
|
if (normalized === "select" || normalized === "picker" || normalized === "dropdown")
|
|
3221
3245
|
return "select";
|
|
3222
3246
|
if (normalized === "toggle" || normalized === "switch" || normalized === "checkbox")
|
|
@@ -3246,7 +3270,7 @@ function fieldCueTerms(fieldId, label) {
|
|
|
3246
3270
|
);
|
|
3247
3271
|
const terms = /* @__PURE__ */ new Set();
|
|
3248
3272
|
for (const value of raw) {
|
|
3249
|
-
const normalized =
|
|
3273
|
+
const normalized = chunkQAZ4TN3Z_js.normalize3(value);
|
|
3250
3274
|
if (normalized.length >= 3 && normalized !== "id") terms.add(normalized);
|
|
3251
3275
|
}
|
|
3252
3276
|
return [...terms];
|
|
@@ -3254,17 +3278,17 @@ function fieldCueTerms(fieldId, label) {
|
|
|
3254
3278
|
function snapshotHasFieldCue(snap, fieldId, label) {
|
|
3255
3279
|
const terms = fieldCueTerms(fieldId, label);
|
|
3256
3280
|
if (terms.length === 0) return false;
|
|
3257
|
-
const visible = [...snap.texts ?? [], ...(snap.buttons ?? []).map((b) => b.label ?? b.id ?? "")].map((text) =>
|
|
3281
|
+
const visible = [...snap.texts ?? [], ...(snap.buttons ?? []).map((b) => b.label ?? b.id ?? "")].map((text) => chunkQAZ4TN3Z_js.normalize3(text)).filter(Boolean);
|
|
3258
3282
|
return visible.some((text) => terms.some((term) => text.includes(term) || term.includes(text)));
|
|
3259
3283
|
}
|
|
3260
3284
|
function scoreCandidateText(value, texts) {
|
|
3261
|
-
const valueNorm =
|
|
3285
|
+
const valueNorm = chunkQAZ4TN3Z_js.normalize3(String(value ?? ""));
|
|
3262
3286
|
if (!valueNorm) return 0;
|
|
3263
3287
|
let best = 0;
|
|
3264
3288
|
for (const text of texts) {
|
|
3265
|
-
const textNorm =
|
|
3289
|
+
const textNorm = chunkQAZ4TN3Z_js.normalize3(text);
|
|
3266
3290
|
if (!textNorm) continue;
|
|
3267
|
-
best = Math.max(best,
|
|
3291
|
+
best = Math.max(best, chunkQAZ4TN3Z_js.matchScore(valueNorm, textNorm));
|
|
3268
3292
|
}
|
|
3269
3293
|
return best;
|
|
3270
3294
|
}
|
|
@@ -3278,7 +3302,7 @@ function optionTexts(option) {
|
|
|
3278
3302
|
function buildChoiceCandidates(snap, fieldId, value, allowFirstVisibleWhenNoCue, registry) {
|
|
3279
3303
|
const fieldLabel = getFieldLabel(fieldId, registry);
|
|
3280
3304
|
const fieldCueVisible = snapshotHasFieldCue(snap, fieldId, fieldLabel);
|
|
3281
|
-
const genericValue =
|
|
3305
|
+
const genericValue = chunkQAZ4TN3Z_js.isGenericSelectValue(value);
|
|
3282
3306
|
const candidates = [];
|
|
3283
3307
|
let order = 0;
|
|
3284
3308
|
const choiceGroups = snap.choiceGroups ?? [];
|
|
@@ -3290,7 +3314,7 @@ function buildChoiceCandidates(snap, fieldId, value, allowFirstVisibleWhenNoCue,
|
|
|
3290
3314
|
const groupCueScore = Math.max(
|
|
3291
3315
|
globalCueScore,
|
|
3292
3316
|
...groupTexts.map((text) => {
|
|
3293
|
-
const normalized =
|
|
3317
|
+
const normalized = chunkQAZ4TN3Z_js.normalize3(text);
|
|
3294
3318
|
return fieldCueTerms(fieldId, fieldLabel).some(
|
|
3295
3319
|
(term) => normalized.includes(term) || term.includes(normalized)
|
|
3296
3320
|
) ? 80 : 0;
|
|
@@ -3327,7 +3351,7 @@ function buildChoiceCandidates(snap, fieldId, value, allowFirstVisibleWhenNoCue,
|
|
|
3327
3351
|
const elementCueScore = Math.max(
|
|
3328
3352
|
fieldCueVisible && elements.length <= 12 ? 50 : 0,
|
|
3329
3353
|
...cueTexts.map((text) => {
|
|
3330
|
-
const normalized =
|
|
3354
|
+
const normalized = chunkQAZ4TN3Z_js.normalize3(text);
|
|
3331
3355
|
return fieldTerms.some((term) => normalized.includes(term) || term.includes(normalized)) ? 80 : 0;
|
|
3332
3356
|
})
|
|
3333
3357
|
);
|
|
@@ -3385,7 +3409,7 @@ async function selectVisibleChoiceAsync(fieldId, value, registry, options) {
|
|
|
3385
3409
|
return {
|
|
3386
3410
|
success: false,
|
|
3387
3411
|
error: err?.message ?? "Could not capture visible choices",
|
|
3388
|
-
diagnose: { category: "unknown", fieldId, screen:
|
|
3412
|
+
diagnose: { category: "unknown", fieldId, screen: chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0 }
|
|
3389
3413
|
};
|
|
3390
3414
|
}
|
|
3391
3415
|
const candidates = buildChoiceCandidates(
|
|
@@ -3403,7 +3427,7 @@ async function selectVisibleChoiceAsync(fieldId, value, registry, options) {
|
|
|
3403
3427
|
diagnose: {
|
|
3404
3428
|
category: "component-not-found",
|
|
3405
3429
|
fieldId,
|
|
3406
|
-
screen:
|
|
3430
|
+
screen: chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0
|
|
3407
3431
|
}
|
|
3408
3432
|
};
|
|
3409
3433
|
}
|
|
@@ -3417,7 +3441,7 @@ async function selectVisibleChoiceAsync(fieldId, value, registry, options) {
|
|
|
3417
3441
|
}
|
|
3418
3442
|
function isContinuationButton(label) {
|
|
3419
3443
|
if (!label) return false;
|
|
3420
|
-
return /^(next|continue|proximo|prox|continuar|avancar|avançar)$/i.test(
|
|
3444
|
+
return /^(next|continue|proximo|prox|continuar|avancar|avançar)$/i.test(chunkQAZ4TN3Z_js.normalize3(label));
|
|
3421
3445
|
}
|
|
3422
3446
|
function pressContinuationButton(registry) {
|
|
3423
3447
|
const snap = captureSnapshot();
|
|
@@ -3430,40 +3454,44 @@ function pressContinuationButton(registry) {
|
|
|
3430
3454
|
return {
|
|
3431
3455
|
success: false,
|
|
3432
3456
|
error: "No enabled continuation button is visible",
|
|
3433
|
-
diagnose: { category: "component-not-found", screen:
|
|
3457
|
+
diagnose: { category: "component-not-found", screen: chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0 }
|
|
3434
3458
|
};
|
|
3435
3459
|
}
|
|
3436
3460
|
return pressTargetByIdOrLabel(id, registry);
|
|
3437
3461
|
}
|
|
3438
3462
|
function findField(fieldId, registry) {
|
|
3439
|
-
|
|
3463
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(`findField: searching for fieldId="${fieldId}"`);
|
|
3440
3464
|
const exact = registry.getField(fieldId);
|
|
3441
3465
|
if (exact) {
|
|
3442
|
-
|
|
3466
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(`findField: FOUND exact match for fieldId="${fieldId}"`);
|
|
3443
3467
|
return exact;
|
|
3444
3468
|
}
|
|
3445
3469
|
const lower = fieldId.toLowerCase();
|
|
3446
3470
|
const snapshot = registry.snapshot();
|
|
3447
3471
|
for (const comp of snapshot) {
|
|
3448
3472
|
if (comp.kind === "field" && comp.id.toLowerCase() === lower) {
|
|
3449
|
-
|
|
3473
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
3450
3474
|
`findField: FOUND case-insensitive match: registered="${comp.id}" for searched="${fieldId}"`
|
|
3451
3475
|
);
|
|
3452
3476
|
return registry.getField(comp.id);
|
|
3453
3477
|
}
|
|
3454
3478
|
}
|
|
3455
|
-
|
|
3456
|
-
|
|
3479
|
+
if (findInteractiveByIdentifier(fieldId, { kind: "field", minScore: IDENTITY_MATCH_SCORE })) {
|
|
3480
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(`findField: "${fieldId}" names a live input \u2014 not guessing in the registry`);
|
|
3481
|
+
return void 0;
|
|
3482
|
+
}
|
|
3483
|
+
const currentScreenForTieBreak = chunkQAZ4TN3Z_js.getCurrentScreen();
|
|
3484
|
+
const needle = chunkQAZ4TN3Z_js.normalize3(fieldId);
|
|
3457
3485
|
let bestComp;
|
|
3458
3486
|
let bestScore = 0;
|
|
3459
3487
|
let bestOnCurrentScreen = false;
|
|
3460
3488
|
for (const comp of snapshot) {
|
|
3461
3489
|
if (comp.kind !== "field") continue;
|
|
3462
|
-
const candidates = [
|
|
3463
|
-
if (comp.label) candidates.push(
|
|
3490
|
+
const candidates = [chunkQAZ4TN3Z_js.normalize3(comp.id)];
|
|
3491
|
+
if (comp.label) candidates.push(chunkQAZ4TN3Z_js.normalize3(comp.label));
|
|
3464
3492
|
let candidateScore = 0;
|
|
3465
3493
|
for (const cand of candidates) {
|
|
3466
|
-
const s =
|
|
3494
|
+
const s = chunkQAZ4TN3Z_js.matchScore(needle, cand);
|
|
3467
3495
|
if (s > candidateScore) candidateScore = s;
|
|
3468
3496
|
}
|
|
3469
3497
|
if (candidateScore === 0) continue;
|
|
@@ -3476,14 +3504,14 @@ function findField(fieldId, registry) {
|
|
|
3476
3504
|
}
|
|
3477
3505
|
}
|
|
3478
3506
|
if (bestComp && bestScore >= 75) {
|
|
3479
|
-
|
|
3507
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
3480
3508
|
`findField: scored match "${fieldId}" -> "${bestComp.id}" (label="${bestComp.label}", score=${bestScore})`
|
|
3481
3509
|
);
|
|
3482
3510
|
return registry.getField(bestComp.id);
|
|
3483
3511
|
}
|
|
3484
|
-
const currentScreen =
|
|
3512
|
+
const currentScreen = chunkQAZ4TN3Z_js.getCurrentScreen();
|
|
3485
3513
|
if (currentScreen) {
|
|
3486
|
-
const screenMeta =
|
|
3514
|
+
const screenMeta = chunkQAZ4TN3Z_js.getScreenMetadata(currentScreen);
|
|
3487
3515
|
const fields = screenMeta?.fields;
|
|
3488
3516
|
if (fields && Array.isArray(fields)) {
|
|
3489
3517
|
const metaField = fields.find(
|
|
@@ -3491,19 +3519,19 @@ function findField(fieldId, registry) {
|
|
|
3491
3519
|
);
|
|
3492
3520
|
if (metaField && typeof metaField === "object" && metaField.label) {
|
|
3493
3521
|
const metaLabel = metaField.label;
|
|
3494
|
-
const metaNeedle =
|
|
3522
|
+
const metaNeedle = chunkQAZ4TN3Z_js.normalize3(metaLabel);
|
|
3495
3523
|
let mBest;
|
|
3496
3524
|
let mBestScore = 0;
|
|
3497
3525
|
for (const comp of snapshot) {
|
|
3498
3526
|
if (comp.kind !== "field" || !comp.label) continue;
|
|
3499
|
-
const score =
|
|
3527
|
+
const score = chunkQAZ4TN3Z_js.matchScore(metaNeedle, chunkQAZ4TN3Z_js.normalize3(comp.label));
|
|
3500
3528
|
if (score > mBestScore) {
|
|
3501
3529
|
mBestScore = score;
|
|
3502
3530
|
mBest = comp;
|
|
3503
3531
|
}
|
|
3504
3532
|
}
|
|
3505
3533
|
if (mBest && mBestScore >= 60) {
|
|
3506
|
-
|
|
3534
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
3507
3535
|
`findField: FOUND via screen metadata translation: fieldId="${fieldId}" -> metaLabel="${metaLabel}" -> registered="${mBest.id}" (score=${mBestScore})`
|
|
3508
3536
|
);
|
|
3509
3537
|
return registry.getField(mBest.id);
|
|
@@ -3512,34 +3540,34 @@ function findField(fieldId, registry) {
|
|
|
3512
3540
|
}
|
|
3513
3541
|
}
|
|
3514
3542
|
if (bestComp && bestScore >= 40) {
|
|
3515
|
-
|
|
3543
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
3516
3544
|
`findField: weak substring match "${fieldId}" -> "${bestComp.id}" (label="${bestComp.label}", score=${bestScore})`
|
|
3517
3545
|
);
|
|
3518
3546
|
return registry.getField(bestComp.id);
|
|
3519
3547
|
}
|
|
3520
|
-
|
|
3548
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn(
|
|
3521
3549
|
`findField: NOT FOUND \u2014 fieldId="${fieldId}" not in registry. Available fields: ${snapshot.filter((c) => c.kind === "field").map((c) => `"${c.id}" (label: ${c.label})`).join(", ") || "none"}`
|
|
3522
3550
|
);
|
|
3523
3551
|
return void 0;
|
|
3524
3552
|
}
|
|
3525
3553
|
function findToggle(fieldId, registry) {
|
|
3526
|
-
|
|
3554
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(`findToggle: searching for fieldId="${fieldId}"`);
|
|
3527
3555
|
const exact = registry.getToggle(fieldId);
|
|
3528
3556
|
if (exact) {
|
|
3529
|
-
|
|
3557
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(`findToggle: FOUND exact match for "${fieldId}"`);
|
|
3530
3558
|
return exact;
|
|
3531
3559
|
}
|
|
3532
3560
|
const lower = fieldId.toLowerCase();
|
|
3533
3561
|
const snapshot = registry.snapshot();
|
|
3534
3562
|
for (const comp of snapshot) {
|
|
3535
3563
|
if (comp.kind === "toggle" && comp.id.toLowerCase() === lower) {
|
|
3536
|
-
|
|
3564
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
3537
3565
|
`findToggle: FOUND case-insensitive match: registered="${comp.id}" for searched="${fieldId}"`
|
|
3538
3566
|
);
|
|
3539
3567
|
return registry.getToggle(comp.id);
|
|
3540
3568
|
}
|
|
3541
3569
|
}
|
|
3542
|
-
|
|
3570
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn(
|
|
3543
3571
|
`findToggle: NOT FOUND \u2014 fieldId="${fieldId}" not in registry. Available toggles: ${snapshot.filter((c) => c.kind === "toggle").map((c) => `"${c.id}"`).join(", ") || "none"}`
|
|
3544
3572
|
);
|
|
3545
3573
|
return void 0;
|
|
@@ -3550,7 +3578,7 @@ function findSlider(fieldId, registry) {
|
|
|
3550
3578
|
const lower = fieldId.toLowerCase();
|
|
3551
3579
|
for (const comp of registry.snapshot()) {
|
|
3552
3580
|
if (comp.kind === "slider" && comp.id.toLowerCase() === lower) {
|
|
3553
|
-
|
|
3581
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
3554
3582
|
`findSlider: FOUND case-insensitive match: registered="${comp.id}" for searched="${fieldId}"`
|
|
3555
3583
|
);
|
|
3556
3584
|
return registry.getSlider(comp.id);
|
|
@@ -3561,13 +3589,13 @@ function findSlider(fieldId, registry) {
|
|
|
3561
3589
|
var sleep3 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
3562
3590
|
async function formFillHandler(payload, context) {
|
|
3563
3591
|
const { permissions } = context;
|
|
3564
|
-
const registry = context.registry ??
|
|
3592
|
+
const registry = context.registry ?? chunkQAZ4TN3Z_js.componentRegistry;
|
|
3565
3593
|
const { screen, activePath } = resolveScreenContext();
|
|
3566
3594
|
const screenPath = activePath.length > 1 ? activePath.join("/") : screen;
|
|
3567
3595
|
if (!permissions.canFillForms) {
|
|
3568
3596
|
return {
|
|
3569
3597
|
success: false,
|
|
3570
|
-
error:
|
|
3598
|
+
error: chunkQAZ4TN3Z_js.permissionDeniedMessage("Form filling", "canFillForms"),
|
|
3571
3599
|
diagnose: { category: "unknown", screen: screenPath, recoverable: false }
|
|
3572
3600
|
};
|
|
3573
3601
|
}
|
|
@@ -3580,11 +3608,11 @@ async function formFillHandler(payload, context) {
|
|
|
3580
3608
|
}
|
|
3581
3609
|
const registrySnapshot = registry.snapshot();
|
|
3582
3610
|
if (registrySnapshot.length === 0) {
|
|
3583
|
-
|
|
3611
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn(
|
|
3584
3612
|
"formFillHandler: registry is EMPTY \u2014 auto-tracking may not be active. Ensure enableAppilotsAutoTracking() runs before components mount."
|
|
3585
3613
|
);
|
|
3586
3614
|
} else {
|
|
3587
|
-
|
|
3615
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
3588
3616
|
`[Appilots formFillHandler] Registry has ${registrySnapshot.length} components:`,
|
|
3589
3617
|
registrySnapshot.map((c) => `${c.kind}:${c.id}`).join(", ")
|
|
3590
3618
|
);
|
|
@@ -3592,7 +3620,7 @@ async function formFillHandler(payload, context) {
|
|
|
3592
3620
|
const fieldResults = [];
|
|
3593
3621
|
let allSuccess = true;
|
|
3594
3622
|
let selectedChoiceThisBatch = false;
|
|
3595
|
-
|
|
3623
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(`formFillHandler: processing ${payload.fields.length} fields`);
|
|
3596
3624
|
const availableFieldIds = () => registry.snapshot().filter((comp) => comp.kind === "field").map((comp) => `${comp.id}${comp.label ? ` (${comp.label})` : ""}`).slice(0, 8);
|
|
3597
3625
|
const isElementIdField = (field) => typeof field.fieldId === "string" && field.fieldId.trim().toLowerCase().startsWith("el:");
|
|
3598
3626
|
for (const field of payload.fields.filter(isElementIdField)) {
|
|
@@ -3619,8 +3647,8 @@ async function formFillHandler(payload, context) {
|
|
|
3619
3647
|
const { fieldId, fieldType, value } = field;
|
|
3620
3648
|
const effectiveFieldType = getEffectiveFieldType(fieldId, fieldType, registry);
|
|
3621
3649
|
let selectFailure;
|
|
3622
|
-
|
|
3623
|
-
`formFillHandler: looking up fieldId="${fieldId}" fieldType="${fieldType}" effectiveFieldType="${effectiveFieldType}" value=${
|
|
3650
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
3651
|
+
`formFillHandler: looking up fieldId="${fieldId}" fieldType="${fieldType}" effectiveFieldType="${effectiveFieldType}" value=${chunkQAZ4TN3Z_js.describeValue(value)}`
|
|
3624
3652
|
);
|
|
3625
3653
|
const fieldEntry = findField(fieldId, registry);
|
|
3626
3654
|
if (fieldEntry) {
|
|
@@ -3640,7 +3668,7 @@ async function formFillHandler(payload, context) {
|
|
|
3640
3668
|
allSuccess = false;
|
|
3641
3669
|
continue;
|
|
3642
3670
|
}
|
|
3643
|
-
|
|
3671
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
3644
3672
|
`formFillHandler: found field "${fieldId}" via registry, calling setValue(<${String(value).length} chars>)`
|
|
3645
3673
|
);
|
|
3646
3674
|
const beforeValue = effectiveFieldType === "date" ? fieldEntry.getValue?.() ?? "" : void 0;
|
|
@@ -3693,7 +3721,7 @@ async function formFillHandler(payload, context) {
|
|
|
3693
3721
|
after = fieldEntry.getValue?.() ?? "";
|
|
3694
3722
|
}
|
|
3695
3723
|
if (!selectValueApplied(fieldId, value, after, registry)) {
|
|
3696
|
-
|
|
3724
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn(
|
|
3697
3725
|
`formFillHandler: select field "${fieldId}" setValue did not stick (wrote <${String(value).length} chars>, current is <${String(after ?? "").length} chars>), trying visible choice fallback`
|
|
3698
3726
|
);
|
|
3699
3727
|
const selectResult = await selectVisibleChoice(fieldId, value, registry, {
|
|
@@ -3818,7 +3846,7 @@ async function formFillHandler(payload, context) {
|
|
|
3818
3846
|
}
|
|
3819
3847
|
if (selectResult.success) {
|
|
3820
3848
|
selectedChoiceThisBatch = true;
|
|
3821
|
-
|
|
3849
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
3822
3850
|
`formFillHandler: selected visible option for "${fieldId}"` + (selectResult.selectedLabel ? ` \u2192 "${selectResult.selectedLabel}"` : "")
|
|
3823
3851
|
);
|
|
3824
3852
|
await sleep3(120);
|
|
@@ -3827,7 +3855,7 @@ async function formFillHandler(payload, context) {
|
|
|
3827
3855
|
}
|
|
3828
3856
|
selectFailure = selectResult;
|
|
3829
3857
|
}
|
|
3830
|
-
|
|
3858
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(`formFillHandler: registry miss for "${fieldId}", falling back to fiber tree`);
|
|
3831
3859
|
const handle = findInteractiveByIdentifier(fieldId, {
|
|
3832
3860
|
kind: effectiveFieldType === "toggle" ? "toggle" : "field"
|
|
3833
3861
|
});
|
|
@@ -3848,7 +3876,7 @@ async function formFillHandler(payload, context) {
|
|
|
3848
3876
|
allSuccess = false;
|
|
3849
3877
|
continue;
|
|
3850
3878
|
}
|
|
3851
|
-
setSpotlightTarget(handle.measure?.() ?? null, handle.label);
|
|
3879
|
+
setSpotlightTarget(handle.measure?.() ?? null, handle.label, "fill");
|
|
3852
3880
|
handle.focus?.();
|
|
3853
3881
|
handle.setValue(value);
|
|
3854
3882
|
if (handle.kind === "field" && !await completeTextEdit(fieldId, value, void 0, handle)) {
|
|
@@ -3861,7 +3889,7 @@ async function formFillHandler(payload, context) {
|
|
|
3861
3889
|
allSuccess = false;
|
|
3862
3890
|
continue;
|
|
3863
3891
|
}
|
|
3864
|
-
|
|
3892
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
3865
3893
|
`formFillHandler: fiber fallback succeeded for "${fieldId}" \u2192 label="${handle.label}"`
|
|
3866
3894
|
);
|
|
3867
3895
|
fieldResults.push({ fieldId, success: true });
|
|
@@ -3908,7 +3936,7 @@ async function formFillHandler(payload, context) {
|
|
|
3908
3936
|
}
|
|
3909
3937
|
if (!allSuccess) {
|
|
3910
3938
|
const failedIds = fieldResults.filter((result) => !result.success).map((result) => result.fieldId);
|
|
3911
|
-
|
|
3939
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn(
|
|
3912
3940
|
"formFillHandler: submitAfterFill=true requested but some fields failed; NOT submitting" + (failedIds.length > 0 ? ` (failed: ${failedIds.join(", ")})` : "")
|
|
3913
3941
|
);
|
|
3914
3942
|
} else {
|
|
@@ -3927,7 +3955,7 @@ async function formFillHandler(payload, context) {
|
|
|
3927
3955
|
registry
|
|
3928
3956
|
);
|
|
3929
3957
|
if (!submitResult.success) {
|
|
3930
|
-
|
|
3958
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn(`formFillHandler: submitAfterFill failed \u2014 ${submitResult.error}`);
|
|
3931
3959
|
return {
|
|
3932
3960
|
success: false,
|
|
3933
3961
|
error: submitResult.error,
|
|
@@ -3940,7 +3968,7 @@ async function formFillHandler(payload, context) {
|
|
|
3940
3968
|
beforeTexts: beforeSubmitTexts
|
|
3941
3969
|
});
|
|
3942
3970
|
if (postSubmit.status === "pending") {
|
|
3943
|
-
|
|
3971
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn(`formFillHandler: submit still pending \u2014 ${postSubmit.message}`);
|
|
3944
3972
|
return {
|
|
3945
3973
|
success: false,
|
|
3946
3974
|
error: postSubmit.message,
|
|
@@ -3949,7 +3977,7 @@ async function formFillHandler(payload, context) {
|
|
|
3949
3977
|
};
|
|
3950
3978
|
}
|
|
3951
3979
|
if (postSubmit.status === "failure") {
|
|
3952
|
-
|
|
3980
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn(
|
|
3953
3981
|
`formFillHandler: submit rejected by visible validation \u2014 ${postSubmit.message}`
|
|
3954
3982
|
);
|
|
3955
3983
|
return {
|
|
@@ -3967,7 +3995,7 @@ async function formFillHandler(payload, context) {
|
|
|
3967
3995
|
if (postSubmit.status === "unverified") {
|
|
3968
3996
|
return { success: true, fieldResults, effect: "unknown" };
|
|
3969
3997
|
}
|
|
3970
|
-
|
|
3998
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog("formFillHandler: submitAfterFill \u2014 submit completed");
|
|
3971
3999
|
}
|
|
3972
4000
|
}
|
|
3973
4001
|
const aggregatedDiagnose = aggregateFieldDiagnoses(fieldResults, screenPath);
|
|
@@ -3979,17 +4007,17 @@ async function formFillHandler(payload, context) {
|
|
|
3979
4007
|
};
|
|
3980
4008
|
}
|
|
3981
4009
|
function pressSubmitButton(context, registry) {
|
|
3982
|
-
const activePath = context.activePath ??
|
|
4010
|
+
const activePath = context.activePath ?? chunkQAZ4TN3Z_js.getActiveRouteNames();
|
|
3983
4011
|
const hintScreen = context.screen ?? context.screenPath;
|
|
3984
4012
|
const formScreens = resolveFormScreensForSubmit(hintScreen, activePath, registry);
|
|
3985
|
-
const resolvedScreen = formScreens.find((name) => screenDeclaresSubmit(name)) ?? formScreens[0] ?? hintScreen ??
|
|
4013
|
+
const resolvedScreen = formScreens.find((name) => screenDeclaresSubmit(name)) ?? formScreens[0] ?? hintScreen ?? chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0;
|
|
3986
4014
|
const candidates = collectSubmitTargetCandidates(formScreens, registry);
|
|
3987
4015
|
for (const candidate of candidates) {
|
|
3988
4016
|
const target = registry.getTarget(candidate);
|
|
3989
4017
|
if (target) {
|
|
3990
4018
|
try {
|
|
3991
4019
|
target.press();
|
|
3992
|
-
|
|
4020
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
3993
4021
|
`formFillHandler: submitAfterFill \u2014 pressed registry target "${candidate}"` + (resolvedScreen ? ` on screen "${resolvedScreen}"` : "")
|
|
3994
4022
|
);
|
|
3995
4023
|
return { success: true, pressedTargetId: candidate };
|
|
@@ -4003,7 +4031,7 @@ function pressSubmitButton(context, registry) {
|
|
|
4003
4031
|
}
|
|
4004
4032
|
}
|
|
4005
4033
|
for (const screenName of formScreens) {
|
|
4006
|
-
const screenMeta =
|
|
4034
|
+
const screenMeta = chunkQAZ4TN3Z_js.getScreenMetadata(screenName);
|
|
4007
4035
|
const submitMeta = Array.isArray(screenMeta?.actions) ? screenMeta.actions.find(
|
|
4008
4036
|
(action) => typeof action === "object" && action !== null && action.type === "submit"
|
|
4009
4037
|
) : void 0;
|
|
@@ -4014,7 +4042,7 @@ function pressSubmitButton(context, registry) {
|
|
|
4014
4042
|
if (handle?.press) {
|
|
4015
4043
|
try {
|
|
4016
4044
|
handle.press();
|
|
4017
|
-
|
|
4045
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(`formFillHandler: submitAfterFill \u2014 fiber fallback "${submitLabel}"`);
|
|
4018
4046
|
return { success: true, pressedTargetId: submitId ?? submitLabel };
|
|
4019
4047
|
} catch (err) {
|
|
4020
4048
|
return {
|
|
@@ -4036,7 +4064,7 @@ function pressSubmitButton(context, registry) {
|
|
|
4036
4064
|
if (id) {
|
|
4037
4065
|
const pressed = pressTargetByIdOrLabel(id, registry);
|
|
4038
4066
|
if (pressed.success) {
|
|
4039
|
-
|
|
4067
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(`formFillHandler: submitAfterFill \u2014 pressed visible heuristic "${id}"`);
|
|
4040
4068
|
return { success: true, pressedTargetId: id };
|
|
4041
4069
|
}
|
|
4042
4070
|
}
|
|
@@ -4050,7 +4078,7 @@ function pressSubmitButton(context, registry) {
|
|
|
4050
4078
|
if (target) {
|
|
4051
4079
|
try {
|
|
4052
4080
|
target.press();
|
|
4053
|
-
|
|
4081
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
4054
4082
|
`formFillHandler: submitAfterFill \u2014 pressed by label heuristic "${comp.label}"`
|
|
4055
4083
|
);
|
|
4056
4084
|
return { success: true, pressedTargetId: comp.id };
|
|
@@ -4066,7 +4094,7 @@ function pressSubmitButton(context, registry) {
|
|
|
4066
4094
|
for (const fieldId of [...context.filledFieldIds ?? []].reverse()) {
|
|
4067
4095
|
const handle = findInteractiveByIdentifier(fieldId, { kind: "field" });
|
|
4068
4096
|
if (handle?.submitFromKeyboard?.()) {
|
|
4069
|
-
|
|
4097
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(`formFillHandler: submitAfterFill \u2014 return key on "${fieldId}"`);
|
|
4070
4098
|
return { success: true, pressedTargetId: fieldId };
|
|
4071
4099
|
}
|
|
4072
4100
|
}
|
|
@@ -4109,11 +4137,11 @@ var PAGINATION_POLL_MS = 150;
|
|
|
4109
4137
|
var sleep4 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
4110
4138
|
async function settleAfterScroll() {
|
|
4111
4139
|
await sleep4(POST_SCROLL_MOUNT_MS);
|
|
4112
|
-
if (!
|
|
4140
|
+
if (!chunkQAZ4TN3Z_js.probeLoadingState(void 0, chunkQAZ4TN3Z_js.getCurrentScreen()).loading) return;
|
|
4113
4141
|
const deadline = Date.now() + PAGINATION_MAX_WAIT_MS;
|
|
4114
4142
|
while (Date.now() < deadline) {
|
|
4115
4143
|
await sleep4(PAGINATION_POLL_MS);
|
|
4116
|
-
if (!
|
|
4144
|
+
if (!chunkQAZ4TN3Z_js.probeLoadingState(void 0, chunkQAZ4TN3Z_js.getCurrentScreen()).loading) {
|
|
4117
4145
|
await sleep4(POST_SCROLL_MOUNT_MS);
|
|
4118
4146
|
return;
|
|
4119
4147
|
}
|
|
@@ -4126,12 +4154,12 @@ function buildDiagnose(category, targetId, candidates) {
|
|
|
4126
4154
|
return {
|
|
4127
4155
|
category,
|
|
4128
4156
|
targetId,
|
|
4129
|
-
screen:
|
|
4157
|
+
screen: chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0,
|
|
4130
4158
|
...candidates && candidates.length > 0 ? { candidates: candidates.slice(0, 8) } : {}
|
|
4131
4159
|
};
|
|
4132
4160
|
}
|
|
4133
4161
|
function resolveListEntry(listId) {
|
|
4134
|
-
const entries =
|
|
4162
|
+
const entries = chunkQAZ4TN3Z_js.listRegistry.snapshot();
|
|
4135
4163
|
if (entries.length === 0) return {};
|
|
4136
4164
|
if (listId) {
|
|
4137
4165
|
const wanted = normalizeId2(listId);
|
|
@@ -4156,7 +4184,7 @@ function pageOffset(metrics, direction) {
|
|
|
4156
4184
|
}
|
|
4157
4185
|
async function finishScroll(entry, before) {
|
|
4158
4186
|
await settleAfterScroll();
|
|
4159
|
-
const current2 =
|
|
4187
|
+
const current2 = chunkQAZ4TN3Z_js.listRegistry.get(entry.id) ?? entry;
|
|
4160
4188
|
const after = current2.getScrollMetrics?.();
|
|
4161
4189
|
const grew = typeof entry.itemCount === "number" && typeof current2.itemCount === "number" && current2.itemCount > entry.itemCount;
|
|
4162
4190
|
const moved = grew || !!(before && after && (Math.abs(after.offset - before.offset) > 2 || after.contentLength > before.contentLength + 2));
|
|
@@ -4172,7 +4200,7 @@ async function scrollListHandler(payload, context) {
|
|
|
4172
4200
|
if (!permissions.canInteractUI) {
|
|
4173
4201
|
return {
|
|
4174
4202
|
success: false,
|
|
4175
|
-
error:
|
|
4203
|
+
error: chunkQAZ4TN3Z_js.permissionDeniedMessage("UI interaction", "canInteractUI"),
|
|
4176
4204
|
diagnose: { ...buildDiagnose("unknown", payload.listId), recoverable: false }
|
|
4177
4205
|
};
|
|
4178
4206
|
}
|
|
@@ -4307,12 +4335,12 @@ function resolveActionHints(screen, pressedComponentId, actionPayload) {
|
|
|
4307
4335
|
if (typeof declared === "number") return { asyncBudgetMs: declared };
|
|
4308
4336
|
}
|
|
4309
4337
|
if (!screen || !pressedComponentId) return void 0;
|
|
4310
|
-
const meta =
|
|
4338
|
+
const meta = chunkQAZ4TN3Z_js.getScreenMetadata(screen);
|
|
4311
4339
|
const actions = meta?.actions;
|
|
4312
4340
|
if (!actions || actions.length === 0) return void 0;
|
|
4313
4341
|
for (const a of actions) {
|
|
4314
4342
|
if (typeof a === "string") continue;
|
|
4315
|
-
if (
|
|
4343
|
+
if (chunkQAZ4TN3Z_js.idLooselyMatches(a.id, pressedComponentId)) {
|
|
4316
4344
|
const inferred = a.appilotsInferred;
|
|
4317
4345
|
const declared = a.asyncBudgetMs;
|
|
4318
4346
|
const hints = {
|
|
@@ -4345,9 +4373,9 @@ function hashFieldValue(value) {
|
|
|
4345
4373
|
var DISCRETE_FIELD_TYPES = /* @__PURE__ */ new Set(["select", "date", "number"]);
|
|
4346
4374
|
function discreteFieldSignature() {
|
|
4347
4375
|
const sigs = [];
|
|
4348
|
-
for (const { id, kind } of
|
|
4376
|
+
for (const { id, kind } of chunkQAZ4TN3Z_js.componentRegistry.snapshot()) {
|
|
4349
4377
|
if (kind !== "field") continue;
|
|
4350
|
-
const entry =
|
|
4378
|
+
const entry = chunkQAZ4TN3Z_js.componentRegistry.getField(id);
|
|
4351
4379
|
if (!entry || !DISCRETE_FIELD_TYPES.has(entry.fieldType ?? "")) continue;
|
|
4352
4380
|
try {
|
|
4353
4381
|
sigs.push(`${id}:${hashFieldValue(String(entry.getValue() ?? ""))}`);
|
|
@@ -4358,8 +4386,8 @@ function discreteFieldSignature() {
|
|
|
4358
4386
|
}
|
|
4359
4387
|
function capturePreInteractionBaseline(payload) {
|
|
4360
4388
|
const targetId = targetIdFromPayload(payload);
|
|
4361
|
-
const screen =
|
|
4362
|
-
const probe =
|
|
4389
|
+
const screen = chunkQAZ4TN3Z_js.getCurrentScreen();
|
|
4390
|
+
const probe = chunkQAZ4TN3Z_js.probeLoadingState(targetId || null, screen);
|
|
4363
4391
|
return {
|
|
4364
4392
|
fingerprint: probe.fingerprint,
|
|
4365
4393
|
fields: discreteFieldSignature(),
|
|
@@ -4374,28 +4402,28 @@ async function waitForPostInteractionSettle(payload, preBaseline) {
|
|
|
4374
4402
|
const baselineFields = baseline.fields;
|
|
4375
4403
|
const readable = baseline.readable;
|
|
4376
4404
|
await sleepMs(100);
|
|
4377
|
-
const afterPress =
|
|
4405
|
+
const afterPress = chunkQAZ4TN3Z_js.probeLoadingState(targetId || null, chunkQAZ4TN3Z_js.getCurrentScreen());
|
|
4378
4406
|
const modalOrLoading = afterPress.modalOpen || afterPress.loading || afterPress.pressedDisabled;
|
|
4379
4407
|
const fingerprintChanged = afterPress.fingerprint !== baseline.fingerprint;
|
|
4380
4408
|
const verdict = () => {
|
|
4381
4409
|
if (!readable) return { effect: "unknown" };
|
|
4382
|
-
const settled =
|
|
4410
|
+
const settled = chunkQAZ4TN3Z_js.probeLoadingState(targetId || null, chunkQAZ4TN3Z_js.getCurrentScreen());
|
|
4383
4411
|
if (settled.fingerprint === "") return { effect: "unknown" };
|
|
4384
4412
|
if (discreteFieldSignature() !== baselineFields) return { effect: "changed" };
|
|
4385
4413
|
return { effect: settled.fingerprint !== baseline.fingerprint ? "changed" : "none" };
|
|
4386
4414
|
};
|
|
4387
4415
|
const declared = declaredBudgetMs(resolveActionHints(fromScreen, targetId || null, payload));
|
|
4388
|
-
const capMs = declared ?? (
|
|
4416
|
+
const capMs = declared ?? (chunkQAZ4TN3Z_js.isListItemPressTarget(targetId) ? 5e3 : 1e4);
|
|
4389
4417
|
if (modalOrLoading || fingerprintChanged) {
|
|
4390
|
-
await
|
|
4418
|
+
await chunkQAZ4TN3Z_js.waitForLoadingSettle({
|
|
4391
4419
|
pressedComponentId: targetId || null,
|
|
4392
4420
|
fromScreen,
|
|
4393
4421
|
maxMs: capMs
|
|
4394
4422
|
});
|
|
4395
4423
|
return verdict();
|
|
4396
4424
|
}
|
|
4397
|
-
if (
|
|
4398
|
-
await
|
|
4425
|
+
if (chunkQAZ4TN3Z_js.isListItemPressTarget(targetId)) {
|
|
4426
|
+
await chunkQAZ4TN3Z_js.waitForLoadingSettle({
|
|
4399
4427
|
fromScreen,
|
|
4400
4428
|
maxMs: 3e3
|
|
4401
4429
|
});
|
|
@@ -4410,7 +4438,7 @@ function validateActionPayload(action) {
|
|
|
4410
4438
|
error: message,
|
|
4411
4439
|
diagnose: {
|
|
4412
4440
|
category: "validation",
|
|
4413
|
-
screen:
|
|
4441
|
+
screen: chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0,
|
|
4414
4442
|
...ids ?? {}
|
|
4415
4443
|
}
|
|
4416
4444
|
});
|
|
@@ -4471,10 +4499,10 @@ function isDestructivePayload(payload) {
|
|
|
4471
4499
|
return !!params && typeof params === "object" && params.destructive === true;
|
|
4472
4500
|
}
|
|
4473
4501
|
async function executeAction(action, context) {
|
|
4474
|
-
|
|
4502
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
4475
4503
|
`executeAction called: type="${action.type}", id="${action.id}", payload=${JSON.stringify(action.payload)}`
|
|
4476
4504
|
);
|
|
4477
|
-
const permissions =
|
|
4505
|
+
const permissions = chunkQAZ4TN3Z_js.resolveAgentPermissions(context.permissions);
|
|
4478
4506
|
context.emit({
|
|
4479
4507
|
type: "agent:action:start",
|
|
4480
4508
|
timestamp: Date.now(),
|
|
@@ -4500,7 +4528,7 @@ async function executeAction(action, context) {
|
|
|
4500
4528
|
let result;
|
|
4501
4529
|
const validationFailure = validateActionPayload(action);
|
|
4502
4530
|
if (validationFailure) {
|
|
4503
|
-
|
|
4531
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn(
|
|
4504
4532
|
`executeAction: payload validation failed for type="${action.type}" id="${action.id}": ${validationFailure.error}`
|
|
4505
4533
|
);
|
|
4506
4534
|
context.emit({
|
|
@@ -4527,7 +4555,7 @@ async function executeAction(action, context) {
|
|
|
4527
4555
|
case "form_fill":
|
|
4528
4556
|
result = await formFillHandler(action.payload, {
|
|
4529
4557
|
permissions,
|
|
4530
|
-
registry: context.registry ??
|
|
4558
|
+
registry: context.registry ?? chunkQAZ4TN3Z_js.getDefaultRegistry()
|
|
4531
4559
|
});
|
|
4532
4560
|
break;
|
|
4533
4561
|
case "ui_interaction": {
|
|
@@ -4535,7 +4563,7 @@ async function executeAction(action, context) {
|
|
|
4535
4563
|
const baseline = capturePreInteractionBaseline(payload);
|
|
4536
4564
|
result = uiInteractionHandler(payload, {
|
|
4537
4565
|
permissions,
|
|
4538
|
-
registry: context.registry ??
|
|
4566
|
+
registry: context.registry ?? chunkQAZ4TN3Z_js.getDefaultRegistry()
|
|
4539
4567
|
});
|
|
4540
4568
|
if (result.success) {
|
|
4541
4569
|
const settle = await waitForPostInteractionSettle(payload, baseline);
|
|
@@ -4564,7 +4592,7 @@ async function executeAction(action, context) {
|
|
|
4564
4592
|
};
|
|
4565
4593
|
}
|
|
4566
4594
|
} catch (err) {
|
|
4567
|
-
|
|
4595
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn(
|
|
4568
4596
|
`executeAction: exception during action type="${action.type}" id="${action.id}": ${err?.message}`
|
|
4569
4597
|
);
|
|
4570
4598
|
result = {
|
|
@@ -4572,7 +4600,7 @@ async function executeAction(action, context) {
|
|
|
4572
4600
|
error: err?.message ?? "Action execution failed unexpectedly"
|
|
4573
4601
|
};
|
|
4574
4602
|
}
|
|
4575
|
-
|
|
4603
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
4576
4604
|
`executeAction result: type="${action.type}", id="${action.id}", success=${result.success}, error=${result.error ?? "none"}`
|
|
4577
4605
|
);
|
|
4578
4606
|
context.emit({
|
|
@@ -4632,7 +4660,7 @@ var _patchedAlert = (title, message, buttons, options) => {
|
|
|
4632
4660
|
buttonLabel: button.text?.slice(0, 160),
|
|
4633
4661
|
handlerCompleted
|
|
4634
4662
|
});
|
|
4635
|
-
|
|
4663
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog("Suppressing native Alert during already-confirmed destructive agent action");
|
|
4636
4664
|
try {
|
|
4637
4665
|
suppression.pending = Promise.resolve(button.onPress()).then(() => report(true)).catch((err) => {
|
|
4638
4666
|
reportHandlerFailure(err);
|
|
@@ -4688,38 +4716,38 @@ async function runWithConfirmedDestructiveContext(enabled, host, fn, onHandled)
|
|
|
4688
4716
|
}
|
|
4689
4717
|
|
|
4690
4718
|
// src/platform/reactNativeAdapter.ts
|
|
4691
|
-
var deltaTracker =
|
|
4719
|
+
var deltaTracker = chunkQAZ4TN3Z_js.createSnapshotDeltaTracker();
|
|
4692
4720
|
function resolveScreenMetadata() {
|
|
4693
|
-
const activePath =
|
|
4721
|
+
const activePath = chunkQAZ4TN3Z_js.getActiveRouteNames();
|
|
4694
4722
|
for (let i = activePath.length - 1; i >= 0; i--) {
|
|
4695
4723
|
const name = activePath[i];
|
|
4696
|
-
const meta = name ?
|
|
4724
|
+
const meta = name ? chunkQAZ4TN3Z_js.getScreenMetadata(name) : void 0;
|
|
4697
4725
|
if (meta && (Array.isArray(meta.fields) && meta.fields.length > 0 || Array.isArray(meta.actions) && meta.actions.length > 0)) {
|
|
4698
4726
|
return meta;
|
|
4699
4727
|
}
|
|
4700
4728
|
}
|
|
4701
|
-
const screen =
|
|
4702
|
-
return screen ?
|
|
4729
|
+
const screen = chunkQAZ4TN3Z_js.getCurrentScreen();
|
|
4730
|
+
return screen ? chunkQAZ4TN3Z_js.getScreenMetadata(screen) : void 0;
|
|
4703
4731
|
}
|
|
4704
4732
|
function buildAgentContext(extras = {}) {
|
|
4705
4733
|
if (extras.newMission === true) {
|
|
4706
4734
|
deltaTracker.reset();
|
|
4707
|
-
for (const entry of
|
|
4735
|
+
for (const entry of chunkQAZ4TN3Z_js.listRegistry.snapshot()) entry.exploration?.reset();
|
|
4708
4736
|
}
|
|
4709
4737
|
const context = {};
|
|
4710
4738
|
context.platform = "react-native";
|
|
4711
4739
|
context.missionProtocol = 1;
|
|
4712
4740
|
context.deviceLocale = detectDeviceLocale() ?? "en";
|
|
4713
|
-
const screen =
|
|
4741
|
+
const screen = chunkQAZ4TN3Z_js.getCurrentScreen();
|
|
4714
4742
|
if (screen) context.currentScreen = screen;
|
|
4715
|
-
const navigationState =
|
|
4743
|
+
const navigationState = chunkQAZ4TN3Z_js.getNavigationStateSnapshot();
|
|
4716
4744
|
if (navigationState) context.navigationState = navigationState;
|
|
4717
4745
|
const screenMeta = resolveScreenMetadata();
|
|
4718
4746
|
if (screenMeta) context.screenMetadata = screenMeta;
|
|
4719
4747
|
try {
|
|
4720
4748
|
const snapshot = captureSnapshot();
|
|
4721
4749
|
for (const list of snapshot.lists) {
|
|
4722
|
-
const memory = list.id ?
|
|
4750
|
+
const memory = list.id ? chunkQAZ4TN3Z_js.listRegistry.get(list.id)?.exploration : void 0;
|
|
4723
4751
|
if (!memory) continue;
|
|
4724
4752
|
memory.observe(list.items);
|
|
4725
4753
|
list.exploration = memory.snapshot();
|
|
@@ -4728,12 +4756,12 @@ function buildAgentContext(extras = {}) {
|
|
|
4728
4756
|
if (delta) snapshot.delta = delta;
|
|
4729
4757
|
context.snapshot = snapshot;
|
|
4730
4758
|
} catch (err) {
|
|
4731
|
-
|
|
4759
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn("buildAgentContext: captureSnapshot failed", err);
|
|
4732
4760
|
}
|
|
4733
|
-
const registry =
|
|
4761
|
+
const registry = chunkQAZ4TN3Z_js.componentRegistry.snapshot();
|
|
4734
4762
|
const filtered = screen ? registry.filter((c) => !c.screen || c.screen === screen) : registry;
|
|
4735
4763
|
if (filtered.length > 0) context.registeredComponents = filtered;
|
|
4736
|
-
const registeredLists =
|
|
4764
|
+
const registeredLists = chunkQAZ4TN3Z_js.listRegistry.snapshot();
|
|
4737
4765
|
if (registeredLists.length > 0) {
|
|
4738
4766
|
const snapshot = context.snapshot;
|
|
4739
4767
|
const activeIds = new Set(
|
|
@@ -4764,25 +4792,25 @@ async function settleTurn(input) {
|
|
|
4764
4792
|
(a) => a.type === "ui_interaction" && a.payload?.componentId === pressedId
|
|
4765
4793
|
);
|
|
4766
4794
|
const hints = resolveActionHints(
|
|
4767
|
-
|
|
4795
|
+
chunkQAZ4TN3Z_js.getCurrentScreen(),
|
|
4768
4796
|
pressedId,
|
|
4769
4797
|
pressedAction?.payload
|
|
4770
4798
|
);
|
|
4771
4799
|
const capSource = typeof hints?.asyncBudgetMs === "number" && hints.asyncBudgetMs > 0 ? " (app-declared)" : hints?.isAsyncTrigger ? " (mcp-inferred)" : "";
|
|
4772
4800
|
if (input.hadNavigate) {
|
|
4773
|
-
const settle = await
|
|
4801
|
+
const settle = await chunkQAZ4TN3Z_js.waitForScreenSettle({
|
|
4774
4802
|
expectingChange: true,
|
|
4775
4803
|
fromScreen: input.preNavigateScreen ?? null,
|
|
4776
4804
|
fromSignature: input.preNavigateSignature ?? null,
|
|
4777
4805
|
targetScreen: navigateTargetScreen,
|
|
4778
4806
|
maxMs: 3500
|
|
4779
4807
|
});
|
|
4780
|
-
|
|
4808
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
4781
4809
|
`settleTurn: post-navigate settle done \u2014 screen="${settle.screen}" transitioned=${settle.transitioned} timedOut=${settle.timedOut} waitedMs=${settle.waitedMs}`
|
|
4782
4810
|
);
|
|
4783
|
-
const navigationMoved = settle.transitioned ||
|
|
4811
|
+
const navigationMoved = settle.transitioned || chunkQAZ4TN3Z_js.screenDepartedBaseline(input.preNavigateScreen ?? null, input.preNavigateSignature ?? null) || !!navigateTargetScreen && !!settle.screen && chunkQAZ4TN3Z_js.routesBelongToSameFeature(settle.screen, navigateTargetScreen);
|
|
4784
4812
|
if (!navigationMoved) {
|
|
4785
|
-
|
|
4813
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn(
|
|
4786
4814
|
`tool-without-effect: navigate emitted but screen did not change (stayed at "${input.preNavigateScreen ?? "unknown"}", waitedMs=${settle.waitedMs}). Likely causes: target screenName missing from MCP doc, nested-nav path absent, or React Navigation rejected the route.`
|
|
4787
4815
|
);
|
|
4788
4816
|
for (const [actionId, type] of typeById) {
|
|
@@ -4790,46 +4818,46 @@ async function settleTurn(input) {
|
|
|
4790
4818
|
}
|
|
4791
4819
|
}
|
|
4792
4820
|
const postNavigateCapMs = resolvePostNavigateCapMs(hints);
|
|
4793
|
-
const loadSettle = await
|
|
4821
|
+
const loadSettle = await chunkQAZ4TN3Z_js.waitForLoadingSettle({
|
|
4794
4822
|
fromScreen: settle.screen ?? null,
|
|
4795
4823
|
maxMs: postNavigateCapMs
|
|
4796
4824
|
});
|
|
4797
|
-
|
|
4825
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
4798
4826
|
`settleTurn: post-navigate loading settle \u2014 settled=${loadSettle.settled} loadingPending=${loadSettle.loadingPending} probes=${loadSettle.probeCount} waitedMs=${loadSettle.waitedMs} cap=${postNavigateCapMs}${capSource}`
|
|
4799
4827
|
);
|
|
4800
4828
|
if (loadSettle.loadingPending) loadingPending = true;
|
|
4801
4829
|
} else {
|
|
4802
4830
|
const settleCapMs = resolveSettleCapMs(hints);
|
|
4803
4831
|
const busyMaxMs = resolveBusyCeilingMs(hints);
|
|
4804
|
-
const loadSettle = await
|
|
4832
|
+
const loadSettle = await chunkQAZ4TN3Z_js.waitForLoadingSettle({
|
|
4805
4833
|
pressedComponentId: pressedId,
|
|
4806
|
-
fromScreen:
|
|
4834
|
+
fromScreen: chunkQAZ4TN3Z_js.getCurrentScreen(),
|
|
4807
4835
|
maxMs: settleCapMs,
|
|
4808
4836
|
...busyMaxMs !== void 0 ? { busyMaxMs } : {}
|
|
4809
4837
|
});
|
|
4810
|
-
|
|
4838
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
4811
4839
|
`settleTurn: post-action loading settle \u2014 pressedId="${pressedId ?? ""}" settled=${loadSettle.settled} transitioned=${loadSettle.transitioned} loadingPending=${loadSettle.loadingPending} probes=${loadSettle.probeCount} waitedMs=${loadSettle.waitedMs} cap=${settleCapMs}${capSource}${busyMaxMs !== void 0 ? ` busyCap=${busyMaxMs}` : ""}`
|
|
4812
4840
|
);
|
|
4813
4841
|
if (loadSettle.loadingPending) loadingPending = true;
|
|
4814
4842
|
const listPressActions = turnActions.filter((action) => {
|
|
4815
|
-
const target =
|
|
4816
|
-
return target ?
|
|
4843
|
+
const target = chunkQAZ4TN3Z_js.actionPressTargetId(action);
|
|
4844
|
+
return target ? chunkQAZ4TN3Z_js.isListItemPressTarget(target) : false;
|
|
4817
4845
|
});
|
|
4818
4846
|
if (listPressActions.length > 0) {
|
|
4819
|
-
const baselineFingerprint =
|
|
4820
|
-
const postPressSettle = await
|
|
4847
|
+
const baselineFingerprint = chunkQAZ4TN3Z_js.probeLoadingState(pressedId, chunkQAZ4TN3Z_js.getCurrentScreen()).fingerprint;
|
|
4848
|
+
const postPressSettle = await chunkQAZ4TN3Z_js.waitForScreenSettle({
|
|
4821
4849
|
expectingChange: true,
|
|
4822
4850
|
fromScreen: input.preNavigateScreen ?? null,
|
|
4823
4851
|
fromSignature: input.preNavigateSignature ?? null,
|
|
4824
4852
|
maxMs: 2500
|
|
4825
4853
|
});
|
|
4826
|
-
await
|
|
4854
|
+
await chunkQAZ4TN3Z_js.waitForLoadingSettle({
|
|
4827
4855
|
pressedComponentId: pressedId,
|
|
4828
|
-
fromScreen:
|
|
4856
|
+
fromScreen: chunkQAZ4TN3Z_js.getCurrentScreen(),
|
|
4829
4857
|
maxMs: 4e3
|
|
4830
4858
|
});
|
|
4831
|
-
const afterFingerprint =
|
|
4832
|
-
|
|
4859
|
+
const afterFingerprint = chunkQAZ4TN3Z_js.probeLoadingState(pressedId, chunkQAZ4TN3Z_js.getCurrentScreen()).fingerprint;
|
|
4860
|
+
chunkQAZ4TN3Z_js.appilotsDebugLog(
|
|
4833
4861
|
`settleTurn: post-list-press settle \u2014 screen="${postPressSettle.screen}" transitioned=${postPressSettle.transitioned} timedOut=${postPressSettle.timedOut} waitedMs=${postPressSettle.waitedMs}`
|
|
4834
4862
|
);
|
|
4835
4863
|
if (!postPressSettle.transitioned && baselineFingerprint === afterFingerprint) {
|
|
@@ -4846,8 +4874,8 @@ async function settleTurn(input) {
|
|
|
4846
4874
|
}
|
|
4847
4875
|
var reactNativeChatAdapter = {
|
|
4848
4876
|
buildContext: buildAgentContext,
|
|
4849
|
-
getCurrentScreen:
|
|
4850
|
-
getCurrentScreenSignature:
|
|
4877
|
+
getCurrentScreen: chunkQAZ4TN3Z_js.getCurrentScreen,
|
|
4878
|
+
getCurrentScreenSignature: chunkQAZ4TN3Z_js.getCurrentScreenSignature,
|
|
4851
4879
|
settleTurn
|
|
4852
4880
|
};
|
|
4853
4881
|
function createReactNativeActionRunner(getOptions) {
|
|
@@ -4855,7 +4883,7 @@ function createReactNativeActionRunner(getOptions) {
|
|
|
4855
4883
|
buildMissionContext: () => reactNativeChatAdapter.buildContext(),
|
|
4856
4884
|
async execute(action, { confirmedDestructive }) {
|
|
4857
4885
|
const { permissions, emit: emit2, navigationRef, suppressNativeConfirm } = getOptions();
|
|
4858
|
-
const navRef = navigationRef?.current ? navigationRef : { current:
|
|
4886
|
+
const navRef = navigationRef?.current ? navigationRef : { current: chunkQAZ4TN3Z_js.getNavigationRef() };
|
|
4859
4887
|
let receipt;
|
|
4860
4888
|
let terminal;
|
|
4861
4889
|
const result = await runWithConfirmedDestructiveContext(
|
|
@@ -4887,21 +4915,21 @@ function createReactNativeActionRunner(getOptions) {
|
|
|
4887
4915
|
});
|
|
4888
4916
|
return failed ? { ...result, success: false, error: "Native confirmation callback failed" } : result;
|
|
4889
4917
|
},
|
|
4890
|
-
getCurrentScreen:
|
|
4891
|
-
getCurrentScreenSignature:
|
|
4918
|
+
getCurrentScreen: chunkQAZ4TN3Z_js.getCurrentScreen,
|
|
4919
|
+
getCurrentScreenSignature: chunkQAZ4TN3Z_js.getCurrentScreenSignature,
|
|
4892
4920
|
getScreenActionsMetadata(screen) {
|
|
4893
|
-
return
|
|
4921
|
+
return chunkQAZ4TN3Z_js.getScreenMetadata(screen)?.actions;
|
|
4894
4922
|
},
|
|
4895
|
-
waitForScreenSettle:
|
|
4923
|
+
waitForScreenSettle: chunkQAZ4TN3Z_js.waitForScreenSettle
|
|
4896
4924
|
};
|
|
4897
4925
|
}
|
|
4898
4926
|
|
|
4899
4927
|
// src/hooks/useAppilotsChat.ts
|
|
4900
4928
|
function useAppilotsChat(options = {}) {
|
|
4901
|
-
const { client, emit: emit2, subscribe } =
|
|
4929
|
+
const { client, emit: emit2, subscribe } = chunkQAZ4TN3Z_js.useAppilotsContext();
|
|
4902
4930
|
const machine = React.useMemo(
|
|
4903
|
-
() => new
|
|
4904
|
-
{ client, adapter: reactNativeChatAdapter, emit: emit2, warn:
|
|
4931
|
+
() => new chunkQAZ4TN3Z_js.ChatSessionMachine(
|
|
4932
|
+
{ client, adapter: reactNativeChatAdapter, emit: emit2, warn: chunkQAZ4TN3Z_js.appilotsDebugWarn },
|
|
4905
4933
|
options
|
|
4906
4934
|
),
|
|
4907
4935
|
// A new machine per client/provider instance — options are pushed in
|
|
@@ -4952,27 +4980,27 @@ function useAppilotsChat(options = {}) {
|
|
|
4952
4980
|
};
|
|
4953
4981
|
}
|
|
4954
4982
|
function useAppilotsActions(options = {}) {
|
|
4955
|
-
const { client, subscribe, config, emit: emit2 } =
|
|
4983
|
+
const { client, subscribe, config, emit: emit2 } = chunkQAZ4TN3Z_js.useAppilotsContext();
|
|
4956
4984
|
const { navigationRef, autoExecute = false } = options;
|
|
4957
4985
|
const runnerOptionsRef = React.useRef({
|
|
4958
|
-
permissions:
|
|
4986
|
+
permissions: chunkQAZ4TN3Z_js.resolveAgentPermissions(config.permissions),
|
|
4959
4987
|
emit: emit2,
|
|
4960
4988
|
navigationRef,
|
|
4961
4989
|
suppressNativeConfirm: config.suppressNativeConfirm
|
|
4962
4990
|
});
|
|
4963
4991
|
runnerOptionsRef.current = {
|
|
4964
|
-
permissions:
|
|
4992
|
+
permissions: chunkQAZ4TN3Z_js.resolveAgentPermissions(config.permissions),
|
|
4965
4993
|
emit: emit2,
|
|
4966
4994
|
navigationRef,
|
|
4967
4995
|
suppressNativeConfirm: config.suppressNativeConfirm
|
|
4968
4996
|
};
|
|
4969
4997
|
const machine = React.useMemo(
|
|
4970
|
-
() => new
|
|
4998
|
+
() => new chunkQAZ4TN3Z_js.ActionQueueMachine(
|
|
4971
4999
|
{
|
|
4972
5000
|
client,
|
|
4973
5001
|
adapter: createReactNativeActionRunner(() => runnerOptionsRef.current),
|
|
4974
5002
|
emit: emit2,
|
|
4975
|
-
warn:
|
|
5003
|
+
warn: chunkQAZ4TN3Z_js.appilotsDebugWarn
|
|
4976
5004
|
},
|
|
4977
5005
|
{ autoExecute }
|
|
4978
5006
|
),
|
|
@@ -5029,7 +5057,7 @@ function shouldShowSuggestedPrompts(args) {
|
|
|
5029
5057
|
|
|
5030
5058
|
// src/hooks/useSuggestedPrompts.ts
|
|
5031
5059
|
function useSuggestedPrompts(options) {
|
|
5032
|
-
const { client } =
|
|
5060
|
+
const { client } = chunkQAZ4TN3Z_js.useAppilotsContext();
|
|
5033
5061
|
const { enabled, limit = 4 } = options;
|
|
5034
5062
|
const [prompts, setPrompts] = React.useState([]);
|
|
5035
5063
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
@@ -5039,8 +5067,8 @@ function useSuggestedPrompts(options) {
|
|
|
5039
5067
|
if (!enabled) return;
|
|
5040
5068
|
const requestId = ++requestIdRef.current;
|
|
5041
5069
|
let cancelled = false;
|
|
5042
|
-
const screen =
|
|
5043
|
-
const localDev = screen ? (
|
|
5070
|
+
const screen = chunkQAZ4TN3Z_js.getCurrentScreen() ?? void 0;
|
|
5071
|
+
const localDev = screen ? (chunkQAZ4TN3Z_js.getScreenMetadata(screen)?.suggestedPrompts ?? []).map((text) => ({
|
|
5044
5072
|
text,
|
|
5045
5073
|
source: "dev-defined"
|
|
5046
5074
|
})) : [];
|
|
@@ -5054,7 +5082,7 @@ function useSuggestedPrompts(options) {
|
|
|
5054
5082
|
if (cancelled || requestIdRef.current !== requestId) return;
|
|
5055
5083
|
setPrompts(mergePromptSources(localDev, data, limit));
|
|
5056
5084
|
}).catch((err) => {
|
|
5057
|
-
|
|
5085
|
+
chunkQAZ4TN3Z_js.appilotsDebugWarn("useSuggestedPrompts: fetch failed", err);
|
|
5058
5086
|
}).finally(() => {
|
|
5059
5087
|
if (cancelled || requestIdRef.current !== requestId) return;
|
|
5060
5088
|
setIsLoading(false);
|
|
@@ -5065,9 +5093,9 @@ function useSuggestedPrompts(options) {
|
|
|
5065
5093
|
}, [client, enabled, limit, refreshTick]);
|
|
5066
5094
|
React.useEffect(() => {
|
|
5067
5095
|
if (!enabled) return;
|
|
5068
|
-
let lastScreen =
|
|
5096
|
+
let lastScreen = chunkQAZ4TN3Z_js.getCurrentScreen();
|
|
5069
5097
|
const interval = setInterval(() => {
|
|
5070
|
-
const current2 =
|
|
5098
|
+
const current2 = chunkQAZ4TN3Z_js.getCurrentScreen();
|
|
5071
5099
|
if (current2 !== lastScreen) {
|
|
5072
5100
|
lastScreen = current2;
|
|
5073
5101
|
setRefreshTick((t) => t + 1);
|
|
@@ -5082,14 +5110,14 @@ function useSuggestedPrompts(options) {
|
|
|
5082
5110
|
};
|
|
5083
5111
|
}
|
|
5084
5112
|
function useAppilotsNavigation() {
|
|
5085
|
-
const { emit: emit2 } =
|
|
5113
|
+
const { emit: emit2 } = chunkQAZ4TN3Z_js.useAppilotsContext();
|
|
5086
5114
|
const [currentScreen, setCurrentScreenState] = React.useState(null);
|
|
5087
5115
|
const [navigationHistory, setNavigationHistory] = React.useState([]);
|
|
5088
5116
|
const navigationRef = React.useRef(null);
|
|
5089
5117
|
const setCurrentScreen2 = React.useCallback(
|
|
5090
5118
|
(screenName) => {
|
|
5091
5119
|
setCurrentScreenState(screenName);
|
|
5092
|
-
|
|
5120
|
+
chunkQAZ4TN3Z_js.setCurrentScreen(screenName);
|
|
5093
5121
|
setNavigationHistory((prev) => [...prev, screenName]);
|
|
5094
5122
|
emit2({
|
|
5095
5123
|
type: "navigation:change",
|
|
@@ -5120,7 +5148,7 @@ function useAppilotsNavigation() {
|
|
|
5120
5148
|
|
|
5121
5149
|
// src/hooks/useAppilots.ts
|
|
5122
5150
|
function useAppilots() {
|
|
5123
|
-
const { config, client } =
|
|
5151
|
+
const { config, client } = chunkQAZ4TN3Z_js.useAppilotsContext();
|
|
5124
5152
|
const chat = useAppilotsChat();
|
|
5125
5153
|
const navigation = useAppilotsNavigation();
|
|
5126
5154
|
const actions = useAppilotsActions();
|
|
@@ -5154,7 +5182,7 @@ function useAppilotsElementProps(id) {
|
|
|
5154
5182
|
// src/hooks/useAppilotsField.ts
|
|
5155
5183
|
function useAppilotsField(id, options) {
|
|
5156
5184
|
const { value, onChangeText, ref, fieldType, label, screen } = options;
|
|
5157
|
-
const registry =
|
|
5185
|
+
const registry = chunkQAZ4TN3Z_js.useResolvedRegistry();
|
|
5158
5186
|
const valueRef = React.useRef(value);
|
|
5159
5187
|
const onChangeRef = React.useRef(onChangeText);
|
|
5160
5188
|
valueRef.current = value;
|
|
@@ -5183,7 +5211,7 @@ function useAppilotsField(id, options) {
|
|
|
5183
5211
|
}
|
|
5184
5212
|
function useAppilotsTarget(id, options) {
|
|
5185
5213
|
const { onPress, onLongPress, onScrollTo, label, screen } = options;
|
|
5186
|
-
const registry =
|
|
5214
|
+
const registry = chunkQAZ4TN3Z_js.useResolvedRegistry();
|
|
5187
5215
|
const onPressRef = React.useRef(onPress);
|
|
5188
5216
|
const onLongPressRef = React.useRef(onLongPress);
|
|
5189
5217
|
const onScrollToRef = React.useRef(onScrollTo);
|
|
@@ -5211,7 +5239,7 @@ function useAppilotsTarget(id, options) {
|
|
|
5211
5239
|
}
|
|
5212
5240
|
function useAppilotsToggle(id, options) {
|
|
5213
5241
|
const { value, onValueChange, label, screen } = options;
|
|
5214
|
-
const registry =
|
|
5242
|
+
const registry = chunkQAZ4TN3Z_js.useResolvedRegistry();
|
|
5215
5243
|
const valueRef = React.useRef(value);
|
|
5216
5244
|
const onChangeRef = React.useRef(onValueChange);
|
|
5217
5245
|
valueRef.current = value;
|
|
@@ -5235,7 +5263,7 @@ function useAppilotsToggle(id, options) {
|
|
|
5235
5263
|
}
|
|
5236
5264
|
function useAppilotsSlider(id, options) {
|
|
5237
5265
|
const { value, onValueChange, min, max, step, label, screen } = options;
|
|
5238
|
-
const registry =
|
|
5266
|
+
const registry = chunkQAZ4TN3Z_js.useResolvedRegistry();
|
|
5239
5267
|
const valueRef = React.useRef(value);
|
|
5240
5268
|
const onChangeRef = React.useRef(onValueChange);
|
|
5241
5269
|
valueRef.current = value;
|
|
@@ -5277,6 +5305,7 @@ exports.setSpotlightMode = setSpotlightMode;
|
|
|
5277
5305
|
exports.setSpotlightTarget = setSpotlightTarget;
|
|
5278
5306
|
exports.shouldShowSuggestedPrompts = shouldShowSuggestedPrompts;
|
|
5279
5307
|
exports.subscribeSpotlight = subscribeSpotlight;
|
|
5308
|
+
exports.subscribeSpotlightAnnouncement = subscribeSpotlightAnnouncement;
|
|
5280
5309
|
exports.useAppilots = useAppilots;
|
|
5281
5310
|
exports.useAppilotsActions = useAppilotsActions;
|
|
5282
5311
|
exports.useAppilotsChat = useAppilotsChat;
|