@amplitude/plugin-session-replay-browser 0.6.6 → 0.6.8

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 (56) hide show
  1. package/README.md +5 -5
  2. package/lib/cjs/constants.d.ts +0 -15
  3. package/lib/cjs/constants.d.ts.map +1 -1
  4. package/lib/cjs/constants.js +1 -20
  5. package/lib/cjs/constants.js.map +1 -1
  6. package/lib/cjs/session-replay.d.ts +13 -2
  7. package/lib/cjs/session-replay.d.ts.map +1 -1
  8. package/lib/cjs/session-replay.js +28 -483
  9. package/lib/cjs/session-replay.js.map +1 -1
  10. package/lib/cjs/typings/session-replay.d.ts +0 -67
  11. package/lib/cjs/typings/session-replay.d.ts.map +1 -1
  12. package/lib/cjs/typings/session-replay.js +0 -6
  13. package/lib/cjs/typings/session-replay.js.map +1 -1
  14. package/lib/esm/constants.d.ts +0 -15
  15. package/lib/esm/constants.d.ts.map +1 -1
  16. package/lib/esm/constants.js +0 -19
  17. package/lib/esm/constants.js.map +1 -1
  18. package/lib/esm/session-replay.d.ts +13 -2
  19. package/lib/esm/session-replay.d.ts.map +1 -1
  20. package/lib/esm/session-replay.js +29 -484
  21. package/lib/esm/session-replay.js.map +1 -1
  22. package/lib/esm/typings/session-replay.d.ts +0 -67
  23. package/lib/esm/typings/session-replay.d.ts.map +1 -1
  24. package/lib/esm/typings/session-replay.js +1 -5
  25. package/lib/esm/typings/session-replay.js.map +1 -1
  26. package/lib/scripts/amplitude-min.js +1 -1
  27. package/lib/scripts/amplitude-min.js.gz +0 -0
  28. package/lib/scripts/amplitude-min.umd.js +1 -1
  29. package/lib/scripts/amplitude-min.umd.js.gz +0 -0
  30. package/lib/scripts/constants.d.ts +0 -15
  31. package/lib/scripts/constants.d.ts.map +1 -1
  32. package/lib/scripts/session-replay.d.ts +13 -2
  33. package/lib/scripts/session-replay.d.ts.map +1 -1
  34. package/lib/scripts/typings/session-replay.d.ts +0 -67
  35. package/lib/scripts/typings/session-replay.d.ts.map +1 -1
  36. package/package.json +3 -2
  37. package/lib/cjs/helpers.d.ts +0 -4
  38. package/lib/cjs/helpers.d.ts.map +0 -1
  39. package/lib/cjs/helpers.js +0 -32
  40. package/lib/cjs/helpers.js.map +0 -1
  41. package/lib/cjs/messages.d.ts +0 -5
  42. package/lib/cjs/messages.d.ts.map +0 -1
  43. package/lib/cjs/messages.js +0 -10
  44. package/lib/cjs/messages.js.map +0 -1
  45. package/lib/esm/helpers.d.ts +0 -4
  46. package/lib/esm/helpers.d.ts.map +0 -1
  47. package/lib/esm/helpers.js +0 -27
  48. package/lib/esm/helpers.js.map +0 -1
  49. package/lib/esm/messages.d.ts +0 -5
  50. package/lib/esm/messages.d.ts.map +0 -1
  51. package/lib/esm/messages.js +0 -7
  52. package/lib/esm/messages.js.map +0 -1
  53. package/lib/scripts/helpers.d.ts +0 -4
  54. package/lib/scripts/helpers.d.ts.map +0 -1
  55. package/lib/scripts/messages.d.ts +0 -5
  56. package/lib/scripts/messages.d.ts.map +0 -1
package/README.md CHANGED
@@ -53,7 +53,7 @@ const sessionReplayTracking = sessionReplayPlugin({
53
53
 
54
54
  |Name|Type|Default|Description|
55
55
  |-|-|-|-|
56
- |`sampleRate`|`number`|`undefined`|Use this option to control how many sessions will be selected for recording. A selected session will be recorded, while sessions that are not selected will not be recorded. <br></br>The number should be a decimal between 0 and 1, ie `0.4`, representing the fraction of sessions you would like to have randomly selected for recording. Over a large number of sessions, `0.4` would select `40%` of those sessions.|
56
+ |`sampleRate`|`number`|`undefined`|Use this option to control how many sessions will be selected for replay collection. A selected session will be collected for replay, while sessions that are not selected will not. <br></br>The number should be a decimal between 0 and 1, ie `0.4`, representing the fraction of sessions you would like to have randomly selected for replay collection. Over a large number of sessions, `0.4` would select `40%` of those sessions.|
57
57
 
58
58
  ### 3. Install plugin to Amplitude SDK
59
59
 
@@ -62,13 +62,13 @@ amplitude.add(sessionReplayTracking);
62
62
  ```
63
63
 
64
64
  ## Privacy
65
- By default, the session recording will mask all inputs, meaning the text in inputs will appear in a session replay as asterisks: `***`. You may require more specific masking controls based on your use case, so we offer the following controls:
65
+ By default, the session replay will mask all inputs, meaning the text in inputs will appear in a session replay as asterisks: `***`. You may require more specific masking controls based on your use case, so we offer the following controls:
66
66
 
67
67
  #### 1. Unmask inputs
68
- In your application code, add the class `.amp-unmask` to any __input__ whose text you'd like to have unmasked in the recording. In the replay of a recorded session, it will be possible to read the exact text entered into an input with this class, the text will not be converted to asterisks.
68
+ In your application code, add the class `.amp-unmask` to any __input__ whose text you'd like to have unmasked in the replay. In the session replay, it will be possible to read the exact text entered into an input with this class, the text will not be converted to asterisks.
69
69
 
70
70
  #### 2. Mask non-input elements
71
- In your application code, add the class `.amp-mask` to any __non-input element__ whose text you'd like to have masked from the recording. The text in the element, as well as it's children, will all be converted to asterisks.
71
+ In your application code, add the class `.amp-mask` to any __non-input element__ whose text you'd like to have masked from the replay. The text in the element, as well as it's children, will all be converted to asterisks.
72
72
 
73
73
  #### 3. Block non-text elements
74
- In your application code, add the class `.amp-block` to any element you would like to have blocked from the recording. The element will appear in the replay as a placeholder with the same dimensions.
74
+ In your application code, add the class `.amp-block` to any element you would like to have blocked from the collection of the replay. The element will appear in the replay as a placeholder with the same dimensions.
@@ -1,17 +1,2 @@
1
- import { IDBStoreSession } from './typings/session-replay';
2
- export declare const DEFAULT_EVENT_PROPERTY_PREFIX = "[Amplitude]";
3
- export declare const DEFAULT_SESSION_REPLAY_PROPERTY: string;
4
1
  export declare const DEFAULT_SESSION_START_EVENT = "session_start";
5
- export declare const DEFAULT_SESSION_END_EVENT = "session_end";
6
- export declare const BLOCK_CLASS = "amp-block";
7
- export declare const MASK_TEXT_CLASS = "amp-mask";
8
- export declare const UNMASK_TEXT_CLASS = "amp-unmask";
9
- export declare const SESSION_REPLAY_SERVER_URL = "https://api-secure.amplitude.com/sessions/track";
10
- export declare const SESSION_REPLAY_EU_URL = "https://api.eu.amplitude.com/sessions/track";
11
- export declare const STORAGE_PREFIX: string;
12
- export declare const MAX_EVENT_LIST_SIZE_IN_BYTES: number;
13
- export declare const MIN_INTERVAL = 500;
14
- export declare const MAX_INTERVAL: number;
15
- export declare const defaultSessionStore: IDBStoreSession;
16
- export declare const MAX_IDB_STORAGE_LENGTH: number;
17
2
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,eAAO,MAAM,6BAA6B,gBAAgB,CAAC;AAE3D,eAAO,MAAM,+BAA+B,QAAsD,CAAC;AACnG,eAAO,MAAM,2BAA2B,kBAAkB,CAAC;AAC3D,eAAO,MAAM,yBAAyB,gBAAgB,CAAC;AAEvD,eAAO,MAAM,WAAW,cAAc,CAAC;AACvC,eAAO,MAAM,eAAe,aAAa,CAAC;AAC1C,eAAO,MAAM,iBAAiB,eAAe,CAAC;AAC9C,eAAO,MAAM,yBAAyB,oDAAoD,CAAC;AAC3F,eAAO,MAAM,qBAAqB,gDAAgD,CAAC;AACnF,eAAO,MAAM,cAAc,QAAsC,CAAC;AAElE,eAAO,MAAM,4BAA4B,QAAgE,CAAC;AAC1G,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,YAAY,QAAY,CAAC;AACtC,eAAO,MAAM,mBAAmB,EAAE,eAGjC,CAAC;AACF,eAAO,MAAM,sBAAsB,QAA0B,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,kBAAkB,CAAC"}
@@ -1,23 +1,4 @@
1
1
  Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.MAX_IDB_STORAGE_LENGTH = exports.defaultSessionStore = exports.MAX_INTERVAL = exports.MIN_INTERVAL = exports.MAX_EVENT_LIST_SIZE_IN_BYTES = exports.STORAGE_PREFIX = exports.SESSION_REPLAY_EU_URL = exports.SESSION_REPLAY_SERVER_URL = exports.UNMASK_TEXT_CLASS = exports.MASK_TEXT_CLASS = exports.BLOCK_CLASS = exports.DEFAULT_SESSION_END_EVENT = exports.DEFAULT_SESSION_START_EVENT = exports.DEFAULT_SESSION_REPLAY_PROPERTY = exports.DEFAULT_EVENT_PROPERTY_PREFIX = void 0;
3
- var analytics_core_1 = require("@amplitude/analytics-core");
4
- exports.DEFAULT_EVENT_PROPERTY_PREFIX = '[Amplitude]';
5
- exports.DEFAULT_SESSION_REPLAY_PROPERTY = "".concat(exports.DEFAULT_EVENT_PROPERTY_PREFIX, " Session Recorded");
2
+ exports.DEFAULT_SESSION_START_EVENT = void 0;
6
3
  exports.DEFAULT_SESSION_START_EVENT = 'session_start';
7
- exports.DEFAULT_SESSION_END_EVENT = 'session_end';
8
- exports.BLOCK_CLASS = 'amp-block';
9
- exports.MASK_TEXT_CLASS = 'amp-mask';
10
- exports.UNMASK_TEXT_CLASS = 'amp-unmask';
11
- exports.SESSION_REPLAY_SERVER_URL = 'https://api-secure.amplitude.com/sessions/track';
12
- exports.SESSION_REPLAY_EU_URL = 'https://api.eu.amplitude.com/sessions/track';
13
- exports.STORAGE_PREFIX = "".concat(analytics_core_1.AMPLITUDE_PREFIX, "_replay_unsent");
14
- var PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS = 500; // derived by JSON stringifying an example payload without events
15
- exports.MAX_EVENT_LIST_SIZE_IN_BYTES = 10 * 1000000 - PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS;
16
- exports.MIN_INTERVAL = 500; // 500 ms
17
- exports.MAX_INTERVAL = 10 * 1000; // 10 seconds
18
- exports.defaultSessionStore = {
19
- currentSequenceId: 0,
20
- sessionSequences: {},
21
- };
22
- exports.MAX_IDB_STORAGE_LENGTH = 1000 * 60 * 60 * 24 * 3; // 3 days
23
4
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;AAAA,4DAA6D;AAGhD,QAAA,6BAA6B,GAAG,aAAa,CAAC;AAE9C,QAAA,+BAA+B,GAAG,UAAG,qCAA6B,sBAAmB,CAAC;AACtF,QAAA,2BAA2B,GAAG,eAAe,CAAC;AAC9C,QAAA,yBAAyB,GAAG,aAAa,CAAC;AAE1C,QAAA,WAAW,GAAG,WAAW,CAAC;AAC1B,QAAA,eAAe,GAAG,UAAU,CAAC;AAC7B,QAAA,iBAAiB,GAAG,YAAY,CAAC;AACjC,QAAA,yBAAyB,GAAG,iDAAiD,CAAC;AAC9E,QAAA,qBAAqB,GAAG,6CAA6C,CAAC;AACtE,QAAA,cAAc,GAAG,UAAG,iCAAgB,mBAAgB,CAAC;AAClE,IAAM,8CAA8C,GAAG,GAAG,CAAC,CAAC,iEAAiE;AAChH,QAAA,4BAA4B,GAAG,EAAE,GAAG,OAAO,GAAG,8CAA8C,CAAC;AAC7F,QAAA,YAAY,GAAG,GAAG,CAAC,CAAC,SAAS;AAC7B,QAAA,YAAY,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AACvC,QAAA,mBAAmB,GAAoB;IAClD,iBAAiB,EAAE,CAAC;IACpB,gBAAgB,EAAE,EAAE;CACrB,CAAC;AACW,QAAA,sBAAsB,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,SAAS","sourcesContent":["import { AMPLITUDE_PREFIX } from '@amplitude/analytics-core';\nimport { IDBStoreSession } from './typings/session-replay';\n\nexport const DEFAULT_EVENT_PROPERTY_PREFIX = '[Amplitude]';\n\nexport const DEFAULT_SESSION_REPLAY_PROPERTY = `${DEFAULT_EVENT_PROPERTY_PREFIX} Session Recorded`;\nexport const DEFAULT_SESSION_START_EVENT = 'session_start';\nexport const DEFAULT_SESSION_END_EVENT = 'session_end';\n\nexport const BLOCK_CLASS = 'amp-block';\nexport const MASK_TEXT_CLASS = 'amp-mask';\nexport const UNMASK_TEXT_CLASS = 'amp-unmask';\nexport const SESSION_REPLAY_SERVER_URL = 'https://api-secure.amplitude.com/sessions/track';\nexport const SESSION_REPLAY_EU_URL = 'https://api.eu.amplitude.com/sessions/track';\nexport const STORAGE_PREFIX = `${AMPLITUDE_PREFIX}_replay_unsent`;\nconst PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS = 500; // derived by JSON stringifying an example payload without events\nexport const MAX_EVENT_LIST_SIZE_IN_BYTES = 10 * 1000000 - PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS;\nexport const MIN_INTERVAL = 500; // 500 ms\nexport const MAX_INTERVAL = 10 * 1000; // 10 seconds\nexport const defaultSessionStore: IDBStoreSession = {\n currentSequenceId: 0,\n sessionSequences: {},\n};\nexport const MAX_IDB_STORAGE_LENGTH = 1000 * 60 * 60 * 24 * 3; // 3 days\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;AAAa,QAAA,2BAA2B,GAAG,eAAe,CAAC","sourcesContent":["export const DEFAULT_SESSION_START_EVENT = 'session_start';\n"]}
@@ -1,3 +1,14 @@
1
- import { SessionReplayPlugin } from './typings/session-replay';
2
- export declare const sessionReplayPlugin: SessionReplayPlugin;
1
+ import { BrowserConfig, EnrichmentPlugin, Event } from '@amplitude/analytics-types';
2
+ import { SessionReplayOptions } from './typings/session-replay';
3
+ export declare class SessionReplayPlugin implements EnrichmentPlugin {
4
+ name: string;
5
+ type: "enrichment";
6
+ config: BrowserConfig;
7
+ options: SessionReplayOptions;
8
+ constructor(options?: SessionReplayOptions);
9
+ setup(config: BrowserConfig): Promise<void>;
10
+ execute(event: Event): Promise<Event>;
11
+ teardown(): Promise<void>;
12
+ }
13
+ export declare const sessionReplayPlugin: (options?: SessionReplayOptions) => EnrichmentPlugin;
3
14
  //# sourceMappingURL=session-replay.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AAsBA,OAAO,EAQL,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AA4clC,eAAO,MAAM,mBAAmB,EAAE,mBAEjC,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;AAGpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,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;IAIpC,KAAK,CAAC,MAAM,EAAE,aAAa;IAkC3B,OAAO,CAAC,KAAK,EAAE,KAAK;IAcpB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC;AAED,eAAO,MAAM,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE,oBAAoB,KAAK,gBAIrE,CAAC"}