@mparticle/web-sdk 2.54.1 → 2.56.0
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 +6 -6
- package/dist/mparticle.esm.js +6 -6
- package/dist/mparticle.js +52 -24
- package/package.json +1 -1
- package/src/identityApiClient.ts +14 -0
- package/src/roktManager.ts +11 -1
- package/src/store.ts +2 -0
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.
|
|
18
|
+
var version = "2.56.0";
|
|
19
19
|
|
|
20
20
|
var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodHasBeenDeprecated:"has been deprecated.",MethodMarkedForDeprecationPostfix:"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
|
|
@@ -580,7 +580,7 @@ document.addEventListener("visibilitychange",function(){return a.handleVisibilit
|
|
|
580
580
|
|
|
581
581
|
function createSDKConfig(a){// TODO: Refactor to create a default config object
|
|
582
582
|
var b={};for(var c in Constants.DefaultConfig)Constants.DefaultConfig.hasOwnProperty(c)&&(b[c]=Constants.DefaultConfig[c]);if(a)for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);for(var c in Constants.DefaultBaseUrls)b[c]=Constants.DefaultBaseUrls[c];return b}// TODO: Merge this with SDKStoreApi in sdkRuntimeModels
|
|
583
|
-
function Store(a,b,c){var d=this,e=b._Helpers.createMainStorageName,f=b._NativeSdkHelpers.isWebviewEnabled,g={isEnabled:!0,sessionAttributes:{},localSessionAttributes:{},currentSessionMPIDs:[],consentState:null,sessionId:null,isFirstRun:null,clientId:null,deviceId:null,devToken:null,serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:null,configurationLoaded:!1,identityCallInFlight:!1,SDKConfig:{},nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,storageName:null,activeForwarders:[],kits:{},sideloadedKits:[],configuredForwarders:[],pixelConfigurations:[],wrapperSDKInfo:{name:"none",version:null,isInfoSet:!1},// Placeholder for in-memory persistence model
|
|
583
|
+
function Store(a,b,c){var d=this,e=b._Helpers.createMainStorageName,f=b._NativeSdkHelpers.isWebviewEnabled,g={isEnabled:!0,sessionAttributes:{},localSessionAttributes:{},currentSessionMPIDs:[],consentState:null,sessionId:null,isFirstRun:null,clientId:null,deviceId:null,devToken:null,serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:null,configurationLoaded:!1,identityCallInFlight:!1,identifyRequestCount:0,SDKConfig:{},nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,storageName:null,activeForwarders:[],kits:{},sideloadedKits:[],configuredForwarders:[],pixelConfigurations:[],wrapperSDKInfo:{name:"none",version:null,isInfoSet:!1},// Placeholder for in-memory persistence model
|
|
584
584
|
persistenceData:{gs:{}}};for(var h in g)this[h]=g[h];if(this.devToken=c||null,this.integrationDelayTimeoutStart=Date.now(),this.SDKConfig=createSDKConfig(a),a){a.hasOwnProperty("flags")||(this.SDKConfig.flags={}),this.SDKConfig.flags=processFlags(a),a.deviceId&&(this.deviceId=a.deviceId),this.SDKConfig.isDevelopmentMode=!!a.hasOwnProperty("isDevelopmentMode")&&returnConvertedBoolean(a.isDevelopmentMode);var i=processBaseUrls(a,this.SDKConfig.flags,c);for(var j in i)this.SDKConfig[j]=i[j];if(a.hasOwnProperty("logLevel")&&(this.SDKConfig.logLevel=a.logLevel),this.SDKConfig.useNativeSdk=!!a.useNativeSdk,this.SDKConfig.kits=a.kits||{},this.SDKConfig.sideloadedKits=a.sideloadedKits||[],this.SDKConfig.isIOS=a.hasOwnProperty("isIOS")?a.isIOS:!!(window.mParticle&&window.mParticle.isIOS)&&window.mParticle.isIOS,this.SDKConfig.useCookieStorage=!!a.hasOwnProperty("useCookieStorage")&&a.useCookieStorage,this.SDKConfig.maxProducts=a.hasOwnProperty("maxProducts")?a.maxProducts:Constants.DefaultConfig.maxProducts,this.SDKConfig.maxCookieSize=a.hasOwnProperty("maxCookieSize")?a.maxCookieSize:Constants.DefaultConfig.maxCookieSize,a.hasOwnProperty("appName")&&(this.SDKConfig.appName=a.appName),a.hasOwnProperty("package")&&(this.SDKConfig["package"]=a["package"]),this.SDKConfig.integrationDelayTimeout=a.hasOwnProperty("integrationDelayTimeout")?a.integrationDelayTimeout:Constants.DefaultConfig.integrationDelayTimeout,a.hasOwnProperty("identifyRequest")&&(this.SDKConfig.identifyRequest=a.identifyRequest),a.hasOwnProperty("identityCallback")){var k=a.identityCallback;b._Helpers.Validators.isFunction(k)?this.SDKConfig.identityCallback=a.identityCallback:b.Logger.warning("The optional callback must be a function. You tried entering a(n) "+_typeof$1(k)+" . Callback not set. Please set your callback again.");}if(a.hasOwnProperty("appVersion")&&(this.SDKConfig.appVersion=a.appVersion),a.hasOwnProperty("appName")&&(this.SDKConfig.appName=a.appName),a.hasOwnProperty("sessionTimeout")&&(this.SDKConfig.sessionTimeout=a.sessionTimeout),a.hasOwnProperty("dataPlan")){this.SDKConfig.dataPlan={PlanVersion:null,PlanId:null};var l=a.dataPlan;l.planId&&(isDataPlanSlug(l.planId)?this.SDKConfig.dataPlan.PlanId=l.planId:b.Logger.error("Your data plan id must be a string and match the data plan slug format (i.e. under_case_slug)")),l.planVersion&&(isNumber(l.planVersion)?this.SDKConfig.dataPlan.PlanVersion=l.planVersion:b.Logger.error("Your data plan version must be a number"));}else this.SDKConfig.dataPlan={};if(this.SDKConfig.forceHttps=!a.hasOwnProperty("forceHttps")||a.forceHttps,this.SDKConfig.customFlags=a.customFlags||{},this.SDKConfig.minWebviewBridgeVersion=a.hasOwnProperty("minWebviewBridgeVersion")?a.minWebviewBridgeVersion:1,this.SDKConfig.aliasMaxWindow=a.hasOwnProperty("aliasMaxWindow")?a.aliasMaxWindow:Constants.DefaultConfig.aliasMaxWindow,a.hasOwnProperty("dataPlanOptions")){var m=a.dataPlanOptions;m.hasOwnProperty("dataPlanVersion")&&m.hasOwnProperty("blockUserAttributes")&&m.hasOwnProperty("blockEventAttributes")&&m.hasOwnProperty("blockEvents")&&m.hasOwnProperty("blockUserIdentities")||b.Logger.error("Ensure your config.dataPlanOptions object has the following keys: a \"dataPlanVersion\" object, and \"blockUserAttributes\", \"blockEventAttributes\", \"blockEvents\", \"blockUserIdentities\" booleans");}a.hasOwnProperty("onCreateBatch")&&("function"==typeof a.onCreateBatch?this.SDKConfig.onCreateBatch=a.onCreateBatch:(b.Logger.error("config.onCreateBatch must be a function"),this.SDKConfig.onCreateBatch=void 0));}this._getFromPersistence=function(a,b){return a?(d.syncPersistenceData(),d.persistenceData&&d.persistenceData[a]&&d.persistenceData[a][b]?d.persistenceData[a][b]:null):null},this._setPersistence=function(a,c,e){var f;a&&(d.syncPersistenceData(),d.persistenceData&&(d.persistenceData[a]?d.persistenceData[a][c]=e:d.persistenceData[a]=(f={},f[c]=e,f),isObject(d.persistenceData[a][c])&&isEmpty(d.persistenceData[a][c])&&delete d.persistenceData[a][c],b._Persistence.savePersistence(d.persistenceData)));},this.hasInvalidIdentifyRequest=function(){var a=d.SDKConfig.identifyRequest;return isObject(a)&&isObject(a.userIdentities)&&isEmpty(a.userIdentities)||!a},this.getConsentState=function(a){var c=b._Consent.ConsentSerialization.fromMinifiedJsonObject,e=d._getFromPersistence(a,"con");return isEmpty(e)?null:c(e)},this.setConsentState=function(a,c){var e=b._Consent.ConsentSerialization.toMinifiedJsonObject;// If ConsentState is null, we assume the intent is to clear out the consent state
|
|
585
585
|
(c||null===c)&&d._setPersistence(a,"con",e(c));},this.getDeviceId=function(){return d.deviceId},this.setDeviceId=function(a){d.deviceId=a,d.persistenceData.gs.das=a,b._Persistence.update();},this.getFirstSeenTime=function(a){return d._getFromPersistence(a,"fst")},this.setFirstSeenTime=function(a,b){if(a){var c=b||new Date().getTime();d._setPersistence(a,"fst",c);}},this.getLastSeenTime=function(a){if(!a)return null;// https://go.mparticle.com/work/SQDSDKS-6315
|
|
586
586
|
var c=b.Identity.getCurrentUser();return a===(null===c||void 0===c?void 0:c.getMPID())?new Date().getTime():d._getFromPersistence(a,"lst")},this.setLastSeenTime=function(a,b){if(a){var c=b||new Date().getTime();d._setPersistence(a,"lst",c);}},this.getLocalSessionAttributes=function(){return d.localSessionAttributes||{}},this.setLocalSessionAttribute=function(a,c){var e;d.localSessionAttributes[a]=c,d.persistenceData.gs.lsa=__assign(__assign({},d.persistenceData.gs.lsa||{}),(e={},e[a]=c,e)),b._Persistence.savePersistence(d.persistenceData);},this.syncPersistenceData=function(){var a=b._Persistence.getPersistence();d.persistenceData=b._Helpers.extend({},d.persistenceData,a);},this.getUserAttributes=function(a){return d._getFromPersistence(a,"ua")||{}},this.setUserAttributes=function(a,b){return d._setPersistence(a,"ua",b)},this.getUserIdentities=function(a){return d._getFromPersistence(a,"ui")||{}},this.setUserIdentities=function(a,b){d._setPersistence(a,"ui",b);},this.addMpidToSessionHistory=function(a,b){var c=d.currentSessionMPIDs.indexOf(a);return a&&b!==a&&0>c?void d.currentSessionMPIDs.push(a):void(0<=c&&(d.currentSessionMPIDs=moveElementToEnd(d.currentSessionMPIDs,c)))},this.nullifySession=function(){d.sessionId=null,d.dateLastEventSent=null,d.sessionStartDate=null,d.sessionAttributes={},d.localSessionAttributes={},b._Persistence.update();},this.processConfig=function(a){var g=a.workspaceToken,h=a.requiredWebviewBridgeName;// We should reprocess the flags and baseUrls in case they have changed when we request an updated config
|
|
@@ -1400,7 +1400,7 @@ return !("boolean"==typeof b&&b)&&"object"===_typeof$1(b)&&!0!==b[a];// When "Bl
|
|
|
1400
1400
|
var buildUrl=function(a,b,c,d){var e=d?"1":"0",f=["env=".concat(e)],g=c||{},h=g.planId,i=g.planVersion;return h&&f.push("plan_id=".concat(h)),i&&f.push("plan_version=".concat(i)),"".concat(a+b+"/config","?").concat(f.join("&"))};function ConfigAPIClient(a,b,c){var d=this,e="https://"+c._Store.SDKConfig.configUrl,f=b.isDevelopmentMode,g=b.dataPlan,h=buildUrl(e,a,g,f),i=window.fetch?new FetchUploader(h):new XHRUploader(h);this.getSDKConfiguration=function(){return __awaiter(d,void 0,void 0,function(){var a,d,e,f,h,j,k;return __generator(this,function(l){switch(l.label){case 0:d={method:"get",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"text/plain;charset=UTF-8"},body:null},l.label=1;case 1:return l.trys.push([1,6,,7]),[4/*yield*/,i.upload(d)];case 2:return (e=l.sent(),200!==e.status)?[3/*break*/,5]:(null===(h=null===c||void 0===c?void 0:c.Logger)||void 0===h?void 0:h.verbose("Successfully received configuration from server"),e.json?[4/*yield*/,e.json()]:[3/*break*/,4]);case 3:return a=l.sent(),[2/*return*/,a];case 4:return f=e,a=JSON.parse(f.responseText),[2/*return*/,a];case 5:return null===(j=null===c||void 0===c?void 0:c.Logger)||void 0===j?void 0:j.verbose("Issue with receiving configuration from server, received HTTP Code of "+e.statusText),[3/*break*/,7];case 6:return l.sent(),null===(k=null===c||void 0===c?void 0:c.Logger)||void 0===k?void 0:k.error("Error getting forwarder configuration from mParticle servers."),[3/*break*/,7];case 7:// Returns the original config object if we cannot retrieve the remote config
|
|
1401
1401
|
return [2/*return*/,b]}})})};}
|
|
1402
1402
|
|
|
1403
|
-
var HTTPCodes$1=Constants.HTTPCodes,Messages$1=Constants.Messages,IdentityMethods=Constants.IdentityMethods,Modify=IdentityMethods.Modify;function IdentityAPIClient(a){this.sendAliasRequest=function(b,c){return __awaiter(this,void 0,void 0,function(){var d,e,f,g,h,i,j,k,l,m,n,o,q,r,s,n;return __generator(this,function(t){switch(t.label){case 0:d=a.Logger,e=a._Helpers.invokeAliasCallback,f=a._Store.SDKConfig.aliasUrl,g=a._Store.devToken,d.verbose(Messages$1.InformationMessages.SendAliasHttp),h="https://".concat(f).concat(g,"/Alias"),i=window.fetch?new FetchUploader(h):new XHRUploader(h),j={method:"post",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"application/json"},body:JSON.stringify(b)},t.label=1;case 1:return t.trys.push([1,13,,14]),[4/*yield*/,i.upload(j)];case 2:return k=t.sent(),l=void 0,m=void 0,n=void 0,o=k.status,o===HTTP_ACCEPTED?[3/*break*/,3]:o===HTTP_OK?[3/*break*/,3]:o===HTTP_BAD_REQUEST?[3/*break*/,4]:[3/*break*/,11];case 3:return m="Received Alias Response from server: "+JSON.stringify(k.status),[3/*break*/,12];case 4:if(!k.json)return [3/*break*/,9];t.label=5;case 5:return t.trys.push([5,7,,8]),[4/*yield*/,k.json()];case 6:return l=t.sent(),[3/*break*/,8];case 7:return t.sent(),d.verbose("The request has no response body"),[3/*break*/,8];case 8:return [3/*break*/,10];case 9:q=k,l=q.responseText?JSON.parse(q.responseText):"",t.label=10;case 10:return r=l,(null===r||void 0===r?void 0:r.message)&&(n=r.message),m="Issue with sending Alias Request to mParticle Servers, received HTTP Code of "+k.status,(null===r||void 0===r?void 0:r.code)&&(m+=" - "+r.code),[3/*break*/,12];case 11:throw new Error("Received HTTP Code of "+k.status);case 12:return d.verbose(m),e(c,k.status,n),[3/*break*/,14];case 13:return s=t.sent(),n=s.message||s.toString(),d.error("Error sending alias request to mParticle servers. "+n),e(c,HTTPCodes$1.noHttpCoverage,n),[3/*break*/,14];case 14:return [2/*return*/]}})})},this.sendIdentityRequest=function(b,c,d,e,f,g,h){return __awaiter(this,void 0,void 0,function(){var
|
|
1403
|
+
var HTTPCodes$1=Constants.HTTPCodes,Messages$1=Constants.Messages,IdentityMethods=Constants.IdentityMethods,Modify=IdentityMethods.Modify;function IdentityAPIClient(a){this.sendAliasRequest=function(b,c){return __awaiter(this,void 0,void 0,function(){var d,e,f,g,h,i,j,k,l,m,n,o,q,r,s,n;return __generator(this,function(t){switch(t.label){case 0:d=a.Logger,e=a._Helpers.invokeAliasCallback,f=a._Store.SDKConfig.aliasUrl,g=a._Store.devToken,d.verbose(Messages$1.InformationMessages.SendAliasHttp),h="https://".concat(f).concat(g,"/Alias"),i=window.fetch?new FetchUploader(h):new XHRUploader(h),j={method:"post",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"application/json"},body:JSON.stringify(b)},t.label=1;case 1:return t.trys.push([1,13,,14]),[4/*yield*/,i.upload(j)];case 2:return k=t.sent(),l=void 0,m=void 0,n=void 0,o=k.status,o===HTTP_ACCEPTED?[3/*break*/,3]:o===HTTP_OK?[3/*break*/,3]:o===HTTP_BAD_REQUEST?[3/*break*/,4]:[3/*break*/,11];case 3:return m="Received Alias Response from server: "+JSON.stringify(k.status),[3/*break*/,12];case 4:if(!k.json)return [3/*break*/,9];t.label=5;case 5:return t.trys.push([5,7,,8]),[4/*yield*/,k.json()];case 6:return l=t.sent(),[3/*break*/,8];case 7:return t.sent(),d.verbose("The request has no response body"),[3/*break*/,8];case 8:return [3/*break*/,10];case 9:q=k,l=q.responseText?JSON.parse(q.responseText):"",t.label=10;case 10:return r=l,(null===r||void 0===r?void 0:r.message)&&(n=r.message),m="Issue with sending Alias Request to mParticle Servers, received HTTP Code of "+k.status,(null===r||void 0===r?void 0:r.code)&&(m+=" - "+r.code),[3/*break*/,12];case 11:throw new Error("Received HTTP Code of "+k.status);case 12:return d.verbose(m),e(c,k.status,n),[3/*break*/,14];case 13:return s=t.sent(),n=s.message||s.toString(),d.error("Error sending alias request to mParticle servers. "+n),e(c,HTTPCodes$1.noHttpCoverage,n),[3/*break*/,14];case 14:return [2/*return*/]}})})},this.sendIdentityRequest=function(b,c,d,e,f,g,h){var i,j,k;return __awaiter(this,void 0,void 0,function(){var l,m,n,o,p,q,r,s,t,u,v,w,x,y,l,z,l,y;return __generator(this,function(A){switch(A.label){case 0:if((null===(i=a._RoktManager)||void 0===i?void 0:i.isInitialized)&&(a._Store.identifyRequestCount=(a._Store.identifyRequestCount||0)+1,l=a._Store.identifyRequestCount,a.captureTiming("".concat(l,"-identityRequestStart"))),m=a._Helpers.invokeCallback,n=a.Logger,n.verbose(Messages$1.InformationMessages.SendIdentityBegin),!b)return n.error(Messages$1.ErrorMessages.APIRequestEmpty),[2/*return*/];if(n.verbose(Messages$1.InformationMessages.SendIdentityHttp),a._Store.identityCallInFlight)return m(d,HTTPCodes$1.activeIdentityRequest,"There is currently an Identity request processing. Please wait for this to return before requesting again"),[2/*return*/];o=g||null,p=this.getUploadUrl(c,g),q=window.fetch?new FetchUploader(p):new XHRUploader(p),r={method:"post",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"application/json","x-mp-key":a._Store.devToken},body:JSON.stringify(b)},a._Store.identityCallInFlight=!0,A.label=1;case 1:return A.trys.push([1,9,,10]),[4/*yield*/,q.upload(r)];case 2:return s=A.sent(),t=void 0,u=void 0,v=s.status,v===HTTP_ACCEPTED?[3/*break*/,3]:v===HTTP_OK?[3/*break*/,3]:v===HTTP_BAD_REQUEST?[3/*break*/,3]:[3/*break*/,7];case 3:return s.json?[4/*yield*/,s.json()]:[3/*break*/,5];case 4:return w=A.sent(),t=this.getIdentityResponseFromFetch(s,w),[3/*break*/,6];case 5:t=this.getIdentityResponseFromXHR(s),A.label=6;case 6:return t.status===HTTP_BAD_REQUEST?(x=t.responseText,u="Issue with sending Identity Request to mParticle Servers, received HTTP Code of "+t.status,(null===x||void 0===x?void 0:x.Errors)&&(y=x.Errors.map(function(a){return a.message}).join(", "),u+=" - "+y)):(u="Received Identity Response from server: ",u+=JSON.stringify(t.responseText)),[3/*break*/,8];case 7:throw new Error("Received HTTP Code of "+s.status);case 8:return a._Store.identityCallInFlight=!1,n.verbose(u),(null===(j=a._RoktManager)||void 0===j?void 0:j.isInitialized)&&(l=a._Store.identifyRequestCount,a.captureTiming("".concat(l,"-identityRequestEnd"))),f(t,o,d,e,c,h,!1),[3/*break*/,10];case 9:return z=A.sent(),a._Store.identityCallInFlight=!1,(null===(k=a._RoktManager)||void 0===k?void 0:k.isInitialized)&&(l=a._Store.identifyRequestCount,a.captureTiming("".concat(l,"-identityRequestEnd"))),y=z.message||z.toString(),n.error("Error sending identity request to servers - "+y),m(d,HTTPCodes$1.noHttpCoverage,y),[3/*break*/,10];case 10:return [2/*return*/]}})})},this.getUploadUrl=function(b,c){var d=a._Helpers.createServiceUrl(a._Store.SDKConfig.identityUrl),e=b===Modify?d+c+"/"+b:d+b;return e},this.getIdentityResponseFromFetch=function(a,b){return {status:a.status,responseText:b,cacheMaxAge:parseInt(a.headers.get(CACHE_HEADER))||0,expireTimestamp:0}},this.getIdentityResponseFromXHR=function(a){return {status:a.status,responseText:a.responseText?JSON.parse(a.responseText):{},cacheMaxAge:parseNumber(a.getResponseHeader(CACHE_HEADER)||""),expireTimestamp:0}};}
|
|
1404
1404
|
|
|
1405
1405
|
// The formatted ClickID value must be of the form version.subdomainIndex.creationTime.<fbclid>, where:
|
|
1406
1406
|
// - version is always this prefix: fb
|
|
@@ -1450,7 +1450,7 @@ for(var e in this.clickIds)if(this.clickIds.hasOwnProperty(e)){var f=this.clickI
|
|
|
1450
1450
|
// Rokt Manager in a "ready" state and it can begin sending data to the kit.
|
|
1451
1451
|
//
|
|
1452
1452
|
// https://github.com/mparticle-integrations/mparticle-javascript-integration-rokt
|
|
1453
|
-
var RoktManager=/** @class */function(){function a(){this.kit=null,this.filters={},this.currentUser=null,this.messageQueue=new Map,this.sandbox=null,this.placementAttributesMapping=[];}/**
|
|
1453
|
+
var RoktManager=/** @class */function(){function a(){this.kit=null,this.filters={},this.currentUser=null,this.messageQueue=new Map,this.sandbox=null,this.placementAttributesMapping=[],this.initialized=!1;}/**
|
|
1454
1454
|
* Initializes the RoktManager with configuration settings and user data.
|
|
1455
1455
|
*
|
|
1456
1456
|
* @param {IKitConfigs} roktConfig - Configuration object containing user attribute filters and settings
|
|
@@ -1467,8 +1467,8 @@ var RoktManager=/** @class */function(){function a(){this.kit=null,this.filters=
|
|
|
1467
1467
|
// as that is independent of this setting, though they share the same name.
|
|
1468
1468
|
var o=(null===f||void 0===f?void 0:f.sandbox)||!1;// Launcher options are set here for the kit to pick up and pass through
|
|
1469
1469
|
// to the Rokt Launcher.
|
|
1470
|
-
this.launcherOptions=__assign({sandbox:o},null===f||void 0===f?void 0:f.launcherOptions),(null===f||void 0===f?void 0:f.domain)&&(this.domain=f.domain);},a.prototype.attachKit=function(a){this.kit=a,this.processMessageQueue();},a.prototype.selectPlacements=function(a){var b,c,d,e,f;return __awaiter(this,void 0,void 0,function(){var
|
|
1471
|
-
if(this.captureTiming&&this.captureTiming(PerformanceMarkType.JointSdkSelectPlacements),!this.isReady()||(null===(b=this.store)||void 0===b?void 0:b.identityCallInFlight))return [2/*return*/,this.deferredCall("selectPlacements",a)];
|
|
1470
|
+
this.launcherOptions=__assign({sandbox:o},null===f||void 0===f?void 0:f.launcherOptions),(null===f||void 0===f?void 0:f.domain)&&(this.domain=f.domain),this.initialized=!0;},Object.defineProperty(a.prototype,"isInitialized",{get:function get(){return this.initialized},enumerable:!1,configurable:!0}),a.prototype.attachKit=function(a){this.kit=a,this.processMessageQueue();},a.prototype.selectPlacements=function(a){var b,c,d,e,f,g;return __awaiter(this,void 0,void 0,function(){var h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z=this;return __generator(this,function(A){switch(A.label){case 0:// Queue if kit isn't ready OR if identity is in flight
|
|
1471
|
+
if(this.captureTiming&&this.captureTiming(PerformanceMarkType.JointSdkSelectPlacements),!this.isReady()||(null===(b=this.store)||void 0===b?void 0:b.identityCallInFlight))return [2/*return*/,this.deferredCall("selectPlacements",a)];A.label=1;case 1:if(A.trys.push([1,6,,7]),h=a.attributes,i=(null===h||void 0===h?void 0:h.sandbox)||null,j=this.mapPlacementAttributes(h,this.placementAttributesMapping),null===(c=this.logger)||void 0===c?void 0:c.verbose("mParticle.Rokt selectPlacements called with attributes:\n".concat(JSON.stringify(h,null,2))),this.currentUser=this.identityService.getCurrentUser(),k=(null===(e=null===(d=this.currentUser)||void 0===d?void 0:d.getUserIdentities())||void 0===e?void 0:e.userIdentities)||{},l=k.email,m=j.email,n=void 0,o=void 0,p=this.mappedEmailShaIdentityType&&!1!==IdentityType.getIdentityType(this.mappedEmailShaIdentityType),p&&(n=k[this.mappedEmailShaIdentityType],o=j.emailsha256||j[this.mappedEmailShaIdentityType]||void 0),q=this.hasIdentityChanged(l,m),r=this.hasIdentityChanged(n,o),s={},q&&(s.email=m,m&&this.logger.warning("Email mismatch detected. Current email differs from email passed to selectPlacements call. Proceeding to call identify with email from selectPlacements call. Please verify your implementation.")),r&&(s[this.mappedEmailShaIdentityType]=o,this.logger.warning("emailsha256 mismatch detected. Current mParticle hashedEmail differs from hashedEmail passed to selectPlacements call. Proceeding to call identify with hashedEmail from selectPlacements call. Please verify your implementation.")),!!isEmpty(s))return [3/*break*/,5];A.label=2;case 2:return A.trys.push([2,4,,5]),[4/*yield*/,new Promise(function(a){z.identityService.identify({userIdentities:__assign(__assign({},k),s)},function(){a();});})];case 3:return A.sent(),[3/*break*/,5];case 4:return t=A.sent(),this.logger.error("Failed to identify user with new email: "+JSON.stringify(t)),[3/*break*/,5];case 5:return this.currentUser=this.identityService.getCurrentUser(),u=(null===(g=null===(f=this.currentUser)||void 0===f?void 0:f.getUserIdentities())||void 0===g?void 0:g.userIdentities)||{},this.setUserAttributes(j),v=__assign(__assign({},j),null===i?{}:{sandbox:i}),u.email&&!v.email&&(v.email=u.email),p&&(w=u[this.mappedEmailShaIdentityType],w&&!v.emailsha256&&!v[this.mappedEmailShaIdentityType]&&(v.emailsha256=w)),this.filters.filteredUser=this.currentUser||this.filters.filteredUser||null,x=__assign(__assign({},a),{attributes:v}),[2/*return*/,this.kit.selectPlacements(x)];case 6:return y=A.sent(),[2/*return*/,Promise.reject(y instanceof Error?y:new Error("Unknown error occurred"))];case 7:return [2/*return*/]}})})},a.prototype.hashAttributes=function(a){return __awaiter(this,void 0,void 0,function(){var b,c,d,e,f,g,h,i,j,k,l,m,n=this;return __generator(this,function(o){switch(o.label){case 0:return (o.trys.push([0,2,,3]),!a||"object"!==_typeof$1(a))?[2/*return*/,{}]:(b=Object.keys(a),0===b.length)?[2/*return*/,{}]:(c=b.map(function(b){return __awaiter(n,void 0,void 0,function(){var c,d;return __generator(this,function(e){switch(e.label){case 0:return c=a[b],[4/*yield*/,this.hashSha256(c)];case 1:return d=e.sent(),[2/*return*/,{key:b,attributeValue:c,hashedValue:d}]}})})}),[4/*yield*/,Promise.all(c)]);case 1:for(d=o.sent(),e={},(f=0,g=d);f<g.length;f++)h=g[f],i=h.key,j=h.attributeValue,k=h.hashedValue,e[i]=j,k&&(e["".concat(i,"sha256")]=k);return [2/*return*/,e];case 2:return l=o.sent(),m=l instanceof Error?l.message:l+"",this.logger.error("Failed to hashAttributes, returning an empty object: ".concat(m)),[2/*return*/,{}];case 3:return [2/*return*/]}})})},a.prototype.setExtensionData=function(a){if(!this.isReady())return void this.deferredCall("setExtensionData",a);try{this.kit.setExtensionData(a);}catch(a){var b=a instanceof Error?a.message:a+"";throw new Error("Error setting extension data: "+b)}},a.prototype.use=function(a){if(!this.isReady())return this.deferredCall("use",a);try{return this.kit.use(a)}catch(b){return Promise.reject(b instanceof Error?b:new Error("Error using extension: "+a))}},a.prototype.hashSha256=function(a){return __awaiter(this,void 0,void 0,function(){var b,c,d;return __generator(this,function(e){switch(e.label){case 0:if(null===a||void 0===a)return this.logger.warning("hashSha256 received null/undefined as input"),[2/*return*/,a];e.label=1;case 1:return e.trys.push([1,3,,4]),b=(a+"").trim().toLocaleLowerCase(),[4/*yield*/,this.sha256Hex(b)];case 2:return [2/*return*/,e.sent()];case 3:return c=e.sent(),d=c instanceof Error?c.message:c+"",this.logger.error("Failed to hashSha256, returning undefined: ".concat(d)),[2/*return*/,void 0];case 4:return [2/*return*/]}})})},a.prototype.getLocalSessionAttributes=function(){return this.store.getLocalSessionAttributes()},a.prototype.setLocalSessionAttribute=function(a,b){this.store.setLocalSessionAttribute(a,b);},a.prototype.isReady=function(){// The Rokt Manager is ready when a kit is attached and has a launcher
|
|
1472
1472
|
return !!(this.kit&&this.kit.launcher)},a.prototype.setUserAttributes=function(a){var b=["sandbox"],c={};for(var d in a)if(a.hasOwnProperty(d)&&-1===b.indexOf(d)){var e=a[d];c[d]=Array.isArray(e)?JSON.stringify(e):e;}try{this.currentUser.setUserAttributes(c);}catch(a){this.logger.error("Error setting user attributes: "+a);}},a.prototype.mapPlacementAttributes=function(a,b){for(var c,d={},e=0,f=b;e<f.length;e++)c=f[e],d[c.map]=c.value;var g={};for(var h in a)if(a.hasOwnProperty(h)){var i=d[h]||h;g[i]=a[h];}return g},a.prototype.onIdentityComplete=function(){this.isReady()&&(this.currentUser=this.identityService.getCurrentUser(),this.processMessageQueue());},a.prototype.processMessageQueue=function(){var a,b=this;if(this.isReady()&&0!==this.messageQueue.size){null===(a=this.logger)||void 0===a?void 0:a.verbose("RoktManager: Processing ".concat(this.messageQueue.size," queued messages"));var c=Array.from(this.messageQueue.values());// Clear the queue immediately to prevent re-processing
|
|
1473
1473
|
this.messageQueue.clear(),c.forEach(function(a){var c,d;if(!(a.methodName in b)||!isFunction(b[a.methodName]))return void(null===(c=b.logger)||void 0===c?void 0:c.error("RoktManager: Method ".concat(a.methodName," not found")));null===(d=b.logger)||void 0===d?void 0:d.verbose("RoktManager: Processing queued message: ".concat(a.methodName," with payload: ").concat(JSON.stringify(a.payload)));// Capture resolve/reject functions before async processing
|
|
1474
1474
|
var e=a.resolve,f=a.reject,g=function(c){var d,e=c instanceof Error?c.message:c+"";null===(d=b.logger)||void 0===d?void 0:d.error("RoktManager: Error processing message '".concat(a.methodName,"': ").concat(e)),f&&f(c);};try{var h=b[a.methodName](a.payload);// Handle both sync and async methods
|
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.
|
|
18
|
+
var version = "2.56.0";
|
|
19
19
|
|
|
20
20
|
var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodHasBeenDeprecated:"has been deprecated.",MethodMarkedForDeprecationPostfix:"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
|
|
@@ -580,7 +580,7 @@ document.addEventListener("visibilitychange",function(){return a.handleVisibilit
|
|
|
580
580
|
|
|
581
581
|
function createSDKConfig(a){// TODO: Refactor to create a default config object
|
|
582
582
|
var b={};for(var c in Constants.DefaultConfig)Constants.DefaultConfig.hasOwnProperty(c)&&(b[c]=Constants.DefaultConfig[c]);if(a)for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);for(var c in Constants.DefaultBaseUrls)b[c]=Constants.DefaultBaseUrls[c];return b}// TODO: Merge this with SDKStoreApi in sdkRuntimeModels
|
|
583
|
-
function Store(a,b,c){var d=this,e=b._Helpers.createMainStorageName,f=b._NativeSdkHelpers.isWebviewEnabled,g={isEnabled:!0,sessionAttributes:{},localSessionAttributes:{},currentSessionMPIDs:[],consentState:null,sessionId:null,isFirstRun:null,clientId:null,deviceId:null,devToken:null,serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:null,configurationLoaded:!1,identityCallInFlight:!1,SDKConfig:{},nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,storageName:null,activeForwarders:[],kits:{},sideloadedKits:[],configuredForwarders:[],pixelConfigurations:[],wrapperSDKInfo:{name:"none",version:null,isInfoSet:!1},// Placeholder for in-memory persistence model
|
|
583
|
+
function Store(a,b,c){var d=this,e=b._Helpers.createMainStorageName,f=b._NativeSdkHelpers.isWebviewEnabled,g={isEnabled:!0,sessionAttributes:{},localSessionAttributes:{},currentSessionMPIDs:[],consentState:null,sessionId:null,isFirstRun:null,clientId:null,deviceId:null,devToken:null,serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:null,configurationLoaded:!1,identityCallInFlight:!1,identifyRequestCount:0,SDKConfig:{},nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,storageName:null,activeForwarders:[],kits:{},sideloadedKits:[],configuredForwarders:[],pixelConfigurations:[],wrapperSDKInfo:{name:"none",version:null,isInfoSet:!1},// Placeholder for in-memory persistence model
|
|
584
584
|
persistenceData:{gs:{}}};for(var h in g)this[h]=g[h];if(this.devToken=c||null,this.integrationDelayTimeoutStart=Date.now(),this.SDKConfig=createSDKConfig(a),a){a.hasOwnProperty("flags")||(this.SDKConfig.flags={}),this.SDKConfig.flags=processFlags(a),a.deviceId&&(this.deviceId=a.deviceId),this.SDKConfig.isDevelopmentMode=!!a.hasOwnProperty("isDevelopmentMode")&&returnConvertedBoolean(a.isDevelopmentMode);var i=processBaseUrls(a,this.SDKConfig.flags,c);for(var j in i)this.SDKConfig[j]=i[j];if(a.hasOwnProperty("logLevel")&&(this.SDKConfig.logLevel=a.logLevel),this.SDKConfig.useNativeSdk=!!a.useNativeSdk,this.SDKConfig.kits=a.kits||{},this.SDKConfig.sideloadedKits=a.sideloadedKits||[],this.SDKConfig.isIOS=a.hasOwnProperty("isIOS")?a.isIOS:!!(window.mParticle&&window.mParticle.isIOS)&&window.mParticle.isIOS,this.SDKConfig.useCookieStorage=!!a.hasOwnProperty("useCookieStorage")&&a.useCookieStorage,this.SDKConfig.maxProducts=a.hasOwnProperty("maxProducts")?a.maxProducts:Constants.DefaultConfig.maxProducts,this.SDKConfig.maxCookieSize=a.hasOwnProperty("maxCookieSize")?a.maxCookieSize:Constants.DefaultConfig.maxCookieSize,a.hasOwnProperty("appName")&&(this.SDKConfig.appName=a.appName),a.hasOwnProperty("package")&&(this.SDKConfig["package"]=a["package"]),this.SDKConfig.integrationDelayTimeout=a.hasOwnProperty("integrationDelayTimeout")?a.integrationDelayTimeout:Constants.DefaultConfig.integrationDelayTimeout,a.hasOwnProperty("identifyRequest")&&(this.SDKConfig.identifyRequest=a.identifyRequest),a.hasOwnProperty("identityCallback")){var k=a.identityCallback;b._Helpers.Validators.isFunction(k)?this.SDKConfig.identityCallback=a.identityCallback:b.Logger.warning("The optional callback must be a function. You tried entering a(n) "+_typeof$1(k)+" . Callback not set. Please set your callback again.");}if(a.hasOwnProperty("appVersion")&&(this.SDKConfig.appVersion=a.appVersion),a.hasOwnProperty("appName")&&(this.SDKConfig.appName=a.appName),a.hasOwnProperty("sessionTimeout")&&(this.SDKConfig.sessionTimeout=a.sessionTimeout),a.hasOwnProperty("dataPlan")){this.SDKConfig.dataPlan={PlanVersion:null,PlanId:null};var l=a.dataPlan;l.planId&&(isDataPlanSlug(l.planId)?this.SDKConfig.dataPlan.PlanId=l.planId:b.Logger.error("Your data plan id must be a string and match the data plan slug format (i.e. under_case_slug)")),l.planVersion&&(isNumber(l.planVersion)?this.SDKConfig.dataPlan.PlanVersion=l.planVersion:b.Logger.error("Your data plan version must be a number"));}else this.SDKConfig.dataPlan={};if(this.SDKConfig.forceHttps=!a.hasOwnProperty("forceHttps")||a.forceHttps,this.SDKConfig.customFlags=a.customFlags||{},this.SDKConfig.minWebviewBridgeVersion=a.hasOwnProperty("minWebviewBridgeVersion")?a.minWebviewBridgeVersion:1,this.SDKConfig.aliasMaxWindow=a.hasOwnProperty("aliasMaxWindow")?a.aliasMaxWindow:Constants.DefaultConfig.aliasMaxWindow,a.hasOwnProperty("dataPlanOptions")){var m=a.dataPlanOptions;m.hasOwnProperty("dataPlanVersion")&&m.hasOwnProperty("blockUserAttributes")&&m.hasOwnProperty("blockEventAttributes")&&m.hasOwnProperty("blockEvents")&&m.hasOwnProperty("blockUserIdentities")||b.Logger.error("Ensure your config.dataPlanOptions object has the following keys: a \"dataPlanVersion\" object, and \"blockUserAttributes\", \"blockEventAttributes\", \"blockEvents\", \"blockUserIdentities\" booleans");}a.hasOwnProperty("onCreateBatch")&&("function"==typeof a.onCreateBatch?this.SDKConfig.onCreateBatch=a.onCreateBatch:(b.Logger.error("config.onCreateBatch must be a function"),this.SDKConfig.onCreateBatch=void 0));}this._getFromPersistence=function(a,b){return a?(d.syncPersistenceData(),d.persistenceData&&d.persistenceData[a]&&d.persistenceData[a][b]?d.persistenceData[a][b]:null):null},this._setPersistence=function(a,c,e){var f;a&&(d.syncPersistenceData(),d.persistenceData&&(d.persistenceData[a]?d.persistenceData[a][c]=e:d.persistenceData[a]=(f={},f[c]=e,f),isObject(d.persistenceData[a][c])&&isEmpty(d.persistenceData[a][c])&&delete d.persistenceData[a][c],b._Persistence.savePersistence(d.persistenceData)));},this.hasInvalidIdentifyRequest=function(){var a=d.SDKConfig.identifyRequest;return isObject(a)&&isObject(a.userIdentities)&&isEmpty(a.userIdentities)||!a},this.getConsentState=function(a){var c=b._Consent.ConsentSerialization.fromMinifiedJsonObject,e=d._getFromPersistence(a,"con");return isEmpty(e)?null:c(e)},this.setConsentState=function(a,c){var e=b._Consent.ConsentSerialization.toMinifiedJsonObject;// If ConsentState is null, we assume the intent is to clear out the consent state
|
|
585
585
|
(c||null===c)&&d._setPersistence(a,"con",e(c));},this.getDeviceId=function(){return d.deviceId},this.setDeviceId=function(a){d.deviceId=a,d.persistenceData.gs.das=a,b._Persistence.update();},this.getFirstSeenTime=function(a){return d._getFromPersistence(a,"fst")},this.setFirstSeenTime=function(a,b){if(a){var c=b||new Date().getTime();d._setPersistence(a,"fst",c);}},this.getLastSeenTime=function(a){if(!a)return null;// https://go.mparticle.com/work/SQDSDKS-6315
|
|
586
586
|
var c=b.Identity.getCurrentUser();return a===(null===c||void 0===c?void 0:c.getMPID())?new Date().getTime():d._getFromPersistence(a,"lst")},this.setLastSeenTime=function(a,b){if(a){var c=b||new Date().getTime();d._setPersistence(a,"lst",c);}},this.getLocalSessionAttributes=function(){return d.localSessionAttributes||{}},this.setLocalSessionAttribute=function(a,c){var e;d.localSessionAttributes[a]=c,d.persistenceData.gs.lsa=__assign(__assign({},d.persistenceData.gs.lsa||{}),(e={},e[a]=c,e)),b._Persistence.savePersistence(d.persistenceData);},this.syncPersistenceData=function(){var a=b._Persistence.getPersistence();d.persistenceData=b._Helpers.extend({},d.persistenceData,a);},this.getUserAttributes=function(a){return d._getFromPersistence(a,"ua")||{}},this.setUserAttributes=function(a,b){return d._setPersistence(a,"ua",b)},this.getUserIdentities=function(a){return d._getFromPersistence(a,"ui")||{}},this.setUserIdentities=function(a,b){d._setPersistence(a,"ui",b);},this.addMpidToSessionHistory=function(a,b){var c=d.currentSessionMPIDs.indexOf(a);return a&&b!==a&&0>c?void d.currentSessionMPIDs.push(a):void(0<=c&&(d.currentSessionMPIDs=moveElementToEnd(d.currentSessionMPIDs,c)))},this.nullifySession=function(){d.sessionId=null,d.dateLastEventSent=null,d.sessionStartDate=null,d.sessionAttributes={},d.localSessionAttributes={},b._Persistence.update();},this.processConfig=function(a){var g=a.workspaceToken,h=a.requiredWebviewBridgeName;// We should reprocess the flags and baseUrls in case they have changed when we request an updated config
|
|
@@ -1400,7 +1400,7 @@ return !("boolean"==typeof b&&b)&&"object"===_typeof$1(b)&&!0!==b[a];// When "Bl
|
|
|
1400
1400
|
var buildUrl=function(a,b,c,d){var e=d?"1":"0",f=["env=".concat(e)],g=c||{},h=g.planId,i=g.planVersion;return h&&f.push("plan_id=".concat(h)),i&&f.push("plan_version=".concat(i)),"".concat(a+b+"/config","?").concat(f.join("&"))};function ConfigAPIClient(a,b,c){var d=this,e="https://"+c._Store.SDKConfig.configUrl,f=b.isDevelopmentMode,g=b.dataPlan,h=buildUrl(e,a,g,f),i=window.fetch?new FetchUploader(h):new XHRUploader(h);this.getSDKConfiguration=function(){return __awaiter(d,void 0,void 0,function(){var a,d,e,f,h,j,k;return __generator(this,function(l){switch(l.label){case 0:d={method:"get",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"text/plain;charset=UTF-8"},body:null},l.label=1;case 1:return l.trys.push([1,6,,7]),[4/*yield*/,i.upload(d)];case 2:return (e=l.sent(),200!==e.status)?[3/*break*/,5]:(null===(h=null===c||void 0===c?void 0:c.Logger)||void 0===h?void 0:h.verbose("Successfully received configuration from server"),e.json?[4/*yield*/,e.json()]:[3/*break*/,4]);case 3:return a=l.sent(),[2/*return*/,a];case 4:return f=e,a=JSON.parse(f.responseText),[2/*return*/,a];case 5:return null===(j=null===c||void 0===c?void 0:c.Logger)||void 0===j?void 0:j.verbose("Issue with receiving configuration from server, received HTTP Code of "+e.statusText),[3/*break*/,7];case 6:return l.sent(),null===(k=null===c||void 0===c?void 0:c.Logger)||void 0===k?void 0:k.error("Error getting forwarder configuration from mParticle servers."),[3/*break*/,7];case 7:// Returns the original config object if we cannot retrieve the remote config
|
|
1401
1401
|
return [2/*return*/,b]}})})};}
|
|
1402
1402
|
|
|
1403
|
-
var HTTPCodes$1=Constants.HTTPCodes,Messages$1=Constants.Messages,IdentityMethods=Constants.IdentityMethods,Modify=IdentityMethods.Modify;function IdentityAPIClient(a){this.sendAliasRequest=function(b,c){return __awaiter(this,void 0,void 0,function(){var d,e,f,g,h,i,j,k,l,m,n,o,q,r,s,n;return __generator(this,function(t){switch(t.label){case 0:d=a.Logger,e=a._Helpers.invokeAliasCallback,f=a._Store.SDKConfig.aliasUrl,g=a._Store.devToken,d.verbose(Messages$1.InformationMessages.SendAliasHttp),h="https://".concat(f).concat(g,"/Alias"),i=window.fetch?new FetchUploader(h):new XHRUploader(h),j={method:"post",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"application/json"},body:JSON.stringify(b)},t.label=1;case 1:return t.trys.push([1,13,,14]),[4/*yield*/,i.upload(j)];case 2:return k=t.sent(),l=void 0,m=void 0,n=void 0,o=k.status,o===HTTP_ACCEPTED?[3/*break*/,3]:o===HTTP_OK?[3/*break*/,3]:o===HTTP_BAD_REQUEST?[3/*break*/,4]:[3/*break*/,11];case 3:return m="Received Alias Response from server: "+JSON.stringify(k.status),[3/*break*/,12];case 4:if(!k.json)return [3/*break*/,9];t.label=5;case 5:return t.trys.push([5,7,,8]),[4/*yield*/,k.json()];case 6:return l=t.sent(),[3/*break*/,8];case 7:return t.sent(),d.verbose("The request has no response body"),[3/*break*/,8];case 8:return [3/*break*/,10];case 9:q=k,l=q.responseText?JSON.parse(q.responseText):"",t.label=10;case 10:return r=l,(null===r||void 0===r?void 0:r.message)&&(n=r.message),m="Issue with sending Alias Request to mParticle Servers, received HTTP Code of "+k.status,(null===r||void 0===r?void 0:r.code)&&(m+=" - "+r.code),[3/*break*/,12];case 11:throw new Error("Received HTTP Code of "+k.status);case 12:return d.verbose(m),e(c,k.status,n),[3/*break*/,14];case 13:return s=t.sent(),n=s.message||s.toString(),d.error("Error sending alias request to mParticle servers. "+n),e(c,HTTPCodes$1.noHttpCoverage,n),[3/*break*/,14];case 14:return [2/*return*/]}})})},this.sendIdentityRequest=function(b,c,d,e,f,g,h){return __awaiter(this,void 0,void 0,function(){var
|
|
1403
|
+
var HTTPCodes$1=Constants.HTTPCodes,Messages$1=Constants.Messages,IdentityMethods=Constants.IdentityMethods,Modify=IdentityMethods.Modify;function IdentityAPIClient(a){this.sendAliasRequest=function(b,c){return __awaiter(this,void 0,void 0,function(){var d,e,f,g,h,i,j,k,l,m,n,o,q,r,s,n;return __generator(this,function(t){switch(t.label){case 0:d=a.Logger,e=a._Helpers.invokeAliasCallback,f=a._Store.SDKConfig.aliasUrl,g=a._Store.devToken,d.verbose(Messages$1.InformationMessages.SendAliasHttp),h="https://".concat(f).concat(g,"/Alias"),i=window.fetch?new FetchUploader(h):new XHRUploader(h),j={method:"post",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"application/json"},body:JSON.stringify(b)},t.label=1;case 1:return t.trys.push([1,13,,14]),[4/*yield*/,i.upload(j)];case 2:return k=t.sent(),l=void 0,m=void 0,n=void 0,o=k.status,o===HTTP_ACCEPTED?[3/*break*/,3]:o===HTTP_OK?[3/*break*/,3]:o===HTTP_BAD_REQUEST?[3/*break*/,4]:[3/*break*/,11];case 3:return m="Received Alias Response from server: "+JSON.stringify(k.status),[3/*break*/,12];case 4:if(!k.json)return [3/*break*/,9];t.label=5;case 5:return t.trys.push([5,7,,8]),[4/*yield*/,k.json()];case 6:return l=t.sent(),[3/*break*/,8];case 7:return t.sent(),d.verbose("The request has no response body"),[3/*break*/,8];case 8:return [3/*break*/,10];case 9:q=k,l=q.responseText?JSON.parse(q.responseText):"",t.label=10;case 10:return r=l,(null===r||void 0===r?void 0:r.message)&&(n=r.message),m="Issue with sending Alias Request to mParticle Servers, received HTTP Code of "+k.status,(null===r||void 0===r?void 0:r.code)&&(m+=" - "+r.code),[3/*break*/,12];case 11:throw new Error("Received HTTP Code of "+k.status);case 12:return d.verbose(m),e(c,k.status,n),[3/*break*/,14];case 13:return s=t.sent(),n=s.message||s.toString(),d.error("Error sending alias request to mParticle servers. "+n),e(c,HTTPCodes$1.noHttpCoverage,n),[3/*break*/,14];case 14:return [2/*return*/]}})})},this.sendIdentityRequest=function(b,c,d,e,f,g,h){var i,j,k;return __awaiter(this,void 0,void 0,function(){var l,m,n,o,p,q,r,s,t,u,v,w,x,y,l,z,l,y;return __generator(this,function(A){switch(A.label){case 0:if((null===(i=a._RoktManager)||void 0===i?void 0:i.isInitialized)&&(a._Store.identifyRequestCount=(a._Store.identifyRequestCount||0)+1,l=a._Store.identifyRequestCount,a.captureTiming("".concat(l,"-identityRequestStart"))),m=a._Helpers.invokeCallback,n=a.Logger,n.verbose(Messages$1.InformationMessages.SendIdentityBegin),!b)return n.error(Messages$1.ErrorMessages.APIRequestEmpty),[2/*return*/];if(n.verbose(Messages$1.InformationMessages.SendIdentityHttp),a._Store.identityCallInFlight)return m(d,HTTPCodes$1.activeIdentityRequest,"There is currently an Identity request processing. Please wait for this to return before requesting again"),[2/*return*/];o=g||null,p=this.getUploadUrl(c,g),q=window.fetch?new FetchUploader(p):new XHRUploader(p),r={method:"post",headers:{Accept:"text/plain;charset=UTF-8","Content-Type":"application/json","x-mp-key":a._Store.devToken},body:JSON.stringify(b)},a._Store.identityCallInFlight=!0,A.label=1;case 1:return A.trys.push([1,9,,10]),[4/*yield*/,q.upload(r)];case 2:return s=A.sent(),t=void 0,u=void 0,v=s.status,v===HTTP_ACCEPTED?[3/*break*/,3]:v===HTTP_OK?[3/*break*/,3]:v===HTTP_BAD_REQUEST?[3/*break*/,3]:[3/*break*/,7];case 3:return s.json?[4/*yield*/,s.json()]:[3/*break*/,5];case 4:return w=A.sent(),t=this.getIdentityResponseFromFetch(s,w),[3/*break*/,6];case 5:t=this.getIdentityResponseFromXHR(s),A.label=6;case 6:return t.status===HTTP_BAD_REQUEST?(x=t.responseText,u="Issue with sending Identity Request to mParticle Servers, received HTTP Code of "+t.status,(null===x||void 0===x?void 0:x.Errors)&&(y=x.Errors.map(function(a){return a.message}).join(", "),u+=" - "+y)):(u="Received Identity Response from server: ",u+=JSON.stringify(t.responseText)),[3/*break*/,8];case 7:throw new Error("Received HTTP Code of "+s.status);case 8:return a._Store.identityCallInFlight=!1,n.verbose(u),(null===(j=a._RoktManager)||void 0===j?void 0:j.isInitialized)&&(l=a._Store.identifyRequestCount,a.captureTiming("".concat(l,"-identityRequestEnd"))),f(t,o,d,e,c,h,!1),[3/*break*/,10];case 9:return z=A.sent(),a._Store.identityCallInFlight=!1,(null===(k=a._RoktManager)||void 0===k?void 0:k.isInitialized)&&(l=a._Store.identifyRequestCount,a.captureTiming("".concat(l,"-identityRequestEnd"))),y=z.message||z.toString(),n.error("Error sending identity request to servers - "+y),m(d,HTTPCodes$1.noHttpCoverage,y),[3/*break*/,10];case 10:return [2/*return*/]}})})},this.getUploadUrl=function(b,c){var d=a._Helpers.createServiceUrl(a._Store.SDKConfig.identityUrl),e=b===Modify?d+c+"/"+b:d+b;return e},this.getIdentityResponseFromFetch=function(a,b){return {status:a.status,responseText:b,cacheMaxAge:parseInt(a.headers.get(CACHE_HEADER))||0,expireTimestamp:0}},this.getIdentityResponseFromXHR=function(a){return {status:a.status,responseText:a.responseText?JSON.parse(a.responseText):{},cacheMaxAge:parseNumber(a.getResponseHeader(CACHE_HEADER)||""),expireTimestamp:0}};}
|
|
1404
1404
|
|
|
1405
1405
|
// The formatted ClickID value must be of the form version.subdomainIndex.creationTime.<fbclid>, where:
|
|
1406
1406
|
// - version is always this prefix: fb
|
|
@@ -1450,7 +1450,7 @@ for(var e in this.clickIds)if(this.clickIds.hasOwnProperty(e)){var f=this.clickI
|
|
|
1450
1450
|
// Rokt Manager in a "ready" state and it can begin sending data to the kit.
|
|
1451
1451
|
//
|
|
1452
1452
|
// https://github.com/mparticle-integrations/mparticle-javascript-integration-rokt
|
|
1453
|
-
var RoktManager=/** @class */function(){function a(){this.kit=null,this.filters={},this.currentUser=null,this.messageQueue=new Map,this.sandbox=null,this.placementAttributesMapping=[];}/**
|
|
1453
|
+
var RoktManager=/** @class */function(){function a(){this.kit=null,this.filters={},this.currentUser=null,this.messageQueue=new Map,this.sandbox=null,this.placementAttributesMapping=[],this.initialized=!1;}/**
|
|
1454
1454
|
* Initializes the RoktManager with configuration settings and user data.
|
|
1455
1455
|
*
|
|
1456
1456
|
* @param {IKitConfigs} roktConfig - Configuration object containing user attribute filters and settings
|
|
@@ -1467,8 +1467,8 @@ var RoktManager=/** @class */function(){function a(){this.kit=null,this.filters=
|
|
|
1467
1467
|
// as that is independent of this setting, though they share the same name.
|
|
1468
1468
|
var o=(null===f||void 0===f?void 0:f.sandbox)||!1;// Launcher options are set here for the kit to pick up and pass through
|
|
1469
1469
|
// to the Rokt Launcher.
|
|
1470
|
-
this.launcherOptions=__assign({sandbox:o},null===f||void 0===f?void 0:f.launcherOptions),(null===f||void 0===f?void 0:f.domain)&&(this.domain=f.domain);},a.prototype.attachKit=function(a){this.kit=a,this.processMessageQueue();},a.prototype.selectPlacements=function(a){var b,c,d,e,f;return __awaiter(this,void 0,void 0,function(){var
|
|
1471
|
-
if(this.captureTiming&&this.captureTiming(PerformanceMarkType.JointSdkSelectPlacements),!this.isReady()||(null===(b=this.store)||void 0===b?void 0:b.identityCallInFlight))return [2/*return*/,this.deferredCall("selectPlacements",a)];
|
|
1470
|
+
this.launcherOptions=__assign({sandbox:o},null===f||void 0===f?void 0:f.launcherOptions),(null===f||void 0===f?void 0:f.domain)&&(this.domain=f.domain),this.initialized=!0;},Object.defineProperty(a.prototype,"isInitialized",{get:function get(){return this.initialized},enumerable:!1,configurable:!0}),a.prototype.attachKit=function(a){this.kit=a,this.processMessageQueue();},a.prototype.selectPlacements=function(a){var b,c,d,e,f,g;return __awaiter(this,void 0,void 0,function(){var h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z=this;return __generator(this,function(A){switch(A.label){case 0:// Queue if kit isn't ready OR if identity is in flight
|
|
1471
|
+
if(this.captureTiming&&this.captureTiming(PerformanceMarkType.JointSdkSelectPlacements),!this.isReady()||(null===(b=this.store)||void 0===b?void 0:b.identityCallInFlight))return [2/*return*/,this.deferredCall("selectPlacements",a)];A.label=1;case 1:if(A.trys.push([1,6,,7]),h=a.attributes,i=(null===h||void 0===h?void 0:h.sandbox)||null,j=this.mapPlacementAttributes(h,this.placementAttributesMapping),null===(c=this.logger)||void 0===c?void 0:c.verbose("mParticle.Rokt selectPlacements called with attributes:\n".concat(JSON.stringify(h,null,2))),this.currentUser=this.identityService.getCurrentUser(),k=(null===(e=null===(d=this.currentUser)||void 0===d?void 0:d.getUserIdentities())||void 0===e?void 0:e.userIdentities)||{},l=k.email,m=j.email,n=void 0,o=void 0,p=this.mappedEmailShaIdentityType&&!1!==IdentityType.getIdentityType(this.mappedEmailShaIdentityType),p&&(n=k[this.mappedEmailShaIdentityType],o=j.emailsha256||j[this.mappedEmailShaIdentityType]||void 0),q=this.hasIdentityChanged(l,m),r=this.hasIdentityChanged(n,o),s={},q&&(s.email=m,m&&this.logger.warning("Email mismatch detected. Current email differs from email passed to selectPlacements call. Proceeding to call identify with email from selectPlacements call. Please verify your implementation.")),r&&(s[this.mappedEmailShaIdentityType]=o,this.logger.warning("emailsha256 mismatch detected. Current mParticle hashedEmail differs from hashedEmail passed to selectPlacements call. Proceeding to call identify with hashedEmail from selectPlacements call. Please verify your implementation.")),!!isEmpty(s))return [3/*break*/,5];A.label=2;case 2:return A.trys.push([2,4,,5]),[4/*yield*/,new Promise(function(a){z.identityService.identify({userIdentities:__assign(__assign({},k),s)},function(){a();});})];case 3:return A.sent(),[3/*break*/,5];case 4:return t=A.sent(),this.logger.error("Failed to identify user with new email: "+JSON.stringify(t)),[3/*break*/,5];case 5:return this.currentUser=this.identityService.getCurrentUser(),u=(null===(g=null===(f=this.currentUser)||void 0===f?void 0:f.getUserIdentities())||void 0===g?void 0:g.userIdentities)||{},this.setUserAttributes(j),v=__assign(__assign({},j),null===i?{}:{sandbox:i}),u.email&&!v.email&&(v.email=u.email),p&&(w=u[this.mappedEmailShaIdentityType],w&&!v.emailsha256&&!v[this.mappedEmailShaIdentityType]&&(v.emailsha256=w)),this.filters.filteredUser=this.currentUser||this.filters.filteredUser||null,x=__assign(__assign({},a),{attributes:v}),[2/*return*/,this.kit.selectPlacements(x)];case 6:return y=A.sent(),[2/*return*/,Promise.reject(y instanceof Error?y:new Error("Unknown error occurred"))];case 7:return [2/*return*/]}})})},a.prototype.hashAttributes=function(a){return __awaiter(this,void 0,void 0,function(){var b,c,d,e,f,g,h,i,j,k,l,m,n=this;return __generator(this,function(o){switch(o.label){case 0:return (o.trys.push([0,2,,3]),!a||"object"!==_typeof$1(a))?[2/*return*/,{}]:(b=Object.keys(a),0===b.length)?[2/*return*/,{}]:(c=b.map(function(b){return __awaiter(n,void 0,void 0,function(){var c,d;return __generator(this,function(e){switch(e.label){case 0:return c=a[b],[4/*yield*/,this.hashSha256(c)];case 1:return d=e.sent(),[2/*return*/,{key:b,attributeValue:c,hashedValue:d}]}})})}),[4/*yield*/,Promise.all(c)]);case 1:for(d=o.sent(),e={},(f=0,g=d);f<g.length;f++)h=g[f],i=h.key,j=h.attributeValue,k=h.hashedValue,e[i]=j,k&&(e["".concat(i,"sha256")]=k);return [2/*return*/,e];case 2:return l=o.sent(),m=l instanceof Error?l.message:l+"",this.logger.error("Failed to hashAttributes, returning an empty object: ".concat(m)),[2/*return*/,{}];case 3:return [2/*return*/]}})})},a.prototype.setExtensionData=function(a){if(!this.isReady())return void this.deferredCall("setExtensionData",a);try{this.kit.setExtensionData(a);}catch(a){var b=a instanceof Error?a.message:a+"";throw new Error("Error setting extension data: "+b)}},a.prototype.use=function(a){if(!this.isReady())return this.deferredCall("use",a);try{return this.kit.use(a)}catch(b){return Promise.reject(b instanceof Error?b:new Error("Error using extension: "+a))}},a.prototype.hashSha256=function(a){return __awaiter(this,void 0,void 0,function(){var b,c,d;return __generator(this,function(e){switch(e.label){case 0:if(null===a||void 0===a)return this.logger.warning("hashSha256 received null/undefined as input"),[2/*return*/,a];e.label=1;case 1:return e.trys.push([1,3,,4]),b=(a+"").trim().toLocaleLowerCase(),[4/*yield*/,this.sha256Hex(b)];case 2:return [2/*return*/,e.sent()];case 3:return c=e.sent(),d=c instanceof Error?c.message:c+"",this.logger.error("Failed to hashSha256, returning undefined: ".concat(d)),[2/*return*/,void 0];case 4:return [2/*return*/]}})})},a.prototype.getLocalSessionAttributes=function(){return this.store.getLocalSessionAttributes()},a.prototype.setLocalSessionAttribute=function(a,b){this.store.setLocalSessionAttribute(a,b);},a.prototype.isReady=function(){// The Rokt Manager is ready when a kit is attached and has a launcher
|
|
1472
1472
|
return !!(this.kit&&this.kit.launcher)},a.prototype.setUserAttributes=function(a){var b=["sandbox"],c={};for(var d in a)if(a.hasOwnProperty(d)&&-1===b.indexOf(d)){var e=a[d];c[d]=Array.isArray(e)?JSON.stringify(e):e;}try{this.currentUser.setUserAttributes(c);}catch(a){this.logger.error("Error setting user attributes: "+a);}},a.prototype.mapPlacementAttributes=function(a,b){for(var c,d={},e=0,f=b;e<f.length;e++)c=f[e],d[c.map]=c.value;var g={};for(var h in a)if(a.hasOwnProperty(h)){var i=d[h]||h;g[i]=a[h];}return g},a.prototype.onIdentityComplete=function(){this.isReady()&&(this.currentUser=this.identityService.getCurrentUser(),this.processMessageQueue());},a.prototype.processMessageQueue=function(){var a,b=this;if(this.isReady()&&0!==this.messageQueue.size){null===(a=this.logger)||void 0===a?void 0:a.verbose("RoktManager: Processing ".concat(this.messageQueue.size," queued messages"));var c=Array.from(this.messageQueue.values());// Clear the queue immediately to prevent re-processing
|
|
1473
1473
|
this.messageQueue.clear(),c.forEach(function(a){var c,d;if(!(a.methodName in b)||!isFunction(b[a.methodName]))return void(null===(c=b.logger)||void 0===c?void 0:c.error("RoktManager: Method ".concat(a.methodName," not found")));null===(d=b.logger)||void 0===d?void 0:d.verbose("RoktManager: Processing queued message: ".concat(a.methodName," with payload: ").concat(JSON.stringify(a.payload)));// Capture resolve/reject functions before async processing
|
|
1474
1474
|
var e=a.resolve,f=a.reject,g=function(c){var d,e=c instanceof Error?c.message:c+"";null===(d=b.logger)||void 0===d?void 0:d.error("RoktManager: Error processing message '".concat(a.methodName,"': ").concat(e)),f&&f(c);};try{var h=b[a.methodName](a.payload);// Handle both sync and async methods
|
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.
|
|
206
|
+
var version = "2.56.0";
|
|
207
207
|
|
|
208
208
|
var Constants = {
|
|
209
209
|
sdkVersion: version,
|
|
@@ -4461,6 +4461,7 @@ var mParticle = (function () {
|
|
|
4461
4461
|
context: null,
|
|
4462
4462
|
configurationLoaded: false,
|
|
4463
4463
|
identityCallInFlight: false,
|
|
4464
|
+
identifyRequestCount: 0,
|
|
4464
4465
|
SDKConfig: {},
|
|
4465
4466
|
nonCurrentUserMPIDs: {},
|
|
4466
4467
|
identifyCalled: false,
|
|
@@ -9257,11 +9258,17 @@ var mParticle = (function () {
|
|
|
9257
9258
|
};
|
|
9258
9259
|
|
|
9259
9260
|
this.sendIdentityRequest = function (identityApiRequest, method, callback, originalIdentityApiData, parseIdentityResponse, mpid, knownIdentities) {
|
|
9261
|
+
var _a, _b, _c;
|
|
9260
9262
|
return __awaiter(this, void 0, void 0, function () {
|
|
9261
|
-
var invokeCallback, Logger, previousMPID, uploadUrl, uploader, fetchPayload, response, identityResponse, message,
|
|
9262
|
-
return __generator(this, function (
|
|
9263
|
-
switch (
|
|
9263
|
+
var requestCount, invokeCallback, Logger, previousMPID, uploadUrl, uploader, fetchPayload, response, identityResponse, message, _d, responseBody, errorResponse, errorMessage, requestCount, err_1, requestCount, errorMessage;
|
|
9264
|
+
return __generator(this, function (_e) {
|
|
9265
|
+
switch (_e.label) {
|
|
9264
9266
|
case 0:
|
|
9267
|
+
if ((_a = mpInstance._RoktManager) === null || _a === void 0 ? void 0 : _a.isInitialized) {
|
|
9268
|
+
mpInstance._Store.identifyRequestCount = (mpInstance._Store.identifyRequestCount || 0) + 1;
|
|
9269
|
+
requestCount = mpInstance._Store.identifyRequestCount;
|
|
9270
|
+
mpInstance.captureTiming("".concat(requestCount, "-identityRequestStart"));
|
|
9271
|
+
}
|
|
9265
9272
|
invokeCallback = mpInstance._Helpers.invokeCallback;
|
|
9266
9273
|
Logger = mpInstance.Logger;
|
|
9267
9274
|
Logger.verbose(Messages$1.InformationMessages.SendIdentityBegin);
|
|
@@ -9289,16 +9296,16 @@ var mParticle = (function () {
|
|
|
9289
9296
|
body: JSON.stringify(identityApiRequest)
|
|
9290
9297
|
};
|
|
9291
9298
|
mpInstance._Store.identityCallInFlight = true;
|
|
9292
|
-
|
|
9299
|
+
_e.label = 1;
|
|
9293
9300
|
case 1:
|
|
9294
|
-
|
|
9301
|
+
_e.trys.push([1, 9,, 10]);
|
|
9295
9302
|
return [4 /*yield*/, uploader.upload(fetchPayload)];
|
|
9296
9303
|
case 2:
|
|
9297
|
-
response =
|
|
9304
|
+
response = _e.sent();
|
|
9298
9305
|
identityResponse = void 0;
|
|
9299
9306
|
message = void 0;
|
|
9300
|
-
|
|
9301
|
-
switch (
|
|
9307
|
+
_d = response.status;
|
|
9308
|
+
switch (_d) {
|
|
9302
9309
|
case HTTP_ACCEPTED:
|
|
9303
9310
|
return [3 /*break*/, 3];
|
|
9304
9311
|
case HTTP_OK:
|
|
@@ -9311,12 +9318,12 @@ var mParticle = (function () {
|
|
|
9311
9318
|
if (!response.json) return [3 /*break*/, 5];
|
|
9312
9319
|
return [4 /*yield*/, response.json()];
|
|
9313
9320
|
case 4:
|
|
9314
|
-
responseBody =
|
|
9321
|
+
responseBody = _e.sent();
|
|
9315
9322
|
identityResponse = this.getIdentityResponseFromFetch(response, responseBody);
|
|
9316
9323
|
return [3 /*break*/, 6];
|
|
9317
9324
|
case 5:
|
|
9318
9325
|
identityResponse = this.getIdentityResponseFromXHR(response);
|
|
9319
|
-
|
|
9326
|
+
_e.label = 6;
|
|
9320
9327
|
case 6:
|
|
9321
9328
|
if (identityResponse.status === HTTP_BAD_REQUEST) {
|
|
9322
9329
|
errorResponse = identityResponse.responseText;
|
|
@@ -9339,11 +9346,19 @@ var mParticle = (function () {
|
|
|
9339
9346
|
case 8:
|
|
9340
9347
|
mpInstance._Store.identityCallInFlight = false;
|
|
9341
9348
|
Logger.verbose(message);
|
|
9349
|
+
if ((_b = mpInstance._RoktManager) === null || _b === void 0 ? void 0 : _b.isInitialized) {
|
|
9350
|
+
requestCount = mpInstance._Store.identifyRequestCount;
|
|
9351
|
+
mpInstance.captureTiming("".concat(requestCount, "-identityRequestEnd"));
|
|
9352
|
+
}
|
|
9342
9353
|
parseIdentityResponse(identityResponse, previousMPID, callback, originalIdentityApiData, method, knownIdentities, false);
|
|
9343
9354
|
return [3 /*break*/, 10];
|
|
9344
9355
|
case 9:
|
|
9345
|
-
err_1 =
|
|
9356
|
+
err_1 = _e.sent();
|
|
9346
9357
|
mpInstance._Store.identityCallInFlight = false;
|
|
9358
|
+
if ((_c = mpInstance._RoktManager) === null || _c === void 0 ? void 0 : _c.isInitialized) {
|
|
9359
|
+
requestCount = mpInstance._Store.identifyRequestCount;
|
|
9360
|
+
mpInstance.captureTiming("".concat(requestCount, "-identityRequestEnd"));
|
|
9361
|
+
}
|
|
9347
9362
|
errorMessage = err_1.message || err_1.toString();
|
|
9348
9363
|
Logger.error('Error sending identity request to servers' + ' - ' + errorMessage);
|
|
9349
9364
|
invokeCallback(callback, HTTPCodes$1.noHttpCoverage, errorMessage);
|
|
@@ -9693,6 +9708,7 @@ var mParticle = (function () {
|
|
|
9693
9708
|
this.messageQueue = new Map();
|
|
9694
9709
|
this.sandbox = null;
|
|
9695
9710
|
this.placementAttributesMapping = [];
|
|
9711
|
+
this.initialized = false;
|
|
9696
9712
|
}
|
|
9697
9713
|
/**
|
|
9698
9714
|
* Initializes the RoktManager with configuration settings and user data.
|
|
@@ -9742,7 +9758,18 @@ var mParticle = (function () {
|
|
|
9742
9758
|
if (options === null || options === void 0 ? void 0 : options.domain) {
|
|
9743
9759
|
this.domain = options.domain;
|
|
9744
9760
|
}
|
|
9761
|
+
// initialized indicates that init() has been called and the RoktManager has been initialized.
|
|
9762
|
+
// This is different from isReady(), which only returns true once the kit has been attached
|
|
9763
|
+
// (which is asynchronous), and has a launcher.
|
|
9764
|
+
this.initialized = true;
|
|
9745
9765
|
};
|
|
9766
|
+
Object.defineProperty(RoktManager.prototype, "isInitialized", {
|
|
9767
|
+
get: function get() {
|
|
9768
|
+
return this.initialized;
|
|
9769
|
+
},
|
|
9770
|
+
enumerable: false,
|
|
9771
|
+
configurable: true
|
|
9772
|
+
});
|
|
9746
9773
|
RoktManager.prototype.attachKit = function (kit) {
|
|
9747
9774
|
this.kit = kit;
|
|
9748
9775
|
this.processMessageQueue();
|
|
@@ -9763,12 +9790,12 @@ var mParticle = (function () {
|
|
|
9763
9790
|
* });
|
|
9764
9791
|
*/
|
|
9765
9792
|
RoktManager.prototype.selectPlacements = function (options) {
|
|
9766
|
-
var _a, _b, _c, _d, _e;
|
|
9793
|
+
var _a, _b, _c, _d, _e, _f;
|
|
9767
9794
|
return __awaiter(this, void 0, void 0, function () {
|
|
9768
9795
|
var attributes, sandboxValue, mappedAttributes, currentUserIdentities_1, currentEmail, newEmail, currentHashedEmail, newHashedEmail, isValidHashedEmailIdentityType, emailChanged, hashedEmailChanged, newIdentities_1, error_1, finalUserIdentities, enrichedAttributes, hashedEmail, enrichedOptions, error_2;
|
|
9769
9796
|
var _this = this;
|
|
9770
|
-
return __generator(this, function (
|
|
9771
|
-
switch (
|
|
9797
|
+
return __generator(this, function (_g) {
|
|
9798
|
+
switch (_g.label) {
|
|
9772
9799
|
case 0:
|
|
9773
9800
|
if (this.captureTiming) {
|
|
9774
9801
|
this.captureTiming(PerformanceMarkType.JointSdkSelectPlacements);
|
|
@@ -9777,14 +9804,15 @@ var mParticle = (function () {
|
|
|
9777
9804
|
if (!this.isReady() || ((_a = this.store) === null || _a === void 0 ? void 0 : _a.identityCallInFlight)) {
|
|
9778
9805
|
return [2 /*return*/, this.deferredCall('selectPlacements', options)];
|
|
9779
9806
|
}
|
|
9780
|
-
|
|
9807
|
+
_g.label = 1;
|
|
9781
9808
|
case 1:
|
|
9782
|
-
|
|
9809
|
+
_g.trys.push([1, 6,, 7]);
|
|
9783
9810
|
attributes = options.attributes;
|
|
9784
9811
|
sandboxValue = (attributes === null || attributes === void 0 ? void 0 : attributes.sandbox) || null;
|
|
9785
9812
|
mappedAttributes = this.mapPlacementAttributes(attributes, this.placementAttributesMapping);
|
|
9813
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.verbose("mParticle.Rokt selectPlacements called with attributes:\n".concat(JSON.stringify(attributes, null, 2)));
|
|
9786
9814
|
this.currentUser = this.identityService.getCurrentUser();
|
|
9787
|
-
currentUserIdentities_1 = ((
|
|
9815
|
+
currentUserIdentities_1 = ((_d = (_c = this.currentUser) === null || _c === void 0 ? void 0 : _c.getUserIdentities()) === null || _d === void 0 ? void 0 : _d.userIdentities) || {};
|
|
9788
9816
|
currentEmail = currentUserIdentities_1.email;
|
|
9789
9817
|
newEmail = mappedAttributes.email;
|
|
9790
9818
|
currentHashedEmail = void 0;
|
|
@@ -9808,9 +9836,9 @@ var mParticle = (function () {
|
|
|
9808
9836
|
this.logger.warning("emailsha256 mismatch detected. Current mParticle hashedEmail differs from hashedEmail passed to selectPlacements call. Proceeding to call identify with hashedEmail from selectPlacements call. Please verify your implementation.");
|
|
9809
9837
|
}
|
|
9810
9838
|
if (!!isEmpty(newIdentities_1)) return [3 /*break*/, 5];
|
|
9811
|
-
|
|
9839
|
+
_g.label = 2;
|
|
9812
9840
|
case 2:
|
|
9813
|
-
|
|
9841
|
+
_g.trys.push([2, 4,, 5]);
|
|
9814
9842
|
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
9815
9843
|
_this.identityService.identify({
|
|
9816
9844
|
userIdentities: __assign(__assign({}, currentUserIdentities_1), newIdentities_1)
|
|
@@ -9819,16 +9847,16 @@ var mParticle = (function () {
|
|
|
9819
9847
|
});
|
|
9820
9848
|
})];
|
|
9821
9849
|
case 3:
|
|
9822
|
-
|
|
9850
|
+
_g.sent();
|
|
9823
9851
|
return [3 /*break*/, 5];
|
|
9824
9852
|
case 4:
|
|
9825
|
-
error_1 =
|
|
9853
|
+
error_1 = _g.sent();
|
|
9826
9854
|
this.logger.error('Failed to identify user with new email: ' + JSON.stringify(error_1));
|
|
9827
9855
|
return [3 /*break*/, 5];
|
|
9828
9856
|
case 5:
|
|
9829
9857
|
// Refresh current user identities to ensure we have the latest values before building enrichedAttributes
|
|
9830
9858
|
this.currentUser = this.identityService.getCurrentUser();
|
|
9831
|
-
finalUserIdentities = ((
|
|
9859
|
+
finalUserIdentities = ((_f = (_e = this.currentUser) === null || _e === void 0 ? void 0 : _e.getUserIdentities()) === null || _f === void 0 ? void 0 : _f.userIdentities) || {};
|
|
9832
9860
|
this.setUserAttributes(mappedAttributes);
|
|
9833
9861
|
enrichedAttributes = __assign(__assign({}, mappedAttributes), sandboxValue !== null ? {
|
|
9834
9862
|
sandbox: sandboxValue
|
|
@@ -9850,7 +9878,7 @@ var mParticle = (function () {
|
|
|
9850
9878
|
});
|
|
9851
9879
|
return [2 /*return*/, this.kit.selectPlacements(enrichedOptions)];
|
|
9852
9880
|
case 6:
|
|
9853
|
-
error_2 =
|
|
9881
|
+
error_2 = _g.sent();
|
|
9854
9882
|
return [2 /*return*/, Promise.reject(error_2 instanceof Error ? error_2 : new Error('Unknown error occurred'))];
|
|
9855
9883
|
case 7:
|
|
9856
9884
|
return [2 /*return*/];
|
package/package.json
CHANGED
package/src/identityApiClient.ts
CHANGED
|
@@ -193,6 +193,12 @@ export default function IdentityAPIClient(
|
|
|
193
193
|
mpid: MPID,
|
|
194
194
|
knownIdentities: UserIdentities
|
|
195
195
|
) {
|
|
196
|
+
if (mpInstance._RoktManager?.isInitialized) {
|
|
197
|
+
mpInstance._Store.identifyRequestCount = (mpInstance._Store.identifyRequestCount || 0) + 1;
|
|
198
|
+
const requestCount = mpInstance._Store.identifyRequestCount;
|
|
199
|
+
mpInstance.captureTiming(`${requestCount}-identityRequestStart`);
|
|
200
|
+
}
|
|
201
|
+
|
|
196
202
|
const { invokeCallback } = mpInstance._Helpers;
|
|
197
203
|
const { Logger } = mpInstance;
|
|
198
204
|
Logger.verbose(Messages.InformationMessages.SendIdentityBegin);
|
|
@@ -289,6 +295,10 @@ export default function IdentityAPIClient(
|
|
|
289
295
|
mpInstance._Store.identityCallInFlight = false;
|
|
290
296
|
|
|
291
297
|
Logger.verbose(message);
|
|
298
|
+
if (mpInstance._RoktManager?.isInitialized) {
|
|
299
|
+
const requestCount = mpInstance._Store.identifyRequestCount;
|
|
300
|
+
mpInstance.captureTiming(`${requestCount}-identityRequestEnd`);
|
|
301
|
+
}
|
|
292
302
|
parseIdentityResponse(
|
|
293
303
|
identityResponse,
|
|
294
304
|
previousMPID,
|
|
@@ -300,6 +310,10 @@ export default function IdentityAPIClient(
|
|
|
300
310
|
);
|
|
301
311
|
} catch (err) {
|
|
302
312
|
mpInstance._Store.identityCallInFlight = false;
|
|
313
|
+
if (mpInstance._RoktManager?.isInitialized) {
|
|
314
|
+
const requestCount = mpInstance._Store.identifyRequestCount;
|
|
315
|
+
mpInstance.captureTiming(`${requestCount}-identityRequestEnd`);
|
|
316
|
+
}
|
|
303
317
|
|
|
304
318
|
const errorMessage = (err as Error).message || err.toString();
|
|
305
319
|
|
package/src/roktManager.ts
CHANGED
|
@@ -102,6 +102,7 @@ export default class RoktManager {
|
|
|
102
102
|
private domain?: string;
|
|
103
103
|
private mappedEmailShaIdentityType?: string | null;
|
|
104
104
|
private captureTiming?: (metricsName: string) => void;
|
|
105
|
+
private initialized: boolean = false;
|
|
105
106
|
/**
|
|
106
107
|
* Initializes the RoktManager with configuration settings and user data.
|
|
107
108
|
*
|
|
@@ -157,6 +158,14 @@ export default class RoktManager {
|
|
|
157
158
|
if (options?.domain) {
|
|
158
159
|
this.domain = options.domain;
|
|
159
160
|
}
|
|
161
|
+
// initialized indicates that init() has been called and the RoktManager has been initialized.
|
|
162
|
+
// This is different from isReady(), which only returns true once the kit has been attached
|
|
163
|
+
// (which is asynchronous), and has a launcher.
|
|
164
|
+
this.initialized = true;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
public get isInitialized(): boolean {
|
|
168
|
+
return this.initialized;
|
|
160
169
|
}
|
|
161
170
|
|
|
162
171
|
public attachKit(kit: IRoktKit): void {
|
|
@@ -193,7 +202,8 @@ export default class RoktManager {
|
|
|
193
202
|
const { attributes } = options;
|
|
194
203
|
const sandboxValue = attributes?.sandbox || null;
|
|
195
204
|
const mappedAttributes = this.mapPlacementAttributes(attributes, this.placementAttributesMapping);
|
|
196
|
-
|
|
205
|
+
this.logger?.verbose(`mParticle.Rokt selectPlacements called with attributes:\n${JSON.stringify(attributes, null, 2)}`);
|
|
206
|
+
|
|
197
207
|
this.currentUser = this.identityService.getCurrentUser();
|
|
198
208
|
const currentUserIdentities = this.currentUser?.getUserIdentities()?.userIdentities || {};
|
|
199
209
|
|
package/src/store.ts
CHANGED
|
@@ -182,6 +182,7 @@ export interface IStore {
|
|
|
182
182
|
context: Context | null;
|
|
183
183
|
configurationLoaded: boolean;
|
|
184
184
|
identityCallInFlight: boolean;
|
|
185
|
+
identifyRequestCount: number;
|
|
185
186
|
SDKConfig: Partial<SDKConfig>;
|
|
186
187
|
nonCurrentUserMPIDs: Record<MPID, Dictionary>;
|
|
187
188
|
identifyCalled: boolean;
|
|
@@ -266,6 +267,7 @@ export default function Store(
|
|
|
266
267
|
context: null,
|
|
267
268
|
configurationLoaded: false,
|
|
268
269
|
identityCallInFlight: false,
|
|
270
|
+
identifyRequestCount: 0,
|
|
269
271
|
SDKConfig: {},
|
|
270
272
|
nonCurrentUserMPIDs: {},
|
|
271
273
|
identifyCalled: false,
|