@anyreplay/browser 0.1.0 → 0.1.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/dist/index.d.cts CHANGED
@@ -40,14 +40,15 @@ declare class ConfigError extends Error {
40
40
  declare function resolveOptions(input: AnyReplayOptions): ResolvedOptions;
41
41
 
42
42
  type RecorderStatus = 'idle' | 'awaiting-consent' | 'recording' | 'sampled-out' | 'stopped';
43
+ interface IdentifyTraits {
44
+ userId?: string;
45
+ email?: string;
46
+ }
43
47
  interface RecorderHandle {
44
48
  status: () => RecorderStatus;
45
49
  sessionId: () => string | null;
46
50
  consent: (granted: boolean) => void;
47
- identify: (traits: {
48
- userId?: string;
49
- email?: string;
50
- }) => void;
51
+ identify: (traits: IdentifyTraits) => void;
51
52
  /**
52
53
  * Tags this moment of the recording so it shows on the player's timeline.
53
54
  *
@@ -199,6 +200,18 @@ interface Identity {
199
200
  * id resets after a period of inactivity.
200
201
  */
201
202
  declare function resolveIdentity(local: Storage, session: Storage, now?: number): Identity;
203
+ /**
204
+ * Removes everything the recorder has stored in this browser.
205
+ *
206
+ * Called when consent is refused. A refusal has to undo an earlier acceptance,
207
+ * not merely stop the current page: the visitor id written last week is
208
+ * exactly what the visitor is now saying no to, and leaving it in place would
209
+ * make "we store nothing without consent" untrue for as long as it sat there.
210
+ * The cool-down goes too — it is a fact about a session that no longer exists.
211
+ * Removing a key that is not there creates nothing, so this is safe to call
212
+ * before anything was ever written.
213
+ */
214
+ declare function forgetVisitor(local: Storage, session: Storage): void;
202
215
 
203
216
  /**
204
217
  * Custom events: the moments a page tags with `track()`.
@@ -225,4 +238,4 @@ interface TrackPayload {
225
238
  */
226
239
  declare function validateTrack(name: unknown, properties: unknown): TrackPayload | string;
227
240
 
228
- export { type AnyReplayOptions, ConfigError, DEFAULTS, EVENT_NAME_PATTERN, MAX_PROPERTIES_BYTES, NAVIGATE_TAG, type RecordedEvent, type RecorderHandle, type RecorderStatus, type ResolvedOptions, type SessionMeta, TRACK_TAG, type TrackPayload, Transport, createRecorder, hashToUnitInterval, isSampledIn, resolveIdentity, resolveOptions, safeStorage, uuidv4, validateTrack };
241
+ export { type AnyReplayOptions, ConfigError, DEFAULTS, EVENT_NAME_PATTERN, MAX_PROPERTIES_BYTES, NAVIGATE_TAG, type RecordedEvent, type RecorderHandle, type RecorderStatus, type ResolvedOptions, type SessionMeta, TRACK_TAG, type TrackPayload, Transport, createRecorder, forgetVisitor, hashToUnitInterval, isSampledIn, resolveIdentity, resolveOptions, safeStorage, uuidv4, validateTrack };
package/dist/index.d.ts CHANGED
@@ -40,14 +40,15 @@ declare class ConfigError extends Error {
40
40
  declare function resolveOptions(input: AnyReplayOptions): ResolvedOptions;
41
41
 
42
42
  type RecorderStatus = 'idle' | 'awaiting-consent' | 'recording' | 'sampled-out' | 'stopped';
43
+ interface IdentifyTraits {
44
+ userId?: string;
45
+ email?: string;
46
+ }
43
47
  interface RecorderHandle {
44
48
  status: () => RecorderStatus;
45
49
  sessionId: () => string | null;
46
50
  consent: (granted: boolean) => void;
47
- identify: (traits: {
48
- userId?: string;
49
- email?: string;
50
- }) => void;
51
+ identify: (traits: IdentifyTraits) => void;
51
52
  /**
52
53
  * Tags this moment of the recording so it shows on the player's timeline.
53
54
  *
@@ -199,6 +200,18 @@ interface Identity {
199
200
  * id resets after a period of inactivity.
200
201
  */
201
202
  declare function resolveIdentity(local: Storage, session: Storage, now?: number): Identity;
203
+ /**
204
+ * Removes everything the recorder has stored in this browser.
205
+ *
206
+ * Called when consent is refused. A refusal has to undo an earlier acceptance,
207
+ * not merely stop the current page: the visitor id written last week is
208
+ * exactly what the visitor is now saying no to, and leaving it in place would
209
+ * make "we store nothing without consent" untrue for as long as it sat there.
210
+ * The cool-down goes too — it is a fact about a session that no longer exists.
211
+ * Removing a key that is not there creates nothing, so this is safe to call
212
+ * before anything was ever written.
213
+ */
214
+ declare function forgetVisitor(local: Storage, session: Storage): void;
202
215
 
203
216
  /**
204
217
  * Custom events: the moments a page tags with `track()`.
@@ -225,4 +238,4 @@ interface TrackPayload {
225
238
  */
226
239
  declare function validateTrack(name: unknown, properties: unknown): TrackPayload | string;
227
240
 
228
- export { type AnyReplayOptions, ConfigError, DEFAULTS, EVENT_NAME_PATTERN, MAX_PROPERTIES_BYTES, NAVIGATE_TAG, type RecordedEvent, type RecorderHandle, type RecorderStatus, type ResolvedOptions, type SessionMeta, TRACK_TAG, type TrackPayload, Transport, createRecorder, hashToUnitInterval, isSampledIn, resolveIdentity, resolveOptions, safeStorage, uuidv4, validateTrack };
241
+ export { type AnyReplayOptions, ConfigError, DEFAULTS, EVENT_NAME_PATTERN, MAX_PROPERTIES_BYTES, NAVIGATE_TAG, type RecordedEvent, type RecorderHandle, type RecorderStatus, type ResolvedOptions, type SessionMeta, TRACK_TAG, type TrackPayload, Transport, createRecorder, forgetVisitor, hashToUnitInterval, isSampledIn, resolveIdentity, resolveOptions, safeStorage, uuidv4, validateTrack };