iris-recorder 0.3.0 → 0.4.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.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,12 @@
1
+ /**
2
+ * App-supplied user identity: string values, or nested objects of the same
3
+ * shape. Deliberately small — the SDK enforces depth/key/size budgets before
4
+ * anything leaves the page.
5
+ */
6
+ type IrisUser = {
7
+ [key: string]: string | IrisUser;
8
+ };
9
+
1
10
  interface TrackOptions {
2
11
  /** per-session budget of tracked events — a loop can't flood the session (default 500) */
3
12
  maxEvents?: number;
@@ -55,7 +64,10 @@ interface RecordConfig {
55
64
  projectKey: string;
56
65
  /** build identifier, used to match source maps. Pass your git SHA. */
57
66
  release?: string;
58
- /** app-supplied user identity for this session */
67
+ /** app-supplied user identity for this session — a small object of string
68
+ (or nested) values, e.g. `{ id: 'staff-042', name: 'Daisy', station: { till: 'till-3' } }` */
69
+ user?: IrisUser;
70
+ /** legacy string form of `user` — still supported; same as `user: { id: … }` */
59
71
  userId?: string;
60
72
  replay?: boolean;
61
73
  errors?: boolean;
@@ -81,8 +93,9 @@ interface IrisHandle {
81
93
  stop: () => void;
82
94
  /** Force an immediate flush. */
83
95
  flush: () => void;
84
- /** Attach the signed-in user to this session (applies from the next flush). */
85
- identify: (userId: string) => void;
96
+ /** Attach the signed-in user to this session (applies from the next flush).
97
+ Takes a small user object — or a plain string id, the legacy form. */
98
+ identify: (user: string | IrisUser) => void;
86
99
  /**
87
100
  * Record an app-defined business event, e.g.
88
101
  * `iris.track('receipt_printed', { total: 42.5 })`. Props are masked with
@@ -100,4 +113,4 @@ interface IrisHandle {
100
113
  */
101
114
  declare function record(config: RecordConfig): IrisHandle;
102
115
 
103
- export { type ConsoleOptions, type IrisHandle, type NetworkOptions, type RecordConfig, type TrackOptions, record };
116
+ export { type ConsoleOptions, type IrisHandle, type IrisUser, type NetworkOptions, type RecordConfig, type TrackOptions, record };