@unifold/analytics 0.1.77 → 0.1.79

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.mts CHANGED
@@ -97,6 +97,22 @@ interface AnalyticsProperties {
97
97
  wallet?: string;
98
98
  /** Transaction amount in USD. */
99
99
  amount_usd?: string;
100
+ /**
101
+ * Direct execution id (`exec_<ksuid>`) the flow produced, when one exists.
102
+ * High cardinality — this is a join key back to the execution row, not a
103
+ * breakdown dimension.
104
+ */
105
+ execution_id?: string;
106
+ /** Payment intent id (`pi_<ksuid>`) a checkout journey paid, when one exists. */
107
+ payment_intent_id?: string;
108
+ /**
109
+ * Deposit wallet id (`wallet_<ksuid>`) the flow is funding. Sent on
110
+ * `flow_started`, where no execution exists yet — an execution is created
111
+ * only once funds land on this wallet, and carries the same id, so this is
112
+ * how a started-but-never-completed journey is matched to whatever
113
+ * execution did (or didn't) follow.
114
+ */
115
+ deposit_wallet_id?: string;
100
116
  /** Human-readable token amount (standard unit, e.g. "0.5"). */
101
117
  amount?: string;
102
118
  /** Token amount in base units (smallest denomination). */
@@ -171,8 +187,9 @@ interface AnalyticsEvent {
171
187
  */
172
188
  sessionId?: string;
173
189
  /**
174
- * Internal Unifold user.id (`user_<ksuid>`), typically obtained from the
175
- * deposit-addresses response. Serialized to the wire as `user_id`.
190
+ * Internal Unifold user.id (`user_<ksuid>`), obtained from whichever API
191
+ * response resolves it first — deposit addresses, the execution query, a
192
+ * payment intent. Serialized to the wire as `user_id`.
176
193
  */
177
194
  userId?: string;
178
195
  properties: AnalyticsProperties;
@@ -246,8 +263,12 @@ declare class EventTracker {
246
263
  track(eventName: AnalyticsEventName, properties?: AnalyticsProperties): void;
247
264
  /**
248
265
  * Associate subsequent events with an internal Unifold user.id
249
- * (`user_<ksuid>`). Pass `null` to clear. Usually called once the
250
- * deposit-addresses response returns the id.
266
+ * (`user_<ksuid>`). Pass `null` to clear.
267
+ *
268
+ * The tracker is shared across flows and outlives any one journey, so a
269
+ * journey stamps its own user at the start — with the id if it already
270
+ * knows one, `null` if it doesn't — rather than inheriting whatever the
271
+ * previous journey left here.
251
272
  */
252
273
  setUserId(userId: string | null): void;
253
274
  /**
@@ -256,8 +277,8 @@ declare class EventTracker {
256
277
  * {@link EventTracker.endSession} carries it.
257
278
  *
258
279
  * Does not touch `userId`: the internal `user_<ksuid>` is attached separately
259
- * via {@link EventTracker.setUserId} once the deposit-addresses response
260
- * returns, and persists until the host replaces it.
280
+ * via {@link EventTracker.setUserId}, and persists until the host replaces
281
+ * it which the SDK's modals do on every journey start.
261
282
  */
262
283
  startSession(): string;
263
284
  /**
@@ -324,6 +345,6 @@ declare function generateKSUID(): string;
324
345
  */
325
346
  declare function generatePrefixedKSUID(prefix: string): string;
326
347
 
327
- declare const PACKAGE_VERSION = "0.1.77";
348
+ declare const PACKAGE_VERSION = "0.1.79";
328
349
 
329
350
  export { type AnalyticsConfig, type AnalyticsContext, type AnalyticsEvent, type AnalyticsEventName, AnalyticsEvents, type AnalyticsProperties, Emitter, EventTracker, PACKAGE_VERSION, createEventTracker, forwardEvent, generateKSUID, generatePrefixedKSUID };
package/dist/index.d.ts CHANGED
@@ -97,6 +97,22 @@ interface AnalyticsProperties {
97
97
  wallet?: string;
98
98
  /** Transaction amount in USD. */
99
99
  amount_usd?: string;
100
+ /**
101
+ * Direct execution id (`exec_<ksuid>`) the flow produced, when one exists.
102
+ * High cardinality — this is a join key back to the execution row, not a
103
+ * breakdown dimension.
104
+ */
105
+ execution_id?: string;
106
+ /** Payment intent id (`pi_<ksuid>`) a checkout journey paid, when one exists. */
107
+ payment_intent_id?: string;
108
+ /**
109
+ * Deposit wallet id (`wallet_<ksuid>`) the flow is funding. Sent on
110
+ * `flow_started`, where no execution exists yet — an execution is created
111
+ * only once funds land on this wallet, and carries the same id, so this is
112
+ * how a started-but-never-completed journey is matched to whatever
113
+ * execution did (or didn't) follow.
114
+ */
115
+ deposit_wallet_id?: string;
100
116
  /** Human-readable token amount (standard unit, e.g. "0.5"). */
101
117
  amount?: string;
102
118
  /** Token amount in base units (smallest denomination). */
@@ -171,8 +187,9 @@ interface AnalyticsEvent {
171
187
  */
172
188
  sessionId?: string;
173
189
  /**
174
- * Internal Unifold user.id (`user_<ksuid>`), typically obtained from the
175
- * deposit-addresses response. Serialized to the wire as `user_id`.
190
+ * Internal Unifold user.id (`user_<ksuid>`), obtained from whichever API
191
+ * response resolves it first — deposit addresses, the execution query, a
192
+ * payment intent. Serialized to the wire as `user_id`.
176
193
  */
177
194
  userId?: string;
178
195
  properties: AnalyticsProperties;
@@ -246,8 +263,12 @@ declare class EventTracker {
246
263
  track(eventName: AnalyticsEventName, properties?: AnalyticsProperties): void;
247
264
  /**
248
265
  * Associate subsequent events with an internal Unifold user.id
249
- * (`user_<ksuid>`). Pass `null` to clear. Usually called once the
250
- * deposit-addresses response returns the id.
266
+ * (`user_<ksuid>`). Pass `null` to clear.
267
+ *
268
+ * The tracker is shared across flows and outlives any one journey, so a
269
+ * journey stamps its own user at the start — with the id if it already
270
+ * knows one, `null` if it doesn't — rather than inheriting whatever the
271
+ * previous journey left here.
251
272
  */
252
273
  setUserId(userId: string | null): void;
253
274
  /**
@@ -256,8 +277,8 @@ declare class EventTracker {
256
277
  * {@link EventTracker.endSession} carries it.
257
278
  *
258
279
  * Does not touch `userId`: the internal `user_<ksuid>` is attached separately
259
- * via {@link EventTracker.setUserId} once the deposit-addresses response
260
- * returns, and persists until the host replaces it.
280
+ * via {@link EventTracker.setUserId}, and persists until the host replaces
281
+ * it which the SDK's modals do on every journey start.
261
282
  */
262
283
  startSession(): string;
263
284
  /**
@@ -324,6 +345,6 @@ declare function generateKSUID(): string;
324
345
  */
325
346
  declare function generatePrefixedKSUID(prefix: string): string;
326
347
 
327
- declare const PACKAGE_VERSION = "0.1.77";
348
+ declare const PACKAGE_VERSION = "0.1.79";
328
349
 
329
350
  export { type AnalyticsConfig, type AnalyticsContext, type AnalyticsEvent, type AnalyticsEventName, AnalyticsEvents, type AnalyticsProperties, Emitter, EventTracker, PACKAGE_VERSION, createEventTracker, forwardEvent, generateKSUID, generatePrefixedKSUID };
package/dist/index.js CHANGED
@@ -100,7 +100,7 @@ function generatePrefixedKSUID(prefix) {
100
100
  }
101
101
 
102
102
  // src/version.ts
103
- var PACKAGE_VERSION = "0.1.77";
103
+ var PACKAGE_VERSION = "0.1.79";
104
104
 
105
105
  // src/tracker.ts
106
106
  var LIBRARY_NAME = "@unifold/analytics";
@@ -193,8 +193,12 @@ var EventTracker = class {
193
193
  }
194
194
  /**
195
195
  * Associate subsequent events with an internal Unifold user.id
196
- * (`user_<ksuid>`). Pass `null` to clear. Usually called once the
197
- * deposit-addresses response returns the id.
196
+ * (`user_<ksuid>`). Pass `null` to clear.
197
+ *
198
+ * The tracker is shared across flows and outlives any one journey, so a
199
+ * journey stamps its own user at the start — with the id if it already
200
+ * knows one, `null` if it doesn't — rather than inheriting whatever the
201
+ * previous journey left here.
198
202
  */
199
203
  setUserId(userId) {
200
204
  this.userId = userId || void 0;
@@ -205,8 +209,8 @@ var EventTracker = class {
205
209
  * {@link EventTracker.endSession} carries it.
206
210
  *
207
211
  * Does not touch `userId`: the internal `user_<ksuid>` is attached separately
208
- * via {@link EventTracker.setUserId} once the deposit-addresses response
209
- * returns, and persists until the host replaces it.
212
+ * via {@link EventTracker.setUserId}, and persists until the host replaces
213
+ * it which the SDK's modals do on every journey start.
210
214
  */
211
215
  startSession() {
212
216
  this.sessionId = generatePrefixedKSUID(SESSION_PREFIX);
package/dist/index.mjs CHANGED
@@ -98,7 +98,7 @@ function generatePrefixedKSUID(prefix) {
98
98
  }
99
99
 
100
100
  // src/version.ts
101
- var PACKAGE_VERSION = "0.1.77";
101
+ var PACKAGE_VERSION = "0.1.79";
102
102
 
103
103
  // src/tracker.ts
104
104
  var LIBRARY_NAME = "@unifold/analytics";
@@ -191,8 +191,12 @@ var EventTracker = class {
191
191
  }
192
192
  /**
193
193
  * Associate subsequent events with an internal Unifold user.id
194
- * (`user_<ksuid>`). Pass `null` to clear. Usually called once the
195
- * deposit-addresses response returns the id.
194
+ * (`user_<ksuid>`). Pass `null` to clear.
195
+ *
196
+ * The tracker is shared across flows and outlives any one journey, so a
197
+ * journey stamps its own user at the start — with the id if it already
198
+ * knows one, `null` if it doesn't — rather than inheriting whatever the
199
+ * previous journey left here.
196
200
  */
197
201
  setUserId(userId) {
198
202
  this.userId = userId || void 0;
@@ -203,8 +207,8 @@ var EventTracker = class {
203
207
  * {@link EventTracker.endSession} carries it.
204
208
  *
205
209
  * Does not touch `userId`: the internal `user_<ksuid>` is attached separately
206
- * via {@link EventTracker.setUserId} once the deposit-addresses response
207
- * returns, and persists until the host replaces it.
210
+ * via {@link EventTracker.setUserId}, and persists until the host replaces
211
+ * it which the SDK's modals do on every journey start.
208
212
  */
209
213
  startSession() {
210
214
  this.sessionId = generatePrefixedKSUID(SESSION_PREFIX);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifold/analytics",
3
- "version": "0.1.77",
3
+ "version": "0.1.79",
4
4
  "description": "Lightweight internal analytics for the Unifold SDK — zero external dependencies",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",