@appilots/sdk 0.2.0 → 0.4.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/index.mjs CHANGED
@@ -1,407 +1,14 @@
1
- export { AppilotsNavigationContainer } from './chunk-KCDNL4HV.mjs';
2
- import { useAppilotsChat, useAppilotsActions, shouldShowSuggestedPrompts, useSuggestedPrompts } from './chunk-GEM6TPAK.mjs';
3
- export { captureSnapshot, executeAction, useAppilots, useAppilotsActions, useAppilotsChat, useAppilotsField, useAppilotsNavigation, useAppilotsSlider, useAppilotsTarget, useAppilotsToggle, useSuggestedPrompts } from './chunk-GEM6TPAK.mjs';
4
- import { useAppilotsContext, componentRegistry } from './chunk-HDLZGXNF.mjs';
5
- export { AppilotsClient, AppilotsProvider, AppilotsRegistryProvider, SDK_VERSION, _patchJsxRuntimes, clearAppilotsDebugTraces, componentRegistry, createComponentRegistry, createElementRegistry, createListRegistry, elementRegistry, enableAppilotsAutoTracking, getAppilotsDebugTraces, getGlobalConfig, initAppilots, isAutoTrackingEnabled, listRegistry, recordAppilotsDebugTrace, registerScreen, subscribeAppilotsDebugTraces, useAppilotsContext, useResolvedRegistry } from './chunk-HDLZGXNF.mjs';
1
+ export { AppilotsNavigationContainer } from './chunk-GEKCGVJN.mjs';
2
+ import { useAppilotsChat, useAppilotsActions, shouldShowSuggestedPrompts, useSuggestedPrompts } from './chunk-42WI3UDB.mjs';
3
+ export { captureSnapshot, executeAction, useAppilots, useAppilotsActions, useAppilotsChat, useAppilotsField, useAppilotsNavigation, useAppilotsSlider, useAppilotsTarget, useAppilotsToggle, useSuggestedPrompts } from './chunk-42WI3UDB.mjs';
4
+ import { defaultLightTheme, describeAction, mergeThemeTokens, resolveBaseTheme, useAppilotsContext, componentRegistry } from './chunk-JBOLV5AM.mjs';
5
+ export { AppilotsClient, AppilotsProvider, AppilotsRegistryProvider, SDK_VERSION, _patchJsxRuntimes, clearAppilotsDebugTraces, componentRegistry, createComponentRegistry, createElementRegistry, createListRegistry, defaultDarkTheme, defaultLightTheme, describeAction, elementRegistry, enableAppilotsAutoTracking, getAppilotsDebugTraces, getGlobalConfig, humanizeError, initAppilots, isAutoTrackingEnabled, listRegistry, mergeThemeTokens, recordAppilotsDebugTrace, registerScreen, subscribeAppilotsDebugTraces, useAppilotsContext, useResolvedRegistry } from './chunk-JBOLV5AM.mjs';
6
6
  import * as React7 from 'react';
7
7
  import React7__default, { createContext, useRef, useEffect, useMemo, useContext, useState, useCallback } from 'react';
8
8
  import { StyleSheet, Dimensions, Platform, View, Animated, Text, TouchableOpacity, ActivityIndicator, useColorScheme, NativeModules, FlatList, Image, TextInput, Modal, KeyboardAvoidingView, Linking } from 'react-native';
9
9
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
10
10
  import Svg, { Path } from 'react-native-svg';
11
11
 
12
- // ../shared/dist/chunk-43YQ52Q7.mjs
13
- var SENSITIVE_FIELD_NAME_RE = /(\b|_|-)(password|senha|contrase[ñn]a|mot[\s_-]*de[\s_-]*passe|passwd|pwd|secret|token|api[\s_-]*key|access[\s_-]*key|private[\s_-]*key|cvv|cvc|cvn|cvc2|cid|pin(?:[\s_-]*code)?|otp|one[\s_-]*time[\s_-]*code|2fa|mfa|security[\s_-]*code|c[óo]digo[\s_-]*seguran[çc]a|c[óo]digo[\s_-]*verifica[çc][ãa]o|verification[\s_-]*code)(\b|_|-)/i;
14
- function isSensitiveFieldName(id, label, placeholder, type) {
15
- if (type === "password") return true;
16
- for (const candidate of [id, label, placeholder]) {
17
- if (typeof candidate === "string" && SENSITIVE_FIELD_NAME_RE.test(candidate)) {
18
- return true;
19
- }
20
- }
21
- return false;
22
- }
23
-
24
- // src/components/humanizeAction.ts
25
- function describeAction(action) {
26
- const state = mapStatus(action.status);
27
- const label = labelFor(action, state);
28
- return { label, state };
29
- }
30
- function mapStatus(status) {
31
- switch (status) {
32
- case "pending":
33
- return "pending";
34
- case "executing":
35
- return "running";
36
- case "completed":
37
- return "success";
38
- case "failed":
39
- return "failed";
40
- default:
41
- return "pending";
42
- }
43
- }
44
- function labelFor(action, state) {
45
- if (state === "failed") {
46
- return failureLabel(action);
47
- }
48
- switch (action.type) {
49
- case "navigate":
50
- return navigateLabel(action, state);
51
- case "form_fill":
52
- return formFillLabel(action, state);
53
- case "ui_interaction":
54
- return uiInteractionLabel(action, state);
55
- case "scroll_list":
56
- return scrollListLabel(action, state);
57
- case "confirm":
58
- return confirmLabel(state);
59
- default:
60
- return genericLabel(action.type, state);
61
- }
62
- }
63
- function navigateLabel(action, state) {
64
- const screen = readString(action.payload, "screenName") || "a outra tela";
65
- switch (state) {
66
- case "pending":
67
- return `Vou navegar para ${screen}`;
68
- case "running":
69
- return `Navegando para ${screen}...`;
70
- case "success":
71
- return `Naveguei para ${screen}`;
72
- default:
73
- return `Navega\xE7\xE3o para ${screen}`;
74
- }
75
- }
76
- function formFillLabel(action, state) {
77
- const fields = readArray(action.payload, "fields");
78
- const summary = summariseFields(fields);
79
- switch (state) {
80
- case "pending":
81
- return summary ? `Vou preencher ${summary}` : "Vou preencher o formul\xE1rio";
82
- case "running":
83
- return summary ? `Preenchendo ${summary}...` : "Preenchendo formul\xE1rio...";
84
- case "success":
85
- return summary ? `Preenchi ${summary}` : "Preenchi o formul\xE1rio";
86
- default:
87
- return "Preenchimento do formul\xE1rio";
88
- }
89
- }
90
- function uiInteractionLabel(action, state) {
91
- const verbBase = uiVerb(readString(action.payload, "action"));
92
- const target = humanActionTarget(action.payload);
93
- const where = target ? ` em ${target}` : "";
94
- switch (state) {
95
- case "pending":
96
- return `Vou ${verbBase.infinitive}${where}`;
97
- case "running":
98
- return `${verbBase.gerund}${where}...`;
99
- case "success":
100
- return `${verbBase.past}${where}`;
101
- default:
102
- return `Intera\xE7\xE3o${where}`;
103
- }
104
- }
105
- function scrollListLabel(action, state) {
106
- const payload = action.payload;
107
- const toIndex = typeof payload?.toIndex === "number" ? payload.toIndex : void 0;
108
- const direction = payload?.direction === "up" ? "para cima" : "para baixo";
109
- const target = toIndex !== void 0 ? `at\xE9 o item ${toIndex}` : direction;
110
- switch (state) {
111
- case "pending":
112
- return `Vou rolar a lista ${target}`;
113
- case "running":
114
- return `Rolando a lista ${target}...`;
115
- case "success":
116
- return `Rolei a lista ${target}`;
117
- default:
118
- return "Rolagem da lista";
119
- }
120
- }
121
- function confirmLabel(state) {
122
- switch (state) {
123
- case "pending":
124
- case "running":
125
- return "Aguardando confirma\xE7\xE3o";
126
- case "success":
127
- return "Voc\xEA confirmou";
128
- case "failed":
129
- return "Confirma\xE7\xE3o cancelada";
130
- default:
131
- return "Confirma\xE7\xE3o";
132
- }
133
- }
134
- function genericLabel(type, state) {
135
- switch (state) {
136
- case "pending":
137
- return `Vou executar ${type}`;
138
- case "running":
139
- return `Executando ${type}...`;
140
- case "success":
141
- return `Executei ${type}`;
142
- default:
143
- return type;
144
- }
145
- }
146
- function failureLabel(action) {
147
- const cause = humanizeError(action.error);
148
- const head = failureHead(action);
149
- return cause ? `${head} (${cause})` : head;
150
- }
151
- function failureHead(action) {
152
- switch (action.type) {
153
- case "navigate": {
154
- const screen = readString(action.payload, "screenName") || "a tela";
155
- return `N\xE3o consegui navegar para ${screen}`;
156
- }
157
- case "form_fill":
158
- return "N\xE3o consegui preencher o formul\xE1rio";
159
- case "ui_interaction": {
160
- const verb = uiVerb(readString(action.payload, "action"));
161
- const target = humanComponentId(
162
- readString(action.payload, "componentId") || readString(action.payload, "targetId")
163
- );
164
- return target ? `N\xE3o consegui ${verb.infinitive} em ${target}` : `N\xE3o consegui ${verb.infinitive}`;
165
- }
166
- case "scroll_list":
167
- return "N\xE3o consegui rolar a lista";
168
- case "confirm":
169
- return "Voc\xEA cancelou";
170
- default:
171
- return `N\xE3o consegui executar ${action.type}`;
172
- }
173
- }
174
- var TECHNICAL_PATTERNS = [
175
- /\bat\s+\S+\s*\(/,
176
- // stack trace frame
177
- /TypeError|ReferenceError|SyntaxError|RangeError/i,
178
- /HTTP\s*[45]\d{2}/i,
179
- /^\s*\{[\s\S]*\}\s*$/,
180
- // JSON dump
181
- /undefined is not a function/i,
182
- /Cannot read propert/i
183
- ];
184
- var FRIENDLY_REWRITES = [
185
- [/rejected by user/i, "cancelado pelo usu\xE1rio"],
186
- [/component '([^']+)' not found/i, "componente $1 n\xE3o encontrado"],
187
- [/field '([^']+)' not found/i, "campo $1 n\xE3o encontrado"],
188
- [/screen '([^']+)' not registered/i, "tela $1 n\xE3o registrada"],
189
- [/permission denied/i, "sem permiss\xE3o"],
190
- [/timeout|timed out/i, "tempo esgotado"],
191
- [/network/i, "falha de rede"]
192
- ];
193
- var MAX_REASON_LEN = 80;
194
- function humanizeError(raw, _action) {
195
- if (!raw) return void 0;
196
- const trimmed = String(raw).trim();
197
- if (!trimmed) return void 0;
198
- for (const [pattern, replacement] of FRIENDLY_REWRITES) {
199
- if (pattern.test(trimmed)) {
200
- return finalize(trimmed.replace(pattern, replacement));
201
- }
202
- }
203
- if (TECHNICAL_PATTERNS.some((p) => p.test(trimmed))) {
204
- return "algo deu errado";
205
- }
206
- if (trimmed.length > MAX_REASON_LEN) {
207
- return "algo deu errado";
208
- }
209
- return finalize(trimmed);
210
- }
211
- function finalize(text) {
212
- let out = text.trim();
213
- if (out.length > MAX_REASON_LEN) out = out.slice(0, MAX_REASON_LEN - 1).trimEnd() + "\u2026";
214
- if (out.length > 0) out = out[0].toLowerCase() + out.slice(1);
215
- return out;
216
- }
217
- function uiVerb(raw) {
218
- switch ((raw ?? "press").toLowerCase()) {
219
- case "press":
220
- case "tap":
221
- case "click":
222
- return { infinitive: "clicar", gerund: "Clicando", past: "Cliquei" };
223
- case "longpress":
224
- case "long_press":
225
- return { infinitive: "pressionar", gerund: "Pressionando", past: "Pressionei" };
226
- case "scroll":
227
- case "scroll_to":
228
- return { infinitive: "rolar", gerund: "Rolando", past: "Rolei" };
229
- case "focus":
230
- return { infinitive: "focar", gerund: "Focando", past: "Foquei" };
231
- default:
232
- return { infinitive: "interagir", gerund: "Interagindo", past: "Interagi" };
233
- }
234
- }
235
- function summariseFields(fields) {
236
- if (!Array.isArray(fields) || fields.length === 0) return void 0;
237
- const parts = [];
238
- const visible = fields.slice(0, 3);
239
- for (const f of visible) {
240
- if (!f || typeof f !== "object") continue;
241
- const obj = f;
242
- const name = humanFieldName(obj.label, obj.fieldId);
243
- if (!name) continue;
244
- const fieldIdStr = typeof obj.fieldId === "string" ? obj.fieldId : void 0;
245
- const labelStr = typeof obj.label === "string" ? obj.label : void 0;
246
- const fieldTypeStr = typeof obj.fieldType === "string" ? obj.fieldType : void 0;
247
- const sensitive = isSensitiveFieldName(fieldIdStr, labelStr, void 0, fieldTypeStr);
248
- if (sensitive) {
249
- parts.push(`${name}=\u2022\u2022\u2022\u2022`);
250
- continue;
251
- }
252
- const value = formatFieldValue(obj.value);
253
- parts.push(value !== void 0 ? `${name}=${value}` : name);
254
- }
255
- if (parts.length === 0) return void 0;
256
- const extra = fields.length - parts.length;
257
- return extra > 0 ? `${parts.join(", ")} +${extra}` : parts.join(", ");
258
- }
259
- function formatFieldValue(value) {
260
- if (value === void 0 || value === null || value === "") return void 0;
261
- if (typeof value === "string") {
262
- const v = value.length > 18 ? `${value.slice(0, 17)}\u2026` : value;
263
- return `"${v}"`;
264
- }
265
- if (typeof value === "number" || typeof value === "boolean") return String(value);
266
- return void 0;
267
- }
268
- function humanActionTarget(payload) {
269
- if (!payload || typeof payload !== "object") return "";
270
- const record = payload;
271
- const friendly = readFriendlyString(record, "label") || readFriendlyString(record, "actionDescription") || readFriendlyString(record, "title") || readFriendlyString(record, "name");
272
- if (friendly) return friendly;
273
- return humanComponentId(
274
- readString(payload, "componentId") || readString(payload, "targetId")
275
- );
276
- }
277
- function humanFieldName(label, fieldId) {
278
- if (typeof label === "string" && label.trim()) return label.trim();
279
- if (typeof fieldId !== "string" || isTechnicalIdentifier(fieldId)) return void 0;
280
- return humanComponentId(fieldId) || void 0;
281
- }
282
- function readFriendlyString(record, key) {
283
- const value = record[key];
284
- if (typeof value !== "string") return "";
285
- const trimmed = value.trim();
286
- if (!trimmed || isTechnicalIdentifier(trimmed)) return "";
287
- return trimmed;
288
- }
289
- function humanComponentId(id) {
290
- if (!id) return "";
291
- if (isTechnicalIdentifier(id)) return "";
292
- const cleaned = id.replace(/^(btn-|btn_|button-|component-)/i, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").trim();
293
- if (!cleaned) return "";
294
- return cleaned[0].toUpperCase() + cleaned.slice(1);
295
- }
296
- function isTechnicalIdentifier(value) {
297
- const raw = value.trim();
298
- if (!raw) return false;
299
- if (/^el:/i.test(raw)) return true;
300
- if (/^list-\d+-item-\d+$/i.test(raw)) return true;
301
- if (/(testid|test-id|accessibilityid|accessibility-id|automationid|automation-id)/i.test(raw)) {
302
- return true;
303
- }
304
- if (/^[a-z]+:[^ ]+:[^ ]+/i.test(raw)) return true;
305
- if (/^[A-Za-z][\w-]*:[^\s]+$/i.test(raw)) return true;
306
- if (/^[a-z]+(?:[-_][a-z]+)*[-_][a-z0-9]{5,}$/i.test(raw)) return true;
307
- return false;
308
- }
309
- function readString(payload, key) {
310
- if (!payload || typeof payload !== "object") return "";
311
- const v = payload[key];
312
- return typeof v === "string" ? v : "";
313
- }
314
- function readArray(payload, key) {
315
- if (!payload || typeof payload !== "object") return [];
316
- const v = payload[key];
317
- return Array.isArray(v) ? v : [];
318
- }
319
-
320
- // src/theme/tokens.ts
321
- var defaultLightTheme = {
322
- colors: {
323
- primary: "#6366f1",
324
- secondary: "#8b5cf6",
325
- background: "#ffffff",
326
- surface: "#f3f4f6",
327
- text: "#1f2937",
328
- textSecondary: "#6b7280",
329
- border: "#e5e7eb",
330
- // NOTE (BACKLOG 4.2): success/warning/error used to have ZERO visual
331
- // consumers — nothing read them, so ActionBreadcrumb's tones and the
332
- // confirm card's destructive accents were hardcoded separately with
333
- // their OWN hex values (#10B981/#EF4444/#9CA3AF-ish grays). Since no
334
- // other UI in the SDK reads these three tokens, we picked these
335
- // defaults to exactly match those pre-existing hardcoded values —
336
- // wiring the tokens up to ActionBreadcrumb (see breadcrumbPresentation.ts)
337
- // is now a no-op for anyone on the bundled default theme, while a
338
- // custom theme's success/warning/error now actually do something.
339
- success: "#10b981",
340
- warning: "#9ca3af",
341
- error: "#ef4444",
342
- // Same value as `text` — split out so an app can diverge them, but
343
- // any app that doesn't set these renders pixel-identical to before.
344
- buttonText: "#1f2937",
345
- bubbleText: "#1f2937",
346
- userBubbleText: "#ffffff"
347
- },
348
- typography: {
349
- fontFamily: "System",
350
- fontSizeXs: 11,
351
- fontSizeSm: 13,
352
- fontSizeBase: 15,
353
- fontSizeLg: 18
354
- },
355
- radii: {
356
- sm: 8,
357
- md: 12,
358
- lg: 16
359
- },
360
- shadows: {
361
- appearance: "light"
362
- }
363
- };
364
- var defaultDarkTheme = {
365
- colors: {
366
- primary: "#818cf8",
367
- secondary: "#a78bfa",
368
- background: "#0f172a",
369
- surface: "#1e293b",
370
- text: "#f1f5f9",
371
- textSecondary: "#94a3b8",
372
- border: "#334155",
373
- // Kept IDENTICAL to the light theme's success/warning/error (not the
374
- // usual "lighter for dark bg" adjustment other tokens get) — the
375
- // breadcrumb's tones were a fixed, theme-agnostic hardcoded palette
376
- // before this token existed, rendering the SAME hex in light and dark
377
- // mode. Diverging them here would change dark-mode breadcrumbs even
378
- // though nothing in the token tree asked for that.
379
- success: "#10b981",
380
- warning: "#9ca3af",
381
- error: "#ef4444",
382
- buttonText: "#f1f5f9",
383
- bubbleText: "#f1f5f9",
384
- userBubbleText: "#ffffff"
385
- },
386
- typography: { ...defaultLightTheme.typography },
387
- radii: { ...defaultLightTheme.radii },
388
- shadows: { appearance: "dark" }
389
- };
390
- function mergeThemeTokens(base, partial) {
391
- if (!partial) return base;
392
- return {
393
- colors: { ...base.colors, ...partial.colors ?? {} },
394
- typography: { ...base.typography, ...partial.typography ?? {} },
395
- radii: { ...base.radii, ...partial.radii ?? {} },
396
- shadows: { ...base.shadows, ...partial.shadows ?? {} }
397
- };
398
- }
399
- function resolveBaseTheme(mode, systemScheme) {
400
- if (mode === "dark") return defaultDarkTheme;
401
- if (mode === "light") return defaultLightTheme;
402
- return systemScheme === "dark" ? defaultDarkTheme : defaultLightTheme;
403
- }
404
-
405
12
  // src/components/breadcrumbPresentation.ts
406
13
  var DEFAULT_BREADCRUMB_PALETTE = {
407
14
  primary: defaultLightTheme.colors.primary,
@@ -456,13 +63,13 @@ function deriveConfirmCardContent(action, palette = DEFAULT_BREADCRUMB_PALETTE)
456
63
  const isDestructive = isDestructiveAction(action);
457
64
  const message = typeof payload.message === "string" && payload.message || typeof payload.actionDescription === "string" && payload.actionDescription || "Confirme para prosseguir";
458
65
  const title = typeof payload.title === "string" && payload.title || (isDestructive ? "A\xE7\xE3o destrutiva" : "Confirma\xE7\xE3o necess\xE1ria");
459
- const confirmLabel2 = typeof payload.confirmLabel === "string" && payload.confirmLabel || (isDestructive ? "Sim, executar" : "Confirmar");
66
+ const confirmLabel = typeof payload.confirmLabel === "string" && payload.confirmLabel || (isDestructive ? "Sim, executar" : "Confirmar");
460
67
  const cancelLabel = typeof payload.cancelLabel === "string" && payload.cancelLabel || "Cancelar";
461
68
  return {
462
69
  isDestructive,
463
70
  title,
464
71
  message,
465
- confirmLabel: confirmLabel2,
72
+ confirmLabel,
466
73
  cancelLabel,
467
74
  glyph: isDestructive ? "\u26A0" : "?",
468
75
  actionColor: isDestructive ? palette.error : palette.primary,
@@ -595,7 +202,7 @@ function ConfirmCard({ action, palette, fontFamily, onApprove, onReject }) {
595
202
  isDestructive,
596
203
  title,
597
204
  message,
598
- confirmLabel: confirmLabel2,
205
+ confirmLabel,
599
206
  cancelLabel,
600
207
  glyph,
601
208
  actionColor,
@@ -648,7 +255,7 @@ function ConfirmCard({ action, palette, fontFamily, onApprove, onReject }) {
648
255
  accessibilityLabel: "Confirmar",
649
256
  testID: "assistant-confirm-approve"
650
257
  },
651
- /* @__PURE__ */ React7__default.createElement(Text, { style: [confirmCardStyles.confirmText, { fontFamily }] }, confirmLabel2)
258
+ /* @__PURE__ */ React7__default.createElement(Text, { style: [confirmCardStyles.confirmText, { fontFamily }] }, confirmLabel)
652
259
  ))
653
260
  );
654
261
  }
@@ -2655,4 +2262,4 @@ function createAppilotsSwitch(WrappedComponent) {
2655
2262
  return AppilotsSwitch;
2656
2263
  }
2657
2264
 
2658
- export { ActionBreadcrumb, AppilotsChat, AppilotsI18nProvider, AppilotsThemeProvider, ChatIcon, ConfirmDialog, HeadsetIcon, appilotsTheme, appilotsThemeFromTailwind, createAppilotsButton, createAppilotsInput, createAppilotsSwitch, defaultDarkTheme, defaultLightTheme, describeAction, detectDeviceLocale, humanizeError, mergeThemeTokens, resolveLocale, useAppilotsI18n, useAppilotsTheme };
2265
+ export { ActionBreadcrumb, AppilotsChat, AppilotsI18nProvider, AppilotsThemeProvider, ChatIcon, ConfirmDialog, HeadsetIcon, appilotsTheme, appilotsThemeFromTailwind, createAppilotsButton, createAppilotsInput, createAppilotsSwitch, detectDeviceLocale, resolveLocale, useAppilotsI18n, useAppilotsTheme };
@@ -1,51 +1,51 @@
1
1
  'use strict';
2
2
 
3
- var chunkKGN3DNGX_js = require('../chunk-KGN3DNGX.js');
4
- var chunkSIBKF7AA_js = require('../chunk-SIBKF7AA.js');
3
+ var chunkCHY5D2PV_js = require('../chunk-CHY5D2PV.js');
4
+ var chunkV3TUIIT2_js = require('../chunk-V3TUIIT2.js');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "AppilotsNavigationContainer", {
9
9
  enumerable: true,
10
- get: function () { return chunkKGN3DNGX_js.AppilotsNavigationContainer; }
10
+ get: function () { return chunkCHY5D2PV_js.AppilotsNavigationContainer; }
11
11
  });
12
12
  Object.defineProperty(exports, "clearScreenRegistry", {
13
13
  enumerable: true,
14
- get: function () { return chunkSIBKF7AA_js.clearScreenRegistry; }
14
+ get: function () { return chunkV3TUIIT2_js.clearScreenRegistry; }
15
15
  });
16
16
  Object.defineProperty(exports, "getActiveRouteNames", {
17
17
  enumerable: true,
18
- get: function () { return chunkSIBKF7AA_js.getActiveRouteNames; }
18
+ get: function () { return chunkV3TUIIT2_js.getActiveRouteNames; }
19
19
  });
20
20
  Object.defineProperty(exports, "getAllScreens", {
21
21
  enumerable: true,
22
- get: function () { return chunkSIBKF7AA_js.getAllScreens; }
22
+ get: function () { return chunkV3TUIIT2_js.getAllScreens; }
23
23
  });
24
24
  Object.defineProperty(exports, "getCurrentScreen", {
25
25
  enumerable: true,
26
- get: function () { return chunkSIBKF7AA_js.getCurrentScreen; }
26
+ get: function () { return chunkV3TUIIT2_js.getCurrentScreen; }
27
27
  });
28
28
  Object.defineProperty(exports, "getNavigationRef", {
29
29
  enumerable: true,
30
- get: function () { return chunkSIBKF7AA_js.getNavigationRef; }
30
+ get: function () { return chunkV3TUIIT2_js.getNavigationRef; }
31
31
  });
32
32
  Object.defineProperty(exports, "getNavigationStateSnapshot", {
33
33
  enumerable: true,
34
- get: function () { return chunkSIBKF7AA_js.getNavigationStateSnapshot; }
34
+ get: function () { return chunkV3TUIIT2_js.getNavigationStateSnapshot; }
35
35
  });
36
36
  Object.defineProperty(exports, "getScreenMetadata", {
37
37
  enumerable: true,
38
- get: function () { return chunkSIBKF7AA_js.getScreenMetadata; }
38
+ get: function () { return chunkV3TUIIT2_js.getScreenMetadata; }
39
39
  });
40
40
  Object.defineProperty(exports, "registerScreen", {
41
41
  enumerable: true,
42
- get: function () { return chunkSIBKF7AA_js.registerScreen; }
42
+ get: function () { return chunkV3TUIIT2_js.registerScreen; }
43
43
  });
44
44
  Object.defineProperty(exports, "setCurrentScreen", {
45
45
  enumerable: true,
46
- get: function () { return chunkSIBKF7AA_js.setCurrentScreen; }
46
+ get: function () { return chunkV3TUIIT2_js.setCurrentScreen; }
47
47
  });
48
48
  Object.defineProperty(exports, "setNavigationRef", {
49
49
  enumerable: true,
50
- get: function () { return chunkSIBKF7AA_js.setNavigationRef; }
50
+ get: function () { return chunkV3TUIIT2_js.setNavigationRef; }
51
51
  });
@@ -1,2 +1,2 @@
1
- export { AppilotsNavigationContainer } from '../chunk-KCDNL4HV.mjs';
2
- export { clearScreenRegistry, getActiveRouteNames, getAllScreens, getCurrentScreen, getNavigationRef, getNavigationStateSnapshot, getScreenMetadata, registerScreen, setCurrentScreen, setNavigationRef } from '../chunk-HDLZGXNF.mjs';
1
+ export { AppilotsNavigationContainer } from '../chunk-GEKCGVJN.mjs';
2
+ export { clearScreenRegistry, getActiveRouteNames, getAllScreens, getCurrentScreen, getNavigationRef, getNavigationStateSnapshot, getScreenMetadata, registerScreen, setCurrentScreen, setNavigationRef } from '../chunk-JBOLV5AM.mjs';
@@ -0,0 +1,9 @@
1
+ {
2
+ "//": "Legacy-resolution redirect for `@appilots/sdk/hooks`. Modern resolvers use the `exports` map in the package root and never read this file; Metro with `unstable_enablePackageExports` off (the default below Metro 0.82 / RN 0.79, and the SDK supports react-native >=0.72) and TypeScript's `moduleResolution: node10` both ignore `exports` and resolve this directory instead. Without it those consumers fail with `Unable to resolve module @appilots/sdk/hooks`. Keep the targets in sync with the `./hooks` entry in ../package.json.",
3
+ "name": "@appilots/sdk-hooks",
4
+ "private": true,
5
+ "main": "../dist/hooks/index.js",
6
+ "module": "../dist/hooks/index.mjs",
7
+ "types": "../dist/hooks/index.d.ts",
8
+ "sideEffects": false
9
+ }
package/metro.d.ts ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Type declarations for `@appilots/sdk/metro`.
3
+ *
4
+ * Hand-written: metro.js is plain CommonJS (Metro loads it via `require`, so it
5
+ * cannot be part of the tsup build). Keep in sync with metro.js.
6
+ */
7
+
8
+ /**
9
+ * Structural subset of a Metro config — just the fields `withAppilots` reads or
10
+ * rewrites. Declared locally rather than imported from `metro-config` so the
11
+ * SDK does not take a dependency on Metro's types just to type this helper.
12
+ */
13
+ export interface MetroConfigLike {
14
+ projectRoot?: string;
15
+ resolver?: {
16
+ resolveRequest?: (
17
+ context: unknown,
18
+ moduleName: string,
19
+ platform: string | null,
20
+ ) => unknown;
21
+ [option: string]: unknown;
22
+ };
23
+ [option: string]: unknown;
24
+ }
25
+
26
+ export interface WithAppilotsOptions {
27
+ /**
28
+ * Path to the `.appilotsrc` file.
29
+ *
30
+ * @default `<projectRoot>/.appilotsrc`
31
+ */
32
+ configPath?: string;
33
+ }
34
+
35
+ /**
36
+ * Wraps a Metro config so `AppilotsProvider` auto-loads `.appilotsrc`.
37
+ *
38
+ * Returns the config unchanged (with a warning) when no `.appilotsrc` is found.
39
+ *
40
+ * @example
41
+ * ```js
42
+ * const { withAppilots } = require('@appilots/sdk/metro');
43
+ * module.exports = withAppilots(mergeConfig(defaultConfig, config));
44
+ * ```
45
+ */
46
+ export declare function withAppilots<T extends MetroConfigLike>(
47
+ metroConfig: T,
48
+ options?: WithAppilotsOptions,
49
+ ): T;
package/metro.js CHANGED
@@ -100,41 +100,6 @@ function withAppilots(metroConfig, options = {}) {
100
100
  // Resolve `@appilots/auto-init` to the shim
101
101
  const existingResolveRequest = metroConfig.resolver?.resolveRequest;
102
102
 
103
- // Metro < 0.79 does not read package.json "exports" by default
104
- // (`unstable_enablePackageExports` is off), so deep imports like
105
- // `@appilots/shared/match` — which the SDK dist emits since the shared
106
- // element matcher landed — fail to resolve in consumer apps. Map
107
- // `@appilots/shared/<subpath>` onto the package's built dist layout
108
- // explicitly. Kept narrow on purpose: flipping
109
- // unstable_enablePackageExports globally would change resolution for
110
- // every dependency in the host app.
111
- const SHARED_SUBPATH_RE = /^@appilots\/shared\/([A-Za-z0-9_-]+)$/;
112
- function resolveSharedSubpath(moduleName) {
113
- const match = SHARED_SUBPATH_RE.exec(moduleName);
114
- if (!match) return null;
115
- try {
116
- // require.resolve('@appilots/shared') → <pkg>/dist/index.js; the
117
- // package root is two levels up. (package.json itself is not in
118
- // the exports map, so it can't be resolved directly.) __dirname
119
- // as a fallback path: the SDK always sees shared as a sibling —
120
- // node_modules/@appilots/{sdk,shared} in apps, workspace packages
121
- // in the monorepo — even when projectRoot has no resolution
122
- // chain to it.
123
- const mainEntry = require.resolve('@appilots/shared', {
124
- paths: [projectRoot, __dirname],
125
- });
126
- const packageRoot = path.dirname(path.dirname(mainEntry));
127
- const candidate = path.join(packageRoot, 'dist', match[1], 'index.js');
128
- if (fs.existsSync(candidate)) {
129
- return { type: 'sourceFile', filePath: candidate };
130
- }
131
- } catch (error) {
132
- // fall through to the default resolver (its error message names
133
- // the module, which is more actionable than ours would be)
134
- }
135
- return null;
136
- }
137
-
138
103
  return {
139
104
  ...metroConfig,
140
105
  resolver: {
@@ -144,8 +109,6 @@ function withAppilots(metroConfig, options = {}) {
144
109
  ensureShimFresh();
145
110
  return { type: 'sourceFile', filePath: shimPath };
146
111
  }
147
- const shared = resolveSharedSubpath(moduleName);
148
- if (shared) return shared;
149
112
  if (existingResolveRequest) {
150
113
  return existingResolveRequest(context, moduleName, platform);
151
114
  }
@@ -0,0 +1,9 @@
1
+ {
2
+ "//": "Legacy-resolution redirect for `@appilots/sdk/navigation`. Modern resolvers use the `exports` map in the package root and never read this file; Metro with `unstable_enablePackageExports` off (the default below Metro 0.82 / RN 0.79, and the SDK supports react-native >=0.72) and TypeScript's `moduleResolution: node10` both ignore `exports` and resolve this directory instead. Without it those consumers fail with `Unable to resolve module @appilots/sdk/navigation`. Keep the targets in sync with the `./navigation` entry in ../package.json.",
3
+ "name": "@appilots/sdk-navigation",
4
+ "private": true,
5
+ "main": "../dist/navigation/index.js",
6
+ "module": "../dist/navigation/index.mjs",
7
+ "types": "../dist/navigation/index.d.ts",
8
+ "sideEffects": false
9
+ }