@appilots/sdk 0.2.0 → 0.3.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/{chunk-GEM6TPAK.mjs → chunk-BKFO4DHW.mjs} +32 -198
- package/dist/{chunk-KCDNL4HV.mjs → chunk-DUSYQXAQ.mjs} +1 -1
- package/dist/{chunk-SIBKF7AA.js → chunk-MCY5YFYD.js} +619 -65
- package/dist/{chunk-KGN3DNGX.js → chunk-N2I3CA7Q.js} +5 -5
- package/dist/{chunk-HDLZGXNF.mjs → chunk-QMSMXTED.mjs} +602 -66
- package/dist/{chunk-IASJ7YHC.js → chunk-XNKPS7W3.js} +173 -339
- package/dist/hooks/index.d.mts +2 -1
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.js +11 -11
- package/dist/hooks/index.mjs +2 -2
- package/dist/index-BYVRBzjJ.d.mts +619 -0
- package/dist/index-BYVRBzjJ.d.ts +619 -0
- package/dist/index.d.mts +109 -64
- package/dist/index.d.ts +109 -64
- package/dist/index.js +84 -462
- package/dist/index.mjs +10 -403
- package/dist/navigation/index.js +13 -13
- package/dist/navigation/index.mjs +2 -2
- package/package.json +16 -15
- package/dist/index-BDb1WVNo.d.mts +0 -1300
- package/dist/index-BDb1WVNo.d.ts +0 -1300
package/dist/index.mjs
CHANGED
|
@@ -1,407 +1,14 @@
|
|
|
1
|
-
export { AppilotsNavigationContainer } from './chunk-
|
|
2
|
-
import { useAppilotsChat, useAppilotsActions, shouldShowSuggestedPrompts, useSuggestedPrompts } from './chunk-
|
|
3
|
-
export { captureSnapshot, executeAction, useAppilots, useAppilotsActions, useAppilotsChat, useAppilotsField, useAppilotsNavigation, useAppilotsSlider, useAppilotsTarget, useAppilotsToggle, useSuggestedPrompts } from './chunk-
|
|
4
|
-
import { useAppilotsContext, componentRegistry } from './chunk-
|
|
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-
|
|
1
|
+
export { AppilotsNavigationContainer } from './chunk-DUSYQXAQ.mjs';
|
|
2
|
+
import { useAppilotsChat, useAppilotsActions, shouldShowSuggestedPrompts, useSuggestedPrompts } from './chunk-BKFO4DHW.mjs';
|
|
3
|
+
export { captureSnapshot, executeAction, useAppilots, useAppilotsActions, useAppilotsChat, useAppilotsField, useAppilotsNavigation, useAppilotsSlider, useAppilotsTarget, useAppilotsToggle, useSuggestedPrompts } from './chunk-BKFO4DHW.mjs';
|
|
4
|
+
import { defaultLightTheme, describeAction, mergeThemeTokens, resolveBaseTheme, useAppilotsContext, componentRegistry } from './chunk-QMSMXTED.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-QMSMXTED.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
|
|
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
|
|
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
|
|
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 }] },
|
|
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,
|
|
2265
|
+
export { ActionBreadcrumb, AppilotsChat, AppilotsI18nProvider, AppilotsThemeProvider, ChatIcon, ConfirmDialog, HeadsetIcon, appilotsTheme, appilotsThemeFromTailwind, createAppilotsButton, createAppilotsInput, createAppilotsSwitch, detectDeviceLocale, resolveLocale, useAppilotsI18n, useAppilotsTheme };
|
package/dist/navigation/index.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkN2I3CA7Q_js = require('../chunk-N2I3CA7Q.js');
|
|
4
|
+
var chunkMCY5YFYD_js = require('../chunk-MCY5YFYD.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "AppilotsNavigationContainer", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkN2I3CA7Q_js.AppilotsNavigationContainer; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "clearScreenRegistry", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkMCY5YFYD_js.clearScreenRegistry; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "getActiveRouteNames", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkMCY5YFYD_js.getActiveRouteNames; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "getAllScreens", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkMCY5YFYD_js.getAllScreens; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "getCurrentScreen", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkMCY5YFYD_js.getCurrentScreen; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "getNavigationRef", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkMCY5YFYD_js.getNavigationRef; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "getNavigationStateSnapshot", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkMCY5YFYD_js.getNavigationStateSnapshot; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "getScreenMetadata", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkMCY5YFYD_js.getScreenMetadata; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "registerScreen", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunkMCY5YFYD_js.registerScreen; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "setCurrentScreen", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunkMCY5YFYD_js.setCurrentScreen; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "setNavigationRef", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunkMCY5YFYD_js.setNavigationRef; }
|
|
51
51
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AppilotsNavigationContainer } from '../chunk-
|
|
2
|
-
export { clearScreenRegistry, getActiveRouteNames, getAllScreens, getCurrentScreen, getNavigationRef, getNavigationStateSnapshot, getScreenMetadata, registerScreen, setCurrentScreen, setNavigationRef } from '../chunk-
|
|
1
|
+
export { AppilotsNavigationContainer } from '../chunk-DUSYQXAQ.mjs';
|
|
2
|
+
export { clearScreenRegistry, getActiveRouteNames, getAllScreens, getCurrentScreen, getNavigationRef, getNavigationStateSnapshot, getScreenMetadata, registerScreen, setCurrentScreen, setNavigationRef } from '../chunk-QMSMXTED.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appilots/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "AI-powered chat component and navigation SDK for React Native apps",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -58,6 +58,17 @@
|
|
|
58
58
|
"chat",
|
|
59
59
|
"sdk"
|
|
60
60
|
],
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "tsup",
|
|
63
|
+
"dev": "tsup --watch",
|
|
64
|
+
"lint": "eslint src --ext .ts,.tsx,.js,.jsx",
|
|
65
|
+
"lint:fix": "eslint src --ext .ts,.tsx,.js,.jsx --fix",
|
|
66
|
+
"test": "vitest run",
|
|
67
|
+
"test:watch": "vitest",
|
|
68
|
+
"test:coverage": "vitest run --coverage",
|
|
69
|
+
"typecheck": "tsc --noEmit",
|
|
70
|
+
"clean": "rm -rf dist .turbo"
|
|
71
|
+
},
|
|
61
72
|
"peerDependencies": {
|
|
62
73
|
"react": ">=18.0.0",
|
|
63
74
|
"react-native": ">=0.72.0",
|
|
@@ -65,6 +76,8 @@
|
|
|
65
76
|
"react-native-svg": ">=13.0.0"
|
|
66
77
|
},
|
|
67
78
|
"devDependencies": {
|
|
79
|
+
"@appilots/client-core": "workspace:*",
|
|
80
|
+
"@appilots/shared": "workspace:*",
|
|
68
81
|
"@types/react": "^18.3.0",
|
|
69
82
|
"@types/react-native": "^0.73.0",
|
|
70
83
|
"react": "^18.3.0",
|
|
@@ -73,18 +86,6 @@
|
|
|
73
86
|
"react-native-svg": "15.8.0",
|
|
74
87
|
"tsup": "^8.3.0",
|
|
75
88
|
"typescript": "^5.6.0",
|
|
76
|
-
"vitest": "^2.1.0"
|
|
77
|
-
"@appilots/shared": "0.1.0"
|
|
78
|
-
},
|
|
79
|
-
"scripts": {
|
|
80
|
-
"build": "tsup",
|
|
81
|
-
"dev": "tsup --watch",
|
|
82
|
-
"lint": "eslint src --ext .ts,.tsx,.js,.jsx",
|
|
83
|
-
"lint:fix": "eslint src --ext .ts,.tsx,.js,.jsx --fix",
|
|
84
|
-
"test": "vitest run",
|
|
85
|
-
"test:watch": "vitest",
|
|
86
|
-
"test:coverage": "vitest run --coverage",
|
|
87
|
-
"typecheck": "tsc --noEmit",
|
|
88
|
-
"clean": "rm -rf dist .turbo"
|
|
89
|
+
"vitest": "^2.1.0"
|
|
89
90
|
}
|
|
90
|
-
}
|
|
91
|
+
}
|