@jitsu/js 1.9.18-canary.1288.20250415193648 → 1.9.18-canary.1288.20250415195029

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.
@@ -3,6 +3,7 @@ import { AnalyticsPlugin } from "analytics";
3
3
  export declare const parseQuery: (qs?: string) => Record<string, string>;
4
4
  export type StorageFactory = (cookieDomain: string, key2Cookie: (key: string) => string) => PersistentStorage;
5
5
  export declare function windowRuntime(opts: JitsuOptions): RuntimeFacade;
6
+ export declare function createInMemoryStorage(debug?: boolean): PersistentStorage;
6
7
  export declare const emptyRuntime: (config: JitsuOptions) => RuntimeFacade;
7
8
  export declare function isInBrowser(): boolean;
8
9
  export type DestinationDescriptor = {
package/dist/jitsu.cjs.js CHANGED
@@ -1333,6 +1333,38 @@ function windowRuntime(opts) {
1333
1333
  },
1334
1334
  };
1335
1335
  }
1336
+ function createInMemoryStorage(debug) {
1337
+ const storage = {};
1338
+ return {
1339
+ reset() {
1340
+ Object.keys(storage).forEach(key => delete storage[key]);
1341
+ },
1342
+ setItem(key, val) {
1343
+ if (debug) {
1344
+ console.log(`[JITSU EMPTY RUNTIME] Set storage item ${key}=${JSON.stringify(val)}`);
1345
+ }
1346
+ if (typeof val === "undefined") {
1347
+ delete storage[key];
1348
+ }
1349
+ else {
1350
+ storage[key] = val;
1351
+ }
1352
+ },
1353
+ getItem(key) {
1354
+ const val = storage[key];
1355
+ if (debug) {
1356
+ console.log(`[JITSU EMPTY RUNTIME] Get storage item ${key}=${JSON.stringify(val)}`);
1357
+ }
1358
+ return val;
1359
+ },
1360
+ removeItem(key) {
1361
+ if (debug) {
1362
+ console.log(`[JITSU EMPTY RUNTIME] Get storage item ${key}=${storage[key]}`);
1363
+ }
1364
+ delete storage[key];
1365
+ },
1366
+ };
1367
+ }
1336
1368
  const emptyRuntime = (config) => ({
1337
1369
  documentEncoding() {
1338
1370
  return undefined;
@@ -1347,36 +1379,7 @@ const emptyRuntime = (config) => ({
1347
1379
  return {};
1348
1380
  },
1349
1381
  store() {
1350
- const storage = {};
1351
- return {
1352
- reset() {
1353
- Object.keys(storage).forEach(key => delete storage[key]);
1354
- },
1355
- setItem(key, val) {
1356
- if (config.debug) {
1357
- console.log(`[JITSU EMPTY RUNTIME] Set storage item ${key}=${JSON.stringify(val)}`);
1358
- }
1359
- if (typeof val === "undefined") {
1360
- delete storage[key];
1361
- }
1362
- else {
1363
- storage[key] = val;
1364
- }
1365
- },
1366
- getItem(key) {
1367
- const val = storage[key];
1368
- if (config.debug) {
1369
- console.log(`[JITSU EMPTY RUNTIME] Get storage item ${key}=${JSON.stringify(val)}`);
1370
- }
1371
- return val;
1372
- },
1373
- removeItem(key) {
1374
- if (config.debug) {
1375
- console.log(`[JITSU EMPTY RUNTIME] Get storage item ${key}=${storage[key]}`);
1376
- }
1377
- delete storage[key];
1378
- },
1379
- };
1382
+ return createInMemoryStorage(config.debug);
1380
1383
  },
1381
1384
  language() {
1382
1385
  return undefined;
@@ -1462,6 +1465,7 @@ function adjustPayload(payload, config, storage, s2s) {
1462
1465
  userAgent: runtime.userAgent(),
1463
1466
  locale: runtime.language(),
1464
1467
  screen: runtime.screen(),
1468
+ ip: runtime === null || runtime === void 0 ? void 0 : runtime.ip(),
1465
1469
  traits: payload.type != "identify" && payload.type != "group" ? Object.assign({}, (restoreTraits(storage) || {})) : undefined,
1466
1470
  page: {
1467
1471
  path: properties.path || (parsedUrl && parsedUrl.pathname),
@@ -1951,7 +1955,7 @@ function createUnderlyingAnalyticsInstance(opts, rt, plugins = []) {
1951
1955
  persistentStorage.removeItem(key);
1952
1956
  },
1953
1957
  });
1954
- const storage = cachingStorageWrapper(rt.store());
1958
+ const storage = cachingStorageWrapper((rt === null || rt === void 0 ? void 0 : rt.store()) || createInMemoryStorage(opts.debug));
1955
1959
  const analytics = analyticsLib({
1956
1960
  debug: !!opts.debug,
1957
1961
  storage,
@@ -2085,6 +2089,7 @@ function jitsuAnalytics(_opts) {
2085
2089
  // }
2086
2090
  }
2087
2091
 
2092
+ exports.createInMemoryStorage = createInMemoryStorage;
2088
2093
  exports.emptyAnalytics = emptyAnalytics;
2089
2094
  exports.emptyRuntime = emptyRuntime;
2090
2095
  exports.isInBrowser = isInBrowser;
package/dist/jitsu.es.js CHANGED
@@ -1331,6 +1331,38 @@ function windowRuntime(opts) {
1331
1331
  },
1332
1332
  };
1333
1333
  }
1334
+ function createInMemoryStorage(debug) {
1335
+ const storage = {};
1336
+ return {
1337
+ reset() {
1338
+ Object.keys(storage).forEach(key => delete storage[key]);
1339
+ },
1340
+ setItem(key, val) {
1341
+ if (debug) {
1342
+ console.log(`[JITSU EMPTY RUNTIME] Set storage item ${key}=${JSON.stringify(val)}`);
1343
+ }
1344
+ if (typeof val === "undefined") {
1345
+ delete storage[key];
1346
+ }
1347
+ else {
1348
+ storage[key] = val;
1349
+ }
1350
+ },
1351
+ getItem(key) {
1352
+ const val = storage[key];
1353
+ if (debug) {
1354
+ console.log(`[JITSU EMPTY RUNTIME] Get storage item ${key}=${JSON.stringify(val)}`);
1355
+ }
1356
+ return val;
1357
+ },
1358
+ removeItem(key) {
1359
+ if (debug) {
1360
+ console.log(`[JITSU EMPTY RUNTIME] Get storage item ${key}=${storage[key]}`);
1361
+ }
1362
+ delete storage[key];
1363
+ },
1364
+ };
1365
+ }
1334
1366
  const emptyRuntime = (config) => ({
1335
1367
  documentEncoding() {
1336
1368
  return undefined;
@@ -1345,36 +1377,7 @@ const emptyRuntime = (config) => ({
1345
1377
  return {};
1346
1378
  },
1347
1379
  store() {
1348
- const storage = {};
1349
- return {
1350
- reset() {
1351
- Object.keys(storage).forEach(key => delete storage[key]);
1352
- },
1353
- setItem(key, val) {
1354
- if (config.debug) {
1355
- console.log(`[JITSU EMPTY RUNTIME] Set storage item ${key}=${JSON.stringify(val)}`);
1356
- }
1357
- if (typeof val === "undefined") {
1358
- delete storage[key];
1359
- }
1360
- else {
1361
- storage[key] = val;
1362
- }
1363
- },
1364
- getItem(key) {
1365
- const val = storage[key];
1366
- if (config.debug) {
1367
- console.log(`[JITSU EMPTY RUNTIME] Get storage item ${key}=${JSON.stringify(val)}`);
1368
- }
1369
- return val;
1370
- },
1371
- removeItem(key) {
1372
- if (config.debug) {
1373
- console.log(`[JITSU EMPTY RUNTIME] Get storage item ${key}=${storage[key]}`);
1374
- }
1375
- delete storage[key];
1376
- },
1377
- };
1380
+ return createInMemoryStorage(config.debug);
1378
1381
  },
1379
1382
  language() {
1380
1383
  return undefined;
@@ -1460,6 +1463,7 @@ function adjustPayload(payload, config, storage, s2s) {
1460
1463
  userAgent: runtime.userAgent(),
1461
1464
  locale: runtime.language(),
1462
1465
  screen: runtime.screen(),
1466
+ ip: runtime === null || runtime === void 0 ? void 0 : runtime.ip(),
1463
1467
  traits: payload.type != "identify" && payload.type != "group" ? Object.assign({}, (restoreTraits(storage) || {})) : undefined,
1464
1468
  page: {
1465
1469
  path: properties.path || (parsedUrl && parsedUrl.pathname),
@@ -1949,7 +1953,7 @@ function createUnderlyingAnalyticsInstance(opts, rt, plugins = []) {
1949
1953
  persistentStorage.removeItem(key);
1950
1954
  },
1951
1955
  });
1952
- const storage = cachingStorageWrapper(rt.store());
1956
+ const storage = cachingStorageWrapper((rt === null || rt === void 0 ? void 0 : rt.store()) || createInMemoryStorage(opts.debug));
1953
1957
  const analytics = analyticsLib({
1954
1958
  debug: !!opts.debug,
1955
1959
  storage,
@@ -2083,4 +2087,4 @@ function jitsuAnalytics(_opts) {
2083
2087
  // }
2084
2088
  }
2085
2089
 
2086
- export { emptyAnalytics, emptyRuntime, isInBrowser, jitsuAnalytics, jitsuAnalyticsPlugin, parseQuery, randomId, uuid, windowRuntime };
2090
+ export { createInMemoryStorage, emptyAnalytics, emptyRuntime, isInBrowser, jitsuAnalytics, jitsuAnalyticsPlugin, parseQuery, randomId, uuid, windowRuntime };
package/dist/web/p.js.txt CHANGED
@@ -1334,6 +1334,38 @@
1334
1334
  },
1335
1335
  };
1336
1336
  }
1337
+ function createInMemoryStorage(debug) {
1338
+ const storage = {};
1339
+ return {
1340
+ reset() {
1341
+ Object.keys(storage).forEach(key => delete storage[key]);
1342
+ },
1343
+ setItem(key, val) {
1344
+ if (debug) {
1345
+ console.log(`[JITSU EMPTY RUNTIME] Set storage item ${key}=${JSON.stringify(val)}`);
1346
+ }
1347
+ if (typeof val === "undefined") {
1348
+ delete storage[key];
1349
+ }
1350
+ else {
1351
+ storage[key] = val;
1352
+ }
1353
+ },
1354
+ getItem(key) {
1355
+ const val = storage[key];
1356
+ if (debug) {
1357
+ console.log(`[JITSU EMPTY RUNTIME] Get storage item ${key}=${JSON.stringify(val)}`);
1358
+ }
1359
+ return val;
1360
+ },
1361
+ removeItem(key) {
1362
+ if (debug) {
1363
+ console.log(`[JITSU EMPTY RUNTIME] Get storage item ${key}=${storage[key]}`);
1364
+ }
1365
+ delete storage[key];
1366
+ },
1367
+ };
1368
+ }
1337
1369
  const emptyRuntime = (config) => ({
1338
1370
  documentEncoding() {
1339
1371
  return undefined;
@@ -1348,36 +1380,7 @@
1348
1380
  return {};
1349
1381
  },
1350
1382
  store() {
1351
- const storage = {};
1352
- return {
1353
- reset() {
1354
- Object.keys(storage).forEach(key => delete storage[key]);
1355
- },
1356
- setItem(key, val) {
1357
- if (config.debug) {
1358
- console.log(`[JITSU EMPTY RUNTIME] Set storage item ${key}=${JSON.stringify(val)}`);
1359
- }
1360
- if (typeof val === "undefined") {
1361
- delete storage[key];
1362
- }
1363
- else {
1364
- storage[key] = val;
1365
- }
1366
- },
1367
- getItem(key) {
1368
- const val = storage[key];
1369
- if (config.debug) {
1370
- console.log(`[JITSU EMPTY RUNTIME] Get storage item ${key}=${JSON.stringify(val)}`);
1371
- }
1372
- return val;
1373
- },
1374
- removeItem(key) {
1375
- if (config.debug) {
1376
- console.log(`[JITSU EMPTY RUNTIME] Get storage item ${key}=${storage[key]}`);
1377
- }
1378
- delete storage[key];
1379
- },
1380
- };
1383
+ return createInMemoryStorage(config.debug);
1381
1384
  },
1382
1385
  language() {
1383
1386
  return undefined;
@@ -1463,6 +1466,7 @@
1463
1466
  userAgent: runtime.userAgent(),
1464
1467
  locale: runtime.language(),
1465
1468
  screen: runtime.screen(),
1469
+ ip: runtime === null || runtime === void 0 ? void 0 : runtime.ip(),
1466
1470
  traits: payload.type != "identify" && payload.type != "group" ? Object.assign({}, (restoreTraits(storage) || {})) : undefined,
1467
1471
  page: {
1468
1472
  path: properties.path || (parsedUrl && parsedUrl.pathname),
@@ -1942,7 +1946,7 @@
1942
1946
  persistentStorage.removeItem(key);
1943
1947
  },
1944
1948
  });
1945
- const storage = cachingStorageWrapper(rt.store());
1949
+ const storage = cachingStorageWrapper((rt === null || rt === void 0 ? void 0 : rt.store()) || createInMemoryStorage(opts.debug));
1946
1950
  const analytics = analyticsLib({
1947
1951
  debug: !!opts.debug,
1948
1952
  storage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jitsu/js",
3
- "version": "1.9.18-canary.1288.20250415193648",
3
+ "version": "1.9.18-canary.1288.20250415195029",
4
4
  "description": "",
5
5
  "author": "Jitsu Dev Team <dev@jitsu.com>",
6
6
  "main": "dist/jitsu.cjs.js",
@@ -38,10 +38,10 @@
38
38
  "rollup": "^3.29.5",
39
39
  "ts-jest": "29.0.5",
40
40
  "typescript": "^5.6.3",
41
- "jsondiffpatch": "1.9.18-canary.1288.20250415193648"
41
+ "jsondiffpatch": "1.9.18-canary.1288.20250415195029"
42
42
  },
43
43
  "peerDependencies": {
44
- "@jitsu/protocols": "1.9.18-canary.1288.20250415193648"
44
+ "@jitsu/protocols": "1.9.18-canary.1288.20250415195029"
45
45
  },
46
46
  "dependencies": {
47
47
  "analytics": "0.8.9"