@amplitude/plugin-session-replay-browser 1.34.0 → 1.35.1-video-analytics-2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/cjs/session-replay.d.ts.map +1 -1
- package/lib/cjs/session-replay.js +1 -0
- package/lib/cjs/session-replay.js.map +1 -1
- package/lib/cjs/typings/session-replay.d.ts +4 -0
- package/lib/cjs/typings/session-replay.d.ts.map +1 -1
- package/lib/cjs/typings/session-replay.js.map +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.d.ts.map +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/esm/session-replay.d.ts.map +1 -1
- package/lib/esm/session-replay.js +1 -0
- package/lib/esm/session-replay.js.map +1 -1
- package/lib/esm/typings/session-replay.d.ts +4 -0
- package/lib/esm/typings/session-replay.d.ts.map +1 -1
- package/lib/esm/typings/session-replay.js.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.d.ts.map +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/plugin-session-replay-browser-min.js +1 -1
- package/lib/scripts/plugin-session-replay-browser-min.js.gz +0 -0
- package/lib/scripts/plugin-session-replay-browser-min.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -60,6 +60,7 @@ const sessionReplayTracking = sessionReplayPlugin({
|
|
|
60
60
|
|`configServerUrl`|`string`|No|`undefined`|Specifies the endpoint URL to fetch remote configuration. If provided, it overrides the default server zone configuration.|
|
|
61
61
|
|`trackServerUrl`|`string`|No|`undefined`|Specifies the endpoint URL for sending session replay data. If provided, it overrides the default server zone configuration.|
|
|
62
62
|
|`shouldInlineStylesheet`|`boolean`|No|`true`|If stylesheets are inlined, the contents of the stylesheet will be stored. During replay, the stored stylesheet will be used instead of attempting to fetch it remotely. This prevents replays from appearing broken due to missing stylesheets. Note: Inlining stylesheets may not work in all cases. If this is `undefined` stylesheets will be inlined.|
|
|
63
|
+
|`inlineImages`|`boolean`|No|`false`|When true, image sources are inlined as data URLs in the rrweb snapshot so replays do not depend on fetching remote image assets at playback time. Increases snapshot payload size. Passed through to rrweb's `inlineImages` record option.|
|
|
63
64
|
|`storeType`|`string`|No|`idb`|Specifies how replay events should be stored. `idb` uses IndexedDB to persist replay events when all events cannot be sent during capture. `memory` stores replay events only in memory, meaning events are lost when the page is closed. If IndexedDB is unavailable, the system falls back to `memory`.|
|
|
64
65
|
|`performanceConfig.enabled`|`boolean`|No|`true`|If enabled, event compression will be deferred to occur during the browser's idle periods.|
|
|
65
66
|
|`performanceConfig.timeout`|`number`|No|`undefined`|Optional timeout in milliseconds for the `requestIdleCallback` API. If specified, this value will be used to set a maximum time for the browser to wait before executing the deferred compression task, even if the browser is not idle.|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,KAAK,EAIN,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAUL,sBAAsB,EACtB,oBAAoB,IAAI,2BAA2B,EACpD,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,eAAO,MAAM,6BAA6B,gBAAgB,CAAC;AAC3D,eAAO,MAAM,+BAA+B,QAAuD,CAAC;AACpG,qBAAa,mBAAoB,YAAW,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC;IACxF,MAAM,CAAC,UAAU,SAA8C;IAC/D,IAAI,SAAkC;IACtC,IAAI,eAAyB;IAI7B,MAAM,EAAE,aAAa,GAAG,IAAI,CAAQ;IACpC,OAAO,EAAE,oBA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GL;AAED,eAAO,MAAM,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE,oBAAoB,KAAK,mBAIrE,CAAC"}
|
|
@@ -78,6 +78,7 @@ var SessionReplayPlugin = /** @class */ (function () {
|
|
|
78
78
|
},
|
|
79
79
|
debugMode: this.options.debugMode,
|
|
80
80
|
shouldInlineStylesheet: this.options.shouldInlineStylesheet,
|
|
81
|
+
inlineImages: this.options.inlineImages,
|
|
81
82
|
version: { type: 'plugin', version: version_1.VERSION },
|
|
82
83
|
performanceConfig: this.options.performanceConfig,
|
|
83
84
|
storeType: this.options.storeType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":";;;;AAAA,4DAQmC;AACnC,4EAY2C;AAC3C,qCAAgD;AAEhD,qCAAoC;AAEvB,QAAA,6BAA6B,GAAG,aAAa,CAAC;AAC9C,QAAA,+BAA+B,GAAG,UAAG,qCAA6B,uBAAoB,CAAC;AACpG;IAsBE,6BAAY,OAA8B;QApB1C,SAAI,GAAG,mBAAmB,CAAC,UAAU,CAAC;QACtC,SAAI,GAAG,YAAqB,CAAC;QAC7B,sEAAsE;QACtE,6DAA6D;QAC7D,aAAa;QACb,WAAM,GAAyB,IAAI,CAAC;QAGpC,kBAAa,GAA2B;YACtC,KAAK,EAAE,8BAAK;YACZ,YAAY,EAAE,qCAAY;YAC1B,0BAA0B,EAAE,mDAA0B;YACtD,IAAI,EAAE,6BAAI;YACV,YAAY,EAAE,qCAAY;YAC1B,KAAK,EAAE,8BAAK;YACZ,IAAI,EAAE,6BAAI;YACV,QAAQ,EAAE,iCAAQ;YAClB,2BAA2B,EAAE,oDAA2B;SACzD,CAAC;QAGA,IAAI,CAAC,OAAO,sBAAK,oBAAoB,EAAE,KAAK,IAAK,OAAO,CAAE,CAAC;QAC3D,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC;IACpC,CAAC;IAEK,mCAA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E,CAAC,CAAC;wBAC/G,sBAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAC;;;;;KAEjC;IAEK,sCAAQ,GAAd;;;;gBACE,IAAI;oBACF,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;oBAC9B,6EAA6E;oBAC7E,qDAAqD;oBACrD,6DAA6D;oBAC7D,aAAa;oBACb,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;iBACpB;gBAAC,OAAO,KAAK,EAAE;oBACd,0BAA0B;oBAC1B,MAAA,IAAI,CAAC,MAAM,0CAAE,cAAc,CAAC,KAAK,CAAC,iDAA2C,KAAe,CAAC,OAAO,CAAE,CAAC,CAAC;iBACzG;;;;KACF;IAED,wDAA0B,GAA1B;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,0BAA0B,EAAE,CAAC;IACzD,CAAC;IAED;;;OAGG;IACG,mCAAK,GAAX;;;;4BACE,qBAAM,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,OAAO,EAAA;;wBAAxC,SAAwC,CAAC;;;;;KAC1C;IAED;;;OAGG;IACH,kCAAI,GAAJ;QACE,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IAC5B,CAAC;IAvNM,8BAAU,GAAG,0CAA0C,CAAC;IAwNjE,0BAAC;CAAA,AAzND,IAyNC;AAzNY,kDAAmB;AA2NzB,IAAM,mBAAmB,GAA4D,UAC1F,OAA8B;IAE9B,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B","sourcesContent":["import {\n BrowserClient,\n BrowserConfig,\n EnrichmentPlugin,\n Event,\n SpecialEventType,\n getGlobalScope,\n getAnalyticsConnector,\n} from '@amplitude/analytics-core';\nimport {\n init,\n setSessionId,\n getSessionId,\n getSessionReplayProperties,\n flush,\n start,\n stop,\n shutdown,\n evaluateTargetingAndCapture,\n AmplitudeSessionReplay,\n SessionReplayOptions as SessionReplayBrowserOptions,\n} from '@amplitude/session-replay-browser';\nimport { parseUserProperties } from './helpers';\nimport { SessionReplayOptions } from './typings/session-replay';\nimport { VERSION } from './version';\n\nexport const DEFAULT_EVENT_PROPERTY_PREFIX = '[Amplitude]';\nexport const DEFAULT_SESSION_REPLAY_PROPERTY = `${DEFAULT_EVENT_PROPERTY_PREFIX} Session Replay ID`;\nexport class SessionReplayPlugin implements EnrichmentPlugin<BrowserClient, BrowserConfig> {\n static pluginName = '@amplitude/plugin-session-replay-browser';\n name = SessionReplayPlugin.pluginName;\n type = 'enrichment' as const;\n // this.config is defined in setup() which will always be called first\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: BrowserConfig | null = null;\n options: SessionReplayOptions;\n srInitOptions: SessionReplayBrowserOptions;\n sessionReplay: AmplitudeSessionReplay = {\n flush: flush,\n getSessionId: getSessionId,\n getSessionReplayProperties: getSessionReplayProperties,\n init: init,\n setSessionId: setSessionId,\n start: start,\n stop: stop,\n shutdown: shutdown,\n evaluateTargetingAndCapture: evaluateTargetingAndCapture,\n };\n\n constructor(options?: SessionReplayOptions) {\n this.options = { forceSessionTracking: false, ...options };\n this.srInitOptions = this.options;\n }\n\n async setup(config: BrowserConfig, _client: BrowserClient) {\n try {\n /* istanbul ignore next */\n config?.loggerProvider.log(`Installing @amplitude/plugin-session-replay, version ${VERSION}.`);\n\n this.config = config;\n\n if (this.options.forceSessionTracking) {\n if (typeof config.defaultTracking === 'boolean') {\n if (config.defaultTracking === false) {\n config.defaultTracking = {\n pageViews: false,\n formInteractions: false,\n fileDownloads: false,\n sessions: true,\n };\n }\n } else {\n config.defaultTracking = {\n ...config.defaultTracking,\n sessions: true,\n };\n }\n }\n const identityStore = getAnalyticsConnector(this.config.instanceName).identityStore;\n const userProperties = identityStore.getIdentity().userProperties;\n\n this.srInitOptions = {\n instanceName: this.config.instanceName,\n deviceId: this.options.deviceId ?? this.config.deviceId,\n optOut: this.config.optOut,\n sessionId: this.options.customSessionId ? undefined : this.config.sessionId,\n loggerProvider: this.config.loggerProvider,\n logLevel: this.config.logLevel,\n flushMaxRetries: this.config.flushMaxRetries,\n serverZone: this.config.serverZone,\n configServerUrl: this.options.configServerUrl || this.config.remoteConfig?.serverUrl,\n trackServerUrl: this.options.trackServerUrl,\n sampleRate: this.options.sampleRate,\n privacyConfig: {\n blockSelector: this.options.privacyConfig?.blockSelector,\n maskSelector: this.options.privacyConfig?.maskSelector,\n unmaskSelector: this.options.privacyConfig?.unmaskSelector,\n defaultMaskLevel: this.options.privacyConfig?.defaultMaskLevel,\n },\n debugMode: this.options.debugMode,\n shouldInlineStylesheet: this.options.shouldInlineStylesheet,\n version: { type: 'plugin', version: VERSION },\n performanceConfig: this.options.performanceConfig,\n storeType: this.options.storeType,\n useWebWorker: this.options.useWebWorker ?? this.options.experimental?.useWebWorker,\n userProperties: userProperties,\n applyBackgroundColorToBlockedElements: this.options.applyBackgroundColorToBlockedElements,\n interactionConfig: this.options.interactionConfig,\n captureDocumentTitle: this.options.captureDocumentTitle,\n enableUrlChangePolling: this.options.enableUrlChangePolling,\n urlChangePollingInterval: this.options.urlChangePollingInterval,\n captureAdoptedStyleSheets: this.options.captureAdoptedStyleSheets,\n crossOriginIframes: this.options.crossOriginIframes,\n flushIntervalConfig: this.options.flushIntervalConfig,\n eagerFullSnapshotSend: this.options.eagerFullSnapshotSend,\n captureFullSnapshotOnFocus: this.options.captureFullSnapshotOnFocus,\n maxPersistedEventsSizeBytes: this.options.maxPersistedEventsSizeBytes,\n maxSingleEventSizeBytes: this.options.maxSingleEventSizeBytes,\n sendTimeoutMs: this.options.sendTimeoutMs,\n handleSendEvents: this.options.handleSendEvents,\n handleFetchConfig: this.options.handleFetchConfig,\n };\n\n await this.sessionReplay.init(config.apiKey, this.srInitOptions).promise;\n } catch (error) {\n /* istanbul ignore next */\n config?.loggerProvider.error(`Session Replay: Failed to initialize due to ${(error as Error).message}`);\n }\n }\n\n async onSessionIdChanged(sessionId: number): Promise<void> {\n this.config?.loggerProvider.debug(\n `Analytics session id is changed to ${sessionId}, SR session id is ${String(this.sessionReplay.getSessionId())}.`,\n );\n await this.sessionReplay.setSessionId(sessionId).promise;\n }\n\n async onOptOutChanged(optOut: boolean): Promise<void> {\n this.config?.loggerProvider.debug(\n `optOut is changed to ${String(optOut)}, calling ${\n optOut ? 'sessionReplay.shutdown()' : 'sessionReplay.init()'\n }.`,\n );\n // TODO: compare optOut with this.sessionReplay.getOptOut().\n // Need to add getOptOut() to the interface AmplitudeSessionReplay first.\n if (optOut) {\n this.sessionReplay.shutdown();\n } else {\n this.config != null && (await this.sessionReplay.init(this.config.apiKey, this.srInitOptions).promise);\n }\n }\n\n async execute(event: Event) {\n try {\n if (this.options.customSessionId) {\n const sessionId = this.options.customSessionId(event);\n if (sessionId) {\n // On event, synchronize the session id to the custom session id from the event. This may\n // suffer from offline/delayed events messing up the state stored\n if (sessionId !== this.sessionReplay.getSessionId()) {\n await this.sessionReplay.setSessionId(sessionId).promise;\n }\n\n const sessionRecordingProperties = this.sessionReplay.getSessionReplayProperties();\n event.event_properties = {\n ...event.event_properties,\n ...sessionRecordingProperties,\n };\n }\n } else {\n // On event, synchronize the session id to the what's on the browserConfig (source of truth)\n // Choosing not to read from event object here, concerned about offline/delayed events messing up the state stored\n // in SR.\n const sessionId: string | number | undefined = this.config?.sessionId;\n if (sessionId && sessionId !== this.sessionReplay.getSessionId()) {\n await this.sessionReplay.setSessionId(sessionId).promise;\n }\n\n // Treating config.sessionId as source of truth, if the event's session id doesn't match, the\n // event is not of the current session (offline/late events). In that case, don't tag the events\n if (sessionId && sessionId === event.session_id) {\n let userProperties;\n if (event.event_type === SpecialEventType.IDENTIFY) {\n userProperties = parseUserProperties(event);\n }\n const globalScope = getGlobalScope();\n await this.sessionReplay.evaluateTargetingAndCapture({\n event,\n userProperties,\n page: globalScope?.location?.href != null ? { url: globalScope.location.href } : undefined,\n });\n const sessionRecordingProperties = this.sessionReplay.getSessionReplayProperties();\n event.event_properties = {\n ...event.event_properties,\n ...sessionRecordingProperties,\n };\n }\n }\n\n if (event.event_type === SpecialEventType.IDENTIFY && event.event_properties) {\n delete event.event_properties[DEFAULT_SESSION_REPLAY_PROPERTY];\n }\n\n return Promise.resolve(event);\n } catch (error) {\n /* istanbul ignore next */\n this.config?.loggerProvider.error(`Session Replay: Failed to enrich event due to ${(error as Error).message}`);\n return Promise.resolve(event);\n }\n }\n\n async teardown(): Promise<void> {\n try {\n this.sessionReplay.shutdown();\n // the following are initialized in setup() which will always be called first\n // here we reset them to null to prevent memory leaks\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.config = null;\n } catch (error) {\n /* istanbul ignore next */\n this.config?.loggerProvider.error(`Session Replay: teardown failed due to ${(error as Error).message}`);\n }\n }\n\n getSessionReplayProperties() {\n return this.sessionReplay.getSessionReplayProperties();\n }\n\n /**\n * Start or resume session replay recording.\n * Recording still respects sample rate, targeting, opt-out, and remote capture flags.\n */\n async start() {\n await this.sessionReplay.start().promise;\n }\n\n /**\n * Stop session replay recording without removing the plugin.\n * Call {@link SessionReplayPlugin.start} to resume. Plugin teardown still uses shutdown.\n */\n stop() {\n this.sessionReplay.stop();\n }\n}\n\nexport const sessionReplayPlugin: (options?: SessionReplayOptions) => SessionReplayPlugin = (\n options?: SessionReplayOptions,\n) => {\n return new SessionReplayPlugin(options);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":";;;;AAAA,4DAQmC;AACnC,4EAY2C;AAC3C,qCAAgD;AAEhD,qCAAoC;AAEvB,QAAA,6BAA6B,GAAG,aAAa,CAAC;AAC9C,QAAA,+BAA+B,GAAG,UAAG,qCAA6B,uBAAoB,CAAC;AACpG;IAsBE,6BAAY,OAA8B;QApB1C,SAAI,GAAG,mBAAmB,CAAC,UAAU,CAAC;QACtC,SAAI,GAAG,YAAqB,CAAC;QAC7B,sEAAsE;QACtE,6DA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AAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IAC5B,CAAC;IAxNM,8BAAU,GAAG,0CAA0C,CAAC;IAyNjE,0BAAC;CAAA,AA1ND,IA0NC;AA1NY,kDAAmB;AA4NzB,IAAM,mBAAmB,GAA4D,UAC1F,OAA8B;IAE9B,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B","sourcesContent":["import {\n BrowserClient,\n BrowserConfig,\n EnrichmentPlugin,\n Event,\n SpecialEventType,\n getGlobalScope,\n getAnalyticsConnector,\n} from '@amplitude/analytics-core';\nimport {\n init,\n setSessionId,\n getSessionId,\n getSessionReplayProperties,\n flush,\n start,\n stop,\n shutdown,\n evaluateTargetingAndCapture,\n AmplitudeSessionReplay,\n SessionReplayOptions as SessionReplayBrowserOptions,\n} from '@amplitude/session-replay-browser';\nimport { parseUserProperties } from './helpers';\nimport { SessionReplayOptions } from './typings/session-replay';\nimport { VERSION } from './version';\n\nexport const DEFAULT_EVENT_PROPERTY_PREFIX = '[Amplitude]';\nexport const DEFAULT_SESSION_REPLAY_PROPERTY = `${DEFAULT_EVENT_PROPERTY_PREFIX} Session Replay ID`;\nexport class SessionReplayPlugin implements EnrichmentPlugin<BrowserClient, BrowserConfig> {\n static pluginName = '@amplitude/plugin-session-replay-browser';\n name = SessionReplayPlugin.pluginName;\n type = 'enrichment' as const;\n // this.config is defined in setup() which will always be called first\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: BrowserConfig | null = null;\n options: SessionReplayOptions;\n srInitOptions: SessionReplayBrowserOptions;\n sessionReplay: AmplitudeSessionReplay = {\n flush: flush,\n getSessionId: getSessionId,\n getSessionReplayProperties: getSessionReplayProperties,\n init: init,\n setSessionId: setSessionId,\n start: start,\n stop: stop,\n shutdown: shutdown,\n evaluateTargetingAndCapture: evaluateTargetingAndCapture,\n };\n\n constructor(options?: SessionReplayOptions) {\n this.options = { forceSessionTracking: false, ...options };\n this.srInitOptions = this.options;\n }\n\n async setup(config: BrowserConfig, _client: BrowserClient) {\n try {\n /* istanbul ignore next */\n config?.loggerProvider.log(`Installing @amplitude/plugin-session-replay, version ${VERSION}.`);\n\n this.config = config;\n\n if (this.options.forceSessionTracking) {\n if (typeof config.defaultTracking === 'boolean') {\n if (config.defaultTracking === false) {\n config.defaultTracking = {\n pageViews: false,\n formInteractions: false,\n fileDownloads: false,\n sessions: true,\n };\n }\n } else {\n config.defaultTracking = {\n ...config.defaultTracking,\n sessions: true,\n };\n }\n }\n const identityStore = getAnalyticsConnector(this.config.instanceName).identityStore;\n const userProperties = identityStore.getIdentity().userProperties;\n\n this.srInitOptions = {\n instanceName: this.config.instanceName,\n deviceId: this.options.deviceId ?? this.config.deviceId,\n optOut: this.config.optOut,\n sessionId: this.options.customSessionId ? undefined : this.config.sessionId,\n loggerProvider: this.config.loggerProvider,\n logLevel: this.config.logLevel,\n flushMaxRetries: this.config.flushMaxRetries,\n serverZone: this.config.serverZone,\n configServerUrl: this.options.configServerUrl || this.config.remoteConfig?.serverUrl,\n trackServerUrl: this.options.trackServerUrl,\n sampleRate: this.options.sampleRate,\n privacyConfig: {\n blockSelector: this.options.privacyConfig?.blockSelector,\n maskSelector: this.options.privacyConfig?.maskSelector,\n unmaskSelector: this.options.privacyConfig?.unmaskSelector,\n defaultMaskLevel: this.options.privacyConfig?.defaultMaskLevel,\n },\n debugMode: this.options.debugMode,\n shouldInlineStylesheet: this.options.shouldInlineStylesheet,\n inlineImages: this.options.inlineImages,\n version: { type: 'plugin', version: VERSION },\n performanceConfig: this.options.performanceConfig,\n storeType: this.options.storeType,\n useWebWorker: this.options.useWebWorker ?? this.options.experimental?.useWebWorker,\n userProperties: userProperties,\n applyBackgroundColorToBlockedElements: this.options.applyBackgroundColorToBlockedElements,\n interactionConfig: this.options.interactionConfig,\n captureDocumentTitle: this.options.captureDocumentTitle,\n enableUrlChangePolling: this.options.enableUrlChangePolling,\n urlChangePollingInterval: this.options.urlChangePollingInterval,\n captureAdoptedStyleSheets: this.options.captureAdoptedStyleSheets,\n crossOriginIframes: this.options.crossOriginIframes,\n flushIntervalConfig: this.options.flushIntervalConfig,\n eagerFullSnapshotSend: this.options.eagerFullSnapshotSend,\n captureFullSnapshotOnFocus: this.options.captureFullSnapshotOnFocus,\n maxPersistedEventsSizeBytes: this.options.maxPersistedEventsSizeBytes,\n maxSingleEventSizeBytes: this.options.maxSingleEventSizeBytes,\n sendTimeoutMs: this.options.sendTimeoutMs,\n handleSendEvents: this.options.handleSendEvents,\n handleFetchConfig: this.options.handleFetchConfig,\n };\n\n await this.sessionReplay.init(config.apiKey, this.srInitOptions).promise;\n } catch (error) {\n /* istanbul ignore next */\n config?.loggerProvider.error(`Session Replay: Failed to initialize due to ${(error as Error).message}`);\n }\n }\n\n async onSessionIdChanged(sessionId: number): Promise<void> {\n this.config?.loggerProvider.debug(\n `Analytics session id is changed to ${sessionId}, SR session id is ${String(this.sessionReplay.getSessionId())}.`,\n );\n await this.sessionReplay.setSessionId(sessionId).promise;\n }\n\n async onOptOutChanged(optOut: boolean): Promise<void> {\n this.config?.loggerProvider.debug(\n `optOut is changed to ${String(optOut)}, calling ${\n optOut ? 'sessionReplay.shutdown()' : 'sessionReplay.init()'\n }.`,\n );\n // TODO: compare optOut with this.sessionReplay.getOptOut().\n // Need to add getOptOut() to the interface AmplitudeSessionReplay first.\n if (optOut) {\n this.sessionReplay.shutdown();\n } else {\n this.config != null && (await this.sessionReplay.init(this.config.apiKey, this.srInitOptions).promise);\n }\n }\n\n async execute(event: Event) {\n try {\n if (this.options.customSessionId) {\n const sessionId = this.options.customSessionId(event);\n if (sessionId) {\n // On event, synchronize the session id to the custom session id from the event. This may\n // suffer from offline/delayed events messing up the state stored\n if (sessionId !== this.sessionReplay.getSessionId()) {\n await this.sessionReplay.setSessionId(sessionId).promise;\n }\n\n const sessionRecordingProperties = this.sessionReplay.getSessionReplayProperties();\n event.event_properties = {\n ...event.event_properties,\n ...sessionRecordingProperties,\n };\n }\n } else {\n // On event, synchronize the session id to the what's on the browserConfig (source of truth)\n // Choosing not to read from event object here, concerned about offline/delayed events messing up the state stored\n // in SR.\n const sessionId: string | number | undefined = this.config?.sessionId;\n if (sessionId && sessionId !== this.sessionReplay.getSessionId()) {\n await this.sessionReplay.setSessionId(sessionId).promise;\n }\n\n // Treating config.sessionId as source of truth, if the event's session id doesn't match, the\n // event is not of the current session (offline/late events). In that case, don't tag the events\n if (sessionId && sessionId === event.session_id) {\n let userProperties;\n if (event.event_type === SpecialEventType.IDENTIFY) {\n userProperties = parseUserProperties(event);\n }\n const globalScope = getGlobalScope();\n await this.sessionReplay.evaluateTargetingAndCapture({\n event,\n userProperties,\n page: globalScope?.location?.href != null ? { url: globalScope.location.href } : undefined,\n });\n const sessionRecordingProperties = this.sessionReplay.getSessionReplayProperties();\n event.event_properties = {\n ...event.event_properties,\n ...sessionRecordingProperties,\n };\n }\n }\n\n if (event.event_type === SpecialEventType.IDENTIFY && event.event_properties) {\n delete event.event_properties[DEFAULT_SESSION_REPLAY_PROPERTY];\n }\n\n return Promise.resolve(event);\n } catch (error) {\n /* istanbul ignore next */\n this.config?.loggerProvider.error(`Session Replay: Failed to enrich event due to ${(error as Error).message}`);\n return Promise.resolve(event);\n }\n }\n\n async teardown(): Promise<void> {\n try {\n this.sessionReplay.shutdown();\n // the following are initialized in setup() which will always be called first\n // here we reset them to null to prevent memory leaks\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.config = null;\n } catch (error) {\n /* istanbul ignore next */\n this.config?.loggerProvider.error(`Session Replay: teardown failed due to ${(error as Error).message}`);\n }\n }\n\n getSessionReplayProperties() {\n return this.sessionReplay.getSessionReplayProperties();\n }\n\n /**\n * Start or resume session replay recording.\n * Recording still respects sample rate, targeting, opt-out, and remote capture flags.\n */\n async start() {\n await this.sessionReplay.start().promise;\n }\n\n /**\n * Stop session replay recording without removing the plugin.\n * Call {@link SessionReplayPlugin.start} to resume. Plugin teardown still uses shutdown.\n */\n stop() {\n this.sessionReplay.stop();\n }\n}\n\nexport const sessionReplayPlugin: (options?: SessionReplayOptions) => SessionReplayPlugin = (\n options?: SessionReplayOptions,\n) => {\n return new SessionReplayPlugin(options);\n};\n"]}
|
|
@@ -106,6 +106,10 @@ export interface SessionReplayOptions {
|
|
|
106
106
|
* @see {@link StandaloneSessionReplayOptions.shouldInlineStylesheet}
|
|
107
107
|
*/
|
|
108
108
|
shouldInlineStylesheet?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* @see {@link StandaloneSessionReplayOptions.inlineImages}
|
|
111
|
+
*/
|
|
112
|
+
inlineImages?: boolean;
|
|
109
113
|
/**
|
|
110
114
|
* @see {@link StandaloneSessionReplayOptions.performanceConfig}
|
|
111
115
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EACL,SAAS,EACT,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EAEpC,KAAK,oBAAoB,IAAI,8BAA8B,EAC5D,MAAM,mCAAmC,CAAC;AAE3C;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,WAAW,CAAC,8BAA8B,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAEzG;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,8BAA8B,CAAC,qBAAqB,CAAC,CAAC,CAAC;AAErG,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,QAAQ,GACR,cAAc,CAAC;AAEnB,MAAM,WAAW,0BAA0B;IACzC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAClC,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,CA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IACtB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,GAAG,SAAS,CAAC;IACvD;;;OAGG;IACH,YAAY,CAAC,EAAE;QACb,YAAY,EAAE,OAAO,CAAC;KACvB,CAAC;IACF;;OAEG;IACH,qCAAqC,CAAC,EAAE,OAAO,CAAC;IAEhD,iBAAiB,CAAC,EAAE,8BAA8B,CAAC;IAEnD;;;;;;;OAOG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;;;;OAKG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;OAEG;IACH,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;IAC9C;;OAEG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC;;OAEG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC;;OAEG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,8BAA8B,CAAC;IAClD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,+BAA+B,CAAC;CACrD"}
|
|
1
|
+
{"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EACL,SAAS,EACT,KAAK,8BAA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mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC;;OAEG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC;;OAEG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,8BAA8B,CAAC;IAClD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,+BAA+B,CAAC;CACrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"","sourcesContent":["import { Event } from '@amplitude/analytics-core';\nimport {\n StoreType,\n type SessionReplaySendEventsHandler,\n type SessionReplayFetchConfigHandler,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n type SessionReplayOptions as StandaloneSessionReplayOptions, // used for documentation\n} from '@amplitude/session-replay-browser';\n\n/**\n * Configuration for cross-origin iframe support.\n * Extracted from the standalone SDK's SessionReplayOptions.\n */\nexport type CrossOriginIframesConfig = NonNullable<StandaloneSessionReplayOptions['crossOriginIframes']>;\n\n/**\n * Configuration for rrweb event-split flush cadence.\n * Extracted from the standalone SDK's SessionReplayOptions.\n */\nexport type FlushIntervalConfig = NonNullable<StandaloneSessionReplayOptions['flushIntervalConfig']>;\n\nexport type MaskLevel =\n | 'light' // only mask a subset of inputs that’s deemed sensitive - password, credit card, telephone #, email. These are information we never want to capture.\n | 'medium' // mask all inputs\n | 'conservative'; // mask all inputs and all texts\n\nexport interface SessionReplayPrivacyConfig {\n blockSelector?: string | string[];\n defaultMaskLevel?: MaskLevel;\n maskSelector?: string[];\n unmaskSelector?: string[];\n}\n\n/**\n * Performance configuration for interaction tracking, specifically for CSS selector generation.\n */\nexport interface InteractionPerformanceConfig {\n /**\n * Maximum time in milliseconds allowed for CSS selector generation.\n * If selector generation takes longer than this, it will throw a timeout error.\n * Default: undefined (no timeout limit)\n */\n timeoutMs?: number;\n /**\n * Maximum number of attempts to optimize/simplify the CSS selector path.\n * Higher values may produce shorter selectors but take longer to compute.\n * Default: 10000\n */\n maxNumberOfTries?: number;\n /**\n * Maximum number of CSS selector combinations to test for uniqueness.\n * If more combinations would be generated, falls back to a simpler strategy.\n * Default: 1000\n */\n threshold?: number;\n}\n\nexport interface SessionReplayPerformanceConfig {\n enabled: boolean;\n timeout?: number;\n /**\n * If enabled, consecutive mutation events are merged into a single event before\n * compression. This reduces the stored event count and coalesces bursts of\n * inline `style` mutations on the same node (last-write-wins), without changing\n * replay semantics. Defaults to false.\n */\n mergeMutations?: boolean;\n /**\n * Performance configuration for interaction tracking (clicks, scrolls).\n */\n interaction?: InteractionPerformanceConfig;\n}\n\n/**\n * UGC filter rule.\n */\nexport type UGCFilterRule = {\n /**\n * The selector of the UGC element.\n */\n selector: string;\n /**\n * The replacement text for the UGC element.\n */\n replacement: string;\n};\n\nexport interface SessionReplayInteractionConfig {\n trackEveryNms?: number;\n enabled: boolean; // defaults to false\n batch: boolean; // defaults to false\n /**\n * UGC filter rules.\n */\n ugcFilterRules?: UGCFilterRule[];\n}\n\nexport interface SessionReplayOptions {\n /**\n * @see {@link StandaloneSessionReplayOptions.sampleRate}\n */\n sampleRate?: number;\n /**\n * @see {@link StandaloneSessionReplayOptions.privacyConfig}\n */\n privacyConfig?: SessionReplayPrivacyConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.debugMode}\n */\n debugMode?: boolean;\n /**\n * If this is enabled we will force the browser SDK to also send start and end session events.\n */\n forceSessionTracking?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.configServerUrl}\n */\n configServerUrl?: string;\n /**\n * @see {@link StandaloneSessionReplayOptions.trackServerUrl}\n */\n trackServerUrl?: string;\n /**\n * @see {@link StandaloneSessionReplayOptions.shouldInlineStylesheet}\n */\n shouldInlineStylesheet?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.performanceConfig}\n */\n performanceConfig?: SessionReplayPerformanceConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.storeType}\n */\n storeType?: StoreType;\n /**\n * If true, the SDK will compress replay events using a web worker.\n * This offloads compression to a separate thread, improving performance on the main thread.\n *\n * @defaultValue false\n */\n useWebWorker?: boolean;\n /**\n * Override the device ID for session replay.\n */\n deviceId?: string;\n /**\n * Dynamically overrides the session ID for replay. Ensure stability to avoid frequent restarts.\n * @param event Browser SDK event\n * @returns The session ID for the session replay.\n */\n customSessionId?: (event: Event) => string | undefined;\n /**\n * @deprecated Use `useWebWorker` instead. This will be removed in a future version.\n * @see {@link StandaloneSessionReplayOptions.useWebWorker}\n */\n experimental?: {\n useWebWorker: boolean;\n };\n /**\n * If true, applies a background color to blocked elements for visual masking. Defaults to false.\n */\n applyBackgroundColorToBlockedElements?: boolean;\n\n interactionConfig?: SessionReplayInteractionConfig;\n\n /**\n * Enables URL change polling as a fallback for SPA route tracking.\n * When enabled, the SDK will periodically check for URL changes every second\n * in addition to patching the History API. This is useful for edge cases where\n * route changes might bypass the standard History API methods.\n *\n * @defaultValue false\n */\n enableUrlChangePolling?: boolean;\n /**\n * Specifies the interval in milliseconds for URL change polling when enableUrlChangePolling is true.\n * The SDK will check for URL changes at this interval as a fallback for SPA route tracking.\n *\n * @defaultValue 1000\n */\n urlChangePollingInterval?: number;\n /**\n * Whether to capture document title in URL change events.\n * When disabled, the title field will be empty in URL change events.\n *\n * @defaultValue false\n */\n captureDocumentTitle?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.captureAdoptedStyleSheets}\n */\n captureAdoptedStyleSheets?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.crossOriginIframes}\n */\n crossOriginIframes?: CrossOriginIframesConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.flushIntervalConfig}\n */\n flushIntervalConfig?: FlushIntervalConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.eagerFullSnapshotSend}\n */\n eagerFullSnapshotSend?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.captureFullSnapshotOnFocus}\n */\n captureFullSnapshotOnFocus?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.maxPersistedEventsSizeBytes}\n */\n maxPersistedEventsSizeBytes?: number;\n /**\n * @see {@link StandaloneSessionReplayOptions.maxSingleEventSizeBytes}\n */\n maxSingleEventSizeBytes?: number;\n /**\n * @see {@link StandaloneSessionReplayOptions.sendTimeoutMs}\n */\n sendTimeoutMs?: number;\n /**\n * Optional custom transport for replay event uploads. Use to attach custom auth (e.g. a JWT\n * `Authorization` header) and route through an authenticated proxy.\n * @see {@link StandaloneSessionReplayOptions.handleSendEvents}\n */\n handleSendEvents?: SessionReplaySendEventsHandler;\n /**\n * Optional custom transport for the remote-config fetch.\n * @see {@link StandaloneSessionReplayOptions.handleFetchConfig}\n */\n handleFetchConfig?: SessionReplayFetchConfigHandler;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"","sourcesContent":["import { Event } from '@amplitude/analytics-core';\nimport {\n StoreType,\n type SessionReplaySendEventsHandler,\n type SessionReplayFetchConfigHandler,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n type SessionReplayOptions as StandaloneSessionReplayOptions, // used for documentation\n} from '@amplitude/session-replay-browser';\n\n/**\n * Configuration for cross-origin iframe support.\n * Extracted from the standalone SDK's SessionReplayOptions.\n */\nexport type CrossOriginIframesConfig = NonNullable<StandaloneSessionReplayOptions['crossOriginIframes']>;\n\n/**\n * Configuration for rrweb event-split flush cadence.\n * Extracted from the standalone SDK's SessionReplayOptions.\n */\nexport type FlushIntervalConfig = NonNullable<StandaloneSessionReplayOptions['flushIntervalConfig']>;\n\nexport type MaskLevel =\n | 'light' // only mask a subset of inputs that’s deemed sensitive - password, credit card, telephone #, email. These are information we never want to capture.\n | 'medium' // mask all inputs\n | 'conservative'; // mask all inputs and all texts\n\nexport interface SessionReplayPrivacyConfig {\n blockSelector?: string | string[];\n defaultMaskLevel?: MaskLevel;\n maskSelector?: string[];\n unmaskSelector?: string[];\n}\n\n/**\n * Performance configuration for interaction tracking, specifically for CSS selector generation.\n */\nexport interface InteractionPerformanceConfig {\n /**\n * Maximum time in milliseconds allowed for CSS selector generation.\n * If selector generation takes longer than this, it will throw a timeout error.\n * Default: undefined (no timeout limit)\n */\n timeoutMs?: number;\n /**\n * Maximum number of attempts to optimize/simplify the CSS selector path.\n * Higher values may produce shorter selectors but take longer to compute.\n * Default: 10000\n */\n maxNumberOfTries?: number;\n /**\n * Maximum number of CSS selector combinations to test for uniqueness.\n * If more combinations would be generated, falls back to a simpler strategy.\n * Default: 1000\n */\n threshold?: number;\n}\n\nexport interface SessionReplayPerformanceConfig {\n enabled: boolean;\n timeout?: number;\n /**\n * If enabled, consecutive mutation events are merged into a single event before\n * compression. This reduces the stored event count and coalesces bursts of\n * inline `style` mutations on the same node (last-write-wins), without changing\n * replay semantics. Defaults to false.\n */\n mergeMutations?: boolean;\n /**\n * Performance configuration for interaction tracking (clicks, scrolls).\n */\n interaction?: InteractionPerformanceConfig;\n}\n\n/**\n * UGC filter rule.\n */\nexport type UGCFilterRule = {\n /**\n * The selector of the UGC element.\n */\n selector: string;\n /**\n * The replacement text for the UGC element.\n */\n replacement: string;\n};\n\nexport interface SessionReplayInteractionConfig {\n trackEveryNms?: number;\n enabled: boolean; // defaults to false\n batch: boolean; // defaults to false\n /**\n * UGC filter rules.\n */\n ugcFilterRules?: UGCFilterRule[];\n}\n\nexport interface SessionReplayOptions {\n /**\n * @see {@link StandaloneSessionReplayOptions.sampleRate}\n */\n sampleRate?: number;\n /**\n * @see {@link StandaloneSessionReplayOptions.privacyConfig}\n */\n privacyConfig?: SessionReplayPrivacyConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.debugMode}\n */\n debugMode?: boolean;\n /**\n * If this is enabled we will force the browser SDK to also send start and end session events.\n */\n forceSessionTracking?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.configServerUrl}\n */\n configServerUrl?: string;\n /**\n * @see {@link StandaloneSessionReplayOptions.trackServerUrl}\n */\n trackServerUrl?: string;\n /**\n * @see {@link StandaloneSessionReplayOptions.shouldInlineStylesheet}\n */\n shouldInlineStylesheet?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.inlineImages}\n */\n inlineImages?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.performanceConfig}\n */\n performanceConfig?: SessionReplayPerformanceConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.storeType}\n */\n storeType?: StoreType;\n /**\n * If true, the SDK will compress replay events using a web worker.\n * This offloads compression to a separate thread, improving performance on the main thread.\n *\n * @defaultValue false\n */\n useWebWorker?: boolean;\n /**\n * Override the device ID for session replay.\n */\n deviceId?: string;\n /**\n * Dynamically overrides the session ID for replay. Ensure stability to avoid frequent restarts.\n * @param event Browser SDK event\n * @returns The session ID for the session replay.\n */\n customSessionId?: (event: Event) => string | undefined;\n /**\n * @deprecated Use `useWebWorker` instead. This will be removed in a future version.\n * @see {@link StandaloneSessionReplayOptions.useWebWorker}\n */\n experimental?: {\n useWebWorker: boolean;\n };\n /**\n * If true, applies a background color to blocked elements for visual masking. Defaults to false.\n */\n applyBackgroundColorToBlockedElements?: boolean;\n\n interactionConfig?: SessionReplayInteractionConfig;\n\n /**\n * Enables URL change polling as a fallback for SPA route tracking.\n * When enabled, the SDK will periodically check for URL changes every second\n * in addition to patching the History API. This is useful for edge cases where\n * route changes might bypass the standard History API methods.\n *\n * @defaultValue false\n */\n enableUrlChangePolling?: boolean;\n /**\n * Specifies the interval in milliseconds for URL change polling when enableUrlChangePolling is true.\n * The SDK will check for URL changes at this interval as a fallback for SPA route tracking.\n *\n * @defaultValue 1000\n */\n urlChangePollingInterval?: number;\n /**\n * Whether to capture document title in URL change events.\n * When disabled, the title field will be empty in URL change events.\n *\n * @defaultValue false\n */\n captureDocumentTitle?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.captureAdoptedStyleSheets}\n */\n captureAdoptedStyleSheets?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.crossOriginIframes}\n */\n crossOriginIframes?: CrossOriginIframesConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.flushIntervalConfig}\n */\n flushIntervalConfig?: FlushIntervalConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.eagerFullSnapshotSend}\n */\n eagerFullSnapshotSend?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.captureFullSnapshotOnFocus}\n */\n captureFullSnapshotOnFocus?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.maxPersistedEventsSizeBytes}\n */\n maxPersistedEventsSizeBytes?: number;\n /**\n * @see {@link StandaloneSessionReplayOptions.maxSingleEventSizeBytes}\n */\n maxSingleEventSizeBytes?: number;\n /**\n * @see {@link StandaloneSessionReplayOptions.sendTimeoutMs}\n */\n sendTimeoutMs?: number;\n /**\n * Optional custom transport for replay event uploads. Use to attach custom auth (e.g. a JWT\n * `Authorization` header) and route through an authenticated proxy.\n * @see {@link StandaloneSessionReplayOptions.handleSendEvents}\n */\n handleSendEvents?: SessionReplaySendEventsHandler;\n /**\n * Optional custom transport for the remote-config fetch.\n * @see {@link StandaloneSessionReplayOptions.handleFetchConfig}\n */\n handleFetchConfig?: SessionReplayFetchConfigHandler;\n}\n"]}
|
package/lib/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.35.1-video-analytics-2.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/cjs/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,+BAA+B,CAAC"}
|
package/lib/cjs/version.js
CHANGED
package/lib/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACvC,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACvC,QAAA,OAAO,GAAG,4BAA4B,CAAC","sourcesContent":["// Autogenerated by `pnpm version-file`. DO NOT EDIT\nexport const VERSION = '1.35.1-video-analytics-2.0';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,KAAK,EAIN,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAUL,sBAAsB,EACtB,oBAAoB,IAAI,2BAA2B,EACpD,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,eAAO,MAAM,6BAA6B,gBAAgB,CAAC;AAC3D,eAAO,MAAM,+BAA+B,QAAuD,CAAC;AACpG,qBAAa,mBAAoB,YAAW,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC;IACxF,MAAM,CAAC,UAAU,SAA8C;IAC/D,IAAI,SAAkC;IACtC,IAAI,eAAyB;IAI7B,MAAM,EAAE,aAAa,GAAG,IAAI,CAAQ;IACpC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,aAAa,EAAE,2BAA2B,CAAC;IAC3C,aAAa,EAAE,sBAAsB,CAUnC;gBAEU,OAAO,CAAC,EAAE,oBA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7 @@ var SessionReplayPlugin = /** @class */ (function () {
|
|
|
75
75
|
},
|
|
76
76
|
debugMode: this.options.debugMode,
|
|
77
77
|
shouldInlineStylesheet: this.options.shouldInlineStylesheet,
|
|
78
|
+
inlineImages: this.options.inlineImages,
|
|
78
79
|
version: { type: 'plugin', version: VERSION },
|
|
79
80
|
performanceConfig: this.options.performanceConfig,
|
|
80
81
|
storeType: this.options.storeType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":";AAAA,OAAO,EAKL,gBAAgB,EAChB,cAAc,EACd,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,0BAA0B,EAC1B,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,2BAA2B,GAG5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,IAAM,6BAA6B,GAAG,aAAa,CAAC;AAC3D,MAAM,CAAC,IAAM,+BAA+B,GAAG,UAAG,6BAA6B,uBAAoB,CAAC;AACpG;IAsBE,6BAAY,OAA8B;QApB1C,SAAI,GAAG,mBAAmB,CAAC,UAAU,CAAC;QACtC,SAAI,GAAG,YAAqB,CAAC;QAC7B,sEAAsE;QACtE,6DAA6D;QAC7D,aAAa;QACb,WAAM,GAAyB,IAAI,CAAC;QAGpC,kBAAa,GAA2B;YACtC,KAAK,EAAE,KAAK;YACZ,YAAY,EAAE,YAAY;YAC1B,0BAA0B,EAAE,0BAA0B;YACtD,IAAI,EAAE,IAAI;YACV,YAAY,EAAE,YAAY;YAC1B,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,QAAQ;YAClB,2BAA2B,EAAE,2BAA2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analytics-core';\nimport {\n init,\n setSessionId,\n getSessionId,\n getSessionReplayProperties,\n flush,\n start,\n stop,\n shutdown,\n evaluateTargetingAndCapture,\n AmplitudeSessionReplay,\n SessionReplayOptions as SessionReplayBrowserOptions,\n} from '@amplitude/session-replay-browser';\nimport { parseUserProperties } from './helpers';\nimport { SessionReplayOptions } from './typings/session-replay';\nimport { VERSION } from './version';\n\nexport const DEFAULT_EVENT_PROPERTY_PREFIX = '[Amplitude]';\nexport const DEFAULT_SESSION_REPLAY_PROPERTY = `${DEFAULT_EVENT_PROPERTY_PREFIX} Session Replay ID`;\nexport class SessionReplayPlugin implements EnrichmentPlugin<BrowserClient, BrowserConfig> {\n static pluginName = '@amplitude/plugin-session-replay-browser';\n name = SessionReplayPlugin.pluginName;\n type = 'enrichment' as const;\n // this.config is defined in setup() which will always be called first\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: BrowserConfig | null = null;\n options: SessionReplayOptions;\n srInitOptions: SessionReplayBrowserOptions;\n sessionReplay: AmplitudeSessionReplay = {\n flush: flush,\n getSessionId: getSessionId,\n getSessionReplayProperties: getSessionReplayProperties,\n init: init,\n setSessionId: setSessionId,\n start: start,\n stop: stop,\n shutdown: shutdown,\n evaluateTargetingAndCapture: evaluateTargetingAndCapture,\n };\n\n constructor(options?: SessionReplayOptions) {\n this.options = { forceSessionTracking: false, ...options };\n this.srInitOptions = this.options;\n }\n\n async setup(config: BrowserConfig, _client: BrowserClient) {\n try {\n /* istanbul ignore next */\n config?.loggerProvider.log(`Installing @amplitude/plugin-session-replay, version ${VERSION}.`);\n\n this.config = config;\n\n if (this.options.forceSessionTracking) {\n if (typeof config.defaultTracking === 'boolean') {\n if (config.defaultTracking === false) {\n config.defaultTracking = {\n pageViews: false,\n formInteractions: false,\n fileDownloads: false,\n sessions: true,\n };\n }\n } else {\n config.defaultTracking = {\n ...config.defaultTracking,\n sessions: true,\n };\n }\n }\n const identityStore = getAnalyticsConnector(this.config.instanceName).identityStore;\n const userProperties = identityStore.getIdentity().userProperties;\n\n this.srInitOptions = {\n instanceName: this.config.instanceName,\n deviceId: this.options.deviceId ?? this.config.deviceId,\n optOut: this.config.optOut,\n sessionId: this.options.customSessionId ? undefined : this.config.sessionId,\n loggerProvider: this.config.loggerProvider,\n logLevel: this.config.logLevel,\n flushMaxRetries: this.config.flushMaxRetries,\n serverZone: this.config.serverZone,\n configServerUrl: this.options.configServerUrl || this.config.remoteConfig?.serverUrl,\n trackServerUrl: this.options.trackServerUrl,\n sampleRate: this.options.sampleRate,\n privacyConfig: {\n blockSelector: this.options.privacyConfig?.blockSelector,\n maskSelector: this.options.privacyConfig?.maskSelector,\n unmaskSelector: this.options.privacyConfig?.unmaskSelector,\n defaultMaskLevel: this.options.privacyConfig?.defaultMaskLevel,\n },\n debugMode: this.options.debugMode,\n shouldInlineStylesheet: this.options.shouldInlineStylesheet,\n version: { type: 'plugin', version: VERSION },\n performanceConfig: this.options.performanceConfig,\n storeType: this.options.storeType,\n useWebWorker: this.options.useWebWorker ?? this.options.experimental?.useWebWorker,\n userProperties: userProperties,\n applyBackgroundColorToBlockedElements: this.options.applyBackgroundColorToBlockedElements,\n interactionConfig: this.options.interactionConfig,\n captureDocumentTitle: this.options.captureDocumentTitle,\n enableUrlChangePolling: this.options.enableUrlChangePolling,\n urlChangePollingInterval: this.options.urlChangePollingInterval,\n captureAdoptedStyleSheets: this.options.captureAdoptedStyleSheets,\n crossOriginIframes: this.options.crossOriginIframes,\n flushIntervalConfig: this.options.flushIntervalConfig,\n eagerFullSnapshotSend: this.options.eagerFullSnapshotSend,\n captureFullSnapshotOnFocus: this.options.captureFullSnapshotOnFocus,\n maxPersistedEventsSizeBytes: this.options.maxPersistedEventsSizeBytes,\n maxSingleEventSizeBytes: this.options.maxSingleEventSizeBytes,\n sendTimeoutMs: this.options.sendTimeoutMs,\n handleSendEvents: this.options.handleSendEvents,\n handleFetchConfig: this.options.handleFetchConfig,\n };\n\n await this.sessionReplay.init(config.apiKey, this.srInitOptions).promise;\n } catch (error) {\n /* istanbul ignore next */\n config?.loggerProvider.error(`Session Replay: Failed to initialize due to ${(error as Error).message}`);\n }\n }\n\n async onSessionIdChanged(sessionId: number): Promise<void> {\n this.config?.loggerProvider.debug(\n `Analytics session id is changed to ${sessionId}, SR session id is ${String(this.sessionReplay.getSessionId())}.`,\n );\n await this.sessionReplay.setSessionId(sessionId).promise;\n }\n\n async onOptOutChanged(optOut: boolean): Promise<void> {\n this.config?.loggerProvider.debug(\n `optOut is changed to ${String(optOut)}, calling ${\n optOut ? 'sessionReplay.shutdown()' : 'sessionReplay.init()'\n }.`,\n );\n // TODO: compare optOut with this.sessionReplay.getOptOut().\n // Need to add getOptOut() to the interface AmplitudeSessionReplay first.\n if (optOut) {\n this.sessionReplay.shutdown();\n } else {\n this.config != null && (await this.sessionReplay.init(this.config.apiKey, this.srInitOptions).promise);\n }\n }\n\n async execute(event: Event) {\n try {\n if (this.options.customSessionId) {\n const sessionId = this.options.customSessionId(event);\n if (sessionId) {\n // On event, synchronize the session id to the custom session id from the event. This may\n // suffer from offline/delayed events messing up the state stored\n if (sessionId !== this.sessionReplay.getSessionId()) {\n await this.sessionReplay.setSessionId(sessionId).promise;\n }\n\n const sessionRecordingProperties = this.sessionReplay.getSessionReplayProperties();\n event.event_properties = {\n ...event.event_properties,\n ...sessionRecordingProperties,\n };\n }\n } else {\n // On event, synchronize the session id to the what's on the browserConfig (source of truth)\n // Choosing not to read from event object here, concerned about offline/delayed events messing up the state stored\n // in SR.\n const sessionId: string | number | undefined = this.config?.sessionId;\n if (sessionId && sessionId !== this.sessionReplay.getSessionId()) {\n await this.sessionReplay.setSessionId(sessionId).promise;\n }\n\n // Treating config.sessionId as source of truth, if the event's session id doesn't match, the\n // event is not of the current session (offline/late events). In that case, don't tag the events\n if (sessionId && sessionId === event.session_id) {\n let userProperties;\n if (event.event_type === SpecialEventType.IDENTIFY) {\n userProperties = parseUserProperties(event);\n }\n const globalScope = getGlobalScope();\n await this.sessionReplay.evaluateTargetingAndCapture({\n event,\n userProperties,\n page: globalScope?.location?.href != null ? { url: globalScope.location.href } : undefined,\n });\n const sessionRecordingProperties = this.sessionReplay.getSessionReplayProperties();\n event.event_properties = {\n ...event.event_properties,\n ...sessionRecordingProperties,\n };\n }\n }\n\n if (event.event_type === SpecialEventType.IDENTIFY && event.event_properties) {\n delete event.event_properties[DEFAULT_SESSION_REPLAY_PROPERTY];\n }\n\n return Promise.resolve(event);\n } catch (error) {\n /* istanbul ignore next */\n this.config?.loggerProvider.error(`Session Replay: Failed to enrich event due to ${(error as Error).message}`);\n return Promise.resolve(event);\n }\n }\n\n async teardown(): Promise<void> {\n try {\n this.sessionReplay.shutdown();\n // the following are initialized in setup() which will always be called first\n // here we reset them to null to prevent memory leaks\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.config = null;\n } catch (error) {\n /* istanbul ignore next */\n this.config?.loggerProvider.error(`Session Replay: teardown failed due to ${(error as Error).message}`);\n }\n }\n\n getSessionReplayProperties() {\n return this.sessionReplay.getSessionReplayProperties();\n }\n\n /**\n * Start or resume session replay recording.\n * Recording still respects sample rate, targeting, opt-out, and remote capture flags.\n */\n async start() {\n await this.sessionReplay.start().promise;\n }\n\n /**\n * Stop session replay recording without removing the plugin.\n * Call {@link SessionReplayPlugin.start} to resume. Plugin teardown still uses shutdown.\n */\n stop() {\n this.sessionReplay.stop();\n }\n}\n\nexport const sessionReplayPlugin: (options?: SessionReplayOptions) => SessionReplayPlugin = (\n options?: SessionReplayOptions,\n) => {\n return new SessionReplayPlugin(options);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":";AAAA,OAAO,EAKL,gBAAgB,EAChB,cAAc,EACd,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,0BAA0B,EAC1B,KAAK,EACL,KAA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oBAC1B,MAAA,IAAI,CAAC,MAAM,0CAAE,cAAc,CAAC,KAAK,CAAC,iDAA2C,KAAe,CAAC,OAAO,CAAE,CAAC,CAAC;iBACzG;;;;KACF;IAED,wDAA0B,GAA1B;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,0BAA0B,EAAE,CAAC;IACzD,CAAC;IAED;;;OAGG;IACG,mCAAK,GAAX;;;;4BACE,qBAAM,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,OAAO,EAAA;;wBAAxC,SAAwC,CAAC;;;;;KAC1C;IAED;;;OAGG;IACH,kCAAI,GAAJ;QACE,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IAC5B,CAAC;IAxNM,8BAAU,GAAG,0CAA0C,CAAC;IAyNjE,0BAAC;CAAA,AA1ND,IA0NC;SA1NY,mBAAmB;AA4NhC,MAAM,CAAC,IAAM,mBAAmB,GAA4D,UAC1F,OAA8B;IAE9B,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC,CAAC","sourcesContent":["import {\n BrowserClient,\n BrowserConfig,\n EnrichmentPlugin,\n Event,\n SpecialEventType,\n getGlobalScope,\n getAnalyticsConnector,\n} from '@amplitude/analytics-core';\nimport {\n init,\n setSessionId,\n getSessionId,\n getSessionReplayProperties,\n flush,\n start,\n stop,\n shutdown,\n evaluateTargetingAndCapture,\n AmplitudeSessionReplay,\n SessionReplayOptions as SessionReplayBrowserOptions,\n} from '@amplitude/session-replay-browser';\nimport { parseUserProperties } from './helpers';\nimport { SessionReplayOptions } from './typings/session-replay';\nimport { VERSION } from './version';\n\nexport const DEFAULT_EVENT_PROPERTY_PREFIX = '[Amplitude]';\nexport const DEFAULT_SESSION_REPLAY_PROPERTY = `${DEFAULT_EVENT_PROPERTY_PREFIX} Session Replay ID`;\nexport class SessionReplayPlugin implements EnrichmentPlugin<BrowserClient, BrowserConfig> {\n static pluginName = '@amplitude/plugin-session-replay-browser';\n name = SessionReplayPlugin.pluginName;\n type = 'enrichment' as const;\n // this.config is defined in setup() which will always be called first\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: BrowserConfig | null = null;\n options: SessionReplayOptions;\n srInitOptions: SessionReplayBrowserOptions;\n sessionReplay: AmplitudeSessionReplay = {\n flush: flush,\n getSessionId: getSessionId,\n getSessionReplayProperties: getSessionReplayProperties,\n init: init,\n setSessionId: setSessionId,\n start: start,\n stop: stop,\n shutdown: shutdown,\n evaluateTargetingAndCapture: evaluateTargetingAndCapture,\n };\n\n constructor(options?: SessionReplayOptions) {\n this.options = { forceSessionTracking: false, ...options };\n this.srInitOptions = this.options;\n }\n\n async setup(config: BrowserConfig, _client: BrowserClient) {\n try {\n /* istanbul ignore next */\n config?.loggerProvider.log(`Installing @amplitude/plugin-session-replay, version ${VERSION}.`);\n\n this.config = config;\n\n if (this.options.forceSessionTracking) {\n if (typeof config.defaultTracking === 'boolean') {\n if (config.defaultTracking === false) {\n config.defaultTracking = {\n pageViews: false,\n formInteractions: false,\n fileDownloads: false,\n sessions: true,\n };\n }\n } else {\n config.defaultTracking = {\n ...config.defaultTracking,\n sessions: true,\n };\n }\n }\n const identityStore = getAnalyticsConnector(this.config.instanceName).identityStore;\n const userProperties = identityStore.getIdentity().userProperties;\n\n this.srInitOptions = {\n instanceName: this.config.instanceName,\n deviceId: this.options.deviceId ?? this.config.deviceId,\n optOut: this.config.optOut,\n sessionId: this.options.customSessionId ? undefined : this.config.sessionId,\n loggerProvider: this.config.loggerProvider,\n logLevel: this.config.logLevel,\n flushMaxRetries: this.config.flushMaxRetries,\n serverZone: this.config.serverZone,\n configServerUrl: this.options.configServerUrl || this.config.remoteConfig?.serverUrl,\n trackServerUrl: this.options.trackServerUrl,\n sampleRate: this.options.sampleRate,\n privacyConfig: {\n blockSelector: this.options.privacyConfig?.blockSelector,\n maskSelector: this.options.privacyConfig?.maskSelector,\n unmaskSelector: this.options.privacyConfig?.unmaskSelector,\n defaultMaskLevel: this.options.privacyConfig?.defaultMaskLevel,\n },\n debugMode: this.options.debugMode,\n shouldInlineStylesheet: this.options.shouldInlineStylesheet,\n inlineImages: this.options.inlineImages,\n version: { type: 'plugin', version: VERSION },\n performanceConfig: this.options.performanceConfig,\n storeType: this.options.storeType,\n useWebWorker: this.options.useWebWorker ?? this.options.experimental?.useWebWorker,\n userProperties: userProperties,\n applyBackgroundColorToBlockedElements: this.options.applyBackgroundColorToBlockedElements,\n interactionConfig: this.options.interactionConfig,\n captureDocumentTitle: this.options.captureDocumentTitle,\n enableUrlChangePolling: this.options.enableUrlChangePolling,\n urlChangePollingInterval: this.options.urlChangePollingInterval,\n captureAdoptedStyleSheets: this.options.captureAdoptedStyleSheets,\n crossOriginIframes: this.options.crossOriginIframes,\n flushIntervalConfig: this.options.flushIntervalConfig,\n eagerFullSnapshotSend: this.options.eagerFullSnapshotSend,\n captureFullSnapshotOnFocus: this.options.captureFullSnapshotOnFocus,\n maxPersistedEventsSizeBytes: this.options.maxPersistedEventsSizeBytes,\n maxSingleEventSizeBytes: this.options.maxSingleEventSizeBytes,\n sendTimeoutMs: this.options.sendTimeoutMs,\n handleSendEvents: this.options.handleSendEvents,\n handleFetchConfig: this.options.handleFetchConfig,\n };\n\n await this.sessionReplay.init(config.apiKey, this.srInitOptions).promise;\n } catch (error) {\n /* istanbul ignore next */\n config?.loggerProvider.error(`Session Replay: Failed to initialize due to ${(error as Error).message}`);\n }\n }\n\n async onSessionIdChanged(sessionId: number): Promise<void> {\n this.config?.loggerProvider.debug(\n `Analytics session id is changed to ${sessionId}, SR session id is ${String(this.sessionReplay.getSessionId())}.`,\n );\n await this.sessionReplay.setSessionId(sessionId).promise;\n }\n\n async onOptOutChanged(optOut: boolean): Promise<void> {\n this.config?.loggerProvider.debug(\n `optOut is changed to ${String(optOut)}, calling ${\n optOut ? 'sessionReplay.shutdown()' : 'sessionReplay.init()'\n }.`,\n );\n // TODO: compare optOut with this.sessionReplay.getOptOut().\n // Need to add getOptOut() to the interface AmplitudeSessionReplay first.\n if (optOut) {\n this.sessionReplay.shutdown();\n } else {\n this.config != null && (await this.sessionReplay.init(this.config.apiKey, this.srInitOptions).promise);\n }\n }\n\n async execute(event: Event) {\n try {\n if (this.options.customSessionId) {\n const sessionId = this.options.customSessionId(event);\n if (sessionId) {\n // On event, synchronize the session id to the custom session id from the event. This may\n // suffer from offline/delayed events messing up the state stored\n if (sessionId !== this.sessionReplay.getSessionId()) {\n await this.sessionReplay.setSessionId(sessionId).promise;\n }\n\n const sessionRecordingProperties = this.sessionReplay.getSessionReplayProperties();\n event.event_properties = {\n ...event.event_properties,\n ...sessionRecordingProperties,\n };\n }\n } else {\n // On event, synchronize the session id to the what's on the browserConfig (source of truth)\n // Choosing not to read from event object here, concerned about offline/delayed events messing up the state stored\n // in SR.\n const sessionId: string | number | undefined = this.config?.sessionId;\n if (sessionId && sessionId !== this.sessionReplay.getSessionId()) {\n await this.sessionReplay.setSessionId(sessionId).promise;\n }\n\n // Treating config.sessionId as source of truth, if the event's session id doesn't match, the\n // event is not of the current session (offline/late events). In that case, don't tag the events\n if (sessionId && sessionId === event.session_id) {\n let userProperties;\n if (event.event_type === SpecialEventType.IDENTIFY) {\n userProperties = parseUserProperties(event);\n }\n const globalScope = getGlobalScope();\n await this.sessionReplay.evaluateTargetingAndCapture({\n event,\n userProperties,\n page: globalScope?.location?.href != null ? { url: globalScope.location.href } : undefined,\n });\n const sessionRecordingProperties = this.sessionReplay.getSessionReplayProperties();\n event.event_properties = {\n ...event.event_properties,\n ...sessionRecordingProperties,\n };\n }\n }\n\n if (event.event_type === SpecialEventType.IDENTIFY && event.event_properties) {\n delete event.event_properties[DEFAULT_SESSION_REPLAY_PROPERTY];\n }\n\n return Promise.resolve(event);\n } catch (error) {\n /* istanbul ignore next */\n this.config?.loggerProvider.error(`Session Replay: Failed to enrich event due to ${(error as Error).message}`);\n return Promise.resolve(event);\n }\n }\n\n async teardown(): Promise<void> {\n try {\n this.sessionReplay.shutdown();\n // the following are initialized in setup() which will always be called first\n // here we reset them to null to prevent memory leaks\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.config = null;\n } catch (error) {\n /* istanbul ignore next */\n this.config?.loggerProvider.error(`Session Replay: teardown failed due to ${(error as Error).message}`);\n }\n }\n\n getSessionReplayProperties() {\n return this.sessionReplay.getSessionReplayProperties();\n }\n\n /**\n * Start or resume session replay recording.\n * Recording still respects sample rate, targeting, opt-out, and remote capture flags.\n */\n async start() {\n await this.sessionReplay.start().promise;\n }\n\n /**\n * Stop session replay recording without removing the plugin.\n * Call {@link SessionReplayPlugin.start} to resume. Plugin teardown still uses shutdown.\n */\n stop() {\n this.sessionReplay.stop();\n }\n}\n\nexport const sessionReplayPlugin: (options?: SessionReplayOptions) => SessionReplayPlugin = (\n options?: SessionReplayOptions,\n) => {\n return new SessionReplayPlugin(options);\n};\n"]}
|
|
@@ -106,6 +106,10 @@ export interface SessionReplayOptions {
|
|
|
106
106
|
* @see {@link StandaloneSessionReplayOptions.shouldInlineStylesheet}
|
|
107
107
|
*/
|
|
108
108
|
shouldInlineStylesheet?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* @see {@link StandaloneSessionReplayOptions.inlineImages}
|
|
111
|
+
*/
|
|
112
|
+
inlineImages?: boolean;
|
|
109
113
|
/**
|
|
110
114
|
* @see {@link StandaloneSessionReplayOptions.performanceConfig}
|
|
111
115
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EACL,SAAS,EACT,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EAEpC,KAAK,oBAAoB,IAAI,8BAA8B,EAC5D,MAAM,mCAAmC,CAAC;AAE3C;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,WAAW,CAAC,8BAA8B,CAAC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;IACH,qCAAqC,CAAC,EAAE,OAAO,CAAC;IAEhD,iBAAiB,CAAC,EAAE,8BAA8B,CAAC;IAEnD;;;;;;;OAOG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;;;;OAKG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;OAEG;IACH,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;IAC9C;;OAEG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC;;OAEG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC;;OAEG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,8BAA8B,CAAC;IAClD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,+BAA+B,CAAC;CACrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"","sourcesContent":["import { Event } from '@amplitude/analytics-core';\nimport {\n StoreType,\n type SessionReplaySendEventsHandler,\n type SessionReplayFetchConfigHandler,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n type SessionReplayOptions as StandaloneSessionReplayOptions, // used for documentation\n} from '@amplitude/session-replay-browser';\n\n/**\n * Configuration for cross-origin iframe support.\n * Extracted from the standalone SDK's SessionReplayOptions.\n */\nexport type CrossOriginIframesConfig = NonNullable<StandaloneSessionReplayOptions['crossOriginIframes']>;\n\n/**\n * Configuration for rrweb event-split flush cadence.\n * Extracted from the standalone SDK's SessionReplayOptions.\n */\nexport type FlushIntervalConfig = NonNullable<StandaloneSessionReplayOptions['flushIntervalConfig']>;\n\nexport type MaskLevel =\n | 'light' // only mask a subset of inputs that’s deemed sensitive - password, credit card, telephone #, email. These are information we never want to capture.\n | 'medium' // mask all inputs\n | 'conservative'; // mask all inputs and all texts\n\nexport interface SessionReplayPrivacyConfig {\n blockSelector?: string | string[];\n defaultMaskLevel?: MaskLevel;\n maskSelector?: string[];\n unmaskSelector?: string[];\n}\n\n/**\n * Performance configuration for interaction tracking, specifically for CSS selector generation.\n */\nexport interface InteractionPerformanceConfig {\n /**\n * Maximum time in milliseconds allowed for CSS selector generation.\n * If selector generation takes longer than this, it will throw a timeout error.\n * Default: undefined (no timeout limit)\n */\n timeoutMs?: number;\n /**\n * Maximum number of attempts to optimize/simplify the CSS selector path.\n * Higher values may produce shorter selectors but take longer to compute.\n * Default: 10000\n */\n maxNumberOfTries?: number;\n /**\n * Maximum number of CSS selector combinations to test for uniqueness.\n * If more combinations would be generated, falls back to a simpler strategy.\n * Default: 1000\n */\n threshold?: number;\n}\n\nexport interface SessionReplayPerformanceConfig {\n enabled: boolean;\n timeout?: number;\n /**\n * If enabled, consecutive mutation events are merged into a single event before\n * compression. This reduces the stored event count and coalesces bursts of\n * inline `style` mutations on the same node (last-write-wins), without changing\n * replay semantics. Defaults to false.\n */\n mergeMutations?: boolean;\n /**\n * Performance configuration for interaction tracking (clicks, scrolls).\n */\n interaction?: InteractionPerformanceConfig;\n}\n\n/**\n * UGC filter rule.\n */\nexport type UGCFilterRule = {\n /**\n * The selector of the UGC element.\n */\n selector: string;\n /**\n * The replacement text for the UGC element.\n */\n replacement: string;\n};\n\nexport interface SessionReplayInteractionConfig {\n trackEveryNms?: number;\n enabled: boolean; // defaults to false\n batch: boolean; // defaults to false\n /**\n * UGC filter rules.\n */\n ugcFilterRules?: UGCFilterRule[];\n}\n\nexport interface SessionReplayOptions {\n /**\n * @see {@link StandaloneSessionReplayOptions.sampleRate}\n */\n sampleRate?: number;\n /**\n * @see {@link StandaloneSessionReplayOptions.privacyConfig}\n */\n privacyConfig?: SessionReplayPrivacyConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.debugMode}\n */\n debugMode?: boolean;\n /**\n * If this is enabled we will force the browser SDK to also send start and end session events.\n */\n forceSessionTracking?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.configServerUrl}\n */\n configServerUrl?: string;\n /**\n * @see {@link StandaloneSessionReplayOptions.trackServerUrl}\n */\n trackServerUrl?: string;\n /**\n * @see {@link StandaloneSessionReplayOptions.shouldInlineStylesheet}\n */\n shouldInlineStylesheet?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.performanceConfig}\n */\n performanceConfig?: SessionReplayPerformanceConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.storeType}\n */\n storeType?: StoreType;\n /**\n * If true, the SDK will compress replay events using a web worker.\n * This offloads compression to a separate thread, improving performance on the main thread.\n *\n * @defaultValue false\n */\n useWebWorker?: boolean;\n /**\n * Override the device ID for session replay.\n */\n deviceId?: string;\n /**\n * Dynamically overrides the session ID for replay. Ensure stability to avoid frequent restarts.\n * @param event Browser SDK event\n * @returns The session ID for the session replay.\n */\n customSessionId?: (event: Event) => string | undefined;\n /**\n * @deprecated Use `useWebWorker` instead. This will be removed in a future version.\n * @see {@link StandaloneSessionReplayOptions.useWebWorker}\n */\n experimental?: {\n useWebWorker: boolean;\n };\n /**\n * If true, applies a background color to blocked elements for visual masking. Defaults to false.\n */\n applyBackgroundColorToBlockedElements?: boolean;\n\n interactionConfig?: SessionReplayInteractionConfig;\n\n /**\n * Enables URL change polling as a fallback for SPA route tracking.\n * When enabled, the SDK will periodically check for URL changes every second\n * in addition to patching the History API. This is useful for edge cases where\n * route changes might bypass the standard History API methods.\n *\n * @defaultValue false\n */\n enableUrlChangePolling?: boolean;\n /**\n * Specifies the interval in milliseconds for URL change polling when enableUrlChangePolling is true.\n * The SDK will check for URL changes at this interval as a fallback for SPA route tracking.\n *\n * @defaultValue 1000\n */\n urlChangePollingInterval?: number;\n /**\n * Whether to capture document title in URL change events.\n * When disabled, the title field will be empty in URL change events.\n *\n * @defaultValue false\n */\n captureDocumentTitle?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.captureAdoptedStyleSheets}\n */\n captureAdoptedStyleSheets?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.crossOriginIframes}\n */\n crossOriginIframes?: CrossOriginIframesConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.flushIntervalConfig}\n */\n flushIntervalConfig?: FlushIntervalConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.eagerFullSnapshotSend}\n */\n eagerFullSnapshotSend?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.captureFullSnapshotOnFocus}\n */\n captureFullSnapshotOnFocus?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.maxPersistedEventsSizeBytes}\n */\n maxPersistedEventsSizeBytes?: number;\n /**\n * @see {@link StandaloneSessionReplayOptions.maxSingleEventSizeBytes}\n */\n maxSingleEventSizeBytes?: number;\n /**\n * @see {@link StandaloneSessionReplayOptions.sendTimeoutMs}\n */\n sendTimeoutMs?: number;\n /**\n * Optional custom transport for replay event uploads. Use to attach custom auth (e.g. a JWT\n * `Authorization` header) and route through an authenticated proxy.\n * @see {@link StandaloneSessionReplayOptions.handleSendEvents}\n */\n handleSendEvents?: SessionReplaySendEventsHandler;\n /**\n * Optional custom transport for the remote-config fetch.\n * @see {@link StandaloneSessionReplayOptions.handleFetchConfig}\n */\n handleFetchConfig?: SessionReplayFetchConfigHandler;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"","sourcesContent":["import { Event } from '@amplitude/analytics-core';\nimport {\n StoreType,\n type SessionReplaySendEventsHandler,\n type SessionReplayFetchConfigHandler,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n type SessionReplayOptions as StandaloneSessionReplayOptions, // used for documentation\n} from '@amplitude/session-replay-browser';\n\n/**\n * Configuration for cross-origin iframe support.\n * Extracted from the standalone SDK's SessionReplayOptions.\n */\nexport type CrossOriginIframesConfig = NonNullable<StandaloneSessionReplayOptions['crossOriginIframes']>;\n\n/**\n * Configuration for rrweb event-split flush cadence.\n * Extracted from the standalone SDK's SessionReplayOptions.\n */\nexport type FlushIntervalConfig = NonNullable<StandaloneSessionReplayOptions['flushIntervalConfig']>;\n\nexport type MaskLevel =\n | 'light' // only mask a subset of inputs that’s deemed sensitive - password, credit card, telephone #, email. These are information we never want to capture.\n | 'medium' // mask all inputs\n | 'conservative'; // mask all inputs and all texts\n\nexport interface SessionReplayPrivacyConfig {\n blockSelector?: string | string[];\n defaultMaskLevel?: MaskLevel;\n maskSelector?: string[];\n unmaskSelector?: string[];\n}\n\n/**\n * Performance configuration for interaction tracking, specifically for CSS selector generation.\n */\nexport interface InteractionPerformanceConfig {\n /**\n * Maximum time in milliseconds allowed for CSS selector generation.\n * If selector generation takes longer than this, it will throw a timeout error.\n * Default: undefined (no timeout limit)\n */\n timeoutMs?: number;\n /**\n * Maximum number of attempts to optimize/simplify the CSS selector path.\n * Higher values may produce shorter selectors but take longer to compute.\n * Default: 10000\n */\n maxNumberOfTries?: number;\n /**\n * Maximum number of CSS selector combinations to test for uniqueness.\n * If more combinations would be generated, falls back to a simpler strategy.\n * Default: 1000\n */\n threshold?: number;\n}\n\nexport interface SessionReplayPerformanceConfig {\n enabled: boolean;\n timeout?: number;\n /**\n * If enabled, consecutive mutation events are merged into a single event before\n * compression. This reduces the stored event count and coalesces bursts of\n * inline `style` mutations on the same node (last-write-wins), without changing\n * replay semantics. Defaults to false.\n */\n mergeMutations?: boolean;\n /**\n * Performance configuration for interaction tracking (clicks, scrolls).\n */\n interaction?: InteractionPerformanceConfig;\n}\n\n/**\n * UGC filter rule.\n */\nexport type UGCFilterRule = {\n /**\n * The selector of the UGC element.\n */\n selector: string;\n /**\n * The replacement text for the UGC element.\n */\n replacement: string;\n};\n\nexport interface SessionReplayInteractionConfig {\n trackEveryNms?: number;\n enabled: boolean; // defaults to false\n batch: boolean; // defaults to false\n /**\n * UGC filter rules.\n */\n ugcFilterRules?: UGCFilterRule[];\n}\n\nexport interface SessionReplayOptions {\n /**\n * @see {@link StandaloneSessionReplayOptions.sampleRate}\n */\n sampleRate?: number;\n /**\n * @see {@link StandaloneSessionReplayOptions.privacyConfig}\n */\n privacyConfig?: SessionReplayPrivacyConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.debugMode}\n */\n debugMode?: boolean;\n /**\n * If this is enabled we will force the browser SDK to also send start and end session events.\n */\n forceSessionTracking?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.configServerUrl}\n */\n configServerUrl?: string;\n /**\n * @see {@link StandaloneSessionReplayOptions.trackServerUrl}\n */\n trackServerUrl?: string;\n /**\n * @see {@link StandaloneSessionReplayOptions.shouldInlineStylesheet}\n */\n shouldInlineStylesheet?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.inlineImages}\n */\n inlineImages?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.performanceConfig}\n */\n performanceConfig?: SessionReplayPerformanceConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.storeType}\n */\n storeType?: StoreType;\n /**\n * If true, the SDK will compress replay events using a web worker.\n * This offloads compression to a separate thread, improving performance on the main thread.\n *\n * @defaultValue false\n */\n useWebWorker?: boolean;\n /**\n * Override the device ID for session replay.\n */\n deviceId?: string;\n /**\n * Dynamically overrides the session ID for replay. Ensure stability to avoid frequent restarts.\n * @param event Browser SDK event\n * @returns The session ID for the session replay.\n */\n customSessionId?: (event: Event) => string | undefined;\n /**\n * @deprecated Use `useWebWorker` instead. This will be removed in a future version.\n * @see {@link StandaloneSessionReplayOptions.useWebWorker}\n */\n experimental?: {\n useWebWorker: boolean;\n };\n /**\n * If true, applies a background color to blocked elements for visual masking. Defaults to false.\n */\n applyBackgroundColorToBlockedElements?: boolean;\n\n interactionConfig?: SessionReplayInteractionConfig;\n\n /**\n * Enables URL change polling as a fallback for SPA route tracking.\n * When enabled, the SDK will periodically check for URL changes every second\n * in addition to patching the History API. This is useful for edge cases where\n * route changes might bypass the standard History API methods.\n *\n * @defaultValue false\n */\n enableUrlChangePolling?: boolean;\n /**\n * Specifies the interval in milliseconds for URL change polling when enableUrlChangePolling is true.\n * The SDK will check for URL changes at this interval as a fallback for SPA route tracking.\n *\n * @defaultValue 1000\n */\n urlChangePollingInterval?: number;\n /**\n * Whether to capture document title in URL change events.\n * When disabled, the title field will be empty in URL change events.\n *\n * @defaultValue false\n */\n captureDocumentTitle?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.captureAdoptedStyleSheets}\n */\n captureAdoptedStyleSheets?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.crossOriginIframes}\n */\n crossOriginIframes?: CrossOriginIframesConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.flushIntervalConfig}\n */\n flushIntervalConfig?: FlushIntervalConfig;\n /**\n * @see {@link StandaloneSessionReplayOptions.eagerFullSnapshotSend}\n */\n eagerFullSnapshotSend?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.captureFullSnapshotOnFocus}\n */\n captureFullSnapshotOnFocus?: boolean;\n /**\n * @see {@link StandaloneSessionReplayOptions.maxPersistedEventsSizeBytes}\n */\n maxPersistedEventsSizeBytes?: number;\n /**\n * @see {@link StandaloneSessionReplayOptions.maxSingleEventSizeBytes}\n */\n maxSingleEventSizeBytes?: number;\n /**\n * @see {@link StandaloneSessionReplayOptions.sendTimeoutMs}\n */\n sendTimeoutMs?: number;\n /**\n * Optional custom transport for replay event uploads. Use to attach custom auth (e.g. a JWT\n * `Authorization` header) and route through an authenticated proxy.\n * @see {@link StandaloneSessionReplayOptions.handleSendEvents}\n */\n handleSendEvents?: SessionReplaySendEventsHandler;\n /**\n * Optional custom transport for the remote-config fetch.\n * @see {@link StandaloneSessionReplayOptions.handleFetchConfig}\n */\n handleFetchConfig?: SessionReplayFetchConfigHandler;\n}\n"]}
|
package/lib/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.35.1-video-analytics-2.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/esm/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,+BAA+B,CAAC"}
|
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,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,CAAC,IAAM,OAAO,GAAG,4BAA4B,CAAC","sourcesContent":["// Autogenerated by `pnpm version-file`. DO NOT EDIT\nexport const VERSION = '1.35.1-video-analytics-2.0';\n"]}
|