woodsportal-client-sdk 4.0.7-dev.9 → 4.0.8-dev.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/README.md +26 -0
- package/dist/adapters/angular/index.js +7 -5
- package/dist/adapters/angular/index.js.map +1 -1
- package/dist/adapters/native/index.d.ts +3 -0
- package/dist/adapters/native/index.js +11 -0
- package/dist/adapters/native/index.js.map +1 -0
- package/dist/adapters/react/index.d.ts +1 -1
- package/dist/adapters/react/index.js +8 -18
- package/dist/adapters/react/index.js.map +1 -1
- package/dist/adapters/vue/index.js +7 -5
- package/dist/adapters/vue/index.js.map +1 -1
- package/dist/auth-interceptor-policy-RGQ26NWR.js +6 -0
- package/dist/{auth-interceptor-policy-CKXBTGBT.js.map → auth-interceptor-policy-RGQ26NWR.js.map} +1 -1
- package/dist/auth-utils-T4FIBK3O.js +7 -0
- package/dist/{auth-utils-LT4JXJER.js.map → auth-utils-T4FIBK3O.js.map} +1 -1
- package/dist/{http-errors-CCCQECil.d.ts → build-error-description-DUXvNW7O.d.ts} +57 -6
- package/dist/{chunk-GKSO3757.js → chunk-5LISZE2R.js} +10 -6
- package/dist/chunk-5LISZE2R.js.map +1 -0
- package/dist/{chunk-Q7Y4HMVO.js → chunk-AVMMEQLO.js} +3 -3
- package/dist/{chunk-Q7Y4HMVO.js.map → chunk-AVMMEQLO.js.map} +1 -1
- package/dist/{chunk-WDCI5FXV.js → chunk-C73AH5CW.js} +173 -102
- package/dist/chunk-C73AH5CW.js.map +1 -0
- package/dist/chunk-DB6W3CJT.js +73 -0
- package/dist/chunk-DB6W3CJT.js.map +1 -0
- package/dist/{chunk-7AAQISX7.js → chunk-ETYE73AH.js} +35 -8
- package/dist/chunk-ETYE73AH.js.map +1 -0
- package/dist/{chunk-PRGN3FF6.js → chunk-JG3TEXWP.js} +7 -11
- package/dist/chunk-JG3TEXWP.js.map +1 -0
- package/dist/{chunk-6XIX6R4X.js → chunk-KPHAQNS2.js} +50 -5
- package/dist/chunk-KPHAQNS2.js.map +1 -0
- package/dist/{chunk-5NONTYJA.js → chunk-NDDE6ZZ3.js} +272 -86
- package/dist/chunk-NDDE6ZZ3.js.map +1 -0
- package/dist/{chunk-N7TNFXKZ.js → chunk-QXUSO7MR.js} +15 -9
- package/dist/chunk-QXUSO7MR.js.map +1 -0
- package/dist/{chunk-3YGYCBUT.js → chunk-VN6VPM5C.js} +4 -4
- package/dist/{chunk-3YGYCBUT.js.map → chunk-VN6VPM5C.js.map} +1 -1
- package/dist/chunk-YJOQG7DQ.js +1272 -0
- package/dist/chunk-YJOQG7DQ.js.map +1 -0
- package/dist/chunk-ZEGKRQA4.js +16 -0
- package/dist/chunk-ZEGKRQA4.js.map +1 -0
- package/dist/cross-tab-session-B34BLQU4.js +11 -0
- package/dist/{cross-tab-session-2HVBZQD3.js.map → cross-tab-session-B34BLQU4.js.map} +1 -1
- package/dist/entries/auth.d.ts +4 -3
- package/dist/entries/auth.js +9 -8
- package/dist/entries/auth.js.map +1 -1
- package/dist/entries/crm.d.ts +3 -3
- package/dist/entries/crm.js +10 -9
- package/dist/entries/crm.js.map +1 -1
- package/dist/{index-Bh9eY8sA.d.ts → index-DhoGEpj3.d.ts} +9 -1
- package/dist/index.d.ts +44 -7
- package/dist/index.js +70 -17
- package/dist/index.js.map +1 -1
- package/dist/{pipeline-ui-DbEzI_v1.d.ts → pipeline-ui-Bdrqupf0.d.ts} +2 -2
- package/dist/storage-migration-2PF52ZSB.js +4 -0
- package/dist/{storage-migration-2NVJ3GNQ.js.map → storage-migration-2PF52ZSB.js.map} +1 -1
- package/package.json +6 -1
- package/dist/auth-interceptor-policy-CKXBTGBT.js +0 -5
- package/dist/auth-utils-LT4JXJER.js +0 -5
- package/dist/chunk-5NONTYJA.js.map +0 -1
- package/dist/chunk-6XIX6R4X.js.map +0 -1
- package/dist/chunk-7AAQISX7.js.map +0 -1
- package/dist/chunk-GKSO3757.js.map +0 -1
- package/dist/chunk-N7TNFXKZ.js.map +0 -1
- package/dist/chunk-PRGN3FF6.js.map +0 -1
- package/dist/chunk-WDCI5FXV.js.map +0 -1
- package/dist/chunk-YKYHYW5F.js +0 -737
- package/dist/chunk-YKYHYW5F.js.map +0 -1
- package/dist/cross-tab-session-2HVBZQD3.js +0 -9
- package/dist/storage-migration-2NVJ3GNQ.js +0 -4
package/dist/chunk-YKYHYW5F.js
DELETED
|
@@ -1,737 +0,0 @@
|
|
|
1
|
-
import { getAuthRefreshToken, createMutation, Client } from './chunk-WDCI5FXV.js';
|
|
2
|
-
import { getParam, actions6 } from './chunk-7AAQISX7.js';
|
|
3
|
-
import { hasRefreshSession, isAccessTokenExpired, hydrateSessionRefreshState, clearSessionRefreshExhaustedState, resetSessionAuthState, isRefreshInFlight, isSessionRefreshExhausted, didLastRefreshFail, hasValidAccessToken, isExpiresAccessToken, isAuthenticateApp, isAuthenticated, clearAccessToken, setAccessToken, getAccessToken, refreshSession, getRefreshToken, clearRefreshToken, storeMfaPendingAccessToken, logger, setPortal, setSubscriptionType, setRefreshToken, setLoggedInDetails, setConfig, clearMfaPendingAccessToken } from './chunk-5NONTYJA.js';
|
|
4
|
-
import { isCookieExpired, clearClientAuthCookies } from './chunk-6XIX6R4X.js';
|
|
5
|
-
|
|
6
|
-
// src/main/core/auth/session-contract.ts
|
|
7
|
-
function hasValidAccess(input) {
|
|
8
|
-
return input.hasAccessToken() && !input.isAccessTokenExpired();
|
|
9
|
-
}
|
|
10
|
-
function isFullyAuthenticated(input) {
|
|
11
|
-
if (input.isMfaPending?.()) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
if (hasValidAccess(input)) {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
return input.hasRefreshSession();
|
|
18
|
-
}
|
|
19
|
-
function isMfaPendingSession(input) {
|
|
20
|
-
return Boolean(input.isMfaPending?.());
|
|
21
|
-
}
|
|
22
|
-
function hasAuthenticatedAccess(input) {
|
|
23
|
-
if (input.isMfaPending?.()) {
|
|
24
|
-
return Boolean(input.hasAccessToken());
|
|
25
|
-
}
|
|
26
|
-
return hasValidAccess(input);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// src/main/core/http/session-persistence-error.ts
|
|
30
|
-
var SessionPersistenceError = class extends Error {
|
|
31
|
-
constructor(message) {
|
|
32
|
-
super(message);
|
|
33
|
-
this.name = "SessionPersistenceError";
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// src/main/core/http/login-session.ts
|
|
38
|
-
function unwrapLoginBody(response) {
|
|
39
|
-
return response?.data ?? response ?? {};
|
|
40
|
-
}
|
|
41
|
-
async function completeLoginSession(response) {
|
|
42
|
-
const body = unwrapLoginBody(response);
|
|
43
|
-
const tokenData = body?.tokenData || {};
|
|
44
|
-
const loggedInDetails = body?.loggedInDetails || {};
|
|
45
|
-
const currentPortal = loggedInDetails?.currentPortal || {};
|
|
46
|
-
const currentPortalId = currentPortal?.portalId || null;
|
|
47
|
-
const subscriptionType = loggedInDetails?.subscriptionType || "BASIC";
|
|
48
|
-
const token = tokenData?.token;
|
|
49
|
-
const refreshToken = tokenData?.refreshToken;
|
|
50
|
-
const expiresIn = tokenData?.expiresIn;
|
|
51
|
-
const refreshExpiresAt = tokenData?.refreshExpiresAt;
|
|
52
|
-
const rExpiresIn = tokenData?.refreshExpiresIn;
|
|
53
|
-
if (!token || typeof token !== "string") {
|
|
54
|
-
logger.error("auth", "login session missing access token", { operation: "completeLoginSession" });
|
|
55
|
-
throw new SessionPersistenceError("Session persistence failed: missing access token in login response");
|
|
56
|
-
}
|
|
57
|
-
if (!refreshToken || typeof refreshToken !== "string") {
|
|
58
|
-
logger.error("auth", "login session missing refresh token", { operation: "completeLoginSession" });
|
|
59
|
-
throw new SessionPersistenceError("Session persistence failed: missing refresh token in login response");
|
|
60
|
-
}
|
|
61
|
-
setPortal(currentPortal);
|
|
62
|
-
setSubscriptionType(subscriptionType);
|
|
63
|
-
await setAccessToken(token, expiresIn);
|
|
64
|
-
await setRefreshToken(refreshToken, refreshExpiresAt ?? rExpiresIn);
|
|
65
|
-
await setLoggedInDetails(body);
|
|
66
|
-
actions6.setProfile(response?.data != null ? response : { data: body });
|
|
67
|
-
setConfig.setDevPortalId(currentPortalId);
|
|
68
|
-
clearMfaPendingAccessToken("c");
|
|
69
|
-
return response;
|
|
70
|
-
}
|
|
71
|
-
async function applyLoginResponse(response) {
|
|
72
|
-
const data = unwrapLoginBody(response);
|
|
73
|
-
if (data?.twoFactorRequired === true) {
|
|
74
|
-
const tokenData = data?.tokenData || {};
|
|
75
|
-
const token = tokenData?.token;
|
|
76
|
-
const expiresIn = tokenData?.expiresIn;
|
|
77
|
-
if (token) {
|
|
78
|
-
clearRefreshToken();
|
|
79
|
-
await setAccessToken(token, expiresIn);
|
|
80
|
-
storeMfaPendingAccessToken(token, expiresIn, "c");
|
|
81
|
-
}
|
|
82
|
-
return response;
|
|
83
|
-
}
|
|
84
|
-
return completeLoginSession(response);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// src/main/features/auth/api/authentication.ts
|
|
88
|
-
function preLogin(options) {
|
|
89
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
90
|
-
const response = await Client.authentication.preLogin(payload);
|
|
91
|
-
return response;
|
|
92
|
-
}, options);
|
|
93
|
-
return {
|
|
94
|
-
mutate,
|
|
95
|
-
preLogin: mutate,
|
|
96
|
-
isLoading
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
function login(options) {
|
|
100
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
101
|
-
const response = await Client.authentication.login(payload);
|
|
102
|
-
await applyLoginResponse(response);
|
|
103
|
-
return response;
|
|
104
|
-
}, options);
|
|
105
|
-
return {
|
|
106
|
-
mutate,
|
|
107
|
-
login: mutate,
|
|
108
|
-
isLoading
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
function handoff(options) {
|
|
112
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
113
|
-
const response = await Client.authentication.handoff(payload);
|
|
114
|
-
await applyLoginResponse(response);
|
|
115
|
-
return response;
|
|
116
|
-
}, options);
|
|
117
|
-
return {
|
|
118
|
-
mutate,
|
|
119
|
-
handoff: mutate,
|
|
120
|
-
isLoading
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
function clientSession(options) {
|
|
124
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
125
|
-
const response = await Client.authentication.clientSession(payload);
|
|
126
|
-
await applyLoginResponse(response);
|
|
127
|
-
return response;
|
|
128
|
-
}, options);
|
|
129
|
-
return {
|
|
130
|
-
mutate,
|
|
131
|
-
clientSession: mutate,
|
|
132
|
-
isLoading
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
function register(options) {
|
|
136
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
137
|
-
const response = await Client.authentication.register(payload);
|
|
138
|
-
return response;
|
|
139
|
-
}, options);
|
|
140
|
-
return {
|
|
141
|
-
mutate,
|
|
142
|
-
register: mutate,
|
|
143
|
-
isLoading
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
function verifyEmail(options) {
|
|
147
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
148
|
-
const verifyEmailPayload = payload || {};
|
|
149
|
-
const token = getParam("token");
|
|
150
|
-
if (!verifyEmailPayload?.token) verifyEmailPayload.token = token;
|
|
151
|
-
const response = await Client.authentication.verifyEmail(verifyEmailPayload);
|
|
152
|
-
return response;
|
|
153
|
-
}, options);
|
|
154
|
-
return {
|
|
155
|
-
mutate,
|
|
156
|
-
verifyEmail: mutate,
|
|
157
|
-
isLoading
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
function resetPasswordVerifyToken(options) {
|
|
161
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
162
|
-
const resetPasswordVerifyTokenPayload = payload || {};
|
|
163
|
-
const token = getParam("token");
|
|
164
|
-
if (!resetPasswordVerifyTokenPayload?.token) resetPasswordVerifyTokenPayload.token = token;
|
|
165
|
-
const response = await Client.authentication.resetPasswordVerifyToken(resetPasswordVerifyTokenPayload);
|
|
166
|
-
return response;
|
|
167
|
-
}, options);
|
|
168
|
-
return {
|
|
169
|
-
mutate,
|
|
170
|
-
resetPasswordVerifyToken: mutate,
|
|
171
|
-
isLoading
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
function resetPassword(options) {
|
|
175
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
176
|
-
const response = await Client.authentication.resetPassword(payload);
|
|
177
|
-
return response;
|
|
178
|
-
}, options);
|
|
179
|
-
return {
|
|
180
|
-
mutate,
|
|
181
|
-
resetPassword: mutate,
|
|
182
|
-
isLoading
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
function forgetPassword(options) {
|
|
186
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
187
|
-
const response = await Client.authentication.forgetPassword(payload);
|
|
188
|
-
return response;
|
|
189
|
-
}, options);
|
|
190
|
-
return {
|
|
191
|
-
mutate,
|
|
192
|
-
forgetPassword: mutate,
|
|
193
|
-
isLoading
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
function logout(options) {
|
|
197
|
-
const { mutate, isLoading } = createMutation(async () => {
|
|
198
|
-
try {
|
|
199
|
-
const response = await Client.authentication.logout();
|
|
200
|
-
return response;
|
|
201
|
-
} finally {
|
|
202
|
-
clearAccessToken();
|
|
203
|
-
clearClientAuthCookies();
|
|
204
|
-
}
|
|
205
|
-
}, options);
|
|
206
|
-
return {
|
|
207
|
-
mutate,
|
|
208
|
-
logout: mutate,
|
|
209
|
-
isLoading
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
function registerExistingUser(options) {
|
|
213
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
214
|
-
const response = await Client.authentication.registerExistingUser(payload);
|
|
215
|
-
return response;
|
|
216
|
-
}, options);
|
|
217
|
-
return {
|
|
218
|
-
mutate,
|
|
219
|
-
registerExistingUser: mutate,
|
|
220
|
-
isLoading
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
function verifyEmailResend(options) {
|
|
224
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
225
|
-
const response = await Client.authentication.verifyEmailResend(payload);
|
|
226
|
-
return response;
|
|
227
|
-
}, options);
|
|
228
|
-
return {
|
|
229
|
-
mutate,
|
|
230
|
-
verifyEmailResend: mutate,
|
|
231
|
-
isLoading
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
function resendEmail(options) {
|
|
235
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
236
|
-
const response = await Client.authentication.resendEmail(payload);
|
|
237
|
-
return response;
|
|
238
|
-
}, options);
|
|
239
|
-
return {
|
|
240
|
-
mutate,
|
|
241
|
-
resendEmail: mutate,
|
|
242
|
-
isLoading
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// src/main/features/auth/api/mfa.ts
|
|
247
|
-
function verifyOtp(options) {
|
|
248
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
249
|
-
const response = await Client.authentication.verifyOtp(payload);
|
|
250
|
-
await applyLoginResponse(response);
|
|
251
|
-
return response;
|
|
252
|
-
}, options);
|
|
253
|
-
return { mutate, verifyOtp: mutate, isLoading };
|
|
254
|
-
}
|
|
255
|
-
function sendMfaOtp(options) {
|
|
256
|
-
const { mutate, isLoading } = createMutation(
|
|
257
|
-
async (payload) => Client.mfa.sendPendingOtp(payload),
|
|
258
|
-
options
|
|
259
|
-
);
|
|
260
|
-
return { mutate, sendOtp: mutate, sendMfaOtp: mutate, isLoading };
|
|
261
|
-
}
|
|
262
|
-
function pendingPasskeyOptions(options) {
|
|
263
|
-
const { mutate, isLoading } = createMutation(
|
|
264
|
-
async (payload) => Client.mfa.pendingPasskeyOptions(payload),
|
|
265
|
-
options
|
|
266
|
-
);
|
|
267
|
-
return { mutate, pendingPasskeyOptions: mutate, isLoading };
|
|
268
|
-
}
|
|
269
|
-
function pendingPasskeyVerify(options) {
|
|
270
|
-
const { mutate, isLoading } = createMutation(
|
|
271
|
-
async (payload) => {
|
|
272
|
-
const response = await Client.mfa.pendingPasskeyVerify(payload);
|
|
273
|
-
await applyLoginResponse(response);
|
|
274
|
-
return response;
|
|
275
|
-
},
|
|
276
|
-
options
|
|
277
|
-
);
|
|
278
|
-
return { mutate, pendingPasskeyVerify: mutate, isLoading };
|
|
279
|
-
}
|
|
280
|
-
function getMfaStatus(options) {
|
|
281
|
-
const { mutate, isLoading } = createMutation(
|
|
282
|
-
async (payload) => await Client.mfa.getStatus(payload),
|
|
283
|
-
options
|
|
284
|
-
);
|
|
285
|
-
return { mutate, getStatus: mutate, getMfaStatus: mutate, isLoading };
|
|
286
|
-
}
|
|
287
|
-
function setMfaPreferences(options) {
|
|
288
|
-
const { mutate, isLoading } = createMutation(
|
|
289
|
-
async (payload) => {
|
|
290
|
-
const { portalId, ...data } = payload;
|
|
291
|
-
return Client.mfa.setPreferences(data, { portalId });
|
|
292
|
-
},
|
|
293
|
-
options
|
|
294
|
-
);
|
|
295
|
-
return { mutate, setPreferences: mutate, setMfaPreferences: mutate, isLoading };
|
|
296
|
-
}
|
|
297
|
-
function startPhoneVerify(options) {
|
|
298
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
299
|
-
const { portalId, ...data } = payload ?? { phone: "" };
|
|
300
|
-
return Client.mfa.startPhoneVerify(data, portalId != null ? { portalId } : void 0);
|
|
301
|
-
}, options);
|
|
302
|
-
return { mutate, startPhoneVerify: mutate, isLoading };
|
|
303
|
-
}
|
|
304
|
-
function confirmPhoneVerify(options) {
|
|
305
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
306
|
-
const { portalId, ...data } = payload ?? { phone: "", code: "" };
|
|
307
|
-
return Client.mfa.confirmPhoneVerify(data, portalId != null ? { portalId } : void 0);
|
|
308
|
-
}, options);
|
|
309
|
-
return { mutate, confirmPhoneVerify: mutate, isLoading };
|
|
310
|
-
}
|
|
311
|
-
function totpEnrollStart(options) {
|
|
312
|
-
const { mutate, isLoading } = createMutation(async (payload) => Client.mfa.totpEnrollStart(payload), options);
|
|
313
|
-
return { mutate, totpEnrollStart: mutate, isLoading };
|
|
314
|
-
}
|
|
315
|
-
function totpEnrollVerify(options) {
|
|
316
|
-
const { mutate, isLoading } = createMutation(
|
|
317
|
-
async (payload) => Client.mfa.totpEnrollVerify(payload),
|
|
318
|
-
options
|
|
319
|
-
);
|
|
320
|
-
return { mutate, totpEnrollVerify: mutate, isLoading };
|
|
321
|
-
}
|
|
322
|
-
function totpDisable(options) {
|
|
323
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
324
|
-
const { portalId, ...data } = payload;
|
|
325
|
-
return Client.mfa.totpDisable(data, { portalId });
|
|
326
|
-
}, options);
|
|
327
|
-
return { mutate, totpDisable: mutate, isLoading };
|
|
328
|
-
}
|
|
329
|
-
function phoneUnverify(options) {
|
|
330
|
-
const { mutate, isLoading } = createMutation(
|
|
331
|
-
async (payload) => {
|
|
332
|
-
const { portalId, ...data } = payload;
|
|
333
|
-
return Client.mfa.phoneUnverify(data, { portalId });
|
|
334
|
-
},
|
|
335
|
-
options
|
|
336
|
-
);
|
|
337
|
-
return { mutate, phoneUnverify: mutate, isLoading };
|
|
338
|
-
}
|
|
339
|
-
function backupCodesRegenerate(options) {
|
|
340
|
-
const { mutate, isLoading } = createMutation(
|
|
341
|
-
async (payload) => {
|
|
342
|
-
const { portalId, ...data } = payload;
|
|
343
|
-
return Client.mfa.backupCodesRegenerate(data, { portalId });
|
|
344
|
-
},
|
|
345
|
-
options
|
|
346
|
-
);
|
|
347
|
-
return { mutate, backupCodesRegenerate: mutate, isLoading };
|
|
348
|
-
}
|
|
349
|
-
function mfaOptOut(options) {
|
|
350
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
351
|
-
const { portalId, ...data } = payload;
|
|
352
|
-
return Client.mfa.optOut(data, { portalId });
|
|
353
|
-
}, options);
|
|
354
|
-
return { mutate, optOut: mutate, mfaOptOut: mutate, isLoading };
|
|
355
|
-
}
|
|
356
|
-
function webauthnRegisterOptions(options) {
|
|
357
|
-
const { mutate, isLoading } = createMutation(
|
|
358
|
-
async (payload) => Client.mfa.webauthnRegisterOptions(payload),
|
|
359
|
-
options
|
|
360
|
-
);
|
|
361
|
-
return { mutate, webauthnRegisterOptions: mutate, isLoading };
|
|
362
|
-
}
|
|
363
|
-
function webauthnRegisterVerify(options) {
|
|
364
|
-
const { mutate, isLoading } = createMutation(
|
|
365
|
-
async (payload) => Client.mfa.webauthnRegisterVerify(payload),
|
|
366
|
-
options
|
|
367
|
-
);
|
|
368
|
-
return { mutate, webauthnRegisterVerify: mutate, isLoading };
|
|
369
|
-
}
|
|
370
|
-
function webauthnAuthOptions(options) {
|
|
371
|
-
const { mutate, isLoading } = createMutation(async (payload) => Client.mfa.webauthnAuthOptions(payload), options);
|
|
372
|
-
return { mutate, webauthnAuthOptions: mutate, isLoading };
|
|
373
|
-
}
|
|
374
|
-
function webauthnAuthVerify(options) {
|
|
375
|
-
const { mutate, isLoading } = createMutation(
|
|
376
|
-
async (payload) => Client.mfa.webauthnAuthVerify(payload),
|
|
377
|
-
options
|
|
378
|
-
);
|
|
379
|
-
return { mutate, webauthnAuthVerify: mutate, isLoading };
|
|
380
|
-
}
|
|
381
|
-
function listWebauthnCredentials(options) {
|
|
382
|
-
const { mutate, isLoading } = createMutation(
|
|
383
|
-
async (payload) => Client.mfa.listWebauthnCredentials(payload),
|
|
384
|
-
options
|
|
385
|
-
);
|
|
386
|
-
return { mutate, listWebauthnCredentials: mutate, isLoading };
|
|
387
|
-
}
|
|
388
|
-
function deleteWebauthnCredential(options) {
|
|
389
|
-
const { mutate, isLoading } = createMutation(
|
|
390
|
-
async (payload) => {
|
|
391
|
-
const { credentialRecordId, portalId } = payload;
|
|
392
|
-
return Client.mfa.deleteWebauthnCredential(credentialRecordId, { portalId });
|
|
393
|
-
},
|
|
394
|
-
options
|
|
395
|
-
);
|
|
396
|
-
return { mutate, deleteWebauthnCredential: mutate, isLoading };
|
|
397
|
-
}
|
|
398
|
-
function passkeyLoginOptions(options) {
|
|
399
|
-
const { mutate, isLoading } = createMutation(
|
|
400
|
-
async (payload) => Client.mfa.passkeyLoginOptions(payload),
|
|
401
|
-
options
|
|
402
|
-
);
|
|
403
|
-
return { mutate, passkeyLoginOptions: mutate, isLoading };
|
|
404
|
-
}
|
|
405
|
-
function passkeyLoginVerify(options) {
|
|
406
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
407
|
-
const response = await Client.mfa.passkeyLoginVerify(payload);
|
|
408
|
-
await applyLoginResponse(response);
|
|
409
|
-
return response;
|
|
410
|
-
}, options);
|
|
411
|
-
return { mutate, passkeyLoginVerify: mutate, isLoading };
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
// src/main/features/auth/api/security.ts
|
|
415
|
-
function getSecurityOverview(options) {
|
|
416
|
-
const { mutate, isLoading } = createMutation(
|
|
417
|
-
async (payload) => Client.security.getOverview(payload),
|
|
418
|
-
options
|
|
419
|
-
);
|
|
420
|
-
return { mutate, getOverview: mutate, getSecurityOverview: mutate, isLoading };
|
|
421
|
-
}
|
|
422
|
-
function getSecurityLoginActivity(options) {
|
|
423
|
-
const { mutate, isLoading } = createMutation(
|
|
424
|
-
async (payload) => Client.security.getLoginActivity(payload),
|
|
425
|
-
options
|
|
426
|
-
);
|
|
427
|
-
return { mutate, getLoginActivity: mutate, getSecurityLoginActivity: mutate, isLoading };
|
|
428
|
-
}
|
|
429
|
-
function getSecuritySessions(options) {
|
|
430
|
-
const { mutate, isLoading } = createMutation(
|
|
431
|
-
async (payload) => Client.security.getSessions(payload),
|
|
432
|
-
options
|
|
433
|
-
);
|
|
434
|
-
return { mutate, getSessions: mutate, getSecuritySessions: mutate, isLoading };
|
|
435
|
-
}
|
|
436
|
-
function revokeSecuritySession(options) {
|
|
437
|
-
const { mutate, isLoading } = createMutation(
|
|
438
|
-
async (payload) => Client.security.revokeSession(payload),
|
|
439
|
-
options
|
|
440
|
-
);
|
|
441
|
-
return { mutate, revokeSession: mutate, revokeSecuritySession: mutate, isLoading };
|
|
442
|
-
}
|
|
443
|
-
function revokeOtherSecuritySessions(options) {
|
|
444
|
-
const { mutate, isLoading } = createMutation(
|
|
445
|
-
async (payload) => Client.security.revokeOtherSessions(payload?.refreshToken),
|
|
446
|
-
options
|
|
447
|
-
);
|
|
448
|
-
return { mutate, revokeOtherSessions: mutate, revokeOtherSecuritySessions: mutate, isLoading };
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
// src/main/features/auth/api/login-bootstrap.ts
|
|
452
|
-
function getLoginBootstrap(options) {
|
|
453
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
454
|
-
const response = await Client.authentication.getLoginBootstrap(payload);
|
|
455
|
-
return response;
|
|
456
|
-
}, options);
|
|
457
|
-
return {
|
|
458
|
-
mutate,
|
|
459
|
-
getLoginBootstrap: mutate,
|
|
460
|
-
isLoading
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
// src/main/features/auth/api/sso.ts
|
|
465
|
-
function getSsoDetails(options) {
|
|
466
|
-
const { mutate, isLoading } = createMutation(async () => {
|
|
467
|
-
const response = await Client.sso.getSsoDetails();
|
|
468
|
-
return response;
|
|
469
|
-
}, options);
|
|
470
|
-
return {
|
|
471
|
-
mutate,
|
|
472
|
-
getDetails: mutate,
|
|
473
|
-
getSsoDetails: mutate,
|
|
474
|
-
isLoading
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
function generateSsoUrl(options) {
|
|
478
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
479
|
-
const response = await Client.sso.generateSsoUrl(payload);
|
|
480
|
-
return response;
|
|
481
|
-
}, options);
|
|
482
|
-
return {
|
|
483
|
-
mutate,
|
|
484
|
-
generateUrl: mutate,
|
|
485
|
-
generateSsoUrl: mutate,
|
|
486
|
-
isLoading
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
function ssoCallback(options) {
|
|
490
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
491
|
-
const response = await Client.sso.ssoCallback(payload);
|
|
492
|
-
await applyLoginResponse(response);
|
|
493
|
-
return response;
|
|
494
|
-
}, options);
|
|
495
|
-
return {
|
|
496
|
-
mutate,
|
|
497
|
-
callback: mutate,
|
|
498
|
-
ssoCallback: mutate,
|
|
499
|
-
isLoading
|
|
500
|
-
};
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
// src/main/features/auth/api/users.ts
|
|
504
|
-
var meRequestInFlight = null;
|
|
505
|
-
async function fetchMeOnce() {
|
|
506
|
-
if (!meRequestInFlight) {
|
|
507
|
-
meRequestInFlight = Client.user.me().finally(() => {
|
|
508
|
-
meRequestInFlight = null;
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
return meRequestInFlight;
|
|
512
|
-
}
|
|
513
|
-
function me(options) {
|
|
514
|
-
const { mutate, isLoading } = createMutation(async () => {
|
|
515
|
-
const response = await fetchMeOnce();
|
|
516
|
-
actions6.setProfile(response);
|
|
517
|
-
return response?.data;
|
|
518
|
-
}, options);
|
|
519
|
-
return {
|
|
520
|
-
mutate,
|
|
521
|
-
me: mutate,
|
|
522
|
-
isLoading
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
|
-
function profile(options) {
|
|
526
|
-
const { mutate, isLoading } = createMutation(async (paylaod) => {
|
|
527
|
-
const response = await Client.user.profile(paylaod);
|
|
528
|
-
return response;
|
|
529
|
-
}, options);
|
|
530
|
-
return {
|
|
531
|
-
mutate,
|
|
532
|
-
profile: mutate,
|
|
533
|
-
isLoading
|
|
534
|
-
};
|
|
535
|
-
}
|
|
536
|
-
function profileUpdate(options) {
|
|
537
|
-
const { mutate, isLoading } = createMutation(async (paylaod) => {
|
|
538
|
-
const response = await Client.user.profileUpdate(paylaod);
|
|
539
|
-
return response;
|
|
540
|
-
}, options);
|
|
541
|
-
return {
|
|
542
|
-
mutate,
|
|
543
|
-
updateProfile: mutate,
|
|
544
|
-
profileUpdate: mutate,
|
|
545
|
-
isLoading
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
function changePassword(options) {
|
|
549
|
-
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
550
|
-
const response = await Client.user.changePassword(payload);
|
|
551
|
-
return response;
|
|
552
|
-
}, options);
|
|
553
|
-
return {
|
|
554
|
-
mutate,
|
|
555
|
-
changePassword: mutate,
|
|
556
|
-
isLoading
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
// src/main/api/nested-auth-api.ts
|
|
561
|
-
var authApi = {
|
|
562
|
-
preLogin,
|
|
563
|
-
login,
|
|
564
|
-
clientSession,
|
|
565
|
-
handoff,
|
|
566
|
-
logout,
|
|
567
|
-
register,
|
|
568
|
-
verifyEmail,
|
|
569
|
-
registerExistingUser,
|
|
570
|
-
forgetPassword,
|
|
571
|
-
resetPassword,
|
|
572
|
-
resetPasswordVerifyToken,
|
|
573
|
-
verifyEmailResend,
|
|
574
|
-
resendEmail,
|
|
575
|
-
changePassword,
|
|
576
|
-
me,
|
|
577
|
-
profile,
|
|
578
|
-
updateProfile: profileUpdate,
|
|
579
|
-
mfa: {
|
|
580
|
-
verifyOtp,
|
|
581
|
-
sendOtp: sendMfaOtp,
|
|
582
|
-
pendingPasskeyOptions,
|
|
583
|
-
pendingPasskeyVerify,
|
|
584
|
-
getStatus: getMfaStatus,
|
|
585
|
-
setPreferences: setMfaPreferences,
|
|
586
|
-
startPhoneVerify,
|
|
587
|
-
confirmPhoneVerify,
|
|
588
|
-
totpEnrollStart,
|
|
589
|
-
totpEnrollVerify,
|
|
590
|
-
totpDisable,
|
|
591
|
-
phoneUnverify,
|
|
592
|
-
backupCodesRegenerate,
|
|
593
|
-
optOut: mfaOptOut,
|
|
594
|
-
mfaOptOut,
|
|
595
|
-
webauthnRegisterOptions,
|
|
596
|
-
webauthnRegisterVerify,
|
|
597
|
-
webauthnAuthOptions,
|
|
598
|
-
webauthnAuthVerify,
|
|
599
|
-
listWebauthnCredentials,
|
|
600
|
-
deleteWebauthnCredential,
|
|
601
|
-
passkeyLoginOptions,
|
|
602
|
-
passkeyLoginVerify
|
|
603
|
-
},
|
|
604
|
-
security: {
|
|
605
|
-
getOverview: getSecurityOverview,
|
|
606
|
-
getLoginActivity: getSecurityLoginActivity,
|
|
607
|
-
getSessions: getSecuritySessions,
|
|
608
|
-
revokeSession: revokeSecuritySession,
|
|
609
|
-
revokeOtherSessions: revokeOtherSecuritySessions
|
|
610
|
-
},
|
|
611
|
-
loginBootstrap: getLoginBootstrap,
|
|
612
|
-
sso: {
|
|
613
|
-
getDetails: getSsoDetails,
|
|
614
|
-
generateUrl: generateSsoUrl,
|
|
615
|
-
callback: ssoCallback
|
|
616
|
-
},
|
|
617
|
-
session: {
|
|
618
|
-
getRefreshToken,
|
|
619
|
-
refreshSession,
|
|
620
|
-
refreshAccessToken: getAuthRefreshToken,
|
|
621
|
-
getAccessToken,
|
|
622
|
-
setAccessToken,
|
|
623
|
-
clearAccessToken,
|
|
624
|
-
isAuthenticated,
|
|
625
|
-
isAuthenticateApp,
|
|
626
|
-
isAccessTokenExpired,
|
|
627
|
-
isExpiresAccessToken,
|
|
628
|
-
isCookieExpired,
|
|
629
|
-
hasRefreshSession,
|
|
630
|
-
hasValidAccessToken,
|
|
631
|
-
didLastRefreshFail,
|
|
632
|
-
isSessionRefreshExhausted,
|
|
633
|
-
isRefreshInFlight,
|
|
634
|
-
resetSessionAuthState,
|
|
635
|
-
clearSessionRefreshExhaustedState,
|
|
636
|
-
hydrateSessionRefreshState,
|
|
637
|
-
contract: () => ({
|
|
638
|
-
hasAccessToken: () => Boolean(getAccessToken()),
|
|
639
|
-
isAccessTokenExpired,
|
|
640
|
-
hasRefreshSession
|
|
641
|
-
}),
|
|
642
|
-
isFullyAuthenticated: () => isFullyAuthenticated({
|
|
643
|
-
hasAccessToken: () => Boolean(getAccessToken()),
|
|
644
|
-
isAccessTokenExpired,
|
|
645
|
-
hasRefreshSession
|
|
646
|
-
}),
|
|
647
|
-
hasAuthenticatedAccess: () => hasAuthenticatedAccess({
|
|
648
|
-
hasAccessToken: () => Boolean(getAccessToken()),
|
|
649
|
-
isAccessTokenExpired,
|
|
650
|
-
hasRefreshSession
|
|
651
|
-
}),
|
|
652
|
-
hasValidAccess: () => hasValidAccess({
|
|
653
|
-
hasAccessToken: () => Boolean(getAccessToken()),
|
|
654
|
-
isAccessTokenExpired,
|
|
655
|
-
hasRefreshSession
|
|
656
|
-
})
|
|
657
|
-
}
|
|
658
|
-
};
|
|
659
|
-
|
|
660
|
-
// src/main/core/auth/bootstrap-contract.ts
|
|
661
|
-
async function recoverMfaGateOnBoot(input) {
|
|
662
|
-
const hasContext = input.hasMfaContext();
|
|
663
|
-
let hasToken = input.hasAccessToken();
|
|
664
|
-
const hasRefresh = input.hasRefreshToken();
|
|
665
|
-
if (hasContext && hasToken) {
|
|
666
|
-
return "pending";
|
|
667
|
-
}
|
|
668
|
-
if (hasContext && !hasToken) {
|
|
669
|
-
const hydrated = await input.tryHydrateMfaAccessToken?.();
|
|
670
|
-
hasToken = input.hasAccessToken();
|
|
671
|
-
if (hydrated && hasToken) {
|
|
672
|
-
return "pending";
|
|
673
|
-
}
|
|
674
|
-
input.clearMfaOrphan();
|
|
675
|
-
return "orphan_cleared";
|
|
676
|
-
}
|
|
677
|
-
if (hasToken && !hasContext && !hasRefresh) {
|
|
678
|
-
input.clearStaleAccessToken();
|
|
679
|
-
return "stale_token_cleared";
|
|
680
|
-
}
|
|
681
|
-
return "none";
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
// src/main/core/auth/route-guard-contract.ts
|
|
685
|
-
function resolveAuthRouteAction(input) {
|
|
686
|
-
const {
|
|
687
|
-
pathname,
|
|
688
|
-
isPublicAuthRoute,
|
|
689
|
-
session,
|
|
690
|
-
funnel,
|
|
691
|
-
mfaRoute,
|
|
692
|
-
previewMode = false,
|
|
693
|
-
sessionRestoring = false,
|
|
694
|
-
sessionRefreshExhausted = false
|
|
695
|
-
} = input;
|
|
696
|
-
if (previewMode) {
|
|
697
|
-
return { kind: "allow" };
|
|
698
|
-
}
|
|
699
|
-
if (isMfaPendingSession(session)) {
|
|
700
|
-
if (pathname === mfaRoute) {
|
|
701
|
-
return { kind: "allow" };
|
|
702
|
-
}
|
|
703
|
-
return { kind: "redirect_mfa" };
|
|
704
|
-
}
|
|
705
|
-
if (sessionRestoring && !sessionRefreshExhausted) {
|
|
706
|
-
return { kind: "show_loader" };
|
|
707
|
-
}
|
|
708
|
-
if (sessionRefreshExhausted && !hasValidAccess(session)) {
|
|
709
|
-
if (isPublicAuthRoute(pathname)) {
|
|
710
|
-
return { kind: "allow" };
|
|
711
|
-
}
|
|
712
|
-
return { kind: "redirect_login" };
|
|
713
|
-
}
|
|
714
|
-
const authenticated = isFullyAuthenticated(session);
|
|
715
|
-
if (!authenticated) {
|
|
716
|
-
if (isPublicAuthRoute(pathname)) {
|
|
717
|
-
return { kind: "allow" };
|
|
718
|
-
}
|
|
719
|
-
return { kind: "redirect_login" };
|
|
720
|
-
}
|
|
721
|
-
if (funnel) {
|
|
722
|
-
if (funnel.emailVerified === false) {
|
|
723
|
-
return { kind: "redirect_funnel", step: "email_verify" };
|
|
724
|
-
}
|
|
725
|
-
if (!funnel.hubId) {
|
|
726
|
-
return { kind: "redirect_funnel", step: "hub_select" };
|
|
727
|
-
}
|
|
728
|
-
if (!funnel.portalId) {
|
|
729
|
-
return { kind: "redirect_funnel", step: "portal_select" };
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
return { kind: "allow" };
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
export { authApi, hasAuthenticatedAccess, hasValidAccess, isFullyAuthenticated, isMfaPendingSession, recoverMfaGateOnBoot, resolveAuthRouteAction };
|
|
736
|
-
//# sourceMappingURL=chunk-YKYHYW5F.js.map
|
|
737
|
-
//# sourceMappingURL=chunk-YKYHYW5F.js.map
|