@mparticle/web-rokt-kit 1.34.0 → 1.35.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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const he=["active_time_on_site_ms","billingaddress1","billingaddress2","billingcity","billingstate","billingzipcode","cartitems","ccbin","confirmationref","conversiontype","country","couponcode","currency","language","paymentserviceprovider","paymentserviceproviderattribute","paymenttype","shippingaddress1","shippingcity","shippingcountry","shippingmethod","shippingstate","shippingzipcode","totalprice"],pe=new Set(he);function ee(i){return pe.has(i.toLowerCase())}function b(i){const e={},t=i||{},n=Object.keys(t);for(let r=0;r<n.length;r++){const s=n[r];ee(s)||(e[s]=t[s])}return e}function I(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function m(i){return typeof i=="string"}function L(i){return typeof i=="function"}function U(i){return i==null?!0:typeof i=="object"?Object.keys(i).length===0:!1}function K(i){try{const e=new URL(i);return e.search="",e.toString()}catch{return i}}const Y="__rokt_ls_probe__";function x(){try{return window.localStorage.setItem(Y,"1"),window.localStorage.removeItem(Y),!0}catch{return!1}}function N(i){try{const e=window.localStorage.getItem(i);return e===null?null:JSON.parse(e)}catch{return null}}function te(i,e){try{return window.localStorage.setItem(i,JSON.stringify(e)),!0}catch{return!1}}function ie(i){try{window.localStorage.removeItem(i)}catch{}}function ne(i,e){const t=N(i);return I(t)?t[e]:void 0}function re(i,e,t){const n=N(i),r=I(n)?{...n}:{};return r[e]=t,te(i,r)}function ge(i,e){const t=N(i);if(!I(t)||!(e in t))return;const n={...t};delete n[e],Object.keys(n).length===0?ie(i):te(i,n)}const A="mp-rokt-kit",k="pageViews",G="mpPageViews";function se(i){const e=N(G);if(e===null)return;!(ne(A,k)!==void 0)&&Array.isArray(e)&&(i?.log({message:"Rokt Kit: Migrating legacy page-view storage",code:"PAGE_VIEW_LEGACY_MIGRATION"}),re(A,k,e)||i?.log({message:"Rokt Kit: Failed to migrate legacy page-view storage [reason: migration_retry]",code:"PAGE_VIEW_CAPTURE_FAILED"})),ie(G)}function W(i){se(i);const e=ne(A,k);return Array.isArray(e)?e:[]}function fe(i){return re(A,k,i.slice(-25))}function j(){ge(A,k)}function me(i){const e=i.slice(-25);return e.map((t,n)=>{const r=t.activeTimeOnSite,s=r!==void 0&&Number.isFinite(r),l=e[n+1]?.activeTimeOnSite,u=l!==void 0&&Number.isFinite(l),c=s&&u?l-r:void 0;return{pageUrl:t.pageUrl,sourceMessageId:t.sourceMessageId,timestamp:t.timestamp,...t.pageTitle!==void 0?{pageTitle:t.pageTitle}:{},...t.canonicalUrl!==void 0?{canonicalUrl:t.canonicalUrl}:{},...s?{activeTimeOnSite:r}:{},...c!==void 0&&c>=0?{activeTimeOnPage:c}:{}}})}function Ee(){const e=document.querySelector('link[rel="canonical"]')?.href;if(e)return K(e)}const d="Rokt",T=181,_e="selectPlacements",Ie="apps.roktecommerce.com",Se=.1,ye="ThankYouPageJourney",Ae="rokt-launcher",ke="rokt-thank-you-element",ve="userIdentifiedInWorkspace",Re=3,we=2,be="page_events",Le="mparticle_session_id",Te="mparticle_device_id",Pe=500,D={UNKNOWN_ERROR:"UNKNOWN_ERROR",UNHANDLED_EXCEPTION:"UNHANDLED_EXCEPTION",IDENTITY_REQUEST:"IDENTITY_REQUEST",LOG_DELIVERY_FAILURE:"LOG_DELIVERY_FAILURE"},_={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},Ne="apps.rokt-api.com",Oe="/v1/log",Ce="/v1/errors",Ue=10;function a(){return window.mParticle}function V(i,e){const n=[O(i),"/wsdk/integrations/launcher.js"].join("");return!e||e.length===0?n:n+"?extensions="+e.join(",")}function H(i){return[O(i),"/rokt-elements/rokt-element-thank-you.js"].join("")}function O(i){const e=typeof i<"u"?i:Ne;return e.includes("://")?e.replace(/\/+$/,""):["https://",e].join("")}function oe(i,e,t){if(i)return i.startsWith("http://")||i.startsWith("https://")?i:"https://"+i;const r=e?.includes("://")&&!/^https?:\/\//i.test(e)?void 0:e;return O(r)+t}function z(i,e,t){if(document.getElementById(i))return;const n=document.head||document.body,r=document.createElement("script");r.id=i,r.type="text/javascript",r.src=e,r.async=!0,r.crossOrigin="anonymous",r.fetchPriority="high",t?.onLoad&&(r.onload=t.onLoad),t?.onError&&(r.onerror=t.onError),n.appendChild(r)}function P(i){if(!i)return[];try{return JSON.parse(i.replace(/&quot;/g,'"'))}catch{console.error("Settings string contains invalid JSON")}return[]}function J(i){const e=i?P(i):[],t=[],n=[];let r=!1;for(let s=0;s<e.length;s++){const o=e[s].value;o==="thank-you-journey"?(r=!0,n.push(ye)):t.push(o)}return{roktExtensionsQueryParams:t,legacyRoktExtensions:n,loadThankYouElement:r}}async function Me(i,e){const t=[];if(e)for(const n of i)t.push(e.use(n));return Promise.all(t)}function q(i){if(!i)return{};const e={};for(let t=0;t<i.length;t++){const n=i[t];e[n.jsmap]=n.value}return e}function B(i){const e={};if(!Array.isArray(i))return e;for(let t=0;t<i.length;t++){const n=i[t];if(!n||!m(n.value)||!m(n.map))continue;const r=n.value,s=n.map;e[r]||(e[r]=[]),e[r].push({eventAttributeKey:s,conditions:Array.isArray(n.conditions)?n.conditions:[]})}return e}function $(i,e,t){return a().generateHash([i,e,t].join(""))}function Ke(i){let n="mParticle_wsdkv_"+a().getVersion()+"_kitv_"+"1.34.0";return i&&(n+="_"+i),n}function ae(i){let e=5381;for(let t=0;t<i.length;t++)e=(e<<5)+e+i.charCodeAt(t),e=e&e;return e}function M(i){const e=document.createElement("iframe");e.style.display="none",e.setAttribute("sandbox","allow-scripts allow-same-origin"),e.src=i,e.onload=function(){e.onload=null,e.parentNode&&e.parentNode.removeChild(e)};const t=document.body||document.head;t&&t.appendChild(e)}function Q(i,e){const t=ae(window.location.origin);if(S._allowedOriginHashes.indexOf(t)===-1||Math.random()>=Se)return;const r=window.__rokt_li_guid__;if(!r||i&&i.includes("://")&&!/^https:\/\//i.test(i))return;const s=window.location.href.split("?")[0].split("#")[0],o="version="+encodeURIComponent(e??"")+"&launcherInstanceGuid="+encodeURIComponent(r)+"&pageUrl="+encodeURIComponent(s),l=i?O(i):"https://apps.rokt.com";M(l+"/v1/wsdk-init/index.html?"+o),M("https://"+Ie+"/v1/wsdk-init/index.html?"+o+"&isControl=true")}function De(){return typeof window<"u"&&!!window.location?.search?.toLowerCase().includes("mp_enable_logging=true")}function Fe(){return typeof window<"u"?window.location?.href:void 0}function Ye(){return typeof window<"u"?window.navigator?.userAgent:void 0}class ce{constructor(){this._logCount={}}incrementAndCheck(e){const n=(this._logCount[e]||0)+1;return this._logCount[e]=n,n>Ue}}class F{constructor(e,t,n,r,s){this._reporter="mp-wsdk";const o=e.isLoggingEnabled;this._integrationName=t||"",this._launcherInstanceGuid=n,this._accountId=r||null,this._rateLimiter=s||new ce,this._isEnabled=De()||o}send(e,t,n,r,s,o){if(!(!this._isEnabled||this._rateLimiter.incrementAndCheck(t)))try{const l={additionalInformation:{message:n,version:this._integrationName},severity:t,code:r||D.UNKNOWN_ERROR,url:Fe(),deviceInfo:Ye(),stackTrace:s,reporter:this._reporter,integration:this._integrationName},u={Accept:"text/plain;charset=UTF-8","Content-Type":"application/json","rokt-launcher-version":this._integrationName,"rokt-wsdk-version":"joint"};this._launcherInstanceGuid&&(u["rokt-launcher-instance-guid"]=this._launcherInstanceGuid),this._accountId&&(u["rokt-account-id"]=this._accountId),fetch(e,{method:"POST",headers:u,body:JSON.stringify(l)}).then(c=>{if(!c.ok){const p=new Error("HTTP "+c.status+" from log endpoint");throw p.statusCode=c.status,p}}).catch(c=>{console.error("ReportingTransport: Failed to send log",c),o&&o(c)})}catch(l){console.error("ReportingTransport: Failed to send log",l),o&&o(l)}}}class X{constructor(e,t,n,r,s){this._transport=new F(e,t,n,r,s),this._errorUrl=oe(e?.errorUrl,e?.integrationDomain,Ce)}report(e){if(!e)return;const t=e.severity||_.ERROR;this._transport.send(this._errorUrl,t,e.message,e.code,e.stackTrace)}}class Z{constructor(e,t,n,r,s,o){this._transport=new F(e,n,r,s,o),this._loggingUrl=oe(e?.loggingUrl,e?.integrationDomain,Oe),this._errorReportingService=t}log(e){e&&this._transport.send(this._loggingUrl,_.INFO,e.message,e.code,void 0,t=>{if(this._errorReportingService){const n=typeof t.statusCode=="number";this._errorReportingService.report({message:"LoggingService: Failed to send log: "+t.message,code:D.LOG_DELIVERY_FAILURE,severity:n?_.ERROR:_.WARNING})}})}}function xe(i){const e=K(window.location.href),t=i.EventAttributes?.title||document.title,n=Ee(),r=i.ActiveTimeOnSite;return{pageUrl:e,sourceMessageId:i.SourceMessageId,timestamp:i.Timestamp,...t?{pageTitle:t}:{},...n!==void 0?{canonicalUrl:n}:{},...Number.isFinite(r)?{activeTimeOnSite:r}:{}}}const f=class f{constructor(){this.name=d,this.id=T,this.moduleId=T,this.isInitialized=!1,this.launcher=null,this.filters={},this.userAttributes={},this.userIdentifiedInWorkspace=!1,this.testHelpers=null,this.placementEventMappingLookup={},this.placementEventAttributeMappingLookup={},this.integrationName=null,this.errorReportingService=null,this.loggingService=null,this._thankYouElementOnLoadCallback=null,this._isThankYouElementLoaded=!1,this._workspaceSearchInFlightPromise=null}getEventAttributeValue(e,t){const n=e&&e.EventAttributes;return!n||typeof n[t]>"u"?null:n[t]}doesEventAttributeConditionMatch(e,t){if(!e||!m(e.operator))return!1;const n=e.operator.toLowerCase(),r=e.attributeValue;return n==="exists"?t!==null:t==null?!1:n==="equals"?String(t)===String(r):n==="contains"?String(t).indexOf(String(r))!==-1:!1}doesEventMatchRule(e,t){if(!t||!m(t.eventAttributeKey))return!1;const n=t.conditions;if(!Array.isArray(n))return!1;const r=this.getEventAttributeValue(e,t.eventAttributeKey);if(n.length===0)return r!==null;for(let s=0;s<n.length;s++)if(!this.doesEventAttributeConditionMatch(n[s],r))return!1;return!0}applyPlacementEventAttributeMapping(e){const t=Object.keys(this.placementEventAttributeMappingLookup);for(let n=0;n<t.length;n++){const r=t[n],s=this.placementEventAttributeMappingLookup[r];if(U(s))continue;let o=!0;for(let l=0;l<s.length;l++)if(!this.doesEventMatchRule(e,s[l])){o=!1;break}o&&a().Rokt.setLocalSessionAttribute?.(r,!0)}}capturePageView(e){let t;try{t=K(window.location.href);const n=W(this.loggingService),r=xe(e);if(n.push(r),!fe(n)){const s=x()?"quota":"ls_unavailable";this.loggingService?.log({message:`Rokt Kit: Failed to persist page view for ${t} [reason: ${s}]`,code:"PAGE_VIEW_CAPTURE_FAILED"})}}catch(n){const r=x()?"exception":"ls_unavailable",s=n instanceof Error?n.message:String(n);this.loggingService?.log({message:`Rokt Kit: Failed to capture page view for ${t}: ${s} [reason: ${r}]`,code:"PAGE_VIEW_CAPTURE_FAILED"})}}isLauncherReadyToAttach(){return!!window.Rokt&&L(window.Rokt.createLauncher)}returnUserIdentities(e){if(!e||!e.getUserIdentities)return{};const t=e.getUserIdentities().userIdentities;return this.replaceOtherIdentityWithEmailsha256(t)}returnLocalSessionAttributes(){return!a().Rokt||typeof a().Rokt.getLocalSessionAttributes!="function"?{}:a().Rokt.getLocalSessionAttributes()}replaceOtherIdentityWithEmailsha256(e){const t={...e||{}},n=this._mappedEmailSha256Key;return n&&e[n]&&(t[f.EMAIL_SHA256_KEY]=e[n]),n&&delete t[n],t}logSelectPlacementsEvent(e){if(!window.mParticle||typeof a().logEvent!="function"||!I(e))return;const t=a().EventType.Other;a().logEvent(_e,t,e)}setRoktSessionId(e){if(!(!e||typeof e!="string"))try{const t=a().getInstance();t&&L(t.setIntegrationAttribute)&&t.setIntegrationAttribute(T,{roktSessionId:e})}catch{}}readMpSessionId(){const e=a()?.sessionManager,t=e?.getSessionId??e?.getSession;if(L(t))return t.call(e)||void 0}readMpDeviceId(){return a()?.getDeviceId?.()||void 0}attachLauncher(e,t,n=[]){const r={accountId:e,...t||{}};let s;this.isPartnerInLocalLauncherTestGroup()?s=Promise.resolve(window.Rokt.createLocalLauncher(r)):s=window.Rokt.createLauncher(r),s.then(async o=>{await Me(n,o),this.initRoktLauncher(o)}).catch(o=>{console.error("Error creating Rokt launcher:",o)})}initRoktLauncher(e){window.Rokt&&(window.Rokt.currentLauncher=e),this.launcher=e;const t=a().Rokt?.filters;t?(this.filters=t,t.filteredUser?this._workspaceSearchInFlightPromise=this.search(t.filteredUser):console.warn("Rokt Kit: No filtered user has been set.")):console.warn("Rokt Kit: No filters have been set."),this.isInitialized=!0,Q(this.domain,this.integrationName),a().Rokt.attachKit(this)}fetchOptimizely(){const e=a()._getActiveForwarders().filter(t=>t.name==="Optimizely");try{if(e.length>0&&window.optimizely){const t=window.optimizely.get("state");return!t||!t.getActiveExperimentIds?{}:t.getActiveExperimentIds().reduce((s,o)=>(s["rokt.custom.optimizely.experiment."+o+".variationId"]=t.getVariationMap()[o].id,s),{})}}catch(t){console.error("Error fetching Optimizely attributes:",t)}return{}}isKitReady(){return!!(this.isInitialized&&this.launcher)}isTargetingDisabled(){return a().Rokt?.launcherOptions?.noTargeting===!0}isPartnerInLocalLauncherTestGroup(){return!!(a().config&&a().config.isLocalLauncherEnabled&&this.isAssignedToSampleGroup())}isAssignedToSampleGroup(){return Math.random()>.5}captureTiming(e){window&&a()&&a().captureTiming&&e&&a().captureTiming(e)}init(e,t,n,r,s){const o=e,l=o.accountId;this.userAttributes=b(s),this._onboardingExpProvider=o.onboardingExpProvider;const u=P(o.placementEventMapping);this.placementEventMappingLookup=q(u);const c=P(o.placementEventAttributeMapping);this.placementEventAttributeMappingLookup=B(c),o.hashedEmailUserIdentityType&&(this._mappedEmailSha256Key=o.hashedEmailUserIdentityType.toLowerCase()),this._workspaceIdSyncApiKey=m(o.workspaceIdSyncApiKey)?o.workspaceIdSyncApiKey:void 0;const p=a().Rokt?.domain,{roktExtensionsQueryParams:C,legacyRoktExtensions:v,loadThankYouElement:R}=J(o.roktExtensions),g={...a().Rokt?.launcherOptions||{}};this.integrationName=Ke(g.integrationName),g.integrationName=this.integrationName,this.domain=p;const y={loggingUrl:o.loggingUrl,errorUrl:o.errorUrl,integrationDomain:p,isLoggingEnabled:a().config?.isLoggingEnabled===!0},E=new X(y,this.integrationName,window.__rokt_li_guid__,o.accountId),w=new Z(y,E,this.integrationName,window.__rokt_li_guid__,o.accountId);if(this.errorReportingService=E,this.loggingService=w,this.isTargetingDisabled())try{j()}catch(h){this.errorReportingService?.report({message:"Rokt Kit: Failed to clear page views when targeting is disabled",code:"PAGE_VIEW_CAPTURE_FAILED",severity:_.INFO,stackTrace:h instanceof Error?h.stack:void 0})}return a()._registerErrorReportingService&&a()._registerErrorReportingService(E),a()._registerLoggingService&&a()._registerLoggingService(w),n?(this.testHelpers={generateLauncherScript:V,generateThankYouElementScript:H,extractRoktExtensionConfig:J,hashEventMessage:$,parseSettingsString:P,generateMappedEventLookup:q,generateMappedEventAttributeLookup:B,sendAdBlockMeasurementSignals:Q,createAutoRemovedIframe:M,djb2:ae,setAllowedOriginHashes:h=>{f._allowedOriginHashes=h},ReportingTransport:F,ErrorReportingService:X,LoggingService:Z,RateLimiter:ce,ErrorCodes:D,WSDKErrorSeverity:_},this.attachLauncher(l,g),"Successfully initialized: "+d):(R&&(a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this),z(ke,H(p),{onLoad:()=>{this._isThankYouElementLoaded=!0,this._thankYouElementOnLoadCallback&&this._thankYouElementOnLoadCallback()},onError:h=>{console.error("Error loading Rokt Thank You Element script:",h)}})),this.isLauncherReadyToAttach()?this.attachLauncher(l,g,v):(z(Ae,V(p,C),{onLoad:()=>{this.isLauncherReadyToAttach()?this.attachLauncher(l,g,v):console.error("Rokt object is not available after script load.")},onError:h=>{console.error("Error loading Rokt launcher script:",h)}}),this.captureTiming(f.PERFORMANCE_MARKS.RoktScriptAppended)),"Successfully initialized: "+d)}process(e){if(this.isTargetingDisabled()||(e.EventDataType===Re&&this.capturePageView(e),e.EventDataType===we&&(se(this.loggingService),j())),!this.isKitReady())return"Kit not ready for forwarder: "+d;if(L(a().Rokt?.setLocalSessionAttribute)&&(U(this.placementEventAttributeMappingLookup)||this.applyPlacementEventAttributeMapping(e),!U(this.placementEventMappingLookup))){const t=$(e.EventDataType,e.EventCategory,e.EventName??"");this.placementEventMappingLookup[String(t)]&&a().Rokt.setLocalSessionAttribute?.(this.placementEventMappingLookup[String(t)],!0)}return"Successfully sent to forwarder: "+d}setExtensionData(e){if(!this.isKitReady()){console.error("Rokt Kit: Not initialized");return}window.Rokt.setExtensionData(e)}setUserAttribute(e,t){return ee(e)||(this.userAttributes[e]=t),"Successfully set user attribute for forwarder: "+d}removeUserAttribute(e){return delete this.userAttributes[e],"Successfully removed user attribute for forwarder: "+d}handleIdentityComplete(e,t){return this.userAttributes=b(e.getAllUserAttributes()),"Successfully called "+t+" for forwarder: "+d}onUserIdentified(e){const t=e;return this.filters.filteredUser=t,this._workspaceSearchInFlightPromise=this.search(t),this.handleIdentityComplete(e,"onUserIdentified")}search(e){const t=this._workspaceIdSyncApiKey;if(!t)return this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=void 0,Promise.resolve();const n=a().Identity?.search;if(typeof n!="function")return this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=void 0,Promise.resolve();const r=e.getUserIdentities?e.getUserIdentities().userIdentities:null,s={};if(r)for(const u of Object.keys(r)){const c=r[u];m(c)&&c.length>0&&(s[u]=c)}const o=Object.keys(s);if(o.length===0)return this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=void 0,Promise.resolve();const l=o.sort().map(u=>`${u}=${s[u]}`).join("&");return l===this._workspaceLastSearchedIdentitiesKey?this._workspaceSearchInFlightPromise||Promise.resolve():(this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=l,new Promise(u=>{try{n(t,s,c=>{c?.httpCode===200&&(this.userIdentifiedInWorkspace=!0),u()})}catch(c){console.error("Rokt Kit: Workspace IDSync search failed",c),this._workspaceLastSearchedIdentitiesKey=void 0,u()}}))}onLoginComplete(e,t){return this.handleIdentityComplete(e,"onLoginComplete")}onLogoutComplete(e,t){return this.userIdentifiedInWorkspace=!1,this._workspaceSearchInFlightPromise=null,this._workspaceLastSearchedIdentitiesKey=void 0,this.handleIdentityComplete(e,"onLogoutComplete")}onModifyComplete(e,t){return this.handleIdentityComplete(e,"onModifyComplete")}selectPlacements(e){if(this._workspaceSearchInFlightPromise){const t=this._workspaceSearchInFlightPromise;return Promise.race([t,new Promise(n=>setTimeout(n,Pe))]).then(()=>this._dispatchPlacements(e))}return this._dispatchPlacements(e)}_dispatchPlacements(e){const t=e&&e.attributes||{},r={...b(this.userAttributes),...t},s=this.filters||{},o=s.userAttributeFilters||[],l=s.filteredUser||null,u=l?l.getMPID():null;let c;s?s.filterUserAttributes?c=s.filterUserAttributes(r,o):c=r:(console.warn("Rokt Kit: No filters available, using user attributes"),c=r),this.userAttributes=b(c);const p=this._onboardingExpProvider==="Optimizely"?this.fetchOptimizely():{},C=this.returnUserIdentities(l),v=this.returnLocalSessionAttributes(),R=me(W(this.loggingService)),g=this.readMpSessionId(),y=this.readMpDeviceId(),E={...C,...c,...p,...v,...R.length?{[be]:JSON.stringify(R)}:{},...this.userIdentifiedInWorkspace?{[ve]:!0}:{},...g?{[Le]:g}:{},...y?{[Te]:y}:{},mpid:u},w={...e,attributes:E},h=this.launcher.selectPlacements(w),le=()=>this.logSelectPlacementsEvent(E);return Promise.resolve(h).then(ue=>ue?.context?.sessionId?.then(de=>this.setRoktSessionId(de))).catch(()=>{}).finally(le),h}hashAttributes(e){return this.isKitReady()?this.launcher.hashAttributes(e):(console.error("Rokt Kit: Not initialized"),null)}use(e){return this.isKitReady()?!e||!m(e)?Promise.reject(new Error("Rokt Kit: Invalid extension name")):this.launcher.use(e):(console.error("Rokt Kit: Not initialized"),Promise.reject(new Error("Rokt Kit: Not initialized")))}onShoppableAdsReady(e){this._isThankYouElementLoaded?e():this._thankYouElementOnLoadCallback=e}};f._allowedOriginHashes=[-553112570,549508659],f.PERFORMANCE_MARKS={RoktScriptAppended:"mp:RoktScriptAppended"},f.EMAIL_SHA256_KEY="emailsha256";let S=f;function Ge(){return T}function We(i){if(!i){window.console.log("You must pass a config object to register the kit "+d);return}if(!I(i)){window.console.log("'config' must be an object. You passed in a "+typeof i);return}I(i.kits)?i.kits[d]={constructor:S}:(i.kits={},i.kits[d]={constructor:S}),window.console.log("Successfully registered "+d+" to your mParticle configuration")}typeof window<"u"&&window.mParticle&&a().addForwarder&&a().addForwarder({name:d,constructor:S,getId:Ge});exports.register=We;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _e=["active_time_on_site_ms","billingaddress1","billingaddress2","billingcity","billingstate","billingzipcode","cartitems","ccbin","confirmationref","conversiontype","country","couponcode","currency","language","paymentserviceprovider","paymentserviceproviderattribute","paymenttype","shippingaddress1","shippingcity","shippingcountry","shippingmethod","shippingstate","shippingzipcode","totalprice"],Ie=new Set(_e);function se(i){return Ie.has(i.toLowerCase())}function b(i){const e={},t=i||{},n=Object.keys(t);for(let r=0;r<n.length;r++){const s=n[r];se(s)||(e[s]=t[s])}return e}function _(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function E(i){return typeof i=="string"}function T(i){return typeof i=="function"}function K(i){return i==null?!0:typeof i=="object"?Object.keys(i).length===0:!1}function Y(i){try{const e=new URL(i);return e.search="",e.toString()}catch{return i}}const V="__rokt_ls_probe__";function D(){try{return window.localStorage.setItem(V,"1"),window.localStorage.removeItem(V),!0}catch{return!1}}function N(i){try{const e=window.localStorage.getItem(i);return e===null?null:JSON.parse(e)}catch{return null}}function oe(i,e){try{return window.localStorage.setItem(i,JSON.stringify(e)),!0}catch{return!1}}function ae(i){try{window.localStorage.removeItem(i)}catch{}}function U(i,e){const t=N(i);return _(t)?t[e]:void 0}function G(i,e,t){const n=N(i),r=_(n)?{...n}:{};return r[e]=t,oe(i,r)}function ce(i,e){const t=N(i);if(!_(t)||!(e in t))return;const n={...t};delete n[e],Object.keys(n).length===0?ae(i):oe(i,n)}const p="mp-rokt-kit",v="pageViews",O="utmParams",H="mpPageViews",le=25,Se=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function ue(i){return i.slice(-le)}function de(i){const e=N(H);if(e===null)return;!(U(p,v)!==void 0)&&Array.isArray(e)&&(i?.log({message:"Rokt Kit: Migrating legacy page-view storage",code:"PAGE_VIEW_LEGACY_MIGRATION"}),G(p,v,e)||i?.log({message:"Rokt Kit: Failed to migrate legacy page-view storage [reason: migration_retry]",code:"PAGE_VIEW_CAPTURE_FAILED"})),ae(H)}function z(i){de(i);const e=U(p,v);return Array.isArray(e)?e:[]}function ye(i){const e=ue(i);for(let t=0;t<e.length;t++){const n=e.slice(t);if(G(p,v,n))return n.length}return 0}function q(){ce(p,v)}function Ae(i){const e=ue(i);return e.map((t,n)=>{const r=t.activeTimeOnSite,s=r!==void 0&&Number.isFinite(r),c=e[n+1]?.activeTimeOnSite,u=c!==void 0&&Number.isFinite(c),l=s&&u?c-r:void 0;return{pageUrl:t.pageUrl,sourceMessageId:t.sourceMessageId,timestamp:t.timestamp,...t.pageTitle!==void 0?{pageTitle:t.pageTitle}:{},...t.canonicalUrl!==void 0?{canonicalUrl:t.canonicalUrl}:{},...s?{activeTimeOnSite:r}:{},...l!==void 0&&l>=0?{activeTimeOnPage:l}:{}}})}function ke(i){if(U(p,O)!==void 0)return;const e=new URLSearchParams(window.location.search),t={};for(const r of Se){const s=e.get(r);s&&(t[r]=s)}if(Object.keys(t).length===0)return;const n=Object.keys(t).join(", ");if(!G(p,O,t)){const r=D()?"quota":"ls_unavailable";i?.log({message:`Rokt Kit: Failed to persist UTM params [reason: ${r}]`,code:"UTM_CAPTURE_FAILED"});return}i?.log({message:`Rokt Kit: Captured UTM params [${n}]`,code:"UTM_CAPTURE_SUCCESS"})}function ve(){const i=U(p,O);return _(i)?i:null}function $(){ce(p,O)}function Re(){const e=document.querySelector('link[rel="canonical"]')?.href;if(e)return Y(e)}const d="Rokt",L=181,we="selectPlacements",be="apps.roktecommerce.com",Te=.1,Le="ThankYouPageJourney",Pe="rokt-launcher",Oe="rokt-thank-you-element",Ne="userIdentifiedInWorkspace",Ue=3,Ce=2,Me="page_events",Ke="page_view_attributes",De="mparticle_session_id",Fe="mparticle_device_id",Ye=500,x={UNKNOWN_ERROR:"UNKNOWN_ERROR",UNHANDLED_EXCEPTION:"UNHANDLED_EXCEPTION",IDENTITY_REQUEST:"IDENTITY_REQUEST",LOG_DELIVERY_FAILURE:"LOG_DELIVERY_FAILURE"},S={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},Ge="apps.rokt-api.com",xe="/v1/log",We="/v1/errors",je=10;function a(){return window.mParticle}function J(i,e){const n=[C(i),"/wsdk/integrations/launcher.js"].join("");return!e||e.length===0?n:n+"?extensions="+e.join(",")}function B(i){return[C(i),"/rokt-elements/rokt-element-thank-you.js"].join("")}function C(i){const e=typeof i<"u"?i:Ge;return e.includes("://")?e.replace(/\/+$/,""):["https://",e].join("")}function he(i,e,t){if(i)return i.startsWith("http://")||i.startsWith("https://")?i:"https://"+i;const r=e?.includes("://")&&!/^https?:\/\//i.test(e)?void 0:e;return C(r)+t}function Q(i,e,t){if(document.getElementById(i))return;const n=document.head||document.body,r=document.createElement("script");r.id=i,r.type="text/javascript",r.src=e,r.async=!0,r.crossOrigin="anonymous",r.fetchPriority="high",t?.onLoad&&(r.onload=t.onLoad),t?.onError&&(r.onerror=t.onError),n.appendChild(r)}function P(i){if(!i)return[];try{return JSON.parse(i.replace(/&quot;/g,'"'))}catch{console.error("Settings string contains invalid JSON")}return[]}function X(i){const e=i?P(i):[],t=[],n=[];let r=!1;for(let s=0;s<e.length;s++){const o=e[s].value;o==="thank-you-journey"?(r=!0,n.push(Le)):t.push(o)}return{roktExtensionsQueryParams:t,legacyRoktExtensions:n,loadThankYouElement:r}}async function Ve(i,e){const t=[];if(e)for(const n of i)t.push(e.use(n));return Promise.all(t)}function Z(i){if(!i)return{};const e={};for(let t=0;t<i.length;t++){const n=i[t];e[n.jsmap]=n.value}return e}function ee(i){const e={};if(!Array.isArray(i))return e;for(let t=0;t<i.length;t++){const n=i[t];if(!n||!E(n.value)||!E(n.map))continue;const r=n.value,s=n.map;e[r]||(e[r]=[]),e[r].push({eventAttributeKey:s,conditions:Array.isArray(n.conditions)?n.conditions:[]})}return e}function te(i,e,t){return a().generateHash([i,e,t].join(""))}function He(i){let n="mParticle_wsdkv_"+a().getVersion()+"_kitv_"+"1.35.0";return i&&(n+="_"+i),n}function ge(i){let e=5381;for(let t=0;t<i.length;t++)e=(e<<5)+e+i.charCodeAt(t),e=e&e;return e}function F(i){const e=document.createElement("iframe");e.style.display="none",e.setAttribute("sandbox","allow-scripts allow-same-origin"),e.src=i,e.onload=function(){e.onload=null,e.parentNode&&e.parentNode.removeChild(e)};const t=document.body||document.head;t&&t.appendChild(e)}function ie(i,e){const t=ge(window.location.origin);if(y._allowedOriginHashes.indexOf(t)===-1||Math.random()>=Te)return;const r=window.__rokt_li_guid__;if(!r||i&&i.includes("://")&&!/^https:\/\//i.test(i))return;const s=window.location.href.split("?")[0].split("#")[0],o="version="+encodeURIComponent(e??"")+"&launcherInstanceGuid="+encodeURIComponent(r)+"&pageUrl="+encodeURIComponent(s),c=i?C(i):"https://apps.rokt.com";F(c+"/v1/wsdk-init/index.html?"+o),F("https://"+be+"/v1/wsdk-init/index.html?"+o+"&isControl=true")}function ze(){return typeof window<"u"&&!!window.location?.search?.toLowerCase().includes("mp_enable_logging=true")}function qe(){return typeof window<"u"?window.location?.href:void 0}function $e(){return typeof window<"u"?window.navigator?.userAgent:void 0}class pe{constructor(){this._logCount={}}incrementAndCheck(e){const n=(this._logCount[e]||0)+1;return this._logCount[e]=n,n>je}}class W{constructor(e,t,n,r,s){this._reporter="mp-wsdk";const o=e.isLoggingEnabled;this._integrationName=t||"",this._launcherInstanceGuid=n,this._accountId=r||null,this._rateLimiter=s||new pe,this._isEnabled=ze()||o}send(e,t,n,r,s,o){if(!(!this._isEnabled||this._rateLimiter.incrementAndCheck(t)))try{const c={additionalInformation:{message:n,version:this._integrationName},severity:t,code:r||x.UNKNOWN_ERROR,url:qe(),deviceInfo:$e(),stackTrace:s,reporter:this._reporter,integration:this._integrationName},u={Accept:"text/plain;charset=UTF-8","Content-Type":"application/json","rokt-launcher-version":this._integrationName,"rokt-wsdk-version":"joint"};this._launcherInstanceGuid&&(u["rokt-launcher-instance-guid"]=this._launcherInstanceGuid),this._accountId&&(u["rokt-account-id"]=this._accountId),fetch(e,{method:"POST",headers:u,body:JSON.stringify(c)}).then(l=>{if(!l.ok){const g=new Error("HTTP "+l.status+" from log endpoint");throw g.statusCode=l.status,g}}).catch(l=>{console.error("ReportingTransport: Failed to send log",l),o&&o(l)})}catch(c){console.error("ReportingTransport: Failed to send log",c),o&&o(c)}}}class ne{constructor(e,t,n,r,s){this._transport=new W(e,t,n,r,s),this._errorUrl=he(e?.errorUrl,e?.integrationDomain,We)}report(e){if(!e)return;const t=e.severity||S.ERROR;this._transport.send(this._errorUrl,t,e.message,e.code,e.stackTrace)}}class re{constructor(e,t,n,r,s,o){this._transport=new W(e,n,r,s,o),this._loggingUrl=he(e?.loggingUrl,e?.integrationDomain,xe),this._errorReportingService=t}log(e){e&&this._transport.send(this._loggingUrl,S.INFO,e.message,e.code,void 0,t=>{if(this._errorReportingService){const n=typeof t.statusCode=="number";this._errorReportingService.report({message:"LoggingService: Failed to send log: "+t.message,code:x.LOG_DELIVERY_FAILURE,severity:n?S.ERROR:S.WARNING})}})}}function Je(i){const e=Y(window.location.href),t=i.EventAttributes?.title||document.title,n=Re(),r=i.ActiveTimeOnSite;return{pageUrl:e,sourceMessageId:i.SourceMessageId,timestamp:i.Timestamp,...t?{pageTitle:t}:{},...n!==void 0?{canonicalUrl:n}:{},...Number.isFinite(r)?{activeTimeOnSite:r}:{}}}const m=class m{constructor(){this.name=d,this.id=L,this.moduleId=L,this.isInitialized=!1,this.launcher=null,this.filters={},this.userAttributes={},this.userIdentifiedInWorkspace=!1,this.testHelpers=null,this.placementEventMappingLookup={},this.placementEventAttributeMappingLookup={},this.integrationName=null,this.errorReportingService=null,this.loggingService=null,this._thankYouElementOnLoadCallback=null,this._isThankYouElementLoaded=!1,this._workspaceSearchInFlightPromise=null}getEventAttributeValue(e,t){const n=e&&e.EventAttributes;return!n||typeof n[t]>"u"?null:n[t]}doesEventAttributeConditionMatch(e,t){if(!e||!E(e.operator))return!1;const n=e.operator.toLowerCase(),r=e.attributeValue;return n==="exists"?t!==null:t==null?!1:n==="equals"?String(t)===String(r):n==="contains"?String(t).indexOf(String(r))!==-1:!1}doesEventMatchRule(e,t){if(!t||!E(t.eventAttributeKey))return!1;const n=t.conditions;if(!Array.isArray(n))return!1;const r=this.getEventAttributeValue(e,t.eventAttributeKey);if(n.length===0)return r!==null;for(let s=0;s<n.length;s++)if(!this.doesEventAttributeConditionMatch(n[s],r))return!1;return!0}applyPlacementEventAttributeMapping(e){const t=Object.keys(this.placementEventAttributeMappingLookup);for(let n=0;n<t.length;n++){const r=t[n],s=this.placementEventAttributeMappingLookup[r];if(K(s))continue;let o=!0;for(let c=0;c<s.length;c++)if(!this.doesEventMatchRule(e,s[c])){o=!1;break}o&&a().Rokt.setLocalSessionAttribute?.(r,!0)}}capturePageView(e){let t;try{t=Y(window.location.href);const n=z(this.loggingService),r=Je(e);n.push(r);const s=Math.min(n.length,le),o=ye(n);if(o===0){const c=D()?"quota":"ls_unavailable";this.loggingService?.log({message:`Rokt Kit: Failed to persist page view for ${t} [reason: ${c}]`,code:"PAGE_VIEW_CAPTURE_FAILED"})}else o<s&&this.loggingService?.log({message:`Rokt Kit: Page view storage reduced from ${s} to ${o} record(s) under quota pressure [reason: quota_eviction]`,code:"PAGE_VIEW_QUOTA_EVICTION"})}catch(n){const r=D()?"exception":"ls_unavailable",s=n instanceof Error?n.message:String(n);this.loggingService?.log({message:`Rokt Kit: Failed to capture page view for ${t}: ${s} [reason: ${r}]`,code:"PAGE_VIEW_CAPTURE_FAILED"})}}isLauncherReadyToAttach(){return!!window.Rokt&&T(window.Rokt.createLauncher)}returnUserIdentities(e){if(!e||!e.getUserIdentities)return{};const t=e.getUserIdentities().userIdentities;return this.replaceOtherIdentityWithEmailsha256(t)}returnLocalSessionAttributes(){return!a().Rokt||typeof a().Rokt.getLocalSessionAttributes!="function"?{}:a().Rokt.getLocalSessionAttributes()}replaceOtherIdentityWithEmailsha256(e){const t={...e||{}},n=this._mappedEmailSha256Key;return n&&e[n]&&(t[m.EMAIL_SHA256_KEY]=e[n]),n&&delete t[n],t}logSelectPlacementsEvent(e){if(!window.mParticle||typeof a().logEvent!="function"||!_(e))return;const t=a().EventType.Other;a().logEvent(we,t,e)}setRoktSessionId(e){if(!(!e||typeof e!="string"))try{const t=a().getInstance();t&&T(t.setIntegrationAttribute)&&t.setIntegrationAttribute(L,{roktSessionId:e})}catch{}}readMpSessionId(){const e=a()?.sessionManager,t=e?.getSessionId??e?.getSession;if(T(t))return t.call(e)||void 0}readMpDeviceId(){return a()?.getDeviceId?.()||void 0}attachLauncher(e,t,n=[]){const r={accountId:e,...t||{}};let s;this.isPartnerInLocalLauncherTestGroup()?s=Promise.resolve(window.Rokt.createLocalLauncher(r)):s=window.Rokt.createLauncher(r),s.then(async o=>{await Ve(n,o),this.initRoktLauncher(o)}).catch(o=>{console.error("Error creating Rokt launcher:",o)})}initRoktLauncher(e){window.Rokt&&(window.Rokt.currentLauncher=e),this.launcher=e;const t=a().Rokt?.filters;t?(this.filters=t,t.filteredUser?this._workspaceSearchInFlightPromise=this.search(t.filteredUser):console.warn("Rokt Kit: No filtered user has been set.")):console.warn("Rokt Kit: No filters have been set."),this.isInitialized=!0,ie(this.domain,this.integrationName),a().Rokt.attachKit(this)}fetchOptimizely(){const e=a()._getActiveForwarders().filter(t=>t.name==="Optimizely");try{if(e.length>0&&window.optimizely){const t=window.optimizely.get("state");return!t||!t.getActiveExperimentIds?{}:t.getActiveExperimentIds().reduce((s,o)=>(s["rokt.custom.optimizely.experiment."+o+".variationId"]=t.getVariationMap()[o].id,s),{})}}catch(t){console.error("Error fetching Optimizely attributes:",t)}return{}}isKitReady(){return!!(this.isInitialized&&this.launcher)}isTargetingDisabled(){return a().Rokt?.launcherOptions?.noTargeting===!0}isPartnerInLocalLauncherTestGroup(){return!!(a().config&&a().config.isLocalLauncherEnabled&&this.isAssignedToSampleGroup())}isAssignedToSampleGroup(){return Math.random()>.5}captureTiming(e){window&&a()&&a().captureTiming&&e&&a().captureTiming(e)}init(e,t,n,r,s){const o=e,c=o.accountId;this.userAttributes=b(s),this._onboardingExpProvider=o.onboardingExpProvider;const u=P(o.placementEventMapping);this.placementEventMappingLookup=Z(u);const l=P(o.placementEventAttributeMapping);this.placementEventAttributeMappingLookup=ee(l),o.hashedEmailUserIdentityType&&(this._mappedEmailSha256Key=o.hashedEmailUserIdentityType.toLowerCase()),this._workspaceIdSyncApiKey=E(o.workspaceIdSyncApiKey)?o.workspaceIdSyncApiKey:void 0;const g=a().Rokt?.domain,{roktExtensionsQueryParams:M,legacyRoktExtensions:R,loadThankYouElement:w}=X(o.roktExtensions),f={...a().Rokt?.launcherOptions||{}};this.integrationName=He(f.integrationName),f.integrationName=this.integrationName,this.domain=g;const A={loggingUrl:o.loggingUrl,errorUrl:o.errorUrl,integrationDomain:g,isLoggingEnabled:a().config?.isLoggingEnabled===!0},I=new ne(A,this.integrationName,window.__rokt_li_guid__,o.accountId),k=new re(A,I,this.integrationName,window.__rokt_li_guid__,o.accountId);if(this.errorReportingService=I,this.loggingService=k,this.isTargetingDisabled())try{q(),$()}catch(h){this.errorReportingService?.report({message:"Rokt Kit: Failed to clear page views when targeting is disabled",code:"PAGE_VIEW_CAPTURE_FAILED",severity:S.INFO,stackTrace:h instanceof Error?h.stack:void 0})}return a()._registerErrorReportingService&&a()._registerErrorReportingService(I),a()._registerLoggingService&&a()._registerLoggingService(k),n?(this.testHelpers={generateLauncherScript:J,generateThankYouElementScript:B,extractRoktExtensionConfig:X,hashEventMessage:te,parseSettingsString:P,generateMappedEventLookup:Z,generateMappedEventAttributeLookup:ee,sendAdBlockMeasurementSignals:ie,createAutoRemovedIframe:F,djb2:ge,setAllowedOriginHashes:h=>{m._allowedOriginHashes=h},ReportingTransport:W,ErrorReportingService:ne,LoggingService:re,RateLimiter:pe,ErrorCodes:x,WSDKErrorSeverity:S},this.attachLauncher(c,f),"Successfully initialized: "+d):(w&&(a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this),Q(Oe,B(g),{onLoad:()=>{this._isThankYouElementLoaded=!0,this._thankYouElementOnLoadCallback&&this._thankYouElementOnLoadCallback()},onError:h=>{console.error("Error loading Rokt Thank You Element script:",h)}})),this.isLauncherReadyToAttach()?this.attachLauncher(c,f,R):(Q(Pe,J(g,M),{onLoad:()=>{this.isLauncherReadyToAttach()?this.attachLauncher(c,f,R):console.error("Rokt object is not available after script load.")},onError:h=>{console.error("Error loading Rokt launcher script:",h)}}),this.captureTiming(m.PERFORMANCE_MARKS.RoktScriptAppended)),"Successfully initialized: "+d)}process(e){if(this.isTargetingDisabled()||(e.EventDataType===Ue&&(ke(this.loggingService),this.capturePageView(e)),e.EventDataType===Ce&&(de(this.loggingService),q(),$())),!this.isKitReady())return"Kit not ready for forwarder: "+d;if(T(a().Rokt?.setLocalSessionAttribute)&&(K(this.placementEventAttributeMappingLookup)||this.applyPlacementEventAttributeMapping(e),!K(this.placementEventMappingLookup))){const t=te(e.EventDataType,e.EventCategory,e.EventName??"");this.placementEventMappingLookup[String(t)]&&a().Rokt.setLocalSessionAttribute?.(this.placementEventMappingLookup[String(t)],!0)}return"Successfully sent to forwarder: "+d}setExtensionData(e){if(!this.isKitReady()){console.error("Rokt Kit: Not initialized");return}window.Rokt.setExtensionData(e)}setUserAttribute(e,t){return se(e)||(this.userAttributes[e]=t),"Successfully set user attribute for forwarder: "+d}removeUserAttribute(e){return delete this.userAttributes[e],"Successfully removed user attribute for forwarder: "+d}handleIdentityComplete(e,t){return this.userAttributes=b(e.getAllUserAttributes()),"Successfully called "+t+" for forwarder: "+d}onUserIdentified(e){const t=e;return this.filters.filteredUser=t,this._workspaceSearchInFlightPromise=this.search(t),this.handleIdentityComplete(e,"onUserIdentified")}search(e){const t=this._workspaceIdSyncApiKey;if(!t)return this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=void 0,Promise.resolve();const n=a().Identity?.search;if(typeof n!="function")return this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=void 0,Promise.resolve();const r=e.getUserIdentities?e.getUserIdentities().userIdentities:null,s={};if(r)for(const u of Object.keys(r)){const l=r[u];E(l)&&l.length>0&&(s[u]=l)}const o=Object.keys(s);if(o.length===0)return this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=void 0,Promise.resolve();const c=o.sort().map(u=>`${u}=${s[u]}`).join("&");return c===this._workspaceLastSearchedIdentitiesKey?this._workspaceSearchInFlightPromise||Promise.resolve():(this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=c,new Promise(u=>{try{n(t,s,l=>{l?.httpCode===200&&(this.userIdentifiedInWorkspace=!0),u()})}catch(l){console.error("Rokt Kit: Workspace IDSync search failed",l),this._workspaceLastSearchedIdentitiesKey=void 0,u()}}))}onLoginComplete(e,t){return this.handleIdentityComplete(e,"onLoginComplete")}onLogoutComplete(e,t){return this.userIdentifiedInWorkspace=!1,this._workspaceSearchInFlightPromise=null,this._workspaceLastSearchedIdentitiesKey=void 0,this.handleIdentityComplete(e,"onLogoutComplete")}onModifyComplete(e,t){return this.handleIdentityComplete(e,"onModifyComplete")}selectPlacements(e){if(this._workspaceSearchInFlightPromise){const t=this._workspaceSearchInFlightPromise;return Promise.race([t,new Promise(n=>setTimeout(n,Ye))]).then(()=>this._dispatchPlacements(e))}return this._dispatchPlacements(e)}_dispatchPlacements(e){const t=e&&e.attributes||{},r={...b(this.userAttributes),...t},s=this.filters||{},o=s.userAttributeFilters||[],c=s.filteredUser||null,u=c?c.getMPID():null;let l;s?s.filterUserAttributes?l=s.filterUserAttributes(r,o):l=r:(console.warn("Rokt Kit: No filters available, using user attributes"),l=r),this.userAttributes=b(l);const g=this._onboardingExpProvider==="Optimizely"?this.fetchOptimizely():{},M=this.returnUserIdentities(c),R=this.returnLocalSessionAttributes(),w=Ae(z(this.loggingService)),f=ve(),A=this.readMpSessionId(),I=this.readMpDeviceId(),k={...M,...l,...g,...R,...w.length?{[Me]:JSON.stringify(w)}:{},...f?{[Ke]:f}:{},...this.userIdentifiedInWorkspace?{[Ne]:!0}:{},...A?{[De]:A}:{},...I?{[Fe]:I}:{},mpid:u},h={...e,attributes:k},j=this.launcher.selectPlacements(h),fe=()=>this.logSelectPlacementsEvent(k);return Promise.resolve(j).then(me=>me?.context?.sessionId?.then(Ee=>this.setRoktSessionId(Ee))).catch(()=>{}).finally(fe),j}hashAttributes(e){return this.isKitReady()?this.launcher.hashAttributes(e):(console.error("Rokt Kit: Not initialized"),null)}use(e){return this.isKitReady()?!e||!E(e)?Promise.reject(new Error("Rokt Kit: Invalid extension name")):this.launcher.use(e):(console.error("Rokt Kit: Not initialized"),Promise.reject(new Error("Rokt Kit: Not initialized")))}onShoppableAdsReady(e){this._isThankYouElementLoaded?e():this._thankYouElementOnLoadCallback=e}};m._allowedOriginHashes=[-553112570,549508659],m.PERFORMANCE_MARKS={RoktScriptAppended:"mp:RoktScriptAppended"},m.EMAIL_SHA256_KEY="emailsha256";let y=m;function Be(){return L}function Qe(i){if(!i){window.console.log("You must pass a config object to register the kit "+d);return}if(!_(i)){window.console.log("'config' must be an object. You passed in a "+typeof i);return}_(i.kits)?i.kits[d]={constructor:y}:(i.kits={},i.kits[d]={constructor:y}),window.console.log("Successfully registered "+d+" to your mParticle configuration")}typeof window<"u"&&window.mParticle&&a().addForwarder&&a().addForwarder({name:d,constructor:y,getId:Be});exports.register=Qe;
2
2
  //# sourceMappingURL=Rokt-Kit.common.js.map
@@ -1,4 +1,4 @@
1
- const he = [
1
+ const _e = [
2
2
  "active_time_on_site_ms",
3
3
  "billingaddress1",
4
4
  "billingaddress2",
@@ -23,31 +23,31 @@ const he = [
23
23
  "shippingstate",
24
24
  "shippingzipcode",
25
25
  "totalprice"
26
- ], pe = new Set(he);
27
- function ee(i) {
28
- return pe.has(i.toLowerCase());
26
+ ], Ie = new Set(_e);
27
+ function se(i) {
28
+ return Ie.has(i.toLowerCase());
29
29
  }
30
30
  function b(i) {
31
31
  const e = {}, t = i || {}, n = Object.keys(t);
32
32
  for (let r = 0; r < n.length; r++) {
33
33
  const s = n[r];
34
- ee(s) || (e[s] = t[s]);
34
+ se(s) || (e[s] = t[s]);
35
35
  }
36
36
  return e;
37
37
  }
38
- function I(i) {
38
+ function _(i) {
39
39
  return typeof i == "object" && i !== null && !Array.isArray(i);
40
40
  }
41
- function m(i) {
41
+ function E(i) {
42
42
  return typeof i == "string";
43
43
  }
44
- function L(i) {
44
+ function T(i) {
45
45
  return typeof i == "function";
46
46
  }
47
- function U(i) {
47
+ function K(i) {
48
48
  return i == null ? !0 : typeof i == "object" ? Object.keys(i).length === 0 : !1;
49
49
  }
50
- function K(i) {
50
+ function Y(i) {
51
51
  try {
52
52
  const e = new URL(i);
53
53
  return e.search = "", e.toString();
@@ -55,10 +55,10 @@ function K(i) {
55
55
  return i;
56
56
  }
57
57
  }
58
- const Y = "__rokt_ls_probe__";
59
- function x() {
58
+ const j = "__rokt_ls_probe__";
59
+ function D() {
60
60
  try {
61
- return window.localStorage.setItem(Y, "1"), window.localStorage.removeItem(Y), !0;
61
+ return window.localStorage.setItem(j, "1"), window.localStorage.removeItem(j), !0;
62
62
  } catch {
63
63
  return !1;
64
64
  }
@@ -71,62 +71,71 @@ function N(i) {
71
71
  return null;
72
72
  }
73
73
  }
74
- function te(i, e) {
74
+ function oe(i, e) {
75
75
  try {
76
76
  return window.localStorage.setItem(i, JSON.stringify(e)), !0;
77
77
  } catch {
78
78
  return !1;
79
79
  }
80
80
  }
81
- function ie(i) {
81
+ function ae(i) {
82
82
  try {
83
83
  window.localStorage.removeItem(i);
84
84
  } catch {
85
85
  }
86
86
  }
87
- function ne(i, e) {
87
+ function U(i, e) {
88
88
  const t = N(i);
89
- return I(t) ? t[e] : void 0;
89
+ return _(t) ? t[e] : void 0;
90
90
  }
91
- function re(i, e, t) {
92
- const n = N(i), r = I(n) ? { ...n } : {};
93
- return r[e] = t, te(i, r);
91
+ function x(i, e, t) {
92
+ const n = N(i), r = _(n) ? { ...n } : {};
93
+ return r[e] = t, oe(i, r);
94
94
  }
95
- function ge(i, e) {
95
+ function ce(i, e) {
96
96
  const t = N(i);
97
- if (!I(t) || !(e in t))
97
+ if (!_(t) || !(e in t))
98
98
  return;
99
99
  const n = { ...t };
100
- delete n[e], Object.keys(n).length === 0 ? ie(i) : te(i, n);
100
+ delete n[e], Object.keys(n).length === 0 ? ae(i) : oe(i, n);
101
101
  }
102
- const A = "mp-rokt-kit", k = "pageViews", G = "mpPageViews";
103
- function se(i) {
104
- const e = N(G);
102
+ const p = "mp-rokt-kit", R = "pageViews", O = "utmParams", H = "mpPageViews", le = 25, Se = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
103
+ function ue(i) {
104
+ return i.slice(-le);
105
+ }
106
+ function de(i) {
107
+ const e = N(H);
105
108
  if (e === null)
106
109
  return;
107
- !(ne(A, k) !== void 0) && Array.isArray(e) && (i?.log({
110
+ !(U(p, R) !== void 0) && Array.isArray(e) && (i?.log({
108
111
  message: "Rokt Kit: Migrating legacy page-view storage",
109
112
  code: "PAGE_VIEW_LEGACY_MIGRATION"
110
- }), re(A, k, e) || i?.log({
113
+ }), x(p, R, e) || i?.log({
111
114
  message: "Rokt Kit: Failed to migrate legacy page-view storage [reason: migration_retry]",
112
115
  code: "PAGE_VIEW_CAPTURE_FAILED"
113
- })), ie(G);
116
+ })), ae(H);
114
117
  }
115
- function W(i) {
116
- se(i);
117
- const e = ne(A, k);
118
+ function z(i) {
119
+ de(i);
120
+ const e = U(p, R);
118
121
  return Array.isArray(e) ? e : [];
119
122
  }
120
- function fe(i) {
121
- return re(A, k, i.slice(-25));
123
+ function ye(i) {
124
+ const e = ue(i);
125
+ for (let t = 0; t < e.length; t++) {
126
+ const n = e.slice(t);
127
+ if (x(p, R, n))
128
+ return n.length;
129
+ }
130
+ return 0;
122
131
  }
123
- function j() {
124
- ge(A, k);
132
+ function q() {
133
+ ce(p, R);
125
134
  }
126
- function me(i) {
127
- const e = i.slice(-25);
135
+ function Ae(i) {
136
+ const e = ue(i);
128
137
  return e.map((t, n) => {
129
- const r = t.activeTimeOnSite, s = r !== void 0 && Number.isFinite(r), l = e[n + 1]?.activeTimeOnSite, u = l !== void 0 && Number.isFinite(l), c = s && u ? l - r : void 0;
138
+ const r = t.activeTimeOnSite, s = r !== void 0 && Number.isFinite(r), c = e[n + 1]?.activeTimeOnSite, u = c !== void 0 && Number.isFinite(c), l = s && u ? c - r : void 0;
130
139
  return {
131
140
  pageUrl: t.pageUrl,
132
141
  sourceMessageId: t.sourceMessageId,
@@ -134,46 +143,77 @@ function me(i) {
134
143
  ...t.pageTitle !== void 0 ? { pageTitle: t.pageTitle } : {},
135
144
  ...t.canonicalUrl !== void 0 ? { canonicalUrl: t.canonicalUrl } : {},
136
145
  ...s ? { activeTimeOnSite: r } : {},
137
- ...c !== void 0 && c >= 0 ? { activeTimeOnPage: c } : {}
146
+ ...l !== void 0 && l >= 0 ? { activeTimeOnPage: l } : {}
138
147
  };
139
148
  });
140
149
  }
141
- function Ee() {
150
+ function ke(i) {
151
+ if (U(p, O) !== void 0)
152
+ return;
153
+ const e = new URLSearchParams(window.location.search), t = {};
154
+ for (const r of Se) {
155
+ const s = e.get(r);
156
+ s && (t[r] = s);
157
+ }
158
+ if (Object.keys(t).length === 0)
159
+ return;
160
+ const n = Object.keys(t).join(", ");
161
+ if (!x(p, O, t)) {
162
+ const r = D() ? "quota" : "ls_unavailable";
163
+ i?.log({
164
+ message: `Rokt Kit: Failed to persist UTM params [reason: ${r}]`,
165
+ code: "UTM_CAPTURE_FAILED"
166
+ });
167
+ return;
168
+ }
169
+ i?.log({
170
+ message: `Rokt Kit: Captured UTM params [${n}]`,
171
+ code: "UTM_CAPTURE_SUCCESS"
172
+ });
173
+ }
174
+ function Re() {
175
+ const i = U(p, O);
176
+ return _(i) ? i : null;
177
+ }
178
+ function $() {
179
+ ce(p, O);
180
+ }
181
+ function ve() {
142
182
  const e = document.querySelector('link[rel="canonical"]')?.href;
143
183
  if (e)
144
- return K(e);
184
+ return Y(e);
145
185
  }
146
- const d = "Rokt", T = 181, _e = "selectPlacements", Ie = "apps.roktecommerce.com", Se = 0.1, ye = "ThankYouPageJourney", Ae = "rokt-launcher", ke = "rokt-thank-you-element", Re = "userIdentifiedInWorkspace", ve = 3, we = 2, be = "page_events", Le = "mparticle_session_id", Te = "mparticle_device_id", Pe = 500, D = {
186
+ const d = "Rokt", L = 181, we = "selectPlacements", be = "apps.roktecommerce.com", Te = 0.1, Le = "ThankYouPageJourney", Pe = "rokt-launcher", Oe = "rokt-thank-you-element", Ne = "userIdentifiedInWorkspace", Ue = 3, Ce = 2, Me = "page_events", Ke = "page_view_attributes", De = "mparticle_session_id", Fe = "mparticle_device_id", Ye = 500, G = {
147
187
  UNKNOWN_ERROR: "UNKNOWN_ERROR",
148
188
  UNHANDLED_EXCEPTION: "UNHANDLED_EXCEPTION",
149
189
  IDENTITY_REQUEST: "IDENTITY_REQUEST",
150
190
  LOG_DELIVERY_FAILURE: "LOG_DELIVERY_FAILURE"
151
- }, _ = {
191
+ }, S = {
152
192
  ERROR: "ERROR",
153
193
  INFO: "INFO",
154
194
  WARNING: "WARNING"
155
- }, Ne = "apps.rokt-api.com", Oe = "/v1/log", Ce = "/v1/errors", Ue = 10;
195
+ }, xe = "apps.rokt-api.com", Ge = "/v1/log", We = "/v1/errors", Ve = 10;
156
196
  function a() {
157
197
  return window.mParticle;
158
198
  }
159
- function V(i, e) {
160
- const n = [O(i), "/wsdk/integrations/launcher.js"].join("");
199
+ function J(i, e) {
200
+ const n = [C(i), "/wsdk/integrations/launcher.js"].join("");
161
201
  return !e || e.length === 0 ? n : n + "?extensions=" + e.join(",");
162
202
  }
163
- function H(i) {
164
- return [O(i), "/rokt-elements/rokt-element-thank-you.js"].join("");
203
+ function B(i) {
204
+ return [C(i), "/rokt-elements/rokt-element-thank-you.js"].join("");
165
205
  }
166
- function O(i) {
167
- const e = typeof i < "u" ? i : Ne;
206
+ function C(i) {
207
+ const e = typeof i < "u" ? i : xe;
168
208
  return e.includes("://") ? e.replace(/\/+$/, "") : ["https://", e].join("");
169
209
  }
170
- function oe(i, e, t) {
210
+ function he(i, e, t) {
171
211
  if (i)
172
212
  return i.startsWith("http://") || i.startsWith("https://") ? i : "https://" + i;
173
213
  const r = e?.includes("://") && !/^https?:\/\//i.test(e) ? void 0 : e;
174
- return O(r) + t;
214
+ return C(r) + t;
175
215
  }
176
- function z(i, e, t) {
216
+ function Q(i, e, t) {
177
217
  if (document.getElementById(i)) return;
178
218
  const n = document.head || document.body, r = document.createElement("script");
179
219
  r.id = i, r.type = "text/javascript", r.src = e, r.async = !0, r.crossOrigin = "anonymous", r.fetchPriority = "high", t?.onLoad && (r.onload = t.onLoad), t?.onError && (r.onerror = t.onError), n.appendChild(r);
@@ -188,12 +228,12 @@ function P(i) {
188
228
  }
189
229
  return [];
190
230
  }
191
- function J(i) {
231
+ function X(i) {
192
232
  const e = i ? P(i) : [], t = [], n = [];
193
233
  let r = !1;
194
234
  for (let s = 0; s < e.length; s++) {
195
235
  const o = e[s].value;
196
- o === "thank-you-journey" ? (r = !0, n.push(ye)) : t.push(o);
236
+ o === "thank-you-journey" ? (r = !0, n.push(Le)) : t.push(o);
197
237
  }
198
238
  return {
199
239
  roktExtensionsQueryParams: t,
@@ -201,14 +241,14 @@ function J(i) {
201
241
  loadThankYouElement: r
202
242
  };
203
243
  }
204
- async function Me(i, e) {
244
+ async function je(i, e) {
205
245
  const t = [];
206
246
  if (e)
207
247
  for (const n of i)
208
248
  t.push(e.use(n));
209
249
  return Promise.all(t);
210
250
  }
211
- function q(i) {
251
+ function Z(i) {
212
252
  if (!i)
213
253
  return {};
214
254
  const e = {};
@@ -218,13 +258,13 @@ function q(i) {
218
258
  }
219
259
  return e;
220
260
  }
221
- function B(i) {
261
+ function ee(i) {
222
262
  const e = {};
223
263
  if (!Array.isArray(i))
224
264
  return e;
225
265
  for (let t = 0; t < i.length; t++) {
226
266
  const n = i[t];
227
- if (!n || !m(n.value) || !m(n.map))
267
+ if (!n || !E(n.value) || !E(n.map))
228
268
  continue;
229
269
  const r = n.value, s = n.map;
230
270
  e[r] || (e[r] = []), e[r].push({
@@ -234,20 +274,20 @@ function B(i) {
234
274
  }
235
275
  return e;
236
276
  }
237
- function $(i, e, t) {
277
+ function te(i, e, t) {
238
278
  return a().generateHash([i, e, t].join(""));
239
279
  }
240
- function Ke(i) {
241
- let n = "mParticle_wsdkv_" + a().getVersion() + "_kitv_" + "1.34.0";
280
+ function He(i) {
281
+ let n = "mParticle_wsdkv_" + a().getVersion() + "_kitv_" + "1.35.0";
242
282
  return i && (n += "_" + i), n;
243
283
  }
244
- function ae(i) {
284
+ function ge(i) {
245
285
  let e = 5381;
246
286
  for (let t = 0; t < i.length; t++)
247
287
  e = (e << 5) + e + i.charCodeAt(t), e = e & e;
248
288
  return e;
249
289
  }
250
- function M(i) {
290
+ function F(i) {
251
291
  const e = document.createElement("iframe");
252
292
  e.style.display = "none", e.setAttribute("sandbox", "allow-scripts allow-same-origin"), e.src = i, e.onload = function() {
253
293
  e.onload = null, e.parentNode && e.parentNode.removeChild(e);
@@ -255,54 +295,54 @@ function M(i) {
255
295
  const t = document.body || document.head;
256
296
  t && t.appendChild(e);
257
297
  }
258
- function Q(i, e) {
259
- const t = ae(window.location.origin);
260
- if (S._allowedOriginHashes.indexOf(t) === -1 || Math.random() >= Se)
298
+ function ie(i, e) {
299
+ const t = ge(window.location.origin);
300
+ if (y._allowedOriginHashes.indexOf(t) === -1 || Math.random() >= Te)
261
301
  return;
262
302
  const r = window.__rokt_li_guid__;
263
303
  if (!r || i && i.includes("://") && !/^https:\/\//i.test(i))
264
304
  return;
265
- const s = window.location.href.split("?")[0].split("#")[0], o = "version=" + encodeURIComponent(e ?? "") + "&launcherInstanceGuid=" + encodeURIComponent(r) + "&pageUrl=" + encodeURIComponent(s), l = i ? O(i) : "https://apps.rokt.com";
266
- M(l + "/v1/wsdk-init/index.html?" + o), M(
267
- "https://" + Ie + "/v1/wsdk-init/index.html?" + o + "&isControl=true"
305
+ const s = window.location.href.split("?")[0].split("#")[0], o = "version=" + encodeURIComponent(e ?? "") + "&launcherInstanceGuid=" + encodeURIComponent(r) + "&pageUrl=" + encodeURIComponent(s), c = i ? C(i) : "https://apps.rokt.com";
306
+ F(c + "/v1/wsdk-init/index.html?" + o), F(
307
+ "https://" + be + "/v1/wsdk-init/index.html?" + o + "&isControl=true"
268
308
  );
269
309
  }
270
- function De() {
310
+ function ze() {
271
311
  return typeof window < "u" && !!window.location?.search?.toLowerCase().includes("mp_enable_logging=true");
272
312
  }
273
- function Fe() {
313
+ function qe() {
274
314
  return typeof window < "u" ? window.location?.href : void 0;
275
315
  }
276
- function Ye() {
316
+ function $e() {
277
317
  return typeof window < "u" ? window.navigator?.userAgent : void 0;
278
318
  }
279
- class ce {
319
+ class pe {
280
320
  constructor() {
281
321
  this._logCount = {};
282
322
  }
283
323
  incrementAndCheck(e) {
284
324
  const n = (this._logCount[e] || 0) + 1;
285
- return this._logCount[e] = n, n > Ue;
325
+ return this._logCount[e] = n, n > Ve;
286
326
  }
287
327
  }
288
- class F {
328
+ class W {
289
329
  constructor(e, t, n, r, s) {
290
330
  this._reporter = "mp-wsdk";
291
331
  const o = e.isLoggingEnabled;
292
- this._integrationName = t || "", this._launcherInstanceGuid = n, this._accountId = r || null, this._rateLimiter = s || new ce(), this._isEnabled = De() || o;
332
+ this._integrationName = t || "", this._launcherInstanceGuid = n, this._accountId = r || null, this._rateLimiter = s || new pe(), this._isEnabled = ze() || o;
293
333
  }
294
334
  send(e, t, n, r, s, o) {
295
335
  if (!(!this._isEnabled || this._rateLimiter.incrementAndCheck(t)))
296
336
  try {
297
- const l = {
337
+ const c = {
298
338
  additionalInformation: {
299
339
  message: n,
300
340
  version: this._integrationName
301
341
  },
302
342
  severity: t,
303
- code: r || D.UNKNOWN_ERROR,
304
- url: Fe(),
305
- deviceInfo: Ye(),
343
+ code: r || G.UNKNOWN_ERROR,
344
+ url: qe(),
345
+ deviceInfo: $e(),
306
346
  stackTrace: s,
307
347
  reporter: this._reporter,
308
348
  integration: this._integrationName
@@ -315,38 +355,38 @@ class F {
315
355
  this._launcherInstanceGuid && (u["rokt-launcher-instance-guid"] = this._launcherInstanceGuid), this._accountId && (u["rokt-account-id"] = this._accountId), fetch(e, {
316
356
  method: "POST",
317
357
  headers: u,
318
- body: JSON.stringify(l)
319
- }).then((c) => {
320
- if (!c.ok) {
321
- const p = new Error("HTTP " + c.status + " from log endpoint");
322
- throw p.statusCode = c.status, p;
358
+ body: JSON.stringify(c)
359
+ }).then((l) => {
360
+ if (!l.ok) {
361
+ const g = new Error("HTTP " + l.status + " from log endpoint");
362
+ throw g.statusCode = l.status, g;
323
363
  }
324
- }).catch((c) => {
325
- console.error("ReportingTransport: Failed to send log", c), o && o(c);
364
+ }).catch((l) => {
365
+ console.error("ReportingTransport: Failed to send log", l), o && o(l);
326
366
  });
327
- } catch (l) {
328
- console.error("ReportingTransport: Failed to send log", l), o && o(l);
367
+ } catch (c) {
368
+ console.error("ReportingTransport: Failed to send log", c), o && o(c);
329
369
  }
330
370
  }
331
371
  }
332
- class X {
372
+ class ne {
333
373
  constructor(e, t, n, r, s) {
334
- this._transport = new F(e, t, n, r, s), this._errorUrl = oe(e?.errorUrl, e?.integrationDomain, Ce);
374
+ this._transport = new W(e, t, n, r, s), this._errorUrl = he(e?.errorUrl, e?.integrationDomain, We);
335
375
  }
336
376
  report(e) {
337
377
  if (!e) return;
338
- const t = e.severity || _.ERROR;
378
+ const t = e.severity || S.ERROR;
339
379
  this._transport.send(this._errorUrl, t, e.message, e.code, e.stackTrace);
340
380
  }
341
381
  }
342
- class Z {
382
+ class re {
343
383
  constructor(e, t, n, r, s, o) {
344
- this._transport = new F(e, n, r, s, o), this._loggingUrl = oe(e?.loggingUrl, e?.integrationDomain, Oe), this._errorReportingService = t;
384
+ this._transport = new W(e, n, r, s, o), this._loggingUrl = he(e?.loggingUrl, e?.integrationDomain, Ge), this._errorReportingService = t;
345
385
  }
346
386
  log(e) {
347
387
  e && this._transport.send(
348
388
  this._loggingUrl,
349
- _.INFO,
389
+ S.INFO,
350
390
  e.message,
351
391
  e.code,
352
392
  void 0,
@@ -355,16 +395,16 @@ class Z {
355
395
  const n = typeof t.statusCode == "number";
356
396
  this._errorReportingService.report({
357
397
  message: "LoggingService: Failed to send log: " + t.message,
358
- code: D.LOG_DELIVERY_FAILURE,
359
- severity: n ? _.ERROR : _.WARNING
398
+ code: G.LOG_DELIVERY_FAILURE,
399
+ severity: n ? S.ERROR : S.WARNING
360
400
  });
361
401
  }
362
402
  }
363
403
  );
364
404
  }
365
405
  }
366
- function xe(i) {
367
- const e = K(window.location.href), t = i.EventAttributes?.title || document.title, n = Ee(), r = i.ActiveTimeOnSite;
406
+ function Je(i) {
407
+ const e = Y(window.location.href), t = i.EventAttributes?.title || document.title, n = ve(), r = i.ActiveTimeOnSite;
368
408
  return {
369
409
  pageUrl: e,
370
410
  sourceMessageId: i.SourceMessageId,
@@ -374,9 +414,9 @@ function xe(i) {
374
414
  ...Number.isFinite(r) ? { activeTimeOnSite: r } : {}
375
415
  };
376
416
  }
377
- const f = class f {
417
+ const m = class m {
378
418
  constructor() {
379
- this.name = d, this.id = T, this.moduleId = T, this.isInitialized = !1, this.launcher = null, this.filters = {}, this.userAttributes = {}, this.userIdentifiedInWorkspace = !1, this.testHelpers = null, this.placementEventMappingLookup = {}, this.placementEventAttributeMappingLookup = {}, this.integrationName = null, this.errorReportingService = null, this.loggingService = null, this._thankYouElementOnLoadCallback = null, this._isThankYouElementLoaded = !1, this._workspaceSearchInFlightPromise = null;
419
+ this.name = d, this.id = L, this.moduleId = L, this.isInitialized = !1, this.launcher = null, this.filters = {}, this.userAttributes = {}, this.userIdentifiedInWorkspace = !1, this.testHelpers = null, this.placementEventMappingLookup = {}, this.placementEventAttributeMappingLookup = {}, this.integrationName = null, this.errorReportingService = null, this.loggingService = null, this._thankYouElementOnLoadCallback = null, this._isThankYouElementLoaded = !1, this._workspaceSearchInFlightPromise = null;
380
420
  }
381
421
  // ---- Private helpers ----
382
422
  getEventAttributeValue(e, t) {
@@ -384,13 +424,13 @@ const f = class f {
384
424
  return !n || typeof n[t] > "u" ? null : n[t];
385
425
  }
386
426
  doesEventAttributeConditionMatch(e, t) {
387
- if (!e || !m(e.operator))
427
+ if (!e || !E(e.operator))
388
428
  return !1;
389
429
  const n = e.operator.toLowerCase(), r = e.attributeValue;
390
430
  return n === "exists" ? t !== null : t == null ? !1 : n === "equals" ? String(t) === String(r) : n === "contains" ? String(t).indexOf(String(r)) !== -1 : !1;
391
431
  }
392
432
  doesEventMatchRule(e, t) {
393
- if (!t || !m(t.eventAttributeKey))
433
+ if (!t || !E(t.eventAttributeKey))
394
434
  return !1;
395
435
  const n = t.conditions;
396
436
  if (!Array.isArray(n))
@@ -407,11 +447,11 @@ const f = class f {
407
447
  const t = Object.keys(this.placementEventAttributeMappingLookup);
408
448
  for (let n = 0; n < t.length; n++) {
409
449
  const r = t[n], s = this.placementEventAttributeMappingLookup[r];
410
- if (U(s))
450
+ if (K(s))
411
451
  continue;
412
452
  let o = !0;
413
- for (let l = 0; l < s.length; l++)
414
- if (!this.doesEventMatchRule(e, s[l])) {
453
+ for (let c = 0; c < s.length; c++)
454
+ if (!this.doesEventMatchRule(e, s[c])) {
415
455
  o = !1;
416
456
  break;
417
457
  }
@@ -421,17 +461,22 @@ const f = class f {
421
461
  capturePageView(e) {
422
462
  let t;
423
463
  try {
424
- t = K(window.location.href);
425
- const n = W(this.loggingService), r = xe(e);
426
- if (n.push(r), !fe(n)) {
427
- const s = x() ? "quota" : "ls_unavailable";
464
+ t = Y(window.location.href);
465
+ const n = z(this.loggingService), r = Je(e);
466
+ n.push(r);
467
+ const s = Math.min(n.length, le), o = ye(n);
468
+ if (o === 0) {
469
+ const c = D() ? "quota" : "ls_unavailable";
428
470
  this.loggingService?.log({
429
- message: `Rokt Kit: Failed to persist page view for ${t} [reason: ${s}]`,
471
+ message: `Rokt Kit: Failed to persist page view for ${t} [reason: ${c}]`,
430
472
  code: "PAGE_VIEW_CAPTURE_FAILED"
431
473
  });
432
- }
474
+ } else o < s && this.loggingService?.log({
475
+ message: `Rokt Kit: Page view storage reduced from ${s} to ${o} record(s) under quota pressure [reason: quota_eviction]`,
476
+ code: "PAGE_VIEW_QUOTA_EVICTION"
477
+ });
433
478
  } catch (n) {
434
- const r = x() ? "exception" : "ls_unavailable", s = n instanceof Error ? n.message : String(n);
479
+ const r = D() ? "exception" : "ls_unavailable", s = n instanceof Error ? n.message : String(n);
435
480
  this.loggingService?.log({
436
481
  message: `Rokt Kit: Failed to capture page view for ${t}: ${s} [reason: ${r}]`,
437
482
  code: "PAGE_VIEW_CAPTURE_FAILED"
@@ -439,7 +484,7 @@ const f = class f {
439
484
  }
440
485
  }
441
486
  isLauncherReadyToAttach() {
442
- return !!window.Rokt && L(window.Rokt.createLauncher);
487
+ return !!window.Rokt && T(window.Rokt.createLauncher);
443
488
  }
444
489
  /**
445
490
  * Returns the user identities from the filtered user, if any.
@@ -455,19 +500,19 @@ const f = class f {
455
500
  }
456
501
  replaceOtherIdentityWithEmailsha256(e) {
457
502
  const t = { ...e || {} }, n = this._mappedEmailSha256Key;
458
- return n && e[n] && (t[f.EMAIL_SHA256_KEY] = e[n]), n && delete t[n], t;
503
+ return n && e[n] && (t[m.EMAIL_SHA256_KEY] = e[n]), n && delete t[n], t;
459
504
  }
460
505
  logSelectPlacementsEvent(e) {
461
- if (!window.mParticle || typeof a().logEvent != "function" || !I(e))
506
+ if (!window.mParticle || typeof a().logEvent != "function" || !_(e))
462
507
  return;
463
508
  const t = a().EventType.Other;
464
- a().logEvent(_e, t, e);
509
+ a().logEvent(we, t, e);
465
510
  }
466
511
  setRoktSessionId(e) {
467
512
  if (!(!e || typeof e != "string"))
468
513
  try {
469
514
  const t = a().getInstance();
470
- t && L(t.setIntegrationAttribute) && t.setIntegrationAttribute(T, {
515
+ t && T(t.setIntegrationAttribute) && t.setIntegrationAttribute(L, {
471
516
  roktSessionId: e
472
517
  });
473
518
  } catch {
@@ -475,7 +520,7 @@ const f = class f {
475
520
  }
476
521
  readMpSessionId() {
477
522
  const e = a()?.sessionManager, t = e?.getSessionId ?? e?.getSession;
478
- if (L(t))
523
+ if (T(t))
479
524
  return t.call(e) || void 0;
480
525
  }
481
526
  readMpDeviceId() {
@@ -488,7 +533,7 @@ const f = class f {
488
533
  };
489
534
  let s;
490
535
  this.isPartnerInLocalLauncherTestGroup() ? s = Promise.resolve(window.Rokt.createLocalLauncher(r)) : s = window.Rokt.createLauncher(r), s.then(async (o) => {
491
- await Me(n, o), this.initRoktLauncher(o);
536
+ await je(n, o), this.initRoktLauncher(o);
492
537
  }).catch((o) => {
493
538
  console.error("Error creating Rokt launcher:", o);
494
539
  });
@@ -496,7 +541,7 @@ const f = class f {
496
541
  initRoktLauncher(e) {
497
542
  window.Rokt && (window.Rokt.currentLauncher = e), this.launcher = e;
498
543
  const t = a().Rokt?.filters;
499
- t ? (this.filters = t, t.filteredUser ? this._workspaceSearchInFlightPromise = this.search(t.filteredUser) : console.warn("Rokt Kit: No filtered user has been set.")) : console.warn("Rokt Kit: No filters have been set."), this.isInitialized = !0, Q(this.domain, this.integrationName), a().Rokt.attachKit(this);
544
+ t ? (this.filters = t, t.filteredUser ? this._workspaceSearchInFlightPromise = this.search(t.filteredUser) : console.warn("Rokt Kit: No filtered user has been set.")) : console.warn("Rokt Kit: No filters have been set."), this.isInitialized = !0, ie(this.domain, this.integrationName), a().Rokt.attachKit(this);
500
545
  }
501
546
  fetchOptimizely() {
502
547
  const e = a()._getActiveForwarders().filter((t) => t.name === "Optimizely");
@@ -532,89 +577,89 @@ const f = class f {
532
577
  * Initializes the Rokt forwarder with settings from the mParticle server.
533
578
  */
534
579
  init(e, t, n, r, s) {
535
- const o = e, l = o.accountId;
580
+ const o = e, c = o.accountId;
536
581
  this.userAttributes = b(s), this._onboardingExpProvider = o.onboardingExpProvider;
537
582
  const u = P(o.placementEventMapping);
538
- this.placementEventMappingLookup = q(u);
539
- const c = P(
583
+ this.placementEventMappingLookup = Z(u);
584
+ const l = P(
540
585
  o.placementEventAttributeMapping
541
586
  );
542
- this.placementEventAttributeMappingLookup = B(c), o.hashedEmailUserIdentityType && (this._mappedEmailSha256Key = o.hashedEmailUserIdentityType.toLowerCase()), this._workspaceIdSyncApiKey = m(o.workspaceIdSyncApiKey) ? o.workspaceIdSyncApiKey : void 0;
543
- const p = a().Rokt?.domain, { roktExtensionsQueryParams: C, legacyRoktExtensions: R, loadThankYouElement: v } = J(
587
+ this.placementEventAttributeMappingLookup = ee(l), o.hashedEmailUserIdentityType && (this._mappedEmailSha256Key = o.hashedEmailUserIdentityType.toLowerCase()), this._workspaceIdSyncApiKey = E(o.workspaceIdSyncApiKey) ? o.workspaceIdSyncApiKey : void 0;
588
+ const g = a().Rokt?.domain, { roktExtensionsQueryParams: M, legacyRoktExtensions: v, loadThankYouElement: w } = X(
544
589
  o.roktExtensions
545
- ), g = {
590
+ ), f = {
546
591
  ...a().Rokt?.launcherOptions || {}
547
592
  };
548
- this.integrationName = Ke(g.integrationName), g.integrationName = this.integrationName, this.domain = p;
549
- const y = {
593
+ this.integrationName = He(f.integrationName), f.integrationName = this.integrationName, this.domain = g;
594
+ const A = {
550
595
  loggingUrl: o.loggingUrl,
551
596
  errorUrl: o.errorUrl,
552
- integrationDomain: p,
597
+ integrationDomain: g,
553
598
  isLoggingEnabled: a().config?.isLoggingEnabled === !0
554
- }, E = new X(
555
- y,
599
+ }, I = new ne(
600
+ A,
556
601
  this.integrationName,
557
602
  window.__rokt_li_guid__,
558
603
  o.accountId
559
- ), w = new Z(
560
- y,
561
- E,
604
+ ), k = new re(
605
+ A,
606
+ I,
562
607
  this.integrationName,
563
608
  window.__rokt_li_guid__,
564
609
  o.accountId
565
610
  );
566
- if (this.errorReportingService = E, this.loggingService = w, this.isTargetingDisabled())
611
+ if (this.errorReportingService = I, this.loggingService = k, this.isTargetingDisabled())
567
612
  try {
568
- j();
613
+ q(), $();
569
614
  } catch (h) {
570
615
  this.errorReportingService?.report({
571
616
  message: "Rokt Kit: Failed to clear page views when targeting is disabled",
572
617
  code: "PAGE_VIEW_CAPTURE_FAILED",
573
- severity: _.INFO,
618
+ severity: S.INFO,
574
619
  stackTrace: h instanceof Error ? h.stack : void 0
575
620
  });
576
621
  }
577
- return a()._registerErrorReportingService && a()._registerErrorReportingService(E), a()._registerLoggingService && a()._registerLoggingService(w), n ? (this.testHelpers = {
578
- generateLauncherScript: V,
579
- generateThankYouElementScript: H,
580
- extractRoktExtensionConfig: J,
581
- hashEventMessage: $,
622
+ return a()._registerErrorReportingService && a()._registerErrorReportingService(I), a()._registerLoggingService && a()._registerLoggingService(k), n ? (this.testHelpers = {
623
+ generateLauncherScript: J,
624
+ generateThankYouElementScript: B,
625
+ extractRoktExtensionConfig: X,
626
+ hashEventMessage: te,
582
627
  parseSettingsString: P,
583
- generateMappedEventLookup: q,
584
- generateMappedEventAttributeLookup: B,
585
- sendAdBlockMeasurementSignals: Q,
586
- createAutoRemovedIframe: M,
587
- djb2: ae,
628
+ generateMappedEventLookup: Z,
629
+ generateMappedEventAttributeLookup: ee,
630
+ sendAdBlockMeasurementSignals: ie,
631
+ createAutoRemovedIframe: F,
632
+ djb2: ge,
588
633
  setAllowedOriginHashes: (h) => {
589
- f._allowedOriginHashes = h;
634
+ m._allowedOriginHashes = h;
590
635
  },
591
- ReportingTransport: F,
592
- ErrorReportingService: X,
593
- LoggingService: Z,
594
- RateLimiter: ce,
595
- ErrorCodes: D,
596
- WSDKErrorSeverity: _
597
- }, this.attachLauncher(l, g), "Successfully initialized: " + d) : (v && (a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this), z(ke, H(p), {
636
+ ReportingTransport: W,
637
+ ErrorReportingService: ne,
638
+ LoggingService: re,
639
+ RateLimiter: pe,
640
+ ErrorCodes: G,
641
+ WSDKErrorSeverity: S
642
+ }, this.attachLauncher(c, f), "Successfully initialized: " + d) : (w && (a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this), Q(Oe, B(g), {
598
643
  onLoad: () => {
599
644
  this._isThankYouElementLoaded = !0, this._thankYouElementOnLoadCallback && this._thankYouElementOnLoadCallback();
600
645
  },
601
646
  onError: (h) => {
602
647
  console.error("Error loading Rokt Thank You Element script:", h);
603
648
  }
604
- })), this.isLauncherReadyToAttach() ? this.attachLauncher(l, g, R) : (z(Ae, V(p, C), {
649
+ })), this.isLauncherReadyToAttach() ? this.attachLauncher(c, f, v) : (Q(Pe, J(g, M), {
605
650
  onLoad: () => {
606
- this.isLauncherReadyToAttach() ? this.attachLauncher(l, g, R) : console.error("Rokt object is not available after script load.");
651
+ this.isLauncherReadyToAttach() ? this.attachLauncher(c, f, v) : console.error("Rokt object is not available after script load.");
607
652
  },
608
653
  onError: (h) => {
609
654
  console.error("Error loading Rokt launcher script:", h);
610
655
  }
611
- }), this.captureTiming(f.PERFORMANCE_MARKS.RoktScriptAppended)), "Successfully initialized: " + d);
656
+ }), this.captureTiming(m.PERFORMANCE_MARKS.RoktScriptAppended)), "Successfully initialized: " + d);
612
657
  }
613
658
  process(e) {
614
- if (this.isTargetingDisabled() || (e.EventDataType === ve && this.capturePageView(e), e.EventDataType === we && (se(this.loggingService), j())), !this.isKitReady())
659
+ if (this.isTargetingDisabled() || (e.EventDataType === Ue && (ke(this.loggingService), this.capturePageView(e)), e.EventDataType === Ce && (de(this.loggingService), q(), $())), !this.isKitReady())
615
660
  return "Kit not ready for forwarder: " + d;
616
- if (L(a().Rokt?.setLocalSessionAttribute) && (U(this.placementEventAttributeMappingLookup) || this.applyPlacementEventAttributeMapping(e), !U(this.placementEventMappingLookup))) {
617
- const t = $(e.EventDataType, e.EventCategory, e.EventName ?? "");
661
+ if (T(a().Rokt?.setLocalSessionAttribute) && (K(this.placementEventAttributeMappingLookup) || this.applyPlacementEventAttributeMapping(e), !K(this.placementEventMappingLookup))) {
662
+ const t = te(e.EventDataType, e.EventCategory, e.EventName ?? "");
618
663
  this.placementEventMappingLookup[String(t)] && a().Rokt.setLocalSessionAttribute?.(this.placementEventMappingLookup[String(t)], !0);
619
664
  }
620
665
  return "Successfully sent to forwarder: " + d;
@@ -627,7 +672,7 @@ const f = class f {
627
672
  window.Rokt.setExtensionData(e);
628
673
  }
629
674
  setUserAttribute(e, t) {
630
- return ee(e) || (this.userAttributes[e] = t), "Successfully set user attribute for forwarder: " + d;
675
+ return se(e) || (this.userAttributes[e] = t), "Successfully set user attribute for forwarder: " + d;
631
676
  }
632
677
  removeUserAttribute(e) {
633
678
  return delete this.userAttributes[e], "Successfully removed user attribute for forwarder: " + d;
@@ -649,20 +694,20 @@ const f = class f {
649
694
  const r = e.getUserIdentities ? e.getUserIdentities().userIdentities : null, s = {};
650
695
  if (r)
651
696
  for (const u of Object.keys(r)) {
652
- const c = r[u];
653
- m(c) && c.length > 0 && (s[u] = c);
697
+ const l = r[u];
698
+ E(l) && l.length > 0 && (s[u] = l);
654
699
  }
655
700
  const o = Object.keys(s);
656
701
  if (o.length === 0)
657
702
  return this.userIdentifiedInWorkspace = !1, this._workspaceLastSearchedIdentitiesKey = void 0, Promise.resolve();
658
- const l = o.sort().map((u) => `${u}=${s[u]}`).join("&");
659
- return l === this._workspaceLastSearchedIdentitiesKey ? this._workspaceSearchInFlightPromise || Promise.resolve() : (this.userIdentifiedInWorkspace = !1, this._workspaceLastSearchedIdentitiesKey = l, new Promise((u) => {
703
+ const c = o.sort().map((u) => `${u}=${s[u]}`).join("&");
704
+ return c === this._workspaceLastSearchedIdentitiesKey ? this._workspaceSearchInFlightPromise || Promise.resolve() : (this.userIdentifiedInWorkspace = !1, this._workspaceLastSearchedIdentitiesKey = c, new Promise((u) => {
660
705
  try {
661
- n(t, s, (c) => {
662
- c?.httpCode === 200 && (this.userIdentifiedInWorkspace = !0), u();
706
+ n(t, s, (l) => {
707
+ l?.httpCode === 200 && (this.userIdentifiedInWorkspace = !0), u();
663
708
  });
664
- } catch (c) {
665
- console.error("Rokt Kit: Workspace IDSync search failed", c), this._workspaceLastSearchedIdentitiesKey = void 0, u();
709
+ } catch (l) {
710
+ console.error("Rokt Kit: Workspace IDSync search failed", l), this._workspaceLastSearchedIdentitiesKey = void 0, u();
666
711
  }
667
712
  }));
668
713
  }
@@ -703,28 +748,29 @@ const f = class f {
703
748
  const t = this._workspaceSearchInFlightPromise;
704
749
  return Promise.race([
705
750
  t,
706
- new Promise((n) => setTimeout(n, Pe))
751
+ new Promise((n) => setTimeout(n, Ye))
707
752
  ]).then(() => this._dispatchPlacements(e));
708
753
  }
709
754
  return this._dispatchPlacements(e);
710
755
  }
711
756
  _dispatchPlacements(e) {
712
- const t = e && e.attributes || {}, r = { ...b(this.userAttributes), ...t }, s = this.filters || {}, o = s.userAttributeFilters || [], l = s.filteredUser || null, u = l ? l.getMPID() : null;
713
- let c;
714
- s ? s.filterUserAttributes ? c = s.filterUserAttributes(r, o) : c = r : (console.warn("Rokt Kit: No filters available, using user attributes"), c = r), this.userAttributes = b(c);
715
- const p = this._onboardingExpProvider === "Optimizely" ? this.fetchOptimizely() : {}, C = this.returnUserIdentities(l), R = this.returnLocalSessionAttributes(), v = me(W(this.loggingService)), g = this.readMpSessionId(), y = this.readMpDeviceId(), E = {
716
- ...C,
717
- ...c,
718
- ...p,
719
- ...R,
720
- ...v.length ? { [be]: JSON.stringify(v) } : {},
721
- ...this.userIdentifiedInWorkspace ? { [Re]: !0 } : {},
722
- ...g ? { [Le]: g } : {},
723
- ...y ? { [Te]: y } : {},
757
+ const t = e && e.attributes || {}, r = { ...b(this.userAttributes), ...t }, s = this.filters || {}, o = s.userAttributeFilters || [], c = s.filteredUser || null, u = c ? c.getMPID() : null;
758
+ let l;
759
+ s ? s.filterUserAttributes ? l = s.filterUserAttributes(r, o) : l = r : (console.warn("Rokt Kit: No filters available, using user attributes"), l = r), this.userAttributes = b(l);
760
+ const g = this._onboardingExpProvider === "Optimizely" ? this.fetchOptimizely() : {}, M = this.returnUserIdentities(c), v = this.returnLocalSessionAttributes(), w = Ae(z(this.loggingService)), f = Re(), A = this.readMpSessionId(), I = this.readMpDeviceId(), k = {
761
+ ...M,
762
+ ...l,
763
+ ...g,
764
+ ...v,
765
+ ...w.length ? { [Me]: JSON.stringify(w) } : {},
766
+ ...f ? { [Ke]: f } : {},
767
+ ...this.userIdentifiedInWorkspace ? { [Ne]: !0 } : {},
768
+ ...A ? { [De]: A } : {},
769
+ ...I ? { [Fe]: I } : {},
724
770
  mpid: u
725
- }, w = { ...e, attributes: E }, h = this.launcher.selectPlacements(w), le = () => this.logSelectPlacementsEvent(E);
726
- return Promise.resolve(h).then((ue) => ue?.context?.sessionId?.then((de) => this.setRoktSessionId(de))).catch(() => {
727
- }).finally(le), h;
771
+ }, h = { ...e, attributes: k }, V = this.launcher.selectPlacements(h), fe = () => this.logSelectPlacementsEvent(k);
772
+ return Promise.resolve(V).then((me) => me?.context?.sessionId?.then((Ee) => this.setRoktSessionId(Ee))).catch(() => {
773
+ }).finally(fe), V;
728
774
  }
729
775
  /**
730
776
  * Passes attributes to the Rokt Web SDK for client-side hashing.
@@ -738,7 +784,7 @@ const f = class f {
738
784
  * @deprecated This functionality has been internalized and will be removed in a future release.
739
785
  */
740
786
  use(e) {
741
- return this.isKitReady() ? !e || !m(e) ? Promise.reject(new Error("Rokt Kit: Invalid extension name")) : this.launcher.use(e) : (console.error("Rokt Kit: Not initialized"), Promise.reject(new Error("Rokt Kit: Not initialized")));
787
+ return this.isKitReady() ? !e || !E(e) ? Promise.reject(new Error("Rokt Kit: Invalid extension name")) : this.launcher.use(e) : (console.error("Rokt Kit: Not initialized"), Promise.reject(new Error("Rokt Kit: Not initialized")));
742
788
  }
743
789
  /**
744
790
  * Registers a callback to be invoked once rokt-thank-you-element.js becomes available.
@@ -747,34 +793,34 @@ const f = class f {
747
793
  this._isThankYouElementLoaded ? e() : this._thankYouElementOnLoadCallback = e;
748
794
  }
749
795
  };
750
- f._allowedOriginHashes = [-553112570, 549508659], f.PERFORMANCE_MARKS = {
796
+ m._allowedOriginHashes = [-553112570, 549508659], m.PERFORMANCE_MARKS = {
751
797
  RoktScriptAppended: "mp:RoktScriptAppended"
752
- }, f.EMAIL_SHA256_KEY = "emailsha256";
753
- let S = f;
754
- function Ge() {
755
- return T;
798
+ }, m.EMAIL_SHA256_KEY = "emailsha256";
799
+ let y = m;
800
+ function Be() {
801
+ return L;
756
802
  }
757
- function We(i) {
803
+ function Qe(i) {
758
804
  if (!i) {
759
805
  window.console.log("You must pass a config object to register the kit " + d);
760
806
  return;
761
807
  }
762
- if (!I(i)) {
808
+ if (!_(i)) {
763
809
  window.console.log("'config' must be an object. You passed in a " + typeof i);
764
810
  return;
765
811
  }
766
- I(i.kits) ? i.kits[d] = {
767
- constructor: S
812
+ _(i.kits) ? i.kits[d] = {
813
+ constructor: y
768
814
  } : (i.kits = {}, i.kits[d] = {
769
- constructor: S
815
+ constructor: y
770
816
  }), window.console.log("Successfully registered " + d + " to your mParticle configuration");
771
817
  }
772
818
  typeof window < "u" && window.mParticle && a().addForwarder && a().addForwarder({
773
819
  name: d,
774
- constructor: S,
775
- getId: Ge
820
+ constructor: y,
821
+ getId: Be
776
822
  });
777
823
  export {
778
- We as register
824
+ Qe as register
779
825
  };
780
826
  //# sourceMappingURL=Rokt-Kit.esm.js.map
@@ -1,2 +1,2 @@
1
- var RoktKit=(function(C){"use strict";const ue=["active_time_on_site_ms","billingaddress1","billingaddress2","billingcity","billingstate","billingzipcode","cartitems","ccbin","confirmationref","conversiontype","country","couponcode","currency","language","paymentserviceprovider","paymentserviceproviderattribute","paymenttype","shippingaddress1","shippingcity","shippingcountry","shippingmethod","shippingstate","shippingzipcode","totalprice"],de=new Set(ue);function x(i){return de.has(i.toLowerCase())}function v(i){const e={},t=i||{},n=Object.keys(t);for(let r=0;r<n.length;r++){const s=n[r];x(s)||(e[s]=t[s])}return e}function E(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function m(i){return typeof i=="string"}function R(i){return typeof i=="function"}function U(i){return i==null?!0:typeof i=="object"?Object.keys(i).length===0:!1}function M(i){try{const e=new URL(i);return e.search="",e.toString()}catch{return i}}const G="__rokt_ls_probe__";function W(){try{return window.localStorage.setItem(G,"1"),window.localStorage.removeItem(G),!0}catch{return!1}}function w(i){try{const e=window.localStorage.getItem(i);return e===null?null:JSON.parse(e)}catch{return null}}function j(i,e){try{return window.localStorage.setItem(i,JSON.stringify(e)),!0}catch{return!1}}function V(i){try{window.localStorage.removeItem(i)}catch{}}function H(i,e){const t=w(i);return E(t)?t[e]:void 0}function z(i,e,t){const n=w(i),r=E(n)?{...n}:{};return r[e]=t,j(i,r)}function he(i,e){const t=w(i);if(!E(t)||!(e in t))return;const n={...t};delete n[e],Object.keys(n).length===0?V(i):j(i,n)}const y="mp-rokt-kit",A="pageViews",J="mpPageViews";function q(i){const e=w(J);if(e===null)return;!(H(y,A)!==void 0)&&Array.isArray(e)&&(i?.log({message:"Rokt Kit: Migrating legacy page-view storage",code:"PAGE_VIEW_LEGACY_MIGRATION"}),z(y,A,e)||i?.log({message:"Rokt Kit: Failed to migrate legacy page-view storage [reason: migration_retry]",code:"PAGE_VIEW_CAPTURE_FAILED"})),V(J)}function B(i){q(i);const e=H(y,A);return Array.isArray(e)?e:[]}function pe(i){return z(y,A,i.slice(-25))}function $(){he(y,A)}function ge(i){const e=i.slice(-25);return e.map((t,n)=>{const r=t.activeTimeOnSite,s=r!==void 0&&Number.isFinite(r),l=e[n+1]?.activeTimeOnSite,u=l!==void 0&&Number.isFinite(l),c=s&&u?l-r:void 0;return{pageUrl:t.pageUrl,sourceMessageId:t.sourceMessageId,timestamp:t.timestamp,...t.pageTitle!==void 0?{pageTitle:t.pageTitle}:{},...t.canonicalUrl!==void 0?{canonicalUrl:t.canonicalUrl}:{},...s?{activeTimeOnSite:r}:{},...c!==void 0&&c>=0?{activeTimeOnPage:c}:{}}})}function fe(){const e=document.querySelector('link[rel="canonical"]')?.href;if(e)return M(e)}const d="Rokt",b=181,me="selectPlacements",Ee="apps.roktecommerce.com",_e=.1,Ie="ThankYouPageJourney",Se="rokt-launcher",ye="rokt-thank-you-element",Ae="userIdentifiedInWorkspace",ke=3,ve=2,Re="page_events",we="mparticle_session_id",be="mparticle_device_id",Le=500,K={UNKNOWN_ERROR:"UNKNOWN_ERROR",UNHANDLED_EXCEPTION:"UNHANDLED_EXCEPTION",IDENTITY_REQUEST:"IDENTITY_REQUEST",LOG_DELIVERY_FAILURE:"LOG_DELIVERY_FAILURE"},_={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},Te="apps.rokt-api.com",Pe="/v1/log",Ne="/v1/errors",Oe=10;function a(){return window.mParticle}function Q(i,e){const n=[L(i),"/wsdk/integrations/launcher.js"].join("");return!e||e.length===0?n:n+"?extensions="+e.join(",")}function X(i){return[L(i),"/rokt-elements/rokt-element-thank-you.js"].join("")}function L(i){const e=typeof i<"u"?i:Te;return e.includes("://")?e.replace(/\/+$/,""):["https://",e].join("")}function Z(i,e,t){if(i)return i.startsWith("http://")||i.startsWith("https://")?i:"https://"+i;const r=e?.includes("://")&&!/^https?:\/\//i.test(e)?void 0:e;return L(r)+t}function ee(i,e,t){if(document.getElementById(i))return;const n=document.head||document.body,r=document.createElement("script");r.id=i,r.type="text/javascript",r.src=e,r.async=!0,r.crossOrigin="anonymous",r.fetchPriority="high",t?.onLoad&&(r.onload=t.onLoad),t?.onError&&(r.onerror=t.onError),n.appendChild(r)}function T(i){if(!i)return[];try{return JSON.parse(i.replace(/&quot;/g,'"'))}catch{console.error("Settings string contains invalid JSON")}return[]}function te(i){const e=i?T(i):[],t=[],n=[];let r=!1;for(let s=0;s<e.length;s++){const o=e[s].value;o==="thank-you-journey"?(r=!0,n.push(Ie)):t.push(o)}return{roktExtensionsQueryParams:t,legacyRoktExtensions:n,loadThankYouElement:r}}async function Ce(i,e){const t=[];if(e)for(const n of i)t.push(e.use(n));return Promise.all(t)}function ie(i){if(!i)return{};const e={};for(let t=0;t<i.length;t++){const n=i[t];e[n.jsmap]=n.value}return e}function ne(i){const e={};if(!Array.isArray(i))return e;for(let t=0;t<i.length;t++){const n=i[t];if(!n||!m(n.value)||!m(n.map))continue;const r=n.value,s=n.map;e[r]||(e[r]=[]),e[r].push({eventAttributeKey:s,conditions:Array.isArray(n.conditions)?n.conditions:[]})}return e}function re(i,e,t){return a().generateHash([i,e,t].join(""))}function Ue(i){let n="mParticle_wsdkv_"+a().getVersion()+"_kitv_"+"1.34.0";return i&&(n+="_"+i),n}function se(i){let e=5381;for(let t=0;t<i.length;t++)e=(e<<5)+e+i.charCodeAt(t),e=e&e;return e}function D(i){const e=document.createElement("iframe");e.style.display="none",e.setAttribute("sandbox","allow-scripts allow-same-origin"),e.src=i,e.onload=function(){e.onload=null,e.parentNode&&e.parentNode.removeChild(e)};const t=document.body||document.head;t&&t.appendChild(e)}function oe(i,e){const t=se(window.location.origin);if(I._allowedOriginHashes.indexOf(t)===-1||Math.random()>=_e)return;const r=window.__rokt_li_guid__;if(!r||i&&i.includes("://")&&!/^https:\/\//i.test(i))return;const s=window.location.href.split("?")[0].split("#")[0],o="version="+encodeURIComponent(e??"")+"&launcherInstanceGuid="+encodeURIComponent(r)+"&pageUrl="+encodeURIComponent(s),l=i?L(i):"https://apps.rokt.com";D(l+"/v1/wsdk-init/index.html?"+o),D("https://"+Ee+"/v1/wsdk-init/index.html?"+o+"&isControl=true")}function Me(){return typeof window<"u"&&!!window.location?.search?.toLowerCase().includes("mp_enable_logging=true")}function Ke(){return typeof window<"u"?window.location?.href:void 0}function De(){return typeof window<"u"?window.navigator?.userAgent:void 0}class ae{constructor(){this._logCount={}}incrementAndCheck(e){const n=(this._logCount[e]||0)+1;return this._logCount[e]=n,n>Oe}}class F{constructor(e,t,n,r,s){this._reporter="mp-wsdk";const o=e.isLoggingEnabled;this._integrationName=t||"",this._launcherInstanceGuid=n,this._accountId=r||null,this._rateLimiter=s||new ae,this._isEnabled=Me()||o}send(e,t,n,r,s,o){if(!(!this._isEnabled||this._rateLimiter.incrementAndCheck(t)))try{const l={additionalInformation:{message:n,version:this._integrationName},severity:t,code:r||K.UNKNOWN_ERROR,url:Ke(),deviceInfo:De(),stackTrace:s,reporter:this._reporter,integration:this._integrationName},u={Accept:"text/plain;charset=UTF-8","Content-Type":"application/json","rokt-launcher-version":this._integrationName,"rokt-wsdk-version":"joint"};this._launcherInstanceGuid&&(u["rokt-launcher-instance-guid"]=this._launcherInstanceGuid),this._accountId&&(u["rokt-account-id"]=this._accountId),fetch(e,{method:"POST",headers:u,body:JSON.stringify(l)}).then(c=>{if(!c.ok){const p=new Error("HTTP "+c.status+" from log endpoint");throw p.statusCode=c.status,p}}).catch(c=>{console.error("ReportingTransport: Failed to send log",c),o&&o(c)})}catch(l){console.error("ReportingTransport: Failed to send log",l),o&&o(l)}}}class ce{constructor(e,t,n,r,s){this._transport=new F(e,t,n,r,s),this._errorUrl=Z(e?.errorUrl,e?.integrationDomain,Ne)}report(e){if(!e)return;const t=e.severity||_.ERROR;this._transport.send(this._errorUrl,t,e.message,e.code,e.stackTrace)}}class le{constructor(e,t,n,r,s,o){this._transport=new F(e,n,r,s,o),this._loggingUrl=Z(e?.loggingUrl,e?.integrationDomain,Pe),this._errorReportingService=t}log(e){e&&this._transport.send(this._loggingUrl,_.INFO,e.message,e.code,void 0,t=>{if(this._errorReportingService){const n=typeof t.statusCode=="number";this._errorReportingService.report({message:"LoggingService: Failed to send log: "+t.message,code:K.LOG_DELIVERY_FAILURE,severity:n?_.ERROR:_.WARNING})}})}}function Fe(i){const e=M(window.location.href),t=i.EventAttributes?.title||document.title,n=fe(),r=i.ActiveTimeOnSite;return{pageUrl:e,sourceMessageId:i.SourceMessageId,timestamp:i.Timestamp,...t?{pageTitle:t}:{},...n!==void 0?{canonicalUrl:n}:{},...Number.isFinite(r)?{activeTimeOnSite:r}:{}}}const g=class g{constructor(){this.name=d,this.id=b,this.moduleId=b,this.isInitialized=!1,this.launcher=null,this.filters={},this.userAttributes={},this.userIdentifiedInWorkspace=!1,this.testHelpers=null,this.placementEventMappingLookup={},this.placementEventAttributeMappingLookup={},this.integrationName=null,this.errorReportingService=null,this.loggingService=null,this._thankYouElementOnLoadCallback=null,this._isThankYouElementLoaded=!1,this._workspaceSearchInFlightPromise=null}getEventAttributeValue(e,t){const n=e&&e.EventAttributes;return!n||typeof n[t]>"u"?null:n[t]}doesEventAttributeConditionMatch(e,t){if(!e||!m(e.operator))return!1;const n=e.operator.toLowerCase(),r=e.attributeValue;return n==="exists"?t!==null:t==null?!1:n==="equals"?String(t)===String(r):n==="contains"?String(t).indexOf(String(r))!==-1:!1}doesEventMatchRule(e,t){if(!t||!m(t.eventAttributeKey))return!1;const n=t.conditions;if(!Array.isArray(n))return!1;const r=this.getEventAttributeValue(e,t.eventAttributeKey);if(n.length===0)return r!==null;for(let s=0;s<n.length;s++)if(!this.doesEventAttributeConditionMatch(n[s],r))return!1;return!0}applyPlacementEventAttributeMapping(e){const t=Object.keys(this.placementEventAttributeMappingLookup);for(let n=0;n<t.length;n++){const r=t[n],s=this.placementEventAttributeMappingLookup[r];if(U(s))continue;let o=!0;for(let l=0;l<s.length;l++)if(!this.doesEventMatchRule(e,s[l])){o=!1;break}o&&a().Rokt.setLocalSessionAttribute?.(r,!0)}}capturePageView(e){let t;try{t=M(window.location.href);const n=B(this.loggingService),r=Fe(e);if(n.push(r),!pe(n)){const s=W()?"quota":"ls_unavailable";this.loggingService?.log({message:`Rokt Kit: Failed to persist page view for ${t} [reason: ${s}]`,code:"PAGE_VIEW_CAPTURE_FAILED"})}}catch(n){const r=W()?"exception":"ls_unavailable",s=n instanceof Error?n.message:String(n);this.loggingService?.log({message:`Rokt Kit: Failed to capture page view for ${t}: ${s} [reason: ${r}]`,code:"PAGE_VIEW_CAPTURE_FAILED"})}}isLauncherReadyToAttach(){return!!window.Rokt&&R(window.Rokt.createLauncher)}returnUserIdentities(e){if(!e||!e.getUserIdentities)return{};const t=e.getUserIdentities().userIdentities;return this.replaceOtherIdentityWithEmailsha256(t)}returnLocalSessionAttributes(){return!a().Rokt||typeof a().Rokt.getLocalSessionAttributes!="function"?{}:a().Rokt.getLocalSessionAttributes()}replaceOtherIdentityWithEmailsha256(e){const t={...e||{}},n=this._mappedEmailSha256Key;return n&&e[n]&&(t[g.EMAIL_SHA256_KEY]=e[n]),n&&delete t[n],t}logSelectPlacementsEvent(e){if(!window.mParticle||typeof a().logEvent!="function"||!E(e))return;const t=a().EventType.Other;a().logEvent(me,t,e)}setRoktSessionId(e){if(!(!e||typeof e!="string"))try{const t=a().getInstance();t&&R(t.setIntegrationAttribute)&&t.setIntegrationAttribute(b,{roktSessionId:e})}catch{}}readMpSessionId(){const e=a()?.sessionManager,t=e?.getSessionId??e?.getSession;if(R(t))return t.call(e)||void 0}readMpDeviceId(){return a()?.getDeviceId?.()||void 0}attachLauncher(e,t,n=[]){const r={accountId:e,...t||{}};let s;this.isPartnerInLocalLauncherTestGroup()?s=Promise.resolve(window.Rokt.createLocalLauncher(r)):s=window.Rokt.createLauncher(r),s.then(async o=>{await Ce(n,o),this.initRoktLauncher(o)}).catch(o=>{console.error("Error creating Rokt launcher:",o)})}initRoktLauncher(e){window.Rokt&&(window.Rokt.currentLauncher=e),this.launcher=e;const t=a().Rokt?.filters;t?(this.filters=t,t.filteredUser?this._workspaceSearchInFlightPromise=this.search(t.filteredUser):console.warn("Rokt Kit: No filtered user has been set.")):console.warn("Rokt Kit: No filters have been set."),this.isInitialized=!0,oe(this.domain,this.integrationName),a().Rokt.attachKit(this)}fetchOptimizely(){const e=a()._getActiveForwarders().filter(t=>t.name==="Optimizely");try{if(e.length>0&&window.optimizely){const t=window.optimizely.get("state");return!t||!t.getActiveExperimentIds?{}:t.getActiveExperimentIds().reduce((s,o)=>(s["rokt.custom.optimizely.experiment."+o+".variationId"]=t.getVariationMap()[o].id,s),{})}}catch(t){console.error("Error fetching Optimizely attributes:",t)}return{}}isKitReady(){return!!(this.isInitialized&&this.launcher)}isTargetingDisabled(){return a().Rokt?.launcherOptions?.noTargeting===!0}isPartnerInLocalLauncherTestGroup(){return!!(a().config&&a().config.isLocalLauncherEnabled&&this.isAssignedToSampleGroup())}isAssignedToSampleGroup(){return Math.random()>.5}captureTiming(e){window&&a()&&a().captureTiming&&e&&a().captureTiming(e)}init(e,t,n,r,s){const o=e,l=o.accountId;this.userAttributes=v(s),this._onboardingExpProvider=o.onboardingExpProvider;const u=T(o.placementEventMapping);this.placementEventMappingLookup=ie(u);const c=T(o.placementEventAttributeMapping);this.placementEventAttributeMappingLookup=ne(c),o.hashedEmailUserIdentityType&&(this._mappedEmailSha256Key=o.hashedEmailUserIdentityType.toLowerCase()),this._workspaceIdSyncApiKey=m(o.workspaceIdSyncApiKey)?o.workspaceIdSyncApiKey:void 0;const p=a().Rokt?.domain,{roktExtensionsQueryParams:Y,legacyRoktExtensions:P,loadThankYouElement:N}=te(o.roktExtensions),f={...a().Rokt?.launcherOptions||{}};this.integrationName=Ue(f.integrationName),f.integrationName=this.integrationName,this.domain=p;const k={loggingUrl:o.loggingUrl,errorUrl:o.errorUrl,integrationDomain:p,isLoggingEnabled:a().config?.isLoggingEnabled===!0},S=new ce(k,this.integrationName,window.__rokt_li_guid__,o.accountId),O=new le(k,S,this.integrationName,window.__rokt_li_guid__,o.accountId);if(this.errorReportingService=S,this.loggingService=O,this.isTargetingDisabled())try{$()}catch(h){this.errorReportingService?.report({message:"Rokt Kit: Failed to clear page views when targeting is disabled",code:"PAGE_VIEW_CAPTURE_FAILED",severity:_.INFO,stackTrace:h instanceof Error?h.stack:void 0})}return a()._registerErrorReportingService&&a()._registerErrorReportingService(S),a()._registerLoggingService&&a()._registerLoggingService(O),n?(this.testHelpers={generateLauncherScript:Q,generateThankYouElementScript:X,extractRoktExtensionConfig:te,hashEventMessage:re,parseSettingsString:T,generateMappedEventLookup:ie,generateMappedEventAttributeLookup:ne,sendAdBlockMeasurementSignals:oe,createAutoRemovedIframe:D,djb2:se,setAllowedOriginHashes:h=>{g._allowedOriginHashes=h},ReportingTransport:F,ErrorReportingService:ce,LoggingService:le,RateLimiter:ae,ErrorCodes:K,WSDKErrorSeverity:_},this.attachLauncher(l,f),"Successfully initialized: "+d):(N&&(a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this),ee(ye,X(p),{onLoad:()=>{this._isThankYouElementLoaded=!0,this._thankYouElementOnLoadCallback&&this._thankYouElementOnLoadCallback()},onError:h=>{console.error("Error loading Rokt Thank You Element script:",h)}})),this.isLauncherReadyToAttach()?this.attachLauncher(l,f,P):(ee(Se,Q(p,Y),{onLoad:()=>{this.isLauncherReadyToAttach()?this.attachLauncher(l,f,P):console.error("Rokt object is not available after script load.")},onError:h=>{console.error("Error loading Rokt launcher script:",h)}}),this.captureTiming(g.PERFORMANCE_MARKS.RoktScriptAppended)),"Successfully initialized: "+d)}process(e){if(this.isTargetingDisabled()||(e.EventDataType===ke&&this.capturePageView(e),e.EventDataType===ve&&(q(this.loggingService),$())),!this.isKitReady())return"Kit not ready for forwarder: "+d;if(R(a().Rokt?.setLocalSessionAttribute)&&(U(this.placementEventAttributeMappingLookup)||this.applyPlacementEventAttributeMapping(e),!U(this.placementEventMappingLookup))){const t=re(e.EventDataType,e.EventCategory,e.EventName??"");this.placementEventMappingLookup[String(t)]&&a().Rokt.setLocalSessionAttribute?.(this.placementEventMappingLookup[String(t)],!0)}return"Successfully sent to forwarder: "+d}setExtensionData(e){if(!this.isKitReady()){console.error("Rokt Kit: Not initialized");return}window.Rokt.setExtensionData(e)}setUserAttribute(e,t){return x(e)||(this.userAttributes[e]=t),"Successfully set user attribute for forwarder: "+d}removeUserAttribute(e){return delete this.userAttributes[e],"Successfully removed user attribute for forwarder: "+d}handleIdentityComplete(e,t){return this.userAttributes=v(e.getAllUserAttributes()),"Successfully called "+t+" for forwarder: "+d}onUserIdentified(e){const t=e;return this.filters.filteredUser=t,this._workspaceSearchInFlightPromise=this.search(t),this.handleIdentityComplete(e,"onUserIdentified")}search(e){const t=this._workspaceIdSyncApiKey;if(!t)return this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=void 0,Promise.resolve();const n=a().Identity?.search;if(typeof n!="function")return this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=void 0,Promise.resolve();const r=e.getUserIdentities?e.getUserIdentities().userIdentities:null,s={};if(r)for(const u of Object.keys(r)){const c=r[u];m(c)&&c.length>0&&(s[u]=c)}const o=Object.keys(s);if(o.length===0)return this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=void 0,Promise.resolve();const l=o.sort().map(u=>`${u}=${s[u]}`).join("&");return l===this._workspaceLastSearchedIdentitiesKey?this._workspaceSearchInFlightPromise||Promise.resolve():(this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=l,new Promise(u=>{try{n(t,s,c=>{c?.httpCode===200&&(this.userIdentifiedInWorkspace=!0),u()})}catch(c){console.error("Rokt Kit: Workspace IDSync search failed",c),this._workspaceLastSearchedIdentitiesKey=void 0,u()}}))}onLoginComplete(e,t){return this.handleIdentityComplete(e,"onLoginComplete")}onLogoutComplete(e,t){return this.userIdentifiedInWorkspace=!1,this._workspaceSearchInFlightPromise=null,this._workspaceLastSearchedIdentitiesKey=void 0,this.handleIdentityComplete(e,"onLogoutComplete")}onModifyComplete(e,t){return this.handleIdentityComplete(e,"onModifyComplete")}selectPlacements(e){if(this._workspaceSearchInFlightPromise){const t=this._workspaceSearchInFlightPromise;return Promise.race([t,new Promise(n=>setTimeout(n,Le))]).then(()=>this._dispatchPlacements(e))}return this._dispatchPlacements(e)}_dispatchPlacements(e){const t=e&&e.attributes||{},r={...v(this.userAttributes),...t},s=this.filters||{},o=s.userAttributeFilters||[],l=s.filteredUser||null,u=l?l.getMPID():null;let c;s?s.filterUserAttributes?c=s.filterUserAttributes(r,o):c=r:(console.warn("Rokt Kit: No filters available, using user attributes"),c=r),this.userAttributes=v(c);const p=this._onboardingExpProvider==="Optimizely"?this.fetchOptimizely():{},Y=this.returnUserIdentities(l),P=this.returnLocalSessionAttributes(),N=ge(B(this.loggingService)),f=this.readMpSessionId(),k=this.readMpDeviceId(),S={...Y,...c,...p,...P,...N.length?{[Re]:JSON.stringify(N)}:{},...this.userIdentifiedInWorkspace?{[Ae]:!0}:{},...f?{[we]:f}:{},...k?{[be]:k}:{},mpid:u},O={...e,attributes:S},h=this.launcher.selectPlacements(O),Ge=()=>this.logSelectPlacementsEvent(S);return Promise.resolve(h).then(We=>We?.context?.sessionId?.then(je=>this.setRoktSessionId(je))).catch(()=>{}).finally(Ge),h}hashAttributes(e){return this.isKitReady()?this.launcher.hashAttributes(e):(console.error("Rokt Kit: Not initialized"),null)}use(e){return this.isKitReady()?!e||!m(e)?Promise.reject(new Error("Rokt Kit: Invalid extension name")):this.launcher.use(e):(console.error("Rokt Kit: Not initialized"),Promise.reject(new Error("Rokt Kit: Not initialized")))}onShoppableAdsReady(e){this._isThankYouElementLoaded?e():this._thankYouElementOnLoadCallback=e}};g._allowedOriginHashes=[-553112570,549508659],g.PERFORMANCE_MARKS={RoktScriptAppended:"mp:RoktScriptAppended"},g.EMAIL_SHA256_KEY="emailsha256";let I=g;function Ye(){return b}function xe(i){if(!i){window.console.log("You must pass a config object to register the kit "+d);return}if(!E(i)){window.console.log("'config' must be an object. You passed in a "+typeof i);return}E(i.kits)?i.kits[d]={constructor:I}:(i.kits={},i.kits[d]={constructor:I}),window.console.log("Successfully registered "+d+" to your mParticle configuration")}return typeof window<"u"&&window.mParticle&&a().addForwarder&&a().addForwarder({name:d,constructor:I,getId:Ye}),C.register=xe,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"}),C})({});
1
+ var RoktKit=(function(M){"use strict";const me=["active_time_on_site_ms","billingaddress1","billingaddress2","billingcity","billingstate","billingzipcode","cartitems","ccbin","confirmationref","conversiontype","country","couponcode","currency","language","paymentserviceprovider","paymentserviceproviderattribute","paymenttype","shippingaddress1","shippingcity","shippingcountry","shippingmethod","shippingstate","shippingzipcode","totalprice"],Ee=new Set(me);function V(i){return Ee.has(i.toLowerCase())}function R(i){const e={},t=i||{},n=Object.keys(t);for(let r=0;r<n.length;r++){const s=n[r];V(s)||(e[s]=t[s])}return e}function E(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function _(i){return typeof i=="string"}function w(i){return typeof i=="function"}function K(i){return i==null?!0:typeof i=="object"?Object.keys(i).length===0:!1}function D(i){try{const e=new URL(i);return e.search="",e.toString()}catch{return i}}const H="__rokt_ls_probe__";function F(){try{return window.localStorage.setItem(H,"1"),window.localStorage.removeItem(H),!0}catch{return!1}}function b(i){try{const e=window.localStorage.getItem(i);return e===null?null:JSON.parse(e)}catch{return null}}function z(i,e){try{return window.localStorage.setItem(i,JSON.stringify(e)),!0}catch{return!1}}function q(i){try{window.localStorage.removeItem(i)}catch{}}function T(i,e){const t=b(i);return E(t)?t[e]:void 0}function Y(i,e,t){const n=b(i),r=E(n)?{...n}:{};return r[e]=t,z(i,r)}function $(i,e){const t=b(i);if(!E(t)||!(e in t))return;const n={...t};delete n[e],Object.keys(n).length===0?q(i):z(i,n)}const g="mp-rokt-kit",A="pageViews",L="utmParams",J="mpPageViews",B=25,_e=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function Q(i){return i.slice(-B)}function X(i){const e=b(J);if(e===null)return;!(T(g,A)!==void 0)&&Array.isArray(e)&&(i?.log({message:"Rokt Kit: Migrating legacy page-view storage",code:"PAGE_VIEW_LEGACY_MIGRATION"}),Y(g,A,e)||i?.log({message:"Rokt Kit: Failed to migrate legacy page-view storage [reason: migration_retry]",code:"PAGE_VIEW_CAPTURE_FAILED"})),q(J)}function Z(i){X(i);const e=T(g,A);return Array.isArray(e)?e:[]}function Ie(i){const e=Q(i);for(let t=0;t<e.length;t++){const n=e.slice(t);if(Y(g,A,n))return n.length}return 0}function ee(){$(g,A)}function Se(i){const e=Q(i);return e.map((t,n)=>{const r=t.activeTimeOnSite,s=r!==void 0&&Number.isFinite(r),c=e[n+1]?.activeTimeOnSite,u=c!==void 0&&Number.isFinite(c),l=s&&u?c-r:void 0;return{pageUrl:t.pageUrl,sourceMessageId:t.sourceMessageId,timestamp:t.timestamp,...t.pageTitle!==void 0?{pageTitle:t.pageTitle}:{},...t.canonicalUrl!==void 0?{canonicalUrl:t.canonicalUrl}:{},...s?{activeTimeOnSite:r}:{},...l!==void 0&&l>=0?{activeTimeOnPage:l}:{}}})}function ye(i){if(T(g,L)!==void 0)return;const e=new URLSearchParams(window.location.search),t={};for(const r of _e){const s=e.get(r);s&&(t[r]=s)}if(Object.keys(t).length===0)return;const n=Object.keys(t).join(", ");if(!Y(g,L,t)){const r=F()?"quota":"ls_unavailable";i?.log({message:`Rokt Kit: Failed to persist UTM params [reason: ${r}]`,code:"UTM_CAPTURE_FAILED"});return}i?.log({message:`Rokt Kit: Captured UTM params [${n}]`,code:"UTM_CAPTURE_SUCCESS"})}function Ae(){const i=T(g,L);return E(i)?i:null}function te(){$(g,L)}function ke(){const e=document.querySelector('link[rel="canonical"]')?.href;if(e)return D(e)}const d="Rokt",P=181,ve="selectPlacements",Re="apps.roktecommerce.com",we=.1,be="ThankYouPageJourney",Te="rokt-launcher",Le="rokt-thank-you-element",Pe="userIdentifiedInWorkspace",Oe=3,Ne=2,Ue="page_events",Ce="page_view_attributes",Me="mparticle_session_id",Ke="mparticle_device_id",De=500,G={UNKNOWN_ERROR:"UNKNOWN_ERROR",UNHANDLED_EXCEPTION:"UNHANDLED_EXCEPTION",IDENTITY_REQUEST:"IDENTITY_REQUEST",LOG_DELIVERY_FAILURE:"LOG_DELIVERY_FAILURE"},I={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},Fe="apps.rokt-api.com",Ye="/v1/log",Ge="/v1/errors",xe=10;function a(){return window.mParticle}function ie(i,e){const n=[O(i),"/wsdk/integrations/launcher.js"].join("");return!e||e.length===0?n:n+"?extensions="+e.join(",")}function ne(i){return[O(i),"/rokt-elements/rokt-element-thank-you.js"].join("")}function O(i){const e=typeof i<"u"?i:Fe;return e.includes("://")?e.replace(/\/+$/,""):["https://",e].join("")}function re(i,e,t){if(i)return i.startsWith("http://")||i.startsWith("https://")?i:"https://"+i;const r=e?.includes("://")&&!/^https?:\/\//i.test(e)?void 0:e;return O(r)+t}function se(i,e,t){if(document.getElementById(i))return;const n=document.head||document.body,r=document.createElement("script");r.id=i,r.type="text/javascript",r.src=e,r.async=!0,r.crossOrigin="anonymous",r.fetchPriority="high",t?.onLoad&&(r.onload=t.onLoad),t?.onError&&(r.onerror=t.onError),n.appendChild(r)}function N(i){if(!i)return[];try{return JSON.parse(i.replace(/&quot;/g,'"'))}catch{console.error("Settings string contains invalid JSON")}return[]}function oe(i){const e=i?N(i):[],t=[],n=[];let r=!1;for(let s=0;s<e.length;s++){const o=e[s].value;o==="thank-you-journey"?(r=!0,n.push(be)):t.push(o)}return{roktExtensionsQueryParams:t,legacyRoktExtensions:n,loadThankYouElement:r}}async function We(i,e){const t=[];if(e)for(const n of i)t.push(e.use(n));return Promise.all(t)}function ae(i){if(!i)return{};const e={};for(let t=0;t<i.length;t++){const n=i[t];e[n.jsmap]=n.value}return e}function ce(i){const e={};if(!Array.isArray(i))return e;for(let t=0;t<i.length;t++){const n=i[t];if(!n||!_(n.value)||!_(n.map))continue;const r=n.value,s=n.map;e[r]||(e[r]=[]),e[r].push({eventAttributeKey:s,conditions:Array.isArray(n.conditions)?n.conditions:[]})}return e}function le(i,e,t){return a().generateHash([i,e,t].join(""))}function je(i){let n="mParticle_wsdkv_"+a().getVersion()+"_kitv_"+"1.35.0";return i&&(n+="_"+i),n}function ue(i){let e=5381;for(let t=0;t<i.length;t++)e=(e<<5)+e+i.charCodeAt(t),e=e&e;return e}function x(i){const e=document.createElement("iframe");e.style.display="none",e.setAttribute("sandbox","allow-scripts allow-same-origin"),e.src=i,e.onload=function(){e.onload=null,e.parentNode&&e.parentNode.removeChild(e)};const t=document.body||document.head;t&&t.appendChild(e)}function de(i,e){const t=ue(window.location.origin);if(S._allowedOriginHashes.indexOf(t)===-1||Math.random()>=we)return;const r=window.__rokt_li_guid__;if(!r||i&&i.includes("://")&&!/^https:\/\//i.test(i))return;const s=window.location.href.split("?")[0].split("#")[0],o="version="+encodeURIComponent(e??"")+"&launcherInstanceGuid="+encodeURIComponent(r)+"&pageUrl="+encodeURIComponent(s),c=i?O(i):"https://apps.rokt.com";x(c+"/v1/wsdk-init/index.html?"+o),x("https://"+Re+"/v1/wsdk-init/index.html?"+o+"&isControl=true")}function Ve(){return typeof window<"u"&&!!window.location?.search?.toLowerCase().includes("mp_enable_logging=true")}function He(){return typeof window<"u"?window.location?.href:void 0}function ze(){return typeof window<"u"?window.navigator?.userAgent:void 0}class he{constructor(){this._logCount={}}incrementAndCheck(e){const n=(this._logCount[e]||0)+1;return this._logCount[e]=n,n>xe}}class W{constructor(e,t,n,r,s){this._reporter="mp-wsdk";const o=e.isLoggingEnabled;this._integrationName=t||"",this._launcherInstanceGuid=n,this._accountId=r||null,this._rateLimiter=s||new he,this._isEnabled=Ve()||o}send(e,t,n,r,s,o){if(!(!this._isEnabled||this._rateLimiter.incrementAndCheck(t)))try{const c={additionalInformation:{message:n,version:this._integrationName},severity:t,code:r||G.UNKNOWN_ERROR,url:He(),deviceInfo:ze(),stackTrace:s,reporter:this._reporter,integration:this._integrationName},u={Accept:"text/plain;charset=UTF-8","Content-Type":"application/json","rokt-launcher-version":this._integrationName,"rokt-wsdk-version":"joint"};this._launcherInstanceGuid&&(u["rokt-launcher-instance-guid"]=this._launcherInstanceGuid),this._accountId&&(u["rokt-account-id"]=this._accountId),fetch(e,{method:"POST",headers:u,body:JSON.stringify(c)}).then(l=>{if(!l.ok){const p=new Error("HTTP "+l.status+" from log endpoint");throw p.statusCode=l.status,p}}).catch(l=>{console.error("ReportingTransport: Failed to send log",l),o&&o(l)})}catch(c){console.error("ReportingTransport: Failed to send log",c),o&&o(c)}}}class ge{constructor(e,t,n,r,s){this._transport=new W(e,t,n,r,s),this._errorUrl=re(e?.errorUrl,e?.integrationDomain,Ge)}report(e){if(!e)return;const t=e.severity||I.ERROR;this._transport.send(this._errorUrl,t,e.message,e.code,e.stackTrace)}}class pe{constructor(e,t,n,r,s,o){this._transport=new W(e,n,r,s,o),this._loggingUrl=re(e?.loggingUrl,e?.integrationDomain,Ye),this._errorReportingService=t}log(e){e&&this._transport.send(this._loggingUrl,I.INFO,e.message,e.code,void 0,t=>{if(this._errorReportingService){const n=typeof t.statusCode=="number";this._errorReportingService.report({message:"LoggingService: Failed to send log: "+t.message,code:G.LOG_DELIVERY_FAILURE,severity:n?I.ERROR:I.WARNING})}})}}function qe(i){const e=D(window.location.href),t=i.EventAttributes?.title||document.title,n=ke(),r=i.ActiveTimeOnSite;return{pageUrl:e,sourceMessageId:i.SourceMessageId,timestamp:i.Timestamp,...t?{pageTitle:t}:{},...n!==void 0?{canonicalUrl:n}:{},...Number.isFinite(r)?{activeTimeOnSite:r}:{}}}const f=class f{constructor(){this.name=d,this.id=P,this.moduleId=P,this.isInitialized=!1,this.launcher=null,this.filters={},this.userAttributes={},this.userIdentifiedInWorkspace=!1,this.testHelpers=null,this.placementEventMappingLookup={},this.placementEventAttributeMappingLookup={},this.integrationName=null,this.errorReportingService=null,this.loggingService=null,this._thankYouElementOnLoadCallback=null,this._isThankYouElementLoaded=!1,this._workspaceSearchInFlightPromise=null}getEventAttributeValue(e,t){const n=e&&e.EventAttributes;return!n||typeof n[t]>"u"?null:n[t]}doesEventAttributeConditionMatch(e,t){if(!e||!_(e.operator))return!1;const n=e.operator.toLowerCase(),r=e.attributeValue;return n==="exists"?t!==null:t==null?!1:n==="equals"?String(t)===String(r):n==="contains"?String(t).indexOf(String(r))!==-1:!1}doesEventMatchRule(e,t){if(!t||!_(t.eventAttributeKey))return!1;const n=t.conditions;if(!Array.isArray(n))return!1;const r=this.getEventAttributeValue(e,t.eventAttributeKey);if(n.length===0)return r!==null;for(let s=0;s<n.length;s++)if(!this.doesEventAttributeConditionMatch(n[s],r))return!1;return!0}applyPlacementEventAttributeMapping(e){const t=Object.keys(this.placementEventAttributeMappingLookup);for(let n=0;n<t.length;n++){const r=t[n],s=this.placementEventAttributeMappingLookup[r];if(K(s))continue;let o=!0;for(let c=0;c<s.length;c++)if(!this.doesEventMatchRule(e,s[c])){o=!1;break}o&&a().Rokt.setLocalSessionAttribute?.(r,!0)}}capturePageView(e){let t;try{t=D(window.location.href);const n=Z(this.loggingService),r=qe(e);n.push(r);const s=Math.min(n.length,B),o=Ie(n);if(o===0){const c=F()?"quota":"ls_unavailable";this.loggingService?.log({message:`Rokt Kit: Failed to persist page view for ${t} [reason: ${c}]`,code:"PAGE_VIEW_CAPTURE_FAILED"})}else o<s&&this.loggingService?.log({message:`Rokt Kit: Page view storage reduced from ${s} to ${o} record(s) under quota pressure [reason: quota_eviction]`,code:"PAGE_VIEW_QUOTA_EVICTION"})}catch(n){const r=F()?"exception":"ls_unavailable",s=n instanceof Error?n.message:String(n);this.loggingService?.log({message:`Rokt Kit: Failed to capture page view for ${t}: ${s} [reason: ${r}]`,code:"PAGE_VIEW_CAPTURE_FAILED"})}}isLauncherReadyToAttach(){return!!window.Rokt&&w(window.Rokt.createLauncher)}returnUserIdentities(e){if(!e||!e.getUserIdentities)return{};const t=e.getUserIdentities().userIdentities;return this.replaceOtherIdentityWithEmailsha256(t)}returnLocalSessionAttributes(){return!a().Rokt||typeof a().Rokt.getLocalSessionAttributes!="function"?{}:a().Rokt.getLocalSessionAttributes()}replaceOtherIdentityWithEmailsha256(e){const t={...e||{}},n=this._mappedEmailSha256Key;return n&&e[n]&&(t[f.EMAIL_SHA256_KEY]=e[n]),n&&delete t[n],t}logSelectPlacementsEvent(e){if(!window.mParticle||typeof a().logEvent!="function"||!E(e))return;const t=a().EventType.Other;a().logEvent(ve,t,e)}setRoktSessionId(e){if(!(!e||typeof e!="string"))try{const t=a().getInstance();t&&w(t.setIntegrationAttribute)&&t.setIntegrationAttribute(P,{roktSessionId:e})}catch{}}readMpSessionId(){const e=a()?.sessionManager,t=e?.getSessionId??e?.getSession;if(w(t))return t.call(e)||void 0}readMpDeviceId(){return a()?.getDeviceId?.()||void 0}attachLauncher(e,t,n=[]){const r={accountId:e,...t||{}};let s;this.isPartnerInLocalLauncherTestGroup()?s=Promise.resolve(window.Rokt.createLocalLauncher(r)):s=window.Rokt.createLauncher(r),s.then(async o=>{await We(n,o),this.initRoktLauncher(o)}).catch(o=>{console.error("Error creating Rokt launcher:",o)})}initRoktLauncher(e){window.Rokt&&(window.Rokt.currentLauncher=e),this.launcher=e;const t=a().Rokt?.filters;t?(this.filters=t,t.filteredUser?this._workspaceSearchInFlightPromise=this.search(t.filteredUser):console.warn("Rokt Kit: No filtered user has been set.")):console.warn("Rokt Kit: No filters have been set."),this.isInitialized=!0,de(this.domain,this.integrationName),a().Rokt.attachKit(this)}fetchOptimizely(){const e=a()._getActiveForwarders().filter(t=>t.name==="Optimizely");try{if(e.length>0&&window.optimizely){const t=window.optimizely.get("state");return!t||!t.getActiveExperimentIds?{}:t.getActiveExperimentIds().reduce((s,o)=>(s["rokt.custom.optimizely.experiment."+o+".variationId"]=t.getVariationMap()[o].id,s),{})}}catch(t){console.error("Error fetching Optimizely attributes:",t)}return{}}isKitReady(){return!!(this.isInitialized&&this.launcher)}isTargetingDisabled(){return a().Rokt?.launcherOptions?.noTargeting===!0}isPartnerInLocalLauncherTestGroup(){return!!(a().config&&a().config.isLocalLauncherEnabled&&this.isAssignedToSampleGroup())}isAssignedToSampleGroup(){return Math.random()>.5}captureTiming(e){window&&a()&&a().captureTiming&&e&&a().captureTiming(e)}init(e,t,n,r,s){const o=e,c=o.accountId;this.userAttributes=R(s),this._onboardingExpProvider=o.onboardingExpProvider;const u=N(o.placementEventMapping);this.placementEventMappingLookup=ae(u);const l=N(o.placementEventAttributeMapping);this.placementEventAttributeMappingLookup=ce(l),o.hashedEmailUserIdentityType&&(this._mappedEmailSha256Key=o.hashedEmailUserIdentityType.toLowerCase()),this._workspaceIdSyncApiKey=_(o.workspaceIdSyncApiKey)?o.workspaceIdSyncApiKey:void 0;const p=a().Rokt?.domain,{roktExtensionsQueryParams:j,legacyRoktExtensions:U,loadThankYouElement:C}=oe(o.roktExtensions),m={...a().Rokt?.launcherOptions||{}};this.integrationName=je(m.integrationName),m.integrationName=this.integrationName,this.domain=p;const k={loggingUrl:o.loggingUrl,errorUrl:o.errorUrl,integrationDomain:p,isLoggingEnabled:a().config?.isLoggingEnabled===!0},y=new ge(k,this.integrationName,window.__rokt_li_guid__,o.accountId),v=new pe(k,y,this.integrationName,window.__rokt_li_guid__,o.accountId);if(this.errorReportingService=y,this.loggingService=v,this.isTargetingDisabled())try{ee(),te()}catch(h){this.errorReportingService?.report({message:"Rokt Kit: Failed to clear page views when targeting is disabled",code:"PAGE_VIEW_CAPTURE_FAILED",severity:I.INFO,stackTrace:h instanceof Error?h.stack:void 0})}return a()._registerErrorReportingService&&a()._registerErrorReportingService(y),a()._registerLoggingService&&a()._registerLoggingService(v),n?(this.testHelpers={generateLauncherScript:ie,generateThankYouElementScript:ne,extractRoktExtensionConfig:oe,hashEventMessage:le,parseSettingsString:N,generateMappedEventLookup:ae,generateMappedEventAttributeLookup:ce,sendAdBlockMeasurementSignals:de,createAutoRemovedIframe:x,djb2:ue,setAllowedOriginHashes:h=>{f._allowedOriginHashes=h},ReportingTransport:W,ErrorReportingService:ge,LoggingService:pe,RateLimiter:he,ErrorCodes:G,WSDKErrorSeverity:I},this.attachLauncher(c,m),"Successfully initialized: "+d):(C&&(a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this),se(Le,ne(p),{onLoad:()=>{this._isThankYouElementLoaded=!0,this._thankYouElementOnLoadCallback&&this._thankYouElementOnLoadCallback()},onError:h=>{console.error("Error loading Rokt Thank You Element script:",h)}})),this.isLauncherReadyToAttach()?this.attachLauncher(c,m,U):(se(Te,ie(p,j),{onLoad:()=>{this.isLauncherReadyToAttach()?this.attachLauncher(c,m,U):console.error("Rokt object is not available after script load.")},onError:h=>{console.error("Error loading Rokt launcher script:",h)}}),this.captureTiming(f.PERFORMANCE_MARKS.RoktScriptAppended)),"Successfully initialized: "+d)}process(e){if(this.isTargetingDisabled()||(e.EventDataType===Oe&&(ye(this.loggingService),this.capturePageView(e)),e.EventDataType===Ne&&(X(this.loggingService),ee(),te())),!this.isKitReady())return"Kit not ready for forwarder: "+d;if(w(a().Rokt?.setLocalSessionAttribute)&&(K(this.placementEventAttributeMappingLookup)||this.applyPlacementEventAttributeMapping(e),!K(this.placementEventMappingLookup))){const t=le(e.EventDataType,e.EventCategory,e.EventName??"");this.placementEventMappingLookup[String(t)]&&a().Rokt.setLocalSessionAttribute?.(this.placementEventMappingLookup[String(t)],!0)}return"Successfully sent to forwarder: "+d}setExtensionData(e){if(!this.isKitReady()){console.error("Rokt Kit: Not initialized");return}window.Rokt.setExtensionData(e)}setUserAttribute(e,t){return V(e)||(this.userAttributes[e]=t),"Successfully set user attribute for forwarder: "+d}removeUserAttribute(e){return delete this.userAttributes[e],"Successfully removed user attribute for forwarder: "+d}handleIdentityComplete(e,t){return this.userAttributes=R(e.getAllUserAttributes()),"Successfully called "+t+" for forwarder: "+d}onUserIdentified(e){const t=e;return this.filters.filteredUser=t,this._workspaceSearchInFlightPromise=this.search(t),this.handleIdentityComplete(e,"onUserIdentified")}search(e){const t=this._workspaceIdSyncApiKey;if(!t)return this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=void 0,Promise.resolve();const n=a().Identity?.search;if(typeof n!="function")return this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=void 0,Promise.resolve();const r=e.getUserIdentities?e.getUserIdentities().userIdentities:null,s={};if(r)for(const u of Object.keys(r)){const l=r[u];_(l)&&l.length>0&&(s[u]=l)}const o=Object.keys(s);if(o.length===0)return this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=void 0,Promise.resolve();const c=o.sort().map(u=>`${u}=${s[u]}`).join("&");return c===this._workspaceLastSearchedIdentitiesKey?this._workspaceSearchInFlightPromise||Promise.resolve():(this.userIdentifiedInWorkspace=!1,this._workspaceLastSearchedIdentitiesKey=c,new Promise(u=>{try{n(t,s,l=>{l?.httpCode===200&&(this.userIdentifiedInWorkspace=!0),u()})}catch(l){console.error("Rokt Kit: Workspace IDSync search failed",l),this._workspaceLastSearchedIdentitiesKey=void 0,u()}}))}onLoginComplete(e,t){return this.handleIdentityComplete(e,"onLoginComplete")}onLogoutComplete(e,t){return this.userIdentifiedInWorkspace=!1,this._workspaceSearchInFlightPromise=null,this._workspaceLastSearchedIdentitiesKey=void 0,this.handleIdentityComplete(e,"onLogoutComplete")}onModifyComplete(e,t){return this.handleIdentityComplete(e,"onModifyComplete")}selectPlacements(e){if(this._workspaceSearchInFlightPromise){const t=this._workspaceSearchInFlightPromise;return Promise.race([t,new Promise(n=>setTimeout(n,De))]).then(()=>this._dispatchPlacements(e))}return this._dispatchPlacements(e)}_dispatchPlacements(e){const t=e&&e.attributes||{},r={...R(this.userAttributes),...t},s=this.filters||{},o=s.userAttributeFilters||[],c=s.filteredUser||null,u=c?c.getMPID():null;let l;s?s.filterUserAttributes?l=s.filterUserAttributes(r,o):l=r:(console.warn("Rokt Kit: No filters available, using user attributes"),l=r),this.userAttributes=R(l);const p=this._onboardingExpProvider==="Optimizely"?this.fetchOptimizely():{},j=this.returnUserIdentities(c),U=this.returnLocalSessionAttributes(),C=Se(Z(this.loggingService)),m=Ae(),k=this.readMpSessionId(),y=this.readMpDeviceId(),v={...j,...l,...p,...U,...C.length?{[Ue]:JSON.stringify(C)}:{},...m?{[Ce]:m}:{},...this.userIdentifiedInWorkspace?{[Pe]:!0}:{},...k?{[Me]:k}:{},...y?{[Ke]:y}:{},mpid:u},h={...e,attributes:v},fe=this.launcher.selectPlacements(h),Be=()=>this.logSelectPlacementsEvent(v);return Promise.resolve(fe).then(Qe=>Qe?.context?.sessionId?.then(Xe=>this.setRoktSessionId(Xe))).catch(()=>{}).finally(Be),fe}hashAttributes(e){return this.isKitReady()?this.launcher.hashAttributes(e):(console.error("Rokt Kit: Not initialized"),null)}use(e){return this.isKitReady()?!e||!_(e)?Promise.reject(new Error("Rokt Kit: Invalid extension name")):this.launcher.use(e):(console.error("Rokt Kit: Not initialized"),Promise.reject(new Error("Rokt Kit: Not initialized")))}onShoppableAdsReady(e){this._isThankYouElementLoaded?e():this._thankYouElementOnLoadCallback=e}};f._allowedOriginHashes=[-553112570,549508659],f.PERFORMANCE_MARKS={RoktScriptAppended:"mp:RoktScriptAppended"},f.EMAIL_SHA256_KEY="emailsha256";let S=f;function $e(){return P}function Je(i){if(!i){window.console.log("You must pass a config object to register the kit "+d);return}if(!E(i)){window.console.log("'config' must be an object. You passed in a "+typeof i);return}E(i.kits)?i.kits[d]={constructor:S}:(i.kits={},i.kits[d]={constructor:S}),window.console.log("Successfully registered "+d+" to your mParticle configuration")}return typeof window<"u"&&window.mParticle&&a().addForwarder&&a().addForwarder({name:d,constructor:S,getId:$e}),M.register=Je,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"}),M})({});
2
2
  //# sourceMappingURL=Rokt-Kit.iife.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-rokt-kit",
3
- "version": "1.34.0",
3
+ "version": "1.35.0",
4
4
  "description": "mParticle integration kit for Rokt",
5
5
  "main": "dist/Rokt-Kit.common.js",
6
6
  "module": "dist/Rokt-Kit.esm.js",