@mparticle/web-sdk 3.17.0 → 3.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -6
- package/dist/mparticle.common.js +110 -47
- package/dist/mparticle.esm.js +110 -47
- package/dist/mparticle.js +561 -158
- package/dist/types/src/buttonTracking/buttonClickEvent.d.ts +5 -0
- package/dist/types/src/buttonTracking/buttonDescription.d.ts +16 -0
- package/dist/types/src/buttonTracking/buttonTracker.d.ts +35 -0
- package/dist/types/src/buttonTracking/checkoutIntent.d.ts +3 -0
- package/dist/types/src/buttonTracking/controls.d.ts +6 -0
- package/dist/types/src/buttonTracking/labelMasking.d.ts +1 -0
- package/dist/types/src/constants.d.ts +1 -1
- package/dist/types/src/mp-instance.d.ts +2 -2
- package/dist/types/src/roktManager.d.ts +1 -1
- package/dist/types/src/store.d.ts +1 -1
- package/package.json +4 -3
- package/src/buttonTracking/buttonClickEvent.ts +48 -0
- package/src/buttonTracking/buttonDescription.ts +259 -0
- package/src/buttonTracking/buttonTracker.ts +370 -0
- package/src/{checkoutIntentClassifier.ts → buttonTracking/checkoutIntent.ts} +39 -80
- package/src/buttonTracking/controls.ts +111 -0
- package/src/buttonTracking/labelMasking.ts +41 -0
- package/src/constants.ts +1 -1
- package/src/mp-instance.ts +22 -27
- package/src/roktManager.ts +2 -2
- package/src/store.ts +3 -3
- package/dist/types/src/checkoutIntentClassifier.d.ts +0 -4
- package/dist/types/src/checkoutIntentTracker.d.ts +0 -23
- package/src/checkoutIntentTracker.ts +0 -244
package/dist/mparticle.esm.js
CHANGED
|
@@ -15,19 +15,19 @@ 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 = "3.
|
|
18
|
+
var version = "3.19.0";
|
|
19
19
|
|
|
20
20
|
var Constants={sdkVersion:version,sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodHasBeenDeprecated:"has been deprecated.",MethodMarkedForDeprecationPostfix:"is a deprecated method and will be removed in future releases.",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",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",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,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
|
|
22
22
|
CNAMEUrlPaths:{v1SecureServiceUrl:"/webevents/v1/JS/",v2SecureServiceUrl:"/webevents/v2/JS/",v3SecureServiceUrl:"/webevents/v3/JS/",configUrl:"/tags/JS/v2/",identityUrl:"/identity/v1/",aliasUrl:"/webevents/v1/identity/"},Base64CookieKeys:{csm:1,sa:1,ss:1,lsa:1,ua:1,ui:1,csd:1,ia:1,con:1},// https://go.mparticle.com/work/SQDSDKS-6039
|
|
23
23
|
SDKv2NonMPIDCookieKeys:{gs:1,cu:1,l:1,globalSettings:1,currentUserMPID:1},HTTPCodes:{noHttpCoverage:-1,activeIdentityRequest:-2,activeSession:-3,validationIssue:-4,nativeIdentityRequest:-5,loggingDisabledOrMissingAPIKey:-6,tooManyRequests:429},FeatureFlags:{ReportBatching:"reportBatching",EventBatchingIntervalMillis:"eventBatchingIntervalMillis",OfflineStorage:"offlineStorage",DirectUrlRouting:"directURLRouting",CacheIdentity:"cacheIdentity",AudienceAPI:"audienceAPI",// CaptureIntegrationSpecificIds (legacy): boolean flag from server/UI
|
|
24
|
-
// - 'True'
|
|
25
|
-
// - 'False'
|
|
24
|
+
// - 'True' \u2192 capture all integration-specific IDs
|
|
25
|
+
// - 'False' \u2192 capture none
|
|
26
26
|
CaptureIntegrationSpecificIds:"captureIntegrationSpecificIds",// CaptureIntegrationSpecificIdsV2 (new): string mode from server
|
|
27
|
-
// - 'all'
|
|
28
|
-
// - 'none'
|
|
29
|
-
// - 'roktonly'
|
|
30
|
-
CaptureIntegrationSpecificIdsV2:"captureIntegrationSpecificIds.V2",AstBackgroundEvents:"astBackgroundEvents",AutoLogPageView:"autoLogPageView",
|
|
27
|
+
// - 'all' \u2192 capture all IDs
|
|
28
|
+
// - 'none' \u2192 capture none
|
|
29
|
+
// - 'roktonly' \u2192 capture only Rokt-related IDs
|
|
30
|
+
CaptureIntegrationSpecificIdsV2:"captureIntegrationSpecificIds.V2",AstBackgroundEvents:"astBackgroundEvents",AutoLogPageView:"autoLogPageView",AutoButtonTracking:"autoButtonTracking"},DefaultInstance:"default_instance",CCPAPurpose:"data_sale_opt_out",IdentityMethods:{Modify:"modify",Logout:"logout",Login:"login",Identify:"identify"},Environment:{Development:"development",Production:"production"},CaptureIntegrationSpecificIdsV2Modes:{All:"all",None:"none",RoktOnly:"roktonly"},Rokt:{LauncherInstanceGuidKey:"__rokt_li_guid__"}};var ONE_DAY_IN_SECONDS=86400;var MILLIS_IN_ONE_SEC=1e3;// User attribute set when the end user opts out of ad targeting via
|
|
31
31
|
// launcherOptions.noTargeting. Server-side systems use this attribute
|
|
32
32
|
// to exclude the user from retargeting audiences.
|
|
33
33
|
var NO_TARGETING_ATTRIBUTE="$NoTargeting";// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
|
|
@@ -162,7 +162,7 @@ if(isObject(a)){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=obfuscateData
|
|
|
162
162
|
return _typeof(a)},obfuscateDevData=function(a,b){return b?a:obfuscateData(a)};/**
|
|
163
163
|
* Returns a value between 1-100 inclusive.
|
|
164
164
|
*/ // Google's cookie matching service requires `google_hm` values to be web-safe
|
|
165
|
-
// base64 (RFC 4648
|
|
165
|
+
// base64 (RFC 4648 \u00A75) without padding, otherwise the write to the hosted
|
|
166
166
|
// match table fails: https://developers.google.com/authorized-buyers/rtb/cookie-guide
|
|
167
167
|
// (String#replaceAll is not available in our ES5 browser targets.)
|
|
168
168
|
// btoa is defined only over Latin-1 and throws InvalidCharacterError above U+00FF
|
|
@@ -656,7 +656,7 @@ var identitiesEqual=function(c,a){var b=Object.keys(null!==c&&void 0!==c?c:{}),d
|
|
|
656
656
|
* plumbing) is type-checked instead of being expressed in plain JS.
|
|
657
657
|
*/var executeSearchRequest=function(a,b,c,d){var e=a._Helpers,f=a._Store,g=a.Logger,h=a._ErrorReportingDispatcher,i=f.SDKConfig,j=i.identityUrl,k=i.isDevelopmentMode;if(!e.canLog()){if(g.verbose(Messages$9.InformationMessages.AbandonLogEvent),isFunction(d))try{d({httpCode:HTTPCodes$3.loggingDisabledOrMissingAPIKey});}catch(a){g.error("Error invoking search callback: "+getErrorMessage(a));}return}// The Search endpoint is colocated with /v1/identify under
|
|
658
658
|
// identityUrl, so we reuse the same service URL builder. We do
|
|
659
|
-
// NOT append the apiKey to the URL
|
|
659
|
+
// NOT append the apiKey to the URL \u2014 auth is done via x-mp-key.
|
|
660
660
|
var l=e.createServiceUrl(j),m=k?"development":"production";sendSearchRequest(c,b,function(){return buildIdentitySearchEnvelope(m)},l+"search?cb=1",d,g,void 0,h);};
|
|
661
661
|
|
|
662
662
|
function APIClient(a,b){this.uploader=null;var c=this;this.queueEventForBatchUpload=function(b){if(!this.uploader){// https://go.mparticle.com/work/SQDSDKS-6317
|
|
@@ -707,7 +707,7 @@ if(n===PARTNER_MODULE_IDS.Rokt&&a._CookieConsentManager.getNoTargeting())return;
|
|
|
707
707
|
// // Desk cookie syncs.
|
|
708
708
|
var u=n===PARTNER_MODULE_IDS.TradeDesk?window.location.hostname:void 0,v="true"===(null===(h=null===o||void 0===o?void 0:o.enableHmTag)||void 0===h?void 0:h.toLowerCase()),w=n===PARTNER_MODULE_IDS.DoubleclickDFP,x=w&&v,y=x?toWebSafeBase64(c):void 0;// Google Marketing Platform accepts a web-safe base64-encoded MPID via the
|
|
709
709
|
// `google_hm` query parameter, but only for accounts provisioned for Google
|
|
710
|
-
// Hosted Matching
|
|
710
|
+
// Hosted Matching \u2014 Google returns errors otherwise. It is therefore gated
|
|
711
711
|
// behind the opt-in `enableHmTag` setting (off by default), which the server
|
|
712
712
|
// delivers as the string 'True' when the UI toggle is enabled.
|
|
713
713
|
x&&!y&&a.Logger.warning("Unable to base64 encode the current MPID; omitting the google_hm parameter from this cookie sync");var z=createCookieSyncUrl(c,l,m,u,y);b.performCookieSync(z,n.toString(),c,s);}catch(b){a.Logger.error("Error performing cookie sync: "+b);}});}},this.performCookieSync=function(b,c,d,e){var f=document.createElement("img");a.Logger.verbose(InformationMessages.CookieSync),f.onload=function(){e[c]=new Date().getTime(),a._Persistence.saveUserCookieSyncDatesToPersistence(d,e);},f.src=b;};}var isLastSyncDateExpired=function(a,b){// If there is no lastSyncDate, then there is no previous cookie sync, so we should sync the cookie
|
|
@@ -762,7 +762,7 @@ var c=b.Identity.getCurrentUser();return a===(null===c||void 0===c?void 0:c.getM
|
|
|
762
762
|
// Only update flags if the config actually has flags (don't overwrite with empty object)
|
|
763
763
|
a.flags&&(d.SDKConfig.flags=processFlags(a));var i=processBaseUrls(a,d.SDKConfig.flags,c);for(var j in i)d.SDKConfig[j]=i[j];if(g){d.SDKConfig.workspaceToken=g;var k=normalizeRoktLauncherOptions(null===a||void 0===a?void 0:a.launcherOptions).noFunctional;b._timeOnSiteTimer=new ForegroundTimeTracker(g,k);}else b.Logger.warning("You should have a workspaceToken on your config object for security purposes.");// add a new function to apply items to the store that require config to be returned
|
|
764
764
|
d.storageName=e(g),d.SDKConfig.requiredWebviewBridgeName=h||g,d.webviewBridgeEnabled=f(d.SDKConfig.requiredWebviewBridgeName,d.SDKConfig.minWebviewBridgeVersion),d.configurationLoaded=!0;};}// https://go.mparticle.com/work/SQDSDKS-6317
|
|
765
|
-
function processFlags(a){var b={},c=Constants.FeatureFlags,d=c.ReportBatching,e=c.EventBatchingIntervalMillis,f=c.OfflineStorage,g=c.DirectUrlRouting,h=c.CacheIdentity,i=c.AudienceAPI,j=c.CaptureIntegrationSpecificIds,k=c.CaptureIntegrationSpecificIdsV2,l=c.AstBackgroundEvents,m=c.AutoLogPageView,n=c.
|
|
765
|
+
function processFlags(a){var b={},c=Constants.FeatureFlags,d=c.ReportBatching,e=c.EventBatchingIntervalMillis,f=c.OfflineStorage,g=c.DirectUrlRouting,h=c.CacheIdentity,i=c.AudienceAPI,j=c.CaptureIntegrationSpecificIds,k=c.CaptureIntegrationSpecificIdsV2,l=c.AstBackgroundEvents,m=c.AutoLogPageView,n=c.AutoButtonTracking;return a.flags?(b[d]=a.flags[d]||!1,b[e]=parseNumber(a.flags[e])||Constants.DefaultConfig.uploadInterval,b[f]=a.flags[f]||"0",b[g]="True"===a.flags[g],b[h]="True"===a.flags[h],b[i]="True"===a.flags[i],b[j]="True"===a.flags[j],b[k]=a.flags[k]||"none",b[l]="True"===a.flags[l],b[m]="True"===a.flags[m],b[n]="True"===a.flags[n],b):{};// https://go.mparticle.com/work/SQDSDKS-6317
|
|
766
766
|
// Passed in config flags take priority over defaults
|
|
767
767
|
}function processBaseUrls(a,b,c){// an API key is not present in a webview only mode. In this case, no baseUrls are needed
|
|
768
768
|
if(!c)return {};// Set default baseUrls
|
|
@@ -852,7 +852,7 @@ return new Date().getTime();var c=D.getPersistence();return c&&c[b]&&c[b].lst?c[
|
|
|
852
852
|
},this.getDeviceId=function(){return a._Store.deviceId},this.setDeviceId=function(b){a._Store.deviceId=b,D.update();},this.resetPersistence=function(){localStorage.clear(),D.expireCookies(StorageNames.cookieName),D.expireCookies(StorageNames.cookieNameV2),D.expireCookies(StorageNames.cookieNameV3),D.expireCookies(StorageNames.cookieNameV4),D.expireCookies(a._Store.storageName);var b=getMParticleManager();if(null===b||void 0===b?void 0:b._isTestEnv){localStorage.removeItem(a._Helpers.createMainStorageName("abcdef")),D.expireCookies(a._Helpers.createMainStorageName("abcdef"));}},this.forwardingStatsBatches={uploadsTable:{},forwardingStatsEventQueue:[]};}
|
|
853
853
|
|
|
854
854
|
var HISTORY_METHODS=["pushState","replaceState"],WRAPPED_MARKER="__mpApvWrapped__";var supportsHistoryTracking=function(a){return !!a&&a.history!==void 0&&"function"==typeof a.history.pushState&&"function"==typeof a.addEventListener};// Wraps pushState/replaceState so `onNavigate` runs after the real method, and
|
|
855
|
-
// returns the single function that undoes it
|
|
855
|
+
// returns the single function that undoes it \u2014 or null when nothing was
|
|
856
856
|
// installed (history is already wrapped, or a frozen/sealed History rejected the
|
|
857
857
|
// assignment). Handing back one undo closure keeps the wrapper and original
|
|
858
858
|
// references out of the tracker entirely: there is no half-patched state for a
|
|
@@ -891,11 +891,11 @@ var WIN_APV_KEY="__mpApv__";// The query params an auto page view may carry. An
|
|
|
891
891
|
// SECURITY: `code`, `state` and `nonce` are the OAuth 2.0 / OIDC authorization
|
|
892
892
|
// code and the CSRF/replay tokens. They are credentials until redeemed, and
|
|
893
893
|
// attaching them here persists them in the event store and forwards them to
|
|
894
|
-
// every configured kit. They are on the list by explicit product decision
|
|
894
|
+
// every configured kit. They are on the list by explicit product decision \u2014
|
|
895
895
|
// deleting that line is the whole of the fix if that decision is revisited.
|
|
896
896
|
var ALLOWED_QUERY_PARAMS=[// Campaign attribution
|
|
897
897
|
"utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id",// Ad-network click ids
|
|
898
|
-
"gclid","gbraid","wbraid","fbclid","msclkid","ttclid","twclid","li_fat_id","dclid",// OAuth / OIDC
|
|
898
|
+
"gclid","gbraid","wbraid","fbclid","msclkid","ttclid","twclid","li_fat_id","dclid",// OAuth / OIDC \u2014 see the SECURITY note above
|
|
899
899
|
"client_id","redirect_uri","response_type","scope","state","code","nonce",// Pagination
|
|
900
900
|
"page","limit","offset","cursor","per_page",// Site search term, as the common platforms spell it. Matching is
|
|
901
901
|
// case-insensitive; single-letter names other than `q` are too generic.
|
|
@@ -904,7 +904,7 @@ var ALLOWED_QUERY_PARAMS=[// Campaign attribution
|
|
|
904
904
|
"pid","productId","sku","skuId","variant",// Category
|
|
905
905
|
"category",// Referral
|
|
906
906
|
"ref","referrer"];// ---------------------------------------------------------------------------
|
|
907
|
-
// Pure helpers. No `this`, no globals, no side effects
|
|
907
|
+
// Pure helpers. No `this`, no globals, no side effects \u2014 callable and assertable
|
|
908
908
|
// on their own, which is where the interesting rules live.
|
|
909
909
|
// ---------------------------------------------------------------------------
|
|
910
910
|
// Pulls the allowlisted query params off a URL. Delegates to the SDK's own
|
|
@@ -923,16 +923,16 @@ var autoPageViewAttribute=function(a){var b;return a?(b={},b[AUTO_PAGE_VIEW_ATTR
|
|
|
923
923
|
// Membership is an own-property check, not `in`. `in` walks the prototype
|
|
924
924
|
// chain, so a name matching an Object.prototype member reports as present on
|
|
925
925
|
// any plain object. ALLOWED_QUERY_PARAMS contains no such name, which was the
|
|
926
|
-
// only thing making `in` safe here
|
|
926
|
+
// only thing making `in` safe here \u2014 and it stops being a safe assumption the
|
|
927
927
|
// moment this list can be extended from configuration.
|
|
928
928
|
var capturedNames=function(a){return ALLOWED_QUERY_PARAMS.filter(function(b){return hasOwnProp(a,b)})};// The dedup key: pathname plus the allowlisted params in a fixed order, so that
|
|
929
929
|
// reordering the query string is not a new page. Params outside the allowlist
|
|
930
|
-
// never make it into `page.params` and so cannot key a view
|
|
930
|
+
// never make it into `page.params` and so cannot key a view \u2014 nor can the hash.
|
|
931
931
|
//
|
|
932
932
|
// Values are re-encoded because queryStringParser hands them back DECODED. A
|
|
933
933
|
// value holding the pair delimiters would otherwise serialize exactly like two
|
|
934
|
-
// separate params
|
|
935
|
-
// `q=a&search=b`
|
|
934
|
+
// separate params \u2014 `{q: 'a&search=b'}` and `{q: 'a', search: 'b'}` both becoming
|
|
935
|
+
// `q=a&search=b` \u2014 and dedup would treat a real navigation between them as the
|
|
936
936
|
// same page and drop the view. `q`, `search` and `redirect_uri` carry `&` and `=`
|
|
937
937
|
// routinely, so this is reachable rather than theoretical.
|
|
938
938
|
var pageKey=function(a){var b=capturedNames(a.params).map(function(b){return "".concat(b,"=").concat(encodeURIComponent(a.params[b]))}).join("&");return b?"".concat(a.path,"?").concat(b):a.path};// Dedup keys on the pageKey above: a change to any captured param is a new page
|
|
@@ -961,7 +961,7 @@ var resetPageViewTracking=function(){var a=apvWindow();if(a){var b=getActiveTrac
|
|
|
961
961
|
get:function get(){return this.active},enumerable:!1,configurable:!0}),a.prototype.init=function(){var a=this;if(this.log("[init] PageViewTracker Init"),!supportsHistoryTracking(apvWindow()))return void this.log("[init] unsupported environment (no History API), not starting");// Take over from whichever tracker is currently active: one left behind by
|
|
962
962
|
// a previous module load, or this same tracker on a repeat
|
|
963
963
|
// mParticle.init(). Their pending navigations are transferred rather than
|
|
964
|
-
// dropped
|
|
964
|
+
// dropped \u2014 a route change may have queued a deferred fire that has not
|
|
965
965
|
// flushed yet, and dropping it loses a page view entirely.
|
|
966
966
|
var b=getActiveTracker(),c=this.retire(b);this.active&&b!==this&&(c=c.concat(this.retire(this))),this.active=!0,this.lastPage=currentPage(),this.log("[init] seeded lastPage: ".concat(describePage(this.lastPage))),this.undoHistoryPatch=subscribeToRouteChange("pageView",function(b){return a.safeHandleNavigation(b)},function(b){return a.log(b)}),setActiveTracker(this),this.log("[init] patched pushState/replaceState + listening for popstate"),c.forEach(function(b){return a.scheduleFire(b)});},a.prototype.teardown=function(){this.takePendingNavigations(),this.undoHistoryPatch&&(this.undoHistoryPatch(),this.undoHistoryPatch=null),this.active=!1,clearActiveTracker(this);},a.prototype.retire=function(a){if(!a)return [];this.log(a===this?"[init] retiring this tracker for a repeat mParticle.init() \u2014 transferring pending navigations and tearing down":"[init] retiring a tracker from a previous module load \u2014 transferring pending navigations and tearing down");var b=a.takePendingNavigations();return a.teardown(),b},a.prototype.takePendingNavigations=function(){var a=this.pendingNavigations;return this.pendingNavigations=[],a.forEach(function(a){var b=a.timeoutId;return clearTimeout(b)}),a.map(function(a){var b=a.page;return b})},a.prototype.safeHandleNavigation=function(a){// An orphaned wrapper still calls in: teardown can only restore a history
|
|
967
967
|
// method that is still ours, so one a third party patched over stays
|
|
@@ -972,7 +972,7 @@ if(this.active)try{this.handleNavigation(a);}catch(b){this.log("[error] navigati
|
|
|
972
972
|
|
|
973
973
|
var Messages$3=Constants.Messages;function Events(a){var b=this;// The auto page view for the landing page. The SPA navigations that follow it
|
|
974
974
|
// come from PageViewTracker instead, so both emitters attach the same
|
|
975
|
-
// allowlisted query params
|
|
975
|
+
// allowlisted query params \u2014 and this is the one that matters for campaign
|
|
976
976
|
// attribution, since utm_*/gclid live on the entry URL.
|
|
977
977
|
this.logEvent=function(b,c){if(a.Logger.verbose(Messages$3.InformationMessages.StartingLogEvent+": "+b.name),a._Helpers.canLog()){var d=a._ServerModel.createEventObject(b);a._APIClient.sendEventToServer(d,c);}else a.Logger.verbose(Messages$3.InformationMessages.AbandonLogEvent);},this.startTracking=function(b){function c(b,c){if(b)try{c?b(c):b();}catch(b){a.Logger.error("Error invoking the callback passed to startTrackingLocation."),a.Logger.error(b);}}if(!a._Store.isTracking)"geolocation"in navigator&&(a._Store.watchPositionId=navigator.geolocation.watchPosition(function e(d){// prevents callback from being fired multiple times
|
|
978
978
|
a._Store.currentPosition={lat:d.coords.latitude,lng:d.coords.longitude},c(b,d),b=null,a._Store.isTracking=!0;},function d(){// prevents callback from being fired multiple times
|
|
@@ -1050,8 +1050,8 @@ function forwardingStatsUploader(a){function b(){var b=a._Forwarders.getForwarde
|
|
|
1050
1050
|
var AudienceManager=/** @class */function(){function a(a,b,c){this.url="",this.logger=c,this.url="https://".concat(a).concat(b,"/audience"),this.userAudienceAPI=window.fetch?new FetchUploader(this.url):new XHRUploader(this.url);}return a.prototype.sendGetUserAudienceRequest=function(a,b){return __awaiter(this,void 0,void 0,function(){var c,d,e,f,g,h;return __generator(this,function(i){switch(i.label){case 0:this.logger.verbose("Fetching user audiences from server"),c={method:"GET",headers:{Accept:"*/*"}},d="".concat(this.url,"?mpid=").concat(a),i.label=1;case 1:return i.trys.push([1,6,,7]),[4/*yield*/,this.userAudienceAPI.upload(c,d)];case 2:return (e=i.sent(),!(200<=e.status&&300>e.status))?[3/*break*/,4]:(this.logger.verbose("User Audiences successfully received"),[4/*yield*/,e.json()]);case 3:f=i.sent(),g={currentAudienceMemberships:null===f||void 0===f?void 0:f.audience_memberships};try{b(g);}catch(a){throw new Error("Error invoking callback on user audience response.")}return [3/*break*/,5];case 4:if(401===e.status)throw new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your API key.`");else if(403===e.status)throw new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your workspace is enabled for audiences.`");else// In case there is an HTTP error we did not anticipate.
|
|
1051
1051
|
throw new Error("Uncaught HTTP Error ".concat(e.status,"."));case 5:return [3/*break*/,7];case 6:return h=i.sent(),this.logger.error("Error retrieving audiences. ".concat(h)),[3/*break*/,7];case 7:return [2/*return*/]}})})},a}();
|
|
1052
1052
|
|
|
1053
|
-
var processReadyQueue=function(a,b){if(isEmpty(a))return [];// Without draining first, sync re-entry (cache-hit identify
|
|
1054
|
-
// parseIdentityResponse
|
|
1053
|
+
var processReadyQueue=function(a,b){if(isEmpty(a))return [];// Without draining first, sync re-entry (cache-hit identify \u2192
|
|
1054
|
+
// parseIdentityResponse \u2192 processReadyQueue) re-iterates the same array:
|
|
1055
1055
|
// callers only replace `_preInit.readyQueue` with [] after we return, so the
|
|
1056
1056
|
// nested call still sees every entry. That duplicates Identity/event calls
|
|
1057
1057
|
// and can nest "Unable to compute proper mParticle function" wraps.
|
|
@@ -1084,7 +1084,7 @@ var Messages$2=Constants.Messages,HTTPCodes$2=Constants.HTTPCodes,FeatureFlags$1
|
|
|
1084
1084
|
// compare what identities exist vs what is previously was for the specific user if they were in memory before.
|
|
1085
1085
|
// if it's the first time the user is logging in, send a user identity change request with
|
|
1086
1086
|
this.idCache=null,this.audienceManager=null,this.IdentityRequest={preProcessIdentityRequest:function preProcessIdentityRequest(b,c,d){a.Logger.verbose(Messages$2.InformationMessages.StartingLogEvent+": "+d);// First, remove any falsy identity values and warn about them
|
|
1087
|
-
var e=a._Helpers.Validators.removeFalsyIdentityValues(b,a.Logger),f=(null===e||void 0===e?void 0:e.userIdentities)?__assign(__assign({},e),{userIdentities:normalizeUserIdentityKeys(e.userIdentities)}):e,g=a._Helpers.Validators.validateIdentities(f,d);// Normalize convenience aliases (email_sha256
|
|
1087
|
+
var e=a._Helpers.Validators.removeFalsyIdentityValues(b,a.Logger),f=(null===e||void 0===e?void 0:e.userIdentities)?__assign(__assign({},e),{userIdentities:normalizeUserIdentityKeys(e.userIdentities)}):e,g=a._Helpers.Validators.validateIdentities(f,d);// Normalize convenience aliases (email_sha256 \u2192 other, mobile_sha256 \u2192 other2)
|
|
1088
1088
|
if(!g.valid)return a.Logger.error("ERROR: "+g.error),{valid:!1,error:g.error};if(c&&!a._Helpers.Validators.isFunction(c)){var h="The optional callback must be a function. You tried entering a(n) "+_typeof(c);return a.Logger.error(h),{valid:!1,error:h}}return {valid:!0,cleanedIdentities:f}},createIdentityRequest:function createIdentityRequest(b,c,d,e,f,g,h){var i={client_sdk:{platform:c,sdk_vendor:d,sdk_version:e},context:g,environment:a._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:a._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),previous_mpid:h||null,known_identities:createKnownIdentities(b,f)};return i},createModifyIdentityRequest:function createModifyIdentityRequest(b,c,d,e,f,g){return {client_sdk:{platform:d,sdk_vendor:e,sdk_version:f},context:g,environment:a._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:a._Helpers.generateUniqueId(),request_timestamp_ms:new Date().getTime(),identity_changes:this.createIdentityChanges(b,c)}},createIdentityChanges:function createIdentityChanges(a,b){var c=[];if(b&&isObject(b)&&a&&isObject(a))for(var d in b)c.push({old_value:a[d]||null,new_value:b[d],identity_type:d});return c},// takes 2 UI objects keyed by name, combines them, returns them keyed by type
|
|
1089
1089
|
combineUserIdentities:function combineUserIdentities(a,b){var c={},e=d({},a,b);for(var f in e){var g=Types.IdentityType.getIdentityType(f);// this check removes anything that is not whitelisted as an identity type
|
|
1090
1090
|
!1!==g&&0<=g&&(c[Types.IdentityType.getIdentityType(f)]=e[f]);}return c},createAliasNetworkRequest:function createAliasNetworkRequest(b){return {request_id:a._Helpers.generateUniqueId(),request_type:"alias",environment:a._Store.SDKConfig.isDevelopmentMode?"development":"production",api_key:a._Store.devToken,data:{destination_mpid:b.destinationMpid,source_mpid:b.sourceMpid,start_unixtime_ms:b.startTime,end_unixtime_ms:b.endTime,scope:b.scope,device_application_stamp:a._Store.deviceId}}},convertAliasToNative:function convertAliasToNative(a){return {DestinationMpid:a.destinationMpid,SourceMpid:a.sourceMpid,StartUnixtimeMs:a.startTime,EndUnixtimeMs:a.endTime,Scope:a.scope}},convertToNative:function convertToNative(a){var b=[];if(null===a||void 0===a?void 0:a.userIdentities){for(var c in a.userIdentities)a.userIdentities.hasOwnProperty(c)&&b.push({Type:Types.IdentityType.getIdentityType(c),Identity:a.userIdentities[c]});return {UserIdentities:b}}}},this.IdentityAPI={HTTPCodes:HTTPCodes$2,/**
|
|
@@ -1265,13 +1265,13 @@ var f=e.getGDPRConsentState();if(f)for(var g in f)f.hasOwnProperty(g)&&(c=KitFil
|
|
|
1265
1265
|
* Add a GDPR Consent State to the consent state object
|
|
1266
1266
|
*
|
|
1267
1267
|
* @method addGDPRConsentState
|
|
1268
|
-
* @param purpose [String] Data processing purpose that describes the type of processing done on the data subject
|
|
1268
|
+
* @param purpose [String] Data processing purpose that describes the type of processing done on the data subject\u2019s data
|
|
1269
1269
|
* @param gdprConsent [Object] A GDPR consent object created via mParticle.Consent.createGDPRConsent(...)
|
|
1270
1270
|
*/function e(b,e){var f=d(b);if(!f)return a.Logger.error("Purpose must be a string."),this;if(!isObject(e))return a.Logger.error("Invoked with a bad or empty consent object."),this;var g=c.createPrivacyConsent(e.Consented,e.Timestamp,e.ConsentDocument,e.Location,e.HardwareId);return g&&(k[f]=g),this}function f(a){if(!a)k={};else if(isObject(a))for(var b in k={},a)a.hasOwnProperty(b)&&this.addGDPRConsentState(b,a[b]);return this}/**
|
|
1271
1271
|
* Remove a GDPR Consent State to the consent state object
|
|
1272
1272
|
*
|
|
1273
1273
|
* @method removeGDPRConsentState
|
|
1274
|
-
* @param purpose [String] Data processing purpose that describes the type of processing done on the data subject
|
|
1274
|
+
* @param purpose [String] Data processing purpose that describes the type of processing done on the data subject\u2019s data
|
|
1275
1275
|
*/function g(a){var b=d(a);return b?(delete k[b],this):this}/**
|
|
1276
1276
|
* Gets the GDPR Consent State
|
|
1277
1277
|
*
|
|
@@ -1333,8 +1333,8 @@ var s=(null===f||void 0===f?void 0:f.sandbox)||!1,t=normalizeRoktLauncherOptions
|
|
|
1333
1333
|
// to the Rokt Launcher.
|
|
1334
1334
|
this.launcherOptions=__assign({sandbox:s},t),(null===f||void 0===f?void 0:f.domain)&&(this.domain=f.domain),this.initialized=!0;},Object.defineProperty(a.prototype,"isInitialized",{get:function get(){return this.initialized},enumerable:!1,configurable:!0}),a.prototype.attachKit=function(a){var b,c,d,f;this.kit=a,this.watchRouteChanges(),this.flushCheckoutIntents(),(null===(b=a.settings)||void 0===b?void 0:b.accountId)&&this.store.setRoktAccountId(a.settings.accountId),a.integrationName&&(null===(c=this.store)||void 0===c?void 0:c.setIntegrationName(a.integrationName)),this.processMessageQueue();try{null===(d=this.onReadyCallback)||void 0===d?void 0:d.call(this);}catch(a){null===(f=this.logger)||void 0===f?void 0:f.error("RoktManager: Error in onReadyCallback: "+a);}},a.prototype.watchRouteChanges=function(){var a,b,c,d=this;return isFunction(null===(a=this.kit)||void 0===a?void 0:a.onRouteChange)?void(// A full navigation or a re-init lands on the trigger route without a route change
|
|
1335
1335
|
// of its own.
|
|
1336
|
-
this.isAutoLogPageViewEnabled()?(null===(c=this.stopRouteChangeWatch)||void 0===c?void 0:c.call(this),this.stopRouteChangeWatch=null):!this.stopRouteChangeWatch&&(this.stopRouteChangeWatch=subscribeToRouteChange("rokt:".concat(this.instanceName),function(){return d.notifyRouteChange()})),this.notifyRouteChange()):(null===(b=this.stopRouteChangeWatch)||void 0===b?void 0:b.call(this),void(this.stopRouteChangeWatch=null))},a.prototype.notifyRouteChange=function(){var a,b,c;try{null===(b=null===(a=this.kit)||void 0===a?void 0:a.onRouteChange)||void 0===b?void 0:b.call(a);}catch(a){null===(c=this.logger)||void 0===c?void 0:c.error("RoktManager: Error in onRouteChange: ".concat(getErrorMessage(a)));}},a.prototype.isCheckoutIntentSuppressed=function(){var a,b,c=null===(b=null===(a=this.store)||void 0===a?void 0:a.SDKConfig)||void 0===b?void 0:b.flags;if(!c||!0!==c[Constants.FeatureFlags.
|
|
1337
|
-
if(null===(b=this.captureTiming)||void 0===b?void 0:b.call(this,PerformanceMarkType.JointSdkSelectPlacements),!this.isReady()||(null===(c=this.store)||void 0===c?void 0:c.identityCallInFlight))return [2/*return*/,this.deferredCall("selectPlacements",a)];try{if(r=a.attributes,s=(null===r||void 0===r?void 0:r.sandbox)||null,t=this.mapPlacementAttributes(r,this.placementAttributesMapping),(null===(d=this.logger)||void 0===d?void 0:d.isVerbose())&&(u=obfuscateDevData(r,null===(f=null===(e=this.store)||void 0===e?void 0:e.SDKConfig)||void 0===f?void 0:f.isDevelopmentMode),this.logger.verbose("mParticle.Rokt selectPlacements called with attributes:\n".concat(JSON.stringify(u,null,2)))),this.currentUser=this.identityService.getCurrentUser(),v=(null===(h=null===(g=this.currentUser)||void 0===g?void 0:g.getUserIdentities())||void 0===h?void 0:h.userIdentities)||{},w=v.email,x=t.email,y=void 0,z=void 0,A=this.mappedEmailShaIdentityType&&!1!==IdentityType.getIdentityType(this.mappedEmailShaIdentityType),A&&(y=v[this.mappedEmailShaIdentityType],z=t.emailsha256||t[this.mappedEmailShaIdentityType]||void 0),B=this.hasIdentityChanged(w,x),C=this.hasIdentityChanged(y,z),D={},B&&(D.email=x,x&&(E="Email mismatch detected. Current email differs from email passed to selectPlacements call. Proceeding to call identify with email from selectPlacements call. Please verify your implementation.",this.logger.warning(E),null===(i=this.errorReporter)||void 0===i?void 0:i.report({message:E,code:ErrorCodes.IDENTITY_MISMATCH,severity:WSDKErrorSeverity.WARNING}))),C&&(D[this.mappedEmailShaIdentityType]=z,E="emailsha256 mismatch detected. Current mParticle hashedEmail differs from hashedEmail passed to selectPlacements call. Proceeding to call identify with hashedEmail from selectPlacements call. Please verify your implementation.",this.logger.warning(E),null===(j=this.errorReporter)||void 0===j?void 0:j.report({message:E,code:ErrorCodes.IDENTITY_MISMATCH,severity:WSDKErrorSeverity.WARNING})),F=this.toUserAttributes(t),isEmpty(D))this.setUserAttributes(this.currentUser,F);else// Fire-and-forget identify
|
|
1336
|
+
this.isAutoLogPageViewEnabled()?(null===(c=this.stopRouteChangeWatch)||void 0===c?void 0:c.call(this),this.stopRouteChangeWatch=null):!this.stopRouteChangeWatch&&(this.stopRouteChangeWatch=subscribeToRouteChange("rokt:".concat(this.instanceName),function(){return d.notifyRouteChange()})),this.notifyRouteChange()):(null===(b=this.stopRouteChangeWatch)||void 0===b?void 0:b.call(this),void(this.stopRouteChangeWatch=null))},a.prototype.notifyRouteChange=function(){var a,b,c;try{null===(b=null===(a=this.kit)||void 0===a?void 0:a.onRouteChange)||void 0===b?void 0:b.call(a);}catch(a){null===(c=this.logger)||void 0===c?void 0:c.error("RoktManager: Error in onRouteChange: ".concat(getErrorMessage(a)));}},a.prototype.isCheckoutIntentSuppressed=function(){var a,b,c=null===(b=null===(a=this.store)||void 0===a?void 0:a.SDKConfig)||void 0===b?void 0:b.flags;if(!c||!0!==c[Constants.FeatureFlags.AutoButtonTracking]||!this.store.isEnabled)return !0;var d=this.launcherOptions||{};if(d.noFunctional||d.noTargeting||d.doNotShareOrSell)return !0;var e="undefined"==typeof navigator?void 0:navigator;return !!e&&!0===e.globalPrivacyControl},a.prototype.notifyCheckoutIntent=function(a,b){var c;if(void 0===b&&(b=window.location.pathname),!this.isCheckoutIntentSuppressed()){var d=this.kit;if(!d)return void(this.pendingCheckoutIntents=this.pendingCheckoutIntents.filter(function(b){return b.signal.kind!==a.kind}).concat({signal:a,pathname:b}).slice(-CHECKOUT_INTENT_BUFFER_LIMIT));try{isFunction(d.onCheckoutIntent)&&d.onCheckoutIntent(a);}catch(a){null===(c=this.logger)||void 0===c?void 0:c.error("RoktManager: Error in onCheckoutIntent: ".concat(getErrorMessage(a)));}}},a.prototype.discardCheckoutIntents=function(){this.pendingCheckoutIntents=[];},a.prototype.flushCheckoutIntents=function(){var a=this,b=this.pendingCheckoutIntents;this.pendingCheckoutIntents=[];var c=Date.now(),d=window.location.pathname;b.filter(function(a){var b=a.signal,e=a.pathname;return c-b.t<CHECKOUT_INTENT_MAX_AGE_MS&&e===d}).sort(function(c,a){return c.signal.t-a.signal.t}).forEach(function(b){var c=b.signal;return a.notifyCheckoutIntent(c)});},a.prototype.isAutoLogPageViewEnabled=function(){var a,b,c;return !0===(null===(c=null===(b=null===(a=this.store)||void 0===a?void 0:a.SDKConfig)||void 0===b?void 0:b.flags)||void 0===c?void 0:c[Constants.FeatureFlags.AutoLogPageView])},a.prototype.selectPlacements=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;return __awaiter(this,void 0,void 0,function(){var r,s,t,u,v,w,x,y,z,A,B,C,D,E,E,F,G,H,I,J,K,L,M,N,O=this;return __generator(this,function(){// Queue if kit isn't ready OR if identity is in flight
|
|
1337
|
+
if(null===(b=this.captureTiming)||void 0===b?void 0:b.call(this,PerformanceMarkType.JointSdkSelectPlacements),!this.isReady()||(null===(c=this.store)||void 0===c?void 0:c.identityCallInFlight))return [2/*return*/,this.deferredCall("selectPlacements",a)];try{if(r=a.attributes,s=(null===r||void 0===r?void 0:r.sandbox)||null,t=this.mapPlacementAttributes(r,this.placementAttributesMapping),(null===(d=this.logger)||void 0===d?void 0:d.isVerbose())&&(u=obfuscateDevData(r,null===(f=null===(e=this.store)||void 0===e?void 0:e.SDKConfig)||void 0===f?void 0:f.isDevelopmentMode),this.logger.verbose("mParticle.Rokt selectPlacements called with attributes:\n".concat(JSON.stringify(u,null,2)))),this.currentUser=this.identityService.getCurrentUser(),v=(null===(h=null===(g=this.currentUser)||void 0===g?void 0:g.getUserIdentities())||void 0===h?void 0:h.userIdentities)||{},w=v.email,x=t.email,y=void 0,z=void 0,A=this.mappedEmailShaIdentityType&&!1!==IdentityType.getIdentityType(this.mappedEmailShaIdentityType),A&&(y=v[this.mappedEmailShaIdentityType],z=t.emailsha256||t[this.mappedEmailShaIdentityType]||void 0),B=this.hasIdentityChanged(w,x),C=this.hasIdentityChanged(y,z),D={},B&&(D.email=x,x&&(E="Email mismatch detected. Current email differs from email passed to selectPlacements call. Proceeding to call identify with email from selectPlacements call. Please verify your implementation.",this.logger.warning(E),null===(i=this.errorReporter)||void 0===i?void 0:i.report({message:E,code:ErrorCodes.IDENTITY_MISMATCH,severity:WSDKErrorSeverity.WARNING}))),C&&(D[this.mappedEmailShaIdentityType]=z,E="emailsha256 mismatch detected. Current mParticle hashedEmail differs from hashedEmail passed to selectPlacements call. Proceeding to call identify with hashedEmail from selectPlacements call. Please verify your implementation.",this.logger.warning(E),null===(j=this.errorReporter)||void 0===j?void 0:j.report({message:E,code:ErrorCodes.IDENTITY_MISMATCH,severity:WSDKErrorSeverity.WARNING})),F=this.toUserAttributes(t),isEmpty(D))this.setUserAttributes(this.currentUser,F);else// Fire-and-forget identify \u2014 best-effort, does not block selectPlacements
|
|
1338
1338
|
try{this.identityService.identify({userIdentities:__assign(__assign({},v),D)},function(a){var b,c=+(null===a||void 0===a?void 0:a.httpCode);c&&(400<=c||0>c)&&O.logger.error("Background identify failed with HTTP "+c),O.setUserAttributes(null===(b=null===a||void 0===a?void 0:a.getUser)||void 0===b?void 0:b.call(a),F,D),O.processMessageQueue();});}catch(a){this.logger.error("Background identify threw an error: "+getErrorMessage(a)),this.setUserAttributes(this.identityService.getCurrentUser(),F,D);}return G=__assign(__assign({},v),D),H=null===(l=null===(k=this.store)||void 0===k?void 0:k.getTimeOnSite)||void 0===l?void 0:l.call(k),I=null===(n=null===(m=this.store)||void 0===m?void 0:m.getTotalTimeOnSite)||void 0===n?void 0:n.call(m),J=__assign(__assign(__assign(__assign({},t),null===s?{}:{sandbox:s}),H?{active_time_on_site_ms:H}:{}),I?{total_time_on_site_ms:I}:{}),G.email&&!J.email&&(J.email=G.email),A&&(K=G[this.mappedEmailShaIdentityType],K&&!J.emailsha256&&!J[this.mappedEmailShaIdentityType]&&(J.emailsha256=K)),J[PASSBACK_CONVERSION_TRACKING_ID]||(null===(o=this.integrationCapture)||void 0===o?void 0:o.capture(),L=null===(p=this.integrationCapture)||void 0===p?void 0:p.getClickIdsAsIntegrationAttributes(),M=null===(q=null===L||void 0===L?void 0:L[PARTNER_MODULE_IDS.Rokt])||void 0===q?void 0:q[PASSBACK_CONVERSION_TRACKING_ID],M&&(J[PASSBACK_CONVERSION_TRACKING_ID]=M)),this.filters.filteredUser=this.currentUser||this.filters.filteredUser||null,N=__assign(__assign({},a),{attributes:J}),[2/*return*/,this.kit.selectPlacements(N)]}catch(a){return [2/*return*/,Promise.reject(a instanceof Error?a:new Error("Unknown error occurred"))]}return [2/*return*/]})})},a.prototype.hashAttributes=function(a){return __awaiter(this,void 0,void 0,function(){var b,c,d,e,f,g,h,i,j,k,l,m=this;return __generator(this,function(n){switch(n.label){case 0:return (n.trys.push([0,2,,3]),!a||"object"!==_typeof(a))?[2/*return*/,{}]:(b=Object.keys(a),0===b.length)?[2/*return*/,{}]:(c=b.map(function(b){return __awaiter(m,void 0,void 0,function(){var c,d;return __generator(this,function(e){switch(e.label){case 0:return c=a[b],[4/*yield*/,this.hashSha256(c)];case 1:return d=e.sent(),[2/*return*/,{key:b,attributeValue:c,hashedValue:d}]}})})}),[4/*yield*/,Promise.all(c)]);case 1:for(d=n.sent(),e={},(f=0,g=d);f<g.length;f++)h=g[f],i=h.key,j=h.attributeValue,k=h.hashedValue,e[i]=j,k&&(e["".concat(i,"sha256")]=k);return [2/*return*/,e];case 2:return l=n.sent(),this.logger.error("Failed to hashAttributes, returning an empty object: ".concat(getErrorMessage(l))),[2/*return*/,{}];case 3:return [2/*return*/]}})})},a.prototype.setExtensionData=function(a){if(!this.isReady())return void this.deferredCall("setExtensionData",a);try{this.kit.setExtensionData(a);}catch(a){throw new Error("Error setting extension data: "+getErrorMessage(a))}},a.prototype.use=function(a){if(!this.isReady())return this.deferredCall("use",a);try{return this.kit.use(a)}catch(b){return Promise.reject(b instanceof Error?b:new Error("Error using extension: "+a))}},a.prototype.terminate=function(){var a,b,c;return __awaiter(this,void 0,void 0,function(){var d;return __generator(this,function(e){switch(e.label){case 0:if(!this.isReady())return null===(a=this.logger)||void 0===a?void 0:a.verbose("mParticle.Rokt.terminate called before the Rokt kit was ready. Nothing to terminate."),[2/*return*/];if(!isFunction(this.kit.terminate))return null===(b=this.logger)||void 0===b?void 0:b.error("mParticle.Rokt.terminate is not supported by the attached Rokt Kit version."),[2/*return*/];e.label=1;case 1:return e.trys.push([1,3,,4]),[4/*yield*/,this.kit.terminate()];case 2:return e.sent(),[3/*break*/,4];case 3:return d=e.sent(),null===(c=this.logger)||void 0===c?void 0:c.error("Failed to terminate the Rokt launcher: ".concat(getErrorMessage(d))),[3/*break*/,4];case 4:return [2/*return*/]}})})},a.prototype.onShoppableAdsReady=function(a){if(!this.kit||!this.isShoppableAdsLoaded)return void this.deferredCall("onShoppableAdsReady",a);try{this.kit.onShoppableAdsReady(a);}catch(a){this.logger.error("Failed to register onShoppableAdsReady callback: ".concat(getErrorMessage(a)));}},a.prototype.flushOnShoppableAdsReadyMessageQueue=function(a){var b=this;this.kit=a,this.messageQueue.forEach(function(c,d){var f;if(c.methodName===ON_SHOPPABLE_ADS_READY_METHOD){try{a.onShoppableAdsReady(c.payload);}catch(a){null===(f=b.logger)||void 0===f?void 0:f.error("RoktManager: Error flushing onShoppableAdsReady: "+a);}b.messageQueue["delete"](d);}}),this.isShoppableAdsLoaded=!0;},a.prototype.hashSha256=function(a){return __awaiter(this,void 0,void 0,function(){var b,c;return __generator(this,function(d){switch(d.label){case 0:if(null===a||void 0===a)return this.logger.warning("hashSha256 received null/undefined as input"),[2/*return*/,a];d.label=1;case 1:return d.trys.push([1,3,,4]),b=(a+"").trim().toLocaleLowerCase(),[4/*yield*/,this.sha256Hex(b)];case 2:return [2/*return*/,d.sent()];case 3:return c=d.sent(),this.logger.error("Failed to hashSha256, returning undefined: ".concat(getErrorMessage(c))),[2/*return*/,void 0];case 4:return [2/*return*/]}})})},a.prototype.getLocalSessionAttributes=function(){return this.store.getLocalSessionAttributes()},a.prototype.setLocalSessionAttribute=function(a,b){this.store.setLocalSessionAttribute(a,b);},a.prototype.isReady=function(){// The Rokt Manager is ready when a kit is attached and has a launcher
|
|
1339
1339
|
return !!(this.kit&&this.kit.launcher)},a.prototype.toUserAttributes=function(a){var b=["sandbox"],c={};for(var d in a)if(a.hasOwnProperty(d)&&-1===b.indexOf(d)){var e=a[d];c[d]=Array.isArray(e)?JSON.stringify(e):e;}return c},a.prototype.setUserAttributes=function(a,b,c){if(void 0===c&&(c={}),!a)return void this.logger.warning("selectPlacements attributes were not set because there is no user to set them on.");try{if(this.hasContradictingIdentity(a,c))return void this.logger.warning("selectPlacements attributes were not set because identify did not resolve to a user with the passed email or hashed email.");a.setUserAttributes(b);}catch(a){this.logger.error("Error setting user attributes: "+a);}},a.prototype.hasContradictingIdentity=function(a,b){return Object.keys(b).some(function(c){var d,e,f=null===(e=null===(d=a.getUserIdentities())||void 0===d?void 0:d.userIdentities)||void 0===e?void 0:e[c];return !!f&&f!==b[c]})},a.prototype.mapPlacementAttributes=function(a,b){for(var c,d={},e=0,f=b;e<f.length;e++)c=f[e],d[c.map]=c.value;var g={};for(var h in a)if(a.hasOwnProperty(h)){var i=d[h]||h;g[i]=a[h];}return g},a.prototype.onIdentityComplete=function(){this.isReady()&&(this.currentUser=this.identityService.getCurrentUser(),this.processMessageQueue());},a.prototype.processMessageQueue=function(){var a,b=this;if(this.isReady()&&0!==this.messageQueue.size){null===(a=this.logger)||void 0===a?void 0:a.verbose("RoktManager: Processing ".concat(this.messageQueue.size," queued messages"));var c=Array.from(this.messageQueue.values());// Clear the queue immediately to prevent re-processing
|
|
1340
1340
|
this.messageQueue.clear(),c.forEach(function(a){var c,d,e,f;if(!(a.methodName in b)||!isFunction(b[a.methodName]))return void(null===(c=b.logger)||void 0===c?void 0:c.error("RoktManager: Method ".concat(a.methodName," not found")));if(null===(d=b.logger)||void 0===d?void 0:d.isVerbose()){var g=obfuscateDevData(a.payload,null===(f=null===(e=b.store)||void 0===e?void 0:e.SDKConfig)||void 0===f?void 0:f.isDevelopmentMode);b.logger.verbose("RoktManager: Processing queued message: ".concat(a.methodName," with payload: ").concat(JSON.stringify(g)));}// Capture resolve/reject functions before async processing
|
|
@@ -1359,20 +1359,83 @@ var ErrorReportingDispatcher=/** @class */function(){function a(){this.services=
|
|
|
1359
1359
|
|
|
1360
1360
|
var LoggingDispatcher=/** @class */function(){function a(){this.services=[];}return a.prototype.register=function(a){this.services.push(a);},a.prototype.log=function(a){var b=this;this.services.forEach(function(c){var d;try{c.log(a);}catch(a){null===(d=b.logger)||void 0===d?void 0:d.error("Error in LoggingService: "+a);}});},a}();
|
|
1361
1361
|
|
|
1362
|
-
var
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
//
|
|
1367
|
-
|
|
1368
|
-
|
|
1362
|
+
var AUTO_BUTTON_ATTRIBUTE="is_auto_button_click";// Specific enough not to merge with a customer's own 'Button Click' event.
|
|
1363
|
+
var BUTTON_CLICK_EVENT_NAME="Auto Button Click";// One custom event per click, logged like logLink() with the auto marker and the
|
|
1364
|
+
// page fields that auto page views carry. No intent: classifying clicks is left
|
|
1365
|
+
// to whoever reads the data.
|
|
1366
|
+
var buildButtonClickEvent=function(a,b){// Optional fields are left out when the button has no safe value for them.
|
|
1367
|
+
for(var c,d,e=(c={label_source:a.labelSource,element:a.element,type:a.type,path:b,hostname:window.location.hostname},c[AUTO_BUTTON_ATTRIBUTE]=!0,c),f={label:a.label,aria_label:a.ariaLabel,icon:a.icon,element_id:a.elementId,element_name:a.elementName,test_id:a.testId,controls:a.controls,form:a.form},g=0,h=Object.keys(f);g<h.length;g++)d=h[g],f[d]&&(e[d]=f[d]);return {messageType:MessageType$1.PageEvent,name:BUTTON_CLICK_EVENT_NAME,data:e,eventType:EventType.Other}};
|
|
1368
|
+
|
|
1369
|
+
// descriptions. Rokt's own elements, disabled controls and anything under
|
|
1370
|
+
// data-mp-no-track are never returned.
|
|
1371
|
+
var CONTROL_SELECTOR="button, input[type=\"submit\"], input[type=\"button\"], input[type=\"image\"], [role=\"button\"]";// closest() over the composed tree: slots, parents, then shadow hosts.
|
|
1372
|
+
function hasComposedAncestor(a,b){for(var c=a;c;){if(c.matches(b))return !0;var d=isFunction(c.getRootNode)?c.getRootNode():null;c=c.assignedSlot||c.parentElement||d&&d.host||null;}return !1}// Rokt's own placements and frames never count as partner checkout controls.
|
|
1373
|
+
function isRoktElement(a){if(hasComposedAncestor(a,"[data-core-type], #rokt-controller-frame"))return !0;var b=a.getAttribute("src");if(b)try{if(-1!==new URL(b,"https://example.test").pathname.indexOf("/wsdk/"))return !0}catch(a){// An unparseable src is not a Rokt element.
|
|
1374
|
+
}return !1}function isWalletElement(a){return a.matches("apple-pay-button, shop-pay-button, .gpay-button, #AmazonPayButton, [data-amazon-pay-button]")}// Walks at most 12 entries of an event's composed path for the nearest control.
|
|
1375
|
+
// Rokt elements, disabled controls and anything under data-mp-no-track are skipped.
|
|
1376
|
+
function findControl(a){for(var b,c,d=0,e=a.slice(0,12);d<e.length;d++)if(c=e[d],!!(c instanceof Element)){if(isRoktElement(c)||c.matches("[data-mp-no-track]"))return;!b&&(c.matches("button, input[type=\"submit\"], input[type=\"button\"], input[type=\"image\"], [role=\"button\"], a[href]")||isWalletElement(c))&&(b=c);}return !b||isRoktElement(b)||hasComposedAncestor(b,"[data-mp-no-track]")||b.matches(":disabled, [aria-disabled=\"true\"]")?void 0:b}// fields, editable regions, and anything under data-mp-no-track.
|
|
1377
|
+
function isUnsafeTextSource(a){return a.matches("input, select, textarea, option, optgroup, datalist, [contenteditable]:not([contenteditable=\"false\"])")||!!a.querySelector("input, select, textarea, [data-mp-no-track], [contenteditable]:not([contenteditable=\"false\"])")||hasComposedAncestor(a,"select, datalist, textarea, [data-mp-no-track], [contenteditable]:not([contenteditable=\"false\"])")}
|
|
1378
|
+
|
|
1379
|
+
// Masks a button label before it is logged. Button text can carry personal data,
|
|
1380
|
+
// so this is the privacy boundary for every label and aria-label.
|
|
1381
|
+
// Masking needs \p{Nd} to see every script's digits. Browsers without Unicode
|
|
1382
|
+
// property escapes send no labels at all.
|
|
1383
|
+
function createDigitPatterns(){try{return {run:/\p{Nd}{6,}/u,number:/\p{Nd}+(?:[.,\u060C\u066B\u066C]\p{Nd}+)*/gu}}catch(a){}}var digitPatterns=createDigitPatterns();// The label as logged: lower case, at most 64 characters, digits and amounts
|
|
1384
|
+
// masked. Dropped when it looks like an email, phone or card number.
|
|
1385
|
+
function maskLabel(a){if(a&&!(128<a.length)&&digitPatterns){var b=a.replace(/\s+/g," ").trim().toLowerCase();if(b&&-1===b.indexOf("@")&&!digitPatterns.run.test(b.replace(/[\s()\-\u2010-\u2015]/g,""))){var c=b.replace(digitPatterns.number,"#").slice(0,64).trim();return c||void 0}}}
|
|
1386
|
+
|
|
1387
|
+
function elementKind(a){if(isWalletElement(a))return "wallet";var b=a.tagName.toLowerCase();return "button"===b||"input"===b?b:"role"}function textOf(a){return a&&!isUnsafeTextSource(a)&&a.textContent?a.textContent.trim():""}function nonBlank(a){return a&&a.trim()?a:void 0}// The button's name as a screen reader would read it, simplified: the first of
|
|
1388
|
+
// aria-labelledby, aria-label, own text (or an inner image's alt), title, and for
|
|
1389
|
+
// inputs their value. The text sources are skipped for controls that hold form
|
|
1390
|
+
// fields or more than four children, so a typed value is never read.
|
|
1391
|
+
function accessibleName(a){var b=a.getAttribute("aria-labelledby");if(b){var c=isFunction(a.getRootNode)?a.getRootNode():document,d=b.split(/\s+/).map(function(a){return textOf(c.getElementById?c.getElementById(a):null)}).filter(function(a){return !!a}).join(" ");if(d)return {raw:d,source:"labelledby"}}var e=nonBlank(a.getAttribute("aria-label"));if(e)return {raw:e,source:"aria"};var f=4>=a.children.length&&!isUnsafeTextSource(a);if(a instanceof HTMLInputElement){// The browser's normalised type: an unknown value reads as 'text'.
|
|
1392
|
+
var g=a.type;if("image"===g){var h=nonBlank(a.getAttribute("alt"));if(h)return {raw:h,source:"alt"}}else if("submit"===g||"button"===g||"reset"===g){var i=nonBlank(a.value);if(i)return {raw:i,source:"value"};if("button"!==g)// What the browser shows on an input without a value.
|
|
1393
|
+
return {raw:g,source:"value"}}}else if(f){var d=textOf(a);if(d)return {raw:d,source:"text"};var j=a.querySelector("img[alt]"),h=j?nonBlank(j.getAttribute("alt")):void 0;if(h)return {raw:h,source:"alt"}}var k=nonBlank(a.getAttribute("title"));return k?{raw:k,source:"title"}:{source:"none"}}var ICON_CLASS=/^(?:fa|fas|far|fal|icon|bi|glyphicon|ti|mdi|ri|la|lucide|ion|feather|ph)-([a-z][a-z-]{1,31})$/,ICON_MODIFIER=/^(?:solid|regular|light|thin|duotone|brands|sharp|fw|lg|xs|sm|xl|spin|pulse|border|inverse|stack|flip(?:-[a-z]+)?|rotate(?:-[a-z]+)?|pull-[a-z]+)$/;// Size, style and animation classes that share the icon prefixes.
|
|
1394
|
+
function iconToken(a){if(a){var b=a.toLowerCase().replace(/^icon-/,"");return /^[a-z][a-z-]{1,31}$/.test(b)?b:void 0}}// An icon name from an SVG sprite reference or an icon-font class, for buttons
|
|
1395
|
+
// whose only content is an icon. Letters and hyphens only.
|
|
1396
|
+
function iconHint(a){var b=function(a){return !hasComposedAncestor(a,"[data-mp-no-track]")},c=Array.from(a.querySelectorAll("use")).filter(b)[0];if(c){var d=c.getAttribute("href")||c.getAttribute("xlink:href")||"",e=d.indexOf("#"),f=iconToken(-1===e?null:d.slice(e+1));if(f)return f}for(var g=[a].concat(Array.from(a.querySelectorAll("i, span, svg"))).filter(b).slice(0,5),h=0,i=g;h<i.length;h++)for(var j=i[h],k=(j.getAttribute("class")||"").split(/\s+/),l=0,m=k;l<m.length;l++){var n=m[l],o=ICON_CLASS.exec(n.toLowerCase());if(o&&!ICON_MODIFIER.test(o[1]))return o[1]}}// Words of letters, each optionally ending in up to three digits, joined by
|
|
1397
|
+
// hyphens or underscores: `add-to-cart`, `btnCheckout`, `step_2`. Generated ids
|
|
1398
|
+
// (`ember1234`, `a8f3e2c1`, `radix-:r1:`) and long numbers don't match.
|
|
1399
|
+
var HAND_WRITTEN_ID=/^[A-Za-z]+[0-9]{0,3}(?:[-_](?:[A-Za-z]+[0-9]{0,3}|[0-9]{1,3}))*$/;// A developer-written identifier, or nothing.
|
|
1400
|
+
function stableIdentifier(a){if(a){// At most three digits in all, so numbers split into groups don't pass.
|
|
1401
|
+
var b=a.trim(),c=b.replace(/[^0-9]/g,"").length;return 64>=b.length&&3>=c&&HAND_WRITTEN_ID.test(b)?b:void 0}}var TEST_ID_ATTRIBUTES=["data-testid","data-test-id","data-test","data-qa","data-cy"];// The first of these attributes that holds a developer-written identifier.
|
|
1402
|
+
function firstIdentifier(a,b){for(var c=0,d=b;c<d.length;c++){var e=d[c],f=stableIdentifier(a.getAttribute(e));if(f)return f}}// What the button opens or acts on: a menu, drawer or dialog. aria-controls can
|
|
1403
|
+
// list several ids, so only the first is used.
|
|
1404
|
+
function controlsIdentifier(a){var b=a.getAttribute("aria-controls");return stableIdentifier(b?b.trim().split(/\s+/)[0]:null)||firstIdentifier(a,["popovertarget","commandfor"])}// The id of the form a button or input actually submits, which the browser
|
|
1405
|
+
// resolves from its form attribute or its owning form. getAttribute, because a
|
|
1406
|
+
// field named "id" shadows form.id.
|
|
1407
|
+
function formIdentifier(a){var b=a instanceof HTMLButtonElement||a instanceof HTMLInputElement?a.form:null;return b?stableIdentifier(b.getAttribute("id")):void 0}// The browser's normalised type: a button defaults to 'submit' and an unknown
|
|
1408
|
+
// input type reads as 'text'. Wallet and role buttons are just 'button'.
|
|
1409
|
+
function controlType(a,b){return "button"===b||"input"===b?a.type:"button"}// Describes a clicked control for auto button tracking. Links are left to page
|
|
1410
|
+
// views, so a link click is not described.
|
|
1411
|
+
function describeButtonClick(a){if(!a.matches("a[href]:not([role=\"button\"])")){var b=elementKind(a),c=accessibleName(a),d=maskLabel(c.raw);return {label:d,labelSource:d?c.source:"none",// Kept on its own as well: it often says more than the visible text,
|
|
1412
|
+
// such as which item a remove button removes.
|
|
1413
|
+
ariaLabel:maskLabel(a.getAttribute("aria-label")),icon:iconHint(a),elementId:stableIdentifier(a.getAttribute("id")),elementName:stableIdentifier(a.getAttribute("name")),testId:firstIdentifier(a,TEST_ID_ATTRIBUTES),controls:controlsIdentifier(a),form:formIdentifier(a),element:b,type:controlType(a,b)}}}
|
|
1414
|
+
|
|
1415
|
+
var checkoutPath=/(?:^|\/)(?:checkouts?|payment|order|kasse|paiement|commander?|pago)(?:\/|$)/i,exclusions=new RegExp("coupon|promo|newsletter|sign in|add to cart|gift card|pay later|pay in|payment plan|learn more|gutschein|anmelden|warenkorb|bon cadeau|connexion|panier|cup\xF3n|iniciar sesi\xF3n|carrito|carrello|codice sconto|accedi|buono regalo|winkelwagen|kortingscode|inloggen|cadeaubon|achteraf betalen|\u30AB\u30FC\u30C8|\u30AF\u30FC\u30DD\u30F3|\u30ED\u30B0\u30A4\u30F3|\u4F1A\u54E1\u767B\u9332|\u30AE\u30D5\u30C8|\u5F8C\u6255\u3044|\u30E1\u30EB\u30DE\u30AC"),commits=new RegExp("^(?:"+"(?:place|submit|complete|confirm|finali[sz]e)(?!(?: [^ ]+){0,2} (?:another|new|next)(?: |$))(?: [^ ]+){0,2} (?:order|purchase|booking|reservation|payment|checkout)|pay(?: securely)?(?: now)?|confirm and pay|order and pay|order with obligation to pay|(?:jetzt )?(?:zahlungs|kosten)pflichtig (?:bestellen|buchen)|(?:jetzt )?bezahlen|kauf abschlie\xDFen|bestellung abschlie\xDFen|commander et payer|payer(?: maintenant)?|(?:confirmer|finaliser) (?:ma |la )?commande|valider et payer|confirmer et payer|commande avec obligation de paiement|finaliser l'achat|(?:realizar|confirmar|completar) (?:el |mi |la )?(?:pedido|compra|reserva)|finalizar (?:el |mi )?pedido|pagar(?: ahora)?|pedido con obligaci\xF3n de pago|(?:effettua|conferma|concludi|completa) (?:l'|il )?(?:ordine|acquisto)|ordine con obbligo di pagamento|paga(?: ora| adesso)?|ordina e paga|(?:nu )?betalen|bestellen en betalen|bestelling plaatsen|plaats bestelling|bestelling afronden|bestelling met betalingsverplichting|(?:\u3053\u306E\u5185\u5BB9\u3067|\u4E0A\u8A18\u306E?\u5185\u5BB9\u3067)?\u3054?(?:\u6CE8\u6587|\u8CFC\u5165|\u4E88\u7D04|\u6C7A\u6E08|\u304A?\u652F\u6255\u3044?)\u3092?(?:\u78BA\u5B9A|\u5B8C\u4E86)(?:\u3059\u308B)?|(?:\u3053\u306E\u5185\u5BB9\u3067|\u4E0A\u8A18\u306E?\u5185\u5BB9\u3067)\u3054?(?:\u6CE8\u6587|\u8CFC\u5165|\u4E88\u7D04)\u3059\u308B|\u3054?\u6CE8\u6587\u3059\u308B|\u6C7A\u6E08\u3059\u308B|(?:\u4ECA\u3059\u3050|\u3092)?\u652F\u6255\u3046"+")$"),routeGatedCommits=/^(?:buy now|purchase|jetzt kaufen|kaufen|commander|(?:passer|valider) (?:la |ma )?commande|finalizar (?:la |mi )?compra|comprar ahora|acquista ora|nu kopen|\u4ECA\u3059\u3050\u8CFC\u5165|\u8CFC\u5165\u3059\u308B|\u3053\u306E\u5185\u5BB9\u3067\u7533\u3057\u8FBC\u3080)$/,steps=new RegExp("^(?:"+"checkout|check out|check-out|continue to payment|proceed to checkout|zur kasse|zur kasse gehen|auschecken|weiter zur zahlung|passer \xE0 la caisse|continuer vers le paiement|proc\xE9der au paiement|ir a caja|continuar al pago|tramitar pedido|procedi al checkout|procedi all'acquisto|procedi al pagamento|vai alla cassa|afrekenen|verder naar betalen|doorgaan naar betalen|\u30EC\u30B8\u306B\u9032\u3080|\u3054?(?:\u8CFC\u5165|\u6CE8\u6587)\u624B\u7D9A\u304D(?:\u3078|\u306B)(?:\u9032\u3080)?|\u304A?\u652F\u6255\u3044(?:\u3078|\u306B)\u9032\u3080|(?:\u3054\u6CE8\u6587\u5185\u5BB9\u306E)?\u78BA\u8A8D\u753B\u9762\u3078(?:\u9032\u3080)?"+")$"),wallets=/^(?:apple pay|google pay|paypal|venmo|amazon pay|shop pay|klarna|afterpay|affirm)$/,frameHosts=new Set(["www.paypal.com","www.sandbox.paypal.com","pay.google.com","applepay.cdn-apple.com","js.stripe.com","checkoutshopper-live.adyen.com","payments.amazon.com","pay.shopify.com"]),TYPOGRAPHIC_APOSTROPHES=/[\u2019\u2018]/g,CURRENCY_AND_NUMBER_CHARS=/[0-9\uFF10-\uFF19$\u20AC\u00A3\u00A5\uFFE5\u20B9\u5186.,\uFF0C]/g;// Exact HTTPS hosts of hosted wallet and payment frames.
|
|
1416
|
+
// Keep these classes ASCII-only in source bytes to avoid mojibake parse failures
|
|
1417
|
+
// when a host page forces non-UTF-8 decoding before JavaScript parse.
|
|
1418
|
+
function getIntentRouteClass(a){return checkoutPath.test(a)?"checkout_path":"other"}function normalize(a){return !a||128<a.length?void 0:a.toLowerCase().replace(TYPOGRAPHIC_APOSTROPHES,"'").replace(CURRENCY_AND_NUMBER_CHARS,"").replace(/\s+/g," ").trim()}// Labels come from aria-label then visible text. Only submit and button inputs
|
|
1419
|
+
// have their value read, so a typed field value is never touched. Other text
|
|
1420
|
+
// follows the same rules as button descriptions.
|
|
1421
|
+
function labelSources(a){if(a instanceof HTMLInputElement){var b=a.type,c=null;return "submit"===b||"button"===b?c=a.value:"image"===b&&(c=a.getAttribute("alt")),[a.getAttribute("aria-label"),c]}return 4<a.children.length||isUnsafeTextSource(a)?[]:[a.getAttribute("aria-label"),a.textContent]}function labels(a){return labelSources(a).map(normalize).filter(function(a){return !!a})}function classifyLabel(a,b,c){return commits.test(a)||routeGatedCommits.test(a)&&"checkout_path"===getIntentRouteClass(c)?"commit":b&&wallets.test(a)?"wallet":steps.test(a)?"checkout_step":void 0}// Classifies a clicked or submitting control found by findControl.
|
|
1422
|
+
function classifyIntentControl(a,b){var c=labels(a);if(!c.some(function(a){return exclusions.test(a)})){var d=!1;if(a.matches("a[href]")||(d=a.matches(CONTROL_SELECTOR)||isWalletElement(a)),d&&isWalletElement(a))return "wallet";for(var e=0,f=c;e<f.length;e++){var g=f[e],h=classifyLabel(g,d,b);if(h)return h}}}// Focus moving into a visible hosted wallet or payment frame.
|
|
1369
1423
|
function classifyIntentFrame(a,b){if("visible"===b.document.visibilityState&&a instanceof HTMLIFrameElement&&!isRoktElement(a))try{var c=new URL(a.src);if("https:"===c.protocol&&frameHosts.has(c.hostname))return "frame"}catch(a){// An unparseable frame src is not a wallet frame.
|
|
1370
1424
|
}}
|
|
1371
1425
|
|
|
1372
|
-
// listeners. Inspect `window.
|
|
1373
|
-
var
|
|
1374
|
-
|
|
1375
|
-
var
|
|
1426
|
+
// listeners. Inspect `window.__mpBtn__` in a console to see if one is live.
|
|
1427
|
+
var WIN_BTN_KEY="__mpBtn__";var THROTTLE_MS=2e3,SUBMIT_AFTER_COMMIT_CLICK_MS=1e3,PATH_LIMIT=12,PAGE_EVENT_LIMIT=100,btnWindow=function(){return "undefined"==typeof window?null:window};// A ceiling, not a dedupe: a held Enter key or browser automation fires a
|
|
1428
|
+
// trusted click per repeat, and each one is forwarded to every kit.
|
|
1429
|
+
var getActiveButtonTracker=function(){var a=btnWindow(),b=a?a[WIN_BTN_KEY]:void 0;return b?b.tracker:void 0};// Stops whichever tracker is active, including one from an earlier bundle load.
|
|
1430
|
+
var resetButtonTracking=function(){var a=btnWindow();if(a){var b=getActiveButtonTracker();b&&b.teardown(),a[WIN_BTN_KEY]={};}};// Runs once the browser has painted the page's response to the interaction, so
|
|
1431
|
+
// describing and logging a click never delays that paint.
|
|
1432
|
+
var afterNextPaint=function(a){isFunction(window.requestAnimationFrame)&&"hidden"!==document.visibilityState?requestAnimationFrame(function(){setTimeout(a,0);}):setTimeout(a,0);},CAPTURE_PASSIVE={capture:!0,passive:!0},PASSIVE={passive:!0},ButtonTracker=/** @class */function(){function a(a){var b=this;this.active=!1,this.hasRoktKit=!1,this.generation=0,this.lastCommitClick=-Infinity,this.lastSent={},this.pagePath=null,this.pageEvents=0,this.pending=[],this.drain=function(){var a=b.pending;b.pending=[],a.forEach(function(a){return a()});},this.onHide=function(a){("beforeunload"===a.type||"pagehide"===a.type||"hidden"===document.visibilityState)&&b.drain();},this.onPageShow=function(a){a.persisted&&b.reset();},this.onEvent=function(a){try{b.observe(a);}catch(a){b.log("[error] event handler threw: "+a);}},this.mpInstance=a;}return Object.defineProperty(a.prototype,"isActive",{get:function get(){return this.active},enumerable:!1,configurable:!0}),a.prototype.init=function(a){var b=btnWindow();if(b){var c=getActiveButtonTracker();return c&&c.teardown(),this.active&&this.teardown(),this.hasRoktKit=a.hasRoktKit,!this.eventsEnabled()&&this.isKitSuppressed()?void this.log("opted out, not starting"):void(b.document.addEventListener("click",this.onEvent,CAPTURE_PASSIVE),b.document.addEventListener("submit",this.onEvent,CAPTURE_PASSIVE),b.addEventListener("blur",this.onEvent,PASSIVE),b.addEventListener("pageshow",this.onPageShow,PASSIVE),b.addEventListener("beforeunload",this.onHide,CAPTURE_PASSIVE),b.addEventListener("pagehide",this.onHide,CAPTURE_PASSIVE),b.document.addEventListener("visibilitychange",this.onHide,CAPTURE_PASSIVE),this.active=!0,!b[WIN_BTN_KEY]&&(b[WIN_BTN_KEY]={}),b[WIN_BTN_KEY].tracker=this,this.log("listening"))}},a.prototype.teardown=function(){var a=btnWindow();if(a){a.document.removeEventListener("click",this.onEvent,!0),a.document.removeEventListener("submit",this.onEvent,!0),a.removeEventListener("blur",this.onEvent),a.removeEventListener("pageshow",this.onPageShow),a.removeEventListener("beforeunload",this.onHide,!0),a.removeEventListener("pagehide",this.onHide,!0),a.document.removeEventListener("visibilitychange",this.onHide,!0);var b=a[WIN_BTN_KEY];b&&b.tracker===this&&(b.tracker=void 0);}this.active=!1,this.clearPending();},a.prototype.clearPending=function(){this.reset();var a=this.mpInstance._RoktManager;a&&a.discardCheckoutIntents();},a.prototype.reset=function(){this.generation++,this.pending=[],this.lastCommitClick=-Infinity,this.lastSent={},this.pagePath=null,this.pageEvents=0;},a.prototype.enqueue=function(a){this.pending.push(a),1===this.pending.length&&afterNextPaint(this.drain);},a.prototype.observe=function(a){var b=this;if(this.active&&a.isTrusted){// The button is read now, while the click is still being dispatched:
|
|
1433
|
+
// this capture listener runs before the page's own handlers, so a
|
|
1434
|
+
// button that disables or relabels itself is seen as it was clicked.
|
|
1435
|
+
// Logging and the kit hand-off wait for the next paint.
|
|
1436
|
+
var c=a.type,d="click"===c&&this.eventsEnabled(),e=!this.isKitSuppressed();if(d||e){var f,g,h=Date.now(),i=window.location.pathname,j=!1;if("click"===c){// The composed path is only populated during dispatch.
|
|
1437
|
+
var k=findControl(isFunction(a.composedPath)?a.composedPath().slice(0,PATH_LIMIT):[]);k&&(f=d?describeButtonClick(k):void 0,g=e?classifyIntentControl(k,i):void 0);}else if("submit"===c){var l=a.submitter,k=l?findControl([l]):void 0;l?k&&(g=classifyIntentControl(k,i)):g="commit",j=!l;}var m=this.generation;this.enqueue(function(){if(m===b.generation)try{"blur"===c?g=classifyIntentFrame(document.activeElement,window):j&&h-b.lastCommitClick>SUBMIT_AFTER_COMMIT_CLICK_MS&&(g=void 0),f&&d&&b.logClick(f,i),g&&b.emit(g,c,h,i);}catch(a){b.log("[error] delivery threw: "+a);}});}}},a.prototype.logClick=function(a,b){this.eventsEnabled()&&(b!==this.pagePath&&(this.pagePath=b,this.pageEvents=0),this.pageEvents>=PAGE_EVENT_LIMIT||(// Restarts an expired session, as public logEvent() and page views do.
|
|
1438
|
+
this.pageEvents++,this.mpInstance._SessionManager.resetSessionTimer(),this.mpInstance._Events.logEvent(buildButtonClickEvent(a,b))));},a.prototype.emit=function(a,b,c,d){if(!this.isKitSuppressed()){"commit"===a&&"click"===b&&(this.lastCommitClick=c);var e=this.lastSent[a];e&&e.pathname===d&&c-e.t<THROTTLE_MS||(this.lastSent[a]={t:c,pathname:d},this.mpInstance._RoktManager.notifyCheckoutIntent(Object.freeze({kind:a,t:c}),d));}},a.prototype.eventsEnabled=function(){var a=this.mpInstance._Store;return !!a&&a.isEnabled},a.prototype.isKitSuppressed=function(){var a=this.mpInstance._RoktManager;return !this.hasRoktKit||!a||a.isCheckoutIntentSuppressed()},a.prototype.log=function(a){this.mpInstance.Logger.verbose("mParticle button tracking: "+a);},a}();// Logs every button click as an mParticle event, and hands checkout intent to the
|
|
1376
1439
|
|
|
1377
1440
|
var Messages=Constants.Messages,HTTPCodes=Constants.HTTPCodes,FeatureFlags=Constants.FeatureFlags,CaptureIntegrationSpecificIdsV2Modes=Constants.CaptureIntegrationSpecificIdsV2Modes,ReportBatching=FeatureFlags.ReportBatching,CaptureIntegrationSpecificIds=FeatureFlags.CaptureIntegrationSpecificIds,CaptureIntegrationSpecificIdsV2=FeatureFlags.CaptureIntegrationSpecificIdsV2,StartingInitialization=Messages.InformationMessages.StartingInitialization;/**
|
|
1378
1441
|
* <p>All of the following methods can be called on the primary mParticle class. In version 2.10.0, we introduced <a href="https://docs.mparticle.com/developers/sdk/web/multiple-instances/">multiple instances</a>. If you are using multiple instances (self hosted environments only), you should call these methods on each instance.</p>
|
|
@@ -1389,9 +1452,9 @@ var Messages=Constants.Messages,HTTPCodes=Constants.HTTPCodes,FeatureFlags=Const
|
|
|
1389
1452
|
this._instanceName=a,this._NativeSdkHelpers=new NativeSdkHelpers(this),this._SessionManager=new SessionManager(this),this._Persistence=new _Persistence(this),this._Helpers=new Helpers(this),this._Events=new Events(this),this._CookieSyncManager=new CookieSyncManager(this),this._ServerModel=new ServerModel(this),this._Ecommerce=new Ecommerce(this),this._ForwardingStatsUploader=new forwardingStatsUploader(this),this._Consent=new Consent(this),this._IdentityAPIClient=new IdentityAPIClient(this),this._preInit={readyQueue:[],integrationDelays:{},forwarderConstructors:[]},this._ErrorReportingDispatcher=new ErrorReportingDispatcher,this._LoggingDispatcher=new LoggingDispatcher,this._RoktManager=new RoktManager(a),this._RoktManager.setOnReadyCallback(function(){b.processQueueOnIdentityFailure();}),this.processQueueOnIdentityFailure=function(){var a,c,d;(null===(a=b._Store)||void 0===a?void 0:a.isInitialized)||(null===(c=b._Store)||void 0===c?void 0:c.identityCallFailed)&&(null===(d=b._RoktManager)||void 0===d?void 0:d.isReady())&&(b._RoktManager.processMessageQueue(),b._preInit.readyQueue=processReadyQueue(b._preInit.readyQueue,b.Logger));},this.processQueueOnNoFunctional=function(){var a,c;if(!(null!==(a=b._Store)&&void 0!==a)||!a.isInitialized){var d=(null===(c=b._CookieConsentManager)||void 0===c?void 0:c.getNoFunctional())&&!hasExplicitIdentifier(b._Store);d&&(b._preInit.readyQueue=processReadyQueue(b._preInit.readyQueue,b.Logger));}},this.IdentityType=IdentityType,this.EventType=EventType,this.CommerceEventType=CommerceEventType,this.PromotionType=PromotionActionType,this.ProductActionType=ProductActionType,this.RoktEvents=RoktEvents,this._Identity=new Identity(this),this.Identity=this._Identity.IdentityAPI,this.generateHash=this._Helpers.generateHash,this.getDeviceId=this._Persistence.getDeviceId,"undefined"!=typeof window&&window.mParticle&&window.mParticle.config&&window.mParticle.config.hasOwnProperty("rq")&&(this._preInit.readyQueue=window.mParticle.config.rq),this.init=function(a,b){var c=this;// config code - Fetch config when requestConfig = true, otherwise, proceed with SDKInitialization
|
|
1390
1453
|
// Since fetching the configuration is asynchronous, we must pass completeSDKInitialization
|
|
1391
1454
|
// to it for it to be run after fetched
|
|
1392
|
-
if(b||console.warn("You did not pass a config object to init(). mParticle will not initialize properly"),runPreConfigFetchInitialization(this,a,b),!b)return void console.error("No config available on the window, please pass a config object to mParticle.init()");if(!b.hasOwnProperty("requestConfig")||b.requestConfig){var d=new ConfigAPIClient(a,b,this);d.getSDKConfiguration().then(function(d){var e=extend({},b,d);completeSDKInitialization(a,e,c);});}else completeSDKInitialization(a,b,this);},this.setLogLevel=function(a){b.Logger.setLogLevel(a);},this.reset=function(a){try{// The Rokt manager keeps its own store reference, so stop
|
|
1393
|
-
//
|
|
1394
|
-
a._Persistence.resetPersistence(),
|
|
1455
|
+
if(b||console.warn("You did not pass a config object to init(). mParticle will not initialize properly"),runPreConfigFetchInitialization(this,a,b),!b)return void console.error("No config available on the window, please pass a config object to mParticle.init()");if(!b.hasOwnProperty("requestConfig")||b.requestConfig){var d=new ConfigAPIClient(a,b,this);d.getSDKConfiguration().then(function(d){var e=extend({},b,d);completeSDKInitialization(a,e,c);});}else completeSDKInitialization(a,b,this);},this.setLogLevel=function(a){b.Logger.setLogLevel(a);},this.reset=function(a){try{// The Rokt manager keeps its own store reference, so stop button
|
|
1456
|
+
// tracking here rather than relying on the deleted store.
|
|
1457
|
+
a._Persistence.resetPersistence(),resetButtonTracking(),a._ButtonTracker=void 0,a._Store&&delete a._Store;}catch(a){console.error("Cannot reset mParticle",a);}},this._resetForTests=function(a,b,c){c._Store&&delete c._Store,c._ErrorReportingDispatcher=new ErrorReportingDispatcher,c._LoggingDispatcher=new LoggingDispatcher,c.Logger=new Logger(a),c._ErrorReportingDispatcher.logger=c.Logger,c._LoggingDispatcher.logger=c.Logger,c._Store=new Store(a,c),c._Store.isLocalStorageAvailable=c._Persistence.determineLocalStorageAvailability(window.localStorage),c._Events.stopTracking(),resetPageViewTracking(),c._PageViewTracker=void 0,resetButtonTracking(),c._ButtonTracker=void 0,b||c._Persistence.resetPersistence(),c._Persistence.forwardingStatsBatches.uploadsTable={},c._Persistence.forwardingStatsBatches.forwardingStatsEventQueue=[],c._preInit={readyQueue:[],pixelConfigurations:[],integrationDelays:{},forwarderConstructors:[],isDevelopmentMode:!1};},this.ready=function(a){var c,d,e,f=(null===(c=b._CookieConsentManager)||void 0===c?void 0:c.getNoFunctional())&&!hasExplicitIdentifier(b._Store),g=isFunction(a)&&((null===(d=b._Store)||void 0===d?void 0:d.isInitialized)||(null===(e=b._Store)||void 0===e?void 0:e.identityCallFailed)&&b._RoktManager.isReady()||f);g?a():b._preInit.readyQueue.push(a);},this.getEnvironment=function(){return b._Store.SDKConfig.isDevelopmentMode?Constants.Environment.Development:Constants.Environment.Production},this.getVersion=function(){return Constants.sdkVersion},this.setAppVersion=function(a){var c=queueIfNotInitialized(function(){b.setAppVersion(a);},b);c||(b._Store.SDKConfig.appVersion=a,b._Persistence.update());},this.setDeviceId=function(a){var c=queueIfNotInitialized(function(){b.setDeviceId(a);},b);c||this._Store.setDeviceId(a);},this.isInitialized=function(){return !!b._Store&&b._Store.isInitialized},this.getAppName=function(){return b._Store.SDKConfig.appName},this.setAppName=function(a){var c=queueIfNotInitialized(function(){b.setAppName(a);},b);c||(b._Store.SDKConfig.appName=a);},this.getAppVersion=function(){return b._Store.SDKConfig.appVersion},this.stopTrackingLocation=function(){b._SessionManager.resetSessionTimer(),b._Events.stopTracking();},this.startTrackingLocation=function(a){isFunction(a)||b.Logger.warning("Warning: Location tracking is triggered, but not including a callback into the `startTrackingLocation` may result in events logged too quickly and not being associated with a location."),b._SessionManager.resetSessionTimer(),b._Events.startTracking(a);},this.setPosition=function(a,c){var d=queueIfNotInitialized(function(){b.setPosition(a,c);},b);d||(b._SessionManager.resetSessionTimer(),"number"==typeof a&&"number"==typeof c?b._Store.currentPosition={lat:a,lng:c}:b.Logger.error("Position latitude and/or longitude must both be of type number"));},this.startNewSession=function(){b._SessionManager.startNewSession();},this.endSession=function(){// Sends true as an over ride vs when endSession is called from the setInterval
|
|
1395
1458
|
b._SessionManager.endSession(!0);},this.logBaseEvent=function(a,c){var d=queueIfNotInitialized(function(){b.logBaseEvent(a,c);},b);if(!d)return (b._SessionManager.resetSessionTimer(),"string"!=typeof a.name)?void b.Logger.error(Messages.ErrorMessages.EventNameInvalidType):(a.eventType||(a.eventType=EventType.Unknown),b._Helpers.canLog()?void b._Events.logEvent(a,c):void b.Logger.error(Messages.ErrorMessages.LoggingDisabled))},this.logEvent=function(a,c,d,e,f){var g=queueIfNotInitialized(function(){b.logEvent(a,c,d,e,f);},b);if(!g)return (b._SessionManager.resetSessionTimer(),"string"!=typeof a)?void b.Logger.error(Messages.ErrorMessages.EventNameInvalidType):(c||(c=EventType.Unknown),b._Helpers.isEventType(c)?b._Helpers.canLog()?void b._Events.logEvent({messageType:MessageType$1.PageEvent,name:a,data:d,eventType:c,customFlags:e},f):void b.Logger.error(Messages.ErrorMessages.LoggingDisabled):void b.Logger.error("Invalid event type: "+c+", must be one of: \n"+JSON.stringify(EventType)))},this.logError=function(a,c){var d=queueIfNotInitialized(function(){b.logError(a,c);},b);if(!d&&(b._SessionManager.resetSessionTimer(),!!a)){"string"==typeof a&&(a={message:a});var e={m:a.message?a.message:a,s:"Error",t:a.stack||null};if(c){var f=b._Helpers.sanitizeAttributes(c,e.m);for(var g in f)e[g]=f[g];}b._Events.logEvent({messageType:MessageType$1.CrashReport,name:a.name?a.name:"Error",eventType:EventType.Other,data:e});}},this.logLink=function(a,c,d,e){b._Events.addEventHandler("click",a,c,e,d);},this.logForm=function(a,c,d,e){b._Events.addEventHandler("submit",a,c,e,d);},this.logPageView=function(a,c,d,e){var f=queueIfNotInitialized(function(){b.logPageView(a,c,d,e);},b);if(!f){if(b._SessionManager.resetSessionTimer(),b._Helpers.canLog()){if(b._Helpers.Validators.isStringOrNumber(a)||(a="PageView"),!c)c={hostname:window.location.hostname,title:window.document.title};else if(!b._Helpers.isObject(c))return void b.Logger.error("The attributes argument must be an object. A "+_typeof(c)+" was entered. Please correct and retry.");if(d&&!b._Helpers.isObject(d))return void b.Logger.error("The customFlags argument must be an object. A "+_typeof(d)+" was entered. Please correct and retry.")}b._Events.logEvent({messageType:MessageType$1.PageView,name:a,data:c,eventType:EventType.Unknown,customFlags:d},e);}},this.upload=function(){var a,c;b._Helpers.canLog()&&(b._Store.webviewBridgeEnabled?b._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.Upload):null===(c=null===(a=b._APIClient)||void 0===a?void 0:a.uploader)||void 0===c?void 0:c.prepareAndUpload(!1,!1));},this.Consent={/**
|
|
1396
1459
|
* Creates a CCPA Opt Out Consent State.
|
|
1397
1460
|
*
|
|
@@ -1500,19 +1563,19 @@ b._SessionManager.endSession(!0);},this.logBaseEvent=function(a,c){var d=queueIf
|
|
|
1500
1563
|
*/logImpression:function logImpression(a,c,d,e){var f=queueIfNotInitialized(function(){b.eCommerce.logImpression(a,c,d,e);},b);f||(b._SessionManager.resetSessionTimer(),b._Events.logImpressionEvent(a,c,d,e));},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
|
|
1501
1564
|
// And logs to in-memory object
|
|
1502
1565
|
// Example: mParticle.setSessionAttribute('location', '33431');
|
|
1503
|
-
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,a&&(b.
|
|
1566
|
+
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,a&&(b._ButtonTracker&&b._ButtonTracker.clearPending(),b._RoktManager.discardCheckoutIntents()),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(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(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(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
|
|
1504
1567
|
if(b._preInit.integrationDelays[a]=c,!0!==c){// If the integration delay is set to false, check to see if there are any
|
|
1505
1568
|
// other integration delays set to true. It not, process the queued events/.
|
|
1506
1569
|
var d=Object.keys(b._preInit.integrationDelays);if(0!==d.length){var e=d.some(function(a){return !0===b._preInit.integrationDelays[a]});e||b._APIClient.processQueuedEvents();}}},this._setWrapperSDKInfo=function(a,c){var d=queueIfNotInitialized(function(){b._setWrapperSDKInfo(a,c);},b);d||(b._Store.wrapperSDKInfo===void 0||!b._Store.wrapperSDKInfo.isInfoSet)&&(b._Store.wrapperSDKInfo={name:a,version:c,isInfoSet:!0});},this._registerErrorReportingService=function(a){b._ErrorReportingDispatcher.register(a);},this._registerLoggingService=function(a){b._LoggingDispatcher.register(a);};var c=Constants.Rokt.LauncherInstanceGuidKey;this.setLauncherInstanceGuid=function(){window[c]&&"string"==typeof window[c]||(window[c]=b._Helpers.generateUniqueId());},this.getLauncherInstanceGuid=function(){return window[c]},this.captureTiming=function(a){var b;"undefined"!=typeof window&&(null===(b=window.performance)||void 0===b?void 0:b.mark)&&window.performance.mark(a);};}// Some (server) config settings need to be returned before they are set on SDKConfig in a self hosted environment
|
|
1507
|
-
function completeSDKInitialization(a,b,c){var d,e,f,g,h=createKitBlocker(b,c),i=c._Helpers.getFeatureFlag,j=Constants.FeatureFlags,k=j.AutoLogPageView,l=j.
|
|
1570
|
+
function completeSDKInitialization(a,b,c){var d,e,f,g,h=createKitBlocker(b,c),i=c._Helpers.getFeatureFlag,j=Constants.FeatureFlags,k=j.AutoLogPageView,l=j.AutoButtonTracking;// Destroy previous batch uploader to prevent leaked timers and event listeners
|
|
1508
1571
|
// Web View Bridge is used for cases where the Web SDK is loaded within an iOS or Android device's
|
|
1509
1572
|
// Web View. The Web SDK simply acts as a passthrough to the mParticle Native SDK. It is not
|
|
1510
1573
|
// responsible for sending events directly to mParticle's servers. The Web SDK will not initialize
|
|
1511
1574
|
// persistence or Identity directly.
|
|
1512
|
-
if((null===(d=c._APIClient)||void 0===d?void 0:d.uploader)&&c._APIClient.uploader.destroy(),c._APIClient=new APIClient(c,h),c._Forwarders=new Forwarders(c,h),c._Store.processConfig(b),c._Identity.idCache=createIdentityCache(c),removeExpiredIdentityCacheDates(c._Identity.idCache),c._Store.webviewBridgeEnabled)c._NativeSdkHelpers.initializeSessionAttributes(a),
|
|
1575
|
+
if((null===(d=c._APIClient)||void 0===d?void 0:d.uploader)&&c._APIClient.uploader.destroy(),c._APIClient=new APIClient(c,h),c._Forwarders=new Forwarders(c,h),c._Store.processConfig(b),c._Identity.idCache=createIdentityCache(c),removeExpiredIdentityCacheDates(c._Identity.idCache),c._Store.webviewBridgeEnabled)c._NativeSdkHelpers.initializeSessionAttributes(a),resetButtonTracking();else {c._Persistence.initializeStorage(),c._Store.syncPersistenceData();// Set up user identitiy variables for later use
|
|
1513
1576
|
var m=c.Identity.getCurrentUser(),n=m?m.getMPID():null,o=m?m.getUserIdentities().userIdentities:{};// https://go.mparticle.com/work/SQDSDKS-7639
|
|
1514
1577
|
if(c._Store.SDKConfig.identifyRequest=c._Store.hasInvalidIdentifyRequest()?{userIdentities:o}:c._Store.SDKConfig.identifyRequest,i(ReportBatching)&&c._ForwardingStatsUploader.startForwardingStatsTimer(),isIntegrationCaptureEnabled(i)){var p=i(CaptureIntegrationSpecificIds),q=i(CaptureIntegrationSpecificIdsV2),r=void 0;p||q===CaptureIntegrationSpecificIdsV2Modes.All?r="all":q===CaptureIntegrationSpecificIdsV2Modes.RoktOnly&&(r="roktonly"),c._IntegrationCapture=new IntegrationCapture(r),c._IntegrationCapture.capture();}// Configure Rokt Manager with user and filtered user
|
|
1515
|
-
var s=parseConfig(b,"Rokt",181);if(s){var t=null===(e=s.settings)||void 0===e?void 0:e.accountId;c._Store.setRoktAccountId(t);var u=s.userAttributeFilters,v=filteredMparticleUser(n,{userAttributeFilters:u},c),w={sandbox:null===b||void 0===b?void 0:b.isDevelopmentMode,launcherOptions:null===b||void 0===b?void 0:b.launcherOptions,domain:null===b||void 0===b?void 0:b.domain};c._RoktManager.init(s,v,c.Identity,c._Store,c.Logger,w,c.captureTiming,c._ErrorReportingDispatcher,c._LoggingDispatcher,c._IntegrationCapture);}c._Forwarders.processForwarders(b,c._APIClient.prepareForwardingStats),c._Forwarders.processPixelConfigs(b),c._SessionManager.initialize(),c._Events.logAST(),i(k)?(!c._PageViewTracker&&(c.Logger.verbose("mParticle APV: [sdk-init] creating new PageViewTracker for this instance"),c._PageViewTracker=new PageViewTracker(c,{isAutoPageView:!0})),hasInitialPageViewFired()?c.Logger.verbose("mParticle APV: [sdk-init] initial page view already logged this page load, skipping"):(markInitialPageViewFired(),c._Events.logPageView({isAutoPageView:!0})),c._PageViewTracker.init()):c._PageViewTracker&&c._PageViewTracker.teardown(),i(l)
|
|
1578
|
+
var s=parseConfig(b,"Rokt",181);if(s){var t=null===(e=s.settings)||void 0===e?void 0:e.accountId;c._Store.setRoktAccountId(t);var u=s.userAttributeFilters,v=filteredMparticleUser(n,{userAttributeFilters:u},c),w={sandbox:null===b||void 0===b?void 0:b.isDevelopmentMode,launcherOptions:null===b||void 0===b?void 0:b.launcherOptions,domain:null===b||void 0===b?void 0:b.domain};c._RoktManager.init(s,v,c.Identity,c._Store,c.Logger,w,c.captureTiming,c._ErrorReportingDispatcher,c._LoggingDispatcher,c._IntegrationCapture);}c._Forwarders.processForwarders(b,c._APIClient.prepareForwardingStats),c._Forwarders.processPixelConfigs(b),c._SessionManager.initialize(),c._Events.logAST(),i(k)?(!c._PageViewTracker&&(c.Logger.verbose("mParticle APV: [sdk-init] creating new PageViewTracker for this instance"),c._PageViewTracker=new PageViewTracker(c,{isAutoPageView:!0})),hasInitialPageViewFired()?c.Logger.verbose("mParticle APV: [sdk-init] initial page view already logged this page load, skipping"):(markInitialPageViewFired(),c._Events.logPageView({isAutoPageView:!0})),c._PageViewTracker.init()):c._PageViewTracker&&c._PageViewTracker.teardown(),i(l)?(!c._ButtonTracker&&(c._ButtonTracker=new ButtonTracker(c)),c._ButtonTracker.init({hasRoktKit:!!s})):resetButtonTracking(),processIdentityCallback(c,m,n,o);}// We will continue to clear out the ready queue as part of the initial init flow
|
|
1516
1579
|
// if an identify request is unnecessary, such as if there is an existing session
|
|
1517
1580
|
(c._Store.mpid&&!c._Store.identifyCalled||c._Store.webviewBridgeEnabled)&&(c._Store.isInitialized=!0,null===(f=c._CookieConsentManager)||void 0===f?void 0:f.syncNoTargetingAttribute(c.Identity.getCurrentUser()),c._preInit.readyQueue=processReadyQueue(c._preInit.readyQueue,c.Logger)),null===(g=c.processQueueOnNoFunctional)||void 0===g?void 0:g.call(c),c._Store.isFirstRun&&(c._Store.isFirstRun=!1);}// https://go.mparticle.com/work/SQDSDKS-7061
|
|
1518
1581
|
function createKitBlocker(a,b){var c,d,e,f;/* There are three ways a data plan object for blocking can be passed to the SDK:
|
|
@@ -1522,7 +1585,7 @@ function createKitBlocker(a,b){var c,d,e,f;/* There are three ways a data plan
|
|
|
1522
1585
|
3. Self hosting via /config endpoint (config.dataPlanResult)
|
|
1523
1586
|
*/return a.dataPlanOptions&&(b.Logger.verbose("Customer provided data plan found"),f=a.dataPlanOptions,d={document:{dtpn:{vers:f.dataPlanVersion,blok:{ev:f.blockEvents,ea:f.blockEventAttributes,ua:f.blockUserAttributes,id:f.blockUserIdentities}}}}),d||(a.dataPlan&&a.dataPlan.document?a.dataPlan.document.error_message?e=a.dataPlan.document.error_message:(b.Logger.verbose("Data plan found from mParticle.js"),d=a.dataPlan):a.dataPlanResult&&(a.dataPlanResult.error_message?e=a.dataPlanResult.error_message:(b.Logger.verbose("Data plan found from /config"),d={document:a.dataPlanResult}))),e&&b.Logger.error(e),d&&(c=new KitBlocker(d,b)),c}function createIdentityCache(a){var b;// Identity expects mpInstance._Identity.idCache to always exist. DisabledVault
|
|
1524
1587
|
// ensures no identity response data is written to localStorage when noFunctional is true
|
|
1525
|
-
return (null===(b=a._CookieConsentManager)||void 0===b?void 0:b.getNoFunctional())?new DisabledVault("".concat(a._Store.storageName,"-id-cache")):new LocalStorageVault("".concat(a._Store.storageName,"-id-cache"))}function runPreConfigFetchInitialization(a,b,c){a.Logger=new Logger(c),a._ErrorReportingDispatcher.logger=a.Logger,a._LoggingDispatcher.logger=a.Logger,a._Store=new Store(c,a,b),window.mParticle.Store=a._Store,
|
|
1588
|
+
return (null===(b=a._CookieConsentManager)||void 0===b?void 0:b.getNoFunctional())?new DisabledVault("".concat(a._Store.storageName,"-id-cache")):new LocalStorageVault("".concat(a._Store.storageName,"-id-cache"))}function runPreConfigFetchInitialization(a,b,c){a.Logger=new Logger(c),a._ErrorReportingDispatcher.logger=a.Logger,a._LoggingDispatcher.logger=a.Logger,a._Store=new Store(c,a,b),window.mParticle.Store=a._Store,resetButtonTracking(),a.Logger.verbose(StartingInitialization);// Initialize CookieConsentManager with privacy flags from launcherOptions
|
|
1526
1589
|
var d=normalizeRoktLauncherOptions(null===c||void 0===c?void 0:c.launcherOptions),e=d.noFunctional,f=d.noTargeting;a._CookieConsentManager=new CookieConsentManager({noFunctional:e,noTargeting:f});// Check to see if localStorage is available before main configuration runs
|
|
1527
1590
|
// since we will need this for the current implementation of user persistence
|
|
1528
1591
|
// TODO: Refactor this when we refactor User Identity Persistence
|