woodsportal-client-sdk 4.0.4-dev.9 → 4.0.7-dev.1
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/adapters/angular/index.d.ts +1 -0
- package/dist/adapters/angular/index.js +6 -4
- package/dist/adapters/angular/index.js.map +1 -1
- package/dist/adapters/react/index.d.ts +1 -0
- package/dist/adapters/react/index.js +6 -4
- package/dist/adapters/react/index.js.map +1 -1
- package/dist/adapters/vue/index.d.ts +1 -0
- package/dist/adapters/vue/index.js +6 -4
- package/dist/adapters/vue/index.js.map +1 -1
- package/dist/auth-error-codes-D7CXVBEN.js +3 -0
- package/dist/auth-error-codes-D7CXVBEN.js.map +1 -0
- package/dist/auth-interceptor-policy-LU2L5NJM.js +5 -0
- package/dist/auth-interceptor-policy-LU2L5NJM.js.map +1 -0
- package/dist/auth-utils-Z5P6SMLJ.js +5 -0
- package/dist/{auth-utils-MNMC2QGX.js.map → auth-utils-Z5P6SMLJ.js.map} +1 -1
- package/dist/chunk-55MIERLJ.js +3 -0
- package/dist/chunk-55MIERLJ.js.map +1 -0
- package/dist/chunk-6YOL5LPB.js +163 -0
- package/dist/chunk-6YOL5LPB.js.map +1 -0
- package/dist/chunk-B2OVKOJU.js +633 -0
- package/dist/chunk-B2OVKOJU.js.map +1 -0
- package/dist/chunk-BKT4MFQM.js +161 -0
- package/dist/chunk-BKT4MFQM.js.map +1 -0
- package/dist/{chunk-7Q6HRCUA.js → chunk-BURJ2NUL.js} +3 -3
- package/dist/{chunk-7Q6HRCUA.js.map → chunk-BURJ2NUL.js.map} +1 -1
- package/dist/chunk-COHBSTHF.js +82 -0
- package/dist/chunk-COHBSTHF.js.map +1 -0
- package/dist/{chunk-2TG7X2ML.js → chunk-FJAOCLB4.js} +12 -11
- package/dist/chunk-FJAOCLB4.js.map +1 -0
- package/dist/chunk-GUYIJ4ZE.js +165 -0
- package/dist/chunk-GUYIJ4ZE.js.map +1 -0
- package/dist/{chunk-VCYJAVD3.js → chunk-HAXXPW65.js} +167 -13
- package/dist/chunk-HAXXPW65.js.map +1 -0
- package/dist/{chunk-IBKBTIT6.js → chunk-OFPD644E.js} +6 -6
- package/dist/{chunk-IBKBTIT6.js.map → chunk-OFPD644E.js.map} +1 -1
- package/dist/{chunk-ZEJGWZK3.js → chunk-PFOSN7EB.js} +1242 -1269
- package/dist/chunk-PFOSN7EB.js.map +1 -0
- package/dist/{chunk-4AMFPSO2.js → chunk-WNE4LSVH.js} +465 -258
- package/dist/chunk-WNE4LSVH.js.map +1 -0
- package/dist/chunk-YNOZWRK3.js +306 -0
- package/dist/chunk-YNOZWRK3.js.map +1 -0
- package/dist/cross-tab-session-TUFJ6KU7.js +9 -0
- package/dist/cross-tab-session-TUFJ6KU7.js.map +1 -0
- package/dist/entries/auth.d.ts +17 -3
- package/dist/entries/auth.js +9 -4
- package/dist/entries/auth.js.map +1 -1
- package/dist/entries/crm.d.ts +1 -0
- package/dist/entries/crm.js +10 -6
- package/dist/entries/crm.js.map +1 -1
- package/dist/{http-errors-DqdtoJ1y.d.ts → http-errors-Bwhj6cfB.d.ts} +192 -9
- package/dist/index.d.ts +141 -3
- package/dist/index.js +16 -9
- package/dist/index.js.map +1 -1
- package/dist/refresh-lock-JQVP4YOS.js +72 -0
- package/dist/refresh-lock-JQVP4YOS.js.map +1 -0
- package/dist/storage-migration-BY2QL6YD.js +4 -0
- package/dist/storage-migration-BY2QL6YD.js.map +1 -0
- package/package.json +11 -9
- package/dist/auth-utils-MNMC2QGX.js +0 -3
- package/dist/chunk-2TG7X2ML.js.map +0 -1
- package/dist/chunk-4AMFPSO2.js.map +0 -1
- package/dist/chunk-QPSCMK4W.js +0 -237
- package/dist/chunk-QPSCMK4W.js.map +0 -1
- package/dist/chunk-VCYJAVD3.js.map +0 -1
- package/dist/chunk-ZEJGWZK3.js.map +0 -1
|
@@ -1,104 +1,44 @@
|
|
|
1
|
-
import { getParamDetails, getRouteDetails, updateLink,
|
|
2
|
-
import {
|
|
1
|
+
import { getParamDetails, getRouteDetails, updateLink, getParam, decodeToBase64, generatePath, getPath, getRouteMenu, tableUiActions, ticketHubspotObjectTypeId, tableStore, actions2, userStore, fileStore, actions7, emailStore, actions5, noteStore, actions4, tableUiStore, resetAllStore, breadcrumbStage, isMessingParentLastItem, isMessingParent, generateUrl } from './chunk-PFOSN7EB.js';
|
|
2
|
+
import { configureLogger, setIframeStorageMode, setRefreshBufferSeconds, config, setRefreshCallback, hydrateSessionRefreshState, isHttpTracingEnabled, logger, getAccessToken, sanitizeAxiosErrorData, setRefreshToken, storAccessToken, storage, HUBSPOT_DATA, setRuntimeHttpClientHubContext, refreshSession, ensureValidRefresh, HUB_ID, DEV_PORTAL_ID, DEV_API_URL, isAccessTokenExpired } from './chunk-B2OVKOJU.js';
|
|
3
|
+
import { AuthErrorCode } from './chunk-COHBSTHF.js';
|
|
4
|
+
import { configureStorageKeys } from './chunk-YNOZWRK3.js';
|
|
3
5
|
import axios2 from 'axios';
|
|
4
6
|
|
|
5
|
-
// src/main/core/
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
set: (key, value) => {
|
|
37
|
-
resolveStore().setItem(key, JSON.stringify(value));
|
|
38
|
-
},
|
|
39
|
-
get: (key) => {
|
|
40
|
-
const item = resolveStore().getItem(key);
|
|
41
|
-
return item ? JSON.parse(item) : null;
|
|
42
|
-
},
|
|
43
|
-
remove: (key) => {
|
|
44
|
-
resolveStore().removeItem(key);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// src/main/core/utils/runtime-hub-context.ts
|
|
49
|
-
var initializedHubId = "";
|
|
50
|
-
var initializedDevPortalId = "";
|
|
51
|
-
var initializedDevApiUrl = "";
|
|
52
|
-
function setRuntimeHttpClientHubContext(partial) {
|
|
53
|
-
if (partial.hubId != null) {
|
|
54
|
-
initializedHubId = partial.hubId;
|
|
55
|
-
}
|
|
56
|
-
if (partial.devPortalId != null) {
|
|
57
|
-
initializedDevPortalId = partial.devPortalId;
|
|
58
|
-
}
|
|
59
|
-
if (partial.devApiUrl != null) {
|
|
60
|
-
initializedDevApiUrl = partial.devApiUrl;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function getRuntimeHttpClientHubId() {
|
|
64
|
-
return initializedHubId;
|
|
65
|
-
}
|
|
66
|
-
function getRuntimeHttpClientDevPortalId() {
|
|
67
|
-
return initializedDevPortalId;
|
|
7
|
+
// src/main/core/http/visibility-refresh-scheduler.ts
|
|
8
|
+
var visibilityStop = null;
|
|
9
|
+
function startVisibilityRefreshScheduler(options) {
|
|
10
|
+
if (typeof window === "undefined") {
|
|
11
|
+
return () => void 0;
|
|
12
|
+
}
|
|
13
|
+
visibilityStop?.();
|
|
14
|
+
const intervalMs = options.intervalMs ?? 6e4;
|
|
15
|
+
const tick = () => {
|
|
16
|
+
if (document.visibilityState !== "visible") return;
|
|
17
|
+
if (!options.shouldRefresh()) return;
|
|
18
|
+
void options.refresh();
|
|
19
|
+
};
|
|
20
|
+
const onVisibility = () => {
|
|
21
|
+
if (document.visibilityState === "visible") {
|
|
22
|
+
void tick();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const intervalId = window.setInterval(tick, intervalMs);
|
|
26
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
27
|
+
window.addEventListener("focus", onVisibility);
|
|
28
|
+
const stop = () => {
|
|
29
|
+
window.clearInterval(intervalId);
|
|
30
|
+
document.removeEventListener("visibilitychange", onVisibility);
|
|
31
|
+
window.removeEventListener("focus", onVisibility);
|
|
32
|
+
if (visibilityStop === stop) {
|
|
33
|
+
visibilityStop = null;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
visibilityStop = stop;
|
|
37
|
+
return stop;
|
|
68
38
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
39
|
+
function stopVisibilityRefreshScheduler() {
|
|
40
|
+
visibilityStop?.();
|
|
71
41
|
}
|
|
72
|
-
|
|
73
|
-
// src/main/core/utils/hub-context.ts
|
|
74
|
-
function readStorageField(key) {
|
|
75
|
-
const hubSpotData = storage.get(HUBSPOT_DATA);
|
|
76
|
-
const value = hubSpotData?.[key];
|
|
77
|
-
return value != null && String(value).trim() !== "" ? String(value) : "";
|
|
78
|
-
}
|
|
79
|
-
var config = {
|
|
80
|
-
get hubId() {
|
|
81
|
-
return readStorageField(HUB_ID) || getRuntimeHttpClientHubId();
|
|
82
|
-
},
|
|
83
|
-
get devPortalId() {
|
|
84
|
-
return readStorageField(DEV_PORTAL_ID) || getRuntimeHttpClientDevPortalId();
|
|
85
|
-
},
|
|
86
|
-
get portalId() {
|
|
87
|
-
return readStorageField(PORTAL_ID);
|
|
88
|
-
},
|
|
89
|
-
get devApiUrl() {
|
|
90
|
-
return readStorageField(DEV_API_URL) || getRuntimeHttpClientDevApiUrl();
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
var setConfig = {
|
|
94
|
-
setDevPortalId(portalId) {
|
|
95
|
-
const existing = storage.get(HUBSPOT_DATA) || {};
|
|
96
|
-
storage.set(HUBSPOT_DATA, {
|
|
97
|
-
...existing,
|
|
98
|
-
[PORTAL_ID]: portalId
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
42
|
var SERVICE_UNAVAILABLE_MESSAGE = "Service temporarily unavailable. Please try again in a few minutes.";
|
|
103
43
|
var SERVICE_UNAVAILABLE_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
104
44
|
function classifyHttpError(error) {
|
|
@@ -154,6 +94,9 @@ var editorPreviewMockHandler = null;
|
|
|
154
94
|
function setEditorPreviewMockHandler(handler) {
|
|
155
95
|
editorPreviewMockHandler = handler;
|
|
156
96
|
}
|
|
97
|
+
function isEditorPreviewMockActive() {
|
|
98
|
+
return editorPreviewMockHandler != null;
|
|
99
|
+
}
|
|
157
100
|
async function resolveEditorPreviewMock(config4) {
|
|
158
101
|
if (!editorPreviewMockHandler) {
|
|
159
102
|
return null;
|
|
@@ -167,6 +110,7 @@ var API_ENDPOINTS = {
|
|
|
167
110
|
PRE_LOGIN: "/api/auth/pre-login",
|
|
168
111
|
LOGIN: "/api/auth/login",
|
|
169
112
|
AUTH_REFRESH: "/api/auth/refresh",
|
|
113
|
+
AUTH_REFRESH_COOKIE: "/api/auth/refresh-cookie",
|
|
170
114
|
FORGET_PASSWORD: "/api/auth/forget-password",
|
|
171
115
|
RESET_PASSWORD_VERIFY_TOKEN: "/api/auth/token/validate",
|
|
172
116
|
RESET_PASSWORD: "/api/auth/reset-password",
|
|
@@ -342,6 +286,126 @@ function getHttpUrl(config4) {
|
|
|
342
286
|
// src/main/core/http/http-client.ts
|
|
343
287
|
var axiosInstance = null;
|
|
344
288
|
var config3 = {};
|
|
289
|
+
function buildAuthPolicy() {
|
|
290
|
+
const routes = config3.routes ?? {};
|
|
291
|
+
const base = config3.authPolicy ?? {};
|
|
292
|
+
return {
|
|
293
|
+
routes: {
|
|
294
|
+
unauthorized: routes.unauthorized ?? "/unauthorized",
|
|
295
|
+
login: routes.login ?? "/login",
|
|
296
|
+
twoFa: routes.twoFa ?? "/login/two-fa",
|
|
297
|
+
resendEmail: routes.resendEmail ?? "/resend-email",
|
|
298
|
+
accountSelect: routes.accountSelect ?? "/account-select",
|
|
299
|
+
...base.routes
|
|
300
|
+
},
|
|
301
|
+
optionalAuthFailurePaths: base.optionalAuthFailurePaths ?? [
|
|
302
|
+
API_ENDPOINTS.MFA_STATUS,
|
|
303
|
+
API_ENDPOINTS.MFA_PREFERENCES,
|
|
304
|
+
API_ENDPOINTS.MFA_TOTP_ENROLL_START,
|
|
305
|
+
API_ENDPOINTS.MFA_TOTP_ENROLL_VERIFY,
|
|
306
|
+
API_ENDPOINTS.MFA_TOTP_DISABLE,
|
|
307
|
+
API_ENDPOINTS.MFA_PHONE_VERIFY_START,
|
|
308
|
+
API_ENDPOINTS.MFA_PHONE_VERIFY_CONFIRM,
|
|
309
|
+
API_ENDPOINTS.MFA_WEBAUTHN_REGISTER_OPTIONS,
|
|
310
|
+
API_ENDPOINTS.MFA_WEBAUTHN_REGISTER_VERIFY,
|
|
311
|
+
API_ENDPOINTS.MFA_WEBAUTHN_CREDENTIALS
|
|
312
|
+
],
|
|
313
|
+
sessionProbePaths: base.sessionProbePaths,
|
|
314
|
+
includeAdminMfaSecurityPrefixes: base.includeAdminMfaSecurityPrefixes ?? true
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function formatUnauthorizedRoute(route) {
|
|
318
|
+
if (route.startsWith("#")) {
|
|
319
|
+
return route;
|
|
320
|
+
}
|
|
321
|
+
if (typeof window !== "undefined" && window.location.hash.startsWith("#/")) {
|
|
322
|
+
return `#${route.startsWith("/") ? route : `/${route}`}`;
|
|
323
|
+
}
|
|
324
|
+
return route;
|
|
325
|
+
}
|
|
326
|
+
function isRecoverableSessionExpiredCode(errorCode) {
|
|
327
|
+
return errorCode === AuthErrorCode.TOKEN_EXPIRED || errorCode === AuthErrorCode.TOKEN_INVALID || errorCode === AuthErrorCode.AUTHENTICATION_FAILED || errorCode === AuthErrorCode.MISSING_REFRESH_TOKEN || errorCode === AuthErrorCode.ACCESS_UNAUTHORIZED;
|
|
328
|
+
}
|
|
329
|
+
function formatLoginRouteWithReturn(loginRoute) {
|
|
330
|
+
const loginPath = loginRoute.startsWith("/") ? loginRoute : `/${loginRoute}`;
|
|
331
|
+
if (typeof window === "undefined") {
|
|
332
|
+
return formatUnauthorizedRoute(loginPath);
|
|
333
|
+
}
|
|
334
|
+
const returnPath = window.location.hash.replace(/^#/, "") || window.location.pathname;
|
|
335
|
+
if (!returnPath || returnPath.startsWith("/login")) {
|
|
336
|
+
return formatUnauthorizedRoute(loginPath);
|
|
337
|
+
}
|
|
338
|
+
return formatUnauthorizedRoute(`${loginPath}?r=${encodeURIComponent(returnPath)}`);
|
|
339
|
+
}
|
|
340
|
+
function setBearerAuthorization(requestConfig, token) {
|
|
341
|
+
if (typeof requestConfig.headers?.set === "function") {
|
|
342
|
+
requestConfig.headers.set("Authorization", `Bearer ${token}`);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
requestConfig.headers.Authorization = `Bearer ${token}`;
|
|
346
|
+
}
|
|
347
|
+
async function handleAuthHttpError(error, axiosInstanceRef) {
|
|
348
|
+
if (!error.response || !error.config) {
|
|
349
|
+
return Promise.reject(error);
|
|
350
|
+
}
|
|
351
|
+
const status = error.response.status;
|
|
352
|
+
if (status !== 401 && status !== 403) {
|
|
353
|
+
return Promise.reject(error);
|
|
354
|
+
}
|
|
355
|
+
const shouldHandleOnPublicPath = config3.skipCurrentPublicPath?.() ?? false;
|
|
356
|
+
const allowUnauthorizedHandling = config3.shouldHandleUnauthorized?.() ?? true;
|
|
357
|
+
if (!shouldHandleOnPublicPath || !allowUnauthorizedHandling) {
|
|
358
|
+
return Promise.reject(error);
|
|
359
|
+
}
|
|
360
|
+
const { parseApiErrorPayload } = await import('./auth-error-codes-D7CXVBEN.js');
|
|
361
|
+
const { persistAuthError, resolveAuthErrorAction } = await import('./auth-interceptor-policy-LU2L5NJM.js');
|
|
362
|
+
const reqConfig = error.config;
|
|
363
|
+
const payload = parseApiErrorPayload(error.response.data);
|
|
364
|
+
const action = resolveAuthErrorAction({
|
|
365
|
+
status,
|
|
366
|
+
errorCode: payload.errorCode,
|
|
367
|
+
url: reqConfig.url,
|
|
368
|
+
skipGlobalAuthRedirect: reqConfig.skipGlobalAuthRedirect,
|
|
369
|
+
isRetryRequest: reqConfig.__isRetryRequest,
|
|
370
|
+
policy: buildAuthPolicy()
|
|
371
|
+
});
|
|
372
|
+
if (action.kind === "reject") {
|
|
373
|
+
return Promise.reject(error);
|
|
374
|
+
}
|
|
375
|
+
if (action.kind === "refresh_retry") {
|
|
376
|
+
if (isRefreshCallbackInFlight()) {
|
|
377
|
+
return Promise.reject(error);
|
|
378
|
+
}
|
|
379
|
+
try {
|
|
380
|
+
await refreshSession({ force: true });
|
|
381
|
+
} catch {
|
|
382
|
+
}
|
|
383
|
+
const token = getAccessToken();
|
|
384
|
+
if (token) {
|
|
385
|
+
const newConfig = { ...reqConfig, __isRetryRequest: true };
|
|
386
|
+
setBearerAuthorization(newConfig, token);
|
|
387
|
+
return axiosInstanceRef.request(newConfig);
|
|
388
|
+
}
|
|
389
|
+
persistAuthError(payload);
|
|
390
|
+
void config3.onLogout?.();
|
|
391
|
+
const policy = buildAuthPolicy();
|
|
392
|
+
const destination = isRecoverableSessionExpiredCode(payload.errorCode) ? formatLoginRouteWithReturn(policy.routes.login) : formatUnauthorizedRoute(policy.routes.unauthorized);
|
|
393
|
+
if (typeof window !== "undefined") {
|
|
394
|
+
window.location.replace(destination);
|
|
395
|
+
}
|
|
396
|
+
return Promise.reject(error);
|
|
397
|
+
}
|
|
398
|
+
persistAuthError(payload);
|
|
399
|
+
if (action.kind === "logout" || action.kind === "redirect") {
|
|
400
|
+
if (action.clearSession) {
|
|
401
|
+
void config3.onLogout?.();
|
|
402
|
+
}
|
|
403
|
+
if (typeof window !== "undefined") {
|
|
404
|
+
window.location.replace(formatUnauthorizedRoute(action.route));
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return Promise.reject(error);
|
|
408
|
+
}
|
|
345
409
|
function persistHubContextFromClientConfig(clientConfig) {
|
|
346
410
|
const existing = storage.get(HUBSPOT_DATA) || {};
|
|
347
411
|
const next = { ...existing };
|
|
@@ -376,7 +440,16 @@ function initializeHttpClient(clientConfig) {
|
|
|
376
440
|
if (clientConfig.storageKeys != null) {
|
|
377
441
|
configureStorageKeys(clientConfig.storageKeys);
|
|
378
442
|
}
|
|
443
|
+
void import('./storage-migration-BY2QL6YD.js').then(({ migrateLegacyStorageKeys }) => {
|
|
444
|
+
migrateLegacyStorageKeys();
|
|
445
|
+
});
|
|
446
|
+
void import('./cross-tab-session-TUFJ6KU7.js').then(({ installCrossTabSessionListener }) => {
|
|
447
|
+
installCrossTabSessionListener();
|
|
448
|
+
});
|
|
379
449
|
setIframeStorageMode(clientConfig.storageMode === "iframe");
|
|
450
|
+
if (typeof clientConfig.refreshBufferSeconds === "number") {
|
|
451
|
+
setRefreshBufferSeconds(clientConfig.refreshBufferSeconds);
|
|
452
|
+
}
|
|
380
453
|
if (clientConfig.editorPreviewMockHandler !== void 0) {
|
|
381
454
|
setEditorPreviewMockHandler(clientConfig.editorPreviewMockHandler);
|
|
382
455
|
}
|
|
@@ -394,6 +467,7 @@ function initializeHttpClient(clientConfig) {
|
|
|
394
467
|
}
|
|
395
468
|
});
|
|
396
469
|
setRefreshCallback(getAuthRefreshToken);
|
|
470
|
+
hydrateSessionRefreshState();
|
|
397
471
|
axiosInstance.interceptors.request.use(async (requestConfig) => {
|
|
398
472
|
const previewMock = await resolveEditorPreviewMock(requestConfig);
|
|
399
473
|
if (previewMock) {
|
|
@@ -444,7 +518,7 @@ function initializeHttpClient(clientConfig) {
|
|
|
444
518
|
phase: "complete"
|
|
445
519
|
});
|
|
446
520
|
}
|
|
447
|
-
if (status != null && status >= 400 && status !== 401) {
|
|
521
|
+
if (status != null && status >= 400 && status !== 401 && status !== 403) {
|
|
448
522
|
logger.warn("http", "HTTP error response", {
|
|
449
523
|
method: getHttpMethod(error.config),
|
|
450
524
|
url: sanitizeHttpUrl(error.config.url),
|
|
@@ -455,30 +529,19 @@ function initializeHttpClient(clientConfig) {
|
|
|
455
529
|
}
|
|
456
530
|
notifyServiceUnavailable(error);
|
|
457
531
|
}
|
|
458
|
-
|
|
459
|
-
const shouldHandleAuthError = config3.skipCurrentPublicPath?.() ?? false;
|
|
460
|
-
const allowUnauthorizedHandling = config3.shouldHandleUnauthorized?.() ?? true;
|
|
461
|
-
if (shouldHandleAuthError && allowUnauthorizedHandling) {
|
|
462
|
-
const payload = error.response.data ?? {};
|
|
463
|
-
const data = {
|
|
464
|
-
errorCode: payload.errorCode,
|
|
465
|
-
errorMessage: payload.errorMessage ?? payload.message,
|
|
466
|
-
detailedMessage: payload.detailedMessage,
|
|
467
|
-
correlationId: payload.correlationId,
|
|
468
|
-
ts: Date.now()
|
|
469
|
-
};
|
|
470
|
-
if (typeof window !== "undefined" && window.sessionStorage) {
|
|
471
|
-
sessionStorage.setItem("authError", JSON.stringify(data));
|
|
472
|
-
}
|
|
473
|
-
if (config3.routes?.unauthorized && typeof window !== "undefined") {
|
|
474
|
-
window.location.replace(`#${config3.routes.unauthorized}`);
|
|
475
|
-
}
|
|
476
|
-
void config3.onLogout?.();
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
return Promise.reject(error);
|
|
532
|
+
return handleAuthHttpError(error, axiosInstance);
|
|
480
533
|
}
|
|
481
534
|
);
|
|
535
|
+
stopVisibilityRefreshScheduler();
|
|
536
|
+
startVisibilityRefreshScheduler({
|
|
537
|
+
shouldRefresh: () => !isEditorPreviewMockActive() && isAccessTokenExpired(),
|
|
538
|
+
refresh: async () => {
|
|
539
|
+
try {
|
|
540
|
+
await refreshSession();
|
|
541
|
+
} catch {
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
});
|
|
482
545
|
logger.info("http", "HTTP client initialized", { baseURL });
|
|
483
546
|
}
|
|
484
547
|
function getAxiosInstance() {
|
|
@@ -493,24 +556,30 @@ function getAxiosInstance() {
|
|
|
493
556
|
function formatBooleanSearchParam(key, value) {
|
|
494
557
|
return value ? `${key}:1` : `${key}:`;
|
|
495
558
|
}
|
|
559
|
+
async function maybeEnsureValidRefresh() {
|
|
560
|
+
if (isEditorPreviewMockActive()) {
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
await ensureValidRefresh();
|
|
564
|
+
}
|
|
496
565
|
var HttpClient = class {
|
|
497
566
|
static async get(url, params, options) {
|
|
498
|
-
await
|
|
567
|
+
await maybeEnsureValidRefresh();
|
|
499
568
|
const response = await getAxiosInstance().get(url, { params, ...options || {} });
|
|
500
569
|
return response.data;
|
|
501
570
|
}
|
|
502
571
|
static async post(url, data, options) {
|
|
503
|
-
await
|
|
572
|
+
await maybeEnsureValidRefresh();
|
|
504
573
|
const response = await getAxiosInstance().post(url, data, options);
|
|
505
574
|
return response.data;
|
|
506
575
|
}
|
|
507
576
|
static async put(url, data) {
|
|
508
|
-
await
|
|
577
|
+
await maybeEnsureValidRefresh();
|
|
509
578
|
const response = await getAxiosInstance().put(url, data);
|
|
510
579
|
return response.data;
|
|
511
580
|
}
|
|
512
581
|
static async delete(url, config4) {
|
|
513
|
-
await
|
|
582
|
+
await maybeEnsureValidRefresh();
|
|
514
583
|
const response = await getAxiosInstance().delete(url, config4);
|
|
515
584
|
return response.data;
|
|
516
585
|
}
|
|
@@ -559,17 +628,67 @@ function getFieldErrors(error) {
|
|
|
559
628
|
}
|
|
560
629
|
return null;
|
|
561
630
|
}
|
|
562
|
-
async function
|
|
563
|
-
|
|
564
|
-
|
|
631
|
+
async function postRefreshCookie(headers) {
|
|
632
|
+
const apiUrl = generateApiUrl({
|
|
633
|
+
route: API_ENDPOINTS.AUTH_REFRESH_COOKIE,
|
|
634
|
+
queryParams: { hubId: config.hubId }
|
|
635
|
+
});
|
|
636
|
+
return getAxiosInstance().post(apiUrl, {}, {
|
|
637
|
+
headers,
|
|
638
|
+
withCredentials: true,
|
|
639
|
+
skipGlobalAuthRedirect: true
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
var refreshCallbackInFlight = false;
|
|
643
|
+
function isRefreshCallbackInFlight() {
|
|
644
|
+
return refreshCallbackInFlight;
|
|
645
|
+
}
|
|
646
|
+
function clearSessionAfterRefreshFailure() {
|
|
647
|
+
if (isEditorPreviewMockActive()) {
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
if (config3.shouldHandleUnauthorized?.() === false) {
|
|
651
|
+
return;
|
|
565
652
|
}
|
|
653
|
+
void config3.onLogout?.();
|
|
654
|
+
}
|
|
655
|
+
async function getAuthRefreshToken(refreshToken) {
|
|
656
|
+
refreshCallbackInFlight = true;
|
|
566
657
|
try {
|
|
567
658
|
const headers = {};
|
|
568
659
|
if (config.devPortalId) {
|
|
569
660
|
headers["X-Dev-Portal-Id"] = config.devPortalId;
|
|
570
661
|
}
|
|
571
|
-
|
|
572
|
-
|
|
662
|
+
let response;
|
|
663
|
+
if (config3.useCookieRefresh) {
|
|
664
|
+
try {
|
|
665
|
+
response = await postRefreshCookie(headers);
|
|
666
|
+
} catch {
|
|
667
|
+
if (refreshToken == null || refreshToken.trim() === "") {
|
|
668
|
+
return { token: null, success: false };
|
|
669
|
+
}
|
|
670
|
+
const apiUrl = generateApiUrl({
|
|
671
|
+
route: API_ENDPOINTS.AUTH_REFRESH,
|
|
672
|
+
queryParams: { hubId: config.hubId }
|
|
673
|
+
});
|
|
674
|
+
response = await getAxiosInstance().post(apiUrl, { refreshToken }, {
|
|
675
|
+
headers,
|
|
676
|
+
skipGlobalAuthRedirect: true
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
} else {
|
|
680
|
+
if (refreshToken == null || refreshToken.trim() === "") {
|
|
681
|
+
return { token: null, success: false };
|
|
682
|
+
}
|
|
683
|
+
const apiUrl = generateApiUrl({
|
|
684
|
+
route: API_ENDPOINTS.AUTH_REFRESH,
|
|
685
|
+
queryParams: { hubId: config.hubId }
|
|
686
|
+
});
|
|
687
|
+
response = await getAxiosInstance().post(apiUrl, { refreshToken }, {
|
|
688
|
+
headers,
|
|
689
|
+
skipGlobalAuthRedirect: true
|
|
690
|
+
});
|
|
691
|
+
}
|
|
573
692
|
const maybeData = response?.data?.data || response?.data;
|
|
574
693
|
const tokenData = maybeData?.tokenData || maybeData || {};
|
|
575
694
|
const newRefreshToken = tokenData?.refreshToken;
|
|
@@ -587,14 +706,18 @@ async function getAuthRefreshToken(refreshToken) {
|
|
|
587
706
|
setRefreshToken(newRefreshToken, rExpires);
|
|
588
707
|
}
|
|
589
708
|
if (typeof token === "string") {
|
|
590
|
-
|
|
709
|
+
storAccessToken(token, typeof expiresIn === "number" ? expiresIn : void 0);
|
|
591
710
|
return { token, success: true };
|
|
592
711
|
}
|
|
712
|
+
clearSessionAfterRefreshFailure();
|
|
593
713
|
return { token: null, success: false };
|
|
594
714
|
} catch (error) {
|
|
595
715
|
notifyServiceUnavailable(error);
|
|
596
716
|
logger.error("auth", error, { operation: "token refresh" });
|
|
717
|
+
clearSessionAfterRefreshFailure();
|
|
597
718
|
return { token: null, success: false };
|
|
719
|
+
} finally {
|
|
720
|
+
refreshCallbackInFlight = false;
|
|
598
721
|
}
|
|
599
722
|
}
|
|
600
723
|
|
|
@@ -1059,15 +1182,213 @@ var mfaClient = {
|
|
|
1059
1182
|
)
|
|
1060
1183
|
};
|
|
1061
1184
|
|
|
1185
|
+
// src/main/features/crm/helpers/normalize-table-list-params.ts
|
|
1186
|
+
function resolveListTableParams(payload) {
|
|
1187
|
+
const param = tableUiActions.getTableParam(payload?.companyAsMediator, payload?.currentPageOverride);
|
|
1188
|
+
if (payload?.tableParams && typeof payload.tableParams === "object") {
|
|
1189
|
+
return { ...param, ...payload.tableParams };
|
|
1190
|
+
}
|
|
1191
|
+
return { ...param };
|
|
1192
|
+
}
|
|
1193
|
+
function applyBoardPaginationToParams(param, tableParams) {
|
|
1194
|
+
const stageId = tableParams.stageId;
|
|
1195
|
+
const page = tableParams.page;
|
|
1196
|
+
if (stageId !== void 0 && stageId !== null && stageId !== "") {
|
|
1197
|
+
param.stageId = stageId;
|
|
1198
|
+
}
|
|
1199
|
+
if (param.view === "BOARD" && page !== void 0) {
|
|
1200
|
+
param.page = page;
|
|
1201
|
+
}
|
|
1202
|
+
return param;
|
|
1203
|
+
}
|
|
1204
|
+
function finalizeBoardListQueryParams(param, context) {
|
|
1205
|
+
const { stageId, nextPage, view, selectedPipeline } = tableUiStore.getState();
|
|
1206
|
+
const payload = context?.payload;
|
|
1207
|
+
if (view) {
|
|
1208
|
+
param.view = view;
|
|
1209
|
+
}
|
|
1210
|
+
const ticketPipelineContext = payload?.isHome && payload?.hubspotObjectTypeId === "0-5" || payload?.componentName === "object" && payload?.hubspotObjectTypeId === "0-5";
|
|
1211
|
+
if (ticketPipelineContext && !param?.isPrimaryCompany) {
|
|
1212
|
+
param.parentObjectTypeId = "0-1";
|
|
1213
|
+
} else if (ticketPipelineContext && param?.isPrimaryCompany) {
|
|
1214
|
+
param.parentObjectTypeId = "0-2";
|
|
1215
|
+
}
|
|
1216
|
+
if (selectedPipeline !== void 0 && selectedPipeline !== null && selectedPipeline !== "") {
|
|
1217
|
+
param.filterValue = selectedPipeline;
|
|
1218
|
+
}
|
|
1219
|
+
return applyBoardPaginationToParams(param, {
|
|
1220
|
+
stageId,
|
|
1221
|
+
page: stageId ? nextPage : 1
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
// src/main/core/utils/cache/resolveCrmListPurgeQuery.ts
|
|
1226
|
+
var LIST_QUERY_KEYS = [
|
|
1227
|
+
"sort",
|
|
1228
|
+
"search",
|
|
1229
|
+
"filterPropertyName",
|
|
1230
|
+
"filterOperator",
|
|
1231
|
+
"filterValue",
|
|
1232
|
+
"page",
|
|
1233
|
+
"limit",
|
|
1234
|
+
"view",
|
|
1235
|
+
"mediatorObjectTypeId",
|
|
1236
|
+
"mediatorObjectRecordId",
|
|
1237
|
+
"parentObjectTypeId",
|
|
1238
|
+
"parentObjectRecordId",
|
|
1239
|
+
"stageId",
|
|
1240
|
+
"after"
|
|
1241
|
+
];
|
|
1242
|
+
var PURGE_FILTER_KEYS = ["sort", "filterPropertyName", "filterOperator", "filterValue", "view", "page", "limit"];
|
|
1243
|
+
function hasPurgeFilterContext(raw) {
|
|
1244
|
+
if (!raw || typeof raw !== "object") {
|
|
1245
|
+
return false;
|
|
1246
|
+
}
|
|
1247
|
+
return PURGE_FILTER_KEYS.some((key) => {
|
|
1248
|
+
const value = raw[key];
|
|
1249
|
+
return value !== void 0 && value !== null && String(value).length > 0;
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
function mergeLiveTableUiState(raw) {
|
|
1253
|
+
const state = tableUiStore.getState();
|
|
1254
|
+
const merged = { ...raw ?? {} };
|
|
1255
|
+
if (!merged.sort && state.sort) {
|
|
1256
|
+
merged.sort = state.sort;
|
|
1257
|
+
}
|
|
1258
|
+
if (!merged.search && state.search) {
|
|
1259
|
+
merged.search = state.search;
|
|
1260
|
+
}
|
|
1261
|
+
if (!merged.filterPropertyName && state.filterPropertyName) {
|
|
1262
|
+
merged.filterPropertyName = state.filterPropertyName;
|
|
1263
|
+
}
|
|
1264
|
+
if (!merged.filterOperator && state.filterOperator) {
|
|
1265
|
+
merged.filterOperator = state.filterOperator;
|
|
1266
|
+
}
|
|
1267
|
+
if (!merged.filterValue && state.selectedPipeline) {
|
|
1268
|
+
merged.filterValue = state.selectedPipeline;
|
|
1269
|
+
}
|
|
1270
|
+
if (merged.limit === void 0 && state.limit) {
|
|
1271
|
+
merged.limit = state.limit;
|
|
1272
|
+
}
|
|
1273
|
+
if (merged.page === void 0 && state.page !== void 0 && state.page !== "") {
|
|
1274
|
+
merged.page = state.page;
|
|
1275
|
+
}
|
|
1276
|
+
if (!merged.view && state.view) {
|
|
1277
|
+
merged.view = state.view;
|
|
1278
|
+
}
|
|
1279
|
+
if (merged.isPrimaryCompany === void 0 && state.isPrimaryCompany !== null) {
|
|
1280
|
+
merged.isPrimaryCompany = state.isPrimaryCompany;
|
|
1281
|
+
}
|
|
1282
|
+
return applyBoardPaginationToParams(merged, {
|
|
1283
|
+
stageId: state.stageId,
|
|
1284
|
+
page: state.stageId ? state.nextPage : 1
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
function listQueryCacheKey(q) {
|
|
1288
|
+
return JSON.stringify({
|
|
1289
|
+
...q,
|
|
1290
|
+
stageId: q.stageId ?? ""
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1293
|
+
function toCachePurgeListQuery(raw) {
|
|
1294
|
+
if (!raw || typeof raw !== "object") {
|
|
1295
|
+
return { page: 1, limit: 10, view: "LIST" };
|
|
1296
|
+
}
|
|
1297
|
+
const q = {};
|
|
1298
|
+
for (const key of LIST_QUERY_KEYS) {
|
|
1299
|
+
const value = raw[key];
|
|
1300
|
+
if (value !== void 0 && value !== null && String(value).length > 0) {
|
|
1301
|
+
q[key] = String(value);
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
if (raw.page !== void 0 && raw.page !== null) {
|
|
1305
|
+
const page = Number(raw.page);
|
|
1306
|
+
if (!Number.isNaN(page) && page > 0) {
|
|
1307
|
+
q.page = page;
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
if (raw.limit !== void 0 && raw.limit !== null) {
|
|
1311
|
+
const limit = Number(raw.limit);
|
|
1312
|
+
if (!Number.isNaN(limit) && limit > 0) {
|
|
1313
|
+
q.limit = limit;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
const isPc = raw.isPrimaryCompany ?? raw.isPC;
|
|
1317
|
+
if (isPc !== void 0 && isPc !== null) {
|
|
1318
|
+
q.isPrimaryCompany = isPc === true || isPc === "true" || isPc === 1 || isPc === "1";
|
|
1319
|
+
}
|
|
1320
|
+
const view = raw.view;
|
|
1321
|
+
if (typeof view === "string") {
|
|
1322
|
+
q.view = view.toUpperCase() === "BOARD" ? "BOARD" : "LIST";
|
|
1323
|
+
}
|
|
1324
|
+
if (Object.keys(q).length === 0) {
|
|
1325
|
+
return { page: 1, limit: 10, view: "LIST" };
|
|
1326
|
+
}
|
|
1327
|
+
if (q.page === void 0) {
|
|
1328
|
+
q.page = 1;
|
|
1329
|
+
}
|
|
1330
|
+
if (q.limit === void 0) {
|
|
1331
|
+
q.limit = 10;
|
|
1332
|
+
}
|
|
1333
|
+
if (q.view === void 0) {
|
|
1334
|
+
q.view = "LIST";
|
|
1335
|
+
}
|
|
1336
|
+
return q;
|
|
1337
|
+
}
|
|
1338
|
+
function expandListPurgeQueriesForCrmWrite(base) {
|
|
1339
|
+
const listQuery = { ...base, view: "LIST" };
|
|
1340
|
+
delete listQuery.stageId;
|
|
1341
|
+
const boardQuery = { ...base, view: "BOARD" };
|
|
1342
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1343
|
+
const expanded = [];
|
|
1344
|
+
for (const query of [listQuery, boardQuery]) {
|
|
1345
|
+
const key = listQueryCacheKey(query);
|
|
1346
|
+
if (seen.has(key)) {
|
|
1347
|
+
continue;
|
|
1348
|
+
}
|
|
1349
|
+
seen.add(key);
|
|
1350
|
+
expanded.push(query);
|
|
1351
|
+
}
|
|
1352
|
+
return expanded;
|
|
1353
|
+
}
|
|
1354
|
+
function resolveCrmListPurgeQuery(options) {
|
|
1355
|
+
let raw;
|
|
1356
|
+
if (options.componentName === "sidebarTable" && options.hubspotObjectTypeId) {
|
|
1357
|
+
raw = options.multiObjectsQueryParams?.[String(options.hubspotObjectTypeId)] ?? null;
|
|
1358
|
+
} else {
|
|
1359
|
+
raw = options.tableQueryParams ?? null;
|
|
1360
|
+
}
|
|
1361
|
+
if (!hasPurgeFilterContext(raw)) {
|
|
1362
|
+
raw = mergeLiveTableUiState(raw);
|
|
1363
|
+
}
|
|
1364
|
+
const base = toCachePurgeListQuery(raw ?? void 0);
|
|
1365
|
+
if (!options.writeContext || Object.keys(options.writeContext).length === 0) {
|
|
1366
|
+
return base;
|
|
1367
|
+
}
|
|
1368
|
+
return {
|
|
1369
|
+
...base,
|
|
1370
|
+
...options.writeContext
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1062
1374
|
// src/main/core/utils/cache/crmCacheRefresh.ts
|
|
1375
|
+
function buildPostWriteListPurgeTargets(objectTypeId, listQuery, recordIds) {
|
|
1376
|
+
const base = listQuery ?? { page: 1, limit: 10, view: "LIST" };
|
|
1377
|
+
return expandListPurgeQueriesForCrmWrite(base).map((query) => buildCrmListPurgeTarget(objectTypeId, query, recordIds));
|
|
1378
|
+
}
|
|
1063
1379
|
async function purgeCrmObjectDataCache(options) {
|
|
1064
1380
|
const result = await purgeCrmListCache(options);
|
|
1065
1381
|
return result.ok;
|
|
1066
1382
|
}
|
|
1067
1383
|
async function purgeCrmListCacheAfterCrmWrite(options) {
|
|
1068
|
-
|
|
1384
|
+
const objectTypeId = options.objectTypeId?.trim();
|
|
1385
|
+
if (!objectTypeId) {
|
|
1386
|
+
return { ok: false, errorCode: "VALIDATION", message: "objectTypeId is required" };
|
|
1387
|
+
}
|
|
1388
|
+
return purgeCrmCombined({
|
|
1069
1389
|
...options,
|
|
1070
|
-
postCrmWrite: true
|
|
1390
|
+
postCrmWrite: true,
|
|
1391
|
+
targets: buildPostWriteListPurgeTargets(objectTypeId, options.listQuery, options.recordIds)
|
|
1071
1392
|
});
|
|
1072
1393
|
}
|
|
1073
1394
|
async function purgeCrmDetailAndListAfterCrmWrite(options) {
|
|
@@ -1083,7 +1404,7 @@ async function purgeCrmDetailAndListAfterCrmWrite(options) {
|
|
|
1083
1404
|
...options,
|
|
1084
1405
|
postCrmWrite: true,
|
|
1085
1406
|
targets: mergePurgeTargets(
|
|
1086
|
-
|
|
1407
|
+
...buildPostWriteListPurgeTargets(objectTypeId, options.listQuery, options.recordIds),
|
|
1087
1408
|
buildCrmSinglePurgeTarget(objectTypeId, options.recordIds, options.listQuery)
|
|
1088
1409
|
)
|
|
1089
1410
|
});
|
|
@@ -1255,85 +1576,6 @@ function fieldValue(raw) {
|
|
|
1255
1576
|
return s.length > 0 ? s : void 0;
|
|
1256
1577
|
}
|
|
1257
1578
|
|
|
1258
|
-
// src/main/core/utils/cache/resolveCrmListPurgeQuery.ts
|
|
1259
|
-
var LIST_QUERY_KEYS = [
|
|
1260
|
-
"sort",
|
|
1261
|
-
"search",
|
|
1262
|
-
"filterPropertyName",
|
|
1263
|
-
"filterOperator",
|
|
1264
|
-
"filterValue",
|
|
1265
|
-
"page",
|
|
1266
|
-
"limit",
|
|
1267
|
-
"view",
|
|
1268
|
-
"mediatorObjectTypeId",
|
|
1269
|
-
"mediatorObjectRecordId",
|
|
1270
|
-
"parentObjectTypeId",
|
|
1271
|
-
"parentObjectRecordId",
|
|
1272
|
-
"stageId",
|
|
1273
|
-
"after"
|
|
1274
|
-
];
|
|
1275
|
-
function toCachePurgeListQuery(raw) {
|
|
1276
|
-
if (!raw || typeof raw !== "object") {
|
|
1277
|
-
return { page: 1, limit: 10, view: "LIST" };
|
|
1278
|
-
}
|
|
1279
|
-
const q = {};
|
|
1280
|
-
for (const key of LIST_QUERY_KEYS) {
|
|
1281
|
-
const value = raw[key];
|
|
1282
|
-
if (value !== void 0 && value !== null && String(value).length > 0) {
|
|
1283
|
-
q[key] = String(value);
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
if (raw.page !== void 0 && raw.page !== null) {
|
|
1287
|
-
const page = Number(raw.page);
|
|
1288
|
-
if (!Number.isNaN(page) && page > 0) {
|
|
1289
|
-
q.page = page;
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
if (raw.limit !== void 0 && raw.limit !== null) {
|
|
1293
|
-
const limit = Number(raw.limit);
|
|
1294
|
-
if (!Number.isNaN(limit) && limit > 0) {
|
|
1295
|
-
q.limit = limit;
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
const isPc = raw.isPrimaryCompany ?? raw.isPC;
|
|
1299
|
-
if (isPc !== void 0 && isPc !== null) {
|
|
1300
|
-
q.isPrimaryCompany = isPc === true || isPc === "true" || isPc === 1 || isPc === "1";
|
|
1301
|
-
}
|
|
1302
|
-
const view = raw.view;
|
|
1303
|
-
if (typeof view === "string") {
|
|
1304
|
-
q.view = view.toUpperCase() === "BOARD" ? "BOARD" : "LIST";
|
|
1305
|
-
}
|
|
1306
|
-
if (Object.keys(q).length === 0) {
|
|
1307
|
-
return { page: 1, limit: 10, view: "LIST" };
|
|
1308
|
-
}
|
|
1309
|
-
if (q.page === void 0) {
|
|
1310
|
-
q.page = 1;
|
|
1311
|
-
}
|
|
1312
|
-
if (q.limit === void 0) {
|
|
1313
|
-
q.limit = 10;
|
|
1314
|
-
}
|
|
1315
|
-
if (q.view === void 0) {
|
|
1316
|
-
q.view = "LIST";
|
|
1317
|
-
}
|
|
1318
|
-
return q;
|
|
1319
|
-
}
|
|
1320
|
-
function resolveCrmListPurgeQuery(options) {
|
|
1321
|
-
let raw;
|
|
1322
|
-
if (options.componentName === "sidebarTable" && options.hubspotObjectTypeId) {
|
|
1323
|
-
raw = options.multiObjectsQueryParams?.[String(options.hubspotObjectTypeId)] ?? null;
|
|
1324
|
-
} else {
|
|
1325
|
-
raw = options.tableQueryParams ?? null;
|
|
1326
|
-
}
|
|
1327
|
-
const base = toCachePurgeListQuery(raw ?? void 0);
|
|
1328
|
-
if (!options.writeContext || Object.keys(options.writeContext).length === 0) {
|
|
1329
|
-
return base;
|
|
1330
|
-
}
|
|
1331
|
-
return {
|
|
1332
|
-
...base,
|
|
1333
|
-
...options.writeContext
|
|
1334
|
-
};
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
1579
|
// src/main/core/http/client-context.ts
|
|
1338
1580
|
function getParamDetails2(...args) {
|
|
1339
1581
|
return navigationApi.route.getParamDetails(...args);
|
|
@@ -1419,6 +1661,8 @@ var authenticationClient = {
|
|
|
1419
1661
|
},
|
|
1420
1662
|
verifyOtp: (data) => mfaClient.verifyOtp(data),
|
|
1421
1663
|
verifyEmail: (data) => AuthHttpClient.post(API_ENDPOINTS.VERIFY_EMAIL, data),
|
|
1664
|
+
/** Legacy client greenfield signup route (predates /api/auth/* registry). */
|
|
1665
|
+
register: (data) => AuthHttpClient.post("/register", data),
|
|
1422
1666
|
resetPasswordVerifyToken: (data) => AuthHttpClient.post(API_ENDPOINTS.RESET_PASSWORD_VERIFY_TOKEN, data),
|
|
1423
1667
|
resetPassword: (data) => AuthHttpClient.post(API_ENDPOINTS.RESET_PASSWORD, data),
|
|
1424
1668
|
forgetPassword: (data) => AuthHttpClient.post(API_ENDPOINTS.FORGET_PASSWORD, data),
|
|
@@ -1467,51 +1711,14 @@ var authenticationClient = {
|
|
|
1467
1711
|
user: {
|
|
1468
1712
|
me: () => HttpClient.get(generateApiUrl({ route: API_ENDPOINTS.ME })),
|
|
1469
1713
|
profile: (payload) => HttpClient.get(generateApiUrl({ route: API_ENDPOINTS.PROFILE, queryParams: payload })),
|
|
1470
|
-
profileUpdate: (props) =>
|
|
1714
|
+
profileUpdate: (props) => {
|
|
1715
|
+
const properties = props?.properties ?? props?.payload ?? {};
|
|
1716
|
+
return HttpClient.put(generateApiUrl({ route: API_ENDPOINTS.PROFILE_UPDATE, queryParams: props?.queryParams || {} }), { properties });
|
|
1717
|
+
},
|
|
1471
1718
|
changePassword: (data) => HttpClient.post(API_ENDPOINTS.CHANGE_PASSWORD, data)
|
|
1472
1719
|
}
|
|
1473
1720
|
};
|
|
1474
1721
|
|
|
1475
|
-
// src/main/features/crm/helpers/normalize-table-list-params.ts
|
|
1476
|
-
function resolveListTableParams(payload) {
|
|
1477
|
-
const param = tableUiActions.getTableParam(payload?.companyAsMediator, payload?.currentPageOverride);
|
|
1478
|
-
if (payload?.tableParams && typeof payload.tableParams === "object") {
|
|
1479
|
-
return { ...param, ...payload.tableParams };
|
|
1480
|
-
}
|
|
1481
|
-
return { ...param };
|
|
1482
|
-
}
|
|
1483
|
-
function applyBoardPaginationToParams(param, tableParams) {
|
|
1484
|
-
const stageId = tableParams.stageId;
|
|
1485
|
-
const page = tableParams.page;
|
|
1486
|
-
if (stageId !== void 0 && stageId !== null && stageId !== "") {
|
|
1487
|
-
param.stageId = stageId;
|
|
1488
|
-
}
|
|
1489
|
-
if (param.view === "BOARD" && page !== void 0) {
|
|
1490
|
-
param.page = page;
|
|
1491
|
-
}
|
|
1492
|
-
return param;
|
|
1493
|
-
}
|
|
1494
|
-
function finalizeBoardListQueryParams(param, context) {
|
|
1495
|
-
const { stageId, nextPage, view, selectedPipeline } = tableUiStore.getState();
|
|
1496
|
-
const payload = context?.payload;
|
|
1497
|
-
if (view) {
|
|
1498
|
-
param.view = view;
|
|
1499
|
-
}
|
|
1500
|
-
const ticketPipelineContext = payload?.isHome && payload?.hubspotObjectTypeId === "0-5" || payload?.componentName === "object" && payload?.hubspotObjectTypeId === "0-5";
|
|
1501
|
-
if (ticketPipelineContext && !param?.isPrimaryCompany) {
|
|
1502
|
-
param.parentObjectTypeId = "0-1";
|
|
1503
|
-
} else if (ticketPipelineContext && param?.isPrimaryCompany) {
|
|
1504
|
-
param.parentObjectTypeId = "0-2";
|
|
1505
|
-
}
|
|
1506
|
-
if (selectedPipeline !== void 0 && selectedPipeline !== null && selectedPipeline !== "") {
|
|
1507
|
-
param.filterValue = selectedPipeline;
|
|
1508
|
-
}
|
|
1509
|
-
return applyBoardPaginationToParams(param, {
|
|
1510
|
-
stageId,
|
|
1511
|
-
page: stageId ? nextPage : 1
|
|
1512
|
-
});
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
1722
|
// src/main/features/crm/client/crm-client.ts
|
|
1516
1723
|
var crmClient = {
|
|
1517
1724
|
pipeline: {
|
|
@@ -1631,7 +1838,7 @@ var crmClient = {
|
|
|
1631
1838
|
},
|
|
1632
1839
|
create: async (props = null) => {
|
|
1633
1840
|
const { paramsObject } = getParamDetails2({ type: props?.componentName });
|
|
1634
|
-
const cardParentMerge = props?.componentName === "association" ? true : false;
|
|
1841
|
+
const cardParentMerge = props?.componentName === "association" || props?.componentName === "sidebarAssociation" ? true : false;
|
|
1635
1842
|
const body = mergeRecordWriteBody(props?.payload, paramsObject, {
|
|
1636
1843
|
cardParentMerge,
|
|
1637
1844
|
addAnother: props?.params?.addAnother
|
|
@@ -1942,7 +2149,7 @@ var engagementClient = {
|
|
|
1942
2149
|
},
|
|
1943
2150
|
file: {
|
|
1944
2151
|
list: (props = null) => {
|
|
1945
|
-
const { setListQueryParams } =
|
|
2152
|
+
const { setListQueryParams } = actions7;
|
|
1946
2153
|
setListQueryParams(props?.queryParams ?? {});
|
|
1947
2154
|
const params = {
|
|
1948
2155
|
// hubId: config.hubId,
|
|
@@ -2209,6 +2416,6 @@ function createMutation(mutationFn, options) {
|
|
|
2209
2416
|
};
|
|
2210
2417
|
}
|
|
2211
2418
|
|
|
2212
|
-
export { Client, SERVICE_UNAVAILABLE_MESSAGE, buildCachePurgeRequest, buildCrmListPurgeTarget, buildCrmSinglePurgeTarget, buildEngagementPurgeTarget, buildPortalConfigPurgeTarget, buildUserSessionPurgeTarget, classifyHttpError,
|
|
2213
|
-
//# sourceMappingURL=chunk-
|
|
2214
|
-
//# sourceMappingURL=chunk-
|
|
2419
|
+
export { Client, SERVICE_UNAVAILABLE_MESSAGE, buildCachePurgeRequest, buildCrmListPurgeTarget, buildCrmSinglePurgeTarget, buildEngagementPurgeTarget, buildPortalConfigPurgeTarget, buildUserSessionPurgeTarget, classifyHttpError, createCachePurgeJob, createMutation, extractEngagementItemIdFromWriteResponse, extractHubspotRecordIdFromWriteResponse, getAuthRefreshToken, getFieldErrors, getFormErrors, getHttpErrorMessage, initializeHttpClient, isServiceUnavailableError, mergePurgeTargets, navigationApi, purgeCrmCombined, purgeCrmDetailAndListAfterCrmWrite, purgeCrmListCache, purgeCrmListCacheAfterCrmWrite, purgeCrmObjectDataCache, purgeCrmRecordCache, purgeEngagementCaches, purgeEngagementCachesAfterCrmWrite, resolveCrmListPurgeQuery, resolveListTableParams, setEditorPreviewMockHandler, startVisibilityRefreshScheduler, stopVisibilityRefreshScheduler, toCachePurgeListQuery };
|
|
2420
|
+
//# sourceMappingURL=chunk-WNE4LSVH.js.map
|
|
2421
|
+
//# sourceMappingURL=chunk-WNE4LSVH.js.map
|