@microsoft/1ds-post-js 3.1.9 → 3.1.10
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/README.md +1 -0
- package/bundle/{ms.post-3.1.9.gbl.js → ms.post-3.1.10.gbl.js} +196 -92
- package/bundle/ms.post-3.1.10.gbl.js.map +1 -0
- package/bundle/ms.post-3.1.10.gbl.min.js +7 -0
- package/bundle/ms.post-3.1.10.gbl.min.js.map +1 -0
- package/bundle/ms.post-3.1.10.integrity.json +46 -0
- package/bundle/{ms.post-3.1.9.js → ms.post-3.1.10.js} +196 -92
- package/bundle/ms.post-3.1.10.js.map +1 -0
- package/bundle/ms.post-3.1.10.min.js +7 -0
- package/bundle/ms.post-3.1.10.min.js.map +1 -0
- package/bundle/ms.post.gbl.js +195 -91
- package/bundle/ms.post.gbl.js.map +1 -1
- package/bundle/ms.post.gbl.min.js +2 -2
- package/bundle/ms.post.gbl.min.js.map +1 -1
- package/bundle/ms.post.integrity.json +17 -17
- package/bundle/ms.post.js +195 -91
- package/bundle/ms.post.js.map +1 -1
- package/bundle/ms.post.min.js +2 -2
- package/bundle/ms.post.min.js.map +1 -1
- package/dist/ms.post.js +140 -72
- package/dist/ms.post.js.map +1 -1
- package/dist/ms.post.min.js +2 -2
- package/dist/ms.post.min.js.map +1 -1
- package/dist-esm/src/BatchNotificationActions.js +1 -1
- package/dist-esm/src/ClockSkewManager.js +1 -1
- package/dist-esm/src/Constants.d.ts +24 -0
- package/dist-esm/src/Constants.js +30 -0
- package/dist-esm/src/Constants.js.map +1 -0
- package/dist-esm/src/DataModels.d.ts +6 -0
- package/dist-esm/src/DataModels.js +1 -1
- package/dist-esm/src/EventBatch.d.ts +5 -2
- package/dist-esm/src/EventBatch.js +35 -15
- package/dist-esm/src/EventBatch.js.map +1 -1
- package/dist-esm/src/HttpManager.d.ts +1 -1
- package/dist-esm/src/HttpManager.js +112 -64
- package/dist-esm/src/HttpManager.js.map +1 -1
- package/dist-esm/src/Index.js +1 -1
- package/dist-esm/src/KillSwitch.js +1 -1
- package/dist-esm/src/PostChannel.js +6 -5
- package/dist-esm/src/PostChannel.js.map +1 -1
- package/dist-esm/src/RetryPolicy.js +1 -1
- package/dist-esm/src/Serializer.js +1 -1
- package/dist-esm/src/typings/XDomainRequest.js +1 -1
- package/package.json +3 -3
- package/src/Constants.ts +27 -0
- package/src/DataModels.ts +8 -1
- package/src/EventBatch.ts +47 -14
- package/src/HttpManager.ts +143 -66
- package/src/PostChannel.ts +4 -3
- package/bundle/ms.post-3.1.9.gbl.js.map +0 -1
- package/bundle/ms.post-3.1.9.gbl.min.js +0 -7
- package/bundle/ms.post-3.1.9.gbl.min.js.map +0 -1
- package/bundle/ms.post-3.1.9.integrity.json +0 -46
- package/bundle/ms.post-3.1.9.js.map +0 -1
- package/bundle/ms.post-3.1.9.min.js +0 -7
- package/bundle/ms.post-3.1.9.min.js.map +0 -1
package/README.md
CHANGED
|
@@ -65,6 +65,7 @@ appInsightsCore.initialize(coreConfig, []);
|
|
|
65
65
|
| stringifyObjects | [Optional] During serialization, when an object is identified should the object serialized by true => JSON.stringify(theObject); otherwise theObject.toString(). Defaults to false. | boolean
|
|
66
66
|
| enableCompoundKey | [Optional] Enables support for objects with compound keys which indirectly represent an object eg. event: { "somedata.embeddedvalue": 123 } where the "key" of the object contains a "." as part of it's name. Defaults to false. | boolean
|
|
67
67
|
| disableOptimizeObj | [Optional] Switch to disable the v8 `optimizeObject()` calls used to provide better serialization performance. Defaults to false. | boolean
|
|
68
|
+
| avoidOptions<br/><sub><i>(Since 3.1.10+ === true*)</i></sub> | [Optional] Avoid adding request headers to the outgoing request that would cause a pre-flight (OPTIONS) request to be sent for each request.<br/> <sub>* This currently defaults to true but will be changed once the collector handles additional settings to allow the browser to better cache any previous OPTIONS response, at which point some of the current dynamic values sent on the query string will be moved to a header.</sub> | boolean
|
|
68
69
|
|
|
69
70
|
### [IXHROverride](https://1dsdocs.azurewebsites.net/api/webSDK/chnl/post/3.0/f/interfaces/ixhroverride.html)
|
|
70
71
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* 1DS JS SDK POST plugin, 3.1.
|
|
2
|
+
* 1DS JS SDK POST plugin, 3.1.10
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
* (Microsoft Internal Only)
|
|
5
5
|
*/
|
|
@@ -18,20 +18,24 @@
|
|
|
18
18
|
var ObjDefineProperty = ObjClass["defineProperty"];
|
|
19
19
|
var ObjHasOwnProperty = ObjProto[strShimHasOwnProperty];
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
var _cachedGlobal = null;
|
|
22
|
+
function getGlobal(useCached) {
|
|
23
|
+
if (useCached === void 0) { useCached = true; }
|
|
24
|
+
if (!_cachedGlobal || !useCached) {
|
|
25
|
+
if (typeof globalThis !== strShimUndefined && globalThis) {
|
|
26
|
+
_cachedGlobal = globalThis;
|
|
27
|
+
}
|
|
28
|
+
if (typeof self !== strShimUndefined && self) {
|
|
29
|
+
_cachedGlobal = self;
|
|
30
|
+
}
|
|
31
|
+
if (typeof window !== strShimUndefined && window) {
|
|
32
|
+
_cachedGlobal = window;
|
|
33
|
+
}
|
|
34
|
+
if (typeof global !== strShimUndefined && global) {
|
|
35
|
+
_cachedGlobal = global;
|
|
36
|
+
}
|
|
33
37
|
}
|
|
34
|
-
return
|
|
38
|
+
return _cachedGlobal;
|
|
35
39
|
}
|
|
36
40
|
function throwTypeError(message) {
|
|
37
41
|
throw new TypeError(message);
|
|
@@ -46,7 +50,7 @@
|
|
|
46
50
|
}
|
|
47
51
|
var type = typeof obj;
|
|
48
52
|
if (type !== strShimObject && type !== strShimFunction) {
|
|
49
|
-
throwTypeError(
|
|
53
|
+
throwTypeError("Object prototype may only be an Object:" + obj);
|
|
50
54
|
}
|
|
51
55
|
function tmpFunc() { }
|
|
52
56
|
tmpFunc[strShimPrototype] = obj;
|
|
@@ -762,7 +766,7 @@
|
|
|
762
766
|
}
|
|
763
767
|
function useXDomainRequest() {
|
|
764
768
|
if (_useXDomainRequest === null) {
|
|
765
|
-
_useXDomainRequest = (typeof XDomainRequest !== undefined);
|
|
769
|
+
_useXDomainRequest = (typeof XDomainRequest !== "undefined");
|
|
766
770
|
if (_useXDomainRequest && isXhrSupported()) {
|
|
767
771
|
_useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst("XMLHttpRequest"), "withCredentials");
|
|
768
772
|
}
|
|
@@ -780,6 +784,22 @@
|
|
|
780
784
|
return isSupported;
|
|
781
785
|
}
|
|
782
786
|
|
|
787
|
+
var _aiNamespace = null;
|
|
788
|
+
function _getExtensionNamespace() {
|
|
789
|
+
var target = getGlobalInst("Microsoft");
|
|
790
|
+
if (target) {
|
|
791
|
+
_aiNamespace = target["ApplicationInsights"];
|
|
792
|
+
}
|
|
793
|
+
return _aiNamespace;
|
|
794
|
+
}
|
|
795
|
+
function getDebugExt(config) {
|
|
796
|
+
var ns = _aiNamespace;
|
|
797
|
+
if (!ns && config.disableDbgExt !== true) {
|
|
798
|
+
ns = _aiNamespace || _getExtensionNamespace();
|
|
799
|
+
}
|
|
800
|
+
return ns ? ns["ChromeDbgExt"] : null;
|
|
801
|
+
}
|
|
802
|
+
|
|
783
803
|
var AiNonUserActionablePrefix = "AI (Internal): ";
|
|
784
804
|
var AiUserActionablePrefix = "AI: ";
|
|
785
805
|
var AIInternalMessagePrefix = "AITR_";
|
|
@@ -863,13 +883,18 @@
|
|
|
863
883
|
}
|
|
864
884
|
_self.logInternalMessage(severity, message);
|
|
865
885
|
}
|
|
886
|
+
else {
|
|
887
|
+
_debugExtMsg("throw" + (severity === LoggingSeverity.CRITICAL ? "Critical" : "Warning"), message);
|
|
888
|
+
}
|
|
866
889
|
}
|
|
867
890
|
};
|
|
868
891
|
_self.warnToConsole = function (message) {
|
|
869
892
|
_logToConsole("warn", message);
|
|
893
|
+
_debugExtMsg("warning", message);
|
|
870
894
|
};
|
|
871
895
|
_self.errorToConsole = function (message) {
|
|
872
896
|
_logToConsole("error", message);
|
|
897
|
+
_debugExtMsg("error", message);
|
|
873
898
|
};
|
|
874
899
|
_self.resetInternalMessageCount = function () {
|
|
875
900
|
_messageCount = 0;
|
|
@@ -891,12 +916,18 @@
|
|
|
891
916
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
892
917
|
_self.queue.push(message);
|
|
893
918
|
_messageCount++;
|
|
919
|
+
_debugExtMsg((severity === LoggingSeverity.CRITICAL ? "error" : "warn"), message);
|
|
894
920
|
}
|
|
895
921
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
896
922
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
897
923
|
var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
|
|
898
924
|
_self.queue.push(throttleMessage);
|
|
899
|
-
|
|
925
|
+
if (severity === LoggingSeverity.CRITICAL) {
|
|
926
|
+
_self.errorToConsole(throttleLimitMessage);
|
|
927
|
+
}
|
|
928
|
+
else {
|
|
929
|
+
_self.warnToConsole(throttleLimitMessage);
|
|
930
|
+
}
|
|
900
931
|
}
|
|
901
932
|
}
|
|
902
933
|
};
|
|
@@ -910,6 +941,12 @@
|
|
|
910
941
|
function _areInternalMessagesThrottled() {
|
|
911
942
|
return _messageCount >= _self.maxInternalMessageLimit();
|
|
912
943
|
}
|
|
944
|
+
function _debugExtMsg(name, data) {
|
|
945
|
+
var dbgExt = getDebugExt(config);
|
|
946
|
+
if (dbgExt && dbgExt.diagLog) {
|
|
947
|
+
dbgExt.diagLog(name, data);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
913
950
|
});
|
|
914
951
|
}
|
|
915
952
|
return DiagnosticLogger;
|
|
@@ -1397,7 +1434,7 @@
|
|
|
1397
1434
|
var _ExtendedInternalMessageId = __assignFn(__assignFn({}, _InternalMessageId), { AuthHandShakeError: 501, AuthRedirectFail: 502, BrowserCannotReadLocalStorage: 503, BrowserCannotWriteLocalStorage: 504, BrowserDoesNotSupportLocalStorage: 505, CannotParseBiBlobValue: 506, CannotParseDataAttribute: 507, CVPluginNotAvailable: 508, DroppedEvent: 509, ErrorParsingAISessionCookie: 510, ErrorProvidedChannels: 511, FailedToGetCookies: 512, FailedToInitializeCorrelationVector: 513, FailedToInitializeSDK: 514, InvalidContentBlob: 515, InvalidCorrelationValue: 516, SessionRenewalDateIsZero: 517, SendPostOnCompleteFailure: 518, PostResponseHandler: 519, SDKNotInitialized: 520 });
|
|
1398
1435
|
|
|
1399
1436
|
var _a$1;
|
|
1400
|
-
var Version = '3.1.
|
|
1437
|
+
var Version = '3.1.10';
|
|
1401
1438
|
var FullVersionString = "1DS-Web-JS-" + Version;
|
|
1402
1439
|
var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
|
|
1403
1440
|
var strWithCredentials = "withCredentials";
|
|
@@ -1600,42 +1637,81 @@
|
|
|
1600
1637
|
var NRT_PROFILE = "NEAR_REAL_TIME";
|
|
1601
1638
|
var BE_PROFILE = "BEST_EFFORT";
|
|
1602
1639
|
|
|
1640
|
+
var Method = "POST";
|
|
1641
|
+
var DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
|
|
1642
|
+
var strDropped = "drop";
|
|
1643
|
+
var strSending = "send";
|
|
1644
|
+
var strRequeue = "requeue";
|
|
1645
|
+
var strResponseFail = "rspFail";
|
|
1646
|
+
var strOther = "oth";
|
|
1647
|
+
var defaultCacheControl = "no-cache, no-store";
|
|
1648
|
+
var defaultContentType = "application/x-json-stream";
|
|
1649
|
+
var strCacheControl = "cache-control";
|
|
1650
|
+
var strContentTypeHeader = "content-type";
|
|
1651
|
+
var strKillTokensHeader = "kill-tokens";
|
|
1652
|
+
var strKillDurationHeader = "kill-duration";
|
|
1653
|
+
var strKillDurationSecondsHeader = "kill-duration-seconds";
|
|
1654
|
+
var strTimeDeltaHeader = "time-delta-millis";
|
|
1655
|
+
var strClientVersion = "client-version";
|
|
1656
|
+
var strClientId = "client-id";
|
|
1657
|
+
var strTimeDeltaToApply = "time-delta-to-apply-millis";
|
|
1658
|
+
var strUploadTime = "upload-time";
|
|
1659
|
+
var strApiKey = "apikey";
|
|
1660
|
+
var strMsaDeviceTicket = "AuthMsaDeviceTicket";
|
|
1661
|
+
var strMsfpc = "msfpc";
|
|
1662
|
+
|
|
1663
|
+
function _getEventMsfpc(theEvent) {
|
|
1664
|
+
var intWeb = ((theEvent.ext || {})["intweb"]);
|
|
1665
|
+
if (intWeb && isValueAssigned(intWeb[strMsfpc])) {
|
|
1666
|
+
return intWeb[strMsfpc];
|
|
1667
|
+
}
|
|
1668
|
+
return null;
|
|
1669
|
+
}
|
|
1670
|
+
function _getMsfpc(theEvents) {
|
|
1671
|
+
var msfpc = null;
|
|
1672
|
+
for (var lp = 0; msfpc === null && lp < theEvents.length; lp++) {
|
|
1673
|
+
msfpc = _getEventMsfpc(theEvents[lp]);
|
|
1674
|
+
}
|
|
1675
|
+
return msfpc;
|
|
1676
|
+
}
|
|
1603
1677
|
var EventBatch = /** @class */ (function () {
|
|
1604
1678
|
function EventBatch(iKey, addEvents) {
|
|
1605
1679
|
var events = addEvents ? [].concat(addEvents) : [];
|
|
1606
1680
|
var _self = this;
|
|
1681
|
+
var _msfpc = _getMsfpc(events);
|
|
1607
1682
|
_self.iKey = function () {
|
|
1608
1683
|
return iKey;
|
|
1609
1684
|
};
|
|
1685
|
+
_self.Msfpc = function () {
|
|
1686
|
+
return _msfpc || "";
|
|
1687
|
+
};
|
|
1610
1688
|
_self.count = function () {
|
|
1611
1689
|
return events.length;
|
|
1612
1690
|
};
|
|
1613
1691
|
_self.events = function () {
|
|
1614
1692
|
return events;
|
|
1615
1693
|
};
|
|
1616
|
-
_self.
|
|
1617
|
-
if (
|
|
1618
|
-
|
|
1619
|
-
if (
|
|
1620
|
-
|
|
1621
|
-
}
|
|
1622
|
-
else {
|
|
1623
|
-
events = theEvents.concat(events);
|
|
1694
|
+
_self.addEvent = function (theEvent) {
|
|
1695
|
+
if (theEvent) {
|
|
1696
|
+
events.push(theEvent);
|
|
1697
|
+
if (!_msfpc) {
|
|
1698
|
+
_msfpc = _getEventMsfpc(theEvent);
|
|
1624
1699
|
}
|
|
1625
|
-
return
|
|
1700
|
+
return true;
|
|
1626
1701
|
}
|
|
1627
|
-
return
|
|
1702
|
+
return false;
|
|
1628
1703
|
};
|
|
1629
1704
|
_self.split = function (fromEvent, numEvents) {
|
|
1630
|
-
var
|
|
1705
|
+
var theEvents;
|
|
1631
1706
|
if (fromEvent < events.length) {
|
|
1632
1707
|
var cnt = events.length - fromEvent;
|
|
1633
1708
|
if (!isNullOrUndefined(numEvents)) {
|
|
1634
1709
|
cnt = numEvents < cnt ? numEvents : cnt;
|
|
1635
1710
|
}
|
|
1636
|
-
|
|
1711
|
+
theEvents = events.splice(fromEvent, cnt);
|
|
1712
|
+
_msfpc = _getMsfpc(events);
|
|
1637
1713
|
}
|
|
1638
|
-
return
|
|
1714
|
+
return new EventBatch(iKey, theEvents);
|
|
1639
1715
|
};
|
|
1640
1716
|
}
|
|
1641
1717
|
EventBatch.create = function (iKey, theEvents) {
|
|
@@ -2005,21 +2081,6 @@
|
|
|
2005
2081
|
var EVTClockSkewManager = ClockSkewManager;
|
|
2006
2082
|
|
|
2007
2083
|
var _a;
|
|
2008
|
-
var Method = "POST";
|
|
2009
|
-
var DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
|
|
2010
|
-
var strDropped = "drop";
|
|
2011
|
-
var strSending = "send";
|
|
2012
|
-
var strRequeue = "requeue";
|
|
2013
|
-
var strResponseFail = "rspFail";
|
|
2014
|
-
var strOther = "oth";
|
|
2015
|
-
var defaultCacheControl = "no-cache, no-store";
|
|
2016
|
-
var defaultContentType = "application/x-json-stream";
|
|
2017
|
-
var strCacheControl = "cache-control";
|
|
2018
|
-
var strContentTypeHeader = "content-type";
|
|
2019
|
-
var strKillTokensHeader = "kill-tokens";
|
|
2020
|
-
var strKillDurationHeader = "kill-duration";
|
|
2021
|
-
var strKillDurationSecondsHeader = "kill-duration-seconds";
|
|
2022
|
-
var strTimeDeltaHeader = "time-delta-millis";
|
|
2023
2084
|
var _eventActionMap = (_a = {},
|
|
2024
2085
|
_a[1 ] = strRequeue,
|
|
2025
2086
|
_a[100 ] = strRequeue,
|
|
@@ -2027,6 +2088,13 @@
|
|
|
2027
2088
|
_a[8004 ] = strDropped,
|
|
2028
2089
|
_a[8003 ] = strDropped,
|
|
2029
2090
|
_a);
|
|
2091
|
+
var _collectorQsHeaders = {};
|
|
2092
|
+
var _collectorHeaderToQs = {};
|
|
2093
|
+
function _addCollectorHeaderQsMapping(qsName, headerName) {
|
|
2094
|
+
_collectorQsHeaders[qsName] = headerName;
|
|
2095
|
+
_collectorHeaderToQs[headerName] = qsName;
|
|
2096
|
+
}
|
|
2097
|
+
_addCollectorHeaderQsMapping(strMsaDeviceTicket, strMsaDeviceTicket);
|
|
2030
2098
|
function _getResponseText(xhr) {
|
|
2031
2099
|
try {
|
|
2032
2100
|
return xhr.responseText;
|
|
@@ -2053,11 +2121,21 @@
|
|
|
2053
2121
|
}
|
|
2054
2122
|
return hasHeader;
|
|
2055
2123
|
}
|
|
2124
|
+
function _addRequestDetails(details, name, value, useHeaders) {
|
|
2125
|
+
if (name && value && value.length > 0) {
|
|
2126
|
+
if (useHeaders && _collectorQsHeaders[name]) {
|
|
2127
|
+
details.hdrs[_collectorQsHeaders[name]] = value;
|
|
2128
|
+
details.useHdrs = true;
|
|
2129
|
+
}
|
|
2130
|
+
else {
|
|
2131
|
+
details.url += "&" + name + "=" + value;
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2056
2135
|
var HttpManager = /** @class */ (function () {
|
|
2057
2136
|
function HttpManager(maxEventsPerBatch, maxConnections, maxRetries, actions) {
|
|
2058
2137
|
this._responseHandlers = [];
|
|
2059
|
-
var _urlString = "?cors=true&" + strContentTypeHeader.toLowerCase() + "=" + defaultContentType
|
|
2060
|
-
+ FullVersionString;
|
|
2138
|
+
var _urlString = "?cors=true&" + strContentTypeHeader.toLowerCase() + "=" + defaultContentType;
|
|
2061
2139
|
var _killSwitch = new EVTKillSwitch();
|
|
2062
2140
|
var _paused = false;
|
|
2063
2141
|
var _clockSkewManager = new EVTClockSkewManager();
|
|
@@ -2074,6 +2152,7 @@
|
|
|
2074
2152
|
var _enableEventTimings = false;
|
|
2075
2153
|
var _cookieMgr;
|
|
2076
2154
|
var _isUnloading = false;
|
|
2155
|
+
var _useHeaders = false;
|
|
2077
2156
|
dynamicProto(HttpManager, this, function (_self) {
|
|
2078
2157
|
var _sendCredentials = true;
|
|
2079
2158
|
_self.initialize = function (endpointUrl, core, postChannel, httpInterface, channelConfig) {
|
|
@@ -2082,6 +2161,7 @@
|
|
|
2082
2161
|
channelConfig = {};
|
|
2083
2162
|
}
|
|
2084
2163
|
_urlString = endpointUrl + _urlString;
|
|
2164
|
+
_useHeaders = !isUndefined(channelConfig.avoidOptions) ? !channelConfig.avoidOptions : false;
|
|
2085
2165
|
_core = core;
|
|
2086
2166
|
_cookieMgr = core.getCookieMgr();
|
|
2087
2167
|
_enableEventTimings = !_core.config.disableEventTimings;
|
|
@@ -2190,6 +2270,8 @@
|
|
|
2190
2270
|
}
|
|
2191
2271
|
function _fetchSendPost(payload, oncomplete, sync) {
|
|
2192
2272
|
var _a;
|
|
2273
|
+
var ignoreResponse = false;
|
|
2274
|
+
var responseHandled = false;
|
|
2193
2275
|
var requestInit = (_a = {
|
|
2194
2276
|
body: payload.data,
|
|
2195
2277
|
method: Method
|
|
@@ -2198,6 +2280,9 @@
|
|
|
2198
2280
|
_a);
|
|
2199
2281
|
if (sync) {
|
|
2200
2282
|
requestInit.keepalive = true;
|
|
2283
|
+
if (payload._sendReason === 2 ) {
|
|
2284
|
+
ignoreResponse = true;
|
|
2285
|
+
}
|
|
2201
2286
|
}
|
|
2202
2287
|
if (_sendCredentials) {
|
|
2203
2288
|
requestInit.credentials = "include";
|
|
@@ -2218,11 +2303,21 @@
|
|
|
2218
2303
|
responseText = text;
|
|
2219
2304
|
});
|
|
2220
2305
|
}
|
|
2221
|
-
|
|
2222
|
-
|
|
2306
|
+
if (!responseHandled) {
|
|
2307
|
+
responseHandled = true;
|
|
2308
|
+
_doOnComplete(oncomplete, response.status, headerMap, responseText);
|
|
2309
|
+
_handleCollectorResponse(responseText);
|
|
2310
|
+
}
|
|
2223
2311
|
})["catch"](function (error) {
|
|
2224
|
-
|
|
2312
|
+
if (!responseHandled) {
|
|
2313
|
+
responseHandled = true;
|
|
2314
|
+
_doOnComplete(oncomplete, 0, {});
|
|
2315
|
+
}
|
|
2225
2316
|
});
|
|
2317
|
+
if (ignoreResponse && !responseHandled) {
|
|
2318
|
+
responseHandled = true;
|
|
2319
|
+
_doOnComplete(oncomplete, 200, {});
|
|
2320
|
+
}
|
|
2226
2321
|
}
|
|
2227
2322
|
function _xhrSendPost(payload, oncomplete, sync) {
|
|
2228
2323
|
function _appendHeader(theHeaders, xhr, name) {
|
|
@@ -2472,8 +2567,16 @@
|
|
|
2472
2567
|
_postManager.diagLog().throwInternal(LoggingSeverity.WARNING, _ExtendedInternalMessageId.CannotSerializeObject, "Unexpected Exception sending batch: " + dumpObj(ex));
|
|
2473
2568
|
}
|
|
2474
2569
|
}
|
|
2475
|
-
function
|
|
2476
|
-
var
|
|
2570
|
+
function _buildRequestDetails(thePayload, useHeaders) {
|
|
2571
|
+
var requestDetails = {
|
|
2572
|
+
url: _urlString,
|
|
2573
|
+
hdrs: {},
|
|
2574
|
+
useHdrs: false
|
|
2575
|
+
};
|
|
2576
|
+
requestDetails.hdrs = extend(requestDetails.hdrs, _headers);
|
|
2577
|
+
requestDetails.useHdrs = (objKeys(requestDetails.hdrs).length > 0);
|
|
2578
|
+
_addRequestDetails(requestDetails, strClientId, "NO_AUTH", useHeaders);
|
|
2579
|
+
_addRequestDetails(requestDetails, strClientVersion, FullVersionString, useHeaders);
|
|
2477
2580
|
var apiQsKeys = "";
|
|
2478
2581
|
arrForEach(thePayload.apiKeys, function (apiKey) {
|
|
2479
2582
|
if (apiQsKeys.length > 0) {
|
|
@@ -2481,27 +2584,25 @@
|
|
|
2481
2584
|
}
|
|
2482
2585
|
apiQsKeys += apiKey;
|
|
2483
2586
|
});
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
}
|
|
2487
|
-
urlString += "&upload-time=" + dateNow().toString();
|
|
2587
|
+
_addRequestDetails(requestDetails, strApiKey, apiQsKeys, useHeaders);
|
|
2588
|
+
_addRequestDetails(requestDetails, strUploadTime, dateNow().toString(), useHeaders);
|
|
2488
2589
|
var msfpc = _getMsfpc(thePayload);
|
|
2489
2590
|
if (isValueAssigned(msfpc)) {
|
|
2490
|
-
|
|
2591
|
+
requestDetails.url += "&ext.intweb.msfpc=" + msfpc;
|
|
2491
2592
|
}
|
|
2492
2593
|
if (_clockSkewManager.shouldAddClockSkewHeaders()) {
|
|
2493
|
-
|
|
2594
|
+
_addRequestDetails(requestDetails, strTimeDeltaToApply, _clockSkewManager.getClockSkewHeaderValue(), useHeaders);
|
|
2494
2595
|
}
|
|
2495
2596
|
if (_core.getWParam) {
|
|
2496
2597
|
var wParam = _core.getWParam();
|
|
2497
2598
|
if (wParam >= 0) {
|
|
2498
|
-
|
|
2599
|
+
requestDetails.url += "&w=" + wParam;
|
|
2499
2600
|
}
|
|
2500
2601
|
}
|
|
2501
2602
|
for (var i = 0; i < _queryStringParameters.length; i++) {
|
|
2502
|
-
|
|
2603
|
+
requestDetails.url += "&" + _queryStringParameters[i].name + "=" + _queryStringParameters[i].value;
|
|
2503
2604
|
}
|
|
2504
|
-
return
|
|
2605
|
+
return requestDetails;
|
|
2505
2606
|
}
|
|
2506
2607
|
function _canUseSendBeaconApi() {
|
|
2507
2608
|
return !_customHttpInterface && _useBeacons && isBeaconsSupported();
|
|
@@ -2512,7 +2613,17 @@
|
|
|
2512
2613
|
}
|
|
2513
2614
|
function _doPayloadSend(thePayload, serializationStart, serializationCompleted, sendReason) {
|
|
2514
2615
|
if (thePayload && thePayload.payloadBlob && thePayload.payloadBlob.length > 0) {
|
|
2515
|
-
var
|
|
2616
|
+
var useSendHook_1 = !!_self.sendHook;
|
|
2617
|
+
var sendInterface_1 = _sendInterfaces[thePayload.sendType];
|
|
2618
|
+
if (!_isBeaconPayload(thePayload.sendType) && thePayload.isBeacon && thePayload.sendReason === 2 ) {
|
|
2619
|
+
sendInterface_1 = _sendInterfaces[2 ] || _sendInterfaces[3 ] || sendInterface_1;
|
|
2620
|
+
}
|
|
2621
|
+
var useHeaders_1 = _useHeaders;
|
|
2622
|
+
if (thePayload.isBeacon || sendInterface_1._transport === 3 ) {
|
|
2623
|
+
useHeaders_1 = false;
|
|
2624
|
+
}
|
|
2625
|
+
var requestDetails_1 = _buildRequestDetails(thePayload, useHeaders_1);
|
|
2626
|
+
useHeaders_1 = useHeaders_1 || requestDetails_1.useHdrs;
|
|
2516
2627
|
var sendEventStart_1 = getTime();
|
|
2517
2628
|
var strSendAttempt_1 = "sendAttempt";
|
|
2518
2629
|
doPerf(_core, function () { return "HttpManager:_doPayloadSend"; }, function () {
|
|
@@ -2533,24 +2644,21 @@
|
|
|
2533
2644
|
_sendBatchesNotification(thePayload.batches, (1000 + (sendReason || 0 )), thePayload.sendType, true);
|
|
2534
2645
|
var orgPayloadData = {
|
|
2535
2646
|
data: thePayload.payloadBlob,
|
|
2536
|
-
urlString:
|
|
2537
|
-
headers:
|
|
2647
|
+
urlString: requestDetails_1.url,
|
|
2648
|
+
headers: requestDetails_1.hdrs,
|
|
2538
2649
|
_thePayload: thePayload,
|
|
2539
2650
|
_sendReason: sendReason
|
|
2540
2651
|
};
|
|
2541
|
-
if (
|
|
2542
|
-
orgPayloadData.headers
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
orgPayloadData.headers
|
|
2652
|
+
if (useHeaders_1) {
|
|
2653
|
+
if (!_hasHeader(orgPayloadData.headers, strCacheControl)) {
|
|
2654
|
+
orgPayloadData.headers[strCacheControl] = defaultCacheControl;
|
|
2655
|
+
}
|
|
2656
|
+
if (!_hasHeader(orgPayloadData.headers, strContentTypeHeader)) {
|
|
2657
|
+
orgPayloadData.headers[strContentTypeHeader] = defaultContentType;
|
|
2658
|
+
}
|
|
2546
2659
|
}
|
|
2547
2660
|
var sender = null;
|
|
2548
|
-
|
|
2549
|
-
var sendInterface = _sendInterfaces[thePayload.sendType];
|
|
2550
|
-
if (!_isBeaconPayload(thePayload.sendType) && thePayload.isBeacon && thePayload.sendReason === 2 ) {
|
|
2551
|
-
sendInterface = _sendInterfaces[2 ] || _sendInterfaces[3 ] || sendInterface;
|
|
2552
|
-
}
|
|
2553
|
-
if (sendInterface) {
|
|
2661
|
+
if (sendInterface_1) {
|
|
2554
2662
|
sender = function (payload) {
|
|
2555
2663
|
_clockSkewManager.firstRequestSent();
|
|
2556
2664
|
var onComplete = function (status, headers) {
|
|
@@ -2558,7 +2666,7 @@
|
|
|
2558
2666
|
};
|
|
2559
2667
|
var isSync = thePayload.isTeardown || thePayload.isSync;
|
|
2560
2668
|
try {
|
|
2561
|
-
|
|
2669
|
+
sendInterface_1.sendPOST(payload, onComplete, isSync);
|
|
2562
2670
|
if (_self.sendListener) {
|
|
2563
2671
|
_self.sendListener(orgPayloadData, payload, isSync, thePayload.isBeacon);
|
|
2564
2672
|
}
|
|
@@ -2574,7 +2682,7 @@
|
|
|
2574
2682
|
if (thePayload.sendType === 0 ) {
|
|
2575
2683
|
_outstandingRequests++;
|
|
2576
2684
|
}
|
|
2577
|
-
if (
|
|
2685
|
+
if (useSendHook_1 && !thePayload.isBeacon && sendInterface_1._transport !== 3 ) {
|
|
2578
2686
|
var hookData_1 = {
|
|
2579
2687
|
data: orgPayloadData.data,
|
|
2580
2688
|
urlString: orgPayloadData.urlString,
|
|
@@ -2741,12 +2849,9 @@
|
|
|
2741
2849
|
}
|
|
2742
2850
|
function _getMsfpc(thePayload) {
|
|
2743
2851
|
for (var lp = 0; lp < thePayload.batches.length; lp++) {
|
|
2744
|
-
var
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
if (isValueAssigned(intWeb["msfpc"])) {
|
|
2748
|
-
return encodeURIComponent(intWeb["msfpc"]);
|
|
2749
|
-
}
|
|
2852
|
+
var msfpc = thePayload.batches[lp].Msfpc();
|
|
2853
|
+
if (msfpc) {
|
|
2854
|
+
return encodeURIComponent(msfpc);
|
|
2750
2855
|
}
|
|
2751
2856
|
}
|
|
2752
2857
|
return "";
|
|
@@ -2764,8 +2869,8 @@
|
|
|
2764
2869
|
}
|
|
2765
2870
|
if (responseText) {
|
|
2766
2871
|
var response = JSON.parse(responseText);
|
|
2767
|
-
if (isValueAssigned(response.webResult) && isValueAssigned(response.webResult
|
|
2768
|
-
_cookieMgr.set("MSFPC", response.webResult
|
|
2872
|
+
if (isValueAssigned(response.webResult) && isValueAssigned(response.webResult[strMsfpc])) {
|
|
2873
|
+
_cookieMgr.set("MSFPC", response.webResult[strMsfpc], 365 * 86400);
|
|
2769
2874
|
}
|
|
2770
2875
|
}
|
|
2771
2876
|
}
|
|
@@ -2810,7 +2915,6 @@
|
|
|
2810
2915
|
}
|
|
2811
2916
|
return HttpManager;
|
|
2812
2917
|
}());
|
|
2813
|
-
var HttpManager$1 = HttpManager;
|
|
2814
2918
|
|
|
2815
2919
|
var FlushCheckTimer = 0.250;
|
|
2816
2920
|
var MaxNumberEventPerBatch = 500;
|
|
@@ -2828,7 +2932,7 @@
|
|
|
2828
2932
|
var _this = _super.call(this) || this;
|
|
2829
2933
|
_this.identifier = "PostChannel";
|
|
2830
2934
|
_this.priority = 1011;
|
|
2831
|
-
_this.version = '3.1.
|
|
2935
|
+
_this.version = '3.1.10';
|
|
2832
2936
|
var _config;
|
|
2833
2937
|
var _isTeardownCalled = false;
|
|
2834
2938
|
var _flushCallbackQueue = [];
|
|
@@ -2857,7 +2961,7 @@
|
|
|
2857
2961
|
_initializeProfiles();
|
|
2858
2962
|
_clearQueues();
|
|
2859
2963
|
_setAutoLimits();
|
|
2860
|
-
_httpManager = new HttpManager
|
|
2964
|
+
_httpManager = new HttpManager(MaxNumberEventPerBatch, MaxConnections, MaxRetries, {
|
|
2861
2965
|
requeue: _requeueEvents,
|
|
2862
2966
|
send: _sendingEvent,
|
|
2863
2967
|
sent: _eventsSentEvent,
|
|
@@ -3101,7 +3205,7 @@
|
|
|
3101
3205
|
}
|
|
3102
3206
|
};
|
|
3103
3207
|
_self.setMsaAuthTicket = function (ticket) {
|
|
3104
|
-
_httpManager.addHeader(
|
|
3208
|
+
_httpManager.addHeader(strMsaDeviceTicket, ticket);
|
|
3105
3209
|
};
|
|
3106
3210
|
_self.hasEvents = _hasEvents;
|
|
3107
3211
|
_self._setTransmitProfile = function (profileName) {
|
|
@@ -3238,7 +3342,7 @@
|
|
|
3238
3342
|
}
|
|
3239
3343
|
var latency = event.latency;
|
|
3240
3344
|
var eventBatch = _getEventBatch(event.iKey, latency, true);
|
|
3241
|
-
if (eventBatch.
|
|
3345
|
+
if (eventBatch.addEvent(event)) {
|
|
3242
3346
|
if (latency !== EventLatency.Immediate) {
|
|
3243
3347
|
_queueSize++;
|
|
3244
3348
|
if (append && event.sendAttempt === 0) {
|
|
@@ -3488,4 +3592,4 @@
|
|
|
3488
3592
|
(function(obj, prop, descriptor) { /* ai_es3_polyfil defineProperty */ var func = Object["defineProperty"]; if (func) { try { return func(obj, prop, descriptor); } catch(e) { /* IE8 defines defineProperty, but will throw */ } } if (descriptor && typeof descriptor.value !== undefined) { obj[prop] = descriptor.value; } return obj; })(exports, '__esModule', { value: true });
|
|
3489
3593
|
|
|
3490
3594
|
})(this.oneDS = this.oneDS || {});
|
|
3491
|
-
//# sourceMappingURL=ms.post-3.1.
|
|
3595
|
+
//# sourceMappingURL=ms.post-3.1.10.gbl.js.map
|