woodsportal-client-sdk 4.0.7 → 4.0.8-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/README.md +26 -0
- package/dist/adapters/angular/index.js +8 -6
- 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 +9 -19
- package/dist/adapters/react/index.js.map +1 -1
- package/dist/adapters/vue/index.js +8 -6
- package/dist/adapters/vue/index.js.map +1 -1
- package/dist/auth-interceptor-policy-RGQ26NWR.js +6 -0
- package/dist/{auth-interceptor-policy-ACKZEQ6J.js.map → auth-interceptor-policy-RGQ26NWR.js.map} +1 -1
- package/dist/auth-utils-T4FIBK3O.js +7 -0
- package/dist/{auth-utils-CPO4LG4K.js.map → auth-utils-T4FIBK3O.js.map} +1 -1
- package/dist/{http-errors-CCCQECil.d.ts → build-error-description-XKI8vhGv.d.ts} +57 -6
- package/dist/{chunk-YZPW5F6U.js → chunk-5LISZE2R.js} +11 -7
- package/dist/chunk-5LISZE2R.js.map +1 -0
- package/dist/{chunk-BGUHACLT.js → chunk-AVMMEQLO.js} +3 -3
- package/dist/{chunk-BGUHACLT.js.map → chunk-AVMMEQLO.js.map} +1 -1
- package/dist/chunk-BXKFJ5NQ.js +1272 -0
- package/dist/chunk-BXKFJ5NQ.js.map +1 -0
- package/dist/chunk-DB6W3CJT.js +73 -0
- package/dist/chunk-DB6W3CJT.js.map +1 -0
- package/dist/{chunk-BKDJOWLW.js → chunk-ETYE73AH.js} +35 -8
- package/dist/chunk-ETYE73AH.js.map +1 -0
- package/dist/{chunk-ZQTCAG6K.js → chunk-JG3TEXWP.js} +7 -11
- package/dist/chunk-JG3TEXWP.js.map +1 -0
- package/dist/{chunk-WSUXZOHL.js → chunk-KPHAQNS2.js} +51 -6
- package/dist/chunk-KPHAQNS2.js.map +1 -0
- package/dist/{chunk-7J265W43.js → chunk-NDDE6ZZ3.js} +273 -87
- package/dist/chunk-NDDE6ZZ3.js.map +1 -0
- package/dist/{chunk-OAFDB4TJ.js → chunk-PVX6FWCW.js} +184 -104
- package/dist/chunk-PVX6FWCW.js.map +1 -0
- package/dist/{chunk-MO22VWRI.js → chunk-S3CVZTU4.js} +15 -9
- package/dist/chunk-S3CVZTU4.js.map +1 -0
- package/dist/{chunk-EFEBZBMU.js → chunk-UDAPRD7Z.js} +3 -2
- package/dist/chunk-UDAPRD7Z.js.map +1 -0
- package/dist/{chunk-TYJO2PSR.js → chunk-VN6VPM5C.js} +4 -4
- package/dist/{chunk-TYJO2PSR.js.map → chunk-VN6VPM5C.js.map} +1 -1
- 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-AGJVA2UZ.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-B-IGDI9L.d.ts} +11 -2
- package/dist/index.d.ts +45 -7
- package/dist/index.js +70 -17
- package/dist/index.js.map +1 -1
- package/dist/{pipeline-ui-DbEzI_v1.d.ts → pipeline-ui-COO9b3x2.d.ts} +2 -2
- package/dist/storage-migration-2PF52ZSB.js +4 -0
- package/dist/{storage-migration-CZTBKXQV.js.map → storage-migration-2PF52ZSB.js.map} +1 -1
- package/package.json +6 -1
- package/dist/auth-interceptor-policy-ACKZEQ6J.js +0 -5
- package/dist/auth-utils-CPO4LG4K.js +0 -5
- package/dist/chunk-7J265W43.js.map +0 -1
- package/dist/chunk-BKDJOWLW.js.map +0 -1
- package/dist/chunk-EFEBZBMU.js.map +0 -1
- package/dist/chunk-MO22VWRI.js.map +0 -1
- package/dist/chunk-OAFDB4TJ.js.map +0 -1
- package/dist/chunk-PK7GZY5P.js +0 -737
- package/dist/chunk-PK7GZY5P.js.map +0 -1
- package/dist/chunk-WSUXZOHL.js.map +0 -1
- package/dist/chunk-YZPW5F6U.js.map +0 -1
- package/dist/chunk-ZQTCAG6K.js.map +0 -1
- package/dist/cross-tab-session-AGJVA2UZ.js +0 -9
- package/dist/storage-migration-CZTBKXQV.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 ?? {};
|
|
@@ -299,6 +287,7 @@ function buildAuthPolicy() {
|
|
|
299
287
|
...base.routes
|
|
300
288
|
},
|
|
301
289
|
optionalAuthFailurePaths: base.optionalAuthFailurePaths ?? [
|
|
290
|
+
API_ENDPOINTS.LOGOUT,
|
|
302
291
|
API_ENDPOINTS.MFA_STATUS,
|
|
303
292
|
API_ENDPOINTS.MFA_PREFERENCES,
|
|
304
293
|
API_ENDPOINTS.MFA_TOTP_ENROLL_START,
|
|
@@ -318,7 +307,7 @@ function formatUnauthorizedRoute(route) {
|
|
|
318
307
|
if (route.startsWith("#")) {
|
|
319
308
|
return route;
|
|
320
309
|
}
|
|
321
|
-
if (
|
|
310
|
+
if (hasBrowserLocation() && window.location.hash.startsWith("#/")) {
|
|
322
311
|
return `#${route.startsWith("/") ? route : `/${route}`}`;
|
|
323
312
|
}
|
|
324
313
|
return route;
|
|
@@ -328,7 +317,7 @@ function isRecoverableSessionExpiredCode(errorCode) {
|
|
|
328
317
|
}
|
|
329
318
|
function formatLoginRouteWithReturn(loginRoute) {
|
|
330
319
|
const loginPath = loginRoute.startsWith("/") ? loginRoute : `/${loginRoute}`;
|
|
331
|
-
if (
|
|
320
|
+
if (!hasBrowserLocation()) {
|
|
332
321
|
return formatUnauthorizedRoute(loginPath);
|
|
333
322
|
}
|
|
334
323
|
const returnPath = window.location.hash.replace(/^#/, "") || window.location.pathname;
|
|
@@ -338,7 +327,10 @@ function formatLoginRouteWithReturn(loginRoute) {
|
|
|
338
327
|
return formatUnauthorizedRoute(`${loginPath}?r=${encodeURIComponent(returnPath)}`);
|
|
339
328
|
}
|
|
340
329
|
function setBearerAuthorization(requestConfig, token) {
|
|
341
|
-
if (
|
|
330
|
+
if (!requestConfig.headers) {
|
|
331
|
+
requestConfig.headers = {};
|
|
332
|
+
}
|
|
333
|
+
if (typeof requestConfig.headers.set === "function") {
|
|
342
334
|
requestConfig.headers.set("Authorization", `Bearer ${token}`);
|
|
343
335
|
return;
|
|
344
336
|
}
|
|
@@ -358,7 +350,7 @@ async function handleAuthHttpError(error, axiosInstanceRef) {
|
|
|
358
350
|
return Promise.reject(error);
|
|
359
351
|
}
|
|
360
352
|
const { parseApiErrorPayload } = await import('./auth-error-codes-D7CXVBEN.js');
|
|
361
|
-
const { persistAuthError, resolveAuthErrorAction } = await import('./auth-interceptor-policy-
|
|
353
|
+
const { persistAuthError, resolveAuthErrorAction } = await import('./auth-interceptor-policy-RGQ26NWR.js');
|
|
362
354
|
const reqConfig = error.config;
|
|
363
355
|
const payload = parseApiErrorPayload(error.response.data);
|
|
364
356
|
const action = resolveAuthErrorAction({
|
|
@@ -390,7 +382,7 @@ async function handleAuthHttpError(error, axiosInstanceRef) {
|
|
|
390
382
|
void config3.onLogout?.();
|
|
391
383
|
const policy = buildAuthPolicy();
|
|
392
384
|
const destination = isRecoverableSessionExpiredCode(payload.errorCode) ? formatLoginRouteWithReturn(policy.routes.login) : formatUnauthorizedRoute(policy.routes.unauthorized);
|
|
393
|
-
if (
|
|
385
|
+
if (hasBrowserLocation()) {
|
|
394
386
|
window.location.replace(destination);
|
|
395
387
|
}
|
|
396
388
|
return Promise.reject(error);
|
|
@@ -400,7 +392,7 @@ async function handleAuthHttpError(error, axiosInstanceRef) {
|
|
|
400
392
|
if (action.clearSession) {
|
|
401
393
|
void config3.onLogout?.();
|
|
402
394
|
}
|
|
403
|
-
if (
|
|
395
|
+
if (hasBrowserLocation()) {
|
|
404
396
|
window.location.replace(formatUnauthorizedRoute(action.route));
|
|
405
397
|
}
|
|
406
398
|
}
|
|
@@ -413,7 +405,9 @@ function persistHubContextFromClientConfig(clientConfig) {
|
|
|
413
405
|
next[HUB_ID] = String(clientConfig.hubId);
|
|
414
406
|
}
|
|
415
407
|
if (clientConfig.devPortalId != null && String(clientConfig.devPortalId).trim() !== "") {
|
|
416
|
-
|
|
408
|
+
const portalId = String(clientConfig.devPortalId);
|
|
409
|
+
next[DEV_PORTAL_ID] = portalId;
|
|
410
|
+
next[PORTAL_ID] = portalId;
|
|
417
411
|
} else {
|
|
418
412
|
delete next[DEV_PORTAL_ID];
|
|
419
413
|
}
|
|
@@ -440,11 +434,13 @@ function initializeHttpClient(clientConfig) {
|
|
|
440
434
|
if (clientConfig.storageKeys != null) {
|
|
441
435
|
configureStorageKeys(clientConfig.storageKeys);
|
|
442
436
|
}
|
|
443
|
-
void import('./storage-migration-
|
|
437
|
+
void import('./storage-migration-2PF52ZSB.js').then(({ migrateLegacyStorageKeys }) => {
|
|
444
438
|
migrateLegacyStorageKeys();
|
|
439
|
+
}).catch(() => {
|
|
445
440
|
});
|
|
446
|
-
void import('./cross-tab-session-
|
|
441
|
+
void import('./cross-tab-session-B34BLQU4.js').then(({ installCrossTabSessionListener }) => {
|
|
447
442
|
installCrossTabSessionListener();
|
|
443
|
+
}).catch(() => {
|
|
448
444
|
});
|
|
449
445
|
setIframeStorageMode(clientConfig.storageMode === "iframe");
|
|
450
446
|
if (typeof clientConfig.refreshBufferSeconds === "number") {
|
|
@@ -458,7 +454,7 @@ function initializeHttpClient(clientConfig) {
|
|
|
458
454
|
throw new Error("WoodsPortal SDK HTTP client is not configured. Call initializeHttpClient({ baseURL }) at app startup.");
|
|
459
455
|
}
|
|
460
456
|
const timeout = config3.timeout ?? 5e4;
|
|
461
|
-
axiosInstance =
|
|
457
|
+
axiosInstance = axios.create({
|
|
462
458
|
baseURL,
|
|
463
459
|
timeout,
|
|
464
460
|
headers: {
|
|
@@ -489,7 +485,7 @@ function initializeHttpClient(clientConfig) {
|
|
|
489
485
|
}
|
|
490
486
|
const token = getAccessToken();
|
|
491
487
|
if (token) {
|
|
492
|
-
requestConfig
|
|
488
|
+
setBearerAuthorization(requestConfig, token);
|
|
493
489
|
}
|
|
494
490
|
return requestConfig;
|
|
495
491
|
});
|
|
@@ -507,7 +503,7 @@ function initializeHttpClient(clientConfig) {
|
|
|
507
503
|
return response;
|
|
508
504
|
},
|
|
509
505
|
(error) => {
|
|
510
|
-
if (
|
|
506
|
+
if (axios.isAxiosError(error) && error.config) {
|
|
511
507
|
const status = error.response?.status;
|
|
512
508
|
if (isHttpTracingEnabled()) {
|
|
513
509
|
logger.debug("http", "request failed", {
|
|
@@ -617,13 +613,13 @@ var AuthHttpClient = class {
|
|
|
617
613
|
}
|
|
618
614
|
};
|
|
619
615
|
function getFormErrors(error) {
|
|
620
|
-
if (
|
|
616
|
+
if (axios.isAxiosError(error)) {
|
|
621
617
|
return error.response?.data?.message ?? null;
|
|
622
618
|
}
|
|
623
619
|
return null;
|
|
624
620
|
}
|
|
625
621
|
function getFieldErrors(error) {
|
|
626
|
-
if (
|
|
622
|
+
if (axios.isAxiosError(error)) {
|
|
627
623
|
return error.response?.data?.errors ?? null;
|
|
628
624
|
}
|
|
629
625
|
return null;
|
|
@@ -655,6 +651,13 @@ function clearSessionAfterRefreshFailure() {
|
|
|
655
651
|
async function getAuthRefreshToken(refreshToken) {
|
|
656
652
|
refreshCallbackInFlight = true;
|
|
657
653
|
try {
|
|
654
|
+
const hubId = config.hubId;
|
|
655
|
+
if (hubId == null || String(hubId).trim() === "") {
|
|
656
|
+
return { token: null, success: false, failureKind: "missing_context" };
|
|
657
|
+
}
|
|
658
|
+
if (refreshToken == null || refreshToken.trim() === "") {
|
|
659
|
+
return { token: null, success: false, failureKind: "missing_refresh_token" };
|
|
660
|
+
}
|
|
658
661
|
const headers = {};
|
|
659
662
|
if (config.devPortalId) {
|
|
660
663
|
headers["X-Dev-Portal-Id"] = config.devPortalId;
|
|
@@ -664,30 +667,64 @@ async function getAuthRefreshToken(refreshToken) {
|
|
|
664
667
|
try {
|
|
665
668
|
response = await postRefreshCookie(headers);
|
|
666
669
|
} catch {
|
|
667
|
-
if (refreshToken == null || refreshToken.trim() === "") {
|
|
668
|
-
return { token: null, success: false };
|
|
669
|
-
}
|
|
670
670
|
const apiUrl = generateApiUrl({
|
|
671
671
|
route: API_ENDPOINTS.AUTH_REFRESH,
|
|
672
672
|
queryParams: { hubId: config.hubId }
|
|
673
673
|
});
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
674
|
+
try {
|
|
675
|
+
response = await getAxiosInstance().post(apiUrl, { refreshToken }, {
|
|
676
|
+
headers,
|
|
677
|
+
skipGlobalAuthRedirect: true
|
|
678
|
+
});
|
|
679
|
+
} catch (bodyError) {
|
|
680
|
+
const failureKind2 = classifyRefreshHttpError(bodyError);
|
|
681
|
+
if (shouldLogoutAfterRefreshFailure(failureKind2)) {
|
|
682
|
+
clearSessionAfterRefreshFailure();
|
|
683
|
+
}
|
|
684
|
+
if (failureKind2 === "transient") {
|
|
685
|
+
notifyServiceUnavailable(bodyError);
|
|
686
|
+
logger.warn("auth", bodyError instanceof Error ? bodyError.message : "token refresh failed", {
|
|
687
|
+
operation: "token refresh",
|
|
688
|
+
failureKind: failureKind2
|
|
689
|
+
});
|
|
690
|
+
} else {
|
|
691
|
+
logger.error("auth", bodyError instanceof Error ? bodyError.message : "token refresh failed", {
|
|
692
|
+
operation: "token refresh",
|
|
693
|
+
failureKind: failureKind2
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
return { token: null, success: false, failureKind: failureKind2 };
|
|
697
|
+
}
|
|
678
698
|
}
|
|
679
699
|
} else {
|
|
680
|
-
if (refreshToken == null || refreshToken.trim() === "") {
|
|
681
|
-
return { token: null, success: false };
|
|
682
|
-
}
|
|
683
700
|
const apiUrl = generateApiUrl({
|
|
684
701
|
route: API_ENDPOINTS.AUTH_REFRESH,
|
|
685
702
|
queryParams: { hubId: config.hubId }
|
|
686
703
|
});
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
704
|
+
try {
|
|
705
|
+
response = await getAxiosInstance().post(apiUrl, { refreshToken }, {
|
|
706
|
+
headers,
|
|
707
|
+
skipGlobalAuthRedirect: true
|
|
708
|
+
});
|
|
709
|
+
} catch (error) {
|
|
710
|
+
const failureKind2 = classifyRefreshHttpError(error);
|
|
711
|
+
if (shouldLogoutAfterRefreshFailure(failureKind2)) {
|
|
712
|
+
clearSessionAfterRefreshFailure();
|
|
713
|
+
}
|
|
714
|
+
if (failureKind2 === "transient") {
|
|
715
|
+
notifyServiceUnavailable(error);
|
|
716
|
+
logger.warn("auth", error instanceof Error ? error.message : "token refresh failed", {
|
|
717
|
+
operation: "token refresh",
|
|
718
|
+
failureKind: failureKind2
|
|
719
|
+
});
|
|
720
|
+
} else {
|
|
721
|
+
logger.error("auth", error instanceof Error ? error.message : "token refresh failed", {
|
|
722
|
+
operation: "token refresh",
|
|
723
|
+
failureKind: failureKind2
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
return { token: null, success: false, failureKind: failureKind2 };
|
|
727
|
+
}
|
|
691
728
|
}
|
|
692
729
|
const maybeData = response?.data?.data || response?.data;
|
|
693
730
|
const tokenData = maybeData?.tokenData || maybeData || {};
|
|
@@ -709,13 +746,20 @@ async function getAuthRefreshToken(refreshToken) {
|
|
|
709
746
|
storAccessToken(token, typeof expiresIn === "number" ? expiresIn : void 0);
|
|
710
747
|
return { token, success: true };
|
|
711
748
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
749
|
+
const failureKind = classifyRefreshResponseWithoutToken(response);
|
|
750
|
+
if (shouldLogoutAfterRefreshFailure(failureKind)) {
|
|
751
|
+
clearSessionAfterRefreshFailure();
|
|
752
|
+
logger.error("auth", "refresh response missing access token", {
|
|
753
|
+
operation: "token refresh",
|
|
754
|
+
failureKind
|
|
755
|
+
});
|
|
756
|
+
} else {
|
|
757
|
+
logger.warn("auth", "refresh response missing access token", {
|
|
758
|
+
operation: "token refresh",
|
|
759
|
+
failureKind
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
return { token: null, success: false, failureKind };
|
|
719
763
|
} finally {
|
|
720
764
|
refreshCallbackInFlight = false;
|
|
721
765
|
}
|
|
@@ -1615,6 +1659,9 @@ var triggerPostWriteListPurge = (props) => {
|
|
|
1615
1659
|
if (!objectTypeId) {
|
|
1616
1660
|
return;
|
|
1617
1661
|
}
|
|
1662
|
+
if (getClientType() === "mobile") {
|
|
1663
|
+
return;
|
|
1664
|
+
}
|
|
1618
1665
|
const { queryParams, multiObjectsQueryParams } = tableStore.getState();
|
|
1619
1666
|
const listQuery = resolveCrmListPurgeQuery({
|
|
1620
1667
|
componentName: props.componentName,
|
|
@@ -1624,12 +1671,13 @@ var triggerPostWriteListPurge = (props) => {
|
|
|
1624
1671
|
writeContext: recordWriteContext(props.paramsObject)
|
|
1625
1672
|
});
|
|
1626
1673
|
const recordIds = props.recordId ? [String(props.recordId)] : void 0;
|
|
1627
|
-
purgeCrmListCacheAfterCrmWrite({
|
|
1674
|
+
void purgeCrmListCacheAfterCrmWrite({
|
|
1628
1675
|
objectTypeId: String(objectTypeId),
|
|
1629
1676
|
listQuery,
|
|
1630
1677
|
recordIds,
|
|
1631
1678
|
waitForWarm: true,
|
|
1632
1679
|
pollTimeoutMs: 45e3
|
|
1680
|
+
}).catch(() => {
|
|
1633
1681
|
});
|
|
1634
1682
|
};
|
|
1635
1683
|
var mergeRecordWriteBody = (payload, paramsObject, options) => {
|
|
@@ -1667,9 +1715,15 @@ var authenticationClient = {
|
|
|
1667
1715
|
},
|
|
1668
1716
|
login: (data) => {
|
|
1669
1717
|
const queryParams = config.hubId ? { hubId: config.hubId } : null;
|
|
1718
|
+
const username = (data.username ?? data.email)?.trim();
|
|
1719
|
+
const body = {
|
|
1720
|
+
username,
|
|
1721
|
+
password: data.password,
|
|
1722
|
+
...data.rememberMe != null ? { rememberMe: data.rememberMe } : {}
|
|
1723
|
+
};
|
|
1670
1724
|
return AuthHttpClient.post(
|
|
1671
1725
|
generateApiUrl({ route: API_ENDPOINTS.LOGIN, queryParams }),
|
|
1672
|
-
|
|
1726
|
+
body,
|
|
1673
1727
|
config?.devPortalId && {
|
|
1674
1728
|
headers: {
|
|
1675
1729
|
"X-Dev-Portal-Id": config.devPortalId
|
|
@@ -1684,10 +1738,13 @@ var authenticationClient = {
|
|
|
1684
1738
|
resetPasswordVerifyToken: (data) => AuthHttpClient.post(API_ENDPOINTS.RESET_PASSWORD_VERIFY_TOKEN, data),
|
|
1685
1739
|
resetPassword: (data) => AuthHttpClient.post(API_ENDPOINTS.RESET_PASSWORD, data),
|
|
1686
1740
|
forgetPassword: (data) => AuthHttpClient.post(API_ENDPOINTS.FORGET_PASSWORD, data),
|
|
1741
|
+
verifyForgotPasswordOtp: (data) => AuthHttpClient.post(API_ENDPOINTS.FORGET_PASSWORD_OTP_VERIFY, data),
|
|
1687
1742
|
registerExistingUser: (data) => AuthHttpClient.post(API_ENDPOINTS.REGISTER_EXISTING_USER, data?.payload),
|
|
1688
1743
|
verifyEmailResend: (data) => AuthHttpClient.post(API_ENDPOINTS.VERIFY_EMAIL_RESEND, data),
|
|
1689
1744
|
resendEmail: (data) => AuthHttpClient.post(API_ENDPOINTS.RESEND_EMAIL, data),
|
|
1690
|
-
logout: () => HttpClient.post(API_ENDPOINTS.LOGOUT, null
|
|
1745
|
+
logout: () => HttpClient.post(API_ENDPOINTS.LOGOUT, null, {
|
|
1746
|
+
skipGlobalAuthRedirect: true
|
|
1747
|
+
}),
|
|
1691
1748
|
clientSession: (payload) => AuthHttpClient.post(
|
|
1692
1749
|
API_ENDPOINTS.CLIENT_SESSION,
|
|
1693
1750
|
{ refreshToken: payload.refreshToken ?? payload.accessToken },
|
|
@@ -1745,14 +1802,19 @@ var crmClient = {
|
|
|
1745
1802
|
const { paramsObject } = getParamDetails2({ type: payload?.componentName });
|
|
1746
1803
|
const userData = userStore.getState().profile;
|
|
1747
1804
|
const apiParams = {};
|
|
1748
|
-
|
|
1749
|
-
|
|
1805
|
+
const tableParams = payload?.tableParams && typeof payload.tableParams === "object" ? payload.tableParams : {};
|
|
1806
|
+
const parentObjectTypeId = paramsObject?.parentObjectTypeId ?? param?.parentObjectTypeId ?? tableParams.parentObjectTypeId;
|
|
1807
|
+
if (parentObjectTypeId) {
|
|
1808
|
+
apiParams.parentObjectTypeId = parentObjectTypeId;
|
|
1750
1809
|
} else if (payload?.isHome && userData?.crmProfile?.info?.objectTypeId && !param?.isPrimaryCompany) {
|
|
1751
1810
|
apiParams.parentObjectTypeId = userData?.crmProfile?.info?.objectTypeId;
|
|
1752
1811
|
} else if (payload?.isHome && userData?.crmProfile?.info?.objectTypeId && param?.isPrimaryCompany) {
|
|
1753
1812
|
apiParams.parentObjectTypeId = "0-2";
|
|
1754
1813
|
}
|
|
1755
|
-
|
|
1814
|
+
const isPrimaryCompany = param?.isPrimaryCompany ?? tableParams.isPrimaryCompany ?? paramsObject?.isPrimaryCompany;
|
|
1815
|
+
if (isPrimaryCompany !== void 0 && isPrimaryCompany !== null && isPrimaryCompany !== "") {
|
|
1816
|
+
apiParams.isPrimaryCompany = isPrimaryCompany;
|
|
1817
|
+
}
|
|
1756
1818
|
apiParams.cache = payload?.cache;
|
|
1757
1819
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.PIPELINES, params, queryParams: apiParams });
|
|
1758
1820
|
return HttpClient.get(apiUrl);
|
|
@@ -1926,17 +1988,35 @@ var crmClient = {
|
|
|
1926
1988
|
const isDdetails = props?.queryParams?.preview ? false : true;
|
|
1927
1989
|
const { paramsObject: urlParam, parentAccessLabel } = getParamDetails2("", isDdetails);
|
|
1928
1990
|
const hubspotObjectTypeId = ticketHubspotObjectTypeId();
|
|
1991
|
+
const previewParams = makePreviewParams(props);
|
|
1992
|
+
let objectId = null;
|
|
1993
|
+
if (props?.queryParams?.preview) {
|
|
1994
|
+
objectId = previewParams?.params?.objectId;
|
|
1995
|
+
} else {
|
|
1996
|
+
objectId = props?.params?.objectId;
|
|
1997
|
+
}
|
|
1929
1998
|
const params = {
|
|
1930
|
-
|
|
1931
|
-
// portalId: portalId,
|
|
1932
|
-
objectId: props?.params?.objectId,
|
|
1999
|
+
objectId,
|
|
1933
2000
|
id: props?.params?.id
|
|
1934
2001
|
};
|
|
1935
|
-
|
|
2002
|
+
let queryParams = {
|
|
1936
2003
|
parentAccessLabel,
|
|
1937
2004
|
...props?.queryParams,
|
|
1938
2005
|
...urlParam
|
|
1939
2006
|
};
|
|
2007
|
+
if (props?.queryParams?.preview) {
|
|
2008
|
+
queryParams = {
|
|
2009
|
+
parentAccessLabel,
|
|
2010
|
+
...props?.queryParams,
|
|
2011
|
+
...previewParams?.queryParams
|
|
2012
|
+
};
|
|
2013
|
+
} else {
|
|
2014
|
+
queryParams = {
|
|
2015
|
+
parentAccessLabel,
|
|
2016
|
+
...props?.queryParams,
|
|
2017
|
+
...urlParam
|
|
2018
|
+
};
|
|
2019
|
+
}
|
|
1940
2020
|
if (hubspotObjectTypeId) queryParams.parentObjectTypeId = hubspotObjectTypeId;
|
|
1941
2021
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_DETAILS, params, queryParams });
|
|
1942
2022
|
return HttpClient.get(apiUrl);
|
|
@@ -2397,7 +2477,7 @@ async function createCachePurgeJob(request, options = {}) {
|
|
|
2397
2477
|
}
|
|
2398
2478
|
}
|
|
2399
2479
|
function logError(context, error) {
|
|
2400
|
-
if (
|
|
2480
|
+
if (axios.isAxiosError(error) && error.response?.status === 401) {
|
|
2401
2481
|
resetAllStore();
|
|
2402
2482
|
}
|
|
2403
2483
|
logger.error(context, error);
|
|
@@ -2435,6 +2515,6 @@ function createMutation(mutationFn, options) {
|
|
|
2435
2515
|
};
|
|
2436
2516
|
}
|
|
2437
2517
|
|
|
2438
|
-
export { Client,
|
|
2439
|
-
//# sourceMappingURL=chunk-
|
|
2440
|
-
//# sourceMappingURL=chunk-
|
|
2518
|
+
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 };
|
|
2519
|
+
//# sourceMappingURL=chunk-PVX6FWCW.js.map
|
|
2520
|
+
//# sourceMappingURL=chunk-PVX6FWCW.js.map
|