@jitsu/js 1.10.1-canary.1321.20250430101335 → 1.10.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.
@@ -0,0 +1,38 @@
1
+ import { PersistentStorage, JitsuOptions, RuntimeFacade, AnalyticsInterface } from '@jitsu/protocols/analytics';
2
+ export { AnalyticsInterface, Callback, DispatchedEvent, DynamicJitsuOptions, ID, JSONObject, JitsuOptions, Options, PersistentStorage, RuntimeFacade } from '@jitsu/protocols/analytics';
3
+ import { AnalyticsPlugin } from 'analytics';
4
+
5
+ declare const parseQuery: (qs?: string) => Record<string, string>;
6
+ type StorageFactory = (cookieDomain: string, key2Cookie: (key: string) => string) => PersistentStorage;
7
+ declare function windowRuntime(opts: JitsuOptions): RuntimeFacade;
8
+ declare function createInMemoryStorage(debug?: boolean): PersistentStorage;
9
+ declare const emptyRuntime: (config: JitsuOptions) => RuntimeFacade;
10
+ declare function isInBrowser(): boolean;
11
+ type DestinationDescriptor = {
12
+ id: string;
13
+ destinationType: string;
14
+ credentials: any;
15
+ options: any;
16
+ newEvents?: any[];
17
+ deviceOptions: DeviceOptions;
18
+ };
19
+ type AnalyticsPluginDescriptor = {
20
+ type: "analytics-plugin";
21
+ packageCdn: string;
22
+ moduleVarName: string;
23
+ };
24
+ type InternalPluginDescriptor = {
25
+ type: "internal-plugin";
26
+ name: string;
27
+ };
28
+ type DeviceOptions = AnalyticsPluginDescriptor | InternalPluginDescriptor;
29
+ declare const jitsuAnalyticsPlugin: (jitsuOptions: JitsuOptions, storage: PersistentStorage) => AnalyticsPlugin;
30
+ declare function randomId(hashString?: string | undefined): string;
31
+ declare function uuid(): string;
32
+
33
+ declare function parse(input: any): any;
34
+ declare const emptyAnalytics: AnalyticsInterface;
35
+ declare function jitsuAnalytics(_opts: JitsuOptions): AnalyticsInterface;
36
+
37
+ export { createInMemoryStorage, parse as default, emptyAnalytics, emptyRuntime, isInBrowser, jitsuAnalytics, jitsuAnalyticsPlugin, parseQuery, randomId, uuid, windowRuntime };
38
+ export type { AnalyticsPluginDescriptor, DestinationDescriptor, DeviceOptions, InternalPluginDescriptor, StorageFactory };
@@ -1483,6 +1483,10 @@ function parse(input) {
1483
1483
  }
1484
1484
  const emptyAnalytics = {
1485
1485
  setAnonymousId: () => { },
1486
+ setContextProperty(name, value) { },
1487
+ getContextProperty(name) {
1488
+ return undefined;
1489
+ },
1486
1490
  track: () => Promise.resolve(),
1487
1491
  page: () => Promise.resolve(),
1488
1492
  user: () => ({}),
@@ -1570,6 +1574,25 @@ function createUnderlyingAnalyticsInstance(opts, rt, plugins = []) {
1570
1574
  storageWrapper.setItem("__user_traits", args[1]);
1571
1575
  }
1572
1576
  return analytics.identify(...args);
1577
+ }, setContextProperty(name, value) {
1578
+ if (opts.debug) {
1579
+ console.log(`[JITSU DEBUG] Setting context property '${name}':${JSON.stringify(value)}`);
1580
+ }
1581
+ if (!opts.defaultPayloadContext) {
1582
+ opts.defaultPayloadContext = {
1583
+ [name]: value,
1584
+ };
1585
+ }
1586
+ else {
1587
+ opts.defaultPayloadContext[name] = value;
1588
+ }
1589
+ },
1590
+ getContextProperty(name) {
1591
+ var _a;
1592
+ if (opts.debug) {
1593
+ console.log(`[JITSU DEBUG] Getting context property '${name}'`);
1594
+ }
1595
+ return (_a = opts.defaultPayloadContext) === null || _a === void 0 ? void 0 : _a[name];
1573
1596
  }, setAnonymousId: (id) => {
1574
1597
  if (opts.debug) {
1575
1598
  console.log("[JITSU DEBUG] Setting anonymous id to " + id);
@@ -0,0 +1,38 @@
1
+ import { PersistentStorage, JitsuOptions, RuntimeFacade, AnalyticsInterface } from '@jitsu/protocols/analytics';
2
+ export { AnalyticsInterface, Callback, DispatchedEvent, DynamicJitsuOptions, ID, JSONObject, JitsuOptions, Options, PersistentStorage, RuntimeFacade } from '@jitsu/protocols/analytics';
3
+ import { AnalyticsPlugin } from 'analytics';
4
+
5
+ declare const parseQuery: (qs?: string) => Record<string, string>;
6
+ type StorageFactory = (cookieDomain: string, key2Cookie: (key: string) => string) => PersistentStorage;
7
+ declare function windowRuntime(opts: JitsuOptions): RuntimeFacade;
8
+ declare function createInMemoryStorage(debug?: boolean): PersistentStorage;
9
+ declare const emptyRuntime: (config: JitsuOptions) => RuntimeFacade;
10
+ declare function isInBrowser(): boolean;
11
+ type DestinationDescriptor = {
12
+ id: string;
13
+ destinationType: string;
14
+ credentials: any;
15
+ options: any;
16
+ newEvents?: any[];
17
+ deviceOptions: DeviceOptions;
18
+ };
19
+ type AnalyticsPluginDescriptor = {
20
+ type: "analytics-plugin";
21
+ packageCdn: string;
22
+ moduleVarName: string;
23
+ };
24
+ type InternalPluginDescriptor = {
25
+ type: "internal-plugin";
26
+ name: string;
27
+ };
28
+ type DeviceOptions = AnalyticsPluginDescriptor | InternalPluginDescriptor;
29
+ declare const jitsuAnalyticsPlugin: (jitsuOptions: JitsuOptions, storage: PersistentStorage) => AnalyticsPlugin;
30
+ declare function randomId(hashString?: string | undefined): string;
31
+ declare function uuid(): string;
32
+
33
+ declare function parse(input: any): any;
34
+ declare const emptyAnalytics: AnalyticsInterface;
35
+ declare function jitsuAnalytics(_opts: JitsuOptions): AnalyticsInterface;
36
+
37
+ export { createInMemoryStorage, parse as default, emptyAnalytics, emptyRuntime, isInBrowser, jitsuAnalytics, jitsuAnalyticsPlugin, parseQuery, randomId, uuid, windowRuntime };
38
+ export type { AnalyticsPluginDescriptor, DestinationDescriptor, DeviceOptions, InternalPluginDescriptor, StorageFactory };
@@ -1481,6 +1481,10 @@ function parse(input) {
1481
1481
  }
1482
1482
  const emptyAnalytics = {
1483
1483
  setAnonymousId: () => { },
1484
+ setContextProperty(name, value) { },
1485
+ getContextProperty(name) {
1486
+ return undefined;
1487
+ },
1484
1488
  track: () => Promise.resolve(),
1485
1489
  page: () => Promise.resolve(),
1486
1490
  user: () => ({}),
@@ -1568,6 +1572,25 @@ function createUnderlyingAnalyticsInstance(opts, rt, plugins = []) {
1568
1572
  storageWrapper.setItem("__user_traits", args[1]);
1569
1573
  }
1570
1574
  return analytics.identify(...args);
1575
+ }, setContextProperty(name, value) {
1576
+ if (opts.debug) {
1577
+ console.log(`[JITSU DEBUG] Setting context property '${name}':${JSON.stringify(value)}`);
1578
+ }
1579
+ if (!opts.defaultPayloadContext) {
1580
+ opts.defaultPayloadContext = {
1581
+ [name]: value,
1582
+ };
1583
+ }
1584
+ else {
1585
+ opts.defaultPayloadContext[name] = value;
1586
+ }
1587
+ },
1588
+ getContextProperty(name) {
1589
+ var _a;
1590
+ if (opts.debug) {
1591
+ console.log(`[JITSU DEBUG] Getting context property '${name}'`);
1592
+ }
1593
+ return (_a = opts.defaultPayloadContext) === null || _a === void 0 ? void 0 : _a[name];
1571
1594
  }, setAnonymousId: (id) => {
1572
1595
  if (opts.debug) {
1573
1596
  console.log("[JITSU DEBUG] Setting anonymous id to " + id);
package/dist/jitsu.cjs.js CHANGED
@@ -1905,6 +1905,10 @@ function parse(input) {
1905
1905
  }
1906
1906
  const emptyAnalytics = {
1907
1907
  setAnonymousId: () => { },
1908
+ setContextProperty(name, value) { },
1909
+ getContextProperty(name) {
1910
+ return undefined;
1911
+ },
1908
1912
  track: () => Promise.resolve(),
1909
1913
  page: () => Promise.resolve(),
1910
1914
  user: () => ({}),
@@ -1992,6 +1996,25 @@ function createUnderlyingAnalyticsInstance(opts, rt, plugins = []) {
1992
1996
  storageWrapper.setItem("__user_traits", args[1]);
1993
1997
  }
1994
1998
  return analytics.identify(...args);
1999
+ }, setContextProperty(name, value) {
2000
+ if (opts.debug) {
2001
+ console.log(`[JITSU DEBUG] Setting context property '${name}':${JSON.stringify(value)}`);
2002
+ }
2003
+ if (!opts.defaultPayloadContext) {
2004
+ opts.defaultPayloadContext = {
2005
+ [name]: value,
2006
+ };
2007
+ }
2008
+ else {
2009
+ opts.defaultPayloadContext[name] = value;
2010
+ }
2011
+ },
2012
+ getContextProperty(name) {
2013
+ var _a;
2014
+ if (opts.debug) {
2015
+ console.log(`[JITSU DEBUG] Getting context property '${name}'`);
2016
+ }
2017
+ return (_a = opts.defaultPayloadContext) === null || _a === void 0 ? void 0 : _a[name];
1995
2018
  }, setAnonymousId: (id) => {
1996
2019
  if (opts.debug) {
1997
2020
  console.log("[JITSU DEBUG] Setting anonymous id to " + id);
@@ -0,0 +1,38 @@
1
+ import { PersistentStorage, JitsuOptions, RuntimeFacade, AnalyticsInterface } from '@jitsu/protocols/analytics';
2
+ export { AnalyticsInterface, Callback, DispatchedEvent, DynamicJitsuOptions, ID, JSONObject, JitsuOptions, Options, PersistentStorage, RuntimeFacade } from '@jitsu/protocols/analytics';
3
+ import { AnalyticsPlugin } from 'analytics';
4
+
5
+ declare const parseQuery: (qs?: string) => Record<string, string>;
6
+ type StorageFactory = (cookieDomain: string, key2Cookie: (key: string) => string) => PersistentStorage;
7
+ declare function windowRuntime(opts: JitsuOptions): RuntimeFacade;
8
+ declare function createInMemoryStorage(debug?: boolean): PersistentStorage;
9
+ declare const emptyRuntime: (config: JitsuOptions) => RuntimeFacade;
10
+ declare function isInBrowser(): boolean;
11
+ type DestinationDescriptor = {
12
+ id: string;
13
+ destinationType: string;
14
+ credentials: any;
15
+ options: any;
16
+ newEvents?: any[];
17
+ deviceOptions: DeviceOptions;
18
+ };
19
+ type AnalyticsPluginDescriptor = {
20
+ type: "analytics-plugin";
21
+ packageCdn: string;
22
+ moduleVarName: string;
23
+ };
24
+ type InternalPluginDescriptor = {
25
+ type: "internal-plugin";
26
+ name: string;
27
+ };
28
+ type DeviceOptions = AnalyticsPluginDescriptor | InternalPluginDescriptor;
29
+ declare const jitsuAnalyticsPlugin: (jitsuOptions: JitsuOptions, storage: PersistentStorage) => AnalyticsPlugin;
30
+ declare function randomId(hashString?: string | undefined): string;
31
+ declare function uuid(): string;
32
+
33
+ declare function parse(input: any): any;
34
+ declare const emptyAnalytics: AnalyticsInterface;
35
+ declare function jitsuAnalytics(_opts: JitsuOptions): AnalyticsInterface;
36
+
37
+ export { createInMemoryStorage, parse as default, emptyAnalytics, emptyRuntime, isInBrowser, jitsuAnalytics, jitsuAnalyticsPlugin, parseQuery, randomId, uuid, windowRuntime };
38
+ export type { AnalyticsPluginDescriptor, DestinationDescriptor, DeviceOptions, InternalPluginDescriptor, StorageFactory };
package/dist/jitsu.es.js CHANGED
@@ -1903,6 +1903,10 @@ function parse(input) {
1903
1903
  }
1904
1904
  const emptyAnalytics = {
1905
1905
  setAnonymousId: () => { },
1906
+ setContextProperty(name, value) { },
1907
+ getContextProperty(name) {
1908
+ return undefined;
1909
+ },
1906
1910
  track: () => Promise.resolve(),
1907
1911
  page: () => Promise.resolve(),
1908
1912
  user: () => ({}),
@@ -1990,6 +1994,25 @@ function createUnderlyingAnalyticsInstance(opts, rt, plugins = []) {
1990
1994
  storageWrapper.setItem("__user_traits", args[1]);
1991
1995
  }
1992
1996
  return analytics.identify(...args);
1997
+ }, setContextProperty(name, value) {
1998
+ if (opts.debug) {
1999
+ console.log(`[JITSU DEBUG] Setting context property '${name}':${JSON.stringify(value)}`);
2000
+ }
2001
+ if (!opts.defaultPayloadContext) {
2002
+ opts.defaultPayloadContext = {
2003
+ [name]: value,
2004
+ };
2005
+ }
2006
+ else {
2007
+ opts.defaultPayloadContext[name] = value;
2008
+ }
2009
+ },
2010
+ getContextProperty(name) {
2011
+ var _a;
2012
+ if (opts.debug) {
2013
+ console.log(`[JITSU DEBUG] Getting context property '${name}'`);
2014
+ }
2015
+ return (_a = opts.defaultPayloadContext) === null || _a === void 0 ? void 0 : _a[name];
1993
2016
  }, setAnonymousId: (id) => {
1994
2017
  if (opts.debug) {
1995
2018
  console.log("[JITSU DEBUG] Setting anonymous id to " + id);
package/dist/web/p.js.txt CHANGED
@@ -1983,6 +1983,25 @@
1983
1983
  storageWrapper.setItem("__user_traits", args[1]);
1984
1984
  }
1985
1985
  return analytics.identify(...args);
1986
+ }, setContextProperty(name, value) {
1987
+ if (opts.debug) {
1988
+ console.log(`[JITSU DEBUG] Setting context property '${name}':${JSON.stringify(value)}`);
1989
+ }
1990
+ if (!opts.defaultPayloadContext) {
1991
+ opts.defaultPayloadContext = {
1992
+ [name]: value,
1993
+ };
1994
+ }
1995
+ else {
1996
+ opts.defaultPayloadContext[name] = value;
1997
+ }
1998
+ },
1999
+ getContextProperty(name) {
2000
+ var _a;
2001
+ if (opts.debug) {
2002
+ console.log(`[JITSU DEBUG] Getting context property '${name}'`);
2003
+ }
2004
+ return (_a = opts.defaultPayloadContext) === null || _a === void 0 ? void 0 : _a[name];
1986
2005
  }, setAnonymousId: (id) => {
1987
2006
  if (opts.debug) {
1988
2007
  console.log("[JITSU DEBUG] Setting anonymous id to " + id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jitsu/js",
3
- "version": "1.10.1-canary.1321.20250430101335",
3
+ "version": "1.10.1",
4
4
  "description": "",
5
5
  "author": "Jitsu Dev Team <dev@jitsu.com>",
6
6
  "main": "dist/jitsu.cjs.js",
@@ -8,7 +8,7 @@
8
8
  "dist"
9
9
  ],
10
10
  "module": "dist/jitsu.es.js",
11
- "types": "dist/index.d.ts",
11
+ "types": "dist/jitsu.d.ts",
12
12
  "publishConfig": {
13
13
  "access": "public"
14
14
  },
@@ -18,6 +18,7 @@
18
18
  "tslib": "^2.6.3",
19
19
  "@playwright/test": "1.39.0",
20
20
  "@rollup/plugin-commonjs": "^28.0.2",
21
+ "rollup-plugin-dts": "^6.2.1",
21
22
  "@rollup/plugin-json": "^5.0.1",
22
23
  "@rollup/plugin-multi-entry": "^6.0.0",
23
24
  "@rollup/plugin-node-resolve": "^16.0.0",
@@ -38,10 +39,10 @@
38
39
  "rollup": "^3.29.5",
39
40
  "ts-jest": "29.0.5",
40
41
  "typescript": "^5.6.3",
41
- "jsondiffpatch": "1.10.1-canary.1321.20250430101335"
42
+ "jsondiffpatch": "1.10.1"
42
43
  },
43
44
  "peerDependencies": {
44
- "@jitsu/protocols": "1.10.1-canary.1321.20250430101335"
45
+ "@jitsu/protocols": "1.10.1"
45
46
  },
46
47
  "dependencies": {
47
48
  "analytics": "0.8.9"
@@ -52,6 +53,6 @@
52
53
  "test:playwright": "playwright test ./__tests__/playwright",
53
54
  "test": "pnpm run test:node && pnpm run test:playwright",
54
55
  "compile": "tsc -p .",
55
- "build": "pnpm run clean && pnpm run compile && rollup -c && cp compiled/src/*.d.ts dist"
56
+ "build": "pnpm run clean && pnpm run compile && rollup -c"
56
57
  }
57
58
  }
@@ -1,29 +0,0 @@
1
- import { JitsuOptions, PersistentStorage, RuntimeFacade } from "@jitsu/protocols/analytics";
2
- import { AnalyticsPlugin } from "analytics";
3
- export declare const parseQuery: (qs?: string) => Record<string, string>;
4
- export type StorageFactory = (cookieDomain: string, key2Cookie: (key: string) => string) => PersistentStorage;
5
- export declare function windowRuntime(opts: JitsuOptions): RuntimeFacade;
6
- export declare function createInMemoryStorage(debug?: boolean): PersistentStorage;
7
- export declare const emptyRuntime: (config: JitsuOptions) => RuntimeFacade;
8
- export declare function isInBrowser(): boolean;
9
- export type DestinationDescriptor = {
10
- id: string;
11
- destinationType: string;
12
- credentials: any;
13
- options: any;
14
- newEvents?: any[];
15
- deviceOptions: DeviceOptions;
16
- };
17
- export type AnalyticsPluginDescriptor = {
18
- type: "analytics-plugin";
19
- packageCdn: string;
20
- moduleVarName: string;
21
- };
22
- export type InternalPluginDescriptor = {
23
- type: "internal-plugin";
24
- name: string;
25
- };
26
- export type DeviceOptions = AnalyticsPluginDescriptor | InternalPluginDescriptor;
27
- export declare const jitsuAnalyticsPlugin: (jitsuOptions: JitsuOptions, storage: PersistentStorage) => AnalyticsPlugin;
28
- export declare function randomId(hashString?: string | undefined): string;
29
- export declare function uuid(): string;
package/dist/browser.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import type { JitsuOptions } from "@jitsu/protocols/analytics";
2
- export type JitsuBrowserOptions = {
3
- namespace?: string;
4
- onload?: string;
5
- initOnly?: boolean;
6
- } & JitsuOptions;
7
- export type Parser = {
8
- path?: (name: string) => string[];
9
- parse: (arg: string) => any;
10
- };
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Callback, DispatchedEvent, ID, JSONObject, Options, AnalyticsInterface, JitsuOptions, PersistentStorage, RuntimeFacade, DynamicJitsuOptions } from "@jitsu/protocols/analytics";
2
- export default function parse(input: any): any;
3
- export declare const emptyAnalytics: AnalyticsInterface;
4
- export declare function jitsuAnalytics(_opts: JitsuOptions): AnalyticsInterface;
5
- export { Callback, DispatchedEvent, ID, JSONObject, Options, AnalyticsInterface, JitsuOptions, PersistentStorage, RuntimeFacade, DynamicJitsuOptions, };
6
- export * from "./analytics-plugin";
@@ -1,17 +0,0 @@
1
- export type InterfaceWrapper<T> = {
2
- get(): WithAsyncMethods<T>;
3
- loaded(instance: T): any;
4
- };
5
- type WithAsyncMethods<T> = {
6
- [K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => R extends Promise<any> ? R : Promise<R> : T[K];
7
- };
8
- /**
9
- * This function creates a wrapper around an interface that allows to call methods on it, but all methods will go to queue. Once actual instance
10
- * implementation becomes available, all queued methods will be called on it.
11
- *
12
- *
13
- * @param methods of methods that should be wrapped. Per each method of you should specify if it should be wrapped. You'll need to mark all
14
- * methods for type safety. If method is not wrapped, it will throw an error when called.
15
- */
16
- export declare function delayMethodExec<T>(methods: Record<keyof T, boolean>): InterfaceWrapper<T>;
17
- export {};
@@ -1,8 +0,0 @@
1
- export type ScriptOptions = {
2
- attributes?: Record<string, string>;
3
- www?: boolean;
4
- js?: boolean;
5
- min?: boolean;
6
- query?: string;
7
- };
8
- export declare function loadScript(src: string, options?: ScriptOptions): Promise<HTMLScriptElement>;
package/dist/tlds.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare const publicSuffixes: string[];
2
- export declare const publicSuffixesMap: Record<string, boolean>;
3
- export declare function getTopLevelDomain(hostname: string): string;
package/dist/version.d.ts DELETED
@@ -1,3 +0,0 @@
1
- declare const jitsuVersion: string;
2
- declare const jitsuLibraryName = "@jitsu/js";
3
- export { jitsuVersion, jitsuLibraryName };