@jitsu/js 0.0.0-alpha.95 → 0.0.0-alpha.98
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/.turbo/turbo-build.log +15 -15
- package/.turbo/turbo-clean.log +5 -5
- package/dist/jitsu.cjs.js +18 -2
- package/dist/jitsu.es.js +18 -2
- package/dist/web/p.js.txt +18 -2
- package/package.json +2 -2
- package/src/analytics-plugin.ts +19 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
@jitsu/js:build: cache hit, replaying output [
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
1
|
+
@jitsu/js:build: cache hit, replaying output [2m1a9a20c9353ea7f7[0m
|
|
2
|
+
[34m@jitsu/js:build: [0m
|
|
3
|
+
[34m@jitsu/js:build: [0m> @jitsu/js@0.0.0 build /Users/ildarnurislamov/Projects/onetag/libs/jitsu-js
|
|
4
|
+
[34m@jitsu/js:build: [0m> tsc -p . && rollup -c && cp src/jitsu.d.ts dist
|
|
5
|
+
[34m@jitsu/js:build: [0m
|
|
6
|
+
[34m@jitsu/js:build: [0m[36m
|
|
7
|
+
[34m@jitsu/js:build: [0m[1m./compiled/src/browser.js[22m → [1mdist/web/p.js.txt[22m...[39m
|
|
8
|
+
[34m@jitsu/js:build: [0m[1m[33m(!) Circular dependency[39m[22m
|
|
9
|
+
[34m@jitsu/js:build: [0mcompiled/src/index.js -> compiled/src/analytics-plugin.js -> compiled/src/index.js
|
|
10
|
+
[34m@jitsu/js:build: [0m[32mcreated [1mdist/web/p.js.txt[22m in [1m539ms[22m[39m
|
|
11
|
+
[34m@jitsu/js:build: [0m[36m
|
|
12
|
+
[34m@jitsu/js:build: [0m[1m./compiled/src/index.js[22m → [1mdist/jitsu.es.js, dist/jitsu.cjs.js[22m...[39m
|
|
13
|
+
[34m@jitsu/js:build: [0m[1m[33m(!) Circular dependency[39m[22m
|
|
14
|
+
[34m@jitsu/js:build: [0mcompiled/src/index.js -> compiled/src/analytics-plugin.js -> compiled/src/index.js
|
|
15
|
+
[34m@jitsu/js:build: [0m[32mcreated [1mdist/jitsu.es.js, dist/jitsu.cjs.js[22m in [1m416ms[22m[39m
|
package/.turbo/turbo-clean.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
@jitsu/js:clean: cache hit, replaying output [
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
1
|
+
@jitsu/js:clean: cache hit, replaying output [2mba79a39d6c375556[0m
|
|
2
|
+
[34m@jitsu/js:clean: [0m
|
|
3
|
+
[34m@jitsu/js:clean: [0m> @jitsu/js@0.0.0 clean /Users/ildarnurislamov/Projects/onetag/libs/jitsu-js
|
|
4
|
+
[34m@jitsu/js:clean: [0m> rm -rf ./dist
|
|
5
|
+
[34m@jitsu/js:clean: [0m
|
package/dist/jitsu.cjs.js
CHANGED
|
@@ -303,13 +303,13 @@ function adjustPayload(payload, config, storage) {
|
|
|
303
303
|
},
|
|
304
304
|
campaign: parseUtms(query),
|
|
305
305
|
};
|
|
306
|
-
const withContext = Object.assign(Object.assign({}, payload), { timestamp: new Date().toISOString(), sentAt: new Date().toISOString(), context: deepMerge(context, customContext) });
|
|
306
|
+
const withContext = Object.assign(Object.assign({}, payload), { timestamp: new Date().toISOString(), sentAt: new Date().toISOString(), messageId: randomId(), context: deepMerge(context, customContext) });
|
|
307
307
|
delete withContext.meta;
|
|
308
308
|
delete withContext.options;
|
|
309
309
|
return withContext;
|
|
310
310
|
}
|
|
311
311
|
function send(method, payload, jitsuConfig, store) {
|
|
312
|
-
const url = `${jitsuConfig.host}/s/${method}`;
|
|
312
|
+
const url = `${jitsuConfig.host}/api/s/${method}`;
|
|
313
313
|
const fetch = jitsuConfig.fetch || globalThis.fetch;
|
|
314
314
|
if (!fetch) {
|
|
315
315
|
throw new Error("Please specify fetch function in jitsu plugin initialization, fetch isn't available in global scope");
|
|
@@ -386,6 +386,22 @@ const jitsuAnalyticsPlugin = (pluginConfig = {}) => {
|
|
|
386
386
|
},
|
|
387
387
|
};
|
|
388
388
|
};
|
|
389
|
+
function randomId(digits = 24) {
|
|
390
|
+
let id = "";
|
|
391
|
+
for (let i = 0; i < digits; i++) {
|
|
392
|
+
id += randomChar(i === 0);
|
|
393
|
+
}
|
|
394
|
+
return id;
|
|
395
|
+
}
|
|
396
|
+
function randomChar(noDigits) {
|
|
397
|
+
const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
398
|
+
while (true) {
|
|
399
|
+
const index = Math.floor(Math.random() * chars.length);
|
|
400
|
+
if (!noDigits || index > 9) {
|
|
401
|
+
return chars[index];
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
389
405
|
|
|
390
406
|
function parse(input) {
|
|
391
407
|
let value = input;
|
package/dist/jitsu.es.js
CHANGED
|
@@ -301,13 +301,13 @@ function adjustPayload(payload, config, storage) {
|
|
|
301
301
|
},
|
|
302
302
|
campaign: parseUtms(query),
|
|
303
303
|
};
|
|
304
|
-
const withContext = Object.assign(Object.assign({}, payload), { timestamp: new Date().toISOString(), sentAt: new Date().toISOString(), context: deepMerge(context, customContext) });
|
|
304
|
+
const withContext = Object.assign(Object.assign({}, payload), { timestamp: new Date().toISOString(), sentAt: new Date().toISOString(), messageId: randomId(), context: deepMerge(context, customContext) });
|
|
305
305
|
delete withContext.meta;
|
|
306
306
|
delete withContext.options;
|
|
307
307
|
return withContext;
|
|
308
308
|
}
|
|
309
309
|
function send(method, payload, jitsuConfig, store) {
|
|
310
|
-
const url = `${jitsuConfig.host}/s/${method}`;
|
|
310
|
+
const url = `${jitsuConfig.host}/api/s/${method}`;
|
|
311
311
|
const fetch = jitsuConfig.fetch || globalThis.fetch;
|
|
312
312
|
if (!fetch) {
|
|
313
313
|
throw new Error("Please specify fetch function in jitsu plugin initialization, fetch isn't available in global scope");
|
|
@@ -384,6 +384,22 @@ const jitsuAnalyticsPlugin = (pluginConfig = {}) => {
|
|
|
384
384
|
},
|
|
385
385
|
};
|
|
386
386
|
};
|
|
387
|
+
function randomId(digits = 24) {
|
|
388
|
+
let id = "";
|
|
389
|
+
for (let i = 0; i < digits; i++) {
|
|
390
|
+
id += randomChar(i === 0);
|
|
391
|
+
}
|
|
392
|
+
return id;
|
|
393
|
+
}
|
|
394
|
+
function randomChar(noDigits) {
|
|
395
|
+
const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
396
|
+
while (true) {
|
|
397
|
+
const index = Math.floor(Math.random() * chars.length);
|
|
398
|
+
if (!noDigits || index > 9) {
|
|
399
|
+
return chars[index];
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
387
403
|
|
|
388
404
|
function parse(input) {
|
|
389
405
|
let value = input;
|
package/dist/web/p.js.txt
CHANGED
|
@@ -304,13 +304,13 @@
|
|
|
304
304
|
},
|
|
305
305
|
campaign: parseUtms(query),
|
|
306
306
|
};
|
|
307
|
-
const withContext = Object.assign(Object.assign({}, payload), { timestamp: new Date().toISOString(), sentAt: new Date().toISOString(), context: deepMerge(context, customContext) });
|
|
307
|
+
const withContext = Object.assign(Object.assign({}, payload), { timestamp: new Date().toISOString(), sentAt: new Date().toISOString(), messageId: randomId(), context: deepMerge(context, customContext) });
|
|
308
308
|
delete withContext.meta;
|
|
309
309
|
delete withContext.options;
|
|
310
310
|
return withContext;
|
|
311
311
|
}
|
|
312
312
|
function send(method, payload, jitsuConfig, store) {
|
|
313
|
-
const url = `${jitsuConfig.host}/s/${method}`;
|
|
313
|
+
const url = `${jitsuConfig.host}/api/s/${method}`;
|
|
314
314
|
const fetch = jitsuConfig.fetch || globalThis.fetch;
|
|
315
315
|
if (!fetch) {
|
|
316
316
|
throw new Error("Please specify fetch function in jitsu plugin initialization, fetch isn't available in global scope");
|
|
@@ -387,6 +387,22 @@
|
|
|
387
387
|
},
|
|
388
388
|
};
|
|
389
389
|
};
|
|
390
|
+
function randomId(digits = 24) {
|
|
391
|
+
let id = "";
|
|
392
|
+
for (let i = 0; i < digits; i++) {
|
|
393
|
+
id += randomChar(i === 0);
|
|
394
|
+
}
|
|
395
|
+
return id;
|
|
396
|
+
}
|
|
397
|
+
function randomChar(noDigits) {
|
|
398
|
+
const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
399
|
+
while (true) {
|
|
400
|
+
const index = Math.floor(Math.random() * chars.length);
|
|
401
|
+
if (!noDigits || index > 9) {
|
|
402
|
+
return chars[index];
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
390
406
|
|
|
391
407
|
function parse(input) {
|
|
392
408
|
let value = input;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jitsu/js",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.98",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Jitsu Dev Team <dev@jitsu.com>",
|
|
6
6
|
"main": "dist/jitsu.cjs.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"raw-loader": "^4.0.2",
|
|
34
34
|
"rollup": "^3.2.5",
|
|
35
35
|
"ts-jest": "^29.0.3",
|
|
36
|
-
"@jitsu/types": "0.0.0-alpha.
|
|
36
|
+
"@jitsu/types": "0.0.0-alpha.98"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"analytics": "^0.8.1"
|
package/src/analytics-plugin.ts
CHANGED
|
@@ -267,6 +267,7 @@ function adjustPayload(payload: any, config: JitsuOptions, storage: PersistentSt
|
|
|
267
267
|
...payload,
|
|
268
268
|
timestamp: new Date().toISOString(),
|
|
269
269
|
sentAt: new Date().toISOString(),
|
|
270
|
+
messageId: randomId(),
|
|
270
271
|
context: deepMerge(context, customContext),
|
|
271
272
|
};
|
|
272
273
|
delete withContext.meta;
|
|
@@ -275,7 +276,7 @@ function adjustPayload(payload: any, config: JitsuOptions, storage: PersistentSt
|
|
|
275
276
|
}
|
|
276
277
|
|
|
277
278
|
function send(method, payload, jitsuConfig: Required<JitsuOptions>, store: PersistentStorage): Promise<void> {
|
|
278
|
-
const url = `${jitsuConfig.host}/s/${method}`;
|
|
279
|
+
const url = `${jitsuConfig.host}/api/s/${method}`;
|
|
279
280
|
const fetch = jitsuConfig.fetch || globalThis.fetch;
|
|
280
281
|
if (!fetch) {
|
|
281
282
|
throw new Error(
|
|
@@ -367,5 +368,22 @@ const jitsuAnalyticsPlugin = (pluginConfig: JitsuOptions = {}): AnalyticsPlugin
|
|
|
367
368
|
},
|
|
368
369
|
};
|
|
369
370
|
};
|
|
371
|
+
export function randomId(digits: number = 24): string {
|
|
372
|
+
let id = "";
|
|
373
|
+
for (let i = 0; i < digits; i++) {
|
|
374
|
+
id += randomChar(i === 0);
|
|
375
|
+
}
|
|
376
|
+
return id;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function randomChar(noDigits?: boolean) {
|
|
380
|
+
const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
381
|
+
while (true) {
|
|
382
|
+
const index = Math.floor(Math.random() * chars.length);
|
|
383
|
+
if (!noDigits || index > 9) {
|
|
384
|
+
return chars[index];
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
370
388
|
|
|
371
389
|
export default jitsuAnalyticsPlugin;
|