@mparticle/web-rokt-kit 3.8.1 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Rokt-Kit.common.js +1 -1
- package/dist/Rokt-Kit.esm.js +308 -255
- package/dist/Rokt-Kit.iife.js +1 -1
- package/package.json +1 -1
package/dist/Rokt-Kit.common.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ne=["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"],Ue=new Set(Ne);function me(i){return Ue.has(i.toLowerCase())}function y(i){const e={},t=i||{},n=Object.keys(t);for(let r=0;r<n.length;r++){const s=n[r];me(s)||(e[s]=t[s])}return e}function m(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function g(i){return typeof i=="string"}function U(i){return typeof i=="function"}function S(i){return i==null?!0:typeof i=="string"?i.length===0:typeof i=="object"?Object.keys(i).length===0:!1}function z(i){try{const e=new URL(i);return e.search="",e.toString()}catch{return i}}function Ee(i){let e=5381;for(let t=0;t<i.length;t++)e=(e<<5)+e+i.charCodeAt(t),e=e&e;return e}const h="mp-rokt-kit",ee="__rokt_ls_probe__";function H(){try{return window.localStorage.setItem(ee,"1"),window.localStorage.removeItem(ee),!0}catch{return!1}}const R=()=>window.localStorage;function $(i,e=R){try{const t=e().getItem(i);return t===null?null:JSON.parse(t)}catch{return null}}function _e(i,e,t=R){try{return t().setItem(i,JSON.stringify(e)),!0}catch{return!1}}function Ke(i,e=R){try{e().removeItem(i)}catch{}}function O(i,e,t=R){const n=$(i,t);return m(n)?n[e]:void 0}function x(i,e,t,n=R){const r=$(i,n),s=m(r)?{...r}:{};return s[e]=t,_e(i,s,n)}function Y(i,e,t=R){const n=$(i,t);if(!m(n)||!(e in n))return;const r={...n};delete r[e],Object.keys(r).length===0?Ke(i,t):_e(i,r,t)}const q="pageViews",D="utmParams",Ie=25,Ce=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function ye(i){return i.slice(-Ie)}function te(){const i=O(h,q);return Array.isArray(i)?i:[]}function De(i){const e=ye(i);for(let t=0;t<e.length;t++){const n=e.slice(t);if(x(h,q,n))return n.length}return 0}function ie(){Y(h,q)}function Me(i){const e=ye(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 Fe(i){if(O(h,D)!==void 0)return;const e=new URLSearchParams(window.location.search),t={};for(const r of Ce){const s=e.get(r);s&&(t[r]=s)}if(Object.keys(t).length===0)return;const n=Object.keys(t).join(", ");if(!x(h,D,t)){const r=H()?"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 xe(){const i=O(h,D);return m(i)?i:null}function ne(){Y(h,D)}function Ye(){const e=document.querySelector('link[rel="canonical"]')?.href;if(e)return z(e)}const J=[{accountId:"2919171670744024290",pathname:"/checkout",targetPageIdentifier:"prod.rokt.conf",attributeKeys:["email","customertype","eventvenue","firstname","lastname","member_status","billingzipcode","currency"],optionalAttributeKeys:["firstname","lastname"]},{accountId:"2550745407543340151",pathname:"/checkout",targetPageIdentifier:"RoktExperience",attributeKeys:["email","firstname","lastname","customertype","loyaltytier","paymenttype","ccbin"],optionalAttributeKeys:["loyaltytier","paymenttype","ccbin"]},{accountId:"3236704179315511296",pathname:"/check-out/pay",targetPageIdentifier:"confirmation_page",attributeKeys:["email","firstname","lastname","loyaltytier"],optionalAttributeKeys:["firstname","lastname","loyaltytier"]},{accountId:"2192288523645376337",pathname:"/checkout/*/review",targetPageIdentifier:"ppx-ad-view-prod",attributeKeys:["email","firstname","lastname"],optionalAttributeKeys:["email"]},{accountId:"2074245483568304147",pathname:"/checkout/cart",targetPageIdentifier:"new_confirmation",attributeKeys:["email"]}],Ge=6e4;function je(i){return m(i)&&typeof i.expiresAt=="number"&&m(i.attributes)}function He(i,e){return`activePreselect:${i}:${e}`}function Ve(i){const e=O(h,i);return je(e)?e:null}function We(i,e){x(h,i,{expiresAt:Date.now()+Ge,attributes:e})}const ze=5*6e4;function M(){return window.sessionStorage}function $e(i){return m(i)&&typeof i.expiresAt=="number"&&g(i.pathname)&&g(i.identifier)&&m(i.attributes)&&g(i.mpid)}function B(i){return`pendingPreselect:${i}`}function qe(i){const e=B(i),t=O(h,e,M);return $e(t)?t.expiresAt<=Date.now()?(Y(h,e,M),null):t:null}function Je(i,e,t,n,r){return x(h,B(i),{expiresAt:Date.now()+ze,pathname:e,identifier:t,attributes:n,mpid:r},M)}function L(i){Y(h,B(i),M)}function A(i,e){const t={fired:"PRESELECT_FIRED",missed:"PRESELECT_MISSED",queued:"PRESELECT_QUEUED",skipped:"PRESELECT_SKIPPED"};return{message:`Rokt Kit: preselect ${i} [reason=${e}]`,code:t[i]}}function Be(i,e){if(!i.includes("*"))return i===e;const t=i.split("/"),n=e.split("/");return t.length!==n.length?!1:t.every((r,s)=>r==="*"?n[s]!=="":r===n[s])}function Se(i,e){if(i)return J.find(t=>t.accountId===i&&Be(t.pathname,e))}function Qe(i,e){if(!(!i||!g(e)))return J.find(t=>t.accountId===i&&t.targetPageIdentifier===e)}function Xe(i,e){return i?J.some(t=>t.accountId===i&&t.attributeKeys.includes(e)):!1}function Ze(){return{pending:[]}}function j(i,e){const t=i.pending.findIndex(n=>n.pathname===e.pathname);if(t>=0){i.pending[t]=e;return}i.pending.push(e)}function V(i){if(!i?.getUserIdentities)return!1;const e=i.getUserIdentities().userIdentities;return e?Object.keys(e).some(t=>{const n=e[t];return g(n)&&n.length>0}):!1}function Ae(i){const e=i?.getMPID?.();return e==null?null:String(e)}function Pe(i,e){const t=new Set((i.optionalAttributeKeys??[]).map(n=>n.toLowerCase()));return i.attributeKeys.filter(n=>!t.has(n.toLowerCase())&&S(e[n]))}function re(i,e,t){const n=i.filteredUser?.getAllUserAttributes?.()||{},r={};for(const s of t.attributeKeys){const o=i.getEventAttributeValue(e,s),c=S(o)?i.userAttributes[s]??n[s]:o;S(c)||(r[s]=c)}return{collected:r,missingKeys:Pe(t,r)}}function et(i,e){Promise.resolve(i.selectPlacements(e)).catch(t=>{const n=t instanceof Error?t.message:String(t);i.log({message:`Rokt Kit: Preselect selectPlacements call failed: ${n}`,code:"PRESELECT_DISPATCH_FAILED"})})}function be(i,e,t,n,r,s){const o=He(e,t),c=Ve(o),u=!!c&&JSON.stringify(c.attributes)===JSON.stringify(r);if(c&&c.expiresAt>Date.now()&&u){i.logPlacementDiagnostic(A("skipped","active_preselection"));return}We(o,r),i.logPlacementDiagnostic(A("fired",s)),et(i,{attributes:r,preselect:!0,identifier:n,omitUrl:!0})}function tt(i,e){if(!e.accountId||!e.isKitReady())return;const t=qe(e.accountId);if(!t)return;if(i.pending.some(o=>o.pathname===t.pathname)){L(e.accountId);return}if(!e.isPreselectionEnabled()){L(e.accountId);return}if(!V(e.filteredUser)||(L(e.accountId),Ae(e.filteredUser)!==t.mpid))return;const n=Se(e.accountId,t.pathname);if(!n||n.targetPageIdentifier!==t.identifier)return;const r=y(t.attributes),s=Pe(n,r);if(s.length>0){for(const o of s)e.logPlacementDiagnostic(A("missed",`missing_persisted_attribute:${o}`));return}be(e,e.accountId,t.identifier,t.identifier,r,"recovered")}function Re(i,e,t,n=window.location.pathname){const r=Se(e.accountId,n);if(!r)return;if(!e.isKitReady()){const c=[],u=Ae(e.filteredUser);if(e.accountId&&u&&V(e.filteredUser)){const{collected:l,missingKeys:f}=re(e,t,r);if(f.length===0){const k=y(l);Je(e.accountId,n,r.targetPageIdentifier,k,u)||c.push(A("queued","persist_failed"))}}j(i,{event:t,pathname:n,storedDiagnostics:c});return}if(!e.isPreselectionEnabled())return;if(!V(e.filteredUser)){e.logPlacementDiagnostic(A("missed","no_valid_identity")),j(i,{event:t,pathname:n});return}const{collected:s,missingKeys:o}=re(e,t,r);if(o.length>0){for(const c of o)e.logPlacementDiagnostic(A("missed",`missing_attribute:${c}`));j(i,{event:t,pathname:n});return}be(e,e.accountId||"",n,r.targetPageIdentifier,s,"fired")}function it(i,e,t=window.location.pathname){if(tt(i,e),i.pending.length===0)return;const n=i.pending;i.pending=[],n.forEach(({event:r,pathname:s,storedDiagnostics:o})=>{s===t&&(e.isKitReady()&&e.isPreselectionEnabled()&&o?.forEach(c=>e.logPlacementDiagnostic(c)),Re(i,e,r,s))})}function nt(){return{context:null,lifecycle:"idle",recreateInFlight:null}}function rt(i,e){i.context={accountId:e.accountId,launcherOptions:{...e.launcherOptions},legacyRoktExtensions:[...e.legacyRoktExtensions]}}function st(i){i.lifecycle="attached"}function ot(i){i.lifecycle!=="idle"&&(i.lifecycle="terminated")}function ct(i){i.lifecycle="terminated"}function at(i){i.context=null,i.lifecycle="idle",i.recreateInFlight=null}function lt(i,e,t){if(i.recreateInFlight)return i.recreateInFlight;if(i.lifecycle!=="terminated"||!i.context||!e)return;i.lifecycle="recreating";const n=i.context;return i.recreateInFlight=t(n).finally(()=>{i.recreateInFlight=null}),i.recreateInFlight}const d="Rokt",K=181,ut="selectPlacements",dt="apps.roktecommerce.com",ht=.1,gt="ThankYouPageJourney",ft="rokt-launcher",pt="rokt-thank-you-element",mt="userIdentifiedInWorkspace",Et=3,_t=2,It="page_events",yt="page_view_attributes",St="mparticle_session_id",At="mparticle_device_id",se=500,Q={UNKNOWN_ERROR:"UNKNOWN_ERROR",UNHANDLED_EXCEPTION:"UNHANDLED_EXCEPTION",IDENTITY_REQUEST:"IDENTITY_REQUEST",LOG_DELIVERY_FAILURE:"LOG_DELIVERY_FAILURE"},P={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},Pt="apps.rokt-api.com",bt="/v1/log",Rt="/v1/errors",kt=10;function a(){return window.mParticle}function oe(i,e){const n=[G(i),"/wsdk/integrations/launcher.js"].join("");return!e||e.length===0?n:n+"?extensions="+e.join(",")}function ce(i){return[G(i),"/rokt-elements/rokt-element-thank-you.js"].join("")}function G(i){const e=i!==void 0?i:Pt;return e.includes("://")?e.replace(/\/+$/,""):["https://",e].join("")}function ke(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 G(r)+t}function ae(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 C(i){if(!i)return[];try{return JSON.parse(i.replace(/"/g,'"'))}catch{console.error("Settings string contains invalid JSON")}return[]}function le(i){const e=i?C(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(gt)):t.push(o)}return{roktExtensionsQueryParams:t,legacyRoktExtensions:n,loadThankYouElement:r}}async function vt(i,e){const t=[];if(e)for(const n of i)t.push(e.use(n));return Promise.all(t)}function ue(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 de(i){const e={};if(!Array.isArray(i))return e;for(let t=0;t<i.length;t++){const n=i[t];if(!n||!g(n.value)||!g(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 he(i,e,t){return a().generateHash([i,e,t].join(""))}function wt(i){let n="mParticle_wsdkv_"+a().getVersion()+"_kitv_"+"3.8.1";return i&&(n+="_"+i),n}function W(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 ge(i,e){const t=Ee(window.location.origin);if(b._allowedOriginHashes.indexOf(t)===-1||Math.random()>=ht)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?G(i):"https://apps.rokt.com";W(c+"/v1/wsdk-init/index.html?"+o),W("https://"+dt+"/v1/wsdk-init/index.html?"+o+"&isControl=true")}function Tt(){return typeof window<"u"&&!!window.location?.search?.toLowerCase().includes("mp_enable_logging=true")}function Lt(){return typeof window<"u"?window.location?.href:void 0}function Ot(){return typeof window<"u"?window.navigator?.userAgent:void 0}class ve{constructor(){this._logCount={}}incrementAndCheck(e){const n=(this._logCount[e]||0)+1;return this._logCount[e]=n,n>kt}}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 ve,this._isEnabled=Tt()||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||Q.UNKNOWN_ERROR,url:Lt(),deviceInfo:Ot(),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 f=new Error("HTTP "+l.status+" from log endpoint");throw f.statusCode=l.status,f}}).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 fe{constructor(e,t,n,r,s){this._transport=new F(e,t,n,r,s),this._errorUrl=ke(e?.errorUrl,e?.integrationDomain,Rt)}report(e){if(!e)return;const t=e.severity||P.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 F(e,n,r,s,o),this._placementDiagnosticTransport=new F(e,n,r,s),this._loggingUrl=ke(e?.loggingUrl,e?.integrationDomain,bt),this._errorReportingService=t}log(e){e&&this._send(this._transport,e)}logPlacementDiagnostic(e){e&&this._send(this._placementDiagnosticTransport,e)}_send(e,t){e.send(this._loggingUrl,P.INFO,t.message,t.code,void 0,n=>{if(this._errorReportingService){const r=typeof n.statusCode=="number";this._errorReportingService.report({message:"LoggingService: Failed to send log: "+n.message,code:Q.LOG_DELIVERY_FAILURE,severity:r?P.ERROR:P.WARNING})}})}}function Nt(i){const e=z(window.location.href),t=i.EventAttributes?.title||document.title,n=Ye(),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 _=class _{constructor(){this.name=d,this.id=K,this.moduleId=K,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,this._launcherAttachState=nt(),this.accountId=null,this._preselectState=Ze()}getEventAttributeValue(e,t){const n=e&&e.EventAttributes;return!n||n[t]===void 0?null:n[t]}doesEventAttributeConditionMatch(e,t){if(!e||!g(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||!g(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(S(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=z(window.location.href);const n=te(),r=Nt(e);n.push(r);const s=Math.min(n.length,Ie),o=De(n);if(o===0){const c=H()?"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=H()?"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"})}}isPreselectionEnabled(){return this.launcher?.enablePreselection===!0}buildCacheMatchKeys(e){if(!this.isPreselectionEnabled())return;const t=Qe(this.accountId,e);if(t)return t.attributeKeys}buildPreselectHost(){return{accountId:this.accountId,filteredUser:this.filters.filteredUser,userAttributes:this.userAttributes,isKitReady:()=>this.isKitReady(),isPreselectionEnabled:()=>this.isPreselectionEnabled(),getEventAttributeValue:(e,t)=>this.getEventAttributeValue(e,t),logPlacementDiagnostic:e=>this.loggingService?.logPlacementDiagnostic(e),log:e=>this.loggingService?.log(e),selectPlacements:e=>this.selectPlacements(e)}}flushPendingPreselectDispatches(){it(this._preselectState,this.buildPreselectHost())}isLauncherReadyToAttach(){return!!window.Rokt&&U(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[_.EMAIL_SHA256_KEY]=e[n]),n&&delete t[n],t}logSelectPlacementsEvent(e){if(!window.mParticle||typeof a().logEvent!="function"||!m(e))return;const t=a().EventType.Other;a().logEvent(ut,t,e)}setRoktSessionId(e){if(!(!e||typeof e!="string"))try{const t=a().getInstance();t&&U(t.setIntegrationAttribute)&&t.setIntegrationAttribute(K,{roktSessionId:e})}catch{}}readMpSessionId(){const e=a()?.sessionManager,t=e?.getSessionId??e?.getSession;if(U(t))return t.call(e)||void 0}readMpDeviceId(){return a()?.getDeviceId?.()||void 0}attachLauncher(e,t,n=[]){rt(this._launcherAttachState,{accountId:e,launcherOptions:t||{},legacyRoktExtensions:n});const r={accountId:e,...t||{}};let s;return this.isPartnerInLocalLauncherTestGroup()?s=Promise.resolve(window.Rokt.createLocalLauncher(r)):s=window.Rokt.createLauncher(r),s.then(async o=>{await vt([...n],o),this.initRoktLauncher(o)}).catch(o=>{const c=this._launcherAttachState.lifecycle==="attached";if(ct(this._launcherAttachState),!c){const u=o instanceof Error?o.message:String(o);this.loggingService?.log({message:`Rokt Kit: Failed to attach Rokt launcher: ${u}`,code:"LAUNCHER_ATTACH_FAILED"})}console.error("Error creating Rokt launcher:",o)})}recreateLauncherIfTerminated(){return lt(this._launcherAttachState,this.isLauncherReadyToAttach(),e=>this.attachLauncher(e.accountId,e.launcherOptions,e.legacyRoktExtensions))}initRoktLauncher(e){window.Rokt&&(window.Rokt.currentLauncher=e),this.launcher=e,st(this._launcherAttachState);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,ge(this.domain,this.integrationName),a().Rokt.attachKit(this),this.flushPendingPreselectDispatches()}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.accountId=c||null,this.userAttributes=y(s),this._onboardingExpProvider=o.onboardingExpProvider;const u=C(o.placementEventMapping);this.placementEventMappingLookup=ue(u);const l=C(o.placementEventAttributeMapping);this.placementEventAttributeMappingLookup=de(l),o.hashedEmailUserIdentityType&&(this._mappedEmailSha256Key=o.hashedEmailUserIdentityType.toLowerCase()),this._workspaceIdSyncApiKey=g(o.workspaceIdSyncApiKey)?o.workspaceIdSyncApiKey:void 0;const f=a().Rokt?.domain,{roktExtensionsQueryParams:k,legacyRoktExtensions:v,loadThankYouElement:N}=le(o.roktExtensions),E={...a().Rokt?.launcherOptions||{}};this.integrationName=wt(E.integrationName),E.integrationName=this.integrationName,this.domain=f;const w={loggingUrl:o.loggingUrl,errorUrl:o.errorUrl,integrationDomain:f,isLoggingEnabled:a().config?.isLoggingEnabled===!0},I=new fe(w,this.integrationName,window.__rokt_li_guid__,o.accountId),T=new pe(w,I,this.integrationName,window.__rokt_li_guid__,o.accountId);if(this.errorReportingService=I,this.loggingService=T,this.isTargetingDisabled())try{ie(),ne()}catch(p){this.errorReportingService?.report({message:"Rokt Kit: Failed to clear page views when targeting is disabled",code:"PAGE_VIEW_CAPTURE_FAILED",severity:P.INFO,stackTrace:p instanceof Error?p.stack:void 0})}return a()._registerErrorReportingService&&a()._registerErrorReportingService(I),a()._registerLoggingService&&a()._registerLoggingService(T),n?(this.testHelpers={generateLauncherScript:oe,generateThankYouElementScript:ce,extractRoktExtensionConfig:le,hashEventMessage:he,parseSettingsString:C,generateMappedEventLookup:ue,generateMappedEventAttributeLookup:de,sendAdBlockMeasurementSignals:ge,createAutoRemovedIframe:W,djb2:Ee,setAllowedOriginHashes:p=>{_._allowedOriginHashes=p},ReportingTransport:F,ErrorReportingService:fe,LoggingService:pe,RateLimiter:ve,ErrorCodes:Q,WSDKErrorSeverity:P,resetLauncherAttachState:()=>at(this._launcherAttachState)},this.attachLauncher(c,E),"Successfully initialized: "+d):(N&&(a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this),ae(pt,ce(f),{onLoad:()=>{this._isThankYouElementLoaded=!0,this._thankYouElementOnLoadCallback&&this._thankYouElementOnLoadCallback()},onError:p=>{console.error("Error loading Rokt Thank You Element script:",p)}})),this.isLauncherReadyToAttach()?this.attachLauncher(c,E,v):(ae(ft,oe(f,k),{onLoad:()=>{this.isLauncherReadyToAttach()?this.attachLauncher(c,E,v):console.error("Rokt object is not available after script load.")},onError:p=>{console.error("Error loading Rokt launcher script:",p)}}),this.captureTiming(_.PERFORMANCE_MARKS.RoktScriptAppended)),"Successfully initialized: "+d)}process(e){if(this.isTargetingDisabled()||(e.EventDataType===Et&&(Fe(this.loggingService),this.capturePageView(e),Re(this._preselectState,this.buildPreselectHost(),e)),e.EventDataType===_t&&(ie(),ne(),this.accountId&&L(this.accountId))),!this.isKitReady())return"Kit not ready for forwarder: "+d;if(U(a().Rokt?.setLocalSessionAttribute)&&(S(this.placementEventAttributeMappingLookup)||this.applyPlacementEventAttributeMapping(e),!S(this.placementEventMappingLookup))){const t=he(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 me(e)||(this.userAttributes[e]=t),Xe(this.accountId,e)&&this.flushPendingPreselectDispatches(),"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=y(e.getAllUserAttributes()),"Successfully called "+t+" for forwarder: "+d}onUserIdentified(e){const t=e;this.filters.filteredUser=t,this._workspaceSearchInFlightPromise=this.search(t);const n=this.handleIdentityComplete(e,"onUserIdentified");return this.flushPendingPreselectDispatches(),n}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];g(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.accountId&&L(this.accountId),this.handleIdentityComplete(e,"onLogoutComplete")}onModifyComplete(e,t){return this.handleIdentityComplete(e,"onModifyComplete")}selectPlacements(e){const t=this.recreateLauncherIfTerminated();if(t){const n=this._workspaceSearchInFlightPromise,r=n?Promise.race([n,new Promise(s=>setTimeout(s,se))]):Promise.resolve();return Promise.all([t,r]).then(()=>this._dispatchPlacements(e))}if(this._workspaceSearchInFlightPromise){const n=this._workspaceSearchInFlightPromise;return Promise.race([n,new Promise(r=>setTimeout(r,se))]).then(()=>this._dispatchPlacements(e))}return this._dispatchPlacements(e)}_dispatchPlacements(e){const t=e&&e.attributes||{},r={...y(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=y(l);const f=this._onboardingExpProvider==="Optimizely"?this.fetchOptimizely():{},k=this.returnUserIdentities(c),v=this.returnLocalSessionAttributes(),N=Me(te()),E=xe(),w=this.readMpSessionId(),I=this.readMpDeviceId(),T={...k,...l,...f,...v,...N.length?{[It]:JSON.stringify(N)}:{},...E?{[yt]:E}:{},...this.userIdentifiedInWorkspace?{[mt]:!0}:{},...w?{[St]:w}:{},...I?{[At]:I}:{},mpid:u},p=this.buildCacheMatchKeys(typeof e.identifier=="string"?e.identifier:void 0),we={...e,attributes:T,...p!==void 0?{cacheMatchKeys:p}:{}},X=this.launcher.selectPlacements(we),Z=e.preselect===!0,Te=()=>{Z||this.logSelectPlacementsEvent(T)};return Promise.resolve(X).then(Le=>{if(!Z)return Le?.context?.sessionId?.then(Oe=>this.setRoktSessionId(Oe))}).catch(()=>{}).finally(Te),X}hashAttributes(e){return this.isKitReady()?this.launcher.hashAttributes(e):(console.error("Rokt Kit: Not initialized"),null)}use(e){return this.isKitReady()?!e||!g(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")))}terminate(){return this.isKitReady()?(ot(this._launcherAttachState),this.launcher.terminate()):(console.error("Rokt Kit: Not initialized"),Promise.resolve())}onShoppableAdsReady(e){this._isThankYouElementLoaded?e():this._thankYouElementOnLoadCallback=e}};_._allowedOriginHashes=[-553112570,549508659],_.PERFORMANCE_MARKS={RoktScriptAppended:"mp:RoktScriptAppended"},_.EMAIL_SHA256_KEY="emailsha256";let b=_;function Ut(){return K}function Kt(i){if(!i){window.console.log("You must pass a config object to register the kit "+d);return}if(!m(i)){window.console.log("'config' must be an object. You passed in a "+typeof i);return}m(i.kits)?i.kits[d]={constructor:b}:(i.kits={},i.kits[d]={constructor:b}),window.console.log("Successfully registered "+d+" to your mParticle configuration")}typeof window<"u"&&window.mParticle&&a().addForwarder&&a().addForwarder({name:d,constructor:b,getId:Ut});exports.register=Kt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Fe=["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"],xe=new Set(Fe);function Ae(i){return xe.has(i.toLowerCase())}function y(i){const e={},t=i||{},n=Object.keys(t);for(let r=0;r<n.length;r++){const s=n[r];Ae(s)||(e[s]=t[s])}return e}function p(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function g(i){return typeof i=="string"}function U(i){return typeof i=="function"}function A(i){return i==null?!0:typeof i=="string"?i.length===0:typeof i=="object"?Object.keys(i).length===0:!1}function J(i){try{const e=new URL(i);return e.search="",e.toString()}catch{return i}}function Pe(i){let e=5381;for(let t=0;t<i.length;t++)e=(e<<5)+e+i.charCodeAt(t),e=e&e;return e}const h="mp-rokt-kit",se="__rokt_ls_probe__";function V(){try{return window.localStorage.setItem(se,"1"),window.localStorage.removeItem(se),!0}catch{return!1}}const v=()=>window.localStorage;function B(i,e=v){try{const t=e().getItem(i);return t===null?null:JSON.parse(t)}catch{return null}}function be(i,e,t=v){try{return t().setItem(i,JSON.stringify(e)),!0}catch{return!1}}function Ye(i,e=v){try{e().removeItem(i)}catch{}}function O(i,e,t=v){const n=B(i,t);return p(n)?n[e]:void 0}function x(i,e,t,n=v){const r=B(i,n),s=p(r)?{...r}:{};return s[e]=t,be(i,s,n)}function Y(i,e,t=v){const n=B(i,t);if(!p(n)||!(e in n))return;const r={...n};delete r[e],Object.keys(r).length===0?Ye(i,t):be(i,r,t)}const Q="pageViews",D="utmParams",Se=25,je=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function ve(i){return i.slice(-Se)}function oe(){const i=O(h,Q);return Array.isArray(i)?i:[]}function Ge(i){const e=ve(i);for(let t=0;t<e.length;t++){const n=e.slice(t);if(x(h,Q,n))return n.length}return 0}function ce(){Y(h,Q)}function He(i){const e=ve(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 Ve(i){if(O(h,D)!==void 0)return;const e=new URLSearchParams(window.location.search),t={};for(const r of je){const s=e.get(r);s&&(t[r]=s)}if(Object.keys(t).length===0)return;const n=Object.keys(t).join(", ");if(!x(h,D,t)){const r=V()?"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 We(){const i=O(h,D);return p(i)?i:null}function ae(){Y(h,D)}function ze(){const e=document.querySelector('link[rel="canonical"]')?.href;if(e)return J(e)}const j=[{accountId:"2919171670744024290",pathname:"/checkout",targetPageIdentifier:"prod.rokt.conf",attributeKeys:["email","customertype","eventvenue","firstname","lastname","member_status","billingzipcode","currency"],optionalAttributeKeys:["firstname","lastname"]},{accountId:"2550745407543340151",pathname:"/checkout",targetPageIdentifier:"RoktExperience",attributeKeys:["email","firstname","lastname","customertype","loyaltytier","paymenttype","ccbin"],optionalAttributeKeys:["loyaltytier","paymenttype","ccbin"]},{accountId:"3236704179315511296",pathname:"/check-out/pay",targetPageIdentifier:"confirmation_page",attributeKeys:["email","firstname","lastname","loyaltytier"],optionalAttributeKeys:["firstname","lastname","loyaltytier"]},{accountId:"2192288523645376337",pathname:"/checkout/*/review",targetPageIdentifier:"ppx-ad-view-prod",attributeKeys:["email"],optionalAttributeKeys:["email"]},{accountId:"2074245483568304147",pathname:"/checkout/cart",targetPageIdentifier:"new_confirmation",attributeKeys:["email","showPlacement","post_purchase_variant"],optionalAttributeKeys:["showPlacement","post_purchase_variant"],preselectAttributeOverrides:{showPlacement:"rokt",post_purchase_variant:"treatment"}}],$e=6e4;function qe(i){return p(i)&&typeof i.expiresAt=="number"&&p(i.attributes)}function Je(i,e){return`activePreselect:${i}:${e}`}function Be(i){const e=O(h,i);return qe(e)?e:null}function Qe(i,e){x(h,i,{expiresAt:Date.now()+$e,attributes:e})}const Xe=5*6e4;function M(){return window.sessionStorage}function Ze(i){return p(i)&&typeof i.expiresAt=="number"&&g(i.pathname)&&g(i.identifier)&&p(i.attributes)&&g(i.mpid)}function X(i){return`pendingPreselect:${i}`}function et(i){const e=X(i),t=O(h,e,M);return Ze(t)?t.expiresAt<=Date.now()?(Y(h,e,M),null):t:null}function tt(i,e,t,n,r){return x(h,X(i),{expiresAt:Date.now()+Xe,pathname:e,identifier:t,attributes:n,mpid:r},M)}function L(i){Y(h,X(i),M)}function P(i,e){const t={fired:"PRESELECT_FIRED",missed:"PRESELECT_MISSED",queued:"PRESELECT_QUEUED",skipped:"PRESELECT_SKIPPED"};return{message:`Rokt Kit: preselect ${i} [reason=${e}]`,code:t[i]}}function it(i,e){if(!i.includes("*"))return i===e;const t=i.split("/"),n=e.split("/");return t.length!==n.length?!1:t.every((r,s)=>r==="*"?n[s]!=="":r===n[s])}const ke={};function W(i){return i===ke}function Re(i,e){if(i)return j.find(t=>t.accountId===i&&it(t.pathname,e))}function z(i,e){if(!(!i||!g(e)))return j.find(t=>t.accountId===i&&t.targetPageIdentifier===e)}function we(i,e){if(!e)return i;const t=new Set(Object.keys(e).map(r=>r.toLowerCase())),n={};for(const[r,s]of Object.entries(i))t.has(r.toLowerCase())||(n[r]=s);return{...n,...e}}function nt(i){const e=Object.keys(i.preselectAttributeOverrides??{});return[...i.attributeKeys,...e.filter(t=>!i.attributeKeys.includes(t))]}function rt(i){return i?j.some(e=>e.accountId===i):!1}function st(i,e,t=window.location.pathname){i.pending.some(n=>n.pathname===t&&!W(n.event))||Z(i,e,ke,t)}function ot(i,e){return i?j.some(t=>t.accountId===i&&t.attributeKeys.includes(e)):!1}function ct(){return{pending:[]}}function H(i,e){const t=i.pending.findIndex(n=>n.pathname===e.pathname);if(t>=0){if(W(e.event)&&!W(i.pending[t].event))return;i.pending[t]=e;return}i.pending.push(e)}function $(i){if(!i?.getUserIdentities)return!1;const e=i.getUserIdentities().userIdentities;return e?Object.keys(e).some(t=>{const n=e[t];return g(n)&&n.length>0}):!1}function Te(i){const e=i?.getMPID?.();return e==null?null:String(e)}function Le(i,e){const t=new Set((i.optionalAttributeKeys??[]).map(n=>n.toLowerCase()));return i.attributeKeys.filter(n=>!t.has(n.toLowerCase())&&A(e[n]))}function le(i,e,t){const n=i.filteredUser?.getAllUserAttributes?.()||{},r={};for(const s of t.attributeKeys){const o=i.getEventAttributeValue(e,s),c=A(o)?i.userAttributes[s]??n[s]:o;A(c)||(r[s]=c)}return{collected:r,missingKeys:Le(t,r)}}function at(i,e){Promise.resolve(i.selectPlacements(e)).catch(t=>{const n=t instanceof Error?t.message:String(t);i.log({message:`Rokt Kit: Preselect selectPlacements call failed: ${n}`,code:"PRESELECT_DISPATCH_FAILED"})})}function Oe(i,e,t,n,r,s){const o=Je(e,t),c=Be(o),u=we(r,z(e,n)?.preselectAttributeOverrides),l=!!c&&JSON.stringify(c.attributes)===JSON.stringify(u);if(c&&c.expiresAt>Date.now()&&l){i.logPlacementDiagnostic(P("skipped","active_preselection"));return}Qe(o,u),i.logPlacementDiagnostic(P("fired",s)),at(i,{attributes:r,preselect:!0,identifier:n,omitUrl:!0})}function lt(i,e){if(!e.accountId||!e.isKitReady())return;const t=et(e.accountId);if(!t)return;if(i.pending.some(o=>o.pathname===t.pathname)){L(e.accountId);return}if(!e.isPreselectionEnabled()){L(e.accountId);return}if(!$(e.filteredUser)||(L(e.accountId),Te(e.filteredUser)!==t.mpid))return;const n=Re(e.accountId,t.pathname);if(!n||n.targetPageIdentifier!==t.identifier)return;const r=y(t.attributes),s=Le(n,r);if(s.length>0){for(const o of s)e.logPlacementDiagnostic(P("missed",`missing_persisted_attribute:${o}`));return}Oe(e,e.accountId,t.identifier,t.identifier,r,"recovered")}function Z(i,e,t,n=window.location.pathname){const r=Re(e.accountId,n);if(!r)return;if(!e.isKitReady()){const c=[],u=Te(e.filteredUser);if(e.accountId&&u&&$(e.filteredUser)){const{collected:l,missingKeys:f}=le(e,t,r);if(f.length===0){const k=y(l);tt(e.accountId,n,r.targetPageIdentifier,k,u)||c.push(P("queued","persist_failed"))}}H(i,{event:t,pathname:n,storedDiagnostics:c});return}if(!e.isPreselectionEnabled())return;if(!$(e.filteredUser)){e.logPlacementDiagnostic(P("missed","no_valid_identity")),H(i,{event:t,pathname:n});return}const{collected:s,missingKeys:o}=le(e,t,r);if(o.length>0){for(const c of o)e.logPlacementDiagnostic(P("missed",`missing_attribute:${c}`));H(i,{event:t,pathname:n});return}Oe(e,e.accountId||"",n,r.targetPageIdentifier,s,"fired")}function ut(i,e,t=window.location.pathname){if(lt(i,e),i.pending.length===0)return;const n=i.pending;i.pending=[],n.forEach(({event:r,pathname:s,storedDiagnostics:o})=>{s===t&&(e.isKitReady()&&e.isPreselectionEnabled()&&o?.forEach(c=>e.logPlacementDiagnostic(c)),Z(i,e,r,s))})}function dt(){return{context:null,lifecycle:"idle",recreateInFlight:null}}function ht(i,e){i.context={accountId:e.accountId,launcherOptions:{...e.launcherOptions},legacyRoktExtensions:[...e.legacyRoktExtensions]}}function gt(i){i.lifecycle="attached"}function ft(i){i.lifecycle!=="idle"&&(i.lifecycle="terminated")}function pt(i){i.lifecycle="terminated"}function mt(i){i.context=null,i.lifecycle="idle",i.recreateInFlight=null}function Et(i,e,t){if(i.recreateInFlight)return i.recreateInFlight;if(i.lifecycle!=="terminated"||!i.context||!e)return;i.lifecycle="recreating";const n=i.context;return i.recreateInFlight=t(n).finally(()=>{i.recreateInFlight=null}),i.recreateInFlight}const d="Rokt",K=181,_t="selectPlacements",It="apps.roktecommerce.com",yt=.1,At="ThankYouPageJourney",Pt="rokt-launcher",bt="rokt-thank-you-element",St="userIdentifiedInWorkspace",vt=3,kt=2,Rt="page_events",wt="page_view_attributes",Tt="mparticle_session_id",Lt="mparticle_device_id",ue=500,ee={UNKNOWN_ERROR:"UNKNOWN_ERROR",UNHANDLED_EXCEPTION:"UNHANDLED_EXCEPTION",IDENTITY_REQUEST:"IDENTITY_REQUEST",LOG_DELIVERY_FAILURE:"LOG_DELIVERY_FAILURE"},b={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},Ot="apps.rokt-api.com",Nt="/v1/log",Ut="/v1/errors",Kt=10;function a(){return window.mParticle}function de(i,e){const n=[G(i),"/wsdk/integrations/launcher.js"].join("");return!e||e.length===0?n:n+"?extensions="+e.join(",")}function he(i){return[G(i),"/rokt-elements/rokt-element-thank-you.js"].join("")}function G(i){const e=i!==void 0?i:Ot;return e.includes("://")?e.replace(/\/+$/,""):["https://",e].join("")}function Ne(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 G(r)+t}function ge(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 C(i){if(!i)return[];try{return JSON.parse(i.replace(/"/g,'"'))}catch{console.error("Settings string contains invalid JSON")}return[]}function fe(i){const e=i?C(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(At)):t.push(o)}return{roktExtensionsQueryParams:t,legacyRoktExtensions:n,loadThankYouElement:r}}async function Ct(i,e){const t=[];if(e)for(const n of i)t.push(e.use(n));return Promise.all(t)}function pe(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 me(i){const e={};if(!Array.isArray(i))return e;for(let t=0;t<i.length;t++){const n=i[t];if(!n||!g(n.value)||!g(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 Ee(i,e,t){return a().generateHash([i,e,t].join(""))}function Dt(i){let n="mParticle_wsdkv_"+a().getVersion()+"_kitv_"+"3.9.0";return i&&(n+="_"+i),n}function q(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 _e(i,e){const t=Pe(window.location.origin);if(S._allowedOriginHashes.indexOf(t)===-1||Math.random()>=yt)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?G(i):"https://apps.rokt.com";q(c+"/v1/wsdk-init/index.html?"+o),q("https://"+It+"/v1/wsdk-init/index.html?"+o+"&isControl=true")}function Mt(){return typeof window<"u"&&!!window.location?.search?.toLowerCase().includes("mp_enable_logging=true")}function Ft(){return typeof window<"u"?window.location?.href:void 0}function xt(){return typeof window<"u"?window.navigator?.userAgent:void 0}class Ue{constructor(){this._logCount={}}incrementAndCheck(e){const n=(this._logCount[e]||0)+1;return this._logCount[e]=n,n>Kt}}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 Ue,this._isEnabled=Mt()||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||ee.UNKNOWN_ERROR,url:Ft(),deviceInfo:xt(),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 f=new Error("HTTP "+l.status+" from log endpoint");throw f.statusCode=l.status,f}}).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 Ie{constructor(e,t,n,r,s){this._transport=new F(e,t,n,r,s),this._errorUrl=Ne(e?.errorUrl,e?.integrationDomain,Ut)}report(e){if(!e)return;const t=e.severity||b.ERROR;this._transport.send(this._errorUrl,t,e.message,e.code,e.stackTrace)}}class ye{constructor(e,t,n,r,s,o){this._transport=new F(e,n,r,s,o),this._placementDiagnosticTransport=new F(e,n,r,s),this._loggingUrl=Ne(e?.loggingUrl,e?.integrationDomain,Nt),this._errorReportingService=t}log(e){e&&this._send(this._transport,e)}logPlacementDiagnostic(e){e&&this._send(this._placementDiagnosticTransport,e)}_send(e,t){e.send(this._loggingUrl,b.INFO,t.message,t.code,void 0,n=>{if(this._errorReportingService){const r=typeof n.statusCode=="number";this._errorReportingService.report({message:"LoggingService: Failed to send log: "+n.message,code:ee.LOG_DELIVERY_FAILURE,severity:r?b.ERROR:b.WARNING})}})}}function Yt(i){const e=J(window.location.href),t=i.EventAttributes?.title||document.title,n=ze(),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 _=class _{constructor(){this.name=d,this.id=K,this.moduleId=K,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,this._launcherAttachState=dt(),this.accountId=null,this._preselectState=ct()}getEventAttributeValue(e,t){const n=e&&e.EventAttributes;return!n||n[t]===void 0?null:n[t]}doesEventAttributeConditionMatch(e,t){if(!e||!g(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||!g(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(A(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=J(window.location.href);const n=oe(),r=Yt(e);n.push(r);const s=Math.min(n.length,Se),o=Ge(n);if(o===0){const c=V()?"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=V()?"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"})}}isPreselectionEnabled(){return this.launcher?.enablePreselection===!0}buildCacheMatchKeys(e){if(!this.isPreselectionEnabled())return;const t=z(this.accountId,e);if(t)return nt(t)}buildPreselectAttributeOverrides(e){if(!this.isPreselectionEnabled())return;const t=z(this.accountId,e)?.preselectAttributeOverrides,n=this.filters||{};if(!t||!n.filterUserAttributes)return t;const r=n.userAttributeFilters||[];return n.filterUserAttributes(t,r)}buildPreselectHost(){return{accountId:this.accountId,filteredUser:this.filters.filteredUser,userAttributes:this.userAttributes,isKitReady:()=>this.isKitReady(),isPreselectionEnabled:()=>this.isPreselectionEnabled(),getEventAttributeValue:(e,t)=>this.getEventAttributeValue(e,t),logPlacementDiagnostic:e=>this.loggingService?.logPlacementDiagnostic(e),log:e=>this.loggingService?.log(e),selectPlacements:e=>this.selectPlacements(e)}}flushPendingPreselectDispatches(){ut(this._preselectState,this.buildPreselectHost())}isLauncherReadyToAttach(){return!!window.Rokt&&U(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[_.EMAIL_SHA256_KEY]=e[n]),n&&delete t[n],t}logSelectPlacementsEvent(e){if(!window.mParticle||typeof a().logEvent!="function"||!p(e))return;const t=a().EventType.Other;a().logEvent(_t,t,e)}setRoktSessionId(e){if(!(!e||typeof e!="string"))try{const t=a().getInstance();t&&U(t.setIntegrationAttribute)&&t.setIntegrationAttribute(K,{roktSessionId:e})}catch{}}readMpSessionId(){const e=a()?.sessionManager,t=e?.getSessionId??e?.getSession;if(U(t))return t.call(e)||void 0}readMpDeviceId(){return a()?.getDeviceId?.()||void 0}attachLauncher(e,t,n=[]){ht(this._launcherAttachState,{accountId:e,launcherOptions:t||{},legacyRoktExtensions:n});const r={accountId:e,...t||{}};let s;return this.isPartnerInLocalLauncherTestGroup()?s=Promise.resolve(window.Rokt.createLocalLauncher(r)):s=window.Rokt.createLauncher(r),s.then(async o=>{await Ct([...n],o),this.initRoktLauncher(o)}).catch(o=>{const c=this._launcherAttachState.lifecycle==="attached";if(pt(this._launcherAttachState),!c){const u=o instanceof Error?o.message:String(o);this.loggingService?.log({message:`Rokt Kit: Failed to attach Rokt launcher: ${u}`,code:"LAUNCHER_ATTACH_FAILED"})}console.error("Error creating Rokt launcher:",o)})}recreateLauncherIfTerminated(){return Et(this._launcherAttachState,this.isLauncherReadyToAttach(),e=>this.attachLauncher(e.accountId,e.launcherOptions,e.legacyRoktExtensions))}initRoktLauncher(e){window.Rokt&&(window.Rokt.currentLauncher=e),this.launcher=e,gt(this._launcherAttachState);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,_e(this.domain,this.integrationName),a().Rokt.attachKit(this),this.flushPendingPreselectDispatches()}armPreselectPathnameTrigger(){this.onRouteChange=rt(this.accountId)?()=>this.evaluatePreselectPathname():void 0}evaluatePreselectPathname(){const e=window.location.pathname;e!==this._lastPreselectPathname&&(this.isTargetingDisabled()||(this._lastPreselectPathname=e,st(this._preselectState,this.buildPreselectHost(),e)))}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.accountId=c||null,this.userAttributes=y(s),this.armPreselectPathnameTrigger(),this._onboardingExpProvider=o.onboardingExpProvider;const u=C(o.placementEventMapping);this.placementEventMappingLookup=pe(u);const l=C(o.placementEventAttributeMapping);this.placementEventAttributeMappingLookup=me(l),o.hashedEmailUserIdentityType&&(this._mappedEmailSha256Key=o.hashedEmailUserIdentityType.toLowerCase()),this._workspaceIdSyncApiKey=g(o.workspaceIdSyncApiKey)?o.workspaceIdSyncApiKey:void 0;const f=a().Rokt?.domain,{roktExtensionsQueryParams:k,legacyRoktExtensions:R,loadThankYouElement:N}=fe(o.roktExtensions),E={...a().Rokt?.launcherOptions||{}};this.integrationName=Dt(E.integrationName),E.integrationName=this.integrationName,this.domain=f;const w={loggingUrl:o.loggingUrl,errorUrl:o.errorUrl,integrationDomain:f,isLoggingEnabled:a().config?.isLoggingEnabled===!0},I=new Ie(w,this.integrationName,window.__rokt_li_guid__,o.accountId),T=new ye(w,I,this.integrationName,window.__rokt_li_guid__,o.accountId);if(this.errorReportingService=I,this.loggingService=T,this.isTargetingDisabled())try{ce(),ae()}catch(m){this.errorReportingService?.report({message:"Rokt Kit: Failed to clear page views when targeting is disabled",code:"PAGE_VIEW_CAPTURE_FAILED",severity:b.INFO,stackTrace:m instanceof Error?m.stack:void 0})}return a()._registerErrorReportingService&&a()._registerErrorReportingService(I),a()._registerLoggingService&&a()._registerLoggingService(T),n?(this.testHelpers={generateLauncherScript:de,generateThankYouElementScript:he,extractRoktExtensionConfig:fe,hashEventMessage:Ee,parseSettingsString:C,generateMappedEventLookup:pe,generateMappedEventAttributeLookup:me,sendAdBlockMeasurementSignals:_e,createAutoRemovedIframe:q,djb2:Pe,setAllowedOriginHashes:m=>{_._allowedOriginHashes=m},ReportingTransport:F,ErrorReportingService:Ie,LoggingService:ye,RateLimiter:Ue,ErrorCodes:ee,WSDKErrorSeverity:b,resetLauncherAttachState:()=>mt(this._launcherAttachState)},this.attachLauncher(c,E),"Successfully initialized: "+d):(N&&(a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this),ge(bt,he(f),{onLoad:()=>{this._isThankYouElementLoaded=!0,this._thankYouElementOnLoadCallback&&this._thankYouElementOnLoadCallback()},onError:m=>{console.error("Error loading Rokt Thank You Element script:",m)}})),this.isLauncherReadyToAttach()?this.attachLauncher(c,E,R):(ge(Pt,de(f,k),{onLoad:()=>{this.isLauncherReadyToAttach()?this.attachLauncher(c,E,R):console.error("Rokt object is not available after script load.")},onError:m=>{console.error("Error loading Rokt launcher script:",m)}}),this.captureTiming(_.PERFORMANCE_MARKS.RoktScriptAppended)),"Successfully initialized: "+d)}process(e){if(this.isTargetingDisabled()||(e.EventDataType===vt&&(Ve(this.loggingService),this.capturePageView(e),Z(this._preselectState,this.buildPreselectHost(),e)),e.EventDataType===kt&&(ce(),ae(),this.accountId&&L(this.accountId))),!this.isKitReady())return"Kit not ready for forwarder: "+d;if(U(a().Rokt?.setLocalSessionAttribute)&&(A(this.placementEventAttributeMappingLookup)||this.applyPlacementEventAttributeMapping(e),!A(this.placementEventMappingLookup))){const t=Ee(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 Ae(e)||(this.userAttributes[e]=t),ot(this.accountId,e)&&this.flushPendingPreselectDispatches(),"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=y(e.getAllUserAttributes()),"Successfully called "+t+" for forwarder: "+d}onUserIdentified(e){const t=e;this.filters.filteredUser=t,this._workspaceSearchInFlightPromise=this.search(t);const n=this.handleIdentityComplete(e,"onUserIdentified");return this.flushPendingPreselectDispatches(),n}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];g(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.accountId&&L(this.accountId),this.handleIdentityComplete(e,"onLogoutComplete")}onModifyComplete(e,t){return this.handleIdentityComplete(e,"onModifyComplete")}selectPlacements(e){const t=this.recreateLauncherIfTerminated();if(t){const n=this._workspaceSearchInFlightPromise,r=n?Promise.race([n,new Promise(s=>setTimeout(s,ue))]):Promise.resolve();return Promise.all([t,r]).then(()=>this._dispatchPlacements(e))}if(this._workspaceSearchInFlightPromise){const n=this._workspaceSearchInFlightPromise;return Promise.race([n,new Promise(r=>setTimeout(r,ue))]).then(()=>this._dispatchPlacements(e))}return this._dispatchPlacements(e)}_dispatchPlacements(e){const t=e&&e.attributes||{},r={...y(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=y(l);const f=this._onboardingExpProvider==="Optimizely"?this.fetchOptimizely():{},k=this.returnUserIdentities(c),R=this.returnLocalSessionAttributes(),N=He(oe()),E=We(),w=this.readMpSessionId(),I=this.readMpDeviceId(),T=typeof e.identifier=="string"?e.identifier:void 0,m=e.preselect===!0?we(l,this.buildPreselectAttributeOverrides(T)):l,te={...k,...m,...f,...R,...N.length?{[Rt]:JSON.stringify(N)}:{},...E?{[wt]:E}:{},...this.userIdentifiedInWorkspace?{[St]:!0}:{},...w?{[Tt]:w}:{},...I?{[Lt]:I}:{},mpid:u},ie=this.buildCacheMatchKeys(T),Ke={...e,attributes:te,...ie!==void 0?{cacheMatchKeys:ie}:{}},ne=this.launcher.selectPlacements(Ke),re=e.preselect===!0,Ce=()=>{re||this.logSelectPlacementsEvent(te)};return Promise.resolve(ne).then(De=>{if(!re)return De?.context?.sessionId?.then(Me=>this.setRoktSessionId(Me))}).catch(()=>{}).finally(Ce),ne}hashAttributes(e){return this.isKitReady()?this.launcher.hashAttributes(e):(console.error("Rokt Kit: Not initialized"),null)}use(e){return this.isKitReady()?!e||!g(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")))}terminate(){return this.isKitReady()?(ft(this._launcherAttachState),this.launcher.terminate()):(console.error("Rokt Kit: Not initialized"),Promise.resolve())}onShoppableAdsReady(e){this._isThankYouElementLoaded?e():this._thankYouElementOnLoadCallback=e}};_._allowedOriginHashes=[-553112570,549508659],_.PERFORMANCE_MARKS={RoktScriptAppended:"mp:RoktScriptAppended"},_.EMAIL_SHA256_KEY="emailsha256";let S=_;function jt(){return K}function Gt(i){if(!i){window.console.log("You must pass a config object to register the kit "+d);return}if(!p(i)){window.console.log("'config' must be an object. You passed in a "+typeof i);return}p(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:jt});exports.register=Gt;
|
|
2
2
|
//# sourceMappingURL=Rokt-Kit.common.js.map
|