woodsportal-client-sdk 4.0.4-dev.8 → 4.0.7-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/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-BSY5KIIA.js +5 -0
- package/dist/auth-interceptor-policy-BSY5KIIA.js.map +1 -0
- package/dist/auth-utils-XIHNYE63.js +5 -0
- package/dist/{auth-utils-MNMC2QGX.js.map → auth-utils-XIHNYE63.js.map} +1 -1
- package/dist/{chunk-6IRXCBBP.js → chunk-4IKGBHFJ.js} +454 -258
- package/dist/chunk-4IKGBHFJ.js.map +1 -0
- package/dist/chunk-55MIERLJ.js +3 -0
- package/dist/chunk-55MIERLJ.js.map +1 -0
- package/dist/chunk-6ROV3EE2.js +160 -0
- package/dist/chunk-6ROV3EE2.js.map +1 -0
- package/dist/{chunk-IBKBTIT6.js → chunk-7OGXVANB.js} +6 -6
- package/dist/{chunk-IBKBTIT6.js.map → chunk-7OGXVANB.js.map} +1 -1
- package/dist/chunk-ADOV2R3A.js +571 -0
- package/dist/chunk-ADOV2R3A.js.map +1 -0
- package/dist/chunk-COHBSTHF.js +82 -0
- package/dist/chunk-COHBSTHF.js.map +1 -0
- package/dist/chunk-DZC3DJUO.js +156 -0
- package/dist/chunk-DZC3DJUO.js.map +1 -0
- package/dist/{chunk-LCHJO5TU.js → chunk-GVXA7OKY.js} +14 -13
- package/dist/chunk-GVXA7OKY.js.map +1 -0
- package/dist/chunk-J33YFZCS.js +162 -0
- package/dist/chunk-J33YFZCS.js.map +1 -0
- package/dist/{chunk-7Q6HRCUA.js → chunk-OF5OLEE5.js} +3 -3
- package/dist/{chunk-7Q6HRCUA.js.map → chunk-OF5OLEE5.js.map} +1 -1
- package/dist/{chunk-ZEJGWZK3.js → chunk-U66LWTVC.js} +1242 -1269
- package/dist/chunk-U66LWTVC.js.map +1 -0
- package/dist/{chunk-EVRUWZUS.js → chunk-WNBF6FKG.js} +165 -13
- package/dist/chunk-WNBF6FKG.js.map +1 -0
- package/dist/chunk-YOT5RW3R.js +306 -0
- package/dist/chunk-YOT5RW3R.js.map +1 -0
- package/dist/cross-tab-session-OJKWJSNT.js +9 -0
- package/dist/cross-tab-session-OJKWJSNT.js.map +1 -0
- package/dist/entries/auth.d.ts +15 -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-_XPPqJ_a.d.ts} +190 -9
- package/dist/index.d.ts +138 -3
- package/dist/index.js +16 -9
- package/dist/index.js.map +1 -1
- package/dist/refresh-lock-UW5RRRTD.js +72 -0
- package/dist/refresh-lock-UW5RRRTD.js.map +1 -0
- package/dist/storage-migration-OCOML7VA.js +4 -0
- package/dist/storage-migration-OCOML7VA.js.map +1 -0
- package/package.json +11 -9
- package/dist/auth-utils-MNMC2QGX.js +0 -3
- package/dist/chunk-6IRXCBBP.js.map +0 -1
- package/dist/chunk-EVRUWZUS.js.map +0 -1
- package/dist/chunk-LCHJO5TU.js.map +0 -1
- package/dist/chunk-QPSCMK4W.js +0 -237
- package/dist/chunk-QPSCMK4W.js.map +0 -1
- package/dist/chunk-ZEJGWZK3.js.map +0 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// src/main/core/auth/auth-error-codes.ts
|
|
2
|
+
var AuthErrorCode = {
|
|
3
|
+
AUTHENTICATION_FAILED: "AUTHENTICATION_FAILED",
|
|
4
|
+
TOKEN_INVALID: "AUTH_TOKEN_INVALID",
|
|
5
|
+
TOKEN_EXPIRED: "AUTH_TOKEN_EXPIRED",
|
|
6
|
+
ACCOUNT_LOCKED: "AUTH_ACCOUNT_LOCKED",
|
|
7
|
+
ACCOUNT_DISABLED: "AUTH_ACCOUNT_DISABLED",
|
|
8
|
+
LOGIN_FAILED: "LOGIN_FAILED",
|
|
9
|
+
INVALID_CREDENTIALS: "AUTH_INVALID_CREDENTIALS",
|
|
10
|
+
TWO_FACTOR_REQUIRED: "AUTH_2FA_REQUIRED",
|
|
11
|
+
EMAIL_NOT_VERIFIED: "AUTH_EMAIL_NOT_VERIFIED",
|
|
12
|
+
ACCESS_DENIED: "ACCESS_DENIED",
|
|
13
|
+
ACCESS_FORBIDDEN: "ACCESS_FORBIDDEN",
|
|
14
|
+
ACCESS_UNAUTHORIZED: "ACCESS_UNAUTHORIZED",
|
|
15
|
+
MISSING_REFRESH_TOKEN: "MISSING_REFRESH_TOKEN",
|
|
16
|
+
MISSING_HEADERS: "MISSING_HEADERS",
|
|
17
|
+
OAUTH_PROCESSING_ERROR: "OAUTH_PROCESSING_ERROR",
|
|
18
|
+
HUBSPOT_REAUTH_REQUIRED: "HUBSPOT_REAUTH_REQUIRED",
|
|
19
|
+
PORTAL_INACTIVE: "PORTAL_INACTIVE",
|
|
20
|
+
AMBIGUOUS_HUB_ID: "AMBIGUOUS_HUB_ID",
|
|
21
|
+
COMMERCIAL_ACCESS_EXPIRED: "COMMERCIAL_ACCESS_EXPIRED"
|
|
22
|
+
};
|
|
23
|
+
function parseApiErrorPayload(data) {
|
|
24
|
+
if (!data || typeof data !== "object") {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
const payload = data;
|
|
28
|
+
return {
|
|
29
|
+
errorCode: typeof payload.errorCode === "string" ? payload.errorCode : void 0,
|
|
30
|
+
errorMessage: typeof payload.errorMessage === "string" ? payload.errorMessage : typeof payload.message === "string" ? payload.message : void 0,
|
|
31
|
+
detailedMessage: typeof payload.detailedMessage === "string" ? payload.detailedMessage : void 0,
|
|
32
|
+
correlationId: typeof payload.correlationId === "string" ? payload.correlationId : void 0,
|
|
33
|
+
statusCode: typeof payload.statusCode === "number" ? payload.statusCode : void 0,
|
|
34
|
+
category: typeof payload.category === "string" ? payload.category : void 0
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function getUnauthorizedPageCopy(errorCode, fallbackMessage) {
|
|
38
|
+
switch (errorCode) {
|
|
39
|
+
case AuthErrorCode.HUBSPOT_REAUTH_REQUIRED:
|
|
40
|
+
return {
|
|
41
|
+
title: "HubSpot re-authorization required",
|
|
42
|
+
message: fallbackMessage ?? "Reconnect your HubSpot account to continue using WoodsPortal.",
|
|
43
|
+
buttonLabel: "Go to HubSpot Accounts",
|
|
44
|
+
clearSessionOnMount: false
|
|
45
|
+
};
|
|
46
|
+
case AuthErrorCode.ACCOUNT_LOCKED:
|
|
47
|
+
case AuthErrorCode.ACCOUNT_DISABLED:
|
|
48
|
+
return {
|
|
49
|
+
title: "Account unavailable",
|
|
50
|
+
message: fallbackMessage ?? "Your account is locked or disabled. Contact support if you need access.",
|
|
51
|
+
buttonLabel: "Go to Login",
|
|
52
|
+
clearSessionOnMount: true
|
|
53
|
+
};
|
|
54
|
+
case AuthErrorCode.ACCESS_DENIED:
|
|
55
|
+
case AuthErrorCode.ACCESS_FORBIDDEN:
|
|
56
|
+
return {
|
|
57
|
+
title: "Access denied",
|
|
58
|
+
message: fallbackMessage ?? "You do not have permission to perform this action.",
|
|
59
|
+
buttonLabel: "Go to Login",
|
|
60
|
+
clearSessionOnMount: false
|
|
61
|
+
};
|
|
62
|
+
case AuthErrorCode.TOKEN_EXPIRED:
|
|
63
|
+
case AuthErrorCode.TOKEN_INVALID:
|
|
64
|
+
return {
|
|
65
|
+
title: "Session expired",
|
|
66
|
+
message: fallbackMessage ?? "Your session has expired. Please log in again to continue.",
|
|
67
|
+
buttonLabel: "Go to Login",
|
|
68
|
+
clearSessionOnMount: true
|
|
69
|
+
};
|
|
70
|
+
default:
|
|
71
|
+
return {
|
|
72
|
+
title: "Unauthorized",
|
|
73
|
+
message: fallbackMessage ?? "Your session may have expired or you do not have the required permissions. Please log in again to continue.",
|
|
74
|
+
buttonLabel: "Go to Login",
|
|
75
|
+
clearSessionOnMount: true
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { AuthErrorCode, getUnauthorizedPageCopy, parseApiErrorPayload };
|
|
81
|
+
//# sourceMappingURL=chunk-COHBSTHF.js.map
|
|
82
|
+
//# sourceMappingURL=chunk-COHBSTHF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/main/core/auth/auth-error-codes.ts"],"names":[],"mappings":";AACO,IAAM,aAAA,GAAgB;AAAA,EACzB,qBAAA,EAAuB,uBAAA;AAAA,EACvB,aAAA,EAAe,oBAAA;AAAA,EACf,aAAA,EAAe,oBAAA;AAAA,EACf,cAAA,EAAgB,qBAAA;AAAA,EAChB,gBAAA,EAAkB,uBAAA;AAAA,EAClB,YAAA,EAAc,cAAA;AAAA,EACd,mBAAA,EAAqB,0BAAA;AAAA,EACrB,mBAAA,EAAqB,mBAAA;AAAA,EACrB,kBAAA,EAAoB,yBAAA;AAAA,EACpB,aAAA,EAAe,eAAA;AAAA,EACf,gBAAA,EAAkB,kBAAA;AAAA,EAClB,mBAAA,EAAqB,qBAAA;AAAA,EACrB,qBAAA,EAAuB,uBAAA;AAAA,EACvB,eAAA,EAAiB,iBAAA;AAAA,EACjB,sBAAA,EAAwB,wBAAA;AAAA,EACxB,uBAAA,EAAyB,yBAAA;AAAA,EACzB,eAAA,EAAiB,iBAAA;AAAA,EACjB,gBAAA,EAAkB,kBAAA;AAAA,EAClB,yBAAA,EAA2B;AAC/B;AAeO,SAAS,qBAAqB,IAAA,EAAgC;AACjE,EAA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AA,EAAqB;AAAA,OACzB;AAAA,IACJ,KAAK,aAAA,CAAc,aAAA;AAAA,IACnB,KAAK,aAAA,CAAc,gBAAA;AACf,MAAA,OAAO;AAAA,QACH,KAAA,EAAO,eAAA;AAAA,QACP,SAAS,eAAA,IAAmB,oDAAA;AAAA,QAC5B,WAAA,EAAa,aAAA;AAAA,QACb,mBAAA,EAAqB;AAAA,OACzB;AAAA,IACJ,KAAK,aAAA,CAAc,aAAA;AAAA,IACnB,KAAK,aAAA,CAAc,aAAA;AACf,MAAA,OAAO;AAAA,QACH,KAAA,EAAO,iBAAA;AAAA,QACP,SAAS,eAAA,IAAmB,4DAAA;AAAA,QAC5B,WAAA,EAAa,aAAA;AAAA,QACb,mBAAA,EAAqB;AAAA,OACzB;AAAA,IACJ;AACI,MAAA,OAAO;AAAA,QACH,KAAA,EAAO,cAAA;AAAA,QACP,SACI,eAAA,IAAmB,6GAAA;AAAA,QACvB,WAAA,EAAa,aAAA;AAAA,QACb,mBAAA,EAAqB;AAAA,OACzB;AAAA;AAEZ","file":"chunk-COHBSTHF.js","sourcesContent":["/** Auth-related API error codes (woodsportal-api ErrorCode.java + API-ERROR-CODES.md). */\nexport const AuthErrorCode = {\n AUTHENTICATION_FAILED: 'AUTHENTICATION_FAILED',\n TOKEN_INVALID: 'AUTH_TOKEN_INVALID',\n TOKEN_EXPIRED: 'AUTH_TOKEN_EXPIRED',\n ACCOUNT_LOCKED: 'AUTH_ACCOUNT_LOCKED',\n ACCOUNT_DISABLED: 'AUTH_ACCOUNT_DISABLED',\n LOGIN_FAILED: 'LOGIN_FAILED',\n INVALID_CREDENTIALS: 'AUTH_INVALID_CREDENTIALS',\n TWO_FACTOR_REQUIRED: 'AUTH_2FA_REQUIRED',\n EMAIL_NOT_VERIFIED: 'AUTH_EMAIL_NOT_VERIFIED',\n ACCESS_DENIED: 'ACCESS_DENIED',\n ACCESS_FORBIDDEN: 'ACCESS_FORBIDDEN',\n ACCESS_UNAUTHORIZED: 'ACCESS_UNAUTHORIZED',\n MISSING_REFRESH_TOKEN: 'MISSING_REFRESH_TOKEN',\n MISSING_HEADERS: 'MISSING_HEADERS',\n OAUTH_PROCESSING_ERROR: 'OAUTH_PROCESSING_ERROR',\n HUBSPOT_REAUTH_REQUIRED: 'HUBSPOT_REAUTH_REQUIRED',\n PORTAL_INACTIVE: 'PORTAL_INACTIVE',\n AMBIGUOUS_HUB_ID: 'AMBIGUOUS_HUB_ID',\n COMMERCIAL_ACCESS_EXPIRED: 'COMMERCIAL_ACCESS_EXPIRED'\n} as const\n\nexport type AuthErrorCodeValue = (typeof AuthErrorCode)[keyof typeof AuthErrorCode]\n\nexport type ApiErrorPayload = {\n errorCode?: string\n errorMessage?: string\n detailedMessage?: string\n correlationId?: string\n statusCode?: number\n category?: string\n}\n\nexport type StoredAuthError = ApiErrorPayload & { ts?: number }\n\nexport function parseApiErrorPayload(data: unknown): ApiErrorPayload {\n if (!data || typeof data !== 'object') {\n return {}\n }\n const payload = data as Record<string, unknown>\n return {\n errorCode: typeof payload.errorCode === 'string' ? payload.errorCode : undefined,\n errorMessage:\n typeof payload.errorMessage === 'string' ? payload.errorMessage : typeof payload.message === 'string' ? payload.message : undefined,\n detailedMessage: typeof payload.detailedMessage === 'string' ? payload.detailedMessage : undefined,\n correlationId: typeof payload.correlationId === 'string' ? payload.correlationId : undefined,\n statusCode: typeof payload.statusCode === 'number' ? payload.statusCode : undefined,\n category: typeof payload.category === 'string' ? payload.category : undefined\n }\n}\n\nexport type UnauthorizedPageCopy = {\n title: string\n message: string\n buttonLabel: string\n clearSessionOnMount: boolean\n}\n\nexport function getUnauthorizedPageCopy(errorCode?: string, fallbackMessage?: string): UnauthorizedPageCopy {\n switch (errorCode) {\n case AuthErrorCode.HUBSPOT_REAUTH_REQUIRED:\n return {\n title: 'HubSpot re-authorization required',\n message: fallbackMessage ?? 'Reconnect your HubSpot account to continue using WoodsPortal.',\n buttonLabel: 'Go to HubSpot Accounts',\n clearSessionOnMount: false\n }\n case AuthErrorCode.ACCOUNT_LOCKED:\n case AuthErrorCode.ACCOUNT_DISABLED:\n return {\n title: 'Account unavailable',\n message: fallbackMessage ?? 'Your account is locked or disabled. Contact support if you need access.',\n buttonLabel: 'Go to Login',\n clearSessionOnMount: true\n }\n case AuthErrorCode.ACCESS_DENIED:\n case AuthErrorCode.ACCESS_FORBIDDEN:\n return {\n title: 'Access denied',\n message: fallbackMessage ?? 'You do not have permission to perform this action.',\n buttonLabel: 'Go to Login',\n clearSessionOnMount: false\n }\n case AuthErrorCode.TOKEN_EXPIRED:\n case AuthErrorCode.TOKEN_INVALID:\n return {\n title: 'Session expired',\n message: fallbackMessage ?? 'Your session has expired. Please log in again to continue.',\n buttonLabel: 'Go to Login',\n clearSessionOnMount: true\n }\n default:\n return {\n title: 'Unauthorized',\n message:\n fallbackMessage ?? 'Your session may have expired or you do not have the required permissions. Please log in again to continue.',\n buttonLabel: 'Go to Login',\n clearSessionOnMount: true\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { AuthErrorCode } from './chunk-COHBSTHF.js';
|
|
2
|
+
import { WP_STORAGE_KEYS } from './chunk-6ROV3EE2.js';
|
|
3
|
+
|
|
4
|
+
// src/main/core/auth/auth-interceptor-policy.ts
|
|
5
|
+
var DEFAULT_SESSION_PROBE_SUFFIXES = ["/auth/me"];
|
|
6
|
+
function normalizeRequestUrl(url) {
|
|
7
|
+
if (!url) return "";
|
|
8
|
+
try {
|
|
9
|
+
if (url.startsWith("http")) {
|
|
10
|
+
return new URL(url).pathname;
|
|
11
|
+
}
|
|
12
|
+
} catch {
|
|
13
|
+
}
|
|
14
|
+
return url.split("?")[0] ?? url;
|
|
15
|
+
}
|
|
16
|
+
function isOptionalAuthFailureUrl(url, config) {
|
|
17
|
+
const path = normalizeRequestUrl(url);
|
|
18
|
+
if (!path) return false;
|
|
19
|
+
if (config.optionalAuthFailurePaths?.includes(path)) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (config.includeAdminMfaSecurityPrefixes) {
|
|
23
|
+
if (path.includes("/api/admin/auth/security/")) return true;
|
|
24
|
+
if (path.includes("/api/admin/auth/mfa/webauthn/")) return true;
|
|
25
|
+
if (path.includes("/api/auth/security/")) return true;
|
|
26
|
+
if (path.includes("/api/auth/mfa/webauthn/")) return true;
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
function isSessionProbeUrl(url, config) {
|
|
31
|
+
const path = normalizeRequestUrl(url);
|
|
32
|
+
if (!path) return false;
|
|
33
|
+
if (config.sessionProbePaths?.includes(path)) return true;
|
|
34
|
+
return DEFAULT_SESSION_PROBE_SUFFIXES.some((suffix) => path.endsWith(suffix));
|
|
35
|
+
}
|
|
36
|
+
function persistAuthError(payload) {
|
|
37
|
+
const data = {
|
|
38
|
+
...payload,
|
|
39
|
+
ts: Date.now()
|
|
40
|
+
};
|
|
41
|
+
if (typeof window !== "undefined" && window.sessionStorage) {
|
|
42
|
+
sessionStorage.setItem(WP_STORAGE_KEYS.c.auth.err, JSON.stringify(data));
|
|
43
|
+
sessionStorage.removeItem("authError");
|
|
44
|
+
}
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
function readPersistedAuthError() {
|
|
48
|
+
if (typeof window === "undefined" || !window.sessionStorage) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const raw = window.sessionStorage.getItem(WP_STORAGE_KEYS.c.auth.err) ?? window.sessionStorage.getItem("authError");
|
|
52
|
+
if (!raw) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
return JSON.parse(raw);
|
|
57
|
+
} catch {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function logoutAction(errorCode, routes) {
|
|
62
|
+
if (errorCode === AuthErrorCode.HUBSPOT_REAUTH_REQUIRED) {
|
|
63
|
+
return {
|
|
64
|
+
kind: "redirect",
|
|
65
|
+
route: routes.accountSelect,
|
|
66
|
+
clearSession: false
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
kind: "logout",
|
|
71
|
+
route: routes.unauthorized,
|
|
72
|
+
clearSession: true
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function resolveByErrorCode(errorCode, status, url, isRetryRequest, policy) {
|
|
76
|
+
const { routes } = policy;
|
|
77
|
+
switch (errorCode) {
|
|
78
|
+
case AuthErrorCode.TOKEN_EXPIRED:
|
|
79
|
+
case AuthErrorCode.TOKEN_INVALID:
|
|
80
|
+
case AuthErrorCode.AUTHENTICATION_FAILED:
|
|
81
|
+
return isRetryRequest ? logoutAction(errorCode, routes) : { kind: "refresh_retry" };
|
|
82
|
+
case AuthErrorCode.MISSING_REFRESH_TOKEN:
|
|
83
|
+
case AuthErrorCode.ACCESS_UNAUTHORIZED:
|
|
84
|
+
return logoutAction(errorCode, routes);
|
|
85
|
+
case AuthErrorCode.ACCOUNT_LOCKED:
|
|
86
|
+
case AuthErrorCode.ACCOUNT_DISABLED:
|
|
87
|
+
return {
|
|
88
|
+
kind: "redirect",
|
|
89
|
+
route: routes.unauthorized,
|
|
90
|
+
clearSession: true
|
|
91
|
+
};
|
|
92
|
+
case AuthErrorCode.LOGIN_FAILED:
|
|
93
|
+
case AuthErrorCode.INVALID_CREDENTIALS:
|
|
94
|
+
return { kind: "reject" };
|
|
95
|
+
case AuthErrorCode.EMAIL_NOT_VERIFIED:
|
|
96
|
+
return {
|
|
97
|
+
kind: "redirect",
|
|
98
|
+
route: routes.resendEmail,
|
|
99
|
+
clearSession: false
|
|
100
|
+
};
|
|
101
|
+
case AuthErrorCode.TWO_FACTOR_REQUIRED:
|
|
102
|
+
return {
|
|
103
|
+
kind: "redirect",
|
|
104
|
+
route: routes.twoFa,
|
|
105
|
+
clearSession: false
|
|
106
|
+
};
|
|
107
|
+
case AuthErrorCode.HUBSPOT_REAUTH_REQUIRED:
|
|
108
|
+
return {
|
|
109
|
+
kind: "redirect",
|
|
110
|
+
route: routes.accountSelect,
|
|
111
|
+
clearSession: false
|
|
112
|
+
};
|
|
113
|
+
case AuthErrorCode.OAUTH_PROCESSING_ERROR:
|
|
114
|
+
case AuthErrorCode.PORTAL_INACTIVE:
|
|
115
|
+
case AuthErrorCode.AMBIGUOUS_HUB_ID:
|
|
116
|
+
case AuthErrorCode.MISSING_HEADERS:
|
|
117
|
+
case AuthErrorCode.COMMERCIAL_ACCESS_EXPIRED:
|
|
118
|
+
return { kind: "reject" };
|
|
119
|
+
case AuthErrorCode.ACCESS_DENIED:
|
|
120
|
+
case AuthErrorCode.ACCESS_FORBIDDEN:
|
|
121
|
+
if (isSessionProbeUrl(url, policy)) {
|
|
122
|
+
return {
|
|
123
|
+
kind: "redirect",
|
|
124
|
+
route: routes.unauthorized,
|
|
125
|
+
clearSession: false
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
return { kind: "reject" };
|
|
129
|
+
default:
|
|
130
|
+
if (status === 401) {
|
|
131
|
+
return isRetryRequest ? logoutAction(errorCode, routes) : { kind: "refresh_retry" };
|
|
132
|
+
}
|
|
133
|
+
if (status === 403) {
|
|
134
|
+
return isSessionProbeUrl(url, policy) ? {
|
|
135
|
+
kind: "redirect",
|
|
136
|
+
route: routes.unauthorized,
|
|
137
|
+
clearSession: false
|
|
138
|
+
} : { kind: "reject" };
|
|
139
|
+
}
|
|
140
|
+
return { kind: "reject" };
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function resolveAuthErrorAction(input) {
|
|
144
|
+
const { status, errorCode, url, skipGlobalAuthRedirect, isRetryRequest, policy } = input;
|
|
145
|
+
if (status !== 401 && status !== 403) {
|
|
146
|
+
return { kind: "reject" };
|
|
147
|
+
}
|
|
148
|
+
if (skipGlobalAuthRedirect || isOptionalAuthFailureUrl(url, policy)) {
|
|
149
|
+
return { kind: "reject" };
|
|
150
|
+
}
|
|
151
|
+
return resolveByErrorCode(errorCode, status, url ?? "", isRetryRequest, policy);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export { isOptionalAuthFailureUrl, isSessionProbeUrl, persistAuthError, readPersistedAuthError, resolveAuthErrorAction };
|
|
155
|
+
//# sourceMappingURL=chunk-DZC3DJUO.js.map
|
|
156
|
+
//# sourceMappingURL=chunk-DZC3DJUO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/main/core/auth/auth-interceptor-policy.ts"],"names":[],"mappings":";;;;AAkCA,IAAM,8BAAA,GAAiC,CAAC,UAAU,CAAA;AAElD,SAAS,oBAAoB,GAAA,EAAsB;AAC/C,EAAA,IAAI,CAAC,KAAK,OAAO,EAAA;AACjB,EAAA,IAAI;AACA,IAAA,IAAI,GAAA,CAAI,UAAA,CAAW,MAAM,CAAA,EAAG;AACxB,MAAA,OAAO,IAAI,GAAA,CAAI,GAAG,CAAA,CAAE,QAAA;AAAA,IACxB;AAAA,EACJ,CAAA,CAAA,MAAQ;AAAA,EAER;AACA,EAAA,OAAO,GAAA,CAAI,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,IAAK,GAAA;AAChC;AAEO,SAAS,wBAAA,CAAyB,KAAyB,MAAA,EAA8C;AAC5G,EAAA,MAAM,IAAA,GAAO,oBAAoB,GAAG,CAAA;AACpC,EAAA,IAAI,CAAC,MAAM,OAAO,KAAA;AAElB,EAAA,IAAI,MAAA,CAAO,wBAAA,EAA0B,QAAA,CAAS,IAAI,CAAA,EAAG;AACjD,IAAA,OAAO,IAAA;AAAA,EACX;AAEA,EAAA,IAAI,OAAO,+BAAA,EAAiC;AACxC,IAAA,IAAI,IAAA,CAAK,QAAA,CAAS,2BAA2B,CAAA,EAAG,OAAO,IAAA;AACvD,IAAA,IAAI,IAAA,CAAK,QAAA,CAAS,+BAA+B,CAAA,EAAG,OAAO,IAAA;AAC3D,IAAA,IAAI,IAAA,CAAK,QAAA,CAAS,qBAAqB,CAAA,EAAG,OAAO,IAAA;AACjD,IAAA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GAC9B;AAAA,UACI,IAAA,EAAM,UAAA;AAAA,UACN,OAAO,MAAA,CAAO,YAAA;AAAA,UACd,YAAA,EAAc;AAAA,SAClB,GACA,EAAE,IAAA,EAAM,QAAA,EAAS;AAAA,MAC3B;AACA,MAAA,OAAO,EAAE,MAAM,QAAA,EAAS;AAAA;AAEpC;AAEO,SAAS,uBAAuB,KAAA,EAOnB;AAChB,EAAA,MAAM,EAAE,MAAA,EAAQ,SAAA,EAAW,KAAK,sBAAA,EAAwB,cAAA,EAAgB,QAAO,GAAI,KAAA;AAEnF,EAAA,IAAI,MAAA,KAAW,GAAA,IAAO,MAAA,KAAW,GAAA,EAAK;AAClC,IAAA,OAAO,EAAE,MAAM,QAAA,EAAS;AAAA,EAC5B;AAEA,EAAA,IAAI,sBAAA,IAA0B,wBAAA,CAAyB,GAAA,EAAK,MAAM,CAAA,EAAG;AACjE,IAAA,OAAO,EAAE,MAAM,QAAA,EAAS;AAAA,EAC5B;AAEA,EAAA,OAAO,mBAAmB,SAAA,EAAW,MAAA,EAAQ,GAAA,IAAO,EAAA,EAAI,gBAAgB,MAAM,CAAA;AAClF","file":"chunk-DZC3DJUO.js","sourcesContent":["import { AuthErrorCode, type ApiErrorPayload } from './auth-error-codes.js'\nimport { WP_STORAGE_KEYS } from '../utils/wp-storage-keys.js'\n\nexport type WoodsportalRequestConfig = {\n __isRetryRequest?: boolean\n skipGlobalAuthRedirect?: boolean\n url?: string\n}\n\nexport type AuthErrorAction =\n | { kind: 'refresh_retry' }\n | { kind: 'reject' }\n | { kind: 'redirect'; route: string; clearSession: boolean }\n | { kind: 'logout'; route: string; clearSession: boolean }\n\n/** Lane-specific routes for auth error redirects (hash or path prefixes supplied by each app). */\nexport type AuthPolicyRoutes = {\n unauthorized: string\n login: string\n twoFa: string\n resendEmail: string\n accountSelect: string\n}\n\nexport type AuthInterceptorPolicyConfig = {\n routes: AuthPolicyRoutes\n /** Request paths that must not trigger global logout (e.g. MFA enrollment). */\n optionalAuthFailurePaths?: string[]\n /** Paths treated as session probes (401/403 → unauthorized page). */\n sessionProbePaths?: string[]\n /** When true, optional MFA/security path prefixes match. */\n includeAdminMfaSecurityPrefixes?: boolean\n}\n\nconst DEFAULT_SESSION_PROBE_SUFFIXES = ['/auth/me']\n\nfunction normalizeRequestUrl(url?: string): string {\n if (!url) return ''\n try {\n if (url.startsWith('http')) {\n return new URL(url).pathname\n }\n } catch {\n // fall through\n }\n return url.split('?')[0] ?? url\n}\n\nexport function isOptionalAuthFailureUrl(url: string | undefined, config: AuthInterceptorPolicyConfig): boolean {\n const path = normalizeRequestUrl(url)\n if (!path) return false\n\n if (config.optionalAuthFailurePaths?.includes(path)) {\n return true\n }\n\n if (config.includeAdminMfaSecurityPrefixes) {\n if (path.includes('/api/admin/auth/security/')) return true\n if (path.includes('/api/admin/auth/mfa/webauthn/')) return true\n if (path.includes('/api/auth/security/')) return true\n if (path.includes('/api/auth/mfa/webauthn/')) return true\n }\n\n return false\n}\n\nexport function isSessionProbeUrl(url: string | undefined, config: AuthInterceptorPolicyConfig): boolean {\n const path = normalizeRequestUrl(url)\n if (!path) return false\n if (config.sessionProbePaths?.includes(path)) return true\n return DEFAULT_SESSION_PROBE_SUFFIXES.some((suffix) => path.endsWith(suffix))\n}\n\nexport function persistAuthError(payload: ApiErrorPayload): ApiErrorPayload & { ts: number } {\n const data = {\n ...payload,\n ts: Date.now()\n }\n if (typeof window !== 'undefined' && window.sessionStorage) {\n sessionStorage.setItem(WP_STORAGE_KEYS.c.auth.err, JSON.stringify(data))\n sessionStorage.removeItem('authError')\n }\n return data\n}\n\n/** Read persisted auth error (canonical key with legacy fallback). */\nexport function readPersistedAuthError(): (ApiErrorPayload & { ts: number }) | null {\n if (typeof window === 'undefined' || !window.sessionStorage) {\n return null\n }\n const raw = window.sessionStorage.getItem(WP_STORAGE_KEYS.c.auth.err) ?? window.sessionStorage.getItem('authError')\n if (!raw) {\n return null\n }\n try {\n return JSON.parse(raw) as ApiErrorPayload & { ts: number }\n } catch {\n return null\n }\n}\n\nfunction logoutAction(errorCode: string | undefined, routes: AuthPolicyRoutes): AuthErrorAction {\n if (errorCode === AuthErrorCode.HUBSPOT_REAUTH_REQUIRED) {\n return {\n kind: 'redirect',\n route: routes.accountSelect,\n clearSession: false\n }\n }\n return {\n kind: 'logout',\n route: routes.unauthorized,\n clearSession: true\n }\n}\n\nfunction resolveByErrorCode(\n errorCode: string | undefined,\n status: number,\n url: string,\n isRetryRequest: boolean | undefined,\n policy: AuthInterceptorPolicyConfig\n): AuthErrorAction {\n const { routes } = policy\n\n switch (errorCode) {\n case AuthErrorCode.TOKEN_EXPIRED:\n case AuthErrorCode.TOKEN_INVALID:\n case AuthErrorCode.AUTHENTICATION_FAILED:\n return isRetryRequest ? logoutAction(errorCode, routes) : { kind: 'refresh_retry' }\n\n case AuthErrorCode.MISSING_REFRESH_TOKEN:\n case AuthErrorCode.ACCESS_UNAUTHORIZED:\n return logoutAction(errorCode, routes)\n\n case AuthErrorCode.ACCOUNT_LOCKED:\n case AuthErrorCode.ACCOUNT_DISABLED:\n return {\n kind: 'redirect',\n route: routes.unauthorized,\n clearSession: true\n }\n\n case AuthErrorCode.LOGIN_FAILED:\n case AuthErrorCode.INVALID_CREDENTIALS:\n return { kind: 'reject' }\n\n case AuthErrorCode.EMAIL_NOT_VERIFIED:\n return {\n kind: 'redirect',\n route: routes.resendEmail,\n clearSession: false\n }\n\n case AuthErrorCode.TWO_FACTOR_REQUIRED:\n return {\n kind: 'redirect',\n route: routes.twoFa,\n clearSession: false\n }\n\n case AuthErrorCode.HUBSPOT_REAUTH_REQUIRED:\n return {\n kind: 'redirect',\n route: routes.accountSelect,\n clearSession: false\n }\n\n case AuthErrorCode.OAUTH_PROCESSING_ERROR:\n case AuthErrorCode.PORTAL_INACTIVE:\n case AuthErrorCode.AMBIGUOUS_HUB_ID:\n case AuthErrorCode.MISSING_HEADERS:\n case AuthErrorCode.COMMERCIAL_ACCESS_EXPIRED:\n return { kind: 'reject' }\n\n case AuthErrorCode.ACCESS_DENIED:\n case AuthErrorCode.ACCESS_FORBIDDEN:\n if (isSessionProbeUrl(url, policy)) {\n return {\n kind: 'redirect',\n route: routes.unauthorized,\n clearSession: false\n }\n }\n return { kind: 'reject' }\n\n default:\n if (status === 401) {\n return isRetryRequest ? logoutAction(errorCode, routes) : { kind: 'refresh_retry' }\n }\n if (status === 403) {\n return isSessionProbeUrl(url, policy)\n ? {\n kind: 'redirect',\n route: routes.unauthorized,\n clearSession: false\n }\n : { kind: 'reject' }\n }\n return { kind: 'reject' }\n }\n}\n\nexport function resolveAuthErrorAction(input: {\n status: number\n errorCode?: string\n url?: string\n skipGlobalAuthRedirect?: boolean\n isRetryRequest?: boolean\n policy: AuthInterceptorPolicyConfig\n}): AuthErrorAction {\n const { status, errorCode, url, skipGlobalAuthRedirect, isRetryRequest, policy } = input\n\n if (status !== 401 && status !== 403) {\n return { kind: 'reject' }\n }\n\n if (skipGlobalAuthRedirect || isOptionalAuthFailureUrl(url, policy)) {\n return { kind: 'reject' }\n }\n\n return resolveByErrorCode(errorCode, status, url ?? '', isRetryRequest, policy)\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createMutation, resolveListTableParams, Client } from './chunk-
|
|
2
|
-
import { actions } from './chunk-
|
|
3
|
-
import { actions2, actions as actions$1, actions4, actions5, actions3,
|
|
1
|
+
import { createMutation, resolveListTableParams, Client } from './chunk-4IKGBHFJ.js';
|
|
2
|
+
import { actions } from './chunk-OF5OLEE5.js';
|
|
3
|
+
import { actions2, actions as actions$1, actions4, actions5, actions3, actions7 } from './chunk-U66LWTVC.js';
|
|
4
4
|
|
|
5
5
|
// src/main/features/crm/api/pipeline.ts
|
|
6
6
|
function list(options) {
|
|
@@ -95,10 +95,10 @@ function create(options) {
|
|
|
95
95
|
const { setMultiObjectPrependData } = actions;
|
|
96
96
|
const { mutate, isLoading } = createMutation(async (props) => {
|
|
97
97
|
if (props?.componentName === "sidebarTable") await setMultiObjectPrependData("loading", props);
|
|
98
|
-
if (props?.componentName != "sidebarTable") await setTablePrependData("loading", props);
|
|
98
|
+
if (props?.componentName != "sidebarTable" && props?.componentName != "sidebarAssociation") await setTablePrependData("loading", props);
|
|
99
99
|
const response = await Client.object.create(props);
|
|
100
100
|
if (props?.componentName === "sidebarTable") await setMultiObjectPrependData(response, props);
|
|
101
|
-
if (props?.componentName != "sidebarTable") await setTablePrependData(response, props);
|
|
101
|
+
if (props?.componentName != "sidebarTable" && props?.componentName != "sidebarAssociation") await setTablePrependData(response, props);
|
|
102
102
|
return response;
|
|
103
103
|
}, options);
|
|
104
104
|
return {
|
|
@@ -145,9 +145,10 @@ function details(options) {
|
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
function update(options) {
|
|
148
|
+
const { updateTablePrependData } = actions2;
|
|
148
149
|
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
149
150
|
const response = await Client.object.update(payload);
|
|
150
|
-
return response;
|
|
151
|
+
return updateTablePrependData(response, payload);
|
|
151
152
|
}, options);
|
|
152
153
|
return {
|
|
153
154
|
mutate,
|
|
@@ -274,7 +275,7 @@ function attachmentUpload(options) {
|
|
|
274
275
|
|
|
275
276
|
// src/main/features/crm/api/file.ts
|
|
276
277
|
function list6(options) {
|
|
277
|
-
const { setFiles } =
|
|
278
|
+
const { setFiles } = actions7;
|
|
278
279
|
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
279
280
|
const response = await Client.file.list(payload);
|
|
280
281
|
setFiles(response, payload);
|
|
@@ -300,9 +301,9 @@ function details2(options) {
|
|
|
300
301
|
};
|
|
301
302
|
}
|
|
302
303
|
function addFolder(options) {
|
|
303
|
-
const { updateTreeWithCreate } =
|
|
304
|
+
const { updateTreeWithCreate } = actions7;
|
|
304
305
|
const { mutate, isLoading } = createMutation(async (props) => {
|
|
305
|
-
const parentFolderId = props?.
|
|
306
|
+
const parentFolderId = props?.queryParams?.parentFolderId;
|
|
306
307
|
await updateTreeWithCreate(parentFolderId, "loading");
|
|
307
308
|
const response = await Client.file.addFolder(props);
|
|
308
309
|
await updateTreeWithCreate(parentFolderId, response, "folder");
|
|
@@ -315,9 +316,9 @@ function addFolder(options) {
|
|
|
315
316
|
};
|
|
316
317
|
}
|
|
317
318
|
function addFile(options) {
|
|
318
|
-
const { updateTreeWithCreate } =
|
|
319
|
+
const { updateTreeWithCreate } = actions7;
|
|
319
320
|
const { mutate, isLoading } = createMutation(async (props) => {
|
|
320
|
-
const parentFolderId = props?.
|
|
321
|
+
const parentFolderId = props?.queryParams?.parentFolderId;
|
|
321
322
|
await updateTreeWithCreate(parentFolderId, "loading");
|
|
322
323
|
const response = await Client.file.addFile(props);
|
|
323
324
|
await updateTreeWithCreate(parentFolderId, response, "file");
|
|
@@ -405,5 +406,5 @@ var crmApi = {
|
|
|
405
406
|
};
|
|
406
407
|
|
|
407
408
|
export { crmApi };
|
|
408
|
-
//# sourceMappingURL=chunk-
|
|
409
|
-
//# sourceMappingURL=chunk-
|
|
409
|
+
//# sourceMappingURL=chunk-GVXA7OKY.js.map
|
|
410
|
+
//# sourceMappingURL=chunk-GVXA7OKY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/main/features/crm/api/pipeline.ts","../src/main/features/crm/api/stage.ts","../src/main/features/crm/api/object.ts","../src/main/features/crm/api/note.ts","../src/main/features/crm/api/email.ts","../src/main/features/crm/api/uploader.ts","../src/main/features/crm/api/file.ts","../src/main/features/crm/api/cache.ts","../src/main/api/nested-crm-api.ts"],"names":["list","actions","create","update","details"],"mappings":";;;;;AAKO,SAAS,KAAK,OAAA,EAAqC;AACtD,EAAA,MAAM,EAAE,MAAA,EAAQ,SAAA,EAAU,GAAI,cAAA,CAAyB,OAAO,OAAA,KAAiB;AAC3E,IAAA,MAAM,KAAA,GAAQ,uBAAuB,OAAO,CAAA;AAE5C,IAAA,MAAM,WAAgB,MAAM,MAAA,CAAO,QAAA,CAAS,IAAA,CAAK,SAAS,KAAK,CAAA;AAC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WAAA,EAAa,WAAA;AAAA,IACb,OAAA,EAAS,IAAA;AAAA,IACT,cAAA,EAAgB,iBAAA;AAAA,IAChB,UAAA,EAAY,OAAA;AAAA,IACZ,aAAA,EAAe,MAAA;AAAA,IACf,MAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACJ;AAAA,EACA,KAAA,EAAO;AAAA,IACH,IAAA,EAAMA,KAAAA;AAAA,IACN,MAAA,EAAQE,OAAAA;AAAA,IACR,MAAA,EAAQC;AAAA,GACZ;AAAA,EACA,MAAA,EAAQ;AAAA,IACJ,IAAA,EAAMH,KAAAA;AAAA,IACN,MAAA,EAAQE,OAAAA;AAAA,IACR,MAAA,EAAQC;AAAA,GACZ;AAAA,EACA,KAAA,EAAO;AAAA,IACH,IAAA,EAAMH,KAAAA;AAAA,IACN,UAAA,EAAYI,QAAAA;AAAA,IACZ,QAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACJ;AAAA,EACA,OAAA,EAAS;AAAA,IACL,WAAA,EAAa,WAAA;AAAA,IACb,gBAAA,EAAkB;AAAA,GACtB;AAAA,EACA,KAAA,EAAO;AAAA,IACH,KAAA;AAAA,IACA,cAAA,EAAgB;AAAA;AAExB","file":"chunk-GVXA7OKY.js","sourcesContent":["import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\nimport { resolveListTableParams } from '../helpers/normalize-table-list-params'\n\nexport function list(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const param = resolveListTableParams(payload)\n\n const response: any = await Client.pipeline.list(payload, param)\n return response\n }, options)\n\n return {\n mutate,\n list: mutate,\n getPipelines: mutate,\n isLoading\n }\n}\n","import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\n\nexport function list(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.stage.list(payload)\n return response\n }, options)\n\n return {\n mutate,\n list: mutate,\n getStages: mutate,\n isLoading\n }\n}\n","import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\nimport { resolveListTableParams } from '../helpers/normalize-table-list-params'\nimport { actions as tableActions } from '../../../state/crm/use-table'\nimport { actions as multiObjectActions } from '../../../state/crm/use-multi-object'\nimport { actions as formActions } from '../../../state/crm/use-form'\n\nexport function list(options?: MutationOptions<any, any>) {\n const { setObjectsData, setTableData } = tableActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const param = resolveListTableParams(payload)\n\n const response: any = await Client.object.list(payload, param)\n\n await setObjectsData(response, {\n stageId: param.stageId as string | number | undefined\n })\n await setTableData(response, payload)\n\n return response\n }, options)\n\n return {\n mutate,\n list: mutate,\n getObjects: mutate,\n isLoading\n }\n}\n\nexport function sideBarList(options?: MutationOptions<any, any>) {\n const { setMultiObjectData } = multiObjectActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.object.sideBarList(payload)\n setMultiObjectData(response, payload)\n return response\n }, options)\n\n return {\n mutate,\n listSidebar: mutate,\n getSideBarObjects: mutate,\n isLoading\n }\n}\n\nexport function form(options?: MutationOptions<any, any>) {\n const { setFormData } = formActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.object.form(payload)\n\n setFormData(response)\n\n return response\n }, options)\n\n return {\n mutate,\n getForm: mutate,\n getObjectsForm: mutate,\n isLoading\n }\n}\n\nexport function objectFormOptions(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.object.objectFormOptions(payload)\n\n return response\n }, options)\n\n return {\n mutate,\n getFormOptions: mutate,\n objectFormOptions: mutate,\n isLoading\n }\n}\n\nexport function create(options?: MutationOptions<any, any>) {\n const { setTablePrependData } = tableActions\n const { setMultiObjectPrependData } = multiObjectActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (props: any) => {\n if (props?.componentName === 'sidebarTable') await setMultiObjectPrependData('loading', props)\n if (props?.componentName != 'sidebarTable' && props?.componentName != 'sidebarAssociation') await setTablePrependData('loading', props)\n\n const response: any = await Client.object.create(props)\n\n if (props?.componentName === 'sidebarTable') await setMultiObjectPrependData(response, props)\n if (props?.componentName != 'sidebarTable' && props?.componentName != 'sidebarAssociation') await setTablePrependData(response, props)\n\n return response\n }, options)\n\n return {\n mutate,\n create: mutate,\n createObject: mutate,\n isLoading\n }\n}\n\nexport function createExisting(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (props: any) => {\n const response: any = await Client.object.createExisting(props)\n\n return response\n }, options)\n\n return {\n mutate,\n createExisting: mutate,\n createExistingObject: mutate,\n isLoading\n }\n}\n\nexport function removeExisting(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (props: any) => {\n const response: any = await Client.object.removeExisting(props)\n\n return response\n }, options)\n\n return {\n mutate,\n removeExisting: mutate,\n removeExistingObject: mutate,\n isLoading\n }\n}\n\nexport function details(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.object.details(payload)\n\n return response\n }, options)\n\n return {\n mutate,\n getDetails: mutate,\n getObjectsDetails: mutate,\n isLoading\n }\n}\n\nexport function update(options?: MutationOptions<any, any>) {\n const { updateTablePrependData } = tableActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.object.update(payload)\n\n return updateTablePrependData(response, payload)\n }, options)\n\n return {\n mutate,\n updateDetails: mutate,\n updateObjectsDetails: mutate,\n isLoading\n }\n}\n","import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\nimport { actions as noteActions } from '../../../state/crm/use-note'\n\nexport function list(options?: MutationOptions<any, any>) {\n const { setNotes } = noteActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.note.list(payload)\n\n setNotes(response, payload)\n\n return response\n }, options)\n\n return {\n mutate,\n list: mutate,\n getNotes: mutate,\n isLoading\n }\n}\n\nexport function create(options?: MutationOptions<any, any>) {\n const { setPrependNote } = noteActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (props: any) => {\n await setPrependNote('loading')\n const response: any = await Client.note.create(props)\n await setPrependNote(response)\n return response\n }, options)\n\n return {\n mutate,\n create: mutate,\n createNote: mutate,\n isLoading\n }\n}\n\nexport function update(options?: MutationOptions<any, any>) {\n const { updatePrependNote } = noteActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n // let params: any = makeParam()\n // let mParams: any = { cache: !!params?.cache, isPrimaryCompany: params?.isPrimaryCompany, limit: params?.limit || 5 }\n\n // if (getAuthSubscriptionType() === 'FREE') {\n // mParams.after = params?.after || \"\";\n // } else {\n // mParams.limit = params?.limit || \"\";\n // mParams.page = params?.page || \"\";\n // }\n\n const response: any = await Client.note.update(payload)\n\n return updatePrependNote(response)\n }, options)\n\n return {\n mutate,\n update: mutate,\n updateNote: mutate,\n isLoading\n }\n}\n\n// const makeParam = () => {\n// let params: any = {};\n// const tab = filterParams(\"tabs.notes\")\n// const baseParams: any = {\n// objectId: objectId,\n// id: id,\n// portalId: portalId,\n// cache: (sync || apiSync) ? false : true,\n// isPrimaryCompany: tab?.isPrimaryCompany ? true : false,\n// };\n\n// if (getAuthSubscriptionType() === \"FREE\") {\n// params = {\n// ...baseParams,\n// ...({ after: isFristTimeLoadData && tab?.page ? tab?.page : page }),\n// };\n// } else {\n// params = {\n// ...baseParams,\n// ...({\n// limit: limit,\n// page: isFristTimeLoadData && tab?.page ? tab?.page : page,\n// }),\n// };\n// }\n// return params\n// }\n","import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\nimport { actions as emailActions } from '../../../state/crm/use-email'\n\nexport function list(options?: MutationOptions<any, any>) {\n const { setEmails } = emailActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.email.list(payload)\n\n setEmails(response, payload)\n\n return response\n }, options)\n\n return {\n mutate,\n list: mutate,\n getEmails: mutate,\n isLoading\n }\n}\n\nexport function create(options?: MutationOptions<any, any>) {\n const { setPrependEmail } = emailActions\n const { mutate, isLoading } = createMutation<any, any>(async (props: any) => {\n await setPrependEmail('loading')\n const response: any = await Client.email.create(props)\n await setPrependEmail(response)\n return response\n }, options)\n\n return {\n mutate,\n create: mutate,\n createEmail: mutate,\n isLoading\n }\n}\n\nexport function update(options?: MutationOptions<any, any>) {\n const { updatePrependEmail } = emailActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.email.update(payload)\n\n return updatePrependEmail(response)\n }, options)\n\n return {\n mutate,\n update: mutate,\n updateEmail: mutate,\n isLoading\n }\n}\n\n// const makeParam = () => {\n// let params: any = {};\n// const tab = filterParams(\"tabs.notes\")\n// const baseParams: any = {\n// objectId: objectId,\n// id: id,\n// portalId: portalId,\n// cache: (sync || apiSync) ? false : true,\n// isPrimaryCompany: tab?.isPrimaryCompany ? true : false,\n// };\n\n// if (getAuthSubscriptionType() === \"FREE\") {\n// params = {\n// ...baseParams,\n// ...({ after: isFristTimeLoadData && tab?.page ? tab?.page : page }),\n// };\n// } else {\n// params = {\n// ...baseParams,\n// ...({\n// limit: limit,\n// page: isFristTimeLoadData && tab?.page ? tab?.page : page,\n// }),\n// };\n// }\n// return params\n// }\n","import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\nimport { actions as uploaderActions } from '../../../state/crm/use-uploader'\n\nexport function imageUpload(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = payload?.type === 'email' ? await Client.email.image(payload) : await Client.note.image(payload)\n\n return response\n }, options)\n\n return {\n mutate,\n uploadImage: mutate,\n imageUpload: mutate,\n isLoading\n }\n}\n\nexport function attachmentUpload(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = payload?.type === 'email' ? await Client.email.attachment(payload) : await Client.note.attachment(payload)\n\n uploaderActions.setAttachment(response)\n\n return response\n }, options)\n\n return {\n mutate,\n uploadAttachment: mutate,\n attachmentUpload: mutate,\n isLoading\n }\n}\n","import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\nimport { actions as fileActions } from '../../../state/crm/use-file'\n\nexport function list(options?: MutationOptions<any, any>) {\n const { setFiles } = fileActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.file.list(payload)\n\n setFiles(response, payload)\n\n return response\n }, options)\n\n return {\n mutate,\n list: mutate,\n getFiles: mutate,\n isLoading\n }\n}\n\nexport function details(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.file.details(payload)\n\n return response\n }, options)\n\n return {\n mutate,\n getDetails: mutate,\n getFile: mutate,\n isLoading\n }\n}\n\nexport function addFolder(options?: MutationOptions<any, any>) {\n const { updateTreeWithCreate } = fileActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (props: any) => {\n const parentFolderId = props?.queryParams?.parentFolderId\n await updateTreeWithCreate(parentFolderId, 'loading')\n const response: any = await Client.file.addFolder(props)\n await updateTreeWithCreate(parentFolderId, response, 'folder')\n return response\n }, options)\n\n return {\n mutate,\n addFolder: mutate,\n isLoading\n }\n}\n\nexport function addFile(options?: MutationOptions<any, any>) {\n const { updateTreeWithCreate } = fileActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (props: any) => {\n const parentFolderId = props?.queryParams?.parentFolderId\n await updateTreeWithCreate(parentFolderId, 'loading')\n const response: any = await Client.file.addFile(props)\n await updateTreeWithCreate(parentFolderId, response, 'file')\n return response\n }, options)\n\n return {\n mutate,\n addFile: mutate,\n isLoading\n }\n}\n\nexport function download(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.file.download(payload)\n return response\n }, options)\n\n return {\n mutate,\n download: mutate,\n downloadFile: mutate,\n isLoading\n }\n}\n","import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\n\n/** Soft refresh CRM list cache (prefer over GET cache=false when purge API is enabled). */\nexport function purge(options?: MutationOptions<unknown, unknown>) {\n const { mutate, isLoading } = createMutation<Record<string, unknown>, unknown>(async (payload?: Record<string, unknown>) => {\n const safePayload = payload ?? {}\n const idempotencyKey = typeof safePayload.idempotencyKey === 'string' ? safePayload.idempotencyKey : undefined\n const headers = idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : undefined\n const { idempotencyKey: _ignored, ...body } = safePayload\n return Client.cache.purge(body, headers)\n }, options)\n\n return { mutate, purge: mutate, purgeCache: mutate, isLoading }\n}\n\nexport function purgeStatus(purgeJobId: string, options?: MutationOptions<unknown, unknown>) {\n const { mutate, isLoading } = createMutation<string, unknown>(async (jobId?: string) => Client.cache.purgeStatus(jobId ?? purgeJobId), options)\n\n return {\n mutate,\n getPurgeStatus: mutate,\n isLoading\n }\n}\n","import { list as pipelinesList } from '../features/crm/api/pipeline'\nimport { list as stagesList } from '../features/crm/api/stage'\nimport {\n list as objectsList,\n sideBarList as objectsListSidebar,\n form as objectsGetForm,\n create as objectsCreate,\n createExisting as objectsCreateExisting,\n removeExisting as objectsRemoveExisting,\n details as objectsGetDetails,\n update as objectsUpdateDetails,\n objectFormOptions as objectsGetFormOptions\n} from '../features/crm/api/object'\nimport { list as notesList, create as notesCreate, update as notesUpdate } from '../features/crm/api/note'\nimport { list as emailsList, create as emailsCreate, update as emailsUpdate } from '../features/crm/api/email'\nimport { imageUpload, attachmentUpload } from '../features/crm/api/uploader'\nimport { list as filesList, addFolder, addFile, details as filesGetDetails, download as filesDownload } from '../features/crm/api/file'\nimport { purge as cachePurge, purgeStatus as cacheGetPurgeStatus } from '../features/crm/api/cache'\n\n/** Canonical nested CRM API (SDK 3.0). */\nexport const crmApi = {\n pipelines: { list: pipelinesList },\n stages: { list: stagesList },\n objects: {\n list: objectsList,\n listSidebar: objectsListSidebar,\n getForm: objectsGetForm,\n getFormOptions: objectsGetFormOptions,\n getDetails: objectsGetDetails,\n updateDetails: objectsUpdateDetails,\n create: objectsCreate,\n createExisting: objectsCreateExisting,\n removeExisting: objectsRemoveExisting\n },\n notes: {\n list: notesList,\n create: notesCreate,\n update: notesUpdate\n },\n emails: {\n list: emailsList,\n create: emailsCreate,\n update: emailsUpdate\n },\n files: {\n list: filesList,\n getDetails: filesGetDetails,\n download: filesDownload,\n addFolder,\n addFile\n },\n uploads: {\n uploadImage: imageUpload,\n uploadAttachment: attachmentUpload\n },\n cache: {\n purge: cachePurge,\n getPurgeStatus: cacheGetPurgeStatus\n }\n}\n"]}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { multiObjectStore } from './chunk-OF5OLEE5.js';
|
|
2
|
+
import { actions2, tableStore, tableUiStore, noteStore, emailStore, userStore, syncStore, formStore, fileStore } from './chunk-U66LWTVC.js';
|
|
3
|
+
import { clearAccessToken, resetSessionAuthState } from './chunk-ADOV2R3A.js';
|
|
4
|
+
import { clearClientAuthCookies, clearClientIframeRefreshLocalKeys } from './chunk-YOT5RW3R.js';
|
|
5
|
+
import { WP_STORAGE_KEYS } from './chunk-6ROV3EE2.js';
|
|
6
|
+
|
|
7
|
+
// src/main/core/http/session-teardown.ts
|
|
8
|
+
function resetSessionStores() {
|
|
9
|
+
actions2.clearTablePrependData();
|
|
10
|
+
tableStore.setState({
|
|
11
|
+
queryParams: null,
|
|
12
|
+
multiObjectsQueryParams: {},
|
|
13
|
+
objectsData: null,
|
|
14
|
+
tableData: [],
|
|
15
|
+
tablePrependData: [],
|
|
16
|
+
hubspotObjectTypeId: "",
|
|
17
|
+
selectedPipeline: "",
|
|
18
|
+
viewType: ""
|
|
19
|
+
});
|
|
20
|
+
tableUiStore.setState({
|
|
21
|
+
tableUniqueId: null,
|
|
22
|
+
gridData: [],
|
|
23
|
+
sort: "-hs_createdate",
|
|
24
|
+
limit: 10,
|
|
25
|
+
after: "",
|
|
26
|
+
page: 1,
|
|
27
|
+
nextPage: 1,
|
|
28
|
+
stageId: "",
|
|
29
|
+
totalItems: 1,
|
|
30
|
+
numOfPages: 1,
|
|
31
|
+
currentPage: 1,
|
|
32
|
+
search: "",
|
|
33
|
+
filterPropertyName: "hs_pipeline",
|
|
34
|
+
filterOperator: "eq",
|
|
35
|
+
filterValue: "",
|
|
36
|
+
isPrimaryCompany: null,
|
|
37
|
+
view: null,
|
|
38
|
+
selectedPipeline: "",
|
|
39
|
+
tableParam: {},
|
|
40
|
+
tableDefPermissions: {}
|
|
41
|
+
});
|
|
42
|
+
noteStore.setState({ notes: [], prependNotes: [], id: "", queryParams: null });
|
|
43
|
+
emailStore.setState({ emails: [], prependEmails: [], id: "", queryParams: null });
|
|
44
|
+
userStore.setState({ profile: null });
|
|
45
|
+
syncStore.setState({
|
|
46
|
+
apiSync: false,
|
|
47
|
+
sync: false,
|
|
48
|
+
isSyncLoading: false,
|
|
49
|
+
isSyncDisable: false
|
|
50
|
+
});
|
|
51
|
+
formStore.setState({ form: null });
|
|
52
|
+
fileStore.setState({ files: null, id: "", queryParams: null });
|
|
53
|
+
multiObjectStore.setState({ objects: {}, objectsPrependData: {}, meta: {} });
|
|
54
|
+
}
|
|
55
|
+
function clearClientSdkSession() {
|
|
56
|
+
clearClientAuthCookies();
|
|
57
|
+
clearClientIframeRefreshLocalKeys();
|
|
58
|
+
clearAccessToken();
|
|
59
|
+
resetSessionStores();
|
|
60
|
+
resetSessionAuthState();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/main/core/http/cross-tab-session.ts
|
|
64
|
+
var REV_KEY = WP_STORAGE_KEYS.c.auth.rev;
|
|
65
|
+
var CHANNEL_NAME = "woodsportal:session-sync";
|
|
66
|
+
function writeRevSignal() {
|
|
67
|
+
if (typeof window === "undefined" || !window.localStorage) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
window.localStorage.setItem(REV_KEY, String(Date.now()));
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function getBroadcastChannel() {
|
|
76
|
+
if (typeof BroadcastChannel === "undefined") {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
return new BroadcastChannel(CHANNEL_NAME);
|
|
81
|
+
} catch {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function signalSessionChanged(kind = "rev") {
|
|
86
|
+
writeRevSignal();
|
|
87
|
+
const channel = getBroadcastChannel();
|
|
88
|
+
if (channel) {
|
|
89
|
+
const message = { type: kind, ts: Date.now() };
|
|
90
|
+
channel.postMessage(message);
|
|
91
|
+
channel.close();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
var listenerInstalled = false;
|
|
95
|
+
var broadcastChannel = null;
|
|
96
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
97
|
+
function dispatch(kind) {
|
|
98
|
+
listeners.forEach((fn) => {
|
|
99
|
+
try {
|
|
100
|
+
fn(kind);
|
|
101
|
+
} catch {
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function handleRemoteSessionChange(kind) {
|
|
106
|
+
if (kind === "rev") {
|
|
107
|
+
clearAccessToken();
|
|
108
|
+
}
|
|
109
|
+
dispatch(kind);
|
|
110
|
+
}
|
|
111
|
+
function installCrossTabSessionListener(onChange) {
|
|
112
|
+
if (typeof window === "undefined") {
|
|
113
|
+
return () => void 0;
|
|
114
|
+
}
|
|
115
|
+
if (onChange) {
|
|
116
|
+
listeners.add(onChange);
|
|
117
|
+
}
|
|
118
|
+
if (!listenerInstalled) {
|
|
119
|
+
listenerInstalled = true;
|
|
120
|
+
window.addEventListener("storage", (event) => {
|
|
121
|
+
if (event.key !== REV_KEY || event.newValue == null) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
handleRemoteSessionChange("rev");
|
|
125
|
+
});
|
|
126
|
+
try {
|
|
127
|
+
broadcastChannel?.close();
|
|
128
|
+
broadcastChannel = new BroadcastChannel(CHANNEL_NAME);
|
|
129
|
+
broadcastChannel.onmessage = (event) => {
|
|
130
|
+
const kind = event.data?.type === "login" ? "login" : "rev";
|
|
131
|
+
handleRemoteSessionChange(kind);
|
|
132
|
+
};
|
|
133
|
+
} catch {
|
|
134
|
+
}
|
|
135
|
+
window.addEventListener("pageshow", (event) => {
|
|
136
|
+
if (event.persisted) {
|
|
137
|
+
handleRemoteSessionChange("rev");
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return () => {
|
|
142
|
+
if (onChange) {
|
|
143
|
+
listeners.delete(onChange);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function applyCrossTabSessionRevocation() {
|
|
148
|
+
clearClientSdkSession();
|
|
149
|
+
}
|
|
150
|
+
function resetCrossTabSessionSyncForTests() {
|
|
151
|
+
try {
|
|
152
|
+
broadcastChannel?.close();
|
|
153
|
+
} catch {
|
|
154
|
+
}
|
|
155
|
+
broadcastChannel = null;
|
|
156
|
+
listenerInstalled = false;
|
|
157
|
+
listeners.clear();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export { applyCrossTabSessionRevocation, clearClientSdkSession, installCrossTabSessionListener, resetCrossTabSessionSyncForTests, resetSessionStores, signalSessionChanged };
|
|
161
|
+
//# sourceMappingURL=chunk-J33YFZCS.js.map
|
|
162
|
+
//# sourceMappingURL=chunk-J33YFZCS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/main/core/http/session-teardown.ts","../src/main/core/http/cross-tab-session.ts"],"names":["actions"],"mappings":";;;;;;;AAiBO,SAAS,kBAAA,GAA2B;AACvC,EAAAA,QAAA,CAAa,qBAAA,EAAsB;AACnC,EAAA,UAAA,CAAW,QAAA,CAAS;AAAA,IAChB,WAAA,EAAa,IAAA;AAAA,IACb,yBAAyB,EAAC;AAAA,IAC1B,WAAA,EAAa,IAAA;AAAA,IACb,WAAW,EAAC;AAAA,IACZ,kBAAkB,EAAC;AAAA,IACnB,mBAAA,EAAqB,EAAA;AAAA,IACrB,gBAAA,EAAkB,EAAA;AAAA,IAClB,QAAA,EAAU;AAAA,GACb,CAAA;AACD,EAAA,YAAA,CAAa,QAAA,CAAS;AAAA,IAClB,aAAA,EAAe,IAAA;AAAA,IACf,UAAU,EAAC;AAAA,IACX,IAAA,EAAM,gBAAA;AAAA,IACN,KAAA,EAAO,EAAA;AAAA,IACP,KAAA,EAAO,EAAA;AAAA,IACP,IAAA,EAAM,CAAA;AAAA,IACN,QAAA,EAAU,CAAA;AAAA,IACV,OAAA,EAAS,EAAA;AAAA,IACT,UAAA,EAAY,CAAA;AAAA,IACZ,UAAA,EAAY,CAAA;AAAA,IACZ,WAAA,EAAa,CAAA;AAAA,IACb,MAAA,EAAQ,EAAA;AAAA,IACR,kBAAA,EAAoB,aAAA;AAAA,IACpB,cAAA,EAAgB,IAAA;AAAA,IAChB,WAAA,EAAa,EAAA;AAAA,IACb,gBAAA,EAAkB,IAAA;AAAA,IAClB,IAAA,EAAM,IAAA;AAAA,IACN,gBAAA,EAAkB,EAAA;AAAA,IAClB,YAAY,EAAC;AAAA,IACb,qBAAqB;AAAC,GACzB,CAAA;AACD,EAAA,SAAA,CAAU,QAAA,CAAS,EAAE,KAAA,EAAO,EAAC,EAAG,YAAA,EAAc,EAAC,EAAG,EAAA,EAAI,EAAA,EAAI,WAAA,EAAa,IAAA,EAAM,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AACnB,EAAA,iBAAA,GAAoB,KAAA;AACpB,EAAA,SAAA,CAAU,KAAA,EAAM;AACpB","file":"chunk-J33YFZCS.js","sourcesContent":["import { clearAccessToken, resetSessionAuthState } from './token-store'\nimport { clearClientAuthCookies } from '../utils/cookie'\nimport { clearClientIframeRefreshLocalKeys } from '../utils/storage-migration'\nimport {\n tableStore,\n tableActions,\n tableUiStore,\n noteStore,\n emailStore,\n userStore,\n syncStore,\n formStore,\n fileStore,\n multiObjectStore\n} from '../../state/index.js'\n\n/** Reset CRM nanostores to empty session state (logout / forced 401). */\nexport function resetSessionStores(): void {\n tableActions.clearTablePrependData()\n tableStore.setState({\n queryParams: null,\n multiObjectsQueryParams: {},\n objectsData: null,\n tableData: [],\n tablePrependData: [],\n hubspotObjectTypeId: '',\n selectedPipeline: '',\n viewType: ''\n })\n tableUiStore.setState({\n tableUniqueId: null,\n gridData: [],\n sort: '-hs_createdate',\n limit: 10,\n after: '',\n page: 1,\n nextPage: 1,\n stageId: '',\n totalItems: 1,\n numOfPages: 1,\n currentPage: 1,\n search: '',\n filterPropertyName: 'hs_pipeline',\n filterOperator: 'eq',\n filterValue: '',\n isPrimaryCompany: null,\n view: null,\n selectedPipeline: '',\n tableParam: {},\n tableDefPermissions: {}\n })\n noteStore.setState({ notes: [], prependNotes: [], id: '', queryParams: null })\n emailStore.setState({ emails: [], prependEmails: [], id: '', queryParams: null })\n userStore.setState({ profile: null })\n syncStore.setState({\n apiSync: false,\n sync: false,\n isSyncLoading: false,\n isSyncDisable: false\n })\n formStore.setState({ form: null })\n fileStore.setState({ files: null, id: '', queryParams: null })\n multiObjectStore.setState({ objects: {}, objectsPrependData: {}, meta: {} })\n}\n\n/**\n * Full client SDK session teardown (cookies, sessionStorage, iframe keys, memory token, CRM stores).\n * Consumer apps should also clear TanStack Query + local UI state after calling this.\n */\nexport function clearClientSdkSession(): void {\n clearClientAuthCookies()\n clearClientIframeRefreshLocalKeys()\n clearAccessToken()\n resetSessionStores()\n resetSessionAuthState()\n}\n","import { WP_STORAGE_KEYS } from '../utils/wp-storage-keys'\nimport { clearClientSdkSession } from './session-teardown'\nimport { clearAccessToken } from './token-store'\n\nconst REV_KEY = WP_STORAGE_KEYS.c.auth.rev\nconst CHANNEL_NAME = 'woodsportal:session-sync'\n\ntype SessionSyncMessage = { type: 'rev' | 'login'; ts: number }\n\nfunction writeRevSignal(): void {\n if (typeof window === 'undefined' || !window.localStorage) {\n return\n }\n try {\n window.localStorage.setItem(REV_KEY, String(Date.now()))\n } catch {\n // ignore\n }\n}\n\nfunction getBroadcastChannel(): BroadcastChannel | null {\n if (typeof BroadcastChannel === 'undefined') {\n return null\n }\n try {\n return new BroadcastChannel(CHANNEL_NAME)\n } catch {\n return null\n }\n}\n\n/** Notify other tabs that session ended or restarted. */\nexport function signalSessionChanged(kind: 'rev' | 'login' = 'rev'): void {\n writeRevSignal()\n const channel = getBroadcastChannel()\n if (channel) {\n const message: SessionSyncMessage = { type: kind, ts: Date.now() }\n channel.postMessage(message)\n channel.close()\n }\n}\n\nexport type SessionSyncListener = (kind: 'rev' | 'login') => void\n\nlet listenerInstalled = false\nlet broadcastChannel: BroadcastChannel | null = null\nconst listeners = new Set<SessionSyncListener>()\n\nfunction dispatch(kind: 'rev' | 'login'): void {\n listeners.forEach((fn) => {\n try {\n fn(kind)\n } catch {\n // consumer error\n }\n })\n}\n\nfunction handleRemoteSessionChange(kind: 'rev' | 'login'): void {\n if (kind === 'rev') {\n clearAccessToken()\n }\n dispatch(kind)\n}\n\n/**\n * Listen for logout/login in other tabs (localStorage + BroadcastChannel).\n * Returns unsubscribe function.\n */\nexport function installCrossTabSessionListener(onChange?: SessionSyncListener): () => void {\n if (typeof window === 'undefined') {\n return () => undefined\n }\n\n if (onChange) {\n listeners.add(onChange)\n }\n\n if (!listenerInstalled) {\n listenerInstalled = true\n\n window.addEventListener('storage', (event) => {\n if (event.key !== REV_KEY || event.newValue == null) {\n return\n }\n handleRemoteSessionChange('rev')\n })\n\n try {\n broadcastChannel?.close()\n broadcastChannel = new BroadcastChannel(CHANNEL_NAME)\n broadcastChannel.onmessage = (event: MessageEvent<SessionSyncMessage>) => {\n const kind = event.data?.type === 'login' ? 'login' : 'rev'\n handleRemoteSessionChange(kind)\n }\n } catch {\n // BroadcastChannel unavailable\n }\n\n window.addEventListener('pageshow', (event) => {\n if (event.persisted) {\n handleRemoteSessionChange('rev')\n }\n })\n }\n\n return () => {\n if (onChange) {\n listeners.delete(onChange)\n }\n }\n}\n\n/** Remote tab signalled logout — clear readable session artifacts. */\nexport function applyCrossTabSessionRevocation(): void {\n clearClientSdkSession()\n}\n\n/** Test-only: close BroadcastChannel and allow listener reinstall (prevents open-handle hangs). */\nexport function resetCrossTabSessionSyncForTests(): void {\n try {\n broadcastChannel?.close()\n } catch {\n // ignore\n }\n broadcastChannel = null\n listenerInstalled = false\n listeners.clear()\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createStore } from './chunk-
|
|
1
|
+
import { createStore } from './chunk-U66LWTVC.js';
|
|
2
2
|
|
|
3
3
|
// src/main/state/crm/use-multi-object.ts
|
|
4
4
|
var multiObjectStore = createStore({
|
|
@@ -91,5 +91,5 @@ var actions = {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
export { actions, multiObjectStore };
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
95
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-OF5OLEE5.js.map
|
|
95
|
+
//# sourceMappingURL=chunk-OF5OLEE5.js.map
|