@mcurros2/microm 1.1.285-0 → 1.1.287-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
@@ -42,7 +42,7 @@ export function isIn<T>(value: T, ...params: T[]): boolean;
42
42
  export function isPromise<T>(obj: unknown): obj is Promise<T>;
43
43
  export function createKeysSet<T>(): Set<keyof T>;
44
44
  export function createKeysArray<T>(): Array<keyof T>;
45
- export function nameof<T>(_type: new (...args: any[]) => T, selector: (x: T) => any): string;
45
+ export function nameof<T>(selector: (x: T) => any): string;
46
46
  export interface IDataStorage {
47
47
  saveData(app_id: string, key: string, data: unknown): Promise<void>;
48
48
  readData(app_id: string, key: string): Promise<unknown | null>;
@@ -82,7 +82,7 @@ export interface ColorConfigurationProps {
82
82
  export function ColorConfiguration({ onChange, value }: ColorConfigurationProps): JSX.Element;
83
83
  export interface LoginOptions {
84
84
  client: MicroMClient;
85
- onStatusCompleted: StatusCompletedHandler<MicroMToken>;
85
+ onStatusCompleted: StatusCompletedHandler<MicroMToken | TwoFactorLoginResult>;
86
86
  userLabel?: string;
87
87
  userPlaceholder?: string;
88
88
  passwordLabel?: string;
@@ -92,11 +92,19 @@ export interface LoginOptions {
92
92
  signInButtonLabel?: string;
93
93
  loginErrorMessage?: string;
94
94
  confirmRecoveryEmailTitle?: string;
95
+ codeLabel?: string;
96
+ codePlaceholder?: string;
97
+ verifyCodeButtonLabel?: string;
98
+ twoFactorTitle?: string;
99
+ twoFactorDescription?: string;
100
+ twoFactorProviderLabel?: string;
101
+ cancelTwoFactorButtonLabel?: string;
95
102
  }
96
103
  export const LoginDefaultProps: Partial<LoginOptions>;
97
104
  export interface LoginValues {
98
105
  user: string;
99
106
  password: string;
107
+ code: string;
100
108
  server: string;
101
109
  rememberme: boolean;
102
110
  }
@@ -921,6 +929,20 @@ interface TimeFieldRef {
921
929
  showPicker: () => void;
922
930
  }
923
931
  export const TimeField: ForwardRefExoticComponent<TimeFieldProps & RefAttributes<TimeFieldRef>>;
932
+ export interface TotpSetupProps {
933
+ client: MicroMClient;
934
+ onConfirmed?: () => void;
935
+ setupButtonLabel?: string;
936
+ confirmButtonLabel?: string;
937
+ qrAlt?: string;
938
+ codePlaceholder?: string;
939
+ setupTitle?: string;
940
+ setupDescription?: string;
941
+ successMessage?: string;
942
+ errorMessage?: string;
943
+ }
944
+ export const TotpSetupDefaultProps: Partial<TotpSetupProps>;
945
+ export function TotpSetup(props: TotpSetupProps): JSX.Element;
924
946
  export function getInitials(input: string): string;
925
947
  export interface useIsLoggedInProps {
926
948
  client: MicroMClient;
@@ -1143,14 +1165,14 @@ export class MicromUsersDef extends EntityDefinition {
1143
1165
  vc_email: EntityColumn<string>;
1144
1166
  vc_pwhash: EntityColumn<string>;
1145
1167
  vb_sid: EntityColumn<string>;
1146
- vc_refreshtoken: EntityColumn<string>;
1147
- dt_refresh_expiration: EntityColumn<boolean>;
1148
1168
  i_badlogonattempts: EntityColumn<number>;
1149
- i_refreshcount: EntityColumn<number>;
1150
1169
  bt_disabled: EntityColumn<boolean>;
1151
1170
  dt_locked: EntityColumn<Date>;
1152
1171
  dt_last_login: EntityColumn<Date>;
1153
1172
  dt_last_refresh: EntityColumn<Date>;
1173
+ vc_totp_secret: EntityColumn<string>;
1174
+ bt_totp_enabled: EntityColumn<boolean>;
1175
+ dt_totp_confirmed: EntityColumn<Date>;
1154
1176
  vc_recovery_code: EntityColumn<string>;
1155
1177
  dt_last_recovery: EntityColumn<Date>;
1156
1178
  c_usertype_id: EntityColumn<string>;
@@ -1159,6 +1181,11 @@ export class MicromUsersDef extends EntityDefinition {
1159
1181
  i_locked_minutes_remaining: EntityColumn<number>;
1160
1182
  vc_password: EntityColumn<string>;
1161
1183
  };
1184
+ procs: {
1185
+ usr_resetTotp: {
1186
+ name: string;
1187
+ };
1188
+ };
1162
1189
  views: {
1163
1190
  usr_brwStandard: {
1164
1191
  name: string;
@@ -1198,6 +1225,13 @@ export interface MicromUsersFormProps extends FormOptions<MicromUsers> {
1198
1225
  lockedTitleLabel?: string;
1199
1226
  minutesLabel?: string;
1200
1227
  willUnlockInNextLogonLabel?: string;
1228
+ authenticatorEnabledLabel?: string;
1229
+ authenticatorDisabledLabel?: string;
1230
+ authenticatorStatusTitle?: string;
1231
+ clearAuthenticatorButtonLabel?: string;
1232
+ clearAuthenticatorTitle?: string;
1233
+ clearAuthenticatorConfirmation?: string;
1234
+ clearAuthenticatorOKLabel?: string;
1201
1235
  }
1202
1236
  export const MicromUsersFormDefaultProps: Partial<MicromUsersFormProps>;
1203
1237
  export function MicromUsersForm(props: MicromUsersFormProps): JSX.Element;
@@ -1757,6 +1791,15 @@ export class MicroMToken {
1757
1791
  constructor(access_token?: string, expires_in?: number, refresh_token?: string, token_type?: string, claims?: {});
1758
1792
  className(): string;
1759
1793
  }
1794
+ export interface TwoFactorLoginResult {
1795
+ requires_two_factor: true;
1796
+ two_factor_challenge_id: string;
1797
+ two_factor_provider?: string;
1798
+ two_factor_setup_required?: boolean;
1799
+ qr_code_data_url?: string;
1800
+ username: string;
1801
+ email?: string;
1802
+ }
1760
1803
  export type DataOperationType = "add" | "edit" | "delete" | "get" | "lookup" | "view" | "action" | "login" | "refresh" | "proc" | "import" | "export" | "other";
1761
1804
  export interface OperationStatus<T> {
1762
1805
  loading?: boolean;
@@ -1764,7 +1807,7 @@ export interface OperationStatus<T> {
1764
1807
  operationType?: DataOperationType;
1765
1808
  data?: T;
1766
1809
  }
1767
- export type StatusCompletedHandler<T extends MicroMToken | DBStatusResult | DataResult | ValuesObject | null> = (status: OperationStatus<T>) => void;
1810
+ export type StatusCompletedHandler<T extends MicroMToken | TwoFactorLoginResult | DBStatusResult | DataResult | ValuesObject | null> = (status: OperationStatus<T>) => void;
1768
1811
  export interface UseImportDataProps {
1769
1812
  initialFormMode: FormMode;
1770
1813
  title?: string;
@@ -3741,6 +3784,9 @@ export class TokenWebStorage implements TokenStorage {
3741
3784
  readToken(app_id: string): Promise<MicroMToken | null>;
3742
3785
  deleteToken(app_id: string): Promise<void>;
3743
3786
  }
3787
+ export interface TotpSetupStartResponse {
3788
+ qr_code_data_url: string;
3789
+ }
3744
3790
  export type APIAction = "get" | "insert" | "update" | "delete" | "lookup" | "view" | "viewstream" | "action" | "upload" | "proc" | "procstream" | "process" | "import" | "viewtoexcel" | "proctoexcel" | "timezoneoffset";
3745
3791
  export interface FileUploadResponse {
3746
3792
  ErrorMessage?: string;
@@ -3775,12 +3821,15 @@ export class MicroMClient {
3775
3821
  getRememberUser(): Promise<string | null>;
3776
3822
  isLoggedIn(): Promise<boolean>;
3777
3823
  isLoggedInLocal(): Promise<boolean>;
3778
- login(username: string, password: string, rememberme?: boolean): Promise<MicroMToken>;
3824
+ login(username: string, password: string, rememberme?: boolean): Promise<MicroMToken | TwoFactorLoginResult>;
3825
+ login2fa(challengeId: string, code: string, rememberme?: boolean, username?: string): Promise<MicroMToken>;
3779
3826
  localLogoff(): Promise<void>;
3780
3827
  logoff(): Promise<void>;
3781
3828
  updateClientClaims(claims: Partial<MicroMClientClaimTypes>): Promise<void>;
3782
3829
  recoveryemail(username: string): Promise<DBStatusResult>;
3783
3830
  recoverpassword(username: string, password: string, recoverycode: string): Promise<DBStatusResult>;
3831
+ startTotpSetup(): Promise<TotpSetupStartResponse>;
3832
+ confirmTotpSetup(code: string): Promise<void>;
3784
3833
  get TIMEZONE_OFFSET(): number;
3785
3834
  getMenus(): Promise<Set<string>>;
3786
3835
  getDocumentURL(fileGuid: string): string;