@jitsu/js 1.1.0-canary.344.20230430234929 → 1.1.0-canary.391.20230523080206

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,23 @@
1
+ {
2
+ "0 debug pnpm:scope": {
3
+ "selected": 1,
4
+ "workspacePrefix": "/Users/ildarnurislamov/Projects/onetag"
5
+ },
6
+ "1 error pnpm": {
7
+ "code": "ELIFECYCLE",
8
+ "errno": "ENOENT",
9
+ "syscall": "spawn",
10
+ "file": "sh",
11
+ "pkgid": "@jitsu/js@0.0.0",
12
+ "stage": "build",
13
+ "script": "tsc -p . && rollup -c && cp src/jitsu.d.ts dist",
14
+ "pkgname": "@jitsu/js",
15
+ "err": {
16
+ "name": "pnpm",
17
+ "message": "@jitsu/js@0.0.0 build: `tsc -p . && rollup -c && cp src/jitsu.d.ts dist`\nspawn ENOENT",
18
+ "code": "ELIFECYCLE",
19
+ "stack": "pnpm: @jitsu/js@0.0.0 build: `tsc -p . && rollup -c && cp src/jitsu.d.ts dist`\nspawn ENOENT\n at ChildProcess.<anonymous> (/opt/homebrew/lib/node_modules/pnpm/dist/pnpm.cjs:93535:22)\n at ChildProcess.emit (node:events:527:28)\n at maybeClose (node:internal/child_process:1092:16)\n at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)"
20
+ }
21
+ },
22
+ "2 warn pnpm:global": " Local package.json exists, but node_modules missing, did you mean to install?"
23
+ }
@@ -1,65 +1,95 @@
1
- @jitsu/js:build: cache hit, replaying output 126f0e7238465aa8
2
- @jitsu/js:build: 
3
- @jitsu/js:build: > @jitsu/js@0.0.0 build /Users/vklmn/dev2/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: (!) "this" has been rewritten to "undefined"
9
- @jitsu/js:build: https://rollupjs.org/troubleshooting/#error-this-is-undefined
10
- @jitsu/js:build: compiled/src/analytics-plugin.js
11
- @jitsu/js:build: 1: /* global analytics */
12
- @jitsu/js:build: 2: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- @jitsu/js:build:  ^
14
- @jitsu/js:build: 3: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- @jitsu/js:build: 4: return new (P || (P = Promise))(function (resolve, reject) {
16
- @jitsu/js:build: ...and 1 other occurrence
17
- @jitsu/js:build: compiled/src/destination-plugins.js
18
- @jitsu/js:build: 1: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
19
- @jitsu/js:build:  ^
20
- @jitsu/js:build: 2: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
21
- @jitsu/js:build: 3: return new (P || (P = Promise))(function (resolve, reject) {
22
- @jitsu/js:build: ...and 1 other occurrence
23
- @jitsu/js:build: (!) Circular dependencies
24
- @jitsu/js:build: compiled/src/index.js -> compiled/src/analytics-plugin.js -> compiled/src/index.js
25
- @jitsu/js:build: compiled/src/analytics-plugin.js -> compiled/src/destination-plugins.js -> compiled/src/analytics-plugin.js
26
- @jitsu/js:build: (!) Use of eval is strongly discouraged
27
- @jitsu/js:build: https://rollupjs.org/troubleshooting/#avoiding-eval
28
- @jitsu/js:build: compiled/src/destination-plugins.js
29
- @jitsu/js:build: 75: })()`;
30
- @jitsu/js:build: 76: try {
31
- @jitsu/js:build: 77: eval(iif);
32
- @jitsu/js:build:  ^
33
- @jitsu/js:build: 78: }
34
- @jitsu/js:build: 79: catch (e) {
35
- @jitsu/js:build: created dist/web/p.js.txt in 872ms
36
- @jitsu/js:build: 
37
- @jitsu/js:build: ./compiled/src/index.js, ./compiled/src/jitsu.js, ./compiled/src/analytics-plugin.js → dist/jitsu.es.js, dist/jitsu.cjs.js...
38
- @jitsu/js:build: (!) "this" has been rewritten to "undefined"
39
- @jitsu/js:build: https://rollupjs.org/troubleshooting/#error-this-is-undefined
40
- @jitsu/js:build: compiled/src/analytics-plugin.js
41
- @jitsu/js:build: 1: /* global analytics */
42
- @jitsu/js:build: 2: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
43
- @jitsu/js:build:  ^
44
- @jitsu/js:build: 3: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
45
- @jitsu/js:build: 4: return new (P || (P = Promise))(function (resolve, reject) {
46
- @jitsu/js:build: ...and 1 other occurrence
47
- @jitsu/js:build: compiled/src/destination-plugins.js
48
- @jitsu/js:build: 1: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
49
- @jitsu/js:build:  ^
50
- @jitsu/js:build: 2: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
51
- @jitsu/js:build: 3: return new (P || (P = Promise))(function (resolve, reject) {
52
- @jitsu/js:build: ...and 1 other occurrence
53
- @jitsu/js:build: (!) Circular dependencies
54
- @jitsu/js:build: compiled/src/index.js -> compiled/src/analytics-plugin.js -> compiled/src/index.js
55
- @jitsu/js:build: compiled/src/analytics-plugin.js -> compiled/src/destination-plugins.js -> compiled/src/analytics-plugin.js
56
- @jitsu/js:build: (!) Use of eval is strongly discouraged
57
- @jitsu/js:build: https://rollupjs.org/troubleshooting/#avoiding-eval
58
- @jitsu/js:build: compiled/src/destination-plugins.js
59
- @jitsu/js:build: 75: })()`;
60
- @jitsu/js:build: 76: try {
61
- @jitsu/js:build: 77: eval(iif);
62
- @jitsu/js:build:  ^
63
- @jitsu/js:build: 78: }
64
- @jitsu/js:build: 79: catch (e) {
65
- @jitsu/js:build: created dist/jitsu.es.js, dist/jitsu.cjs.js in 504ms
1
+ @jitsu/js:build: cache hit, replaying output 70799201810b0c5a
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: (!) "this" has been rewritten to "undefined"
9
+ @jitsu/js:build: https://rollupjs.org/troubleshooting/#error-this-is-undefined
10
+ @jitsu/js:build: compiled/src/analytics-plugin.js
11
+ @jitsu/js:build: 1: /* global analytics */
12
+ @jitsu/js:build: 2: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ @jitsu/js:build:  ^
14
+ @jitsu/js:build: 3: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ @jitsu/js:build: 4: return new (P || (P = Promise))(function (resolve, reject) {
16
+ @jitsu/js:build: ...and 1 other occurrence
17
+ @jitsu/js:build: compiled/src/destination-plugins/tag.js
18
+ @jitsu/js:build: 1: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
19
+ @jitsu/js:build:  ^
20
+ @jitsu/js:build: 2: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
21
+ @jitsu/js:build: 3: return new (P || (P = Promise))(function (resolve, reject) {
22
+ @jitsu/js:build: ...and 1 other occurrence
23
+ @jitsu/js:build: compiled/src/destination-plugins/gtm.js
24
+ @jitsu/js:build: 1: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
25
+ @jitsu/js:build:  ^
26
+ @jitsu/js:build: 2: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ @jitsu/js:build: 3: return new (P || (P = Promise))(function (resolve, reject) {
28
+ @jitsu/js:build: ...and 1 other occurrence
29
+ @jitsu/js:build: compiled/src/destination-plugins/logrocket.js
30
+ @jitsu/js:build: 1: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
31
+ @jitsu/js:build:  ^
32
+ @jitsu/js:build: 2: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
33
+ @jitsu/js:build: 3: return new (P || (P = Promise))(function (resolve, reject) {
34
+ @jitsu/js:build: ...and 1 other occurrence
35
+ @jitsu/js:build: (!) Circular dependencies
36
+ @jitsu/js:build: compiled/src/index.js -> compiled/src/analytics-plugin.js -> compiled/src/index.js
37
+ @jitsu/js:build: compiled/src/destination-plugins/index.js -> compiled/src/destination-plugins/tag.js -> compiled/src/destination-plugins/index.js
38
+ @jitsu/js:build: compiled/src/analytics-plugin.js -> compiled/src/destination-plugins/index.js -> compiled/src/destination-plugins/tag.js -> compiled/src/analytics-plugin.js
39
+ @jitsu/js:build: compiled/src/destination-plugins/index.js -> compiled/src/destination-plugins/logrocket.js -> compiled/src/destination-plugins/index.js
40
+ @jitsu/js:build: compiled/src/destination-plugins/index.js -> compiled/src/destination-plugins/gtm.js -> compiled/src/destination-plugins/index.js
41
+ @jitsu/js:build: (!) Use of eval is strongly discouraged
42
+ @jitsu/js:build: https://rollupjs.org/troubleshooting/#avoiding-eval
43
+ @jitsu/js:build: compiled/src/destination-plugins/tag.js
44
+ @jitsu/js:build: 68: })()`;
45
+ @jitsu/js:build: 69: try {
46
+ @jitsu/js:build: 70: eval(iif);
47
+ @jitsu/js:build:  ^
48
+ @jitsu/js:build: 71: }
49
+ @jitsu/js:build: 72: catch (e) {
50
+ @jitsu/js:build: created dist/web/p.js.txt in 512ms
51
+ @jitsu/js:build: 
52
+ @jitsu/js:build: ./compiled/src/index.js, ./compiled/src/jitsu.js, ./compiled/src/analytics-plugin.js → dist/jitsu.es.js, dist/jitsu.cjs.js...
53
+ @jitsu/js:build: (!) "this" has been rewritten to "undefined"
54
+ @jitsu/js:build: https://rollupjs.org/troubleshooting/#error-this-is-undefined
55
+ @jitsu/js:build: compiled/src/analytics-plugin.js
56
+ @jitsu/js:build: 1: /* global analytics */
57
+ @jitsu/js:build: 2: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
58
+ @jitsu/js:build:  ^
59
+ @jitsu/js:build: 3: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
60
+ @jitsu/js:build: 4: return new (P || (P = Promise))(function (resolve, reject) {
61
+ @jitsu/js:build: ...and 1 other occurrence
62
+ @jitsu/js:build: compiled/src/destination-plugins/tag.js
63
+ @jitsu/js:build: 1: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
64
+ @jitsu/js:build:  ^
65
+ @jitsu/js:build: 2: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
66
+ @jitsu/js:build: 3: return new (P || (P = Promise))(function (resolve, reject) {
67
+ @jitsu/js:build: ...and 1 other occurrence
68
+ @jitsu/js:build: compiled/src/destination-plugins/logrocket.js
69
+ @jitsu/js:build: 1: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
70
+ @jitsu/js:build:  ^
71
+ @jitsu/js:build: 2: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
72
+ @jitsu/js:build: 3: return new (P || (P = Promise))(function (resolve, reject) {
73
+ @jitsu/js:build: ...and 1 other occurrence
74
+ @jitsu/js:build: compiled/src/destination-plugins/gtm.js
75
+ @jitsu/js:build: 1: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
76
+ @jitsu/js:build:  ^
77
+ @jitsu/js:build: 2: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
78
+ @jitsu/js:build: 3: return new (P || (P = Promise))(function (resolve, reject) {
79
+ @jitsu/js:build: ...and 1 other occurrence
80
+ @jitsu/js:build: (!) Circular dependencies
81
+ @jitsu/js:build: compiled/src/index.js -> compiled/src/analytics-plugin.js -> compiled/src/index.js
82
+ @jitsu/js:build: compiled/src/destination-plugins/index.js -> compiled/src/destination-plugins/tag.js -> compiled/src/destination-plugins/index.js
83
+ @jitsu/js:build: compiled/src/analytics-plugin.js -> compiled/src/destination-plugins/index.js -> compiled/src/destination-plugins/tag.js -> compiled/src/analytics-plugin.js
84
+ @jitsu/js:build: compiled/src/destination-plugins/index.js -> compiled/src/destination-plugins/logrocket.js -> compiled/src/destination-plugins/index.js
85
+ @jitsu/js:build: compiled/src/destination-plugins/index.js -> compiled/src/destination-plugins/gtm.js -> compiled/src/destination-plugins/index.js
86
+ @jitsu/js:build: (!) Use of eval is strongly discouraged
87
+ @jitsu/js:build: https://rollupjs.org/troubleshooting/#avoiding-eval
88
+ @jitsu/js:build: compiled/src/destination-plugins/tag.js
89
+ @jitsu/js:build: 68: })()`;
90
+ @jitsu/js:build: 69: try {
91
+ @jitsu/js:build: 70: eval(iif);
92
+ @jitsu/js:build:  ^
93
+ @jitsu/js:build: 71: }
94
+ @jitsu/js:build: 72: catch (e) {
95
+ @jitsu/js:build: created dist/jitsu.es.js, dist/jitsu.cjs.js in 353ms
@@ -1,5 +1,5 @@
1
- @jitsu/js:clean: cache hit, replaying output a45f0a4478c12277
2
- @jitsu/js:clean: 
3
- @jitsu/js:clean: > @jitsu/js@0.0.0 clean /Users/vklmn/dev2/onetag/libs/jitsu-js
4
- @jitsu/js:clean: > rm -rf ./dist
5
- @jitsu/js:clean: 
1
+ @jitsu/js:clean: cache hit, replaying output 96c25c4b05e1319b
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: 
@@ -46,6 +46,10 @@ describe("Test Jitsu NodeJS client", () => {
46
46
  email: "test@test.com",
47
47
  });
48
48
 
49
+ await jitsu.group("testGroup", {
50
+ name: "Test Group",
51
+ });
52
+
49
53
  await jitsu.page({
50
54
  name: "test",
51
55
  environment: "nodejs",
@@ -56,14 +60,16 @@ describe("Test Jitsu NodeJS client", () => {
56
60
  },
57
61
  });
58
62
  await new Promise(resolve => setTimeout(resolve, 1000));
59
- expect(requestLog.length).toBe(3);
63
+ expect(requestLog.length).toBe(4);
60
64
  expect(requestLog[0].type).toBe("track");
61
65
  expect(requestLog[1].type).toBe("identify");
62
- expect(requestLog[2].type).toBe("page");
66
+ expect(requestLog[2].type).toBe("group");
67
+ expect(requestLog[3].type).toBe("page");
63
68
 
64
69
  const track = requestLog[0].body as AnalyticsClientEvent;
65
70
  const identify = requestLog[1].body as AnalyticsClientEvent;
66
- const page = requestLog[2].body as AnalyticsClientEvent;
71
+ const group = requestLog[2].body as AnalyticsClientEvent;
72
+ const page = requestLog[3].body as AnalyticsClientEvent;
67
73
 
68
74
  //expect(track.userId).toBe(undefined);
69
75
  expect(page.properties.name).toBe("test");
@@ -72,6 +78,11 @@ describe("Test Jitsu NodeJS client", () => {
72
78
  expect(page.userId).toBe("testUser");
73
79
  expect(identify.traits.email).toBe("test@test.com");
74
80
  expect(identify.anonymousId).toBe(page.anonymousId);
81
+ expect(group.traits.name).toBe("Test Group");
82
+ expect(group.anonymousId).toBe(page.anonymousId);
83
+ expect(group.userId).toBe("testUser");
84
+ expect(group.groupId).toBe("testGroup");
85
+
75
86
  const pagePayload = requestLog[0].body;
76
87
  console.log("pagePayload", pagePayload);
77
88
  } finally {
@@ -7,8 +7,6 @@ import ejs from "ejs";
7
7
  import * as process from "process";
8
8
  import * as console from "console";
9
9
  import { AnalyticsClientEvent, AnalyticsInterface } from "@jitsu/protocols/analytics.d";
10
- import type { AnalyticsCore } from "@segment/analytics-next/src/core/analytics/interfaces";
11
- import { response } from "express";
12
10
 
13
11
  test.use({
14
12
  ignoreHTTPSErrors: true,
@@ -116,6 +114,7 @@ const generateTestEvents = async () => {
116
114
  await analytics.identify("userId2", { email: "john.doe2@gmail.com", caseName: "basic-identify" });
117
115
  // jitsu must extract traits even from 'id' object
118
116
  await analytics.identify({ email: "john.doe3@gmail.com", caseName: "identify-without-user-id" });
117
+ await analytics.group("group1", { name: "Group 1", caseName: "basic-group" });
119
118
  await analytics.page({ caseName: "page-without-name", context: { page: { title: "Synthetic Title" } } });
120
119
  await analytics.page("test-page", { caseName: "page-with-name" });
121
120
  await analytics.track("testEvent", { caseName: "track-with-name" });
@@ -10,6 +10,7 @@ export type DestinationDescriptor = {
10
10
  id: string;
11
11
  destinationType: string;
12
12
  credentials: any;
13
+ options: any;
13
14
  deviceOptions: DeviceOptions;
14
15
  };
15
16
  export type AnalyticsPluginDescriptor = {
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export declare const emptyAnalytics: {
5
5
  page: () => Promise<void>;
6
6
  user: () => {};
7
7
  identify: () => Promise<{}>;
8
+ group: () => Promise<{}>;
8
9
  reset: () => Promise<{}>;
9
10
  };
10
11
  export declare function jitsuAnalytics(opts: JitsuOptions): AnalyticsInterface;