@zeniai/client-epic-state 4.18.42 → 4.18.43
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.
|
@@ -6,19 +6,28 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const systemInfo_1 = require("../../../commonStateTypes/systemInfo");
|
|
7
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
8
|
const tenantReducer_1 = require("../tenantReducer");
|
|
9
|
-
const toRequestPayload = (token, deviceId) => {
|
|
10
|
-
const
|
|
11
|
-
return {
|
|
9
|
+
const toRequestPayload = (token, deviceId, magicLinkCodeVerifier, isOtpResend, email) => {
|
|
10
|
+
const payload = {
|
|
12
11
|
token,
|
|
13
12
|
device_id: deviceId,
|
|
14
13
|
auth_type: 'magic_links',
|
|
15
|
-
device_info:
|
|
14
|
+
device_info: (0, systemInfo_1.collectSystemInfo)(),
|
|
16
15
|
};
|
|
16
|
+
if (magicLinkCodeVerifier != null) {
|
|
17
|
+
payload.pkce_code_verifier = magicLinkCodeVerifier;
|
|
18
|
+
}
|
|
19
|
+
if (isOtpResend === true) {
|
|
20
|
+
payload.is_otp_resend = true;
|
|
21
|
+
}
|
|
22
|
+
if (email != null) {
|
|
23
|
+
payload.user_email = email;
|
|
24
|
+
}
|
|
25
|
+
return payload;
|
|
17
26
|
};
|
|
18
27
|
const doMagicLinkSignInEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.doMagicLinkSignIn.match), (0, operators_1.switchMap)((action) => {
|
|
19
|
-
const { token, deviceId } = action.payload;
|
|
28
|
+
const { token, deviceId, isOtpResend, email, magicLinkCodeVerifier } = action.payload;
|
|
20
29
|
return zeniAPI
|
|
21
|
-
.postJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/signin`, toRequestPayload(token, deviceId))
|
|
30
|
+
.postJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/signin`, toRequestPayload(token, deviceId, magicLinkCodeVerifier, isOtpResend, email))
|
|
22
31
|
.pipe((0, operators_1.concatMap)((response) => {
|
|
23
32
|
return (0, rxjs_1.from)(response.json()).pipe((0, operators_1.mergeMap)((responseJson) => {
|
|
24
33
|
var _a, _b, _c;
|
|
@@ -13,7 +13,7 @@ const toRequestPayload = (email, deviceId) => {
|
|
|
13
13
|
return {
|
|
14
14
|
email,
|
|
15
15
|
device_id: deviceId,
|
|
16
|
-
|
|
16
|
+
device_info: systemInfo,
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
catch (_a) {
|
|
@@ -29,7 +29,7 @@ const sendEmailMagicLinkToUserEpic = (actions$, _, zeniAPI) => actions$.pipe((0,
|
|
|
29
29
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/signin/magic-link`, toRequestPayload(email, deviceId))
|
|
30
30
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
31
31
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
32
|
-
return (0, rxjs_1.of)((0, tenantReducer_1.sendEmailMagicLinkToUserSuccess)());
|
|
32
|
+
return (0, rxjs_1.of)((0, tenantReducer_1.sendEmailMagicLinkToUserSuccess)(response.data.code_verifier));
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
35
|
const actions = [];
|
|
@@ -34,16 +34,21 @@ export declare const updateTenants: import("@reduxjs/toolkit").ActionCreatorWith
|
|
|
34
34
|
}, "tenant/updateExcludedResourcesSuccess", never, never>, updateExcludedResourcesFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
35
35
|
tenantId: string;
|
|
36
36
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
37
|
-
}, "tenant/updateExcludedResourcesFailure", never, never>, doSignIn: import("@reduxjs/toolkit").ActionCreatorWithPayload<DoSignInPayload, "tenant/doSignIn">, doMagicLinkSignIn: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[token: string, deviceId: string], {
|
|
37
|
+
}, "tenant/updateExcludedResourcesFailure", never, never>, doSignIn: import("@reduxjs/toolkit").ActionCreatorWithPayload<DoSignInPayload, "tenant/doSignIn">, doMagicLinkSignIn: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[token: string, deviceId: string, magicLinkCodeVerifier?: string | undefined, isOtpResend?: boolean | undefined, email?: string | undefined], {
|
|
38
38
|
token: string;
|
|
39
39
|
deviceId: string;
|
|
40
|
+
isOtpResend: boolean | undefined;
|
|
41
|
+
email: string | undefined;
|
|
42
|
+
magicLinkCodeVerifier: string | undefined;
|
|
40
43
|
}, "tenant/doMagicLinkSignIn", never, never>, magicLinkSignInSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userId: string, sessionId: string], {
|
|
41
44
|
userId: string;
|
|
42
45
|
sessionId: string;
|
|
43
46
|
}, "tenant/magicLinkSignInSuccess", never, never>, magicLinkSignInFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "tenant/magicLinkSignInFailure">, sendEmailMagicLinkToUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[email: string, deviceId: string], {
|
|
44
47
|
email: string;
|
|
45
48
|
deviceId: string;
|
|
46
|
-
}, "tenant/sendEmailMagicLinkToUser", never, never>, sendEmailMagicLinkToUserSuccess: import("@reduxjs/toolkit").
|
|
49
|
+
}, "tenant/sendEmailMagicLinkToUser", never, never>, sendEmailMagicLinkToUserSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[codeVerifier: string], {
|
|
50
|
+
codeVerifier: string;
|
|
51
|
+
}, "tenant/sendEmailMagicLinkToUserSuccess", never, never>, sendEmailMagicLinkToUserFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "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], {
|
|
47
52
|
userPayload: LoggedInUserPayload;
|
|
48
53
|
zeniSessionId: string;
|
|
49
54
|
authProvider: AuthProvider;
|
|
@@ -214,18 +214,25 @@ const tenant = (0, toolkit_1.createSlice)({
|
|
|
214
214
|
draft.magicLinkEmail = action.payload.email;
|
|
215
215
|
},
|
|
216
216
|
},
|
|
217
|
-
sendEmailMagicLinkToUserSuccess
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
sendEmailMagicLinkToUserSuccess: {
|
|
218
|
+
prepare(codeVerifier) {
|
|
219
|
+
return { payload: { codeVerifier } };
|
|
220
|
+
},
|
|
221
|
+
reducer(draft, action) {
|
|
222
|
+
const { codeVerifier } = action.payload;
|
|
223
|
+
draft.sendEmailMagicLinkFetchState.fetchState = 'Completed';
|
|
224
|
+
draft.sendEmailMagicLinkFetchState.error = undefined;
|
|
225
|
+
draft.magicLinkCodeVerifier = codeVerifier;
|
|
226
|
+
},
|
|
220
227
|
},
|
|
221
228
|
sendEmailMagicLinkToUserFailure(draft, action) {
|
|
222
229
|
draft.sendEmailMagicLinkFetchState.fetchState = 'Error';
|
|
223
230
|
draft.sendEmailMagicLinkFetchState.error = action.payload;
|
|
224
231
|
},
|
|
225
232
|
doMagicLinkSignIn: {
|
|
226
|
-
prepare(token, deviceId) {
|
|
233
|
+
prepare(token, deviceId, magicLinkCodeVerifier, isOtpResend, email) {
|
|
227
234
|
return {
|
|
228
|
-
payload: { token, deviceId },
|
|
235
|
+
payload: { token, deviceId, isOtpResend, email, magicLinkCodeVerifier },
|
|
229
236
|
};
|
|
230
237
|
},
|
|
231
238
|
reducer(draft) {
|
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.43",
|
|
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",
|