@appilots/sdk 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.build-meta.json +3 -3
- package/dist/{chunk-VX7AL4SA.js → chunk-2YPEQTL2.js} +275 -275
- package/dist/{chunk-IHPLS5FE.mjs → chunk-3K7ORC4X.mjs} +1 -1
- package/dist/{chunk-YB77RYCC.js → chunk-55Y2AQE7.js} +1 -1
- package/dist/{chunk-AHHDOUVX.mjs → chunk-G6KI7KVH.mjs} +1 -1
- package/dist/{chunk-2GCWCPSD.js → chunk-IZEWWAA7.js} +8 -8
- package/dist/{chunk-XHR65V2W.mjs → chunk-NA5H4IHH.mjs} +1 -1
- package/dist/hooks/index.js +11 -11
- package/dist/hooks/index.mjs +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +72 -72
- package/dist/index.mjs +5 -5
- 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 chunk55Y2AQE7_js = require('./chunk-55Y2AQE7.js');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var reactNative = require('react-native');
|
|
6
6
|
|
|
@@ -23,9 +23,9 @@ function fiberSliderMatches(fiber, registryId, registryLabel) {
|
|
|
23
23
|
function reconcileSliders(snapshot) {
|
|
24
24
|
const fiberSliders = snapshot.sliders;
|
|
25
25
|
const out = [];
|
|
26
|
-
for (const { id, kind } of
|
|
26
|
+
for (const { id, kind } of chunk55Y2AQE7_js.componentRegistry.snapshot()) {
|
|
27
27
|
if (kind !== "slider") continue;
|
|
28
|
-
const entry =
|
|
28
|
+
const entry = chunk55Y2AQE7_js.componentRegistry.getSlider(id);
|
|
29
29
|
if (!entry) continue;
|
|
30
30
|
const fiber = fiberSliders.find((s) => fiberSliderMatches(s, id, entry.label));
|
|
31
31
|
const visible = !!fiber || typeof entry.screen === "string" && entry.screen === snapshot.route;
|
|
@@ -53,7 +53,7 @@ function normalizeFieldKey(value) {
|
|
|
53
53
|
}
|
|
54
54
|
function canonicalizeRegisteredFields(snapshot) {
|
|
55
55
|
const claimed = /* @__PURE__ */ new Set();
|
|
56
|
-
for (const { id, kind, label } of
|
|
56
|
+
for (const { id, kind, label } of chunk55Y2AQE7_js.componentRegistry.snapshot()) {
|
|
57
57
|
if (kind !== "field") continue;
|
|
58
58
|
if (snapshot.inputs.some((input) => input.id === id)) continue;
|
|
59
59
|
const registryLabel = (label ?? "").toLowerCase();
|
|
@@ -72,7 +72,7 @@ function canonicalizeRegisteredFields(snapshot) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
function mergeRegisteredLists(snapshot) {
|
|
75
|
-
const registered =
|
|
75
|
+
const registered = chunk55Y2AQE7_js.listRegistry.snapshot();
|
|
76
76
|
if (registered.length === 0) return;
|
|
77
77
|
const byId = /* @__PURE__ */ new Map();
|
|
78
78
|
for (const list of snapshot.lists) {
|
|
@@ -121,7 +121,7 @@ function mergeRegisteredLists(snapshot) {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
function mergeRegisteredScrollables(snapshot) {
|
|
124
|
-
const registered =
|
|
124
|
+
const registered = chunk55Y2AQE7_js.listRegistry.snapshot().filter((e) => e.kind === "scroll");
|
|
125
125
|
if (registered.length === 0) return;
|
|
126
126
|
const listsById = /* @__PURE__ */ new Map();
|
|
127
127
|
for (const list of snapshot.lists) {
|
|
@@ -154,7 +154,7 @@ function mergeRegisteredScrollables(snapshot) {
|
|
|
154
154
|
if (out.length > 0) snapshot.scrollables = out;
|
|
155
155
|
}
|
|
156
156
|
function mergeNativeDialog(snapshot) {
|
|
157
|
-
const dialog =
|
|
157
|
+
const dialog = chunk55Y2AQE7_js.getOpenNativeDialog();
|
|
158
158
|
if (!dialog) return;
|
|
159
159
|
snapshot.nativeDialog = {
|
|
160
160
|
id: dialog.id,
|
|
@@ -169,21 +169,21 @@ function mergeNativeDialog(snapshot) {
|
|
|
169
169
|
}
|
|
170
170
|
var MIN_FIBERS_FOR_BLINDNESS = 200;
|
|
171
171
|
function recordBlindWalk() {
|
|
172
|
-
const walk =
|
|
172
|
+
const walk = chunk55Y2AQE7_js.getLastWalkDiagnostics();
|
|
173
173
|
if (!walk) return;
|
|
174
174
|
if (walk.visitedFibers < MIN_FIBERS_FOR_BLINDNESS) return;
|
|
175
|
-
if (
|
|
176
|
-
|
|
175
|
+
if (chunk55Y2AQE7_js.totalDetectorHits(walk.detectors) > 0) return;
|
|
176
|
+
chunk55Y2AQE7_js.recordIntrospectionFailure("walk-recognized-nothing", null);
|
|
177
177
|
}
|
|
178
178
|
function captureSnapshot() {
|
|
179
|
-
const root =
|
|
179
|
+
const root = chunk55Y2AQE7_js.getFiberRoot();
|
|
180
180
|
if (!root) {
|
|
181
|
-
|
|
181
|
+
chunk55Y2AQE7_js.appilotsDebugWarn(
|
|
182
182
|
"captureSnapshot: fiber root not captured yet. Ensure <AppilotsProvider> has rendered before calling this."
|
|
183
183
|
);
|
|
184
|
-
|
|
184
|
+
chunk55Y2AQE7_js.recordIntrospectionFailure("never-mounted", null);
|
|
185
185
|
return {
|
|
186
|
-
route:
|
|
186
|
+
route: chunk55Y2AQE7_js.getCurrentScreen(),
|
|
187
187
|
texts: [],
|
|
188
188
|
inputs: [],
|
|
189
189
|
buttons: [],
|
|
@@ -197,9 +197,9 @@ function captureSnapshot() {
|
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
199
|
const start = Date.now();
|
|
200
|
-
const snapshot =
|
|
200
|
+
const snapshot = chunk55Y2AQE7_js.walkFiber(root);
|
|
201
201
|
recordBlindWalk();
|
|
202
|
-
const activePath =
|
|
202
|
+
const activePath = chunk55Y2AQE7_js.getActiveRouteNames();
|
|
203
203
|
const deepestRoute = activePath[activePath.length - 1];
|
|
204
204
|
if (deepestRoute) snapshot.route = deepestRoute;
|
|
205
205
|
mergeRegisteredLists(snapshot);
|
|
@@ -207,15 +207,15 @@ function captureSnapshot() {
|
|
|
207
207
|
mergeNativeDialog(snapshot);
|
|
208
208
|
reconcileSliders(snapshot);
|
|
209
209
|
canonicalizeRegisteredFields(snapshot);
|
|
210
|
-
|
|
211
|
-
const entries =
|
|
210
|
+
chunk55Y2AQE7_js.clampSnapshotToWireLimits(snapshot);
|
|
211
|
+
const entries = chunk55Y2AQE7_js.deriveInteractionElements(snapshot, { rectOf: chunk55Y2AQE7_js.rectForNode });
|
|
212
212
|
const rectById = new Map(
|
|
213
213
|
entries.flatMap((entry) => entry.rect ? [[entry.id, entry.rect]] : [])
|
|
214
214
|
);
|
|
215
|
-
snapshot.elements = entries.map(
|
|
216
|
-
snapshot.choiceGroups =
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
snapshot.elements = entries.map(chunk55Y2AQE7_js.toWireElement);
|
|
216
|
+
snapshot.choiceGroups = chunk55Y2AQE7_js.attachElementIdsToChoiceGroups(snapshot.choiceGroups, snapshot.elements);
|
|
217
|
+
chunk55Y2AQE7_js.clampSnapshotToWireLimits(snapshot);
|
|
218
|
+
chunk55Y2AQE7_js.elementRegistry.replaceAll(
|
|
219
219
|
snapshot.elements.map((element) => {
|
|
220
220
|
const rect = rectById.get(element.id);
|
|
221
221
|
return rect ? { ...element, rect } : element;
|
|
@@ -227,10 +227,10 @@ function captureSnapshot() {
|
|
|
227
227
|
(acc, l) => acc + (typeof l.itemCount === "number" ? l.itemCount : 0),
|
|
228
228
|
0
|
|
229
229
|
);
|
|
230
|
-
|
|
230
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
231
231
|
`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)`
|
|
232
232
|
);
|
|
233
|
-
|
|
233
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
234
234
|
`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(", ")}]`
|
|
235
235
|
);
|
|
236
236
|
return snapshot;
|
|
@@ -241,10 +241,10 @@ function registryCounts() {
|
|
|
241
241
|
toggles: 0,
|
|
242
242
|
sliders: 0,
|
|
243
243
|
targets: 0,
|
|
244
|
-
lists:
|
|
245
|
-
elements:
|
|
244
|
+
lists: chunk55Y2AQE7_js.listRegistry.snapshot().length,
|
|
245
|
+
elements: chunk55Y2AQE7_js.elementRegistry.size
|
|
246
246
|
};
|
|
247
|
-
for (const { kind } of
|
|
247
|
+
for (const { kind } of chunk55Y2AQE7_js.componentRegistry.snapshot()) {
|
|
248
248
|
if (kind === "field") counts.fields++;
|
|
249
249
|
else if (kind === "toggle") counts.toggles++;
|
|
250
250
|
else if (kind === "slider") counts.sliders++;
|
|
@@ -253,26 +253,26 @@ function registryCounts() {
|
|
|
253
253
|
return counts;
|
|
254
254
|
}
|
|
255
255
|
function appilotsSelfCheck() {
|
|
256
|
-
const root =
|
|
256
|
+
const root = chunk55Y2AQE7_js.getFiberRoot();
|
|
257
257
|
const start = Date.now();
|
|
258
|
-
if (root)
|
|
258
|
+
if (root) chunk55Y2AQE7_js.walkFiber(root);
|
|
259
259
|
const elapsedMs = Date.now() - start;
|
|
260
|
-
const walk =
|
|
260
|
+
const walk = chunk55Y2AQE7_js.getLastWalkDiagnostics();
|
|
261
261
|
return {
|
|
262
|
-
sdkVersion:
|
|
262
|
+
sdkVersion: chunk55Y2AQE7_js.SDK_VERSION,
|
|
263
263
|
reactVersion: React__default.default.version ?? null,
|
|
264
|
-
route:
|
|
265
|
-
introspection:
|
|
266
|
-
autoTracking:
|
|
264
|
+
route: chunk55Y2AQE7_js.getCurrentScreen() || null,
|
|
265
|
+
introspection: chunk55Y2AQE7_js.getIntrospectionDiagnostics(),
|
|
266
|
+
autoTracking: chunk55Y2AQE7_js.getAutoTrackingState(),
|
|
267
267
|
walk: {
|
|
268
268
|
visitedFibers: root ? walk?.visitedFibers ?? 0 : 0,
|
|
269
269
|
skippedHidden: root ? walk?.skippedHidden ?? 0 : 0,
|
|
270
270
|
elapsedMs
|
|
271
271
|
},
|
|
272
|
-
detectors: root ? walk?.detectors ??
|
|
272
|
+
detectors: root ? walk?.detectors ?? chunk55Y2AQE7_js.emptyDetectorCounts() : chunk55Y2AQE7_js.emptyDetectorCounts(),
|
|
273
273
|
registry: registryCounts(),
|
|
274
|
-
nameMangling:
|
|
275
|
-
geometry: { availability:
|
|
274
|
+
nameMangling: chunk55Y2AQE7_js.getNameManglingProbe(),
|
|
275
|
+
geometry: { availability: chunk55Y2AQE7_js.geometryAvailability(), ...chunk55Y2AQE7_js.geometryStats() }
|
|
276
276
|
};
|
|
277
277
|
}
|
|
278
278
|
|
|
@@ -350,7 +350,7 @@ function shouldSkipSubtree2(fiber) {
|
|
|
350
350
|
const typeName = getTypeName2(fiber.type) ?? getTypeName2(fiber.elementType);
|
|
351
351
|
if (typeName && SELF_REFERENTIAL_COMPONENTS.has(typeName)) return true;
|
|
352
352
|
if (isAppilotsSkipMarked(props)) return true;
|
|
353
|
-
if (
|
|
353
|
+
if (chunk55Y2AQE7_js.isModalFiber(fiber) && props.visible === false) return true;
|
|
354
354
|
if (matchesName(fiber, "Screen") && props.activityState === 0) return true;
|
|
355
355
|
const style = props.style;
|
|
356
356
|
if (style) {
|
|
@@ -360,7 +360,7 @@ function shouldSkipSubtree2(fiber) {
|
|
|
360
360
|
}
|
|
361
361
|
return false;
|
|
362
362
|
}
|
|
363
|
-
var normalize =
|
|
363
|
+
var normalize = chunk55Y2AQE7_js.foldForCompare;
|
|
364
364
|
function scoreMatch(fiber, queryNorm, queryRaw) {
|
|
365
365
|
const props = fiber.memoizedProps ?? {};
|
|
366
366
|
const candidates = [];
|
|
@@ -456,9 +456,9 @@ function wrapTouchable(fiber, label) {
|
|
|
456
456
|
};
|
|
457
457
|
}
|
|
458
458
|
function findInteractiveByIdentifier(query, options = {}) {
|
|
459
|
-
const root =
|
|
459
|
+
const root = chunk55Y2AQE7_js.getFiberRoot();
|
|
460
460
|
if (!root) {
|
|
461
|
-
|
|
461
|
+
chunk55Y2AQE7_js.appilotsDebugWarn("findInteractiveByIdentifier: fiber root not captured yet");
|
|
462
462
|
return null;
|
|
463
463
|
}
|
|
464
464
|
const queryNorm = normalize(query);
|
|
@@ -493,11 +493,11 @@ function findInteractiveByIdentifier(query, options = {}) {
|
|
|
493
493
|
if (fiber.child) stack.push(fiber.child);
|
|
494
494
|
}
|
|
495
495
|
if (bestHandle) {
|
|
496
|
-
|
|
496
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
497
497
|
`findInteractiveByIdentifier: query="${query}" \u2192 kind=${bestHandle.kind} label="${bestHandle.label ?? bestId}" score=${bestScore}`
|
|
498
498
|
);
|
|
499
499
|
} else {
|
|
500
|
-
|
|
500
|
+
chunk55Y2AQE7_js.appilotsDebugLog(`findInteractiveByIdentifier: query="${query}" \u2192 no match`);
|
|
501
501
|
}
|
|
502
502
|
return bestHandle;
|
|
503
503
|
}
|
|
@@ -546,7 +546,7 @@ function screenExistsAnywhere(state, screenName) {
|
|
|
546
546
|
function safeNavigate(nav, screenName, params, path) {
|
|
547
547
|
if (path && path.length > 0) {
|
|
548
548
|
const { root, nestedParams } = buildNestedParams(path, screenName, params);
|
|
549
|
-
|
|
549
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
550
550
|
`safeNavigate: using path-based navigation \u2014 root="${root}", nested=${JSON.stringify(nestedParams)}`
|
|
551
551
|
);
|
|
552
552
|
nav.navigate(root, nestedParams);
|
|
@@ -563,16 +563,16 @@ function safeNavigate(nav, screenName, params, path) {
|
|
|
563
563
|
`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.`
|
|
564
564
|
);
|
|
565
565
|
}
|
|
566
|
-
|
|
566
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
567
567
|
`safeNavigate: screen exists in nested navigator, attempting direct navigation to "${screenName}"`
|
|
568
568
|
);
|
|
569
569
|
nav.navigate(screenName, params);
|
|
570
570
|
}
|
|
571
571
|
function navigateHandler(payload, context) {
|
|
572
|
-
|
|
572
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
573
573
|
// Params carry record ids and, on some screens, the user's own
|
|
574
574
|
// data — the count answers "were params passed?" and nothing else.
|
|
575
|
-
`navigateHandler called: screenName="${payload.screenName}" action="${payload.navigationAction}" params=${
|
|
575
|
+
`navigateHandler called: screenName="${payload.screenName}" action="${payload.navigationAction}" params=${chunk55Y2AQE7_js.describeValue(payload.params)}`
|
|
576
576
|
);
|
|
577
577
|
const { navigationRef, permissions } = context;
|
|
578
578
|
const nav = navigationRef.current;
|
|
@@ -665,12 +665,12 @@ function navigateHandler(payload, context) {
|
|
|
665
665
|
diagnose: { category: "unknown", screen: payload.screenName }
|
|
666
666
|
};
|
|
667
667
|
}
|
|
668
|
-
|
|
668
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
669
669
|
`navigateHandler: navigation succeeded for "${payload.screenName}" (action="${payload.navigationAction}")`
|
|
670
670
|
);
|
|
671
671
|
return { success: true };
|
|
672
672
|
} catch (err) {
|
|
673
|
-
|
|
673
|
+
chunk55Y2AQE7_js.appilotsDebugWarn(
|
|
674
674
|
`navigateHandler: navigation failed for "${payload.screenName}": ${err?.message}`
|
|
675
675
|
);
|
|
676
676
|
const msg = String(err?.message ?? "Navigation failed");
|
|
@@ -718,18 +718,18 @@ function markedItemIndexFromFiber(fiber) {
|
|
|
718
718
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
719
719
|
}
|
|
720
720
|
function normalize2(value) {
|
|
721
|
-
return
|
|
721
|
+
return chunk55Y2AQE7_js.foldForCompare(String(value ?? ""));
|
|
722
722
|
}
|
|
723
723
|
function hasPressHandler2(fiber) {
|
|
724
724
|
const props = fiber?.memoizedProps ?? {};
|
|
725
725
|
return typeof props.onPress === "function" || typeof props.onPressIn === "function";
|
|
726
726
|
}
|
|
727
727
|
function isPressableFiber(fiber) {
|
|
728
|
-
const typeName =
|
|
729
|
-
return
|
|
728
|
+
const typeName = chunk55Y2AQE7_js.getTypeName(fiber.type) ?? chunk55Y2AQE7_js.getTypeName(fiber.elementType) ?? "";
|
|
729
|
+
return chunk55Y2AQE7_js.TOUCHABLE_NAMES.has(typeName) || hasPressHandler2(fiber);
|
|
730
730
|
}
|
|
731
731
|
function findListContainers(options = {}) {
|
|
732
|
-
const root =
|
|
732
|
+
const root = chunk55Y2AQE7_js.getFiberRoot();
|
|
733
733
|
if (!root) return [];
|
|
734
734
|
const containers = [];
|
|
735
735
|
const visited = /* @__PURE__ */ new WeakSet();
|
|
@@ -740,17 +740,17 @@ function findListContainers(options = {}) {
|
|
|
740
740
|
if (!fiber || visited.has(fiber)) continue;
|
|
741
741
|
visited.add(fiber);
|
|
742
742
|
if (fiber.sibling) stack.push(fiber.sibling);
|
|
743
|
-
if (
|
|
744
|
-
if (
|
|
745
|
-
const minItems =
|
|
746
|
-
const items =
|
|
743
|
+
if (chunk55Y2AQE7_js.shouldSkipSubtree(fiber)) continue;
|
|
744
|
+
if (chunk55Y2AQE7_js.isAlwaysListContainer(fiber) || chunk55Y2AQE7_js.isHeuristicListContainer(fiber)) {
|
|
745
|
+
const minItems = chunk55Y2AQE7_js.isAlwaysListContainer(fiber) || options.allowSingleHeuristic ? 1 : 2;
|
|
746
|
+
const items = chunk55Y2AQE7_js.findListItems(fiber, minItems);
|
|
747
747
|
if (items && items.length >= minItems) {
|
|
748
748
|
containers.push({
|
|
749
749
|
container: fiber,
|
|
750
750
|
items,
|
|
751
751
|
listId: listIdFromContainer(fiber),
|
|
752
752
|
listLabel: listLabelFromContainer(fiber),
|
|
753
|
-
containerType:
|
|
753
|
+
containerType: chunk55Y2AQE7_js.getTypeName(fiber.type) ?? chunk55Y2AQE7_js.getTypeName(fiber.elementType) ?? "List"
|
|
754
754
|
});
|
|
755
755
|
continue;
|
|
756
756
|
}
|
|
@@ -769,7 +769,7 @@ function findFirstTouchable(item) {
|
|
|
769
769
|
const { fiber, includeSibling } = stack.pop();
|
|
770
770
|
if (!fiber || visited.has(fiber)) continue;
|
|
771
771
|
visited.add(fiber);
|
|
772
|
-
if (
|
|
772
|
+
if (chunk55Y2AQE7_js.shouldSkipSubtree(fiber)) continue;
|
|
773
773
|
if (isPressableFiber(fiber)) {
|
|
774
774
|
const props = fiber.memoizedProps ?? {};
|
|
775
775
|
if (typeof props.onPress === "function" || typeof props.onPressIn === "function") {
|
|
@@ -796,7 +796,7 @@ function findTouchableFibers(item) {
|
|
|
796
796
|
const { fiber, includeSibling } = stack.pop();
|
|
797
797
|
if (!fiber || visited.has(fiber)) continue;
|
|
798
798
|
visited.add(fiber);
|
|
799
|
-
if (
|
|
799
|
+
if (chunk55Y2AQE7_js.shouldSkipSubtree(fiber)) continue;
|
|
800
800
|
const props = fiber.memoizedProps ?? {};
|
|
801
801
|
if (isPressableFiber(fiber) && (typeof props.onPress === "function" || typeof props.onPressIn === "function")) {
|
|
802
802
|
found.push(fiber);
|
|
@@ -840,7 +840,7 @@ function findFirstText(fiber) {
|
|
|
840
840
|
const node = stack.pop();
|
|
841
841
|
if (!node || visited.has(node)) continue;
|
|
842
842
|
visited.add(node);
|
|
843
|
-
const typeName =
|
|
843
|
+
const typeName = chunk55Y2AQE7_js.getTypeName(node.type) ?? chunk55Y2AQE7_js.getTypeName(node.elementType) ?? "";
|
|
844
844
|
if (typeName === "Text") {
|
|
845
845
|
const text = textFromChildren(node.memoizedProps?.children).trim();
|
|
846
846
|
if (text) return text;
|
|
@@ -859,7 +859,7 @@ function collectTexts(fiber) {
|
|
|
859
859
|
const node = stack.pop();
|
|
860
860
|
if (!node || visited.has(node)) continue;
|
|
861
861
|
visited.add(node);
|
|
862
|
-
const typeName =
|
|
862
|
+
const typeName = chunk55Y2AQE7_js.getTypeName(node.type) ?? chunk55Y2AQE7_js.getTypeName(node.elementType) ?? "";
|
|
863
863
|
if (typeName === "Text") {
|
|
864
864
|
const text = textFromChildren(node.memoizedProps?.children).trim();
|
|
865
865
|
if (text) out.push(text);
|
|
@@ -871,10 +871,10 @@ function collectTexts(fiber) {
|
|
|
871
871
|
}
|
|
872
872
|
function hasUsefulTouchableIdentity(fiber) {
|
|
873
873
|
const props = fiber?.memoizedProps ?? {};
|
|
874
|
-
if (
|
|
875
|
-
if (
|
|
876
|
-
if (
|
|
877
|
-
return
|
|
874
|
+
if (chunk55Y2AQE7_js.isReferenceable(props.testID)) return true;
|
|
875
|
+
if (chunk55Y2AQE7_js.isReferenceable(props.accessibilityLabel)) return true;
|
|
876
|
+
if (chunk55Y2AQE7_js.isReferenceable(props.label)) return true;
|
|
877
|
+
return chunk55Y2AQE7_js.isReferenceable(findFirstText(fiber));
|
|
878
878
|
}
|
|
879
879
|
function describeTouchable(fiber) {
|
|
880
880
|
const props = fiber?.memoizedProps ?? {};
|
|
@@ -885,10 +885,10 @@ function describeTouchable(fiber) {
|
|
|
885
885
|
}
|
|
886
886
|
function touchableLooksDestructive(fiber) {
|
|
887
887
|
const descriptor = describeTouchable(fiber);
|
|
888
|
-
if (descriptor &&
|
|
888
|
+
if (descriptor && chunk55Y2AQE7_js.looksDestructiveActionLabel(descriptor)) return true;
|
|
889
889
|
const props = fiber?.memoizedProps ?? {};
|
|
890
890
|
const haystack = [props.testID, props.accessibilityLabel, props.accessibilityHint, props.label].filter((value) => typeof value === "string").join(" ");
|
|
891
|
-
return
|
|
891
|
+
return chunk55Y2AQE7_js.looksDestructiveActionLabel(haystack);
|
|
892
892
|
}
|
|
893
893
|
function describeItemCandidate(listIndex, zeroBasedIndex, item) {
|
|
894
894
|
const syntheticId = `list-${listIndex}-item-${zeroBasedIndex + 1}`;
|
|
@@ -921,7 +921,7 @@ function pressResolvedListItem(list, itemFiber, listIndex, itemIndex) {
|
|
|
921
921
|
(candidate) => candidate !== touchable && containsFiber(touchable, candidate)
|
|
922
922
|
);
|
|
923
923
|
if (primaryWrapsNestedTargets) {
|
|
924
|
-
|
|
924
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
925
925
|
`listItemDispatch: item "list-${listIndex}-item-${itemIndex}" has nested pressables; pressing outer row target`
|
|
926
926
|
);
|
|
927
927
|
} else {
|
|
@@ -956,14 +956,14 @@ function pressResolvedListItem(list, itemFiber, listIndex, itemIndex) {
|
|
|
956
956
|
}
|
|
957
957
|
return {
|
|
958
958
|
ok: true,
|
|
959
|
-
containerType:
|
|
959
|
+
containerType: chunk55Y2AQE7_js.getTypeName(container.type) ?? chunk55Y2AQE7_js.getTypeName(container.elementType) ?? list.containerType
|
|
960
960
|
};
|
|
961
961
|
} catch (err) {
|
|
962
962
|
return {
|
|
963
963
|
ok: false,
|
|
964
964
|
reason: "press-threw",
|
|
965
965
|
error: err?.message ?? "press handler threw",
|
|
966
|
-
containerType:
|
|
966
|
+
containerType: chunk55Y2AQE7_js.getTypeName(container.type) ?? chunk55Y2AQE7_js.getTypeName(container.elementType) ?? list.containerType
|
|
967
967
|
};
|
|
968
968
|
}
|
|
969
969
|
}
|
|
@@ -1019,7 +1019,7 @@ function candidateLists(containers, locator) {
|
|
|
1019
1019
|
return containers.map((list, listIndex) => ({ list, listIndex }));
|
|
1020
1020
|
}
|
|
1021
1021
|
function pressListItemAtOrdinal(listIndex, itemIndex) {
|
|
1022
|
-
if (!
|
|
1022
|
+
if (!chunk55Y2AQE7_js.getFiberRoot()) return { ok: false, reason: "no-fiber-root" };
|
|
1023
1023
|
const containers = findListContainers({ allowSingleHeuristic: true });
|
|
1024
1024
|
if (listIndex < 0 || listIndex >= containers.length) {
|
|
1025
1025
|
return { ok: false, reason: "list-not-found" };
|
|
@@ -1033,7 +1033,7 @@ function pressListItemAtOrdinal(listIndex, itemIndex) {
|
|
|
1033
1033
|
return pressResolvedListItem(list, items[zeroBased], listIndex, itemIndex);
|
|
1034
1034
|
}
|
|
1035
1035
|
function resolveListItemByIdentity(locator) {
|
|
1036
|
-
if (!
|
|
1036
|
+
if (!chunk55Y2AQE7_js.getFiberRoot()) return { ok: false, result: { ok: false, reason: "no-fiber-root" } };
|
|
1037
1037
|
const parsed = locator.syntheticId ? parseSyntheticListItemId(locator.syntheticId) : null;
|
|
1038
1038
|
const effective = parsed ? { ...locator, listIndex: parsed.listIndex, itemIndex: parsed.itemIndex } : locator;
|
|
1039
1039
|
const containers = findListContainers({ allowSingleHeuristic: true });
|
|
@@ -1094,9 +1094,9 @@ function findSwitchFibers(item) {
|
|
|
1094
1094
|
const { fiber, includeSibling } = stack.pop();
|
|
1095
1095
|
if (!fiber || visited.has(fiber)) continue;
|
|
1096
1096
|
visited.add(fiber);
|
|
1097
|
-
if (
|
|
1097
|
+
if (chunk55Y2AQE7_js.shouldSkipSubtree(fiber)) continue;
|
|
1098
1098
|
const props = fiber.memoizedProps ?? {};
|
|
1099
|
-
if (
|
|
1099
|
+
if (chunk55Y2AQE7_js.isSwitchLike(fiber, props)) {
|
|
1100
1100
|
if (props.__appilotsInternal !== true) found.push(fiber);
|
|
1101
1101
|
if (includeSibling && fiber.sibling) {
|
|
1102
1102
|
stack.push({ fiber: fiber.sibling, includeSibling: true });
|
|
@@ -1130,7 +1130,7 @@ function toggleListItemByIdentity(locator, options) {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
const target = switches[0];
|
|
1132
1132
|
const props = target?.memoizedProps ?? {};
|
|
1133
|
-
const current =
|
|
1133
|
+
const current = chunk55Y2AQE7_js.switchValue(props);
|
|
1134
1134
|
if (options?.expected !== void 0 && current === options.expected) {
|
|
1135
1135
|
return { ok: true, containerType: list.containerType, value: current };
|
|
1136
1136
|
}
|
|
@@ -1171,7 +1171,7 @@ function screenDiagnose(targetId, category = "component-not-found") {
|
|
|
1171
1171
|
return {
|
|
1172
1172
|
category,
|
|
1173
1173
|
targetId,
|
|
1174
|
-
screen:
|
|
1174
|
+
screen: chunk55Y2AQE7_js.getCurrentScreen() ?? void 0
|
|
1175
1175
|
};
|
|
1176
1176
|
}
|
|
1177
1177
|
function isPressLike(action) {
|
|
@@ -1188,10 +1188,10 @@ function elementLookupKey(value) {
|
|
|
1188
1188
|
return canonicalElementId(value).toLowerCase().replace(/[\s_]+/g, "-");
|
|
1189
1189
|
}
|
|
1190
1190
|
function findRegisteredElement(elementId) {
|
|
1191
|
-
const direct =
|
|
1191
|
+
const direct = chunk55Y2AQE7_js.elementRegistry.get(elementId) ?? chunk55Y2AQE7_js.elementRegistry.get(canonicalElementId(elementId));
|
|
1192
1192
|
if (direct) return direct;
|
|
1193
1193
|
const wanted = elementLookupKey(elementId);
|
|
1194
|
-
return
|
|
1194
|
+
return chunk55Y2AQE7_js.elementRegistry.snapshot().find((element) => elementLookupKey(element.id) === wanted);
|
|
1195
1195
|
}
|
|
1196
1196
|
function resolveInteractionElement(elementId) {
|
|
1197
1197
|
return getLatestElement(elementId);
|
|
@@ -1451,7 +1451,7 @@ function dispatchElement(element, registry, action) {
|
|
|
1451
1451
|
}
|
|
1452
1452
|
function dispatchStructuredElementId(identifier, action) {
|
|
1453
1453
|
if (!isElementIdentifier(identifier) || !isPressLike(action)) return null;
|
|
1454
|
-
const parsed =
|
|
1454
|
+
const parsed = chunk55Y2AQE7_js.parseStableElementId(identifier);
|
|
1455
1455
|
if (!parsed || parsed.role !== "option") return null;
|
|
1456
1456
|
if (!parsed.itemKey && !parsed.listId) return null;
|
|
1457
1457
|
const pressed = pressListItemByIdentity({
|
|
@@ -1461,7 +1461,7 @@ function dispatchStructuredElementId(identifier, action) {
|
|
|
1461
1461
|
texts: parsed.itemKey ? [parsed.itemKey] : void 0
|
|
1462
1462
|
});
|
|
1463
1463
|
if (pressed.ok) {
|
|
1464
|
-
|
|
1464
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
1465
1465
|
`elementDispatch: resolved stale el id "${identifier}" via structural identity (listId="${parsed.listId}", itemKey="${parsed.itemKey}")`
|
|
1466
1466
|
);
|
|
1467
1467
|
return { success: true };
|
|
@@ -1490,20 +1490,20 @@ function normalize4(value) {
|
|
|
1490
1490
|
return value.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]/g, "");
|
|
1491
1491
|
}
|
|
1492
1492
|
function resolveScreenForFormFields() {
|
|
1493
|
-
const activePath =
|
|
1493
|
+
const activePath = chunk55Y2AQE7_js.getActiveRouteNames();
|
|
1494
1494
|
for (let i = activePath.length - 1; i >= 0; i--) {
|
|
1495
1495
|
const name = activePath[i];
|
|
1496
|
-
const meta = name ?
|
|
1496
|
+
const meta = name ? chunk55Y2AQE7_js.getScreenMetadata(name) : void 0;
|
|
1497
1497
|
if (name && Array.isArray(meta?.fields) && meta.fields.length > 0) return name;
|
|
1498
1498
|
}
|
|
1499
|
-
return
|
|
1499
|
+
return chunk55Y2AQE7_js.getCurrentScreen();
|
|
1500
1500
|
}
|
|
1501
1501
|
function collectKnownFormFields(registry) {
|
|
1502
1502
|
const registryFields = registry.snapshot().filter((entry) => entry.kind === "field" || entry.kind === "slider").map((entry) => ({ id: entry.id, label: entry.label }));
|
|
1503
1503
|
if (registryFields.length >= 2) return registryFields;
|
|
1504
1504
|
const screen = resolveScreenForFormFields();
|
|
1505
1505
|
if (screen) {
|
|
1506
|
-
const metaFields =
|
|
1506
|
+
const metaFields = chunk55Y2AQE7_js.getScreenMetadata(screen)?.fields;
|
|
1507
1507
|
if (Array.isArray(metaFields) && metaFields.length > 0) {
|
|
1508
1508
|
return metaFields.filter((field) => !!field && typeof field.id === "string").map((field) => ({
|
|
1509
1509
|
id: field.id,
|
|
@@ -1513,7 +1513,7 @@ function collectKnownFormFields(registry) {
|
|
|
1513
1513
|
}));
|
|
1514
1514
|
}
|
|
1515
1515
|
}
|
|
1516
|
-
for (const meta of
|
|
1516
|
+
for (const meta of chunk55Y2AQE7_js.getAllScreens()) {
|
|
1517
1517
|
if (Array.isArray(meta.fields) && meta.fields.length > 0) {
|
|
1518
1518
|
return meta.fields.filter((field) => !!field && typeof field.id === "string").map((field) => ({
|
|
1519
1519
|
id: field.id,
|
|
@@ -1626,7 +1626,7 @@ function rewriteMisplacedFormFillFields(fields, registry) {
|
|
|
1626
1626
|
const inferred = inferFieldIdForValue(String(field.value ?? ""), knownFields, used);
|
|
1627
1627
|
if (!inferred) return field;
|
|
1628
1628
|
used.add(inferred);
|
|
1629
|
-
|
|
1629
|
+
chunk55Y2AQE7_js.appilotsDebugWarn(
|
|
1630
1630
|
`formFieldRewrite: ${field.fieldId} \u2192 ${inferred} (value=${JSON.stringify(field.value)})`
|
|
1631
1631
|
);
|
|
1632
1632
|
return { ...field, fieldId: inferred };
|
|
@@ -1634,8 +1634,8 @@ function rewriteMisplacedFormFillFields(fields, registry) {
|
|
|
1634
1634
|
}
|
|
1635
1635
|
|
|
1636
1636
|
// src/executor/formValidation.ts
|
|
1637
|
-
var FORM_VALIDATION_TEXT_RE2 =
|
|
1638
|
-
var FORM_SUCCESS_TEXT_RE =
|
|
1637
|
+
var FORM_VALIDATION_TEXT_RE2 = chunk55Y2AQE7_js.FORM_VALIDATION_TEXT_RE;
|
|
1638
|
+
var FORM_SUCCESS_TEXT_RE = chunk55Y2AQE7_js.FORM_WRITE_SUCCESS_TEXT_RE;
|
|
1639
1639
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
1640
1640
|
function inferValidationFieldId(message, inputs) {
|
|
1641
1641
|
const haystack = normalizeText(message);
|
|
@@ -1672,7 +1672,7 @@ function readVisibleFormSuccess(snap) {
|
|
|
1672
1672
|
return (snap.texts ?? []).find((text) => text?.trim() && FORM_SUCCESS_TEXT_RE.test(text));
|
|
1673
1673
|
}
|
|
1674
1674
|
function submitAsyncStillPending(submitTargetId) {
|
|
1675
|
-
const probe =
|
|
1675
|
+
const probe = chunk55Y2AQE7_js.probeLoadingState(submitTargetId ?? null, chunk55Y2AQE7_js.getCurrentScreen());
|
|
1676
1676
|
if (probe.loading) return true;
|
|
1677
1677
|
if (submitTargetId && probe.pressedFound && probe.pressedDisabled) return true;
|
|
1678
1678
|
return false;
|
|
@@ -1684,7 +1684,7 @@ function evaluatePostSubmitSnapshot(snap, activePath) {
|
|
|
1684
1684
|
}
|
|
1685
1685
|
const successText = readVisibleFormSuccess(snap);
|
|
1686
1686
|
if (successText) return { status: "success", message: successText };
|
|
1687
|
-
if (!
|
|
1687
|
+
if (!chunk55Y2AQE7_js.snapshotShowsOpenCreateForm(snap, activePath)) {
|
|
1688
1688
|
return { status: "success" };
|
|
1689
1689
|
}
|
|
1690
1690
|
return void 0;
|
|
@@ -1700,7 +1700,7 @@ async function waitForPostSubmitOutcome(options) {
|
|
|
1700
1700
|
continue;
|
|
1701
1701
|
}
|
|
1702
1702
|
const snap2 = captureSnapshot();
|
|
1703
|
-
const activePath2 =
|
|
1703
|
+
const activePath2 = chunk55Y2AQE7_js.getActiveRouteNames();
|
|
1704
1704
|
const outcome2 = evaluatePostSubmitSnapshot(snap2, activePath2);
|
|
1705
1705
|
if (outcome2) return outcome2;
|
|
1706
1706
|
await sleep(pollMs);
|
|
@@ -1712,7 +1712,7 @@ async function waitForPostSubmitOutcome(options) {
|
|
|
1712
1712
|
};
|
|
1713
1713
|
}
|
|
1714
1714
|
const snap = captureSnapshot();
|
|
1715
|
-
const activePath =
|
|
1715
|
+
const activePath = chunk55Y2AQE7_js.getActiveRouteNames();
|
|
1716
1716
|
const outcome = evaluatePostSubmitSnapshot(snap, activePath);
|
|
1717
1717
|
if (outcome) return outcome;
|
|
1718
1718
|
return {
|
|
@@ -1818,16 +1818,16 @@ function findSnapshotButton(targetId) {
|
|
|
1818
1818
|
}
|
|
1819
1819
|
}
|
|
1820
1820
|
function buildUiDiagnose(targetId, cause) {
|
|
1821
|
-
const activePath =
|
|
1822
|
-
const screen = activePath[activePath.length - 1] ??
|
|
1821
|
+
const activePath = chunk55Y2AQE7_js.getActiveRouteNames();
|
|
1822
|
+
const screen = activePath[activePath.length - 1] ?? chunk55Y2AQE7_js.getCurrentScreen() ?? void 0;
|
|
1823
1823
|
const screenPath = activePath.length > 1 ? activePath.join("/") : screen;
|
|
1824
1824
|
const diagnose = {
|
|
1825
1825
|
category: cause === "not-found" ? "component-not-found" : cause === "disabled" ? "disabled" : "unknown",
|
|
1826
1826
|
targetId,
|
|
1827
1827
|
screen: screenPath
|
|
1828
1828
|
};
|
|
1829
|
-
if (
|
|
1830
|
-
diagnose.visibleMessage =
|
|
1829
|
+
if (chunk55Y2AQE7_js.isOptionalStepAutomationFailure(targetId, screenPath, activePath)) {
|
|
1830
|
+
diagnose.visibleMessage = chunk55Y2AQE7_js.OPTIONAL_STEP_AUTOMATION_HINT;
|
|
1831
1831
|
diagnose.recoverable = true;
|
|
1832
1832
|
}
|
|
1833
1833
|
return diagnose;
|
|
@@ -1885,15 +1885,15 @@ function resolveComponentId(componentId, registry, action) {
|
|
|
1885
1885
|
const snapshot = registry.snapshot();
|
|
1886
1886
|
for (const comp of snapshot) {
|
|
1887
1887
|
if (comp.id.toLowerCase() === lower) {
|
|
1888
|
-
|
|
1888
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
1889
1889
|
`resolveComponentId: case-insensitive match "${componentId}" \u2192 "${comp.id}"`
|
|
1890
1890
|
);
|
|
1891
1891
|
return comp.id;
|
|
1892
1892
|
}
|
|
1893
1893
|
}
|
|
1894
|
-
const currentScreen =
|
|
1894
|
+
const currentScreen = chunk55Y2AQE7_js.getCurrentScreen();
|
|
1895
1895
|
if (currentScreen) {
|
|
1896
|
-
const screenMeta =
|
|
1896
|
+
const screenMeta = chunk55Y2AQE7_js.getScreenMetadata(currentScreen);
|
|
1897
1897
|
const actions = screenMeta?.actions;
|
|
1898
1898
|
if (actions && Array.isArray(actions)) {
|
|
1899
1899
|
const metaAction = actions.find(
|
|
@@ -1902,14 +1902,14 @@ function resolveComponentId(componentId, registry, action) {
|
|
|
1902
1902
|
if (metaAction && typeof metaAction === "object" && metaAction.label) {
|
|
1903
1903
|
const metaLabel = metaAction.label;
|
|
1904
1904
|
const normalizedMetaLabel = metaLabel.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]/g, "");
|
|
1905
|
-
|
|
1905
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
1906
1906
|
`resolveComponentId: found screen metadata for "${componentId}" \u2192 label="${metaLabel}"`
|
|
1907
1907
|
);
|
|
1908
1908
|
for (const comp of snapshot) {
|
|
1909
1909
|
if (!comp.label) continue;
|
|
1910
1910
|
const compLabel = comp.label.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]/g, "");
|
|
1911
1911
|
if (compLabel === normalizedMetaLabel || compLabel.includes(normalizedMetaLabel) || normalizedMetaLabel.includes(compLabel)) {
|
|
1912
|
-
|
|
1912
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
1913
1913
|
`resolveComponentId: FOUND via metadata: "${componentId}" \u2192 "${comp.id}" (label="${comp.label}")`
|
|
1914
1914
|
);
|
|
1915
1915
|
return comp.id;
|
|
@@ -1926,7 +1926,7 @@ function resolveComponentId(componentId, registry, action) {
|
|
|
1926
1926
|
}));
|
|
1927
1927
|
const match = resolveTarget(componentId, candidates, { action });
|
|
1928
1928
|
if (match.status === "matched") {
|
|
1929
|
-
|
|
1929
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
1930
1930
|
`resolveComponentId: matched "${componentId}" -> "${match.id}" (tier=${match.tier})`
|
|
1931
1931
|
);
|
|
1932
1932
|
return match.id;
|
|
@@ -2016,7 +2016,7 @@ function setValueHandler(rawComponentId, requested, registry) {
|
|
|
2016
2016
|
try {
|
|
2017
2017
|
slider.setValue(applied);
|
|
2018
2018
|
if (applied !== requestedValue) {
|
|
2019
|
-
|
|
2019
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2020
2020
|
`uiInteractionHandler: set_value snapped ${requestedValue} \u2192 ${applied} for "${componentId}" (step=${step})`
|
|
2021
2021
|
);
|
|
2022
2022
|
}
|
|
@@ -2051,7 +2051,7 @@ function checkModalOcclusion(rawComponentId, action) {
|
|
|
2051
2051
|
return null;
|
|
2052
2052
|
}
|
|
2053
2053
|
if (typeof rawComponentId !== "string" || rawComponentId.trim().length === 0) return null;
|
|
2054
|
-
const dialog =
|
|
2054
|
+
const dialog = chunk55Y2AQE7_js.getOpenNativeDialog();
|
|
2055
2055
|
if (dialog) {
|
|
2056
2056
|
const needle = normalizeIdent(rawComponentId);
|
|
2057
2057
|
if (dialog.buttons.some((b) => normalizeIdent(b.label) === needle)) return null;
|
|
@@ -2061,16 +2061,16 @@ function checkModalOcclusion(rawComponentId, action) {
|
|
|
2061
2061
|
diagnose: {
|
|
2062
2062
|
category: "ambiguous-target",
|
|
2063
2063
|
targetId: rawComponentId,
|
|
2064
|
-
screen:
|
|
2064
|
+
screen: chunk55Y2AQE7_js.getCurrentScreen() ?? void 0,
|
|
2065
2065
|
candidates: dialog.buttons.map((b) => b.label).slice(0, 8)
|
|
2066
2066
|
}
|
|
2067
2067
|
};
|
|
2068
2068
|
}
|
|
2069
|
-
const fiberRoot =
|
|
2069
|
+
const fiberRoot = chunk55Y2AQE7_js.getFiberRoot();
|
|
2070
2070
|
if (!fiberRoot) return null;
|
|
2071
2071
|
let snap;
|
|
2072
2072
|
try {
|
|
2073
|
-
snap =
|
|
2073
|
+
snap = chunk55Y2AQE7_js.walkFiber(fiberRoot);
|
|
2074
2074
|
} catch {
|
|
2075
2075
|
return null;
|
|
2076
2076
|
}
|
|
@@ -2132,7 +2132,7 @@ function checkModalOcclusion(rawComponentId, action) {
|
|
|
2132
2132
|
}
|
|
2133
2133
|
function uiInteractionHandler(payload, context) {
|
|
2134
2134
|
const { permissions } = context;
|
|
2135
|
-
const registry = context.registry ??
|
|
2135
|
+
const registry = context.registry ?? chunk55Y2AQE7_js.componentRegistry;
|
|
2136
2136
|
if (!permissions.canInteractUI) {
|
|
2137
2137
|
return {
|
|
2138
2138
|
success: false,
|
|
@@ -2154,7 +2154,7 @@ function uiInteractionHandler(payload, context) {
|
|
|
2154
2154
|
if (sliderId) {
|
|
2155
2155
|
const smuggled = payload.value ?? payload.params?.value;
|
|
2156
2156
|
if (smuggled !== void 0) {
|
|
2157
|
-
|
|
2157
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2158
2158
|
`uiInteractionHandler: "${actionStr}" on slider "${sliderId}" carried value=${JSON.stringify(smuggled)} \u2014 routing to set_value`
|
|
2159
2159
|
);
|
|
2160
2160
|
return setValueHandler(rawComponentId, smuggled, registry);
|
|
@@ -2165,23 +2165,23 @@ function uiInteractionHandler(payload, context) {
|
|
|
2165
2165
|
diagnose: { ...buildUiDiagnose(sliderId, "unknown"), recoverable: true }
|
|
2166
2166
|
};
|
|
2167
2167
|
}
|
|
2168
|
-
const openDialog =
|
|
2168
|
+
const openDialog = chunk55Y2AQE7_js.getOpenNativeDialog();
|
|
2169
2169
|
const isPressVerb = actionStr === "press" || actionStr === "tap" || actionStr === "click";
|
|
2170
2170
|
if (openDialog && isPressVerb) {
|
|
2171
2171
|
const needle = normalizeIdent(rawComponentId);
|
|
2172
2172
|
const button = openDialog.buttons.find((b) => normalizeIdent(b.label) === needle);
|
|
2173
2173
|
if (button) {
|
|
2174
2174
|
button.press();
|
|
2175
|
-
|
|
2175
|
+
chunk55Y2AQE7_js.appilotsDebugLog(`uiInteractionHandler: pressed native dialog button "${button.label}"`);
|
|
2176
2176
|
return { success: true, effect: "changed" };
|
|
2177
2177
|
}
|
|
2178
2178
|
}
|
|
2179
2179
|
if (!openDialog && isPressVerb) {
|
|
2180
|
-
const answered =
|
|
2180
|
+
const answered = chunk55Y2AQE7_js.getLastAnsweredNativeDialog();
|
|
2181
2181
|
const needle = normalizeIdent(rawComponentId);
|
|
2182
2182
|
if (answered && needle) {
|
|
2183
2183
|
if (answered.answeredWith && normalizeIdent(answered.answeredWith) === needle) {
|
|
2184
|
-
|
|
2184
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2185
2185
|
`uiInteractionHandler: native dialog button "${answered.answeredWith}" was already pressed and the dialog is closed \u2014 treating the repeat as done`
|
|
2186
2186
|
);
|
|
2187
2187
|
return { success: true, effect: "completed" };
|
|
@@ -2193,7 +2193,7 @@ function uiInteractionHandler(payload, context) {
|
|
|
2193
2193
|
diagnose: {
|
|
2194
2194
|
category: "component-not-found",
|
|
2195
2195
|
targetId: rawComponentId,
|
|
2196
|
-
screen:
|
|
2196
|
+
screen: chunk55Y2AQE7_js.getCurrentScreen() ?? void 0,
|
|
2197
2197
|
recoverable: false
|
|
2198
2198
|
}
|
|
2199
2199
|
};
|
|
@@ -2202,7 +2202,7 @@ function uiInteractionHandler(payload, context) {
|
|
|
2202
2202
|
}
|
|
2203
2203
|
const occluded = checkModalOcclusion(rawComponentId, actionStr);
|
|
2204
2204
|
if (occluded) {
|
|
2205
|
-
|
|
2205
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2206
2206
|
`uiInteractionHandler: blocked "${actionStr}" on "${rawComponentId}" \u2014 target is behind an open modal`
|
|
2207
2207
|
);
|
|
2208
2208
|
return occluded;
|
|
@@ -2210,7 +2210,7 @@ function uiInteractionHandler(payload, context) {
|
|
|
2210
2210
|
if (typeof rawComponentId === "string" && rawComponentId.trim().toLowerCase().startsWith("el:")) {
|
|
2211
2211
|
const result = dispatchElementOrTarget(rawComponentId, registry, actionStr);
|
|
2212
2212
|
if (result.success) {
|
|
2213
|
-
|
|
2213
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2214
2214
|
`uiInteractionHandler: interaction element dispatch succeeded for "${rawComponentId}"`
|
|
2215
2215
|
);
|
|
2216
2216
|
return { success: true };
|
|
@@ -2219,17 +2219,17 @@ function uiInteractionHandler(payload, context) {
|
|
|
2219
2219
|
}
|
|
2220
2220
|
const ordinal = parseSyntheticListItemId(rawComponentId);
|
|
2221
2221
|
if (ordinal && (action === "press" || actionStr === "tap" || actionStr === "click" || actionStr === "longPress")) {
|
|
2222
|
-
|
|
2222
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2223
2223
|
`uiInteractionHandler: dispatching synthetic list ordinal \u2014 componentId="${rawComponentId}" list=${ordinal.listIndex} item=${ordinal.itemIndex}`
|
|
2224
2224
|
);
|
|
2225
2225
|
const result = pressListItemAtOrdinal(ordinal.listIndex, ordinal.itemIndex);
|
|
2226
2226
|
if (result.ok) {
|
|
2227
|
-
|
|
2227
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2228
2228
|
`uiInteractionHandler: synthetic ordinal press succeeded (container=${result.containerType ?? "List"})`
|
|
2229
2229
|
);
|
|
2230
2230
|
return { success: true };
|
|
2231
2231
|
}
|
|
2232
|
-
const screen =
|
|
2232
|
+
const screen = chunk55Y2AQE7_js.getCurrentScreen() ?? void 0;
|
|
2233
2233
|
if (result.reason === "list-not-found" || result.reason === "item-not-found") {
|
|
2234
2234
|
return {
|
|
2235
2235
|
success: false,
|
|
@@ -2270,7 +2270,7 @@ function uiInteractionHandler(payload, context) {
|
|
|
2270
2270
|
};
|
|
2271
2271
|
}
|
|
2272
2272
|
const componentId = resolveComponentId(rawComponentId, registry, actionStr);
|
|
2273
|
-
|
|
2273
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2274
2274
|
`uiInteractionHandler: resolved componentId="${payload.componentId}" \u2192 "${componentId}"`
|
|
2275
2275
|
);
|
|
2276
2276
|
const target = registry.getTarget(componentId);
|
|
@@ -2323,7 +2323,7 @@ function uiInteractionHandler(payload, context) {
|
|
|
2323
2323
|
return { success: false, error: err?.message ?? "Focus failed" };
|
|
2324
2324
|
}
|
|
2325
2325
|
}
|
|
2326
|
-
|
|
2326
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2327
2327
|
`uiInteractionHandler: registry miss for "${componentId}", falling back to fiber tree`
|
|
2328
2328
|
);
|
|
2329
2329
|
const handle = findInteractiveByIdentifier(componentId, {
|
|
@@ -2333,7 +2333,7 @@ function uiInteractionHandler(payload, context) {
|
|
|
2333
2333
|
try {
|
|
2334
2334
|
if (actionStr === "press" && handle.kind === "target" && handle.press) {
|
|
2335
2335
|
handle.press();
|
|
2336
|
-
|
|
2336
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2337
2337
|
`uiInteractionHandler: fiber fallback press succeeded for "${componentId}"`
|
|
2338
2338
|
);
|
|
2339
2339
|
return { success: true };
|
|
@@ -2400,7 +2400,7 @@ function submitLabelHintsSubmit(label) {
|
|
|
2400
2400
|
return SUBMIT_LABEL_HINT_RE.test(trimmed);
|
|
2401
2401
|
}
|
|
2402
2402
|
function screenDeclaresSubmitAction(screenName) {
|
|
2403
|
-
const meta =
|
|
2403
|
+
const meta = chunk55Y2AQE7_js.getScreenMetadata(screenName);
|
|
2404
2404
|
return Array.isArray(meta?.actions) && meta.actions.some(
|
|
2405
2405
|
(action) => typeof action === "object" && action !== null && action.type === "submit"
|
|
2406
2406
|
);
|
|
@@ -2433,7 +2433,7 @@ function resolveFormScreensForSubmit(screen, activePath, registry) {
|
|
|
2433
2433
|
} else {
|
|
2434
2434
|
push(screen);
|
|
2435
2435
|
}
|
|
2436
|
-
push(
|
|
2436
|
+
push(chunk55Y2AQE7_js.getCurrentScreen() ?? void 0);
|
|
2437
2437
|
const withSubmit = [];
|
|
2438
2438
|
const rest = [];
|
|
2439
2439
|
for (const name of ordered) {
|
|
@@ -2451,7 +2451,7 @@ function collectSubmitTargetCandidates(screens, registry) {
|
|
|
2451
2451
|
candidates.push(id);
|
|
2452
2452
|
};
|
|
2453
2453
|
for (const screenName of screens) {
|
|
2454
|
-
const meta =
|
|
2454
|
+
const meta = chunk55Y2AQE7_js.getScreenMetadata(screenName);
|
|
2455
2455
|
const submitMeta = Array.isArray(meta?.actions) ? meta.actions.find(
|
|
2456
2456
|
(action) => typeof action === "object" && action !== null && action.type === "submit"
|
|
2457
2457
|
) : void 0;
|
|
@@ -2495,8 +2495,8 @@ function readVisibleValidation(fieldId, label) {
|
|
|
2495
2495
|
return void 0;
|
|
2496
2496
|
}
|
|
2497
2497
|
function resolveScreenContext() {
|
|
2498
|
-
const activePath =
|
|
2499
|
-
const screen = activePath[activePath.length - 1] ??
|
|
2498
|
+
const activePath = chunk55Y2AQE7_js.getActiveRouteNames();
|
|
2499
|
+
const screen = activePath[activePath.length - 1] ?? chunk55Y2AQE7_js.getCurrentScreen() ?? void 0;
|
|
2500
2500
|
return { screen, activePath };
|
|
2501
2501
|
}
|
|
2502
2502
|
function selectValueApplied(fieldId, requestedValue, currentValue, registry) {
|
|
@@ -2504,36 +2504,36 @@ function selectValueApplied(fieldId, requestedValue, currentValue, registry) {
|
|
|
2504
2504
|
if (!requested) return false;
|
|
2505
2505
|
const meta = getMetadataField(fieldId, registry);
|
|
2506
2506
|
const options = Array.isArray(meta?.options) ? meta.options : [];
|
|
2507
|
-
const requestedNorm =
|
|
2508
|
-
const currentNorm =
|
|
2507
|
+
const requestedNorm = chunk55Y2AQE7_js.normalize3(requested);
|
|
2508
|
+
const currentNorm = chunk55Y2AQE7_js.normalize3(currentValue);
|
|
2509
2509
|
if (currentNorm === requestedNorm) return true;
|
|
2510
2510
|
for (const option of options) {
|
|
2511
2511
|
const value = typeof option?.value === "string" ? option.value : "";
|
|
2512
2512
|
const label = typeof option?.label === "string" ? option.label : "";
|
|
2513
|
-
if (
|
|
2514
|
-
if (
|
|
2515
|
-
if (
|
|
2513
|
+
if (chunk55Y2AQE7_js.normalize3(value) === requestedNorm && chunk55Y2AQE7_js.normalize3(label) === currentNorm) return true;
|
|
2514
|
+
if (chunk55Y2AQE7_js.normalize3(label) === requestedNorm && chunk55Y2AQE7_js.normalize3(label) === currentNorm) return true;
|
|
2515
|
+
if (chunk55Y2AQE7_js.normalize3(value) === requestedNorm && chunk55Y2AQE7_js.normalize3(value) === currentNorm) return true;
|
|
2516
2516
|
}
|
|
2517
2517
|
return false;
|
|
2518
2518
|
}
|
|
2519
2519
|
function getMetadataField(fieldId, registry) {
|
|
2520
2520
|
const screens = /* @__PURE__ */ new Set();
|
|
2521
|
-
for (const name of
|
|
2522
|
-
const current =
|
|
2521
|
+
for (const name of chunk55Y2AQE7_js.getActiveRouteNames()) screens.add(name);
|
|
2522
|
+
const current = chunk55Y2AQE7_js.getCurrentScreen();
|
|
2523
2523
|
if (current) screens.add(current);
|
|
2524
2524
|
if (registry) {
|
|
2525
2525
|
for (const comp of registry.snapshot()) {
|
|
2526
2526
|
if (comp.kind === "field" && comp.screen) screens.add(comp.screen);
|
|
2527
2527
|
}
|
|
2528
2528
|
}
|
|
2529
|
-
const needle =
|
|
2529
|
+
const needle = chunk55Y2AQE7_js.normalize3(fieldId);
|
|
2530
2530
|
for (const screenName of screens) {
|
|
2531
|
-
const screenMeta =
|
|
2531
|
+
const screenMeta = chunk55Y2AQE7_js.getScreenMetadata(screenName);
|
|
2532
2532
|
const fields = Array.isArray(screenMeta?.fields) ? screenMeta.fields : [];
|
|
2533
2533
|
const match = fields.find((field) => {
|
|
2534
2534
|
if (!field || typeof field !== "object") return false;
|
|
2535
|
-
const id = typeof field.id === "string" ?
|
|
2536
|
-
const label = typeof field.label === "string" ?
|
|
2535
|
+
const id = typeof field.id === "string" ? chunk55Y2AQE7_js.normalize3(field.id) : "";
|
|
2536
|
+
const label = typeof field.label === "string" ? chunk55Y2AQE7_js.normalize3(field.label) : "";
|
|
2537
2537
|
return id === needle || label === needle;
|
|
2538
2538
|
});
|
|
2539
2539
|
if (match) return match;
|
|
@@ -2545,11 +2545,11 @@ function resolveSelectOption(fieldId, value, registry) {
|
|
|
2545
2545
|
if (!requested) return void 0;
|
|
2546
2546
|
const meta = getMetadataField(fieldId, registry);
|
|
2547
2547
|
const options = Array.isArray(meta?.options) ? meta.options : [];
|
|
2548
|
-
const requestedNorm =
|
|
2548
|
+
const requestedNorm = chunk55Y2AQE7_js.normalize3(requested);
|
|
2549
2549
|
for (const option of options) {
|
|
2550
2550
|
const optionValue = typeof option?.value === "string" ? option.value : "";
|
|
2551
2551
|
const optionLabel = typeof option?.label === "string" ? option.label : "";
|
|
2552
|
-
if (
|
|
2552
|
+
if (chunk55Y2AQE7_js.normalize3(optionValue) === requestedNorm || chunk55Y2AQE7_js.normalize3(optionLabel) === requestedNorm) {
|
|
2553
2553
|
return { value: optionValue, label: optionLabel };
|
|
2554
2554
|
}
|
|
2555
2555
|
}
|
|
@@ -2599,12 +2599,12 @@ async function tryPressSelectOption(fieldId, value, registry, options = {}) {
|
|
|
2599
2599
|
return {
|
|
2600
2600
|
success: false,
|
|
2601
2601
|
error: `No pressable option found for select field "${fieldId}"`,
|
|
2602
|
-
diagnose: { category: "component-not-found", fieldId, screen:
|
|
2602
|
+
diagnose: { category: "component-not-found", fieldId, screen: chunk55Y2AQE7_js.getCurrentScreen() ?? void 0 }
|
|
2603
2603
|
};
|
|
2604
2604
|
}
|
|
2605
2605
|
function normalizeFieldType(type) {
|
|
2606
2606
|
if (typeof type !== "string") return void 0;
|
|
2607
|
-
const normalized =
|
|
2607
|
+
const normalized = chunk55Y2AQE7_js.normalize3(type);
|
|
2608
2608
|
if (normalized === "select" || normalized === "picker" || normalized === "dropdown")
|
|
2609
2609
|
return "select";
|
|
2610
2610
|
if (normalized === "toggle" || normalized === "switch" || normalized === "checkbox")
|
|
@@ -2634,7 +2634,7 @@ function fieldCueTerms(fieldId, label) {
|
|
|
2634
2634
|
);
|
|
2635
2635
|
const terms = /* @__PURE__ */ new Set();
|
|
2636
2636
|
for (const value of raw) {
|
|
2637
|
-
const normalized =
|
|
2637
|
+
const normalized = chunk55Y2AQE7_js.normalize3(value);
|
|
2638
2638
|
if (normalized.length >= 3 && normalized !== "id") terms.add(normalized);
|
|
2639
2639
|
}
|
|
2640
2640
|
return [...terms];
|
|
@@ -2642,17 +2642,17 @@ function fieldCueTerms(fieldId, label) {
|
|
|
2642
2642
|
function snapshotHasFieldCue(snap, fieldId, label) {
|
|
2643
2643
|
const terms = fieldCueTerms(fieldId, label);
|
|
2644
2644
|
if (terms.length === 0) return false;
|
|
2645
|
-
const visible = [...snap.texts ?? [], ...(snap.buttons ?? []).map((b) => b.label ?? b.id ?? "")].map((text) =>
|
|
2645
|
+
const visible = [...snap.texts ?? [], ...(snap.buttons ?? []).map((b) => b.label ?? b.id ?? "")].map((text) => chunk55Y2AQE7_js.normalize3(text)).filter(Boolean);
|
|
2646
2646
|
return visible.some((text) => terms.some((term) => text.includes(term) || term.includes(text)));
|
|
2647
2647
|
}
|
|
2648
2648
|
function scoreCandidateText(value, texts) {
|
|
2649
|
-
const valueNorm =
|
|
2649
|
+
const valueNorm = chunk55Y2AQE7_js.normalize3(String(value ?? ""));
|
|
2650
2650
|
if (!valueNorm) return 0;
|
|
2651
2651
|
let best = 0;
|
|
2652
2652
|
for (const text of texts) {
|
|
2653
|
-
const textNorm =
|
|
2653
|
+
const textNorm = chunk55Y2AQE7_js.normalize3(text);
|
|
2654
2654
|
if (!textNorm) continue;
|
|
2655
|
-
best = Math.max(best,
|
|
2655
|
+
best = Math.max(best, chunk55Y2AQE7_js.matchScore(valueNorm, textNorm));
|
|
2656
2656
|
}
|
|
2657
2657
|
return best;
|
|
2658
2658
|
}
|
|
@@ -2666,7 +2666,7 @@ function optionTexts(option) {
|
|
|
2666
2666
|
function buildChoiceCandidates(snap, fieldId, value, allowFirstVisibleWhenNoCue, registry) {
|
|
2667
2667
|
const fieldLabel = getFieldLabel(fieldId, registry);
|
|
2668
2668
|
const fieldCueVisible = snapshotHasFieldCue(snap, fieldId, fieldLabel);
|
|
2669
|
-
const genericValue =
|
|
2669
|
+
const genericValue = chunk55Y2AQE7_js.isGenericSelectValue(value);
|
|
2670
2670
|
const candidates = [];
|
|
2671
2671
|
let order = 0;
|
|
2672
2672
|
const choiceGroups = snap.choiceGroups ?? [];
|
|
@@ -2678,7 +2678,7 @@ function buildChoiceCandidates(snap, fieldId, value, allowFirstVisibleWhenNoCue,
|
|
|
2678
2678
|
const groupCueScore = Math.max(
|
|
2679
2679
|
globalCueScore,
|
|
2680
2680
|
...groupTexts.map((text) => {
|
|
2681
|
-
const normalized =
|
|
2681
|
+
const normalized = chunk55Y2AQE7_js.normalize3(text);
|
|
2682
2682
|
return fieldCueTerms(fieldId, fieldLabel).some(
|
|
2683
2683
|
(term) => normalized.includes(term) || term.includes(normalized)
|
|
2684
2684
|
) ? 80 : 0;
|
|
@@ -2715,7 +2715,7 @@ function buildChoiceCandidates(snap, fieldId, value, allowFirstVisibleWhenNoCue,
|
|
|
2715
2715
|
const elementCueScore = Math.max(
|
|
2716
2716
|
fieldCueVisible && elements.length <= 12 ? 50 : 0,
|
|
2717
2717
|
...cueTexts.map((text) => {
|
|
2718
|
-
const normalized =
|
|
2718
|
+
const normalized = chunk55Y2AQE7_js.normalize3(text);
|
|
2719
2719
|
return fieldTerms.some((term) => normalized.includes(term) || term.includes(normalized)) ? 80 : 0;
|
|
2720
2720
|
})
|
|
2721
2721
|
);
|
|
@@ -2773,7 +2773,7 @@ async function selectVisibleChoiceAsync(fieldId, value, registry, options) {
|
|
|
2773
2773
|
return {
|
|
2774
2774
|
success: false,
|
|
2775
2775
|
error: err?.message ?? "Could not capture visible choices",
|
|
2776
|
-
diagnose: { category: "unknown", fieldId, screen:
|
|
2776
|
+
diagnose: { category: "unknown", fieldId, screen: chunk55Y2AQE7_js.getCurrentScreen() ?? void 0 }
|
|
2777
2777
|
};
|
|
2778
2778
|
}
|
|
2779
2779
|
const candidates = buildChoiceCandidates(
|
|
@@ -2791,7 +2791,7 @@ async function selectVisibleChoiceAsync(fieldId, value, registry, options) {
|
|
|
2791
2791
|
diagnose: {
|
|
2792
2792
|
category: "component-not-found",
|
|
2793
2793
|
fieldId,
|
|
2794
|
-
screen:
|
|
2794
|
+
screen: chunk55Y2AQE7_js.getCurrentScreen() ?? void 0
|
|
2795
2795
|
}
|
|
2796
2796
|
};
|
|
2797
2797
|
}
|
|
@@ -2805,7 +2805,7 @@ async function selectVisibleChoiceAsync(fieldId, value, registry, options) {
|
|
|
2805
2805
|
}
|
|
2806
2806
|
function isContinuationButton(label) {
|
|
2807
2807
|
if (!label) return false;
|
|
2808
|
-
return /^(next|continue|proximo|prox|continuar|avancar|avançar)$/i.test(
|
|
2808
|
+
return /^(next|continue|proximo|prox|continuar|avancar|avançar)$/i.test(chunk55Y2AQE7_js.normalize3(label));
|
|
2809
2809
|
}
|
|
2810
2810
|
function pressContinuationButton(registry) {
|
|
2811
2811
|
const snap = captureSnapshot();
|
|
@@ -2818,40 +2818,40 @@ function pressContinuationButton(registry) {
|
|
|
2818
2818
|
return {
|
|
2819
2819
|
success: false,
|
|
2820
2820
|
error: "No enabled continuation button is visible",
|
|
2821
|
-
diagnose: { category: "component-not-found", screen:
|
|
2821
|
+
diagnose: { category: "component-not-found", screen: chunk55Y2AQE7_js.getCurrentScreen() ?? void 0 }
|
|
2822
2822
|
};
|
|
2823
2823
|
}
|
|
2824
2824
|
return pressTargetByIdOrLabel(id, registry);
|
|
2825
2825
|
}
|
|
2826
2826
|
function findField(fieldId, registry) {
|
|
2827
|
-
|
|
2827
|
+
chunk55Y2AQE7_js.appilotsDebugLog(`findField: searching for fieldId="${fieldId}"`);
|
|
2828
2828
|
const exact = registry.getField(fieldId);
|
|
2829
2829
|
if (exact) {
|
|
2830
|
-
|
|
2830
|
+
chunk55Y2AQE7_js.appilotsDebugLog(`findField: FOUND exact match for fieldId="${fieldId}"`);
|
|
2831
2831
|
return exact;
|
|
2832
2832
|
}
|
|
2833
2833
|
const lower = fieldId.toLowerCase();
|
|
2834
2834
|
const snapshot = registry.snapshot();
|
|
2835
2835
|
for (const comp of snapshot) {
|
|
2836
2836
|
if (comp.kind === "field" && comp.id.toLowerCase() === lower) {
|
|
2837
|
-
|
|
2837
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2838
2838
|
`findField: FOUND case-insensitive match: registered="${comp.id}" for searched="${fieldId}"`
|
|
2839
2839
|
);
|
|
2840
2840
|
return registry.getField(comp.id);
|
|
2841
2841
|
}
|
|
2842
2842
|
}
|
|
2843
|
-
const currentScreenForTieBreak =
|
|
2844
|
-
const needle =
|
|
2843
|
+
const currentScreenForTieBreak = chunk55Y2AQE7_js.getCurrentScreen();
|
|
2844
|
+
const needle = chunk55Y2AQE7_js.normalize3(fieldId);
|
|
2845
2845
|
let bestComp;
|
|
2846
2846
|
let bestScore = 0;
|
|
2847
2847
|
let bestOnCurrentScreen = false;
|
|
2848
2848
|
for (const comp of snapshot) {
|
|
2849
2849
|
if (comp.kind !== "field") continue;
|
|
2850
|
-
const candidates = [
|
|
2851
|
-
if (comp.label) candidates.push(
|
|
2850
|
+
const candidates = [chunk55Y2AQE7_js.normalize3(comp.id)];
|
|
2851
|
+
if (comp.label) candidates.push(chunk55Y2AQE7_js.normalize3(comp.label));
|
|
2852
2852
|
let candidateScore = 0;
|
|
2853
2853
|
for (const cand of candidates) {
|
|
2854
|
-
const s =
|
|
2854
|
+
const s = chunk55Y2AQE7_js.matchScore(needle, cand);
|
|
2855
2855
|
if (s > candidateScore) candidateScore = s;
|
|
2856
2856
|
}
|
|
2857
2857
|
if (candidateScore === 0) continue;
|
|
@@ -2864,14 +2864,14 @@ function findField(fieldId, registry) {
|
|
|
2864
2864
|
}
|
|
2865
2865
|
}
|
|
2866
2866
|
if (bestComp && bestScore >= 75) {
|
|
2867
|
-
|
|
2867
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2868
2868
|
`findField: scored match "${fieldId}" -> "${bestComp.id}" (label="${bestComp.label}", score=${bestScore})`
|
|
2869
2869
|
);
|
|
2870
2870
|
return registry.getField(bestComp.id);
|
|
2871
2871
|
}
|
|
2872
|
-
const currentScreen =
|
|
2872
|
+
const currentScreen = chunk55Y2AQE7_js.getCurrentScreen();
|
|
2873
2873
|
if (currentScreen) {
|
|
2874
|
-
const screenMeta =
|
|
2874
|
+
const screenMeta = chunk55Y2AQE7_js.getScreenMetadata(currentScreen);
|
|
2875
2875
|
const fields = screenMeta?.fields;
|
|
2876
2876
|
if (fields && Array.isArray(fields)) {
|
|
2877
2877
|
const metaField = fields.find(
|
|
@@ -2879,19 +2879,19 @@ function findField(fieldId, registry) {
|
|
|
2879
2879
|
);
|
|
2880
2880
|
if (metaField && typeof metaField === "object" && metaField.label) {
|
|
2881
2881
|
const metaLabel = metaField.label;
|
|
2882
|
-
const metaNeedle =
|
|
2882
|
+
const metaNeedle = chunk55Y2AQE7_js.normalize3(metaLabel);
|
|
2883
2883
|
let mBest;
|
|
2884
2884
|
let mBestScore = 0;
|
|
2885
2885
|
for (const comp of snapshot) {
|
|
2886
2886
|
if (comp.kind !== "field" || !comp.label) continue;
|
|
2887
|
-
const score =
|
|
2887
|
+
const score = chunk55Y2AQE7_js.matchScore(metaNeedle, chunk55Y2AQE7_js.normalize3(comp.label));
|
|
2888
2888
|
if (score > mBestScore) {
|
|
2889
2889
|
mBestScore = score;
|
|
2890
2890
|
mBest = comp;
|
|
2891
2891
|
}
|
|
2892
2892
|
}
|
|
2893
2893
|
if (mBest && mBestScore >= 60) {
|
|
2894
|
-
|
|
2894
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2895
2895
|
`findField: FOUND via screen metadata translation: fieldId="${fieldId}" -> metaLabel="${metaLabel}" -> registered="${mBest.id}" (score=${mBestScore})`
|
|
2896
2896
|
);
|
|
2897
2897
|
return registry.getField(mBest.id);
|
|
@@ -2900,34 +2900,34 @@ function findField(fieldId, registry) {
|
|
|
2900
2900
|
}
|
|
2901
2901
|
}
|
|
2902
2902
|
if (bestComp && bestScore >= 40) {
|
|
2903
|
-
|
|
2903
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2904
2904
|
`findField: weak substring match "${fieldId}" -> "${bestComp.id}" (label="${bestComp.label}", score=${bestScore})`
|
|
2905
2905
|
);
|
|
2906
2906
|
return registry.getField(bestComp.id);
|
|
2907
2907
|
}
|
|
2908
|
-
|
|
2908
|
+
chunk55Y2AQE7_js.appilotsDebugWarn(
|
|
2909
2909
|
`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"}`
|
|
2910
2910
|
);
|
|
2911
2911
|
return void 0;
|
|
2912
2912
|
}
|
|
2913
2913
|
function findToggle(fieldId, registry) {
|
|
2914
|
-
|
|
2914
|
+
chunk55Y2AQE7_js.appilotsDebugLog(`findToggle: searching for fieldId="${fieldId}"`);
|
|
2915
2915
|
const exact = registry.getToggle(fieldId);
|
|
2916
2916
|
if (exact) {
|
|
2917
|
-
|
|
2917
|
+
chunk55Y2AQE7_js.appilotsDebugLog(`findToggle: FOUND exact match for "${fieldId}"`);
|
|
2918
2918
|
return exact;
|
|
2919
2919
|
}
|
|
2920
2920
|
const lower = fieldId.toLowerCase();
|
|
2921
2921
|
const snapshot = registry.snapshot();
|
|
2922
2922
|
for (const comp of snapshot) {
|
|
2923
2923
|
if (comp.kind === "toggle" && comp.id.toLowerCase() === lower) {
|
|
2924
|
-
|
|
2924
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2925
2925
|
`findToggle: FOUND case-insensitive match: registered="${comp.id}" for searched="${fieldId}"`
|
|
2926
2926
|
);
|
|
2927
2927
|
return registry.getToggle(comp.id);
|
|
2928
2928
|
}
|
|
2929
2929
|
}
|
|
2930
|
-
|
|
2930
|
+
chunk55Y2AQE7_js.appilotsDebugWarn(
|
|
2931
2931
|
`findToggle: NOT FOUND \u2014 fieldId="${fieldId}" not in registry. Available toggles: ${snapshot.filter((c) => c.kind === "toggle").map((c) => `"${c.id}"`).join(", ") || "none"}`
|
|
2932
2932
|
);
|
|
2933
2933
|
return void 0;
|
|
@@ -2938,7 +2938,7 @@ function findSlider(fieldId, registry) {
|
|
|
2938
2938
|
const lower = fieldId.toLowerCase();
|
|
2939
2939
|
for (const comp of registry.snapshot()) {
|
|
2940
2940
|
if (comp.kind === "slider" && comp.id.toLowerCase() === lower) {
|
|
2941
|
-
|
|
2941
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2942
2942
|
`findSlider: FOUND case-insensitive match: registered="${comp.id}" for searched="${fieldId}"`
|
|
2943
2943
|
);
|
|
2944
2944
|
return registry.getSlider(comp.id);
|
|
@@ -2949,7 +2949,7 @@ function findSlider(fieldId, registry) {
|
|
|
2949
2949
|
var sleep2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
2950
2950
|
async function formFillHandler(payload, context) {
|
|
2951
2951
|
const { permissions } = context;
|
|
2952
|
-
const registry = context.registry ??
|
|
2952
|
+
const registry = context.registry ?? chunk55Y2AQE7_js.componentRegistry;
|
|
2953
2953
|
const { screen, activePath } = resolveScreenContext();
|
|
2954
2954
|
const screenPath = activePath.length > 1 ? activePath.join("/") : screen;
|
|
2955
2955
|
if (!permissions.canFillForms) {
|
|
@@ -2968,11 +2968,11 @@ async function formFillHandler(payload, context) {
|
|
|
2968
2968
|
}
|
|
2969
2969
|
const registrySnapshot = registry.snapshot();
|
|
2970
2970
|
if (registrySnapshot.length === 0) {
|
|
2971
|
-
|
|
2971
|
+
chunk55Y2AQE7_js.appilotsDebugWarn(
|
|
2972
2972
|
"formFillHandler: registry is EMPTY \u2014 auto-tracking may not be active. Ensure enableAppilotsAutoTracking() runs before components mount."
|
|
2973
2973
|
);
|
|
2974
2974
|
} else {
|
|
2975
|
-
|
|
2975
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
2976
2976
|
`[Appilots formFillHandler] Registry has ${registrySnapshot.length} components:`,
|
|
2977
2977
|
registrySnapshot.map((c) => `${c.kind}:${c.id}`).join(", ")
|
|
2978
2978
|
);
|
|
@@ -2980,7 +2980,7 @@ async function formFillHandler(payload, context) {
|
|
|
2980
2980
|
const fieldResults = [];
|
|
2981
2981
|
let allSuccess = true;
|
|
2982
2982
|
let selectedChoiceThisBatch = false;
|
|
2983
|
-
|
|
2983
|
+
chunk55Y2AQE7_js.appilotsDebugLog(`formFillHandler: processing ${payload.fields.length} fields`);
|
|
2984
2984
|
const availableFieldIds = () => registry.snapshot().filter((comp) => comp.kind === "field").map((comp) => `${comp.id}${comp.label ? ` (${comp.label})` : ""}`).slice(0, 8);
|
|
2985
2985
|
const isElementIdField = (field) => typeof field.fieldId === "string" && field.fieldId.trim().toLowerCase().startsWith("el:");
|
|
2986
2986
|
for (const field of payload.fields.filter(isElementIdField)) {
|
|
@@ -3007,13 +3007,13 @@ async function formFillHandler(payload, context) {
|
|
|
3007
3007
|
const { fieldId, fieldType, value } = field;
|
|
3008
3008
|
const effectiveFieldType = getEffectiveFieldType(fieldId, fieldType, registry);
|
|
3009
3009
|
let selectFailure;
|
|
3010
|
-
|
|
3011
|
-
`formFillHandler: looking up fieldId="${fieldId}" fieldType="${fieldType}" effectiveFieldType="${effectiveFieldType}" value=${
|
|
3010
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
3011
|
+
`formFillHandler: looking up fieldId="${fieldId}" fieldType="${fieldType}" effectiveFieldType="${effectiveFieldType}" value=${chunk55Y2AQE7_js.describeValue(value)}`
|
|
3012
3012
|
);
|
|
3013
3013
|
const fieldEntry = findField(fieldId, registry);
|
|
3014
3014
|
if (fieldEntry) {
|
|
3015
3015
|
try {
|
|
3016
|
-
|
|
3016
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
3017
3017
|
`formFillHandler: found field "${fieldId}" via registry, calling setValue(<${String(value).length} chars>)`
|
|
3018
3018
|
);
|
|
3019
3019
|
const beforeValue = effectiveFieldType === "date" ? fieldEntry.getValue?.() ?? "" : void 0;
|
|
@@ -3044,7 +3044,7 @@ async function formFillHandler(payload, context) {
|
|
|
3044
3044
|
after = fieldEntry.getValue?.() ?? "";
|
|
3045
3045
|
}
|
|
3046
3046
|
if (!selectValueApplied(fieldId, value, after, registry)) {
|
|
3047
|
-
|
|
3047
|
+
chunk55Y2AQE7_js.appilotsDebugWarn(
|
|
3048
3048
|
`formFillHandler: select field "${fieldId}" setValue did not stick (wrote <${String(value).length} chars>, current is <${String(after ?? "").length} chars>), trying visible choice fallback`
|
|
3049
3049
|
);
|
|
3050
3050
|
const selectResult = await selectVisibleChoice(fieldId, value, registry, {
|
|
@@ -3169,7 +3169,7 @@ async function formFillHandler(payload, context) {
|
|
|
3169
3169
|
}
|
|
3170
3170
|
if (selectResult.success) {
|
|
3171
3171
|
selectedChoiceThisBatch = true;
|
|
3172
|
-
|
|
3172
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
3173
3173
|
`formFillHandler: selected visible option for "${fieldId}"` + (selectResult.selectedLabel ? ` \u2192 "${selectResult.selectedLabel}"` : "")
|
|
3174
3174
|
);
|
|
3175
3175
|
await sleep2(120);
|
|
@@ -3178,7 +3178,7 @@ async function formFillHandler(payload, context) {
|
|
|
3178
3178
|
}
|
|
3179
3179
|
selectFailure = selectResult;
|
|
3180
3180
|
}
|
|
3181
|
-
|
|
3181
|
+
chunk55Y2AQE7_js.appilotsDebugLog(`formFillHandler: registry miss for "${fieldId}", falling back to fiber tree`);
|
|
3182
3182
|
const handle = findInteractiveByIdentifier(fieldId, {
|
|
3183
3183
|
kind: effectiveFieldType === "toggle" ? "toggle" : "field"
|
|
3184
3184
|
});
|
|
@@ -3186,7 +3186,7 @@ async function formFillHandler(payload, context) {
|
|
|
3186
3186
|
try {
|
|
3187
3187
|
handle.focus?.();
|
|
3188
3188
|
handle.setValue(value);
|
|
3189
|
-
|
|
3189
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
3190
3190
|
`formFillHandler: fiber fallback succeeded for "${fieldId}" \u2192 label="${handle.label}"`
|
|
3191
3191
|
);
|
|
3192
3192
|
fieldResults.push({ fieldId, success: true });
|
|
@@ -3225,7 +3225,7 @@ async function formFillHandler(payload, context) {
|
|
|
3225
3225
|
if (payload.submitAfterFill === true) {
|
|
3226
3226
|
if (!allSuccess) {
|
|
3227
3227
|
const failedIds = fieldResults.filter((result) => !result.success).map((result) => result.fieldId);
|
|
3228
|
-
|
|
3228
|
+
chunk55Y2AQE7_js.appilotsDebugWarn(
|
|
3229
3229
|
"formFillHandler: submitAfterFill=true requested but some fields failed; NOT submitting" + (failedIds.length > 0 ? ` (failed: ${failedIds.join(", ")})` : "")
|
|
3230
3230
|
);
|
|
3231
3231
|
} else {
|
|
@@ -3240,7 +3240,7 @@ async function formFillHandler(payload, context) {
|
|
|
3240
3240
|
registry
|
|
3241
3241
|
);
|
|
3242
3242
|
if (!submitResult.success) {
|
|
3243
|
-
|
|
3243
|
+
chunk55Y2AQE7_js.appilotsDebugWarn(`formFillHandler: submitAfterFill failed \u2014 ${submitResult.error}`);
|
|
3244
3244
|
return {
|
|
3245
3245
|
success: false,
|
|
3246
3246
|
error: submitResult.error,
|
|
@@ -3252,7 +3252,7 @@ async function formFillHandler(payload, context) {
|
|
|
3252
3252
|
submitTargetId: submitResult.pressedTargetId
|
|
3253
3253
|
});
|
|
3254
3254
|
if (postSubmit.status === "pending") {
|
|
3255
|
-
|
|
3255
|
+
chunk55Y2AQE7_js.appilotsDebugWarn(`formFillHandler: submit still pending \u2014 ${postSubmit.message}`);
|
|
3256
3256
|
return {
|
|
3257
3257
|
success: false,
|
|
3258
3258
|
error: postSubmit.message,
|
|
@@ -3261,7 +3261,7 @@ async function formFillHandler(payload, context) {
|
|
|
3261
3261
|
};
|
|
3262
3262
|
}
|
|
3263
3263
|
if (postSubmit.status === "failure") {
|
|
3264
|
-
|
|
3264
|
+
chunk55Y2AQE7_js.appilotsDebugWarn(
|
|
3265
3265
|
`formFillHandler: submit rejected by visible validation \u2014 ${postSubmit.message}`
|
|
3266
3266
|
);
|
|
3267
3267
|
return {
|
|
@@ -3276,7 +3276,7 @@ async function formFillHandler(payload, context) {
|
|
|
3276
3276
|
}
|
|
3277
3277
|
};
|
|
3278
3278
|
}
|
|
3279
|
-
|
|
3279
|
+
chunk55Y2AQE7_js.appilotsDebugLog("formFillHandler: submitAfterFill \u2014 submit completed");
|
|
3280
3280
|
}
|
|
3281
3281
|
}
|
|
3282
3282
|
const aggregatedDiagnose = aggregateFieldDiagnoses(fieldResults, screenPath);
|
|
@@ -3288,17 +3288,17 @@ async function formFillHandler(payload, context) {
|
|
|
3288
3288
|
};
|
|
3289
3289
|
}
|
|
3290
3290
|
function pressSubmitButton(context, registry) {
|
|
3291
|
-
const activePath = context.activePath ??
|
|
3291
|
+
const activePath = context.activePath ?? chunk55Y2AQE7_js.getActiveRouteNames();
|
|
3292
3292
|
const hintScreen = context.screen ?? context.screenPath;
|
|
3293
3293
|
const formScreens = resolveFormScreensForSubmit(hintScreen, activePath, registry);
|
|
3294
|
-
const resolvedScreen = formScreens.find((name) => screenDeclaresSubmit(name)) ?? formScreens[0] ?? hintScreen ??
|
|
3294
|
+
const resolvedScreen = formScreens.find((name) => screenDeclaresSubmit(name)) ?? formScreens[0] ?? hintScreen ?? chunk55Y2AQE7_js.getCurrentScreen() ?? void 0;
|
|
3295
3295
|
const candidates = collectSubmitTargetCandidates(formScreens, registry);
|
|
3296
3296
|
for (const candidate of candidates) {
|
|
3297
3297
|
const target = registry.getTarget(candidate);
|
|
3298
3298
|
if (target) {
|
|
3299
3299
|
try {
|
|
3300
3300
|
target.press();
|
|
3301
|
-
|
|
3301
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
3302
3302
|
`formFillHandler: submitAfterFill \u2014 pressed registry target "${candidate}"` + (resolvedScreen ? ` on screen "${resolvedScreen}"` : "")
|
|
3303
3303
|
);
|
|
3304
3304
|
return { success: true, pressedTargetId: candidate };
|
|
@@ -3312,7 +3312,7 @@ function pressSubmitButton(context, registry) {
|
|
|
3312
3312
|
}
|
|
3313
3313
|
}
|
|
3314
3314
|
for (const screenName of formScreens) {
|
|
3315
|
-
const screenMeta =
|
|
3315
|
+
const screenMeta = chunk55Y2AQE7_js.getScreenMetadata(screenName);
|
|
3316
3316
|
const submitMeta = Array.isArray(screenMeta?.actions) ? screenMeta.actions.find(
|
|
3317
3317
|
(action) => typeof action === "object" && action !== null && action.type === "submit"
|
|
3318
3318
|
) : void 0;
|
|
@@ -3323,7 +3323,7 @@ function pressSubmitButton(context, registry) {
|
|
|
3323
3323
|
if (handle?.press) {
|
|
3324
3324
|
try {
|
|
3325
3325
|
handle.press();
|
|
3326
|
-
|
|
3326
|
+
chunk55Y2AQE7_js.appilotsDebugLog(`formFillHandler: submitAfterFill \u2014 fiber fallback "${submitLabel}"`);
|
|
3327
3327
|
return { success: true, pressedTargetId: submitId ?? submitLabel };
|
|
3328
3328
|
} catch (err) {
|
|
3329
3329
|
return {
|
|
@@ -3345,7 +3345,7 @@ function pressSubmitButton(context, registry) {
|
|
|
3345
3345
|
if (id) {
|
|
3346
3346
|
const pressed = pressTargetByIdOrLabel(id, registry);
|
|
3347
3347
|
if (pressed.success) {
|
|
3348
|
-
|
|
3348
|
+
chunk55Y2AQE7_js.appilotsDebugLog(`formFillHandler: submitAfterFill \u2014 pressed visible heuristic "${id}"`);
|
|
3349
3349
|
return { success: true, pressedTargetId: id };
|
|
3350
3350
|
}
|
|
3351
3351
|
}
|
|
@@ -3359,7 +3359,7 @@ function pressSubmitButton(context, registry) {
|
|
|
3359
3359
|
if (target) {
|
|
3360
3360
|
try {
|
|
3361
3361
|
target.press();
|
|
3362
|
-
|
|
3362
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
3363
3363
|
`formFillHandler: submitAfterFill \u2014 pressed by label heuristic "${comp.label}"`
|
|
3364
3364
|
);
|
|
3365
3365
|
return { success: true, pressedTargetId: comp.id };
|
|
@@ -3375,7 +3375,7 @@ function pressSubmitButton(context, registry) {
|
|
|
3375
3375
|
for (const fieldId of [...context.filledFieldIds ?? []].reverse()) {
|
|
3376
3376
|
const handle = findInteractiveByIdentifier(fieldId, { kind: "field" });
|
|
3377
3377
|
if (handle?.submitFromKeyboard?.()) {
|
|
3378
|
-
|
|
3378
|
+
chunk55Y2AQE7_js.appilotsDebugLog(`formFillHandler: submitAfterFill \u2014 return key on "${fieldId}"`);
|
|
3379
3379
|
return { success: true, pressedTargetId: fieldId };
|
|
3380
3380
|
}
|
|
3381
3381
|
}
|
|
@@ -3421,12 +3421,12 @@ function buildDiagnose(category, targetId, candidates) {
|
|
|
3421
3421
|
return {
|
|
3422
3422
|
category,
|
|
3423
3423
|
targetId,
|
|
3424
|
-
screen:
|
|
3424
|
+
screen: chunk55Y2AQE7_js.getCurrentScreen() ?? void 0,
|
|
3425
3425
|
...candidates && candidates.length > 0 ? { candidates: candidates.slice(0, 8) } : {}
|
|
3426
3426
|
};
|
|
3427
3427
|
}
|
|
3428
3428
|
function resolveListEntry(listId) {
|
|
3429
|
-
const entries =
|
|
3429
|
+
const entries = chunk55Y2AQE7_js.listRegistry.snapshot();
|
|
3430
3430
|
if (entries.length === 0) return {};
|
|
3431
3431
|
if (listId) {
|
|
3432
3432
|
const wanted = normalizeId2(listId);
|
|
@@ -3555,9 +3555,9 @@ function hashFieldValue(value) {
|
|
|
3555
3555
|
var DISCRETE_FIELD_TYPES = /* @__PURE__ */ new Set(["select", "date"]);
|
|
3556
3556
|
function discreteFieldSignature() {
|
|
3557
3557
|
const sigs = [];
|
|
3558
|
-
for (const { id, kind } of
|
|
3558
|
+
for (const { id, kind } of chunk55Y2AQE7_js.componentRegistry.snapshot()) {
|
|
3559
3559
|
if (kind !== "field") continue;
|
|
3560
|
-
const entry =
|
|
3560
|
+
const entry = chunk55Y2AQE7_js.componentRegistry.getField(id);
|
|
3561
3561
|
if (!entry || !DISCRETE_FIELD_TYPES.has(entry.fieldType ?? "")) continue;
|
|
3562
3562
|
try {
|
|
3563
3563
|
sigs.push(`${id}:${hashFieldValue(String(entry.getValue() ?? ""))}`);
|
|
@@ -3568,32 +3568,32 @@ function discreteFieldSignature() {
|
|
|
3568
3568
|
}
|
|
3569
3569
|
async function waitForPostInteractionSettle(payload) {
|
|
3570
3570
|
const targetId = targetIdFromPayload(payload);
|
|
3571
|
-
const fromScreen =
|
|
3572
|
-
const baseline =
|
|
3571
|
+
const fromScreen = chunk55Y2AQE7_js.getCurrentScreen();
|
|
3572
|
+
const baseline = chunk55Y2AQE7_js.probeLoadingState(targetId || null, fromScreen);
|
|
3573
3573
|
const baselineFields = discreteFieldSignature();
|
|
3574
3574
|
const readable = baseline.fingerprint !== "";
|
|
3575
3575
|
await sleepMs(100);
|
|
3576
|
-
const afterPress =
|
|
3576
|
+
const afterPress = chunk55Y2AQE7_js.probeLoadingState(targetId || null, chunk55Y2AQE7_js.getCurrentScreen());
|
|
3577
3577
|
const modalOrLoading = afterPress.modalOpen || afterPress.loading || afterPress.pressedDisabled;
|
|
3578
3578
|
const fingerprintChanged = afterPress.fingerprint !== baseline.fingerprint;
|
|
3579
3579
|
const verdict = () => {
|
|
3580
3580
|
if (!readable) return { effect: "unknown" };
|
|
3581
|
-
const settled =
|
|
3581
|
+
const settled = chunk55Y2AQE7_js.probeLoadingState(targetId || null, chunk55Y2AQE7_js.getCurrentScreen());
|
|
3582
3582
|
if (settled.fingerprint === "") return { effect: "unknown" };
|
|
3583
3583
|
if (discreteFieldSignature() !== baselineFields) return { effect: "changed" };
|
|
3584
3584
|
return { effect: settled.fingerprint !== baseline.fingerprint ? "changed" : "none" };
|
|
3585
3585
|
};
|
|
3586
|
-
const capMs =
|
|
3586
|
+
const capMs = chunk55Y2AQE7_js.isListItemPressTarget(targetId) ? 5e3 : 1e4;
|
|
3587
3587
|
if (modalOrLoading || fingerprintChanged) {
|
|
3588
|
-
await
|
|
3588
|
+
await chunk55Y2AQE7_js.waitForLoadingSettle({
|
|
3589
3589
|
pressedComponentId: targetId || null,
|
|
3590
3590
|
fromScreen,
|
|
3591
3591
|
maxMs: capMs
|
|
3592
3592
|
});
|
|
3593
3593
|
return verdict();
|
|
3594
3594
|
}
|
|
3595
|
-
if (
|
|
3596
|
-
await
|
|
3595
|
+
if (chunk55Y2AQE7_js.isListItemPressTarget(targetId)) {
|
|
3596
|
+
await chunk55Y2AQE7_js.waitForLoadingSettle({
|
|
3597
3597
|
fromScreen,
|
|
3598
3598
|
maxMs: 3e3
|
|
3599
3599
|
});
|
|
@@ -3614,7 +3614,7 @@ function validateActionPayload(action) {
|
|
|
3614
3614
|
error: message,
|
|
3615
3615
|
diagnose: {
|
|
3616
3616
|
category: "validation",
|
|
3617
|
-
screen:
|
|
3617
|
+
screen: chunk55Y2AQE7_js.getCurrentScreen() ?? void 0,
|
|
3618
3618
|
...ids ?? {}
|
|
3619
3619
|
}
|
|
3620
3620
|
});
|
|
@@ -3675,7 +3675,7 @@ function isDestructivePayload(payload) {
|
|
|
3675
3675
|
return !!params && typeof params === "object" && params.destructive === true;
|
|
3676
3676
|
}
|
|
3677
3677
|
async function executeAction(action, context) {
|
|
3678
|
-
|
|
3678
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
3679
3679
|
`executeAction called: type="${action.type}", id="${action.id}", payload=${JSON.stringify(action.payload)}`
|
|
3680
3680
|
);
|
|
3681
3681
|
const permissions = context.permissions ?? DEFAULT_PERMISSIONS;
|
|
@@ -3704,7 +3704,7 @@ async function executeAction(action, context) {
|
|
|
3704
3704
|
let result;
|
|
3705
3705
|
const validationFailure = validateActionPayload(action);
|
|
3706
3706
|
if (validationFailure) {
|
|
3707
|
-
|
|
3707
|
+
chunk55Y2AQE7_js.appilotsDebugWarn(
|
|
3708
3708
|
`executeAction: payload validation failed for type="${action.type}" id="${action.id}": ${validationFailure.error}`
|
|
3709
3709
|
);
|
|
3710
3710
|
context.emit({
|
|
@@ -3731,14 +3731,14 @@ async function executeAction(action, context) {
|
|
|
3731
3731
|
case "form_fill":
|
|
3732
3732
|
result = await formFillHandler(action.payload, {
|
|
3733
3733
|
permissions,
|
|
3734
|
-
registry: context.registry ??
|
|
3734
|
+
registry: context.registry ?? chunk55Y2AQE7_js.getDefaultRegistry()
|
|
3735
3735
|
});
|
|
3736
3736
|
break;
|
|
3737
3737
|
case "ui_interaction": {
|
|
3738
3738
|
const payload = action.payload;
|
|
3739
3739
|
result = uiInteractionHandler(payload, {
|
|
3740
3740
|
permissions,
|
|
3741
|
-
registry: context.registry ??
|
|
3741
|
+
registry: context.registry ?? chunk55Y2AQE7_js.getDefaultRegistry()
|
|
3742
3742
|
});
|
|
3743
3743
|
if (result.success) {
|
|
3744
3744
|
const settle = await waitForPostInteractionSettle(payload);
|
|
@@ -3767,7 +3767,7 @@ async function executeAction(action, context) {
|
|
|
3767
3767
|
};
|
|
3768
3768
|
}
|
|
3769
3769
|
} catch (err) {
|
|
3770
|
-
|
|
3770
|
+
chunk55Y2AQE7_js.appilotsDebugWarn(
|
|
3771
3771
|
`executeAction: exception during action type="${action.type}" id="${action.id}": ${err?.message}`
|
|
3772
3772
|
);
|
|
3773
3773
|
result = {
|
|
@@ -3775,7 +3775,7 @@ async function executeAction(action, context) {
|
|
|
3775
3775
|
error: err?.message ?? "Action execution failed unexpectedly"
|
|
3776
3776
|
};
|
|
3777
3777
|
}
|
|
3778
|
-
|
|
3778
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
3779
3779
|
`executeAction result: type="${action.type}", id="${action.id}", success=${result.success}, error=${result.error ?? "none"}`
|
|
3780
3780
|
);
|
|
3781
3781
|
context.emit({
|
|
@@ -3829,7 +3829,7 @@ var _patchedAlert = (title, message, buttons, options) => {
|
|
|
3829
3829
|
return suppression.originalAlert(title, message, buttons, options);
|
|
3830
3830
|
}
|
|
3831
3831
|
suppression.consumed = true;
|
|
3832
|
-
|
|
3832
|
+
chunk55Y2AQE7_js.appilotsDebugLog("Suppressing native Alert during already-confirmed destructive agent action");
|
|
3833
3833
|
try {
|
|
3834
3834
|
suppression.pending = Promise.resolve(button.onPress()).then(() => void 0).catch((err) => reportHandlerFailure(err));
|
|
3835
3835
|
} catch (err) {
|
|
@@ -3882,35 +3882,35 @@ async function runWithConfirmedDestructiveContext(enabled, host, fn) {
|
|
|
3882
3882
|
// src/platform/reactNativeAdapter.ts
|
|
3883
3883
|
var POST_ACTION_LOADING_MAX_MS = 6e3;
|
|
3884
3884
|
function resolveScreenMetadata() {
|
|
3885
|
-
const activePath =
|
|
3885
|
+
const activePath = chunk55Y2AQE7_js.getActiveRouteNames();
|
|
3886
3886
|
for (let i = activePath.length - 1; i >= 0; i--) {
|
|
3887
3887
|
const name = activePath[i];
|
|
3888
|
-
const meta = name ?
|
|
3888
|
+
const meta = name ? chunk55Y2AQE7_js.getScreenMetadata(name) : void 0;
|
|
3889
3889
|
if (meta && (Array.isArray(meta.fields) && meta.fields.length > 0 || Array.isArray(meta.actions) && meta.actions.length > 0)) {
|
|
3890
3890
|
return meta;
|
|
3891
3891
|
}
|
|
3892
3892
|
}
|
|
3893
|
-
const screen =
|
|
3894
|
-
return screen ?
|
|
3893
|
+
const screen = chunk55Y2AQE7_js.getCurrentScreen();
|
|
3894
|
+
return screen ? chunk55Y2AQE7_js.getScreenMetadata(screen) : void 0;
|
|
3895
3895
|
}
|
|
3896
3896
|
function buildAgentContext(extras = {}) {
|
|
3897
3897
|
const context = {};
|
|
3898
3898
|
context.platform = "react-native";
|
|
3899
|
-
const screen =
|
|
3899
|
+
const screen = chunk55Y2AQE7_js.getCurrentScreen();
|
|
3900
3900
|
if (screen) context.currentScreen = screen;
|
|
3901
|
-
const navigationState =
|
|
3901
|
+
const navigationState = chunk55Y2AQE7_js.getNavigationStateSnapshot();
|
|
3902
3902
|
if (navigationState) context.navigationState = navigationState;
|
|
3903
3903
|
const screenMeta = resolveScreenMetadata();
|
|
3904
3904
|
if (screenMeta) context.screenMetadata = screenMeta;
|
|
3905
3905
|
try {
|
|
3906
3906
|
context.snapshot = captureSnapshot();
|
|
3907
3907
|
} catch (err) {
|
|
3908
|
-
|
|
3908
|
+
chunk55Y2AQE7_js.appilotsDebugWarn("buildAgentContext: captureSnapshot failed", err);
|
|
3909
3909
|
}
|
|
3910
|
-
const registry =
|
|
3910
|
+
const registry = chunk55Y2AQE7_js.componentRegistry.snapshot();
|
|
3911
3911
|
const filtered = screen ? registry.filter((c) => !c.screen || c.screen === screen) : registry;
|
|
3912
3912
|
if (filtered.length > 0) context.registeredComponents = filtered;
|
|
3913
|
-
const registeredLists =
|
|
3913
|
+
const registeredLists = chunk55Y2AQE7_js.listRegistry.snapshot();
|
|
3914
3914
|
if (registeredLists.length > 0) {
|
|
3915
3915
|
context.registeredLists = registeredLists.map(
|
|
3916
3916
|
({ scrollToIndex, scrollToOffset, getScrollMetrics, dataPreview, ...rest }) => rest
|
|
@@ -3927,12 +3927,12 @@ function resolveActionHints(screen, pressedComponentId, actionPayload) {
|
|
|
3927
3927
|
}
|
|
3928
3928
|
}
|
|
3929
3929
|
if (!screen || !pressedComponentId) return void 0;
|
|
3930
|
-
const meta =
|
|
3930
|
+
const meta = chunk55Y2AQE7_js.getScreenMetadata(screen);
|
|
3931
3931
|
const actions = meta?.actions;
|
|
3932
3932
|
if (!actions || actions.length === 0) return void 0;
|
|
3933
3933
|
for (const a of actions) {
|
|
3934
3934
|
if (typeof a === "string") continue;
|
|
3935
|
-
if (
|
|
3935
|
+
if (chunk55Y2AQE7_js.idLooselyMatches(a.id, pressedComponentId)) {
|
|
3936
3936
|
const inferred = a.appilotsInferred;
|
|
3937
3937
|
if (inferred && typeof inferred === "object") return inferred;
|
|
3938
3938
|
return void 0;
|
|
@@ -3947,30 +3947,30 @@ async function settleTurn(input) {
|
|
|
3947
3947
|
const successById = new Map(input.results.map((r) => [r.actionId, r.success]));
|
|
3948
3948
|
const typeById = new Map(input.results.map((r) => [r.actionId, r.type]));
|
|
3949
3949
|
if (input.hadNavigate) {
|
|
3950
|
-
const settle = await
|
|
3950
|
+
const settle = await chunk55Y2AQE7_js.waitForScreenSettle({
|
|
3951
3951
|
expectingChange: true,
|
|
3952
3952
|
fromScreen: input.preNavigateScreen ?? null,
|
|
3953
3953
|
fromSignature: input.preNavigateSignature ?? null,
|
|
3954
3954
|
targetScreen: navigateTargetScreen,
|
|
3955
3955
|
maxMs: 3500
|
|
3956
3956
|
});
|
|
3957
|
-
|
|
3957
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
3958
3958
|
`settleTurn: post-navigate settle done \u2014 screen="${settle.screen}" transitioned=${settle.transitioned} timedOut=${settle.timedOut} waitedMs=${settle.waitedMs}`
|
|
3959
3959
|
);
|
|
3960
|
-
const navigationMoved = settle.transitioned ||
|
|
3960
|
+
const navigationMoved = settle.transitioned || chunk55Y2AQE7_js.screenDepartedBaseline(input.preNavigateScreen ?? null, input.preNavigateSignature ?? null) || !!navigateTargetScreen && !!settle.screen && chunk55Y2AQE7_js.routesBelongToSameFeature(settle.screen, navigateTargetScreen);
|
|
3961
3961
|
if (!navigationMoved) {
|
|
3962
|
-
|
|
3962
|
+
chunk55Y2AQE7_js.appilotsDebugWarn(
|
|
3963
3963
|
`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.`
|
|
3964
3964
|
);
|
|
3965
3965
|
for (const [actionId, type] of typeById) {
|
|
3966
3966
|
if (type === "navigate") toolWithoutEffectIds.add(actionId);
|
|
3967
3967
|
}
|
|
3968
3968
|
}
|
|
3969
|
-
const loadSettle = await
|
|
3969
|
+
const loadSettle = await chunk55Y2AQE7_js.waitForLoadingSettle({
|
|
3970
3970
|
fromScreen: settle.screen ?? null,
|
|
3971
3971
|
maxMs: 3e3
|
|
3972
3972
|
});
|
|
3973
|
-
|
|
3973
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
3974
3974
|
`settleTurn: post-navigate loading settle \u2014 settled=${loadSettle.settled} loadingPending=${loadSettle.loadingPending} probes=${loadSettle.probeCount} waitedMs=${loadSettle.waitedMs}`
|
|
3975
3975
|
);
|
|
3976
3976
|
if (loadSettle.loadingPending) loadingPending = true;
|
|
@@ -3978,36 +3978,36 @@ async function settleTurn(input) {
|
|
|
3978
3978
|
const pressedAction = turnActions.find(
|
|
3979
3979
|
(a) => a.type === "ui_interaction" && a.payload?.componentId === pressedId
|
|
3980
3980
|
);
|
|
3981
|
-
const hints = resolveActionHints(
|
|
3981
|
+
const hints = resolveActionHints(chunk55Y2AQE7_js.getCurrentScreen(), pressedId, pressedAction?.payload);
|
|
3982
3982
|
const settleCapMs = hints?.isAsyncTrigger === true ? 1e4 : POST_ACTION_LOADING_MAX_MS;
|
|
3983
|
-
const loadSettle = await
|
|
3983
|
+
const loadSettle = await chunk55Y2AQE7_js.waitForLoadingSettle({
|
|
3984
3984
|
pressedComponentId: pressedId,
|
|
3985
|
-
fromScreen:
|
|
3985
|
+
fromScreen: chunk55Y2AQE7_js.getCurrentScreen(),
|
|
3986
3986
|
maxMs: settleCapMs
|
|
3987
3987
|
});
|
|
3988
|
-
|
|
3988
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
3989
3989
|
`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}${hints?.isAsyncTrigger ? " (mcp-inferred)" : ""}`
|
|
3990
3990
|
);
|
|
3991
3991
|
if (loadSettle.loadingPending) loadingPending = true;
|
|
3992
3992
|
const listPressActions = turnActions.filter((action) => {
|
|
3993
|
-
const target =
|
|
3994
|
-
return target ?
|
|
3993
|
+
const target = chunk55Y2AQE7_js.actionPressTargetId(action);
|
|
3994
|
+
return target ? chunk55Y2AQE7_js.isListItemPressTarget(target) : false;
|
|
3995
3995
|
});
|
|
3996
3996
|
if (listPressActions.length > 0) {
|
|
3997
|
-
const baselineFingerprint =
|
|
3998
|
-
const postPressSettle = await
|
|
3997
|
+
const baselineFingerprint = chunk55Y2AQE7_js.probeLoadingState(pressedId, chunk55Y2AQE7_js.getCurrentScreen()).fingerprint;
|
|
3998
|
+
const postPressSettle = await chunk55Y2AQE7_js.waitForScreenSettle({
|
|
3999
3999
|
expectingChange: true,
|
|
4000
4000
|
fromScreen: input.preNavigateScreen ?? null,
|
|
4001
4001
|
fromSignature: input.preNavigateSignature ?? null,
|
|
4002
4002
|
maxMs: 2500
|
|
4003
4003
|
});
|
|
4004
|
-
await
|
|
4004
|
+
await chunk55Y2AQE7_js.waitForLoadingSettle({
|
|
4005
4005
|
pressedComponentId: pressedId,
|
|
4006
|
-
fromScreen:
|
|
4006
|
+
fromScreen: chunk55Y2AQE7_js.getCurrentScreen(),
|
|
4007
4007
|
maxMs: 4e3
|
|
4008
4008
|
});
|
|
4009
|
-
const afterFingerprint =
|
|
4010
|
-
|
|
4009
|
+
const afterFingerprint = chunk55Y2AQE7_js.probeLoadingState(pressedId, chunk55Y2AQE7_js.getCurrentScreen()).fingerprint;
|
|
4010
|
+
chunk55Y2AQE7_js.appilotsDebugLog(
|
|
4011
4011
|
`settleTurn: post-list-press settle \u2014 screen="${postPressSettle.screen}" transitioned=${postPressSettle.transitioned} timedOut=${postPressSettle.timedOut} waitedMs=${postPressSettle.waitedMs}`
|
|
4012
4012
|
);
|
|
4013
4013
|
if (!postPressSettle.transitioned && baselineFingerprint === afterFingerprint) {
|
|
@@ -4023,15 +4023,15 @@ async function settleTurn(input) {
|
|
|
4023
4023
|
}
|
|
4024
4024
|
var reactNativeChatAdapter = {
|
|
4025
4025
|
buildContext: buildAgentContext,
|
|
4026
|
-
getCurrentScreen:
|
|
4027
|
-
getCurrentScreenSignature:
|
|
4026
|
+
getCurrentScreen: chunk55Y2AQE7_js.getCurrentScreen,
|
|
4027
|
+
getCurrentScreenSignature: chunk55Y2AQE7_js.getCurrentScreenSignature,
|
|
4028
4028
|
settleTurn
|
|
4029
4029
|
};
|
|
4030
4030
|
function createReactNativeActionRunner(getOptions) {
|
|
4031
4031
|
return {
|
|
4032
4032
|
async execute(action, { confirmedDestructive }) {
|
|
4033
4033
|
const { permissions, emit, navigationRef, suppressNativeConfirm } = getOptions();
|
|
4034
|
-
const navRef = navigationRef?.current ? navigationRef : { current:
|
|
4034
|
+
const navRef = navigationRef?.current ? navigationRef : { current: chunk55Y2AQE7_js.getNavigationRef() };
|
|
4035
4035
|
return runWithConfirmedDestructiveContext(
|
|
4036
4036
|
confirmedDestructive && suppressNativeConfirm !== false,
|
|
4037
4037
|
reactNative.Alert,
|
|
@@ -4042,21 +4042,21 @@ function createReactNativeActionRunner(getOptions) {
|
|
|
4042
4042
|
})
|
|
4043
4043
|
);
|
|
4044
4044
|
},
|
|
4045
|
-
getCurrentScreen:
|
|
4046
|
-
getCurrentScreenSignature:
|
|
4045
|
+
getCurrentScreen: chunk55Y2AQE7_js.getCurrentScreen,
|
|
4046
|
+
getCurrentScreenSignature: chunk55Y2AQE7_js.getCurrentScreenSignature,
|
|
4047
4047
|
getScreenActionsMetadata(screen) {
|
|
4048
|
-
return
|
|
4048
|
+
return chunk55Y2AQE7_js.getScreenMetadata(screen)?.actions;
|
|
4049
4049
|
},
|
|
4050
|
-
waitForScreenSettle:
|
|
4050
|
+
waitForScreenSettle: chunk55Y2AQE7_js.waitForScreenSettle
|
|
4051
4051
|
};
|
|
4052
4052
|
}
|
|
4053
4053
|
|
|
4054
4054
|
// src/hooks/useAppilotsChat.ts
|
|
4055
4055
|
function useAppilotsChat(options = {}) {
|
|
4056
|
-
const { client, emit, subscribe } =
|
|
4056
|
+
const { client, emit, subscribe } = chunk55Y2AQE7_js.useAppilotsContext();
|
|
4057
4057
|
const machine = React.useMemo(
|
|
4058
|
-
() => new
|
|
4059
|
-
{ client, adapter: reactNativeChatAdapter, emit, warn:
|
|
4058
|
+
() => new chunk55Y2AQE7_js.ChatSessionMachine(
|
|
4059
|
+
{ client, adapter: reactNativeChatAdapter, emit, warn: chunk55Y2AQE7_js.appilotsDebugWarn },
|
|
4060
4060
|
options
|
|
4061
4061
|
),
|
|
4062
4062
|
// A new machine per client/provider instance — options are pushed in
|
|
@@ -4099,7 +4099,7 @@ var DEFAULT_PERMISSIONS2 = {
|
|
|
4099
4099
|
canSubmitForms: true
|
|
4100
4100
|
};
|
|
4101
4101
|
function useAppilotsActions(options = {}) {
|
|
4102
|
-
const { client, subscribe, config, emit } =
|
|
4102
|
+
const { client, subscribe, config, emit } = chunk55Y2AQE7_js.useAppilotsContext();
|
|
4103
4103
|
const { navigationRef, autoExecute = false } = options;
|
|
4104
4104
|
const runnerOptionsRef = React.useRef({
|
|
4105
4105
|
permissions: config.permissions ?? DEFAULT_PERMISSIONS2,
|
|
@@ -4114,12 +4114,12 @@ function useAppilotsActions(options = {}) {
|
|
|
4114
4114
|
suppressNativeConfirm: config.suppressNativeConfirm
|
|
4115
4115
|
};
|
|
4116
4116
|
const machine = React.useMemo(
|
|
4117
|
-
() => new
|
|
4117
|
+
() => new chunk55Y2AQE7_js.ActionQueueMachine(
|
|
4118
4118
|
{
|
|
4119
4119
|
client,
|
|
4120
4120
|
adapter: createReactNativeActionRunner(() => runnerOptionsRef.current),
|
|
4121
4121
|
emit,
|
|
4122
|
-
warn:
|
|
4122
|
+
warn: chunk55Y2AQE7_js.appilotsDebugWarn
|
|
4123
4123
|
},
|
|
4124
4124
|
{ autoExecute }
|
|
4125
4125
|
),
|
|
@@ -4176,7 +4176,7 @@ function shouldShowSuggestedPrompts(args) {
|
|
|
4176
4176
|
|
|
4177
4177
|
// src/hooks/useSuggestedPrompts.ts
|
|
4178
4178
|
function useSuggestedPrompts(options) {
|
|
4179
|
-
const { client } =
|
|
4179
|
+
const { client } = chunk55Y2AQE7_js.useAppilotsContext();
|
|
4180
4180
|
const { enabled, limit = 4 } = options;
|
|
4181
4181
|
const [prompts, setPrompts] = React.useState([]);
|
|
4182
4182
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
@@ -4186,8 +4186,8 @@ function useSuggestedPrompts(options) {
|
|
|
4186
4186
|
if (!enabled) return;
|
|
4187
4187
|
const requestId = ++requestIdRef.current;
|
|
4188
4188
|
let cancelled = false;
|
|
4189
|
-
const screen =
|
|
4190
|
-
const localDev = screen ? (
|
|
4189
|
+
const screen = chunk55Y2AQE7_js.getCurrentScreen() ?? void 0;
|
|
4190
|
+
const localDev = screen ? (chunk55Y2AQE7_js.getScreenMetadata(screen)?.suggestedPrompts ?? []).map((text) => ({
|
|
4191
4191
|
text,
|
|
4192
4192
|
source: "dev-defined"
|
|
4193
4193
|
})) : [];
|
|
@@ -4201,7 +4201,7 @@ function useSuggestedPrompts(options) {
|
|
|
4201
4201
|
if (cancelled || requestIdRef.current !== requestId) return;
|
|
4202
4202
|
setPrompts(mergePromptSources(localDev, data, limit));
|
|
4203
4203
|
}).catch((err) => {
|
|
4204
|
-
|
|
4204
|
+
chunk55Y2AQE7_js.appilotsDebugWarn("useSuggestedPrompts: fetch failed", err);
|
|
4205
4205
|
}).finally(() => {
|
|
4206
4206
|
if (cancelled || requestIdRef.current !== requestId) return;
|
|
4207
4207
|
setIsLoading(false);
|
|
@@ -4212,9 +4212,9 @@ function useSuggestedPrompts(options) {
|
|
|
4212
4212
|
}, [client, enabled, limit, refreshTick]);
|
|
4213
4213
|
React.useEffect(() => {
|
|
4214
4214
|
if (!enabled) return;
|
|
4215
|
-
let lastScreen =
|
|
4215
|
+
let lastScreen = chunk55Y2AQE7_js.getCurrentScreen();
|
|
4216
4216
|
const interval = setInterval(() => {
|
|
4217
|
-
const current =
|
|
4217
|
+
const current = chunk55Y2AQE7_js.getCurrentScreen();
|
|
4218
4218
|
if (current !== lastScreen) {
|
|
4219
4219
|
lastScreen = current;
|
|
4220
4220
|
setRefreshTick((t) => t + 1);
|
|
@@ -4229,14 +4229,14 @@ function useSuggestedPrompts(options) {
|
|
|
4229
4229
|
};
|
|
4230
4230
|
}
|
|
4231
4231
|
function useAppilotsNavigation() {
|
|
4232
|
-
const { emit } =
|
|
4232
|
+
const { emit } = chunk55Y2AQE7_js.useAppilotsContext();
|
|
4233
4233
|
const [currentScreen, setCurrentScreenState] = React.useState(null);
|
|
4234
4234
|
const [navigationHistory, setNavigationHistory] = React.useState([]);
|
|
4235
4235
|
const navigationRef = React.useRef(null);
|
|
4236
4236
|
const setCurrentScreen2 = React.useCallback(
|
|
4237
4237
|
(screenName) => {
|
|
4238
4238
|
setCurrentScreenState(screenName);
|
|
4239
|
-
|
|
4239
|
+
chunk55Y2AQE7_js.setCurrentScreen(screenName);
|
|
4240
4240
|
setNavigationHistory((prev) => [...prev, screenName]);
|
|
4241
4241
|
emit({
|
|
4242
4242
|
type: "navigation:change",
|
|
@@ -4267,7 +4267,7 @@ function useAppilotsNavigation() {
|
|
|
4267
4267
|
|
|
4268
4268
|
// src/hooks/useAppilots.ts
|
|
4269
4269
|
function useAppilots() {
|
|
4270
|
-
const { config, client } =
|
|
4270
|
+
const { config, client } = chunk55Y2AQE7_js.useAppilotsContext();
|
|
4271
4271
|
const chat = useAppilotsChat();
|
|
4272
4272
|
const navigation = useAppilotsNavigation();
|
|
4273
4273
|
const actions = useAppilotsActions();
|
|
@@ -4296,7 +4296,7 @@ function useAppilots() {
|
|
|
4296
4296
|
}
|
|
4297
4297
|
function useAppilotsField(id, options) {
|
|
4298
4298
|
const { value, onChangeText, ref, fieldType, label, screen } = options;
|
|
4299
|
-
const registry =
|
|
4299
|
+
const registry = chunk55Y2AQE7_js.useResolvedRegistry();
|
|
4300
4300
|
const valueRef = React.useRef(value);
|
|
4301
4301
|
const onChangeRef = React.useRef(onChangeText);
|
|
4302
4302
|
valueRef.current = value;
|
|
@@ -4324,7 +4324,7 @@ function useAppilotsField(id, options) {
|
|
|
4324
4324
|
}
|
|
4325
4325
|
function useAppilotsTarget(id, options) {
|
|
4326
4326
|
const { onPress, onLongPress, onScrollTo, label, screen } = options;
|
|
4327
|
-
const registry =
|
|
4327
|
+
const registry = chunk55Y2AQE7_js.useResolvedRegistry();
|
|
4328
4328
|
const onPressRef = React.useRef(onPress);
|
|
4329
4329
|
const onLongPressRef = React.useRef(onLongPress);
|
|
4330
4330
|
const onScrollToRef = React.useRef(onScrollTo);
|
|
@@ -4351,7 +4351,7 @@ function useAppilotsTarget(id, options) {
|
|
|
4351
4351
|
}
|
|
4352
4352
|
function useAppilotsToggle(id, options) {
|
|
4353
4353
|
const { value, onValueChange, label, screen } = options;
|
|
4354
|
-
const registry =
|
|
4354
|
+
const registry = chunk55Y2AQE7_js.useResolvedRegistry();
|
|
4355
4355
|
const valueRef = React.useRef(value);
|
|
4356
4356
|
const onChangeRef = React.useRef(onValueChange);
|
|
4357
4357
|
valueRef.current = value;
|
|
@@ -4374,7 +4374,7 @@ function useAppilotsToggle(id, options) {
|
|
|
4374
4374
|
}
|
|
4375
4375
|
function useAppilotsSlider(id, options) {
|
|
4376
4376
|
const { value, onValueChange, min, max, step, label, screen } = options;
|
|
4377
|
-
const registry =
|
|
4377
|
+
const registry = chunk55Y2AQE7_js.useResolvedRegistry();
|
|
4378
4378
|
const valueRef = React.useRef(value);
|
|
4379
4379
|
const onChangeRef = React.useRef(onValueChange);
|
|
4380
4380
|
valueRef.current = value;
|