@outlit/browser 0.4.1 → 1.0.1

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.
@@ -1,4 +1,4 @@
1
- import { TrackerConfig, BrowserTrackOptions, BrowserIdentifyOptions } from '@outlit/core';
1
+ import { TrackerConfig, BrowserTrackOptions, BrowserIdentifyOptions, CustomerIdentifier } from '@outlit/core';
2
2
 
3
3
  interface OutlitOptions extends TrackerConfig {
4
4
  /**
@@ -50,6 +50,9 @@ interface UserIdentity {
50
50
  userId?: string;
51
51
  traits?: Record<string, string | number | boolean | null>;
52
52
  }
53
+ interface BillingOptions extends CustomerIdentifier {
54
+ properties?: Record<string, string | number | boolean | null>;
55
+ }
53
56
  declare class Outlit {
54
57
  private publicKey;
55
58
  private apiHost;
@@ -88,7 +91,7 @@ declare class Outlit {
88
91
  * Links the anonymous visitor to a known user.
89
92
  *
90
93
  * When email or userId is provided, also sets the current user identity
91
- * for stage events (activate, engaged, paid).
94
+ * for stage events (activate, engaged, inactive).
92
95
  */
93
96
  identify(options: BrowserIdentifyOptions): void;
94
97
  /**
@@ -114,33 +117,27 @@ declare class Outlit {
114
117
  */
115
118
  private applyUser;
116
119
  /**
117
- * Mark the current user as activated.
118
- * This is typically called after a user completes onboarding or a key activation milestone.
119
- * Requires the user to be identified (via setUser or identify with userId).
120
- */
121
- activate(properties?: Record<string, string | number | boolean | null>): void;
122
- /**
123
- * Mark the current user as engaged.
124
- * This is typically called when a user reaches a usage milestone.
125
- * Can also be computed automatically by the engagement cron.
120
+ * User namespace methods for contact journey stages.
126
121
  */
127
- engaged(properties?: Record<string, string | number | boolean | null>): void;
122
+ readonly user: {
123
+ identify: (options: BrowserIdentifyOptions) => void;
124
+ activate: (properties?: Record<string, string | number | boolean | null>) => void;
125
+ engaged: (properties?: Record<string, string | number | boolean | null>) => void;
126
+ inactive: (properties?: Record<string, string | number | boolean | null>) => void;
127
+ };
128
128
  /**
129
- * Mark the current user as paid.
130
- * This is typically called after a successful payment/subscription.
131
- * Can also be triggered by Stripe integration.
129
+ * Customer namespace methods for billing status.
132
130
  */
133
- paid(properties?: Record<string, string | number | boolean | null>): void;
134
- /**
135
- * Mark the current user as churned.
136
- * This is typically called when a subscription is cancelled.
137
- * Can also be triggered by Stripe integration.
138
- */
139
- churned(properties?: Record<string, string | number | boolean | null>): void;
131
+ readonly customer: {
132
+ trialing: (options: BillingOptions) => void;
133
+ paid: (options: BillingOptions) => void;
134
+ churned: (options: BillingOptions) => void;
135
+ };
140
136
  /**
141
137
  * Internal method to send a stage event.
142
138
  */
143
139
  private sendStageEvent;
140
+ private sendBillingEvent;
144
141
  /**
145
142
  * Get the current visitor ID.
146
143
  * Returns null if tracking is not enabled.
@@ -204,24 +201,10 @@ declare function setUser(identity: UserIdentity): void;
204
201
  */
205
202
  declare function clearUser(): void;
206
203
  /**
207
- * Mark the current user as activated.
208
- * Convenience method that uses the singleton instance.
209
- */
210
- declare function activate(properties?: Record<string, string | number | boolean | null>): void;
211
- /**
212
- * Mark the current user as engaged.
213
- * Convenience method that uses the singleton instance.
214
- */
215
- declare function engaged(properties?: Record<string, string | number | boolean | null>): void;
216
- /**
217
- * Mark the current user as paid.
218
- * Convenience method that uses the singleton instance.
219
- */
220
- declare function paid(properties?: Record<string, string | number | boolean | null>): void;
221
- /**
222
- * Mark the current user as churned.
204
+ * Access user and customer namespaces.
223
205
  * Convenience method that uses the singleton instance.
224
206
  */
225
- declare function churned(properties?: Record<string, string | number | boolean | null>): void;
207
+ declare function user(): Outlit["user"];
208
+ declare function customer(): Outlit["customer"];
226
209
 
227
- export { Outlit as O, type UserIdentity as U, identify as a, isTrackingEnabled as b, clearUser as c, activate as d, enableTracking as e, engaged as f, getInstance as g, churned as h, init as i, type OutlitOptions as j, paid as p, setUser as s, track as t };
210
+ export { type BillingOptions as B, Outlit as O, type UserIdentity as U, identify as a, isTrackingEnabled as b, clearUser as c, customer as d, enableTracking as e, type OutlitOptions as f, getInstance as g, init as i, setUser as s, track as t, user as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outlit/browser",
3
- "version": "0.4.1",
3
+ "version": "1.0.1",
4
4
  "description": "Outlit browser tracking SDK with React bindings",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Outlit AI",
@@ -52,7 +52,7 @@
52
52
  "dist"
53
53
  ],
54
54
  "dependencies": {
55
- "@outlit/core": "0.4.0"
55
+ "@outlit/core": "1.0.1"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@playwright/test": "^1.48.0",