@mparticle/web-sdk 2.43.2 → 2.43.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.
- package/dist/mparticle.common.js +3 -2
- package/dist/mparticle.esm.js +3 -2
- package/dist/mparticle.js +17 -2
- package/package.json +1 -1
- package/src/batchUploader.ts +24 -2
package/dist/mparticle.common.js
CHANGED
|
@@ -15,7 +15,7 @@ map:function map(a,b){var c,d,e;if(null===this)throw new TypeError(" this is nul
|
|
|
15
15
|
filter:function filter(a/*, thisArg*/){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=2<=arguments.length?arguments[1]:void 0,f=0;f<c;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g);}return d},// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
|
|
16
16
|
isArray:function isArray(a){return "[object Array]"===Object.prototype.toString.call(a)},Base64:Base64$1};
|
|
17
17
|
|
|
18
|
-
var version = "2.43.
|
|
18
|
+
var version = "2.43.3";
|
|
19
19
|
|
|
20
20
|
var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodIsDeprecatedPostfix:"is a deprecated method and will be removed in future releases",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",AddToCart:"addToCart",RemoveFromCart:"removeFromCart",ClearCart:"clearCart",LogOut:"logOut",SetUserAttributeList:"setUserAttributeList",RemoveAllUserAttributes:"removeAllUserAttributes",GetUserAttributesLists:"getUserAttributesLists",GetAllUserAttributes:"getAllUserAttributes",Identify:"identify",Logout:"logout",Login:"login",Modify:"modify",Alias:"aliasUsers",Upload:"upload"},StorageNames:{localStorageName:"mprtcl-api",localStorageNameV3:"mprtcl-v3",cookieName:"mprtcl-api",cookieNameV2:"mprtcl-v2",cookieNameV3:"mprtcl-v3",localStorageNameV4:"mprtcl-v4",localStorageProductsV4:"mprtcl-prodv4",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4",currentStorageProductsName:"mprtcl-prodv4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,maxProducts:20,forwarderStatsTimeout:5e3,integrationDelayTimeout:5e3,maxCookieSize:3e3,aliasMaxWindow:90,uploadInterval:0// Maximum milliseconds in between batch uploads, below 500 will mean immediate upload. The server returns this as a string, but we are using it as a number internally
|
|
21
21
|
},DefaultBaseUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/",userAudienceUrl:"nativesdks.mparticle.com/v1/"},// These are the paths that are used to construct the CNAME urls
|
|
@@ -444,7 +444,8 @@ function appendUserInfo(a,b){if(b){if(!a)return b.MPID=null,b.ConsentState=null,
|
|
|
444
444
|
// TODO: Handle cases where Local Storage is unavailable
|
|
445
445
|
// Potentially shared between Vault and Persistence as well
|
|
446
446
|
// https://go.mparticle.com/work/SQDSDKS-5022
|
|
447
|
-
return e>=f},a.prototype.shouldDebounceAndUpdateLastASTTime=function(){var a=Date.now();return !!(a-this.lastASTEventTime<this.AST_DEBOUNCE_MS)||(this.lastASTEventTime=a,!1)},a.prototype.createBackgroundASTEvent=function(){var a=Date.now(),b=this.mpInstance,c=b._Store,d=b.Identity,e=b._timeOnSiteTimer,f=b._Helpers,g=c.sessionId,h=c.deviceId,i=c.sessionStartDate,j=c.SDKConfig,k=f.generateUniqueId,l=d.getCurrentUser,
|
|
447
|
+
return e>=f},a.prototype.shouldDebounceAndUpdateLastASTTime=function(){var a=Date.now();return !!(a-this.lastASTEventTime<this.AST_DEBOUNCE_MS)||(this.lastASTEventTime=a,!1)},a.prototype.createBackgroundASTEvent=function(){var a=Date.now(),b=this.mpInstance,c=b._Store,d=b.Identity,e=b._timeOnSiteTimer,f=b._Helpers,g=c.sessionId,h=c.deviceId,i=c.sessionStartDate,j=c.SDKConfig,k=f.generateUniqueId,l=f.getFeatureFlag,m=d.getCurrentUser,n={AppName:j.appName,AppVersion:j.appVersion,Package:j["package"],EventDataType:MessageType$1.AppStateTransition,Timestamp:a,SessionId:g,DeviceId:h,IsFirstRun:!1,SourceMessageId:k(),SDKVersion:Constants.sdkVersion,CustomFlags:{},EventAttributes:{},SessionStartDate:(null===i||void 0===i?void 0:i.getTime())||a,Debug:j.isDevelopmentMode,ActiveTimeOnSite:(null===e||void 0===e?void 0:e.getTimeInForeground())||0,IsBackgroundAST:!0},o=__assign({},n.CustomFlags),p=c.integrationAttributes;// https://go.mparticle.com/work/SQDSDKS-5053
|
|
448
|
+
if(l&&l(Constants.FeatureFlags.CaptureIntegrationSpecificIds)){this.mpInstance._IntegrationCapture.capture();var q=this.mpInstance._IntegrationCapture.getClickIdsAsCustomFlags();o=__assign(__assign({},q),o);var r=this.mpInstance._IntegrationCapture.getClickIdsAsIntegrationAttributes();p=__assign(__assign({},r),p);}return n.CustomFlags=o,n.IntegrationAttributes=p,appendUserInfo(m(),n),n},a.prototype.addEventListeners=function(){var a=this,b=this,c=function(){// Check for debounce before creating and queueing event
|
|
448
449
|
var c=a.mpInstance._Helpers.getFeatureFlag,d=Constants.FeatureFlags.AstBackgroundEvents;if(c(d)){if(b.shouldDebounceAndUpdateLastASTTime())return;// Add application state transition event to queue
|
|
449
450
|
var e=b.createBackgroundASTEvent();b.queueEvent(e);}// Then trigger the upload with beacon
|
|
450
451
|
b.prepareAndUpload(!1,b.isBeaconAvailable());};document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&c();}),window.addEventListener("beforeunload",c),window.addEventListener("pagehide",c);},a.prototype.isBeaconAvailable=function(){return !!navigator.sendBeacon},a.prototype.triggerUploadInterval=function(a,b){var c=this;void 0===a&&(a=!1),void 0===b&&(b=!1),setTimeout(function(){c.prepareAndUpload(a,b);},this.uploadIntervalMillis);},a.prototype.queueEvent=function(a){if(!isEmpty(a)){var b=this.mpInstance.Logger.verbose;this.eventsQueuedForProcessing.push(a),this.offlineStorageEnabled&&this.eventVault&&this.eventVault.store(this.eventsQueuedForProcessing),b("Queuing event: ".concat(JSON.stringify(a))),b("Queued event count: ".concat(this.eventsQueuedForProcessing.length)),this.shouldTriggerImmediateUpload(a.EventDataType)&&this.prepareAndUpload(!1,!1);}},a.prototype.shouldTriggerImmediateUpload=function(a){var b=[MessageType$1.Commerce,MessageType$1.UserIdentityChange];return !this.batchingEnabled||b.includes(a)},(a.createNewBatches=function(a,b,c){if(!b||!a||!a.length)return null;//bucket by MPID, and then by session, ordered by timestamp
|
package/dist/mparticle.esm.js
CHANGED
|
@@ -15,7 +15,7 @@ map:function map(a,b){var c,d,e;if(null===this)throw new TypeError(" this is nul
|
|
|
15
15
|
filter:function filter(a/*, thisArg*/){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=2<=arguments.length?arguments[1]:void 0,f=0;f<c;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g);}return d},// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
|
|
16
16
|
isArray:function isArray(a){return "[object Array]"===Object.prototype.toString.call(a)},Base64:Base64$1};
|
|
17
17
|
|
|
18
|
-
var version = "2.43.
|
|
18
|
+
var version = "2.43.3";
|
|
19
19
|
|
|
20
20
|
var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodIsDeprecatedPostfix:"is a deprecated method and will be removed in future releases",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",AddToCart:"addToCart",RemoveFromCart:"removeFromCart",ClearCart:"clearCart",LogOut:"logOut",SetUserAttributeList:"setUserAttributeList",RemoveAllUserAttributes:"removeAllUserAttributes",GetUserAttributesLists:"getUserAttributesLists",GetAllUserAttributes:"getAllUserAttributes",Identify:"identify",Logout:"logout",Login:"login",Modify:"modify",Alias:"aliasUsers",Upload:"upload"},StorageNames:{localStorageName:"mprtcl-api",localStorageNameV3:"mprtcl-v3",cookieName:"mprtcl-api",cookieNameV2:"mprtcl-v2",cookieNameV3:"mprtcl-v3",localStorageNameV4:"mprtcl-v4",localStorageProductsV4:"mprtcl-prodv4",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4",currentStorageProductsName:"mprtcl-prodv4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,maxProducts:20,forwarderStatsTimeout:5e3,integrationDelayTimeout:5e3,maxCookieSize:3e3,aliasMaxWindow:90,uploadInterval:0// Maximum milliseconds in between batch uploads, below 500 will mean immediate upload. The server returns this as a string, but we are using it as a number internally
|
|
21
21
|
},DefaultBaseUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/",userAudienceUrl:"nativesdks.mparticle.com/v1/"},// These are the paths that are used to construct the CNAME urls
|
|
@@ -444,7 +444,8 @@ function appendUserInfo(a,b){if(b){if(!a)return b.MPID=null,b.ConsentState=null,
|
|
|
444
444
|
// TODO: Handle cases where Local Storage is unavailable
|
|
445
445
|
// Potentially shared between Vault and Persistence as well
|
|
446
446
|
// https://go.mparticle.com/work/SQDSDKS-5022
|
|
447
|
-
return e>=f},a.prototype.shouldDebounceAndUpdateLastASTTime=function(){var a=Date.now();return !!(a-this.lastASTEventTime<this.AST_DEBOUNCE_MS)||(this.lastASTEventTime=a,!1)},a.prototype.createBackgroundASTEvent=function(){var a=Date.now(),b=this.mpInstance,c=b._Store,d=b.Identity,e=b._timeOnSiteTimer,f=b._Helpers,g=c.sessionId,h=c.deviceId,i=c.sessionStartDate,j=c.SDKConfig,k=f.generateUniqueId,l=d.getCurrentUser,
|
|
447
|
+
return e>=f},a.prototype.shouldDebounceAndUpdateLastASTTime=function(){var a=Date.now();return !!(a-this.lastASTEventTime<this.AST_DEBOUNCE_MS)||(this.lastASTEventTime=a,!1)},a.prototype.createBackgroundASTEvent=function(){var a=Date.now(),b=this.mpInstance,c=b._Store,d=b.Identity,e=b._timeOnSiteTimer,f=b._Helpers,g=c.sessionId,h=c.deviceId,i=c.sessionStartDate,j=c.SDKConfig,k=f.generateUniqueId,l=f.getFeatureFlag,m=d.getCurrentUser,n={AppName:j.appName,AppVersion:j.appVersion,Package:j["package"],EventDataType:MessageType$1.AppStateTransition,Timestamp:a,SessionId:g,DeviceId:h,IsFirstRun:!1,SourceMessageId:k(),SDKVersion:Constants.sdkVersion,CustomFlags:{},EventAttributes:{},SessionStartDate:(null===i||void 0===i?void 0:i.getTime())||a,Debug:j.isDevelopmentMode,ActiveTimeOnSite:(null===e||void 0===e?void 0:e.getTimeInForeground())||0,IsBackgroundAST:!0},o=__assign({},n.CustomFlags),p=c.integrationAttributes;// https://go.mparticle.com/work/SQDSDKS-5053
|
|
448
|
+
if(l&&l(Constants.FeatureFlags.CaptureIntegrationSpecificIds)){this.mpInstance._IntegrationCapture.capture();var q=this.mpInstance._IntegrationCapture.getClickIdsAsCustomFlags();o=__assign(__assign({},q),o);var r=this.mpInstance._IntegrationCapture.getClickIdsAsIntegrationAttributes();p=__assign(__assign({},r),p);}return n.CustomFlags=o,n.IntegrationAttributes=p,appendUserInfo(m(),n),n},a.prototype.addEventListeners=function(){var a=this,b=this,c=function(){// Check for debounce before creating and queueing event
|
|
448
449
|
var c=a.mpInstance._Helpers.getFeatureFlag,d=Constants.FeatureFlags.AstBackgroundEvents;if(c(d)){if(b.shouldDebounceAndUpdateLastASTTime())return;// Add application state transition event to queue
|
|
449
450
|
var e=b.createBackgroundASTEvent();b.queueEvent(e);}// Then trigger the upload with beacon
|
|
450
451
|
b.prepareAndUpload(!1,b.isBeaconAvailable());};document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&c();}),window.addEventListener("beforeunload",c),window.addEventListener("pagehide",c);},a.prototype.isBeaconAvailable=function(){return !!navigator.sendBeacon},a.prototype.triggerUploadInterval=function(a,b){var c=this;void 0===a&&(a=!1),void 0===b&&(b=!1),setTimeout(function(){c.prepareAndUpload(a,b);},this.uploadIntervalMillis);},a.prototype.queueEvent=function(a){if(!isEmpty(a)){var b=this.mpInstance.Logger.verbose;this.eventsQueuedForProcessing.push(a),this.offlineStorageEnabled&&this.eventVault&&this.eventVault.store(this.eventsQueuedForProcessing),b("Queuing event: ".concat(JSON.stringify(a))),b("Queued event count: ".concat(this.eventsQueuedForProcessing.length)),this.shouldTriggerImmediateUpload(a.EventDataType)&&this.prepareAndUpload(!1,!1);}},a.prototype.shouldTriggerImmediateUpload=function(a){var b=[MessageType$1.Commerce,MessageType$1.UserIdentityChange];return !this.batchingEnabled||b.includes(a)},(a.createNewBatches=function(a,b,c){if(!b||!a||!a.length)return null;//bucket by MPID, and then by session, ordered by timestamp
|
package/dist/mparticle.js
CHANGED
|
@@ -203,7 +203,7 @@ var mParticle = (function () {
|
|
|
203
203
|
Base64: Base64$1
|
|
204
204
|
};
|
|
205
205
|
|
|
206
|
-
var version = "2.43.
|
|
206
|
+
var version = "2.43.3";
|
|
207
207
|
|
|
208
208
|
var Constants = {
|
|
209
209
|
sdkVersion: version,
|
|
@@ -2391,7 +2391,8 @@ var mParticle = (function () {
|
|
|
2391
2391
|
deviceId = _Store.deviceId,
|
|
2392
2392
|
sessionStartDate = _Store.sessionStartDate,
|
|
2393
2393
|
SDKConfig = _Store.SDKConfig;
|
|
2394
|
-
var generateUniqueId = _Helpers.generateUniqueId
|
|
2394
|
+
var generateUniqueId = _Helpers.generateUniqueId,
|
|
2395
|
+
getFeatureFlag = _Helpers.getFeatureFlag;
|
|
2395
2396
|
var getCurrentUser = Identity.getCurrentUser;
|
|
2396
2397
|
var event = {
|
|
2397
2398
|
AppName: SDKConfig.appName,
|
|
@@ -2411,6 +2412,20 @@ var mParticle = (function () {
|
|
|
2411
2412
|
ActiveTimeOnSite: (_timeOnSiteTimer === null || _timeOnSiteTimer === void 0 ? void 0 : _timeOnSiteTimer.getTimeInForeground()) || 0,
|
|
2412
2413
|
IsBackgroundAST: true
|
|
2413
2414
|
};
|
|
2415
|
+
var customFlags = __assign({}, event.CustomFlags);
|
|
2416
|
+
var integrationAttributes = _Store.integrationAttributes;
|
|
2417
|
+
// https://go.mparticle.com/work/SQDSDKS-5053
|
|
2418
|
+
if (getFeatureFlag && getFeatureFlag(Constants.FeatureFlags.CaptureIntegrationSpecificIds)) {
|
|
2419
|
+
// Attempt to recapture click IDs in case a third party integration
|
|
2420
|
+
// has added or updated new click IDs since the last event was sent.
|
|
2421
|
+
this.mpInstance._IntegrationCapture.capture();
|
|
2422
|
+
var transformedClickIDs = this.mpInstance._IntegrationCapture.getClickIdsAsCustomFlags();
|
|
2423
|
+
customFlags = __assign(__assign({}, transformedClickIDs), customFlags);
|
|
2424
|
+
var transformedIntegrationAttributes = this.mpInstance._IntegrationCapture.getClickIdsAsIntegrationAttributes();
|
|
2425
|
+
integrationAttributes = __assign(__assign({}, transformedIntegrationAttributes), integrationAttributes);
|
|
2426
|
+
}
|
|
2427
|
+
event.CustomFlags = customFlags;
|
|
2428
|
+
event.IntegrationAttributes = integrationAttributes;
|
|
2414
2429
|
appendUserInfo(getCurrentUser(), event);
|
|
2415
2430
|
return event;
|
|
2416
2431
|
};
|
package/package.json
CHANGED
package/src/batchUploader.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Batch } from '@mparticle/event-models';
|
|
2
2
|
import Constants from './constants';
|
|
3
|
-
import { SDKEvent, SDKLoggerApi } from './sdkRuntimeModels';
|
|
3
|
+
import { SDKEvent, SDKEventCustomFlags, SDKLoggerApi } from './sdkRuntimeModels';
|
|
4
4
|
import { convertEvents } from './sdkToEventsApiConverter';
|
|
5
5
|
import { MessageType, EventType } from './types';
|
|
6
6
|
import { getRampNumber, isEmpty } from './utils';
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import { IMParticleUser } from './identity-user-interfaces';
|
|
15
15
|
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
16
16
|
import { appendUserInfo } from './user-utils';
|
|
17
|
+
import { IntegrationAttributes } from './store';
|
|
17
18
|
/**
|
|
18
19
|
* BatchUploader contains all the logic to store/retrieve events and batches
|
|
19
20
|
* to/from persistence, and upload batches to mParticle.
|
|
@@ -147,7 +148,7 @@ export class BatchUploader {
|
|
|
147
148
|
const now = Date.now();
|
|
148
149
|
const { _Store, Identity, _timeOnSiteTimer, _Helpers } = this.mpInstance;
|
|
149
150
|
const { sessionId, deviceId, sessionStartDate, SDKConfig } = _Store;
|
|
150
|
-
const { generateUniqueId } = _Helpers;
|
|
151
|
+
const { generateUniqueId, getFeatureFlag } = _Helpers;
|
|
151
152
|
const { getCurrentUser } = Identity;
|
|
152
153
|
|
|
153
154
|
const event = {
|
|
@@ -169,7 +170,28 @@ export class BatchUploader {
|
|
|
169
170
|
IsBackgroundAST: true
|
|
170
171
|
} as SDKEvent;
|
|
171
172
|
|
|
173
|
+
|
|
174
|
+
let customFlags: SDKEventCustomFlags = {...event.CustomFlags};
|
|
175
|
+
let integrationAttributes: IntegrationAttributes = _Store.integrationAttributes;
|
|
176
|
+
|
|
177
|
+
// https://go.mparticle.com/work/SQDSDKS-5053
|
|
178
|
+
if (getFeatureFlag && getFeatureFlag(Constants.FeatureFlags.CaptureIntegrationSpecificIds)) {
|
|
179
|
+
|
|
180
|
+
// Attempt to recapture click IDs in case a third party integration
|
|
181
|
+
// has added or updated new click IDs since the last event was sent.
|
|
182
|
+
this.mpInstance._IntegrationCapture.capture();
|
|
183
|
+
const transformedClickIDs = this.mpInstance._IntegrationCapture.getClickIdsAsCustomFlags();
|
|
184
|
+
customFlags = {...transformedClickIDs, ...customFlags};
|
|
185
|
+
|
|
186
|
+
const transformedIntegrationAttributes = this.mpInstance._IntegrationCapture.getClickIdsAsIntegrationAttributes();
|
|
187
|
+
integrationAttributes = {...transformedIntegrationAttributes, ...integrationAttributes};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
event.CustomFlags = customFlags;
|
|
191
|
+
event.IntegrationAttributes = integrationAttributes;
|
|
192
|
+
|
|
172
193
|
appendUserInfo(getCurrentUser(), event);
|
|
194
|
+
|
|
173
195
|
return event;
|
|
174
196
|
}
|
|
175
197
|
|