kv-test-lib 3.5.2-rc.2 → 3.5.2-rc.3

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.
Files changed (39) hide show
  1. package/es5_dist/adapters/browser.js +7 -11
  2. package/es5_dist/adapters/browser.js.map +1 -1
  3. package/es5_dist/browser/browser.js +0 -4
  4. package/es5_dist/browser/browser.js.map +1 -1
  5. package/es5_dist/browser/cookies.js +0 -4
  6. package/es5_dist/browser/cookies.js.map +1 -1
  7. package/es5_dist/browser/persist.js +79 -96
  8. package/es5_dist/browser/persist.js.map +1 -1
  9. package/es5_dist/generated/buildInfo.js +1 -1
  10. package/es5_dist/generated/buildInfo.js.map +1 -1
  11. package/es5_dist/http.js +5 -9
  12. package/es5_dist/http.js.map +1 -1
  13. package/es5_dist/interfaces.js +0 -7
  14. package/es5_dist/interfaces.js.map +1 -1
  15. package/es5_dist/jobqueue.js +92 -112
  16. package/es5_dist/jobqueue.js.map +1 -1
  17. package/es5_dist/kochava.js +134 -366
  18. package/es5_dist/kochava.js.map +1 -1
  19. package/es5_dist/measurementEvent.js +1 -3
  20. package/es5_dist/measurementEvent.js.map +1 -1
  21. package/es5_dist/payloads/event.js +3 -7
  22. package/es5_dist/payloads/event.js.map +1 -1
  23. package/es5_dist/payloads/identityLink.js +3 -7
  24. package/es5_dist/payloads/identityLink.js.map +1 -1
  25. package/es5_dist/payloads/install.js +28 -46
  26. package/es5_dist/payloads/install.js.map +1 -1
  27. package/es5_dist/payloads/kvinit.js +25 -38
  28. package/es5_dist/payloads/kvinit.js.map +1 -1
  29. package/es5_dist/payloads/payload.js +0 -9
  30. package/es5_dist/payloads/payload.js.map +1 -1
  31. package/es5_dist/payloads/update.js +3 -7
  32. package/es5_dist/payloads/update.js.map +1 -1
  33. package/es5_dist/product.js +1 -16
  34. package/es5_dist/product.js.map +1 -1
  35. package/es5_dist/utils/log.js +1 -5
  36. package/es5_dist/utils/log.js.map +1 -1
  37. package/es5_dist/utils/utils.js +0 -7
  38. package/es5_dist/utils/utils.js.map +1 -1
  39. package/package.json +1 -1
@@ -90,10 +90,6 @@ var __generator = this && this.__generator || function (thisArg, body) {
90
90
  if (op[0] & 5) throw op[1];return { value: op[0] ? op[1] : void 0, done: true };
91
91
  }
92
92
  };
93
- /*
94
- Authored by Jacob Bechler on 06/09/25.
95
- Copyright (c) Kochava, Inc. All rights reserved.
96
- */
97
93
  import './polyfills/browser.js';
98
94
  import 'whatwg-fetch';
99
95
  import { Log } from "./utils/log";
@@ -111,20 +107,13 @@ import { getCookie } from "./browser/cookies";
111
107
  import adapter from './adapters/adapter.browser.js';
112
108
  import { Product } from "./product";
113
109
  configureStorage(adapter);
114
- var Kochava = /** @class */function () {
115
- // User will use the below factories instead of directly calling
116
- // the constructor
110
+ var Kochava = function () {
117
111
  function Kochava() {
118
112
  this.product = Product.measurement;
119
- // Readiness barrier for the persisted-identity restore. Resolves
120
- // immediately in synchronous-storage environments (browser) and when the
121
- // async restore completes otherwise (React Native). Assigned in
122
- // _resetInstance().
123
113
  this._stateRestored = Promise.resolve();
124
114
  this._resetInstance();
125
115
  this._jobQueue = new JobQueue();
126
116
  }
127
- // ============================= PUBLIC =============================== //
128
117
  Kochava.create = function () {
129
118
  return new Kochava();
130
119
  };
@@ -153,26 +142,12 @@ var Kochava = /** @class */function () {
153
142
  kochava.executeAdvancedInstruction("wrapper", JSON.stringify({ name: "Angular", version: "1.0.0" }));
154
143
  return kochava;
155
144
  };
156
- /*
157
- Set if the SDK should also store persisted values in cookie storage.
158
- - Not all values can be persisted in cookies, such as event/idlink queues
159
- due to size constraints.
160
- - true = yes use cookies
161
- - no = no don't use cookies
162
- - defaults to false
163
- */
164
145
  Kochava.prototype.useCookies = function (condition) {
165
146
  if (condition === void 0) {
166
147
  condition = false;
167
148
  }
168
149
  this._instance.useCookies = condition;
169
150
  };
170
- /*
171
- - Set whether the sdk shouldn't automatically send a page or should.
172
- - true = no auto page
173
- - false = yes auto page
174
- - defaults to false
175
- */
176
151
  Kochava.prototype.disableAutoPage = function (condition) {
177
152
  if (condition === void 0) {
178
153
  condition = false;
@@ -193,32 +168,7 @@ var Kochava = /** @class */function () {
193
168
  }
194
169
  return new KochavaMeasurementEvent(this, eventName);
195
170
  };
196
- /*
197
- The primary means for starting the sdk.
198
- Responsibilites:
199
- - Checks for migrations.
200
- - Creates the sdk instance.
201
- - Checks for persisted state.
202
- - Determines and sends kvinit.
203
- - Determines and sends install.
204
- - Optionally enqueues an auto_page.
205
- - Starts the job queue.
206
- */
207
- /**
208
- * Start the SDK.
209
- *
210
- * Returns a promise that resolves once startup reaches the "started"
211
- * milestone — install identity resolved, session/appGuid established, and
212
- * kvinit/install kicked off. It intentionally does NOT wait for
213
- * kvinit/install to complete: those retry indefinitely on network failure,
214
- * and awaiting them would hang the caller with no connectivity. Existing
215
- * void-context callers are unaffected by the added return value.
216
- */
217
171
  Kochava.prototype.startWithAppGuid = function (appGuid) {
218
- // shutdown() swaps in the fresh instance synchronously, so by the time this
219
- // runs (even on the line right after a shutdown), this._instance is already
220
- // the new instance — no serialization needed. _startWithAppGuid captures it
221
- // up front and operates only on that captured reference.
222
172
  return this._startWithAppGuid(appGuid);
223
173
  };
224
174
  Kochava.prototype._startWithAppGuid = function (appGuid) {
@@ -227,136 +177,95 @@ var Kochava = /** @class */function () {
227
177
  return __generator(this, function (_c) {
228
178
  switch (_c.label) {
229
179
  case 0:
230
- // VALIDATE ELSE RETURN
231
180
  if (!appGuid) {
232
181
  Log.error("Invalid appGuid ".concat(appGuid, ", start failed."));
233
- return [2 /*return*/];
182
+ return [2];
234
183
  }
235
184
  instance = this._instance;
236
185
  stateRestored = this._stateRestored;
237
186
  if (instance.started) {
238
187
  Log.warn("Kochava SDK already started.");
239
- return [2 /*return*/];
188
+ return [2];
240
189
  }
241
- // Kick the install-identity resolution before control returns to the
242
- // caller when restore has already completed (synchronous storage): the
243
- // resolution's synchronous prefix populates kochavaDeviceId in place, so
244
- // getDeviceId() on the caller's very next line is already correct once
245
- // started flips true below.
246
190
  if (instance.stateRestoredBool) {
247
191
  this._ensureIdentityResolved(instance).catch(function () {});
248
192
  }
249
- // Gen4 gate: started flips true synchronously within this call — the
250
- // long-standing contract getDeviceId() is gated on — so the identity
251
- // resolved by the kick above is readable on the caller's very next line.
252
- // (On asynchronous-storage platforms the id resolves during the awaits
253
- // below, matching the current production behavior there.)
254
193
  instance.started = true;
255
194
  _c.label = 1;
256
195
  case 1:
257
196
  _c.trys.push([1, 3,, 4]);
258
- return [4 /*yield*/, stateRestored];
197
+ return [4, stateRestored];
259
198
  case 2:
260
199
  _c.sent();
261
- return [3 /*break*/, 4];
200
+ return [3, 4];
262
201
  case 3:
263
202
  _a = _c.sent();
264
- return [3 /*break*/, 4];
203
+ return [3, 4];
265
204
  case 4:
266
205
  if (instance.invalidatedBool) {
267
- return [2 /*return*/];
206
+ return [2];
268
207
  }
269
208
  _c.label = 5;
270
209
  case 5:
271
210
  _c.trys.push([5, 7,, 8]);
272
- return [4 /*yield*/, this._ensureIdentityResolved(instance)];
211
+ return [4, this._ensureIdentityResolved(instance)];
273
212
  case 6:
274
213
  _c.sent();
275
- return [3 /*break*/, 8];
214
+ return [3, 8];
276
215
  case 7:
277
216
  _b = _c.sent();
278
- return [3 /*break*/, 8];
217
+ return [3, 8];
279
218
  case 8:
280
219
  if (instance.invalidatedBool) {
281
- return [2 /*return*/];
220
+ return [2];
282
221
  }
283
- // MAIN
284
222
  Log.diagDebug("Host called API: Start With App Guid ".concat(appGuid));
285
- return [4 /*yield*/, this._checkFirstLaunchAndMigrate(instance)];
223
+ return [4, this._checkFirstLaunchAndMigrate(instance)];
286
224
  case 9:
287
225
  _c.sent();
288
226
  if (instance.invalidatedBool) {
289
- return [2 /*return*/];
227
+ return [2];
290
228
  }
291
229
  this._initInstance(instance, appGuid);
292
230
  if (!instance.disableAutoPage) this.sendPageEvent();
293
- return [4 /*yield*/, this._checkPersistedState(instance)];
231
+ return [4, this._checkPersistedState(instance)];
294
232
  case 10:
295
233
  _c.sent();
296
234
  if (instance.invalidatedBool) {
297
- return [2 /*return*/];
235
+ return [2];
298
236
  }
299
- return [4 /*yield*/, this._checkPersistedKvinit(instance)];
237
+ return [4, this._checkPersistedKvinit(instance)];
300
238
  case 11:
301
239
  _c.sent();
302
240
  if (instance.invalidatedBool) {
303
- return [2 /*return*/];
241
+ return [2];
304
242
  }
305
243
  this._printStartupMsgs(instance, appGuid);
306
- // Kick off the network-dependent startup (kvinit, install, queue) WITHOUT
307
- // awaiting it. Network completion must not gate this returned promise —
308
- // retries are indefinite, so awaiting would hang a caller with no
309
- // connectivity.
310
244
  this._beginStart(instance).catch(function (e) {
311
245
  return Log.error("Error during startup", e);
312
246
  });
313
- return [2 /*return*/];
247
+ return [2];
314
248
  }
315
249
  });
316
250
  });
317
251
  };
318
- /*
319
- Primary means for stopping the sdk.
320
- Will optionally delete all persisted data, and will shutdown the
321
- sdk and job queue.
322
- */
323
252
  Kochava.prototype.shutdown = function (deleteData) {
324
253
  Log.diagDebug("Host called API: Shutdown and ".concat(deleteData ? "delete data" : "keep data"));
325
- // Capture the instance being torn down. In-flight startup continuations
326
- // hold this same reference and bail on its invalidatedBool, so swapping
327
- // this._instance out from under them below can never strand them on the
328
- // fresh instance.
329
254
  var invalidatedInstance = this._instance;
330
255
  if (!invalidatedInstance.started) {
331
256
  Log.warn("SDK already shutdown.");
332
257
  }
333
258
  Log.info("SDK shutting down.");
334
- // 1. Invalidate synchronously — every in-flight continuation checks this at
335
- // its next await boundary and exits early (after fulfilling anything it
336
- // owns), so no further side effects occur on this instance.
337
259
  invalidatedInstance.invalidatedBool = true;
338
- // 2. Resume/stop long-running work so it observes invalidation promptly
339
- // rather than sitting in a retry sleep. cancelRetries()/stop() resolve
340
- // the pending wait (they no longer merely clear the timer), so the loop
341
- // wakes, sees invalidatedBool, and returns.
342
260
  Kvinit.cancelRetries();
343
261
  Install.cancelRetries();
344
262
  this._jobQueue.stop();
345
263
  this._jobQueue = new JobQueue();
346
- // 3. Swap in a fresh instance synchronously so a start issued on the very
347
- // next line (even without awaiting this shutdown) runs on the new
348
- // instance. When deleting data on asynchronous storage, gate the fresh
349
- // instance's restore on the clear so it never reads storage mid-wipe.
350
- // On synchronous storage no gate is needed: an adapter exposing the sync
351
- // fast-path is synchronous under the hood, so the wipe has already landed
352
- // by the time deleteAllPersisted() returns.
353
264
  if (deleteData) {
354
265
  Log.debug("Deleting persisted values");
355
266
  }
356
267
  var clearPromise = deleteData ? deleteAllPersisted() : Promise.resolve();
357
268
  this._resetInstance(deleteData && !hasSyncStorage() ? clearPromise : undefined);
358
- // 4. Complete asynchronously: after the clear (if any) and a bounded drain
359
- // of the invalidated instance's in-flight work, resolve.
360
269
  return this._completeShutdown(clearPromise);
361
270
  };
362
271
  Kochava.prototype._completeShutdown = function (clearPromise) {
@@ -366,31 +275,23 @@ var Kochava = /** @class */function () {
366
275
  switch (_a.label) {
367
276
  case 0:
368
277
  _a.trys.push([0, 2,, 3]);
369
- return [4 /*yield*/, clearPromise];
278
+ return [4, clearPromise];
370
279
  case 1:
371
280
  _a.sent();
372
- return [3 /*break*/, 3];
281
+ return [3, 3];
373
282
  case 2:
374
283
  e_1 = _a.sent();
375
284
  Log.error("Error deleting persisted values during shutdown", e_1);
376
- return [3 /*break*/, 3];
285
+ return [3, 3];
377
286
  case 3:
378
- return [4 /*yield*/, this._drainInvalidated()];
287
+ return [4, this._drainInvalidated()];
379
288
  case 4:
380
289
  _a.sent();
381
- return [2 /*return*/];
290
+ return [2];
382
291
  }
383
292
  });
384
293
  });
385
294
  };
386
- // Bounded event-loop drain. After invalidation, yield a few macrotask turns
387
- // so in-flight work on the just-invalidated instance resumes (its retry waits
388
- // were resolved by cancelRetries()/stop()) and bails before we consider
389
- // shutdown complete. This is best-effort quiescence for callers who await
390
- // shutdown, never a correctness dependency: a request already in flight
391
- // (bounded by the 20s request timeout) can outlive this window, and the
392
- // invalidation checks preceding each side effect are what keep any straggler
393
- // harmless. A fixed hop count means it can never hang.
394
295
  Kochava.prototype._drainInvalidated = function () {
395
296
  return __awaiter(this, void 0, void 0, function () {
396
297
  var DRAIN_HOPS, i;
@@ -401,8 +302,8 @@ var Kochava = /** @class */function () {
401
302
  i = 0;
402
303
  _a.label = 1;
403
304
  case 1:
404
- if (!(i < DRAIN_HOPS)) return [3 /*break*/, 4];
405
- return [4 /*yield*/, new Promise(function (resolve) {
305
+ if (!(i < DRAIN_HOPS)) return [3, 4];
306
+ return [4, new Promise(function (resolve) {
406
307
  return setTimeout(resolve, 0);
407
308
  })];
408
309
  case 2:
@@ -410,34 +311,17 @@ var Kochava = /** @class */function () {
410
311
  _a.label = 3;
411
312
  case 3:
412
313
  i++;
413
- return [3 /*break*/, 1];
314
+ return [3, 1];
414
315
  case 4:
415
- return [2 /*return*/];
316
+ return [2];
416
317
  }
417
318
  });
418
319
  });
419
320
  };
420
- /*
421
- Changes the current logLevel.
422
- Options include:
423
- - Off :: No logging whatsoever
424
- - Error :: Only critical errors
425
- - Warn :: Only critical errors and non-critical warnings
426
- - Info :: High-level sdk behavior logs (default)
427
- - Debug :: More in-depth sdk behavior logs and payload logs
428
- - Trace :: Everything, granular detail
429
- */
430
321
  Kochava.prototype.setLogLevel = function (logLevel) {
431
322
  Log.diagDebug("Host called API: Set Log Level ".concat(logLevel));
432
323
  Log.setLogLevel(logLevel);
433
324
  };
434
- /*
435
- Used internally, for special SDK behavior not utilized by a client.
436
- Examples include:
437
- - urls :: purposefully changing an endpoint for testing
438
- - wrapper :: overwriting the version of a wrapper
439
- several more ...
440
- */
441
325
  Kochava.prototype.executeAdvancedInstruction = function (key, valueStr, callback) {
442
326
  Log.diagDebug("Host called API: Execute Advanced Instruction ".concat(key));
443
327
  switch (key) {
@@ -493,10 +377,6 @@ var Kochava = /** @class */function () {
493
377
  break;
494
378
  }
495
379
  };
496
- /*
497
- Builds and enqueues a kochava event. Must include an event_name string,
498
- with optional event_data as either another string or object.
499
- */
500
380
  Kochava.prototype.sendEvent = function (name, data) {
501
381
  this._sendEvent(name, data);
502
382
  };
@@ -508,32 +388,19 @@ var Kochava = /** @class */function () {
508
388
  Log.diagDebug("Host called API: Send Event");
509
389
  if (!name) {
510
390
  Log.warn("Invalid event name, ignoring call.");
511
- return [2 /*return*/];
391
+ return [2];
512
392
  }
513
- return [4 /*yield*/, this._jobQueue.enqueueEvent(this._instance, [name, data])];
393
+ return [4, this._jobQueue.enqueueEvent(this._instance, [name, data])];
514
394
  case 1:
515
395
  _a.sent();
516
- return [2 /*return*/];
396
+ return [2];
517
397
  }
518
398
  });
519
399
  });
520
400
  };
521
- /*
522
- Wraps the sendEvent call with predefined data specific to page events.
523
- */
524
401
  Kochava.prototype.sendPageEvent = function (pageName, additionalData) {
525
402
  if (pageName) this.sendEvent("page", __assign({ page_name: pageName }, additionalData));else this.sendEvent("page", __assign({ page_name: getPageName() }, additionalData));
526
403
  };
527
- /**
528
- * Register an identity link with the SDK. Identity links are sent with the install
529
- * on first launch, or as standalone requests on subsequent launches. Duplicate
530
- * links (same name and identifier) are ignored. A maximum of 10 links may be
531
- * stored at any time.
532
- *
533
- * Note: passing an empty identifier currently ignores the call rather than clearing
534
- * the stored link — unlike registerCustomValue and registerCustomDeviceIdentifier,
535
- * which treat an empty value as a clear. Task 1214093961771892 tracks the fix.
536
- */
537
404
  Kochava.prototype.registerIdentityLink = function (name, identifier) {
538
405
  this._registerIdentityLink(name, identifier);
539
406
  };
@@ -546,35 +413,32 @@ var Kochava = /** @class */function () {
546
413
  Log.diagDebug("Host called API: Register Identity Link ".concat(name));
547
414
  if (!name || !identifier) {
548
415
  Log.warn("Invalid identity link, ignoring call.");
549
- return [2 /*return*/];
416
+ return [2];
550
417
  }
551
- return [4 /*yield*/, checkDuplicateIdLink(name, identifier)];
418
+ return [4, checkDuplicateIdLink(name, identifier)];
552
419
  case 1:
553
420
  if (_a.sent()) {
554
421
  Log.debug("Duplicate Identity Link found, ignoring.");
555
- return [2 /*return*/];
422
+ return [2];
556
423
  }
557
424
  idLink = {};
558
425
  idLink[name] = identifier;
559
- return [4 /*yield*/, addPersistedIdLinks(name, identifier, this._instance.useCookies)];
426
+ return [4, addPersistedIdLinks(name, identifier, this._instance.useCookies)];
560
427
  case 2:
561
428
  _a.sent();
562
- return [4 /*yield*/, getItem("com.kochava.tracker.InstallSentDate")];
429
+ return [4, getItem("com.kochava.tracker.InstallSentDate")];
563
430
  case 3:
564
- if (!_a.sent()) return [3 /*break*/, 5];
565
- // it will be sent standalone
566
- return [4 /*yield*/, this._jobQueue.enqueueIdLink(this._instance, idLink)];
431
+ if (!_a.sent()) return [3, 5];
432
+ return [4, this._jobQueue.enqueueIdLink(this._instance, idLink)];
567
433
  case 4:
568
- // it will be sent standalone
569
434
  _a.sent();
570
435
  _a.label = 5;
571
436
  case 5:
572
- return [2 /*return*/];
437
+ return [2];
573
438
  }
574
439
  });
575
440
  });
576
441
  };
577
- // Allows the client to attach arbitrary data to certain payloads.
578
442
  Kochava.prototype.registerCustomValue = function (name, value) {
579
443
  Log.diagDebug("Host called API: Register Custom Value ".concat(value ? 'setting' : 'clearing', " ").concat(name));
580
444
  if (!name) {
@@ -591,7 +455,6 @@ var Kochava = /** @class */function () {
591
455
  dataToAdorn[name] = value;
592
456
  this._instance.customValues.push({ data: dataToAdorn, isDeviceId: false });
593
457
  };
594
- // Allows the client to attach arbitrary identifiers to go out in the install.
595
458
  Kochava.prototype.registerCustomDeviceIdentifier = function (name, value) {
596
459
  this._registerCustomDeviceIdentifier(name, value);
597
460
  };
@@ -605,7 +468,7 @@ var Kochava = /** @class */function () {
605
468
  Log.diagDebug("Host called API: Register Custom Device Identifier ".concat(value ? 'setting' : 'clearing', " ").concat(name));
606
469
  if (!name) {
607
470
  Log.warn("Invalid custom device identifier, ignoring call.");
608
- return [2 /*return*/];
471
+ return [2];
609
472
  }
610
473
  if (!value) {
611
474
  this._instance.customValues = this._instance.customValues.filter(function (cv) {
@@ -616,47 +479,33 @@ var Kochava = /** @class */function () {
616
479
  dataToAdorn[name] = value;
617
480
  this._instance.customValues.push({ data: dataToAdorn, isDeviceId: true });
618
481
  }
619
- return [4 /*yield*/, getItem(PersistKey.InstallSentDate)];
482
+ return [4, getItem(PersistKey.InstallSentDate)];
620
483
  case 1:
621
- if (!_b.sent()) return [3 /*break*/, 4];
622
- return [4 /*yield*/, checkAndRecordDeviceIdChange(name, value)];
484
+ if (!_b.sent()) return [3, 4];
485
+ return [4, checkAndRecordDeviceIdChange(name, value)];
623
486
  case 2:
624
487
  changed = _b.sent();
625
488
  if (!changed) {
626
489
  Log.debug("Custom device identifier ".concat(name, " unchanged, no update needed."));
627
- return [2 /*return*/];
490
+ return [2];
628
491
  }
629
- return [4 /*yield*/, this._jobQueue.enqueueUpdate(this._instance, (_a = {}, _a[name] = value, _a))];
492
+ return [4, this._jobQueue.enqueueUpdate(this._instance, (_a = {}, _a[name] = value, _a))];
630
493
  case 3:
631
494
  _b.sent();
632
495
  _b.label = 4;
633
496
  case 4:
634
- return [2 /*return*/];
497
+ return [2];
635
498
  }
636
499
  });
637
500
  });
638
501
  };
639
- /*
640
- Returns whether or not the sdk is in a "started" state.
641
- This basically amounts to if start has been called,
642
- not if kvinit is done or the queue is started.
643
- Likewise, shutdown will set "started" to false;
644
- */
645
502
  Kochava.prototype.getStarted = function () {
646
503
  return this._instance.started;
647
504
  };
648
- /*
649
- Returns the current kochavaDeviceId, or "" if called too early.
650
- */
651
505
  Kochava.prototype.getDeviceId = function () {
652
506
  Log.diagDebug("Host called API: Get Kochava Device Id");
653
507
  if (this._instance.started) return this._instance.kochavaDeviceId;else return "";
654
508
  };
655
- /*
656
- Puts the sdk in a "sleep" state. This will stop the sdk from dequeuing
657
- new jobs and retrying failed jobs. Different than shutdown, because the
658
- current state is not destroyed.
659
- */
660
509
  Kochava.prototype.setSleep = function (sleep) {
661
510
  return this._setSleep(sleep);
662
511
  };
@@ -666,32 +515,23 @@ var Kochava = /** @class */function () {
666
515
  switch (_a.label) {
667
516
  case 0:
668
517
  Log.diagDebug("Host called API: Sleep ".concat(sleep ? "Stop" : "Start"));
669
- if (!(sleep && !this._instance.sleep)) return [3 /*break*/, 1];
670
- // only pause if it was running
518
+ if (!(sleep && !this._instance.sleep)) return [3, 1];
671
519
  this._instance.sleep = sleep;
672
520
  this._jobQueue.pause();
673
- return [3 /*break*/, 3];
521
+ return [3, 3];
674
522
  case 1:
675
- if (!(!sleep && this._instance.sleep)) return [3 /*break*/, 3];
676
- // only resume queueing if it was paused
523
+ if (!(!sleep && this._instance.sleep)) return [3, 3];
677
524
  this._instance.sleep = sleep;
678
- return [4 /*yield*/, this._beginStart(this._instance)];
525
+ return [4, this._beginStart(this._instance)];
679
526
  case 2:
680
527
  _a.sent();
681
528
  _a.label = 3;
682
529
  case 3:
683
- return [2 /*return*/];
530
+ return [2];
684
531
  }
685
532
  });
686
533
  });
687
534
  };
688
- // ============================= =============================== //
689
- // Unintialized/invalid state.
690
- // start must be called before these values will be correct.
691
- //
692
- // gate: when provided (shutdown with deleteData on asynchronous storage), the
693
- // fresh instance's restore is deferred until the gate resolves — so restore
694
- // never reads storage mid-wipe.
695
535
  Kochava.prototype._resetInstance = function (gate) {
696
536
  var _this = this;
697
537
  this._instance = {
@@ -728,118 +568,62 @@ var Kochava = /** @class */function () {
728
568
  kochavaInstallDate: -1,
729
569
  kochavaConfig: undefined
730
570
  };
731
- // Restore the persisted identity so the resolution waterfall can run on
732
- // demand. Synchronously when the storage adapter supports it (browser) —
733
- // a returning device's id is in memory before control returns; async
734
- // otherwise (React Native), with start waiting on _stateRestored. Restore
735
- // only reads: a device with no stored identity keeps "" until the identity
736
- // is resolved at start (_resolveInstallIdentity). Under the Gen4 started
737
- // gate nothing can observe pre-start state, so the remaining persisted
738
- // state loads at start (_checkPersistedState / _checkPersistedKvinit)
739
- // exactly as before. When gated (shutdown+delete on async storage),
740
- // restore runs only after the wipe settles — including a failed wipe, in
741
- // which case restoring whatever survived is the honest state; a rejected
742
- // gate must never leave the instance permanently unrestored.
743
571
  var instance = this._instance;
744
572
  this._stateRestored = gate ? gate.catch(function () {}).then(function () {
745
573
  return _this._restoreState(instance);
746
574
  }) : this._restoreState(instance);
747
575
  };
748
- // Generate a fresh Kochava device id (kvid).
749
576
  Kochava.prototype._generateDeviceId = function () {
750
577
  var kvId = "KB".concat(utils.getCurrTimeSec(), "T").concat(utils.uuidv4());
751
578
  return kvId.replace(/-/g, "");
752
579
  };
753
- // Choose the restore path based on the configured storage adapter's
754
- // capability. Sync when available (resolve immediately); async otherwise.
755
580
  Kochava.prototype._restoreState = function (instance) {
756
581
  if (hasSyncStorage()) {
757
582
  try {
758
583
  this._restoreSync(instance);
759
584
  return Promise.resolve();
760
- } catch (_a) {
761
- // Synchronous storage access threw (e.g. localStorage disabled) —
762
- // fall back to the async path rather than leaving state unrestored.
763
- }
585
+ } catch (_a) {}
764
586
  }
765
587
  return this._restoreAsync(instance);
766
588
  };
767
- // Synchronous identity restore through the adapter's sync fast-path.
768
- // Pure reads — a device with no stored identity keeps "" until the identity
769
- // is resolved on demand (_resolveInstallIdentity).
770
589
  Kochava.prototype._restoreSync = function (instance) {
771
590
  var _a, _b;
772
591
  this._applyRestoredIdentity(instance, (_a = getItemSync(PersistKey.DeviceId)) !== null && _a !== void 0 ? _a : "", (_b = getItemSync(PersistKey.OverrideDeviceId)) !== null && _b !== void 0 ? _b : "");
773
592
  };
774
- // Asynchronous identity restore through the abstracted StorageAdapter, which
775
- // routes to AsyncStorage on React Native. Pure reads, as above.
776
593
  Kochava.prototype._restoreAsync = function (instance) {
777
594
  return __awaiter(this, void 0, void 0, function () {
778
595
  var _a, deviceId, overrideDeviceId;
779
596
  return __generator(this, function (_b) {
780
597
  switch (_b.label) {
781
598
  case 0:
782
- if (instance.invalidatedBool) return [2 /*return*/];
783
- return [4 /*yield*/, Promise.all([getItem(PersistKey.DeviceId), getItem(PersistKey.OverrideDeviceId)])];
599
+ if (instance.invalidatedBool) return [2];
600
+ return [4, Promise.all([getItem(PersistKey.DeviceId), getItem(PersistKey.OverrideDeviceId)])];
784
601
  case 1:
785
602
  _a = _b.sent(), deviceId = _a[0], overrideDeviceId = _a[1];
786
- if (instance.invalidatedBool) return [2 /*return*/];
603
+ if (instance.invalidatedBool) return [2];
787
604
  this._applyRestoredIdentity(instance, deviceId !== null && deviceId !== void 0 ? deviceId : "", overrideDeviceId !== null && overrideDeviceId !== void 0 ? overrideDeviceId : "");
788
- return [2 /*return*/];
605
+ return [2];
789
606
  }
790
607
  });
791
608
  });
792
609
  };
793
- // Apply the restored identity to the instance. Both loaders funnel through
794
- // here so the two paths can never drift.
795
610
  Kochava.prototype._applyRestoredIdentity = function (instance, deviceId, overrideDeviceId) {
796
- // kochavaDeviceId: server override wins over the stored id.
797
611
  instance.kochavaDeviceId = overrideDeviceId || deviceId;
798
- // Restore complete — the identity may now be resolved on demand.
799
612
  instance.stateRestoredBool = true;
800
613
  };
801
- // Return this instance's install-identity resolution, creating it on first
802
- // demand. Memoized on the instance so it can never pair with the wrong
803
- // lifecycle generation across a shutdown swap.
804
614
  Kochava.prototype._ensureIdentityResolved = function (instance) {
805
615
  if (!instance.identityResolvedPromise) {
806
616
  instance.identityResolvedPromise = this._resolveInstallIdentity(instance);
807
617
  }
808
618
  return instance.identityResolvedPromise;
809
619
  };
810
- // Resolve the install identity for this instance. Precondition: the
811
- // persisted-identity restore has completed (callers gate on stateRestoredBool
812
- // or await _stateRestored first).
813
- //
814
- // The waterfall, in order — an id is generated only after every read source
815
- // is exhausted, so nothing provisional is ever created, persisted, or shown:
816
- // 1. Stored id (already in memory from restore).
817
- // 2. Shared cookie (useCookies integrations share one identity across
818
- // subdomains; a fresh subdomain's local storage starts empty while the
819
- // shared cookie already holds the real id — adopting it here is what
820
- // keeps a new subdomain from entrenching a new id and clobbering the
821
- // shared identity). An id read from local storage still wins over the
822
- // cookie, matching the long-standing storage-before-cookie precedence.
823
- // 3. Legacy v2 kv_id (URL parameter or storage), only on a first-ever v3
824
- // launch — the identity half of the v2->v3 migration; the bookkeeping
825
- // half stays in _checkFirstLaunchAndMigrate.
826
- // 4. Generate — the one and only generation point, logged as such.
827
- //
828
- // On synchronous-storage platforms every step through the in-memory
829
- // assignment executes synchronously, so a resolution kicked from the
830
- // synchronous start path makes getDeviceId() correct on the caller's very
831
- // next line. Cookie and legacy-URL sources are DOM-only and are gated on
832
- // the sync fast-path accordingly.
833
620
  Kochava.prototype._resolveInstallIdentity = function (instance) {
834
621
  return __awaiter(this, void 0, void 0, function () {
835
622
  var cookieDeviceId, oldKvId, deviceId, cookieOverrideDeviceId;
836
623
  return __generator(this, function (_a) {
837
624
  switch (_a.label) {
838
625
  case 0:
839
- // WATERFALL
840
- // 1. stored id
841
626
  if (!instance.kochavaDeviceId) {
842
- // 2. shared cookie
843
627
  if (instance.useCookies && hasSyncStorage()) {
844
628
  try {
845
629
  cookieDeviceId = getCookie(PersistKey.DeviceId);
@@ -847,11 +631,10 @@ var Kochava = /** @class */function () {
847
631
  instance.kochavaDeviceId = cookieDeviceId;
848
632
  setItemSync(PersistKey.DeviceId, cookieDeviceId);
849
633
  }
850
- } catch ( /* sync storage unavailable — fall through */_b) {/* sync storage unavailable — fall through */}
634
+ } catch (_b) {}
851
635
  }
852
636
  }
853
637
  if (!instance.kochavaDeviceId) {
854
- // 3. legacy v2 kv_id (first-ever v3 launch only; web-legacy sources)
855
638
  if (hasSyncStorage()) {
856
639
  try {
857
640
  if (!getItemSync(PersistKey.FirstStartDate)) {
@@ -861,23 +644,19 @@ var Kochava = /** @class */function () {
861
644
  setItemSync(PersistKey.DeviceId, oldKvId);
862
645
  }
863
646
  }
864
- } catch ( /* sync storage unavailable — fall through */_c) {/* sync storage unavailable — fall through */}
647
+ } catch (_c) {}
865
648
  }
866
649
  }
867
- if (!!instance.kochavaDeviceId) return [3 /*break*/, 2];
650
+ if (!!instance.kochavaDeviceId) return [3, 2];
868
651
  deviceId = this._generateDeviceId();
869
652
  Log.diagDebug("Generated new kochava device id ".concat(deviceId));
870
653
  instance.kochavaDeviceId = deviceId;
871
- return [4 /*yield*/, setItem(PersistKey.DeviceId, deviceId)];
654
+ return [4, setItem(PersistKey.DeviceId, deviceId)];
872
655
  case 1:
873
656
  _a.sent();
874
- if (instance.invalidatedBool) return [2 /*return*/];
657
+ if (instance.invalidatedBool) return [2];
875
658
  _a.label = 2;
876
659
  case 2:
877
- // overrideDeviceId
878
- // ⓘ Adopt the shared cookie override when none is stored locally, so a
879
- // subdomain that has not yet received the override from kvinit reports
880
- // consistently with the subdomain that has.
881
660
  if (instance.useCookies && hasSyncStorage()) {
882
661
  try {
883
662
  if (!getItemSync(PersistKey.OverrideDeviceId)) {
@@ -887,15 +666,14 @@ var Kochava = /** @class */function () {
887
666
  setItemSync(PersistKey.OverrideDeviceId, cookieOverrideDeviceId);
888
667
  }
889
668
  }
890
- } catch ( /* sync storage unavailable */_d) {/* sync storage unavailable */}
669
+ } catch (_d) {}
891
670
  }
892
- return [2 /*return*/];
671
+ return [2];
893
672
  }
894
673
  });
895
674
  });
896
675
  };
897
676
  Kochava.prototype._initInstance = function (instance, appGuid) {
898
- // init instance with defaults
899
677
  instance.appGuid = appGuid;
900
678
  instance.disableAutoPage = instance.disableAutoPage || false;
901
679
  instance.useCookies = instance.useCookies || false;
@@ -912,32 +690,27 @@ var Kochava = /** @class */function () {
912
690
  return __generator(this, function (_a) {
913
691
  switch (_a.label) {
914
692
  case 0:
915
- return [4 /*yield*/, readAndUpdatePersistedValue(PersistKey.FirstStartDate, instance.useCookies)];
693
+ return [4, readAndUpdatePersistedValue(PersistKey.FirstStartDate, instance.useCookies)];
916
694
  case 1:
917
695
  firstLaunchDate = _a.sent();
918
- if (instance.invalidatedBool) return [2 /*return*/];
919
- if (!!firstLaunchDate) return [3 /*break*/, 5];
920
- return [4 /*yield*/, updatePersistedValue(PersistKey.FirstStartDate, String(utils.getCurrTimeSec()), instance.useCookies)];
696
+ if (instance.invalidatedBool) return [2];
697
+ if (!!firstLaunchDate) return [3, 5];
698
+ return [4, updatePersistedValue(PersistKey.FirstStartDate, String(utils.getCurrTimeSec()), instance.useCookies)];
921
699
  case 2:
922
700
  _a.sent();
923
- if (instance.invalidatedBool) return [2 /*return*/];
924
- return [4 /*yield*/, readAndUpdatePersistedValue(PersistKey.OldKvid, instance.useCookies)];
701
+ if (instance.invalidatedBool) return [2];
702
+ return [4, readAndUpdatePersistedValue(PersistKey.OldKvid, instance.useCookies)];
925
703
  case 3:
926
704
  oldKvId = _a.sent();
927
- if (instance.invalidatedBool) return [2 /*return*/];
928
- if (!oldKvId) return [3 /*break*/, 5];
929
- // Identity adoption of the legacy id lives in the resolution waterfall
930
- // (_resolveInstallIdentity), which already ran and wins precedence
931
- // battles (an established cookie identity beats the legacy id). Here
932
- // migration only records that this device has v2 history, so the
933
- // install is not re-sent.
705
+ if (instance.invalidatedBool) return [2];
706
+ if (!oldKvId) return [3, 5];
934
707
  instance.installDone = true;
935
- return [4 /*yield*/, updatePersistedValue(PersistKey.InstallSentDate, JSON.stringify(utils.getCurrTimeSec()), instance.useCookies)];
708
+ return [4, updatePersistedValue(PersistKey.InstallSentDate, JSON.stringify(utils.getCurrTimeSec()), instance.useCookies)];
936
709
  case 4:
937
710
  _a.sent();
938
711
  _a.label = 5;
939
712
  case 5:
940
- return [2 /*return*/];
713
+ return [2];
941
714
  }
942
715
  });
943
716
  });
@@ -949,23 +722,22 @@ var Kochava = /** @class */function () {
949
722
  switch (_a.label) {
950
723
  case 0:
951
724
  persistedKvinit = {};
952
- return [4 /*yield*/, readAndUpdatePersistedValue(PersistKey.LastKvinit, instance.useCookies)];
725
+ return [4, readAndUpdatePersistedValue(PersistKey.LastKvinit, instance.useCookies)];
953
726
  case 1:
954
727
  persistedKvinitStr = _a.sent();
955
- if (instance.invalidatedBool) return [2 /*return*/];
956
- if (!persistedKvinitStr) return [3 /*break*/, 3];
728
+ if (instance.invalidatedBool) return [2];
729
+ if (!persistedKvinitStr) return [3, 3];
957
730
  persistedKvinit = JSON.parse(persistedKvinitStr);
958
- if (!persistedKvinit) return [3 /*break*/, 3];
959
- // if persisted kvinit, apply it
731
+ if (!persistedKvinit) return [3, 3];
960
732
  Log.trace("Found persisted kvinit.", persistedKvinit);
961
- return [4 /*yield*/, Kvinit.applyKvinitResp(instance, persistedKvinit)];
733
+ return [4, Kvinit.applyKvinitResp(instance, persistedKvinit)];
962
734
  case 2:
963
735
  _a.sent();
964
- if (instance.invalidatedBool) return [2 /*return*/];
736
+ if (instance.invalidatedBool) return [2];
965
737
  Log.trace("KochavaConfig after persistedKvinit:", JSON.parse(JSON.stringify(instance.kochavaConfig)));
966
738
  _a.label = 3;
967
739
  case 3:
968
- return [4 /*yield*/, readAndUpdatePersistedValue(PersistKey.KvinitSentDate, instance.useCookies)];
740
+ return [4, readAndUpdatePersistedValue(PersistKey.KvinitSentDate, instance.useCookies)];
969
741
  case 4:
970
742
  persistedKvinitDateStr = _a.sent();
971
743
  if (persistedKvinitDateStr) {
@@ -975,7 +747,7 @@ var Kochava = /** @class */function () {
975
747
  if (utils.getCurrTimeSec() - lastKvinitDate < refreshMin) instance.kvinitDone = true;
976
748
  }
977
749
  }
978
- return [2 /*return*/];
750
+ return [2];
979
751
  }
980
752
  });
981
753
  });
@@ -986,43 +758,43 @@ var Kochava = /** @class */function () {
986
758
  return __generator(this, function (_e) {
987
759
  switch (_e.label) {
988
760
  case 0:
989
- if (!instance.useCookies) return [3 /*break*/, 3];
990
- return [4 /*yield*/, getItem(PersistKey.DeviceId)];
761
+ if (!instance.useCookies) return [3, 3];
762
+ return [4, getItem(PersistKey.DeviceId)];
991
763
  case 1:
992
764
  rawDeviceId = _e.sent() || instance.kochavaDeviceId;
993
- if (instance.invalidatedBool) return [2 /*return*/];
994
- return [4 /*yield*/, updatePersistedValue(PersistKey.DeviceId, rawDeviceId, true)];
765
+ if (instance.invalidatedBool) return [2];
766
+ return [4, updatePersistedValue(PersistKey.DeviceId, rawDeviceId, true)];
995
767
  case 2:
996
768
  _e.sent();
997
- if (instance.invalidatedBool) return [2 /*return*/];
769
+ if (instance.invalidatedBool) return [2];
998
770
  _e.label = 3;
999
771
  case 3:
1000
772
  _a = instance;
1001
- return [4 /*yield*/, readAndUpdatePersistedValue(PersistKey.InstallSentDate, instance.useCookies)];
773
+ return [4, readAndUpdatePersistedValue(PersistKey.InstallSentDate, instance.useCookies)];
1002
774
  case 4:
1003
775
  _a.installDone = _e.sent().length > 0;
1004
- if (instance.invalidatedBool) return [2 /*return*/];
776
+ if (instance.invalidatedBool) return [2];
1005
777
  _b = instance;
1006
- return [4 /*yield*/, readAndUpdatePersistedValue(PersistKey.InstallId, instance.useCookies)];
778
+ return [4, readAndUpdatePersistedValue(PersistKey.InstallId, instance.useCookies)];
1007
779
  case 5:
1008
780
  _b.kochavaInstallId = _e.sent();
1009
- if (instance.invalidatedBool) return [2 /*return*/];
781
+ if (instance.invalidatedBool) return [2];
1010
782
  _c = instance;
1011
- return [4 /*yield*/, readAndUpdateSessionCount(instance.useCookies)];
783
+ return [4, readAndUpdateSessionCount(instance.useCookies)];
1012
784
  case 6:
1013
785
  _c.kochavaSessionCount = _e.sent();
1014
- if (instance.invalidatedBool) return [2 /*return*/];
786
+ if (instance.invalidatedBool) return [2];
1015
787
  _d = instance;
1016
- return [4 /*yield*/, readAndUpdateUTM(instance.appGuid, instance.useCookies)];
788
+ return [4, readAndUpdateUTM(instance.appGuid, instance.useCookies)];
1017
789
  case 7:
1018
790
  _d.utm = _e.sent();
1019
- if (instance.invalidatedBool) return [2 /*return*/];
1020
- return [4 /*yield*/, readAndUpdatePersistedValue(PersistKey.InstallCount, instance.useCookies)];
791
+ if (instance.invalidatedBool) return [2];
792
+ return [4, readAndUpdatePersistedValue(PersistKey.InstallCount, instance.useCookies)];
1021
793
  case 8:
1022
794
  installCountStr = _e.sent();
1023
795
  parsedInstallCount = parseInt(installCountStr, 10);
1024
796
  instance.installCount = isNaN(parsedInstallCount) ? 0 : parsedInstallCount;
1025
- return [2 /*return*/];
797
+ return [2];
1026
798
  }
1027
799
  });
1028
800
  });
@@ -1041,40 +813,39 @@ var Kochava = /** @class */function () {
1041
813
  return __generator(this, function (_a) {
1042
814
  switch (_a.label) {
1043
815
  case 0:
1044
- if (instance.invalidatedBool) return [2 /*return*/];
816
+ if (instance.invalidatedBool) return [2];
1045
817
  jobQueue = this._jobQueue;
1046
- if (!!instance.kvinitDone) return [3 /*break*/, 2];
818
+ if (!!instance.kvinitDone) return [3, 2];
1047
819
  Log.diagDebug("A new kvinit will be sent");
1048
- return [4 /*yield*/, this.performNewKvinit(instance)];
820
+ return [4, this.performNewKvinit(instance)];
1049
821
  case 1:
1050
822
  _a.sent();
1051
- return [3 /*break*/, 3];
823
+ return [3, 3];
1052
824
  case 2:
1053
825
  Log.diagDebug("A new kvinit will not be sent");
1054
826
  _a.label = 3;
1055
827
  case 3:
1056
- if (instance.invalidatedBool) return [2 /*return*/];
1057
- return [4 /*yield*/, this.checkResendId(instance)];
828
+ if (instance.invalidatedBool) return [2];
829
+ return [4, this.checkResendId(instance)];
1058
830
  case 4:
1059
- // if the install_id changed and thus a new install must go out
1060
831
  if (_a.sent()) instance.installDone = false;
1061
- if (instance.invalidatedBool) return [2 /*return*/];
832
+ if (instance.invalidatedBool) return [2];
1062
833
  Log.diagDebug("The install ".concat(instance.installDone ? "has already" : "has not yet", " been sent"));
1063
- if (instance.sleep) return [2 /*return*/];
1064
- if (!!instance.installDone) return [3 /*break*/, 6];
1065
- return [4 /*yield*/, this.performInstall(instance)];
834
+ if (instance.sleep) return [2];
835
+ if (!!instance.installDone) return [3, 6];
836
+ return [4, this.performInstall(instance)];
1066
837
  case 5:
1067
838
  _a.sent();
1068
839
  _a.label = 6;
1069
840
  case 6:
1070
- if (instance.invalidatedBool) return [2 /*return*/];
1071
- if (!(instance.kvinitDone && instance.installDone)) return [3 /*break*/, 8];
1072
- return [4 /*yield*/, jobQueue.start(instance)];
841
+ if (instance.invalidatedBool) return [2];
842
+ if (!(instance.kvinitDone && instance.installDone)) return [3, 8];
843
+ return [4, jobQueue.start(instance)];
1073
844
  case 7:
1074
845
  _a.sent();
1075
846
  _a.label = 8;
1076
847
  case 8:
1077
- return [2 /*return*/];
848
+ return [2];
1078
849
  }
1079
850
  });
1080
851
  });
@@ -1086,27 +857,27 @@ var Kochava = /** @class */function () {
1086
857
  switch (_b.label) {
1087
858
  case 0:
1088
859
  _a = instance;
1089
- return [4 /*yield*/, Kvinit.send(instance, instance.retryWaterfall)];
860
+ return [4, Kvinit.send(instance, instance.retryWaterfall)];
1090
861
  case 1:
1091
862
  _a.kvinitDone = _b.sent();
1092
- if (instance.invalidatedBool) return [2 /*return*/];
1093
- return [4 /*yield*/, updatePersistedValue(PersistKey.KvinitSentDate, String(utils.getCurrTimeSec()), instance.useCookies)];
863
+ if (instance.invalidatedBool) return [2];
864
+ return [4, updatePersistedValue(PersistKey.KvinitSentDate, String(utils.getCurrTimeSec()), instance.useCookies)];
1094
865
  case 2:
1095
866
  _b.sent();
1096
- if (instance.invalidatedBool) return [2 /*return*/];
867
+ if (instance.invalidatedBool) return [2];
1097
868
  newKvinit = {};
1098
- return [4 /*yield*/, readAndUpdatePersistedValue(PersistKey.LastKvinit, instance.useCookies)];
869
+ return [4, readAndUpdatePersistedValue(PersistKey.LastKvinit, instance.useCookies)];
1099
870
  case 3:
1100
871
  newKvinitStr = _b.sent();
1101
- if (instance.invalidatedBool) return [2 /*return*/];
872
+ if (instance.invalidatedBool) return [2];
1102
873
  if (newKvinitStr) {
1103
874
  newKvinit = JSON.parse(newKvinitStr);
1104
875
  }
1105
- return [4 /*yield*/, Kvinit.applyKvinitResp(instance, newKvinit)];
876
+ return [4, Kvinit.applyKvinitResp(instance, newKvinit)];
1106
877
  case 4:
1107
878
  _b.sent();
1108
879
  Log.trace("KochavaConfig after new Kvinit:", JSON.parse(JSON.stringify(instance.kochavaConfig)));
1109
- return [2 /*return*/];
880
+ return [2];
1110
881
  }
1111
882
  });
1112
883
  });
@@ -1121,13 +892,13 @@ var Kochava = /** @class */function () {
1121
892
  if (instance.kochavaConfig.install) {
1122
893
  resendId = instance.kochavaConfig.install.resend_id;
1123
894
  }
1124
- return [4 /*yield*/, checkInstallIdChange(resendId, instance.useCookies)];
895
+ return [4, checkInstallIdChange(resendId, instance.useCookies)];
1125
896
  case 1:
1126
897
  needsNewInstall = _a.sent();
1127
898
  if (needsNewInstall) {
1128
899
  Log.debug("resend_id ".concat(resendId, " found, forcing new install"));
1129
900
  }
1130
- return [2 /*return*/, needsNewInstall];
901
+ return [2, needsNewInstall];
1131
902
  }
1132
903
  });
1133
904
  });
@@ -1139,33 +910,31 @@ var Kochava = /** @class */function () {
1139
910
  switch (_b.label) {
1140
911
  case 0:
1141
912
  jobQueue = this._jobQueue;
1142
- return [4 /*yield*/, Install.build(instance)];
913
+ return [4, Install.build(instance)];
1143
914
  case 1:
1144
915
  request = _b.sent();
1145
916
  _a = instance;
1146
- return [4 /*yield*/, Install.send(instance, request)];
917
+ return [4, Install.send(instance, request)];
1147
918
  case 2:
1148
919
  _a.installDone = _b.sent();
1149
- if (!instance.installDone) return [2 /*return*/];
1150
- if (instance.invalidatedBool) return [2 /*return*/];
1151
- // If the install succeeded, remove all idLink that were passed to it
1152
- return [4 /*yield*/, Install.onSuccess(instance)];
920
+ if (!instance.installDone) return [2];
921
+ if (instance.invalidatedBool) return [2];
922
+ return [4, Install.onSuccess(instance)];
1153
923
  case 3:
1154
- // If the install succeeded, remove all idLink that were passed to it
1155
924
  _b.sent();
1156
- if (instance.invalidatedBool) return [2 /*return*/];
1157
- return [4 /*yield*/, jobQueue.persistIdLinkQueue()];
925
+ if (instance.invalidatedBool) return [2];
926
+ return [4, jobQueue.persistIdLinkQueue()];
1158
927
  case 4:
1159
928
  _b.sent();
1160
- if (instance.invalidatedBool) return [2 /*return*/];
1161
- return [4 /*yield*/, jobQueue.persistUpdateQueue()];
929
+ if (instance.invalidatedBool) return [2];
930
+ return [4, jobQueue.persistUpdateQueue()];
1162
931
  case 5:
1163
932
  _b.sent();
1164
- if (instance.invalidatedBool) return [2 /*return*/];
1165
- return [4 /*yield*/, this._persistSentCustomDeviceIds(instance)];
933
+ if (instance.invalidatedBool) return [2];
934
+ return [4, this._persistSentCustomDeviceIds(instance)];
1166
935
  case 6:
1167
936
  _b.sent();
1168
- return [2 /*return*/];
937
+ return [2];
1169
938
  }
1170
939
  });
1171
940
  });
@@ -1192,13 +961,13 @@ var Kochava = /** @class */function () {
1192
961
  }
1193
962
  if (keyAllowed) sentIds[key] = cv.data[key];
1194
963
  });
1195
- if (!(Object.keys(sentIds).length > 0)) return [3 /*break*/, 2];
1196
- return [4 /*yield*/, persistSentDeviceIds(sentIds)];
964
+ if (!(Object.keys(sentIds).length > 0)) return [3, 2];
965
+ return [4, persistSentDeviceIds(sentIds)];
1197
966
  case 1:
1198
967
  _c.sent();
1199
968
  _c.label = 2;
1200
969
  case 2:
1201
- return [2 /*return*/];
970
+ return [2];
1202
971
  }
1203
972
  });
1204
973
  });
@@ -1206,6 +975,5 @@ var Kochava = /** @class */function () {
1206
975
  return Kochava;
1207
976
  }();
1208
977
  export { Kochava };
1209
- // Only here for generic Web integration
1210
978
  window.kochava = Kochava.create();
1211
979
  //# sourceMappingURL=kochava.js.map