@microsoft/applicationinsights-react-js 3.2.2 → 3.2.3-nightly.2201-02
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/browser/applicationinsights-react-js.js +1 -1
- package/browser/applicationinsights-react-js.js.map +1 -1
- package/browser/applicationinsights-react-js.min.js +1 -1
- package/browser/applicationinsights-react-js.min.js.map +1 -1
- package/dist/applicationinsights-react-js.api.json +1 -1
- package/dist/applicationinsights-react-js.d.ts +1 -1
- package/dist/applicationinsights-react-js.js +1 -1
- package/dist/applicationinsights-react-js.js.map +1 -1
- package/dist/applicationinsights-react-js.min.js +1 -1
- package/dist/applicationinsights-react-js.min.js.map +1 -1
- package/dist/applicationinsights-react-js.rollup.d.ts +1 -1
- package/dist-esm/AppInsightsContext.js +1 -1
- package/dist-esm/AppInsightsErrorBoundary.js +1 -1
- package/dist-esm/Interfaces/IReactExtensionConfig.js +1 -1
- package/dist-esm/ReactPlugin.js +1 -1
- package/dist-esm/applicationinsights-react-js.js +1 -1
- package/dist-esm/useTrackEvent.js +1 -1
- package/dist-esm/useTrackMetric.js +1 -1
- package/dist-esm/withAITracking.js +1 -1
- package/package.json +74 -71
- package/src/ReactPlugin.ts +2 -2
- package/types/tsdoc-metadata.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - React Plugin, 3.2.
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 3.2.3-nightly.2201-02
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
var t=this,e=function(t,a){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{"default":t}}function n(i){if(i&&i.__esModule)return i;var t,n=(t=Object.create)?t(null):{};return i&&Object.keys(i).forEach(function(t){var e;"default"!==t&&(e=(e=Object.getOwnPropertyDescriptor)?e(i,t):undefined,function(t,e,n){var r=Object.defineProperty;if(r)try{return r(t,e,n)}catch(i){}n&&typeof n.value!==undefined&&(t[e]=n.value)}(n,t,e.get?e:{enumerable:!0,get:function(){return i[t]}}))}),n["default"]=i,n}var l=n(a),r=e(a),s="function",p="object",i="undefined",o="prototype",u="hasOwnProperty",c=Object,f=c[o],d=c.assign,g=c.create,m=c.defineProperty,v=f[u];function h(){return typeof globalThis!==i&&globalThis?globalThis:typeof self!==i&&self?self:typeof window!==i&&window?window:typeof global!==i&&global?global:null}function y(t){throw new TypeError(t)}function T(t){if(g)return g(t);if(null==t)return{};var e=typeof t;function n(){}return e!==p&&e!==s&&y("Object prototype may only be an Object:"+t),n[o]=t,new n}(h()||{}).Symbol,(h()||{}).Reflect;var C=d||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])f[u].call(e,i)&&(t[i]=e[i]);return t},x=function(t,e){return(x=c.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e[u](n)&&(t[n]=e[n])})(t,e)};function I(t,e){function n(){this.constructor=t}typeof e!==s&&null!==e&&y("Class extends value "+e+" is not a constructor or null"),x(t,e),t[o]=null===e?T(e):(n[o]=e[o],new n)}var A,w="constructor",_="prototype",b="function",S="_dynInstFuncs",E="_isDynProxy",k="_dynClass",P="_dynInstChk",M=P,L="_dfOpts",N="_unknown_",F="__proto__",R="useBaseInst",O="setInstFuncs",j=Object,D=j.getPrototypeOf,U=0;function B(t,e){return t&&j[_].hasOwnProperty.call(t,e)}function V(t){return t&&(t===j[_]||t===Array[_])}function z(t){return V(t)||t===Function[_]}function K(t){if(t){if(D)return D(t);t=t[F]||t[_]||(t[w]?t[w][_]:null);if(t)return t}return null}function W(t,e){var n=[],r=j.getOwnPropertyNames;if(r)n=r(t);else for(var i in t)"string"==typeof i&&B(t,i)&&n.push(i);if(n&&0<n.length)for(var o=0;o<n.length;o++)e(n[o])}function G(t,e,n){return e!==w&&typeof t[e]===b&&(n||B(t,e))}function H(t){throw new TypeError("DynamicProto: "+t)}function q(t,e){for(var n=t.length-1;0<=n;n--)if(t[n]===e)return 1}function J(t,e){return B(t,_)?t.name||e||N:((t||{})[w]||{}).name||e||N}function X(t,r,e,n){B(t,_)||H("theClass is an invalid class definition.");var i=t[_];!function(t){if(D)for(var e=[],n=K(r);n&&!z(n)&&!q(e,n);){if(n===t)return 1;e.push(n),n=K(n)}}(i)&&H("["+J(t)+"] is not in class hierarchy of ["+J(r)+"]");var o=null;B(i,k)?o=i[k]:(o="_dynCls$"+J(t,"_")+"$"+U,U++,i[k]=o);var a=X[L],l=!!a[R];l&&n&&n[R]!==undefined&&(l=!!n[R]);var s,u,t=(u={},W(s=r,function(t){!u[t]&&G(s,t,!1)&&(u[t]=s[t])}),u);e(r,function(t,e,n,o){function r(t,e,n){var r,i=e[n];return i[E]&&o&&!1!==(r=t[S]||{})[M]&&(i=(r[e[k]]||{})[n]||i),function(){return i.apply(t,arguments)}}var i={};W(n,function(t){i[t]=r(e,n,t)});for(var a=K(t),l=[];a&&!z(a)&&!q(l,a);)W(a,function(t){!i[t]&&G(a,t,!D)&&(i[t]=r(e,a,t))}),l.push(a),a=K(a);return i}(i,r,t,l));var c,f,d,p,a=!!D&&!!a[O];c=i,o=o,f=r,d=t,n=!1!==(a=a&&n?!!n[O]:a),V(c)||(a=f[S]=f[S]||{},p=a[o]=a[o]||{},!1!==a[M]&&(a[M]=!!n),W(f,function(t){var n,r,i;G(f,t,!1)&&f[t]!==d[t]&&(p[t]=f[t],delete f[t],B(c,t)&&(!c[t]||c[t][E])||(c[t]=(n=c,r=t,(i=function(){var t,e;return(function(t,e,n,r){var i=null;if(t&&B(n,k)){var o=t[S]||{};if((i=(o[n[k]]||{})[e])||H("Missing ["+e+"] "+b),!i[P]&&!1!==o[M]){for(var a=!B(t,e),l=K(t),s=[];a&&l&&!z(l)&&!q(s,l);){var u=l[e];if(u){a=u===r;break}s.push(l),l=K(l)}try{a&&(t[e]=i),i[P]=1}catch(c){o[M]=!1}}}return i}(this,r,n,i)||(typeof(e=(e=n[t=r])===i?K(n)[t]:e)!==b&&H("["+t+"] is not a "+b),e)).apply(this,arguments)})[E]=1,i)))}))}X[L]={setInstFuncs:!0,useBaseInst:!0},(d=A=A||{})[d.CRITICAL=1]="CRITICAL",d[d.WARNING=2]="WARNING";var Z={BrowserDoesNotSupportLocalStorage:0,BrowserCannotReadLocalStorage:1,BrowserCannotReadSessionStorage:2,BrowserCannotWriteLocalStorage:3,BrowserCannotWriteSessionStorage:4,BrowserFailedRemovalFromLocalStorage:5,BrowserFailedRemovalFromSessionStorage:6,CannotSendEmptyTelemetry:7,ClientPerformanceMathError:8,ErrorParsingAISessionCookie:9,ErrorPVCalc:10,ExceptionWhileLoggingError:11,FailedAddingTelemetryToBuffer:12,FailedMonitorAjaxAbort:13,FailedMonitorAjaxDur:14,FailedMonitorAjaxOpen:15,FailedMonitorAjaxRSC:16,FailedMonitorAjaxSend:17,FailedMonitorAjaxGetCorrelationHeader:18,FailedToAddHandlerForOnBeforeUnload:19,FailedToSendQueuedTelemetry:20,FailedToReportDataLoss:21,FlushFailed:22,MessageLimitPerPVExceeded:23,MissingRequiredFieldSpecification:24,NavigationTimingNotSupported:25,OnError:26,SessionRenewalDateIsZero:27,SenderNotInitialized:28,StartTrackEventFailed:29,StopTrackEventFailed:30,StartTrackFailed:31,StopTrackFailed:32,TelemetrySampledAndNotSent:33,TrackEventFailed:34,TrackExceptionFailed:35,TrackMetricFailed:36,TrackPVFailed:37,TrackPVFailedCalc:38,TrackTraceFailed:39,TransmissionFailed:40,FailedToSetStorageBuffer:41,FailedToRestoreStorageBuffer:42,InvalidBackendResponse:43,FailedToFixDepricatedValues:44,InvalidDurationValue:45,TelemetryEnvelopeInvalid:46,CreateEnvelopeError:47,CannotSerializeObject:48,CannotSerializeObjectNonSerializable:49,CircularReferenceDetected:50,ClearAuthContextFailed:51,ExceptionTruncated:52,IllegalCharsInName:53,ItemNotInArray:54,MaxAjaxPerPVExceeded:55,MessageTruncated:56,NameTooLong:57,SampleRateOutOfRange:58,SetAuthContextFailed:59,SetAuthContextFailedAccountName:60,StringValueTooLong:61,StartCalledMoreThanOnce:62,StopCalledWithoutStart:63,TelemetryInitializerFailed:64,TrackArgumentsNotSpecified:65,UrlTooLong:66,SessionStorageBufferFull:67,CannotAccessCookie:68,IdTooLong:69,InvalidEvent:70,FailedMonitorAjaxSetRequestHeader:71,SendBrowserInfoOnUserInit:72,PluginException:73,NotificationException:74,SnippetScriptLoadFailure:99,InvalidInstrumentationKey:100,CannotParseAiBlobValue:101,InvalidContentBlob:102,TrackPageActionEventFailed:103,FailedAddingCustomDefinedRequestContext:104,InMemoryStorageBufferFull:105},$="attachEvent",Q="addEventListener",Y=m;function tt(t){return f.toString.call(t)}function et(t){return t===undefined||typeof t===i}function nt(t){return null===t||et(t)}function rt(t){return!nt(t)}function it(t){return typeof t===s}function ot(t,e,n,r){void 0===r&&(r=!1);var i=!1;if(!nt(t))try{nt(t[Q])?nt(t[$])||(t[$]("on"+e,n),i=!0):(t[Q](e,n,r),i=!0)}catch(o){}return i}function at(t,e){return!(!t||!e||!~t.indexOf(e))}function lt(t){return"[object Date]"===tt(t)}function st(t){return"[object Array]"===tt(t)}function ut(t){return"[object Error]"===tt(t)}function ct(t){return"string"==typeof t}function ft(t){return"boolean"==typeof t}function dt(t,e,n){var r=t.length;try{for(var i=0;i<r&&!(i in t&&-1===e.call(n||t,t[i],i,t));i++);}catch(o){}}function pt(t,e,n){var r=t.length,n=n||0;try{for(var i=Math.max(0<=n?n:r-Math.abs(n),0);i<r;i++)if(i in t&&t[i]===e)return i}catch(o){}return-1}function gt(t){return"string"!=typeof t?t:t.replace(/^\s+|\s+$/g,"")}var mt=!{toString:null}.propertyIsEnumerable("toString"),vt=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];function ht(t,e,n,r){if(Y)try{var i={enumerable:!0,configurable:!0};return n&&(i.get=n),r&&(i.set=r),Y(t,e,i),!0}catch(o){}return!1}function yt(){var t=Date;return t.now?t.now():(new t).getTime()}function Tt(t,e,n,r,i){var o=n;return t&&((o=t[e])===n||i&&!i(o)||r&&!r(n)||(t[e]=o=n)),o}function Ct(t){return!!t}var xt="window",It="navigator",At="location",wt="JSON",_t="crypto",bt="msCrypto",St="msie",Et="trident/",kt=null,Pt=null;function Mt(t){var e=h();return e&&e[t]?e[t]:t===xt&&Lt()?window:null}function Lt(){return typeof window===p&&window}function Nt(){return typeof document===p&&document?document:Mt("document")}function Ft(){return typeof navigator===p&&navigator?navigator:Mt(It)}function Rt(){return typeof JSON===p&&JSON||null!==Mt(wt)}function Ot(){return Rt()?JSON||Mt(wt):null}function jt(){var t=Ft();return!t||t.userAgent===Pt&&null!==kt||(t=((Pt=t.userAgent)||"").toLowerCase(),kt=at(t,St)||at(t,Et)),kt}function Dt(t){var e=Object[o].toString.call(t),n="";return"[object Error]"===e?n="{ stack: '"+t.stack+"', message: '"+t.message+"', name: '"+t.name+"'":Rt()&&(n=Ot().stringify(t)),e+n}var Ut=null;function Bt(t){return t?'"'+t.replace(/\"/g,"")+'"':""}function Vt(t,e){var n,r=typeof console!==i?console:Mt("console");r&&(n="log",it(r[n=r[t]?t:n])&&r[n](e))}var zt=(Kt.dataType="MessageData",Kt);function Kt(t,e,n,r){void 0===n&&(n=!1),this.messageId=t,this.message=(n?"AI: ":"AI (Internal): ")+t;t="";Rt()&&(t=Ot().stringify(r));t=(e?" message:"+Bt(e):"")+(r?" props:"+Bt(t):"");this.message+=t}var Wt=function Ke(i){this.identifier="DiagnosticLogger",this.queue=[];var l=0,s={};X(Ke,this,function(o){function t(t,e){t=i[t];return nt(t)?e:t}function a(t,e){var n,r=(r=(r=Ut)||!0===i.disableDbgExt?r:Ut||(n=Mt("Microsoft"),Ut=n?n.ApplicationInsights:Ut))?r.ChromeDbgExt:null;r&&r.diagLog&&r.diagLog(t,e)}nt(i)&&(i={}),o.consoleLoggingLevel=function(){return t("loggingLevelConsole",0)},o.telemetryLoggingLevel=function(){return t("loggingLevelTelemetry",1)},o.maxInternalMessageLimit=function(){return t("maxMessageLimit",25)},o.enableDebugExceptions=function(){return t("enableDebugExceptions",!1)},o.throwInternal=function(t,e,n,r,i){e=new zt(e,n,i=void 0!==i&&i,r);if(o.enableDebugExceptions())throw e;n=t===A.CRITICAL?"errorToConsole":"warnToConsole";et(e.message)?a("throw"+(t===A.CRITICAL?"Critical":"Warning"),e):(r=o.consoleLoggingLevel(),i?(i=+e.messageId,!s[i]&&t<=r&&(o[n](e.message),s[i]=!0)):t<=r&&o[n](e.message),o.logInternalMessage(t,e))},o.warnToConsole=function(t){Vt("warn",t),a("warning",t)},o.errorToConsole=function(t){Vt("error",t),a("error",t)},o.resetInternalMessageCount=function(){l=0,s={}},o.logInternalMessage=function(t,e){var n,r;l>=o.maxInternalMessageLimit()||(r=!0,n="AITR_"+e.messageId,s[n]?r=!1:s[n]=!0,r&&(t<=o.telemetryLoggingLevel()&&(o.queue.push(e),l++,a(t===A.CRITICAL?"error":"warn",e)),l===o.maxInternalMessageLimit()&&(e=new zt(Z.MessageLimitPerPVExceeded,r="Internal events throttle limit per PageView reached for this app.",!1),o.queue.push(e),t===A.CRITICAL?o.errorToConsole(r):o.warnToConsole(r))))}})},Gt=(Ht.ParentContextKey="parent",Ht.ChildrenContextKey="childEvts",Ht);function Ht(t,i,e){var n,o=this,a=!1;o.start=yt(),o.name=t,o.isAsync=e,o.isChildEvt=function(){return!1},it(i)&&(a=ht(o,"payload",function(){return!n&&it(i)&&(n=i(),i=null),n})),o.getCtx=function(t){return t?(t===Ht.ParentContextKey||t===Ht.ChildrenContextKey?o:o.ctx||{})[t]:null},o.setCtx=function(t,e){t&&(t===Ht.ParentContextKey?(o[t]||(o.isChildEvt=function(){return!0}),o[t]=e):t===Ht.ChildrenContextKey?o[t]=e:(o.ctx=o.ctx||{})[t]=e)},o.complete=function(){var t=0,e=o.getCtx(Ht.ChildrenContextKey);if(st(e))for(var n=0;n<e.length;n++){var r=e[n];r&&(t+=r.time)}o.time=yt()-o.start,o.exTime=o.time-t,o.complete=function(){},!a&&it(i)&&(o.payload=i())}}var qt="CoreUtils.doPerf";function Jt(t,e,n,r,i){if(t){var o=t;if(o=it(o.getPerfMgr)?o.getPerfMgr():o){var a,l=void 0,t=o.getCtx(qt);try{if(l=o.create(e(),r,i))return t&&l.setCtx&&(l.setCtx(Gt.ParentContextKey,t),t.getCtx&&t.setCtx&&((a=t.getCtx(Gt.ChildrenContextKey))||(a=[],t.setCtx(Gt.ChildrenContextKey,a)),a.push(l))),o.setCtx(qt,l),n(l)}catch(s){l&&l.setCtx&&l.setCtx("exception",s)}finally{l&&o.fire(l),o.setCtx(qt,t)}}}return n()}var Xt=function(i,e){var o=this,a=null,l=it(i.processTelemetry),s=it(i.setNextPlugin);o._hasRun=!1,o.getPlugin=function(){return i},o.getNext=function(){return a},o.setNext=function(t){a=t},o.processTelemetry=function(n,r){r=r||e;var t=i?i.identifier:"TelemetryPluginChain";Jt(r?r.core():null,function(){return t+":processTelemetry"},function(){if(i&&l){o._hasRun=!0;try{r.setNext(a),s&&i.setNextPlugin(a),a&&(a._hasRun=!1),i.processTelemetry(n,r)}catch(e){var t=a&&a._hasRun;a&&t||r.diagLog().throwInternal(A.CRITICAL,Z.PluginException,"Plugin ["+i.identifier+"] failed during processTelemetry - "+Dt(e)),a&&!t&&a.processTelemetry(n,r)}}else a&&(o._hasRun=!0,a.processTelemetry(n,r))},function(){return{item:n}},!n.sync)}};function Zt(t,e){var n=[];if(t&&0<t.length)for(var r=null,i=0;i<t.length;i++){var o=t[i];o&&it(o.processTelemetry)&&(o=new Xt(o,e),n.push(o),r&&r.setNext(o),r=o)}return 0<n.length?n[0]:null}var $t=function We(t,i,n,e){var r,o,a,l,s=this,u=null;null!==e&&(t&&it(t.getPlugin)?u=function(t,e,n){var r=[],i=!n;if(t)for(;t;){var o=t.getPlugin();!i&&o!==n||(i=!0,r.push(o)),t=t.getNext()}return i||r.push(n),Zt(r,e)}(t,s,e||t.getPlugin()):e?(r=s,a=t,l=!1,(o=e)&&t&&(a=[],dt(t,function(t){!l&&t!==o||(l=!0,a.push(t))})),o&&!l&&(a=a||[]).push(o),u=Zt(a,r)):et(e)&&(u=Zt(t,s))),s.core=function(){return n},s.diagLog=function(){return(n||{}).logger||new Wt(i)},s.getCfg=function(){return i},s.getExtCfg=function(t,e){var n,r;return void 0===e&&(e={}),!i||(r=i.extensionConfig)&&t&&(n=r[t]),n||e},s.getConfig=function(t,e,n){var r;void 0===n&&(n=!1);t=s.getExtCfg(t,null);return t&&!nt(t[e])?r=t[e]:i&&!nt(i[e])&&(r=i[e]),nt(r)?n:r},s.hasNext=function(){return null!=u},s.getNext=function(){return u},s.setNext=function(t){u=t},s.processNext=function(t){var e=u;e&&(u=e.getNext(),e.processTelemetry(t,s))},s.createNew=function(t,e){return new We((t=void 0===t?null:t)||u,i,n,e)}},Qt="getPlugin",d=(Yt.prototype.initialize=function(t,e,n,r){this._baseTelInit(t,e,n,r)},Yt);function Yt(){var o=this,a=!1,l=null,s=null;o.core=null,o.diagLog=function(t){return o._getTelCtx(t).diagLog()},o.isInitialized=function(){return a},o.setInitialized=function(t){a=t},o.setNextPlugin=function(t){s=t},o.processNext=function(t,e){e?e.processNext(t):s&&it(s.processTelemetry)&&s.processTelemetry(t,null)},o._getTelCtx=function(t){var e=t=void 0===t?null:t;return e||(t=l||new $t(null,{},o.core),e=s&&s[Qt]?t.createNew(null,s[Qt]):t.createNew(null,s)),e},o._baseTelInit=function(t,e,n,r){t&&Tt(t,"extensionConfig",[],null,nt),!r&&e&&(r=e.getProcessTelContext().getNext());var i=s;s&&s[Qt]&&(i=s[Qt]()),o.core=e,l=new $t(r,t,e,i),a=!0}}var te="toGMTString",ee="toUTCString",ne="cookie",re="expires",ie="enabled",oe="isCookieUseDisabled",ae="disableCookiesUsage",le="_ckMgr",se="",ue=null,ce=null,fe=null,de=Nt(),pe={},ge={};function me(t,e){var n=he[le]||ge[le];return n||(n=he[le]=he(t,e),ge[le]=n),n}function ve(t){return!t||t.isEnabled()}function he(t,i){var e,n,u=(Tt(n=(e=t||ge).cookieCfg=e.cookieCfg||{},"domain",e.cookieDomain,rt,nt),Tt(n,"path",e.cookiePath||"/",null,nt),nt(n[ie])&&(t=void 0,et(e[oe])||(t=!e[oe]),et(e[ae])||(t=!e[ae]),n[ie]=t),n),c=u.path||"/",f=u.domain,r=!1!==u[ie],d={isEnabled:function(){var t=r&&ye(i),e=ge[le];return t&&e&&d!==e?ve(e):t},setEnabled:function(t){r=!1!==t},set:function(t,e,n,r,i){var o,a,l,s=!1;return ve(d)&&(o={},-1!=(l=(a=gt(e||se)).indexOf(";"))&&(a=gt(e.substring(0,l)),o=Te(e.substring(1+l))),Tt(o,"domain",r||f,Ct,et),nt(n)||(l=jt(),!et(o[re])||0<(e=yt()+1e3*n)&&((r=new Date).setTime(e),Tt(o,re,Ce(r,l?te:ee)||Ce(r,l?te:ee)||se,Ct)),l||Tt(o,"max-age",se+n,null,et)),(n=typeof location===p&&location?location:Mt(At))&&"https:"===n.protocol&&(Tt(o,"secure",null,null,et),(ce=null===ce?!(ct(n=(Ft()||{}).userAgent)&&(at(n,"CPU iPhone OS 12")||at(n,"iPad; CPU OS 12")||at(n,"Macintosh; Intel Mac OS X 10_14")&&at(n,"Version/")&&at(n,"Safari")||at(n,"Macintosh; Intel Mac OS X 10_14")&&function(t,e){if(t){var n=t.length;if(t===e)return 1;if(40<=n){for(var r=n-1,i=39;0<=i;i--){if(t[r]!=e[i])return;r--}return 1}}}(n,"AppleWebKit/605.1.15 (KHTML, like Gecko)")||at(n,"Chrome/5")||at(n,"Chrome/6")||at(n,"UnrealEngine")&&!at(n,"Chrome")||at(n,"UCBrowser/12")||at(n,"UCBrowser/11"))):ce)&&Tt(o,"SameSite","None",null,et)),Tt(o,"path",i||c,null,et),(u.setCookie||Ie)(t,xe(a,o)),s=!0),s},get:function(t){var e=se;return ve(d)?(u.getCookie||function(t){var e,n=se;return de&&(e=de[ne]||se,fe!==e&&(pe=Te(e),fe=e),n=gt(pe[t]||se)),n})(t):e},del:function(t,e){return!!ve(d)&&d.purge(t,e)},purge:function(t,e){var n,r=!1;return ye(i)&&((n={}).path=e||"/",n[re]="Thu, 01 Jan 1970 00:00:01 GMT",n=n,jt()||(n["max-age"]="0"),(u.delCookie||Ie)(t,xe(se,n)),r=!0),r}};return d[le]=d}function ye(t){if(null===ue){ue=!1;try{ue=(de||{})[ne]!==undefined}catch(n){t&&t.throwInternal(A.WARNING,Z.CannotAccessCookie,"Cannot access document.cookie - "+(ut(e=n)?e.name:""),{exception:Dt(n)})}}var e;return ue}function Te(t){var n={};return t&&t.length&&dt(gt(t).split(";"),function(t){var e;(t=gt(t||se))&&(-1==(e=t.indexOf("="))?n[t]=null:n[gt(t.substring(0,e))]=gt(t.substring(1+e)))}),n}function Ce(t,e){return it(t[e])?t[e]():null}function xe(t,e){var r=t||se;return function(t){if(t)for(var e in t)v.call(t,e)&&(n=e,e=t[e],r+="; "+n+(nt(e)?se:"="+e));var n}(e),r}function Ie(t,e){de&&(de[ne]=t+"="+e)}var Ae=4294967296,we=4294967295,_e=!1,be=123456789,Se=987654321;function Ee(t){t<0&&(t>>>=0),be=123456789+t&we,Se=987654321-t&we,_e=!0}function ke(){try{var t=2147483647&yt();Ee((Math.random()*Ae^t)+t)}catch(e){}}function Pe(t){return 0<t?Math.floor(Me()/we*(t+1))>>>0:0}function Me(t){var e=Mt(_t)||Mt(bt),e=e&&e.getRandomValues?e.getRandomValues(new Uint32Array(1))[0]&we:jt()?(_e||ke(),Le()&we):Math.floor(Ae*Math.random()|0);return t||(e>>>=0),e}function Le(t){var e=((Se=36969*(65535&Se)+(Se>>16)&we)<<16)+(65535&(be=18e3*(65535&be)+(be>>16)&we))>>>0&we|0;return t||(e>>>=0),e}var Ne,Fe,Re=null,Oe={_canUseCookies:undefined,isTypeof:function(t,e){return typeof t===e},isUndefined:et,isNullOrUndefined:nt,hasOwnProperty:function(t,e){return t&&v.call(t,e)},isFunction:it,isObject:function(t){return typeof t===p},isDate:lt,isArray:st,isError:ut,isString:ct,isNumber:function(t){return"number"==typeof t},isBoolean:ft,toISOString:function(t){if(lt(t)){var e=function(t){t=""+t;return 1===t.length?"0"+t:t};return t.getUTCFullYear()+"-"+e(1+t.getUTCMonth())+"-"+e(t.getUTCDate())+"T"+e(t.getUTCHours())+":"+e(t.getUTCMinutes())+":"+e(t.getUTCSeconds())+"."+(""+(t.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}},arrForEach:dt,arrIndexOf:pt,arrMap:function(t,e,n){var r=t.length,i=n||t,o=Array(r);try{for(var a=0;a<r;a++)a in t&&(o[a]=e.call(i,t[a],t))}catch(l){}return o},arrReduce:function(t,e,n){var r,i=t.length,o=0;if(3<=arguments.length)r=n;else{for(;o<i&&!(o in t);)o++;r=t[o++]}for(;o<i;)o in t&&(r=e(r,t[o],o,t)),o++;return r},strTrim:gt,objCreate:T,objKeys:function(t){var e=typeof t;e===s||e===p&&null!==t||y("objKeys called on non-object");var n,r=[];for(n in t)t&&v.call(t,n)&&r.push(n);if(mt)for(var i=vt.length,o=0;o<i;o++)t&&v.call(t,vt[o])&&r.push(vt[o]);return r},objDefineAccessors:ht,addEventHandler:function(t,e){var n=!1,r=Lt()?window:Mt(xt);r&&(n=ot(r,t,e),n=ot(r.body,t,e)||n);r=Nt();return r&&ot(r,t,e)||n},dateNow:yt,isIE:jt,disableCookies:function(){var t=me(void 0,void 0),e=Oe._canUseCookies;null===Re&&(Re=[],Ne=e,ht(Oe,"_canUseCookies",function(){return Ne},function(e){Ne=e,dt(Re,function(t){t.setEnabled(e)})})),-1===pt(Re,t)&&Re.push(t),ft(e)&&t.setEnabled(e),ft(Ne)&&t.setEnabled(Ne),t.setEnabled(!1)},newGuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(je,function(t){var e=0|Pe(15);return("x"===t?e:3&e|8).toString(16)})},perfNow:function(){var t=Mt("performance");return t&&t.now?t.now():yt()},newId:function(t){void 0===t&&(t=22);for(var e=Me()>>>0,n=0,r="";r.length<t;)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[0|63&e]||"",e>>>=6,5==++n&&(e=(Me()<<2&4294967295|3&e)>>>0,n=0);return r},randomValue:Pe,random32:Me,mwcRandomSeed:function(t){t?Ee(t):ke()},mwcRandom32:Le,generateW3CId:function(){for(var t,e=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],n="",r=0;r<4;r++)n+=e[15&(t=Me())]+e[t>>4&15]+e[t>>8&15]+e[t>>12&15]+e[t>>16&15]+e[t>>20&15]+e[t>>24&15]+e[t>>28&15];var i=e[8+(3&Me())|0];return n.substr(0,8)+n.substr(9,4)+"4"+n.substr(13,3)+i+n.substr(16,3)+n.substr(19,12)}},je=/[xy]/g;function De(){var t=null!==Fe&&Fe.apply(this,arguments)||this;return t.priority=185,t.identifier="ReactPlugin",t}var Ue,m=(I(De,Fe=d),De.prototype.initialize=function(t,e,n,r){var i=this;Fe.prototype.initialize.call(this,t,e,n,r),this._extensionConfig=t.extensionConfig&&t.extensionConfig[this.identifier]?t.extensionConfig[this.identifier]:{history:null},dt(n,function(t){"ApplicationInsightsAnalytics"===t.identifier&&(i._analyticsPlugin=t)}),this._extensionConfig.history&&(this.addHistoryListener(this._extensionConfig.history),n={uri:this._extensionConfig.history.location.pathname},this.trackPageView(n))},De.prototype.getCookieMgr=function(){return(e=(t=this.core)?t.getCookieMgr():e)||me(void 0,(t||{}).logger);var t,e},De.prototype.getAppInsights=function(){return this._analyticsPlugin},De.prototype.processTelemetry=function(t,e){this.processNext(t,e)},De.prototype.trackMetric=function(t,e){this._analyticsPlugin?this._analyticsPlugin.trackMetric(t,e):this.diagLog().throwInternal(A.CRITICAL,Z.TelemetryInitializerFailed,"Analytics plugin is not available, React plugin telemetry will not be sent: ")},De.prototype.trackPageView=function(t){this._analyticsPlugin?this._analyticsPlugin.trackPageView(t):this.diagLog().throwInternal(A.CRITICAL,Z.TelemetryInitializerFailed,"Analytics plugin is not available, React plugin telemetry will not be sent: ")},De.prototype.trackEvent=function(t,e){this._analyticsPlugin?this._analyticsPlugin.trackEvent(t,e):this.diagLog().throwInternal(A.CRITICAL,Z.TelemetryInitializerFailed,"Analytics plugin is not available, React plugin telemetry will not be sent: ")},De.prototype.trackException=function(t,e){this._analyticsPlugin?this._analyticsPlugin.trackException(t,e):this.diagLog().throwInternal(A.CRITICAL,Z.TelemetryInitializerFailed,"Analytics plugin is not available, React plugin telemetry will not be sent: ")},De.prototype.trackTrace=function(t,e){this._analyticsPlugin?this._analyticsPlugin.trackTrace(t,e):this.diagLog().throwInternal(A.CRITICAL,Z.TelemetryInitializerFailed,"Analytics plugin is not available, React plugin telemetry will not be sent: ")},De.prototype.addHistoryListener=function(t){var n=this;t.listen(function(t){var e="location"in t?t.location:t;setTimeout(function(){var t={uri:e.pathname};n.trackPageView(t)},500)})},De);function Be(){var t=null!==Ue&&Ue.apply(this,arguments)||this;return t.state={hasError:!1},t}var Ve=3,d=(I(Be,Ue=r["default"].Component),Be.prototype.componentDidCatch=function(t,e){this.setState({hasError:!0}),this.props.appInsights.trackException({error:t,exception:t,severityLevel:Ve,properties:e})},Be.prototype.render=function(){if(this.state.hasError){var t=this.props.onError;return r["default"].createElement(t)}return this.props.children},Be),ze=a.createContext(undefined);t.AppInsightsContext=ze,t.AppInsightsErrorBoundary=d,t.ReactPlugin=m,t.useAppInsightsContext=function(){return a.useContext(ze)},t.useTrackEvent=function(t,e,n,r){void 0===r&&(r=!0);var n=a.useState(n),i=n[0],n=n[1],o=a.useRef(r);return a.useEffect(function(){o.current?o.current=!1:t.trackEvent({name:e},i)},[t,i,e]),n},t.useTrackMetric=function(n,r){var i=a.useRef({hookTimestamp:yt(),firstActiveTimestamp:0,totalIdleTime:0,lastActiveTimestamp:0,idleStartTimestamp:0,idleCount:0,idleTimeout:5e3}),t=a.useRef();return t.current=function(){var t=i.current;0<t.lastActiveTimestamp&&0===t.idleStartTimestamp&&yt()-t.lastActiveTimestamp>=t.idleTimeout&&(t.idleStartTimestamp=yt(),t.idleCount++)},a.useEffect(function(){var e=setInterval(t.current,100);return function(){clearInterval(e);var t=i.current;if(0===t.hookTimestamp)throw Error("useAppInsights:unload hook: hookTimestamp is not initialized.");0!==t.firstActiveTimestamp&&(t=t,t=(yt()-t.firstActiveTimestamp-t.totalIdleTime-t.idleCount*t.idleTimeout)/1e3,n.trackMetric({average:t,name:"React Component Engaged Time (seconds)",sampleCount:1},{"Component Name":r}))}},[]),function(){var t,e=i.current;0===e.firstActiveTimestamp?(e.firstActiveTimestamp=yt(),e.lastActiveTimestamp=e.firstActiveTimestamp):e.lastActiveTimestamp=yt(),0<e.idleStartTimestamp&&(t=e.lastActiveTimestamp-e.idleStartTimestamp,e.totalIdleTime+=t,e.idleStartTimestamp=0)}},t.withAITracking=function(n,t,r,e){return r!==undefined&&null!==r&&"string"==typeof r||(r=t.prototype&&t.prototype.constructor&&t.prototype.constructor.name||"Unknown"),e!==undefined&&null!==e&&"string"==typeof e||(e=""),I(i,o=l.Component),i.prototype.componentDidMount=function(){var t=this;this._mountTimestamp=Oe.dateNow(),this._firstActiveTimestamp=0,this._totalIdleTime=0,this._lastActiveTimestamp=0,this._idleStartTimestamp=0,this._idleCount=0,this._intervalId=setInterval(function(){0<t._lastActiveTimestamp&&0===t._idleStartTimestamp&&Oe.dateNow()-t._lastActiveTimestamp>=t._idleTimeout&&(t._idleStartTimestamp=Oe.dateNow(),t._idleCount++)},100)},i.prototype.componentWillUnmount=function(){if(0===this._mountTimestamp)throw Error("withAITracking:componentWillUnmount: mountTimestamp is not initialized.");var t,e;this._intervalId&&clearInterval(this._intervalId),0!==this._firstActiveTimestamp&&(t=this.getEngagementTimeSeconds(),e={"Component Name":r},n.trackMetric({average:t,name:"React Component Engaged Time (seconds)",sampleCount:1},e))},i.prototype.render=function(){return l.createElement("div",{onKeyDown:this.trackActivity,onMouseMove:this.trackActivity,onScroll:this.trackActivity,onMouseDown:this.trackActivity,onTouchStart:this.trackActivity,onTouchMove:this.trackActivity,className:e},l.createElement(t,C({},this.props)))},i.prototype.getEngagementTimeSeconds=function(){return(Oe.dateNow()-this._firstActiveTimestamp-this._totalIdleTime-this._idleCount*this._idleTimeout)/1e3},i;function i(){var n=null!==o&&o.apply(this,arguments)||this;return n._mountTimestamp=0,n._firstActiveTimestamp=0,n._idleStartTimestamp=0,n._lastActiveTimestamp=0,n._totalIdleTime=0,n._idleCount=0,n._idleTimeout=5e3,n.trackActivity=function(t){var e;0===n._firstActiveTimestamp?(n._firstActiveTimestamp=Oe.dateNow(),n._lastActiveTimestamp=n._firstActiveTimestamp):n._lastActiveTimestamp=Oe.dateNow(),0<n._idleStartTimestamp&&(e=n._lastActiveTimestamp-n._idleStartTimestamp,n._totalIdleTime+=e,n._idleStartTimestamp=0)},n}var o},function(t,e,n){var r=Object.defineProperty;if(r)try{return r(t,e,n)}catch(i){}typeof n.value!==undefined&&(t[e]=n.value)}(t,"__esModule",{value:!0})};"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Microsoft=t.Microsoft||{},t.Microsoft.ApplicationInsights=t.Microsoft.ApplicationInsights||{}),t.React);
|