@microsoft/applicationinsights-analytics-js 2.8.0-beta.2203-06 → 2.8.0-beta.2203-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
- * Microsoft Application Insights JavaScript SDK - Web Analytics, 2.8.0-beta.2203-06
2
+ * Microsoft Application Insights JavaScript SDK - Web Analytics, 2.8.0-beta.2203-09
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Web Analytics, 2.8.0-beta.2203-06
2
+ * Application Insights JavaScript SDK - Web Analytics, 2.8.0-beta.2203-09
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -2025,6 +2025,8 @@
2025
2025
  var strEvents = "events";
2026
2026
  createUniqueNamespace("aiEvtPageHide");
2027
2027
  createUniqueNamespace("aiEvtPageShow");
2028
+ var rRemoveEmptyNs = /\.[\.]+/g;
2029
+ var rRemoveTrailingEmptyNs = /[\.]+$/;
2028
2030
  var _guid = 1;
2029
2031
  var elmNodeData = createElmNodeData("events");
2030
2032
  var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
@@ -2062,7 +2064,7 @@
2062
2064
  var parsedEvent = (eventNamespace.exec(eventName) || []);
2063
2065
  return {
2064
2066
  type: parsedEvent[1],
2065
- ns: ((parsedEvent[2] || "").split(".").sort()).join(".")
2067
+ ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
2066
2068
  };
2067
2069
  }
2068
2070
  function _getRegisteredEvents(target, evtName, addDefault) {
@@ -2135,6 +2137,7 @@
2135
2137
  else {
2136
2138
  newNamespaces = [theNamespace, namespaces];
2137
2139
  }
2140
+ newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
2138
2141
  }
2139
2142
  else {
2140
2143
  newNamespaces = theNamespace;
@@ -3592,11 +3595,9 @@
3592
3595
  if (core) {
3593
3596
  _logger = core.logger;
3594
3597
  }
3595
- function _flushChannels() {
3598
+ function _flushChannels(isAsync) {
3596
3599
  if (core) {
3597
- arrForEach(core.getTransmissionControls(), function (queues) {
3598
- arrForEach(queues, function (q) { q.flush(true); });
3599
- });
3600
+ core.flush(isAsync);
3600
3601
  }
3601
3602
  }
3602
3603
  function _addQueue(cb) {
@@ -3619,7 +3620,7 @@
3619
3620
  intervalHandle = null;
3620
3621
  }
3621
3622
  if (doFlush) {
3622
- _flushChannels();
3623
+ _flushChannels(true);
3623
3624
  }
3624
3625
  }), 100);
3625
3626
  }
@@ -3637,7 +3638,7 @@
3637
3638
  }
3638
3639
  if (!pageViewPerformanceManager.isPerformanceTimingSupported()) {
3639
3640
  appInsights.sendPageViewInternal(pageView, customProperties);
3640
- _flushChannels();
3641
+ _flushChannels(true);
3641
3642
  _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NavigationTimingNotSupported, "trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");
3642
3643
  return;
3643
3644
  }
@@ -3663,7 +3664,7 @@
3663
3664
  customProperties["duration"] = customDuration;
3664
3665
  }
3665
3666
  appInsights.sendPageViewInternal(pageView, customProperties);
3666
- _flushChannels();
3667
+ _flushChannels(true);
3667
3668
  pageViewSent = true;
3668
3669
  }
3669
3670
  var maxDurationLimit = 60000;
@@ -3709,6 +3710,17 @@
3709
3710
  return processed;
3710
3711
  });
3711
3712
  };
3713
+ _self.teardown = function (unloadCtx, unloadState) {
3714
+ if (intervalHandle) {
3715
+ clearInterval(intervalHandle);
3716
+ intervalHandle = null;
3717
+ var allItems = itemQueue.slice(0);
3718
+ itemQueue = [];
3719
+ arrForEach(allItems, function (item) {
3720
+ if (item()) ;
3721
+ });
3722
+ }
3723
+ };
3712
3724
  });
3713
3725
  }
3714
3726
  return PageViewManager;
@@ -4198,7 +4210,7 @@
4198
4210
  }
4199
4211
  _base.initialize(config, core, extensions, pluginChain);
4200
4212
  try {
4201
- _evtNamespace = mergeEvtNamespace(createUniqueNamespace("AnalyticsPlugin"), core.evtNamespace && core.evtNamespace());
4213
+ _evtNamespace = mergeEvtNamespace(createUniqueNamespace(_self.identifier), core.evtNamespace && core.evtNamespace());
4202
4214
  if (_preInitTelemetryInitializers) {
4203
4215
  arrForEach(_preInitTelemetryInitializers, function (initializer) {
4204
4216
  core.addTelemetryInitializer(initializer);
@@ -4245,6 +4257,7 @@
4245
4257
  }
4246
4258
  };
4247
4259
  _self._doTeardown = function (unloadCtx, unloadState) {
4260
+ _pageViewManager && _pageViewManager.teardown(unloadCtx, unloadState);
4248
4261
  eventOff(window, null, null, _evtNamespace);
4249
4262
  _initDefaults();
4250
4263
  };
@@ -4430,7 +4443,7 @@
4430
4443
  });
4431
4444
  return _this;
4432
4445
  }
4433
- AnalyticsPlugin.Version = "2.8.0-beta.2203-06";
4446
+ AnalyticsPlugin.Version = "2.8.0-beta.2203-09";
4434
4447
  AnalyticsPlugin.getDefaultConfig = _getDefaultConfig;
4435
4448
  return AnalyticsPlugin;
4436
4449
  }(BaseTelemetryPlugin));