@neofaceid/web-sdk 1.29.0 → 1.30.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.d.ts +90 -7
- package/dist/neoface-id-sdk.es.js +258 -189
- package/dist/neoface-id-sdk.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -503,12 +503,6 @@ export declare interface EmailPasswordOptions {
|
|
|
503
503
|
subtitle?: string;
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
-
/**
|
|
507
|
-
* SDK Global Configuration
|
|
508
|
-
*
|
|
509
|
-
* Este módulo gerencia a configuração global do SDK, permitindo
|
|
510
|
-
* inicialização com detecção automática de ambiente ou override manual.
|
|
511
|
-
*/
|
|
512
506
|
export declare type Environment = 'development' | 'sandbox' | 'production';
|
|
513
507
|
|
|
514
508
|
/**
|
|
@@ -596,11 +590,17 @@ export declare interface GestureResponse {
|
|
|
596
590
|
images: string[];
|
|
597
591
|
}
|
|
598
592
|
|
|
593
|
+
/** Retorna a cor de acento configurada, se houver (antes do validador de contraste). */
|
|
594
|
+
export declare function getAccent(): string | null;
|
|
595
|
+
|
|
599
596
|
/**
|
|
600
597
|
* Retorna o token de aplicação configurado, se houver.
|
|
601
598
|
*/
|
|
602
599
|
export declare function getApplicationToken(): string | null;
|
|
603
600
|
|
|
601
|
+
/** Retorna o nome do integrador configurado, se houver. */
|
|
602
|
+
export declare function getAppName(): string | null;
|
|
603
|
+
|
|
604
604
|
/**
|
|
605
605
|
* Retorna a URL base configurada para a API.
|
|
606
606
|
* Se o SDK não foi inicializado, retorna o fallback para sandbox.
|
|
@@ -619,6 +619,22 @@ export declare function getConfig(): Readonly<SDKConfig>;
|
|
|
619
619
|
*/
|
|
620
620
|
export declare function getEnvironment(): Environment | 'custom';
|
|
621
621
|
|
|
622
|
+
/** Retorna o locale configurado (padrão 'pt-BR'). */
|
|
623
|
+
export declare function getLocale(): string;
|
|
624
|
+
|
|
625
|
+
/** Retorna o raio base configurado (padrão 16). */
|
|
626
|
+
export declare function getRadius(): SDKRadius;
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Retorna o modo de tema resolvido para a superfície de UI (light | dark).
|
|
630
|
+
* Considera 'auto' + `prefers-color-scheme`. Útil para consumidores que
|
|
631
|
+
* precisam alinhar visualmente algum elemento próprio ao SDK.
|
|
632
|
+
*/
|
|
633
|
+
export declare function getResolvedThemeMode(): ThemeMode;
|
|
634
|
+
|
|
635
|
+
/** Retorna o modo de tema configurado (padrão 'light'). */
|
|
636
|
+
export declare function getTheme(): SDKTheme;
|
|
637
|
+
|
|
622
638
|
/**
|
|
623
639
|
* Identifies a person from an image and returns name and age
|
|
624
640
|
* @param image The image blob to process
|
|
@@ -1286,6 +1302,15 @@ export declare function requestPasswordReset(email: string, applicationToken: st
|
|
|
1286
1302
|
|
|
1287
1303
|
export declare function resetCaptureSession(): void;
|
|
1288
1304
|
|
|
1305
|
+
declare interface ResolvedTheme {
|
|
1306
|
+
mode: ThemeMode;
|
|
1307
|
+
tokens: ThemeTokens;
|
|
1308
|
+
radius: 8 | 16 | 24;
|
|
1309
|
+
accent: string;
|
|
1310
|
+
/** True quando o `accent` do integrador foi rejeitado por contraste. */
|
|
1311
|
+
accentFellBack: boolean;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1289
1314
|
/**
|
|
1290
1315
|
* Orquestra o fluxo completo:
|
|
1291
1316
|
* 1. Abre `capture/session`
|
|
@@ -1319,6 +1344,12 @@ declare interface SDKConfig {
|
|
|
1319
1344
|
applicationToken: string | null;
|
|
1320
1345
|
environment: Environment | 'custom';
|
|
1321
1346
|
initialized: boolean;
|
|
1347
|
+
appName: string | null;
|
|
1348
|
+
accent: string | null;
|
|
1349
|
+
radius: SDKRadius;
|
|
1350
|
+
theme: SDKTheme;
|
|
1351
|
+
locale: string;
|
|
1352
|
+
resolvedTheme: ResolvedTheme | null;
|
|
1322
1353
|
}
|
|
1323
1354
|
|
|
1324
1355
|
/**
|
|
@@ -1340,8 +1371,42 @@ export declare interface SDKInitOptions {
|
|
|
1340
1371
|
* Obtido através do painel administrativo do NeoFaceID.
|
|
1341
1372
|
*/
|
|
1342
1373
|
applicationToken?: string;
|
|
1374
|
+
/**
|
|
1375
|
+
* Nome do integrador — mostrado no topo dos modais do SDK ("Banco Exemplo" >
|
|
1376
|
+
* NeoFaceID). Obrigatório na prática: omitir gera `console.warn` e cai para o
|
|
1377
|
+
* fallback "sua aplicação".
|
|
1378
|
+
*/
|
|
1379
|
+
appName?: string;
|
|
1380
|
+
/**
|
|
1381
|
+
* Cor de acento do integrador. Pinta APENAS o preenchimento do botão primário.
|
|
1382
|
+
* Nunca o anel de captura, o arco de desafio, os colchetes Focus Frame, os
|
|
1383
|
+
* glifos ou o selo de resultado — o visor precisa ser idêntico em toda parte
|
|
1384
|
+
* para que uma tela falsa não engane.
|
|
1385
|
+
*
|
|
1386
|
+
* Validado em runtime: contraste vs `#FFFFFF` < 4.5 = fallback para `#0059C4`
|
|
1387
|
+
* + `console.warn`. É segurança, não gosto.
|
|
1388
|
+
*/
|
|
1389
|
+
accent?: string;
|
|
1390
|
+
/**
|
|
1391
|
+
* Raio base dos containers. Restrito aos três raios do sistema: 8, 16 ou 24.
|
|
1392
|
+
* Padrão 16. Valor fora dos três permitidos = `console.warn` + fallback 16.
|
|
1393
|
+
*/
|
|
1394
|
+
radius?: SDKRadius;
|
|
1395
|
+
/**
|
|
1396
|
+
* Modo do tema para a superfície dos modais. Padrão `light`. `auto` respeita
|
|
1397
|
+
* `prefers-color-scheme`. O visor de captura é sempre escuro nos dois modos.
|
|
1398
|
+
*/
|
|
1399
|
+
theme?: SDKTheme;
|
|
1400
|
+
/**
|
|
1401
|
+
* Locale da UI. Padrão `pt-BR`.
|
|
1402
|
+
*/
|
|
1403
|
+
locale?: string;
|
|
1343
1404
|
}
|
|
1344
1405
|
|
|
1406
|
+
export declare type SDKRadius = 8 | 16 | 24;
|
|
1407
|
+
|
|
1408
|
+
export declare type SDKTheme = 'light' | 'dark' | 'auto';
|
|
1409
|
+
|
|
1345
1410
|
/**
|
|
1346
1411
|
* Session data interface for external integrations
|
|
1347
1412
|
*/
|
|
@@ -1476,6 +1541,24 @@ export declare interface SubmitLivenessChallengeParams {
|
|
|
1476
1541
|
gestures: GestureResponse[];
|
|
1477
1542
|
}
|
|
1478
1543
|
|
|
1544
|
+
declare type ThemeMode = 'light' | 'dark';
|
|
1545
|
+
|
|
1546
|
+
/** Tokens semânticos por tema — o que os componentes consomem. */
|
|
1547
|
+
declare interface ThemeTokens {
|
|
1548
|
+
ground: string;
|
|
1549
|
+
surface: string;
|
|
1550
|
+
surfaceMuted: string;
|
|
1551
|
+
line: string;
|
|
1552
|
+
text: string;
|
|
1553
|
+
textMuted: string;
|
|
1554
|
+
textSubtle: string;
|
|
1555
|
+
action: string;
|
|
1556
|
+
actionText: string;
|
|
1557
|
+
accent: string;
|
|
1558
|
+
overlay: string;
|
|
1559
|
+
focusRing: string;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1479
1562
|
/**
|
|
1480
1563
|
* Result of user existence check
|
|
1481
1564
|
*/
|
|
@@ -1512,7 +1595,7 @@ export declare const validateToken: (applicationToken: string) => Promise<boolea
|
|
|
1512
1595
|
* MINOR: Incrementado quando adicionamos funcionalidades mantendo compatibilidade
|
|
1513
1596
|
* PATCH: Incrementado quando corrigimos bugs mantendo compatibilidade
|
|
1514
1597
|
*/
|
|
1515
|
-
export declare const VERSION = "1.
|
|
1598
|
+
export declare const VERSION = "1.30.0";
|
|
1516
1599
|
|
|
1517
1600
|
/**
|
|
1518
1601
|
* Executa `fn(sessionId)`. Se o servidor devolver 410 (sessão consumida/expirada),
|
|
@@ -4342,21 +4342,209 @@ object({
|
|
|
4342
4342
|
task_id: string().optional(),
|
|
4343
4343
|
status: string().optional()
|
|
4344
4344
|
});
|
|
4345
|
+
const BLUE = {
|
|
4346
|
+
400: "#00B0F8",
|
|
4347
|
+
500: "#0091F6",
|
|
4348
|
+
700: "#0059C4"
|
|
4349
|
+
};
|
|
4350
|
+
const GOLD = {
|
|
4351
|
+
500: "#F1BE00"
|
|
4352
|
+
};
|
|
4353
|
+
const INK = {
|
|
4354
|
+
25: "#F7F9FC",
|
|
4355
|
+
50: "#F1F5FA",
|
|
4356
|
+
100: "#E6ECF4",
|
|
4357
|
+
300: "#AFBDCE",
|
|
4358
|
+
400: "#8496AD",
|
|
4359
|
+
500: "#617489",
|
|
4360
|
+
600: "#48586B",
|
|
4361
|
+
800: "#1E2B3C",
|
|
4362
|
+
900: "#111C2B",
|
|
4363
|
+
950: "#0A1320"
|
|
4364
|
+
};
|
|
4365
|
+
const LIGHT_TOKENS = {
|
|
4366
|
+
ground: INK[25],
|
|
4367
|
+
surface: "#FFFFFF",
|
|
4368
|
+
surfaceMuted: INK[50],
|
|
4369
|
+
line: INK[100],
|
|
4370
|
+
text: INK[950],
|
|
4371
|
+
textMuted: INK[600],
|
|
4372
|
+
textSubtle: INK[500],
|
|
4373
|
+
action: BLUE[700],
|
|
4374
|
+
actionText: "#FFFFFF",
|
|
4375
|
+
accent: GOLD[500],
|
|
4376
|
+
overlay: "rgba(10,19,32,.55)",
|
|
4377
|
+
focusRing: BLUE[700]
|
|
4378
|
+
};
|
|
4379
|
+
const DARK_TOKENS = {
|
|
4380
|
+
ground: INK[950],
|
|
4381
|
+
surface: INK[900],
|
|
4382
|
+
surfaceMuted: INK[800],
|
|
4383
|
+
line: "#22334D",
|
|
4384
|
+
text: "#EEF3F9",
|
|
4385
|
+
textMuted: INK[300],
|
|
4386
|
+
textSubtle: INK[400],
|
|
4387
|
+
action: BLUE[500],
|
|
4388
|
+
actionText: "#FFFFFF",
|
|
4389
|
+
accent: GOLD[500],
|
|
4390
|
+
overlay: "rgba(10,19,32,.72)",
|
|
4391
|
+
focusRing: BLUE[400]
|
|
4392
|
+
};
|
|
4393
|
+
function contrastRatio(hexA, hexB) {
|
|
4394
|
+
const lumA = luminance(hexA);
|
|
4395
|
+
const lumB = luminance(hexB);
|
|
4396
|
+
const [hi, lo] = lumA > lumB ? [lumA, lumB] : [lumB, lumA];
|
|
4397
|
+
return (hi + 0.05) / (lo + 0.05);
|
|
4398
|
+
}
|
|
4399
|
+
function luminance(hex) {
|
|
4400
|
+
const [r, g, b] = parseHex(hex).map((v) => {
|
|
4401
|
+
const s = v / 255;
|
|
4402
|
+
return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
4403
|
+
});
|
|
4404
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
4405
|
+
}
|
|
4406
|
+
function parseHex(hex) {
|
|
4407
|
+
let h = hex.trim().replace("#", "");
|
|
4408
|
+
if (h.length === 3) h = h.split("").map((c) => c + c).join("");
|
|
4409
|
+
if (!/^[0-9a-fA-F]{6}$/.test(h)) return [0, 0, 0];
|
|
4410
|
+
return [
|
|
4411
|
+
parseInt(h.slice(0, 2), 16),
|
|
4412
|
+
parseInt(h.slice(2, 4), 16),
|
|
4413
|
+
parseInt(h.slice(4, 6), 16)
|
|
4414
|
+
];
|
|
4415
|
+
}
|
|
4416
|
+
const ALLOWED_RADIUS = [8, 16, 24];
|
|
4417
|
+
function resolveTheme(options = {}) {
|
|
4418
|
+
const mode = resolveMode(options.theme);
|
|
4419
|
+
const tokens = mode === "dark" ? { ...DARK_TOKENS } : { ...LIGHT_TOKENS };
|
|
4420
|
+
let radius = 16;
|
|
4421
|
+
if (options.radius !== void 0) {
|
|
4422
|
+
if (ALLOWED_RADIUS.includes(options.radius)) {
|
|
4423
|
+
radius = options.radius;
|
|
4424
|
+
} else {
|
|
4425
|
+
console.warn(
|
|
4426
|
+
`[NeoFaceID SDK] radius ${options.radius} inválido — permitidos: 8, 16, 24. Usando 16.`
|
|
4427
|
+
);
|
|
4428
|
+
}
|
|
4429
|
+
}
|
|
4430
|
+
let accent = tokens.action;
|
|
4431
|
+
let accentFellBack = false;
|
|
4432
|
+
if (options.accent) {
|
|
4433
|
+
const ratio = contrastRatio(options.accent, "#FFFFFF");
|
|
4434
|
+
if (ratio >= 4.5) {
|
|
4435
|
+
accent = options.accent;
|
|
4436
|
+
} else {
|
|
4437
|
+
accentFellBack = true;
|
|
4438
|
+
console.warn(
|
|
4439
|
+
`[NeoFaceID SDK] accent ${options.accent} reprova AA vs branco (${ratio.toFixed(2)}:1). Usando ${BLUE[700]}.`
|
|
4440
|
+
);
|
|
4441
|
+
accent = BLUE[700];
|
|
4442
|
+
}
|
|
4443
|
+
}
|
|
4444
|
+
return { mode, tokens: { ...tokens, action: accent }, radius, accent, accentFellBack };
|
|
4445
|
+
}
|
|
4446
|
+
function resolveMode(theme) {
|
|
4447
|
+
if (theme === "dark") return "dark";
|
|
4448
|
+
if (theme === "light") return "light";
|
|
4449
|
+
if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
|
|
4450
|
+
if (window.matchMedia("(prefers-color-scheme: dark)").matches) return "dark";
|
|
4451
|
+
}
|
|
4452
|
+
return "light";
|
|
4453
|
+
}
|
|
4454
|
+
const CSS_VAR = {
|
|
4455
|
+
ground: "--nfid-ground",
|
|
4456
|
+
surface: "--nfid-surface",
|
|
4457
|
+
surfaceMuted: "--nfid-surface-muted",
|
|
4458
|
+
line: "--nfid-line",
|
|
4459
|
+
text: "--nfid-text",
|
|
4460
|
+
textMuted: "--nfid-text-muted",
|
|
4461
|
+
textSubtle: "--nfid-text-subtle",
|
|
4462
|
+
action: "--nfid-action",
|
|
4463
|
+
actionText: "--nfid-action-text",
|
|
4464
|
+
accent: "--nfid-accent",
|
|
4465
|
+
overlay: "--nfid-overlay",
|
|
4466
|
+
focusRing: "--nfid-focus-ring",
|
|
4467
|
+
radius: "--nfid-radius"
|
|
4468
|
+
};
|
|
4469
|
+
const INJECTED_STYLE_ID = "neofaceid-focus-frame-tokens";
|
|
4470
|
+
function injectThemeStyles$1(options = {}) {
|
|
4471
|
+
const resolved = resolveTheme(options);
|
|
4472
|
+
if (typeof document === "undefined") return resolved;
|
|
4473
|
+
const css = buildRootCss(resolved);
|
|
4474
|
+
const existing = document.getElementById(INJECTED_STYLE_ID);
|
|
4475
|
+
if (existing) {
|
|
4476
|
+
if (existing.textContent !== css) existing.textContent = css;
|
|
4477
|
+
return resolved;
|
|
4478
|
+
}
|
|
4479
|
+
const style = document.createElement("style");
|
|
4480
|
+
style.id = INJECTED_STYLE_ID;
|
|
4481
|
+
style.textContent = css;
|
|
4482
|
+
document.head.appendChild(style);
|
|
4483
|
+
return resolved;
|
|
4484
|
+
}
|
|
4485
|
+
function buildRootCss(theme) {
|
|
4486
|
+
const t = theme.tokens;
|
|
4487
|
+
return `.neofaceid-root {
|
|
4488
|
+
${CSS_VAR.ground}: ${t.ground};
|
|
4489
|
+
${CSS_VAR.surface}: ${t.surface};
|
|
4490
|
+
${CSS_VAR.surfaceMuted}: ${t.surfaceMuted};
|
|
4491
|
+
${CSS_VAR.line}: ${t.line};
|
|
4492
|
+
${CSS_VAR.text}: ${t.text};
|
|
4493
|
+
${CSS_VAR.textMuted}: ${t.textMuted};
|
|
4494
|
+
${CSS_VAR.textSubtle}: ${t.textSubtle};
|
|
4495
|
+
${CSS_VAR.action}: ${t.action};
|
|
4496
|
+
${CSS_VAR.actionText}: ${t.actionText};
|
|
4497
|
+
${CSS_VAR.accent}: ${t.accent};
|
|
4498
|
+
${CSS_VAR.overlay}: ${t.overlay};
|
|
4499
|
+
${CSS_VAR.focusRing}: ${t.focusRing};
|
|
4500
|
+
${CSS_VAR.radius}: ${theme.radius}px;
|
|
4501
|
+
color: var(${CSS_VAR.text});
|
|
4502
|
+
font-family: inherit;
|
|
4503
|
+
}
|
|
4504
|
+
.neofaceid-root :focus-visible {
|
|
4505
|
+
outline: 2px solid var(${CSS_VAR.focusRing});
|
|
4506
|
+
outline-offset: 2px;
|
|
4507
|
+
}`;
|
|
4508
|
+
}
|
|
4509
|
+
function injectScopedStyles$1(id, css) {
|
|
4510
|
+
if (typeof document === "undefined") return;
|
|
4511
|
+
const existing = document.getElementById(id);
|
|
4512
|
+
if (existing) {
|
|
4513
|
+
if (existing.textContent !== css) existing.textContent = css;
|
|
4514
|
+
return;
|
|
4515
|
+
}
|
|
4516
|
+
const style = document.createElement("style");
|
|
4517
|
+
style.id = id;
|
|
4518
|
+
style.textContent = css;
|
|
4519
|
+
document.head.appendChild(style);
|
|
4520
|
+
}
|
|
4345
4521
|
const __vite_import_meta_env__ = {};
|
|
4346
4522
|
const ENVIRONMENT_URLS = {
|
|
4347
4523
|
development: "http://localhost:8000",
|
|
4348
4524
|
sandbox: "https://sandbox-core.neofaceid.com",
|
|
4349
4525
|
production: "https://core.neofaceid.com.br"
|
|
4350
4526
|
};
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4527
|
+
const DEFAULT_LOCALE = "pt-BR";
|
|
4528
|
+
const DEFAULT_RADIUS = 16;
|
|
4529
|
+
const DEFAULT_THEME = "light";
|
|
4530
|
+
const ALLOWED_RADII = [8, 16, 24];
|
|
4531
|
+
function makeDefaultConfig() {
|
|
4532
|
+
return {
|
|
4533
|
+
baseUrl: ENVIRONMENT_URLS.sandbox,
|
|
4534
|
+
applicationToken: null,
|
|
4535
|
+
environment: "sandbox",
|
|
4536
|
+
initialized: false,
|
|
4537
|
+
appName: null,
|
|
4538
|
+
accent: null,
|
|
4539
|
+
radius: DEFAULT_RADIUS,
|
|
4540
|
+
theme: DEFAULT_THEME,
|
|
4541
|
+
locale: DEFAULT_LOCALE,
|
|
4542
|
+
resolvedTheme: null
|
|
4543
|
+
};
|
|
4544
|
+
}
|
|
4545
|
+
let globalConfig = makeDefaultConfig();
|
|
4358
4546
|
function init(options = {}) {
|
|
4359
|
-
const { environment, baseUrl, applicationToken } = options;
|
|
4547
|
+
const { environment, baseUrl, applicationToken, appName, accent, radius, theme, locale } = options;
|
|
4360
4548
|
if (baseUrl) {
|
|
4361
4549
|
globalConfig.baseUrl = baseUrl;
|
|
4362
4550
|
globalConfig.environment = "custom";
|
|
@@ -4383,9 +4571,40 @@ function init(options = {}) {
|
|
|
4383
4571
|
"[NeoFaceID SDK] applicationToken vazio em init() — 401 esperado em chamadas autenticadas."
|
|
4384
4572
|
);
|
|
4385
4573
|
}
|
|
4574
|
+
if (appName && appName.trim()) {
|
|
4575
|
+
globalConfig.appName = appName.trim();
|
|
4576
|
+
} else if (appName !== void 0) {
|
|
4577
|
+
console.warn(
|
|
4578
|
+
'[NeoFaceID SDK] init({ appName }) vazio — modais cairão para o fallback "sua aplicação".'
|
|
4579
|
+
);
|
|
4580
|
+
}
|
|
4581
|
+
if (radius !== void 0) {
|
|
4582
|
+
if (ALLOWED_RADII.includes(radius)) {
|
|
4583
|
+
globalConfig.radius = radius;
|
|
4584
|
+
} else {
|
|
4585
|
+
console.warn(
|
|
4586
|
+
`[NeoFaceID SDK] radius ${radius} inválido em init() — permitidos: 8, 16, 24. Usando 16.`
|
|
4587
|
+
);
|
|
4588
|
+
globalConfig.radius = DEFAULT_RADIUS;
|
|
4589
|
+
}
|
|
4590
|
+
}
|
|
4591
|
+
if (theme) globalConfig.theme = theme;
|
|
4592
|
+
if (locale) globalConfig.locale = locale;
|
|
4593
|
+
if (accent !== void 0) globalConfig.accent = accent;
|
|
4594
|
+
const resolved = resolveTheme({
|
|
4595
|
+
accent: globalConfig.accent ?? void 0,
|
|
4596
|
+
radius: globalConfig.radius,
|
|
4597
|
+
theme: globalConfig.theme
|
|
4598
|
+
});
|
|
4599
|
+
globalConfig.resolvedTheme = resolved;
|
|
4600
|
+
injectThemeStyles$1({
|
|
4601
|
+
accent: globalConfig.accent ?? void 0,
|
|
4602
|
+
radius: globalConfig.radius,
|
|
4603
|
+
theme: globalConfig.theme
|
|
4604
|
+
});
|
|
4386
4605
|
globalConfig.initialized = true;
|
|
4387
4606
|
console.log(
|
|
4388
|
-
`[NeoFaceID SDK] Inicializado
|
|
4607
|
+
`[NeoFaceID SDK] Inicializado — Ambiente: ${globalConfig.environment}, URL: ${globalConfig.baseUrl}, appName: ${globalConfig.appName ?? "(vazio)"}, theme: ${resolved.mode}, radius: ${globalConfig.radius}`
|
|
4389
4608
|
);
|
|
4390
4609
|
}
|
|
4391
4610
|
function getBaseUrl() {
|
|
@@ -4406,6 +4625,25 @@ function isInitialized() {
|
|
|
4406
4625
|
function getConfig() {
|
|
4407
4626
|
return { ...globalConfig };
|
|
4408
4627
|
}
|
|
4628
|
+
function getAppName() {
|
|
4629
|
+
return globalConfig.appName;
|
|
4630
|
+
}
|
|
4631
|
+
function getAccent() {
|
|
4632
|
+
return globalConfig.accent;
|
|
4633
|
+
}
|
|
4634
|
+
function getRadius() {
|
|
4635
|
+
return globalConfig.radius;
|
|
4636
|
+
}
|
|
4637
|
+
function getTheme() {
|
|
4638
|
+
return globalConfig.theme;
|
|
4639
|
+
}
|
|
4640
|
+
function getResolvedThemeMode() {
|
|
4641
|
+
var _a2;
|
|
4642
|
+
return ((_a2 = globalConfig.resolvedTheme) == null ? void 0 : _a2.mode) ?? (globalConfig.theme === "dark" ? "dark" : "light");
|
|
4643
|
+
}
|
|
4644
|
+
function getLocale() {
|
|
4645
|
+
return globalConfig.locale;
|
|
4646
|
+
}
|
|
4409
4647
|
const getApiBaseUrl = () => getBaseUrl();
|
|
4410
4648
|
const REQUEST_TIMEOUT = 1e4;
|
|
4411
4649
|
const ensureSecureContext = () => {
|
|
@@ -5966,182 +6204,6 @@ const api = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty(
|
|
|
5966
6204
|
validateToken,
|
|
5967
6205
|
videoToBase64
|
|
5968
6206
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5969
|
-
const BLUE = {
|
|
5970
|
-
400: "#00B0F8",
|
|
5971
|
-
500: "#0091F6",
|
|
5972
|
-
700: "#0059C4"
|
|
5973
|
-
};
|
|
5974
|
-
const GOLD = {
|
|
5975
|
-
500: "#F1BE00"
|
|
5976
|
-
};
|
|
5977
|
-
const INK = {
|
|
5978
|
-
25: "#F7F9FC",
|
|
5979
|
-
50: "#F1F5FA",
|
|
5980
|
-
100: "#E6ECF4",
|
|
5981
|
-
300: "#AFBDCE",
|
|
5982
|
-
400: "#8496AD",
|
|
5983
|
-
500: "#617489",
|
|
5984
|
-
600: "#48586B",
|
|
5985
|
-
800: "#1E2B3C",
|
|
5986
|
-
900: "#111C2B",
|
|
5987
|
-
950: "#0A1320"
|
|
5988
|
-
};
|
|
5989
|
-
const LIGHT_TOKENS = {
|
|
5990
|
-
ground: INK[25],
|
|
5991
|
-
surface: "#FFFFFF",
|
|
5992
|
-
surfaceMuted: INK[50],
|
|
5993
|
-
line: INK[100],
|
|
5994
|
-
text: INK[950],
|
|
5995
|
-
textMuted: INK[600],
|
|
5996
|
-
textSubtle: INK[500],
|
|
5997
|
-
action: BLUE[700],
|
|
5998
|
-
actionText: "#FFFFFF",
|
|
5999
|
-
accent: GOLD[500],
|
|
6000
|
-
overlay: "rgba(10,19,32,.55)",
|
|
6001
|
-
focusRing: BLUE[700]
|
|
6002
|
-
};
|
|
6003
|
-
const DARK_TOKENS = {
|
|
6004
|
-
ground: INK[950],
|
|
6005
|
-
surface: INK[900],
|
|
6006
|
-
surfaceMuted: INK[800],
|
|
6007
|
-
line: "#22334D",
|
|
6008
|
-
text: "#EEF3F9",
|
|
6009
|
-
textMuted: INK[300],
|
|
6010
|
-
textSubtle: INK[400],
|
|
6011
|
-
action: BLUE[500],
|
|
6012
|
-
actionText: "#FFFFFF",
|
|
6013
|
-
accent: GOLD[500],
|
|
6014
|
-
overlay: "rgba(10,19,32,.72)",
|
|
6015
|
-
focusRing: BLUE[400]
|
|
6016
|
-
};
|
|
6017
|
-
function contrastRatio(hexA, hexB) {
|
|
6018
|
-
const lumA = luminance(hexA);
|
|
6019
|
-
const lumB = luminance(hexB);
|
|
6020
|
-
const [hi, lo] = lumA > lumB ? [lumA, lumB] : [lumB, lumA];
|
|
6021
|
-
return (hi + 0.05) / (lo + 0.05);
|
|
6022
|
-
}
|
|
6023
|
-
function luminance(hex) {
|
|
6024
|
-
const [r, g, b] = parseHex(hex).map((v) => {
|
|
6025
|
-
const s = v / 255;
|
|
6026
|
-
return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
6027
|
-
});
|
|
6028
|
-
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
6029
|
-
}
|
|
6030
|
-
function parseHex(hex) {
|
|
6031
|
-
let h = hex.trim().replace("#", "");
|
|
6032
|
-
if (h.length === 3) h = h.split("").map((c) => c + c).join("");
|
|
6033
|
-
if (!/^[0-9a-fA-F]{6}$/.test(h)) return [0, 0, 0];
|
|
6034
|
-
return [
|
|
6035
|
-
parseInt(h.slice(0, 2), 16),
|
|
6036
|
-
parseInt(h.slice(2, 4), 16),
|
|
6037
|
-
parseInt(h.slice(4, 6), 16)
|
|
6038
|
-
];
|
|
6039
|
-
}
|
|
6040
|
-
const ALLOWED_RADIUS = [8, 16, 24];
|
|
6041
|
-
function resolveTheme(options = {}) {
|
|
6042
|
-
const mode = resolveMode(options.theme);
|
|
6043
|
-
const tokens = mode === "dark" ? { ...DARK_TOKENS } : { ...LIGHT_TOKENS };
|
|
6044
|
-
let radius = 16;
|
|
6045
|
-
if (options.radius !== void 0) {
|
|
6046
|
-
if (ALLOWED_RADIUS.includes(options.radius)) {
|
|
6047
|
-
radius = options.radius;
|
|
6048
|
-
} else {
|
|
6049
|
-
console.warn(
|
|
6050
|
-
`[NeoFaceID SDK] radius ${options.radius} inválido — permitidos: 8, 16, 24. Usando 16.`
|
|
6051
|
-
);
|
|
6052
|
-
}
|
|
6053
|
-
}
|
|
6054
|
-
let accent = tokens.action;
|
|
6055
|
-
let accentFellBack = false;
|
|
6056
|
-
if (options.accent) {
|
|
6057
|
-
const ratio = contrastRatio(options.accent, "#FFFFFF");
|
|
6058
|
-
if (ratio >= 4.5) {
|
|
6059
|
-
accent = options.accent;
|
|
6060
|
-
} else {
|
|
6061
|
-
accentFellBack = true;
|
|
6062
|
-
console.warn(
|
|
6063
|
-
`[NeoFaceID SDK] accent ${options.accent} reprova AA vs branco (${ratio.toFixed(2)}:1). Usando ${BLUE[700]}.`
|
|
6064
|
-
);
|
|
6065
|
-
accent = BLUE[700];
|
|
6066
|
-
}
|
|
6067
|
-
}
|
|
6068
|
-
return { mode, tokens: { ...tokens, action: accent }, radius, accent, accentFellBack };
|
|
6069
|
-
}
|
|
6070
|
-
function resolveMode(theme) {
|
|
6071
|
-
if (theme === "dark") return "dark";
|
|
6072
|
-
if (theme === "light") return "light";
|
|
6073
|
-
if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
|
|
6074
|
-
if (window.matchMedia("(prefers-color-scheme: dark)").matches) return "dark";
|
|
6075
|
-
}
|
|
6076
|
-
return "light";
|
|
6077
|
-
}
|
|
6078
|
-
const CSS_VAR = {
|
|
6079
|
-
ground: "--nfid-ground",
|
|
6080
|
-
surface: "--nfid-surface",
|
|
6081
|
-
surfaceMuted: "--nfid-surface-muted",
|
|
6082
|
-
line: "--nfid-line",
|
|
6083
|
-
text: "--nfid-text",
|
|
6084
|
-
textMuted: "--nfid-text-muted",
|
|
6085
|
-
textSubtle: "--nfid-text-subtle",
|
|
6086
|
-
action: "--nfid-action",
|
|
6087
|
-
actionText: "--nfid-action-text",
|
|
6088
|
-
accent: "--nfid-accent",
|
|
6089
|
-
overlay: "--nfid-overlay",
|
|
6090
|
-
focusRing: "--nfid-focus-ring",
|
|
6091
|
-
radius: "--nfid-radius"
|
|
6092
|
-
};
|
|
6093
|
-
const INJECTED_STYLE_ID = "neofaceid-focus-frame-tokens";
|
|
6094
|
-
function injectThemeStyles$1(options = {}) {
|
|
6095
|
-
const resolved = resolveTheme(options);
|
|
6096
|
-
if (typeof document === "undefined") return resolved;
|
|
6097
|
-
const css = buildRootCss(resolved);
|
|
6098
|
-
const existing = document.getElementById(INJECTED_STYLE_ID);
|
|
6099
|
-
if (existing) {
|
|
6100
|
-
if (existing.textContent !== css) existing.textContent = css;
|
|
6101
|
-
return resolved;
|
|
6102
|
-
}
|
|
6103
|
-
const style = document.createElement("style");
|
|
6104
|
-
style.id = INJECTED_STYLE_ID;
|
|
6105
|
-
style.textContent = css;
|
|
6106
|
-
document.head.appendChild(style);
|
|
6107
|
-
return resolved;
|
|
6108
|
-
}
|
|
6109
|
-
function buildRootCss(theme) {
|
|
6110
|
-
const t = theme.tokens;
|
|
6111
|
-
return `.neofaceid-root {
|
|
6112
|
-
${CSS_VAR.ground}: ${t.ground};
|
|
6113
|
-
${CSS_VAR.surface}: ${t.surface};
|
|
6114
|
-
${CSS_VAR.surfaceMuted}: ${t.surfaceMuted};
|
|
6115
|
-
${CSS_VAR.line}: ${t.line};
|
|
6116
|
-
${CSS_VAR.text}: ${t.text};
|
|
6117
|
-
${CSS_VAR.textMuted}: ${t.textMuted};
|
|
6118
|
-
${CSS_VAR.textSubtle}: ${t.textSubtle};
|
|
6119
|
-
${CSS_VAR.action}: ${t.action};
|
|
6120
|
-
${CSS_VAR.actionText}: ${t.actionText};
|
|
6121
|
-
${CSS_VAR.accent}: ${t.accent};
|
|
6122
|
-
${CSS_VAR.overlay}: ${t.overlay};
|
|
6123
|
-
${CSS_VAR.focusRing}: ${t.focusRing};
|
|
6124
|
-
${CSS_VAR.radius}: ${theme.radius}px;
|
|
6125
|
-
color: var(${CSS_VAR.text});
|
|
6126
|
-
font-family: inherit;
|
|
6127
|
-
}
|
|
6128
|
-
.neofaceid-root :focus-visible {
|
|
6129
|
-
outline: 2px solid var(${CSS_VAR.focusRing});
|
|
6130
|
-
outline-offset: 2px;
|
|
6131
|
-
}`;
|
|
6132
|
-
}
|
|
6133
|
-
function injectScopedStyles$1(id, css) {
|
|
6134
|
-
if (typeof document === "undefined") return;
|
|
6135
|
-
const existing = document.getElementById(id);
|
|
6136
|
-
if (existing) {
|
|
6137
|
-
if (existing.textContent !== css) existing.textContent = css;
|
|
6138
|
-
return;
|
|
6139
|
-
}
|
|
6140
|
-
const style = document.createElement("style");
|
|
6141
|
-
style.id = id;
|
|
6142
|
-
style.textContent = css;
|
|
6143
|
-
document.head.appendChild(style);
|
|
6144
|
-
}
|
|
6145
6207
|
const modalReducer$1 = (state, action) => {
|
|
6146
6208
|
switch (action.type) {
|
|
6147
6209
|
case "PERMISSION_GRANTED":
|
|
@@ -8668,10 +8730,11 @@ class ConsentModal {
|
|
|
8668
8730
|
}
|
|
8669
8731
|
const DEFAULT_APP_NAME = "sua aplicação";
|
|
8670
8732
|
function requestConsent(info = {}) {
|
|
8671
|
-
const
|
|
8672
|
-
|
|
8733
|
+
const globalAppName = getAppName();
|
|
8734
|
+
const appName = info.appName ?? globalAppName ?? DEFAULT_APP_NAME;
|
|
8735
|
+
if (!info.appName && !globalAppName) {
|
|
8673
8736
|
console.warn(
|
|
8674
|
-
'[NeoFaceID SDK] requestConsent
|
|
8737
|
+
'[NeoFaceID SDK] requestConsent sem appName — usando fallback "sua aplicação". Passe via NeoFaceSDK.init({ appName }) ou opts do caller.'
|
|
8675
8738
|
);
|
|
8676
8739
|
}
|
|
8677
8740
|
const flow = info.flow ?? "verification";
|
|
@@ -10808,7 +10871,7 @@ const biometricDetection = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.
|
|
|
10808
10871
|
initializeBiometricDetection,
|
|
10809
10872
|
isAdvancedDetectionAvailable
|
|
10810
10873
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
10811
|
-
const VERSION = "1.
|
|
10874
|
+
const VERSION = "1.30.0";
|
|
10812
10875
|
const RELEASE_DATE = "2026-09-02";
|
|
10813
10876
|
let cachedSession = null;
|
|
10814
10877
|
function getCachedCaptureSession() {
|
|
@@ -12931,11 +12994,17 @@ export {
|
|
|
12931
12994
|
completeOnboardingWithData,
|
|
12932
12995
|
confirmPasswordReset,
|
|
12933
12996
|
detectBiometricType,
|
|
12997
|
+
getAccent,
|
|
12998
|
+
getAppName,
|
|
12934
12999
|
getApplicationToken,
|
|
12935
13000
|
getBaseUrl,
|
|
12936
13001
|
getCachedCaptureSession,
|
|
12937
13002
|
getConfig,
|
|
12938
13003
|
getEnvironment,
|
|
13004
|
+
getLocale,
|
|
13005
|
+
getRadius,
|
|
13006
|
+
getResolvedThemeMode,
|
|
13007
|
+
getTheme,
|
|
12939
13008
|
identifyPerson,
|
|
12940
13009
|
identifyPersonAsync,
|
|
12941
13010
|
init,
|