mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
62 lines
2.2 KiB
TypeScript
62 lines
2.2 KiB
TypeScript
// import Tracker from '@openreplay/tracker';
|
|
// import trackerAssist from '@openreplay/tracker-assist'; // 👈 for errors, logs & stack traces
|
|
// import { SessionStore } from 'src/app/store/session.service';
|
|
|
|
// export function initOpenReplay() {
|
|
// const shouldEnableTracker =
|
|
// !window.location.href.includes('oapr') &&
|
|
// !window.location.href.includes('localhost')
|
|
|
|
// if (shouldEnableTracker) {
|
|
// const tracker = new Tracker({
|
|
// projectKey: 'g8HOZiBi5iUWEsK3Ajw5',
|
|
// __DISABLE_SECURE_MODE: true,
|
|
// network: {
|
|
// // === Required for TS compatibility ===
|
|
// sessionTokenHeader: false, // 👈 explicitly set (default = false)
|
|
// // === Capture settings ===
|
|
// capturePayload: true, // ✅ capture request/response bodies
|
|
// failuresOnly: false, // set true if you only want 4xx/5xx
|
|
// ignoreHeaders: ['Cookie', 'Set-Cookie', 'Authorization'], // default sensitive headers
|
|
// captureInIframes: false,
|
|
|
|
// // === Sanitizer to avoid leaking secrets ===
|
|
// sanitizer: (data) => {
|
|
// // Example: sanitize login payload
|
|
// if (data.url.includes('/login') && data.request.body) {
|
|
// try {
|
|
// const body = JSON.parse(data.request.body as string)
|
|
// if (body.password) body.password = '<REDACTED>'
|
|
// data.request.body = JSON.stringify(body)
|
|
// } catch {
|
|
// // drop non-JSON body
|
|
// data.request.body = null
|
|
// }
|
|
// }
|
|
|
|
// // Example: redact custom auth token header
|
|
// if (data.request.headers['x-auth-token']) {
|
|
// data.request.headers['x-auth-token'] = '<REDACTED>'
|
|
// }
|
|
|
|
// // Example: truncate very large responses
|
|
// if (
|
|
// typeof data.response.body === 'string' &&
|
|
// data.response.body.length > 5000
|
|
// ) {
|
|
// data.response.body =
|
|
// data.response.body.slice(0, 5000) + '...[truncated]'
|
|
// }
|
|
|
|
// return data
|
|
// },
|
|
// },
|
|
// })
|
|
|
|
// tracker.start()
|
|
// tracker.use(trackerAssist())
|
|
// tracker.setUserID(SessionStore.user?.FullName || ''); // 👈 set current user ID
|
|
// }
|
|
|
|
// }
|