@jitsu/js 0.0.1-alpha.122 → 0.0.1-alpha.126

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,15 +1,15 @@
1
- @jitsu/js:build: cache hit, replaying output 4195d34999fb1a4a
1
+ @jitsu/js:build: cache hit, replaying output 86152f925c86fdcd
2
2
  @jitsu/js:build: 
3
3
  @jitsu/js:build: > @jitsu/js@0.0.0 build /Users/ildarnurislamov/Projects/onetag/libs/jitsu-js
4
- @jitsu/js:build: > tsc -p . && rollup -c && cp src/jitsu.d.ts dist
4
+ @jitsu/js:build: > tsc -p . && rollup -c && cp compiled/src/*.d.ts dist
5
5
  @jitsu/js:build: 
6
6
  @jitsu/js:build: 
7
7
  @jitsu/js:build: ./compiled/src/browser.js → dist/web/p.js.txt...
8
8
  @jitsu/js:build: (!) Circular dependency
9
9
  @jitsu/js:build: compiled/src/index.js -> compiled/src/analytics-plugin.js -> compiled/src/index.js
10
- @jitsu/js:build: created dist/web/p.js.txt in 247ms
10
+ @jitsu/js:build: created dist/web/p.js.txt in 237ms
11
11
  @jitsu/js:build: 
12
- @jitsu/js:build: ./compiled/src/index.js → dist/jitsu.es.js, dist/jitsu.cjs.js...
12
+ @jitsu/js:build: ./compiled/src/index.js, ./compiled/src/jitsu.js, ./compiled/src/analytics-plugin.js → dist/jitsu.es.js, dist/jitsu.cjs.js...
13
13
  @jitsu/js:build: (!) Circular dependency
14
14
  @jitsu/js:build: compiled/src/index.js -> compiled/src/analytics-plugin.js -> compiled/src/index.js
15
- @jitsu/js:build: created dist/jitsu.es.js, dist/jitsu.cjs.js in 142ms
15
+ @jitsu/js:build: created dist/jitsu.es.js, dist/jitsu.cjs.js in 128ms
@@ -1,4 +1,4 @@
1
- @jitsu/js:clean: cache hit, replaying output aea50bc0e75b3672
1
+ @jitsu/js:clean: cache hit, replaying output 918ecf9a7a81d250
2
2
  @jitsu/js:clean: 
3
3
  @jitsu/js:clean: > @jitsu/js@0.0.0 clean /Users/ildarnurislamov/Projects/onetag/libs/jitsu-js
4
4
  @jitsu/js:clean: > rm -rf ./dist
@@ -0,0 +1,10 @@
1
+ import { JitsuOptions, PersistentStorage, RuntimeFacade } from "./jitsu";
2
+ import { AnalyticsPlugin } from "analytics";
3
+ export declare const parseQuery: (qs?: string) => Record<string, string>;
4
+ export declare type StorageFactory = (cookieDomain: string, cookie2key: Record<string, string>) => PersistentStorage;
5
+ export declare function getTopLevelDomain(opts?: JitsuOptions): string;
6
+ export declare function windowRuntime(opts: JitsuOptions): RuntimeFacade;
7
+ export declare const emptyRuntime: (config: JitsuOptions) => RuntimeFacade;
8
+ declare const jitsuAnalyticsPlugin: (pluginConfig?: JitsuOptions) => AnalyticsPlugin;
9
+ export declare function randomId(hashString?: string | undefined): string;
10
+ export default jitsuAnalyticsPlugin;
@@ -0,0 +1,7 @@
1
+ import { JitsuOptions } from "./jitsu";
2
+ export declare type JitsuBrowserOptions = {
3
+ userId?: string;
4
+ onload?: string;
5
+ initOnly?: boolean;
6
+ } & JitsuOptions;
7
+ export declare type Parser = (arg: string) => any;
@@ -0,0 +1,5 @@
1
+ import { JitsuOptions, AnalyticsInterface } from "./jitsu";
2
+ export default function parse(input: any): any;
3
+ export declare function jitsuAnalytics(opts: JitsuOptions): AnalyticsInterface;
4
+ export * from "./jitsu";
5
+ export * from "./analytics-plugin";
package/dist/jitsu.cjs.js CHANGED
@@ -459,4 +459,9 @@ function jitsuAnalytics(opts) {
459
459
  return analytics;
460
460
  }
461
461
 
462
+ exports.emptyRuntime = emptyRuntime;
463
+ exports.getTopLevelDomain = getTopLevelDomain;
462
464
  exports.jitsuAnalytics = jitsuAnalytics;
465
+ exports.parseQuery = parseQuery;
466
+ exports.randomId = randomId;
467
+ exports.windowRuntime = windowRuntime;
package/dist/jitsu.d.ts CHANGED
@@ -1,50 +1,42 @@
1
- import { AnalyticsInterface } from "@jitsu/protocols/analytics";
1
+ import type { AnalyticsInterface } from "@jitsu/protocols/analytics";
2
2
  import type { AnalyticsPlugin } from "analytics";
3
-
4
- type JitsuOptions = {
5
- /**
6
- * API Key. Optional. If not set, Jitsu will send event to the server without auth, and server
7
- * will link the call to configured source by domain name
8
- */
9
- writeKey?: string;
10
- /**
11
- * API Host. Default value: same host as script origin
12
- */
13
- host?: string;
14
- debug?: boolean;
15
- cookieDomain?: string;
16
- fetch?: typeof fetch;
17
- runtime?: RuntimeFacade;
3
+ declare type JitsuOptions = {
4
+ /**
5
+ * API Key. Optional. If not set, Jitsu will send event to the server without auth, and server
6
+ * will link the call to configured source by domain name
7
+ */
8
+ writeKey?: string;
9
+ /**
10
+ * API Host. Default value: same host as script origin
11
+ */
12
+ host?: string;
13
+ debug?: boolean;
14
+ cookieDomain?: string;
15
+ fetch?: typeof fetch;
16
+ runtime?: RuntimeFacade;
18
17
  };
19
-
20
- type PersistentStorage = {
21
- getItem: (key: string, options?: any) => any;
22
- setItem: (key: string, value: any, options?: any) => void;
23
- removeItem: (key: string, options?: any) => void;
18
+ declare type PersistentStorage = {
19
+ getItem: (key: string, options?: any) => any;
20
+ setItem: (key: string, value: any, options?: any) => void;
21
+ removeItem: (key: string, options?: any) => void;
24
22
  };
25
-
26
- type RuntimeFacade = {
27
- store(): PersistentStorage;
28
- userAgent(): string | undefined;
29
- language(): string | undefined;
30
- pageUrl(): string | undefined;
31
- documentEncoding(): string | undefined;
32
- timezoneOffset(): number | undefined;
33
- screen():
34
- | {
23
+ declare type RuntimeFacade = {
24
+ store(): PersistentStorage;
25
+ userAgent(): string | undefined;
26
+ language(): string | undefined;
27
+ pageUrl(): string | undefined;
28
+ documentEncoding(): string | undefined;
29
+ timezoneOffset(): number | undefined;
30
+ screen(): {
35
31
  width: number;
36
32
  height: number;
37
33
  innerWidth: number;
38
34
  innerHeight: number;
39
35
  density: number;
40
- }
41
- | undefined;
42
- referrer(): string | undefined;
43
- pageTitle(): string | undefined;
36
+ } | undefined;
37
+ referrer(): string | undefined;
38
+ pageTitle(): string | undefined;
44
39
  };
45
-
46
- declare function jitsuAnalytics(opts: JitsuOptions): AnalyticsInterface;
47
-
48
- declare const jitsuAnalyticsPlugin: AnalyticsPlugin;
49
-
50
- export { AnalyticsInterface, JitsuOptions, PersistentStorage, RuntimeFacade, jitsuAnalytics, jitsuAnalyticsPlugin };
40
+ export declare function jitsuAnalytics(opts: JitsuOptions): AnalyticsInterface;
41
+ export declare const jitsuAnalyticsPlugin: AnalyticsPlugin;
42
+ export { AnalyticsInterface, JitsuOptions, PersistentStorage, RuntimeFacade };
package/dist/jitsu.es.js CHANGED
@@ -457,4 +457,4 @@ function jitsuAnalytics(opts) {
457
457
  return analytics;
458
458
  }
459
459
 
460
- export { jitsuAnalytics };
460
+ export { emptyRuntime, getTopLevelDomain, jitsuAnalytics, parseQuery, randomId, windowRuntime };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@jitsu/js",
3
- "version": "0.0.1-alpha.122",
3
+ "version": "0.0.1-alpha.126",
4
4
  "description": "",
5
5
  "author": "Jitsu Dev Team <dev@jitsu.com>",
6
6
  "main": "dist/jitsu.cjs.js",
7
7
  "module": "dist/jitsu.es.js",
8
- "types": "dist/jitsu.d.ts",
8
+ "types": "dist/index.d.ts",
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
@@ -32,11 +32,11 @@
32
32
  "node-forge": "^1.3.1",
33
33
  "raw-loader": "^4.0.2",
34
34
  "rollup": "^3.2.5",
35
- "ts-jest": "^29.0.3",
36
- "@jitsu/protocols": "0.0.1-alpha.122"
35
+ "ts-jest": "^29.0.3"
37
36
  },
38
37
  "dependencies": {
39
- "analytics": "^0.8.1"
38
+ "analytics": "^0.8.1",
39
+ "@jitsu/protocols": "0.0.1-alpha.126"
40
40
  },
41
41
  "scripts": {
42
42
  "clean": "rm -rf ./dist",
@@ -44,6 +44,6 @@
44
44
  "test:playwright": "playwright test ./__tests__/playwright",
45
45
  "test": "pnpm run test:node && pnpm run test:playwright",
46
46
  "compile": "tsc -p .",
47
- "build": "tsc -p . && rollup -c && cp src/jitsu.d.ts dist"
47
+ "build": "tsc -p . && rollup -c && cp compiled/src/*.d.ts dist"
48
48
  }
49
49
  }
package/rollup.config.js CHANGED
@@ -6,7 +6,7 @@ const terser = require("@rollup/plugin-terser");
6
6
 
7
7
  module.exports = [
8
8
  {
9
- plugins: [multi(), resolve({ preferBuiltins: false }), commonjs(), rollupJson(),],
9
+ plugins: [multi(), resolve({ preferBuiltins: false }), commonjs(), rollupJson()],
10
10
  input: "./compiled/src/browser.js",
11
11
  output: {
12
12
  file: `dist/web/p.js.txt`,
@@ -16,7 +16,7 @@ module.exports = [
16
16
  },
17
17
  {
18
18
  plugins: [multi(), resolve({ preferBuiltins: false }), commonjs(), rollupJson()],
19
- input: "./compiled/src/index.js",
19
+ input: ["./compiled/src/index.js", "./compiled/src/jitsu.js", "./compiled/src/analytics-plugin.js"],
20
20
  output: [
21
21
  { file: "dist/jitsu.es.js", format: "es" },
22
22
  { file: "dist/jitsu.cjs.js", format: "cjs" },
package/src/index.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { AnalyticsInterface } from "@jitsu/protocols/analytics.d";
2
1
  import Analytics from "analytics";
3
- import { JitsuOptions, PersistentStorage } from "./jitsu";
2
+ import { JitsuOptions, AnalyticsInterface } from "./jitsu";
4
3
  import jitsuAnalyticsPlugin, { emptyRuntime, windowRuntime } from "./analytics-plugin";
5
4
 
6
5
  export default function parse(input) {
@@ -44,3 +43,6 @@ export function jitsuAnalytics(opts: JitsuOptions): AnalyticsInterface {
44
43
  };
45
44
  return analytics;
46
45
  }
46
+
47
+ export * from "./jitsu";
48
+ export * from "./analytics-plugin";
@@ -1,4 +1,4 @@
1
- import { AnalyticsInterface } from "@jitsu/protocols/analytics";
1
+ import type { AnalyticsInterface } from "@jitsu/protocols/analytics";
2
2
  import type { AnalyticsPlugin } from "analytics";
3
3
 
4
4
  type JitsuOptions = {
@@ -43,8 +43,8 @@ type RuntimeFacade = {
43
43
  pageTitle(): string | undefined;
44
44
  };
45
45
 
46
- declare function jitsuAnalytics(opts: JitsuOptions): AnalyticsInterface;
46
+ export declare function jitsuAnalytics(opts: JitsuOptions): AnalyticsInterface;
47
47
 
48
- declare const jitsuAnalyticsPlugin: AnalyticsPlugin;
48
+ export declare const jitsuAnalyticsPlugin: AnalyticsPlugin;
49
49
 
50
- export { AnalyticsInterface, JitsuOptions, PersistentStorage, RuntimeFacade, jitsuAnalytics, jitsuAnalyticsPlugin };
50
+ export { AnalyticsInterface, JitsuOptions, PersistentStorage, RuntimeFacade };
package/tsconfig.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "compilerOptions": {
3
3
  "rootDir": ".",
4
4
  "outDir": "./compiled",
5
- "declaration": false,
5
+ "declaration": true,
6
6
  "esModuleInterop": true,
7
7
  "moduleResolution": "Node",
8
8
  "target": "ES2015",