@neofaceid/web-sdk 1.42.3 → 1.43.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 CHANGED
@@ -1372,6 +1372,12 @@ export declare interface ProofOfLifeResult {
1372
1372
  * `denied` e `expired` são desfechos, não exceções — quem chama precisa
1373
1373
  * distinguir os dois para dirigir a cascata de fallback: expirar pode cair
1374
1374
  * para senha, recusar **não pode**.
1375
+ *
1376
+ * `cancelled` carrega `source` pelo mesmo motivo: a pessoa fechar o modal no
1377
+ * navegador e a solicitação ser cancelada do outro lado são situações
1378
+ * diferentes, e dizer "você cancelou" para quem não cancelou é afirmar algo
1379
+ * falso. É o colapso que o core pediu para evitar entre `denied` e `expired`,
1380
+ * um nível abaixo.
1375
1381
  */
1376
1382
  export declare type PushApprovalOutcome = {
1377
1383
  status: 'approved';
@@ -1383,6 +1389,8 @@ export declare type PushApprovalOutcome = {
1383
1389
  status: 'expired';
1384
1390
  } | {
1385
1391
  status: 'cancelled';
1392
+ source: 'user' | 'server';
1393
+ reason?: string;
1386
1394
  };
1387
1395
 
1388
1396
  declare interface RecognitionResult {
@@ -1595,7 +1603,7 @@ export declare const registerPersonWithoutFace: (personData: {
1595
1603
  /**
1596
1604
  * Data de lançamento da versão atual
1597
1605
  */
1598
- export declare const RELEASE_DATE = "2026-09-14";
1606
+ export declare const RELEASE_DATE = "2026-09-15";
1599
1607
 
1600
1608
  declare interface RequestChallengeWithSessionParams {
1601
1609
  applicationToken: string;
@@ -2032,7 +2040,7 @@ export declare const validateToken: (applicationToken: string) => Promise<boolea
2032
2040
  * MINOR: Incrementado quando adicionamos funcionalidades mantendo compatibilidade
2033
2041
  * PATCH: Incrementado quando corrigimos bugs mantendo compatibilidade
2034
2042
  */
2035
- export declare const VERSION = "1.42.3";
2043
+ export declare const VERSION = "1.43.0";
2036
2044
 
2037
2045
  /**
2038
2046
  * Executa `fn(sessionId)`. Se o servidor devolver 410 (sessão consumida/expirada),
@@ -8886,8 +8886,8 @@ function BiometricRegistrationModal({
8886
8886
  /* @__PURE__ */ jsx("canvas", { ref: canvasRef })
8887
8887
  ] });
8888
8888
  }
8889
- const VERSION = "1.42.3";
8890
- const RELEASE_DATE = "2026-09-14";
8889
+ const VERSION = "1.43.0";
8890
+ const RELEASE_DATE = "2026-09-15";
8891
8891
  const CONSENT_TRAIL_STORAGE_KEY = "neoface_consent_trail_v1";
8892
8892
  const CONSENT_TRAIL_MAX_LIMIT = 100;
8893
8893
  async function hashString(inputStr) {
@@ -9744,6 +9744,48 @@ function PushExpiredView({ onFallback, onCancel }) {
9744
9744
  /* @__PURE__ */ jsx("div", { className: "nfid-push-footer", children: /* @__PURE__ */ jsx(BrandFooter, {}) })
9745
9745
  ] });
9746
9746
  }
9747
+ function PushCancelledView({
9748
+ appName,
9749
+ onFallback,
9750
+ onCancel
9751
+ }) {
9752
+ useEffect(() => {
9753
+ injectThemeStyles();
9754
+ injectScopedStyles(STYLE_ID$2, CSS$1);
9755
+ }, []);
9756
+ return /* @__PURE__ */ jsxs("div", { className: "nfid-push", role: "alert", "aria-live": "assertive", children: [
9757
+ /* @__PURE__ */ jsxs(
9758
+ "svg",
9759
+ {
9760
+ className: "nfid-push-phone-icon",
9761
+ viewBox: "0 0 24 24",
9762
+ fill: "none",
9763
+ stroke: "currentColor",
9764
+ strokeWidth: "1.75",
9765
+ strokeLinecap: "round",
9766
+ strokeLinejoin: "round",
9767
+ "aria-hidden": "true",
9768
+ style: { color: "var(--nfid-text-muted)" },
9769
+ children: [
9770
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
9771
+ /* @__PURE__ */ jsx("path", { d: "M8 12h8" })
9772
+ ]
9773
+ }
9774
+ ),
9775
+ /* @__PURE__ */ jsx("h2", { children: "Solicitação cancelada" }),
9776
+ /* @__PURE__ */ jsxs("p", { children: [
9777
+ "O pedido de confirmação foi cancelado antes de ser respondido. Você pode tentar de novo pelo",
9778
+ " ",
9779
+ appName,
9780
+ "."
9781
+ ] }),
9782
+ /* @__PURE__ */ jsx("div", { className: "nfid-push-actions", children: onFallback ? /* @__PURE__ */ jsxs(Fragment, { children: [
9783
+ /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: onFallback, children: "Entrar de outro jeito" }),
9784
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: onCancel, children: "Agora não" })
9785
+ ] }) : /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: onCancel, children: "Entendi" }) }),
9786
+ /* @__PURE__ */ jsx("div", { className: "nfid-push-footer", children: /* @__PURE__ */ jsx(BrandFooter, {}) })
9787
+ ] });
9788
+ }
9747
9789
  function PushDeniedView({ appName, onCancel }) {
9748
9790
  useEffect(() => {
9749
9791
  injectThemeStyles();
@@ -9780,7 +9822,7 @@ function PushDeniedView({ appName, onCancel }) {
9780
9822
  }
9781
9823
  const CONTAINER_ID = "neofaceid-push-approval-container";
9782
9824
  function classifyAuthorizationFrame(frame) {
9783
- var _a2, _b;
9825
+ var _a2, _b, _c;
9784
9826
  switch (frame.status) {
9785
9827
  case "approved":
9786
9828
  case "success":
@@ -9792,12 +9834,26 @@ function classifyAuthorizationFrame(frame) {
9792
9834
  };
9793
9835
  case "expired":
9794
9836
  return { kind: "resolve", value: { status: "expired" } };
9837
+ // Quinto terminal do core: a origem desistiu, ou o Push cancelou a
9838
+ // solicitação. Não é traduzido para `expired` de propósito — o prazo não
9839
+ // estourou, alguém decidiu parar, e a tela precisa dizer coisas diferentes
9840
+ // nos dois casos. Sem este ramo o frame cairia em `pending` e o fluxo
9841
+ // morreria no tempo limite.
9842
+ case "cancelled":
9843
+ return {
9844
+ kind: "resolve",
9845
+ value: {
9846
+ status: "cancelled",
9847
+ source: "server",
9848
+ reason: ((_b = frame.data) == null ? void 0 : _b.reason) ?? frame.message
9849
+ }
9850
+ };
9795
9851
  case "failed":
9796
9852
  case "error":
9797
9853
  return {
9798
9854
  kind: "reject",
9799
9855
  error: new NeoFaceError(
9800
- frame.message ?? ((_b = frame.data) == null ? void 0 : _b.message) ?? "Falha na confirmação",
9856
+ frame.message ?? ((_c = frame.data) == null ? void 0 : _c.message) ?? "Falha na confirmação",
9801
9857
  ErrorType.API_ERROR
9802
9858
  )
9803
9859
  };
@@ -9864,6 +9920,10 @@ function PushApprovalModal({
9864
9920
  setPhase({ kind: "expired" });
9865
9921
  return;
9866
9922
  }
9923
+ if (outcome.status === "cancelled") {
9924
+ setPhase({ kind: "cancelled", reason: outcome.reason });
9925
+ return;
9926
+ }
9867
9927
  onSettle(outcome);
9868
9928
  }).catch(() => {
9869
9929
  if (done || controller.signal.aborted) return;
@@ -9878,6 +9938,19 @@ function PushApprovalModal({
9878
9938
  if (phase.kind === "denied") {
9879
9939
  return /* @__PURE__ */ jsx(Sheet, { open: true, dismissOnOverlay: false, ariaLabel: "Confirmação recusada", children: /* @__PURE__ */ jsx(PushDeniedView, { appName: headerAppName, onCancel: () => onSettle({ status: "denied" }) }) });
9880
9940
  }
9941
+ if (phase.kind === "cancelled") {
9942
+ return /* @__PURE__ */ jsx(Sheet, { open: true, dismissOnOverlay: false, ariaLabel: "Solicitação cancelada", children: /* @__PURE__ */ jsx(
9943
+ PushCancelledView,
9944
+ {
9945
+ appName: headerAppName,
9946
+ onFallback: onFallback ? () => {
9947
+ onFallback();
9948
+ onSettle({ status: "cancelled", source: "server", reason: phase.reason });
9949
+ } : void 0,
9950
+ onCancel: () => onSettle({ status: "cancelled", source: "server", reason: phase.reason })
9951
+ }
9952
+ ) });
9953
+ }
9881
9954
  if (phase.kind === "expired") {
9882
9955
  return /* @__PURE__ */ jsx(Sheet, { open: true, dismissOnOverlay: false, ariaLabel: "Tempo esgotado", children: /* @__PURE__ */ jsx(
9883
9956
  PushExpiredView,
@@ -9896,7 +9969,7 @@ function PushApprovalModal({
9896
9969
  appName: headerAppName,
9897
9970
  numericCode,
9898
9971
  remainingSeconds: remaining,
9899
- onCancel: () => onSettle({ status: "cancelled" })
9972
+ onCancel: () => onSettle({ status: "cancelled", source: "user" })
9900
9973
  }
9901
9974
  ) });
9902
9975
  }