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

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,4 +1,4 @@
1
- @jitsu/js:build: cache hit, replaying output 69adc66572df923c
1
+ @jitsu/js:build: cache hit, replaying output 126f0e7238465aa8
2
2
  @jitsu/js:build: 
3
3
  @jitsu/js:build: > @jitsu/js@0.0.0 build /Users/vklmn/dev2/onetag/libs/jitsu-js
4
4
  @jitsu/js:build: > tsc -p . && rollup -c && cp compiled/src/*.d.ts dist
@@ -6,7 +6,7 @@
6
6
  @jitsu/js:build: 
7
7
  @jitsu/js:build: ./compiled/src/browser.js → dist/web/p.js.txt...
8
8
  @jitsu/js:build: (!) "this" has been rewritten to "undefined"
9
- @jitsu/js:build: https://rollupjs.org/guide/en/#error-this-is-undefined
9
+ @jitsu/js:build: https://rollupjs.org/troubleshooting/#error-this-is-undefined
10
10
  @jitsu/js:build: compiled/src/analytics-plugin.js
11
11
  @jitsu/js:build: 1: /* global analytics */
12
12
  @jitsu/js:build: 2: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -24,7 +24,7 @@
24
24
  @jitsu/js:build: compiled/src/index.js -> compiled/src/analytics-plugin.js -> compiled/src/index.js
25
25
  @jitsu/js:build: compiled/src/analytics-plugin.js -> compiled/src/destination-plugins.js -> compiled/src/analytics-plugin.js
26
26
  @jitsu/js:build: (!) Use of eval is strongly discouraged
27
- @jitsu/js:build: https://rollupjs.org/guide/en/#avoiding-eval
27
+ @jitsu/js:build: https://rollupjs.org/troubleshooting/#avoiding-eval
28
28
  @jitsu/js:build: compiled/src/destination-plugins.js
29
29
  @jitsu/js:build: 75: })()`;
30
30
  @jitsu/js:build: 76: try {
@@ -32,11 +32,11 @@
32
32
  @jitsu/js:build:  ^
33
33
  @jitsu/js:build: 78: }
34
34
  @jitsu/js:build: 79: catch (e) {
35
- @jitsu/js:build: created dist/web/p.js.txt in 213ms
35
+ @jitsu/js:build: created dist/web/p.js.txt in 872ms
36
36
  @jitsu/js:build: 
37
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
38
  @jitsu/js:build: (!) "this" has been rewritten to "undefined"
39
- @jitsu/js:build: https://rollupjs.org/guide/en/#error-this-is-undefined
39
+ @jitsu/js:build: https://rollupjs.org/troubleshooting/#error-this-is-undefined
40
40
  @jitsu/js:build: compiled/src/analytics-plugin.js
41
41
  @jitsu/js:build: 1: /* global analytics */
42
42
  @jitsu/js:build: 2: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -54,7 +54,7 @@
54
54
  @jitsu/js:build: compiled/src/index.js -> compiled/src/analytics-plugin.js -> compiled/src/index.js
55
55
  @jitsu/js:build: compiled/src/analytics-plugin.js -> compiled/src/destination-plugins.js -> compiled/src/analytics-plugin.js
56
56
  @jitsu/js:build: (!) Use of eval is strongly discouraged
57
- @jitsu/js:build: https://rollupjs.org/guide/en/#avoiding-eval
57
+ @jitsu/js:build: https://rollupjs.org/troubleshooting/#avoiding-eval
58
58
  @jitsu/js:build: compiled/src/destination-plugins.js
59
59
  @jitsu/js:build: 75: })()`;
60
60
  @jitsu/js:build: 76: try {
@@ -62,4 +62,4 @@
62
62
  @jitsu/js:build:  ^
63
63
  @jitsu/js:build: 78: }
64
64
  @jitsu/js:build: 79: catch (e) {
65
- @jitsu/js:build: created dist/jitsu.es.js, dist/jitsu.cjs.js in 160ms
65
+ @jitsu/js:build: created dist/jitsu.es.js, dist/jitsu.cjs.js in 504ms
@@ -1,4 +1,4 @@
1
- @jitsu/js:clean: cache hit, replaying output a6c982fcc208270f
1
+ @jitsu/js:clean: cache hit, replaying output a45f0a4478c12277
2
2
  @jitsu/js:clean: 
3
3
  @jitsu/js:clean: > @jitsu/js@0.0.0 clean /Users/vklmn/dev2/onetag/libs/jitsu-js
4
4
  @jitsu/js:clean: > rm -rf ./dist
@@ -1,7 +1,4 @@
1
- import fs from "fs";
2
- import path from "path";
3
1
  import { createServer, SimpleSyrup } from "../simple-syrup";
4
- import process from "process";
5
2
  import { AnalyticsClientEvent, AnalyticsInterface } from "@jitsu/protocols/analytics";
6
3
 
7
4
  const jitsuAnalytics = require("../../dist/jitsu.cjs.js").jitsuAnalytics;
package/dist/jitsu.cjs.js CHANGED
@@ -469,7 +469,9 @@ function processDestinations(destinations, method, event, debug, analyticsInstan
469
469
  const plugin = internalDestinationPlugins[destination.deviceOptions.name];
470
470
  if (plugin) {
471
471
  try {
472
- promises.push(plugin.handle(destination.credentials, event));
472
+ //to support old versions, where credentials were stored in root
473
+ const credentials = destination.credentials || destination;
474
+ promises.push(plugin.handle(credentials, event));
473
475
  }
474
476
  catch (e) {
475
477
  console.warn(`[JITSU] Error processing event with internal plugin '${destination.deviceOptions.name}': ${e === null || e === void 0 ? void 0 : e.message}`, e);
@@ -526,12 +528,12 @@ function send(method, payload, jitsuConfig, instance, store) {
526
528
  if (!fetch) {
527
529
  throw new Error("Please specify fetch function in jitsu plugin initialization, fetch isn't available in global scope");
528
530
  }
529
- const authHeader = {};
530
531
  const debugHeader = jitsuConfig.debug ? { "X-Enable-Debug": "true" } : {};
531
532
  // if (jitsuConfig.debug) {
532
533
  // console.log(`[JITSU] Sending event to ${url}: `, JSON.stringify(payload, null, 2));
533
534
  // }
534
535
  const adjustedPayload = adjustPayload(payload, jitsuConfig, store);
536
+ const authHeader = adjustedPayload.writeKey ? { "X-Write-Key": adjustedPayload.writeKey } : {};
535
537
  return fetch(url, {
536
538
  method: "POST",
537
539
  headers: Object.assign(Object.assign({ "Content-Type": "application/json" }, authHeader), debugHeader),
package/dist/jitsu.d.ts CHANGED
@@ -15,7 +15,7 @@ type JitsuOptions = {
15
15
  */
16
16
  debug?: boolean;
17
17
  /**
18
- * Explicitely specify cookie domain. If not set, cookie domain will be set to top level
18
+ * Explicitly specify cookie domain. If not set, cookie domain will be set to top level
19
19
  * of the current domain. Example: if JS lives on "app.example.com", cookie domain will be
20
20
  * set to ".example.com". If it lives on "example.com", cookie domain will be set to ".example.com" too
21
21
  */
package/dist/jitsu.es.js CHANGED
@@ -467,7 +467,9 @@ function processDestinations(destinations, method, event, debug, analyticsInstan
467
467
  const plugin = internalDestinationPlugins[destination.deviceOptions.name];
468
468
  if (plugin) {
469
469
  try {
470
- promises.push(plugin.handle(destination.credentials, event));
470
+ //to support old versions, where credentials were stored in root
471
+ const credentials = destination.credentials || destination;
472
+ promises.push(plugin.handle(credentials, event));
471
473
  }
472
474
  catch (e) {
473
475
  console.warn(`[JITSU] Error processing event with internal plugin '${destination.deviceOptions.name}': ${e === null || e === void 0 ? void 0 : e.message}`, e);
@@ -524,12 +526,12 @@ function send(method, payload, jitsuConfig, instance, store) {
524
526
  if (!fetch) {
525
527
  throw new Error("Please specify fetch function in jitsu plugin initialization, fetch isn't available in global scope");
526
528
  }
527
- const authHeader = {};
528
529
  const debugHeader = jitsuConfig.debug ? { "X-Enable-Debug": "true" } : {};
529
530
  // if (jitsuConfig.debug) {
530
531
  // console.log(`[JITSU] Sending event to ${url}: `, JSON.stringify(payload, null, 2));
531
532
  // }
532
533
  const adjustedPayload = adjustPayload(payload, jitsuConfig, store);
534
+ const authHeader = adjustedPayload.writeKey ? { "X-Write-Key": adjustedPayload.writeKey } : {};
533
535
  return fetch(url, {
534
536
  method: "POST",
535
537
  headers: Object.assign(Object.assign({ "Content-Type": "application/json" }, authHeader), debugHeader),
package/dist/web/p.js.txt CHANGED
@@ -470,7 +470,9 @@
470
470
  const plugin = internalDestinationPlugins[destination.deviceOptions.name];
471
471
  if (plugin) {
472
472
  try {
473
- promises.push(plugin.handle(destination.credentials, event));
473
+ //to support old versions, where credentials were stored in root
474
+ const credentials = destination.credentials || destination;
475
+ promises.push(plugin.handle(credentials, event));
474
476
  }
475
477
  catch (e) {
476
478
  console.warn(`[JITSU] Error processing event with internal plugin '${destination.deviceOptions.name}': ${e === null || e === void 0 ? void 0 : e.message}`, e);
@@ -527,12 +529,12 @@
527
529
  if (!fetch) {
528
530
  throw new Error("Please specify fetch function in jitsu plugin initialization, fetch isn't available in global scope");
529
531
  }
530
- const authHeader = {};
531
532
  const debugHeader = jitsuConfig.debug ? { "X-Enable-Debug": "true" } : {};
532
533
  // if (jitsuConfig.debug) {
533
534
  // console.log(`[JITSU] Sending event to ${url}: `, JSON.stringify(payload, null, 2));
534
535
  // }
535
536
  const adjustedPayload = adjustPayload(payload, jitsuConfig, store);
537
+ const authHeader = adjustedPayload.writeKey ? { "X-Write-Key": adjustedPayload.writeKey } : {};
536
538
  return fetch(url, {
537
539
  method: "POST",
538
540
  headers: Object.assign(Object.assign({ "Content-Type": "application/json" }, authHeader), debugHeader),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jitsu/js",
3
- "version": "1.1.0-canary.212.20230220173912",
3
+ "version": "1.1.0-canary.344.20230430234929",
4
4
  "description": "",
5
5
  "author": "Jitsu Dev Team <dev@jitsu.com>",
6
6
  "main": "dist/jitsu.cjs.js",
@@ -12,7 +12,7 @@
12
12
  "license": "MIT",
13
13
  "private": false,
14
14
  "devDependencies": {
15
- "@playwright/test": "^1.30.0",
15
+ "@playwright/test": "1.31.2",
16
16
  "@rollup/plugin-commonjs": "^23.0.2",
17
17
  "@rollup/plugin-json": "^5.0.1",
18
18
  "@rollup/plugin-multi-entry": "^6.0.0",
@@ -32,8 +32,9 @@
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": "1.1.0-canary.212.20230220173912"
35
+ "ts-jest": "29.0.5",
36
+ "typescript": "^4.9.5",
37
+ "@jitsu/protocols": "1.1.0-canary.344.20230430234929"
37
38
  },
38
39
  "dependencies": {
39
40
  "analytics": "^0.8.1"
@@ -319,7 +319,9 @@ async function processDestinations(
319
319
  const plugin = internalDestinationPlugins[destination.deviceOptions.name];
320
320
  if (plugin) {
321
321
  try {
322
- promises.push(plugin.handle(destination.credentials, event));
322
+ //to support old versions, where credentials were stored in root
323
+ const credentials = destination.credentials || destination;
324
+ promises.push(plugin.handle(credentials, event));
323
325
  } catch (e) {
324
326
  console.warn(
325
327
  `[JITSU] Error processing event with internal plugin '${destination.deviceOptions.name}': ${e?.message}`,
@@ -400,13 +402,13 @@ function send(
400
402
  "Please specify fetch function in jitsu plugin initialization, fetch isn't available in global scope"
401
403
  );
402
404
  }
403
- const authHeader = {};
404
405
  const debugHeader = jitsuConfig.debug ? { "X-Enable-Debug": "true" } : {};
405
406
 
406
407
  // if (jitsuConfig.debug) {
407
408
  // console.log(`[JITSU] Sending event to ${url}: `, JSON.stringify(payload, null, 2));
408
409
  // }
409
410
  const adjustedPayload = adjustPayload(payload, jitsuConfig, store);
411
+ const authHeader = adjustedPayload.writeKey ? { "X-Write-Key": adjustedPayload.writeKey } : {};
410
412
  return fetch(url, {
411
413
  method: "POST",
412
414
  headers: {
package/src/jitsu.ts CHANGED
@@ -16,7 +16,7 @@ type JitsuOptions = {
16
16
  */
17
17
  debug?: boolean;
18
18
  /**
19
- * Explicitely specify cookie domain. If not set, cookie domain will be set to top level
19
+ * Explicitly specify cookie domain. If not set, cookie domain will be set to top level
20
20
  * of the current domain. Example: if JS lives on "app.example.com", cookie domain will be
21
21
  * set to ".example.com". If it lives on "example.com", cookie domain will be set to ".example.com" too
22
22
  */