@jitsu/js 1.10.0 → 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.
- package/dist/jitsu-no-ext.cjs.d.ts +38 -0
- package/dist/jitsu-no-ext.cjs.js +1703 -0
- package/dist/jitsu-no-ext.es.d.ts +38 -0
- package/dist/jitsu-no-ext.es.js +1692 -0
- package/dist/jitsu.cjs.js +23 -0
- package/dist/jitsu.d.ts +35 -84
- package/dist/jitsu.es.js +23 -0
- package/dist/web/p.js.txt +19 -0
- package/package.json +7 -6
- package/dist/analytics-plugin.d.ts +0 -29
- package/dist/browser.d.ts +0 -10
- package/dist/index.d.ts +0 -6
- package/dist/method-queue.d.ts +0 -17
- package/dist/script-loader.d.ts +0 -8
- package/dist/tlds.d.ts +0 -3
- package/dist/version.d.ts +0 -3
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);
|
package/dist/jitsu.d.ts
CHANGED
|
@@ -1,87 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* of the current domain. Example: if JS lives on "app.example.com", cookie domain will be
|
|
19
|
-
* set to ".example.com". If it lives on "example.com", cookie domain will be set to ".example.com" too
|
|
20
|
-
*/
|
|
21
|
-
cookieDomain?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Provide fetch implementation. It is required if you want to use Jitsu in NodeJS
|
|
24
|
-
*/
|
|
25
|
-
fetch?: typeof fetch;
|
|
26
|
-
/**
|
|
27
|
-
* Which runtime to use. Runtime is used for obtaining context of the event: cookes,
|
|
28
|
-
* url, etc. At the moment, Jitsu supports browser runtime and NodeJS runtime, but you
|
|
29
|
-
* can provide your own implementation.
|
|
30
|
-
*
|
|
31
|
-
* If it's not set, the runtime will be detected automatically by presense of `window` object
|
|
32
|
-
*/
|
|
33
|
-
runtime?: RuntimeFacade;
|
|
34
|
-
/**
|
|
35
|
-
* If set to true, jitsu will output events in console. In this case you don't need to set
|
|
36
|
-
* writeKey / host. It's useful for debugging development environment
|
|
37
|
-
*/
|
|
38
|
-
echoEvents?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* If true, events will go to s2s endpoints like ${host}/api/s/s2s/{type}. Otherwise they'll go to ${host}/api/s/{type}.
|
|
41
|
-
*
|
|
42
|
-
* If not set at all, it will be detected automatically by presence of `window` object
|
|
43
|
-
*/
|
|
44
|
-
s2s?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Timeout for fetch requests. Default value: 5000
|
|
47
|
-
*/
|
|
48
|
-
fetchTimeoutMs?: number;
|
|
49
|
-
/**
|
|
50
|
-
* Endpoint that makes sure that Jitsu anonymousId cookie is set as server (httpOnly) cookie.
|
|
51
|
-
* Endpoint must be hosted on the same domain as the site where Jitsu code is installed.
|
|
52
|
-
* Required to overcome Safari ITP restrictions.
|
|
53
|
-
*/
|
|
54
|
-
idEndpoint?: string;
|
|
55
|
-
enabled?: boolean;
|
|
56
|
-
enableAnonymousId?: boolean;
|
|
57
|
-
enableThirdPartIds?: boolean;
|
|
58
|
-
ipPolicy?: "keep" | "remove" | "stripLastOctet";
|
|
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;
|
|
59
18
|
};
|
|
60
|
-
type
|
|
61
|
-
type
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
removeItem: (key: string, options?: any) => void;
|
|
65
|
-
reset: () => void;
|
|
19
|
+
type AnalyticsPluginDescriptor = {
|
|
20
|
+
type: "analytics-plugin";
|
|
21
|
+
packageCdn: string;
|
|
22
|
+
moduleVarName: string;
|
|
66
23
|
};
|
|
67
|
-
type
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
language(): string | undefined;
|
|
71
|
-
pageUrl(): string | undefined;
|
|
72
|
-
documentEncoding(): string | undefined;
|
|
73
|
-
getCookie(name: string): string | undefined;
|
|
74
|
-
getCookies(): Record<string, string>;
|
|
75
|
-
timezoneOffset(): number | undefined;
|
|
76
|
-
screen(): {
|
|
77
|
-
width: number;
|
|
78
|
-
height: number;
|
|
79
|
-
innerWidth: number;
|
|
80
|
-
innerHeight: number;
|
|
81
|
-
density: number;
|
|
82
|
-
} | undefined;
|
|
83
|
-
referrer(): string | undefined;
|
|
84
|
-
pageTitle(): string | undefined;
|
|
24
|
+
type InternalPluginDescriptor = {
|
|
25
|
+
type: "internal-plugin";
|
|
26
|
+
name: string;
|
|
85
27
|
};
|
|
86
|
-
|
|
87
|
-
|
|
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.
|
|
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/
|
|
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,20 +39,20 @@
|
|
|
38
39
|
"rollup": "^3.29.5",
|
|
39
40
|
"ts-jest": "29.0.5",
|
|
40
41
|
"typescript": "^5.6.3",
|
|
41
|
-
"jsondiffpatch": "1.10.
|
|
42
|
+
"jsondiffpatch": "1.10.1"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
|
-
"@jitsu/protocols": "1.10.
|
|
45
|
+
"@jitsu/protocols": "1.10.1"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
48
|
"analytics": "0.8.9"
|
|
48
49
|
},
|
|
49
50
|
"scripts": {
|
|
50
|
-
"clean": "rm -rf ./dist",
|
|
51
|
+
"clean": "rm -rf ./dist ./compiled",
|
|
51
52
|
"test:node": "jest",
|
|
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": "
|
|
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";
|
package/dist/method-queue.d.ts
DELETED
|
@@ -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 {};
|
package/dist/script-loader.d.ts
DELETED
package/dist/tlds.d.ts
DELETED
package/dist/version.d.ts
DELETED