@amplitude/plugin-session-replay-browser 1.7.0-srtargeting.2 → 1.7.1

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.
Files changed (50) hide show
  1. package/lib/cjs/constants.d.ts +0 -2
  2. package/lib/cjs/constants.d.ts.map +1 -1
  3. package/lib/cjs/constants.js +0 -12
  4. package/lib/cjs/constants.js.map +1 -1
  5. package/lib/cjs/session-replay.d.ts.map +1 -1
  6. package/lib/cjs/session-replay.js +9 -24
  7. package/lib/cjs/session-replay.js.map +1 -1
  8. package/lib/cjs/typings/session-replay.d.ts +5 -0
  9. package/lib/cjs/typings/session-replay.d.ts.map +1 -1
  10. package/lib/cjs/typings/session-replay.js.map +1 -1
  11. package/lib/cjs/version.d.ts +1 -1
  12. package/lib/cjs/version.d.ts.map +1 -1
  13. package/lib/cjs/version.js +1 -1
  14. package/lib/cjs/version.js.map +1 -1
  15. package/lib/esm/constants.d.ts +0 -2
  16. package/lib/esm/constants.d.ts.map +1 -1
  17. package/lib/esm/constants.js +0 -10
  18. package/lib/esm/constants.js.map +1 -1
  19. package/lib/esm/session-replay.d.ts.map +1 -1
  20. package/lib/esm/session-replay.js +9 -24
  21. package/lib/esm/session-replay.js.map +1 -1
  22. package/lib/esm/typings/session-replay.d.ts +5 -0
  23. package/lib/esm/typings/session-replay.d.ts.map +1 -1
  24. package/lib/esm/typings/session-replay.js.map +1 -1
  25. package/lib/esm/version.d.ts +1 -1
  26. package/lib/esm/version.d.ts.map +1 -1
  27. package/lib/esm/version.js +1 -1
  28. package/lib/esm/version.js.map +1 -1
  29. package/lib/scripts/amplitude-min.js +1 -1
  30. package/lib/scripts/amplitude-min.js.gz +0 -0
  31. package/lib/scripts/amplitude-min.umd.js +1 -1
  32. package/lib/scripts/amplitude-min.umd.js.gz +0 -0
  33. package/lib/scripts/constants.d.ts +0 -2
  34. package/lib/scripts/constants.d.ts.map +1 -1
  35. package/lib/scripts/session-replay.d.ts.map +1 -1
  36. package/lib/scripts/typings/session-replay.d.ts +5 -0
  37. package/lib/scripts/typings/session-replay.d.ts.map +1 -1
  38. package/lib/scripts/version.d.ts +1 -1
  39. package/lib/scripts/version.d.ts.map +1 -1
  40. package/package.json +3 -3
  41. package/lib/cjs/helpers.d.ts +0 -3
  42. package/lib/cjs/helpers.d.ts.map +0 -1
  43. package/lib/cjs/helpers.js +0 -20
  44. package/lib/cjs/helpers.js.map +0 -1
  45. package/lib/esm/helpers.d.ts +0 -3
  46. package/lib/esm/helpers.d.ts.map +0 -1
  47. package/lib/esm/helpers.js +0 -17
  48. package/lib/esm/helpers.js.map +0 -1
  49. package/lib/scripts/helpers.d.ts +0 -3
  50. package/lib/scripts/helpers.d.ts.map +0 -1
@@ -1,3 +1 @@
1
- import { IdentifyOperation } from '@amplitude/analytics-types';
2
- export declare const PROPERTY_ADD_OPERATIONS: IdentifyOperation[];
3
1
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,eAAO,MAAM,uBAAuB,qBAQnC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":""}
@@ -1,13 +1 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.PROPERTY_ADD_OPERATIONS = void 0;
3
- var analytics_types_1 = require("@amplitude/analytics-types");
4
- exports.PROPERTY_ADD_OPERATIONS = [
5
- analytics_types_1.IdentifyOperation.SET,
6
- analytics_types_1.IdentifyOperation.SET_ONCE,
7
- analytics_types_1.IdentifyOperation.ADD,
8
- analytics_types_1.IdentifyOperation.APPEND,
9
- analytics_types_1.IdentifyOperation.PREPEND,
10
- analytics_types_1.IdentifyOperation.POSTINSERT,
11
- analytics_types_1.IdentifyOperation.POSTINSERT,
12
- ];
13
1
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;AAAA,8DAA+D;AAElD,QAAA,uBAAuB,GAAG;IACrC,mCAAiB,CAAC,GAAG;IACrB,mCAAiB,CAAC,QAAQ;IAC1B,mCAAiB,CAAC,GAAG;IACrB,mCAAiB,CAAC,MAAM;IACxB,mCAAiB,CAAC,OAAO;IACzB,mCAAiB,CAAC,UAAU;IAC5B,mCAAiB,CAAC,UAAU;CAC7B,CAAC","sourcesContent":["import { IdentifyOperation } from '@amplitude/analytics-types';\n\nexport const PROPERTY_ADD_OPERATIONS = [\n IdentifyOperation.SET,\n IdentifyOperation.SET_ONCE,\n IdentifyOperation.ADD,\n IdentifyOperation.APPEND,\n IdentifyOperation.PREPEND,\n IdentifyOperation.POSTINSERT,\n IdentifyOperation.POSTINSERT,\n];\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"","sourcesContent":[""]}
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,EAAoB,MAAM,4BAA4B,CAAC;AAGtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,qBAAa,mBAAoB,YAAW,gBAAgB;IAC1D,IAAI,SAA8C;IAClD,IAAI,eAAyB;IAI7B,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,oBAAoB,CAAC;gBAElB,OAAO,CAAC,EAAE,oBAAoB;IAQpC,KAAK,CAAC,MAAM,EAAE,aAAa;IAkD3B,OAAO,CAAC,KAAK,EAAE,KAAK;IA4BpB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAS/B,0BAA0B;;;CAG3B;AAED,eAAO,MAAM,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE,oBAAoB,KAAK,gBAIrE,CAAC"}
1
+ {"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,qBAAa,mBAAoB,YAAW,gBAAgB;IAC1D,IAAI,SAA8C;IAClD,IAAI,eAAyB;IAI7B,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,oBAAoB,CAAC;gBAElB,OAAO,CAAC,EAAE,oBAAoB;IAQpC,KAAK,CAAC,MAAM,EAAE,aAAa;IA+C3B,OAAO,CAAC,KAAK,EAAE,KAAK;IAmBpB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAS/B,0BAA0B;;;CAG3B;AAED,eAAO,MAAM,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE,oBAAoB,KAAK,gBAIrE,CAAC"}
@@ -1,10 +1,7 @@
1
1
  Object.defineProperty(exports, "__esModule", { value: true });
2
2
  exports.sessionReplayPlugin = exports.SessionReplayPlugin = void 0;
3
3
  var tslib_1 = require("tslib");
4
- var analytics_client_common_1 = require("@amplitude/analytics-client-common");
5
- var analytics_types_1 = require("@amplitude/analytics-types");
6
4
  var sessionReplay = tslib_1.__importStar(require("@amplitude/session-replay-browser"));
7
- var helpers_1 = require("./helpers");
8
5
  var version_1 = require("./version");
9
6
  var SessionReplayPlugin = /** @class */ (function () {
10
7
  function SessionReplayPlugin(options) {
@@ -19,7 +16,6 @@ var SessionReplayPlugin = /** @class */ (function () {
19
16
  SessionReplayPlugin.prototype.setup = function (config) {
20
17
  var _a, _b, _c, _d;
21
18
  return tslib_1.__awaiter(this, void 0, void 0, function () {
22
- var identityStore, userProperties;
23
19
  return tslib_1.__generator(this, function (_e) {
24
20
  switch (_e.label) {
25
21
  case 0:
@@ -40,8 +36,6 @@ var SessionReplayPlugin = /** @class */ (function () {
40
36
  config.defaultTracking = tslib_1.__assign(tslib_1.__assign({}, config.defaultTracking), { sessions: true });
41
37
  }
42
38
  }
43
- identityStore = (0, analytics_client_common_1.getAnalyticsConnector)(this.config.instanceName).identityStore;
44
- userProperties = identityStore.getIdentity().userProperties;
45
39
  return [4 /*yield*/, sessionReplay.init(config.apiKey, {
46
40
  instanceName: this.config.instanceName,
47
41
  deviceId: this.config.deviceId,
@@ -62,7 +56,7 @@ var SessionReplayPlugin = /** @class */ (function () {
62
56
  configEndpointUrl: this.options.configEndpointUrl,
63
57
  shouldInlineStylesheet: this.options.shouldInlineStylesheet,
64
58
  version: { type: 'plugin', version: version_1.VERSION },
65
- userProperties: userProperties,
59
+ performanceConfig: this.options.performanceConfig,
66
60
  }).promise];
67
61
  case 1:
68
62
  _e.sent();
@@ -73,32 +67,23 @@ var SessionReplayPlugin = /** @class */ (function () {
73
67
  };
74
68
  SessionReplayPlugin.prototype.execute = function (event) {
75
69
  return tslib_1.__awaiter(this, void 0, void 0, function () {
76
- var identityStore, userProperties, userProperties, sessionRecordingProperties;
70
+ var sessionRecordingProperties;
77
71
  return tslib_1.__generator(this, function (_a) {
78
72
  switch (_a.label) {
79
73
  case 0:
80
74
  if (!(this.config.sessionId && this.config.sessionId !== sessionReplay.getSessionId())) return [3 /*break*/, 2];
81
- identityStore = (0, analytics_client_common_1.getAnalyticsConnector)(this.config.instanceName).identityStore;
82
- userProperties = identityStore.getIdentity().userProperties;
83
- return [4 /*yield*/, sessionReplay.setSessionId(this.config.sessionId, this.config.deviceId, {
84
- userProperties: userProperties || {},
85
- }).promise];
75
+ return [4 /*yield*/, sessionReplay.setSessionId(this.config.sessionId).promise];
86
76
  case 1:
87
77
  _a.sent();
88
78
  _a.label = 2;
89
79
  case 2:
90
- if (!(this.config.sessionId && this.config.sessionId === event.session_id)) return [3 /*break*/, 4];
91
- userProperties = void 0;
92
- if (event.event_type === analytics_types_1.SpecialEventType.IDENTIFY) {
93
- userProperties = (0, helpers_1.parseUserProperties)(event);
80
+ // Treating config.sessionId as source of truth, if the event's session id doesn't match, the
81
+ // event is not of the current session (offline/late events). In that case, don't tag the events
82
+ if (this.config.sessionId && this.config.sessionId === event.session_id) {
83
+ sessionRecordingProperties = sessionReplay.getSessionReplayProperties();
84
+ event.event_properties = tslib_1.__assign(tslib_1.__assign({}, event.event_properties), sessionRecordingProperties);
94
85
  }
95
- return [4 /*yield*/, sessionReplay.evaluateTargetingAndCapture({ event: event, userProperties: userProperties })];
96
- case 3:
97
- _a.sent();
98
- sessionRecordingProperties = sessionReplay.getSessionReplayProperties();
99
- event.event_properties = tslib_1.__assign(tslib_1.__assign({}, event.event_properties), sessionRecordingProperties);
100
- _a.label = 4;
101
- case 4: return [2 /*return*/, Promise.resolve(event)];
86
+ return [2 /*return*/, Promise.resolve(event)];
102
87
  }
103
88
  });
104
89
  });
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":";;;AAAA,8EAA2E;AAC3E,8DAAsG;AACtG,uFAAmE;AACnE,qCAAgD;AAEhD,qCAAoC;AAEpC;IASE,6BAAY,OAA8B;QAR1C,SAAI,GAAG,0CAA0C,CAAC;QAClD,SAAI,GAAG,YAAqB,CAAC;QAQ3B,IAAI,CAAC,OAAO,wBAAQ,OAAO,CAAE,CAAC;QAC9B,wFAAwF;QACxF,IAAI,IAAI,CAAC,OAAO,CAAC,oBAAoB,KAAK,KAAK,EAAE;YAC/C,IAAI,CAAC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;SAC1C;IACH,CAAC;IAEK,mCAAK,GAAX,UAAY,MAAqB;;;;;;;wBAC/B,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,+DAAwD,iBAAO,MAAG,CAAC,CAAC;wBAE9F,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;wBAErB,IAAI,IAAI,CAAC,OAAO,CAAC,oBAAo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,EAAC,KAAK,CAAC,CAAC;yBAC7C;wBACD,qBAAM,aAAa,CAAC,2BAA2B,CAAC,EAAE,KAAK,OAAA,EAAE,cAAc,gBAAA,EAAE,CAAC,EAAA;;wBAA1E,SAA0E,CAAC;wBACrE,0BAA0B,GAAG,aAAa,CAAC,0BAA0B,EAAE,CAAC;wBAC9E,KAAK,CAAC,gBAAgB,yCACjB,KAAK,CAAC,gBAAgB,GACtB,0BAA0B,CAC9B,CAAC;;4BAEJ,sBAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAC;;;;KAC/B;IAEK,sCAAQ,GAAd;;;gBACE,aAAa,CAAC,QAAQ,EAAE,CAAC;gBACzB,6EAA6E;gBAC7E,qDAAqD;gBACrD,6DAA6D;gBAC7D,aAAa;gBACb,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;;;;KACpB;IAED,wDAA0B,GAA1B;QACE,OAAO,aAAa,CAAC,0BAA0B,EAAE,CAAC;IACpD,CAAC;IACH,0BAAC;AAAD,CAAC,AA3GD,IA2GC;AA3GY,kDAAmB;AA6GzB,IAAM,mBAAmB,GAAyD,UACvF,OAA8B;IAE9B,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B","sourcesContent":["import { getAnalyticsConnector } from '@amplitude/analytics-client-common';\nimport { BrowserConfig, EnrichmentPlugin, Event, SpecialEventType } from '@amplitude/analytics-types';\nimport * as sessionReplay from '@amplitude/session-replay-browser';\nimport { parseUserProperties } from './helpers';\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 = { ...options };\n // The user did not explicitly configure forceSessionTracking to false, default to true.\n if (this.options.forceSessionTracking !== false) {\n this.options.forceSessionTracking = true;\n }\n }\n\n async setup(config: BrowserConfig) {\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 const identityStore = getAnalyticsConnector(this.config.instanceName).identityStore;\n const userProperties = identityStore.getIdentity().userProperties;\n\n await sessionReplay.init(config.apiKey, {\n instanceName: this.config.instanceName,\n deviceId: this.config.deviceId,\n optOut: this.config.optOut,\n sessionId: this.config.sessionId,\n loggerProvider: this.config.loggerProvider,\n logLevel: this.config.logLevel,\n flushMaxRetries: this.config.flushMaxRetries,\n serverZone: this.config.serverZone,\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 configEndpointUrl: this.options.configEndpointUrl,\n shouldInlineStylesheet: this.options.shouldInlineStylesheet,\n version: { type: 'plugin', version: VERSION },\n userProperties: userProperties,\n }).promise;\n }\n\n async execute(event: Event) {\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 if (this.config.sessionId && this.config.sessionId !== sessionReplay.getSessionId()) {\n const identityStore = getAnalyticsConnector(this.config.instanceName).identityStore;\n const userProperties = identityStore.getIdentity().userProperties;\n await sessionReplay.setSessionId(this.config.sessionId, this.config.deviceId, {\n userProperties: userProperties || {},\n }).promise;\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 (this.config.sessionId && this.config.sessionId === event.session_id) {\n let userProperties;\n if (event.event_type === SpecialEventType.IDENTIFY) {\n userProperties = parseUserProperties(event);\n }\n await sessionReplay.evaluateTargetingAndCapture({ event, userProperties });\n const sessionRecordingProperties = sessionReplay.getSessionReplayProperties();\n event.event_properties = {\n ...event.event_properties,\n ...sessionRecordingProperties,\n };\n }\n return Promise.resolve(event);\n }\n\n async teardown(): Promise<void> {\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 }\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"]}
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,YAAqB,CAAC;QAQ3B,IAAI,CAAC,OAAO,wBAAQ,OAAO,CAAE,CAAC;QAC9B,wFAAwF;QACxF,IAAI,IAAI,CAAC,OAAO,CAAC,oBAAoB,KAAK,KAAK,EAAE;YAC/C,IAAI,CAAC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;SAC1C;IACH,CAAC;IAEK,mCAAK,GAAX,UAAY,MAAqB;;;;;;wBAC/B,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,+DAAwD,iBAAO,MAAG,CAAC,CAAC;wBAE9F,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;wBAErB,IAAI,IAAI,CAAC,OAAO,CAAC,oBAAoB,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C,AA/FD,IA+FC;AA/FY,kDAAmB;AAiGzB,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 = { ...options };\n // The user did not explicitly configure forceSessionTracking to false, default to true.\n if (this.options.forceSessionTracking !== false) {\n this.options.forceSessionTracking = true;\n }\n }\n\n async setup(config: BrowserConfig) {\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.config.deviceId,\n optOut: this.config.optOut,\n sessionId: this.config.sessionId,\n loggerProvider: this.config.loggerProvider,\n logLevel: this.config.logLevel,\n flushMaxRetries: this.config.flushMaxRetries,\n serverZone: this.config.serverZone,\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 configEndpointUrl: this.options.configEndpointUrl,\n shouldInlineStylesheet: this.options.shouldInlineStylesheet,\n version: { type: 'plugin', version: VERSION },\n performanceConfig: this.options.performanceConfig,\n }).promise;\n }\n\n async execute(event: Event) {\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 if (this.config.sessionId && this.config.sessionId !== sessionReplay.getSessionId()) {\n await sessionReplay.setSessionId(this.config.sessionId).promise;\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 (this.config.sessionId && this.config.sessionId === event.session_id) {\n const sessionRecordingProperties = sessionReplay.getSessionReplayProperties();\n event.event_properties = {\n ...event.event_properties,\n ...sessionRecordingProperties,\n };\n }\n return Promise.resolve(event);\n }\n\n async teardown(): Promise<void> {\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 }\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"]}
@@ -5,6 +5,10 @@ export interface SessionReplayPrivacyConfig {
5
5
  maskSelector?: string[];
6
6
  unmaskSelector?: string[];
7
7
  }
8
+ export interface SessionReplayPerformanceConfig {
9
+ enabled: boolean;
10
+ timeout?: number;
11
+ }
8
12
  export interface SessionReplayOptions {
9
13
  sampleRate?: number;
10
14
  privacyConfig?: SessionReplayPrivacyConfig;
@@ -12,5 +16,6 @@ export interface SessionReplayOptions {
12
16
  forceSessionTracking?: boolean;
13
17
  configEndpointUrl?: string;
14
18
  shouldInlineStylesheet?: boolean;
19
+ performanceConfig?: SessionReplayPerformanceConfig;
15
20
  }
16
21
  //# sourceMappingURL=session-replay.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"AAAA,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,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AACD,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,0BAA0B,CAAC;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC"}
1
+ {"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"AAAA,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,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,0BAA0B,CAAC;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,iBAAiB,CAAC,EAAE,8BAA8B,CAAC;CACpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"","sourcesContent":["export 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}\nexport interface SessionReplayOptions {\n sampleRate?: number;\n privacyConfig?: SessionReplayPrivacyConfig;\n debugMode?: boolean;\n forceSessionTracking?: boolean;\n configEndpointUrl?: string;\n shouldInlineStylesheet?: boolean;\n}\n"]}
1
+ {"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"","sourcesContent":["export 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\nexport interface SessionReplayPerformanceConfig {\n enabled: boolean;\n timeout?: number;\n}\n\nexport interface SessionReplayOptions {\n sampleRate?: number;\n privacyConfig?: SessionReplayPrivacyConfig;\n debugMode?: boolean;\n forceSessionTracking?: boolean;\n configEndpointUrl?: string;\n shouldInlineStylesheet?: boolean;\n performanceConfig?: SessionReplayPerformanceConfig;\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.7.0-srtargeting.2";
1
+ export declare const VERSION = "1.7.1";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,wBAAwB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,UAAU,CAAC"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, "__esModule", { value: true });
2
2
  exports.VERSION = void 0;
3
3
  // Autogenerated by `yarn version-file`. DO NOT EDIT
4
- exports.VERSION = '1.7.0-srtargeting.2';
4
+ exports.VERSION = '1.7.1';
5
5
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;AAAA,oDAAoD;AACvC,QAAA,OAAO,GAAG,qBAAqB,CAAC","sourcesContent":["// Autogenerated by `yarn version-file`. DO NOT EDIT\nexport const VERSION = '1.7.0-srtargeting.2';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;AAAA,oDAAoD;AACvC,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// Autogenerated by `yarn version-file`. DO NOT EDIT\nexport const VERSION = '1.7.1';\n"]}
@@ -1,3 +1 @@
1
- import { IdentifyOperation } from '@amplitude/analytics-types';
2
- export declare const PROPERTY_ADD_OPERATIONS: IdentifyOperation[];
3
1
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,eAAO,MAAM,uBAAuB,qBAQnC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":""}
@@ -1,11 +1 @@
1
- import { IdentifyOperation } from '@amplitude/analytics-types';
2
- export var PROPERTY_ADD_OPERATIONS = [
3
- IdentifyOperation.SET,
4
- IdentifyOperation.SET_ONCE,
5
- IdentifyOperation.ADD,
6
- IdentifyOperation.APPEND,
7
- IdentifyOperation.PREPEND,
8
- IdentifyOperation.POSTINSERT,
9
- IdentifyOperation.POSTINSERT,
10
- ];
11
1
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,CAAC,IAAM,uBAAuB,GAAG;IACrC,iBAAiB,CAAC,GAAG;IACrB,iBAAiB,CAAC,QAAQ;IAC1B,iBAAiB,CAAC,GAAG;IACrB,iBAAiB,CAAC,MAAM;IACxB,iBAAiB,CAAC,OAAO;IACzB,iBAAiB,CAAC,UAAU;IAC5B,iBAAiB,CAAC,UAAU;CAC7B,CAAC","sourcesContent":["import { IdentifyOperation } from '@amplitude/analytics-types';\n\nexport const PROPERTY_ADD_OPERATIONS = [\n IdentifyOperation.SET,\n IdentifyOperation.SET_ONCE,\n IdentifyOperation.ADD,\n IdentifyOperation.APPEND,\n IdentifyOperation.PREPEND,\n IdentifyOperation.POSTINSERT,\n IdentifyOperation.POSTINSERT,\n];\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"","sourcesContent":[""]}
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,EAAoB,MAAM,4BAA4B,CAAC;AAGtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,qBAAa,mBAAoB,YAAW,gBAAgB;IAC1D,IAAI,SAA8C;IAClD,IAAI,eAAyB;IAI7B,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,oBAAoB,CAAC;gBAElB,OAAO,CAAC,EAAE,oBAAoB;IAQpC,KAAK,CAAC,MAAM,EAAE,aAAa;IAkD3B,OAAO,CAAC,KAAK,EAAE,KAAK;IA4BpB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAS/B,0BAA0B;;;CAG3B;AAED,eAAO,MAAM,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE,oBAAoB,KAAK,gBAIrE,CAAC"}
1
+ {"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,qBAAa,mBAAoB,YAAW,gBAAgB;IAC1D,IAAI,SAA8C;IAClD,IAAI,eAAyB;IAI7B,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,oBAAoB,CAAC;gBAElB,OAAO,CAAC,EAAE,oBAAoB;IAQpC,KAAK,CAAC,MAAM,EAAE,aAAa;IA+C3B,OAAO,CAAC,KAAK,EAAE,KAAK;IAmBpB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAS/B,0BAA0B;;;CAG3B;AAED,eAAO,MAAM,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE,oBAAoB,KAAK,gBAIrE,CAAC"}
@@ -1,8 +1,5 @@
1
1
  import { __assign, __awaiter, __generator } from "tslib";
2
- import { getAnalyticsConnector } from '@amplitude/analytics-client-common';
3
- import { SpecialEventType } from '@amplitude/analytics-types';
4
2
  import * as sessionReplay from '@amplitude/session-replay-browser';
5
- import { parseUserProperties } from './helpers';
6
3
  import { VERSION } from './version';
7
4
  var SessionReplayPlugin = /** @class */ (function () {
8
5
  function SessionReplayPlugin(options) {
@@ -17,7 +14,6 @@ var SessionReplayPlugin = /** @class */ (function () {
17
14
  SessionReplayPlugin.prototype.setup = function (config) {
18
15
  var _a, _b, _c, _d;
19
16
  return __awaiter(this, void 0, void 0, function () {
20
- var identityStore, userProperties;
21
17
  return __generator(this, function (_e) {
22
18
  switch (_e.label) {
23
19
  case 0:
@@ -38,8 +34,6 @@ var SessionReplayPlugin = /** @class */ (function () {
38
34
  config.defaultTracking = __assign(__assign({}, config.defaultTracking), { sessions: true });
39
35
  }
40
36
  }
41
- identityStore = getAnalyticsConnector(this.config.instanceName).identityStore;
42
- userProperties = identityStore.getIdentity().userProperties;
43
37
  return [4 /*yield*/, sessionReplay.init(config.apiKey, {
44
38
  instanceName: this.config.instanceName,
45
39
  deviceId: this.config.deviceId,
@@ -60,7 +54,7 @@ var SessionReplayPlugin = /** @class */ (function () {
60
54
  configEndpointUrl: this.options.configEndpointUrl,
61
55
  shouldInlineStylesheet: this.options.shouldInlineStylesheet,
62
56
  version: { type: 'plugin', version: VERSION },
63
- userProperties: userProperties,
57
+ performanceConfig: this.options.performanceConfig,
64
58
  }).promise];
65
59
  case 1:
66
60
  _e.sent();
@@ -71,32 +65,23 @@ var SessionReplayPlugin = /** @class */ (function () {
71
65
  };
72
66
  SessionReplayPlugin.prototype.execute = function (event) {
73
67
  return __awaiter(this, void 0, void 0, function () {
74
- var identityStore, userProperties, userProperties, sessionRecordingProperties;
68
+ var sessionRecordingProperties;
75
69
  return __generator(this, function (_a) {
76
70
  switch (_a.label) {
77
71
  case 0:
78
72
  if (!(this.config.sessionId && this.config.sessionId !== sessionReplay.getSessionId())) return [3 /*break*/, 2];
79
- identityStore = getAnalyticsConnector(this.config.instanceName).identityStore;
80
- userProperties = identityStore.getIdentity().userProperties;
81
- return [4 /*yield*/, sessionReplay.setSessionId(this.config.sessionId, this.config.deviceId, {
82
- userProperties: userProperties || {},
83
- }).promise];
73
+ return [4 /*yield*/, sessionReplay.setSessionId(this.config.sessionId).promise];
84
74
  case 1:
85
75
  _a.sent();
86
76
  _a.label = 2;
87
77
  case 2:
88
- if (!(this.config.sessionId && this.config.sessionId === event.session_id)) return [3 /*break*/, 4];
89
- userProperties = void 0;
90
- if (event.event_type === SpecialEventType.IDENTIFY) {
91
- userProperties = parseUserProperties(event);
78
+ // Treating config.sessionId as source of truth, if the event's session id doesn't match, the
79
+ // event is not of the current session (offline/late events). In that case, don't tag the events
80
+ if (this.config.sessionId && this.config.sessionId === event.session_id) {
81
+ sessionRecordingProperties = sessionReplay.getSessionReplayProperties();
82
+ event.event_properties = __assign(__assign({}, event.event_properties), sessionRecordingProperties);
92
83
  }
93
- return [4 /*yield*/, sessionReplay.evaluateTargetingAndCapture({ event: event, userProperties: userProperties })];
94
- case 3:
95
- _a.sent();
96
- sessionRecordingProperties = sessionReplay.getSessionReplayProperties();
97
- event.event_properties = __assign(__assign({}, event.event_properties), sessionRecordingProperties);
98
- _a.label = 4;
99
- case 4: return [2 /*return*/, Promise.resolve(event)];
84
+ return [2 /*return*/, Promise.resolve(event)];
100
85
  }
101
86
  });
102
87
  });
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAA0C,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,KAAK,aAAa,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;IASE,6BAAY,OAA8B;QAR1C,SAAI,GAAG,0CAA0C,CAAC;QAClD,SAAI,GAAG,YAAqB,CAAC;QAQ3B,IAAI,CAAC,OAAO,gBAAQ,OAAO,CAAE,CAAC;QAC9B,wFAAwF;QACxF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AAE,cAAc,IAAI,EAAE;6BACrC,CAAC,CAAC,OAAO,EAAA;;wBAFV,SAEU,CAAC;;;6BAIT,CAAA,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,KAAK,KAAK,CAAC,UAAU,CAAA,EAAnE,wBAAmE;wBACjE,cAAc,SAAA,CAAC;wBACnB,IAAI,KAAK,CAAC,UAAU,KAAK,gBAAgB,CAAC,QAAQ,EAAE;4BAClD,cAAc,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;yBAC7C;wBACD,qBAAM,aAAa,CAAC,2BAA2B,CAAC,EAAE,KAAK,OAAA,EAAE,cAAc,gBAAA,EAAE,CAAC,EAAA;;wBAA1E,SAA0E,CAAC;wBACrE,0BAA0B,GAAG,aAAa,CAAC,0BAA0B,EAAE,CAAC;wBAC9E,KAAK,CAAC,gBAAgB,yBACjB,KAAK,CAAC,gBAAgB,GACtB,0BAA0B,CAC9B,CAAC;;4BAEJ,sBAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAC;;;;KAC/B;IAEK,sCAAQ,GAAd;;;gBACE,aAAa,CAAC,QAAQ,EAAE,CAAC;gBACzB,6EAA6E;gBAC7E,qDAAqD;gBACrD,6DAA6D;gBAC7D,aAAa;gBACb,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;;;;KACpB;IAED,wDAA0B,GAA1B;QACE,OAAO,aAAa,CAAC,0BAA0B,EAAE,CAAC;IACpD,CAAC;IACH,0BAAC;AAAD,CAAC,AA3GD,IA2GC;;AAED,MAAM,CAAC,IAAM,mBAAmB,GAAyD,UACvF,OAA8B;IAE9B,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC,CAAC","sourcesContent":["import { getAnalyticsConnector } from '@amplitude/analytics-client-common';\nimport { BrowserConfig, EnrichmentPlugin, Event, SpecialEventType } from '@amplitude/analytics-types';\nimport * as sessionReplay from '@amplitude/session-replay-browser';\nimport { parseUserProperties } from './helpers';\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 = { ...options };\n // The user did not explicitly configure forceSessionTracking to false, default to true.\n if (this.options.forceSessionTracking !== false) {\n this.options.forceSessionTracking = true;\n }\n }\n\n async setup(config: BrowserConfig) {\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 const identityStore = getAnalyticsConnector(this.config.instanceName).identityStore;\n const userProperties = identityStore.getIdentity().userProperties;\n\n await sessionReplay.init(config.apiKey, {\n instanceName: this.config.instanceName,\n deviceId: this.config.deviceId,\n optOut: this.config.optOut,\n sessionId: this.config.sessionId,\n loggerProvider: this.config.loggerProvider,\n logLevel: this.config.logLevel,\n flushMaxRetries: this.config.flushMaxRetries,\n serverZone: this.config.serverZone,\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 configEndpointUrl: this.options.configEndpointUrl,\n shouldInlineStylesheet: this.options.shouldInlineStylesheet,\n version: { type: 'plugin', version: VERSION },\n userProperties: userProperties,\n }).promise;\n }\n\n async execute(event: Event) {\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 if (this.config.sessionId && this.config.sessionId !== sessionReplay.getSessionId()) {\n const identityStore = getAnalyticsConnector(this.config.instanceName).identityStore;\n const userProperties = identityStore.getIdentity().userProperties;\n await sessionReplay.setSessionId(this.config.sessionId, this.config.deviceId, {\n userProperties: userProperties || {},\n }).promise;\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 (this.config.sessionId && this.config.sessionId === event.session_id) {\n let userProperties;\n if (event.event_type === SpecialEventType.IDENTIFY) {\n userProperties = parseUserProperties(event);\n }\n await sessionReplay.evaluateTargetingAndCapture({ event, userProperties });\n const sessionRecordingProperties = sessionReplay.getSessionReplayProperties();\n event.event_properties = {\n ...event.event_properties,\n ...sessionRecordingProperties,\n };\n }\n return Promise.resolve(event);\n }\n\n async teardown(): Promise<void> {\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 }\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"]}
1
+ {"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,aAAa,MAAM,mCAAmC,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;IASE,6BAAY,OAA8B;QAR1C,SAAI,GAAG,0CAA0C,CAAC;QAClD,SAAI,GAAG,YAAqB,CAAC;QAQ3B,IAAI,CAAC,OAAO,gBAAQ,OAAO,CAAE,CAAC;QAC9B,wFAAwF;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BACH;wBACD,sBAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAC;;;;KAC/B;IAEK,sCAAQ,GAAd;;;gBACE,aAAa,CAAC,QAAQ,EAAE,CAAC;gBACzB,6EAA6E;gBAC7E,qDAAqD;gBACrD,6DAA6D;gBAC7D,aAAa;gBACb,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;;;;KACpB;IAED,wDAA0B,GAA1B;QACE,OAAO,aAAa,CAAC,0BAA0B,EAAE,CAAC;IACpD,CAAC;IACH,0BAAC;AAAD,CAAC,AA/FD,IA+FC;;AAED,MAAM,CAAC,IAAM,mBAAmB,GAAyD,UACvF,OAA8B;IAE9B,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC,CAAC","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 = { ...options };\n // The user did not explicitly configure forceSessionTracking to false, default to true.\n if (this.options.forceSessionTracking !== false) {\n this.options.forceSessionTracking = true;\n }\n }\n\n async setup(config: BrowserConfig) {\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.config.deviceId,\n optOut: this.config.optOut,\n sessionId: this.config.sessionId,\n loggerProvider: this.config.loggerProvider,\n logLevel: this.config.logLevel,\n flushMaxRetries: this.config.flushMaxRetries,\n serverZone: this.config.serverZone,\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 configEndpointUrl: this.options.configEndpointUrl,\n shouldInlineStylesheet: this.options.shouldInlineStylesheet,\n version: { type: 'plugin', version: VERSION },\n performanceConfig: this.options.performanceConfig,\n }).promise;\n }\n\n async execute(event: Event) {\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 if (this.config.sessionId && this.config.sessionId !== sessionReplay.getSessionId()) {\n await sessionReplay.setSessionId(this.config.sessionId).promise;\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 (this.config.sessionId && this.config.sessionId === event.session_id) {\n const sessionRecordingProperties = sessionReplay.getSessionReplayProperties();\n event.event_properties = {\n ...event.event_properties,\n ...sessionRecordingProperties,\n };\n }\n return Promise.resolve(event);\n }\n\n async teardown(): Promise<void> {\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 }\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"]}
@@ -5,6 +5,10 @@ export interface SessionReplayPrivacyConfig {
5
5
  maskSelector?: string[];
6
6
  unmaskSelector?: string[];
7
7
  }
8
+ export interface SessionReplayPerformanceConfig {
9
+ enabled: boolean;
10
+ timeout?: number;
11
+ }
8
12
  export interface SessionReplayOptions {
9
13
  sampleRate?: number;
10
14
  privacyConfig?: SessionReplayPrivacyConfig;
@@ -12,5 +16,6 @@ export interface SessionReplayOptions {
12
16
  forceSessionTracking?: boolean;
13
17
  configEndpointUrl?: string;
14
18
  shouldInlineStylesheet?: boolean;
19
+ performanceConfig?: SessionReplayPerformanceConfig;
15
20
  }
16
21
  //# sourceMappingURL=session-replay.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"AAAA,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,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AACD,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,0BAA0B,CAAC;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC"}
1
+ {"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"AAAA,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,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,0BAA0B,CAAC;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,iBAAiB,CAAC,EAAE,8BAA8B,CAAC;CACpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"","sourcesContent":["export 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}\nexport interface SessionReplayOptions {\n sampleRate?: number;\n privacyConfig?: SessionReplayPrivacyConfig;\n debugMode?: boolean;\n forceSessionTracking?: boolean;\n configEndpointUrl?: string;\n shouldInlineStylesheet?: boolean;\n}\n"]}
1
+ {"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"","sourcesContent":["export 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\nexport interface SessionReplayPerformanceConfig {\n enabled: boolean;\n timeout?: number;\n}\n\nexport interface SessionReplayOptions {\n sampleRate?: number;\n privacyConfig?: SessionReplayPrivacyConfig;\n debugMode?: boolean;\n forceSessionTracking?: boolean;\n configEndpointUrl?: string;\n shouldInlineStylesheet?: boolean;\n performanceConfig?: SessionReplayPerformanceConfig;\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.7.0-srtargeting.2";
1
+ export declare const VERSION = "1.7.1";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,wBAAwB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,UAAU,CAAC"}
@@ -1,3 +1,3 @@
1
1
  // Autogenerated by `yarn version-file`. DO NOT EDIT
2
- export var VERSION = '1.7.0-srtargeting.2';
2
+ export var VERSION = '1.7.1';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,CAAC,IAAM,OAAO,GAAG,qBAAqB,CAAC","sourcesContent":["// Autogenerated by `yarn version-file`. DO NOT EDIT\nexport const VERSION = '1.7.0-srtargeting.2';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// Autogenerated by `yarn version-file`. DO NOT EDIT\nexport const VERSION = '1.7.1';\n"]}