@mparticle/web-sdk 2.41.0 → 2.41.1
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 +9 -3
- package/dist/mparticle.esm.js +9 -3
- package/dist/mparticle.js +9 -10
- package/package.json +1 -1
- package/src/mp-instance.ts +2 -4
- package/src/roktManager.ts +3 -6
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.41.
|
|
18
|
+
var version = "2.41.1";
|
|
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/"},Base64CookieKeys:{csm:1,sa:1,ss:1,ua:1,ui:1,csd:1,ia:1,con:1},// https://go.mparticle.com/work/SQDSDKS-6039
|
|
@@ -1427,7 +1427,13 @@ var RoktManager=/** @class */function(){function a(){this.kit=null,this.filters=
|
|
|
1427
1427
|
* @param {IRoktOptions} options - Options for the RoktManager
|
|
1428
1428
|
*
|
|
1429
1429
|
* @throws Logs error to console if placementAttributesMapping parsing fails
|
|
1430
|
-
*/return a.prototype.init=function(a,b,c,d,e){var f
|
|
1430
|
+
*/return a.prototype.init=function(a,b,c,d,e){var f=a||{},g=f.userAttributeFilters,h=f.settings,i=(h||{}).placementAttributesMapping;try{this.placementAttributesMapping=parseSettingsString(i);}catch(a){console.error("Error parsing placement attributes mapping from config",a);}this.identityService=c,this.logger=d,this.filters={userAttributeFilters:g,filterUserAttributes:KitFilterHelper.filterUserAttributes,filteredUser:b};// This is the global setting for sandbox mode
|
|
1431
|
+
// It is set here and passed in to the createLauncher method in the Rokt Kit
|
|
1432
|
+
// This is not to be confused for the `sandbox` flag in the selectPlacements attributes
|
|
1433
|
+
// as that is independent of this setting, though they share the same name.
|
|
1434
|
+
var j=(null===e||void 0===e?void 0:e.sandbox)||!1;// Launcher options are set here for the kit to pick up and pass through
|
|
1435
|
+
// to the Rokt Launcher.
|
|
1436
|
+
this.launcherOptions=__assign({sandbox:j},null===e||void 0===e?void 0:e.launcherOptions);},a.prototype.attachKit=function(a){this.kit=a,this.processMessageQueue();},a.prototype.selectPlacements=function(a){var b,c;return __awaiter(this,void 0,void 0,function(){var d,e,f,g,h,i,j,k,l,m,n=this;return __generator(this,function(o){switch(o.label){case 0:if(!this.isReady())return this.queueMessage({methodName:"selectPlacements",payload:a}),[2/*return*/,Promise.resolve({})];o.label=1;case 1:if(o.trys.push([1,6,,7]),d=a.attributes,e=(null===d||void 0===d?void 0:d.sandbox)||null,f=this.mapPlacementAttributes(d,this.placementAttributesMapping),this.currentUser=this.identityService.getCurrentUser(),g=(null===(c=null===(b=this.currentUser)||void 0===b?void 0:b.getUserIdentities())||void 0===c?void 0:c.userIdentities)||{},h=g.email,i=f.email,!i||h&&h===i)return [3/*break*/,5];h&&h!==i&&this.logger.warning("Email mismatch detected. Current email, ".concat(h," differs from email passed to selectPlacements call, ").concat(i,". Proceeding to call identify with ").concat(i,". Please verify your implementation.")),o.label=2;case 2:return o.trys.push([2,4,,5]),[4/*yield*/,new Promise(function(a){n.identityService.identify({userIdentities:__assign(__assign({},g),{email:i})},function(){a();});})];case 3:return o.sent(),[3/*break*/,5];case 4:return j=o.sent(),this.logger.error("Failed to identify user with new email: "+JSON.stringify(j)),[3/*break*/,5];case 5:return this.setUserAttributes(f),k=__assign(__assign({},f),null===e?{}:{sandbox:e}),l=__assign(__assign({},a),{attributes:k}),[2/*return*/,this.kit.selectPlacements(l)];case 6:return m=o.sent(),[2/*return*/,Promise.reject(m instanceof Error?m:new Error("Unknown error occurred"))];case 7:return [2/*return*/]}})})},a.prototype.hashAttributes=function(a){if(!this.isReady())return this.queueMessage({methodName:"hashAttributes",payload:a}),Promise.resolve({});try{return this.kit.hashAttributes(a)}catch(a){return Promise.reject(a instanceof Error?a:new Error("Unknown error occurred"))}},a.prototype.setExtensionData=function(a){if(!this.isReady())return void this.queueMessage({methodName:"setExtensionData",payload: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.isReady=function(){// The Rokt Manager is ready when a kit is attached and has a launcher
|
|
1431
1437
|
return !!(this.kit&&this.kit.launcher)},a.prototype.setUserAttributes=function(a){var b=["sandbox"],c={};for(var d in a)a.hasOwnProperty(d)&&-1===b.indexOf(d)&&(c[d]=a[d]);try{this.currentUser.setUserAttributes(c);}catch(a){console.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.processMessageQueue=function(){var a=this;0<this.messageQueue.length&&this.isReady()&&(this.messageQueue.forEach(function(b){return __awaiter(a,void 0,void 0,function(){return __generator(this,function(a){switch(a.label){case 0:return this.kit&&b.methodName in this.kit?[4/*yield*/,this.kit[b.methodName](b.payload)]:[3/*break*/,2];case 1:a.sent(),a.label=2;case 2:return [2/*return*/]}})})}),this.messageQueue=[]);},a.prototype.queueMessage=function(a){this.messageQueue.push(a);},a}();
|
|
1432
1438
|
|
|
1433
1439
|
var Messages=Constants.Messages,HTTPCodes=Constants.HTTPCodes,FeatureFlags=Constants.FeatureFlags,ReportBatching=FeatureFlags.ReportBatching,CaptureIntegrationSpecificIds=FeatureFlags.CaptureIntegrationSpecificIds,StartingInitialization=Messages.InformationMessages.StartingInitialization;/**
|
|
@@ -1766,7 +1772,7 @@ function completeSDKInitialization(a,b,c){var d=createKitBlocker(b,c);// Web Vie
|
|
|
1766
1772
|
// persistence or Identity directly.
|
|
1767
1773
|
if(c._APIClient=new APIClient(c,d),c._Forwarders=new Forwarders(c,d),c._Store.processConfig(b),c._Identity.idCache=createIdentityCache(c),removeExpiredIdentityCacheDates(c._Identity.idCache),c._Store.webviewBridgeEnabled)c._NativeSdkHelpers.initializeSessionAttributes(a);else {c._Persistence.initializeStorage(),c._Store.syncPersistenceData();// Set up user identitiy variables for later use
|
|
1768
1774
|
var e=c.Identity.getCurrentUser(),f=e?e.getMPID():null,g=e?e.getUserIdentities().userIdentities:{};c._Store.SDKConfig.identifyRequest=c._Store.hasInvalidIdentifyRequest()?{userIdentities:g}:c._Store.SDKConfig.identifyRequest,c._Helpers.getFeatureFlag(ReportBatching)&&c._ForwardingStatsUploader.startForwardingStatsTimer(),c._Helpers.getFeatureFlag(CaptureIntegrationSpecificIds)&&c._IntegrationCapture.capture();// Configure Rokt Manager with user and filtered user
|
|
1769
|
-
var h=parseConfig(b,"Rokt",181);if(h){var i=h.userAttributeFilters,j=filteredMparticleUser(f,{userAttributeFilters:i},c),k={
|
|
1775
|
+
var h=parseConfig(b,"Rokt",181);if(h){var i=h.userAttributeFilters,j=filteredMparticleUser(f,{userAttributeFilters:i},c),k={sandbox:null===b||void 0===b?void 0:b.isDevelopmentMode,launcherOptions:null===b||void 0===b?void 0:b.launcherOptions};// https://go.mparticle.com/work/SQDSDKS-7339
|
|
1770
1776
|
c._RoktManager.init(h,j,c.Identity,c.Logger,k);}c._Forwarders.processForwarders(b,c._APIClient.prepareForwardingStats),c._Forwarders.processPixelConfigs(b),c._SessionManager.initialize(),c._Events.logAST(),processIdentityCallback(c,e,f,g);}// We will continue to clear out the ready queue as part of the initial init flow
|
|
1771
1777
|
// if an identify request is unnecessary, such as if there is an existing session
|
|
1772
1778
|
(c._Store.mpid&&!c._Store.identifyCalled||c._Store.webviewBridgeEnabled)&&(c._Store.isInitialized=!0,c._preInit.readyQueue=processReadyQueue(c._preInit.readyQueue)),c._Store.isFirstRun&&(c._Store.isFirstRun=!1);}// https://go.mparticle.com/work/SQDSDKS-7061
|
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.41.
|
|
18
|
+
var version = "2.41.1";
|
|
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/"},Base64CookieKeys:{csm:1,sa:1,ss:1,ua:1,ui:1,csd:1,ia:1,con:1},// https://go.mparticle.com/work/SQDSDKS-6039
|
|
@@ -1427,7 +1427,13 @@ var RoktManager=/** @class */function(){function a(){this.kit=null,this.filters=
|
|
|
1427
1427
|
* @param {IRoktOptions} options - Options for the RoktManager
|
|
1428
1428
|
*
|
|
1429
1429
|
* @throws Logs error to console if placementAttributesMapping parsing fails
|
|
1430
|
-
*/return a.prototype.init=function(a,b,c,d,e){var f
|
|
1430
|
+
*/return a.prototype.init=function(a,b,c,d,e){var f=a||{},g=f.userAttributeFilters,h=f.settings,i=(h||{}).placementAttributesMapping;try{this.placementAttributesMapping=parseSettingsString(i);}catch(a){console.error("Error parsing placement attributes mapping from config",a);}this.identityService=c,this.logger=d,this.filters={userAttributeFilters:g,filterUserAttributes:KitFilterHelper.filterUserAttributes,filteredUser:b};// This is the global setting for sandbox mode
|
|
1431
|
+
// It is set here and passed in to the createLauncher method in the Rokt Kit
|
|
1432
|
+
// This is not to be confused for the `sandbox` flag in the selectPlacements attributes
|
|
1433
|
+
// as that is independent of this setting, though they share the same name.
|
|
1434
|
+
var j=(null===e||void 0===e?void 0:e.sandbox)||!1;// Launcher options are set here for the kit to pick up and pass through
|
|
1435
|
+
// to the Rokt Launcher.
|
|
1436
|
+
this.launcherOptions=__assign({sandbox:j},null===e||void 0===e?void 0:e.launcherOptions);},a.prototype.attachKit=function(a){this.kit=a,this.processMessageQueue();},a.prototype.selectPlacements=function(a){var b,c;return __awaiter(this,void 0,void 0,function(){var d,e,f,g,h,i,j,k,l,m,n=this;return __generator(this,function(o){switch(o.label){case 0:if(!this.isReady())return this.queueMessage({methodName:"selectPlacements",payload:a}),[2/*return*/,Promise.resolve({})];o.label=1;case 1:if(o.trys.push([1,6,,7]),d=a.attributes,e=(null===d||void 0===d?void 0:d.sandbox)||null,f=this.mapPlacementAttributes(d,this.placementAttributesMapping),this.currentUser=this.identityService.getCurrentUser(),g=(null===(c=null===(b=this.currentUser)||void 0===b?void 0:b.getUserIdentities())||void 0===c?void 0:c.userIdentities)||{},h=g.email,i=f.email,!i||h&&h===i)return [3/*break*/,5];h&&h!==i&&this.logger.warning("Email mismatch detected. Current email, ".concat(h," differs from email passed to selectPlacements call, ").concat(i,". Proceeding to call identify with ").concat(i,". Please verify your implementation.")),o.label=2;case 2:return o.trys.push([2,4,,5]),[4/*yield*/,new Promise(function(a){n.identityService.identify({userIdentities:__assign(__assign({},g),{email:i})},function(){a();});})];case 3:return o.sent(),[3/*break*/,5];case 4:return j=o.sent(),this.logger.error("Failed to identify user with new email: "+JSON.stringify(j)),[3/*break*/,5];case 5:return this.setUserAttributes(f),k=__assign(__assign({},f),null===e?{}:{sandbox:e}),l=__assign(__assign({},a),{attributes:k}),[2/*return*/,this.kit.selectPlacements(l)];case 6:return m=o.sent(),[2/*return*/,Promise.reject(m instanceof Error?m:new Error("Unknown error occurred"))];case 7:return [2/*return*/]}})})},a.prototype.hashAttributes=function(a){if(!this.isReady())return this.queueMessage({methodName:"hashAttributes",payload:a}),Promise.resolve({});try{return this.kit.hashAttributes(a)}catch(a){return Promise.reject(a instanceof Error?a:new Error("Unknown error occurred"))}},a.prototype.setExtensionData=function(a){if(!this.isReady())return void this.queueMessage({methodName:"setExtensionData",payload: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.isReady=function(){// The Rokt Manager is ready when a kit is attached and has a launcher
|
|
1431
1437
|
return !!(this.kit&&this.kit.launcher)},a.prototype.setUserAttributes=function(a){var b=["sandbox"],c={};for(var d in a)a.hasOwnProperty(d)&&-1===b.indexOf(d)&&(c[d]=a[d]);try{this.currentUser.setUserAttributes(c);}catch(a){console.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.processMessageQueue=function(){var a=this;0<this.messageQueue.length&&this.isReady()&&(this.messageQueue.forEach(function(b){return __awaiter(a,void 0,void 0,function(){return __generator(this,function(a){switch(a.label){case 0:return this.kit&&b.methodName in this.kit?[4/*yield*/,this.kit[b.methodName](b.payload)]:[3/*break*/,2];case 1:a.sent(),a.label=2;case 2:return [2/*return*/]}})})}),this.messageQueue=[]);},a.prototype.queueMessage=function(a){this.messageQueue.push(a);},a}();
|
|
1432
1438
|
|
|
1433
1439
|
var Messages=Constants.Messages,HTTPCodes=Constants.HTTPCodes,FeatureFlags=Constants.FeatureFlags,ReportBatching=FeatureFlags.ReportBatching,CaptureIntegrationSpecificIds=FeatureFlags.CaptureIntegrationSpecificIds,StartingInitialization=Messages.InformationMessages.StartingInitialization;/**
|
|
@@ -1766,7 +1772,7 @@ function completeSDKInitialization(a,b,c){var d=createKitBlocker(b,c);// Web Vie
|
|
|
1766
1772
|
// persistence or Identity directly.
|
|
1767
1773
|
if(c._APIClient=new APIClient(c,d),c._Forwarders=new Forwarders(c,d),c._Store.processConfig(b),c._Identity.idCache=createIdentityCache(c),removeExpiredIdentityCacheDates(c._Identity.idCache),c._Store.webviewBridgeEnabled)c._NativeSdkHelpers.initializeSessionAttributes(a);else {c._Persistence.initializeStorage(),c._Store.syncPersistenceData();// Set up user identitiy variables for later use
|
|
1768
1774
|
var e=c.Identity.getCurrentUser(),f=e?e.getMPID():null,g=e?e.getUserIdentities().userIdentities:{};c._Store.SDKConfig.identifyRequest=c._Store.hasInvalidIdentifyRequest()?{userIdentities:g}:c._Store.SDKConfig.identifyRequest,c._Helpers.getFeatureFlag(ReportBatching)&&c._ForwardingStatsUploader.startForwardingStatsTimer(),c._Helpers.getFeatureFlag(CaptureIntegrationSpecificIds)&&c._IntegrationCapture.capture();// Configure Rokt Manager with user and filtered user
|
|
1769
|
-
var h=parseConfig(b,"Rokt",181);if(h){var i=h.userAttributeFilters,j=filteredMparticleUser(f,{userAttributeFilters:i},c),k={
|
|
1775
|
+
var h=parseConfig(b,"Rokt",181);if(h){var i=h.userAttributeFilters,j=filteredMparticleUser(f,{userAttributeFilters:i},c),k={sandbox:null===b||void 0===b?void 0:b.isDevelopmentMode,launcherOptions:null===b||void 0===b?void 0:b.launcherOptions};// https://go.mparticle.com/work/SQDSDKS-7339
|
|
1770
1776
|
c._RoktManager.init(h,j,c.Identity,c.Logger,k);}c._Forwarders.processForwarders(b,c._APIClient.prepareForwardingStats),c._Forwarders.processPixelConfigs(b),c._SessionManager.initialize(),c._Events.logAST(),processIdentityCallback(c,e,f,g);}// We will continue to clear out the ready queue as part of the initial init flow
|
|
1771
1777
|
// if an identify request is unnecessary, such as if there is an existing session
|
|
1772
1778
|
(c._Store.mpid&&!c._Store.identifyCalled||c._Store.webviewBridgeEnabled)&&(c._Store.isInitialized=!0,c._preInit.readyQueue=processReadyQueue(c._preInit.readyQueue)),c._Store.isFirstRun&&(c._Store.isFirstRun=!1);}// https://go.mparticle.com/work/SQDSDKS-7061
|
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.41.
|
|
206
|
+
var version = "2.41.1";
|
|
207
207
|
|
|
208
208
|
var Constants = {
|
|
209
209
|
sdkVersion: version,
|
|
@@ -9683,10 +9683,9 @@ var mParticle = (function () {
|
|
|
9683
9683
|
* @throws Logs error to console if placementAttributesMapping parsing fails
|
|
9684
9684
|
*/
|
|
9685
9685
|
RoktManager.prototype.init = function (roktConfig, filteredUser, identityService, logger, options) {
|
|
9686
|
-
var _a
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
settings = _b.settings;
|
|
9686
|
+
var _a = roktConfig || {},
|
|
9687
|
+
userAttributeFilters = _a.userAttributeFilters,
|
|
9688
|
+
settings = _a.settings;
|
|
9690
9689
|
var placementAttributesMapping = (settings || {}).placementAttributesMapping;
|
|
9691
9690
|
try {
|
|
9692
9691
|
this.placementAttributesMapping = parseSettingsString(placementAttributesMapping);
|
|
@@ -9704,10 +9703,12 @@ var mParticle = (function () {
|
|
|
9704
9703
|
// It is set here and passed in to the createLauncher method in the Rokt Kit
|
|
9705
9704
|
// This is not to be confused for the `sandbox` flag in the selectPlacements attributes
|
|
9706
9705
|
// as that is independent of this setting, though they share the same name.
|
|
9707
|
-
|
|
9706
|
+
var sandbox = (options === null || options === void 0 ? void 0 : options.sandbox) || false;
|
|
9708
9707
|
// Launcher options are set here for the kit to pick up and pass through
|
|
9709
9708
|
// to the Rokt Launcher.
|
|
9710
|
-
this.launcherOptions =
|
|
9709
|
+
this.launcherOptions = __assign({
|
|
9710
|
+
sandbox: sandbox
|
|
9711
|
+
}, options === null || options === void 0 ? void 0 : options.launcherOptions);
|
|
9711
9712
|
};
|
|
9712
9713
|
RoktManager.prototype.attachKit = function (kit) {
|
|
9713
9714
|
this.kit = kit;
|
|
@@ -10865,9 +10866,7 @@ var mParticle = (function () {
|
|
|
10865
10866
|
userAttributeFilters: userAttributeFilters
|
|
10866
10867
|
}, mpInstance);
|
|
10867
10868
|
var roktOptions = {
|
|
10868
|
-
|
|
10869
|
-
sandbox: config.isDevelopmentMode
|
|
10870
|
-
},
|
|
10869
|
+
sandbox: config === null || config === void 0 ? void 0 : config.isDevelopmentMode,
|
|
10871
10870
|
launcherOptions: config === null || config === void 0 ? void 0 : config.launcherOptions
|
|
10872
10871
|
};
|
|
10873
10872
|
// https://go.mparticle.com/work/SQDSDKS-7339
|
package/package.json
CHANGED
package/src/mp-instance.ts
CHANGED
|
@@ -49,7 +49,7 @@ import { IECommerce } from './ecommerce.interfaces';
|
|
|
49
49
|
import { INativeSdkHelpers } from './nativeSdkHelpers.interfaces';
|
|
50
50
|
import { IPersistence } from './persistence.interfaces';
|
|
51
51
|
import ForegroundTimer from './foregroundTimeTracker';
|
|
52
|
-
import RoktManager, {
|
|
52
|
+
import RoktManager, { IRoktOptions } from './roktManager';
|
|
53
53
|
import filteredMparticleUser from './filteredMparticleUser';
|
|
54
54
|
|
|
55
55
|
export interface IErrorLogMessage {
|
|
@@ -1404,9 +1404,7 @@ function completeSDKInitialization(apiKey, config, mpInstance) {
|
|
|
1404
1404
|
mpInstance
|
|
1405
1405
|
);
|
|
1406
1406
|
const roktOptions: IRoktOptions = {
|
|
1407
|
-
|
|
1408
|
-
sandbox: config.isDevelopmentMode,
|
|
1409
|
-
},
|
|
1407
|
+
sandbox: config?.isDevelopmentMode,
|
|
1410
1408
|
launcherOptions: config?.launcherOptions,
|
|
1411
1409
|
};
|
|
1412
1410
|
// https://go.mparticle.com/work/SQDSDKS-7339
|
package/src/roktManager.ts
CHANGED
|
@@ -56,14 +56,11 @@ export interface IRoktKit {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export interface IRoktOptions {
|
|
59
|
-
|
|
59
|
+
sandbox?: boolean;
|
|
60
60
|
launcherOptions?: IRoktLauncherOptions;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export type IRoktLauncherOptions = Dictionary<any>;
|
|
64
|
-
export type IRoktManagerOptions = {
|
|
65
|
-
sandbox?: boolean;
|
|
66
|
-
};
|
|
67
64
|
|
|
68
65
|
// The purpose of this class is to create a link between the Core mParticle SDK and the
|
|
69
66
|
// Rokt Web SDK via a Web Kit.
|
|
@@ -124,11 +121,11 @@ export default class RoktManager {
|
|
|
124
121
|
// It is set here and passed in to the createLauncher method in the Rokt Kit
|
|
125
122
|
// This is not to be confused for the `sandbox` flag in the selectPlacements attributes
|
|
126
123
|
// as that is independent of this setting, though they share the same name.
|
|
127
|
-
|
|
124
|
+
const sandbox = options?.sandbox || false;
|
|
128
125
|
|
|
129
126
|
// Launcher options are set here for the kit to pick up and pass through
|
|
130
127
|
// to the Rokt Launcher.
|
|
131
|
-
this.launcherOptions = options?.launcherOptions;
|
|
128
|
+
this.launcherOptions = { sandbox, ...options?.launcherOptions };
|
|
132
129
|
}
|
|
133
130
|
|
|
134
131
|
public attachKit(kit: IRoktKit): void {
|