@amplitude/session-replay-browser 1.20.1 → 1.20.2

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 CHANGED
@@ -81,12 +81,19 @@ sessionReplay.shutdown()
81
81
  |`sessionId`|`number`|Yes|`undefined`|Sets an identifier for the users current session. The value must be in milliseconds since epoch (Unix Timestamp).|
82
82
  |`sampleRate`|`number`|No|`0`|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.01`, representing the fraction of sessions you would like to have randomly selected for replay collection. Over a large number of sessions, `0.01` would select `1%` of those sessions.|
83
83
  |`optOut`|`boolean`|No|`false`|Sets permission to collect replays for sessions. Setting a value of true prevents Amplitude from collecting session replays.|
84
- |`flushMaxRetries`|`number`|No|`5`|Sets the maximum number of retries for failed upload attempts. This is only applicable to retryable errors.|
84
+ |`flushMaxRetries`|`number`|No|`2`|Sets the maximum number of retries for failed upload attempts. This is only applicable to retryable errors.|
85
85
  |`logLevel`|`number`|No|`LogLevel.Warn`|`LogLevel.None` or `LogLevel.Error` or `LogLevel.Warn` or `LogLevel.Verbose` or `LogLevel.Debug`. Sets the log level.|
86
86
  |`loggerProvider`|`Logger`|No|`Logger`|Sets a custom loggerProvider class from the Logger to emit log messages to desired destination.|
87
87
  |`serverZone`|`string`|No|`US`|EU or US. Sets the Amplitude server zone. Set this to EU for Amplitude projects created in EU data center.|
88
- |`privacyConfig`|`object`|No|`undefined`| Supports advanced masking configs with CSS selectors.|
89
- |`debugMode`|`boolean`|No|`false`| Adds additional debug event property to help debug instrumentation issues (such as mismatching apps). Only recommended for debugging initial setup, and not recommended for production.|
88
+ |`privacyConfig`|`object`|No|`undefined`|Supports advanced masking configs with CSS selectors.|
89
+ |`debugMode`|`boolean`|No|`false`|Adds additional debug event property to help debug instrumentation issues (such as mismatching apps). Only recommended for debugging initial setup, and not recommended for production.|
90
+ |`configServerUrl`|`string`|No|`undefined`|Specifies the endpoint URL to fetch remote configuration. If provided, it overrides the default server zone configuration.|
91
+ |`trackServerUrl`|`string`|No|`undefined`|Specifies the endpoint URL for sending session replay data. If provided, it overrides the default server zone configuration.|
92
+ |`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.|
93
+ |`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`.|
94
+ |`performanceConfig.enabled`|`boolean`|No|`false`|If enabled, event compression will be deferred to occur during the browser's idle periods.|
95
+ |`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.|
96
+ |`experimental.useWebWorker`|`boolean`|No|`false`|If the SDK should compress the replay events using a webworker.|
90
97
 
91
98
  ## Privacy
92
99
  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:
@@ -40,18 +40,73 @@ export type PrivacyConfig = {
40
40
  export interface SessionReplayLocalConfig extends Config {
41
41
  apiKey: string;
42
42
  loggerProvider: Logger;
43
+ /**
44
+ * LogLevel.None or LogLevel.Error or LogLevel.Warn or LogLevel.Verbose or LogLevel.Debug.
45
+ * Sets the log level.
46
+ *
47
+ * @defaultValue LogLevel.Warn
48
+ */
43
49
  logLevel: LogLevel;
50
+ /**
51
+ * The maximum number of retries allowed for sending replay events.
52
+ * Once this limit is reached, failed events will no longer be sent.
53
+ *
54
+ * @defaultValue 2
55
+ */
44
56
  flushMaxRetries: number;
57
+ /**
58
+ * Use this option to control how many sessions to select for replay collection.
59
+ * The number should be a decimal between 0 and 1, for example 0.4, representing
60
+ * the fraction of sessions to have randomly selected for replay collection.
61
+ * Over a large number of sessions, 0.4 would select 40% of those sessions.
62
+ * Sample rates as small as six decimal places (0.000001) are supported.
63
+ *
64
+ * @defaultValue 0
65
+ */
45
66
  sampleRate: number;
46
67
  privacyConfig?: PrivacyConfig;
68
+ /**
69
+ * Adds additional debug event property to help debug instrumentation issues
70
+ * (such as mismatching apps). Only recommended for debugging initial setup,
71
+ * and not recommended for production.
72
+ */
47
73
  debugMode?: boolean;
74
+ /**
75
+ * Specifies the endpoint URL to fetch remote configuration.
76
+ * If provided, it overrides the default server zone configuration.
77
+ */
48
78
  configServerUrl?: string;
79
+ /**
80
+ * Specifies the endpoint URL for sending session replay data.
81
+ * If provided, it overrides the default server zone configuration.
82
+ */
49
83
  trackServerUrl?: string;
84
+ /**
85
+ * If stylesheets are inlined, the contents of the stylesheet will be stored.
86
+ * During replay, the stored stylesheet will be used instead of attempting to fetch it remotely.
87
+ * This prevents replays from appearing broken due to missing stylesheets.
88
+ * Note: Inlining stylesheets may not work in all cases.
89
+ */
50
90
  shouldInlineStylesheet?: boolean;
51
91
  version?: SessionReplayVersion;
92
+ /**
93
+ * Performance configuration config. If enabled, we will defer compression
94
+ * to be done during the browser's idle periods.
95
+ */
52
96
  performanceConfig?: SessionReplayPerformanceConfig;
97
+ /**
98
+ * Specifies how replay events should be stored. `idb` uses IndexedDB to persist replay events
99
+ * when all events cannot be sent during capture. `memory` stores replay events only in memory,
100
+ * meaning events are lost when the page is closed. If IndexedDB is unavailable, the system falls back to `memory`.
101
+ */
53
102
  storeType: StoreType;
103
+ /**
104
+ * Experimental features.
105
+ */
54
106
  experimental?: {
107
+ /**
108
+ * If the SDK should compress the replay events using a webworker.
109
+ */
55
110
  useWebWorker: boolean;
56
111
  };
57
112
  }
@@ -73,8 +128,19 @@ export interface SessionReplayVersion {
73
128
  version: string;
74
129
  type: SessionReplayType;
75
130
  }
131
+ /**
132
+ * Configuration options for session replay performance.
133
+ */
76
134
  export interface SessionReplayPerformanceConfig {
135
+ /**
136
+ * If enabled, event compression will be deferred to occur during the browser's idle periods.
137
+ */
77
138
  enabled: boolean;
139
+ /**
140
+ * Optional timeout in milliseconds for the `requestIdleCallback` API.
141
+ * If specified, this value will be used to set a maximum time for the browser to wait
142
+ * before executing the deferred compression task, even if the browser is not idle.
143
+ */
78
144
  timeout?: number;
79
145
  }
80
146
  export type SessionReplayType = 'standalone' | 'plugin' | 'segment';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEvE,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE;QACP,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,eAAe,EAAE,CAAC;KAC3B,CAAC;IACF,OAAO,CAAC,EAAE;QACR,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,iBAAiB,CAAC,EAAE,aAAa,CAAC;IAClC,qBAAqB,CAAC,EAAE,iBAAiB,CAAC;IAC1C,iBAAiB,CAAC,EAAE,aAAa,CAAC;CACnC,CAAC;AAEF,MAAM,WAAW,oCAAoC;IACnD,OAAO,EAAE;QACP,aAAa,EAAE,yBAAyB,CAAC;KAC1C,C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AS,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE;QACb;;WAEG;QACH,YAAY,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,yBAA0B,SAAQ,wBAAwB;IACzE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,MAAM,WAAW,8BAA8B;IAC7C,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,iBAAiB,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,yBAAyB,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,CAAC;IAC3G,iBAAiB,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAC;IACrF,eAAe,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAC;CACpF;AAED,MAAM,WAAW,kCAAkC;IACjD,oBAAoB,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAC3F;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":";;;AA0Ca,QAAA,kBAAkB,GAAG,QAAQ,CAAC","sourcesContent":["import { Config, LogLevel, Logger } from '@amplitude/analytics-types';\nimport { StoreType, ConsoleLogLevel } from '../typings/session-replay';\n\nexport interface SamplingConfig {\n sample_rate: number;\n capture_enabled: boolean;\n}\n\nexport interface InteractionConfig {\n trackEveryNms?: number;\n enabled: boolean; // defaults to false\n batch: boolean; // defaults to false\n}\n\nexport interface LoggingConfig {\n console: {\n enabled: boolean;\n levels: ConsoleLogLevel[];\n };\n network?: {\n enabled: boolean;\n };\n}\n\nexport type SessionReplayRemoteConfig = {\n sr_sampling_config?: SamplingConfig;\n sr_privacy_config?: PrivacyConfig;\n sr_interaction_config?: InteractionConfig;\n sr_logging_config?: LoggingConfig;\n};\n\nexport interface SessionReplayRemoteConfigAPIResponse {\n configs: {\n sessionReplay: SessionReplayRemoteConfig;\n };\n}\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 const DEFAULT_MASK_LEVEL = 'medium';\n\n// err on the side of excluding more\nexport type PrivacyConfig = {\n blockSelector?: string | string[]; // exclude in the UI\n defaultMaskLevel?: MaskLevel;\n maskSelector?: string[];\n unmaskSelector?: string[];\n};\n\nexport interface SessionReplayLocalConfig extends Config {\n apiKey: string;\n loggerProvider: Logger;\n logLevel: LogLevel;\n flushMaxRetries: number;\n sampleRate: number;\n privacyConfig?: PrivacyConfig;\n debugMode?: boolean;\n // This will control which endpoint is used for remote config.\n // This will override server zone if specified.\n configServerUrl?: string;\n // This will control which endpoint is used for session replay track calls.\n // This will override server zone if specified.\n trackServerUrl?: string;\n shouldInlineStylesheet?: boolean;\n version?: SessionReplayVersion;\n performanceConfig?: SessionReplayPerformanceConfig;\n storeType: StoreType;\n\n experimental?: {\n useWebWorker: boolean;\n };\n}\n\nexport interface SessionReplayJoinedConfig extends SessionReplayLocalConfig {\n captureEnabled?: boolean;\n interactionConfig?: InteractionConfig;\n loggingConfig?: LoggingConfig;\n}\n\nexport interface SessionReplayRemoteConfigFetch {\n getServerUrl: () => void;\n getSamplingConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig['sr_sampling_config'] | void>;\n fetchRemoteConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig | void>;\n getRemoteConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig | void>;\n}\n\nexport interface SessionReplayJoinedConfigGenerator {\n generateJoinedConfig: (sessionId?: string | number) => Promise<SessionReplayJoinedConfig>;\n}\n\nexport interface SessionReplayVersion {\n version: string;\n type: SessionReplayType;\n}\n\nexport interface SessionReplayPerformanceConfig {\n enabled: boolean;\n timeout?: number;\n}\n\nexport type SessionReplayType = 'standalone' | 'plugin' | 'segment';\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":";;;AA0Ca,QAAA,kBAAkB,GAAG,QAAQ,CAAC","sourcesContent":["import { Config, LogLevel, Logger } from '@amplitude/analytics-types';\nimport { StoreType, ConsoleLogLevel } from '../typings/session-replay';\n\nexport interface SamplingConfig {\n sample_rate: number;\n capture_enabled: boolean;\n}\n\nexport interface InteractionConfig {\n trackEveryNms?: number;\n enabled: boolean; // defaults to false\n batch: boolean; // defaults to false\n}\n\nexport interface LoggingConfig {\n console: {\n enabled: boolean;\n levels: ConsoleLogLevel[];\n };\n network?: {\n enabled: boolean;\n };\n}\n\nexport type SessionReplayRemoteConfig = {\n sr_sampling_config?: SamplingConfig;\n sr_privacy_config?: PrivacyConfig;\n sr_interaction_config?: InteractionConfig;\n sr_logging_config?: LoggingConfig;\n};\n\nexport interface SessionReplayRemoteConfigAPIResponse {\n configs: {\n sessionReplay: SessionReplayRemoteConfig;\n };\n}\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 const DEFAULT_MASK_LEVEL = 'medium';\n\n// err on the side of excluding more\nexport type PrivacyConfig = {\n blockSelector?: string | string[]; // exclude in the UI\n defaultMaskLevel?: MaskLevel;\n maskSelector?: string[];\n unmaskSelector?: string[];\n};\n\nexport interface SessionReplayLocalConfig extends Config {\n apiKey: string;\n loggerProvider: Logger;\n /**\n * LogLevel.None or LogLevel.Error or LogLevel.Warn or LogLevel.Verbose or LogLevel.Debug.\n * Sets the log level.\n *\n * @defaultValue LogLevel.Warn\n */\n logLevel: LogLevel;\n /**\n * The maximum number of retries allowed for sending replay events.\n * Once this limit is reached, failed events will no longer be sent.\n *\n * @defaultValue 2\n */\n flushMaxRetries: number;\n /**\n * Use this option to control how many sessions to select for replay collection.\n * The number should be a decimal between 0 and 1, for example 0.4, representing\n * the fraction of sessions to have randomly selected for replay collection.\n * Over a large number of sessions, 0.4 would select 40% of those sessions.\n * Sample rates as small as six decimal places (0.000001) are supported.\n *\n * @defaultValue 0\n */\n sampleRate: number;\n privacyConfig?: PrivacyConfig;\n /**\n * Adds additional debug event property to help debug instrumentation issues\n * (such as mismatching apps). Only recommended for debugging initial setup,\n * and not recommended for production.\n */\n debugMode?: boolean;\n /**\n * Specifies the endpoint URL to fetch remote configuration.\n * If provided, it overrides the default server zone configuration.\n */\n configServerUrl?: string;\n /**\n * Specifies the endpoint URL for sending session replay data.\n * If provided, it overrides the default server zone configuration.\n */\n trackServerUrl?: string;\n /**\n * If stylesheets are inlined, the contents of the stylesheet will be stored.\n * During replay, the stored stylesheet will be used instead of attempting to fetch it remotely.\n * This prevents replays from appearing broken due to missing stylesheets.\n * Note: Inlining stylesheets may not work in all cases.\n */\n shouldInlineStylesheet?: boolean;\n version?: SessionReplayVersion;\n /**\n * Performance configuration config. If enabled, we will defer compression\n * to be done during the browser's idle periods.\n */\n performanceConfig?: SessionReplayPerformanceConfig;\n /**\n * Specifies how replay events should be stored. `idb` uses IndexedDB to persist replay events\n * when all events cannot be sent during capture. `memory` stores replay events only in memory,\n * meaning events are lost when the page is closed. If IndexedDB is unavailable, the system falls back to `memory`.\n */\n storeType: StoreType;\n\n /**\n * Experimental features.\n */\n experimental?: {\n /**\n * If the SDK should compress the replay events using a webworker.\n */\n useWebWorker: boolean;\n };\n}\n\nexport interface SessionReplayJoinedConfig extends SessionReplayLocalConfig {\n captureEnabled?: boolean;\n interactionConfig?: InteractionConfig;\n loggingConfig?: LoggingConfig;\n}\n\nexport interface SessionReplayRemoteConfigFetch {\n getServerUrl: () => void;\n getSamplingConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig['sr_sampling_config'] | void>;\n fetchRemoteConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig | void>;\n getRemoteConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig | void>;\n}\n\nexport interface SessionReplayJoinedConfigGenerator {\n generateJoinedConfig: (sessionId?: string | number) => Promise<SessionReplayJoinedConfig>;\n}\n\nexport interface SessionReplayVersion {\n version: string;\n type: SessionReplayType;\n}\n\n/**\n * Configuration options for session replay performance.\n */\nexport interface SessionReplayPerformanceConfig {\n /**\n * If enabled, event compression will be deferred to occur during the browser's idle periods.\n */\n enabled: boolean;\n /**\n * Optional timeout in milliseconds for the `requestIdleCallback` API.\n * If specified, this value will be used to set a maximum time for the browser to wait\n * before executing the deferred compression task, even if the browser is not idle.\n */\n timeout?: number;\n}\n\nexport type SessionReplayType = 'standalone' | 'plugin' | 'segment';\n"]}
@@ -61,7 +61,13 @@ export interface EventsStore<KeyType> {
61
61
  cleanUpSessionEventsStore(sessionId: string | number, sequenceId?: KeyType): Promise<void>;
62
62
  }
63
63
  export interface SessionIdentifiers {
64
+ /**
65
+ * Sets an identifier for the device running your application.
66
+ */
64
67
  deviceId?: string;
68
+ /**
69
+ * Sets an identifier for the users current session. The value must be in milliseconds since epoch (Unix Timestamp).
70
+ */
65
71
  sessionId?: string | number;
66
72
  sessionReplayId?: string;
67
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],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AAK;IACrD;;OAEG;IACH,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE;;OAEG;IACH,QAAQ,CAAC,EACP,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE;QACD,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;QAC3B,KAAK,EAAE;YAAE,IAAI,EAAE,IAAI,CAAC;YAAC,IAAI,EAAE,KAAK,CAAA;SAAE,CAAC;QACnC,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,IAAI,CAAC;IACT;;OAEG;IACH,yBAAyB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC3G;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"","sourcesContent":["import { AmplitudeReturn, ServerZone } from '@amplitude/analytics-types';\nimport { SessionReplayJoinedConfig, SessionReplayLocalConfig, SessionReplayVersion } from '../config/types';\n\nexport type StorageData = {\n totalStorageSize: number;\n percentOfQuota: number;\n usageDetails: string;\n};\n\nexport interface DebugInfo extends Partial<StorageData> {\n config: SessionReplayJoinedConfig;\n version: string;\n}\n\nexport type Events = string[];\n\nexport type StoreType = 'memory' | 'idb';\n\nexport type EventType = 'replay' | 'interaction';\n\nexport type ConsoleLogLevel = 'info' | 'log' | 'warn' | 'error';\n\nexport interface SessionReplayDestinationSessionMetadata {\n type: EventType;\n sessionId: string | number;\n deviceId: string | undefined;\n version?: SessionReplayVersion;\n}\n\nexport type SessionReplayDestination = {\n events: Events;\n flushMaxRetries?: number;\n apiKey?: string;\n sampleRate: number;\n serverZone?: keyof typeof ServerZone;\n onComplete: () => Promise<void>;\n} & SessionReplayDestinationSessionMetadata;\n\nexport interface SessionReplayDestinationContext extends SessionReplayDestination {\n attempts: number;\n timeout: number;\n}\n\nexport interface SendingSequencesReturn<KeyType> {\n sequenceId: KeyType;\n sessionId: string | number;\n events: Events;\n}\n\n/**\n * This interface is not guaranteed to be stable, yet.\n */\nexport interface EventsStore<KeyType> {\n getSequencesToSend(): Promise<SendingSequencesReturn<KeyType>[] | undefined>;\n /**\n * Moves current sequence of events to long term storage and resets short term storage.\n */\n storeCurrentSequence(sessionId: string | number): Promise<SendingSequencesReturn<KeyType> | undefined>;\n /**\n * Adds events to the current IDB sequence. Returns events that should be\n * sent to the track destination right away if should split events is true.\n */\n addEventToCurrentSequence(\n sessionId: string | number,\n event: string,\n ): Promise<SendingSequencesReturn<KeyType> | undefined>;\n /**\n * Returns the sequence id associated with the events batch.\n * @returns the new sequence id or undefined if it cannot be determined or on any error.\n */\n storeSendingEvents(sessionId: string | number, events: Events): Promise<KeyType | undefined>;\n /**\n * Permanently removes the events batch for the session/sequence pair.\n */\n cleanUpSessionEventsStore(sessionId: string | number, sequenceId?: KeyType): Promise<void>;\n}\nexport interface SessionIdentifiers {\n deviceId?: string;\n sessionId?: string | number;\n sessionReplayId?: string;\n}\n\nexport type SessionReplayOptions = Omit<Partial<SessionReplayLocalConfig & SessionIdentifiers>, 'apiKey'>;\n\nexport interface AmplitudeSessionReplay {\n init: (apiKey: string, options: SessionReplayOptions) => AmplitudeReturn<void>;\n setSessionId: (sessionId: string | number, deviceId?: string) => AmplitudeReturn<void>;\n getSessionId: () => string | number | undefined;\n getSessionReplayProperties: () => { [key: string]: boolean | string | null };\n flush: (useRetry: boolean) => Promise<void>;\n shutdown: () => void;\n}\n\nexport interface SessionReplayTrackDestination {\n /**\n * Enqueues events to be sent.\n */\n sendEventsList: (destinationData: SessionReplayDestination) => void;\n /**\n * Immediately sends queued events.\n */\n flush: (useRetry: boolean) => Promise<void>;\n}\n\nexport type EventsManagerWithType<EventType, EventDataType> = {\n name: EventType;\n manager: SessionReplayEventsManager<EventType, EventDataType>;\n};\n\nexport interface SessionReplayEventsManager<Type, Event> {\n /**\n * For each sequence stored in the long term indexed DB send immediately to the track destination.\n */\n sendStoredEvents({ deviceId }: { deviceId: string }): Promise<void>;\n /**\n * Adds an event to the short term storage. If should split based on size or last sent, then send immediately.\n */\n addEvent({\n sessionId,\n event,\n deviceId,\n }: {\n sessionId: string | number;\n event: { type: Type; data: Event };\n deviceId: string;\n }): void;\n /**\n * Move events in short term storage to long term storage and send immediately to the track destination.\n */\n sendCurrentSequenceEvents({ sessionId, deviceId }: { sessionId: string | number; deviceId: string }): void;\n /**\n * Flush the track destination queue immediately. This should invoke sends for all the events in the queue.\n */\n flush(useRetry?: boolean): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"","sourcesContent":["import { AmplitudeReturn, ServerZone } from '@amplitude/analytics-types';\nimport { SessionReplayJoinedConfig, SessionReplayLocalConfig, SessionReplayVersion } from '../config/types';\n\nexport type StorageData = {\n totalStorageSize: number;\n percentOfQuota: number;\n usageDetails: string;\n};\n\nexport interface DebugInfo extends Partial<StorageData> {\n config: SessionReplayJoinedConfig;\n version: string;\n}\n\nexport type Events = string[];\n\nexport type StoreType = 'memory' | 'idb';\n\nexport type EventType = 'replay' | 'interaction';\n\nexport type ConsoleLogLevel = 'info' | 'log' | 'warn' | 'error';\n\nexport interface SessionReplayDestinationSessionMetadata {\n type: EventType;\n sessionId: string | number;\n deviceId: string | undefined;\n version?: SessionReplayVersion;\n}\n\nexport type SessionReplayDestination = {\n events: Events;\n flushMaxRetries?: number;\n apiKey?: string;\n sampleRate: number;\n serverZone?: keyof typeof ServerZone;\n onComplete: () => Promise<void>;\n} & SessionReplayDestinationSessionMetadata;\n\nexport interface SessionReplayDestinationContext extends SessionReplayDestination {\n attempts: number;\n timeout: number;\n}\n\nexport interface SendingSequencesReturn<KeyType> {\n sequenceId: KeyType;\n sessionId: string | number;\n events: Events;\n}\n\n/**\n * This interface is not guaranteed to be stable, yet.\n */\nexport interface EventsStore<KeyType> {\n getSequencesToSend(): Promise<SendingSequencesReturn<KeyType>[] | undefined>;\n /**\n * Moves current sequence of events to long term storage and resets short term storage.\n */\n storeCurrentSequence(sessionId: string | number): Promise<SendingSequencesReturn<KeyType> | undefined>;\n /**\n * Adds events to the current IDB sequence. Returns events that should be\n * sent to the track destination right away if should split events is true.\n */\n addEventToCurrentSequence(\n sessionId: string | number,\n event: string,\n ): Promise<SendingSequencesReturn<KeyType> | undefined>;\n /**\n * Returns the sequence id associated with the events batch.\n * @returns the new sequence id or undefined if it cannot be determined or on any error.\n */\n storeSendingEvents(sessionId: string | number, events: Events): Promise<KeyType | undefined>;\n /**\n * Permanently removes the events batch for the session/sequence pair.\n */\n cleanUpSessionEventsStore(sessionId: string | number, sequenceId?: KeyType): Promise<void>;\n}\nexport interface SessionIdentifiers {\n /**\n * Sets an identifier for the device running your application.\n */\n deviceId?: string;\n /**\n * Sets an identifier for the users current session. The value must be in milliseconds since epoch (Unix Timestamp).\n */\n sessionId?: string | number;\n sessionReplayId?: string;\n}\n\nexport type SessionReplayOptions = Omit<Partial<SessionReplayLocalConfig & SessionIdentifiers>, 'apiKey'>;\n\nexport interface AmplitudeSessionReplay {\n init: (apiKey: string, options: SessionReplayOptions) => AmplitudeReturn<void>;\n setSessionId: (sessionId: string | number, deviceId?: string) => AmplitudeReturn<void>;\n getSessionId: () => string | number | undefined;\n getSessionReplayProperties: () => { [key: string]: boolean | string | null };\n flush: (useRetry: boolean) => Promise<void>;\n shutdown: () => void;\n}\n\nexport interface SessionReplayTrackDestination {\n /**\n * Enqueues events to be sent.\n */\n sendEventsList: (destinationData: SessionReplayDestination) => void;\n /**\n * Immediately sends queued events.\n */\n flush: (useRetry: boolean) => Promise<void>;\n}\n\nexport type EventsManagerWithType<EventType, EventDataType> = {\n name: EventType;\n manager: SessionReplayEventsManager<EventType, EventDataType>;\n};\n\nexport interface SessionReplayEventsManager<Type, Event> {\n /**\n * For each sequence stored in the long term indexed DB send immediately to the track destination.\n */\n sendStoredEvents({ deviceId }: { deviceId: string }): Promise<void>;\n /**\n * Adds an event to the short term storage. If should split based on size or last sent, then send immediately.\n */\n addEvent({\n sessionId,\n event,\n deviceId,\n }: {\n sessionId: string | number;\n event: { type: Type; data: Event };\n deviceId: string;\n }): void;\n /**\n * Move events in short term storage to long term storage and send immediately to the track destination.\n */\n sendCurrentSequenceEvents({ sessionId, deviceId }: { sessionId: string | number; deviceId: string }): void;\n /**\n * Flush the track destination queue immediately. This should invoke sends for all the events in the queue.\n */\n flush(useRetry?: boolean): Promise<void>;\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.20.1";
1
+ export declare const VERSION = "1.20.2";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Autogenerated by `yarn version-file`. DO NOT EDIT
5
- exports.VERSION = '1.20.1';
5
+ exports.VERSION = '1.20.2';
6
6
  //# 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,QAAQ,CAAC","sourcesContent":["// Autogenerated by `yarn version-file`. DO NOT EDIT\nexport const VERSION = '1.20.1';\n"]}
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.20.2';\n"]}
@@ -40,18 +40,73 @@ export type PrivacyConfig = {
40
40
  export interface SessionReplayLocalConfig extends Config {
41
41
  apiKey: string;
42
42
  loggerProvider: Logger;
43
+ /**
44
+ * LogLevel.None or LogLevel.Error or LogLevel.Warn or LogLevel.Verbose or LogLevel.Debug.
45
+ * Sets the log level.
46
+ *
47
+ * @defaultValue LogLevel.Warn
48
+ */
43
49
  logLevel: LogLevel;
50
+ /**
51
+ * The maximum number of retries allowed for sending replay events.
52
+ * Once this limit is reached, failed events will no longer be sent.
53
+ *
54
+ * @defaultValue 2
55
+ */
44
56
  flushMaxRetries: number;
57
+ /**
58
+ * Use this option to control how many sessions to select for replay collection.
59
+ * The number should be a decimal between 0 and 1, for example 0.4, representing
60
+ * the fraction of sessions to have randomly selected for replay collection.
61
+ * Over a large number of sessions, 0.4 would select 40% of those sessions.
62
+ * Sample rates as small as six decimal places (0.000001) are supported.
63
+ *
64
+ * @defaultValue 0
65
+ */
45
66
  sampleRate: number;
46
67
  privacyConfig?: PrivacyConfig;
68
+ /**
69
+ * Adds additional debug event property to help debug instrumentation issues
70
+ * (such as mismatching apps). Only recommended for debugging initial setup,
71
+ * and not recommended for production.
72
+ */
47
73
  debugMode?: boolean;
74
+ /**
75
+ * Specifies the endpoint URL to fetch remote configuration.
76
+ * If provided, it overrides the default server zone configuration.
77
+ */
48
78
  configServerUrl?: string;
79
+ /**
80
+ * Specifies the endpoint URL for sending session replay data.
81
+ * If provided, it overrides the default server zone configuration.
82
+ */
49
83
  trackServerUrl?: string;
84
+ /**
85
+ * If stylesheets are inlined, the contents of the stylesheet will be stored.
86
+ * During replay, the stored stylesheet will be used instead of attempting to fetch it remotely.
87
+ * This prevents replays from appearing broken due to missing stylesheets.
88
+ * Note: Inlining stylesheets may not work in all cases.
89
+ */
50
90
  shouldInlineStylesheet?: boolean;
51
91
  version?: SessionReplayVersion;
92
+ /**
93
+ * Performance configuration config. If enabled, we will defer compression
94
+ * to be done during the browser's idle periods.
95
+ */
52
96
  performanceConfig?: SessionReplayPerformanceConfig;
97
+ /**
98
+ * Specifies how replay events should be stored. `idb` uses IndexedDB to persist replay events
99
+ * when all events cannot be sent during capture. `memory` stores replay events only in memory,
100
+ * meaning events are lost when the page is closed. If IndexedDB is unavailable, the system falls back to `memory`.
101
+ */
53
102
  storeType: StoreType;
103
+ /**
104
+ * Experimental features.
105
+ */
54
106
  experimental?: {
107
+ /**
108
+ * If the SDK should compress the replay events using a webworker.
109
+ */
55
110
  useWebWorker: boolean;
56
111
  };
57
112
  }
@@ -73,8 +128,19 @@ export interface SessionReplayVersion {
73
128
  version: string;
74
129
  type: SessionReplayType;
75
130
  }
131
+ /**
132
+ * Configuration options for session replay performance.
133
+ */
76
134
  export interface SessionReplayPerformanceConfig {
135
+ /**
136
+ * If enabled, event compression will be deferred to occur during the browser's idle periods.
137
+ */
77
138
  enabled: boolean;
139
+ /**
140
+ * Optional timeout in milliseconds for the `requestIdleCallback` API.
141
+ * If specified, this value will be used to set a maximum time for the browser to wait
142
+ * before executing the deferred compression task, even if the browser is not idle.
143
+ */
78
144
  timeout?: number;
79
145
  }
80
146
  export type SessionReplayType = 'standalone' | 'plugin' | 'segment';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEvE,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE;QACP,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,eAAe,EAAE,CAAC;KAC3B,CAA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;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"AA0CA,MAAM,CAAC,IAAM,kBAAkB,GAAG,QAAQ,CAAC","sourcesContent":["import { Config, LogLevel, Logger } from '@amplitude/analytics-types';\nimport { StoreType, ConsoleLogLevel } from '../typings/session-replay';\n\nexport interface SamplingConfig {\n sample_rate: number;\n capture_enabled: boolean;\n}\n\nexport interface InteractionConfig {\n trackEveryNms?: number;\n enabled: boolean; // defaults to false\n batch: boolean; // defaults to false\n}\n\nexport interface LoggingConfig {\n console: {\n enabled: boolean;\n levels: ConsoleLogLevel[];\n };\n network?: {\n enabled: boolean;\n };\n}\n\nexport type SessionReplayRemoteConfig = {\n sr_sampling_config?: SamplingConfig;\n sr_privacy_config?: PrivacyConfig;\n sr_interaction_config?: InteractionConfig;\n sr_logging_config?: LoggingConfig;\n};\n\nexport interface SessionReplayRemoteConfigAPIResponse {\n configs: {\n sessionReplay: SessionReplayRemoteConfig;\n };\n}\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 const DEFAULT_MASK_LEVEL = 'medium';\n\n// err on the side of excluding more\nexport type PrivacyConfig = {\n blockSelector?: string | string[]; // exclude in the UI\n defaultMaskLevel?: MaskLevel;\n maskSelector?: string[];\n unmaskSelector?: string[];\n};\n\nexport interface SessionReplayLocalConfig extends Config {\n apiKey: string;\n loggerProvider: Logger;\n logLevel: LogLevel;\n flushMaxRetries: number;\n sampleRate: number;\n privacyConfig?: PrivacyConfig;\n debugMode?: boolean;\n // This will control which endpoint is used for remote config.\n // This will override server zone if specified.\n configServerUrl?: string;\n // This will control which endpoint is used for session replay track calls.\n // This will override server zone if specified.\n trackServerUrl?: string;\n shouldInlineStylesheet?: boolean;\n version?: SessionReplayVersion;\n performanceConfig?: SessionReplayPerformanceConfig;\n storeType: StoreType;\n\n experimental?: {\n useWebWorker: boolean;\n };\n}\n\nexport interface SessionReplayJoinedConfig extends SessionReplayLocalConfig {\n captureEnabled?: boolean;\n interactionConfig?: InteractionConfig;\n loggingConfig?: LoggingConfig;\n}\n\nexport interface SessionReplayRemoteConfigFetch {\n getServerUrl: () => void;\n getSamplingConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig['sr_sampling_config'] | void>;\n fetchRemoteConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig | void>;\n getRemoteConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig | void>;\n}\n\nexport interface SessionReplayJoinedConfigGenerator {\n generateJoinedConfig: (sessionId?: string | number) => Promise<SessionReplayJoinedConfig>;\n}\n\nexport interface SessionReplayVersion {\n version: string;\n type: SessionReplayType;\n}\n\nexport interface SessionReplayPerformanceConfig {\n enabled: boolean;\n timeout?: number;\n}\n\nexport type SessionReplayType = 'standalone' | 'plugin' | 'segment';\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"AA0CA,MAAM,CAAC,IAAM,kBAAkB,GAAG,QAAQ,CAAC","sourcesContent":["import { Config, LogLevel, Logger } from '@amplitude/analytics-types';\nimport { StoreType, ConsoleLogLevel } from '../typings/session-replay';\n\nexport interface SamplingConfig {\n sample_rate: number;\n capture_enabled: boolean;\n}\n\nexport interface InteractionConfig {\n trackEveryNms?: number;\n enabled: boolean; // defaults to false\n batch: boolean; // defaults to false\n}\n\nexport interface LoggingConfig {\n console: {\n enabled: boolean;\n levels: ConsoleLogLevel[];\n };\n network?: {\n enabled: boolean;\n };\n}\n\nexport type SessionReplayRemoteConfig = {\n sr_sampling_config?: SamplingConfig;\n sr_privacy_config?: PrivacyConfig;\n sr_interaction_config?: InteractionConfig;\n sr_logging_config?: LoggingConfig;\n};\n\nexport interface SessionReplayRemoteConfigAPIResponse {\n configs: {\n sessionReplay: SessionReplayRemoteConfig;\n };\n}\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 const DEFAULT_MASK_LEVEL = 'medium';\n\n// err on the side of excluding more\nexport type PrivacyConfig = {\n blockSelector?: string | string[]; // exclude in the UI\n defaultMaskLevel?: MaskLevel;\n maskSelector?: string[];\n unmaskSelector?: string[];\n};\n\nexport interface SessionReplayLocalConfig extends Config {\n apiKey: string;\n loggerProvider: Logger;\n /**\n * LogLevel.None or LogLevel.Error or LogLevel.Warn or LogLevel.Verbose or LogLevel.Debug.\n * Sets the log level.\n *\n * @defaultValue LogLevel.Warn\n */\n logLevel: LogLevel;\n /**\n * The maximum number of retries allowed for sending replay events.\n * Once this limit is reached, failed events will no longer be sent.\n *\n * @defaultValue 2\n */\n flushMaxRetries: number;\n /**\n * Use this option to control how many sessions to select for replay collection.\n * The number should be a decimal between 0 and 1, for example 0.4, representing\n * the fraction of sessions to have randomly selected for replay collection.\n * Over a large number of sessions, 0.4 would select 40% of those sessions.\n * Sample rates as small as six decimal places (0.000001) are supported.\n *\n * @defaultValue 0\n */\n sampleRate: number;\n privacyConfig?: PrivacyConfig;\n /**\n * Adds additional debug event property to help debug instrumentation issues\n * (such as mismatching apps). Only recommended for debugging initial setup,\n * and not recommended for production.\n */\n debugMode?: boolean;\n /**\n * Specifies the endpoint URL to fetch remote configuration.\n * If provided, it overrides the default server zone configuration.\n */\n configServerUrl?: string;\n /**\n * Specifies the endpoint URL for sending session replay data.\n * If provided, it overrides the default server zone configuration.\n */\n trackServerUrl?: string;\n /**\n * If stylesheets are inlined, the contents of the stylesheet will be stored.\n * During replay, the stored stylesheet will be used instead of attempting to fetch it remotely.\n * This prevents replays from appearing broken due to missing stylesheets.\n * Note: Inlining stylesheets may not work in all cases.\n */\n shouldInlineStylesheet?: boolean;\n version?: SessionReplayVersion;\n /**\n * Performance configuration config. If enabled, we will defer compression\n * to be done during the browser's idle periods.\n */\n performanceConfig?: SessionReplayPerformanceConfig;\n /**\n * Specifies how replay events should be stored. `idb` uses IndexedDB to persist replay events\n * when all events cannot be sent during capture. `memory` stores replay events only in memory,\n * meaning events are lost when the page is closed. If IndexedDB is unavailable, the system falls back to `memory`.\n */\n storeType: StoreType;\n\n /**\n * Experimental features.\n */\n experimental?: {\n /**\n * If the SDK should compress the replay events using a webworker.\n */\n useWebWorker: boolean;\n };\n}\n\nexport interface SessionReplayJoinedConfig extends SessionReplayLocalConfig {\n captureEnabled?: boolean;\n interactionConfig?: InteractionConfig;\n loggingConfig?: LoggingConfig;\n}\n\nexport interface SessionReplayRemoteConfigFetch {\n getServerUrl: () => void;\n getSamplingConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig['sr_sampling_config'] | void>;\n fetchRemoteConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig | void>;\n getRemoteConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig | void>;\n}\n\nexport interface SessionReplayJoinedConfigGenerator {\n generateJoinedConfig: (sessionId?: string | number) => Promise<SessionReplayJoinedConfig>;\n}\n\nexport interface SessionReplayVersion {\n version: string;\n type: SessionReplayType;\n}\n\n/**\n * Configuration options for session replay performance.\n */\nexport interface SessionReplayPerformanceConfig {\n /**\n * If enabled, event compression will be deferred to occur during the browser's idle periods.\n */\n enabled: boolean;\n /**\n * Optional timeout in milliseconds for the `requestIdleCallback` API.\n * If specified, this value will be used to set a maximum time for the browser to wait\n * before executing the deferred compression task, even if the browser is not idle.\n */\n timeout?: number;\n}\n\nexport type SessionReplayType = 'standalone' | 'plugin' | 'segment';\n"]}
@@ -61,7 +61,13 @@ export interface EventsStore<KeyType> {
61
61
  cleanUpSessionEventsStore(sessionId: string | number, sequenceId?: KeyType): Promise<void>;
62
62
  }
63
63
  export interface SessionIdentifiers {
64
+ /**
65
+ * Sets an identifier for the device running your application.
66
+ */
64
67
  deviceId?: string;
68
+ /**
69
+ * Sets an identifier for the users current session. The value must be in milliseconds since epoch (Unix Timestamp).
70
+ */
65
71
  sessionId?: string | number;
66
72
  sessionReplayId?: string;
67
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5G,MAAM,MAAM,WAAW,GAAG;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,SAAU,SAAQ,OAAO,CAAC,WAAW,CAAC;IACrD,MAAM,EAAE,yBAAyB,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;AAE9B,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEzC,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAC;AAEjD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhE,MAAM,WAAW,uCAAuC;IACtD,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED,MAAM,MAAM,w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AEG;IACH,cAAc,EAAE,CAAC,eAAe,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACpE;;OAEG;IACH,KAAK,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED,MAAM,MAAM,qBAAqB,CAAC,SAAS,EAAE,aAAa,IAAI;IAC5D,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,0BAA0B,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;CAC/D,CAAC;AAEF,MAAM,WAAW,0BAA0B,CAAC,IAAI,EAAE,KAAK;IACrD;;OAEG;IACH,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE;;OAEG;IACH,QAAQ,CAAC,EACP,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE;QACD,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;QAC3B,KAAK,EAAE;YAAE,IAAI,EAAE,IAAI,CAAC;YAAC,IAAI,EAAE,KAAK,CAAA;SAAE,CAAC;QACnC,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,IAAI,CAAC;IACT;;OAEG;IACH,yBAAyB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC3G;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"","sourcesContent":["import { AmplitudeReturn, ServerZone } from '@amplitude/analytics-types';\nimport { SessionReplayJoinedConfig, SessionReplayLocalConfig, SessionReplayVersion } from '../config/types';\n\nexport type StorageData = {\n totalStorageSize: number;\n percentOfQuota: number;\n usageDetails: string;\n};\n\nexport interface DebugInfo extends Partial<StorageData> {\n config: SessionReplayJoinedConfig;\n version: string;\n}\n\nexport type Events = string[];\n\nexport type StoreType = 'memory' | 'idb';\n\nexport type EventType = 'replay' | 'interaction';\n\nexport type ConsoleLogLevel = 'info' | 'log' | 'warn' | 'error';\n\nexport interface SessionReplayDestinationSessionMetadata {\n type: EventType;\n sessionId: string | number;\n deviceId: string | undefined;\n version?: SessionReplayVersion;\n}\n\nexport type SessionReplayDestination = {\n events: Events;\n flushMaxRetries?: number;\n apiKey?: string;\n sampleRate: number;\n serverZone?: keyof typeof ServerZone;\n onComplete: () => Promise<void>;\n} & SessionReplayDestinationSessionMetadata;\n\nexport interface SessionReplayDestinationContext extends SessionReplayDestination {\n attempts: number;\n timeout: number;\n}\n\nexport interface SendingSequencesReturn<KeyType> {\n sequenceId: KeyType;\n sessionId: string | number;\n events: Events;\n}\n\n/**\n * This interface is not guaranteed to be stable, yet.\n */\nexport interface EventsStore<KeyType> {\n getSequencesToSend(): Promise<SendingSequencesReturn<KeyType>[] | undefined>;\n /**\n * Moves current sequence of events to long term storage and resets short term storage.\n */\n storeCurrentSequence(sessionId: string | number): Promise<SendingSequencesReturn<KeyType> | undefined>;\n /**\n * Adds events to the current IDB sequence. Returns events that should be\n * sent to the track destination right away if should split events is true.\n */\n addEventToCurrentSequence(\n sessionId: string | number,\n event: string,\n ): Promise<SendingSequencesReturn<KeyType> | undefined>;\n /**\n * Returns the sequence id associated with the events batch.\n * @returns the new sequence id or undefined if it cannot be determined or on any error.\n */\n storeSendingEvents(sessionId: string | number, events: Events): Promise<KeyType | undefined>;\n /**\n * Permanently removes the events batch for the session/sequence pair.\n */\n cleanUpSessionEventsStore(sessionId: string | number, sequenceId?: KeyType): Promise<void>;\n}\nexport interface SessionIdentifiers {\n deviceId?: string;\n sessionId?: string | number;\n sessionReplayId?: string;\n}\n\nexport type SessionReplayOptions = Omit<Partial<SessionReplayLocalConfig & SessionIdentifiers>, 'apiKey'>;\n\nexport interface AmplitudeSessionReplay {\n init: (apiKey: string, options: SessionReplayOptions) => AmplitudeReturn<void>;\n setSessionId: (sessionId: string | number, deviceId?: string) => AmplitudeReturn<void>;\n getSessionId: () => string | number | undefined;\n getSessionReplayProperties: () => { [key: string]: boolean | string | null };\n flush: (useRetry: boolean) => Promise<void>;\n shutdown: () => void;\n}\n\nexport interface SessionReplayTrackDestination {\n /**\n * Enqueues events to be sent.\n */\n sendEventsList: (destinationData: SessionReplayDestination) => void;\n /**\n * Immediately sends queued events.\n */\n flush: (useRetry: boolean) => Promise<void>;\n}\n\nexport type EventsManagerWithType<EventType, EventDataType> = {\n name: EventType;\n manager: SessionReplayEventsManager<EventType, EventDataType>;\n};\n\nexport interface SessionReplayEventsManager<Type, Event> {\n /**\n * For each sequence stored in the long term indexed DB send immediately to the track destination.\n */\n sendStoredEvents({ deviceId }: { deviceId: string }): Promise<void>;\n /**\n * Adds an event to the short term storage. If should split based on size or last sent, then send immediately.\n */\n addEvent({\n sessionId,\n event,\n deviceId,\n }: {\n sessionId: string | number;\n event: { type: Type; data: Event };\n deviceId: string;\n }): void;\n /**\n * Move events in short term storage to long term storage and send immediately to the track destination.\n */\n sendCurrentSequenceEvents({ sessionId, deviceId }: { sessionId: string | number; deviceId: string }): void;\n /**\n * Flush the track destination queue immediately. This should invoke sends for all the events in the queue.\n */\n flush(useRetry?: boolean): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"","sourcesContent":["import { AmplitudeReturn, ServerZone } from '@amplitude/analytics-types';\nimport { SessionReplayJoinedConfig, SessionReplayLocalConfig, SessionReplayVersion } from '../config/types';\n\nexport type StorageData = {\n totalStorageSize: number;\n percentOfQuota: number;\n usageDetails: string;\n};\n\nexport interface DebugInfo extends Partial<StorageData> {\n config: SessionReplayJoinedConfig;\n version: string;\n}\n\nexport type Events = string[];\n\nexport type StoreType = 'memory' | 'idb';\n\nexport type EventType = 'replay' | 'interaction';\n\nexport type ConsoleLogLevel = 'info' | 'log' | 'warn' | 'error';\n\nexport interface SessionReplayDestinationSessionMetadata {\n type: EventType;\n sessionId: string | number;\n deviceId: string | undefined;\n version?: SessionReplayVersion;\n}\n\nexport type SessionReplayDestination = {\n events: Events;\n flushMaxRetries?: number;\n apiKey?: string;\n sampleRate: number;\n serverZone?: keyof typeof ServerZone;\n onComplete: () => Promise<void>;\n} & SessionReplayDestinationSessionMetadata;\n\nexport interface SessionReplayDestinationContext extends SessionReplayDestination {\n attempts: number;\n timeout: number;\n}\n\nexport interface SendingSequencesReturn<KeyType> {\n sequenceId: KeyType;\n sessionId: string | number;\n events: Events;\n}\n\n/**\n * This interface is not guaranteed to be stable, yet.\n */\nexport interface EventsStore<KeyType> {\n getSequencesToSend(): Promise<SendingSequencesReturn<KeyType>[] | undefined>;\n /**\n * Moves current sequence of events to long term storage and resets short term storage.\n */\n storeCurrentSequence(sessionId: string | number): Promise<SendingSequencesReturn<KeyType> | undefined>;\n /**\n * Adds events to the current IDB sequence. Returns events that should be\n * sent to the track destination right away if should split events is true.\n */\n addEventToCurrentSequence(\n sessionId: string | number,\n event: string,\n ): Promise<SendingSequencesReturn<KeyType> | undefined>;\n /**\n * Returns the sequence id associated with the events batch.\n * @returns the new sequence id or undefined if it cannot be determined or on any error.\n */\n storeSendingEvents(sessionId: string | number, events: Events): Promise<KeyType | undefined>;\n /**\n * Permanently removes the events batch for the session/sequence pair.\n */\n cleanUpSessionEventsStore(sessionId: string | number, sequenceId?: KeyType): Promise<void>;\n}\nexport interface SessionIdentifiers {\n /**\n * Sets an identifier for the device running your application.\n */\n deviceId?: string;\n /**\n * Sets an identifier for the users current session. The value must be in milliseconds since epoch (Unix Timestamp).\n */\n sessionId?: string | number;\n sessionReplayId?: string;\n}\n\nexport type SessionReplayOptions = Omit<Partial<SessionReplayLocalConfig & SessionIdentifiers>, 'apiKey'>;\n\nexport interface AmplitudeSessionReplay {\n init: (apiKey: string, options: SessionReplayOptions) => AmplitudeReturn<void>;\n setSessionId: (sessionId: string | number, deviceId?: string) => AmplitudeReturn<void>;\n getSessionId: () => string | number | undefined;\n getSessionReplayProperties: () => { [key: string]: boolean | string | null };\n flush: (useRetry: boolean) => Promise<void>;\n shutdown: () => void;\n}\n\nexport interface SessionReplayTrackDestination {\n /**\n * Enqueues events to be sent.\n */\n sendEventsList: (destinationData: SessionReplayDestination) => void;\n /**\n * Immediately sends queued events.\n */\n flush: (useRetry: boolean) => Promise<void>;\n}\n\nexport type EventsManagerWithType<EventType, EventDataType> = {\n name: EventType;\n manager: SessionReplayEventsManager<EventType, EventDataType>;\n};\n\nexport interface SessionReplayEventsManager<Type, Event> {\n /**\n * For each sequence stored in the long term indexed DB send immediately to the track destination.\n */\n sendStoredEvents({ deviceId }: { deviceId: string }): Promise<void>;\n /**\n * Adds an event to the short term storage. If should split based on size or last sent, then send immediately.\n */\n addEvent({\n sessionId,\n event,\n deviceId,\n }: {\n sessionId: string | number;\n event: { type: Type; data: Event };\n deviceId: string;\n }): void;\n /**\n * Move events in short term storage to long term storage and send immediately to the track destination.\n */\n sendCurrentSequenceEvents({ sessionId, deviceId }: { sessionId: string | number; deviceId: string }): void;\n /**\n * Flush the track destination queue immediately. This should invoke sends for all the events in the queue.\n */\n flush(useRetry?: boolean): Promise<void>;\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.20.1";
1
+ export declare const VERSION = "1.20.2";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Autogenerated by `yarn version-file`. DO NOT EDIT
2
- export var VERSION = '1.20.1';
2
+ export var VERSION = '1.20.2';
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,QAAQ,CAAC","sourcesContent":["// Autogenerated by `yarn version-file`. DO NOT EDIT\nexport const VERSION = '1.20.1';\n"]}
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.20.2';\n"]}