@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.
@@ -1,15 +1,15 @@
1
- @jitsu/js:build: cache hit, replaying output fd9a15b75ea61c02
2
- @jitsu/js:build: 
3
- @jitsu/js:build: > @jitsu/js@0.0.1 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 552ms
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 308ms
1
+ @jitsu/js:build: cache hit, replaying output 1a9a20c9353ea7f7
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 539ms
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 416ms
@@ -1,5 +1,5 @@
1
- @jitsu/js:clean: cache hit, replaying output 6cc5edb43189bde9
2
- @jitsu/js:clean: 
3
- @jitsu/js:clean: > @jitsu/js@0.0.1 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 ba79a39d6c375556
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: 
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.95",
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.95"
36
+ "@jitsu/types": "0.0.0-alpha.98"
37
37
  },
38
38
  "dependencies": {
39
39
  "analytics": "^0.8.1"
@@ -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;