@zeniai/client-epic-state 4.18.56 → 4.18.57
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.
|
@@ -28,12 +28,19 @@ const sendEmailMagicLinkToUserEpic = (actions$, _, zeniAPI) => actions$.pipe((0,
|
|
|
28
28
|
return zeniAPI
|
|
29
29
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/signin/magic-link`, toRequestPayload(email, deviceId))
|
|
30
30
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
31
|
+
var _a, _b, _c, _d, _e;
|
|
31
32
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
32
33
|
return (0, rxjs_1.of)((0, tenantReducer_1.sendEmailMagicLinkToUserSuccess)(response.data.code_verifier));
|
|
33
34
|
}
|
|
34
35
|
else {
|
|
35
36
|
const actions = [];
|
|
36
|
-
actions.push((0, tenantReducer_1.sendEmailMagicLinkToUserFailure)(
|
|
37
|
+
actions.push((0, tenantReducer_1.sendEmailMagicLinkToUserFailure)({
|
|
38
|
+
error: response.status,
|
|
39
|
+
accountLockTime: (_b = (_a = response.status.details) === null || _a === void 0 ? void 0 : _a.lock_time) !== null && _b !== void 0 ? _b : undefined,
|
|
40
|
+
accountUnlockTime: (_d = (_c = response.status.details) === null || _c === void 0 ? void 0 : _c.unlock_time) !== null && _d !== void 0 ? _d : undefined,
|
|
41
|
+
isAccountLocked: ((_e = response.status.details) === null || _e === void 0 ? void 0 : _e.application_error_code) ===
|
|
42
|
+
'LOGIN_VIA_EMAIL_LOCKED',
|
|
43
|
+
}));
|
|
37
44
|
if (response.status.code === 500) {
|
|
38
45
|
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
39
46
|
messageSection: 'send_email_magic_link_to_user',
|
|
@@ -43,8 +50,13 @@ const sendEmailMagicLinkToUserEpic = (actions$, _, zeniAPI) => actions$.pipe((0,
|
|
|
43
50
|
}
|
|
44
51
|
return (0, rxjs_1.from)(actions);
|
|
45
52
|
}
|
|
46
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, tenantReducer_1.sendEmailMagicLinkToUserFailure)(
|
|
47
|
-
|
|
53
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, tenantReducer_1.sendEmailMagicLinkToUserFailure)({
|
|
54
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Send magic link to user API call errored out: ' +
|
|
55
|
+
JSON.stringify(error)),
|
|
56
|
+
accountLockTime: undefined,
|
|
57
|
+
accountUnlockTime: undefined,
|
|
58
|
+
isAccountLocked: false,
|
|
59
|
+
}), (0, snackbarReducer_1.openSnackbar)({
|
|
48
60
|
messageSection: 'send_email_magic_link_to_user',
|
|
49
61
|
messageText: 'failed',
|
|
50
62
|
type: 'error',
|
|
@@ -46,7 +46,12 @@ export declare const updateTenants: import("@reduxjs/toolkit").ActionCreatorWith
|
|
|
46
46
|
deviceId: string;
|
|
47
47
|
}, "tenant/sendEmailMagicLinkToUser", never, never>, sendEmailMagicLinkToUserSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[codeVerifier: string], {
|
|
48
48
|
codeVerifier: string;
|
|
49
|
-
}, "tenant/sendEmailMagicLinkToUserSuccess", never, never>, sendEmailMagicLinkToUserFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<
|
|
49
|
+
}, "tenant/sendEmailMagicLinkToUserSuccess", never, never>, sendEmailMagicLinkToUserFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
50
|
+
error: ZeniAPIStatus;
|
|
51
|
+
accountLockTime?: string;
|
|
52
|
+
accountUnlockTime?: string;
|
|
53
|
+
isAccountLocked?: boolean;
|
|
54
|
+
}, "tenant/sendEmailMagicLinkToUserFailure">, updateSignInState: import("@reduxjs/toolkit").ActionCreatorWithPayload<FetchState, "tenant/updateSignInState">, doSignOut: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"tenant/doSignOut">, signOutSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"tenant/signOutSuccess">, updateLoggedInUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userPayload: LoggedInUserPayload, zeniSessionId: string, authProvider: AuthProvider], {
|
|
50
55
|
userPayload: LoggedInUserPayload;
|
|
51
56
|
zeniSessionId: string;
|
|
52
57
|
authProvider: AuthProvider;
|
|
@@ -19,6 +19,7 @@ const userRolePayload_1 = require("../userRole/userRolePayload");
|
|
|
19
19
|
exports.initialState = {
|
|
20
20
|
fetchState: 'Not-Started',
|
|
21
21
|
error: undefined,
|
|
22
|
+
accountLocked: false,
|
|
22
23
|
tenantsById: {},
|
|
23
24
|
onboardingTenantsById: {},
|
|
24
25
|
tenantIds: [],
|
|
@@ -52,6 +53,8 @@ exports.initialState = {
|
|
|
52
53
|
magicLinkCodeVerifier: undefined,
|
|
53
54
|
otpChallenge: undefined,
|
|
54
55
|
twoFAPhoneNumber: undefined,
|
|
56
|
+
accountLockTime: undefined,
|
|
57
|
+
accountUnlockTime: undefined,
|
|
55
58
|
hasValidState() {
|
|
56
59
|
return this.fetchState == 'Completed' && this.tenantIds.length > 0;
|
|
57
60
|
},
|
|
@@ -229,9 +232,16 @@ const tenant = (0, toolkit_1.createSlice)({
|
|
|
229
232
|
draft.magicLinkCodeVerifier = codeVerifier;
|
|
230
233
|
},
|
|
231
234
|
},
|
|
235
|
+
// accept account lock time and unlock time in the payload in sendEmailMagicLinkToUserFailure function
|
|
232
236
|
sendEmailMagicLinkToUserFailure(draft, action) {
|
|
237
|
+
const { error, accountLockTime, accountUnlockTime, isAccountLocked } = action.payload;
|
|
233
238
|
draft.sendEmailMagicLinkFetchState.fetchState = 'Error';
|
|
234
|
-
draft.sendEmailMagicLinkFetchState.error =
|
|
239
|
+
draft.sendEmailMagicLinkFetchState.error = error;
|
|
240
|
+
draft.accountLockTime =
|
|
241
|
+
accountLockTime != null ? (0, zeniDayJS_1.date)(accountLockTime) : undefined;
|
|
242
|
+
draft.accountUnlockTime =
|
|
243
|
+
accountUnlockTime != null ? (0, zeniDayJS_1.date)(accountUnlockTime) : undefined;
|
|
244
|
+
draft.accountLocked = isAccountLocked !== null && isAccountLocked !== void 0 ? isAccountLocked : false;
|
|
235
245
|
},
|
|
236
246
|
doMagicLinkSignIn: {
|
|
237
247
|
prepare(token, deviceId, magicLinkCodeVerifier) {
|
|
@@ -405,6 +415,9 @@ const tenant = (0, toolkit_1.createSlice)({
|
|
|
405
415
|
draft.sendEmailMagicLinkFetchState.error = undefined;
|
|
406
416
|
draft.magicLinkSignInFetchState.fetchState = 'Not-Started';
|
|
407
417
|
draft.magicLinkSignInFetchState.error = undefined;
|
|
418
|
+
draft.accountLocked = false;
|
|
419
|
+
draft.accountLockTime = undefined;
|
|
420
|
+
draft.accountUnlockTime = undefined;
|
|
408
421
|
draft.error = undefined;
|
|
409
422
|
},
|
|
410
423
|
signOutSuccess(draft) {
|
|
@@ -18,6 +18,7 @@ export interface TenantExternalConnections {
|
|
|
18
18
|
error?: ZeniAPIStatus;
|
|
19
19
|
}
|
|
20
20
|
export interface TenantState extends FetchedState {
|
|
21
|
+
accountLocked: boolean;
|
|
21
22
|
activeTenantFetchState: FetchStateAndError;
|
|
22
23
|
excludedResourcesByTenant: Record<ID, {
|
|
23
24
|
fetchState: FetchState;
|
|
@@ -37,6 +38,8 @@ export interface TenantState extends FetchedState {
|
|
|
37
38
|
tenantIds: ID[];
|
|
38
39
|
tenantsById: Record<ID, Tenant>;
|
|
39
40
|
verifyDeviceFetchState: FetchStateAndError;
|
|
41
|
+
accountLockTime?: ZeniDate;
|
|
42
|
+
accountUnlockTime?: ZeniDate;
|
|
40
43
|
currentTenantId?: ID;
|
|
41
44
|
loggedInUser?: LoggedInUser;
|
|
42
45
|
magicLinkCodeVerifier?: string;
|
package/lib/responsePayload.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ import { ReportPayload } from './commonPayloadTypes/viewAndReportPayload';
|
|
|
5
5
|
interface ZeniAPIStatusDetails {
|
|
6
6
|
application_error_code: string;
|
|
7
7
|
application_error_message: string;
|
|
8
|
+
lock_time: string;
|
|
8
9
|
request_id: string;
|
|
10
|
+
unlock_time: string;
|
|
9
11
|
}
|
|
10
12
|
export interface ZeniAPIStatus<E = Record<string, unknown>> {
|
|
11
13
|
code: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.57",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|