@archbase/security 4.3.0 → 4.3.1

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.
Binary file
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import "reflect-metadata";
2
2
  import * as I from "inversify";
3
3
  import { decorate as Bt, injectable as Lt } from "inversify";
4
- import { compressString as Ot, decompressString as zt, IOCContainer as jt, ARCHBASE_IOC_API_TYPE as Y, processErrorMessage as oe, IsNotEmpty as Q, IsOptional as ae, IsBoolean as re, IsEmail as Ft, getKeyByEnumValue as Qe, useArchbasePasswordRemember as Ht, getI18nextInstance as x, useArchbaseTheme as Vt, resolveArchbasePasswordPolicy as Wt, isEmailValidate as Gt, validateArchbasePassword as Jt, useArchbaseAppContext as Kt } from "@archbase/core";
4
+ import { compressString as Ot, decompressString as zt, IOCContainer as jt, ARCHBASE_IOC_API_TYPE as Y, processErrorMessage as ie, IsNotEmpty as Q, IsOptional as Z, IsBoolean as se, IsEmail as Ft, getKeyByEnumValue as Qe, useArchbasePasswordRemember as Ht, getI18nextInstance as S, useArchbaseTheme as Vt, resolveArchbasePasswordPolicy as Wt, isEmailValidate as Gt, validateArchbasePassword as Jt, useArchbaseAppContext as Kt } from "@archbase/core";
5
5
  import q from "crypto-js";
6
6
  import { jwtDecode as qt } from "jwt-decode";
7
- import { jsx as o, jsxs as C, Fragment as ie } from "react/jsx-runtime";
7
+ import { jsx as o, jsxs as C, Fragment as ae } from "react/jsx-runtime";
8
8
  import it, { useState as p, useEffect as X, createContext as He, useMemo as at, useRef as ct, useCallback as Ie, useContext as Ve } from "react";
9
9
  import { BehaviorSubject as Ze } from "rxjs";
10
10
  import { ArchbaseRemoteApiService as ge, useArchbaseStore as lt } from "@archbase/data";
11
- import { v4 as Z } from "uuid";
12
- import { Card as We, Text as j, Divider as Ue, Stack as Ee, TextInput as xe, Button as G, Anchor as et, Group as ue, Select as Yt, Tooltip as Xt, Loader as dt, PasswordInput as ze, Checkbox as Qt, Alert as tt, Code as rt, CopyButton as st, SimpleGrid as Zt, useMantineColorScheme as er, Box as tr, Skeleton as Ce } from "@mantine/core";
11
+ import { v4 as ee } from "uuid";
12
+ import { Card as We, Text as F, Divider as Ue, Stack as Ee, TextInput as xe, Button as G, Anchor as et, Group as ue, Select as Yt, Tooltip as Xt, Loader as dt, PasswordInput as ze, Checkbox as Qt, Alert as tt, Code as rt, CopyButton as st, SimpleGrid as Zt, useMantineColorScheme as er, Box as tr, Skeleton as Ce } from "@mantine/core";
13
13
  import { useFocusTrap as ut } from "@mantine/hooks";
14
14
  import { IconCopy as rr } from "@tabler/icons-react";
15
15
  import { ArchbaseQRCode as sr, ArchbasePasswordStrengthMeter as nr, ArchbaseDialog as nt } from "@archbase/components";
@@ -395,7 +395,7 @@ const Te = (r) => {
395
395
  "ROCP_loginInProgress",
396
396
  !1,
397
397
  t.storage
398
- ), [E, P] = de(
398
+ ), [x, P] = de(
399
399
  "ROCP_refreshInProgress",
400
400
  !1,
401
401
  t.storage
@@ -433,18 +433,18 @@ const Te = (r) => {
433
433
  console.warn(`Falha ao decodificar o token de acesso: ${W.message}`);
434
434
  }
435
435
  }
436
- function ee(g = !1) {
436
+ function te(g = !1) {
437
437
  return g || !t.onRefreshTokenExpire ? N() : t.onRefreshTokenExpire({ login: N });
438
438
  }
439
- function te(g = !1) {
440
- if (i && ot(y) && !(E && !g)) {
439
+ function re(g = !1) {
440
+ if (i && ot(y) && !(x && !g)) {
441
441
  if (ot(a))
442
- return ee(g);
442
+ return te(g);
443
443
  if (s) {
444
444
  P(!0), pr({ config: t, refreshToken: s }).then((v) => T(v)).catch((v) => {
445
445
  if (v instanceof mt) {
446
446
  if (v.status === 400)
447
- return ee(g);
447
+ return te(g);
448
448
  console.error(v), m(v.message), g && N();
449
449
  } else
450
450
  v instanceof Error && (console.error(v), m(v.message), g && N());
@@ -458,8 +458,8 @@ const Te = (r) => {
458
458
  );
459
459
  }
460
460
  }
461
- X(() => (R = setInterval(() => te(), 1e4), () => clearInterval(R)), [i, s, a, y]);
462
- const se = ct(!1);
461
+ X(() => (R = setInterval(() => re(), 1e4), () => clearInterval(R)), [i, s, a, y]);
462
+ const ne = ct(!1);
463
463
  return X(() => {
464
464
  if (A) {
465
465
  const g = new URLSearchParams(window.location.search);
@@ -468,8 +468,8 @@ const Te = (r) => {
468
468
  console.error(v), m(v), L();
469
469
  return;
470
470
  }
471
- if (!se.current) {
472
- se.current = !0;
471
+ if (!ne.current) {
472
+ ne.current = !0;
473
473
  try {
474
474
  mr(g);
475
475
  } catch (v) {
@@ -497,7 +497,7 @@ const Te = (r) => {
497
497
  } catch (g) {
498
498
  console.warn(`Falha ao decodificar o token de acesso: ${g.message}`);
499
499
  }
500
- te(!0);
500
+ re(!0);
501
501
  }, []), /* @__PURE__ */ o(
502
502
  br.Provider,
503
503
  {
@@ -524,7 +524,7 @@ class vt {
524
524
  this.alreadyApplied || (this.alreadyApplied = !0, this.resourceService.registerResource({ resource: this.resource, actions: this.actions }).then((t) => {
525
525
  this.permissions = t.permissions, this.error = "", e && e();
526
526
  }).catch((t) => {
527
- this.alreadyApplied = !1, this.error = oe(t);
527
+ this.alreadyApplied = !1, this.error = ie(t);
528
528
  }));
529
529
  }
530
530
  hasPermission(e) {
@@ -632,7 +632,7 @@ class J {
632
632
  function Jr() {
633
633
  return J.getInstance();
634
634
  }
635
- var me = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(me || {}), Ar = Object.defineProperty, S = (r, e, t, s) => {
635
+ var me = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(me || {}), Ar = Object.defineProperty, E = (r, e, t, s) => {
636
636
  for (var n = void 0, a = r.length - 1, c; a >= 0; a--)
637
637
  (c = r[a]) && (n = c(e, t, n) || n);
638
638
  return n && Ar(e, t, n), n;
@@ -651,11 +651,11 @@ const wt = class bt {
651
651
  this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.description = e.description || "", this.intervals = e.intervals ? e.intervals.map((t) => new xr(t)) : [];
652
652
  }
653
653
  static newInstance = () => new bt({
654
- id: Z(),
654
+ id: ee(),
655
655
  intervals: []
656
656
  });
657
657
  };
658
- S([
658
+ E([
659
659
  Q({
660
660
  message: "archbase:Informe a descrição do cronograma de acesso"
661
661
  })
@@ -677,21 +677,21 @@ const _e = class Et {
677
677
  this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.accessSchedule = e.accessSchedule ? new At(e.accessSchedule) : void 0, this.dayOfWeek = e.dayOfWeek || 0, this.startTime = e.startTime || "", this.endTime = e.endTime || "";
678
678
  }
679
679
  static newInstance = () => new Et({
680
- id: Z(),
680
+ id: ee(),
681
681
  dayOfWeek: (/* @__PURE__ */ new Date()).getDay(),
682
682
  startTime: "08:00",
683
683
  endTime: "17:00"
684
684
  });
685
685
  };
686
- S([
687
- ae()
686
+ E([
687
+ Z()
688
688
  ], _e.prototype, "accessSchedule");
689
- S([
689
+ E([
690
690
  Q({
691
691
  message: "archbase:Informe a hora de início"
692
692
  })
693
693
  ], _e.prototype, "startTime");
694
- S([
694
+ E([
695
695
  Q({
696
696
  message: "archbase:Informe a hora de término"
697
697
  })
@@ -712,18 +712,18 @@ class ye {
712
712
  this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.actions = e.actions || [];
713
713
  }
714
714
  }
715
- S([
715
+ E([
716
716
  Q({
717
717
  message: "archbase:Informe o nome"
718
718
  })
719
719
  ], ye.prototype, "name");
720
- S([
720
+ E([
721
721
  Q({
722
722
  message: "archbase:Informe a descrição"
723
723
  })
724
724
  ], ye.prototype, "description");
725
- S([
726
- ae()
725
+ E([
726
+ Z()
727
727
  ], ye.prototype, "actions");
728
728
  const ve = class xt {
729
729
  id;
@@ -744,31 +744,31 @@ const ve = class xt {
744
744
  this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.resource = e.resource ? new kt(e.resource) : void 0, this.category = e.category || "", this.active = e.active || !1, this.actionVersion = e.actionVersion || "", this.isNewAction = e.isNewAction || !1;
745
745
  }
746
746
  static newInstance = () => new xt({
747
- id: Z(),
747
+ id: ee(),
748
748
  active: !0,
749
749
  isNewAction: !0
750
750
  });
751
751
  };
752
- S([
752
+ E([
753
753
  Q({
754
754
  message: "archbase:Informe o nome para a ação"
755
755
  })
756
756
  ], ve.prototype, "name");
757
- S([
757
+ E([
758
758
  Q({
759
759
  message: "archbase:Informe a descrição para a ação"
760
760
  })
761
761
  ], ve.prototype, "description");
762
- S([
763
- ae()
762
+ E([
763
+ Z()
764
764
  ], ve.prototype, "resource");
765
- S([
765
+ E([
766
766
  Q({
767
767
  message: "archbase:Informe a categoria para a ação"
768
768
  })
769
769
  ], ve.prototype, "category");
770
- S([
771
- re()
770
+ E([
771
+ se()
772
772
  ], ve.prototype, "active");
773
773
  let Sr = ve;
774
774
  class Se extends ye {
@@ -778,7 +778,7 @@ class Se extends ye {
778
778
  super(e), this.type = me.PROFILE, this.isNewProfile = e.isNewProfile || !1;
779
779
  }
780
780
  static newInstance = () => new Se({
781
- id: Z(),
781
+ id: ee(),
782
782
  isNewProfile: !0
783
783
  });
784
784
  }
@@ -795,7 +795,7 @@ class Ge {
795
795
  this.id = e.id, this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.group = e.group ? new ke(e.group) : void 0;
796
796
  }
797
797
  static newInstance = (e) => new Ge({
798
- id: Z(),
798
+ id: ee(),
799
799
  group: e
800
800
  });
801
801
  }
@@ -806,7 +806,7 @@ class ke extends ye {
806
806
  super(e), this.type = me.GROUP, this.isNewGroup = e.isNewGroup || !1;
807
807
  }
808
808
  static newInstance = () => new ke({
809
- id: Z(),
809
+ id: ee(),
810
810
  isNewGroup: !0
811
811
  });
812
812
  }
@@ -828,27 +828,27 @@ const Re = class St {
828
828
  this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.actions = e.actions || [], this.active = e.active || !1, this.type = e.type || "VIEW", this.isNewResource = e.isNewResource || !1;
829
829
  }
830
830
  static newInstance = () => new St({
831
- id: Z(),
831
+ id: ee(),
832
832
  actions: [],
833
833
  active: !0,
834
834
  isNewResource: !0
835
835
  });
836
836
  };
837
- S([
837
+ E([
838
838
  Q({
839
839
  message: "archbase:Informe o nome para o recurso"
840
840
  })
841
841
  ], Re.prototype, "name");
842
- S([
842
+ E([
843
843
  Q({
844
844
  message: "archbase:Informe a descrição para o recurso"
845
845
  })
846
846
  ], Re.prototype, "description");
847
- S([
848
- re()
847
+ E([
848
+ se()
849
849
  ], Re.prototype, "active");
850
850
  let kt = Re;
851
- const F = class It extends ye {
851
+ const O = class It extends ye {
852
852
  userName;
853
853
  password;
854
854
  changePasswordOnNextLogin;
@@ -868,11 +868,13 @@ const F = class It extends ye {
868
868
  email;
869
869
  type;
870
870
  isNewUser;
871
+ employeeId;
872
+ externalId;
871
873
  constructor(e) {
872
- super(e), this.type = me.USER, this.userName = e.userName || "", this.password = e.password || "", this.changePasswordOnNextLogin = e.changePasswordOnNextLogin || !1, this.allowPasswordChange = e.allowPasswordChange || !1, this.allowMultipleLogins = e.allowMultipleLogins || !1, this.passwordNeverExpires = e.passwordNeverExpires || !1, this.passwordChangedAt = e.passwordChangedAt || void 0, this.accountDeactivated = e.accountDeactivated || !1, this.accountLocked = e.accountLocked || !1, this.unlimitedAccessHours = e.unlimitedAccessHours || !1, this.isAdministrator = e.isAdministrator || !1, this.accessSchedule = e.accessSchedule ? new At(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new Ge(t)) : [], this.profile = e.profile ? new Se(e.profile) : void 0, this.email = e.email || "", this.avatar = e.avatar || void 0, this.isNewUser = e.isNewUser || !1, this.nickname = e.nickname;
874
+ super(e), this.type = me.USER, this.userName = e.userName || "", this.password = e.password || "", this.changePasswordOnNextLogin = e.changePasswordOnNextLogin || !1, this.allowPasswordChange = e.allowPasswordChange || !1, this.allowMultipleLogins = e.allowMultipleLogins || !1, this.passwordNeverExpires = e.passwordNeverExpires || !1, this.passwordChangedAt = e.passwordChangedAt || void 0, this.accountDeactivated = e.accountDeactivated || !1, this.accountLocked = e.accountLocked || !1, this.unlimitedAccessHours = e.unlimitedAccessHours || !1, this.isAdministrator = e.isAdministrator || !1, this.accessSchedule = e.accessSchedule ? new At(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new Ge(t)) : [], this.profile = e.profile ? new Se(e.profile) : void 0, this.email = e.email || "", this.avatar = e.avatar || void 0, this.isNewUser = e.isNewUser || !1, this.nickname = e.nickname, this.employeeId = e.employeeId || void 0, this.externalId = e.externalId || void 0;
873
875
  }
874
876
  static newInstance = () => new It({
875
- id: Z(),
877
+ id: ee(),
876
878
  userName: "",
877
879
  password: "",
878
880
  groups: [],
@@ -883,56 +885,62 @@ const F = class It extends ye {
883
885
  isNewUser: !0
884
886
  });
885
887
  };
886
- S([
888
+ E([
887
889
  Q({
888
890
  message: "archbase:Informe o nome de usuário"
889
891
  })
890
- ], F.prototype, "userName");
891
- S([
892
- re()
893
- ], F.prototype, "changePasswordOnNextLogin");
894
- S([
895
- re()
896
- ], F.prototype, "allowPasswordChange");
897
- S([
898
- re()
899
- ], F.prototype, "allowMultipleLogins");
900
- S([
901
- re()
902
- ], F.prototype, "passwordNeverExpires");
903
- S([
904
- ae()
905
- ], F.prototype, "passwordChangedAt");
906
- S([
907
- re()
908
- ], F.prototype, "accountDeactivated");
909
- S([
910
- re()
911
- ], F.prototype, "accountLocked");
912
- S([
913
- re()
914
- ], F.prototype, "unlimitedAccessHours");
915
- S([
916
- re()
917
- ], F.prototype, "isAdministrator");
918
- S([
919
- ae()
920
- ], F.prototype, "accessSchedule");
921
- S([
922
- ae()
923
- ], F.prototype, "groups");
924
- S([
925
- ae()
926
- ], F.prototype, "profile");
927
- S([
892
+ ], O.prototype, "userName");
893
+ E([
894
+ se()
895
+ ], O.prototype, "changePasswordOnNextLogin");
896
+ E([
897
+ se()
898
+ ], O.prototype, "allowPasswordChange");
899
+ E([
900
+ se()
901
+ ], O.prototype, "allowMultipleLogins");
902
+ E([
903
+ se()
904
+ ], O.prototype, "passwordNeverExpires");
905
+ E([
906
+ Z()
907
+ ], O.prototype, "passwordChangedAt");
908
+ E([
909
+ se()
910
+ ], O.prototype, "accountDeactivated");
911
+ E([
912
+ se()
913
+ ], O.prototype, "accountLocked");
914
+ E([
915
+ se()
916
+ ], O.prototype, "unlimitedAccessHours");
917
+ E([
918
+ se()
919
+ ], O.prototype, "isAdministrator");
920
+ E([
921
+ Z()
922
+ ], O.prototype, "accessSchedule");
923
+ E([
924
+ Z()
925
+ ], O.prototype, "groups");
926
+ E([
927
+ Z()
928
+ ], O.prototype, "profile");
929
+ E([
928
930
  Ft(
929
931
  {},
930
932
  {
931
933
  message: "archbase:Informe um email válido"
932
934
  }
933
935
  )
934
- ], F.prototype, "email");
935
- let Me = F;
936
+ ], O.prototype, "email");
937
+ E([
938
+ Z()
939
+ ], O.prototype, "employeeId");
940
+ E([
941
+ Z()
942
+ ], O.prototype, "externalId");
943
+ let Me = O;
936
944
  const Je = class Fe {
937
945
  id;
938
946
  code;
@@ -962,17 +970,17 @@ const Je = class Fe {
962
970
  }
963
971
  }
964
972
  static newInstance = () => new Fe({
965
- id: Z(),
973
+ id: ee(),
966
974
  tenantId: "",
967
975
  companyId: "",
968
976
  projectId: ""
969
977
  });
970
978
  };
971
- S([
972
- ae()
979
+ E([
980
+ Z()
973
981
  ], Je.prototype, "security");
974
- S([
975
- ae()
982
+ E([
983
+ Z()
976
984
  ], Je.prototype, "action");
977
985
  let Kr = Je;
978
986
  class Ke {
@@ -996,7 +1004,7 @@ class Ke {
996
1004
  this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.tenantId = e.tenantId || "", this.user = e.user ? new Me(e.user) : void 0, this.name = e.name || "", this.description = e.description || "", this.token = e.token || "", this.expirationDate = e.expirationDate, this.revoked = e.revoked, this.activated = e.activated || !1;
997
1005
  }
998
1006
  static newInstance = () => new Ke({
999
- id: Z()
1007
+ id: ee()
1000
1008
  });
1001
1009
  }
1002
1010
  class qe {
@@ -1019,7 +1027,7 @@ class qe {
1019
1027
  this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.token = e.token || "", this.tokenType = e.tokenType || void 0, this.user = e.user ? new Me(e.user) : void 0, this.revoked = e.revoked || !1, this.expired = e.expired || !1, this.expirationTime = e.expirationTime || 0, this.expirationDate = e.expirationDate || "", this.isNewAccessToken = e.isNewAccessToken || !1;
1020
1028
  }
1021
1029
  static newInstance = () => new qe({
1022
- id: Z(),
1030
+ id: ee(),
1023
1031
  active: !0,
1024
1032
  isNewAccessToken: !0
1025
1033
  });
@@ -1363,7 +1371,7 @@ function qr({
1363
1371
  isCheckingUsername: U = !1,
1364
1372
  showSignIn: A = !0,
1365
1373
  mfaRequired: w = !1,
1366
- onVerifyMfa: E,
1374
+ onVerifyMfa: x,
1367
1375
  mfaError: P,
1368
1376
  onCancelMfa: M,
1369
1377
  isVerifyingMfa: B = !1
@@ -1373,28 +1381,28 @@ function qr({
1373
1381
  password: b,
1374
1382
  rememberMe: m,
1375
1383
  clearRememberMe: R
1376
- } = Ht(), [V, L] = p(_), [N, T] = p(b), [ee, te] = p(m), [se, g] = p(!1), [v, K] = p(null), [W, we] = p("");
1384
+ } = Ht(), [V, L] = p(_), [N, T] = p(b), [te, re] = p(m), [ne, g] = p(!1), [v, K] = p(null), [W, we] = p("");
1377
1385
  X(() => {
1378
1386
  g(!!e);
1379
1387
  }, [e]), X(() => {
1380
- _ !== V && (L(_), k?.(_)), b !== N && T(b), m !== ee && te(m);
1388
+ _ !== V && (L(_), k?.(_)), b !== N && T(b), m !== te && re(m);
1381
1389
  }, [_, b, m]);
1382
1390
  const he = () => {
1383
1391
  g(!1);
1384
1392
  }, $ = () => {
1385
- V && N && r(V, N, ee).finally(() => g(!0));
1393
+ V && N && r(V, N, te).finally(() => g(!0));
1386
1394
  }, ce = () => {
1387
1395
  const l = W.trim();
1388
- l && E && E(l);
1389
- }, ne = () => {
1396
+ l && x && x(l);
1397
+ }, oe = () => {
1390
1398
  if (!d)
1391
1399
  return i.map((f) => ({
1392
1400
  value: f.email,
1393
1401
  label: f.email
1394
1402
  }));
1395
1403
  const l = i.reduce((f, D) => {
1396
- const z = d[D.type];
1397
- return z && (f[z] || (f[z] = []), f[z].push({
1404
+ const j = d[D.type];
1405
+ return j && (f[j] || (f[j] = []), f[j].push({
1398
1406
  value: D.email,
1399
1407
  label: D.email
1400
1408
  })), f;
@@ -1424,16 +1432,16 @@ function qr({
1424
1432
  pos: "relative",
1425
1433
  ref: H,
1426
1434
  children: [
1427
- A && /* @__PURE__ */ C(ie, { children: [
1435
+ A && /* @__PURE__ */ C(ae, { children: [
1428
1436
  /* @__PURE__ */ o(
1429
- j,
1437
+ F,
1430
1438
  {
1431
1439
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1432
1440
  fw: 800,
1433
1441
  fz: { base: "20px", md: "35px" },
1434
1442
  style: { textAlign: "center", letterSpacing: "-1px" },
1435
1443
  mt: "xs",
1436
- children: x().t("archbase:signIn")
1444
+ children: S().t("archbase:signIn")
1437
1445
  }
1438
1446
  ),
1439
1447
  /* @__PURE__ */ o(Ue, { m: "md" })
@@ -1441,8 +1449,8 @@ function qr({
1441
1449
  y?.customContentBefore,
1442
1450
  w && /* @__PURE__ */ C(Ee, { gap: "md", children: [
1443
1451
  /* @__PURE__ */ C("div", { children: [
1444
- /* @__PURE__ */ o(j, { fw: 700, fz: "lg", children: x().t("archbase:mfa.title", "Verificação em duas etapas") }),
1445
- /* @__PURE__ */ o(j, { c: "dimmed", fz: "sm", children: x().t(
1452
+ /* @__PURE__ */ o(F, { fw: 700, fz: "lg", children: S().t("archbase:mfa.title", "Verificação em duas etapas") }),
1453
+ /* @__PURE__ */ o(F, { c: "dimmed", fz: "sm", children: S().t(
1446
1454
  "archbase:mfa.subtitle",
1447
1455
  "Digite o código do seu aplicativo autenticador (ou um código de recuperação)."
1448
1456
  ) })
@@ -1450,7 +1458,7 @@ function qr({
1450
1458
  /* @__PURE__ */ o(
1451
1459
  xe,
1452
1460
  {
1453
- label: x().t("archbase:mfa.code", "Código de verificação"),
1461
+ label: S().t("archbase:mfa.code", "Código de verificação"),
1454
1462
  placeholder: "000000",
1455
1463
  value: W,
1456
1464
  autoFocus: !0,
@@ -1460,7 +1468,7 @@ function qr({
1460
1468
  }
1461
1469
  }
1462
1470
  ),
1463
- P && /* @__PURE__ */ o(j, { c: "red", fz: "sm", children: P }),
1471
+ P && /* @__PURE__ */ o(F, { c: "red", fz: "sm", children: P }),
1464
1472
  /* @__PURE__ */ o(
1465
1473
  G,
1466
1474
  {
@@ -1468,7 +1476,7 @@ function qr({
1468
1476
  disabled: !W.trim() || B,
1469
1477
  loading: B,
1470
1478
  onClick: ce,
1471
- children: x().t("archbase:mfa.verify", "Verificar")
1479
+ children: S().t("archbase:mfa.verify", "Verificar")
1472
1480
  }
1473
1481
  ),
1474
1482
  M && /* @__PURE__ */ o(
@@ -1480,18 +1488,18 @@ function qr({
1480
1488
  ta: "center",
1481
1489
  styles: { root: { cursor: "pointer" } },
1482
1490
  onClick: M,
1483
- children: x().t("archbase:mfa.back", "Voltar ao login")
1491
+ children: S().t("archbase:mfa.back", "Voltar ao login")
1484
1492
  }
1485
1493
  )
1486
1494
  ] }),
1487
- !w && /* @__PURE__ */ C(ie, { children: [
1488
- c && /* @__PURE__ */ C(ie, { children: [
1495
+ !w && /* @__PURE__ */ C(ae, { children: [
1496
+ c && /* @__PURE__ */ C(ae, { children: [
1489
1497
  /* @__PURE__ */ C(ue, { gap: "sm", mb: "md", children: [
1490
1498
  /* @__PURE__ */ o(
1491
1499
  Yt,
1492
1500
  {
1493
1501
  placeholder: "Selecione um usuário mock",
1494
- data: ne(),
1502
+ data: oe(),
1495
1503
  value: v,
1496
1504
  onChange: (l) => K(l ?? ""),
1497
1505
  searchable: !0,
@@ -1517,7 +1525,7 @@ function qr({
1517
1525
  xe,
1518
1526
  {
1519
1527
  label: s,
1520
- placeholder: n ?? x().t("archbase:usuario@email.com"),
1528
+ placeholder: n ?? S().t("archbase:usuario@email.com"),
1521
1529
  rightSection: U ? /* @__PURE__ */ o(dt, { size: "xs" }) : null,
1522
1530
  value: V || "",
1523
1531
  required: !0,
@@ -1529,8 +1537,8 @@ function qr({
1529
1537
  /* @__PURE__ */ o(
1530
1538
  ze,
1531
1539
  {
1532
- label: x().t("archbase:Password"),
1533
- placeholder: x().t("archbase:Sua senha"),
1540
+ label: S().t("archbase:Password"),
1541
+ placeholder: S().t("archbase:Sua senha"),
1534
1542
  onChange: (l) => {
1535
1543
  T(l.currentTarget.value), he();
1536
1544
  },
@@ -1543,11 +1551,11 @@ function qr({
1543
1551
  /* @__PURE__ */ o(
1544
1552
  Qt,
1545
1553
  {
1546
- label: x().t("archbase:Lembre-me"),
1547
- checked: ee,
1554
+ label: S().t("archbase:Lembre-me"),
1555
+ checked: te,
1548
1556
  onChange: (l) => {
1549
1557
  const f = l.currentTarget.checked;
1550
- te(f), f || R();
1558
+ re(f), f || R();
1551
1559
  }
1552
1560
  }
1553
1561
  ),
@@ -1560,7 +1568,7 @@ function qr({
1560
1568
  lh: "20px",
1561
1569
  styles: { root: { cursor: "pointer" } },
1562
1570
  onClick: t,
1563
- children: x().t("archbase:Esqueci minha senha")
1571
+ children: S().t("archbase:Esqueci minha senha")
1564
1572
  }
1565
1573
  )
1566
1574
  ] }),
@@ -1572,17 +1580,17 @@ function qr({
1572
1580
  fullWidth: !0,
1573
1581
  mt: "xl",
1574
1582
  onClick: $,
1575
- children: x().t("archbase:signIn")
1583
+ children: S().t("archbase:signIn")
1576
1584
  }
1577
1585
  )
1578
1586
  ] }),
1579
1587
  y?.customContentAfter,
1580
- se && e && /* @__PURE__ */ o(j, { c: "red", mt: "sm", children: e })
1588
+ ne && e && /* @__PURE__ */ o(F, { c: "red", mt: "sm", children: e })
1581
1589
  ]
1582
1590
  }
1583
1591
  );
1584
1592
  }
1585
- const O = (r, e) => x().t(r, e);
1593
+ const z = (r, e) => S().t(r, e);
1586
1594
  function Yr({
1587
1595
  enabled: r,
1588
1596
  onSetup: e,
@@ -1590,7 +1598,7 @@ function Yr({
1590
1598
  onDisable: s,
1591
1599
  onStatusChange: n
1592
1600
  }) {
1593
- const [a, c] = p("idle"), [i, d] = p(null), [y, k] = p(""), [h, U] = p([]), [A, w] = p(!1), [E, P] = p(null), M = async () => {
1601
+ const [a, c] = p("idle"), [i, d] = p(null), [y, k] = p(""), [h, U] = p([]), [A, w] = p(!1), [x, P] = p(null), M = async () => {
1594
1602
  w(!0), P(null);
1595
1603
  try {
1596
1604
  const b = await e();
@@ -1627,34 +1635,34 @@ function Yr({
1627
1635
  };
1628
1636
  return /* @__PURE__ */ o(We, { withBorder: !0, radius: "md", p: "lg", children: /* @__PURE__ */ C(Ee, { gap: "md", children: [
1629
1637
  /* @__PURE__ */ C("div", { children: [
1630
- /* @__PURE__ */ o(j, { fw: 700, fz: "lg", children: O("archbase:mfa.setup.title", "Autenticação em duas etapas (MFA)") }),
1631
- /* @__PURE__ */ o(j, { c: "dimmed", fz: "sm", children: O(
1638
+ /* @__PURE__ */ o(F, { fw: 700, fz: "lg", children: z("archbase:mfa.setup.title", "Autenticação em duas etapas (MFA)") }),
1639
+ /* @__PURE__ */ o(F, { c: "dimmed", fz: "sm", children: z(
1632
1640
  "archbase:mfa.setup.subtitle",
1633
1641
  "Proteja o acesso exigindo um código do seu aplicativo autenticador no login."
1634
1642
  ) })
1635
1643
  ] }),
1636
- E && /* @__PURE__ */ o(tt, { color: "red", children: E }),
1644
+ x && /* @__PURE__ */ o(tt, { color: "red", children: x }),
1637
1645
  r && a === "idle" && /* @__PURE__ */ C(ue, { justify: "space-between", children: [
1638
- /* @__PURE__ */ o(j, { c: "teal", fw: 600, children: O("archbase:mfa.setup.active", "MFA ativo") }),
1639
- /* @__PURE__ */ o(G, { color: "red", variant: "light", loading: A, onClick: H, children: O("archbase:mfa.setup.disable", "Desativar") })
1646
+ /* @__PURE__ */ o(F, { c: "teal", fw: 600, children: z("archbase:mfa.setup.active", "MFA ativo") }),
1647
+ /* @__PURE__ */ o(G, { color: "red", variant: "light", loading: A, onClick: H, children: z("archbase:mfa.setup.disable", "Desativar") })
1640
1648
  ] }),
1641
- !r && a === "idle" && /* @__PURE__ */ o(G, { loading: A, onClick: M, children: O("archbase:mfa.setup.enable", "Ativar MFA") }),
1649
+ !r && a === "idle" && /* @__PURE__ */ o(G, { loading: A, onClick: M, children: z("archbase:mfa.setup.enable", "Ativar MFA") }),
1642
1650
  a === "setup" && i && /* @__PURE__ */ C(Ee, { gap: "sm", align: "center", children: [
1643
- /* @__PURE__ */ o(j, { fz: "sm", ta: "center", children: O(
1651
+ /* @__PURE__ */ o(F, { fz: "sm", ta: "center", children: z(
1644
1652
  "archbase:mfa.setup.scan",
1645
1653
  "Escaneie o QR Code no seu app autenticador (Google Authenticator, Authy…):"
1646
1654
  ) }),
1647
1655
  /* @__PURE__ */ o(sr, { value: i.provisioningUri, size: 180, level: "M" }),
1648
- /* @__PURE__ */ o(j, { fz: "xs", c: "dimmed", ta: "center", children: O("archbase:mfa.setup.manual", "Ou informe o código manualmente:") }),
1656
+ /* @__PURE__ */ o(F, { fz: "xs", c: "dimmed", ta: "center", children: z("archbase:mfa.setup.manual", "Ou informe o código manualmente:") }),
1649
1657
  /* @__PURE__ */ C(ue, { gap: "xs", children: [
1650
1658
  /* @__PURE__ */ o(rt, { children: i.secret }),
1651
- /* @__PURE__ */ o(st, { value: i.secret, children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { size: "xs", variant: "subtle", onClick: m, children: b ? O("archbase:mfa.setup.copied", "Copiado") : O("archbase:mfa.setup.copy", "Copiar") }) })
1659
+ /* @__PURE__ */ o(st, { value: i.secret, children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { size: "xs", variant: "subtle", onClick: m, children: b ? z("archbase:mfa.setup.copied", "Copiado") : z("archbase:mfa.setup.copy", "Copiar") }) })
1652
1660
  ] }),
1653
1661
  /* @__PURE__ */ o(
1654
1662
  xe,
1655
1663
  {
1656
1664
  w: "100%",
1657
- label: O("archbase:mfa.setup.confirmCode", "Digite o código gerado para confirmar"),
1665
+ label: z("archbase:mfa.setup.confirmCode", "Digite o código gerado para confirmar"),
1658
1666
  placeholder: "000000",
1659
1667
  value: y,
1660
1668
  onChange: (b) => k(b.currentTarget.value),
@@ -1664,20 +1672,20 @@ function Yr({
1664
1672
  }
1665
1673
  ),
1666
1674
  /* @__PURE__ */ C(ue, { w: "100%", justify: "flex-end", children: [
1667
- /* @__PURE__ */ o(G, { variant: "default", onClick: _, disabled: A, children: O("archbase:mfa.setup.cancel", "Cancelar") }),
1668
- /* @__PURE__ */ o(G, { onClick: B, loading: A, disabled: !y.trim(), children: O("archbase:mfa.setup.confirm", "Confirmar e ativar") })
1675
+ /* @__PURE__ */ o(G, { variant: "default", onClick: _, disabled: A, children: z("archbase:mfa.setup.cancel", "Cancelar") }),
1676
+ /* @__PURE__ */ o(G, { onClick: B, loading: A, disabled: !y.trim(), children: z("archbase:mfa.setup.confirm", "Confirmar e ativar") })
1669
1677
  ] })
1670
1678
  ] }),
1671
1679
  a === "recovery" && /* @__PURE__ */ C(Ee, { gap: "sm", children: [
1672
- /* @__PURE__ */ o(tt, { color: "yellow", children: O(
1680
+ /* @__PURE__ */ o(tt, { color: "yellow", children: z(
1673
1681
  "archbase:mfa.setup.recoveryWarning",
1674
1682
  "Guarde estes códigos de recuperação em local seguro. Cada um funciona uma única vez e permite entrar se você perder o acesso ao app autenticador. Eles não serão exibidos novamente."
1675
1683
  ) }),
1676
1684
  /* @__PURE__ */ o(Zt, { cols: 2, spacing: "xs", children: h.map((b) => /* @__PURE__ */ o(rt, { fz: "sm", children: b }, b)) }),
1677
1685
  /* @__PURE__ */ C(ue, { justify: "space-between", children: [
1678
1686
  /* @__PURE__ */ o(st, { value: h.join(`
1679
- `), children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { variant: "subtle", onClick: m, children: b ? O("archbase:mfa.setup.copied", "Copiado") : O("archbase:mfa.setup.copyAll", "Copiar todos") }) }),
1680
- /* @__PURE__ */ o(G, { onClick: _, children: O("archbase:mfa.setup.done", "Guardei os códigos") })
1687
+ `), children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { variant: "subtle", onClick: m, children: b ? z("archbase:mfa.setup.copied", "Copiado") : z("archbase:mfa.setup.copyAll", "Copiar todos") }) }),
1688
+ /* @__PURE__ */ o(G, { onClick: _, children: z("archbase:mfa.setup.done", "Guardei os códigos") })
1681
1689
  ] })
1682
1690
  ] })
1683
1691
  ] }) });
@@ -1690,27 +1698,27 @@ const kr = {
1690
1698
  marginTop: 30
1691
1699
  };
1692
1700
  function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: n, validateToken: a, initialEmail: c = "", description: i, style: d, passwordPolicy: y, showPasswordRequirements: k = !0 }) {
1693
- const h = ut(), U = Vt(), { colorScheme: A } = er(), [w, E] = p(r ?? ""), [P, M] = p(c), [B, H] = p(""), [_, b] = p(""), [m, R] = p(""), [V, L] = p(!1), [N, T] = p(""), [ee, te] = p(""), [se, g] = p(""), [v, K] = p(""), W = Wt(y);
1701
+ const h = ut(), U = Vt(), { colorScheme: A } = er(), [w, x] = p(r ?? ""), [P, M] = p(c), [B, H] = p(""), [_, b] = p(""), [m, R] = p(""), [V, L] = p(!1), [N, T] = p(""), [te, re] = p(""), [ne, g] = p(""), [v, K] = p(""), W = Wt(y);
1694
1702
  async function we($) {
1695
1703
  $ && (Gt($) ? await e($).then(() => {
1696
- nt.showSuccess(`${x().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), L(!0);
1704
+ nt.showSuccess(`${S().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), L(!0);
1697
1705
  }).catch(() => {
1698
- }) : T(`${x().t("archbase:Email inválido")}`));
1706
+ }) : T(`${S().t("archbase:Email inválido")}`));
1699
1707
  }
1700
- async function he($, ce, ne, be) {
1701
- if ($ && ce && ne) {
1708
+ async function he($, ce, oe, be) {
1709
+ if ($ && ce && oe) {
1702
1710
  let u = "", l = "", f = "";
1703
- a && (u = a(ce), te(u)), W && (l = Jt(ne, W).error ?? ""), !l && n && (l = n(ne)), g(l), ne !== be && (f = `${x().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, K(f)), !l && !u && !f && await t($, ce, ne).then(() => {
1704
- nt.showSuccess(`${x().t("archbase:Senha redefinida com sucesso.")}`), s(), L(!1);
1711
+ a && (u = a(ce), re(u)), W && (l = Jt(oe, W).error ?? ""), !l && n && (l = n(oe)), g(l), oe !== be && (f = `${S().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, K(f)), !l && !u && !f && await t($, ce, oe).then(() => {
1712
+ nt.showSuccess(`${S().t("archbase:Senha redefinida com sucesso.")}`), s(), L(!1);
1705
1713
  }).catch(() => {
1706
- E(r || `${x().t("archbase:Erro ao redefinir senha.")}`);
1714
+ x(r || `${S().t("archbase:Erro ao redefinir senha.")}`);
1707
1715
  });
1708
1716
  }
1709
1717
  }
1710
1718
  return X(() => {
1711
- r && E(r);
1719
+ r && x(r);
1712
1720
  }, [r]), X(() => {
1713
- E("");
1721
+ x("");
1714
1722
  }, [P, B, _, m]), /* @__PURE__ */ C(
1715
1723
  We,
1716
1724
  {
@@ -1723,43 +1731,43 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1723
1731
  ...d
1724
1732
  },
1725
1733
  children: [
1726
- V ? /* @__PURE__ */ C(ie, { children: [
1734
+ V ? /* @__PURE__ */ C(ae, { children: [
1727
1735
  /* @__PURE__ */ o(
1728
- j,
1736
+ F,
1729
1737
  {
1730
1738
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1731
1739
  fw: 800,
1732
1740
  fz: { base: "20px", md: "35px" },
1733
1741
  style: { textAlign: "center", letterSpacing: "-1px" },
1734
1742
  mt: "xs",
1735
- children: x().t("archbase:Redefinir senha")
1743
+ children: S().t("archbase:Redefinir senha")
1736
1744
  }
1737
1745
  ),
1738
1746
  /* @__PURE__ */ o(Ue, { m: "xs" }),
1739
1747
  /* @__PURE__ */ o(
1740
1748
  xe,
1741
1749
  {
1742
- label: x().t("archbase:Código de segurança"),
1743
- placeholder: `${x().t("archbase:Código enviado no seu e-mail")}`,
1750
+ label: S().t("archbase:Código de segurança"),
1751
+ placeholder: `${S().t("archbase:Código enviado no seu e-mail")}`,
1744
1752
  value: B || "",
1745
1753
  required: !0,
1746
1754
  onChange: ($) => {
1747
- H($.currentTarget.value), te("");
1755
+ H($.currentTarget.value), re("");
1748
1756
  },
1749
- error: ee
1757
+ error: te
1750
1758
  }
1751
1759
  ),
1752
1760
  /* @__PURE__ */ o(
1753
1761
  ze,
1754
1762
  {
1755
- label: x().t("archbase:Nova senha"),
1756
- placeholder: x().t("archbase:Nova senha"),
1763
+ label: S().t("archbase:Nova senha"),
1764
+ placeholder: S().t("archbase:Nova senha"),
1757
1765
  onChange: ($) => {
1758
1766
  b($.currentTarget.value), g(""), K("");
1759
1767
  },
1760
1768
  value: _,
1761
1769
  required: !0,
1762
- error: se
1770
+ error: ne
1763
1771
  }
1764
1772
  ),
1765
1773
  W && /* @__PURE__ */ o(
@@ -1773,8 +1781,8 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1773
1781
  /* @__PURE__ */ o(
1774
1782
  ze,
1775
1783
  {
1776
- label: x().t("archbase:Confirmar senha"),
1777
- placeholder: x().t("archbase:Confirmar senha"),
1784
+ label: S().t("archbase:Confirmar senha"),
1785
+ placeholder: S().t("archbase:Confirmar senha"),
1778
1786
  onChange: ($) => {
1779
1787
  R($.currentTarget.value), K("");
1780
1788
  },
@@ -1790,7 +1798,7 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1790
1798
  mt: "md",
1791
1799
  fullWidth: !0,
1792
1800
  onClick: () => he(P, B, _, m),
1793
- children: `${x().t("archbase:Redefinir senha")}`
1801
+ children: `${S().t("archbase:Redefinir senha")}`
1794
1802
  }
1795
1803
  ),
1796
1804
  /* @__PURE__ */ o(
@@ -1802,28 +1810,28 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1802
1810
  onClick: () => {
1803
1811
  N || L(!1);
1804
1812
  },
1805
- children: `${x().t("archbase:Voltar")}`
1813
+ children: `${S().t("archbase:Voltar")}`
1806
1814
  }
1807
1815
  )
1808
- ] }) : /* @__PURE__ */ C(ie, { children: [
1816
+ ] }) : /* @__PURE__ */ C(ae, { children: [
1809
1817
  /* @__PURE__ */ o(
1810
- j,
1818
+ F,
1811
1819
  {
1812
1820
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1813
1821
  fw: 800,
1814
1822
  fz: { base: "20px", md: "35px" },
1815
1823
  style: { textAlign: "center", letterSpacing: "-1px" },
1816
1824
  mt: "xs",
1817
- children: x().t("archbase:Redefinir senha")
1825
+ children: S().t("archbase:Redefinir senha")
1818
1826
  }
1819
1827
  ),
1820
- /* @__PURE__ */ o(j, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
1828
+ /* @__PURE__ */ o(F, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
1821
1829
  /* @__PURE__ */ o(Ue, { m: "md" }),
1822
1830
  /* @__PURE__ */ o(
1823
1831
  xe,
1824
1832
  {
1825
1833
  label: "Email",
1826
- placeholder: `${x().t("archbase:usuario@email.com")}`,
1834
+ placeholder: `${S().t("archbase:usuario@email.com")}`,
1827
1835
  value: P || "",
1828
1836
  required: !0,
1829
1837
  onChange: ($) => {
@@ -1839,7 +1847,7 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1839
1847
  mt: "md",
1840
1848
  fullWidth: !0,
1841
1849
  onClick: () => we(P),
1842
- children: `${x().t("archbase:Enviar")}`
1850
+ children: `${S().t("archbase:Enviar")}`
1843
1851
  }
1844
1852
  ),
1845
1853
  /* @__PURE__ */ o(
@@ -1849,11 +1857,11 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1849
1857
  fullWidth: !0,
1850
1858
  color: A === "dark" ? U.colors.dark[4] : U.colors.gray[7],
1851
1859
  onClick: () => s && s(),
1852
- children: `${x().t("archbase:Voltar")}`
1860
+ children: `${S().t("archbase:Voltar")}`
1853
1861
  }
1854
1862
  )
1855
1863
  ] }),
1856
- w ? /* @__PURE__ */ o(j, { c: "red", style: { textAlign: "justify" }, children: w }) : null
1864
+ w ? /* @__PURE__ */ o(F, { c: "red", style: { textAlign: "justify" }, children: w }) : null
1857
1865
  ]
1858
1866
  }
1859
1867
  );
@@ -1889,7 +1897,7 @@ const Zr = ({
1889
1897
  (u) => u.get(Y.TokenManager)
1890
1898
  ), s = De(
1891
1899
  (u) => u.get(Y.Authenticator)
1892
- ), [n, a] = p(null), [c, i] = p(!1), [d, y] = p(!0), [k, h] = p(!1), [U, A] = p(!1), [w, E] = p(""), [P, M] = p(""), [B, H] = p(null), [_, b] = p(!1), [m, R] = p(!1), [V, L] = p(null), N = lt(Mt), T = {
1900
+ ), [n, a] = p(null), [c, i] = p(!1), [d, y] = p(!0), [k, h] = p(!1), [U, A] = p(!1), [w, x] = p(""), [P, M] = p(""), [B, H] = p(null), [_, b] = p(!1), [m, R] = p(!1), [V, L] = p(null), N = lt(Mt), T = {
1893
1901
  hasContextualLogin: typeof s.loginWithContext == "function",
1894
1902
  hasFlexibleLogin: typeof s.loginFlexible == "function",
1895
1903
  hasSocialLogin: typeof s.loginSocial == "function",
@@ -1909,40 +1917,40 @@ const Zr = ({
1909
1917
  }
1910
1918
  }
1911
1919
  const l = t.getToken();
1912
- l && (h(!0), E(""), A(!1), a(l)), y(!1);
1920
+ l && (h(!0), x(""), A(!1), a(l)), y(!1);
1913
1921
  }, []);
1914
- const ee = () => {
1915
- A(!1), E("");
1916
- }, te = () => {
1922
+ const te = () => {
1923
+ A(!1), x("");
1924
+ }, re = () => {
1917
1925
  R(!1);
1918
- }, se = (u) => {
1919
- i(!1), h(!1), t.clearToken(), u && t.clearUsernameAndPassword(), T.hasContextSupport && t.clearContext && t.clearContext(), M(""), H(null), E(""), A(!1), R(!1), N.clearAllValues();
1926
+ }, ne = (u) => {
1927
+ i(!1), h(!1), t.clearToken(), u && t.clearUsernameAndPassword(), T.hasContextSupport && t.clearContext && t.clearContext(), M(""), H(null), x(""), A(!1), R(!1), N.clearAllValues();
1920
1928
  }, g = async (u, l, f) => {
1921
1929
  try {
1922
1930
  i(!0), h(!1);
1923
1931
  const D = await s.login(u, l);
1924
1932
  t.saveToken(D), f && t.saveUsernameAndPassword(u, l), t.saveUsername(u), M(u), a(D), i(!1), h(!0);
1925
1933
  } catch (D) {
1926
- i(!1), h(!1), Oe(D) && (M(u), R(!0)), E(oe(D)), A(!0);
1934
+ i(!1), h(!1), Oe(D) && (M(u), R(!0)), x(ie(D)), A(!0);
1927
1935
  }
1928
1936
  }, v = async (u, l = !1) => {
1929
1937
  if (!T.hasContextualLogin || !s.loginWithContext)
1930
1938
  throw new Error("Login contextual não suportado por esta implementação do ArchbaseAuthenticator");
1931
1939
  try {
1932
1940
  i(!0), h(!1);
1933
- const { context: f, user: D, ...z } = await s.loginWithContext(u);
1934
- if (z.mfa_required) {
1935
- L(z.challenge_token ?? null), b(!0), M(u.email), i(!1);
1941
+ const { context: f, user: D, ...j } = await s.loginWithContext(u);
1942
+ if (j.mfa_required) {
1943
+ L(j.challenge_token ?? null), b(!0), M(u.email), i(!1);
1936
1944
  return;
1937
1945
  }
1938
1946
  const Ae = {
1939
1947
  scope: "",
1940
- ext_expires_in: z.expires_in,
1941
- ...z
1948
+ ext_expires_in: j.expires_in,
1949
+ ...j
1942
1950
  };
1943
1951
  t.saveToken(Ae), l ? t.saveUsernameAndPassword(u.email, u.password) : t.clearUsernameAndPassword(), t.saveUsername(u.email), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), H(f)), M(u.email), a(Ae), i(!1), h(!0);
1944
1952
  } catch (f) {
1945
- throw i(!1), h(!1), Oe(f) && (M(u.email), R(!0)), E(oe(f)), A(!0), f;
1953
+ throw i(!1), h(!1), Oe(f) && (M(u.email), R(!0)), x(ie(f)), A(!0), f;
1946
1954
  }
1947
1955
  }, K = async (u) => {
1948
1956
  if (!s.verifyMfa)
@@ -1950,41 +1958,41 @@ const Zr = ({
1950
1958
  if (!V)
1951
1959
  throw new Error("Nenhum desafio de MFA pendente");
1952
1960
  try {
1953
- i(!0), E(""), A(!1);
1961
+ i(!0), x(""), A(!1);
1954
1962
  const l = await s.verifyMfa(V, u);
1955
1963
  t.saveToken(l), t.saveUsername(P), a(l), b(!1), L(null), i(!1), h(!0);
1956
1964
  } catch (l) {
1957
- throw i(!1), E(oe(l)), A(!0), l;
1965
+ throw i(!1), x(ie(l)), A(!0), l;
1958
1966
  }
1959
1967
  }, W = () => {
1960
- b(!1), L(null), E(""), A(!1);
1968
+ b(!1), L(null), x(""), A(!1);
1961
1969
  }, we = async (u, l = !1) => {
1962
1970
  if (!T.hasFlexibleLogin || !s.loginFlexible)
1963
1971
  throw new Error("Login flexível não suportado por esta implementação do ArchbaseAuthenticator");
1964
1972
  try {
1965
1973
  i(!0), h(!1);
1966
- const { context: f, user: D, ...z } = await s.loginFlexible(u), Ae = {
1974
+ const { context: f, user: D, ...j } = await s.loginFlexible(u), Ae = {
1967
1975
  scope: "",
1968
- ext_expires_in: z.expires_in,
1969
- ...z
1976
+ ext_expires_in: j.expires_in,
1977
+ ...j
1970
1978
  };
1971
1979
  t.saveToken(Ae), l && t.saveUsernameAndPassword(u.identifier, u.password), t.saveUsername(D.email || u.identifier), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), H(f)), M(D.email || u.identifier), a(Ae), i(!1), h(!0);
1972
1980
  } catch (f) {
1973
- throw i(!1), h(!1), Oe(f) && (M(u.identifier), R(!0)), E(oe(f)), A(!0), f;
1981
+ throw i(!1), h(!1), Oe(f) && (M(u.identifier), R(!0)), x(ie(f)), A(!0), f;
1974
1982
  }
1975
1983
  }, he = async (u) => {
1976
1984
  if (!T.hasSocialLogin || !s.loginSocial)
1977
1985
  throw new Error("Login social não suportado por esta implementação do ArchbaseAuthenticator");
1978
1986
  try {
1979
1987
  i(!0), h(!1);
1980
- const { context: l, user: f, ...D } = await s.loginSocial(u), z = {
1988
+ const { context: l, user: f, ...D } = await s.loginSocial(u), j = {
1981
1989
  scope: "",
1982
1990
  ext_expires_in: D.expires_in,
1983
1991
  ...D
1984
1992
  };
1985
- t.saveToken(z), t.saveUsername(f.email), T.hasContextSupport && t.saveContext && l && (t.saveContext(JSON.stringify(l)), H(l)), M(f.email), a(z), i(!1), h(!0);
1993
+ t.saveToken(j), t.saveUsername(f.email), T.hasContextSupport && t.saveContext && l && (t.saveContext(JSON.stringify(l)), H(l)), M(f.email), a(j), i(!1), h(!0);
1986
1994
  } catch (l) {
1987
- throw i(!1), h(!1), E(oe(l)), A(!0), l;
1995
+ throw i(!1), h(!1), x(ie(l)), A(!0), l;
1988
1996
  }
1989
1997
  }, $ = async (u) => {
1990
1998
  if (!T.hasRegistration || !s.register)
@@ -1994,9 +2002,9 @@ const Zr = ({
1994
2002
  const l = await s.register(u);
1995
2003
  return i(!1), l;
1996
2004
  } catch (l) {
1997
- throw i(!1), E(oe(l)), A(!0), l;
2005
+ throw i(!1), x(ie(l)), A(!0), l;
1998
2006
  }
1999
- }, ce = async () => s.getSupportedContexts ? await s.getSupportedContexts() : { supportedContexts: ["DEFAULT"], defaultContext: "DEFAULT" }, ne = async (u) => s.validateContext ? await s.validateContext(u) : { context: u, supported: u === "DEFAULT" };
2007
+ }, ce = async () => s.getSupportedContexts ? await s.getSupportedContexts() : { supportedContexts: ["DEFAULT"], defaultContext: "DEFAULT" }, oe = async (u) => s.validateContext ? await s.validateContext(u) : { context: u, supported: u === "DEFAULT" };
2000
2008
  X(() => {
2001
2009
  const u = setInterval(() => {
2002
2010
  n && n.access_token && t.isTokenExpired(n, e) && be();
@@ -2011,20 +2019,20 @@ const Zr = ({
2011
2019
  const u = await s.refreshToken(n?.refresh_token);
2012
2020
  t.saveToken(u), a(u);
2013
2021
  } catch (u) {
2014
- console.error("Erro ao renovar o token:", u), se();
2022
+ console.error("Erro ao renovar o token:", u), ne();
2015
2023
  }
2016
2024
  };
2017
2025
  return {
2018
2026
  // Métodos básicos (compatibilidade)
2019
2027
  login: g,
2020
- logout: se,
2028
+ logout: ne,
2021
2029
  username: P,
2022
2030
  isAuthenticated: k,
2023
2031
  isAuthenticating: c,
2024
2032
  isInitializing: d,
2025
2033
  isError: U,
2026
2034
  error: w,
2027
- clearError: ee,
2035
+ clearError: te,
2028
2036
  accessToken: n ? n.access_token : null,
2029
2037
  // Métodos opcionais para autenticação avançada
2030
2038
  loginWithContext: T.hasContextualLogin ? v : void 0,
@@ -2032,14 +2040,14 @@ const Zr = ({
2032
2040
  loginSocial: T.hasSocialLogin ? he : void 0,
2033
2041
  register: T.hasRegistration ? $ : void 0,
2034
2042
  getSupportedContexts: ce,
2035
- validateContext: ne,
2043
+ validateContext: oe,
2036
2044
  // MFA / segundo fator (2 passos)
2037
2045
  mfaRequired: _,
2038
2046
  verifyMfa: typeof s.verifyMfa == "function" ? K : void 0,
2039
2047
  cancelMfa: W,
2040
2048
  // Troca de senha obrigatória (CREDENTIALS_EXPIRED)
2041
2049
  passwordChangeRequired: m,
2042
- clearPasswordChangeRequired: te,
2050
+ clearPasswordChangeRequired: re,
2043
2051
  // Informações de contexto
2044
2052
  context: B,
2045
2053
  // Detecção de capacidades
@@ -2064,14 +2072,14 @@ const Zr = ({
2064
2072
  try {
2065
2073
  return await r.sendResetPasswordEmail(d);
2066
2074
  } catch (y) {
2067
- throw n(oe(y)), t(!0), y;
2075
+ throw n(ie(y)), t(!0), y;
2068
2076
  }
2069
2077
  },
2070
2078
  resetPassword: async (d, y, k) => {
2071
2079
  try {
2072
2080
  return await r.resetPassword(d, y, k);
2073
2081
  } catch (h) {
2074
- throw n(oe(h)), t(!0), h;
2082
+ throw n(ie(h)), t(!0), h;
2075
2083
  }
2076
2084
  },
2077
2085
  isError: e,
@@ -2083,7 +2091,7 @@ const Zr = ({
2083
2091
  }, Cr = () => /* @__PURE__ */ o(tr, { p: "xl", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ C(Ee, { gap: "md", children: [
2084
2092
  /* @__PURE__ */ C(ue, { gap: "sm", children: [
2085
2093
  /* @__PURE__ */ o(dt, { size: "sm" }),
2086
- /* @__PURE__ */ o(j, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
2094
+ /* @__PURE__ */ o(F, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
2087
2095
  ] }),
2088
2096
  /* @__PURE__ */ o(Ce, { height: 40, radius: "sm" }),
2089
2097
  /* @__PURE__ */ o(Ce, { height: 200, radius: "sm" }),
@@ -2096,7 +2104,7 @@ const Zr = ({
2096
2104
  user: e,
2097
2105
  onError: t
2098
2106
  }) => {
2099
- const [s, n] = p(!1), [a, c] = p(null), [i] = p([]), d = e?.isAdministrator || !1, y = Ie((w) => d ? !0 : i.includes(w), [i, d]), k = Ie((w) => d ? !0 : w.some((E) => i.includes(E)), [i, d]), h = Ie((w) => d ? !0 : w.every((E) => i.includes(E)), [i, d]), U = Ie((w) => {
2107
+ const [s, n] = p(!1), [a, c] = p(null), [i] = p([]), d = e?.isAdministrator || !1, y = Ie((w) => d ? !0 : i.includes(w), [i, d]), k = Ie((w) => d ? !0 : w.some((x) => i.includes(x)), [i, d]), h = Ie((w) => d ? !0 : w.every((x) => i.includes(x)), [i, d]), U = Ie((w) => {
2100
2108
  c(w), w && t && t(w);
2101
2109
  }, [t]), A = {
2102
2110
  user: e,
@@ -2122,7 +2130,7 @@ const Zr = ({
2122
2130
  const d = Ve(Ye);
2123
2131
  if (!d)
2124
2132
  throw new Error("ArchbaseViewSecurityProvider deve ser usado dentro de um ArchbaseSecurityProvider");
2125
- const { user: y, isAdmin: k } = d, [h, U] = p(null), [A, w] = p(!0), [E, P] = p(null);
2133
+ const { user: y, isAdmin: k } = d, [h, U] = p(null), [A, w] = p(!0), [x, P] = p(null);
2126
2134
  if (it.useEffect(() => {
2127
2135
  if (!y) {
2128
2136
  w(!1);
@@ -2141,11 +2149,11 @@ const Zr = ({
2141
2149
  }
2142
2150
  })();
2143
2151
  }, [e, t, y, k, c, i]), A)
2144
- return a ? /* @__PURE__ */ o(ie, { children: a }) : /* @__PURE__ */ o(Cr, {});
2145
- if (E)
2152
+ return a ? /* @__PURE__ */ o(ae, { children: a }) : /* @__PURE__ */ o(Cr, {});
2153
+ if (x)
2146
2154
  return /* @__PURE__ */ o("div", { className: "archbase-security-error", children: /* @__PURE__ */ C("div", { children: [
2147
2155
  "Erro ao carregar permissões: ",
2148
- E
2156
+ x
2149
2157
  ] }) });
2150
2158
  if (!y)
2151
2159
  return n || /* @__PURE__ */ o("div", { className: "archbase-security-no-user", children: /* @__PURE__ */ o("div", { children: "É necessário fazer login para acessar esta área" }) });
@@ -2168,7 +2176,7 @@ const Zr = ({
2168
2176
  h?.registerAction(m, R);
2169
2177
  },
2170
2178
  isLoading: A,
2171
- error: E
2179
+ error: x
2172
2180
  };
2173
2181
  return /* @__PURE__ */ o(Nt.Provider, { value: b, children: r });
2174
2182
  }, Tr = () => {
@@ -2221,7 +2229,7 @@ const Zr = ({
2221
2229
  c && e && n && k(e, n);
2222
2230
  }, [e, n, c, k]);
2223
2231
  let h = !1;
2224
- return e ? h = i(e) : t.length > 0 ? h = s ? y(t) : d(t) : h = !0, h ? /* @__PURE__ */ o(ie, { children: r }) : /* @__PURE__ */ o(ie, { children: a });
2232
+ return e ? h = i(e) : t.length > 0 ? h = s ? y(t) : d(t) : h = !0, h ? /* @__PURE__ */ o(ae, { children: r }) : /* @__PURE__ */ o(ae, { children: a });
2225
2233
  }, os = ({
2226
2234
  actionName: r,
2227
2235
  actionDescription: e,
@@ -2308,7 +2316,7 @@ const Zr = ({
2308
2316
  ] }),
2309
2317
  children: r
2310
2318
  }
2311
- ) : /* @__PURE__ */ o(ie, { children: r });
2319
+ ) : /* @__PURE__ */ o(ae, { children: r });
2312
2320
  function as(r, e) {
2313
2321
  return function(s) {
2314
2322
  const { resourceName: n, resourceDescription: a, requiredPermissions: c, fallbackComponent: i } = e;
@@ -127,6 +127,28 @@ export declare class UserDto extends SecurityDto {
127
127
  email?: string;
128
128
  type: string;
129
129
  isNewUser: boolean;
130
+ /**
131
+ * Matrícula do funcionário na empresa: o número pelo qual o RH e a folha identificam a pessoa,
132
+ * e que costuma ser o elo com ponto, crachá e folha de pagamento.
133
+ *
134
+ * Opcional de propósito — contas de serviço e usuários que não são funcionários não têm uma.
135
+ * Não é única: bases herdadas de sistemas antigos costumam ter matrícula repetida, e quem
136
+ * precisar exigir unicidade cria o índice decidindo o escopo (global ou por tenant).
137
+ *
138
+ * Não confundir com {@link externalId}, que identifica a conta num provedor de identidade
139
+ * (Keycloak, LDAP). Uma é o vínculo empregatício, a outra é a credencial — convivem.
140
+ *
141
+ * Requer archbase-security 3.1.20 ou superior no backend.
142
+ */
143
+ employeeId?: string;
144
+ /**
145
+ * ID da conta num provedor de identidade externo (Keycloak, LDAP e afins).
146
+ *
147
+ * Existe no backend desde antes da matrícula, mas nunca esteve neste DTO — então a tela lia e
148
+ * devolvia o usuário sem ele. Declarado aqui para que o valor sobreviva a uma edição, junto com
149
+ * a correção do lado do servidor que passou a gravá-lo.
150
+ */
151
+ externalId?: string;
130
152
  constructor(data: any);
131
153
  static newInstance: () => UserDto;
132
154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archbase/security",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "description": "Security and authentication components for Archbase React",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -37,10 +37,10 @@
37
37
  "reflect-metadata": "^0.1.13",
38
38
  "rxjs": "^7.8.2",
39
39
  "uuid": "^9.0.1",
40
- "@archbase/components": "4.3.0",
41
- "@archbase/core": "4.3.0",
42
- "@archbase/data": "4.3.0",
43
- "@archbase/layout": "4.3.0"
40
+ "@archbase/components": "4.3.1",
41
+ "@archbase/core": "4.3.1",
42
+ "@archbase/data": "4.3.1",
43
+ "@archbase/layout": "4.3.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/crypto-js": "^4.1.1",
Binary file