@mparticle/web-sdk 2.75.0 → 2.75.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 +15 -15
- package/dist/mparticle.esm.js +15 -15
- package/dist/mparticle.js +21 -20
- package/dist/types/src/reporting/deprecatedMethodLogger.d.ts +2 -2
- package/package.json +1 -1
- package/src/consent.ts +1 -1
- package/src/identity.js +8 -8
- package/src/mp-instance.ts +6 -6
- package/src/reporting/deprecatedMethodLogger.ts +4 -3
- package/src/sessionManager.ts +1 -1
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.75.
|
|
18
|
+
var version = "2.75.1";
|
|
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
|
|
@@ -648,7 +648,7 @@ if(!isEmpty(k)&&(isEmpty(o)||(h=!0),!(h&&d))&&!(m===PARTNER_MODULE_IDS.Rokt&&a._
|
|
|
648
648
|
return !b||new Date().getTime()>new Date(b).getTime()+a*DAYS_IN_MILLISECONDS;// Otherwise, compare the last sync date to determine if it should do a cookie sync again
|
|
649
649
|
};
|
|
650
650
|
|
|
651
|
-
function logDeprecatedMethodUsage(a,b,c){b.warning(a.warningMessage),null===c||void 0===c?void 0:c.
|
|
651
|
+
function logDeprecatedMethodUsage(a,b,c){b.warning(a.warningMessage),null===c||void 0===c?void 0:c.report({message:a.methodName,code:ErrorCodes.MP_DEPRECATED_METHOD_USAGE,severity:WSDKErrorSeverity.WARNING});}
|
|
652
652
|
|
|
653
653
|
var Messages$6=Constants.Messages;function SessionManager(a){/**
|
|
654
654
|
* Checks if the session has expired based on the last event timestamp
|
|
@@ -662,7 +662,7 @@ var Messages$6=Constants.Messages;function SessionManager(a){/**
|
|
|
662
662
|
* - Resets the time-on-site timer
|
|
663
663
|
*/function c(){var b;a._Events.logEvent({messageType:Types.MessageType.SessionEnd}),a._Store.nullifySession(),null===(b=a._timeOnSiteTimer)||void 0===b?void 0:b.resetTimer();}var d=this;this.initialize=function(){var c;if(a._Store.sessionId){var e=a._Store,f=e.dateLastEventSent,g=e.SDKConfig,h=g.sessionTimeout;if(b(null===f||void 0===f?void 0:f.getTime(),h))d.endSession(),d.startNewSession();else {// https://go.mparticle.com/work/SQDSDKS-6045
|
|
664
664
|
// https://go.mparticle.com/work/SQDSDKS-6323
|
|
665
|
-
var i=a.Identity.getCurrentUser(),j=g.identifyRequest,k=(null===(c=a._CookieConsentManager)||void 0===c?void 0:c.getNoFunctional())&&!hasExplicitIdentifier(a._Store);!k&&hasIdentityRequestChanged(i,j)&&(a.Identity.identify(j,g.identityCallback),a._Store.identifyCalled=!0,a._Store.SDKConfig.identityCallback=null);}}else d.startNewSession();},this.getSession=function(){return logDeprecatedMethodUsage({methodName:"SessionManager.getSession()",warningMessage:generateDeprecationMessage("SessionManager.getSession()",!1,"SessionManager.getSessionId()")},a.Logger,a.
|
|
665
|
+
var i=a.Identity.getCurrentUser(),j=g.identifyRequest,k=(null===(c=a._CookieConsentManager)||void 0===c?void 0:c.getNoFunctional())&&!hasExplicitIdentifier(a._Store);!k&&hasIdentityRequestChanged(i,j)&&(a.Identity.identify(j,g.identityCallback),a._Store.identifyCalled=!0,a._Store.SDKConfig.identityCallback=null);}}else d.startNewSession();},this.getSession=function(){return logDeprecatedMethodUsage({methodName:"SessionManager.getSession()",warningMessage:generateDeprecationMessage("SessionManager.getSession()",!1,"SessionManager.getSessionId()")},a.Logger,a._ErrorReportingDispatcher),this.getSessionId()},this.getSessionId=function(){return a._Store.sessionId},this.startNewSession=function(){var b;if(a.Logger.verbose(Messages$6.InformationMessages.StartingNewSession),a._Helpers.canLog()){a._Store.sessionId=a._Helpers.generateUniqueId().toUpperCase();var c=a.Identity.getCurrentUser(),e=c?c.getMPID():null;if(e&&(a._Store.currentSessionMPIDs=[e]),!a._Store.sessionStartDate){var f=new Date;a._Store.sessionStartDate=f,a._Store.dateLastEventSent=f;}d.setSessionTimer();var g=(null===(b=a._CookieConsentManager)||void 0===b?void 0:b.getNoFunctional())&&!hasExplicitIdentifier(a._Store);a._Store.identifyCalled||g||(a.Identity.identify(a._Store.SDKConfig.identifyRequest,a._Store.SDKConfig.identityCallback),a._Store.identifyCalled=!0,a._Store.SDKConfig.identityCallback=null),a._Events.logEvent({messageType:Types.MessageType.SessionStart});}else a.Logger.verbose(Messages$6.InformationMessages.AbandonStartSession);},this.endSession=function(e){var f,g,h,i;if(a.Logger.verbose(Messages$6.InformationMessages.StartingEndSession),e)return void c();if(!a._Helpers.canLog())return a.Logger.verbose(Messages$6.InformationMessages.AbandonEndSession),void(null===(f=a._timeOnSiteTimer)||void 0===f?void 0:f.resetTimer());var j=a._Persistence.getPersistence();if(!j||j.gs&&!j.gs.sid)return a.Logger.verbose(Messages$6.InformationMessages.NoSessionToEnd),void(null===(g=a._timeOnSiteTimer)||void 0===g?void 0:g.resetTimer());// sessionId is not equal to cookies.sid if cookies.sid is changed in another tab
|
|
666
666
|
if(j.gs.sid&&a._Store.sessionId!==j.gs.sid&&(a._Store.sessionId=j.gs.sid),null===(h=null===j||void 0===j?void 0:j.gs)||void 0===h?void 0:h.les){var k=a._Store.SDKConfig.sessionTimeout;b(j.gs.les,k)?c():(d.setSessionTimer(),null===(i=a._timeOnSiteTimer)||void 0===i?void 0:i.resetTimer());}},this.setSessionTimer=function(){var b=6e4*a._Store.SDKConfig.sessionTimeout;a._Store.globalTimer=window.setTimeout(function(){d.endSession();},b);},this.resetSessionTimer=function(){a._Store.webviewBridgeEnabled||(!a._Store.sessionId&&d.startNewSession(),d.clearSessionTimeout(),d.setSessionTimer()),d.startNewSessionIfNeeded();},this.clearSessionTimeout=function(){clearTimeout(a._Store.globalTimer);},this.startNewSessionIfNeeded=function(){if(!a._Store.webviewBridgeEnabled){var b=a._Persistence.getPersistence();!a._Store.sessionId&&b&&(b.sid?a._Store.sessionId=b.sid:d.startNewSession());}};}
|
|
667
667
|
|
|
668
668
|
var Messages$5=Constants.Messages;function Ecommerce(a){var b=this;// https://go.mparticle.com/work/SQDSDKS-4801
|
|
@@ -1433,7 +1433,7 @@ if(u?(o=!1,d=l[u],delete l[u]):o=!0,l[r]=a,t._Store.setUserAttributes(e,l),!d||!
|
|
|
1433
1433
|
* Returns the cart object for the current user
|
|
1434
1434
|
* @method getCart
|
|
1435
1435
|
* @return a cart object
|
|
1436
|
-
*/getCart:function getCart(){return logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart()",warningMessage:"Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases"},t.Logger,t.
|
|
1436
|
+
*/getCart:function getCart(){return logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart()",warningMessage:"Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases"},t.Logger,t._ErrorReportingDispatcher),s.mParticleUserCart()},/**
|
|
1437
1437
|
* Returns the Consent State stored locally for this user.
|
|
1438
1438
|
* @method getConsentState
|
|
1439
1439
|
* @return a ConsentState object
|
|
@@ -1451,20 +1451,20 @@ return t._Helpers.getFeatureFlag(FeatureFlags$1.AudienceAPI)?void(null===s.audie
|
|
|
1451
1451
|
* Adds a cart product to the user cart
|
|
1452
1452
|
* @method add
|
|
1453
1453
|
* @deprecated
|
|
1454
|
-
*/add:function add(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().add()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().add()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t.
|
|
1454
|
+
*/add:function add(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().add()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().add()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t._ErrorReportingDispatcher);},/**
|
|
1455
1455
|
* Removes a cart product from the current user cart
|
|
1456
1456
|
* @method remove
|
|
1457
1457
|
* @deprecated
|
|
1458
|
-
*/remove:function remove(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().remove()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().remove()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t.
|
|
1458
|
+
*/remove:function remove(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().remove()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().remove()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t._ErrorReportingDispatcher);},/**
|
|
1459
1459
|
* Clears the user's cart
|
|
1460
1460
|
* @method clear
|
|
1461
1461
|
* @deprecated
|
|
1462
|
-
*/clear:function clear(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().clear()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().clear()",!0,"","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t.
|
|
1462
|
+
*/clear:function clear(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().clear()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().clear()",!0,"","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t._ErrorReportingDispatcher);},/**
|
|
1463
1463
|
* Returns all cart products
|
|
1464
1464
|
* @method getCartProducts
|
|
1465
1465
|
* @return {Array} array of cart products
|
|
1466
1466
|
* @deprecated
|
|
1467
|
-
*/getCartProducts:function getCartProducts(){return logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().getCartProducts()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().getCartProducts()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t.
|
|
1467
|
+
*/getCartProducts:function getCartProducts(){return logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().getCartProducts()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().getCartProducts()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t._ErrorReportingDispatcher),[]}}},this.parseIdentityResponse=function(r,i,a,d,o,g,l){var u,p,y,I=t.Identity.getUser(i),c=I?I.getMPID():null,_=I?I.getUserIdentities().userIdentities:{},v={};t._Store.identityCallInFlight=!1;try{var m,b,S;if(t.Logger.verbose("Parsing \""+o+"\" identity response from server"),p=null!==(m=r.responseText)&&void 0!==m?m:null,t._Store.isLoggedIn=(null===(b=p)||void 0===b?void 0:b.is_logged_in)||!1,hasMPIDChanged(I,p)&&(t._Store.mpid=p.mpid,I&&t._Persistence.setLastSeenTime(i),u=!t._Persistence.getFirstSeenTime(p.mpid),t._Persistence.setFirstSeenTime(p.mpid)),r.status===HTTP_OK){var A;s(CacheIdentity)&&cacheOrClearIdCache(o,g,n.idCache,r,l);var U=n.IdentityAPI.getUser(p.mpid),C=U?U.getUserIdentities().userIdentities:{};o===Modify$1?(v=t._Identity.IdentityRequest.combineUserIdentities(_,d.userIdentities),t._Store.setUserIdentities(i,v)):(o===Identify&&I&&p.mpid===c&&t._Persistence.setFirstSeenTime(p.mpid),t._Store.addMpidToSessionHistory(p.mpid,i),t._CookieSyncManager.attemptCookieSync(p.mpid,u),t._Persistence.swapCurrentUser(i,p.mpid,t._Store.currentSessionMPIDs),d&&!isEmpty(d.userIdentities)&&(v=n.IdentityRequest.combineUserIdentities(C,d.userIdentities)),t._Store.setUserIdentities(p.mpid,v),t._Persistence.update(),t._Store.syncPersistenceData(),t._Persistence.findPrevCookiesBasedOnUI(d),t._Store.context=p.context||t._Store.context),y=t.Identity.getCurrentUser(),tryOnUserAlias(I,y,d,t.Logger,t._ErrorReportingDispatcher);var k=t._Persistence.getPersistence();y&&(t._Persistence.storeDataInMemory(k,y.getMPID()),n.reinitForwardersOnUserChange(I,y),n.setForwarderCallbacks(y,o));var P=IdentityType.getNewIdentitiesByName(v),f=o===Modify$1?_:C;// Sync $NoTargeting before sendUserIdentityChangeEvent
|
|
1468
1468
|
// because UIC events call sendEventToServer which triggers
|
|
1469
1469
|
// processQueuedEvents, draining the event queue. The
|
|
1470
1470
|
// attribute must be in the store before that happens so
|
|
@@ -1529,7 +1529,7 @@ var f=e.getGDPRConsentState();if(f)for(var g in f)f.hasOwnProperty(g)&&(c=KitFil
|
|
|
1529
1529
|
*/function j(){return delete l[CCPAPurpose],this}// TODO: Can we remove this? It is deprecated.
|
|
1530
1530
|
var k={},l={};if(c){var m=b.createConsentState();// TODO: Remove casting once `removeCCPAState` is removed;
|
|
1531
1531
|
return m.setGDPRConsentState(c.getGDPRConsentState()),m.setCCPAConsentState(c.getCCPAConsentState()),m}return {setGDPRConsentState:f,addGDPRConsentState:e,setCCPAConsentState:i,getCCPAConsentState:function a(){return l[CCPAPurpose]},getGDPRConsentState:h,removeGDPRConsentState:g,removeCCPAState:function b(){// @ts-ignore
|
|
1532
|
-
return logDeprecatedMethodUsage({methodName:"Consent.removeCCPAState",warningMessage:"removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead"},a.Logger,a.
|
|
1532
|
+
return logDeprecatedMethodUsage({methodName:"Consent.removeCCPAState",warningMessage:"removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead"},a.Logger,a._ErrorReportingDispatcher),j()},removeCCPAConsentState:j}};}
|
|
1533
1533
|
|
|
1534
1534
|
/*
|
|
1535
1535
|
TODO: Including this as a workaround because attempting to import it from
|
|
@@ -1702,17 +1702,17 @@ b._SessionManager.endSession(!0);},this.logBaseEvent=function(a,c){var d=queueIf
|
|
|
1702
1702
|
* @param {Object} product The product you want to add to the cart
|
|
1703
1703
|
* @param {Boolean} [logEventBoolean] Option to log the event to mParticle's servers. If blank, no logging occurs.
|
|
1704
1704
|
* @deprecated
|
|
1705
|
-
*/add:function add(){logDeprecatedMethodUsage({methodName:"mPInstance.eCommerce.Cart.add()",warningMessage:generateDeprecationMessage("eCommerce.Cart.add()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},b.Logger,b.
|
|
1705
|
+
*/add:function add(){logDeprecatedMethodUsage({methodName:"mPInstance.eCommerce.Cart.add()",warningMessage:generateDeprecationMessage("eCommerce.Cart.add()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},b.Logger,b._ErrorReportingDispatcher);},/**
|
|
1706
1706
|
* Removes a product from the cart
|
|
1707
1707
|
* @method remove
|
|
1708
1708
|
* @param {Object} product The product you want to add to the cart
|
|
1709
1709
|
* @param {Boolean} [logEventBoolean] Option to log the event to mParticle's servers. If blank, no logging occurs.
|
|
1710
1710
|
* @deprecated
|
|
1711
|
-
*/remove:function remove(){logDeprecatedMethodUsage({methodName:"mPInstance.eCommerce.Cart.remove()",warningMessage:generateDeprecationMessage("eCommerce.Cart.remove()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},b.Logger,b.
|
|
1711
|
+
*/remove:function remove(){logDeprecatedMethodUsage({methodName:"mPInstance.eCommerce.Cart.remove()",warningMessage:generateDeprecationMessage("eCommerce.Cart.remove()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},b.Logger,b._ErrorReportingDispatcher);},/**
|
|
1712
1712
|
* Clears the cart
|
|
1713
1713
|
* @method clear
|
|
1714
1714
|
* @deprecated
|
|
1715
|
-
*/clear:function clear(){logDeprecatedMethodUsage({methodName:"mPInstance.eCommerce.Cart.clear()",warningMessage:generateDeprecationMessage("eCommerce.Cart.clear()",!0,"","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},b.Logger,b.
|
|
1715
|
+
*/clear:function clear(){logDeprecatedMethodUsage({methodName:"mPInstance.eCommerce.Cart.clear()",warningMessage:generateDeprecationMessage("eCommerce.Cart.clear()",!0,"","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},b.Logger,b._ErrorReportingDispatcher);}},/**
|
|
1716
1716
|
* Sets the currency code
|
|
1717
1717
|
* @for mParticle.eCommerce
|
|
1718
1718
|
* @method setCurrencyCode
|
|
@@ -1764,7 +1764,7 @@ b._SessionManager.endSession(!0);},this.logBaseEvent=function(a,c){var d=queueIf
|
|
|
1764
1764
|
* @param {Object} attrs
|
|
1765
1765
|
* @param {Object} [customFlags] Custom flags for the event
|
|
1766
1766
|
* @deprecated
|
|
1767
|
-
*/logCheckout:function logCheckout(a,c,d,e){return logDeprecatedMethodUsage({methodName:"mParticle.logCheckout",warningMessage:"mParticle.logCheckout is deprecated, please use mParticle.logProductAction instead"},b.Logger,b.
|
|
1767
|
+
*/logCheckout:function logCheckout(a,c,d,e){return logDeprecatedMethodUsage({methodName:"mParticle.logCheckout",warningMessage:"mParticle.logCheckout is deprecated, please use mParticle.logProductAction instead"},b.Logger,b._ErrorReportingDispatcher),b._Store.isInitialized?void(b._SessionManager.resetSessionTimer(),b._Events.logCheckoutEvent(a,c,d,e)):void b.ready(function(){b.eCommerce.logCheckout(a,c,d,e);})},/**
|
|
1768
1768
|
* Logs a product action
|
|
1769
1769
|
* @for mParticle.eCommerce
|
|
1770
1770
|
* @method logProductAction
|
|
@@ -1784,7 +1784,7 @@ b._SessionManager.endSession(!0);},this.logBaseEvent=function(a,c){var d=queueIf
|
|
|
1784
1784
|
* @param {Object} [attrs] other attributes related to the product purchase
|
|
1785
1785
|
* @param {Object} [customFlags] Custom flags for the event
|
|
1786
1786
|
* @deprecated
|
|
1787
|
-
*/logPurchase:function logPurchase(a,c,d,e,f){return logDeprecatedMethodUsage({methodName:"mParticle.logPurchase",warningMessage:"mParticle.logPurchase is deprecated, please use mParticle.logProductAction instead"},b.Logger,b.
|
|
1787
|
+
*/logPurchase:function logPurchase(a,c,d,e,f){return logDeprecatedMethodUsage({methodName:"mParticle.logPurchase",warningMessage:"mParticle.logPurchase is deprecated, please use mParticle.logProductAction instead"},b.Logger,b._ErrorReportingDispatcher),b._Store.isInitialized?a&&c?void(b._SessionManager.resetSessionTimer(),b._Events.logPurchaseEvent(a,c,e,f)):void b.Logger.error(Messages.ErrorMessages.BadLogPurchase):void b.ready(function(){b.eCommerce.logPurchase(a,c,d,e,f);})},/**
|
|
1788
1788
|
* Logs a product promotion
|
|
1789
1789
|
* @for mParticle.eCommerce
|
|
1790
1790
|
* @method logPromotion
|
|
@@ -1811,7 +1811,7 @@ b._SessionManager.endSession(!0);},this.logBaseEvent=function(a,c){var d=queueIf
|
|
|
1811
1811
|
* @param {Object} [attrs] attributes related to the refund
|
|
1812
1812
|
* @param {Object} [customFlags] Custom flags for the event
|
|
1813
1813
|
* @deprecated
|
|
1814
|
-
*/logRefund:function logRefund(a,c,d,e,f){return logDeprecatedMethodUsage({methodName:"mParticle.logRefund",warningMessage:"mParticle.logRefund is deprecated, please use mParticle.logProductAction instead"},b.Logger,b.
|
|
1814
|
+
*/logRefund:function logRefund(a,c,d,e,f){return logDeprecatedMethodUsage({methodName:"mParticle.logRefund",warningMessage:"mParticle.logRefund is deprecated, please use mParticle.logProductAction instead"},b.Logger,b._ErrorReportingDispatcher),b._Store.isInitialized?void(b._SessionManager.resetSessionTimer(),b._Events.logRefundEvent(a,c,e,f)):void b.ready(function(){b.eCommerce.logRefund(a,c,d,e,f);})},expandCommerceEvent:function expandCommerceEvent(a){return b._Ecommerce.expandCommerceEvent(a)}},this.setSessionAttribute=function(a,c){var d,e=(null===(d=b._CookieConsentManager)||void 0===d?void 0:d.getNoFunctional())&&!hasExplicitIdentifier(b._Store);if(!e){var f=queueIfNotInitialized(function(){b.setSessionAttribute(a,c);},b);if(f)return}// Logs to cookie
|
|
1815
1815
|
// And logs to in-memory object
|
|
1816
1816
|
// Example: mParticle.setSessionAttribute('location', '33431');
|
|
1817
1817
|
if(b._Helpers.canLog()){if(!b._Helpers.Validators.isValidAttributeValue(c))return void b.Logger.error(Messages.ErrorMessages.BadAttribute);if(!b._Helpers.Validators.isValidKeyValue(a))return void b.Logger.error(Messages.ErrorMessages.BadKey);if(b._Store.webviewBridgeEnabled)b._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetSessionAttribute,JSON.stringify({key:a,value:c}));else {var g=b._Helpers.findKeyInObject(b._Store.sessionAttributes,a);g&&(a=g),b._Store.sessionAttributes[a]=c,b._Persistence.update(),b._Forwarders.applyToForwarders("setSessionAttribute",[a,c]);}}},this.setOptOut=function(a){var c=queueIfNotInitialized(function(){b.setOptOut(a);},b);c||(b._SessionManager.resetSessionTimer(),b._Store.isEnabled=!a,b._Events.logOptOut(),b._Persistence.update(),b._Store.activeForwarders.length&&b._Store.activeForwarders.forEach(function(c){if(c.setOptOut){var d=c.setOptOut(a);d&&b.Logger.verbose(d);}}));},this.setIntegrationAttribute=function(a,c){var d=queueIfNotInitialized(function(){b.setIntegrationAttribute(a,c);},b);if(!d){if("number"!=typeof a)return void b.Logger.error("integrationId must be a number");if(null===c)b._Store.integrationAttributes[a]={};else {if(!b._Helpers.isObject(c))return void b.Logger.error("Attrs must be an object with keys and values. You entered a "+_typeof$1(c));if(0===Object.keys(c).length)b._Store.integrationAttributes[a]={};else for(var e in c)if("string"!=typeof e){b.Logger.error("Keys must be strings, you entered a "+_typeof$1(e));continue}else if("string"==typeof c[e])b._Helpers.isObject(b._Store.integrationAttributes[a])?b._Store.integrationAttributes[a][e]=c[e]:(b._Store.integrationAttributes[a]={},b._Store.integrationAttributes[a][e]=c[e]);else {b.Logger.error("Values for integration attributes must be strings. You entered a "+_typeof$1(c[e]));continue}}b._Persistence.update();}},this.getIntegrationAttributes=function(a){return b._Store.integrationAttributes[a]?b._Store.integrationAttributes[a]:{}},this.addForwarder=function(a){b._preInit.forwarderConstructors.push(a);},this.configurePixel=function(a){b._Forwarders.configurePixel(a);},this._getActiveForwarders=function(){return b._Store.activeForwarders},this._getIntegrationDelays=function(){return b._preInit.integrationDelays},this._setIntegrationDelay=function(a,c){// If the integration delay is set to true, no further action needed
|
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.75.
|
|
18
|
+
var version = "2.75.1";
|
|
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
|
|
@@ -648,7 +648,7 @@ if(!isEmpty(k)&&(isEmpty(o)||(h=!0),!(h&&d))&&!(m===PARTNER_MODULE_IDS.Rokt&&a._
|
|
|
648
648
|
return !b||new Date().getTime()>new Date(b).getTime()+a*DAYS_IN_MILLISECONDS;// Otherwise, compare the last sync date to determine if it should do a cookie sync again
|
|
649
649
|
};
|
|
650
650
|
|
|
651
|
-
function logDeprecatedMethodUsage(a,b,c){b.warning(a.warningMessage),null===c||void 0===c?void 0:c.
|
|
651
|
+
function logDeprecatedMethodUsage(a,b,c){b.warning(a.warningMessage),null===c||void 0===c?void 0:c.report({message:a.methodName,code:ErrorCodes.MP_DEPRECATED_METHOD_USAGE,severity:WSDKErrorSeverity.WARNING});}
|
|
652
652
|
|
|
653
653
|
var Messages$6=Constants.Messages;function SessionManager(a){/**
|
|
654
654
|
* Checks if the session has expired based on the last event timestamp
|
|
@@ -662,7 +662,7 @@ var Messages$6=Constants.Messages;function SessionManager(a){/**
|
|
|
662
662
|
* - Resets the time-on-site timer
|
|
663
663
|
*/function c(){var b;a._Events.logEvent({messageType:Types.MessageType.SessionEnd}),a._Store.nullifySession(),null===(b=a._timeOnSiteTimer)||void 0===b?void 0:b.resetTimer();}var d=this;this.initialize=function(){var c;if(a._Store.sessionId){var e=a._Store,f=e.dateLastEventSent,g=e.SDKConfig,h=g.sessionTimeout;if(b(null===f||void 0===f?void 0:f.getTime(),h))d.endSession(),d.startNewSession();else {// https://go.mparticle.com/work/SQDSDKS-6045
|
|
664
664
|
// https://go.mparticle.com/work/SQDSDKS-6323
|
|
665
|
-
var i=a.Identity.getCurrentUser(),j=g.identifyRequest,k=(null===(c=a._CookieConsentManager)||void 0===c?void 0:c.getNoFunctional())&&!hasExplicitIdentifier(a._Store);!k&&hasIdentityRequestChanged(i,j)&&(a.Identity.identify(j,g.identityCallback),a._Store.identifyCalled=!0,a._Store.SDKConfig.identityCallback=null);}}else d.startNewSession();},this.getSession=function(){return logDeprecatedMethodUsage({methodName:"SessionManager.getSession()",warningMessage:generateDeprecationMessage("SessionManager.getSession()",!1,"SessionManager.getSessionId()")},a.Logger,a.
|
|
665
|
+
var i=a.Identity.getCurrentUser(),j=g.identifyRequest,k=(null===(c=a._CookieConsentManager)||void 0===c?void 0:c.getNoFunctional())&&!hasExplicitIdentifier(a._Store);!k&&hasIdentityRequestChanged(i,j)&&(a.Identity.identify(j,g.identityCallback),a._Store.identifyCalled=!0,a._Store.SDKConfig.identityCallback=null);}}else d.startNewSession();},this.getSession=function(){return logDeprecatedMethodUsage({methodName:"SessionManager.getSession()",warningMessage:generateDeprecationMessage("SessionManager.getSession()",!1,"SessionManager.getSessionId()")},a.Logger,a._ErrorReportingDispatcher),this.getSessionId()},this.getSessionId=function(){return a._Store.sessionId},this.startNewSession=function(){var b;if(a.Logger.verbose(Messages$6.InformationMessages.StartingNewSession),a._Helpers.canLog()){a._Store.sessionId=a._Helpers.generateUniqueId().toUpperCase();var c=a.Identity.getCurrentUser(),e=c?c.getMPID():null;if(e&&(a._Store.currentSessionMPIDs=[e]),!a._Store.sessionStartDate){var f=new Date;a._Store.sessionStartDate=f,a._Store.dateLastEventSent=f;}d.setSessionTimer();var g=(null===(b=a._CookieConsentManager)||void 0===b?void 0:b.getNoFunctional())&&!hasExplicitIdentifier(a._Store);a._Store.identifyCalled||g||(a.Identity.identify(a._Store.SDKConfig.identifyRequest,a._Store.SDKConfig.identityCallback),a._Store.identifyCalled=!0,a._Store.SDKConfig.identityCallback=null),a._Events.logEvent({messageType:Types.MessageType.SessionStart});}else a.Logger.verbose(Messages$6.InformationMessages.AbandonStartSession);},this.endSession=function(e){var f,g,h,i;if(a.Logger.verbose(Messages$6.InformationMessages.StartingEndSession),e)return void c();if(!a._Helpers.canLog())return a.Logger.verbose(Messages$6.InformationMessages.AbandonEndSession),void(null===(f=a._timeOnSiteTimer)||void 0===f?void 0:f.resetTimer());var j=a._Persistence.getPersistence();if(!j||j.gs&&!j.gs.sid)return a.Logger.verbose(Messages$6.InformationMessages.NoSessionToEnd),void(null===(g=a._timeOnSiteTimer)||void 0===g?void 0:g.resetTimer());// sessionId is not equal to cookies.sid if cookies.sid is changed in another tab
|
|
666
666
|
if(j.gs.sid&&a._Store.sessionId!==j.gs.sid&&(a._Store.sessionId=j.gs.sid),null===(h=null===j||void 0===j?void 0:j.gs)||void 0===h?void 0:h.les){var k=a._Store.SDKConfig.sessionTimeout;b(j.gs.les,k)?c():(d.setSessionTimer(),null===(i=a._timeOnSiteTimer)||void 0===i?void 0:i.resetTimer());}},this.setSessionTimer=function(){var b=6e4*a._Store.SDKConfig.sessionTimeout;a._Store.globalTimer=window.setTimeout(function(){d.endSession();},b);},this.resetSessionTimer=function(){a._Store.webviewBridgeEnabled||(!a._Store.sessionId&&d.startNewSession(),d.clearSessionTimeout(),d.setSessionTimer()),d.startNewSessionIfNeeded();},this.clearSessionTimeout=function(){clearTimeout(a._Store.globalTimer);},this.startNewSessionIfNeeded=function(){if(!a._Store.webviewBridgeEnabled){var b=a._Persistence.getPersistence();!a._Store.sessionId&&b&&(b.sid?a._Store.sessionId=b.sid:d.startNewSession());}};}
|
|
667
667
|
|
|
668
668
|
var Messages$5=Constants.Messages;function Ecommerce(a){var b=this;// https://go.mparticle.com/work/SQDSDKS-4801
|
|
@@ -1433,7 +1433,7 @@ if(u?(o=!1,d=l[u],delete l[u]):o=!0,l[r]=a,t._Store.setUserAttributes(e,l),!d||!
|
|
|
1433
1433
|
* Returns the cart object for the current user
|
|
1434
1434
|
* @method getCart
|
|
1435
1435
|
* @return a cart object
|
|
1436
|
-
*/getCart:function getCart(){return logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart()",warningMessage:"Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases"},t.Logger,t.
|
|
1436
|
+
*/getCart:function getCart(){return logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart()",warningMessage:"Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases"},t.Logger,t._ErrorReportingDispatcher),s.mParticleUserCart()},/**
|
|
1437
1437
|
* Returns the Consent State stored locally for this user.
|
|
1438
1438
|
* @method getConsentState
|
|
1439
1439
|
* @return a ConsentState object
|
|
@@ -1451,20 +1451,20 @@ return t._Helpers.getFeatureFlag(FeatureFlags$1.AudienceAPI)?void(null===s.audie
|
|
|
1451
1451
|
* Adds a cart product to the user cart
|
|
1452
1452
|
* @method add
|
|
1453
1453
|
* @deprecated
|
|
1454
|
-
*/add:function add(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().add()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().add()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t.
|
|
1454
|
+
*/add:function add(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().add()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().add()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t._ErrorReportingDispatcher);},/**
|
|
1455
1455
|
* Removes a cart product from the current user cart
|
|
1456
1456
|
* @method remove
|
|
1457
1457
|
* @deprecated
|
|
1458
|
-
*/remove:function remove(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().remove()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().remove()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t.
|
|
1458
|
+
*/remove:function remove(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().remove()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().remove()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t._ErrorReportingDispatcher);},/**
|
|
1459
1459
|
* Clears the user's cart
|
|
1460
1460
|
* @method clear
|
|
1461
1461
|
* @deprecated
|
|
1462
|
-
*/clear:function clear(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().clear()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().clear()",!0,"","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t.
|
|
1462
|
+
*/clear:function clear(){logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().clear()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().clear()",!0,"","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t._ErrorReportingDispatcher);},/**
|
|
1463
1463
|
* Returns all cart products
|
|
1464
1464
|
* @method getCartProducts
|
|
1465
1465
|
* @return {Array} array of cart products
|
|
1466
1466
|
* @deprecated
|
|
1467
|
-
*/getCartProducts:function getCartProducts(){return logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().getCartProducts()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().getCartProducts()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t.
|
|
1467
|
+
*/getCartProducts:function getCartProducts(){return logDeprecatedMethodUsage({methodName:"Identity.getCurrentUser().getCart().getCartProducts()",warningMessage:generateDeprecationMessage("Identity.getCurrentUser().getCart().getCartProducts()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},t.Logger,t._ErrorReportingDispatcher),[]}}},this.parseIdentityResponse=function(r,i,a,d,o,g,l){var u,p,y,I=t.Identity.getUser(i),c=I?I.getMPID():null,_=I?I.getUserIdentities().userIdentities:{},v={};t._Store.identityCallInFlight=!1;try{var m,b,S;if(t.Logger.verbose("Parsing \""+o+"\" identity response from server"),p=null!==(m=r.responseText)&&void 0!==m?m:null,t._Store.isLoggedIn=(null===(b=p)||void 0===b?void 0:b.is_logged_in)||!1,hasMPIDChanged(I,p)&&(t._Store.mpid=p.mpid,I&&t._Persistence.setLastSeenTime(i),u=!t._Persistence.getFirstSeenTime(p.mpid),t._Persistence.setFirstSeenTime(p.mpid)),r.status===HTTP_OK){var A;s(CacheIdentity)&&cacheOrClearIdCache(o,g,n.idCache,r,l);var U=n.IdentityAPI.getUser(p.mpid),C=U?U.getUserIdentities().userIdentities:{};o===Modify$1?(v=t._Identity.IdentityRequest.combineUserIdentities(_,d.userIdentities),t._Store.setUserIdentities(i,v)):(o===Identify&&I&&p.mpid===c&&t._Persistence.setFirstSeenTime(p.mpid),t._Store.addMpidToSessionHistory(p.mpid,i),t._CookieSyncManager.attemptCookieSync(p.mpid,u),t._Persistence.swapCurrentUser(i,p.mpid,t._Store.currentSessionMPIDs),d&&!isEmpty(d.userIdentities)&&(v=n.IdentityRequest.combineUserIdentities(C,d.userIdentities)),t._Store.setUserIdentities(p.mpid,v),t._Persistence.update(),t._Store.syncPersistenceData(),t._Persistence.findPrevCookiesBasedOnUI(d),t._Store.context=p.context||t._Store.context),y=t.Identity.getCurrentUser(),tryOnUserAlias(I,y,d,t.Logger,t._ErrorReportingDispatcher);var k=t._Persistence.getPersistence();y&&(t._Persistence.storeDataInMemory(k,y.getMPID()),n.reinitForwardersOnUserChange(I,y),n.setForwarderCallbacks(y,o));var P=IdentityType.getNewIdentitiesByName(v),f=o===Modify$1?_:C;// Sync $NoTargeting before sendUserIdentityChangeEvent
|
|
1468
1468
|
// because UIC events call sendEventToServer which triggers
|
|
1469
1469
|
// processQueuedEvents, draining the event queue. The
|
|
1470
1470
|
// attribute must be in the store before that happens so
|
|
@@ -1529,7 +1529,7 @@ var f=e.getGDPRConsentState();if(f)for(var g in f)f.hasOwnProperty(g)&&(c=KitFil
|
|
|
1529
1529
|
*/function j(){return delete l[CCPAPurpose],this}// TODO: Can we remove this? It is deprecated.
|
|
1530
1530
|
var k={},l={};if(c){var m=b.createConsentState();// TODO: Remove casting once `removeCCPAState` is removed;
|
|
1531
1531
|
return m.setGDPRConsentState(c.getGDPRConsentState()),m.setCCPAConsentState(c.getCCPAConsentState()),m}return {setGDPRConsentState:f,addGDPRConsentState:e,setCCPAConsentState:i,getCCPAConsentState:function a(){return l[CCPAPurpose]},getGDPRConsentState:h,removeGDPRConsentState:g,removeCCPAState:function b(){// @ts-ignore
|
|
1532
|
-
return logDeprecatedMethodUsage({methodName:"Consent.removeCCPAState",warningMessage:"removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead"},a.Logger,a.
|
|
1532
|
+
return logDeprecatedMethodUsage({methodName:"Consent.removeCCPAState",warningMessage:"removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead"},a.Logger,a._ErrorReportingDispatcher),j()},removeCCPAConsentState:j}};}
|
|
1533
1533
|
|
|
1534
1534
|
/*
|
|
1535
1535
|
TODO: Including this as a workaround because attempting to import it from
|
|
@@ -1702,17 +1702,17 @@ b._SessionManager.endSession(!0);},this.logBaseEvent=function(a,c){var d=queueIf
|
|
|
1702
1702
|
* @param {Object} product The product you want to add to the cart
|
|
1703
1703
|
* @param {Boolean} [logEventBoolean] Option to log the event to mParticle's servers. If blank, no logging occurs.
|
|
1704
1704
|
* @deprecated
|
|
1705
|
-
*/add:function add(){logDeprecatedMethodUsage({methodName:"mPInstance.eCommerce.Cart.add()",warningMessage:generateDeprecationMessage("eCommerce.Cart.add()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},b.Logger,b.
|
|
1705
|
+
*/add:function add(){logDeprecatedMethodUsage({methodName:"mPInstance.eCommerce.Cart.add()",warningMessage:generateDeprecationMessage("eCommerce.Cart.add()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},b.Logger,b._ErrorReportingDispatcher);},/**
|
|
1706
1706
|
* Removes a product from the cart
|
|
1707
1707
|
* @method remove
|
|
1708
1708
|
* @param {Object} product The product you want to add to the cart
|
|
1709
1709
|
* @param {Boolean} [logEventBoolean] Option to log the event to mParticle's servers. If blank, no logging occurs.
|
|
1710
1710
|
* @deprecated
|
|
1711
|
-
*/remove:function remove(){logDeprecatedMethodUsage({methodName:"mPInstance.eCommerce.Cart.remove()",warningMessage:generateDeprecationMessage("eCommerce.Cart.remove()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},b.Logger,b.
|
|
1711
|
+
*/remove:function remove(){logDeprecatedMethodUsage({methodName:"mPInstance.eCommerce.Cart.remove()",warningMessage:generateDeprecationMessage("eCommerce.Cart.remove()",!0,"eCommerce.logProductAction()","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},b.Logger,b._ErrorReportingDispatcher);},/**
|
|
1712
1712
|
* Clears the cart
|
|
1713
1713
|
* @method clear
|
|
1714
1714
|
* @deprecated
|
|
1715
|
-
*/clear:function clear(){logDeprecatedMethodUsage({methodName:"mPInstance.eCommerce.Cart.clear()",warningMessage:generateDeprecationMessage("eCommerce.Cart.clear()",!0,"","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},b.Logger,b.
|
|
1715
|
+
*/clear:function clear(){logDeprecatedMethodUsage({methodName:"mPInstance.eCommerce.Cart.clear()",warningMessage:generateDeprecationMessage("eCommerce.Cart.clear()",!0,"","https://docs.mparticle.com/developers/sdk/web/commerce-tracking")},b.Logger,b._ErrorReportingDispatcher);}},/**
|
|
1716
1716
|
* Sets the currency code
|
|
1717
1717
|
* @for mParticle.eCommerce
|
|
1718
1718
|
* @method setCurrencyCode
|
|
@@ -1764,7 +1764,7 @@ b._SessionManager.endSession(!0);},this.logBaseEvent=function(a,c){var d=queueIf
|
|
|
1764
1764
|
* @param {Object} attrs
|
|
1765
1765
|
* @param {Object} [customFlags] Custom flags for the event
|
|
1766
1766
|
* @deprecated
|
|
1767
|
-
*/logCheckout:function logCheckout(a,c,d,e){return logDeprecatedMethodUsage({methodName:"mParticle.logCheckout",warningMessage:"mParticle.logCheckout is deprecated, please use mParticle.logProductAction instead"},b.Logger,b.
|
|
1767
|
+
*/logCheckout:function logCheckout(a,c,d,e){return logDeprecatedMethodUsage({methodName:"mParticle.logCheckout",warningMessage:"mParticle.logCheckout is deprecated, please use mParticle.logProductAction instead"},b.Logger,b._ErrorReportingDispatcher),b._Store.isInitialized?void(b._SessionManager.resetSessionTimer(),b._Events.logCheckoutEvent(a,c,d,e)):void b.ready(function(){b.eCommerce.logCheckout(a,c,d,e);})},/**
|
|
1768
1768
|
* Logs a product action
|
|
1769
1769
|
* @for mParticle.eCommerce
|
|
1770
1770
|
* @method logProductAction
|
|
@@ -1784,7 +1784,7 @@ b._SessionManager.endSession(!0);},this.logBaseEvent=function(a,c){var d=queueIf
|
|
|
1784
1784
|
* @param {Object} [attrs] other attributes related to the product purchase
|
|
1785
1785
|
* @param {Object} [customFlags] Custom flags for the event
|
|
1786
1786
|
* @deprecated
|
|
1787
|
-
*/logPurchase:function logPurchase(a,c,d,e,f){return logDeprecatedMethodUsage({methodName:"mParticle.logPurchase",warningMessage:"mParticle.logPurchase is deprecated, please use mParticle.logProductAction instead"},b.Logger,b.
|
|
1787
|
+
*/logPurchase:function logPurchase(a,c,d,e,f){return logDeprecatedMethodUsage({methodName:"mParticle.logPurchase",warningMessage:"mParticle.logPurchase is deprecated, please use mParticle.logProductAction instead"},b.Logger,b._ErrorReportingDispatcher),b._Store.isInitialized?a&&c?void(b._SessionManager.resetSessionTimer(),b._Events.logPurchaseEvent(a,c,e,f)):void b.Logger.error(Messages.ErrorMessages.BadLogPurchase):void b.ready(function(){b.eCommerce.logPurchase(a,c,d,e,f);})},/**
|
|
1788
1788
|
* Logs a product promotion
|
|
1789
1789
|
* @for mParticle.eCommerce
|
|
1790
1790
|
* @method logPromotion
|
|
@@ -1811,7 +1811,7 @@ b._SessionManager.endSession(!0);},this.logBaseEvent=function(a,c){var d=queueIf
|
|
|
1811
1811
|
* @param {Object} [attrs] attributes related to the refund
|
|
1812
1812
|
* @param {Object} [customFlags] Custom flags for the event
|
|
1813
1813
|
* @deprecated
|
|
1814
|
-
*/logRefund:function logRefund(a,c,d,e,f){return logDeprecatedMethodUsage({methodName:"mParticle.logRefund",warningMessage:"mParticle.logRefund is deprecated, please use mParticle.logProductAction instead"},b.Logger,b.
|
|
1814
|
+
*/logRefund:function logRefund(a,c,d,e,f){return logDeprecatedMethodUsage({methodName:"mParticle.logRefund",warningMessage:"mParticle.logRefund is deprecated, please use mParticle.logProductAction instead"},b.Logger,b._ErrorReportingDispatcher),b._Store.isInitialized?void(b._SessionManager.resetSessionTimer(),b._Events.logRefundEvent(a,c,e,f)):void b.ready(function(){b.eCommerce.logRefund(a,c,d,e,f);})},expandCommerceEvent:function expandCommerceEvent(a){return b._Ecommerce.expandCommerceEvent(a)}},this.setSessionAttribute=function(a,c){var d,e=(null===(d=b._CookieConsentManager)||void 0===d?void 0:d.getNoFunctional())&&!hasExplicitIdentifier(b._Store);if(!e){var f=queueIfNotInitialized(function(){b.setSessionAttribute(a,c);},b);if(f)return}// Logs to cookie
|
|
1815
1815
|
// And logs to in-memory object
|
|
1816
1816
|
// Example: mParticle.setSessionAttribute('location', '33431');
|
|
1817
1817
|
if(b._Helpers.canLog()){if(!b._Helpers.Validators.isValidAttributeValue(c))return void b.Logger.error(Messages.ErrorMessages.BadAttribute);if(!b._Helpers.Validators.isValidKeyValue(a))return void b.Logger.error(Messages.ErrorMessages.BadKey);if(b._Store.webviewBridgeEnabled)b._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.SetSessionAttribute,JSON.stringify({key:a,value:c}));else {var g=b._Helpers.findKeyInObject(b._Store.sessionAttributes,a);g&&(a=g),b._Store.sessionAttributes[a]=c,b._Persistence.update(),b._Forwarders.applyToForwarders("setSessionAttribute",[a,c]);}}},this.setOptOut=function(a){var c=queueIfNotInitialized(function(){b.setOptOut(a);},b);c||(b._SessionManager.resetSessionTimer(),b._Store.isEnabled=!a,b._Events.logOptOut(),b._Persistence.update(),b._Store.activeForwarders.length&&b._Store.activeForwarders.forEach(function(c){if(c.setOptOut){var d=c.setOptOut(a);d&&b.Logger.verbose(d);}}));},this.setIntegrationAttribute=function(a,c){var d=queueIfNotInitialized(function(){b.setIntegrationAttribute(a,c);},b);if(!d){if("number"!=typeof a)return void b.Logger.error("integrationId must be a number");if(null===c)b._Store.integrationAttributes[a]={};else {if(!b._Helpers.isObject(c))return void b.Logger.error("Attrs must be an object with keys and values. You entered a "+_typeof$1(c));if(0===Object.keys(c).length)b._Store.integrationAttributes[a]={};else for(var e in c)if("string"!=typeof e){b.Logger.error("Keys must be strings, you entered a "+_typeof$1(e));continue}else if("string"==typeof c[e])b._Helpers.isObject(b._Store.integrationAttributes[a])?b._Store.integrationAttributes[a][e]=c[e]:(b._Store.integrationAttributes[a]={},b._Store.integrationAttributes[a][e]=c[e]);else {b.Logger.error("Values for integration attributes must be strings. You entered a "+_typeof$1(c[e]));continue}}b._Persistence.update();}},this.getIntegrationAttributes=function(a){return b._Store.integrationAttributes[a]?b._Store.integrationAttributes[a]:{}},this.addForwarder=function(a){b._preInit.forwarderConstructors.push(a);},this.configurePixel=function(a){b._Forwarders.configurePixel(a);},this._getActiveForwarders=function(){return b._Store.activeForwarders},this._getIntegrationDelays=function(){return b._preInit.integrationDelays},this._setIntegrationDelay=function(a,c){// If the integration delay is set to true, no further action needed
|
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.75.
|
|
206
|
+
var version = "2.75.1";
|
|
207
207
|
|
|
208
208
|
var Constants = {
|
|
209
209
|
sdkVersion: version,
|
|
@@ -4253,11 +4253,12 @@ var mParticle = (function () {
|
|
|
4253
4253
|
return new Date().getTime() > new Date(lastSyncDate).getTime() + frequencyCap * DAYS_IN_MILLISECONDS;
|
|
4254
4254
|
};
|
|
4255
4255
|
|
|
4256
|
-
function logDeprecatedMethodUsage(usage, logger,
|
|
4256
|
+
function logDeprecatedMethodUsage(usage, logger, errorReporter) {
|
|
4257
4257
|
logger.warning(usage.warningMessage);
|
|
4258
|
-
|
|
4258
|
+
errorReporter === null || errorReporter === void 0 ? void 0 : errorReporter.report({
|
|
4259
4259
|
message: usage.methodName,
|
|
4260
|
-
code: ErrorCodes.MP_DEPRECATED_METHOD_USAGE
|
|
4260
|
+
code: ErrorCodes.MP_DEPRECATED_METHOD_USAGE,
|
|
4261
|
+
severity: WSDKErrorSeverity.WARNING
|
|
4261
4262
|
});
|
|
4262
4263
|
}
|
|
4263
4264
|
|
|
@@ -4294,7 +4295,7 @@ var mParticle = (function () {
|
|
|
4294
4295
|
logDeprecatedMethodUsage({
|
|
4295
4296
|
methodName: 'SessionManager.getSession()',
|
|
4296
4297
|
warningMessage: generateDeprecationMessage('SessionManager.getSession()', false, 'SessionManager.getSessionId()')
|
|
4297
|
-
}, mpInstance.Logger, mpInstance.
|
|
4298
|
+
}, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
|
|
4298
4299
|
return this.getSessionId();
|
|
4299
4300
|
};
|
|
4300
4301
|
this.getSessionId = function () {
|
|
@@ -8781,7 +8782,7 @@ var mParticle = (function () {
|
|
|
8781
8782
|
logDeprecatedMethodUsage({
|
|
8782
8783
|
methodName: 'Identity.getCurrentUser().getCart()',
|
|
8783
8784
|
warningMessage: 'Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases'
|
|
8784
|
-
}, mpInstance.Logger, mpInstance.
|
|
8785
|
+
}, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
|
|
8785
8786
|
return self.mParticleUserCart();
|
|
8786
8787
|
},
|
|
8787
8788
|
/**
|
|
@@ -8848,7 +8849,7 @@ var mParticle = (function () {
|
|
|
8848
8849
|
logDeprecatedMethodUsage({
|
|
8849
8850
|
methodName: 'Identity.getCurrentUser().getCart().add()',
|
|
8850
8851
|
warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().add()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
8851
|
-
}, mpInstance.Logger, mpInstance.
|
|
8852
|
+
}, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
|
|
8852
8853
|
},
|
|
8853
8854
|
/**
|
|
8854
8855
|
* Removes a cart product from the current user cart
|
|
@@ -8859,7 +8860,7 @@ var mParticle = (function () {
|
|
|
8859
8860
|
logDeprecatedMethodUsage({
|
|
8860
8861
|
methodName: 'Identity.getCurrentUser().getCart().remove()',
|
|
8861
8862
|
warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().remove()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
8862
|
-
}, mpInstance.Logger, mpInstance.
|
|
8863
|
+
}, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
|
|
8863
8864
|
},
|
|
8864
8865
|
/**
|
|
8865
8866
|
* Clears the user's cart
|
|
@@ -8870,7 +8871,7 @@ var mParticle = (function () {
|
|
|
8870
8871
|
logDeprecatedMethodUsage({
|
|
8871
8872
|
methodName: 'Identity.getCurrentUser().getCart().clear()',
|
|
8872
8873
|
warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().clear()', true, '', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
8873
|
-
}, mpInstance.Logger, mpInstance.
|
|
8874
|
+
}, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
|
|
8874
8875
|
},
|
|
8875
8876
|
/**
|
|
8876
8877
|
* Returns all cart products
|
|
@@ -8882,7 +8883,7 @@ var mParticle = (function () {
|
|
|
8882
8883
|
logDeprecatedMethodUsage({
|
|
8883
8884
|
methodName: 'Identity.getCurrentUser().getCart().getCartProducts()',
|
|
8884
8885
|
warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().getCartProducts()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
8885
|
-
}, mpInstance.Logger, mpInstance.
|
|
8886
|
+
}, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
|
|
8886
8887
|
return [];
|
|
8887
8888
|
}
|
|
8888
8889
|
};
|
|
@@ -8955,7 +8956,7 @@ var mParticle = (function () {
|
|
|
8955
8956
|
newUser = mpInstance.Identity.getCurrentUser();
|
|
8956
8957
|
|
|
8957
8958
|
// https://go.mparticle.com/work/SQDSDKS-6359
|
|
8958
|
-
tryOnUserAlias(prevUser, newUser, identityApiData, mpInstance.Logger, mpInstance.
|
|
8959
|
+
tryOnUserAlias(prevUser, newUser, identityApiData, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
|
|
8959
8960
|
var persistence = mpInstance._Persistence.getPersistence();
|
|
8960
8961
|
if (newUser) {
|
|
8961
8962
|
mpInstance._Persistence.storeDataInMemory(persistence, newUser.getMPID());
|
|
@@ -9088,13 +9089,13 @@ var mParticle = (function () {
|
|
|
9088
9089
|
}
|
|
9089
9090
|
|
|
9090
9091
|
// https://go.mparticle.com/work/SQDSDKS-6359
|
|
9091
|
-
function tryOnUserAlias(previousUser, newUser, identityApiData, logger,
|
|
9092
|
+
function tryOnUserAlias(previousUser, newUser, identityApiData, logger, errorReporter) {
|
|
9092
9093
|
if (identityApiData && identityApiData.onUserAlias && isFunction(identityApiData.onUserAlias)) {
|
|
9093
9094
|
try {
|
|
9094
9095
|
logDeprecatedMethodUsage({
|
|
9095
9096
|
methodName: 'onUserAlias',
|
|
9096
9097
|
warningMessage: generateDeprecationMessage('onUserAlias')
|
|
9097
|
-
}, logger,
|
|
9098
|
+
}, logger, errorReporter);
|
|
9098
9099
|
identityApiData.onUserAlias(previousUser, newUser);
|
|
9099
9100
|
} catch (e) {
|
|
9100
9101
|
logger.error('There was an error with your onUserAlias function - ' + e);
|
|
@@ -9378,7 +9379,7 @@ var mParticle = (function () {
|
|
|
9378
9379
|
logDeprecatedMethodUsage({
|
|
9379
9380
|
methodName: 'Consent.removeCCPAState',
|
|
9380
9381
|
warningMessage: 'removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead'
|
|
9381
|
-
}, mpInstance.Logger, mpInstance.
|
|
9382
|
+
}, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
|
|
9382
9383
|
// @ts-ignore
|
|
9383
9384
|
return removeCCPAConsentState();
|
|
9384
9385
|
}
|
|
@@ -11688,7 +11689,7 @@ var mParticle = (function () {
|
|
|
11688
11689
|
logDeprecatedMethodUsage({
|
|
11689
11690
|
methodName: 'mPInstance.eCommerce.Cart.add()',
|
|
11690
11691
|
warningMessage: generateDeprecationMessage('eCommerce.Cart.add()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
11691
|
-
}, self.Logger, self.
|
|
11692
|
+
}, self.Logger, self._ErrorReportingDispatcher);
|
|
11692
11693
|
},
|
|
11693
11694
|
/**
|
|
11694
11695
|
* Removes a product from the cart
|
|
@@ -11701,7 +11702,7 @@ var mParticle = (function () {
|
|
|
11701
11702
|
logDeprecatedMethodUsage({
|
|
11702
11703
|
methodName: 'mPInstance.eCommerce.Cart.remove()',
|
|
11703
11704
|
warningMessage: generateDeprecationMessage('eCommerce.Cart.remove()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
11704
|
-
}, self.Logger, self.
|
|
11705
|
+
}, self.Logger, self._ErrorReportingDispatcher);
|
|
11705
11706
|
},
|
|
11706
11707
|
/**
|
|
11707
11708
|
* Clears the cart
|
|
@@ -11712,7 +11713,7 @@ var mParticle = (function () {
|
|
|
11712
11713
|
logDeprecatedMethodUsage({
|
|
11713
11714
|
methodName: 'mPInstance.eCommerce.Cart.clear()',
|
|
11714
11715
|
warningMessage: generateDeprecationMessage('eCommerce.Cart.clear()', true, '', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
|
|
11715
|
-
}, self.Logger, self.
|
|
11716
|
+
}, self.Logger, self._ErrorReportingDispatcher);
|
|
11716
11717
|
}
|
|
11717
11718
|
},
|
|
11718
11719
|
/**
|
|
@@ -11801,7 +11802,7 @@ var mParticle = (function () {
|
|
|
11801
11802
|
logDeprecatedMethodUsage({
|
|
11802
11803
|
methodName: 'mParticle.logCheckout',
|
|
11803
11804
|
warningMessage: 'mParticle.logCheckout is deprecated, please use mParticle.logProductAction instead'
|
|
11804
|
-
}, self.Logger, self.
|
|
11805
|
+
}, self.Logger, self._ErrorReportingDispatcher);
|
|
11805
11806
|
if (!self._Store.isInitialized) {
|
|
11806
11807
|
self.ready(function () {
|
|
11807
11808
|
self.eCommerce.logCheckout(step, option, attrs, customFlags);
|
|
@@ -11845,7 +11846,7 @@ var mParticle = (function () {
|
|
|
11845
11846
|
logDeprecatedMethodUsage({
|
|
11846
11847
|
methodName: 'mParticle.logPurchase',
|
|
11847
11848
|
warningMessage: 'mParticle.logPurchase is deprecated, please use mParticle.logProductAction instead'
|
|
11848
|
-
}, self.Logger, self.
|
|
11849
|
+
}, self.Logger, self._ErrorReportingDispatcher);
|
|
11849
11850
|
if (!self._Store.isInitialized) {
|
|
11850
11851
|
self.ready(function () {
|
|
11851
11852
|
self.eCommerce.logPurchase(transactionAttributes, product, clearCart, attrs, customFlags);
|
|
@@ -11909,7 +11910,7 @@ var mParticle = (function () {
|
|
|
11909
11910
|
logDeprecatedMethodUsage({
|
|
11910
11911
|
methodName: 'mParticle.logRefund',
|
|
11911
11912
|
warningMessage: 'mParticle.logRefund is deprecated, please use mParticle.logProductAction instead'
|
|
11912
|
-
}, self.Logger, self.
|
|
11913
|
+
}, self.Logger, self._ErrorReportingDispatcher);
|
|
11913
11914
|
if (!self._Store.isInitialized) {
|
|
11914
11915
|
self.ready(function () {
|
|
11915
11916
|
self.eCommerce.logRefund(transactionAttributes, product, clearCart, attrs, customFlags);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IErrorReportingService } from './types';
|
|
2
2
|
import { SDKLoggerApi } from '../sdkRuntimeModels';
|
|
3
3
|
interface DeprecatedMethodUsage {
|
|
4
4
|
methodName: string;
|
|
5
5
|
warningMessage: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function logDeprecatedMethodUsage(usage: DeprecatedMethodUsage, logger: Pick<SDKLoggerApi, 'warning'>,
|
|
7
|
+
export declare function logDeprecatedMethodUsage(usage: DeprecatedMethodUsage, logger: Pick<SDKLoggerApi, 'warning'>, errorReporter: IErrorReportingService | undefined): void;
|
|
8
8
|
export {};
|
package/package.json
CHANGED
package/src/consent.ts
CHANGED
|
@@ -512,7 +512,7 @@ export default function Consent(this: IConsent, mpInstance: IMParticleWebSDKInst
|
|
|
512
512
|
warningMessage: 'removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead',
|
|
513
513
|
},
|
|
514
514
|
mpInstance.Logger,
|
|
515
|
-
mpInstance.
|
|
515
|
+
mpInstance._ErrorReportingDispatcher
|
|
516
516
|
);
|
|
517
517
|
// @ts-ignore
|
|
518
518
|
return removeCCPAConsentState();
|
package/src/identity.js
CHANGED
|
@@ -1260,7 +1260,7 @@ export default function Identity(mpInstance) {
|
|
|
1260
1260
|
'Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases',
|
|
1261
1261
|
},
|
|
1262
1262
|
mpInstance.Logger,
|
|
1263
|
-
mpInstance.
|
|
1263
|
+
mpInstance._ErrorReportingDispatcher
|
|
1264
1264
|
);
|
|
1265
1265
|
return self.mParticleUserCart();
|
|
1266
1266
|
},
|
|
@@ -1352,7 +1352,7 @@ export default function Identity(mpInstance) {
|
|
|
1352
1352
|
),
|
|
1353
1353
|
},
|
|
1354
1354
|
mpInstance.Logger,
|
|
1355
|
-
mpInstance.
|
|
1355
|
+
mpInstance._ErrorReportingDispatcher
|
|
1356
1356
|
);
|
|
1357
1357
|
},
|
|
1358
1358
|
/**
|
|
@@ -1373,7 +1373,7 @@ export default function Identity(mpInstance) {
|
|
|
1373
1373
|
),
|
|
1374
1374
|
},
|
|
1375
1375
|
mpInstance.Logger,
|
|
1376
|
-
mpInstance.
|
|
1376
|
+
mpInstance._ErrorReportingDispatcher
|
|
1377
1377
|
);
|
|
1378
1378
|
},
|
|
1379
1379
|
/**
|
|
@@ -1394,7 +1394,7 @@ export default function Identity(mpInstance) {
|
|
|
1394
1394
|
),
|
|
1395
1395
|
},
|
|
1396
1396
|
mpInstance.Logger,
|
|
1397
|
-
mpInstance.
|
|
1397
|
+
mpInstance._ErrorReportingDispatcher
|
|
1398
1398
|
);
|
|
1399
1399
|
},
|
|
1400
1400
|
/**
|
|
@@ -1416,7 +1416,7 @@ export default function Identity(mpInstance) {
|
|
|
1416
1416
|
),
|
|
1417
1417
|
},
|
|
1418
1418
|
mpInstance.Logger,
|
|
1419
|
-
mpInstance.
|
|
1419
|
+
mpInstance._ErrorReportingDispatcher
|
|
1420
1420
|
);
|
|
1421
1421
|
return [];
|
|
1422
1422
|
},
|
|
@@ -1571,7 +1571,7 @@ export default function Identity(mpInstance) {
|
|
|
1571
1571
|
newUser,
|
|
1572
1572
|
identityApiData,
|
|
1573
1573
|
mpInstance.Logger,
|
|
1574
|
-
mpInstance.
|
|
1574
|
+
mpInstance._ErrorReportingDispatcher
|
|
1575
1575
|
);
|
|
1576
1576
|
|
|
1577
1577
|
const persistence = mpInstance._Persistence.getPersistence();
|
|
@@ -1812,7 +1812,7 @@ function tryOnUserAlias(
|
|
|
1812
1812
|
newUser,
|
|
1813
1813
|
identityApiData,
|
|
1814
1814
|
logger,
|
|
1815
|
-
|
|
1815
|
+
errorReporter
|
|
1816
1816
|
) {
|
|
1817
1817
|
if (
|
|
1818
1818
|
identityApiData &&
|
|
@@ -1826,7 +1826,7 @@ function tryOnUserAlias(
|
|
|
1826
1826
|
warningMessage: generateDeprecationMessage('onUserAlias'),
|
|
1827
1827
|
},
|
|
1828
1828
|
logger,
|
|
1829
|
-
|
|
1829
|
+
errorReporter
|
|
1830
1830
|
);
|
|
1831
1831
|
identityApiData.onUserAlias(previousUser, newUser);
|
|
1832
1832
|
} catch (e) {
|
package/src/mp-instance.ts
CHANGED
|
@@ -792,7 +792,7 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
|
|
|
792
792
|
),
|
|
793
793
|
},
|
|
794
794
|
self.Logger,
|
|
795
|
-
self.
|
|
795
|
+
self._ErrorReportingDispatcher
|
|
796
796
|
);
|
|
797
797
|
},
|
|
798
798
|
/**
|
|
@@ -814,7 +814,7 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
|
|
|
814
814
|
),
|
|
815
815
|
},
|
|
816
816
|
self.Logger,
|
|
817
|
-
self.
|
|
817
|
+
self._ErrorReportingDispatcher
|
|
818
818
|
);
|
|
819
819
|
},
|
|
820
820
|
/**
|
|
@@ -834,7 +834,7 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
|
|
|
834
834
|
),
|
|
835
835
|
},
|
|
836
836
|
self.Logger,
|
|
837
|
-
self.
|
|
837
|
+
self._ErrorReportingDispatcher
|
|
838
838
|
);
|
|
839
839
|
},
|
|
840
840
|
},
|
|
@@ -970,7 +970,7 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
|
|
|
970
970
|
warningMessage: 'mParticle.logCheckout is deprecated, please use mParticle.logProductAction instead',
|
|
971
971
|
},
|
|
972
972
|
self.Logger,
|
|
973
|
-
self.
|
|
973
|
+
self._ErrorReportingDispatcher
|
|
974
974
|
);
|
|
975
975
|
|
|
976
976
|
if (!self._Store.isInitialized) {
|
|
@@ -1055,7 +1055,7 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
|
|
|
1055
1055
|
warningMessage: 'mParticle.logPurchase is deprecated, please use mParticle.logProductAction instead',
|
|
1056
1056
|
},
|
|
1057
1057
|
self.Logger,
|
|
1058
|
-
self.
|
|
1058
|
+
self._ErrorReportingDispatcher
|
|
1059
1059
|
);
|
|
1060
1060
|
if (!self._Store.isInitialized) {
|
|
1061
1061
|
self.ready(function() {
|
|
@@ -1172,7 +1172,7 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
|
|
|
1172
1172
|
warningMessage: 'mParticle.logRefund is deprecated, please use mParticle.logProductAction instead',
|
|
1173
1173
|
},
|
|
1174
1174
|
self.Logger,
|
|
1175
|
-
self.
|
|
1175
|
+
self._ErrorReportingDispatcher
|
|
1176
1176
|
);
|
|
1177
1177
|
if (!self._Store.isInitialized) {
|
|
1178
1178
|
self.ready(function() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorCodes,
|
|
1
|
+
import { ErrorCodes, IErrorReportingService, WSDKErrorSeverity } from './types';
|
|
2
2
|
import { SDKLoggerApi } from '../sdkRuntimeModels';
|
|
3
3
|
|
|
4
4
|
interface DeprecatedMethodUsage {
|
|
@@ -9,11 +9,12 @@ interface DeprecatedMethodUsage {
|
|
|
9
9
|
export function logDeprecatedMethodUsage(
|
|
10
10
|
usage: DeprecatedMethodUsage,
|
|
11
11
|
logger: Pick<SDKLoggerApi, 'warning'>,
|
|
12
|
-
|
|
12
|
+
errorReporter: IErrorReportingService | undefined
|
|
13
13
|
): void {
|
|
14
14
|
logger.warning(usage.warningMessage);
|
|
15
|
-
|
|
15
|
+
errorReporter?.report({
|
|
16
16
|
message: usage.methodName,
|
|
17
17
|
code: ErrorCodes.MP_DEPRECATED_METHOD_USAGE,
|
|
18
|
+
severity: WSDKErrorSeverity.WARNING,
|
|
18
19
|
});
|
|
19
20
|
}
|