@zeniai/client-epic-state 4.18.47 → 4.18.49
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/lib/commonStateTypes/animations.d.ts +1 -1
- package/lib/commonStateTypes/animations.js +0 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransactionPayload.d.ts +1 -1
- package/lib/entity/company/companyPayload.d.ts +0 -1
- package/lib/entity/company/companyPayload.js +0 -1
- package/lib/entity/company/companyStateTypes.d.ts +0 -1
- package/lib/entity/tenant/epic/doMagicLinkSignInEpic.d.ts +0 -7
- package/lib/entity/tenant/epic/doMagicLinkSignInEpic.js +7 -28
- package/lib/entity/tenant/epic/sendEmailMagicLinkToUserEpic.js +5 -19
- package/lib/entity/tenant/tenantPayload.d.ts +2 -12
- package/lib/entity/tenant/tenantReducer.d.ts +4 -20
- package/lib/entity/tenant/tenantReducer.js +7 -64
- package/lib/entity/tenant/tenantState.d.ts +0 -4
- package/lib/epic.d.ts +1 -2
- package/lib/epic.js +1 -2
- package/lib/index.d.ts +4 -4
- package/lib/index.js +28 -30
- package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +0 -1
- package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +0 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +7 -1
- package/lib/view/spendManagement/helpers.d.ts +0 -10
- package/lib/view/spendManagement/helpers.js +1 -28
- package/package.json +1 -1
- package/lib/commonStateTypes/systemInfo.d.ts +0 -52
- package/lib/commonStateTypes/systemInfo.js +0 -242
- package/lib/entity/tenant/epic/verifyDeviceWithTwoFAEpic.d.ts +0 -28
- package/lib/entity/tenant/epic/verifyDeviceWithTwoFAEpic.js +0 -42
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.checkIfLowBalance = exports.getReportIDPlusForecastIDFromSetupViewType = exports.isAwaitingMarkAsPaid = exports.isPaymentMethodOutsideZeni = exports.toAccountsPromoConfig = exports.getBulkOperationSuffix = exports.getRemiListUniqueType = exports.getBillListUniqueType = exports.isBulkProcessing = exports.getActualPaymentDate = exports.accountTypeSubConfigCodeToAccType = exports.isRecurringConfigChanged = exports.updateRecurringBillDetails = exports.getPaymentDateFromVendorReceiveDate = exports.getSelectedCompanyOfficer = exports.getLatestApprovalDate = void 0;
|
|
7
7
|
exports.getSpendManagementEffectiveListPeriod = getSpendManagementEffectiveListPeriod;
|
|
8
8
|
exports.showReimbursementPromoPage = showReimbursementPromoPage;
|
|
9
9
|
exports.showBillPayPromoPage = showBillPayPromoPage;
|
|
@@ -364,30 +364,3 @@ const checkIfLowBalance = (totalAmount, bankBalance) => {
|
|
|
364
364
|
return isLowBalance;
|
|
365
365
|
};
|
|
366
366
|
exports.checkIfLowBalance = checkIfLowBalance;
|
|
367
|
-
const toSameDayAchDisablementConfig = (dynamicConfigValue) => {
|
|
368
|
-
return {
|
|
369
|
-
balanceOutdatedThresholdDays: typeof dynamicConfigValue.balance_outdated_threshold_days === 'number'
|
|
370
|
-
? dynamicConfigValue.balance_outdated_threshold_days
|
|
371
|
-
: 10,
|
|
372
|
-
disablementAmountThreshold: typeof dynamicConfigValue.disablement_amount_threshold === 'number'
|
|
373
|
-
? dynamicConfigValue.disablement_amount_threshold
|
|
374
|
-
: 100000,
|
|
375
|
-
disablementReturnCountThreshold: typeof dynamicConfigValue.disablement_return_count_threshold === 'number'
|
|
376
|
-
? dynamicConfigValue.disablement_return_count_threshold
|
|
377
|
-
: 1,
|
|
378
|
-
excludedTenantList: Array.isArray(dynamicConfigValue.excluded_tenant_list) &&
|
|
379
|
-
dynamicConfigValue.excluded_tenant_list.every((item) => typeof item === 'string')
|
|
380
|
-
? dynamicConfigValue.excluded_tenant_list
|
|
381
|
-
: [],
|
|
382
|
-
isEnabledForAllTenants: typeof dynamicConfigValue.is_enabled_for_all_tenants === 'boolean'
|
|
383
|
-
? dynamicConfigValue.is_enabled_for_all_tenants
|
|
384
|
-
: false,
|
|
385
|
-
newTenantTenureLimitMonths: typeof dynamicConfigValue.new_tenant_tenure_limit_months === 'number'
|
|
386
|
-
? dynamicConfigValue.new_tenant_tenure_limit_months
|
|
387
|
-
: 3,
|
|
388
|
-
returnCountLookbackTenureDays: typeof dynamicConfigValue.return_count_lookback_tenure_days === 'number'
|
|
389
|
-
? dynamicConfigValue.return_count_lookback_tenure_days
|
|
390
|
-
: 365,
|
|
391
|
-
};
|
|
392
|
-
};
|
|
393
|
-
exports.toSameDayAchDisablementConfig = toSameDayAchDisablementConfig;
|
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.49",
|
|
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",
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* System information that can be collected from the client side
|
|
3
|
-
* when sending email magic link requests
|
|
4
|
-
*/
|
|
5
|
-
export interface SystemInfo {
|
|
6
|
-
browser: {
|
|
7
|
-
name: string;
|
|
8
|
-
userAgent: string;
|
|
9
|
-
version: string;
|
|
10
|
-
};
|
|
11
|
-
device: {
|
|
12
|
-
isDesktop: boolean;
|
|
13
|
-
isMobile: boolean;
|
|
14
|
-
isTablet: boolean;
|
|
15
|
-
type: 'desktop' | 'mobile' | 'tablet' | 'unknown';
|
|
16
|
-
};
|
|
17
|
-
language: {
|
|
18
|
-
all: readonly string[];
|
|
19
|
-
primary: string;
|
|
20
|
-
};
|
|
21
|
-
metadata: {
|
|
22
|
-
referrer: string;
|
|
23
|
-
timestamp: string;
|
|
24
|
-
url: string;
|
|
25
|
-
};
|
|
26
|
-
os: {
|
|
27
|
-
name: string;
|
|
28
|
-
platform: string;
|
|
29
|
-
version: string;
|
|
30
|
-
};
|
|
31
|
-
screen: {
|
|
32
|
-
colorDepth: number;
|
|
33
|
-
height: number;
|
|
34
|
-
pixelRatio: number;
|
|
35
|
-
width: number;
|
|
36
|
-
};
|
|
37
|
-
timezone: {
|
|
38
|
-
name: string;
|
|
39
|
-
offset: number;
|
|
40
|
-
};
|
|
41
|
-
network?: {
|
|
42
|
-
connectionType?: string;
|
|
43
|
-
downlink?: number;
|
|
44
|
-
effectiveType?: string;
|
|
45
|
-
rtt?: number;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Collects comprehensive system information from the client
|
|
50
|
-
* @returns SystemInfo object with all available system details
|
|
51
|
-
*/
|
|
52
|
-
export declare function collectSystemInfo(): SystemInfo;
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.collectSystemInfo = collectSystemInfo;
|
|
4
|
-
/**
|
|
5
|
-
* Array of browser detection configurations, ordered by specificity
|
|
6
|
-
* (more specific browsers should be checked first)
|
|
7
|
-
*/
|
|
8
|
-
const browserConfigs = [
|
|
9
|
-
{
|
|
10
|
-
name: 'Chrome',
|
|
11
|
-
versionRegex: /Chrome\/(\d+\.\d+)/,
|
|
12
|
-
test: (userAgent) => userAgent.includes('Chrome') && !userAgent.includes('Edg'),
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: 'Firefox',
|
|
16
|
-
versionRegex: /Firefox\/(\d+\.\d+)/,
|
|
17
|
-
test: (userAgent) => userAgent.includes('Firefox'),
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: 'Safari',
|
|
21
|
-
versionRegex: /Version\/(\d+\.\d+)/,
|
|
22
|
-
test: (userAgent) => userAgent.includes('Safari') && !userAgent.includes('Chrome'),
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: 'Edge',
|
|
26
|
-
versionRegex: /Edg\/(\d+\.\d+)/,
|
|
27
|
-
test: (userAgent) => userAgent.includes('Edg'),
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'Internet Explorer',
|
|
31
|
-
versionRegex: /(?:MSIE |rv:)(\d+\.\d+)/,
|
|
32
|
-
test: (userAgent) => userAgent.includes('Trident') || userAgent.includes('MSIE'),
|
|
33
|
-
},
|
|
34
|
-
];
|
|
35
|
-
/**
|
|
36
|
-
* Detects browser name and version from user agent
|
|
37
|
-
*/
|
|
38
|
-
function getBrowserInfo() {
|
|
39
|
-
const userAgent = navigator.userAgent;
|
|
40
|
-
for (const config of browserConfigs) {
|
|
41
|
-
if (config.test(userAgent)) {
|
|
42
|
-
const match = userAgent.match(config.versionRegex);
|
|
43
|
-
return {
|
|
44
|
-
name: config.name,
|
|
45
|
-
version: match ? match[1] : 'unknown',
|
|
46
|
-
userAgent,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
name: 'Unknown',
|
|
52
|
-
version: 'unknown',
|
|
53
|
-
userAgent,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Windows NT version to readable version mapping
|
|
58
|
-
*/
|
|
59
|
-
const windowsVersionMap = {
|
|
60
|
-
'10.0': '10',
|
|
61
|
-
'6.3': '8.1',
|
|
62
|
-
'6.2': '8',
|
|
63
|
-
'6.1': '7',
|
|
64
|
-
'6.0': 'Vista',
|
|
65
|
-
'5.1': 'XP',
|
|
66
|
-
'5.0': '2000',
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Array of OS detection configurations, ordered by specificity
|
|
70
|
-
* (more specific OS should be checked first)
|
|
71
|
-
*/
|
|
72
|
-
const osConfigs = [
|
|
73
|
-
{
|
|
74
|
-
name: 'Windows',
|
|
75
|
-
versionRegex: /Windows NT (\d+\.\d+)/,
|
|
76
|
-
extractVersion: (match) => {
|
|
77
|
-
if (!match) {
|
|
78
|
-
return 'unknown';
|
|
79
|
-
}
|
|
80
|
-
const ntVersion = match[1];
|
|
81
|
-
return windowsVersionMap[ntVersion] || ntVersion;
|
|
82
|
-
},
|
|
83
|
-
test: (userAgent) => userAgent.includes('Windows'),
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: 'macOS',
|
|
87
|
-
versionRegex: /Mac OS X (\d+[._]\d+)/,
|
|
88
|
-
extractVersion: (match) => {
|
|
89
|
-
return match ? match[1].replace(/_/g, '.') : 'unknown';
|
|
90
|
-
},
|
|
91
|
-
test: (userAgent) => userAgent.includes('Mac OS X'),
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
name: 'iOS',
|
|
95
|
-
versionRegex: /OS (\d+[._]\d+)/,
|
|
96
|
-
extractVersion: (match) => {
|
|
97
|
-
return match ? match[1].replace(/_/g, '.') : 'unknown';
|
|
98
|
-
},
|
|
99
|
-
test: (userAgent) => userAgent.includes('iPhone') || userAgent.includes('iPad'),
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
name: 'Android',
|
|
103
|
-
versionRegex: /Android (\d+\.\d+)/,
|
|
104
|
-
extractVersion: (match) => {
|
|
105
|
-
return match ? match[1] : 'unknown';
|
|
106
|
-
},
|
|
107
|
-
test: (userAgent) => userAgent.includes('Android'),
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: 'Linux',
|
|
111
|
-
versionRegex: null,
|
|
112
|
-
extractVersion: () => 'unknown',
|
|
113
|
-
test: (userAgent) => userAgent.includes('Linux'),
|
|
114
|
-
},
|
|
115
|
-
];
|
|
116
|
-
/**
|
|
117
|
-
* Detects operating system from user agent
|
|
118
|
-
*/
|
|
119
|
-
function getOSInfo() {
|
|
120
|
-
const userAgent = navigator.userAgent;
|
|
121
|
-
const platform = navigator.platform;
|
|
122
|
-
for (const config of osConfigs) {
|
|
123
|
-
if (config.test(userAgent)) {
|
|
124
|
-
const match = config.versionRegex
|
|
125
|
-
? userAgent.match(config.versionRegex)
|
|
126
|
-
: null;
|
|
127
|
-
return {
|
|
128
|
-
name: config.name,
|
|
129
|
-
version: config.extractVersion(match),
|
|
130
|
-
platform,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return {
|
|
135
|
-
name: 'Unknown',
|
|
136
|
-
version: 'unknown',
|
|
137
|
-
platform,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Detects device type and characteristics
|
|
142
|
-
*/
|
|
143
|
-
function getDeviceInfo() {
|
|
144
|
-
const userAgent = navigator.userAgent;
|
|
145
|
-
const isTablet = /iPad|Android(?!.*Mobile)/i.test(userAgent);
|
|
146
|
-
const isMobile = /Android.*Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
|
|
147
|
-
const isDesktop = !isMobile && !isTablet;
|
|
148
|
-
let type = 'unknown';
|
|
149
|
-
if (isMobile) {
|
|
150
|
-
type = 'mobile';
|
|
151
|
-
}
|
|
152
|
-
else if (isTablet) {
|
|
153
|
-
type = 'tablet';
|
|
154
|
-
}
|
|
155
|
-
else if (isDesktop) {
|
|
156
|
-
type = 'desktop';
|
|
157
|
-
}
|
|
158
|
-
return {
|
|
159
|
-
type,
|
|
160
|
-
isMobile,
|
|
161
|
-
isTablet,
|
|
162
|
-
isDesktop,
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Gets screen information
|
|
167
|
-
*/
|
|
168
|
-
function getScreenInfo() {
|
|
169
|
-
return {
|
|
170
|
-
width: screen.width,
|
|
171
|
-
height: screen.height,
|
|
172
|
-
colorDepth: screen.colorDepth,
|
|
173
|
-
pixelRatio: window.devicePixelRatio || 1,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Gets network information if available
|
|
178
|
-
*/
|
|
179
|
-
function getNetworkInfo() {
|
|
180
|
-
// Cast navigator to our extended interface to access network connection properties
|
|
181
|
-
const nav = navigator;
|
|
182
|
-
const connection = nav.connection || nav.mozConnection || nav.webkitConnection;
|
|
183
|
-
if (connection) {
|
|
184
|
-
return {
|
|
185
|
-
connectionType: connection.type,
|
|
186
|
-
effectiveType: connection.effectiveType,
|
|
187
|
-
downlink: connection.downlink,
|
|
188
|
-
rtt: connection.rtt,
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
return undefined;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Gets timezone information
|
|
195
|
-
*/
|
|
196
|
-
function getTimezoneInfo() {
|
|
197
|
-
const now = new Date();
|
|
198
|
-
const offset = -now.getTimezoneOffset() / 60; // Convert to hours
|
|
199
|
-
const name = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
200
|
-
return {
|
|
201
|
-
offset,
|
|
202
|
-
name,
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Gets language information
|
|
207
|
-
*/
|
|
208
|
-
function getLanguageInfo() {
|
|
209
|
-
const languages = navigator.languages != null
|
|
210
|
-
? Array.from(navigator.languages)
|
|
211
|
-
: [navigator.language];
|
|
212
|
-
return {
|
|
213
|
-
primary: navigator.language,
|
|
214
|
-
all: languages,
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Gets additional metadata
|
|
219
|
-
*/
|
|
220
|
-
function getMetadata() {
|
|
221
|
-
return {
|
|
222
|
-
timestamp: new Date().toISOString(),
|
|
223
|
-
url: window.location.href,
|
|
224
|
-
referrer: document.referrer,
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Collects comprehensive system information from the client
|
|
229
|
-
* @returns SystemInfo object with all available system details
|
|
230
|
-
*/
|
|
231
|
-
function collectSystemInfo() {
|
|
232
|
-
return {
|
|
233
|
-
browser: getBrowserInfo(),
|
|
234
|
-
os: getOSInfo(),
|
|
235
|
-
device: getDeviceInfo(),
|
|
236
|
-
screen: getScreenInfo(),
|
|
237
|
-
network: getNetworkInfo(),
|
|
238
|
-
timezone: getTimezoneInfo(),
|
|
239
|
-
language: getLanguageInfo(),
|
|
240
|
-
metadata: getMetadata(),
|
|
241
|
-
};
|
|
242
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { RootState } from '../../../reducer';
|
|
3
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
-
import { updateLoggedInUser, verifyDeviceWithTwoFA, verifyDeviceWithTwoFAFailure, verifyDeviceWithTwoFASuccess } from '../tenantReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof verifyDeviceWithTwoFA> | ReturnType<typeof updateLoggedInUser> | ReturnType<typeof verifyDeviceWithTwoFASuccess> | ReturnType<typeof verifyDeviceWithTwoFAFailure>;
|
|
6
|
-
export declare const verifyDeviceWithTwoFAEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
|
-
payload: {
|
|
8
|
-
userPayload: import("../tenantPayload").LoggedInUserPayload;
|
|
9
|
-
zeniSessionId: string;
|
|
10
|
-
authProvider: import("../tenantReducer").AuthProvider;
|
|
11
|
-
};
|
|
12
|
-
type: "tenant/updateLoggedInUser";
|
|
13
|
-
} | {
|
|
14
|
-
payload: {
|
|
15
|
-
userId: string;
|
|
16
|
-
zeniSessionId: string | undefined;
|
|
17
|
-
};
|
|
18
|
-
type: "tenant/fetchAllTenants";
|
|
19
|
-
} | {
|
|
20
|
-
payload: {
|
|
21
|
-
userId: string;
|
|
22
|
-
sessionId: string;
|
|
23
|
-
};
|
|
24
|
-
type: "tenant/verifyDeviceWithTwoFASuccess";
|
|
25
|
-
} | {
|
|
26
|
-
payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
27
|
-
type: "tenant/verifyDeviceWithTwoFAFailure";
|
|
28
|
-
}>;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verifyDeviceWithTwoFAEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const systemInfo_1 = require("../../../commonStateTypes/systemInfo");
|
|
7
|
-
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
-
const tenantReducer_1 = require("../tenantReducer");
|
|
9
|
-
const toRequestPayload = (otp, deviceId, userEmail, otpChallenge) => {
|
|
10
|
-
const systemInfo = (0, systemInfo_1.collectSystemInfo)();
|
|
11
|
-
return {
|
|
12
|
-
device_id: deviceId,
|
|
13
|
-
auth_type: 'magic_links',
|
|
14
|
-
otp_code: otp,
|
|
15
|
-
device_info: systemInfo,
|
|
16
|
-
otp_challenge: otpChallenge,
|
|
17
|
-
user_email: userEmail,
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
const verifyDeviceWithTwoFAEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.verifyDeviceWithTwoFA.match), (0, operators_1.switchMap)((action) => {
|
|
21
|
-
const { otp, deviceId, otpChallenge, userEmail } = action.payload;
|
|
22
|
-
return zeniAPI
|
|
23
|
-
.postJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/signin`, toRequestPayload(otp, deviceId, userEmail, otpChallenge))
|
|
24
|
-
.pipe((0, operators_1.concatMap)((response) => {
|
|
25
|
-
return (0, rxjs_1.from)(response.json()).pipe((0, operators_1.mergeMap)((responseJson) => {
|
|
26
|
-
const signInResponse = responseJson;
|
|
27
|
-
const sessionId = response.headers.get('zeni-session-id');
|
|
28
|
-
if (response.ok &&
|
|
29
|
-
(0, responsePayload_1.isSuccessResponse)(responseJson) &&
|
|
30
|
-
signInResponse.data != null &&
|
|
31
|
-
signInResponse.data.user != null &&
|
|
32
|
-
sessionId != null) {
|
|
33
|
-
return (0, rxjs_1.of)((0, tenantReducer_1.updateLoggedInUser)(signInResponse.data.user, sessionId, 'email'), (0, tenantReducer_1.verifyDeviceWithTwoFASuccess)(signInResponse.data.user.user_id, sessionId), (0, tenantReducer_1.fetchAllTenants)(signInResponse.data.user.user_id, sessionId));
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
return (0, rxjs_1.of)((0, tenantReducer_1.verifyDeviceWithTwoFAFailure)(responseJson.status));
|
|
37
|
-
}
|
|
38
|
-
}));
|
|
39
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, tenantReducer_1.verifyDeviceWithTwoFAFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Verify device with two FA API call errored out: ' +
|
|
40
|
-
JSON.stringify(error))))));
|
|
41
|
-
}));
|
|
42
|
-
exports.verifyDeviceWithTwoFAEpic = verifyDeviceWithTwoFAEpic;
|