Files
klz-cables.com/.pnpm-store/v10/files/3f/3b79a0a0838b4c68d762054cf1bef9a8534dca154562d266424d33b1d98be27eb331f8ab281f5cde1519bf2fd3327a2e0693cac0835e50aad3bf1a687cf112
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

37 lines
1.2 KiB
Plaintext

import { DEBUG_BUILD } from '../debug-build.js';
import { debug } from './debug-logger.js';
import { stringMatchesSomePattern } from './string.js';
const NOT_PROPAGATED_MESSAGE =
'[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:';
/**
* Check if a given URL should be propagated to or not.
* If no url is defined, or no trace propagation targets are defined, this will always return `true`.
* You can also optionally provide a decision map, to cache decisions and avoid repeated regex lookups.
*/
function shouldPropagateTraceForUrl(
url,
tracePropagationTargets,
decisionMap,
) {
if (typeof url !== 'string' || !tracePropagationTargets) {
return true;
}
const cachedDecision = decisionMap?.get(url);
if (cachedDecision !== undefined) {
DEBUG_BUILD && !cachedDecision && debug.log(NOT_PROPAGATED_MESSAGE, url);
return cachedDecision;
}
const decision = stringMatchesSomePattern(url, tracePropagationTargets);
decisionMap?.set(url, decision);
DEBUG_BUILD && !decision && debug.log(NOT_PROPAGATED_MESSAGE, url);
return decision;
}
export { shouldPropagateTraceForUrl };
//# sourceMappingURL=tracePropagationTargets.js.map