@jitsu/protocols 1.9.10 → 1.9.11

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.
Files changed (2) hide show
  1. package/analytics.d.ts +21 -3
  2. package/package.json +1 -1
package/analytics.d.ts CHANGED
@@ -189,7 +189,7 @@ interface AnalyticsContext {
189
189
 
190
190
  locale?: string;
191
191
 
192
- library?: {
192
+ xlibrary?: {
193
193
  name: string;
194
194
  version: string;
195
195
  //allow to add custom fields
@@ -316,6 +316,8 @@ export type RuntimeFacade = {
316
316
  pageTitle(): string | undefined;
317
317
  };
318
318
 
319
+ export type ErrorHandler = (message: string, ...args: any[]) => void;
320
+
319
321
  export type JitsuOptions = {
320
322
  /**
321
323
  * API Key. Optional. If not set, Jitsu will send event to the server without auth, and server
@@ -372,6 +374,11 @@ export type JitsuOptions = {
372
374
  */
373
375
  idEndpoint?: string;
374
376
 
377
+ /**
378
+ * What to do with errors. It can log it, rethrow or run a custom handler. Default value: "log"
379
+ */
380
+ errorPolicy?: ErrorHandler | "rethrow" | "log";
381
+
375
382
  privacy?: {
376
383
  dontSend?: boolean;
377
384
  disableUserIds?: boolean;
@@ -382,6 +389,17 @@ export type JitsuOptions = {
382
389
 
383
390
  export type DynamicJitsuOptions = Pick<JitsuOptions, "privacy" | "debug" | "echoEvents">;
384
391
 
392
+ export type Traits = {
393
+ [key: string]: JSONValue;
394
+ //some traits, all starting with $, are reserved for signalling the behavior of the event
395
+
396
+ /**
397
+ * Tells Jitsu to process event, but not send it to server. Used for .identify() and .group() calls
398
+ * that are intended to update user/group state, but not send events
399
+ */
400
+ $doNotSend?: boolean;
401
+ };
402
+
385
403
  export interface AnalyticsInterface {
386
404
  track(
387
405
  eventName: string | JSONObject,
@@ -400,12 +418,12 @@ export interface AnalyticsInterface {
400
418
 
401
419
  group(
402
420
  groupId?: ID | object,
403
- traits?: JSONObject | null,
421
+ traits?: Traits | null,
404
422
  options?: Options,
405
423
  callback?: Callback
406
424
  ): Promise<DispatchedEvent>;
407
425
 
408
- identify(id?: ID | object, traits?: JSONObject | Callback | null, callback?: Callback): Promise<DispatchedEvent>;
426
+ identify(id?: ID | Traits, traits?: Traits | Callback | null, callback?: Callback): Promise<DispatchedEvent>;
409
427
 
410
428
  reset(callback?: (...params: any[]) => any): Promise<any>;
411
429
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jitsu/protocols",
3
- "version": "1.9.10",
3
+ "version": "1.9.11",
4
4
  "description": "",
5
5
  "author": "Jitsu Dev Team <dev@jitsu.com>",
6
6
  "publishConfig": {