@usermaven/sdk-js 1.0.0 → 1.0.4

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.
@@ -27,7 +27,7 @@ export type UsermavenClient = {
27
27
  rawTrack: (payload: any) => void
28
28
 
29
29
  /**
30
- * Sets a user data
30
+ * Sets a user data including organization/company data
31
31
  * @param userData user data (as map id_type --> value, such as "email": "a@bcd.com"
32
32
  * @param doNotSendEvent if true (false by default), separate "id" event won't be sent to server
33
33
  * @return Promise, see _send3p documentation
@@ -59,7 +59,6 @@ export type UsermavenClient = {
59
59
  * User
60
60
  */
61
61
  unset(propertyName: string, opts: { eventType?: string, persist?: boolean });
62
-
63
62
  }
64
63
 
65
64
  /**
@@ -88,6 +87,11 @@ export type Policy = 'strict' | 'keep' | 'comply'
88
87
  */
89
88
  export type UsermavenOptions = {
90
89
 
90
+ /**
91
+ * If auto-capturing is enabled on all sort of events | for future work
92
+ */
93
+ autocapture?: boolean,
94
+
91
95
  /**
92
96
  * If Usermaven should work in compatibility mode. If set to true:
93
97
  * - event_type will be set to 'eventn' instead of 'usermaven'
@@ -182,9 +186,37 @@ export type UsermavenOptions = {
182
186
  */
183
187
  log_level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'NONE';
184
188
 
189
+ /**
190
+ * Type of persistence required
191
+ * Possible values: cookie | localStorage | localStorage+cookie | memory
192
+ * Default value: cookie
193
+ */
194
+ persistence?: PersistenceType;
195
+
196
+ /**
197
+ * Persistent connection name
198
+ */
199
+ persistence_name?: string;
200
+
201
+ /**
202
+ * Persistent connection version
203
+ */
204
+ project_id?: string;
205
+
185
206
  //NOTE: If any property is added here, please make sure it's added to browser.ts usermavenProps as well
207
+
186
208
  };
187
209
 
210
+ /**
211
+ * Company Attributes
212
+ */
213
+ export interface CompanyProps {
214
+ id: string; // Company ID
215
+ name: string; // Company Name
216
+ created_at: string; // Company creation date
217
+ custom: any; // Optional attributes such as industry, website, employee count etc.
218
+ }
219
+
188
220
  /**
189
221
  * User properties (ids).
190
222
  */
@@ -193,6 +225,7 @@ export interface UserProps {
193
225
  id?: string //user id (non anonymous). If not set, first known id (from propName below) will be used
194
226
  email?: string //user id (non anonymous). If not set, first known id (from propName below) will be used
195
227
  [propName: string]: any //any other forms of ids
228
+ company?: CompanyProps
196
229
  }
197
230
 
198
231
  /**
@@ -221,6 +254,7 @@ export type Conversion = {
221
254
  export type EventCtx = {
222
255
  event_id: string //unique event id or empty string for generating id on the backend side
223
256
  user: UserProps //user properties
257
+ company?: CompanyProps //company properties
224
258
  ids?: ThirdpartyIds //user ids from external systems
225
259
  user_agent: string //user
226
260
  utc_time: string //current UTC time in ISO 8601
@@ -228,7 +262,7 @@ export type EventCtx = {
228
262
  referer: string //document referer
229
263
  url: string //current url
230
264
  page_title: string //page title
231
- //see UTM_TYPES for all supported utm tags
265
+ //see UTM_TYPES for all supported utm tags
232
266
  doc_path: string //document path
233
267
  doc_host: string //document host
234
268
  doc_search: string //document search string
@@ -258,9 +292,9 @@ export type Transport = (url: string, jsonPayload: string) => Promise<void>
258
292
  * Type of event source
259
293
  */
260
294
  export type EventSrc =
261
- 'jitsu' | //event came directly from Usermaven
262
- 'eventn' | //same as usermaven but for 'compat' mode, see
263
- 'ga' | //event is intercepted from GA
295
+ 'usermaven' | //event came directly from Usermaven
296
+ 'eventn' | //same as usermaven but for 'compat' mode, see
297
+ 'ga' | //event is intercepted from GA
264
298
  '3rdparty' | //event is intercepted from 3rdparty source
265
299
  'ajs'; //event is intercepted from analytics.js
266
300
 
@@ -287,3 +321,4 @@ export type EventCompat = EventBasics & {
287
321
  eventn_ctx: EventCtx
288
322
  } & EventPayload;
289
323
 
324
+ export type PersistenceType = 'cookie' | 'localStorage' | 'localStorage+cookie' | 'memory';