@amplitude/session-replay-browser 1.22.5 → 1.22.7-prereleasenetworkcapture.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/lib/esm/config/joined-config.d.ts +2 -2
  2. package/lib/esm/config/joined-config.d.ts.map +1 -1
  3. package/lib/esm/config/joined-config.js +10 -2
  4. package/lib/esm/config/joined-config.js.map +1 -1
  5. package/lib/esm/config/types.d.ts +22 -1
  6. package/lib/esm/config/types.d.ts.map +1 -1
  7. package/lib/esm/config/types.js.map +1 -1
  8. package/lib/esm/constants.d.ts +2 -1
  9. package/lib/esm/constants.d.ts.map +1 -1
  10. package/lib/esm/constants.js +1 -0
  11. package/lib/esm/constants.js.map +1 -1
  12. package/lib/esm/session-replay.d.ts +3 -1
  13. package/lib/esm/session-replay.d.ts.map +1 -1
  14. package/lib/esm/session-replay.js +50 -30
  15. package/lib/esm/session-replay.js.map +1 -1
  16. package/lib/esm/version.d.ts +1 -1
  17. package/lib/esm/version.js +1 -1
  18. package/lib/esm/version.js.map +1 -1
  19. package/lib/scripts/amplitude-min.js +2 -0
  20. package/lib/scripts/amplitude-min.js.gz +0 -0
  21. package/lib/scripts/amplitude-min.js.map +1 -0
  22. package/lib/scripts/amplitude-min.umd.js +1 -0
  23. package/lib/scripts/amplitude-min.umd.js.gz +0 -0
  24. package/lib/scripts/beacon-transport.d.ts +28 -0
  25. package/lib/scripts/beacon-transport.d.ts.map +1 -0
  26. package/lib/scripts/config/joined-config.d.ts +13 -0
  27. package/lib/scripts/config/joined-config.d.ts.map +1 -0
  28. package/lib/scripts/config/local-config.d.ts +27 -0
  29. package/lib/scripts/config/local-config.d.ts.map +1 -0
  30. package/lib/scripts/config/types.d.ts +147 -0
  31. package/lib/scripts/config/types.d.ts.map +1 -0
  32. package/lib/scripts/console-plugin-min.js.gz +0 -0
  33. package/lib/scripts/constants.d.ts +29 -0
  34. package/lib/scripts/constants.d.ts.map +1 -0
  35. package/lib/scripts/events/base-events-store.d.ts +31 -0
  36. package/lib/scripts/events/base-events-store.d.ts.map +1 -0
  37. package/lib/scripts/events/event-compressor.d.ts +27 -0
  38. package/lib/scripts/events/event-compressor.d.ts.map +1 -0
  39. package/lib/scripts/events/events-idb-store.d.ts +52 -0
  40. package/lib/scripts/events/events-idb-store.d.ts.map +1 -0
  41. package/lib/scripts/events/events-manager.d.ts +13 -0
  42. package/lib/scripts/events/events-manager.d.ts.map +1 -0
  43. package/lib/scripts/events/events-memory-store.d.ts +15 -0
  44. package/lib/scripts/events/events-memory-store.d.ts.map +1 -0
  45. package/lib/scripts/events/legacy-idb-types.d.ts +26 -0
  46. package/lib/scripts/events/legacy-idb-types.d.ts.map +1 -0
  47. package/lib/scripts/events/multi-manager.d.ts +26 -0
  48. package/lib/scripts/events/multi-manager.d.ts.map +1 -0
  49. package/lib/scripts/helpers.d.ts +46 -0
  50. package/lib/scripts/helpers.d.ts.map +1 -0
  51. package/lib/scripts/hooks/click.d.ts +27 -0
  52. package/lib/scripts/hooks/click.d.ts.map +1 -0
  53. package/lib/scripts/hooks/scroll.d.ts +44 -0
  54. package/lib/scripts/hooks/scroll.d.ts.map +1 -0
  55. package/lib/scripts/identifiers.d.ts +11 -0
  56. package/lib/scripts/identifiers.d.ts.map +1 -0
  57. package/lib/scripts/index.d.ts +7 -0
  58. package/lib/scripts/index.d.ts.map +1 -0
  59. package/lib/scripts/libs/finder.d.ts +14 -0
  60. package/lib/scripts/libs/finder.d.ts.map +1 -0
  61. package/lib/scripts/logger.d.ts +13 -0
  62. package/lib/scripts/logger.d.ts.map +1 -0
  63. package/lib/scripts/messages.d.ts +7 -0
  64. package/lib/scripts/messages.d.ts.map +1 -0
  65. package/lib/scripts/observers.d.ts +24 -0
  66. package/lib/scripts/observers.d.ts.map +1 -0
  67. package/lib/scripts/session-replay-browser-esm.js.gz +0 -0
  68. package/lib/scripts/session-replay-browser-min.js.gz +0 -0
  69. package/lib/scripts/session-replay-factory.d.ts +7 -0
  70. package/lib/scripts/session-replay-factory.d.ts.map +1 -0
  71. package/lib/scripts/session-replay.d.ts +56 -0
  72. package/lib/scripts/session-replay.d.ts.map +1 -0
  73. package/lib/scripts/track-destination.d.ts +37 -0
  74. package/lib/scripts/track-destination.d.ts.map +1 -0
  75. package/lib/scripts/typings/session-replay.d.ts +129 -0
  76. package/lib/scripts/typings/session-replay.d.ts.map +1 -0
  77. package/lib/scripts/version.d.ts +2 -0
  78. package/lib/scripts/version.d.ts.map +1 -0
  79. package/lib/scripts/worker/compression.d.ts +2 -0
  80. package/lib/scripts/worker/compression.d.ts.map +1 -0
  81. package/package.json +3 -3
@@ -0,0 +1,28 @@
1
+ import { SessionReplayJoinedConfig } from './config/types';
2
+ import { SessionReplayDestinationSessionMetadata } from './typings/session-replay';
3
+ /**
4
+ * For very small payloads it's preferable to use the [Beacon API](https://developer.mozilla.org/en-US/docs/Web/API/Beacon_API).
5
+ * While it doesn't provide 100% guarantees on sends, it greatly helps with overall reliability and page load performance. As
6
+ * the Beacon API has a potential to fail due to size constraints we want to fall back to XHR if need be. This is mostly to
7
+ * be used with 'pagehide' or 'beforeunload' events.
8
+ *
9
+ * Note there are only 3 CORS safelisted Content-Types you can send:
10
+ *
11
+ * - application/x-www-form-urlencoded
12
+ * - multipart/form-data
13
+ * - text/plain
14
+ *
15
+ * If we do not send one of these, some browsers like Chrome may not send this at all. Also we incur the overhead of a preflight
16
+ * request. In our case we will add no additional content-type header. If you are trying to ping a server that requires this
17
+ * header, you may want to use the regular fetch API or a different mechanism.
18
+ */
19
+ export declare class BeaconTransport<T> {
20
+ private sendBeacon;
21
+ private sendXhr;
22
+ private readonly basePageUrl;
23
+ private readonly context;
24
+ private readonly apiKey;
25
+ constructor(context: Omit<SessionReplayDestinationSessionMetadata, 'deviceId'>, config: SessionReplayJoinedConfig);
26
+ send(deviceId: string, payload: T): void;
27
+ }
28
+ //# sourceMappingURL=beacon-transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"beacon-transport.d.ts","sourceRoot":"","sources":["../../src/beacon-transport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,uCAAuC,EAAE,MAAM,0BAA0B,CAAC;AAKnF;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,eAAe,CAAC,CAAC;IAC5B,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4D;IACpF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,OAAO,EAAE,IAAI,CAAC,uCAAuC,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,yBAAyB;IA8BjH,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;CAelC"}
@@ -0,0 +1,13 @@
1
+ import { RemoteConfigFetch } from '@amplitude/analytics-remote-config';
2
+ import { ILogger } from '@amplitude/analytics-core';
3
+ import { SessionReplayOptions } from '../typings/session-replay';
4
+ import { SessionReplayLocalConfig as ISessionReplayLocalConfig, PrivacyConfig, SessionReplayJoinedConfig, SessionReplayRemoteConfig } from './types';
5
+ export declare const removeInvalidSelectorsFromPrivacyConfig: (privacyConfig: PrivacyConfig, loggerProvider: ILogger) => PrivacyConfig;
6
+ export declare class SessionReplayJoinedConfigGenerator {
7
+ private readonly localConfig;
8
+ private readonly remoteConfigFetch;
9
+ constructor(remoteConfigFetch: RemoteConfigFetch<SessionReplayRemoteConfig>, localConfig: ISessionReplayLocalConfig);
10
+ generateJoinedConfig(sessionId?: string | number): Promise<SessionReplayJoinedConfig>;
11
+ }
12
+ export declare const createSessionReplayJoinedConfigGenerator: (apiKey: string, options: SessionReplayOptions) => Promise<SessionReplayJoinedConfigGenerator>;
13
+ //# sourceMappingURL=joined-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joined-config.d.ts","sourceRoot":"","sources":["../../../src/config/joined-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA2B,MAAM,oCAAoC,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EACL,wBAAwB,IAAI,yBAAyB,EACrD,aAAa,EACb,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,uCAAuC,kBAAmB,aAAa,kBAAkB,OAAO,kBA0B5G,CAAC;AACF,qBAAa,kCAAkC;IAC7C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA4B;IACxD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA+C;gBAErE,iBAAiB,EAAE,iBAAiB,CAAC,yBAAyB,CAAC,EAAE,WAAW,EAAE,yBAAyB;IAK7G,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAgJ5F;AAED,eAAO,MAAM,wCAAwC,WAAkB,MAAM,WAAW,oBAAoB,gDAQ3G,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { Config, Logger, FetchTransport, LogLevel } from '@amplitude/analytics-core';
2
+ import { SessionReplayOptions, StoreType } from '../typings/session-replay';
3
+ import { SessionReplayLocalConfig as ISessionReplayLocalConfig, InteractionConfig, PrivacyConfig, SessionReplayPerformanceConfig, SessionReplayVersion } from './types';
4
+ export declare const getDefaultConfig: () => {
5
+ flushMaxRetries: number;
6
+ logLevel: LogLevel;
7
+ loggerProvider: Logger;
8
+ transportProvider: FetchTransport;
9
+ };
10
+ export declare class SessionReplayLocalConfig extends Config implements ISessionReplayLocalConfig {
11
+ apiKey: string;
12
+ sampleRate: number;
13
+ privacyConfig?: PrivacyConfig;
14
+ interactionConfig?: InteractionConfig;
15
+ debugMode?: boolean;
16
+ configServerUrl?: string;
17
+ trackServerUrl?: string;
18
+ shouldInlineStylesheet?: boolean;
19
+ version?: SessionReplayVersion;
20
+ storeType: StoreType;
21
+ performanceConfig?: SessionReplayPerformanceConfig;
22
+ experimental?: {
23
+ useWebWorker: boolean;
24
+ };
25
+ constructor(apiKey: string, options: SessionReplayOptions);
26
+ }
27
+ //# sourceMappingURL=local-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-config.d.ts","sourceRoot":"","sources":["../../../src/config/local-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErF,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EACL,wBAAwB,IAAI,yBAAyB,EACrD,iBAAiB,EACjB,aAAa,EACb,8BAA8B,EAC9B,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,gBAAgB;;;;;CAK3B,CAAC;AAEH,qBAAa,wBAAyB,SAAQ,MAAO,YAAW,yBAAyB;IACvF,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,CAAC,EAAE,8BAA8B,CAAC;IACnD,YAAY,CAAC,EAAE;QAAE,YAAY,EAAE,OAAO,CAAA;KAAE,CAAC;gBAE7B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB;CAiC1D"}
@@ -0,0 +1,147 @@
1
+ import { IConfig, LogLevel, ILogger } from '@amplitude/analytics-core';
2
+ import { StoreType, ConsoleLogLevel } from '../typings/session-replay';
3
+ export interface SamplingConfig {
4
+ sample_rate: number;
5
+ capture_enabled: boolean;
6
+ }
7
+ export interface InteractionConfig {
8
+ trackEveryNms?: number;
9
+ enabled: boolean;
10
+ batch: boolean;
11
+ }
12
+ export interface LoggingConfig {
13
+ console: {
14
+ enabled: boolean;
15
+ levels: ConsoleLogLevel[];
16
+ };
17
+ network?: {
18
+ enabled: boolean;
19
+ };
20
+ }
21
+ export type SessionReplayRemoteConfig = {
22
+ sr_sampling_config?: SamplingConfig;
23
+ sr_privacy_config?: PrivacyConfig;
24
+ sr_interaction_config?: InteractionConfig;
25
+ sr_logging_config?: LoggingConfig;
26
+ };
27
+ export interface SessionReplayRemoteConfigAPIResponse {
28
+ configs: {
29
+ sessionReplay: SessionReplayRemoteConfig;
30
+ };
31
+ }
32
+ export type MaskLevel = 'light' | 'medium' | 'conservative';
33
+ export declare const DEFAULT_MASK_LEVEL = "medium";
34
+ export type PrivacyConfig = {
35
+ blockSelector?: string | string[];
36
+ defaultMaskLevel?: MaskLevel;
37
+ maskSelector?: string[];
38
+ unmaskSelector?: string[];
39
+ };
40
+ export interface SessionReplayLocalConfig extends IConfig {
41
+ apiKey: string;
42
+ loggerProvider: ILogger;
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
+ */
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
+ */
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
+ */
66
+ sampleRate: number;
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
+ */
73
+ debugMode?: boolean;
74
+ /**
75
+ * Specifies the endpoint URL to fetch remote configuration.
76
+ * If provided, it overrides the default server zone configuration.
77
+ */
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
+ */
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
+ */
90
+ shouldInlineStylesheet?: boolean;
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
+ */
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
+ */
102
+ storeType: StoreType;
103
+ /**
104
+ * Experimental features.
105
+ */
106
+ experimental?: {
107
+ /**
108
+ * If the SDK should compress the replay events using a webworker.
109
+ */
110
+ useWebWorker: boolean;
111
+ };
112
+ }
113
+ export interface SessionReplayJoinedConfig extends SessionReplayLocalConfig {
114
+ captureEnabled?: boolean;
115
+ interactionConfig?: InteractionConfig;
116
+ loggingConfig?: LoggingConfig;
117
+ }
118
+ export interface SessionReplayRemoteConfigFetch {
119
+ getServerUrl: () => void;
120
+ getSamplingConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig['sr_sampling_config'] | void>;
121
+ fetchRemoteConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig | void>;
122
+ getRemoteConfig: (sessionId?: number) => Promise<SessionReplayRemoteConfig | void>;
123
+ }
124
+ export interface SessionReplayJoinedConfigGenerator {
125
+ generateJoinedConfig: (sessionId?: string | number) => Promise<SessionReplayJoinedConfig>;
126
+ }
127
+ export interface SessionReplayVersion {
128
+ version: string;
129
+ type: SessionReplayType;
130
+ }
131
+ /**
132
+ * Configuration options for session replay performance.
133
+ */
134
+ export interface SessionReplayPerformanceConfig {
135
+ /**
136
+ * If enabled, event compression will be deferred to occur during the browser's idle periods.
137
+ */
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
+ */
144
+ timeout?: number;
145
+ }
146
+ export type SessionReplayType = 'standalone' | 'plugin' | 'segment';
147
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACvE,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,C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
+ export declare const DEFAULT_EVENT_PROPERTY_PREFIX = "[Amplitude]";
3
+ export declare const DEFAULT_SESSION_REPLAY_PROPERTY: string;
4
+ export declare const DEFAULT_SESSION_START_EVENT = "session_start";
5
+ export declare const DEFAULT_SESSION_END_EVENT = "session_end";
6
+ export declare const DEFAULT_SAMPLE_RATE = 0;
7
+ export declare const DEFAULT_SERVER_ZONE = ServerZone.US;
8
+ export declare const SESSION_REPLAY_DEBUG_PROPERTY: string;
9
+ export declare const BLOCK_CLASS = "amp-block";
10
+ export declare const MASK_TEXT_CLASS = "amp-mask";
11
+ export declare const UNMASK_TEXT_CLASS = "amp-unmask";
12
+ export declare const SESSION_REPLAY_SERVER_URL = "https://api-sr.amplitude.com/sessions/v2/track";
13
+ export declare const SESSION_REPLAY_EU_URL = "https://api-sr.eu.amplitude.com/sessions/v2/track";
14
+ export declare const SESSION_REPLAY_STAGING_URL = "https://api-sr.stag2.amplitude.com/sessions/v2/track";
15
+ export declare const STORAGE_PREFIX: string;
16
+ export declare const MAX_EVENT_LIST_SIZE_IN_BYTES: number;
17
+ export declare const INTERACTION_MIN_INTERVAL = 30000;
18
+ export declare const INTERACTION_MAX_INTERVAL = 60000;
19
+ export declare const MIN_INTERVAL = 500;
20
+ export declare const MAX_INTERVAL: number;
21
+ export declare const MAX_IDB_STORAGE_LENGTH: number;
22
+ export declare const KB_SIZE = 1024;
23
+ export declare const MAX_URL_LENGTH = 1000;
24
+ export declare enum CustomRRwebEvent {
25
+ GET_SR_PROPS = "get-sr-props",
26
+ DEBUG_INFO = "debug-info",
27
+ FETCH_REQUEST = "fetch-request"
28
+ }
29
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEzE,eAAO,MAAM,6BAA6B,gBAAgB,CAAC;AAE3D,eAAO,MAAM,+BAA+B,QAAuD,CAAC;AACpG,eAAO,MAAM,2BAA2B,kBAAkB,CAAC;AAC3D,eAAO,MAAM,yBAAyB,gBAAgB,CAAC;AACvD,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAEjD,eAAO,MAAM,6BAA6B,QAA0D,CAAC;AAErG,eAAO,MAAM,WAAW,cAAc,CAAC;AACvC,eAAO,MAAM,eAAe,aAAa,CAAC;AAC1C,eAAO,MAAM,iBAAiB,eAAe,CAAC;AAC9C,eAAO,MAAM,yBAAyB,mDAAmD,CAAC;AAC1F,eAAO,MAAM,qBAAqB,sDAAsD,CAAC;AACzF,eAAO,MAAM,0BAA0B,yDAAyD,CAAC;AACjG,eAAO,MAAM,cAAc,QAAsC,CAAC;AAClE,eAAO,MAAM,4BAA4B,QAAc,CAAC;AACxD,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAC/C,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAC/C,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,YAAY,QAAY,CAAC;AACtC,eAAO,MAAM,sBAAsB,QAA0B,CAAC;AAC9D,eAAO,MAAM,OAAO,OAAO,CAAC;AAC5B,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,oBAAY,gBAAgB;IAC1B,YAAY,iBAAiB;IAC7B,UAAU,eAAe;IACzB,aAAa,kBAAkB;CAChC"}
@@ -0,0 +1,31 @@
1
+ import { Events, EventsStore, SendingSequencesReturn } from '../typings/session-replay';
2
+ import { ILogger } from '@amplitude/analytics-core';
3
+ export type InstanceArgs = {
4
+ loggerProvider: ILogger;
5
+ minInterval?: number;
6
+ maxInterval?: number;
7
+ maxPersistedEventsSize?: number;
8
+ };
9
+ export declare abstract class BaseEventsStore<KeyType> implements EventsStore<KeyType> {
10
+ protected readonly loggerProvider: ILogger;
11
+ private minInterval;
12
+ private maxInterval;
13
+ private maxPersistedEventsSize;
14
+ private interval;
15
+ private _timeAtLastSplit;
16
+ get timeAtLastSplit(): number;
17
+ constructor(args: InstanceArgs);
18
+ abstract addEventToCurrentSequence(sessionId: string | number, event: string): Promise<SendingSequencesReturn<KeyType> | undefined>;
19
+ abstract getSequencesToSend(): Promise<SendingSequencesReturn<KeyType>[] | undefined>;
20
+ abstract storeCurrentSequence(sessionId: number): Promise<SendingSequencesReturn<KeyType> | undefined>;
21
+ abstract storeSendingEvents(sessionId: string | number, events: Events): Promise<KeyType | undefined>;
22
+ abstract cleanUpSessionEventsStore(sessionId: number, sequenceId: KeyType): Promise<void>;
23
+ /**
24
+ * Determines whether to send the events list to the backend and start a new
25
+ * empty events list, based on the size of the list as well as the last time sent
26
+ * @param nextEventString
27
+ * @returns boolean
28
+ */
29
+ shouldSplitEventsList: (events: Events, nextEventString: string) => boolean;
30
+ }
31
+ //# sourceMappingURL=base-events-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-events-store.d.ts","sourceRoot":"","sources":["../../../src/events/base-events-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEpD,MAAM,MAAM,YAAY,GAAG;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,8BAAsB,eAAe,CAAC,OAAO,CAAE,YAAW,WAAW,CAAC,OAAO,CAAC;IAC5E,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IAC3C,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,sBAAsB,CAAgC;IAC9D,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,gBAAgB,CAAc;IAEtC,IAAW,eAAe,WAEzB;gBAEW,IAAI,EAAE,YAAY;IAO9B,QAAQ,CAAC,yBAAyB,CAChC,SAAS,EAAE,MAAM,GAAG,MAAM,EAC1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,sBAAsB,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IACvD,QAAQ,CAAC,kBAAkB,IAAI,OAAO,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;IACrF,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IACtG,QAAQ,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IACrG,QAAQ,CAAC,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAEzF;;;;;OAKG;IACH,qBAAqB,oCAAqC,MAAM,KAAG,OAAO,CAYxE;CACH"}
@@ -0,0 +1,27 @@
1
+ import type { eventWithTime } from '@amplitude/rrweb-types';
2
+ import { SessionReplayJoinedConfig } from '../config/types';
3
+ import { SessionReplayEventsManager } from '../typings/session-replay';
4
+ interface TaskQueue {
5
+ event: eventWithTime;
6
+ sessionId: string | number;
7
+ }
8
+ export declare class EventCompressor {
9
+ taskQueue: TaskQueue[];
10
+ isProcessing: boolean;
11
+ eventsManager?: SessionReplayEventsManager<'replay' | 'interaction', string>;
12
+ config: SessionReplayJoinedConfig;
13
+ deviceId: string | undefined;
14
+ canUseIdleCallback: boolean | undefined;
15
+ timeout: number;
16
+ worker?: Worker;
17
+ constructor(eventsManager: SessionReplayEventsManager<'replay' | 'interaction', string>, config: SessionReplayJoinedConfig, deviceId: string | undefined, workerScriptInternal?: string);
18
+ scheduleIdleProcessing(): void;
19
+ enqueueEvent(event: eventWithTime, sessionId: string | number): void;
20
+ processQueue(idleDeadline: IdleDeadline): void;
21
+ compressEvent: (event: eventWithTime) => string;
22
+ private addCompressedEventToManager;
23
+ addCompressedEvent: (event: eventWithTime, sessionId: string | number) => void;
24
+ terminate: () => void;
25
+ }
26
+ export {};
27
+ //# sourceMappingURL=event-compressor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-compressor.d.ts","sourceRoot":"","sources":["../../../src/events/event-compressor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE,UAAU,SAAS;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B;AAGD,qBAAa,eAAe;IAC1B,SAAS,EAAE,SAAS,EAAE,CAAM;IAC5B,YAAY,UAAS;IACrB,aAAa,CAAC,EAAE,0BAA0B,CAAC,QAAQ,GAAG,aAAa,EAAE,MAAM,CAAC,CAAC;IAC7E,MAAM,EAAE,yBAAyB,CAAC;IAClC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,kBAAkB,EAAE,OAAO,GAAG,SAAS,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;gBAGd,aAAa,EAAE,0BAA0B,CAAC,QAAQ,GAAG,aAAa,EAAE,MAAM,CAAC,EAC3E,MAAM,EAAE,yBAAyB,EACjC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,oBAAoB,CAAC,EAAE,MAAM;IA+BxB,sBAAsB,IAAI,IAAI;IAa9B,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAYpE,YAAY,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAuBrD,aAAa,UAAW,aAAa,YAGnC;IAEF,OAAO,CAAC,2BAA2B,CAQjC;IAEK,kBAAkB,UAAW,aAAa,aAAa,MAAM,GAAG,MAAM,UAQ3E;IAEK,SAAS,aAEd;CACH"}
@@ -0,0 +1,52 @@
1
+ import { DBSchema, IDBPDatabase } from 'idb';
2
+ import { EventType, Events, SendingSequencesReturn } from '../typings/session-replay';
3
+ import { BaseEventsStore, InstanceArgs as BaseInstanceArgs } from './base-events-store';
4
+ export declare const currentSequenceKey = "sessionCurrentSequence";
5
+ export declare const sequencesToSendKey = "sequencesToSend";
6
+ export declare const remoteConfigKey = "remoteConfig";
7
+ export interface SessionReplayDB extends DBSchema {
8
+ sessionCurrentSequence: {
9
+ key: number;
10
+ value: Omit<SendingSequencesReturn<number>, 'sequenceId'>;
11
+ };
12
+ sequencesToSend: {
13
+ key: number;
14
+ value: Omit<SendingSequencesReturn<number>, 'sequenceId'>;
15
+ indexes: {
16
+ sessionId: string | number;
17
+ };
18
+ };
19
+ }
20
+ export declare const keyValDatabaseExists: () => Promise<IDBDatabase | void>;
21
+ export declare const defineObjectStores: (db: IDBPDatabase<SessionReplayDB>) => {
22
+ sequencesStore: import("idb").IDBPObjectStore<SessionReplayDB, ArrayLike<"sessionCurrentSequence" | "sequencesToSend">, "sequencesToSend", "versionchange"> | undefined;
23
+ currentSequenceStore: import("idb").IDBPObjectStore<SessionReplayDB, ArrayLike<"sessionCurrentSequence" | "sequencesToSend">, "sessionCurrentSequence", "versionchange"> | undefined;
24
+ };
25
+ export declare const createStore: (dbName: string) => Promise<IDBPDatabase<SessionReplayDB>>;
26
+ type InstanceArgs = {
27
+ apiKey: string;
28
+ db: IDBPDatabase<SessionReplayDB>;
29
+ } & BaseInstanceArgs;
30
+ export declare class SessionReplayEventsIDBStore extends BaseEventsStore<number> {
31
+ private readonly apiKey;
32
+ private readonly db;
33
+ constructor(args: InstanceArgs);
34
+ static new(type: EventType, args: Omit<InstanceArgs, 'db'>, sessionId?: string | number): Promise<SessionReplayEventsIDBStore | undefined>;
35
+ getCurrentSequenceEvents(sessionId?: number): Promise<Omit<SendingSequencesReturn<number>, "sequenceId">[] | undefined>;
36
+ getSequencesToSend: () => Promise<SendingSequencesReturn<number>[] | undefined>;
37
+ storeCurrentSequence: (sessionId: number) => Promise<{
38
+ sessionId: number;
39
+ sequenceId: number;
40
+ events: Events;
41
+ } | undefined>;
42
+ addEventToCurrentSequence: (sessionId: number, event: string) => Promise<{
43
+ events: Events;
44
+ sessionId: number;
45
+ sequenceId: number;
46
+ } | undefined>;
47
+ storeSendingEvents: (sessionId: number, events: Events) => Promise<number | undefined>;
48
+ cleanUpSessionEventsStore: (_sessionId: number, sequenceId?: number) => Promise<void>;
49
+ transitionFromKeyValStore: (sessionId?: string | number) => Promise<void>;
50
+ }
51
+ export {};
52
+ //# sourceMappingURL=events-idb-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events-idb-store.d.ts","sourceRoot":"","sources":["../../../src/events/events-idb-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAU,MAAM,KAAK,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGxF,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAC3D,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AACpD,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,sBAAsB,EAAE;QACtB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,CAAC;KAC3D,CAAC;IACF,eAAe,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}
@@ -0,0 +1,13 @@
1
+ import { SessionReplayEventsManager as AmplitudeSessionReplayEventsManager, EventType, StoreType } from '../typings/session-replay';
2
+ import { SessionReplayJoinedConfig } from '../config/types';
3
+ import { PayloadBatcher } from '../track-destination';
4
+ export declare const createEventsManager: <Type extends EventType>({ config, sessionId, minInterval, maxInterval, type, payloadBatcher, storeType, }: {
5
+ config: SessionReplayJoinedConfig;
6
+ type: Type;
7
+ minInterval?: number | undefined;
8
+ maxInterval?: number | undefined;
9
+ sessionId?: string | number | undefined;
10
+ payloadBatcher?: PayloadBatcher | undefined;
11
+ storeType: StoreType;
12
+ }) => Promise<AmplitudeSessionReplayEventsManager<Type, string>>;
13
+ //# sourceMappingURL=events-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events-manager.d.ts","sourceRoot":"","sources":["../../../src/events/events-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,IAAI,mCAAmC,EAEjE,SAAS,EACT,SAAS,EACV,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAiC,MAAM,sBAAsB,CAAC;AAIrF,eAAO,MAAM,mBAAmB;YAStB,yBAAyB;;;;;;eAMtB,SAAS;gEAgJrB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Events, SendingSequencesReturn } from '../typings/session-replay';
2
+ import { BaseEventsStore } from './base-events-store';
3
+ export declare class InMemoryEventsStore extends BaseEventsStore<number> {
4
+ private finalizedSequences;
5
+ private sequences;
6
+ private sequenceId;
7
+ private resetCurrentSequence;
8
+ private addSequence;
9
+ getSequencesToSend(): Promise<SendingSequencesReturn<number>[] | undefined>;
10
+ storeCurrentSequence(sessionId: string | number): Promise<SendingSequencesReturn<number> | undefined>;
11
+ addEventToCurrentSequence(sessionId: number, event: string): Promise<SendingSequencesReturn<number> | undefined>;
12
+ storeSendingEvents(sessionId: number, events: Events): Promise<number | undefined>;
13
+ cleanUpSessionEventsStore(_sessionId: number, sequenceId?: number): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=events-memory-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events-memory-store.d.ts","sourceRoot":"","sources":["../../../src/events/events-memory-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,qBAAa,mBAAoB,SAAQ,eAAe,CAAC,MAAM,CAAC;IAC9D,OAAO,CAAC,kBAAkB,CAAwE;IAClG,OAAO,CAAC,SAAS,CAAyC;IAC1D,OAAO,CAAC,UAAU,CAAK;IAEvB,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,WAAW;IAQb,kBAAkB,IAAI,OAAO,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS,CAAC;IAQ3E,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAOrG,yBAAyB,CAC7B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,sBAAsB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAehD,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAMlF,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKxF"}
@@ -0,0 +1,26 @@
1
+ import { SessionReplayRemoteConfig } from '../config/types';
2
+ import { Events } from '../typings/session-replay';
3
+ export declare enum RecordingStatus {
4
+ RECORDING = "recording",
5
+ SENT = "sent"
6
+ }
7
+ export interface IDBStoreSequence {
8
+ events: Events;
9
+ status: RecordingStatus;
10
+ }
11
+ interface IDBRemoteConfig {
12
+ config: SessionReplayRemoteConfig;
13
+ lastFetchedSessionId: number | undefined;
14
+ }
15
+ export interface IDBStoreSession {
16
+ currentSequenceId: number;
17
+ sessionSequences: {
18
+ [sequenceId: number]: IDBStoreSequence;
19
+ };
20
+ }
21
+ export interface IDBStore {
22
+ remoteConfig?: IDBRemoteConfig;
23
+ [sessionId: number]: IDBStoreSession;
24
+ }
25
+ export {};
26
+ //# sourceMappingURL=legacy-idb-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-idb-types.d.ts","sourceRoot":"","sources":["../../../src/events/legacy-idb-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,oBAAY,eAAe;IACzB,SAAS,cAAc;IACvB,IAAI,SAAS;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,eAAe,CAAC;CACzB;AAED,UAAU,eAAe;IACvB,MAAM,EAAE,yBAAyB,CAAC;IAClC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C;AACD,MAAM,WAAW,eAAe;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE;QAChB,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAAC;KACxC,CAAC;CACH;AAED,MAAM,WAAW,QAAQ;IACvB,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;CACtC"}
@@ -0,0 +1,26 @@
1
+ import { SessionReplayEventsManager as AmplitudeSessionReplayEventsManager, EventsManagerWithType } from '../typings/session-replay';
2
+ /**
3
+ * "Registers" events managers internally. When an event is added this class routes the event to the correct
4
+ * manager. For all send or flush methods this will invoke the event for all registered managers.
5
+ */
6
+ export declare class MultiEventManager<EventType, EventDataType> implements AmplitudeSessionReplayEventsManager<EventType, EventDataType> {
7
+ private managers;
8
+ constructor(...managers: EventsManagerWithType<EventType, EventDataType>[]);
9
+ sendStoredEvents(opts: {
10
+ deviceId: string;
11
+ }): Promise<void>;
12
+ addEvent({ sessionId, event, deviceId, }: {
13
+ sessionId: number;
14
+ event: {
15
+ type: EventType;
16
+ data: EventDataType;
17
+ };
18
+ deviceId: string;
19
+ }): void;
20
+ sendCurrentSequenceEvents({ sessionId, deviceId }: {
21
+ sessionId: number;
22
+ deviceId: string;
23
+ }): void;
24
+ flush(useRetry?: boolean | undefined): Promise<void>;
25
+ }
26
+ //# sourceMappingURL=multi-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-manager.d.ts","sourceRoot":"","sources":["../../../src/events/multi-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,IAAI,mCAAmC,EACjE,qBAAqB,EACtB,MAAM,2BAA2B,CAAC;AAEnC;;;GAGG;AACH,qBAAa,iBAAiB,CAAC,SAAS,EAAE,aAAa,CACrD,YAAW,mCAAmC,CAAC,SAAS,EAAE,aAAa,CAAC;IAExE,OAAO,CAAC,QAAQ,CAAgF;gBAEpF,GAAG,QAAQ,EAAE,qBAAqB,CAAC,SAAS,EAAE,aAAa,CAAC,EAAE;IAQpE,gBAAgB,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQjE,QAAQ,CAAC,EACP,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE;QACD,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE;YAAE,IAAI,EAAE,SAAS,CAAC;YAAC,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC;QAChD,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,IAAI;IAIR,yBAAyB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAM3F,KAAK,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAO3D"}
@@ -0,0 +1,46 @@
1
+ import { ServerZone } from '@amplitude/analytics-core';
2
+ import { PrivacyConfig, SessionReplayJoinedConfig } from './config/types';
3
+ import { StorageData } from './typings/session-replay';
4
+ export declare const maskFn: (elementType: 'text' | 'input', config?: PrivacyConfig) => (text: string, element: HTMLElement | null) => string;
5
+ export declare const generateHashCode: (str: string) => number;
6
+ export declare const isSessionInSample: (sessionId: string | number, sampleRate: number) => boolean;
7
+ export declare const getCurrentUrl: () => string;
8
+ export declare const generateSessionReplayId: (sessionId: string | number, deviceId: string) => string;
9
+ export declare const getServerUrl: (serverZone?: keyof typeof ServerZone, trackServerUrl?: string) => string;
10
+ export declare const getStorageSize: () => Promise<StorageData>;
11
+ export declare const getDebugConfig: (config: SessionReplayJoinedConfig) => {
12
+ captureEnabled?: boolean | undefined;
13
+ interactionConfig?: import("./config/types").InteractionConfig | undefined;
14
+ loggingConfig?: import("./config/types").LoggingConfig | undefined;
15
+ apiKey: string;
16
+ loggerProvider: import("@amplitude/analytics-core").ILogger;
17
+ logLevel: import("@amplitude/analytics-core").LogLevel;
18
+ flushMaxRetries: number;
19
+ sampleRate: number;
20
+ privacyConfig?: PrivacyConfig | undefined;
21
+ debugMode?: boolean | undefined;
22
+ configServerUrl?: string | undefined;
23
+ trackServerUrl?: string | undefined;
24
+ shouldInlineStylesheet?: boolean | undefined;
25
+ version?: import("./config/types").SessionReplayVersion | undefined;
26
+ performanceConfig?: import("./config/types").SessionReplayPerformanceConfig | undefined;
27
+ storeType: import("./typings/session-replay").StoreType;
28
+ experimental?: {
29
+ useWebWorker: boolean;
30
+ } | undefined;
31
+ flushIntervalMillis: number;
32
+ flushQueueSize: number;
33
+ instanceName?: string | undefined;
34
+ minIdLength?: number | undefined;
35
+ offline?: boolean | null | undefined;
36
+ optOut: boolean;
37
+ plan?: import("@amplitude/analytics-core").Plan | undefined;
38
+ ingestionMetadata?: import("@amplitude/analytics-core").IngestionMetadata | undefined;
39
+ serverUrl?: string | undefined;
40
+ serverZone?: import("@amplitude/analytics-core").ServerZoneType | undefined;
41
+ storageProvider?: import("@amplitude/analytics-core").Storage<import("@amplitude/analytics-core").Event[]> | undefined;
42
+ transportProvider: import("@amplitude/analytics-core").Transport;
43
+ useBatch: boolean;
44
+ requestMetadata?: import("@amplitude/analytics-core/lib/esm/config").IRequestMetadata | undefined;
45
+ };
46
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,EAAiC,aAAa,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AASzG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAoFvD,eAAO,MAAM,MAAM,gBACH,MAAM,GAAG,OAAO,WAAW,aAAa,YAC/C,MAAM,WAAW,WAAW,GAAG,IAAI,KAAG,MAE5C,CAAC;AAEJ,eAAO,MAAM,gBAAgB,QAAkB,MAAM,WASpD,CAAC;AAEF,eAAO,MAAM,iBAAiB,cAAwB,MAAM,GAAG,MAAM,cAAc,MAAM,YAMxF,CAAC;AAEF,eAAO,MAAM,aAAa,cAGzB,CAAC;AAEF,eAAO,MAAM,uBAAuB,cAAe,MAAM,GAAG,MAAM,YAAY,MAAM,KAAG,MAEtF,CAAC;AAEF,eAAO,MAAM,YAAY,gBAAiB,MAAM,iBAAiB,mBAAmB,MAAM,KAAG,MAc5F,CAAC;AAEF,eAAO,MAAM,cAAc,QAAa,QAAQ,WAAW,CAa1D,CAAC;AAEF,eAAO,MAAM,cAAc,WAAY,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAO/D,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { mouseInteractionCallBack } from '@amplitude/rrweb-types';
2
+ import { SessionReplayEventsManager as AmplitudeSessionReplayEventsManager } from '../typings/session-replay';
3
+ import { PayloadBatcher } from 'src/track-destination';
4
+ import { ILogger } from '@amplitude/analytics-core';
5
+ export type ClickEvent = {
6
+ timestamp: number;
7
+ x: number;
8
+ y: number;
9
+ viewportWidth: number;
10
+ viewportHeight: number;
11
+ pageUrl: string;
12
+ selector?: string;
13
+ type: 'click';
14
+ };
15
+ export type ClickEventWithCount = ClickEvent & {
16
+ count: number;
17
+ };
18
+ type Options = {
19
+ sessionId: string | number;
20
+ deviceIdFn: () => string | undefined;
21
+ eventsManager: AmplitudeSessionReplayEventsManager<'interaction', string>;
22
+ };
23
+ export declare const clickNonBatcher: PayloadBatcher;
24
+ export declare const clickBatcher: PayloadBatcher;
25
+ export declare const clickHook: (logger: ILogger, options: Options) => mouseInteractionCallBack;
26
+ export {};
27
+ //# sourceMappingURL=click.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../src/hooks/click.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAqB,MAAM,wBAAwB,CAAC;AAErF,OAAO,EAAE,0BAA0B,IAAI,mCAAmC,EAAE,MAAM,2BAA2B,CAAC;AAC9G,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAkB,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGpE,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAGF,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACrC,aAAa,EAAE,mCAAmC,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;CAC3E,CAAC;AAIF,eAAO,MAAM,eAAe,EAAE,cAU7B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAyB1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,KAAK,wBAkD5D,CAAC"}