@amplitude/session-replay-browser 1.47.0-sr-trc-debug-log.2 → 1.47.0-sr-trc-debug-log.3
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/lib/cjs/diagnostics.d.ts +2 -0
- package/lib/cjs/diagnostics.d.ts.map +1 -1
- package/lib/cjs/diagnostics.js +4 -1
- package/lib/cjs/diagnostics.js.map +1 -1
- package/lib/cjs/plugins/url-tracking-plugin.d.ts +7 -0
- package/lib/cjs/plugins/url-tracking-plugin.d.ts.map +1 -1
- package/lib/cjs/plugins/url-tracking-plugin.js +5 -3
- package/lib/cjs/plugins/url-tracking-plugin.js.map +1 -1
- package/lib/cjs/session-replay.d.ts +1 -0
- package/lib/cjs/session-replay.d.ts.map +1 -1
- package/lib/cjs/session-replay.js +15 -0
- package/lib/cjs/session-replay.js.map +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/esm/diagnostics.d.ts +2 -0
- package/lib/esm/diagnostics.d.ts.map +1 -1
- package/lib/esm/diagnostics.js +4 -1
- package/lib/esm/diagnostics.js.map +1 -1
- package/lib/esm/plugins/url-tracking-plugin.d.ts +7 -0
- package/lib/esm/plugins/url-tracking-plugin.d.ts.map +1 -1
- package/lib/esm/plugins/url-tracking-plugin.js +5 -3
- package/lib/esm/plugins/url-tracking-plugin.js.map +1 -1
- package/lib/esm/session-replay.d.ts +1 -0
- package/lib/esm/session-replay.d.ts.map +1 -1
- package/lib/esm/session-replay.js +15 -0
- package/lib/esm/session-replay.js.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/lib/scripts/index-min.js +1 -1
- package/lib/scripts/index-min.js.gz +0 -0
- package/lib/scripts/index-min.js.map +1 -1
- package/lib/scripts/session-replay-browser-min.js +1 -1
- package/lib/scripts/session-replay-browser-min.js.gz +0 -0
- package/lib/scripts/session-replay-browser-min.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,EAEd,MAAM,EAEN,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAEnC,gFAAgF;AAChF,OAAO,EAAiB,SAAS,IAAI,cAAc,EAAkB,MAAM,wBAAwB,CAAC;AACpG,OAAO,EAAE,wCAAwC,EAAE,MAAM,wBAAwB,CAAC;AASlF,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,+BAA+B,EAC/B,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EACf,6BAA6B,EAC7B,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,cAAc,EACd,aAAa,EACb,MAAM,EACN,eAAe,GAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAA2B,MAAM,yBAAyB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AACnC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;QAE7F,IAAI,CAAC,QAAQ,GAAG;YACd,YAAY,cAAA;YACZ,WAAW,aAAA;YACX,YAAY,cAAA;YACZ,SAAS,WAAA;YACT,SAAS,WAAA;YACT,UAAU,EAAE,YAAY,CAAC,UAAU;YACnC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACvC,gBAAgB,kBAAA;YAChB,iBAAiB,EAAE,mCAAmC;YACtD,oBAAoB,sBAAA;SACrB,CAAC;IACJ,CAAC;IAEa,kDAA0B,GAAxC;;;;;;;6BACM,CAAA,CAAA,MAAA,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,aAAa,0CAAE,OAAO,0CAAE,OAAO,KAAI,CAAC,IAAI,CAAC,gBAAgB,CAAA,EAAtE,wBAAsE;;;;wBAElB,qBAAM,MAAM,CAAC,aAAa,CAAC,EAAA;;wBAArD,qBAAqB,GAAK,CAAA,SAA2B,CAAA,iBAAhC;wBAC/C,IAAI,CAAC,gBAAgB,GAAG,IAAI,qBAAqB,EAAE,CAAC;;;;wBAEpD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,mDAAmD,EAAE,OAAK,CAAC,CAAC;;;;;;KAG1F;IACH,oBAAC;AAAD,CAAC,AAr8CD,IAq8CC","sourcesContent":["import {\n getAnalyticsConnector,\n getGlobalScope,\n ILogger,\n Logger,\n LogLevel,\n returnWrapper,\n SpecialEventType,\n generateHashCode,\n getOrCreateWindowMessenger,\n enableBackgroundCapture,\n AMPLITUDE_ORIGINS_MAP,\n} from '@amplitude/analytics-core';\n\n// Import only specific types to avoid pulling in the entire rrweb-types package\nimport { eventWithTime, EventType as RRWebEventType, scrollCallback } from '@amplitude/rrweb-types';\nimport { createSessionReplayJoinedConfigGenerator } from './config/joined-config';\nimport {\n LoggingConfig,\n SessionReplayJoinedConfig,\n SessionReplayJoinedConfigGenerator,\n SessionReplayLocalConfig,\n SessionReplayMetadata,\n SessionReplayRemoteConfig,\n} from './config/types';\nimport {\n BLOCK_CLASS,\n CustomRRwebEvent,\n DEFAULT_SESSION_REPLAY_PROPERTY,\n INTERACTION_MAX_INTERVAL,\n INTERACTION_MIN_INTERVAL,\n MASK_TEXT_CLASS,\n SESSION_REPLAY_DEBUG_PROPERTY,\n SESSION_REPLAY_EU_URL,\n SESSION_REPLAY_SERVER_URL,\n SESSION_REPLAY_STAGING_URL,\n} from './constants';\nimport {\n getServerUrl,\n getDebugConfig,\n getEffectiveMaskLevel,\n getPageUrl,\n getStorageSize,\n getCurrentUrl,\n maskFn,\n maskAttributeFn,\n} from './helpers';\nimport { EventCompressor } from './events/event-compressor';\nimport { createEventsManager, EventsManagerWithBeacon } from './events/events-manager';\nimport { MultiEventManager } from './events/multi-manager';\nimport { clickBatcher, ClickHandler, clickNonBatcher } from './hooks/click';\nimport { ScrollWatcher } from './hooks/scroll';\nimport { SessionIdentifiers } from './identifiers';\nimport { SafeLoggerProvider } from './logger';\nimport {\n getOrInitReplayStartTime,\n pruneStaleReplayStartTimes,\n removeReplayStartTime,\n setReplayStartTime,\n} from './replay-start-time-store';\nimport { evaluateTargetingAndStore } from './targeting/targeting-manager';\nimport { SrDiagnostic } from './diagnostics';\nimport {\n AmplitudeSessionReplay,\n SessionReplayEventsManager as AmplitudeSessionReplayEventsManager,\n DebugInfo,\n EventsManagerWithType,\n EventType,\n SessionIdentifiers as ISessionIdentifiers,\n SessionReplayOptions,\n SessionReplayTargetingInput,\n} from './typings/session-replay';\nimport { isSessionInSample } from './sampling';\nimport { VERSION } from './version';\n\n// Import only the type for NetworkRequestEvent to keep type safety\nimport type { NetworkObservers, NetworkRequestEvent } from './observers';\nimport { createUrlTrackingPlugin, subscribeToUrlChanges } from './plugins/url-tracking-plugin';\nimport type { RecordFunction } from './utils/rrweb';\nimport { isInIframe, CrossOriginIframeCoordinator, listenForParentSignals } from './cross-origin-iframes';\n\ntype PageLeaveFn = (e: PageTransitionEvent | Event) => void;\n\nexport class SessionReplay implements AmplitudeSessionReplay {\n name = '@amplitude/session-replay-browser';\n config: SessionReplayJoinedConfig | undefined;\n joinedConfigGenerator: SessionReplayJoinedConfigGenerator | undefined;\n identifiers: ISessionIdentifiers | undefined;\n eventsManager?: AmplitudeSessionReplayEventsManager<'replay' | 'interaction', string>;\n loggerProvider: ILogger;\n recordCancelCallback: ReturnType<RecordFunction> | null = null;\n eventCount = 0;\n eventCompressor: EventCompressor | undefined;\n sessionTargetingMatch = false;\n private lastTargetingParams?: SessionReplayTargetingInput;\n private lastShouldRecordDecision?: boolean;\n // Session for which the one-per-session TRC diagnostic event was already emitted. The\n // diagnostics client caps in-memory events, so per-call signals go through counters and only\n // a single rich snapshot event is recorded per session.\n private trcDiagnosticSessionId: string | number | undefined = undefined;\n\n // Public on purpose. `pageLeaveFns` is iterated by `pageLeaveListener`,\n // `rrwebEventManager` is dereferenced in `asyncSetSessionId` to drop the beacon buffer\n // at a session boundary, and `sessionStartTime` drives `isBelowMinSessionDuration()`.\n // Tests also stub/inspect these — privatizing them would break both production callers\n // and the gate's test coverage.\n pageLeaveFns: PageLeaveFn[] = [];\n sessionStartTime: number | undefined;\n rrwebEventManager: EventsManagerWithBeacon<'replay'> | undefined;\n /**\n * Count of sendEvents() calls suppressed by the min-session-duration gate for the\n * current session. Drives the REPLAY_GATE_DECISION rrweb event on first send-after-pass.\n */\n private suppressedSendCount = 0;\n /** True once REPLAY_GATE_DECISION has been emitted for the current session. */\n private hasEmittedGateDecision = false;\n private scrollHook?: scrollCallback;\n private clickHandler?: ClickHandler;\n private networkObservers?: NetworkObservers;\n private metadata: SessionReplayMetadata | undefined;\n\n // Cache the dynamically imported record function\n private recordFunction: RecordFunction | null = null;\n private recordEventsInFlight = false;\n private pendingEmitEvents: Array<{ event: eventWithTime; sessionId: string | number }> = [];\n\n /** Current page URL, kept in sync with SPA navigations for URL-based masking */\n private currentPageUrl = '';\n\n private recordEventsPendingShouldLogMetadata: boolean | null = null;\n\n /** Cleanup for URL change listener used to re-evaluate targeting on SPA route changes */\n private urlChangeCleanup: (() => void) | null = null;\n private crossOriginIframeCoordinator: CrossOriginIframeCoordinator | null = null;\n private crossOriginParentSignalCleanup: (() => void) | null = null;\n /** Monotonic counter to ignore stale URL-change targeting results */\n private latestUrlChangeTargetingEvaluationId = 0;\n\n constructor() {\n this.loggerProvider = new SafeLoggerProvider(new Logger());\n }\n\n init(apiKey: string, options: SessionReplayOptions) {\n return returnWrapper(this._init(apiKey, options));\n }\n\n private teardownEventListeners = (teardown: boolean) => {\n const globalScope = getGlobalScope();\n if (globalScope) {\n globalScope.removeEventListener('blur', this.blurListener);\n globalScope.removeEventListener('focus', this.focusListener);\n !teardown && globalScope.addEventListener('blur', this.blurListener);\n !teardown && globalScope.addEventListener('focus', this.focusListener);\n // prefer pagehide to unload events, this is the standard going forward. it is not\n // 100% reliable, but is bfcache-compatible.\n if (globalScope.self && 'onpagehide' in globalScope.self) {\n globalScope.removeEventListener('pagehide', this.pageLeaveListener);\n !teardown && globalScope.addEventListener('pagehide', this.pageLeaveListener);\n } else {\n // this has performance implications, but is the only way we can reliably send events\n // in browser that don't support pagehide.\n globalScope.removeEventListener('beforeunload', this.pageLeaveListener);\n !teardown && globalScope.addEventListener('beforeunload', this.pageLeaveListener);\n }\n }\n };\n\n /**\n * Subscribes to SPA URL changes via the URL tracking plugin. Always keeps\n * `currentPageUrl` in sync (needed for URL-based masking). When a targeting\n * config is present it also re-evaluates targeting on every navigation.\n */\n private setupUrlChangeListener(): void {\n // If init() runs multiple times, remove the previous URL-change subscription first\n // so we don't leak callbacks and trigger duplicate targeting evaluations.\n this.urlChangeCleanup?.();\n\n const globalScope = getGlobalScope() as Window | undefined;\n if (!globalScope?.location) {\n // No window/location (SSR, worker, or pre-render) — the listener can't attach, so TRC will\n // never re-evaluate on navigation. Surface it rather than failing silently.\n this.incrementDiagnostic(SrDiagnostic.urlListenerSkipped);\n this.recordDiagnosticEvent(SrDiagnostic.urlListenerSkipped, { reason: 'no_global_scope' });\n this.loggerProvider.debug('URL-change listener not attached: no global scope/location.');\n return;\n }\n\n const hasTargeting = !!this.config?.targetingConfig;\n\n const onUrlChange = (href: string): void => {\n this.currentPageUrl = href;\n\n // Team-visible signal that an SPA navigation was detected at all (covers the \"is the SDK\n // even seeing route changes in this framework?\" question — counter + a log with the href\n // and whether it triggered a targeting re-eval).\n this.incrementDiagnostic(SrDiagnostic.urlChange);\n this.recordDiagnosticEvent(SrDiagnostic.urlChangeEvent, {\n href,\n hasTargeting,\n alreadyMatched: this.sessionTargetingMatch,\n });\n\n if (hasTargeting) {\n const evaluationId = ++this.latestUrlChangeTargetingEvaluationId;\n void this.evaluateTargetingAndCapture(\n {\n userProperties: {},\n event: undefined,\n page: { url: href },\n },\n false,\n false,\n true,\n );\n this.loggerProvider.debug(`Queued URL-change targeting re-evaluation #${evaluationId} for ${href}.`);\n }\n };\n // Pass the polling options so targeting re-evaluation also respects `enableUrlChangePolling`.\n // Without this, the targeting listener only sees history.pushState/replaceState + popstate +\n // hashchange — so SPA navigations that bypass the history API never re-evaluate TRC and\n // recording never starts on the new URL (enableUrlChangePolling previously only affected the\n // rrweb URL-tracking plugin, which runs only once recording is already active).\n const enablePolling = this.config?.enableUrlChangePolling ?? false;\n const unsubscribe = subscribeToUrlChanges(globalScope, onUrlChange, {\n enablePolling,\n pollingInterval: this.config?.urlChangePollingInterval,\n // Mirror each poll tick to the console (Debug level) so we can confirm polling is firing.\n log: this.loggerProvider.debug.bind(this.loggerProvider),\n });\n // Confirm the listener is actually live, and under what settings — if recording never starts on\n // navigation, this tells us whether the listener existed and whether polling (the fallback for\n // SPAs that bypass the History API) was on.\n this.recordDiagnosticEvent(SrDiagnostic.urlListenerAttached, {\n hasTargeting,\n enablePolling,\n pollingInterval: this.config?.urlChangePollingInterval,\n });\n this.loggerProvider.debug(`URL-change listener attached (polling: ${String(enablePolling)}).`);\n\n this.urlChangeCleanup = (): void => {\n unsubscribe();\n this.urlChangeCleanup = null;\n };\n }\n\n /**\n * Single source of truth for the min_session_duration_ms gate. Returns true when the\n * current session has not yet reached the configured threshold (and we have both a\n * configured value and a recorded start time). Returns false when there's no\n * threshold, no recorded start time, or the threshold has been met — i.e. it\n * answers \"should this batch be suppressed?\".\n *\n * Centralizing the check means future changes (clock-skew tolerance, switching to\n * performance.now(), etc.) are one-line edits.\n */\n private isBelowMinSessionDuration(): boolean {\n const minSessionDurationMs = this.config?.minSessionDurationMs;\n if (minSessionDurationMs === undefined || this.sessionStartTime === undefined) {\n return false;\n }\n return Date.now() - this.sessionStartTime < minSessionDurationMs;\n }\n\n private getCurrentPageForTargeting(): SessionReplayTargetingInput['page'] {\n const currentUrl = getGlobalScope()?.location?.href;\n return currentUrl != null ? { url: currentUrl } : undefined;\n }\n\n /**\n * Best-effort navigation type from the Navigation Timing API: 'reload' | 'navigate' |\n * 'back_forward' | 'prerender'. Surfaced in the init diagnostic so a page refresh ('reload')\n * is distinguishable from a fresh load ('navigate') — neither changes the session id, so this\n * is the only way to tell them apart. Returns undefined when the API is unavailable.\n */\n private getNavigationType(): string | undefined {\n try {\n const globalScope = getGlobalScope();\n const performance = globalScope && globalScope.performance;\n if (!performance || typeof performance.getEntriesByType !== 'function') {\n return undefined;\n }\n const navEntries = performance.getEntriesByType('navigation') as PerformanceNavigationTiming[];\n return navEntries.length > 0 ? navEntries[0].type : undefined;\n } catch {\n return undefined;\n }\n }\n\n protected async _init(apiKey: string, options: SessionReplayOptions) {\n // Re-init should always tear down any previous URL-change subscription, even when the\n // next config has no targeting config and we don't subscribe again.\n this.urlChangeCleanup?.();\n\n this.loggerProvider = new SafeLoggerProvider(options.loggerProvider || new Logger());\n Object.prototype.hasOwnProperty.call(options, 'logLevel') &&\n this.loggerProvider.enable(options.logLevel as LogLevel);\n this.currentPageUrl = getCurrentUrl();\n this.identifiers = new SessionIdentifiers({ sessionId: options.sessionId, deviceId: options.deviceId });\n // Persist replay start time per sessionId so the min_session_duration_ms gate\n // measures replay duration (survives page reloads within a session) rather than\n // page-load duration. Storage failures fall back to a transient Date.now().\n const now = Date.now();\n pruneStaleReplayStartTimes(apiKey, now, this.loggerProvider);\n this.sessionStartTime =\n options.sessionId !== undefined\n ? getOrInitReplayStartTime(apiKey, options.sessionId, now, this.loggerProvider) ?? now\n : now;\n this.joinedConfigGenerator = await createSessionReplayJoinedConfigGenerator(apiKey, options);\n const { joinedConfig, localConfig, remoteConfig } = await this.joinedConfigGenerator.generateJoinedConfig();\n this.config = joinedConfig;\n\n this.setMetadata(\n options.sessionId,\n joinedConfig,\n localConfig,\n remoteConfig,\n options.version?.version,\n VERSION,\n options.version?.type,\n );\n\n this.pageLeaveFns = [];\n\n if (options.sessionId && this.config.interactionConfig?.enabled) {\n const scrollWatcher = ScrollWatcher.default(\n {\n sessionId: options.sessionId,\n type: 'interaction',\n },\n this.config,\n );\n this.pageLeaveFns = [scrollWatcher.send(this.getDeviceId.bind(this)).bind(scrollWatcher)];\n this.scrollHook = scrollWatcher.hook.bind(scrollWatcher);\n this.clickHandler = new ClickHandler(this.loggerProvider, scrollWatcher);\n }\n\n const managers: EventsManagerWithType<EventType, string>[] = [];\n let { storeType } = this.config;\n if (storeType === 'idb' && !getGlobalScope()?.indexedDB) {\n storeType = 'memory';\n this.loggerProvider.warn('Could not use preferred indexedDB storage, reverting to in memory option.');\n }\n this.loggerProvider.log(`Using ${storeType} for event storage.`);\n let compressionWorkerScript: string | undefined;\n let trackDestinationWorkerScript: string | undefined;\n const globalScope = getGlobalScope();\n if (this.config.useWebWorker && globalScope && globalScope.Worker) {\n const { compressionScript, trackDestinationScript } = await import('./worker');\n compressionWorkerScript = compressionScript;\n trackDestinationWorkerScript = trackDestinationScript;\n }\n\n let rrwebEventManager: EventsManagerWithBeacon<'replay'> | undefined;\n try {\n rrwebEventManager = await createEventsManager<'replay'>({\n config: this.config,\n type: 'replay',\n minInterval: this.config.flushIntervalConfig?.minIntervalMs,\n maxInterval: this.config.flushIntervalConfig?.maxIntervalMs,\n maxPersistedEventsSize: this.config.maxPersistedEventsSizeBytes,\n storeType,\n trackDestinationWorkerScript,\n shouldSend: () => !this.isBelowMinSessionDuration(),\n });\n this.rrwebEventManager = rrwebEventManager;\n managers.push({ name: 'replay', manager: rrwebEventManager });\n } catch (error) {\n const typedError = error as Error;\n this.loggerProvider.warn(`Error occurred while creating replay events manager: ${typedError.toString()}`);\n }\n\n if (this.config.interactionConfig?.enabled) {\n const payloadBatcher = this.config.interactionConfig.batch ? clickBatcher : clickNonBatcher;\n try {\n const interactionEventManager = await createEventsManager<'interaction'>({\n config: this.config,\n type: 'interaction',\n minInterval: this.config.interactionConfig.trackEveryNms ?? INTERACTION_MIN_INTERVAL,\n maxInterval: INTERACTION_MAX_INTERVAL,\n maxPersistedEventsSize: this.config.maxPersistedEventsSizeBytes,\n payloadBatcher,\n storeType,\n trackDestinationWorkerScript,\n });\n managers.push({ name: 'interaction', manager: interactionEventManager });\n } catch (error) {\n const typedError = error as Error;\n this.loggerProvider.warn(`Error occurred while creating interaction events manager: ${typedError.toString()}`);\n }\n }\n\n this.eventsManager = new MultiEventManager<'replay' | 'interaction', string>(...managers);\n // To prevent too many threads.\n if (this.eventCompressor) {\n this.eventCompressor.terminate();\n }\n\n // Eager full-snapshot send is tunable. When `eagerFullSnapshotSend` is true, every full\n // snapshot triggers an immediate flush so replays are playable as early as possible (the\n // SR-3115 contract). Leaving it unset (default) keeps the snapshot compressed and buffered\n // immediately (ordering + beacon coverage on page exit preserved) but defers the network\n // send to the normal interval/size cadence — this avoids the focus/checkout-driven request\n // storm that eager per-snapshot sends create when many SDK instances run on the same page.\n // The default flipped to disabled per the validated amp-on-amp perf config (SR-4646).\n const onFullSnapshotProcessed = this.config.eagerFullSnapshotSend === true ? () => this.sendEvents() : undefined;\n this.eventCompressor = new EventCompressor(\n this.eventsManager,\n this.config,\n this.getDeviceId(),\n compressionWorkerScript,\n onFullSnapshotProcessed,\n );\n\n // Flush any events that arrived while eventCompressor was not yet ready\n // (e.g. a concurrent setSessionId() call that raced _init()'s async setup).\n if (this.pendingEmitEvents.length > 0) {\n const pending = this.pendingEmitEvents.splice(0);\n for (const { event, sessionId } of pending) {\n this.eventCompressor.enqueueEvent(event, sessionId);\n }\n }\n\n // Register beacon fallback for page exit. sendBeacon survives page unload\n // and delivers any incremental events that haven't been flushed via fetch yet.\n //\n // Known cross-session race: if asyncSetSessionId fired and its async\n // storeCurrentSequence hasn't resolved before unload, the beacon buffer can still\n // hold previous-session events. The gate below reads the *new* session's\n // sessionStartTime, so legitimately-sendable old-session events get suppressed.\n // Follow-up: track start time per buffered batch instead of globally.\n this.pageLeaveFns = [\n ...this.pageLeaveFns,\n () => {\n if (!this.config || !this.identifiers?.sessionId || !rrwebEventManager) return;\n const events = rrwebEventManager.getBeaconEvents();\n if (!events.length) return;\n const deviceId = this.getDeviceId();\n if (!deviceId) return;\n if (this.isBelowMinSessionDuration()) return;\n rrwebEventManager.trackDestination.sendBeacon({\n events,\n sessionId: this.identifiers.sessionId,\n deviceId,\n apiKey: this.config.apiKey,\n serverZone: this.config.serverZone,\n });\n },\n ];\n\n await this.initializeNetworkObservers();\n\n // Enable background capture when this page is opened by the Amplitude app\n // (window.opener exists). Uses the shared messenger singleton so that if\n // autocapture is also loaded, both share a single messenger and script load.\n if (getGlobalScope()?.opener) {\n const messenger = getOrCreateWindowMessenger();\n enableBackgroundCapture(messenger);\n messenger.setup({\n logger: this.loggerProvider,\n ...(this.config.serverZone && { endpoint: AMPLITUDE_ORIGINS_MAP[this.config.serverZone] }),\n });\n }\n\n this.loggerProvider.log('Installing @amplitude/session-replay-browser.');\n\n this.teardownEventListeners(false);\n\n // Q1 \"did init happen?\": its presence in DataDog proves init() ran to completion for this\n // session; the props show whether the prerequisites (session/device id, config) were present.\n this.incrementDiagnostic(SrDiagnostic.init);\n this.recordDiagnosticEvent(SrDiagnostic.init, {\n // sessionId is always stamped by recordDiagnosticEvent, so no separate hasSessionId here.\n hasDeviceId: !!this.getDeviceId(),\n captureEnabled: this.config.captureEnabled,\n hasTargetingConfig: !!this.config.targetingConfig,\n sampleRate: this.config.sampleRate,\n optOut: this.shouldOptOut(),\n currentUrl: this.getCurrentPageForTargeting()?.url,\n // 'reload' tells a page refresh apart from a fresh load ('navigate') or back/forward\n // ('back_forward'). New tabs and refreshes keep the same session id, so this is the only\n // way to distinguish a refresh from a brand-new init within a session.\n navigationType: this.getNavigationType(),\n });\n\n await this.evaluateTargetingAndCapture(\n { userProperties: options.userProperties, page: this.getCurrentPageForTargeting() },\n true,\n );\n\n const needsUrlTracking = this.config.targetingConfig || (this.config.privacyConfig?.urlMaskLevels?.length ?? 0) > 0;\n // Record whether we even attempt to wire up the URL-change listener, and the inputs behind that\n // decision. If `needsUrlTracking` is false the listener is never attached, so SPA navigations are\n // invisible to TRC — this is the first thing to check when \"TRC is on but never re-evaluates\".\n this.recordDiagnosticEvent(SrDiagnostic.urlListenerSetup, {\n needsUrlTracking: !!needsUrlTracking,\n hasTargetingConfig: !!this.config.targetingConfig,\n urlMaskLevels: this.config.privacyConfig?.urlMaskLevels?.length ?? 0,\n // config always defaults this to a boolean (see local-config), so no `?? false` needed here.\n enableUrlChangePolling: this.config.enableUrlChangePolling,\n urlChangePollingInterval: this.config.urlChangePollingInterval,\n });\n this.loggerProvider.debug(`URL-change listener needed: ${String(!!needsUrlTracking)}.`);\n if (needsUrlTracking) {\n this.setupUrlChangeListener();\n }\n }\n\n setSessionId(sessionId: string | number, deviceId?: string) {\n return returnWrapper(this.asyncSetSessionId(sessionId, deviceId));\n }\n\n async asyncSetSessionId(\n sessionId: string | number,\n deviceId?: string,\n options?: { userProperties?: { [key: string]: any } },\n ) {\n const previousSessionId = this.identifiers?.sessionId;\n const currentDeviceId = this.getDeviceId();\n // Standalone SDK callers may poll setSessionId with a stable bucket id (e.g. hour-aligned\n // timestamps) and only need a no-op when the bucket hasn't rolled. Without this guard,\n // the rest of asyncSetSessionId still runs: sendEvents, targeting reset, config refetch,\n // and recordEvents (stop + restart rrweb). Proceed when deviceId changes or\n // non-empty userProperties are passed so targeting can re-evaluate on Identify.\n if (\n previousSessionId !== undefined &&\n previousSessionId === sessionId &&\n (deviceId === undefined || deviceId === currentDeviceId) &&\n (options?.userProperties === undefined || Object.keys(options.userProperties).length === 0)\n ) {\n return;\n }\n\n // Invalidate any in-flight URL-change re-evaluations from the previous session.\n this.latestUrlChangeTargetingEvaluationId++;\n this.sessionTargetingMatch = false;\n this.lastShouldRecordDecision = undefined; // Reset targeting decision for new session\n if (previousSessionId) {\n this.sendEvents(previousSessionId);\n }\n\n const isSessionChange = previousSessionId !== sessionId;\n\n // A real session transition (not the first set): recording stops/restarts and targeting is\n // re-evaluated here, so session churn (timeout, multi-tab custom ids, explicit setSessionId)\n // is a prime suspect for \"sometimes records, sometimes not\". recordDiagnosticEvent ships to\n // DataDog AND mirrors to loggerProvider.debug. New tabs / refreshes keep the same id and won't\n // hit this — use the init diagnostic's navigationType for those.\n if (isSessionChange && previousSessionId !== undefined) {\n this.recordDiagnosticEvent(SrDiagnostic.sessionChanged, {\n from: previousSessionId,\n to: sessionId,\n deviceIdChanged: deviceId !== undefined && deviceId !== currentDeviceId,\n });\n }\n\n // Drop any beacon-buffered events from the previous session BEFORE installing the\n // new identifiers / start time. Otherwise the page-leave beacon path could attribute\n // old-session events to the new session id, and the gate (using the new start time)\n // would compute the wrong elapsed duration. Skip on a redundant same-sessionId call —\n // the buffer belongs to the *continuing* session and should ship via beacon as normal.\n if (isSessionChange) {\n this.rrwebEventManager?.dropPendingBeaconEvents();\n }\n\n const deviceIdForReplayId = deviceId || this.getDeviceId();\n this.identifiers = new SessionIdentifiers({\n sessionId: sessionId,\n deviceId: deviceIdForReplayId,\n });\n\n // Gate state and persisted start time only get reset on an actual session boundary.\n // A redundant setSessionId(currentId) call would otherwise overwrite both the in-memory\n // and stored start time with a fresh Date.now() — restarting the gate clock for what is\n // supposed to be a continuing session.\n if (isSessionChange) {\n this.sessionStartTime = Date.now();\n this.suppressedSendCount = 0;\n this.hasEmittedGateDecision = false;\n if (this.config?.apiKey) {\n setReplayStartTime(this.config.apiKey, sessionId, this.sessionStartTime, this.loggerProvider);\n if (previousSessionId !== undefined) {\n removeReplayStartTime(this.config.apiKey, previousSessionId, this.loggerProvider);\n }\n }\n }\n\n // If there is no previous session id, SDK is being initialized for the first time,\n // and config was just fetched in initialization, so no need to fetch it a second time\n if (this.joinedConfigGenerator && previousSessionId) {\n const { joinedConfig } = await this.joinedConfigGenerator.generateJoinedConfig();\n this.config = joinedConfig;\n }\n\n if (this.config?.targetingConfig) {\n await this.evaluateTargetingAndCapture(\n { userProperties: options?.userProperties, page: this.getCurrentPageForTargeting() },\n false,\n true,\n );\n } else {\n await this.recordEvents();\n }\n }\n\n getSessionReplayProperties() {\n const config = this.config;\n const identifiers = this.identifiers;\n if (!config || !identifiers) {\n this.loggerProvider.warn('Session replay init has not been called, cannot get session replay properties.');\n return {};\n }\n\n const shouldRecord = this.getShouldRecord();\n let eventProperties: { [key: string]: string | null } = {};\n\n if (shouldRecord) {\n eventProperties = {\n [DEFAULT_SESSION_REPLAY_PROPERTY]: identifiers.sessionReplayId ? identifiers.sessionReplayId : null,\n };\n if (config.debugMode) {\n eventProperties[SESSION_REPLAY_DEBUG_PROPERTY] = JSON.stringify({\n appHash: generateHashCode(config.apiKey).toString(),\n });\n }\n }\n\n void this.addCustomRRWebEvent(\n CustomRRwebEvent.GET_SR_PROPS,\n {\n shouldRecord,\n eventProperties: eventProperties,\n },\n this.eventCount === 10,\n );\n if (this.eventCount === 10) {\n this.eventCount = 0;\n }\n this.eventCount++;\n\n return eventProperties;\n }\n\n blurListener = () => {\n this.sendEvents();\n };\n\n focusListener = () => {\n if (this.recordCancelCallback && this.recordFunction) {\n // Recording is already active. The on-focus full snapshot is tunable: when\n // `captureFullSnapshotOnFocus` is false we skip it entirely so high focus-churn pages\n // don't generate a full snapshot (and, with eager send, a network request) per focus.\n if (this.config?.captureFullSnapshotOnFocus === false) {\n return;\n }\n try {\n this.recordFunction.takeFullSnapshot(true);\n } catch (error) {\n this.loggerProvider.warn('Failed to take full snapshot on focus:', error);\n }\n } else if (!this.recordEventsInFlight) {\n void this.recordEvents(false);\n }\n };\n\n /**\n * This is an instance member so that if init is called multiple times\n * it doesn't add another listener to the page leave event. This is to\n * prevent duplicate listener actions from firing.\n */\n private pageLeaveListener = (e: PageTransitionEvent | Event) => {\n // Synchronously drain any events still queued in the requestIdleCallback\n // pipeline so they are available to send before the page unloads.\n this.eventCompressor?.flushQueue();\n this.sendEvents();\n this.pageLeaveFns.forEach((fn) => {\n fn(e);\n });\n };\n\n evaluateTargetingAndCapture = async (\n targetingParams: SessionReplayTargetingInput,\n isInit = false,\n forceRestart = false,\n forceTargetingReevaluation = false,\n ) => {\n // What triggered this evaluation (init vs SPA URL change vs analytics event) — shows in\n // DataDog how often re-evaluation actually runs.\n this.incrementDiagnostic(\n SrDiagnostic.evalTrigger(isInit ? 'init' : forceTargetingReevaluation ? 'urlchange' : 'event'),\n );\n\n if (!this.identifiers || !this.identifiers.sessionId || !this.config) {\n // Q4: eval can't run because a prerequisite is missing — record exactly which one.\n this.incrementDiagnostic(SrDiagnostic.evalMissingPrereq);\n this.recordDiagnosticEvent(SrDiagnostic.evalMissingPrereq, {\n hasIdentifiers: !!this.identifiers,\n hasSessionId: !!this.identifiers?.sessionId,\n hasConfig: !!this.config,\n hasDeviceId: !!this.getDeviceId(),\n });\n if (this.identifiers && !this.identifiers.sessionId) {\n this.loggerProvider.log('Session ID has not been set yet, cannot evaluate targeting for Session Replay.');\n } else {\n this.loggerProvider.warn('Session replay init has not been called, cannot evaluate targeting.');\n }\n return;\n }\n\n // Handle cases where there's no targeting config\n if (!this.config.targetingConfig) {\n this.incrementDiagnostic(SrDiagnostic.evalNoConfig);\n if (isInit) {\n this.loggerProvider.log('Targeting config has not been set yet, cannot evaluate targeting.');\n } else {\n this.loggerProvider.log('No targeting config set, skipping initialization/recording for event.');\n return;\n }\n }\n\n // Store targeting parameters for use in getShouldRecord\n this.lastTargetingParams = targetingParams;\n\n // Re-evaluate only until we get the first match in this session.\n // Once matched, keep recording for the rest of the session.\n const targetingConfig = this.config.targetingConfig;\n const shouldReEvaluate = targetingConfig && !this.sessionTargetingMatch;\n if (shouldReEvaluate) {\n // Capture URL-change evaluation id so out-of-order async completions can be discarded.\n const urlChangeEvaluationId = forceTargetingReevaluation ? this.latestUrlChangeTargetingEvaluationId : undefined;\n let eventForTargeting = targetingParams.event;\n if (\n eventForTargeting &&\n Object.values(SpecialEventType).includes(eventForTargeting.event_type as SpecialEventType)\n ) {\n eventForTargeting = undefined;\n }\n\n const pageUrl = targetingParams.page?.url ?? getGlobalScope()?.location?.href ?? '';\n const pageForTargeting = targetingParams.page ?? (pageUrl !== '' ? { url: pageUrl } : undefined);\n\n // Record the targeting trigger event\n this.recordDiagnosticEvent(SrDiagnostic.targetingTrigger, {\n sessionId: this.identifiers.sessionId,\n deviceId: this.getDeviceId(),\n targetingConfig: this.config.targetingConfig,\n targetingParams: {\n userProperties: targetingParams.userProperties,\n event: eventForTargeting,\n page: pageForTargeting,\n },\n });\n\n const evalStart = Date.now();\n const targetingMatch = await evaluateTargetingAndStore({\n sessionId: this.identifiers.sessionId,\n targetingConfig,\n loggerProvider: this.loggerProvider,\n apiKey: this.config.apiKey,\n targetingParams: {\n userProperties: targetingParams.userProperties,\n event: eventForTargeting,\n page: pageForTargeting,\n },\n urlChange: forceTargetingReevaluation,\n diagnosticsClient: this.config.diagnosticsClient,\n deviceId: this.getDeviceId(),\n });\n const evalDurationMs = Date.now() - evalStart;\n const trigger = isInit ? 'init' : forceTargetingReevaluation ? 'urlchange' : 'event';\n // Evaluation latency — surfaces the slow-network residual gap (SR-4234) in DataDog as\n // sdk.diagnostics.sr.trc.eval.duration_ms.{avg,max,...}.\n this.recordDiagnosticHistogram(SrDiagnostic.evalDurationMs, evalDurationMs);\n\n if (\n forceTargetingReevaluation &&\n urlChangeEvaluationId !== undefined &&\n urlChangeEvaluationId !== this.latestUrlChangeTargetingEvaluationId\n ) {\n this.incrementDiagnostic(SrDiagnostic.evalStaleDiscarded);\n this.recordDiagnosticEvent(SrDiagnostic.evalStaleDiscarded, {\n sessionId: this.identifiers.sessionId,\n pageUrl: pageForTargeting?.url,\n evaluationId: urlChangeEvaluationId,\n latestEvaluationId: this.latestUrlChangeTargetingEvaluationId,\n evalDurationMs,\n });\n this.loggerProvider.debug(\n `Ignoring stale URL-change targeting result #${urlChangeEvaluationId}; latest is #${this.latestUrlChangeTargetingEvaluationId}.`,\n );\n return;\n }\n // Per-evaluation outcome (distinct from the per-session sr.gate.* gate counters).\n this.incrementDiagnostic(targetingMatch ? SrDiagnostic.evalMatch : SrDiagnostic.evalNoMatch);\n // Keep targeting match monotonic within a session: once true, always true.\n // This avoids races where an older in-flight evaluation resolves false after\n // a newer evaluation already resolved true.\n this.sessionTargetingMatch = this.sessionTargetingMatch || targetingMatch;\n // Q5: record ALL evaluation params (→ DataDog Logs) so a single evaluation can be fully\n // reconstructed by URL, identifiers, inputs, outcome, trigger and latency. userProperties\n // values are intentionally reduced to keys to avoid logging PII.\n this.recordDiagnosticEvent(SrDiagnostic.evalEvent, {\n // sessionId + deviceId are stamped by recordDiagnosticEvent.\n trigger,\n matched: targetingMatch,\n sessionTargetingMatch: this.sessionTargetingMatch,\n pageUrl: pageForTargeting?.url,\n hasDeviceId: !!this.getDeviceId(),\n hasEvent: !!eventForTargeting,\n eventType: eventForTargeting?.event_type,\n userPropertyKeys: targetingParams.userProperties ? Object.keys(targetingParams.userProperties) : [],\n evalDurationMs,\n });\n\n this.loggerProvider.debug(\n JSON.stringify(\n {\n name: 'targeted replay capture config',\n sessionTargetingMatch: this.sessionTargetingMatch,\n event: eventForTargeting,\n targetingParams: targetingParams,\n },\n null,\n 2,\n ),\n );\n } else if (targetingConfig && this.sessionTargetingMatch) {\n // Already matched earlier this session — recording continues without re-evaluation.\n this.incrementDiagnostic(SrDiagnostic.evalSkippedAlreadyMatched);\n }\n\n if (isInit) {\n void this.initialize(true);\n } else if (forceRestart || !this.recordCancelCallback) {\n this.loggerProvider.log('Recording events for session due to forceRestart or no ongoing recording.');\n await this.recordEvents();\n }\n };\n\n sendEvents(sessionId?: string | number) {\n const sessionIdToSend = sessionId || this.identifiers?.sessionId;\n const deviceId = this.getDeviceId();\n if (this.eventsManager && sessionIdToSend && deviceId) {\n if (this.isBelowMinSessionDuration()) {\n // Safe to dereference: isBelowMinSessionDuration() only returns true when both\n // this.config and this.sessionStartTime are defined.\n const startTime = this.sessionStartTime as number;\n const minMs = (this.config as SessionReplayJoinedConfig).minSessionDurationMs as number;\n this.loggerProvider.log(\n `Session ${sessionIdToSend} not sent: duration ${Date.now() - startTime}ms is below minimum ${minMs}ms.`,\n );\n // We deliberately do NOT clear the beacon buffer here. Blur/visibility-change\n // can call sendEvents() mid-session; if the session later crosses the threshold\n // those buffered events are legitimately sendable via beacon on page exit.\n // Cross-session leak is prevented in asyncSetSessionId, which drops the buffer\n // at the session transition. The page-leave path also gates independently.\n this.suppressedSendCount++;\n // gap #1: recording but events held back by min_session_duration — another \"recording yet\n // no replay in Amplitude\" cause.\n this.incrementDiagnostic(SrDiagnostic.sendSuppressedMinDuration);\n return;\n }\n // On the first send-after-pass for the session, emit a custom rrweb event so the\n // payload itself carries the gate verdict. Lets backend ingestion diff intended\n // vs actual replay counts to spot start-time-tracking regressions.\n //\n // Gate on recording being active too: addCustomRRWebEvent is a no-op when\n // recordCancelCallback/recordFunction aren't set yet (e.g. a blur-listener-fired\n // sendEvents reaches us before _recordEvents() activates on a reloaded long-lived\n // session). Tripping hasEmittedGateDecision unconditionally would lose the signal\n // for that session's first real send.\n if (\n !this.hasEmittedGateDecision &&\n this.config?.minSessionDurationMs !== undefined &&\n this.recordCancelCallback &&\n this.recordFunction\n ) {\n this.hasEmittedGateDecision = true;\n const elapsedMs = this.sessionStartTime !== undefined ? Date.now() - this.sessionStartTime : undefined;\n void this.addCustomRRWebEvent(\n CustomRRwebEvent.REPLAY_GATE_DECISION,\n {\n sessionId: sessionIdToSend,\n suppressedSendCount: this.suppressedSendCount,\n elapsedMs,\n minSessionDurationMs: this.config.minSessionDurationMs,\n },\n false,\n );\n }\n this.eventsManager.sendCurrentSequenceEvents({ sessionId: sessionIdToSend, deviceId });\n }\n }\n\n async initialize(shouldSendStoredEvents = false) {\n if (!this.identifiers?.sessionId) {\n this.loggerProvider.log(`Session is not being recorded due to lack of session id.`);\n return Promise.resolve();\n }\n\n const deviceId = this.getDeviceId();\n if (!deviceId) {\n this.loggerProvider.log(`Session is not being recorded due to lack of device id.`);\n return Promise.resolve();\n }\n this.eventsManager && shouldSendStoredEvents && void this.eventsManager.sendStoredEvents({ deviceId });\n\n return this.recordEvents();\n }\n\n shouldOptOut() {\n let identityStoreOptOut: boolean | undefined;\n if (this.config?.instanceName) {\n const identityStore = getAnalyticsConnector(this.config.instanceName).identityStore;\n identityStoreOptOut = identityStore.getIdentity().optOut;\n }\n\n return identityStoreOptOut !== undefined ? identityStoreOptOut : this.config?.optOut;\n }\n\n /**\n * Increment a diagnostics counter so the team can see the distribution of recording decisions\n * across a customer's sessions (e.g. lots of sr.gate.trc_no_match => rule isn't matching).\n * Ships via the analytics SDK's DiagnosticsClient. No-op when there's no client or diagnostics\n * isn't sampled in; never throws — diagnostics must never interfere with recording.\n */\n private incrementDiagnostic(counter: string) {\n try {\n // Mirror to the console (Debug level) so the full set of diagnostics is visible in the\n // browser, not only in DataDog — helps debugging when a customer can't share a repro env.\n this.loggerProvider.debug(`[SR diagnostics] ${counter}`);\n this.config?.diagnosticsClient?.increment(counter);\n } catch {\n // swallow — diagnostics is best-effort\n }\n }\n\n /**\n * Record a diagnostics histogram value (min/max/avg/count in DataDog). Same best-effort, never-\n * throws contract as incrementDiagnostic. Use for latencies/sizes, not per-call counts.\n */\n private recordDiagnosticHistogram(name: string, value: number) {\n try {\n // Mirror to the console (Debug level) — see incrementDiagnostic.\n this.loggerProvider.debug(`[SR diagnostics] ${name}=${value}`);\n // The only caller runs inside evaluateTargetingAndCapture's `this.config` guard, so the\n // `config == null` arm of this optional chain is unreachable here (kept as defensive parity\n // with recordDiagnosticEvent). The diagnosticsClient-absent arm IS exercised by no-client tests.\n /* istanbul ignore next */\n this.config?.diagnosticsClient?.recordHistogram(name, value);\n } catch {\n // swallow — diagnostics is best-effort\n }\n }\n\n /**\n * Record a diagnostics EVENT with properties. Events are forwarded to DataDog Logs, so the\n * properties become queryable fields (e.g. @matched, @pageUrl). Use sparingly vs counters: the\n * client caps in-memory events (~10 per save interval), so this is for context-rich signals at\n * meaningful decision points, not per-call tallies. Best-effort, never throws.\n */\n private recordDiagnosticEvent(name: string, properties: { [key: string]: unknown }) {\n try {\n const sessionId = this.identifiers?.sessionId;\n const deviceId = this.getDeviceId();\n // Always stamp sessionId, deviceId and srId so every diagnostics event (→ DataDog Logs) can\n // be correlated to a single session/device — and to the actual replay, since the Session\n // Replay ID is `${deviceId}/${sessionId}`. Caller props override if they pass their own.\n const enriched = {\n sessionId,\n deviceId,\n srId: deviceId != null && sessionId != null ? `${deviceId}/${sessionId}` : undefined,\n ...properties,\n };\n // Mirror to the console (Debug level) so the full event + props are visible in the browser,\n // not only in DataDog — see incrementDiagnostic.\n this.loggerProvider.debug(`[SR diagnostics] ${name} ${JSON.stringify(enriched)}`);\n this.config?.diagnosticsClient?.recordEvent(name, enriched);\n // Flush immediately so the event ships now rather than on the client's ~5-min timer (and so\n // short sessions that never reach the timer aren't lost). NOTE: this sends one capture POST\n // per event — higher request volume; revisit/gate before production.\n void this.config?.diagnosticsClient?._flush?.();\n } catch {\n // swallow — diagnostics is best-effort\n }\n }\n\n /**\n * Emit a single rich TRC decision snapshot per session to diagnostics — surfaced even when\n * nothing records (the exact case customers can't reproduce locally).\n */\n private recordTrcDecisionDiagnostic(shouldRecord: boolean) {\n const config = this.config;\n // Every caller is past getShouldRecord's `!this.identifiers`/`!this.config` guard, so both are\n // defined here; the `?.` arms below are unreachable defensive narrowing and excluded from\n // coverage. The reachable guards (no diagnosticsClient, undefined/duplicate sessionId) are tested.\n /* istanbul ignore next */\n if (!config) {\n return;\n }\n /* istanbul ignore next */\n const sessionId = this.identifiers?.sessionId;\n // Once past this guard, config.diagnosticsClient is truthy, so the fields below read config\n // directly rather than re-asserting with `?.` on every access.\n if (!config.diagnosticsClient || sessionId === undefined || sessionId === this.trcDiagnosticSessionId) {\n return;\n }\n this.trcDiagnosticSessionId = sessionId;\n // Goes through recordDiagnosticEvent so it carries sessionId + deviceId like every other event.\n this.recordDiagnosticEvent(SrDiagnostic.decision, {\n shouldRecord,\n captureEnabled: config.captureEnabled,\n hasTargetingConfig: !!config.targetingConfig,\n sessionTargetingMatch: this.sessionTargetingMatch,\n sampleRate: config.sampleRate,\n pageUrl: this.getCurrentPageForTargeting()?.url,\n sdkVersion: VERSION,\n });\n }\n\n getShouldRecord() {\n if (!this.identifiers || !this.config || !this.identifiers.sessionId) {\n this.loggerProvider.warn(`Session is not being recorded due to lack of config, please call sessionReplay.init.`);\n this.incrementDiagnostic(SrDiagnostic.gateNoIdentifiers);\n return false;\n }\n\n if (!this.config.captureEnabled) {\n this.loggerProvider.log(\n `Session ${this.identifiers.sessionId} not being captured due to capture being disabled for project or because the remote config could not be fetched.`,\n );\n this.incrementDiagnostic(SrDiagnostic.gateCaptureDisabled);\n this.recordTrcDecisionDiagnostic(false);\n return false;\n }\n\n if (this.shouldOptOut()) {\n this.loggerProvider.log(`Opting session ${this.identifiers.sessionId} out of recording due to optOut config.`);\n this.incrementDiagnostic(SrDiagnostic.gateOptOut);\n this.recordTrcDecisionDiagnostic(false);\n return false;\n }\n\n let shouldRecord = false;\n let message = '';\n let matched = false;\n\n // If targetingConfig exists, we'll use the sessionTargetingMatch to determine whether to record\n // Otherwise, we'll evaluate the session against the overall sample rate\n if (this.config.targetingConfig) {\n if (!this.sessionTargetingMatch) {\n message = `Not capturing replays for session ${this.identifiers.sessionId} due to not matching targeting conditions.`;\n this.loggerProvider.log(message);\n shouldRecord = false;\n matched = false;\n this.incrementDiagnostic(SrDiagnostic.gateTrcNoMatch);\n } else {\n message = `Capturing replays for session ${this.identifiers.sessionId} due to matching targeting conditions.`;\n this.loggerProvider.log(message);\n shouldRecord = true;\n matched = true;\n this.incrementDiagnostic(SrDiagnostic.gateTrcMatch);\n }\n } else {\n const isInSample = isSessionInSample(this.identifiers.sessionId, this.config.sampleRate);\n if (!isInSample) {\n message = `Opting session ${this.identifiers.sessionId} out of recording due to sample rate.`;\n this.loggerProvider.log(message);\n shouldRecord = false;\n matched = false;\n this.incrementDiagnostic(SrDiagnostic.gateSampleOut);\n } else {\n shouldRecord = true;\n matched = true;\n this.incrementDiagnostic(SrDiagnostic.gateSampleIn);\n }\n }\n\n // Only send custom rrweb event for targeting decision when the decision changes\n if (this.lastShouldRecordDecision !== shouldRecord && this.config.targetingConfig) {\n void this.addCustomRRWebEvent(CustomRRwebEvent.TARGETING_DECISION, {\n message,\n sessionId: this.identifiers.sessionId,\n matched,\n targetingParams: this.lastTargetingParams,\n });\n this.lastShouldRecordDecision = shouldRecord;\n }\n\n this.recordTrcDecisionDiagnostic(shouldRecord);\n\n return shouldRecord;\n }\n\n getBlockSelectors(): string | string[] | undefined {\n // For some reason, this defaults to empty array ([]) if undefined in the compiled script.\n // Empty arrays cause errors when being evaluated in Safari.\n // Force the selector to be undefined if it's an empty array.\n const blockSelector = this.config?.privacyConfig?.blockSelector ?? [];\n if (blockSelector.length === 0) {\n return undefined;\n }\n return blockSelector;\n }\n\n getMaskTextSelectors(): string | undefined {\n const privacyConfig = this.config?.privacyConfig;\n const effectiveLevel = privacyConfig ? getEffectiveMaskLevel(this.currentPageUrl, privacyConfig) : undefined;\n\n if (effectiveLevel === 'conservative') {\n return '*';\n }\n\n // If any urlMaskLevels rule uses 'conservative', always route all text nodes\n // through maskTextFn so the dynamic URL getter can decide at call time.\n // Without this, rrweb's static maskTextSelector would miss text nodes when\n // the user navigates from a non-conservative page to a conservative one.\n if (privacyConfig?.urlMaskLevels?.some((rule) => rule.maskLevel === 'conservative')) {\n return '*';\n }\n\n // If defaultMaskLevel is 'conservative' and URL rules exist, always route text through\n // maskTextFn — a page matching no rule falls back to the conservative default, and\n // rrweb must be set up at start to call maskTextFn for those text nodes.\n const urlMaskLevels = privacyConfig?.urlMaskLevels;\n if (privacyConfig?.defaultMaskLevel === 'conservative' && urlMaskLevels && urlMaskLevels.length > 0) {\n return '*';\n }\n\n const maskSelector = privacyConfig?.maskSelector;\n if (!maskSelector) {\n return;\n }\n\n return maskSelector as unknown as string;\n }\n\n async getRecordingPlugins(loggingConfig: LoggingConfig | undefined) {\n const plugins = [];\n\n // Add URL tracking plugin\n try {\n const urlTrackingPlugin = createUrlTrackingPlugin({\n ugcFilterRules: this.config?.interactionConfig?.ugcFilterRules || [],\n enablePolling: this.config?.enableUrlChangePolling || false,\n pollingInterval: this.config?.urlChangePollingInterval,\n captureDocumentTitle: this.config?.captureDocumentTitle,\n });\n\n plugins.push(urlTrackingPlugin);\n } catch (error) {\n this.loggerProvider.warn('Failed to create URL tracking plugin:', error);\n }\n\n // Default plugin settings -\n // {\n // level: ['info', 'log', 'warn', 'error'],\n // lengthThreshold: 10000,\n // stringifyOptions: {\n // stringLengthLimit: undefined,\n // numOfKeysLimit: 50,\n // depthOfLimit: 4,\n // },\n // logger: window.console,\n // }\n if (loggingConfig?.console?.enabled) {\n try {\n // Dynamic import keeps console plugin separate and only loads when needed\n const { getRecordConsolePlugin } = await import('@amplitude/rrweb-plugin-console-record');\n plugins.push(getRecordConsolePlugin({ level: loggingConfig.console.levels }));\n } catch (error) {\n this.loggerProvider.warn('Failed to load console plugin:', error);\n }\n }\n\n return plugins.length > 0 ? plugins : undefined;\n }\n\n private async getRecordFunction(): Promise<RecordFunction | null> {\n if (this.recordFunction) {\n return this.recordFunction;\n }\n\n try {\n const { record } = await import('@amplitude/rrweb-record');\n this.recordFunction = record;\n return record;\n } catch (error) {\n this.loggerProvider.warn('Failed to load rrweb-record module:', error);\n return null;\n }\n }\n\n async recordEvents(shouldLogMetadata = true) {\n if (this.recordEventsInFlight) {\n this.recordEventsPendingShouldLogMetadata = shouldLogMetadata;\n return;\n }\n this.recordEventsInFlight = true;\n try {\n await this._recordEvents(shouldLogMetadata);\n while (this.recordEventsPendingShouldLogMetadata !== null) {\n const pendingArgs = this.recordEventsPendingShouldLogMetadata;\n this.recordEventsPendingShouldLogMetadata = null;\n await this._recordEvents(pendingArgs);\n }\n } finally {\n this.recordEventsInFlight = false;\n this.recordEventsPendingShouldLogMetadata = null;\n }\n }\n\n private async _recordEvents(shouldLogMetadata = true) {\n const config = this.config;\n const shouldRecord = this.getShouldRecord();\n const sessionId = this.identifiers?.sessionId;\n if (!shouldRecord || !sessionId || !config) {\n return;\n }\n this.stopRecordingEvents();\n\n const recordFunction = await this.getRecordFunction();\n\n // May be undefined if cannot import rrweb-record\n if (!recordFunction) {\n // gap #1: gate said record, but rrweb couldn't load → no replay despite shouldRecord=true.\n this.incrementDiagnostic(SrDiagnostic.recordNoRecordFn);\n this.recordDiagnosticEvent(SrDiagnostic.recordNoRecordFn, {});\n return;\n }\n\n await this.initializeNetworkObservers();\n\n const networkLoggingConfig = config.loggingConfig?.network;\n const trackUrl = getServerUrl(config.serverZone, config.trackServerUrl);\n const ignoredUrls = [SESSION_REPLAY_SERVER_URL, SESSION_REPLAY_EU_URL, SESSION_REPLAY_STAGING_URL, trackUrl];\n this.networkObservers?.start((event: NetworkRequestEvent) => {\n if (ignoredUrls.some((url) => event.url.startsWith(url))) return;\n void this.addCustomRRWebEvent(CustomRRwebEvent.FETCH_REQUEST, event);\n }, networkLoggingConfig);\n const { interactionConfig, loggingConfig } = config;\n\n const hooks = interactionConfig?.enabled\n ? {\n mouseInteraction:\n this.eventsManager &&\n this.clickHandler?.createHook({\n eventsManager: this.eventsManager,\n sessionId,\n deviceIdFn: this.getDeviceId.bind(this),\n mirror: recordFunction.mirror,\n ugcFilterRules: interactionConfig.ugcFilterRules ?? [],\n performanceOptions: config.performanceConfig?.interaction,\n }),\n scroll: this.scrollHook,\n }\n : {};\n\n const ugcFilterRules =\n interactionConfig?.enabled && interactionConfig.ugcFilterRules ? interactionConfig.ugcFilterRules : [];\n\n this.loggerProvider.log(`Session Replay capture beginning for ${sessionId}.`);\n // gap #1: rrweb is actually starting. Closes the \"gate said yes but no replay\" blind spot,\n // and its srId is the id the replay uploads under (compare with analytics events to catch the\n // device-id mismatch that breaks stitching).\n this.incrementDiagnostic(SrDiagnostic.recordStarted);\n this.recordDiagnosticEvent(SrDiagnostic.recordStarted, {});\n\n try {\n const crossOriginIframesEnabled = !!config.crossOriginIframes?.enabled;\n const coordinateChildren = config.crossOriginIframes?.coordinateChildren !== false;\n const childMode = crossOriginIframesEnabled && isInIframe();\n\n if (childMode && coordinateChildren) {\n // Child mode: don't self-start; wait for a start signal from the parent.\n // (The previous listener, if any, was already removed by stopRecordingEvents above.)\n this.crossOriginParentSignalCleanup = listenForParentSignals({\n onStart: () => this._recordEventsInChildMode(recordFunction, sessionId, config, hooks),\n onStop: () => {\n try {\n // Only cancel the rrweb recording — do NOT call stopRecordingEvents() here,\n // which would clear crossOriginParentSignalCleanup and make the child deaf\n // to subsequent start/stop cycles from the parent.\n this.recordCancelCallback && this.recordCancelCallback();\n this.recordCancelCallback = null;\n } catch (error) {\n const typedError = error as Error;\n this.loggerProvider.warn(\n `Error occurred while stopping child iframe replay capture: ${typedError.toString()}`,\n );\n }\n },\n });\n return;\n }\n\n this.recordCancelCallback = recordFunction({\n ...this.buildRRWebRecordOptions(\n config,\n hooks,\n (event: eventWithTime) => {\n if (this.shouldOptOut()) {\n this.loggerProvider.log(`Opting session ${sessionId} out of recording due to optOut config.`);\n this.stopRecordingEvents();\n this.sendEvents();\n return;\n }\n\n if (event.type === RRWebEventType.Meta) {\n event.data.href = getPageUrl(event.data.href, ugcFilterRules);\n }\n\n if (this.eventCompressor) {\n // Schedule processing during idle time if the browser supports requestIdleCallback\n this.eventCompressor.enqueueEvent(event, sessionId);\n } else {\n // eventCompressor is not yet ready (concurrent call racing _init()).\n // Buffer the event so it can be flushed once the compressor is initialized.\n this.pendingEmitEvents.push({ event, sessionId });\n }\n },\n 'Error while capturing replay: ',\n ),\n plugins: await this.getRecordingPlugins(loggingConfig),\n recordCrossOriginIframes: crossOriginIframesEnabled,\n });\n\n if (crossOriginIframesEnabled && !childMode && coordinateChildren) {\n if (!this.crossOriginIframeCoordinator) {\n this.crossOriginIframeCoordinator = new CrossOriginIframeCoordinator();\n }\n this.crossOriginIframeCoordinator.start();\n }\n\n void this.addCustomRRWebEvent(CustomRRwebEvent.DEBUG_INFO);\n if (shouldLogMetadata) {\n void this.addCustomRRWebEvent(CustomRRwebEvent.METADATA, this.metadata);\n }\n } catch (error) {\n this.loggerProvider.warn('Failed to initialize session replay:', error);\n }\n }\n\n private buildRRWebRecordOptions(\n config: SessionReplayJoinedConfig,\n hooks: { mouseInteraction?: any; scroll?: scrollCallback },\n emit: (event: eventWithTime) => void,\n errorLogPrefix: string,\n ): Parameters<RecordFunction>[0] {\n const { privacyConfig } = config;\n return {\n emit,\n inlineStylesheet: config.shouldInlineStylesheet,\n hooks,\n maskAllInputs: true,\n maskTextClass: MASK_TEXT_CLASS,\n blockClass: BLOCK_CLASS,\n blockSelector: this.getBlockSelectors() as string | undefined,\n applyBackgroundColorToBlockedElements: config.applyBackgroundColorToBlockedElements,\n maskInputFn: maskFn('input', privacyConfig, () => this.currentPageUrl),\n maskTextFn: maskFn('text', privacyConfig, () => this.currentPageUrl),\n maskAttributeFn: maskAttributeFn(privacyConfig, () => this.currentPageUrl),\n maskTextSelector: this.getMaskTextSelectors(),\n ...(config.fullSnapshotIntervalMs !== undefined && { checkoutEveryNms: config.fullSnapshotIntervalMs }),\n recordCanvas: false,\n captureAdoptedStyleSheets: config.captureAdoptedStyleSheets,\n // Strip nodes that are never rendered by the rrweb replay player.\n // None of these affect visual fidelity; omitting them reduces snapshot size.\n slimDOMOptions: {\n script: true,\n comment: true,\n headFavicon: true,\n headWhitespace: true,\n headMetaDescKeywords: true,\n headMetaSocial: true,\n headMetaRobots: true,\n headMetaHttpEquiv: true,\n headMetaAuthorship: true,\n headMetaVerification: true,\n },\n errorHandler: (error: unknown) => {\n const typedError = error as Error & { _external_?: boolean };\n // styled-components relies on this error being thrown and bubbled up, rrweb is otherwise suppressing it\n if (typedError.message.includes('insertRule') && typedError.message.includes('CSSStyleSheet')) {\n throw typedError;\n }\n // rrweb monkey-patches window functions like CSSStyleSheet.insertRule; errors from external callers\n // (e.g. styled-components) must be re-thrown so they aren't silently swallowed.\n if (typedError._external_) {\n throw typedError;\n }\n this.loggerProvider.warn(errorLogPrefix, typedError.toString());\n // Return true so that we don't clutter user's consoles with internal rrweb errors\n return true;\n },\n };\n }\n\n private _recordEventsInChildMode(\n recordFunction: RecordFunction,\n sessionId: string | number,\n config: SessionReplayJoinedConfig,\n hooks: { mouseInteraction?: any; scroll?: scrollCallback },\n ) {\n // In child mode, rrweb detects window.parent !== window and routes events via\n // postMessage to the parent instead of calling emit. The emit callback is unused.\n // Note: recording plugins (URL tracking, console capture) are intentionally omitted\n // here — the child's events are merged into the parent stream, so URL changes inside\n // the iframe should not be recorded as parent page-view events.\n try {\n // Stop only the previous rrweb recording. Do NOT call stopRecordingEvents() here:\n // that would clear crossOriginParentSignalCleanup — the very listener that invoked\n // this method — making the child permanently deaf to subsequent stop/start cycles.\n this.recordCancelCallback && this.recordCancelCallback();\n this.recordCancelCallback = null;\n this.recordCancelCallback = recordFunction({\n ...this.buildRRWebRecordOptions(\n config,\n hooks,\n () => {\n // no-op: child events are forwarded to parent via postMessage by rrweb\n },\n 'Error while capturing replay (child iframe): ',\n ),\n recordCrossOriginIframes: true, // child mode is only entered when crossOriginIframes.enabled is true\n });\n this.loggerProvider.log(`Session Replay child iframe capture beginning for session ${sessionId}.`);\n } catch (error) {\n this.loggerProvider.warn('Failed to initialize session replay in child iframe mode:', error);\n }\n }\n\n addCustomRRWebEvent = async (\n eventName: CustomRRwebEvent,\n eventData: { [key: string]: any } = {},\n addStorageInfo = true,\n ) => {\n try {\n let debugInfo: DebugInfo | undefined = undefined;\n const config = this.config;\n // Only add debug info for non-metadata events\n if (config && eventName !== CustomRRwebEvent.METADATA) {\n debugInfo = {\n config: getDebugConfig(config),\n version: VERSION,\n };\n if (addStorageInfo) {\n const storageSizeData = await getStorageSize();\n debugInfo = {\n ...storageSizeData,\n ...debugInfo,\n };\n }\n }\n // Check first to ensure we are recording\n if (this.recordCancelCallback && this.recordFunction) {\n this.recordFunction.addCustomEvent(eventName, {\n ...eventData,\n ...debugInfo,\n });\n } else {\n this.loggerProvider.debug(\n `Not able to add custom replay capture event ${eventName} due to no ongoing recording.`,\n );\n }\n } catch (e) {\n this.loggerProvider.debug('Error while adding custom replay capture event: ', e);\n }\n };\n\n stopRecordingEvents = () => {\n try {\n this.loggerProvider.log('Session Replay capture stopping.');\n this.recordCancelCallback && this.recordCancelCallback();\n this.recordCancelCallback = null;\n this.networkObservers?.stop();\n this.crossOriginIframeCoordinator?.stop();\n this.crossOriginIframeCoordinator = null;\n // Remove the child-mode parent signal listener so a later mode change\n // (e.g. crossOriginIframes disabled) does not leave a stale listener.\n this.crossOriginParentSignalCleanup?.();\n this.crossOriginParentSignalCleanup = null;\n } catch (error) {\n const typedError = error as Error;\n this.loggerProvider.warn(`Error occurred while stopping replay capture: ${typedError.toString()}`);\n }\n };\n\n getDeviceId() {\n return this.identifiers?.deviceId;\n }\n\n getSessionId() {\n return this.identifiers?.sessionId;\n }\n\n async flush(useRetry = false) {\n // Intentionally not gated on min_session_duration_ms. flush() forwards payloads\n // already queued in trackDestination, and every code path that queues into it —\n // sendCurrentSequenceEvents, addEvent's batch-split path, sendStoredEvents reading\n // sequencesToSend from IDB — has already passed the gate at the time of queuing.\n // A duplicate gate here would be unreachable.\n return this.eventsManager?.flush(useRetry);\n }\n\n shutdown() {\n this.urlChangeCleanup?.();\n this.crossOriginParentSignalCleanup?.();\n this.crossOriginParentSignalCleanup = null;\n this.teardownEventListeners(true);\n this.stopRecordingEvents();\n this.sendEvents();\n }\n\n private mapSDKType(sdkType: string | undefined) {\n if (sdkType === 'plugin') {\n return '@amplitude/plugin-session-replay-browser';\n }\n\n if (sdkType === 'segment') {\n return '@amplitude/segment-session-replay-plugin';\n }\n\n return null;\n }\n\n private setMetadata(\n sessionId: string | number | undefined,\n joinedConfig: SessionReplayJoinedConfig,\n localConfig: SessionReplayLocalConfig,\n remoteConfig: SessionReplayRemoteConfig | undefined,\n replaySDKVersion: string | undefined,\n standaloneSDKVersion: string | undefined,\n sdkType: string | undefined,\n ) {\n const hashValue = sessionId?.toString() ? generateHashCode(sessionId.toString()) : undefined;\n\n this.metadata = {\n joinedConfig,\n localConfig,\n remoteConfig,\n sessionId,\n hashValue,\n sampleRate: joinedConfig.sampleRate,\n replaySDKType: this.mapSDKType(sdkType),\n replaySDKVersion,\n standaloneSDKType: '@amplitude/session-replay-browser',\n standaloneSDKVersion,\n };\n }\n\n private async initializeNetworkObservers(): Promise<void> {\n if (this.config?.loggingConfig?.network?.enabled && !this.networkObservers) {\n try {\n const { NetworkObservers: NetworkObserversClass } = await import('./observers');\n this.networkObservers = new NetworkObserversClass();\n } catch (error) {\n this.loggerProvider.warn('Failed to import or instantiate NetworkObservers:', error);\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,EAEd,MAAM,EAEN,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAEnC,gFAAgF;AAChF,OAAO,EAAiB,SAAS,IAAI,cAAc,EAAkB,MAAM,wBAAwB,CAAC;AACpG,OAAO,EAAE,wCAAwC,EAAE,MAAM,wBAAwB,CAAC;AASlF,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,+BAA+B,EAC/B,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EACf,6BAA6B,EAC7B,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,GAC3B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WAAA;YACT,SAAS,WAAA;YACT,UAAU,EAAE,YAAY,CAAC,UAAU;YACnC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACvC,gBAAgB,kBAAA;YAChB,iBAAiB,EAAE,mCAAmC;YACtD,oBAAoB,sBAAA;SACrB,CAAC;IACJ,CAAC;IAEa,kDAA0B,GAAxC;;;;;;;6BACM,CAAA,CAAA,MAAA,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,aAAa,0CAAE,OAAO,0CAAE,OAAO,KAAI,CAAC,IAAI,CAAC,gBAAgB,CAAA,EAAtE,wBAAsE;;;;wBAElB,qBAAM,MAAM,CAAC,aAAa,CAAC,EAAA;;wBAArD,qBAAqB,GAAK,CAAA,SAA2B,CAAA,iBAAhC;wBAC/C,IAAI,CAAC,gBAAgB,GAAG,IAAI,qBAAqB,EAAE,CAAC;;;;wBAEpD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,mDAAmD,EAAE,OAAK,CAAC,CAAC;;;;;;KAG1F;IACH,oBAAC;AAAD,CAAC,AAp9CD,IAo9CC","sourcesContent":["import {\n getAnalyticsConnector,\n getGlobalScope,\n ILogger,\n Logger,\n LogLevel,\n returnWrapper,\n SpecialEventType,\n generateHashCode,\n getOrCreateWindowMessenger,\n enableBackgroundCapture,\n AMPLITUDE_ORIGINS_MAP,\n} from '@amplitude/analytics-core';\n\n// Import only specific types to avoid pulling in the entire rrweb-types package\nimport { eventWithTime, EventType as RRWebEventType, scrollCallback } from '@amplitude/rrweb-types';\nimport { createSessionReplayJoinedConfigGenerator } from './config/joined-config';\nimport {\n LoggingConfig,\n SessionReplayJoinedConfig,\n SessionReplayJoinedConfigGenerator,\n SessionReplayLocalConfig,\n SessionReplayMetadata,\n SessionReplayRemoteConfig,\n} from './config/types';\nimport {\n BLOCK_CLASS,\n CustomRRwebEvent,\n DEFAULT_SESSION_REPLAY_PROPERTY,\n INTERACTION_MAX_INTERVAL,\n INTERACTION_MIN_INTERVAL,\n MASK_TEXT_CLASS,\n SESSION_REPLAY_DEBUG_PROPERTY,\n SESSION_REPLAY_EU_URL,\n SESSION_REPLAY_SERVER_URL,\n SESSION_REPLAY_STAGING_URL,\n} from './constants';\nimport {\n getServerUrl,\n getDebugConfig,\n getEffectiveMaskLevel,\n getPageUrl,\n getStorageSize,\n getCurrentUrl,\n maskFn,\n maskAttributeFn,\n} from './helpers';\nimport { EventCompressor } from './events/event-compressor';\nimport { createEventsManager, EventsManagerWithBeacon } from './events/events-manager';\nimport { MultiEventManager } from './events/multi-manager';\nimport { clickBatcher, ClickHandler, clickNonBatcher } from './hooks/click';\nimport { ScrollWatcher } from './hooks/scroll';\nimport { SessionIdentifiers } from './identifiers';\nimport { SafeLoggerProvider } from './logger';\nimport {\n getOrInitReplayStartTime,\n pruneStaleReplayStartTimes,\n removeReplayStartTime,\n setReplayStartTime,\n} from './replay-start-time-store';\nimport { evaluateTargetingAndStore } from './targeting/targeting-manager';\nimport { SrDiagnostic } from './diagnostics';\nimport {\n AmplitudeSessionReplay,\n SessionReplayEventsManager as AmplitudeSessionReplayEventsManager,\n DebugInfo,\n EventsManagerWithType,\n EventType,\n SessionIdentifiers as ISessionIdentifiers,\n SessionReplayOptions,\n SessionReplayTargetingInput,\n} from './typings/session-replay';\nimport { isSessionInSample } from './sampling';\nimport { VERSION } from './version';\n\n// Import only the type for NetworkRequestEvent to keep type safety\nimport type { NetworkObservers, NetworkRequestEvent } from './observers';\nimport { createUrlTrackingPlugin, subscribeToUrlChanges } from './plugins/url-tracking-plugin';\nimport type { RecordFunction } from './utils/rrweb';\nimport { isInIframe, CrossOriginIframeCoordinator, listenForParentSignals } from './cross-origin-iframes';\n\ntype PageLeaveFn = (e: PageTransitionEvent | Event) => void;\n\nexport class SessionReplay implements AmplitudeSessionReplay {\n name = '@amplitude/session-replay-browser';\n config: SessionReplayJoinedConfig | undefined;\n joinedConfigGenerator: SessionReplayJoinedConfigGenerator | undefined;\n identifiers: ISessionIdentifiers | undefined;\n eventsManager?: AmplitudeSessionReplayEventsManager<'replay' | 'interaction', string>;\n loggerProvider: ILogger;\n recordCancelCallback: ReturnType<RecordFunction> | null = null;\n eventCount = 0;\n eventCompressor: EventCompressor | undefined;\n sessionTargetingMatch = false;\n private lastTargetingParams?: SessionReplayTargetingInput;\n private lastShouldRecordDecision?: boolean;\n // Session for which the one-per-session TRC diagnostic event was already emitted. The\n // diagnostics client caps in-memory events, so per-call signals go through counters and only\n // a single rich snapshot event is recorded per session.\n private trcDiagnosticSessionId: string | number | undefined = undefined;\n\n // Public on purpose. `pageLeaveFns` is iterated by `pageLeaveListener`,\n // `rrwebEventManager` is dereferenced in `asyncSetSessionId` to drop the beacon buffer\n // at a session boundary, and `sessionStartTime` drives `isBelowMinSessionDuration()`.\n // Tests also stub/inspect these — privatizing them would break both production callers\n // and the gate's test coverage.\n pageLeaveFns: PageLeaveFn[] = [];\n sessionStartTime: number | undefined;\n rrwebEventManager: EventsManagerWithBeacon<'replay'> | undefined;\n /**\n * Count of sendEvents() calls suppressed by the min-session-duration gate for the\n * current session. Drives the REPLAY_GATE_DECISION rrweb event on first send-after-pass.\n */\n private suppressedSendCount = 0;\n /** True once REPLAY_GATE_DECISION has been emitted for the current session. */\n private hasEmittedGateDecision = false;\n private scrollHook?: scrollCallback;\n private clickHandler?: ClickHandler;\n private networkObservers?: NetworkObservers;\n private metadata: SessionReplayMetadata | undefined;\n\n // Cache the dynamically imported record function\n private recordFunction: RecordFunction | null = null;\n private recordEventsInFlight = false;\n private pendingEmitEvents: Array<{ event: eventWithTime; sessionId: string | number }> = [];\n\n /** Current page URL, kept in sync with SPA navigations for URL-based masking */\n private currentPageUrl = '';\n\n private recordEventsPendingShouldLogMetadata: boolean | null = null;\n\n /** Cleanup for URL change listener used to re-evaluate targeting on SPA route changes */\n private urlChangeCleanup: (() => void) | null = null;\n // Ensures the url_poll.first_tick diagnostic event is emitted at most once per listener setup\n // (the per-tick counter still increments every tick; only the rich event is one-shot).\n private urlPollFirstTickRecorded = false;\n private crossOriginIframeCoordinator: CrossOriginIframeCoordinator | null = null;\n private crossOriginParentSignalCleanup: (() => void) | null = null;\n /** Monotonic counter to ignore stale URL-change targeting results */\n private latestUrlChangeTargetingEvaluationId = 0;\n\n constructor() {\n this.loggerProvider = new SafeLoggerProvider(new Logger());\n }\n\n init(apiKey: string, options: SessionReplayOptions) {\n return returnWrapper(this._init(apiKey, options));\n }\n\n private teardownEventListeners = (teardown: boolean) => {\n const globalScope = getGlobalScope();\n if (globalScope) {\n globalScope.removeEventListener('blur', this.blurListener);\n globalScope.removeEventListener('focus', this.focusListener);\n !teardown && globalScope.addEventListener('blur', this.blurListener);\n !teardown && globalScope.addEventListener('focus', this.focusListener);\n // prefer pagehide to unload events, this is the standard going forward. it is not\n // 100% reliable, but is bfcache-compatible.\n if (globalScope.self && 'onpagehide' in globalScope.self) {\n globalScope.removeEventListener('pagehide', this.pageLeaveListener);\n !teardown && globalScope.addEventListener('pagehide', this.pageLeaveListener);\n } else {\n // this has performance implications, but is the only way we can reliably send events\n // in browser that don't support pagehide.\n globalScope.removeEventListener('beforeunload', this.pageLeaveListener);\n !teardown && globalScope.addEventListener('beforeunload', this.pageLeaveListener);\n }\n }\n };\n\n /**\n * Subscribes to SPA URL changes via the URL tracking plugin. Always keeps\n * `currentPageUrl` in sync (needed for URL-based masking). When a targeting\n * config is present it also re-evaluates targeting on every navigation.\n */\n private setupUrlChangeListener(): void {\n // If init() runs multiple times, remove the previous URL-change subscription first\n // so we don't leak callbacks and trigger duplicate targeting evaluations.\n this.urlChangeCleanup?.();\n\n const globalScope = getGlobalScope() as Window | undefined;\n if (!globalScope?.location) {\n // No window/location (SSR, worker, or pre-render) — the listener can't attach, so TRC will\n // never re-evaluate on navigation. Surface it rather than failing silently.\n this.incrementDiagnostic(SrDiagnostic.urlListenerSkipped);\n this.recordDiagnosticEvent(SrDiagnostic.urlListenerSkipped, { reason: 'no_global_scope' });\n this.loggerProvider.debug('URL-change listener not attached: no global scope/location.');\n return;\n }\n\n const hasTargeting = !!this.config?.targetingConfig;\n\n const onUrlChange = (href: string): void => {\n this.currentPageUrl = href;\n\n // Team-visible signal that an SPA navigation was detected at all (covers the \"is the SDK\n // even seeing route changes in this framework?\" question — counter + a log with the href\n // and whether it triggered a targeting re-eval).\n this.incrementDiagnostic(SrDiagnostic.urlChange);\n this.recordDiagnosticEvent(SrDiagnostic.urlChangeEvent, {\n href,\n hasTargeting,\n alreadyMatched: this.sessionTargetingMatch,\n });\n\n if (hasTargeting) {\n const evaluationId = ++this.latestUrlChangeTargetingEvaluationId;\n void this.evaluateTargetingAndCapture(\n {\n userProperties: {},\n event: undefined,\n page: { url: href },\n },\n false,\n false,\n true,\n );\n this.loggerProvider.debug(`Queued URL-change targeting re-evaluation #${evaluationId} for ${href}.`);\n }\n };\n // Pass the polling options so targeting re-evaluation also respects `enableUrlChangePolling`.\n // Without this, the targeting listener only sees history.pushState/replaceState + popstate +\n // hashchange — so SPA navigations that bypass the history API never re-evaluate TRC and\n // recording never starts on the new URL (enableUrlChangePolling previously only affected the\n // rrweb URL-tracking plugin, which runs only once recording is already active).\n const enablePolling = this.config?.enableUrlChangePolling ?? false;\n this.urlPollFirstTickRecorded = false;\n const unsubscribe = subscribeToUrlChanges(globalScope, onUrlChange, {\n enablePolling,\n pollingInterval: this.config?.urlChangePollingInterval,\n // Mirror each poll tick to the console (Debug level) so we can confirm polling is firing.\n log: this.loggerProvider.debug.bind(this.loggerProvider),\n // Prove in DataDog that polling actually FIRES (not just that it was scheduled). Per-tick is a\n // cheap aggregated counter; the rich event is emitted once (with href) to avoid flooding the\n // diagnostics endpoint with one capture POST per second.\n onPoll: (href: string, changed: boolean): void => {\n this.incrementDiagnostic(SrDiagnostic.urlPollTick);\n if (!this.urlPollFirstTickRecorded) {\n this.urlPollFirstTickRecorded = true;\n // pollingInterval is already on url_listener.attached, so it's omitted here.\n this.recordDiagnosticEvent(SrDiagnostic.urlPollFirstTick, { href, changed });\n }\n },\n });\n // Confirm the listener is actually live, and under what settings — if recording never starts on\n // navigation, this tells us whether the listener existed and whether polling (the fallback for\n // SPAs that bypass the History API) was on.\n this.recordDiagnosticEvent(SrDiagnostic.urlListenerAttached, {\n hasTargeting,\n enablePolling,\n pollingInterval: this.config?.urlChangePollingInterval,\n });\n this.loggerProvider.debug(`URL-change listener attached (polling: ${String(enablePolling)}).`);\n\n this.urlChangeCleanup = (): void => {\n unsubscribe();\n this.urlChangeCleanup = null;\n };\n }\n\n /**\n * Single source of truth for the min_session_duration_ms gate. Returns true when the\n * current session has not yet reached the configured threshold (and we have both a\n * configured value and a recorded start time). Returns false when there's no\n * threshold, no recorded start time, or the threshold has been met — i.e. it\n * answers \"should this batch be suppressed?\".\n *\n * Centralizing the check means future changes (clock-skew tolerance, switching to\n * performance.now(), etc.) are one-line edits.\n */\n private isBelowMinSessionDuration(): boolean {\n const minSessionDurationMs = this.config?.minSessionDurationMs;\n if (minSessionDurationMs === undefined || this.sessionStartTime === undefined) {\n return false;\n }\n return Date.now() - this.sessionStartTime < minSessionDurationMs;\n }\n\n private getCurrentPageForTargeting(): SessionReplayTargetingInput['page'] {\n const currentUrl = getGlobalScope()?.location?.href;\n return currentUrl != null ? { url: currentUrl } : undefined;\n }\n\n /**\n * Best-effort navigation type from the Navigation Timing API: 'reload' | 'navigate' |\n * 'back_forward' | 'prerender'. Surfaced in the init diagnostic so a page refresh ('reload')\n * is distinguishable from a fresh load ('navigate') — neither changes the session id, so this\n * is the only way to tell them apart. Returns undefined when the API is unavailable.\n */\n private getNavigationType(): string | undefined {\n try {\n const globalScope = getGlobalScope();\n const performance = globalScope && globalScope.performance;\n if (!performance || typeof performance.getEntriesByType !== 'function') {\n return undefined;\n }\n const navEntries = performance.getEntriesByType('navigation') as PerformanceNavigationTiming[];\n return navEntries.length > 0 ? navEntries[0].type : undefined;\n } catch {\n return undefined;\n }\n }\n\n protected async _init(apiKey: string, options: SessionReplayOptions) {\n // Re-init should always tear down any previous URL-change subscription, even when the\n // next config has no targeting config and we don't subscribe again.\n this.urlChangeCleanup?.();\n\n this.loggerProvider = new SafeLoggerProvider(options.loggerProvider || new Logger());\n Object.prototype.hasOwnProperty.call(options, 'logLevel') &&\n this.loggerProvider.enable(options.logLevel as LogLevel);\n this.currentPageUrl = getCurrentUrl();\n this.identifiers = new SessionIdentifiers({ sessionId: options.sessionId, deviceId: options.deviceId });\n // Persist replay start time per sessionId so the min_session_duration_ms gate\n // measures replay duration (survives page reloads within a session) rather than\n // page-load duration. Storage failures fall back to a transient Date.now().\n const now = Date.now();\n pruneStaleReplayStartTimes(apiKey, now, this.loggerProvider);\n this.sessionStartTime =\n options.sessionId !== undefined\n ? getOrInitReplayStartTime(apiKey, options.sessionId, now, this.loggerProvider) ?? now\n : now;\n this.joinedConfigGenerator = await createSessionReplayJoinedConfigGenerator(apiKey, options);\n const { joinedConfig, localConfig, remoteConfig } = await this.joinedConfigGenerator.generateJoinedConfig();\n this.config = joinedConfig;\n\n this.setMetadata(\n options.sessionId,\n joinedConfig,\n localConfig,\n remoteConfig,\n options.version?.version,\n VERSION,\n options.version?.type,\n );\n\n this.pageLeaveFns = [];\n\n if (options.sessionId && this.config.interactionConfig?.enabled) {\n const scrollWatcher = ScrollWatcher.default(\n {\n sessionId: options.sessionId,\n type: 'interaction',\n },\n this.config,\n );\n this.pageLeaveFns = [scrollWatcher.send(this.getDeviceId.bind(this)).bind(scrollWatcher)];\n this.scrollHook = scrollWatcher.hook.bind(scrollWatcher);\n this.clickHandler = new ClickHandler(this.loggerProvider, scrollWatcher);\n }\n\n const managers: EventsManagerWithType<EventType, string>[] = [];\n let { storeType } = this.config;\n if (storeType === 'idb' && !getGlobalScope()?.indexedDB) {\n storeType = 'memory';\n this.loggerProvider.warn('Could not use preferred indexedDB storage, reverting to in memory option.');\n }\n this.loggerProvider.log(`Using ${storeType} for event storage.`);\n let compressionWorkerScript: string | undefined;\n let trackDestinationWorkerScript: string | undefined;\n const globalScope = getGlobalScope();\n if (this.config.useWebWorker && globalScope && globalScope.Worker) {\n const { compressionScript, trackDestinationScript } = await import('./worker');\n compressionWorkerScript = compressionScript;\n trackDestinationWorkerScript = trackDestinationScript;\n }\n\n let rrwebEventManager: EventsManagerWithBeacon<'replay'> | undefined;\n try {\n rrwebEventManager = await createEventsManager<'replay'>({\n config: this.config,\n type: 'replay',\n minInterval: this.config.flushIntervalConfig?.minIntervalMs,\n maxInterval: this.config.flushIntervalConfig?.maxIntervalMs,\n maxPersistedEventsSize: this.config.maxPersistedEventsSizeBytes,\n storeType,\n trackDestinationWorkerScript,\n shouldSend: () => !this.isBelowMinSessionDuration(),\n });\n this.rrwebEventManager = rrwebEventManager;\n managers.push({ name: 'replay', manager: rrwebEventManager });\n } catch (error) {\n const typedError = error as Error;\n this.loggerProvider.warn(`Error occurred while creating replay events manager: ${typedError.toString()}`);\n }\n\n if (this.config.interactionConfig?.enabled) {\n const payloadBatcher = this.config.interactionConfig.batch ? clickBatcher : clickNonBatcher;\n try {\n const interactionEventManager = await createEventsManager<'interaction'>({\n config: this.config,\n type: 'interaction',\n minInterval: this.config.interactionConfig.trackEveryNms ?? INTERACTION_MIN_INTERVAL,\n maxInterval: INTERACTION_MAX_INTERVAL,\n maxPersistedEventsSize: this.config.maxPersistedEventsSizeBytes,\n payloadBatcher,\n storeType,\n trackDestinationWorkerScript,\n });\n managers.push({ name: 'interaction', manager: interactionEventManager });\n } catch (error) {\n const typedError = error as Error;\n this.loggerProvider.warn(`Error occurred while creating interaction events manager: ${typedError.toString()}`);\n }\n }\n\n this.eventsManager = new MultiEventManager<'replay' | 'interaction', string>(...managers);\n // To prevent too many threads.\n if (this.eventCompressor) {\n this.eventCompressor.terminate();\n }\n\n // Eager full-snapshot send is tunable. When `eagerFullSnapshotSend` is true, every full\n // snapshot triggers an immediate flush so replays are playable as early as possible (the\n // SR-3115 contract). Leaving it unset (default) keeps the snapshot compressed and buffered\n // immediately (ordering + beacon coverage on page exit preserved) but defers the network\n // send to the normal interval/size cadence — this avoids the focus/checkout-driven request\n // storm that eager per-snapshot sends create when many SDK instances run on the same page.\n // The default flipped to disabled per the validated amp-on-amp perf config (SR-4646).\n const onFullSnapshotProcessed = this.config.eagerFullSnapshotSend === true ? () => this.sendEvents() : undefined;\n this.eventCompressor = new EventCompressor(\n this.eventsManager,\n this.config,\n this.getDeviceId(),\n compressionWorkerScript,\n onFullSnapshotProcessed,\n );\n\n // Flush any events that arrived while eventCompressor was not yet ready\n // (e.g. a concurrent setSessionId() call that raced _init()'s async setup).\n if (this.pendingEmitEvents.length > 0) {\n const pending = this.pendingEmitEvents.splice(0);\n for (const { event, sessionId } of pending) {\n this.eventCompressor.enqueueEvent(event, sessionId);\n }\n }\n\n // Register beacon fallback for page exit. sendBeacon survives page unload\n // and delivers any incremental events that haven't been flushed via fetch yet.\n //\n // Known cross-session race: if asyncSetSessionId fired and its async\n // storeCurrentSequence hasn't resolved before unload, the beacon buffer can still\n // hold previous-session events. The gate below reads the *new* session's\n // sessionStartTime, so legitimately-sendable old-session events get suppressed.\n // Follow-up: track start time per buffered batch instead of globally.\n this.pageLeaveFns = [\n ...this.pageLeaveFns,\n () => {\n if (!this.config || !this.identifiers?.sessionId || !rrwebEventManager) return;\n const events = rrwebEventManager.getBeaconEvents();\n if (!events.length) return;\n const deviceId = this.getDeviceId();\n if (!deviceId) return;\n if (this.isBelowMinSessionDuration()) return;\n rrwebEventManager.trackDestination.sendBeacon({\n events,\n sessionId: this.identifiers.sessionId,\n deviceId,\n apiKey: this.config.apiKey,\n serverZone: this.config.serverZone,\n });\n },\n ];\n\n await this.initializeNetworkObservers();\n\n // Enable background capture when this page is opened by the Amplitude app\n // (window.opener exists). Uses the shared messenger singleton so that if\n // autocapture is also loaded, both share a single messenger and script load.\n if (getGlobalScope()?.opener) {\n const messenger = getOrCreateWindowMessenger();\n enableBackgroundCapture(messenger);\n messenger.setup({\n logger: this.loggerProvider,\n ...(this.config.serverZone && { endpoint: AMPLITUDE_ORIGINS_MAP[this.config.serverZone] }),\n });\n }\n\n this.loggerProvider.log('Installing @amplitude/session-replay-browser.');\n\n this.teardownEventListeners(false);\n\n // Q1 \"did init happen?\": its presence in DataDog proves init() ran to completion for this\n // session; the props show whether the prerequisites (session/device id, config) were present.\n this.incrementDiagnostic(SrDiagnostic.init);\n this.recordDiagnosticEvent(SrDiagnostic.init, {\n // sessionId is always stamped by recordDiagnosticEvent, so no separate hasSessionId here.\n hasDeviceId: !!this.getDeviceId(),\n captureEnabled: this.config.captureEnabled,\n hasTargetingConfig: !!this.config.targetingConfig,\n sampleRate: this.config.sampleRate,\n optOut: this.shouldOptOut(),\n currentUrl: this.getCurrentPageForTargeting()?.url,\n // 'reload' tells a page refresh apart from a fresh load ('navigate') or back/forward\n // ('back_forward'). New tabs and refreshes keep the same session id, so this is the only\n // way to distinguish a refresh from a brand-new init within a session.\n navigationType: this.getNavigationType(),\n });\n\n await this.evaluateTargetingAndCapture(\n { userProperties: options.userProperties, page: this.getCurrentPageForTargeting() },\n true,\n );\n\n const needsUrlTracking = this.config.targetingConfig || (this.config.privacyConfig?.urlMaskLevels?.length ?? 0) > 0;\n // Record whether we even attempt to wire up the URL-change listener, and the inputs behind that\n // decision. If `needsUrlTracking` is false the listener is never attached, so SPA navigations are\n // invisible to TRC — this is the first thing to check when \"TRC is on but never re-evaluates\".\n this.recordDiagnosticEvent(SrDiagnostic.urlListenerSetup, {\n needsUrlTracking: !!needsUrlTracking,\n hasTargetingConfig: !!this.config.targetingConfig,\n urlMaskLevels: this.config.privacyConfig?.urlMaskLevels?.length ?? 0,\n // config always defaults this to a boolean (see local-config), so no `?? false` needed here.\n enableUrlChangePolling: this.config.enableUrlChangePolling,\n urlChangePollingInterval: this.config.urlChangePollingInterval,\n });\n this.loggerProvider.debug(`URL-change listener needed: ${String(!!needsUrlTracking)}.`);\n if (needsUrlTracking) {\n this.setupUrlChangeListener();\n }\n }\n\n setSessionId(sessionId: string | number, deviceId?: string) {\n return returnWrapper(this.asyncSetSessionId(sessionId, deviceId));\n }\n\n async asyncSetSessionId(\n sessionId: string | number,\n deviceId?: string,\n options?: { userProperties?: { [key: string]: any } },\n ) {\n const previousSessionId = this.identifiers?.sessionId;\n const currentDeviceId = this.getDeviceId();\n // Standalone SDK callers may poll setSessionId with a stable bucket id (e.g. hour-aligned\n // timestamps) and only need a no-op when the bucket hasn't rolled. Without this guard,\n // the rest of asyncSetSessionId still runs: sendEvents, targeting reset, config refetch,\n // and recordEvents (stop + restart rrweb). Proceed when deviceId changes or\n // non-empty userProperties are passed so targeting can re-evaluate on Identify.\n if (\n previousSessionId !== undefined &&\n previousSessionId === sessionId &&\n (deviceId === undefined || deviceId === currentDeviceId) &&\n (options?.userProperties === undefined || Object.keys(options.userProperties).length === 0)\n ) {\n return;\n }\n\n // Invalidate any in-flight URL-change re-evaluations from the previous session.\n this.latestUrlChangeTargetingEvaluationId++;\n this.sessionTargetingMatch = false;\n this.lastShouldRecordDecision = undefined; // Reset targeting decision for new session\n if (previousSessionId) {\n this.sendEvents(previousSessionId);\n }\n\n const isSessionChange = previousSessionId !== sessionId;\n\n // A real session transition (not the first set): recording stops/restarts and targeting is\n // re-evaluated here, so session churn (timeout, multi-tab custom ids, explicit setSessionId)\n // is a prime suspect for \"sometimes records, sometimes not\". recordDiagnosticEvent ships to\n // DataDog AND mirrors to loggerProvider.debug. New tabs / refreshes keep the same id and won't\n // hit this — use the init diagnostic's navigationType for those.\n if (isSessionChange && previousSessionId !== undefined) {\n this.recordDiagnosticEvent(SrDiagnostic.sessionChanged, {\n from: previousSessionId,\n to: sessionId,\n deviceIdChanged: deviceId !== undefined && deviceId !== currentDeviceId,\n });\n }\n\n // Drop any beacon-buffered events from the previous session BEFORE installing the\n // new identifiers / start time. Otherwise the page-leave beacon path could attribute\n // old-session events to the new session id, and the gate (using the new start time)\n // would compute the wrong elapsed duration. Skip on a redundant same-sessionId call —\n // the buffer belongs to the *continuing* session and should ship via beacon as normal.\n if (isSessionChange) {\n this.rrwebEventManager?.dropPendingBeaconEvents();\n }\n\n const deviceIdForReplayId = deviceId || this.getDeviceId();\n this.identifiers = new SessionIdentifiers({\n sessionId: sessionId,\n deviceId: deviceIdForReplayId,\n });\n\n // Gate state and persisted start time only get reset on an actual session boundary.\n // A redundant setSessionId(currentId) call would otherwise overwrite both the in-memory\n // and stored start time with a fresh Date.now() — restarting the gate clock for what is\n // supposed to be a continuing session.\n if (isSessionChange) {\n this.sessionStartTime = Date.now();\n this.suppressedSendCount = 0;\n this.hasEmittedGateDecision = false;\n if (this.config?.apiKey) {\n setReplayStartTime(this.config.apiKey, sessionId, this.sessionStartTime, this.loggerProvider);\n if (previousSessionId !== undefined) {\n removeReplayStartTime(this.config.apiKey, previousSessionId, this.loggerProvider);\n }\n }\n }\n\n // If there is no previous session id, SDK is being initialized for the first time,\n // and config was just fetched in initialization, so no need to fetch it a second time\n if (this.joinedConfigGenerator && previousSessionId) {\n const { joinedConfig } = await this.joinedConfigGenerator.generateJoinedConfig();\n this.config = joinedConfig;\n }\n\n if (this.config?.targetingConfig) {\n await this.evaluateTargetingAndCapture(\n { userProperties: options?.userProperties, page: this.getCurrentPageForTargeting() },\n false,\n true,\n );\n } else {\n await this.recordEvents();\n }\n }\n\n getSessionReplayProperties() {\n const config = this.config;\n const identifiers = this.identifiers;\n if (!config || !identifiers) {\n this.loggerProvider.warn('Session replay init has not been called, cannot get session replay properties.');\n return {};\n }\n\n const shouldRecord = this.getShouldRecord();\n let eventProperties: { [key: string]: string | null } = {};\n\n if (shouldRecord) {\n eventProperties = {\n [DEFAULT_SESSION_REPLAY_PROPERTY]: identifiers.sessionReplayId ? identifiers.sessionReplayId : null,\n };\n if (config.debugMode) {\n eventProperties[SESSION_REPLAY_DEBUG_PROPERTY] = JSON.stringify({\n appHash: generateHashCode(config.apiKey).toString(),\n });\n }\n }\n\n void this.addCustomRRWebEvent(\n CustomRRwebEvent.GET_SR_PROPS,\n {\n shouldRecord,\n eventProperties: eventProperties,\n },\n this.eventCount === 10,\n );\n if (this.eventCount === 10) {\n this.eventCount = 0;\n }\n this.eventCount++;\n\n return eventProperties;\n }\n\n blurListener = () => {\n this.sendEvents();\n };\n\n focusListener = () => {\n if (this.recordCancelCallback && this.recordFunction) {\n // Recording is already active. The on-focus full snapshot is tunable: when\n // `captureFullSnapshotOnFocus` is false we skip it entirely so high focus-churn pages\n // don't generate a full snapshot (and, with eager send, a network request) per focus.\n if (this.config?.captureFullSnapshotOnFocus === false) {\n return;\n }\n try {\n this.recordFunction.takeFullSnapshot(true);\n } catch (error) {\n this.loggerProvider.warn('Failed to take full snapshot on focus:', error);\n }\n } else if (!this.recordEventsInFlight) {\n void this.recordEvents(false);\n }\n };\n\n /**\n * This is an instance member so that if init is called multiple times\n * it doesn't add another listener to the page leave event. This is to\n * prevent duplicate listener actions from firing.\n */\n private pageLeaveListener = (e: PageTransitionEvent | Event) => {\n // Synchronously drain any events still queued in the requestIdleCallback\n // pipeline so they are available to send before the page unloads.\n this.eventCompressor?.flushQueue();\n this.sendEvents();\n this.pageLeaveFns.forEach((fn) => {\n fn(e);\n });\n };\n\n evaluateTargetingAndCapture = async (\n targetingParams: SessionReplayTargetingInput,\n isInit = false,\n forceRestart = false,\n forceTargetingReevaluation = false,\n ) => {\n // What triggered this evaluation (init vs SPA URL change vs analytics event) — shows in\n // DataDog how often re-evaluation actually runs.\n this.incrementDiagnostic(\n SrDiagnostic.evalTrigger(isInit ? 'init' : forceTargetingReevaluation ? 'urlchange' : 'event'),\n );\n\n if (!this.identifiers || !this.identifiers.sessionId || !this.config) {\n // Q4: eval can't run because a prerequisite is missing — record exactly which one.\n this.incrementDiagnostic(SrDiagnostic.evalMissingPrereq);\n this.recordDiagnosticEvent(SrDiagnostic.evalMissingPrereq, {\n hasIdentifiers: !!this.identifiers,\n hasSessionId: !!this.identifiers?.sessionId,\n hasConfig: !!this.config,\n hasDeviceId: !!this.getDeviceId(),\n });\n if (this.identifiers && !this.identifiers.sessionId) {\n this.loggerProvider.log('Session ID has not been set yet, cannot evaluate targeting for Session Replay.');\n } else {\n this.loggerProvider.warn('Session replay init has not been called, cannot evaluate targeting.');\n }\n return;\n }\n\n // Handle cases where there's no targeting config\n if (!this.config.targetingConfig) {\n this.incrementDiagnostic(SrDiagnostic.evalNoConfig);\n if (isInit) {\n this.loggerProvider.log('Targeting config has not been set yet, cannot evaluate targeting.');\n } else {\n this.loggerProvider.log('No targeting config set, skipping initialization/recording for event.');\n return;\n }\n }\n\n // Store targeting parameters for use in getShouldRecord\n this.lastTargetingParams = targetingParams;\n\n // Re-evaluate only until we get the first match in this session.\n // Once matched, keep recording for the rest of the session.\n const targetingConfig = this.config.targetingConfig;\n const shouldReEvaluate = targetingConfig && !this.sessionTargetingMatch;\n if (shouldReEvaluate) {\n // Capture URL-change evaluation id so out-of-order async completions can be discarded.\n const urlChangeEvaluationId = forceTargetingReevaluation ? this.latestUrlChangeTargetingEvaluationId : undefined;\n let eventForTargeting = targetingParams.event;\n if (\n eventForTargeting &&\n Object.values(SpecialEventType).includes(eventForTargeting.event_type as SpecialEventType)\n ) {\n eventForTargeting = undefined;\n }\n\n const pageUrl = targetingParams.page?.url ?? getGlobalScope()?.location?.href ?? '';\n const pageForTargeting = targetingParams.page ?? (pageUrl !== '' ? { url: pageUrl } : undefined);\n\n // Record the targeting trigger event\n this.recordDiagnosticEvent(SrDiagnostic.targetingTrigger, {\n sessionId: this.identifiers.sessionId,\n deviceId: this.getDeviceId(),\n targetingConfig: this.config.targetingConfig,\n targetingParams: {\n userProperties: targetingParams.userProperties,\n event: eventForTargeting,\n page: pageForTargeting,\n },\n });\n\n const evalStart = Date.now();\n const targetingMatch = await evaluateTargetingAndStore({\n sessionId: this.identifiers.sessionId,\n targetingConfig,\n loggerProvider: this.loggerProvider,\n apiKey: this.config.apiKey,\n targetingParams: {\n userProperties: targetingParams.userProperties,\n event: eventForTargeting,\n page: pageForTargeting,\n },\n urlChange: forceTargetingReevaluation,\n diagnosticsClient: this.config.diagnosticsClient,\n deviceId: this.getDeviceId(),\n });\n const evalDurationMs = Date.now() - evalStart;\n const trigger = isInit ? 'init' : forceTargetingReevaluation ? 'urlchange' : 'event';\n // Evaluation latency — surfaces the slow-network residual gap (SR-4234) in DataDog as\n // sdk.diagnostics.sr.trc.eval.duration_ms.{avg,max,...}.\n this.recordDiagnosticHistogram(SrDiagnostic.evalDurationMs, evalDurationMs);\n\n if (\n forceTargetingReevaluation &&\n urlChangeEvaluationId !== undefined &&\n urlChangeEvaluationId !== this.latestUrlChangeTargetingEvaluationId\n ) {\n this.incrementDiagnostic(SrDiagnostic.evalStaleDiscarded);\n this.recordDiagnosticEvent(SrDiagnostic.evalStaleDiscarded, {\n sessionId: this.identifiers.sessionId,\n pageUrl: pageForTargeting?.url,\n evaluationId: urlChangeEvaluationId,\n latestEvaluationId: this.latestUrlChangeTargetingEvaluationId,\n evalDurationMs,\n });\n this.loggerProvider.debug(\n `Ignoring stale URL-change targeting result #${urlChangeEvaluationId}; latest is #${this.latestUrlChangeTargetingEvaluationId}.`,\n );\n return;\n }\n // Per-evaluation outcome (distinct from the per-session sr.gate.* gate counters).\n this.incrementDiagnostic(targetingMatch ? SrDiagnostic.evalMatch : SrDiagnostic.evalNoMatch);\n // Keep targeting match monotonic within a session: once true, always true.\n // This avoids races where an older in-flight evaluation resolves false after\n // a newer evaluation already resolved true.\n this.sessionTargetingMatch = this.sessionTargetingMatch || targetingMatch;\n // Q5: record ALL evaluation params (→ DataDog Logs) so a single evaluation can be fully\n // reconstructed by URL, identifiers, inputs, outcome, trigger and latency. userProperties\n // values are intentionally reduced to keys to avoid logging PII.\n this.recordDiagnosticEvent(SrDiagnostic.evalEvent, {\n // sessionId + deviceId are stamped by recordDiagnosticEvent.\n trigger,\n matched: targetingMatch,\n sessionTargetingMatch: this.sessionTargetingMatch,\n pageUrl: pageForTargeting?.url,\n hasDeviceId: !!this.getDeviceId(),\n hasEvent: !!eventForTargeting,\n eventType: eventForTargeting?.event_type,\n userPropertyKeys: targetingParams.userProperties ? Object.keys(targetingParams.userProperties) : [],\n evalDurationMs,\n });\n\n this.loggerProvider.debug(\n JSON.stringify(\n {\n name: 'targeted replay capture config',\n sessionTargetingMatch: this.sessionTargetingMatch,\n event: eventForTargeting,\n targetingParams: targetingParams,\n },\n null,\n 2,\n ),\n );\n } else if (targetingConfig && this.sessionTargetingMatch) {\n // Already matched earlier this session — recording continues without re-evaluation.\n this.incrementDiagnostic(SrDiagnostic.evalSkippedAlreadyMatched);\n }\n\n if (isInit) {\n void this.initialize(true);\n } else if (forceRestart || !this.recordCancelCallback) {\n this.loggerProvider.log('Recording events for session due to forceRestart or no ongoing recording.');\n await this.recordEvents();\n }\n };\n\n sendEvents(sessionId?: string | number) {\n const sessionIdToSend = sessionId || this.identifiers?.sessionId;\n const deviceId = this.getDeviceId();\n if (this.eventsManager && sessionIdToSend && deviceId) {\n if (this.isBelowMinSessionDuration()) {\n // Safe to dereference: isBelowMinSessionDuration() only returns true when both\n // this.config and this.sessionStartTime are defined.\n const startTime = this.sessionStartTime as number;\n const minMs = (this.config as SessionReplayJoinedConfig).minSessionDurationMs as number;\n this.loggerProvider.log(\n `Session ${sessionIdToSend} not sent: duration ${Date.now() - startTime}ms is below minimum ${minMs}ms.`,\n );\n // We deliberately do NOT clear the beacon buffer here. Blur/visibility-change\n // can call sendEvents() mid-session; if the session later crosses the threshold\n // those buffered events are legitimately sendable via beacon on page exit.\n // Cross-session leak is prevented in asyncSetSessionId, which drops the buffer\n // at the session transition. The page-leave path also gates independently.\n this.suppressedSendCount++;\n // gap #1: recording but events held back by min_session_duration — another \"recording yet\n // no replay in Amplitude\" cause.\n this.incrementDiagnostic(SrDiagnostic.sendSuppressedMinDuration);\n return;\n }\n // On the first send-after-pass for the session, emit a custom rrweb event so the\n // payload itself carries the gate verdict. Lets backend ingestion diff intended\n // vs actual replay counts to spot start-time-tracking regressions.\n //\n // Gate on recording being active too: addCustomRRWebEvent is a no-op when\n // recordCancelCallback/recordFunction aren't set yet (e.g. a blur-listener-fired\n // sendEvents reaches us before _recordEvents() activates on a reloaded long-lived\n // session). Tripping hasEmittedGateDecision unconditionally would lose the signal\n // for that session's first real send.\n if (\n !this.hasEmittedGateDecision &&\n this.config?.minSessionDurationMs !== undefined &&\n this.recordCancelCallback &&\n this.recordFunction\n ) {\n this.hasEmittedGateDecision = true;\n const elapsedMs = this.sessionStartTime !== undefined ? Date.now() - this.sessionStartTime : undefined;\n void this.addCustomRRWebEvent(\n CustomRRwebEvent.REPLAY_GATE_DECISION,\n {\n sessionId: sessionIdToSend,\n suppressedSendCount: this.suppressedSendCount,\n elapsedMs,\n minSessionDurationMs: this.config.minSessionDurationMs,\n },\n false,\n );\n }\n this.eventsManager.sendCurrentSequenceEvents({ sessionId: sessionIdToSend, deviceId });\n }\n }\n\n async initialize(shouldSendStoredEvents = false) {\n if (!this.identifiers?.sessionId) {\n this.loggerProvider.log(`Session is not being recorded due to lack of session id.`);\n return Promise.resolve();\n }\n\n const deviceId = this.getDeviceId();\n if (!deviceId) {\n this.loggerProvider.log(`Session is not being recorded due to lack of device id.`);\n return Promise.resolve();\n }\n this.eventsManager && shouldSendStoredEvents && void this.eventsManager.sendStoredEvents({ deviceId });\n\n return this.recordEvents();\n }\n\n shouldOptOut() {\n let identityStoreOptOut: boolean | undefined;\n if (this.config?.instanceName) {\n const identityStore = getAnalyticsConnector(this.config.instanceName).identityStore;\n identityStoreOptOut = identityStore.getIdentity().optOut;\n }\n\n return identityStoreOptOut !== undefined ? identityStoreOptOut : this.config?.optOut;\n }\n\n /**\n * Increment a diagnostics counter so the team can see the distribution of recording decisions\n * across a customer's sessions (e.g. lots of sr.gate.trc_no_match => rule isn't matching).\n * Ships via the analytics SDK's DiagnosticsClient. No-op when there's no client or diagnostics\n * isn't sampled in; never throws — diagnostics must never interfere with recording.\n */\n private incrementDiagnostic(counter: string) {\n try {\n // Mirror to the console (Debug level) so the full set of diagnostics is visible in the\n // browser, not only in DataDog — helps debugging when a customer can't share a repro env.\n this.loggerProvider.debug(`[SR diagnostics] ${counter}`);\n this.config?.diagnosticsClient?.increment(counter);\n } catch {\n // swallow — diagnostics is best-effort\n }\n }\n\n /**\n * Record a diagnostics histogram value (min/max/avg/count in DataDog). Same best-effort, never-\n * throws contract as incrementDiagnostic. Use for latencies/sizes, not per-call counts.\n */\n private recordDiagnosticHistogram(name: string, value: number) {\n try {\n // Mirror to the console (Debug level) — see incrementDiagnostic.\n this.loggerProvider.debug(`[SR diagnostics] ${name}=${value}`);\n // The only caller runs inside evaluateTargetingAndCapture's `this.config` guard, so the\n // `config == null` arm of this optional chain is unreachable here (kept as defensive parity\n // with recordDiagnosticEvent). The diagnosticsClient-absent arm IS exercised by no-client tests.\n /* istanbul ignore next */\n this.config?.diagnosticsClient?.recordHistogram(name, value);\n } catch {\n // swallow — diagnostics is best-effort\n }\n }\n\n /**\n * Record a diagnostics EVENT with properties. Events are forwarded to DataDog Logs, so the\n * properties become queryable fields (e.g. @matched, @pageUrl). Use sparingly vs counters: the\n * client caps in-memory events (~10 per save interval), so this is for context-rich signals at\n * meaningful decision points, not per-call tallies. Best-effort, never throws.\n */\n private recordDiagnosticEvent(name: string, properties: { [key: string]: unknown }) {\n try {\n const sessionId = this.identifiers?.sessionId;\n const deviceId = this.getDeviceId();\n // Always stamp sessionId, deviceId and srId so every diagnostics event (→ DataDog Logs) can\n // be correlated to a single session/device — and to the actual replay, since the Session\n // Replay ID is `${deviceId}/${sessionId}`. Caller props override if they pass their own.\n const enriched = {\n sessionId,\n deviceId,\n srId: deviceId != null && sessionId != null ? `${deviceId}/${sessionId}` : undefined,\n ...properties,\n };\n // Mirror to the console (Debug level) so the full event + props are visible in the browser,\n // not only in DataDog — see incrementDiagnostic.\n this.loggerProvider.debug(`[SR diagnostics] ${name} ${JSON.stringify(enriched)}`);\n this.config?.diagnosticsClient?.recordEvent(name, enriched);\n // Flush immediately so the event ships now rather than on the client's ~5-min timer (and so\n // short sessions that never reach the timer aren't lost). NOTE: this sends one capture POST\n // per event — higher request volume; revisit/gate before production.\n void this.config?.diagnosticsClient?._flush?.();\n } catch {\n // swallow — diagnostics is best-effort\n }\n }\n\n /**\n * Emit a single rich TRC decision snapshot per session to diagnostics — surfaced even when\n * nothing records (the exact case customers can't reproduce locally).\n */\n private recordTrcDecisionDiagnostic(shouldRecord: boolean) {\n const config = this.config;\n // Every caller is past getShouldRecord's `!this.identifiers`/`!this.config` guard, so both are\n // defined here; the `?.` arms below are unreachable defensive narrowing and excluded from\n // coverage. The reachable guards (no diagnosticsClient, undefined/duplicate sessionId) are tested.\n /* istanbul ignore next */\n if (!config) {\n return;\n }\n /* istanbul ignore next */\n const sessionId = this.identifiers?.sessionId;\n // Once past this guard, config.diagnosticsClient is truthy, so the fields below read config\n // directly rather than re-asserting with `?.` on every access.\n if (!config.diagnosticsClient || sessionId === undefined || sessionId === this.trcDiagnosticSessionId) {\n return;\n }\n this.trcDiagnosticSessionId = sessionId;\n // Goes through recordDiagnosticEvent so it carries sessionId + deviceId like every other event.\n this.recordDiagnosticEvent(SrDiagnostic.decision, {\n shouldRecord,\n captureEnabled: config.captureEnabled,\n hasTargetingConfig: !!config.targetingConfig,\n sessionTargetingMatch: this.sessionTargetingMatch,\n sampleRate: config.sampleRate,\n pageUrl: this.getCurrentPageForTargeting()?.url,\n sdkVersion: VERSION,\n });\n }\n\n getShouldRecord() {\n if (!this.identifiers || !this.config || !this.identifiers.sessionId) {\n this.loggerProvider.warn(`Session is not being recorded due to lack of config, please call sessionReplay.init.`);\n this.incrementDiagnostic(SrDiagnostic.gateNoIdentifiers);\n return false;\n }\n\n if (!this.config.captureEnabled) {\n this.loggerProvider.log(\n `Session ${this.identifiers.sessionId} not being captured due to capture being disabled for project or because the remote config could not be fetched.`,\n );\n this.incrementDiagnostic(SrDiagnostic.gateCaptureDisabled);\n this.recordTrcDecisionDiagnostic(false);\n return false;\n }\n\n if (this.shouldOptOut()) {\n this.loggerProvider.log(`Opting session ${this.identifiers.sessionId} out of recording due to optOut config.`);\n this.incrementDiagnostic(SrDiagnostic.gateOptOut);\n this.recordTrcDecisionDiagnostic(false);\n return false;\n }\n\n let shouldRecord = false;\n let message = '';\n let matched = false;\n\n // If targetingConfig exists, we'll use the sessionTargetingMatch to determine whether to record\n // Otherwise, we'll evaluate the session against the overall sample rate\n if (this.config.targetingConfig) {\n if (!this.sessionTargetingMatch) {\n message = `Not capturing replays for session ${this.identifiers.sessionId} due to not matching targeting conditions.`;\n this.loggerProvider.log(message);\n shouldRecord = false;\n matched = false;\n this.incrementDiagnostic(SrDiagnostic.gateTrcNoMatch);\n } else {\n message = `Capturing replays for session ${this.identifiers.sessionId} due to matching targeting conditions.`;\n this.loggerProvider.log(message);\n shouldRecord = true;\n matched = true;\n this.incrementDiagnostic(SrDiagnostic.gateTrcMatch);\n }\n } else {\n const isInSample = isSessionInSample(this.identifiers.sessionId, this.config.sampleRate);\n if (!isInSample) {\n message = `Opting session ${this.identifiers.sessionId} out of recording due to sample rate.`;\n this.loggerProvider.log(message);\n shouldRecord = false;\n matched = false;\n this.incrementDiagnostic(SrDiagnostic.gateSampleOut);\n } else {\n shouldRecord = true;\n matched = true;\n this.incrementDiagnostic(SrDiagnostic.gateSampleIn);\n }\n }\n\n // Only send custom rrweb event for targeting decision when the decision changes\n if (this.lastShouldRecordDecision !== shouldRecord && this.config.targetingConfig) {\n void this.addCustomRRWebEvent(CustomRRwebEvent.TARGETING_DECISION, {\n message,\n sessionId: this.identifiers.sessionId,\n matched,\n targetingParams: this.lastTargetingParams,\n });\n this.lastShouldRecordDecision = shouldRecord;\n }\n\n this.recordTrcDecisionDiagnostic(shouldRecord);\n\n return shouldRecord;\n }\n\n getBlockSelectors(): string | string[] | undefined {\n // For some reason, this defaults to empty array ([]) if undefined in the compiled script.\n // Empty arrays cause errors when being evaluated in Safari.\n // Force the selector to be undefined if it's an empty array.\n const blockSelector = this.config?.privacyConfig?.blockSelector ?? [];\n if (blockSelector.length === 0) {\n return undefined;\n }\n return blockSelector;\n }\n\n getMaskTextSelectors(): string | undefined {\n const privacyConfig = this.config?.privacyConfig;\n const effectiveLevel = privacyConfig ? getEffectiveMaskLevel(this.currentPageUrl, privacyConfig) : undefined;\n\n if (effectiveLevel === 'conservative') {\n return '*';\n }\n\n // If any urlMaskLevels rule uses 'conservative', always route all text nodes\n // through maskTextFn so the dynamic URL getter can decide at call time.\n // Without this, rrweb's static maskTextSelector would miss text nodes when\n // the user navigates from a non-conservative page to a conservative one.\n if (privacyConfig?.urlMaskLevels?.some((rule) => rule.maskLevel === 'conservative')) {\n return '*';\n }\n\n // If defaultMaskLevel is 'conservative' and URL rules exist, always route text through\n // maskTextFn — a page matching no rule falls back to the conservative default, and\n // rrweb must be set up at start to call maskTextFn for those text nodes.\n const urlMaskLevels = privacyConfig?.urlMaskLevels;\n if (privacyConfig?.defaultMaskLevel === 'conservative' && urlMaskLevels && urlMaskLevels.length > 0) {\n return '*';\n }\n\n const maskSelector = privacyConfig?.maskSelector;\n if (!maskSelector) {\n return;\n }\n\n return maskSelector as unknown as string;\n }\n\n async getRecordingPlugins(loggingConfig: LoggingConfig | undefined) {\n const plugins = [];\n\n // Add URL tracking plugin\n try {\n const urlTrackingPlugin = createUrlTrackingPlugin({\n ugcFilterRules: this.config?.interactionConfig?.ugcFilterRules || [],\n enablePolling: this.config?.enableUrlChangePolling || false,\n pollingInterval: this.config?.urlChangePollingInterval,\n captureDocumentTitle: this.config?.captureDocumentTitle,\n });\n\n plugins.push(urlTrackingPlugin);\n } catch (error) {\n this.loggerProvider.warn('Failed to create URL tracking plugin:', error);\n }\n\n // Default plugin settings -\n // {\n // level: ['info', 'log', 'warn', 'error'],\n // lengthThreshold: 10000,\n // stringifyOptions: {\n // stringLengthLimit: undefined,\n // numOfKeysLimit: 50,\n // depthOfLimit: 4,\n // },\n // logger: window.console,\n // }\n if (loggingConfig?.console?.enabled) {\n try {\n // Dynamic import keeps console plugin separate and only loads when needed\n const { getRecordConsolePlugin } = await import('@amplitude/rrweb-plugin-console-record');\n plugins.push(getRecordConsolePlugin({ level: loggingConfig.console.levels }));\n } catch (error) {\n this.loggerProvider.warn('Failed to load console plugin:', error);\n }\n }\n\n return plugins.length > 0 ? plugins : undefined;\n }\n\n private async getRecordFunction(): Promise<RecordFunction | null> {\n if (this.recordFunction) {\n return this.recordFunction;\n }\n\n try {\n const { record } = await import('@amplitude/rrweb-record');\n this.recordFunction = record;\n return record;\n } catch (error) {\n this.loggerProvider.warn('Failed to load rrweb-record module:', error);\n return null;\n }\n }\n\n async recordEvents(shouldLogMetadata = true) {\n if (this.recordEventsInFlight) {\n this.recordEventsPendingShouldLogMetadata = shouldLogMetadata;\n return;\n }\n this.recordEventsInFlight = true;\n try {\n await this._recordEvents(shouldLogMetadata);\n while (this.recordEventsPendingShouldLogMetadata !== null) {\n const pendingArgs = this.recordEventsPendingShouldLogMetadata;\n this.recordEventsPendingShouldLogMetadata = null;\n await this._recordEvents(pendingArgs);\n }\n } finally {\n this.recordEventsInFlight = false;\n this.recordEventsPendingShouldLogMetadata = null;\n }\n }\n\n private async _recordEvents(shouldLogMetadata = true) {\n const config = this.config;\n const shouldRecord = this.getShouldRecord();\n const sessionId = this.identifiers?.sessionId;\n if (!shouldRecord || !sessionId || !config) {\n return;\n }\n this.stopRecordingEvents();\n\n const recordFunction = await this.getRecordFunction();\n\n // May be undefined if cannot import rrweb-record\n if (!recordFunction) {\n // gap #1: gate said record, but rrweb couldn't load → no replay despite shouldRecord=true.\n this.incrementDiagnostic(SrDiagnostic.recordNoRecordFn);\n this.recordDiagnosticEvent(SrDiagnostic.recordNoRecordFn, {});\n return;\n }\n\n await this.initializeNetworkObservers();\n\n const networkLoggingConfig = config.loggingConfig?.network;\n const trackUrl = getServerUrl(config.serverZone, config.trackServerUrl);\n const ignoredUrls = [SESSION_REPLAY_SERVER_URL, SESSION_REPLAY_EU_URL, SESSION_REPLAY_STAGING_URL, trackUrl];\n this.networkObservers?.start((event: NetworkRequestEvent) => {\n if (ignoredUrls.some((url) => event.url.startsWith(url))) return;\n void this.addCustomRRWebEvent(CustomRRwebEvent.FETCH_REQUEST, event);\n }, networkLoggingConfig);\n const { interactionConfig, loggingConfig } = config;\n\n const hooks = interactionConfig?.enabled\n ? {\n mouseInteraction:\n this.eventsManager &&\n this.clickHandler?.createHook({\n eventsManager: this.eventsManager,\n sessionId,\n deviceIdFn: this.getDeviceId.bind(this),\n mirror: recordFunction.mirror,\n ugcFilterRules: interactionConfig.ugcFilterRules ?? [],\n performanceOptions: config.performanceConfig?.interaction,\n }),\n scroll: this.scrollHook,\n }\n : {};\n\n const ugcFilterRules =\n interactionConfig?.enabled && interactionConfig.ugcFilterRules ? interactionConfig.ugcFilterRules : [];\n\n this.loggerProvider.log(`Session Replay capture beginning for ${sessionId}.`);\n // gap #1: rrweb is actually starting. Closes the \"gate said yes but no replay\" blind spot,\n // and its srId is the id the replay uploads under (compare with analytics events to catch the\n // device-id mismatch that breaks stitching).\n this.incrementDiagnostic(SrDiagnostic.recordStarted);\n this.recordDiagnosticEvent(SrDiagnostic.recordStarted, {});\n\n try {\n const crossOriginIframesEnabled = !!config.crossOriginIframes?.enabled;\n const coordinateChildren = config.crossOriginIframes?.coordinateChildren !== false;\n const childMode = crossOriginIframesEnabled && isInIframe();\n\n if (childMode && coordinateChildren) {\n // Child mode: don't self-start; wait for a start signal from the parent.\n // (The previous listener, if any, was already removed by stopRecordingEvents above.)\n this.crossOriginParentSignalCleanup = listenForParentSignals({\n onStart: () => this._recordEventsInChildMode(recordFunction, sessionId, config, hooks),\n onStop: () => {\n try {\n // Only cancel the rrweb recording — do NOT call stopRecordingEvents() here,\n // which would clear crossOriginParentSignalCleanup and make the child deaf\n // to subsequent start/stop cycles from the parent.\n this.recordCancelCallback && this.recordCancelCallback();\n this.recordCancelCallback = null;\n } catch (error) {\n const typedError = error as Error;\n this.loggerProvider.warn(\n `Error occurred while stopping child iframe replay capture: ${typedError.toString()}`,\n );\n }\n },\n });\n return;\n }\n\n this.recordCancelCallback = recordFunction({\n ...this.buildRRWebRecordOptions(\n config,\n hooks,\n (event: eventWithTime) => {\n if (this.shouldOptOut()) {\n this.loggerProvider.log(`Opting session ${sessionId} out of recording due to optOut config.`);\n this.stopRecordingEvents();\n this.sendEvents();\n return;\n }\n\n if (event.type === RRWebEventType.Meta) {\n event.data.href = getPageUrl(event.data.href, ugcFilterRules);\n }\n\n if (this.eventCompressor) {\n // Schedule processing during idle time if the browser supports requestIdleCallback\n this.eventCompressor.enqueueEvent(event, sessionId);\n } else {\n // eventCompressor is not yet ready (concurrent call racing _init()).\n // Buffer the event so it can be flushed once the compressor is initialized.\n this.pendingEmitEvents.push({ event, sessionId });\n }\n },\n 'Error while capturing replay: ',\n ),\n plugins: await this.getRecordingPlugins(loggingConfig),\n recordCrossOriginIframes: crossOriginIframesEnabled,\n });\n\n if (crossOriginIframesEnabled && !childMode && coordinateChildren) {\n if (!this.crossOriginIframeCoordinator) {\n this.crossOriginIframeCoordinator = new CrossOriginIframeCoordinator();\n }\n this.crossOriginIframeCoordinator.start();\n }\n\n void this.addCustomRRWebEvent(CustomRRwebEvent.DEBUG_INFO);\n if (shouldLogMetadata) {\n void this.addCustomRRWebEvent(CustomRRwebEvent.METADATA, this.metadata);\n }\n } catch (error) {\n this.loggerProvider.warn('Failed to initialize session replay:', error);\n }\n }\n\n private buildRRWebRecordOptions(\n config: SessionReplayJoinedConfig,\n hooks: { mouseInteraction?: any; scroll?: scrollCallback },\n emit: (event: eventWithTime) => void,\n errorLogPrefix: string,\n ): Parameters<RecordFunction>[0] {\n const { privacyConfig } = config;\n return {\n emit,\n inlineStylesheet: config.shouldInlineStylesheet,\n hooks,\n maskAllInputs: true,\n maskTextClass: MASK_TEXT_CLASS,\n blockClass: BLOCK_CLASS,\n blockSelector: this.getBlockSelectors() as string | undefined,\n applyBackgroundColorToBlockedElements: config.applyBackgroundColorToBlockedElements,\n maskInputFn: maskFn('input', privacyConfig, () => this.currentPageUrl),\n maskTextFn: maskFn('text', privacyConfig, () => this.currentPageUrl),\n maskAttributeFn: maskAttributeFn(privacyConfig, () => this.currentPageUrl),\n maskTextSelector: this.getMaskTextSelectors(),\n ...(config.fullSnapshotIntervalMs !== undefined && { checkoutEveryNms: config.fullSnapshotIntervalMs }),\n recordCanvas: false,\n captureAdoptedStyleSheets: config.captureAdoptedStyleSheets,\n // Strip nodes that are never rendered by the rrweb replay player.\n // None of these affect visual fidelity; omitting them reduces snapshot size.\n slimDOMOptions: {\n script: true,\n comment: true,\n headFavicon: true,\n headWhitespace: true,\n headMetaDescKeywords: true,\n headMetaSocial: true,\n headMetaRobots: true,\n headMetaHttpEquiv: true,\n headMetaAuthorship: true,\n headMetaVerification: true,\n },\n errorHandler: (error: unknown) => {\n const typedError = error as Error & { _external_?: boolean };\n // styled-components relies on this error being thrown and bubbled up, rrweb is otherwise suppressing it\n if (typedError.message.includes('insertRule') && typedError.message.includes('CSSStyleSheet')) {\n throw typedError;\n }\n // rrweb monkey-patches window functions like CSSStyleSheet.insertRule; errors from external callers\n // (e.g. styled-components) must be re-thrown so they aren't silently swallowed.\n if (typedError._external_) {\n throw typedError;\n }\n this.loggerProvider.warn(errorLogPrefix, typedError.toString());\n // Return true so that we don't clutter user's consoles with internal rrweb errors\n return true;\n },\n };\n }\n\n private _recordEventsInChildMode(\n recordFunction: RecordFunction,\n sessionId: string | number,\n config: SessionReplayJoinedConfig,\n hooks: { mouseInteraction?: any; scroll?: scrollCallback },\n ) {\n // In child mode, rrweb detects window.parent !== window and routes events via\n // postMessage to the parent instead of calling emit. The emit callback is unused.\n // Note: recording plugins (URL tracking, console capture) are intentionally omitted\n // here — the child's events are merged into the parent stream, so URL changes inside\n // the iframe should not be recorded as parent page-view events.\n try {\n // Stop only the previous rrweb recording. Do NOT call stopRecordingEvents() here:\n // that would clear crossOriginParentSignalCleanup — the very listener that invoked\n // this method — making the child permanently deaf to subsequent stop/start cycles.\n this.recordCancelCallback && this.recordCancelCallback();\n this.recordCancelCallback = null;\n this.recordCancelCallback = recordFunction({\n ...this.buildRRWebRecordOptions(\n config,\n hooks,\n () => {\n // no-op: child events are forwarded to parent via postMessage by rrweb\n },\n 'Error while capturing replay (child iframe): ',\n ),\n recordCrossOriginIframes: true, // child mode is only entered when crossOriginIframes.enabled is true\n });\n this.loggerProvider.log(`Session Replay child iframe capture beginning for session ${sessionId}.`);\n } catch (error) {\n this.loggerProvider.warn('Failed to initialize session replay in child iframe mode:', error);\n }\n }\n\n addCustomRRWebEvent = async (\n eventName: CustomRRwebEvent,\n eventData: { [key: string]: any } = {},\n addStorageInfo = true,\n ) => {\n try {\n let debugInfo: DebugInfo | undefined = undefined;\n const config = this.config;\n // Only add debug info for non-metadata events\n if (config && eventName !== CustomRRwebEvent.METADATA) {\n debugInfo = {\n config: getDebugConfig(config),\n version: VERSION,\n };\n if (addStorageInfo) {\n const storageSizeData = await getStorageSize();\n debugInfo = {\n ...storageSizeData,\n ...debugInfo,\n };\n }\n }\n // Check first to ensure we are recording\n if (this.recordCancelCallback && this.recordFunction) {\n this.recordFunction.addCustomEvent(eventName, {\n ...eventData,\n ...debugInfo,\n });\n } else {\n this.loggerProvider.debug(\n `Not able to add custom replay capture event ${eventName} due to no ongoing recording.`,\n );\n }\n } catch (e) {\n this.loggerProvider.debug('Error while adding custom replay capture event: ', e);\n }\n };\n\n stopRecordingEvents = () => {\n try {\n this.loggerProvider.log('Session Replay capture stopping.');\n this.recordCancelCallback && this.recordCancelCallback();\n this.recordCancelCallback = null;\n this.networkObservers?.stop();\n this.crossOriginIframeCoordinator?.stop();\n this.crossOriginIframeCoordinator = null;\n // Remove the child-mode parent signal listener so a later mode change\n // (e.g. crossOriginIframes disabled) does not leave a stale listener.\n this.crossOriginParentSignalCleanup?.();\n this.crossOriginParentSignalCleanup = null;\n } catch (error) {\n const typedError = error as Error;\n this.loggerProvider.warn(`Error occurred while stopping replay capture: ${typedError.toString()}`);\n }\n };\n\n getDeviceId() {\n return this.identifiers?.deviceId;\n }\n\n getSessionId() {\n return this.identifiers?.sessionId;\n }\n\n async flush(useRetry = false) {\n // Intentionally not gated on min_session_duration_ms. flush() forwards payloads\n // already queued in trackDestination, and every code path that queues into it —\n // sendCurrentSequenceEvents, addEvent's batch-split path, sendStoredEvents reading\n // sequencesToSend from IDB — has already passed the gate at the time of queuing.\n // A duplicate gate here would be unreachable.\n return this.eventsManager?.flush(useRetry);\n }\n\n shutdown() {\n this.urlChangeCleanup?.();\n this.crossOriginParentSignalCleanup?.();\n this.crossOriginParentSignalCleanup = null;\n this.teardownEventListeners(true);\n this.stopRecordingEvents();\n this.sendEvents();\n }\n\n private mapSDKType(sdkType: string | undefined) {\n if (sdkType === 'plugin') {\n return '@amplitude/plugin-session-replay-browser';\n }\n\n if (sdkType === 'segment') {\n return '@amplitude/segment-session-replay-plugin';\n }\n\n return null;\n }\n\n private setMetadata(\n sessionId: string | number | undefined,\n joinedConfig: SessionReplayJoinedConfig,\n localConfig: SessionReplayLocalConfig,\n remoteConfig: SessionReplayRemoteConfig | undefined,\n replaySDKVersion: string | undefined,\n standaloneSDKVersion: string | undefined,\n sdkType: string | undefined,\n ) {\n const hashValue = sessionId?.toString() ? generateHashCode(sessionId.toString()) : undefined;\n\n this.metadata = {\n joinedConfig,\n localConfig,\n remoteConfig,\n sessionId,\n hashValue,\n sampleRate: joinedConfig.sampleRate,\n replaySDKType: this.mapSDKType(sdkType),\n replaySDKVersion,\n standaloneSDKType: '@amplitude/session-replay-browser',\n standaloneSDKVersion,\n };\n }\n\n private async initializeNetworkObservers(): Promise<void> {\n if (this.config?.loggingConfig?.network?.enabled && !this.networkObservers) {\n try {\n const { NetworkObservers: NetworkObserversClass } = await import('./observers');\n this.networkObservers = new NetworkObserversClass();\n } catch (error) {\n this.loggerProvider.warn('Failed to import or instantiate NetworkObservers:', error);\n }\n }\n }\n}\n"]}
|
package/lib/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.47.0-sr-trc-debug-log.
|
|
1
|
+
export declare const VERSION = "1.47.0-sr-trc-debug-log.3";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/esm/version.js
CHANGED
package/lib/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,CAAC,IAAM,OAAO,GAAG,2BAA2B,CAAC","sourcesContent":["// Autogenerated by `pnpm version-file`. DO NOT EDIT\nexport const VERSION = '1.47.0-sr-trc-debug-log.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,CAAC,IAAM,OAAO,GAAG,2BAA2B,CAAC","sourcesContent":["// Autogenerated by `pnpm version-file`. DO NOT EDIT\nexport const VERSION = '1.47.0-sr-trc-debug-log.3';\n"]}
|