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
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { getParamDetails, getRouteDetails, updateLink, getParam, decodeToBase64, generatePath, getPath, getRouteMenu, tableUiActions, ticketHubspotObjectTypeId, tableStore, actions2, userStore, isPipelineBoardObjectTypeId, fileStore, actions7, emailStore, actions5, noteStore, actions4, tableUiStore, resetAllStore, breadcrumbStage, isMessingParentLastItem, isMessingParent, generateUrl } from './chunk-
|
|
2
|
-
import { configureLogger, setIframeStorageMode, setRefreshBufferSeconds,
|
|
1
|
+
import { getParamDetails, getRouteDetails, updateLink, getParam, decodeToBase64, generatePath, getPath, getRouteMenu, tableUiActions, ticketHubspotObjectTypeId, tableStore, makePreviewParams, actions2, userStore, isPipelineBoardObjectTypeId, fileStore, actions7, emailStore, actions5, noteStore, actions4, tableUiStore, resetAllStore, breadcrumbStage, isMessingParentLastItem, isMessingParent, generateUrl } from './chunk-ETYE73AH.js';
|
|
2
|
+
import { config, configureLogger, setIframeStorageMode, setRefreshBufferSeconds, setRefreshCallback, hydrateSessionRefreshState, isHttpTracingEnabled, logger, getAccessToken, sanitizeAxiosErrorData, classifyRefreshHttpError, shouldLogoutAfterRefreshFailure, setRefreshToken, storAccessToken, classifyRefreshResponseWithoutToken, storage, HUBSPOT_DATA, setRuntimeHttpClientHubContext, isServiceUnavailableError, refreshSession, ensureValidRefresh, HUB_ID, DEV_PORTAL_ID, PORTAL_ID, DEV_API_URL, isAccessTokenExpired } from './chunk-NDDE6ZZ3.js';
|
|
3
|
+
import { getClientType, configureStorageKeys } from './chunk-KPHAQNS2.js';
|
|
3
4
|
import { AuthErrorCode } from './chunk-COHBSTHF.js';
|
|
4
|
-
import
|
|
5
|
-
import axios2 from 'axios';
|
|
5
|
+
import axios from 'axios';
|
|
6
6
|
|
|
7
7
|
// src/main/core/http/visibility-refresh-scheduler.ts
|
|
8
8
|
var visibilityStop = null;
|
|
9
|
+
function hasBrowserDocument() {
|
|
10
|
+
return typeof document !== "undefined" && document != null;
|
|
11
|
+
}
|
|
9
12
|
function startVisibilityRefreshScheduler(options) {
|
|
10
|
-
if (
|
|
13
|
+
if (getClientType() === "mobile") {
|
|
14
|
+
return () => void 0;
|
|
15
|
+
}
|
|
16
|
+
if (typeof window === "undefined" || !hasBrowserDocument()) {
|
|
11
17
|
return () => void 0;
|
|
12
18
|
}
|
|
13
19
|
visibilityStop?.();
|
|
@@ -39,55 +45,6 @@ function startVisibilityRefreshScheduler(options) {
|
|
|
39
45
|
function stopVisibilityRefreshScheduler() {
|
|
40
46
|
visibilityStop?.();
|
|
41
47
|
}
|
|
42
|
-
var SERVICE_UNAVAILABLE_MESSAGE = "Service temporarily unavailable. Please try again in a few minutes.";
|
|
43
|
-
var SERVICE_UNAVAILABLE_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
44
|
-
function classifyHttpError(error) {
|
|
45
|
-
if (!axios2.isAxiosError(error)) {
|
|
46
|
-
return "unknown";
|
|
47
|
-
}
|
|
48
|
-
const status = error.response?.status;
|
|
49
|
-
if (status != null) {
|
|
50
|
-
if (SERVICE_UNAVAILABLE_STATUSES.has(status)) return "service_unavailable";
|
|
51
|
-
if (status === 401 || status === 403) return "auth";
|
|
52
|
-
if (status >= 400 && status < 500) return "client";
|
|
53
|
-
if (status >= 500) return "server";
|
|
54
|
-
}
|
|
55
|
-
if (error.code === "ECONNABORTED" || error.message.toLowerCase().includes("timeout")) {
|
|
56
|
-
return "timeout";
|
|
57
|
-
}
|
|
58
|
-
if (error.code === "ERR_NETWORK" || error.message === "Network Error") {
|
|
59
|
-
return "service_unavailable";
|
|
60
|
-
}
|
|
61
|
-
return "network";
|
|
62
|
-
}
|
|
63
|
-
function isServiceUnavailableError(error) {
|
|
64
|
-
return classifyHttpError(error) === "service_unavailable";
|
|
65
|
-
}
|
|
66
|
-
function getHttpErrorMessage(error) {
|
|
67
|
-
const kind = classifyHttpError(error);
|
|
68
|
-
switch (kind) {
|
|
69
|
-
case "service_unavailable":
|
|
70
|
-
return SERVICE_UNAVAILABLE_MESSAGE;
|
|
71
|
-
case "timeout":
|
|
72
|
-
return "The request timed out. Please check your connection and try again.";
|
|
73
|
-
case "auth":
|
|
74
|
-
return "Your session has expired. Please sign in again.";
|
|
75
|
-
case "network":
|
|
76
|
-
return "Unable to reach the server. Please check your connection and try again.";
|
|
77
|
-
case "client":
|
|
78
|
-
case "server":
|
|
79
|
-
case "unknown": {
|
|
80
|
-
if (axios2.isAxiosError(error)) {
|
|
81
|
-
const payload = error.response?.data;
|
|
82
|
-
const apiMessage = payload?.errorMessage ?? payload?.message;
|
|
83
|
-
if (typeof apiMessage === "string" && apiMessage.trim() !== "") {
|
|
84
|
-
return apiMessage;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return "Something went wrong. Please try again.";
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
48
|
|
|
92
49
|
// src/main/core/http/editor-preview-mock.ts
|
|
93
50
|
var editorPreviewMockHandler = null;
|
|
@@ -112,6 +69,7 @@ var API_ENDPOINTS = {
|
|
|
112
69
|
AUTH_REFRESH: "/api/auth/refresh",
|
|
113
70
|
AUTH_REFRESH_COOKIE: "/api/auth/refresh-cookie",
|
|
114
71
|
FORGET_PASSWORD: "/api/auth/forget-password",
|
|
72
|
+
FORGET_PASSWORD_OTP_VERIFY: "/api/auth/forget-password/otp/verify",
|
|
115
73
|
RESET_PASSWORD_VERIFY_TOKEN: "/api/auth/token/validate",
|
|
116
74
|
RESET_PASSWORD: "/api/auth/reset-password",
|
|
117
75
|
VERIFY_EMAIL: "/api/auth/verify-email",
|
|
@@ -161,6 +119,13 @@ var API_ENDPOINTS = {
|
|
|
161
119
|
PROFILE: "/api/${hubId}/${portalId}/profiles",
|
|
162
120
|
PROFILE_UPDATE: "/api/${hubId}/${portalId}/profiles",
|
|
163
121
|
CHANGE_PASSWORD: "/api/auth/change-password",
|
|
122
|
+
// Accounts (client lane — hub / portal picker)
|
|
123
|
+
HUBSPOTS: "/api/hubspots",
|
|
124
|
+
PORTALS: "/api/portals",
|
|
125
|
+
// Mobile
|
|
126
|
+
MOBILE_NAVIGATION: "/api/${hubId}/${portalId}/mobile/navigation",
|
|
127
|
+
MOBILE_APP_CONFIG: "/api/${hubId}/${portalId}/mobile/app-config",
|
|
128
|
+
MOBILE_NAVIGATION_IMPORT_WEB_MENU: "/api/${hubId}/${portalId}/mobile/navigation/import-web-menu",
|
|
164
129
|
// Pipeline
|
|
165
130
|
PIPELINES: "/api/${hubId}/${portalId}/hubspot-object-pipelines/${hubspotObjectTypeId}",
|
|
166
131
|
// Stage
|
|
@@ -251,12 +216,25 @@ function isSensitiveQueryKey(key) {
|
|
|
251
216
|
const normalized = key.toLowerCase();
|
|
252
217
|
return SENSITIVE_QUERY_KEYS.has(normalized) || normalized.includes("password") || normalized.includes("token");
|
|
253
218
|
}
|
|
219
|
+
function resolveUrlBase() {
|
|
220
|
+
if (typeof window === "undefined") {
|
|
221
|
+
return "http://localhost";
|
|
222
|
+
}
|
|
223
|
+
try {
|
|
224
|
+
const origin = window.location?.origin;
|
|
225
|
+
if (typeof origin === "string" && origin.length > 0) {
|
|
226
|
+
return origin;
|
|
227
|
+
}
|
|
228
|
+
} catch {
|
|
229
|
+
}
|
|
230
|
+
return "http://localhost";
|
|
231
|
+
}
|
|
254
232
|
function sanitizeHttpUrl(url) {
|
|
255
233
|
if (url == null || url === "") {
|
|
256
234
|
return url;
|
|
257
235
|
}
|
|
258
236
|
try {
|
|
259
|
-
const base =
|
|
237
|
+
const base = resolveUrlBase();
|
|
260
238
|
const parsed = url.startsWith("http") ? new URL(url) : new URL(url, base);
|
|
261
239
|
for (const key of [...parsed.searchParams.keys()]) {
|
|
262
240
|
if (isSensitiveQueryKey(key)) {
|
|
@@ -286,6 +264,16 @@ function getHttpUrl(config4) {
|
|
|
286
264
|
// src/main/core/http/http-client.ts
|
|
287
265
|
var axiosInstance = null;
|
|
288
266
|
var config3 = {};
|
|
267
|
+
function hasBrowserLocation() {
|
|
268
|
+
if (typeof window === "undefined") {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
try {
|
|
272
|
+
return window.location != null;
|
|
273
|
+
} catch {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
289
277
|
function buildAuthPolicy() {
|
|
290
278
|
const routes = config3.routes ?? {};
|
|
291
279
|
const base = config3.authPolicy ?? {};
|
|
@@ -318,7 +306,7 @@ function formatUnauthorizedRoute(route) {
|
|
|
318
306
|
if (route.startsWith("#")) {
|
|
319
307
|
return route;
|
|
320
308
|
}
|
|
321
|
-
if (
|
|
309
|
+
if (hasBrowserLocation() && window.location.hash.startsWith("#/")) {
|
|
322
310
|
return `#${route.startsWith("/") ? route : `/${route}`}`;
|
|
323
311
|
}
|
|
324
312
|
return route;
|
|
@@ -328,7 +316,7 @@ function isRecoverableSessionExpiredCode(errorCode) {
|
|
|
328
316
|
}
|
|
329
317
|
function formatLoginRouteWithReturn(loginRoute) {
|
|
330
318
|
const loginPath = loginRoute.startsWith("/") ? loginRoute : `/${loginRoute}`;
|
|
331
|
-
if (
|
|
319
|
+
if (!hasBrowserLocation()) {
|
|
332
320
|
return formatUnauthorizedRoute(loginPath);
|
|
333
321
|
}
|
|
334
322
|
const returnPath = window.location.hash.replace(/^#/, "") || window.location.pathname;
|
|
@@ -338,7 +326,10 @@ function formatLoginRouteWithReturn(loginRoute) {
|
|
|
338
326
|
return formatUnauthorizedRoute(`${loginPath}?r=${encodeURIComponent(returnPath)}`);
|
|
339
327
|
}
|
|
340
328
|
function setBearerAuthorization(requestConfig, token) {
|
|
341
|
-
if (
|
|
329
|
+
if (!requestConfig.headers) {
|
|
330
|
+
requestConfig.headers = {};
|
|
331
|
+
}
|
|
332
|
+
if (typeof requestConfig.headers.set === "function") {
|
|
342
333
|
requestConfig.headers.set("Authorization", `Bearer ${token}`);
|
|
343
334
|
return;
|
|
344
335
|
}
|
|
@@ -358,7 +349,7 @@ async function handleAuthHttpError(error, axiosInstanceRef) {
|
|
|
358
349
|
return Promise.reject(error);
|
|
359
350
|
}
|
|
360
351
|
const { parseApiErrorPayload } = await import('./auth-error-codes-D7CXVBEN.js');
|
|
361
|
-
const { persistAuthError, resolveAuthErrorAction } = await import('./auth-interceptor-policy-
|
|
352
|
+
const { persistAuthError, resolveAuthErrorAction } = await import('./auth-interceptor-policy-RGQ26NWR.js');
|
|
362
353
|
const reqConfig = error.config;
|
|
363
354
|
const payload = parseApiErrorPayload(error.response.data);
|
|
364
355
|
const action = resolveAuthErrorAction({
|
|
@@ -390,7 +381,7 @@ async function handleAuthHttpError(error, axiosInstanceRef) {
|
|
|
390
381
|
void config3.onLogout?.();
|
|
391
382
|
const policy = buildAuthPolicy();
|
|
392
383
|
const destination = isRecoverableSessionExpiredCode(payload.errorCode) ? formatLoginRouteWithReturn(policy.routes.login) : formatUnauthorizedRoute(policy.routes.unauthorized);
|
|
393
|
-
if (
|
|
384
|
+
if (hasBrowserLocation()) {
|
|
394
385
|
window.location.replace(destination);
|
|
395
386
|
}
|
|
396
387
|
return Promise.reject(error);
|
|
@@ -400,7 +391,7 @@ async function handleAuthHttpError(error, axiosInstanceRef) {
|
|
|
400
391
|
if (action.clearSession) {
|
|
401
392
|
void config3.onLogout?.();
|
|
402
393
|
}
|
|
403
|
-
if (
|
|
394
|
+
if (hasBrowserLocation()) {
|
|
404
395
|
window.location.replace(formatUnauthorizedRoute(action.route));
|
|
405
396
|
}
|
|
406
397
|
}
|
|
@@ -413,7 +404,9 @@ function persistHubContextFromClientConfig(clientConfig) {
|
|
|
413
404
|
next[HUB_ID] = String(clientConfig.hubId);
|
|
414
405
|
}
|
|
415
406
|
if (clientConfig.devPortalId != null && String(clientConfig.devPortalId).trim() !== "") {
|
|
416
|
-
|
|
407
|
+
const portalId = String(clientConfig.devPortalId);
|
|
408
|
+
next[DEV_PORTAL_ID] = portalId;
|
|
409
|
+
next[PORTAL_ID] = portalId;
|
|
417
410
|
} else {
|
|
418
411
|
delete next[DEV_PORTAL_ID];
|
|
419
412
|
}
|
|
@@ -440,11 +433,13 @@ function initializeHttpClient(clientConfig) {
|
|
|
440
433
|
if (clientConfig.storageKeys != null) {
|
|
441
434
|
configureStorageKeys(clientConfig.storageKeys);
|
|
442
435
|
}
|
|
443
|
-
void import('./storage-migration-
|
|
436
|
+
void import('./storage-migration-2PF52ZSB.js').then(({ migrateLegacyStorageKeys }) => {
|
|
444
437
|
migrateLegacyStorageKeys();
|
|
438
|
+
}).catch(() => {
|
|
445
439
|
});
|
|
446
|
-
void import('./cross-tab-session-
|
|
440
|
+
void import('./cross-tab-session-B34BLQU4.js').then(({ installCrossTabSessionListener }) => {
|
|
447
441
|
installCrossTabSessionListener();
|
|
442
|
+
}).catch(() => {
|
|
448
443
|
});
|
|
449
444
|
setIframeStorageMode(clientConfig.storageMode === "iframe");
|
|
450
445
|
if (typeof clientConfig.refreshBufferSeconds === "number") {
|
|
@@ -458,7 +453,7 @@ function initializeHttpClient(clientConfig) {
|
|
|
458
453
|
throw new Error("WoodsPortal SDK HTTP client is not configured. Call initializeHttpClient({ baseURL }) at app startup.");
|
|
459
454
|
}
|
|
460
455
|
const timeout = config3.timeout ?? 5e4;
|
|
461
|
-
axiosInstance =
|
|
456
|
+
axiosInstance = axios.create({
|
|
462
457
|
baseURL,
|
|
463
458
|
timeout,
|
|
464
459
|
headers: {
|
|
@@ -489,7 +484,7 @@ function initializeHttpClient(clientConfig) {
|
|
|
489
484
|
}
|
|
490
485
|
const token = getAccessToken();
|
|
491
486
|
if (token) {
|
|
492
|
-
requestConfig
|
|
487
|
+
setBearerAuthorization(requestConfig, token);
|
|
493
488
|
}
|
|
494
489
|
return requestConfig;
|
|
495
490
|
});
|
|
@@ -507,7 +502,7 @@ function initializeHttpClient(clientConfig) {
|
|
|
507
502
|
return response;
|
|
508
503
|
},
|
|
509
504
|
(error) => {
|
|
510
|
-
if (
|
|
505
|
+
if (axios.isAxiosError(error) && error.config) {
|
|
511
506
|
const status = error.response?.status;
|
|
512
507
|
if (isHttpTracingEnabled()) {
|
|
513
508
|
logger.debug("http", "request failed", {
|
|
@@ -617,13 +612,13 @@ var AuthHttpClient = class {
|
|
|
617
612
|
}
|
|
618
613
|
};
|
|
619
614
|
function getFormErrors(error) {
|
|
620
|
-
if (
|
|
615
|
+
if (axios.isAxiosError(error)) {
|
|
621
616
|
return error.response?.data?.message ?? null;
|
|
622
617
|
}
|
|
623
618
|
return null;
|
|
624
619
|
}
|
|
625
620
|
function getFieldErrors(error) {
|
|
626
|
-
if (
|
|
621
|
+
if (axios.isAxiosError(error)) {
|
|
627
622
|
return error.response?.data?.errors ?? null;
|
|
628
623
|
}
|
|
629
624
|
return null;
|
|
@@ -655,6 +650,13 @@ function clearSessionAfterRefreshFailure() {
|
|
|
655
650
|
async function getAuthRefreshToken(refreshToken) {
|
|
656
651
|
refreshCallbackInFlight = true;
|
|
657
652
|
try {
|
|
653
|
+
const hubId = config.hubId;
|
|
654
|
+
if (hubId == null || String(hubId).trim() === "") {
|
|
655
|
+
return { token: null, success: false, failureKind: "missing_context" };
|
|
656
|
+
}
|
|
657
|
+
if (refreshToken == null || refreshToken.trim() === "") {
|
|
658
|
+
return { token: null, success: false, failureKind: "missing_refresh_token" };
|
|
659
|
+
}
|
|
658
660
|
const headers = {};
|
|
659
661
|
if (config.devPortalId) {
|
|
660
662
|
headers["X-Dev-Portal-Id"] = config.devPortalId;
|
|
@@ -664,30 +666,64 @@ async function getAuthRefreshToken(refreshToken) {
|
|
|
664
666
|
try {
|
|
665
667
|
response = await postRefreshCookie(headers);
|
|
666
668
|
} catch {
|
|
667
|
-
if (refreshToken == null || refreshToken.trim() === "") {
|
|
668
|
-
return { token: null, success: false };
|
|
669
|
-
}
|
|
670
669
|
const apiUrl = generateApiUrl({
|
|
671
670
|
route: API_ENDPOINTS.AUTH_REFRESH,
|
|
672
671
|
queryParams: { hubId: config.hubId }
|
|
673
672
|
});
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
673
|
+
try {
|
|
674
|
+
response = await getAxiosInstance().post(apiUrl, { refreshToken }, {
|
|
675
|
+
headers,
|
|
676
|
+
skipGlobalAuthRedirect: true
|
|
677
|
+
});
|
|
678
|
+
} catch (bodyError) {
|
|
679
|
+
const failureKind2 = classifyRefreshHttpError(bodyError);
|
|
680
|
+
if (shouldLogoutAfterRefreshFailure(failureKind2)) {
|
|
681
|
+
clearSessionAfterRefreshFailure();
|
|
682
|
+
}
|
|
683
|
+
if (failureKind2 === "transient") {
|
|
684
|
+
notifyServiceUnavailable(bodyError);
|
|
685
|
+
logger.warn("auth", bodyError instanceof Error ? bodyError.message : "token refresh failed", {
|
|
686
|
+
operation: "token refresh",
|
|
687
|
+
failureKind: failureKind2
|
|
688
|
+
});
|
|
689
|
+
} else {
|
|
690
|
+
logger.error("auth", bodyError instanceof Error ? bodyError.message : "token refresh failed", {
|
|
691
|
+
operation: "token refresh",
|
|
692
|
+
failureKind: failureKind2
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
return { token: null, success: false, failureKind: failureKind2 };
|
|
696
|
+
}
|
|
678
697
|
}
|
|
679
698
|
} else {
|
|
680
|
-
if (refreshToken == null || refreshToken.trim() === "") {
|
|
681
|
-
return { token: null, success: false };
|
|
682
|
-
}
|
|
683
699
|
const apiUrl = generateApiUrl({
|
|
684
700
|
route: API_ENDPOINTS.AUTH_REFRESH,
|
|
685
701
|
queryParams: { hubId: config.hubId }
|
|
686
702
|
});
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
703
|
+
try {
|
|
704
|
+
response = await getAxiosInstance().post(apiUrl, { refreshToken }, {
|
|
705
|
+
headers,
|
|
706
|
+
skipGlobalAuthRedirect: true
|
|
707
|
+
});
|
|
708
|
+
} catch (error) {
|
|
709
|
+
const failureKind2 = classifyRefreshHttpError(error);
|
|
710
|
+
if (shouldLogoutAfterRefreshFailure(failureKind2)) {
|
|
711
|
+
clearSessionAfterRefreshFailure();
|
|
712
|
+
}
|
|
713
|
+
if (failureKind2 === "transient") {
|
|
714
|
+
notifyServiceUnavailable(error);
|
|
715
|
+
logger.warn("auth", error instanceof Error ? error.message : "token refresh failed", {
|
|
716
|
+
operation: "token refresh",
|
|
717
|
+
failureKind: failureKind2
|
|
718
|
+
});
|
|
719
|
+
} else {
|
|
720
|
+
logger.error("auth", error instanceof Error ? error.message : "token refresh failed", {
|
|
721
|
+
operation: "token refresh",
|
|
722
|
+
failureKind: failureKind2
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
return { token: null, success: false, failureKind: failureKind2 };
|
|
726
|
+
}
|
|
691
727
|
}
|
|
692
728
|
const maybeData = response?.data?.data || response?.data;
|
|
693
729
|
const tokenData = maybeData?.tokenData || maybeData || {};
|
|
@@ -709,13 +745,20 @@ async function getAuthRefreshToken(refreshToken) {
|
|
|
709
745
|
storAccessToken(token, typeof expiresIn === "number" ? expiresIn : void 0);
|
|
710
746
|
return { token, success: true };
|
|
711
747
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
748
|
+
const failureKind = classifyRefreshResponseWithoutToken(response);
|
|
749
|
+
if (shouldLogoutAfterRefreshFailure(failureKind)) {
|
|
750
|
+
clearSessionAfterRefreshFailure();
|
|
751
|
+
logger.error("auth", "refresh response missing access token", {
|
|
752
|
+
operation: "token refresh",
|
|
753
|
+
failureKind
|
|
754
|
+
});
|
|
755
|
+
} else {
|
|
756
|
+
logger.warn("auth", "refresh response missing access token", {
|
|
757
|
+
operation: "token refresh",
|
|
758
|
+
failureKind
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
return { token: null, success: false, failureKind };
|
|
719
762
|
} finally {
|
|
720
763
|
refreshCallbackInFlight = false;
|
|
721
764
|
}
|
|
@@ -1615,6 +1658,9 @@ var triggerPostWriteListPurge = (props) => {
|
|
|
1615
1658
|
if (!objectTypeId) {
|
|
1616
1659
|
return;
|
|
1617
1660
|
}
|
|
1661
|
+
if (getClientType() === "mobile") {
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1618
1664
|
const { queryParams, multiObjectsQueryParams } = tableStore.getState();
|
|
1619
1665
|
const listQuery = resolveCrmListPurgeQuery({
|
|
1620
1666
|
componentName: props.componentName,
|
|
@@ -1624,12 +1670,13 @@ var triggerPostWriteListPurge = (props) => {
|
|
|
1624
1670
|
writeContext: recordWriteContext(props.paramsObject)
|
|
1625
1671
|
});
|
|
1626
1672
|
const recordIds = props.recordId ? [String(props.recordId)] : void 0;
|
|
1627
|
-
purgeCrmListCacheAfterCrmWrite({
|
|
1673
|
+
void purgeCrmListCacheAfterCrmWrite({
|
|
1628
1674
|
objectTypeId: String(objectTypeId),
|
|
1629
1675
|
listQuery,
|
|
1630
1676
|
recordIds,
|
|
1631
1677
|
waitForWarm: true,
|
|
1632
1678
|
pollTimeoutMs: 45e3
|
|
1679
|
+
}).catch(() => {
|
|
1633
1680
|
});
|
|
1634
1681
|
};
|
|
1635
1682
|
var mergeRecordWriteBody = (payload, paramsObject, options) => {
|
|
@@ -1684,6 +1731,7 @@ var authenticationClient = {
|
|
|
1684
1731
|
resetPasswordVerifyToken: (data) => AuthHttpClient.post(API_ENDPOINTS.RESET_PASSWORD_VERIFY_TOKEN, data),
|
|
1685
1732
|
resetPassword: (data) => AuthHttpClient.post(API_ENDPOINTS.RESET_PASSWORD, data),
|
|
1686
1733
|
forgetPassword: (data) => AuthHttpClient.post(API_ENDPOINTS.FORGET_PASSWORD, data),
|
|
1734
|
+
verifyForgotPasswordOtp: (data) => AuthHttpClient.post(API_ENDPOINTS.FORGET_PASSWORD_OTP_VERIFY, data),
|
|
1687
1735
|
registerExistingUser: (data) => AuthHttpClient.post(API_ENDPOINTS.REGISTER_EXISTING_USER, data?.payload),
|
|
1688
1736
|
verifyEmailResend: (data) => AuthHttpClient.post(API_ENDPOINTS.VERIFY_EMAIL_RESEND, data),
|
|
1689
1737
|
resendEmail: (data) => AuthHttpClient.post(API_ENDPOINTS.RESEND_EMAIL, data),
|
|
@@ -1745,14 +1793,19 @@ var crmClient = {
|
|
|
1745
1793
|
const { paramsObject } = getParamDetails2({ type: payload?.componentName });
|
|
1746
1794
|
const userData = userStore.getState().profile;
|
|
1747
1795
|
const apiParams = {};
|
|
1748
|
-
|
|
1749
|
-
|
|
1796
|
+
const tableParams = payload?.tableParams && typeof payload.tableParams === "object" ? payload.tableParams : {};
|
|
1797
|
+
const parentObjectTypeId = paramsObject?.parentObjectTypeId ?? param?.parentObjectTypeId ?? tableParams.parentObjectTypeId;
|
|
1798
|
+
if (parentObjectTypeId) {
|
|
1799
|
+
apiParams.parentObjectTypeId = parentObjectTypeId;
|
|
1750
1800
|
} else if (payload?.isHome && userData?.crmProfile?.info?.objectTypeId && !param?.isPrimaryCompany) {
|
|
1751
1801
|
apiParams.parentObjectTypeId = userData?.crmProfile?.info?.objectTypeId;
|
|
1752
1802
|
} else if (payload?.isHome && userData?.crmProfile?.info?.objectTypeId && param?.isPrimaryCompany) {
|
|
1753
1803
|
apiParams.parentObjectTypeId = "0-2";
|
|
1754
1804
|
}
|
|
1755
|
-
|
|
1805
|
+
const isPrimaryCompany = param?.isPrimaryCompany ?? tableParams.isPrimaryCompany ?? paramsObject?.isPrimaryCompany;
|
|
1806
|
+
if (isPrimaryCompany !== void 0 && isPrimaryCompany !== null && isPrimaryCompany !== "") {
|
|
1807
|
+
apiParams.isPrimaryCompany = isPrimaryCompany;
|
|
1808
|
+
}
|
|
1756
1809
|
apiParams.cache = payload?.cache;
|
|
1757
1810
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.PIPELINES, params, queryParams: apiParams });
|
|
1758
1811
|
return HttpClient.get(apiUrl);
|
|
@@ -1926,17 +1979,35 @@ var crmClient = {
|
|
|
1926
1979
|
const isDdetails = props?.queryParams?.preview ? false : true;
|
|
1927
1980
|
const { paramsObject: urlParam, parentAccessLabel } = getParamDetails2("", isDdetails);
|
|
1928
1981
|
const hubspotObjectTypeId = ticketHubspotObjectTypeId();
|
|
1982
|
+
const previewParams = makePreviewParams(props);
|
|
1983
|
+
let objectId = null;
|
|
1984
|
+
if (props?.queryParams?.preview) {
|
|
1985
|
+
objectId = previewParams?.params?.objectId;
|
|
1986
|
+
} else {
|
|
1987
|
+
objectId = props?.params?.objectId;
|
|
1988
|
+
}
|
|
1929
1989
|
const params = {
|
|
1930
|
-
|
|
1931
|
-
// portalId: portalId,
|
|
1932
|
-
objectId: props?.params?.objectId,
|
|
1990
|
+
objectId,
|
|
1933
1991
|
id: props?.params?.id
|
|
1934
1992
|
};
|
|
1935
|
-
|
|
1993
|
+
let queryParams = {
|
|
1936
1994
|
parentAccessLabel,
|
|
1937
1995
|
...props?.queryParams,
|
|
1938
1996
|
...urlParam
|
|
1939
1997
|
};
|
|
1998
|
+
if (props?.queryParams?.preview) {
|
|
1999
|
+
queryParams = {
|
|
2000
|
+
parentAccessLabel,
|
|
2001
|
+
...props?.queryParams,
|
|
2002
|
+
...previewParams?.queryParams
|
|
2003
|
+
};
|
|
2004
|
+
} else {
|
|
2005
|
+
queryParams = {
|
|
2006
|
+
parentAccessLabel,
|
|
2007
|
+
...props?.queryParams,
|
|
2008
|
+
...urlParam
|
|
2009
|
+
};
|
|
2010
|
+
}
|
|
1940
2011
|
if (hubspotObjectTypeId) queryParams.parentObjectTypeId = hubspotObjectTypeId;
|
|
1941
2012
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_DETAILS, params, queryParams });
|
|
1942
2013
|
return HttpClient.get(apiUrl);
|
|
@@ -2397,7 +2468,7 @@ async function createCachePurgeJob(request, options = {}) {
|
|
|
2397
2468
|
}
|
|
2398
2469
|
}
|
|
2399
2470
|
function logError(context, error) {
|
|
2400
|
-
if (
|
|
2471
|
+
if (axios.isAxiosError(error) && error.response?.status === 401) {
|
|
2401
2472
|
resetAllStore();
|
|
2402
2473
|
}
|
|
2403
2474
|
logger.error(context, error);
|
|
@@ -2435,6 +2506,6 @@ function createMutation(mutationFn, options) {
|
|
|
2435
2506
|
};
|
|
2436
2507
|
}
|
|
2437
2508
|
|
|
2438
|
-
export { Client,
|
|
2439
|
-
//# sourceMappingURL=chunk-
|
|
2440
|
-
//# sourceMappingURL=chunk-
|
|
2509
|
+
export { API_ENDPOINTS, Client, HttpClient, buildCachePurgeRequest, buildCrmListPurgeTarget, buildCrmSinglePurgeTarget, buildEngagementPurgeTarget, buildPortalConfigPurgeTarget, buildUserSessionPurgeTarget, createCachePurgeJob, createMutation, extractEngagementItemIdFromWriteResponse, extractHubspotRecordIdFromWriteResponse, generateApiUrl, getAuthRefreshToken, getFieldErrors, getFormErrors, initializeHttpClient, mergePurgeTargets, navigationApi, purgeCrmCombined, purgeCrmDetailAndListAfterCrmWrite, purgeCrmListCache, purgeCrmListCacheAfterCrmWrite, purgeCrmObjectDataCache, purgeCrmRecordCache, purgeEngagementCaches, purgeEngagementCachesAfterCrmWrite, resolveCrmListPurgeQuery, resolveListTableParams, setEditorPreviewMockHandler, startVisibilityRefreshScheduler, stopVisibilityRefreshScheduler, toCachePurgeListQuery };
|
|
2510
|
+
//# sourceMappingURL=chunk-C73AH5CW.js.map
|
|
2511
|
+
//# sourceMappingURL=chunk-C73AH5CW.js.map
|