@amplitude/plugin-session-replay-browser 1.13.2 → 1.13.4
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/index.js +1 -0
- package/lib/cjs/index.js.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.js +1 -0
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +2 -1
- package/lib/cjs/version.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/amplitude-min.js +2 -1
- package/lib/scripts/amplitude-min.js.gz +0 -0
- package/lib/scripts/amplitude-min.js.map +1 -0
- package/lib/scripts/amplitude-min.umd.js +1 -1
- package/lib/scripts/amplitude-min.umd.js.gz +0 -0
- package/lib/scripts/version.d.ts +1 -1
- package/package.json +7 -7
package/lib/cjs/index.js
CHANGED
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAAsF;AAA7E,wGAAA,mBAAmB,OAAU;AAAE,qHAAA,mBAAmB,OAAA","sourcesContent":["export { sessionReplayPlugin as plugin, sessionReplayPlugin } from './session-replay';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":";;;;AACA,uFAAmE;AAEnE,qCAAoC;AAEpC;IASE,6BAAY,OAA8B;QAR1C,SAAI,GAAG,0CAA0C,CAAC;QAClD,SAAI,GAAG,Y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AAG,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,aAAa,CAAC,0BAA0B,EAAE,CAAC;IACpD,CAAC;IACH,0BAAC;AAAD,CAAC,AAnID,IAmIC;AAnIY,kDAAmB;AAqIzB,IAAM,mBAAmB,GAAyD,UACvF,OAA8B;IAE9B,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B","sourcesContent":["import { BrowserConfig, EnrichmentPlugin, Event } from '@amplitude/analytics-types';\nimport * as sessionReplay from '@amplitude/session-replay-browser';\nimport { SessionReplayOptions } from './typings/session-replay';\nimport { VERSION } from './version';\n\nexport class SessionReplayPlugin implements EnrichmentPlugin {\n name = '@amplitude/plugin-session-replay-browser';\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;\n options: SessionReplayOptions;\n\n constructor(options?: SessionReplayOptions) {\n this.options = { forceSessionTracking: false, ...options };\n }\n\n async setup(config: BrowserConfig) {\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\n await sessionReplay.init(config.apiKey, {\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,\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 experimental: this.options.experimental,\n }).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 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 !== sessionReplay.getSessionId()) {\n await sessionReplay.setSessionId(sessionId).promise;\n }\n\n const sessionRecordingProperties = 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 !== sessionReplay.getSessionId()) {\n await 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 const sessionRecordingProperties = sessionReplay.getSessionReplayProperties();\n event.event_properties = {\n ...event.event_properties,\n ...sessionRecordingProperties,\n };\n }\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 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 sessionReplay.getSessionReplayProperties();\n }\n}\n\nexport const sessionReplayPlugin: (options?: SessionReplayOptions) => EnrichmentPlugin = (\n options?: SessionReplayOptions,\n) => {\n return new SessionReplayPlugin(options);\n};\n"]}
|
package/lib/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.13.
|
|
1
|
+
export declare const VERSION = "1.13.4";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
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":"
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACvC,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// Autogenerated by `yarn version-file`. DO NOT EDIT\nexport const VERSION = '1.13.4';\n"]}
|
package/lib/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.13.
|
|
1
|
+
export declare const VERSION = "1.13.4";
|
|
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,QAAQ,CAAC","sourcesContent":["// Autogenerated by `yarn version-file`. DO NOT EDIT\nexport const VERSION = '1.13.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// Autogenerated by `yarn version-file`. DO NOT EDIT\nexport const VERSION = '1.13.4';\n"]}
|