@microsoft/applicationinsights-react-js 4.0.0-nightly.2307-08 → 17.0.1-nightly.2307-09

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,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - React Plugin, 4.0.0-nightly.2307-08
2
+ * Application Insights JavaScript SDK - React Plugin, 17.0.1-nightly.2307-09
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -52,6 +52,7 @@
52
52
  var SYMBOL = "Symbol";
53
53
  var POLYFILL_TAG = "_polyfill";
54
54
  var INDEX_OF = "indexOf";
55
+ var LAST_INDEX_OF = "lastIndexOf";
55
56
  var LENGTH = "length";
56
57
  var DONE = "done";
57
58
  var VALUE = "value";
@@ -61,6 +62,7 @@
61
62
  var ObjProto = ObjClass[PROTOTYPE];
62
63
  var StrCls = String;
63
64
  var StrProto = StrCls[PROTOTYPE];
65
+ var MathCls = Math;
64
66
  var ArrCls = Array;
65
67
  var ArrProto = ArrCls[PROTOTYPE];
66
68
 
@@ -253,18 +255,59 @@
253
255
  return objToString(object) + ": " + propertyValueDump;
254
256
  }
255
257
 
256
- function _unwrapFunction(funcName, target, polyFunc) {
258
+ var _arrSlice = ArrProto[SLICE];
259
+ var _throwMissingFunction = function (funcName, thisArg) {
260
+ throwTypeError("'" + asString(funcName) + "' not defined for " + dumpObj(thisArg));
261
+ };
262
+ var _unwrapInstFunction = function (funcName) {
263
+ return function (thisArg) {
264
+ return thisArg[funcName].apply(thisArg, _arrSlice.call(arguments, 1));
265
+ };
266
+ };
267
+ var _unwrapFunction = function (funcName, clsProto) {
268
+ var clsFn = clsProto && clsProto[funcName];
269
+ return function (thisArg) {
270
+ var theFunc = (thisArg && thisArg[funcName]) || clsFn;
271
+ if (theFunc) {
272
+ return theFunc.apply(thisArg, _arrSlice.call(arguments, 1));
273
+ }
274
+ _throwMissingFunction(funcName, thisArg);
275
+ };
276
+ };
277
+ var _unwrapFunctionWithPoly = function (funcName, clsProto, polyFunc) {
278
+ var clsFn = clsProto && clsProto[funcName];
257
279
  return function (thisArg) {
258
- var theFunc = (thisArg && thisArg[funcName]) || (target && target[funcName]);
280
+ var theFunc = (thisArg && thisArg[funcName]) || clsFn;
259
281
  if (theFunc || polyFunc) {
260
282
  var theArgs = arguments;
261
- return (theFunc || polyFunc).apply(thisArg, theFunc ? ArrProto[SLICE].call(theArgs, 1) : theArgs);
283
+ return (theFunc || polyFunc).apply(thisArg, theFunc ? _arrSlice.call(theArgs, 1) : theArgs);
262
284
  }
263
- throwTypeError("'" + asString(funcName) + "' not defined for " + dumpObj(thisArg));
285
+ _throwMissingFunction(funcName, thisArg);
264
286
  };
265
- }
287
+ };
288
+
289
+ var mathMax = MathCls.max;
290
+
291
+ var strSlice = _unwrapFunction(SLICE, StrProto);
266
292
 
267
293
  var strSubstring = _unwrapFunction("substring", StrProto);
294
+ _unwrapFunctionWithPoly("substr", StrProto, polyStrSubstr);
295
+ function polyStrSubstr(value, start, length) {
296
+ if (isNullOrUndefined(value)) {
297
+ throwTypeError("'polyStrSubstr called with invalid " + dumpObj(value));
298
+ }
299
+ if (length < 0) {
300
+ return EMPTY;
301
+ }
302
+ start = start || 0;
303
+ if (start < 0) {
304
+ start = mathMax(start + value[LENGTH], 0);
305
+ }
306
+ if (isUndefined(length)) {
307
+ return strSlice(value, start);
308
+ }
309
+ return strSlice(value, start, start + length);
310
+ }
268
311
  function strLeft(value, count) {
269
312
  return strSubstring(value, 0, count);
270
313
  }
@@ -388,15 +431,13 @@
388
431
  var _cachedWindow;
389
432
  var _cachedDocument;
390
433
  var _cachedNavigator;
391
- function lazySafeGetInst(name) {
392
- return safeGetLazy(function () { return getInst(name) || UNDEF_VALUE; }, UNDEF_VALUE);
393
- }
394
- function getGlobal(useCached) {
395
- (!_cachedGlobal || useCached === false || (_globalLazyTestHooks.lzy && !_cachedGlobal.b)) && (_cachedGlobal = safeGetLazy(_getGlobalValue, NULL_VALUE));
434
+ var lazySafeGetInst = function (name) { return safeGetLazy(function () { return getInst(name) || UNDEF_VALUE; }, UNDEF_VALUE); };
435
+ var getGlobal = function (useCached) {
436
+ (!_cachedGlobal || useCached === false || (_globalLazyTestHooks && _globalLazyTestHooks.lzy && !_cachedGlobal.b)) && (_cachedGlobal = safeGetLazy(_getGlobalValue, NULL_VALUE));
396
437
  return _cachedGlobal.v;
397
- }
398
- function getInst(name, useCached) {
399
- var gbl = getGlobal(useCached);
438
+ };
439
+ var getInst = function (name, useCached) {
440
+ var gbl = (!_cachedGlobal || useCached === false) ? getGlobal(useCached) : _cachedGlobal.v;
400
441
  if (gbl && gbl[name]) {
401
442
  return gbl[name];
402
443
  }
@@ -404,22 +445,20 @@
404
445
  return _cachedWindow.v;
405
446
  }
406
447
  return NULL_VALUE;
407
- }
408
- function getDocument() {
409
- (!_cachedDocument || (_globalLazyTestHooks.lzy && !_cachedDocument.b)) && (_cachedDocument = lazySafeGetInst("document"));
448
+ };
449
+ var getDocument = function () {
450
+ (!_cachedDocument || (_globalLazyTestHooks && _globalLazyTestHooks.lzy && !_cachedDocument.b)) && (_cachedDocument = lazySafeGetInst("document"));
410
451
  return _cachedDocument.v;
411
- }
412
- function hasWindow() {
413
- return !!getWindow();
414
- }
415
- function getWindow() {
416
- (!_cachedWindow || (_globalLazyTestHooks.lzy && !_cachedWindow.b)) && (_cachedWindow = lazySafeGetInst(WINDOW));
452
+ };
453
+ var hasWindow = function () { return !!getWindow(); };
454
+ var getWindow = function () {
455
+ (!_cachedWindow || (_globalLazyTestHooks && _globalLazyTestHooks.lzy && !_cachedWindow.b)) && (_cachedWindow = lazySafeGetInst(WINDOW));
417
456
  return _cachedWindow.v;
418
- }
419
- function getNavigator() {
420
- (!_cachedNavigator || (_globalLazyTestHooks.lzy && !_cachedNavigator.b)) && (_cachedNavigator = lazySafeGetInst("navigator"));
457
+ };
458
+ var getNavigator = function () {
459
+ (!_cachedNavigator || (_globalLazyTestHooks && _globalLazyTestHooks.lzy && !_cachedNavigator.b)) && (_cachedNavigator = lazySafeGetInst("navigator"));
421
460
  return _cachedNavigator.v;
422
- }
461
+ };
423
462
 
424
463
  var _symbol;
425
464
  var _symbolFor;
@@ -457,36 +496,54 @@
457
496
  return !isStrictNullOrUndefined(value) && isFunction(value[getKnownSymbol(3 )]);
458
497
  }
459
498
 
499
+ var _iterSymbol;
460
500
  function iterForOf(iter, callbackfn, thisArg) {
461
501
  if (iter) {
462
502
  if (!isIterator(iter)) {
463
- var itSymbol = getKnownSymbol(3 );
464
- iter = iter[itSymbol] ? iter[itSymbol]() : null;
503
+ !_iterSymbol && (_iterSymbol = getLazy(function () { return getKnownSymbol(3 ); }));
504
+ iter = iter[_iterSymbol.v] ? iter[_iterSymbol.v]() : null;
465
505
  }
466
506
  if (isIterator(iter)) {
507
+ var err = void 0;
508
+ var iterResult = void 0;
467
509
  try {
468
510
  var count = 0;
469
- var value = iter.next();
470
- while (!value[DONE]) {
471
- if (callbackfn.call(thisArg || iter, value[VALUE], count, iter) === -1) {
511
+ while (!(iterResult = iter.next())[DONE]) {
512
+ if (callbackfn.call(thisArg || iter, iterResult[VALUE], count, iter) === -1) {
472
513
  break;
473
514
  }
474
515
  count++;
475
- value = iter.next();
476
516
  }
477
- iter.return && iter.return(value);
478
517
  }
479
- catch (e) {
480
- iter.throw && iter.throw(e);
518
+ catch (failed) {
519
+ err = { e: failed };
520
+ if (iter.throw) {
521
+ iterResult = null;
522
+ iter.throw(err);
523
+ }
524
+ }
525
+ finally {
526
+ try {
527
+ if (iterResult && !iterResult[DONE]) {
528
+ iter.return && iter.return(iterResult);
529
+ }
530
+ }
531
+ finally {
532
+ if (err) {
533
+ throw err.e;
534
+ }
535
+ }
481
536
  }
482
537
  }
483
538
  }
484
539
  }
485
540
 
541
+ var fnApply = _unwrapInstFunction("apply");
542
+
486
543
  function arrAppend(target, elms) {
487
544
  if (!isUndefined(elms) && target) {
488
545
  if (isArray(elms)) {
489
- target.push.apply(target, elms);
546
+ fnApply(target.push, target, elms);
490
547
  }
491
548
  else if (isIterator(elms) || isIterable(elms)) {
492
549
  iterForOf(elms, function (elm) {
@@ -514,9 +571,12 @@
514
571
  }
515
572
 
516
573
  var arrIndexOf = _unwrapFunction(INDEX_OF, ArrProto);
574
+ _unwrapFunction(LAST_INDEX_OF, ArrProto);
517
575
 
518
576
  var arrSlice = _unwrapFunction(SLICE, ArrProto);
519
577
 
578
+ var fnCall = _unwrapInstFunction("call");
579
+
520
580
  var _objCreate = ObjClass["create"];
521
581
  var objCreate = _objCreate || polyObjCreate;
522
582
  function polyObjCreate(obj) {
@@ -577,7 +637,7 @@
577
637
  var _this = this;
578
638
  try {
579
639
  _safeSetName(theBaseClass, name);
580
- var _self = theBaseClass.apply(_this, arguments) || _this;
640
+ var _self = fnApply(theBaseClass, _this, arrSlice(arguments)) || _this;
581
641
  if (_self !== _this) {
582
642
  var orgProto = objGetPrototypeOf(_this);
583
643
  if (orgProto !== objGetPrototypeOf(_self)) {
@@ -613,8 +673,12 @@
613
673
  };
614
674
  }
615
675
  var polyStrTrim = _createTrimFn(/^\s+|(?=\s)\s+$/g);
676
+ var polyStrTrimStart = _createTrimFn(/^\s+/g);
677
+ var polyStrTrimEnd = _createTrimFn(/(?=\s)\s+$/g);
616
678
 
617
- var strTrim = _unwrapFunction("trim", StrProto, polyStrTrim);
679
+ var strTrim = _unwrapFunctionWithPoly("trim", StrProto, polyStrTrim);
680
+ _unwrapFunctionWithPoly("trimStart", StrProto, polyStrTrimStart);
681
+ _unwrapFunctionWithPoly("trimEnd", StrProto, polyStrTrimEnd);
618
682
 
619
683
  var _fnToString;
620
684
  var _objCtrFnString;
@@ -630,7 +694,7 @@
630
694
  if (value !== _gblWindow) {
631
695
  if (!_objCtrFnString) {
632
696
  _fnToString = Function[PROTOTYPE].toString;
633
- _objCtrFnString = _fnToString.call(ObjClass);
697
+ _objCtrFnString = fnCall(_fnToString, ObjClass);
634
698
  }
635
699
  try {
636
700
  var proto = objGetPrototypeOf(value);
@@ -648,7 +712,7 @@
648
712
  return result;
649
713
  }
650
714
 
651
- var strEndsWith = _unwrapFunction("endsWith", StrProto, polyStrEndsWith);
715
+ var strEndsWith = _unwrapFunctionWithPoly("endsWith", StrProto, polyStrEndsWith);
652
716
  function polyStrEndsWith(value, searchString, length) {
653
717
  if (!isString(value)) {
654
718
  throwTypeError("'" + dumpObj(value) + "' is not a string");
@@ -661,6 +725,7 @@
661
725
  }
662
726
 
663
727
  var strIndexOf = _unwrapFunction(INDEX_OF, StrProto);
728
+ _unwrapFunction(LAST_INDEX_OF, StrProto);
664
729
 
665
730
  var REF = "ref";
666
731
  var UNREF = "un" + REF;
@@ -731,7 +796,7 @@
731
796
  var timerFn = theArgs[0];
732
797
  theArgs[0] = function () {
733
798
  handler.dn();
734
- timerFn.apply(self, arguments);
799
+ fnApply(timerFn, self, arrSlice(arguments));
735
800
  };
736
801
  var handler = _createTimerHandler(startTimer, function (timerId) {
737
802
  if (timerId) {
@@ -739,11 +804,11 @@
739
804
  timerId.refresh();
740
805
  return timerId;
741
806
  }
742
- clearFn.call(self, timerId);
807
+ fnApply(clearFn, self, [timerId]);
743
808
  }
744
- return setFn.apply(self, theArgs);
809
+ return fnApply(setFn, self, theArgs);
745
810
  }, function (timerId) {
746
- clearFn.call(self, timerId);
811
+ fnApply(clearFn, self, [timerId]);
747
812
  });
748
813
  return handler.h;
749
814
  }