woodsportal-client-sdk 4.1.1-dev.0 → 4.1.1-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-IOBRI7OT.js → chunk-JEQNFCQP.js} +61 -3
- package/dist/chunk-JEQNFCQP.js.map +1 -0
- package/dist/{chunk-OO5ZL2AS.js → chunk-JZ5BNYYH.js} +3 -3
- package/dist/{chunk-OO5ZL2AS.js.map → chunk-JZ5BNYYH.js.map} +1 -1
- package/dist/{chunk-AHGJODTH.js → chunk-YGSPLKDC.js} +3 -3
- package/dist/{chunk-AHGJODTH.js.map → chunk-YGSPLKDC.js.map} +1 -1
- package/dist/entries/auth.js +3 -3
- package/dist/entries/crm.js +3 -3
- package/dist/index.js +6 -6
- package/package.json +1 -1
- package/dist/chunk-IOBRI7OT.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getParamDetails, getRouteDetails, updateLink, getParam, decodeToBase64, generatePath, getPath, getRouteMenu, tableUiActions, ticketHubspotObjectTypeId, makePreviewParams, tableStore, actions2, userStore, isPipelineBoardObjectTypeId, tableUiStore, fileStore, actions7, emailStore, actions5, noteStore, actions4, resetAllStore, breadcrumbStage, isMessingParentLastItem, isMessingParent, generateUrl } from './chunk-ZZCYSW32.js';
|
|
2
|
-
import { getRuntimeHttpClientApiDate, config, configureLogger, setIframeStorageMode, setRefreshBufferSeconds, setRefreshCallback, hydrateSessionRefreshState,
|
|
2
|
+
import { getRuntimeHttpClientApiDate, config, configureLogger, setIframeStorageMode, setRefreshBufferSeconds, setRefreshCallback, hydrateSessionRefreshState, logger, isHttpTracingEnabled, 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-JVJMM4SZ.js';
|
|
3
3
|
import { getClientType, configureStorageKeys } from './chunk-32ERSTFY.js';
|
|
4
4
|
import { AuthErrorCode } from './chunk-COHBSTHF.js';
|
|
5
5
|
import axios from 'axios';
|
|
@@ -300,7 +300,46 @@ function getHttpUrl(config4) {
|
|
|
300
300
|
return sanitizeHttpUrl(config4.url);
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
+
// src/main/core/http/csp-violation-monitor.ts
|
|
304
|
+
var VIOLATION_TTL_MS = 3e4;
|
|
305
|
+
var MAX_RECORDED = 20;
|
|
306
|
+
var violations = [];
|
|
307
|
+
var installed = false;
|
|
308
|
+
function installCspViolationMonitor() {
|
|
309
|
+
if (installed || typeof document === "undefined" || typeof document.addEventListener !== "function") {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
installed = true;
|
|
313
|
+
document.addEventListener("securitypolicyviolation", (event) => {
|
|
314
|
+
violations.push({
|
|
315
|
+
blockedUri: event.blockedURI ?? "",
|
|
316
|
+
effectiveDirective: event.effectiveDirective ?? event.violatedDirective ?? "",
|
|
317
|
+
at: Date.now()
|
|
318
|
+
});
|
|
319
|
+
if (violations.length > MAX_RECORDED) {
|
|
320
|
+
violations = violations.slice(-MAX_RECORDED);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
function findCspViolationFor(requestUrl) {
|
|
325
|
+
if (!requestUrl) {
|
|
326
|
+
return void 0;
|
|
327
|
+
}
|
|
328
|
+
const now = Date.now();
|
|
329
|
+
violations = violations.filter((violation) => now - violation.at <= VIOLATION_TTL_MS);
|
|
330
|
+
let origin;
|
|
331
|
+
try {
|
|
332
|
+
origin = new URL(requestUrl, typeof location !== "undefined" ? location.href : void 0).origin;
|
|
333
|
+
} catch {
|
|
334
|
+
return void 0;
|
|
335
|
+
}
|
|
336
|
+
return violations.find(
|
|
337
|
+
(violation) => violation.blockedUri === origin || violation.blockedUri.startsWith(`${origin}/`)
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
|
|
303
341
|
// src/main/core/http/http-client.ts
|
|
342
|
+
var INVALID_PATH_SEGMENT_PATTERN = /\/(undefined|null|NaN)([/?#]|$)/;
|
|
304
343
|
var axiosInstance = null;
|
|
305
344
|
var config3 = {};
|
|
306
345
|
function hasBrowserLocation() {
|
|
@@ -502,9 +541,17 @@ function initializeHttpClient(clientConfig) {
|
|
|
502
541
|
...config3.headers
|
|
503
542
|
}
|
|
504
543
|
});
|
|
544
|
+
installCspViolationMonitor();
|
|
505
545
|
setRefreshCallback(getAuthRefreshToken);
|
|
506
546
|
hydrateSessionRefreshState();
|
|
507
547
|
axiosInstance.interceptors.request.use(async (requestConfig) => {
|
|
548
|
+
const requestUrl = getHttpUrl(requestConfig);
|
|
549
|
+
if (requestUrl && INVALID_PATH_SEGMENT_PATTERN.test(requestUrl)) {
|
|
550
|
+
logger.error("http", "blocked request with unresolved id in path", { url: requestUrl });
|
|
551
|
+
throw new Error(
|
|
552
|
+
`[woodsportal-sdk] Blocked request: URL contains an unresolved id segment: ${requestUrl}`
|
|
553
|
+
);
|
|
554
|
+
}
|
|
508
555
|
const previewMock = await resolveEditorPreviewMock(requestConfig);
|
|
509
556
|
if (previewMock) {
|
|
510
557
|
requestConfig.adapter = () => Promise.resolve({
|
|
@@ -545,6 +592,17 @@ function initializeHttpClient(clientConfig) {
|
|
|
545
592
|
(error) => {
|
|
546
593
|
if (axios.isAxiosError(error) && error.config) {
|
|
547
594
|
const status = error.response?.status;
|
|
595
|
+
if (status == null) {
|
|
596
|
+
const violation = findCspViolationFor(getHttpUrl(error.config));
|
|
597
|
+
if (violation) {
|
|
598
|
+
logger.error("http", "request blocked by the embedding page CSP", {
|
|
599
|
+
url: sanitizeHttpUrl(error.config.url),
|
|
600
|
+
violatedDirective: violation.effectiveDirective,
|
|
601
|
+
blockedUri: violation.blockedUri,
|
|
602
|
+
fix: `the embedding page's Content-Security-Policy must include "${violation.effectiveDirective} ${violation.blockedUri}"`
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
}
|
|
548
606
|
if (isHttpTracingEnabled()) {
|
|
549
607
|
logger.debug("http", "request failed", {
|
|
550
608
|
method: getHttpMethod(error.config),
|
|
@@ -2605,5 +2663,5 @@ function createMutation(mutationFn, options) {
|
|
|
2605
2663
|
}
|
|
2606
2664
|
|
|
2607
2665
|
export { API_ENDPOINTS, Client, HttpClient, applyContractApiDate, buildCachePurgeRequest, buildCrmListPurgeTarget, buildCrmSinglePurgeTarget, buildEngagementPurgeTarget, buildPortalConfigPurgeTarget, buildUserSessionPurgeTarget, createCachePurgeJob, createMutation, extractEngagementItemIdFromWriteResponse, extractHubspotRecordIdFromWriteResponse, generateApiUrl, getAuthRefreshToken, getConfiguredContractApiDate, getFieldErrors, getFormErrors, initializeHttpClient, mergePurgeTargets, navigationApi, purgeCrmCombined, purgeCrmDetailAndListAfterCrmWrite, purgeCrmListCache, purgeCrmListCacheAfterCrmWrite, purgeCrmObjectDataCache, purgeCrmRecordCache, purgeEngagementCaches, purgeEngagementCachesAfterCrmWrite, resolveCrmListPurgeQuery, resolveListTableParams, setEditorPreviewMockHandler, startVisibilityRefreshScheduler, stopVisibilityRefreshScheduler, toCachePurgeListQuery };
|
|
2608
|
-
//# sourceMappingURL=chunk-
|
|
2609
|
-
//# sourceMappingURL=chunk-
|
|
2666
|
+
//# sourceMappingURL=chunk-JEQNFCQP.js.map
|
|
2667
|
+
//# sourceMappingURL=chunk-JEQNFCQP.js.map
|