kv-test-lib 1.0.0 → 1.0.22

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/dist/kochava.d.ts CHANGED
@@ -30,7 +30,12 @@ export interface KochavaInstance {
30
30
  export declare class Kochava {
31
31
  private instance;
32
32
  private jobQueue;
33
- constructor();
33
+ private constructor();
34
+ static create(): Kochava;
35
+ static createWithNode(): Kochava;
36
+ static createWithReact(): Kochava;
37
+ static createWithVue(): Kochava;
38
+ static createWithAngular(): Kochava;
34
39
  useCookies(condition?: boolean): void;
35
40
  disableAutoPage(condition?: boolean): void;
36
41
  startWithAppGuid(appGuid: string): void;
package/dist/kochava.js CHANGED
@@ -16,6 +16,29 @@ export class Kochava {
16
16
  this.resetInstance();
17
17
  this.jobQueue = new JobQueue();
18
18
  }
19
+ static create() {
20
+ return new Kochava();
21
+ }
22
+ static createWithNode() {
23
+ const kochava = new Kochava();
24
+ kochava.executeAdvancedInstruction("wrapper", JSON.stringify({ name: "Node", version: "3.0.0" }));
25
+ return kochava;
26
+ }
27
+ static createWithReact() {
28
+ const kochava = new Kochava();
29
+ kochava.executeAdvancedInstruction("wrapper", JSON.stringify({ name: "React", version: "3.0.0" }));
30
+ return kochava;
31
+ }
32
+ static createWithVue() {
33
+ const kochava = new Kochava();
34
+ kochava.executeAdvancedInstruction("wrapper", JSON.stringify({ name: "Vue", version: "3.0.0" }));
35
+ return kochava;
36
+ }
37
+ static createWithAngular() {
38
+ const kochava = new Kochava();
39
+ kochava.executeAdvancedInstruction("wrapper", JSON.stringify({ name: "Angular", version: "3.0.0" }));
40
+ return kochava;
41
+ }
19
42
  /*
20
43
  Set if the SDK should also store persisted values in cookie storage.
21
44
  - Not all values can be persisted in cookies, such as event/idlink queues
@@ -118,7 +141,16 @@ export class Kochava {
118
141
  case "wrapper":
119
142
  {
120
143
  const wrapperVersion = JSON.parse(valueStr);
121
- this.instance.version = `${this.instance.version} (${wrapperVersion.name} ${wrapperVersion.version})`;
144
+ if (!this.instance.version)
145
+ this.instance.version = "WebTracker 3.0.0";
146
+ switch (wrapperVersion.name) {
147
+ case "Angular":
148
+ this.instance.version += ` (${wrapperVersion.name} ${wrapperVersion.version})`;
149
+ break;
150
+ default:
151
+ this.instance.version += ` (${wrapperVersion.name})`;
152
+ break;
153
+ }
122
154
  }
123
155
  break;
124
156
  case "urls":
@@ -290,7 +322,7 @@ export class Kochava {
290
322
  disableAutoPage: false,
291
323
  useCookies: false,
292
324
  sleep: false,
293
- version: "Web 3.0.0",
325
+ version: "",
294
326
  buildDate: "",
295
327
  overrideUrls: {
296
328
  init: "",
@@ -315,8 +347,8 @@ export class Kochava {
315
347
  this.instance.appGuid = appGuid;
316
348
  this.instance.disableAutoPage = this.instance.disableAutoPage || false;
317
349
  this.instance.useCookies = this.instance.useCookies || false;
318
- this.instance.version = "Web 3.0.0";
319
- this.instance.buildDate = "kbd: 3/29/2022, 9:27:29 AM";
350
+ this.instance.version = this.instance.version || "WebTracker 3.0.0";
351
+ this.instance.buildDate = "kbd: 3/31/2022, 10:12:19 AM";
320
352
  this.instance.kochavaSession = utils.uuidv4().substring(0, 5);
321
353
  this.instance.startTimeMS = utils.getCurrTimeMS();
322
354
  this.instance.retryWaterfall = [7, 30, 300, 1800];
@@ -433,4 +465,4 @@ export class Kochava {
433
465
  updatePersistedValue(PersistKey.IdLinkQueue, JSON.stringify(this.jobQueue.idLinkQueue), false);
434
466
  }
435
467
  }
436
- window.kochava = new Kochava();
468
+ // window.kochava = new Kochava();
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "kv-test-lib",
4
- "version": "1.0.0",
4
+ "version": "1.0.22",
5
+ "main": "dist/kochava.js",
6
+ "files": [
7
+ "dist/"
8
+ ],
5
9
  "description": "",
6
10
  "scripts": {
7
11
  "build": "tsc -p ../../src/tsconfig.node.json",
package/webpack.config.js DELETED
@@ -1,64 +0,0 @@
1
- // Generated using webpack-cli https://github.com/webpack/webpack-cli
2
-
3
- const path = require('path');
4
- // import * as path from 'path';
5
-
6
- const isProduction = process.env.NODE_ENV == 'production';
7
-
8
- const kochavaConfig = {
9
- entry: '../../src/kochava.ts',
10
- plugins: [
11
- // Add your plugins here
12
- // Learn more about plugins from https://webpack.js.org/configuration/plugins/
13
- ],
14
- output: {
15
- filename: 'kochava.js',
16
- path: path.resolve(__dirname, 'dist'),
17
- clean: true,
18
- },
19
- target: 'web',
20
- module: {
21
- rules: [
22
- {
23
- test: /\.(ts|tsx)$/i,
24
- loader: 'ts-loader',
25
- exclude: ['/node_modules/'],
26
- options: {
27
- configFile: "tsconfig.node.json"
28
- }
29
- },
30
- {
31
- test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
32
- type: 'asset',
33
- },
34
-
35
- // Add your rules for custom modules here
36
- // Learn more about loaders from https://webpack.js.org/loaders/
37
- ],
38
- },
39
- resolve: {
40
- extensions: ['.ts', '.js'],
41
- },
42
- mode: (isProduction) ? 'production' : 'development',
43
- devtool: 'source-map',
44
- };
45
-
46
-
47
- module.exports = [
48
- kochavaConfig,
49
- ];
50
- module.exports.parallelism = 2;
51
-
52
-
53
-
54
-
55
-
56
- // module.exports = () => {
57
- // if (isProduction) {
58
- // config.mode = 'production';
59
- // } else {
60
- // config.mode = 'development';
61
- // }
62
- // return config;
63
- // };
64
-