@jitsu/js 0.0.1-alpha.120 → 0.0.1-alpha.125

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 d0a9e8b6bb4cbc1a
2
- @jitsu/js:build: 
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
5
- @jitsu/js:build: 
6
- @jitsu/js:build: 
7
- @jitsu/js:build: ./compiled/src/browser.js → dist/web/p.js.txt...
8
- @jitsu/js:build: (!) Circular dependency
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 218ms
11
- @jitsu/js:build: 
12
- @jitsu/js:build: ./compiled/src/index.js → dist/jitsu.es.js, dist/jitsu.cjs.js...
13
- @jitsu/js:build: (!) Circular dependency
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 119ms
1
+ @jitsu/js:build: cache hit, replaying output 9f7a1241ace64e9d
2
+ @jitsu/js:build: 
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 compiled/src/*.d.ts dist
5
+ @jitsu/js:build: 
6
+ @jitsu/js:build: 
7
+ @jitsu/js:build: ./compiled/src/browser.js → dist/web/p.js.txt...
8
+ @jitsu/js:build: (!) Circular dependency
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 193ms
11
+ @jitsu/js:build: 
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
+ @jitsu/js:build: (!) Circular dependency
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 131ms
@@ -1,5 +1,5 @@
1
- @jitsu/js:clean: cache hit, replaying output a743e35d3f6db643
2
- @jitsu/js:clean: 
3
- @jitsu/js:clean: > @jitsu/js@0.0.0 clean /Users/ildarnurislamov/Projects/onetag/libs/jitsu-js
4
- @jitsu/js:clean: > rm -rf ./dist
5
- @jitsu/js:clean: 
1
+ @jitsu/js:clean: cache hit, replaying output 706db8e09c90ca8d
2
+ @jitsu/js:clean: 
3
+ @jitsu/js:clean: > @jitsu/js@0.0.0 clean /Users/ildarnurislamov/Projects/onetag/libs/jitsu-js
4
+ @jitsu/js:clean: > rm -rf ./dist
5
+ @jitsu/js:clean: 
@@ -2,7 +2,7 @@ import fs from "fs";
2
2
  import path from "path";
3
3
  import { createServer, SimpleSyrup } from "../simple-syrup";
4
4
  import process from "process";
5
- import { AnalyticsClientEvent, AnalyticsInterface } from "@jitsu/analytics-types/analytics";
5
+ import { AnalyticsClientEvent, AnalyticsInterface } from "@jitsu/protocols/analytics";
6
6
 
7
7
  const jitsuAnalytics = require("../../dist/jitsu.cjs.js").jitsuAnalytics;
8
8
  const fetchImpl = require("node-fetch-commonjs");
@@ -6,7 +6,7 @@ import ejs from "ejs";
6
6
  import chalk from "chalk";
7
7
  import * as process from "process";
8
8
  import * as console from "console";
9
- import { AnalyticsClientEvent, AnalyticsInterface } from "@jitsu/analytics-types/analytics.d";
9
+ import { AnalyticsClientEvent, AnalyticsInterface } from "@jitsu/protocols/analytics.d";
10
10
  import type { AnalyticsCore } from "@segment/analytics-next/src/core/analytics/interfaces";
11
11
  import { response } from "express";
12
12
 
@@ -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,48 +1,42 @@
1
- import { AnalyticsInterface } from "@jitsu/analytics-types/analytics";
1
+ import type { AnalyticsInterface } from "@jitsu/protocols/analytics";
2
2
  import type { AnalyticsPlugin } from "analytics";
3
-
4
- export 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
- export 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
40
  export declare function jitsuAnalytics(opts: JitsuOptions): AnalyticsInterface;
47
-
48
- declare const jitsuAnalyticsPlugin: AnalyticsPlugin;
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.120",
3
+ "version": "0.0.1-alpha.125",
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
  },
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "analytics": "^0.8.1",
39
- "@jitsu/analytics-types": "0.0.1-alpha.120"
39
+ "@jitsu/protocols": "0.0.1-alpha.125"
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" },
@@ -1,7 +1,7 @@
1
1
  /* global analytics */
2
2
 
3
3
  import { JitsuOptions, PersistentStorage, RuntimeFacade } from "./jitsu";
4
- import { AnalyticsClientEvent } from "@jitsu/analytics-types/analytics";
4
+ import { AnalyticsClientEvent } from "@jitsu/protocols/analytics";
5
5
  import parse from "./index";
6
6
  import { AnalyticsPlugin } from "analytics";
7
7
 
package/src/index.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { AnalyticsInterface } from "@jitsu/analytics-types/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,7 +1,7 @@
1
- import { AnalyticsInterface } from "@jitsu/analytics-types/analytics";
1
+ import type { AnalyticsInterface } from "@jitsu/protocols/analytics";
2
2
  import type { AnalyticsPlugin } from "analytics";
3
3
 
4
- export type JitsuOptions = {
4
+ type JitsuOptions = {
5
5
  /**
6
6
  * API Key. Optional. If not set, Jitsu will send event to the server without auth, and server
7
7
  * will link the call to configured source by domain name
@@ -23,7 +23,7 @@ type PersistentStorage = {
23
23
  removeItem: (key: string, options?: any) => void;
24
24
  };
25
25
 
26
- export type RuntimeFacade = {
26
+ type RuntimeFacade = {
27
27
  store(): PersistentStorage;
28
28
  userAgent(): string | undefined;
29
29
  language(): string | undefined;
@@ -45,4 +45,6 @@ export type RuntimeFacade = {
45
45
 
46
46
  export declare function jitsuAnalytics(opts: JitsuOptions): AnalyticsInterface;
47
47
 
48
- declare const jitsuAnalyticsPlugin: AnalyticsPlugin;
48
+ export declare const jitsuAnalyticsPlugin: AnalyticsPlugin;
49
+
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",