@mparticle/web-rokt-kit 3.6.1 → 3.6.2
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 +182 -172
- 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 Le=["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"],Oe=new Set(Le);function me(i){return Oe.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];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 w(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 A=()=>window.localStorage;function $(i,e=A){try{const t=e().getItem(i);return t===null?null:JSON.parse(t)}catch{return null}}function _e(i,e,t=A){try{return t().setItem(i,JSON.stringify(e)),!0}catch{return!1}}function Ne(i,e=A){try{e().removeItem(i)}catch{}}function O(i,e,t=A){const n=$(i,t);return m(n)?n[e]:void 0}function x(i,e,t,n=A){const r=$(i,n),s=m(r)?{...r}:{};return s[e]=t,_e(i,s,n)}function Y(i,e,t=A){const n=$(i,t);if(!m(n)||!(e in n))return;const r={...n};delete r[e],Object.keys(r).length===0?Ne(i,t):_e(i,r,t)}const q="pageViews",D="utmParams",Ie=25,Ue=["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 Ce(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 Ke(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 De(i){if(O(h,D)!==void 0)return;const e=new URLSearchParams(window.location.search),t={};for(const r of Ue){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 Me(){const i=O(h,D);return m(i)?i:null}function ne(){Y(h,D)}function Fe(){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","amount","customertype","eventvenue","firstname","lastname","member_status","billingzipcode","currency"],optionalAttributeKeys:["firstname","lastname"]},{accountId:"2550745407543340151",pathname:"/checkout",targetPageIdentifier:"RoktExperience",attributeKeys:["email","amount","firstname","lastname","cartItems","customertype","loyaltytier","paymenttype","ccbin"],optionalAttributeKeys:["loyaltytier","paymenttype","ccbin"]},{accountId:"3236704179315511296",pathname:"/check-out/pay",targetPageIdentifier:"confirmation_page",attributeKeys:["email","totalprice","firstname","lastname","loyaltytier"],optionalAttributeKeys:["firstname","lastname","loyaltytier"]}],xe=6e4;function Ye(i){return m(i)&&typeof i.expiresAt=="number"&&m(i.attributes)}function Ge(i,e){return`activePreselect:${i}:${e}`}function je(i){const e=O(h,i);return Ye(e)?e:null}function He(i,e){x(h,i,{expiresAt:Date.now()+xe,attributes:e})}const Ve=5*6e4;function M(){return window.sessionStorage}function We(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 ze(i){const e=B(i),t=O(h,e,M);return We(t)?t.expiresAt<=Date.now()?(Y(h,e,M),null):t:null}function $e(i,e,t,n,r){return x(h,B(i),{expiresAt:Date.now()+Ve,pathname:e,identifier:t,attributes:n,mpid:r},M)}function T(i){Y(h,B(i),M)}function L(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 qe(i,e){if(i)return J.find(t=>t.accountId===i&&t.pathname===e)}function Je(i,e){if(!(!i||!g(e)))return J.find(t=>t.accountId===i&&t.targetPageIdentifier===e)}function Be(i,e){return i?J.some(t=>t.accountId===i&&t.attributeKeys.includes(e)):!1}function Qe(){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 Se(i){const e=i?.getMPID?.();return e==null?null:String(e)}function re(i,e,t){const n=i.filteredUser?.getAllUserAttributes?.()||{},r=new Set((t.optionalAttributeKeys??[]).map(c=>c.toLowerCase())),s={},o=[];for(const c of t.attributeKeys){const u=i.getEventAttributeValue(e,c),l=w(u)?i.userAttributes[c]??n[c]:u;if(w(l)){r.has(c.toLowerCase())||o.push(c);continue}s[c]=l}return{collected:s,missingKeys:o}}function Xe(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 Ae(i,e,t,n,r,s){const o=Ge(e,t),c=je(o),u=!!c&&JSON.stringify(c.attributes)===JSON.stringify(r);if(c&&c.expiresAt>Date.now()&&u){i.logPlacementDiagnostic(L("skipped","active_preselection"));return}He(o,r),i.logPlacementDiagnostic(L("fired",s)),Xe(i,{attributes:r,preselect:!0,identifier:n,omitUrl:!0})}function Ze(i,e){if(!e.accountId||!e.isKitReady())return;const t=ze(e.accountId);if(t){if(i.pending.some(n=>n.pathname===t.pathname)){T(e.accountId);return}if(!e.isPreselectionEnabled()){T(e.accountId);return}V(e.filteredUser)&&(T(e.accountId),Se(e.filteredUser)===t.mpid&&Ae(e,e.accountId,t.identifier,t.identifier,t.attributes,"recovered"))}}function Pe(i,e,t,n=window.location.pathname){const r=qe(e.accountId,n);if(!r)return;if(!e.isKitReady()){const c=[],u=Se(e.filteredUser);if(e.accountId&&u&&V(e.filteredUser)){const{collected:l,missingKeys:f}=re(e,t,r);if(f.length===0){const P=v(l);$e(e.accountId,n,r.targetPageIdentifier,P,u)||c.push(L("queued","persist_failed"))}}j(i,{event:t,pathname:n,storedDiagnostics:c});return}if(!e.isPreselectionEnabled())return;if(!V(e.filteredUser)){e.logPlacementDiagnostic(L("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(L("missed",`missing_attribute:${c}`));j(i,{event:t,pathname:n});return}Ae(e,e.accountId||"",n,r.targetPageIdentifier,s,"fired")}function et(i,e,t=window.location.pathname){if(Ze(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)),Pe(i,e,r,s))})}function tt(){return{context:null,lifecycle:"idle",recreateInFlight:null}}function it(i,e){i.context={accountId:e.accountId,launcherOptions:{...e.launcherOptions},legacyRoktExtensions:[...e.legacyRoktExtensions]}}function nt(i){i.lifecycle="attached"}function rt(i){i.lifecycle!=="idle"&&(i.lifecycle="terminated")}function st(i){i.lifecycle="terminated"}function ot(i){i.context=null,i.lifecycle="idle",i.recreateInFlight=null}function ct(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",C=181,at="selectPlacements",lt="apps.roktecommerce.com",ut=.1,dt="ThankYouPageJourney",ht="rokt-launcher",gt="rokt-thank-you-element",ft="userIdentifiedInWorkspace",pt=3,mt=2,Et="page_events",_t="page_view_attributes",It="mparticle_session_id",yt="mparticle_device_id",se=500,Q={UNKNOWN_ERROR:"UNKNOWN_ERROR",UNHANDLED_EXCEPTION:"UNHANDLED_EXCEPTION",IDENTITY_REQUEST:"IDENTITY_REQUEST",LOG_DELIVERY_FAILURE:"LOG_DELIVERY_FAILURE"},y={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},St="apps.rokt-api.com",At="/v1/log",Pt="/v1/errors",bt=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:St;return e.includes("://")?e.replace(/\/+$/,""):["https://",e].join("")}function be(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 K(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?K(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(dt)):t.push(o)}return{roktExtensionsQueryParams:t,legacyRoktExtensions:n,loadThankYouElement:r}}async function Rt(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 kt(i){let n="mParticle_wsdkv_"+a().getVersion()+"_kitv_"+"3.6.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(S._allowedOriginHashes.indexOf(t)===-1||Math.random()>=ut)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://"+lt+"/v1/wsdk-init/index.html?"+o+"&isControl=true")}function vt(){return typeof window<"u"&&!!window.location?.search?.toLowerCase().includes("mp_enable_logging=true")}function wt(){return typeof window<"u"?window.location?.href:void 0}function Tt(){return typeof window<"u"?window.navigator?.userAgent:void 0}class Re{constructor(){this._logCount={}}incrementAndCheck(e){const n=(this._logCount[e]||0)+1;return this._logCount[e]=n,n>bt}}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 Re,this._isEnabled=vt()||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:wt(),deviceInfo:Tt(),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=be(e?.errorUrl,e?.integrationDomain,Pt)}report(e){if(!e)return;const t=e.severity||y.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=be(e?.loggingUrl,e?.integrationDomain,At),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,y.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?y.ERROR:y.WARNING})}})}}function Lt(i){const e=z(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 _=class _{constructor(){this.name=d,this.id=C,this.moduleId=C,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=tt(),this.accountId=null,this._preselectState=Qe()}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(w(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=Lt(e);n.push(r);const s=Math.min(n.length,Ie),o=Ce(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=Je(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(){et(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(at,t,e)}setRoktSessionId(e){if(!(!e||typeof e!="string"))try{const t=a().getInstance();t&&U(t.setIntegrationAttribute)&&t.setIntegrationAttribute(C,{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=[]){it(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 Rt([...n],o),this.initRoktLauncher(o)}).catch(o=>{const c=this._launcherAttachState.lifecycle==="attached";if(st(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 ct(this._launcherAttachState,this.isLauncherReadyToAttach(),e=>this.attachLauncher(e.accountId,e.launcherOptions,e.legacyRoktExtensions))}initRoktLauncher(e){window.Rokt&&(window.Rokt.currentLauncher=e),this.launcher=e,nt(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=v(s),this._onboardingExpProvider=o.onboardingExpProvider;const u=K(o.placementEventMapping);this.placementEventMappingLookup=ue(u);const l=K(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:P,legacyRoktExtensions:b,loadThankYouElement:N}=le(o.roktExtensions),E={...a().Rokt?.launcherOptions||{}};this.integrationName=kt(E.integrationName),E.integrationName=this.integrationName,this.domain=f;const R={loggingUrl:o.loggingUrl,errorUrl:o.errorUrl,integrationDomain:f,isLoggingEnabled:a().config?.isLoggingEnabled===!0},I=new fe(R,this.integrationName,window.__rokt_li_guid__,o.accountId),k=new pe(R,I,this.integrationName,window.__rokt_li_guid__,o.accountId);if(this.errorReportingService=I,this.loggingService=k,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:y.INFO,stackTrace:p instanceof Error?p.stack:void 0})}return a()._registerErrorReportingService&&a()._registerErrorReportingService(I),a()._registerLoggingService&&a()._registerLoggingService(k),n?(this.testHelpers={generateLauncherScript:oe,generateThankYouElementScript:ce,extractRoktExtensionConfig:le,hashEventMessage:he,parseSettingsString:K,generateMappedEventLookup:ue,generateMappedEventAttributeLookup:de,sendAdBlockMeasurementSignals:ge,createAutoRemovedIframe:W,djb2:Ee,setAllowedOriginHashes:p=>{_._allowedOriginHashes=p},ReportingTransport:F,ErrorReportingService:fe,LoggingService:pe,RateLimiter:Re,ErrorCodes:Q,WSDKErrorSeverity:y,resetLauncherAttachState:()=>ot(this._launcherAttachState)},this.attachLauncher(c,E),"Successfully initialized: "+d):(N&&(a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this),ae(gt,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,b):(ae(ht,oe(f,P),{onLoad:()=>{this.isLauncherReadyToAttach()?this.attachLauncher(c,E,b):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===pt&&(De(this.loggingService),this.capturePageView(e),Pe(this._preselectState,this.buildPreselectHost(),e)),e.EventDataType===mt&&(ie(),ne(),this.accountId&&T(this.accountId))),!this.isKitReady())return"Kit not ready for forwarder: "+d;if(U(a().Rokt?.setLocalSessionAttribute)&&(w(this.placementEventAttributeMappingLookup)||this.applyPlacementEventAttributeMapping(e),!w(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),Be(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=v(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&&T(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={...v(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=v(l);const f=this._onboardingExpProvider==="Optimizely"?this.fetchOptimizely():{},P=this.returnUserIdentities(c),b=this.returnLocalSessionAttributes(),N=Ke(te()),E=Me(),R=this.readMpSessionId(),I=this.readMpDeviceId(),k={...P,...l,...f,...b,...N.length?{[Et]:JSON.stringify(N)}:{},...E?{[_t]:E}:{},...this.userIdentifiedInWorkspace?{[ft]:!0}:{},...R?{[It]:R}:{},...I?{[yt]:I}:{},mpid:u},p=this.buildCacheMatchKeys(typeof e.identifier=="string"?e.identifier:void 0),ke={...e,attributes:k,...p!==void 0?{cacheMatchKeys:p}:{}},X=this.launcher.selectPlacements(ke),Z=e.preselect===!0,ve=()=>{Z||this.logSelectPlacementsEvent(k)};return Promise.resolve(X).then(we=>{if(!Z)return we?.context?.sessionId?.then(Te=>this.setRoktSessionId(Te))}).catch(()=>{}).finally(ve),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()?(rt(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 Ot(){return C}function Nt(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: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:Ot});exports.register=Nt;
|
|
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 Ce(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?Ce(i,t):_e(i,r,t)}const q="pageViews",D="utmParams",Ie=25,Ke=["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 Ke){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"]}],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 Se(i,e){if(i)return J.find(t=>t.accountId===i&&t.pathname===e)}function Be(i,e){if(!(!i||!g(e)))return J.find(t=>t.accountId===i&&t.targetPageIdentifier===e)}function Qe(i,e){return i?J.some(t=>t.accountId===i&&t.attributeKeys.includes(e)):!1}function Xe(){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 Ze(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)),Ze(i,{attributes:r,preselect:!0,identifier:n,omitUrl:!0})}function et(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 tt(i,e,t=window.location.pathname){if(et(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 it(){return{context:null,lifecycle:"idle",recreateInFlight:null}}function nt(i,e){i.context={accountId:e.accountId,launcherOptions:{...e.launcherOptions},legacyRoktExtensions:[...e.legacyRoktExtensions]}}function rt(i){i.lifecycle="attached"}function st(i){i.lifecycle!=="idle"&&(i.lifecycle="terminated")}function ot(i){i.lifecycle="terminated"}function ct(i){i.context=null,i.lifecycle="idle",i.recreateInFlight=null}function at(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",C=181,lt="selectPlacements",ut="apps.roktecommerce.com",dt=.1,ht="ThankYouPageJourney",gt="rokt-launcher",ft="rokt-thank-you-element",pt="userIdentifiedInWorkspace",mt=3,Et=2,_t="page_events",It="page_view_attributes",yt="mparticle_session_id",St="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"},At="apps.rokt-api.com",Pt="/v1/log",bt="/v1/errors",Rt=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:At;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 K(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?K(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(ht)):t.push(o)}return{roktExtensionsQueryParams:t,legacyRoktExtensions:n,loadThankYouElement:r}}async function kt(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 vt(i){let n="mParticle_wsdkv_"+a().getVersion()+"_kitv_"+"3.6.2";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()>=dt)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://"+ut+"/v1/wsdk-init/index.html?"+o+"&isControl=true")}function wt(){return typeof window<"u"&&!!window.location?.search?.toLowerCase().includes("mp_enable_logging=true")}function Tt(){return typeof window<"u"?window.location?.href:void 0}function Lt(){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>Rt}}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=wt()||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:Tt(),deviceInfo:Lt(),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,bt)}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,Pt),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 Ot(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=C,this.moduleId=C,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=it(),this.accountId=null,this._preselectState=Xe()}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=Ot(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=Be(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(){tt(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(lt,t,e)}setRoktSessionId(e){if(!(!e||typeof e!="string"))try{const t=a().getInstance();t&&U(t.setIntegrationAttribute)&&t.setIntegrationAttribute(C,{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=[]){nt(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 kt([...n],o),this.initRoktLauncher(o)}).catch(o=>{const c=this._launcherAttachState.lifecycle==="attached";if(ot(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 at(this._launcherAttachState,this.isLauncherReadyToAttach(),e=>this.attachLauncher(e.accountId,e.launcherOptions,e.legacyRoktExtensions))}initRoktLauncher(e){window.Rokt&&(window.Rokt.currentLauncher=e),this.launcher=e,rt(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=K(o.placementEventMapping);this.placementEventMappingLookup=ue(u);const l=K(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=vt(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:K,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:()=>ct(this._launcherAttachState)},this.attachLauncher(c,E),"Successfully initialized: "+d):(N&&(a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this),ae(ft,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(gt,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===mt&&(Fe(this.loggingService),this.capturePageView(e),Re(this._preselectState,this.buildPreselectHost(),e)),e.EventDataType===Et&&(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),Qe(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?{[_t]:JSON.stringify(N)}:{},...E?{[It]:E}:{},...this.userIdentifiedInWorkspace?{[pt]:!0}:{},...w?{[yt]:w}:{},...I?{[St]: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()?(st(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 Nt(){return C}function Ut(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:Nt});exports.register=Ut;
|
|
2
2
|
//# sourceMappingURL=Rokt-Kit.common.js.map
|
package/dist/Rokt-Kit.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Ne = [
|
|
2
2
|
"active_time_on_site_ms",
|
|
3
3
|
"billingaddress1",
|
|
4
4
|
"billingaddress2",
|
|
@@ -23,11 +23,11 @@ const Le = [
|
|
|
23
23
|
"shippingstate",
|
|
24
24
|
"shippingzipcode",
|
|
25
25
|
"totalprice"
|
|
26
|
-
],
|
|
26
|
+
], Ue = new Set(Ne);
|
|
27
27
|
function me(i) {
|
|
28
|
-
return
|
|
28
|
+
return Ue.has(i.toLowerCase());
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function y(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];
|
|
@@ -44,7 +44,7 @@ function g(i) {
|
|
|
44
44
|
function U(i) {
|
|
45
45
|
return typeof i == "function";
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function A(i) {
|
|
48
48
|
return i == null ? !0 : typeof i == "string" ? i.length === 0 : typeof i == "object" ? Object.keys(i).length === 0 : !1;
|
|
49
49
|
}
|
|
50
50
|
function z(i) {
|
|
@@ -69,8 +69,8 @@ function H() {
|
|
|
69
69
|
return !1;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
const
|
|
73
|
-
function $(i, e =
|
|
72
|
+
const R = () => window.localStorage;
|
|
73
|
+
function $(i, e = R) {
|
|
74
74
|
try {
|
|
75
75
|
const t = e().getItem(i);
|
|
76
76
|
return t === null ? null : JSON.parse(t);
|
|
@@ -78,35 +78,35 @@ function $(i, e = A) {
|
|
|
78
78
|
return null;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
function _e(i, e, t =
|
|
81
|
+
function _e(i, e, t = R) {
|
|
82
82
|
try {
|
|
83
83
|
return t().setItem(i, JSON.stringify(e)), !0;
|
|
84
84
|
} catch {
|
|
85
85
|
return !1;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function Ce(i, e = R) {
|
|
89
89
|
try {
|
|
90
90
|
e().removeItem(i);
|
|
91
91
|
} catch {
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
function O(i, e, t =
|
|
94
|
+
function O(i, e, t = R) {
|
|
95
95
|
const n = $(i, t);
|
|
96
96
|
return m(n) ? n[e] : void 0;
|
|
97
97
|
}
|
|
98
|
-
function x(i, e, t, n =
|
|
98
|
+
function x(i, e, t, n = R) {
|
|
99
99
|
const r = $(i, n), s = m(r) ? { ...r } : {};
|
|
100
100
|
return s[e] = t, _e(i, s, n);
|
|
101
101
|
}
|
|
102
|
-
function Y(i, e, t =
|
|
102
|
+
function Y(i, e, t = R) {
|
|
103
103
|
const n = $(i, t);
|
|
104
104
|
if (!m(n) || !(e in n))
|
|
105
105
|
return;
|
|
106
106
|
const r = { ...n };
|
|
107
|
-
delete r[e], Object.keys(r).length === 0 ?
|
|
107
|
+
delete r[e], Object.keys(r).length === 0 ? Ce(i, t) : _e(i, r, t);
|
|
108
108
|
}
|
|
109
|
-
const q = "pageViews", D = "utmParams", Ie = 25,
|
|
109
|
+
const q = "pageViews", D = "utmParams", Ie = 25, Ke = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
|
|
110
110
|
function ye(i) {
|
|
111
111
|
return i.slice(-Ie);
|
|
112
112
|
}
|
|
@@ -114,7 +114,7 @@ function te() {
|
|
|
114
114
|
const i = O(h, q);
|
|
115
115
|
return Array.isArray(i) ? i : [];
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function De(i) {
|
|
118
118
|
const e = ye(i);
|
|
119
119
|
for (let t = 0; t < e.length; t++) {
|
|
120
120
|
const n = e.slice(t);
|
|
@@ -126,7 +126,7 @@ function Ce(i) {
|
|
|
126
126
|
function ie() {
|
|
127
127
|
Y(h, q);
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function Me(i) {
|
|
130
130
|
const e = ye(i);
|
|
131
131
|
return e.map((t, n) => {
|
|
132
132
|
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;
|
|
@@ -141,11 +141,11 @@ function Ke(i) {
|
|
|
141
141
|
};
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function Fe(i) {
|
|
145
145
|
if (O(h, D) !== void 0)
|
|
146
146
|
return;
|
|
147
147
|
const e = new URLSearchParams(window.location.search), t = {};
|
|
148
|
-
for (const r of
|
|
148
|
+
for (const r of Ke) {
|
|
149
149
|
const s = e.get(r);
|
|
150
150
|
s && (t[r] = s);
|
|
151
151
|
}
|
|
@@ -165,14 +165,14 @@ function De(i) {
|
|
|
165
165
|
code: "UTM_CAPTURE_SUCCESS"
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function xe() {
|
|
169
169
|
const i = O(h, D);
|
|
170
170
|
return m(i) ? i : null;
|
|
171
171
|
}
|
|
172
172
|
function ne() {
|
|
173
173
|
Y(h, D);
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function Ye() {
|
|
176
176
|
const e = document.querySelector('link[rel="canonical"]')?.href;
|
|
177
177
|
if (e)
|
|
178
178
|
return z(e);
|
|
@@ -184,7 +184,6 @@ const J = [
|
|
|
184
184
|
targetPageIdentifier: "prod.rokt.conf",
|
|
185
185
|
attributeKeys: [
|
|
186
186
|
"email",
|
|
187
|
-
"amount",
|
|
188
187
|
"customertype",
|
|
189
188
|
"eventvenue",
|
|
190
189
|
"firstname",
|
|
@@ -201,10 +200,8 @@ const J = [
|
|
|
201
200
|
targetPageIdentifier: "RoktExperience",
|
|
202
201
|
attributeKeys: [
|
|
203
202
|
"email",
|
|
204
|
-
"amount",
|
|
205
203
|
"firstname",
|
|
206
204
|
"lastname",
|
|
207
|
-
"cartItems",
|
|
208
205
|
"customertype",
|
|
209
206
|
"loyaltytier",
|
|
210
207
|
"paymenttype",
|
|
@@ -218,7 +215,6 @@ const J = [
|
|
|
218
215
|
targetPageIdentifier: "confirmation_page",
|
|
219
216
|
attributeKeys: [
|
|
220
217
|
"email",
|
|
221
|
-
"totalprice",
|
|
222
218
|
"firstname",
|
|
223
219
|
"lastname",
|
|
224
220
|
"loyaltytier"
|
|
@@ -229,43 +225,43 @@ const J = [
|
|
|
229
225
|
"loyaltytier"
|
|
230
226
|
]
|
|
231
227
|
}
|
|
232
|
-
],
|
|
233
|
-
function
|
|
228
|
+
], Ge = 6e4;
|
|
229
|
+
function je(i) {
|
|
234
230
|
return m(i) && typeof i.expiresAt == "number" && m(i.attributes);
|
|
235
231
|
}
|
|
236
|
-
function
|
|
232
|
+
function He(i, e) {
|
|
237
233
|
return `activePreselect:${i}:${e}`;
|
|
238
234
|
}
|
|
239
|
-
function
|
|
235
|
+
function Ve(i) {
|
|
240
236
|
const e = O(h, i);
|
|
241
|
-
return
|
|
237
|
+
return je(e) ? e : null;
|
|
242
238
|
}
|
|
243
|
-
function
|
|
239
|
+
function We(i, e) {
|
|
244
240
|
x(h, i, {
|
|
245
|
-
expiresAt: Date.now() +
|
|
241
|
+
expiresAt: Date.now() + Ge,
|
|
246
242
|
attributes: e
|
|
247
243
|
});
|
|
248
244
|
}
|
|
249
|
-
const
|
|
245
|
+
const ze = 5 * 6e4;
|
|
250
246
|
function M() {
|
|
251
247
|
return window.sessionStorage;
|
|
252
248
|
}
|
|
253
|
-
function
|
|
249
|
+
function $e(i) {
|
|
254
250
|
return m(i) && typeof i.expiresAt == "number" && g(i.pathname) && g(i.identifier) && m(i.attributes) && g(i.mpid);
|
|
255
251
|
}
|
|
256
252
|
function B(i) {
|
|
257
253
|
return `pendingPreselect:${i}`;
|
|
258
254
|
}
|
|
259
|
-
function
|
|
255
|
+
function qe(i) {
|
|
260
256
|
const e = B(i), t = O(h, e, M);
|
|
261
|
-
return
|
|
257
|
+
return $e(t) ? t.expiresAt <= Date.now() ? (Y(h, e, M), null) : t : null;
|
|
262
258
|
}
|
|
263
|
-
function
|
|
259
|
+
function Je(i, e, t, n, r) {
|
|
264
260
|
return x(
|
|
265
261
|
h,
|
|
266
262
|
B(i),
|
|
267
263
|
{
|
|
268
|
-
expiresAt: Date.now() +
|
|
264
|
+
expiresAt: Date.now() + ze,
|
|
269
265
|
pathname: e,
|
|
270
266
|
identifier: t,
|
|
271
267
|
attributes: n,
|
|
@@ -274,10 +270,10 @@ function $e(i, e, t, n, r) {
|
|
|
274
270
|
M
|
|
275
271
|
);
|
|
276
272
|
}
|
|
277
|
-
function
|
|
273
|
+
function L(i) {
|
|
278
274
|
Y(h, B(i), M);
|
|
279
275
|
}
|
|
280
|
-
function
|
|
276
|
+
function S(i, e) {
|
|
281
277
|
const t = {
|
|
282
278
|
fired: "PRESELECT_FIRED",
|
|
283
279
|
missed: "PRESELECT_MISSED",
|
|
@@ -289,18 +285,18 @@ function L(i, e) {
|
|
|
289
285
|
code: t[i]
|
|
290
286
|
};
|
|
291
287
|
}
|
|
292
|
-
function
|
|
288
|
+
function Ae(i, e) {
|
|
293
289
|
if (i)
|
|
294
290
|
return J.find((t) => t.accountId === i && t.pathname === e);
|
|
295
291
|
}
|
|
296
|
-
function
|
|
292
|
+
function Be(i, e) {
|
|
297
293
|
if (!(!i || !g(e)))
|
|
298
294
|
return J.find((t) => t.accountId === i && t.targetPageIdentifier === e);
|
|
299
295
|
}
|
|
300
|
-
function
|
|
296
|
+
function Qe(i, e) {
|
|
301
297
|
return i ? J.some((t) => t.accountId === i && t.attributeKeys.includes(e)) : !1;
|
|
302
298
|
}
|
|
303
|
-
function
|
|
299
|
+
function Xe() {
|
|
304
300
|
return { pending: [] };
|
|
305
301
|
}
|
|
306
302
|
function j(i, e) {
|
|
@@ -324,19 +320,22 @@ function Se(i) {
|
|
|
324
320
|
const e = i?.getMPID?.();
|
|
325
321
|
return e == null ? null : String(e);
|
|
326
322
|
}
|
|
323
|
+
function Pe(i, e) {
|
|
324
|
+
const t = new Set((i.optionalAttributeKeys ?? []).map((n) => n.toLowerCase()));
|
|
325
|
+
return i.attributeKeys.filter((n) => !t.has(n.toLowerCase()) && A(e[n]));
|
|
326
|
+
}
|
|
327
327
|
function re(i, e, t) {
|
|
328
|
-
const n = i.filteredUser?.getAllUserAttributes?.() || {}, r =
|
|
329
|
-
for (const
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
r.has(c.toLowerCase()) || o.push(c);
|
|
333
|
-
continue;
|
|
334
|
-
}
|
|
335
|
-
s[c] = l;
|
|
328
|
+
const n = i.filteredUser?.getAllUserAttributes?.() || {}, r = {};
|
|
329
|
+
for (const s of t.attributeKeys) {
|
|
330
|
+
const o = i.getEventAttributeValue(e, s), c = A(o) ? i.userAttributes[s] ?? n[s] : o;
|
|
331
|
+
A(c) || (r[s] = c);
|
|
336
332
|
}
|
|
337
|
-
return {
|
|
333
|
+
return {
|
|
334
|
+
collected: r,
|
|
335
|
+
missingKeys: Pe(t, r)
|
|
336
|
+
};
|
|
338
337
|
}
|
|
339
|
-
function
|
|
338
|
+
function Ze(i, e) {
|
|
340
339
|
Promise.resolve(i.selectPlacements(e)).catch((t) => {
|
|
341
340
|
const n = t instanceof Error ? t.message : String(t);
|
|
342
341
|
i.log({
|
|
@@ -345,32 +344,43 @@ function Xe(i, e) {
|
|
|
345
344
|
});
|
|
346
345
|
});
|
|
347
346
|
}
|
|
348
|
-
function
|
|
349
|
-
const o =
|
|
347
|
+
function be(i, e, t, n, r, s) {
|
|
348
|
+
const o = He(e, t), c = Ve(o), u = !!c && JSON.stringify(c.attributes) === JSON.stringify(r);
|
|
350
349
|
if (c && c.expiresAt > Date.now() && u) {
|
|
351
|
-
i.logPlacementDiagnostic(
|
|
350
|
+
i.logPlacementDiagnostic(S("skipped", "active_preselection"));
|
|
352
351
|
return;
|
|
353
352
|
}
|
|
354
|
-
|
|
353
|
+
We(o, r), i.logPlacementDiagnostic(S("fired", s)), Ze(i, { attributes: r, preselect: !0, identifier: n, omitUrl: !0 });
|
|
355
354
|
}
|
|
356
|
-
function
|
|
355
|
+
function et(i, e) {
|
|
357
356
|
if (!e.accountId || !e.isKitReady())
|
|
358
357
|
return;
|
|
359
|
-
const t =
|
|
360
|
-
if (t)
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
if (!e.isPreselectionEnabled()) {
|
|
366
|
-
T(e.accountId);
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
V(e.filteredUser) && (T(e.accountId), Se(e.filteredUser) === t.mpid && Ae(e, e.accountId, t.identifier, t.identifier, t.attributes, "recovered"));
|
|
358
|
+
const t = qe(e.accountId);
|
|
359
|
+
if (!t)
|
|
360
|
+
return;
|
|
361
|
+
if (i.pending.some((o) => o.pathname === t.pathname)) {
|
|
362
|
+
L(e.accountId);
|
|
363
|
+
return;
|
|
370
364
|
}
|
|
365
|
+
if (!e.isPreselectionEnabled()) {
|
|
366
|
+
L(e.accountId);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
if (!V(e.filteredUser) || (L(e.accountId), Se(e.filteredUser) !== t.mpid))
|
|
370
|
+
return;
|
|
371
|
+
const n = Ae(e.accountId, t.pathname);
|
|
372
|
+
if (!n || n.targetPageIdentifier !== t.identifier)
|
|
373
|
+
return;
|
|
374
|
+
const r = y(t.attributes), s = Pe(n, r);
|
|
375
|
+
if (s.length > 0) {
|
|
376
|
+
for (const o of s)
|
|
377
|
+
e.logPlacementDiagnostic(S("missed", `missing_persisted_attribute:${o}`));
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
be(e, e.accountId, t.identifier, t.identifier, r, "recovered");
|
|
371
381
|
}
|
|
372
|
-
function
|
|
373
|
-
const r =
|
|
382
|
+
function Re(i, e, t, n = window.location.pathname) {
|
|
383
|
+
const r = Ae(e.accountId, n);
|
|
374
384
|
if (!r)
|
|
375
385
|
return;
|
|
376
386
|
if (!e.isKitReady()) {
|
|
@@ -378,14 +388,14 @@ function Pe(i, e, t, n = window.location.pathname) {
|
|
|
378
388
|
if (e.accountId && u && V(e.filteredUser)) {
|
|
379
389
|
const { collected: l, missingKeys: f } = re(e, t, r);
|
|
380
390
|
if (f.length === 0) {
|
|
381
|
-
const
|
|
382
|
-
|
|
391
|
+
const k = y(l);
|
|
392
|
+
Je(
|
|
383
393
|
e.accountId,
|
|
384
394
|
n,
|
|
385
395
|
r.targetPageIdentifier,
|
|
386
|
-
|
|
396
|
+
k,
|
|
387
397
|
u
|
|
388
|
-
) || c.push(
|
|
398
|
+
) || c.push(S("queued", "persist_failed"));
|
|
389
399
|
}
|
|
390
400
|
}
|
|
391
401
|
j(i, { event: t, pathname: n, storedDiagnostics: c });
|
|
@@ -394,53 +404,53 @@ function Pe(i, e, t, n = window.location.pathname) {
|
|
|
394
404
|
if (!e.isPreselectionEnabled())
|
|
395
405
|
return;
|
|
396
406
|
if (!V(e.filteredUser)) {
|
|
397
|
-
e.logPlacementDiagnostic(
|
|
407
|
+
e.logPlacementDiagnostic(S("missed", "no_valid_identity")), j(i, { event: t, pathname: n });
|
|
398
408
|
return;
|
|
399
409
|
}
|
|
400
410
|
const { collected: s, missingKeys: o } = re(e, t, r);
|
|
401
411
|
if (o.length > 0) {
|
|
402
412
|
for (const c of o)
|
|
403
|
-
e.logPlacementDiagnostic(
|
|
413
|
+
e.logPlacementDiagnostic(S("missed", `missing_attribute:${c}`));
|
|
404
414
|
j(i, { event: t, pathname: n });
|
|
405
415
|
return;
|
|
406
416
|
}
|
|
407
|
-
|
|
417
|
+
be(e, e.accountId || "", n, r.targetPageIdentifier, s, "fired");
|
|
408
418
|
}
|
|
409
|
-
function
|
|
410
|
-
if (
|
|
419
|
+
function tt(i, e, t = window.location.pathname) {
|
|
420
|
+
if (et(i, e), i.pending.length === 0)
|
|
411
421
|
return;
|
|
412
422
|
const n = i.pending;
|
|
413
423
|
i.pending = [], n.forEach(({ event: r, pathname: s, storedDiagnostics: o }) => {
|
|
414
|
-
s === t && (e.isKitReady() && e.isPreselectionEnabled() && o?.forEach((c) => e.logPlacementDiagnostic(c)),
|
|
424
|
+
s === t && (e.isKitReady() && e.isPreselectionEnabled() && o?.forEach((c) => e.logPlacementDiagnostic(c)), Re(i, e, r, s));
|
|
415
425
|
});
|
|
416
426
|
}
|
|
417
|
-
function
|
|
427
|
+
function it() {
|
|
418
428
|
return {
|
|
419
429
|
context: null,
|
|
420
430
|
lifecycle: "idle",
|
|
421
431
|
recreateInFlight: null
|
|
422
432
|
};
|
|
423
433
|
}
|
|
424
|
-
function
|
|
434
|
+
function nt(i, e) {
|
|
425
435
|
i.context = {
|
|
426
436
|
accountId: e.accountId,
|
|
427
437
|
launcherOptions: { ...e.launcherOptions },
|
|
428
438
|
legacyRoktExtensions: [...e.legacyRoktExtensions]
|
|
429
439
|
};
|
|
430
440
|
}
|
|
431
|
-
function
|
|
441
|
+
function rt(i) {
|
|
432
442
|
i.lifecycle = "attached";
|
|
433
443
|
}
|
|
434
|
-
function
|
|
444
|
+
function st(i) {
|
|
435
445
|
i.lifecycle !== "idle" && (i.lifecycle = "terminated");
|
|
436
446
|
}
|
|
437
|
-
function
|
|
447
|
+
function ot(i) {
|
|
438
448
|
i.lifecycle = "terminated";
|
|
439
449
|
}
|
|
440
|
-
function
|
|
450
|
+
function ct(i) {
|
|
441
451
|
i.context = null, i.lifecycle = "idle", i.recreateInFlight = null;
|
|
442
452
|
}
|
|
443
|
-
function
|
|
453
|
+
function at(i, e, t) {
|
|
444
454
|
if (i.recreateInFlight)
|
|
445
455
|
return i.recreateInFlight;
|
|
446
456
|
if (i.lifecycle !== "terminated" || !i.context || !e)
|
|
@@ -451,16 +461,16 @@ function ct(i, e, t) {
|
|
|
451
461
|
i.recreateInFlight = null;
|
|
452
462
|
}), i.recreateInFlight;
|
|
453
463
|
}
|
|
454
|
-
const d = "Rokt", C = 181,
|
|
464
|
+
const d = "Rokt", C = 181, lt = "selectPlacements", ut = "apps.roktecommerce.com", dt = 0.1, ht = "ThankYouPageJourney", gt = "rokt-launcher", ft = "rokt-thank-you-element", pt = "userIdentifiedInWorkspace", mt = 3, Et = 2, _t = "page_events", It = "page_view_attributes", yt = "mparticle_session_id", At = "mparticle_device_id", se = 500, Q = {
|
|
455
465
|
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
|
456
466
|
UNHANDLED_EXCEPTION: "UNHANDLED_EXCEPTION",
|
|
457
467
|
IDENTITY_REQUEST: "IDENTITY_REQUEST",
|
|
458
468
|
LOG_DELIVERY_FAILURE: "LOG_DELIVERY_FAILURE"
|
|
459
|
-
},
|
|
469
|
+
}, P = {
|
|
460
470
|
ERROR: "ERROR",
|
|
461
471
|
INFO: "INFO",
|
|
462
472
|
WARNING: "WARNING"
|
|
463
|
-
}, St = "apps.rokt-api.com",
|
|
473
|
+
}, St = "apps.rokt-api.com", Pt = "/v1/log", bt = "/v1/errors", Rt = 10;
|
|
464
474
|
function a() {
|
|
465
475
|
return window.mParticle;
|
|
466
476
|
}
|
|
@@ -475,7 +485,7 @@ function G(i) {
|
|
|
475
485
|
const e = i !== void 0 ? i : St;
|
|
476
486
|
return e.includes("://") ? e.replace(/\/+$/, "") : ["https://", e].join("");
|
|
477
487
|
}
|
|
478
|
-
function
|
|
488
|
+
function ke(i, e, t) {
|
|
479
489
|
if (i)
|
|
480
490
|
return i.startsWith("http://") || i.startsWith("https://") ? i : "https://" + i;
|
|
481
491
|
const r = e?.includes("://") && !/^https?:\/\//i.test(e) ? void 0 : e;
|
|
@@ -501,7 +511,7 @@ function le(i) {
|
|
|
501
511
|
let r = !1;
|
|
502
512
|
for (let s = 0; s < e.length; s++) {
|
|
503
513
|
const o = e[s].value;
|
|
504
|
-
o === "thank-you-journey" ? (r = !0, n.push(
|
|
514
|
+
o === "thank-you-journey" ? (r = !0, n.push(ht)) : t.push(o);
|
|
505
515
|
}
|
|
506
516
|
return {
|
|
507
517
|
roktExtensionsQueryParams: t,
|
|
@@ -509,7 +519,7 @@ function le(i) {
|
|
|
509
519
|
loadThankYouElement: r
|
|
510
520
|
};
|
|
511
521
|
}
|
|
512
|
-
async function
|
|
522
|
+
async function kt(i, e) {
|
|
513
523
|
const t = [];
|
|
514
524
|
if (e)
|
|
515
525
|
for (const n of i)
|
|
@@ -545,8 +555,8 @@ function de(i) {
|
|
|
545
555
|
function he(i, e, t) {
|
|
546
556
|
return a().generateHash([i, e, t].join(""));
|
|
547
557
|
}
|
|
548
|
-
function
|
|
549
|
-
let n = "mParticle_wsdkv_" + a().getVersion() + "_kitv_" + "3.6.
|
|
558
|
+
function vt(i) {
|
|
559
|
+
let n = "mParticle_wsdkv_" + a().getVersion() + "_kitv_" + "3.6.2";
|
|
550
560
|
return i && (n += "_" + i), n;
|
|
551
561
|
}
|
|
552
562
|
function W(i) {
|
|
@@ -559,39 +569,39 @@ function W(i) {
|
|
|
559
569
|
}
|
|
560
570
|
function ge(i, e) {
|
|
561
571
|
const t = Ee(window.location.origin);
|
|
562
|
-
if (
|
|
572
|
+
if (b._allowedOriginHashes.indexOf(t) === -1 || Math.random() >= dt)
|
|
563
573
|
return;
|
|
564
574
|
const r = window.__rokt_li_guid__;
|
|
565
575
|
if (!r || i && i.includes("://") && !/^https:\/\//i.test(i))
|
|
566
576
|
return;
|
|
567
577
|
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";
|
|
568
578
|
W(c + "/v1/wsdk-init/index.html?" + o), W(
|
|
569
|
-
"https://" +
|
|
579
|
+
"https://" + ut + "/v1/wsdk-init/index.html?" + o + "&isControl=true"
|
|
570
580
|
);
|
|
571
581
|
}
|
|
572
|
-
function
|
|
582
|
+
function wt() {
|
|
573
583
|
return typeof window < "u" && !!window.location?.search?.toLowerCase().includes("mp_enable_logging=true");
|
|
574
584
|
}
|
|
575
|
-
function
|
|
585
|
+
function Tt() {
|
|
576
586
|
return typeof window < "u" ? window.location?.href : void 0;
|
|
577
587
|
}
|
|
578
|
-
function
|
|
588
|
+
function Lt() {
|
|
579
589
|
return typeof window < "u" ? window.navigator?.userAgent : void 0;
|
|
580
590
|
}
|
|
581
|
-
class
|
|
591
|
+
class ve {
|
|
582
592
|
constructor() {
|
|
583
593
|
this._logCount = {};
|
|
584
594
|
}
|
|
585
595
|
incrementAndCheck(e) {
|
|
586
596
|
const n = (this._logCount[e] || 0) + 1;
|
|
587
|
-
return this._logCount[e] = n, n >
|
|
597
|
+
return this._logCount[e] = n, n > Rt;
|
|
588
598
|
}
|
|
589
599
|
}
|
|
590
600
|
class F {
|
|
591
601
|
constructor(e, t, n, r, s) {
|
|
592
602
|
this._reporter = "mp-wsdk";
|
|
593
603
|
const o = e.isLoggingEnabled;
|
|
594
|
-
this._integrationName = t || "", this._launcherInstanceGuid = n, this._accountId = r || null, this._rateLimiter = s || new
|
|
604
|
+
this._integrationName = t || "", this._launcherInstanceGuid = n, this._accountId = r || null, this._rateLimiter = s || new ve(), this._isEnabled = wt() || o;
|
|
595
605
|
}
|
|
596
606
|
send(e, t, n, r, s, o) {
|
|
597
607
|
if (!(!this._isEnabled || this._rateLimiter.incrementAndCheck(t)))
|
|
@@ -603,8 +613,8 @@ class F {
|
|
|
603
613
|
},
|
|
604
614
|
severity: t,
|
|
605
615
|
code: r || Q.UNKNOWN_ERROR,
|
|
606
|
-
url:
|
|
607
|
-
deviceInfo:
|
|
616
|
+
url: Tt(),
|
|
617
|
+
deviceInfo: Lt(),
|
|
608
618
|
stackTrace: s,
|
|
609
619
|
reporter: this._reporter,
|
|
610
620
|
integration: this._integrationName
|
|
@@ -633,11 +643,11 @@ class F {
|
|
|
633
643
|
}
|
|
634
644
|
class fe {
|
|
635
645
|
constructor(e, t, n, r, s) {
|
|
636
|
-
this._transport = new F(e, t, n, r, s), this._errorUrl =
|
|
646
|
+
this._transport = new F(e, t, n, r, s), this._errorUrl = ke(e?.errorUrl, e?.integrationDomain, bt);
|
|
637
647
|
}
|
|
638
648
|
report(e) {
|
|
639
649
|
if (!e) return;
|
|
640
|
-
const t = e.severity ||
|
|
650
|
+
const t = e.severity || P.ERROR;
|
|
641
651
|
this._transport.send(this._errorUrl, t, e.message, e.code, e.stackTrace);
|
|
642
652
|
}
|
|
643
653
|
}
|
|
@@ -648,7 +658,7 @@ class pe {
|
|
|
648
658
|
n,
|
|
649
659
|
r,
|
|
650
660
|
s
|
|
651
|
-
), this._loggingUrl =
|
|
661
|
+
), this._loggingUrl = ke(e?.loggingUrl, e?.integrationDomain, Pt), this._errorReportingService = t;
|
|
652
662
|
}
|
|
653
663
|
log(e) {
|
|
654
664
|
e && this._send(this._transport, e);
|
|
@@ -659,7 +669,7 @@ class pe {
|
|
|
659
669
|
_send(e, t) {
|
|
660
670
|
e.send(
|
|
661
671
|
this._loggingUrl,
|
|
662
|
-
|
|
672
|
+
P.INFO,
|
|
663
673
|
t.message,
|
|
664
674
|
t.code,
|
|
665
675
|
void 0,
|
|
@@ -669,15 +679,15 @@ class pe {
|
|
|
669
679
|
this._errorReportingService.report({
|
|
670
680
|
message: "LoggingService: Failed to send log: " + n.message,
|
|
671
681
|
code: Q.LOG_DELIVERY_FAILURE,
|
|
672
|
-
severity: r ?
|
|
682
|
+
severity: r ? P.ERROR : P.WARNING
|
|
673
683
|
});
|
|
674
684
|
}
|
|
675
685
|
}
|
|
676
686
|
);
|
|
677
687
|
}
|
|
678
688
|
}
|
|
679
|
-
function
|
|
680
|
-
const e = z(window.location.href), t = i.EventAttributes?.title || document.title, n =
|
|
689
|
+
function Ot(i) {
|
|
690
|
+
const e = z(window.location.href), t = i.EventAttributes?.title || document.title, n = Ye(), r = i.ActiveTimeOnSite;
|
|
681
691
|
return {
|
|
682
692
|
pageUrl: e,
|
|
683
693
|
sourceMessageId: i.SourceMessageId,
|
|
@@ -689,7 +699,7 @@ function Lt(i) {
|
|
|
689
699
|
}
|
|
690
700
|
const _ = class _ {
|
|
691
701
|
constructor() {
|
|
692
|
-
this.name = d, this.id = C, this.moduleId = C, 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 =
|
|
702
|
+
this.name = d, this.id = C, this.moduleId = C, 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 = it(), this.accountId = null, this._preselectState = Xe();
|
|
693
703
|
}
|
|
694
704
|
// ---- Private helpers ----
|
|
695
705
|
getEventAttributeValue(e, t) {
|
|
@@ -720,7 +730,7 @@ const _ = class _ {
|
|
|
720
730
|
const t = Object.keys(this.placementEventAttributeMappingLookup);
|
|
721
731
|
for (let n = 0; n < t.length; n++) {
|
|
722
732
|
const r = t[n], s = this.placementEventAttributeMappingLookup[r];
|
|
723
|
-
if (
|
|
733
|
+
if (A(s))
|
|
724
734
|
continue;
|
|
725
735
|
let o = !0;
|
|
726
736
|
for (let c = 0; c < s.length; c++)
|
|
@@ -735,9 +745,9 @@ const _ = class _ {
|
|
|
735
745
|
let t;
|
|
736
746
|
try {
|
|
737
747
|
t = z(window.location.href);
|
|
738
|
-
const n = te(), r =
|
|
748
|
+
const n = te(), r = Ot(e);
|
|
739
749
|
n.push(r);
|
|
740
|
-
const s = Math.min(n.length, Ie), o =
|
|
750
|
+
const s = Math.min(n.length, Ie), o = De(n);
|
|
741
751
|
if (o === 0) {
|
|
742
752
|
const c = H() ? "quota" : "ls_unavailable";
|
|
743
753
|
this.loggingService?.log({
|
|
@@ -762,7 +772,7 @@ const _ = class _ {
|
|
|
762
772
|
buildCacheMatchKeys(e) {
|
|
763
773
|
if (!this.isPreselectionEnabled())
|
|
764
774
|
return;
|
|
765
|
-
const t =
|
|
775
|
+
const t = Be(this.accountId, e);
|
|
766
776
|
if (t)
|
|
767
777
|
return t.attributeKeys;
|
|
768
778
|
}
|
|
@@ -780,7 +790,7 @@ const _ = class _ {
|
|
|
780
790
|
};
|
|
781
791
|
}
|
|
782
792
|
flushPendingPreselectDispatches() {
|
|
783
|
-
|
|
793
|
+
tt(this._preselectState, this.buildPreselectHost());
|
|
784
794
|
}
|
|
785
795
|
isLauncherReadyToAttach() {
|
|
786
796
|
return !!window.Rokt && U(window.Rokt.createLauncher);
|
|
@@ -805,7 +815,7 @@ const _ = class _ {
|
|
|
805
815
|
if (!window.mParticle || typeof a().logEvent != "function" || !m(e))
|
|
806
816
|
return;
|
|
807
817
|
const t = a().EventType.Other;
|
|
808
|
-
a().logEvent(
|
|
818
|
+
a().logEvent(lt, t, e);
|
|
809
819
|
}
|
|
810
820
|
setRoktSessionId(e) {
|
|
811
821
|
if (!(!e || typeof e != "string"))
|
|
@@ -826,7 +836,7 @@ const _ = class _ {
|
|
|
826
836
|
return a()?.getDeviceId?.() || void 0;
|
|
827
837
|
}
|
|
828
838
|
attachLauncher(e, t, n = []) {
|
|
829
|
-
|
|
839
|
+
nt(this._launcherAttachState, {
|
|
830
840
|
accountId: e,
|
|
831
841
|
launcherOptions: t || {},
|
|
832
842
|
legacyRoktExtensions: n
|
|
@@ -837,10 +847,10 @@ const _ = class _ {
|
|
|
837
847
|
};
|
|
838
848
|
let s;
|
|
839
849
|
return this.isPartnerInLocalLauncherTestGroup() ? s = Promise.resolve(window.Rokt.createLocalLauncher(r)) : s = window.Rokt.createLauncher(r), s.then(async (o) => {
|
|
840
|
-
await
|
|
850
|
+
await kt([...n], o), this.initRoktLauncher(o);
|
|
841
851
|
}).catch((o) => {
|
|
842
852
|
const c = this._launcherAttachState.lifecycle === "attached";
|
|
843
|
-
if (
|
|
853
|
+
if (ot(this._launcherAttachState), !c) {
|
|
844
854
|
const u = o instanceof Error ? o.message : String(o);
|
|
845
855
|
this.loggingService?.log({
|
|
846
856
|
message: `Rokt Kit: Failed to attach Rokt launcher: ${u}`,
|
|
@@ -851,14 +861,14 @@ const _ = class _ {
|
|
|
851
861
|
});
|
|
852
862
|
}
|
|
853
863
|
recreateLauncherIfTerminated() {
|
|
854
|
-
return
|
|
864
|
+
return at(
|
|
855
865
|
this._launcherAttachState,
|
|
856
866
|
this.isLauncherReadyToAttach(),
|
|
857
867
|
(e) => this.attachLauncher(e.accountId, e.launcherOptions, e.legacyRoktExtensions)
|
|
858
868
|
);
|
|
859
869
|
}
|
|
860
870
|
initRoktLauncher(e) {
|
|
861
|
-
window.Rokt && (window.Rokt.currentLauncher = e), this.launcher = e,
|
|
871
|
+
window.Rokt && (window.Rokt.currentLauncher = e), this.launcher = e, rt(this._launcherAttachState);
|
|
862
872
|
const t = a().Rokt?.filters;
|
|
863
873
|
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();
|
|
864
874
|
}
|
|
@@ -897,48 +907,48 @@ const _ = class _ {
|
|
|
897
907
|
*/
|
|
898
908
|
init(e, t, n, r, s) {
|
|
899
909
|
const o = e, c = o.accountId;
|
|
900
|
-
this.accountId = c || null, this.userAttributes =
|
|
910
|
+
this.accountId = c || null, this.userAttributes = y(s), this._onboardingExpProvider = o.onboardingExpProvider;
|
|
901
911
|
const u = K(o.placementEventMapping);
|
|
902
912
|
this.placementEventMappingLookup = ue(u);
|
|
903
913
|
const l = K(
|
|
904
914
|
o.placementEventAttributeMapping
|
|
905
915
|
);
|
|
906
916
|
this.placementEventAttributeMappingLookup = de(l), o.hashedEmailUserIdentityType && (this._mappedEmailSha256Key = o.hashedEmailUserIdentityType.toLowerCase()), this._workspaceIdSyncApiKey = g(o.workspaceIdSyncApiKey) ? o.workspaceIdSyncApiKey : void 0;
|
|
907
|
-
const f = a().Rokt?.domain, { roktExtensionsQueryParams:
|
|
917
|
+
const f = a().Rokt?.domain, { roktExtensionsQueryParams: k, legacyRoktExtensions: v, loadThankYouElement: N } = le(
|
|
908
918
|
o.roktExtensions
|
|
909
919
|
), E = {
|
|
910
920
|
...a().Rokt?.launcherOptions || {}
|
|
911
921
|
};
|
|
912
|
-
this.integrationName =
|
|
913
|
-
const
|
|
922
|
+
this.integrationName = vt(E.integrationName), E.integrationName = this.integrationName, this.domain = f;
|
|
923
|
+
const w = {
|
|
914
924
|
loggingUrl: o.loggingUrl,
|
|
915
925
|
errorUrl: o.errorUrl,
|
|
916
926
|
integrationDomain: f,
|
|
917
927
|
isLoggingEnabled: a().config?.isLoggingEnabled === !0
|
|
918
928
|
}, I = new fe(
|
|
919
|
-
|
|
929
|
+
w,
|
|
920
930
|
this.integrationName,
|
|
921
931
|
window.__rokt_li_guid__,
|
|
922
932
|
o.accountId
|
|
923
|
-
),
|
|
924
|
-
|
|
933
|
+
), T = new pe(
|
|
934
|
+
w,
|
|
925
935
|
I,
|
|
926
936
|
this.integrationName,
|
|
927
937
|
window.__rokt_li_guid__,
|
|
928
938
|
o.accountId
|
|
929
939
|
);
|
|
930
|
-
if (this.errorReportingService = I, this.loggingService =
|
|
940
|
+
if (this.errorReportingService = I, this.loggingService = T, this.isTargetingDisabled())
|
|
931
941
|
try {
|
|
932
942
|
ie(), ne();
|
|
933
943
|
} catch (p) {
|
|
934
944
|
this.errorReportingService?.report({
|
|
935
945
|
message: "Rokt Kit: Failed to clear page views when targeting is disabled",
|
|
936
946
|
code: "PAGE_VIEW_CAPTURE_FAILED",
|
|
937
|
-
severity:
|
|
947
|
+
severity: P.INFO,
|
|
938
948
|
stackTrace: p instanceof Error ? p.stack : void 0
|
|
939
949
|
});
|
|
940
950
|
}
|
|
941
|
-
return a()._registerErrorReportingService && a()._registerErrorReportingService(I), a()._registerLoggingService && a()._registerLoggingService(
|
|
951
|
+
return a()._registerErrorReportingService && a()._registerErrorReportingService(I), a()._registerLoggingService && a()._registerLoggingService(T), n ? (this.testHelpers = {
|
|
942
952
|
generateLauncherScript: oe,
|
|
943
953
|
generateThankYouElementScript: ce,
|
|
944
954
|
extractRoktExtensionConfig: le,
|
|
@@ -955,20 +965,20 @@ const _ = class _ {
|
|
|
955
965
|
ReportingTransport: F,
|
|
956
966
|
ErrorReportingService: fe,
|
|
957
967
|
LoggingService: pe,
|
|
958
|
-
RateLimiter:
|
|
968
|
+
RateLimiter: ve,
|
|
959
969
|
ErrorCodes: Q,
|
|
960
|
-
WSDKErrorSeverity:
|
|
961
|
-
resetLauncherAttachState: () =>
|
|
962
|
-
}, this.attachLauncher(c, E), "Successfully initialized: " + d) : (N && (a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this), ae(
|
|
970
|
+
WSDKErrorSeverity: P,
|
|
971
|
+
resetLauncherAttachState: () => ct(this._launcherAttachState)
|
|
972
|
+
}, this.attachLauncher(c, E), "Successfully initialized: " + d) : (N && (a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this), ae(ft, ce(f), {
|
|
963
973
|
onLoad: () => {
|
|
964
974
|
this._isThankYouElementLoaded = !0, this._thankYouElementOnLoadCallback && this._thankYouElementOnLoadCallback();
|
|
965
975
|
},
|
|
966
976
|
onError: (p) => {
|
|
967
977
|
console.error("Error loading Rokt Thank You Element script:", p);
|
|
968
978
|
}
|
|
969
|
-
})), this.isLauncherReadyToAttach() ? this.attachLauncher(c, E,
|
|
979
|
+
})), this.isLauncherReadyToAttach() ? this.attachLauncher(c, E, v) : (ae(gt, oe(f, k), {
|
|
970
980
|
onLoad: () => {
|
|
971
|
-
this.isLauncherReadyToAttach() ? this.attachLauncher(c, E,
|
|
981
|
+
this.isLauncherReadyToAttach() ? this.attachLauncher(c, E, v) : console.error("Rokt object is not available after script load.");
|
|
972
982
|
},
|
|
973
983
|
onError: (p) => {
|
|
974
984
|
console.error("Error loading Rokt launcher script:", p);
|
|
@@ -976,9 +986,9 @@ const _ = class _ {
|
|
|
976
986
|
}), this.captureTiming(_.PERFORMANCE_MARKS.RoktScriptAppended)), "Successfully initialized: " + d);
|
|
977
987
|
}
|
|
978
988
|
process(e) {
|
|
979
|
-
if (this.isTargetingDisabled() || (e.EventDataType ===
|
|
989
|
+
if (this.isTargetingDisabled() || (e.EventDataType === mt && (Fe(this.loggingService), this.capturePageView(e), Re(this._preselectState, this.buildPreselectHost(), e)), e.EventDataType === Et && (ie(), ne(), this.accountId && L(this.accountId))), !this.isKitReady())
|
|
980
990
|
return "Kit not ready for forwarder: " + d;
|
|
981
|
-
if (U(a().Rokt?.setLocalSessionAttribute) && (
|
|
991
|
+
if (U(a().Rokt?.setLocalSessionAttribute) && (A(this.placementEventAttributeMappingLookup) || this.applyPlacementEventAttributeMapping(e), !A(this.placementEventMappingLookup))) {
|
|
982
992
|
const t = he(e.EventDataType, e.EventCategory, e.EventName ?? "");
|
|
983
993
|
this.placementEventMappingLookup[String(t)] && a().Rokt.setLocalSessionAttribute?.(this.placementEventMappingLookup[String(t)], !0);
|
|
984
994
|
}
|
|
@@ -992,13 +1002,13 @@ const _ = class _ {
|
|
|
992
1002
|
window.Rokt.setExtensionData(e);
|
|
993
1003
|
}
|
|
994
1004
|
setUserAttribute(e, t) {
|
|
995
|
-
return me(e) || (this.userAttributes[e] = t),
|
|
1005
|
+
return me(e) || (this.userAttributes[e] = t), Qe(this.accountId, e) && this.flushPendingPreselectDispatches(), "Successfully set user attribute for forwarder: " + d;
|
|
996
1006
|
}
|
|
997
1007
|
removeUserAttribute(e) {
|
|
998
1008
|
return delete this.userAttributes[e], "Successfully removed user attribute for forwarder: " + d;
|
|
999
1009
|
}
|
|
1000
1010
|
handleIdentityComplete(e, t) {
|
|
1001
|
-
return this.userAttributes =
|
|
1011
|
+
return this.userAttributes = y(e.getAllUserAttributes()), "Successfully called " + t + " for forwarder: " + d;
|
|
1002
1012
|
}
|
|
1003
1013
|
onUserIdentified(e) {
|
|
1004
1014
|
const t = e;
|
|
@@ -1037,7 +1047,7 @@ const _ = class _ {
|
|
|
1037
1047
|
return this.handleIdentityComplete(e, "onLoginComplete");
|
|
1038
1048
|
}
|
|
1039
1049
|
onLogoutComplete(e, t) {
|
|
1040
|
-
return this.userIdentifiedInWorkspace = !1, this._workspaceSearchInFlightPromise = null, this._workspaceLastSearchedIdentitiesKey = void 0, this.accountId &&
|
|
1050
|
+
return this.userIdentifiedInWorkspace = !1, this._workspaceSearchInFlightPromise = null, this._workspaceLastSearchedIdentitiesKey = void 0, this.accountId && L(this.accountId), this.handleIdentityComplete(e, "onLogoutComplete");
|
|
1041
1051
|
}
|
|
1042
1052
|
onModifyComplete(e, t) {
|
|
1043
1053
|
return this.handleIdentityComplete(e, "onModifyComplete");
|
|
@@ -1087,32 +1097,32 @@ const _ = class _ {
|
|
|
1087
1097
|
return this._dispatchPlacements(e);
|
|
1088
1098
|
}
|
|
1089
1099
|
_dispatchPlacements(e) {
|
|
1090
|
-
const t = e && e.attributes || {}, r = { ...
|
|
1100
|
+
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;
|
|
1091
1101
|
let l;
|
|
1092
|
-
s ? s.filterUserAttributes ? l = s.filterUserAttributes(r, o) : l = r : (console.warn("Rokt Kit: No filters available, using user attributes"), l = r), this.userAttributes =
|
|
1093
|
-
const f = this._onboardingExpProvider === "Optimizely" ? this.fetchOptimizely() : {},
|
|
1094
|
-
...
|
|
1102
|
+
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);
|
|
1103
|
+
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 = {
|
|
1104
|
+
...k,
|
|
1095
1105
|
...l,
|
|
1096
1106
|
...f,
|
|
1097
|
-
...
|
|
1098
|
-
...N.length ? { [
|
|
1099
|
-
...E ? { [
|
|
1100
|
-
...this.userIdentifiedInWorkspace ? { [
|
|
1101
|
-
...
|
|
1102
|
-
...I ? { [
|
|
1107
|
+
...v,
|
|
1108
|
+
...N.length ? { [_t]: JSON.stringify(N) } : {},
|
|
1109
|
+
...E ? { [It]: E } : {},
|
|
1110
|
+
...this.userIdentifiedInWorkspace ? { [pt]: !0 } : {},
|
|
1111
|
+
...w ? { [yt]: w } : {},
|
|
1112
|
+
...I ? { [At]: I } : {},
|
|
1103
1113
|
mpid: u
|
|
1104
|
-
}, p = this.buildCacheMatchKeys(typeof e.identifier == "string" ? e.identifier : void 0),
|
|
1114
|
+
}, p = this.buildCacheMatchKeys(typeof e.identifier == "string" ? e.identifier : void 0), we = {
|
|
1105
1115
|
...e,
|
|
1106
|
-
attributes:
|
|
1116
|
+
attributes: T,
|
|
1107
1117
|
...p !== void 0 ? { cacheMatchKeys: p } : {}
|
|
1108
|
-
}, X = this.launcher.selectPlacements(
|
|
1109
|
-
Z || this.logSelectPlacementsEvent(
|
|
1118
|
+
}, X = this.launcher.selectPlacements(we), Z = e.preselect === !0, Te = () => {
|
|
1119
|
+
Z || this.logSelectPlacementsEvent(T);
|
|
1110
1120
|
};
|
|
1111
|
-
return Promise.resolve(X).then((
|
|
1121
|
+
return Promise.resolve(X).then((Le) => {
|
|
1112
1122
|
if (!Z)
|
|
1113
|
-
return
|
|
1123
|
+
return Le?.context?.sessionId?.then((Oe) => this.setRoktSessionId(Oe));
|
|
1114
1124
|
}).catch(() => {
|
|
1115
|
-
}).finally(
|
|
1125
|
+
}).finally(Te), X;
|
|
1116
1126
|
}
|
|
1117
1127
|
/**
|
|
1118
1128
|
* Passes attributes to the Rokt Web SDK for client-side hashing.
|
|
@@ -1138,7 +1148,7 @@ const _ = class _ {
|
|
|
1138
1148
|
* here would flip the kit to not-ready with no drain path for queued calls.
|
|
1139
1149
|
*/
|
|
1140
1150
|
terminate() {
|
|
1141
|
-
return this.isKitReady() ? (
|
|
1151
|
+
return this.isKitReady() ? (st(this._launcherAttachState), this.launcher.terminate()) : (console.error("Rokt Kit: Not initialized"), Promise.resolve());
|
|
1142
1152
|
}
|
|
1143
1153
|
/**
|
|
1144
1154
|
* Registers a callback to be invoked once rokt-thank-you-element.js becomes available.
|
|
@@ -1150,11 +1160,11 @@ const _ = class _ {
|
|
|
1150
1160
|
_._allowedOriginHashes = [-553112570, 549508659], _.PERFORMANCE_MARKS = {
|
|
1151
1161
|
RoktScriptAppended: "mp:RoktScriptAppended"
|
|
1152
1162
|
}, _.EMAIL_SHA256_KEY = "emailsha256";
|
|
1153
|
-
let
|
|
1154
|
-
function
|
|
1163
|
+
let b = _;
|
|
1164
|
+
function Nt() {
|
|
1155
1165
|
return C;
|
|
1156
1166
|
}
|
|
1157
|
-
function
|
|
1167
|
+
function Ut(i) {
|
|
1158
1168
|
if (!i) {
|
|
1159
1169
|
window.console.log("You must pass a config object to register the kit " + d);
|
|
1160
1170
|
return;
|
|
@@ -1164,17 +1174,17 @@ function Nt(i) {
|
|
|
1164
1174
|
return;
|
|
1165
1175
|
}
|
|
1166
1176
|
m(i.kits) ? i.kits[d] = {
|
|
1167
|
-
constructor:
|
|
1177
|
+
constructor: b
|
|
1168
1178
|
} : (i.kits = {}, i.kits[d] = {
|
|
1169
|
-
constructor:
|
|
1179
|
+
constructor: b
|
|
1170
1180
|
}), window.console.log("Successfully registered " + d + " to your mParticle configuration");
|
|
1171
1181
|
}
|
|
1172
1182
|
typeof window < "u" && window.mParticle && a().addForwarder && a().addForwarder({
|
|
1173
1183
|
name: d,
|
|
1174
|
-
constructor:
|
|
1175
|
-
getId:
|
|
1184
|
+
constructor: b,
|
|
1185
|
+
getId: Nt
|
|
1176
1186
|
});
|
|
1177
1187
|
export {
|
|
1178
|
-
|
|
1188
|
+
Ut as register
|
|
1179
1189
|
};
|
|
1180
1190
|
//# sourceMappingURL=Rokt-Kit.esm.js.map
|
package/dist/Rokt-Kit.iife.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var RoktKit=(function(j){"use strict";const ve=["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"],we=new Set(ve);function Z(i){return we.has(i.toLowerCase())}function P(i){const e={},t=i||{},n=Object.keys(t);for(let r=0;r<n.length;r++){const s=n[r];Z(s)||(e[s]=t[s])}return e}function f(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function g(i){return typeof i=="string"}function N(i){return typeof i=="function"}function b(i){return i==null?!0:typeof i=="string"?i.length===0:typeof i=="object"?Object.keys(i).length===0:!1}function H(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 d="mp-rokt-kit",te="__rokt_ls_probe__";function V(){try{return window.localStorage.setItem(te,"1"),window.localStorage.removeItem(te),!0}catch{return!1}}const I=()=>window.localStorage;function W(i,e=I){try{const t=e().getItem(i);return t===null?null:JSON.parse(t)}catch{return null}}function ie(i,e,t=I){try{return t().setItem(i,JSON.stringify(e)),!0}catch{return!1}}function Te(i,e=I){try{e().removeItem(i)}catch{}}function R(i,e,t=I){const n=W(i,t);return f(n)?n[e]:void 0}function U(i,e,t,n=I){const r=W(i,n),s=f(r)?{...r}:{};return s[e]=t,ie(i,s,n)}function C(i,e,t=I){const n=W(i,t);if(!f(n)||!(e in n))return;const r={...n};delete r[e],Object.keys(r).length===0?Te(i,t):ie(i,r,t)}const z="pageViews",K="utmParams",ne=25,Le=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function re(i){return i.slice(-ne)}function se(){const i=R(d,z);return Array.isArray(i)?i:[]}function Oe(i){const e=re(i);for(let t=0;t<e.length;t++){const n=e.slice(t);if(U(d,z,n))return n.length}return 0}function oe(){C(d,z)}function Ne(i){const e=re(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 Ue(i){if(R(d,K)!==void 0)return;const e=new URLSearchParams(window.location.search),t={};for(const r of Le){const s=e.get(r);s&&(t[r]=s)}if(Object.keys(t).length===0)return;const n=Object.keys(t).join(", ");if(!U(d,K,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 Ce(){const i=R(d,K);return f(i)?i:null}function ce(){C(d,K)}function Ke(){const e=document.querySelector('link[rel="canonical"]')?.href;if(e)return H(e)}const $=[{accountId:"2919171670744024290",pathname:"/checkout",targetPageIdentifier:"prod.rokt.conf",attributeKeys:["email","amount","customertype","eventvenue","firstname","lastname","member_status","billingzipcode","currency"],optionalAttributeKeys:["firstname","lastname"]},{accountId:"2550745407543340151",pathname:"/checkout",targetPageIdentifier:"RoktExperience",attributeKeys:["email","amount","firstname","lastname","cartItems","customertype","loyaltytier","paymenttype","ccbin"],optionalAttributeKeys:["loyaltytier","paymenttype","ccbin"]},{accountId:"3236704179315511296",pathname:"/check-out/pay",targetPageIdentifier:"confirmation_page",attributeKeys:["email","totalprice","firstname","lastname","loyaltytier"],optionalAttributeKeys:["firstname","lastname","loyaltytier"]}],De=6e4;function Me(i){return f(i)&&typeof i.expiresAt=="number"&&f(i.attributes)}function Fe(i,e){return`activePreselect:${i}:${e}`}function xe(i){const e=R(d,i);return Me(e)?e:null}function Ye(i,e){U(d,i,{expiresAt:Date.now()+De,attributes:e})}const Ge=5*6e4;function D(){return window.sessionStorage}function je(i){return f(i)&&typeof i.expiresAt=="number"&&g(i.pathname)&&g(i.identifier)&&f(i.attributes)&&g(i.mpid)}function q(i){return`pendingPreselect:${i}`}function He(i){const e=q(i),t=R(d,e,D);return je(t)?t.expiresAt<=Date.now()?(C(d,e,D),null):t:null}function Ve(i,e,t,n,r){return U(d,q(i),{expiresAt:Date.now()+Ge,pathname:e,identifier:t,attributes:n,mpid:r},D)}function k(i){C(d,q(i),D)}function v(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 We(i,e){if(i)return $.find(t=>t.accountId===i&&t.pathname===e)}function ze(i,e){if(!(!i||!g(e)))return $.find(t=>t.accountId===i&&t.targetPageIdentifier===e)}function $e(i,e){return i?$.some(t=>t.accountId===i&&t.attributeKeys.includes(e)):!1}function qe(){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 B(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 le(i,e,t){const n=i.filteredUser?.getAllUserAttributes?.()||{},r=new Set((t.optionalAttributeKeys??[]).map(c=>c.toLowerCase())),s={},o=[];for(const c of t.attributeKeys){const u=i.getEventAttributeValue(e,c),l=b(u)?i.userAttributes[c]??n[c]:u;if(b(l)){r.has(c.toLowerCase())||o.push(c);continue}s[c]=l}return{collected:s,missingKeys:o}}function Je(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 ue(i,e,t,n,r,s){const o=Fe(e,t),c=xe(o),u=!!c&&JSON.stringify(c.attributes)===JSON.stringify(r);if(c&&c.expiresAt>Date.now()&&u){i.logPlacementDiagnostic(v("skipped","active_preselection"));return}Ye(o,r),i.logPlacementDiagnostic(v("fired",s)),Je(i,{attributes:r,preselect:!0,identifier:n,omitUrl:!0})}function Be(i,e){if(!e.accountId||!e.isKitReady())return;const t=He(e.accountId);if(t){if(i.pending.some(n=>n.pathname===t.pathname)){k(e.accountId);return}if(!e.isPreselectionEnabled()){k(e.accountId);return}B(e.filteredUser)&&(k(e.accountId),ae(e.filteredUser)===t.mpid&&ue(e,e.accountId,t.identifier,t.identifier,t.attributes,"recovered"))}}function de(i,e,t,n=window.location.pathname){const r=We(e.accountId,n);if(!r)return;if(!e.isKitReady()){const c=[],u=ae(e.filteredUser);if(e.accountId&&u&&B(e.filteredUser)){const{collected:l,missingKeys:p}=le(e,t,r);if(p.length===0){const w=P(l);Ve(e.accountId,n,r.targetPageIdentifier,w,u)||c.push(v("queued","persist_failed"))}}J(i,{event:t,pathname:n,storedDiagnostics:c});return}if(!e.isPreselectionEnabled())return;if(!B(e.filteredUser)){e.logPlacementDiagnostic(v("missed","no_valid_identity")),J(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(v("missed",`missing_attribute:${c}`));J(i,{event:t,pathname:n});return}ue(e,e.accountId||"",n,r.targetPageIdentifier,s,"fired")}function Qe(i,e,t=window.location.pathname){if(Be(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)),de(i,e,r,s))})}function Xe(){return{context:null,lifecycle:"idle",recreateInFlight:null}}function Ze(i,e){i.context={accountId:e.accountId,launcherOptions:{...e.launcherOptions},legacyRoktExtensions:[...e.legacyRoktExtensions]}}function et(i){i.lifecycle="attached"}function tt(i){i.lifecycle!=="idle"&&(i.lifecycle="terminated")}function it(i){i.lifecycle="terminated"}function nt(i){i.context=null,i.lifecycle="idle",i.recreateInFlight=null}function rt(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 h="Rokt",M=181,st="selectPlacements",ot="apps.roktecommerce.com",ct=.1,at="ThankYouPageJourney",lt="rokt-launcher",ut="rokt-thank-you-element",dt="userIdentifiedInWorkspace",ht=3,gt=2,ft="page_events",pt="page_view_attributes",mt="mparticle_session_id",Et="mparticle_device_id",he=500,Q={UNKNOWN_ERROR:"UNKNOWN_ERROR",UNHANDLED_EXCEPTION:"UNHANDLED_EXCEPTION",IDENTITY_REQUEST:"IDENTITY_REQUEST",LOG_DELIVERY_FAILURE:"LOG_DELIVERY_FAILURE"},y={ERROR:"ERROR",INFO:"INFO",WARNING:"WARNING"},_t="apps.rokt-api.com",It="/v1/log",yt="/v1/errors",St=10;function a(){return window.mParticle}function ge(i,e){const n=[F(i),"/wsdk/integrations/launcher.js"].join("");return!e||e.length===0?n:n+"?extensions="+e.join(",")}function fe(i){return[F(i),"/rokt-elements/rokt-element-thank-you.js"].join("")}function F(i){const e=i!==void 0?i:_t;return e.includes("://")?e.replace(/\/+$/,""):["https://",e].join("")}function pe(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 F(r)+t}function me(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 x(i){if(!i)return[];try{return JSON.parse(i.replace(/"/g,'"'))}catch{console.error("Settings string contains invalid JSON")}return[]}function Ee(i){const e=i?x(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 At(i,e){const t=[];if(e)for(const n of i)t.push(e.use(n));return Promise.all(t)}function _e(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 Ie(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 ye(i,e,t){return a().generateHash([i,e,t].join(""))}function Pt(i){let n="mParticle_wsdkv_"+a().getVersion()+"_kitv_"+"3.6.1";return i&&(n+="_"+i),n}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 Se(i,e){const t=ee(window.location.origin);if(S._allowedOriginHashes.indexOf(t)===-1||Math.random()>=ct)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?F(i):"https://apps.rokt.com";X(c+"/v1/wsdk-init/index.html?"+o),X("https://"+ot+"/v1/wsdk-init/index.html?"+o+"&isControl=true")}function bt(){return typeof window<"u"&&!!window.location?.search?.toLowerCase().includes("mp_enable_logging=true")}function Rt(){return typeof window<"u"?window.location?.href:void 0}function kt(){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>St}}class Y{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=bt()||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:Rt(),deviceInfo:kt(),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 Pe{constructor(e,t,n,r,s){this._transport=new Y(e,t,n,r,s),this._errorUrl=pe(e?.errorUrl,e?.integrationDomain,yt)}report(e){if(!e)return;const t=e.severity||y.ERROR;this._transport.send(this._errorUrl,t,e.message,e.code,e.stackTrace)}}class be{constructor(e,t,n,r,s,o){this._transport=new Y(e,n,r,s,o),this._placementDiagnosticTransport=new Y(e,n,r,s),this._loggingUrl=pe(e?.loggingUrl,e?.integrationDomain,It),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,y.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?y.ERROR:y.WARNING})}})}}function vt(i){const e=H(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 E=class E{constructor(){this.name=h,this.id=M,this.moduleId=M,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=Xe(),this.accountId=null,this._preselectState=qe()}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(b(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=H(window.location.href);const n=se(),r=vt(e);n.push(r);const s=Math.min(n.length,ne),o=Oe(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=ze(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(){Qe(this._preselectState,this.buildPreselectHost())}isLauncherReadyToAttach(){return!!window.Rokt&&N(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[E.EMAIL_SHA256_KEY]=e[n]),n&&delete t[n],t}logSelectPlacementsEvent(e){if(!window.mParticle||typeof a().logEvent!="function"||!f(e))return;const t=a().EventType.Other;a().logEvent(st,t,e)}setRoktSessionId(e){if(!(!e||typeof e!="string"))try{const t=a().getInstance();t&&N(t.setIntegrationAttribute)&&t.setIntegrationAttribute(M,{roktSessionId:e})}catch{}}readMpSessionId(){const e=a()?.sessionManager,t=e?.getSessionId??e?.getSession;if(N(t))return t.call(e)||void 0}readMpDeviceId(){return a()?.getDeviceId?.()||void 0}attachLauncher(e,t,n=[]){Ze(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 At([...n],o),this.initRoktLauncher(o)}).catch(o=>{const c=this._launcherAttachState.lifecycle==="attached";if(it(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 rt(this._launcherAttachState,this.isLauncherReadyToAttach(),e=>this.attachLauncher(e.accountId,e.launcherOptions,e.legacyRoktExtensions))}initRoktLauncher(e){window.Rokt&&(window.Rokt.currentLauncher=e),this.launcher=e,et(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,Se(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=P(s),this._onboardingExpProvider=o.onboardingExpProvider;const u=x(o.placementEventMapping);this.placementEventMappingLookup=_e(u);const l=x(o.placementEventAttributeMapping);this.placementEventAttributeMappingLookup=Ie(l),o.hashedEmailUserIdentityType&&(this._mappedEmailSha256Key=o.hashedEmailUserIdentityType.toLowerCase()),this._workspaceIdSyncApiKey=g(o.workspaceIdSyncApiKey)?o.workspaceIdSyncApiKey:void 0;const p=a().Rokt?.domain,{roktExtensionsQueryParams:w,legacyRoktExtensions:T,loadThankYouElement:G}=Ee(o.roktExtensions),_={...a().Rokt?.launcherOptions||{}};this.integrationName=Pt(_.integrationName),_.integrationName=this.integrationName,this.domain=p;const L={loggingUrl:o.loggingUrl,errorUrl:o.errorUrl,integrationDomain:p,isLoggingEnabled:a().config?.isLoggingEnabled===!0},A=new Pe(L,this.integrationName,window.__rokt_li_guid__,o.accountId),O=new be(L,A,this.integrationName,window.__rokt_li_guid__,o.accountId);if(this.errorReportingService=A,this.loggingService=O,this.isTargetingDisabled())try{oe(),ce()}catch(m){this.errorReportingService?.report({message:"Rokt Kit: Failed to clear page views when targeting is disabled",code:"PAGE_VIEW_CAPTURE_FAILED",severity:y.INFO,stackTrace:m instanceof Error?m.stack:void 0})}return a()._registerErrorReportingService&&a()._registerErrorReportingService(A),a()._registerLoggingService&&a()._registerLoggingService(O),n?(this.testHelpers={generateLauncherScript:ge,generateThankYouElementScript:fe,extractRoktExtensionConfig:Ee,hashEventMessage:ye,parseSettingsString:x,generateMappedEventLookup:_e,generateMappedEventAttributeLookup:Ie,sendAdBlockMeasurementSignals:Se,createAutoRemovedIframe:X,djb2:ee,setAllowedOriginHashes:m=>{E._allowedOriginHashes=m},ReportingTransport:Y,ErrorReportingService:Pe,LoggingService:be,RateLimiter:Ae,ErrorCodes:Q,WSDKErrorSeverity:y,resetLauncherAttachState:()=>nt(this._launcherAttachState)},this.attachLauncher(c,_),"Successfully initialized: "+h):(G&&(a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this),me(ut,fe(p),{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,_,T):(me(lt,ge(p,w),{onLoad:()=>{this.isLauncherReadyToAttach()?this.attachLauncher(c,_,T):console.error("Rokt object is not available after script load.")},onError:m=>{console.error("Error loading Rokt launcher script:",m)}}),this.captureTiming(E.PERFORMANCE_MARKS.RoktScriptAppended)),"Successfully initialized: "+h)}process(e){if(this.isTargetingDisabled()||(e.EventDataType===ht&&(Ue(this.loggingService),this.capturePageView(e),de(this._preselectState,this.buildPreselectHost(),e)),e.EventDataType===gt&&(oe(),ce(),this.accountId&&k(this.accountId))),!this.isKitReady())return"Kit not ready for forwarder: "+h;if(N(a().Rokt?.setLocalSessionAttribute)&&(b(this.placementEventAttributeMappingLookup)||this.applyPlacementEventAttributeMapping(e),!b(this.placementEventMappingLookup))){const t=ye(e.EventDataType,e.EventCategory,e.EventName??"");this.placementEventMappingLookup[String(t)]&&a().Rokt.setLocalSessionAttribute?.(this.placementEventMappingLookup[String(t)],!0)}return"Successfully sent to forwarder: "+h}setExtensionData(e){if(!this.isKitReady()){console.error("Rokt Kit: Not initialized");return}window.Rokt.setExtensionData(e)}setUserAttribute(e,t){return Z(e)||(this.userAttributes[e]=t),$e(this.accountId,e)&&this.flushPendingPreselectDispatches(),"Successfully set user attribute for forwarder: "+h}removeUserAttribute(e){return delete this.userAttributes[e],"Successfully removed user attribute for forwarder: "+h}handleIdentityComplete(e,t){return this.userAttributes=P(e.getAllUserAttributes()),"Successfully called "+t+" for forwarder: "+h}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&&k(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,he))]):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,he))]).then(()=>this._dispatchPlacements(e))}return this._dispatchPlacements(e)}_dispatchPlacements(e){const t=e&&e.attributes||{},r={...P(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=P(l);const p=this._onboardingExpProvider==="Optimizely"?this.fetchOptimizely():{},w=this.returnUserIdentities(c),T=this.returnLocalSessionAttributes(),G=Ne(se()),_=Ce(),L=this.readMpSessionId(),A=this.readMpDeviceId(),O={...w,...l,...p,...T,...G.length?{[ft]:JSON.stringify(G)}:{},..._?{[pt]:_}:{},...this.userIdentifiedInWorkspace?{[dt]:!0}:{},...L?{[mt]:L}:{},...A?{[Et]:A}:{},mpid:u},m=this.buildCacheMatchKeys(typeof e.identifier=="string"?e.identifier:void 0),Lt={...e,attributes:O,...m!==void 0?{cacheMatchKeys:m}:{}},Re=this.launcher.selectPlacements(Lt),ke=e.preselect===!0,Ot=()=>{ke||this.logSelectPlacementsEvent(O)};return Promise.resolve(Re).then(Nt=>{if(!ke)return Nt?.context?.sessionId?.then(Ut=>this.setRoktSessionId(Ut))}).catch(()=>{}).finally(Ot),Re}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()?(tt(this._launcherAttachState),this.launcher.terminate()):(console.error("Rokt Kit: Not initialized"),Promise.resolve())}onShoppableAdsReady(e){this._isThankYouElementLoaded?e():this._thankYouElementOnLoadCallback=e}};E._allowedOriginHashes=[-553112570,549508659],E.PERFORMANCE_MARKS={RoktScriptAppended:"mp:RoktScriptAppended"},E.EMAIL_SHA256_KEY="emailsha256";let S=E;function wt(){return M}function Tt(i){if(!i){window.console.log("You must pass a config object to register the kit "+h);return}if(!f(i)){window.console.log("'config' must be an object. You passed in a "+typeof i);return}f(i.kits)?i.kits[h]={constructor:S}:(i.kits={},i.kits[h]={constructor:S}),window.console.log("Successfully registered "+h+" to your mParticle configuration")}return typeof window<"u"&&window.mParticle&&a().addForwarder&&a().addForwarder({name:h,constructor:S,getId:wt}),j.register=Tt,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"}),j})({});
|
|
1
|
+
var RoktKit=(function(j){"use strict";const Te=["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"],Le=new Set(Te);function Z(i){return Le.has(i.toLowerCase())}function I(i){const e={},t=i||{},n=Object.keys(t);for(let r=0;r<n.length;r++){const s=n[r];Z(s)||(e[s]=t[s])}return e}function f(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function g(i){return typeof i=="string"}function N(i){return typeof i=="function"}function y(i){return i==null?!0:typeof i=="string"?i.length===0:typeof i=="object"?Object.keys(i).length===0:!1}function H(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 d="mp-rokt-kit",te="__rokt_ls_probe__";function V(){try{return window.localStorage.setItem(te,"1"),window.localStorage.removeItem(te),!0}catch{return!1}}const S=()=>window.localStorage;function W(i,e=S){try{const t=e().getItem(i);return t===null?null:JSON.parse(t)}catch{return null}}function ie(i,e,t=S){try{return t().setItem(i,JSON.stringify(e)),!0}catch{return!1}}function Oe(i,e=S){try{e().removeItem(i)}catch{}}function k(i,e,t=S){const n=W(i,t);return f(n)?n[e]:void 0}function U(i,e,t,n=S){const r=W(i,n),s=f(r)?{...r}:{};return s[e]=t,ie(i,s,n)}function C(i,e,t=S){const n=W(i,t);if(!f(n)||!(e in n))return;const r={...n};delete r[e],Object.keys(r).length===0?Oe(i,t):ie(i,r,t)}const z="pageViews",K="utmParams",ne=25,Ne=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function re(i){return i.slice(-ne)}function se(){const i=k(d,z);return Array.isArray(i)?i:[]}function Ue(i){const e=re(i);for(let t=0;t<e.length;t++){const n=e.slice(t);if(U(d,z,n))return n.length}return 0}function oe(){C(d,z)}function Ce(i){const e=re(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(k(d,K)!==void 0)return;const e=new URLSearchParams(window.location.search),t={};for(const r of Ne){const s=e.get(r);s&&(t[r]=s)}if(Object.keys(t).length===0)return;const n=Object.keys(t).join(", ");if(!U(d,K,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 De(){const i=k(d,K);return f(i)?i:null}function ce(){C(d,K)}function Me(){const e=document.querySelector('link[rel="canonical"]')?.href;if(e)return H(e)}const $=[{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"]}],Fe=6e4;function xe(i){return f(i)&&typeof i.expiresAt=="number"&&f(i.attributes)}function Ye(i,e){return`activePreselect:${i}:${e}`}function Ge(i){const e=k(d,i);return xe(e)?e:null}function je(i,e){U(d,i,{expiresAt:Date.now()+Fe,attributes:e})}const He=5*6e4;function D(){return window.sessionStorage}function Ve(i){return f(i)&&typeof i.expiresAt=="number"&&g(i.pathname)&&g(i.identifier)&&f(i.attributes)&&g(i.mpid)}function q(i){return`pendingPreselect:${i}`}function We(i){const e=q(i),t=k(d,e,D);return Ve(t)?t.expiresAt<=Date.now()?(C(d,e,D),null):t:null}function ze(i,e,t,n,r){return U(d,q(i),{expiresAt:Date.now()+He,pathname:e,identifier:t,attributes:n,mpid:r},D)}function v(i){C(d,q(i),D)}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 ae(i,e){if(i)return $.find(t=>t.accountId===i&&t.pathname===e)}function $e(i,e){if(!(!i||!g(e)))return $.find(t=>t.accountId===i&&t.targetPageIdentifier===e)}function qe(i,e){return i?$.some(t=>t.accountId===i&&t.attributeKeys.includes(e)):!1}function Je(){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 B(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 le(i){const e=i?.getMPID?.();return e==null?null:String(e)}function ue(i,e){const t=new Set((i.optionalAttributeKeys??[]).map(n=>n.toLowerCase()));return i.attributeKeys.filter(n=>!t.has(n.toLowerCase())&&y(e[n]))}function de(i,e,t){const n=i.filteredUser?.getAllUserAttributes?.()||{},r={};for(const s of t.attributeKeys){const o=i.getEventAttributeValue(e,s),c=y(o)?i.userAttributes[s]??n[s]:o;y(c)||(r[s]=c)}return{collected:r,missingKeys:ue(t,r)}}function Be(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 he(i,e,t,n,r,s){const o=Ye(e,t),c=Ge(o),u=!!c&&JSON.stringify(c.attributes)===JSON.stringify(r);if(c&&c.expiresAt>Date.now()&&u){i.logPlacementDiagnostic(A("skipped","active_preselection"));return}je(o,r),i.logPlacementDiagnostic(A("fired",s)),Be(i,{attributes:r,preselect:!0,identifier:n,omitUrl:!0})}function Qe(i,e){if(!e.accountId||!e.isKitReady())return;const t=We(e.accountId);if(!t)return;if(i.pending.some(o=>o.pathname===t.pathname)){v(e.accountId);return}if(!e.isPreselectionEnabled()){v(e.accountId);return}if(!B(e.filteredUser)||(v(e.accountId),le(e.filteredUser)!==t.mpid))return;const n=ae(e.accountId,t.pathname);if(!n||n.targetPageIdentifier!==t.identifier)return;const r=I(t.attributes),s=ue(n,r);if(s.length>0){for(const o of s)e.logPlacementDiagnostic(A("missed",`missing_persisted_attribute:${o}`));return}he(e,e.accountId,t.identifier,t.identifier,r,"recovered")}function ge(i,e,t,n=window.location.pathname){const r=ae(e.accountId,n);if(!r)return;if(!e.isKitReady()){const c=[],u=le(e.filteredUser);if(e.accountId&&u&&B(e.filteredUser)){const{collected:l,missingKeys:p}=de(e,t,r);if(p.length===0){const w=I(l);ze(e.accountId,n,r.targetPageIdentifier,w,u)||c.push(A("queued","persist_failed"))}}J(i,{event:t,pathname:n,storedDiagnostics:c});return}if(!e.isPreselectionEnabled())return;if(!B(e.filteredUser)){e.logPlacementDiagnostic(A("missed","no_valid_identity")),J(i,{event:t,pathname:n});return}const{collected:s,missingKeys:o}=de(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}he(e,e.accountId||"",n,r.targetPageIdentifier,s,"fired")}function Xe(i,e,t=window.location.pathname){if(Qe(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)),ge(i,e,r,s))})}function Ze(){return{context:null,lifecycle:"idle",recreateInFlight:null}}function et(i,e){i.context={accountId:e.accountId,launcherOptions:{...e.launcherOptions},legacyRoktExtensions:[...e.legacyRoktExtensions]}}function tt(i){i.lifecycle="attached"}function it(i){i.lifecycle!=="idle"&&(i.lifecycle="terminated")}function nt(i){i.lifecycle="terminated"}function rt(i){i.context=null,i.lifecycle="idle",i.recreateInFlight=null}function st(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 h="Rokt",M=181,ot="selectPlacements",ct="apps.roktecommerce.com",at=.1,lt="ThankYouPageJourney",ut="rokt-launcher",dt="rokt-thank-you-element",ht="userIdentifiedInWorkspace",gt=3,ft=2,pt="page_events",mt="page_view_attributes",Et="mparticle_session_id",_t="mparticle_device_id",fe=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"},It="apps.rokt-api.com",yt="/v1/log",St="/v1/errors",At=10;function a(){return window.mParticle}function pe(i,e){const n=[F(i),"/wsdk/integrations/launcher.js"].join("");return!e||e.length===0?n:n+"?extensions="+e.join(",")}function me(i){return[F(i),"/rokt-elements/rokt-element-thank-you.js"].join("")}function F(i){const e=i!==void 0?i:It;return e.includes("://")?e.replace(/\/+$/,""):["https://",e].join("")}function Ee(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 F(r)+t}function _e(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 x(i){if(!i)return[];try{return JSON.parse(i.replace(/"/g,'"'))}catch{console.error("Settings string contains invalid JSON")}return[]}function Ie(i){const e=i?x(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(lt)):t.push(o)}return{roktExtensionsQueryParams:t,legacyRoktExtensions:n,loadThankYouElement:r}}async function Pt(i,e){const t=[];if(e)for(const n of i)t.push(e.use(n));return Promise.all(t)}function ye(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 Se(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 Ae(i,e,t){return a().generateHash([i,e,t].join(""))}function bt(i){let n="mParticle_wsdkv_"+a().getVersion()+"_kitv_"+"3.6.2";return i&&(n+="_"+i),n}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 Pe(i,e){const t=ee(window.location.origin);if(b._allowedOriginHashes.indexOf(t)===-1||Math.random()>=at)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?F(i):"https://apps.rokt.com";X(c+"/v1/wsdk-init/index.html?"+o),X("https://"+ct+"/v1/wsdk-init/index.html?"+o+"&isControl=true")}function Rt(){return typeof window<"u"&&!!window.location?.search?.toLowerCase().includes("mp_enable_logging=true")}function kt(){return typeof window<"u"?window.location?.href:void 0}function vt(){return typeof window<"u"?window.navigator?.userAgent:void 0}class be{constructor(){this._logCount={}}incrementAndCheck(e){const n=(this._logCount[e]||0)+1;return this._logCount[e]=n,n>At}}class Y{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 be,this._isEnabled=Rt()||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:kt(),deviceInfo:vt(),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 Re{constructor(e,t,n,r,s){this._transport=new Y(e,t,n,r,s),this._errorUrl=Ee(e?.errorUrl,e?.integrationDomain,St)}report(e){if(!e)return;const t=e.severity||P.ERROR;this._transport.send(this._errorUrl,t,e.message,e.code,e.stackTrace)}}class ke{constructor(e,t,n,r,s,o){this._transport=new Y(e,n,r,s,o),this._placementDiagnosticTransport=new Y(e,n,r,s),this._loggingUrl=Ee(e?.loggingUrl,e?.integrationDomain,yt),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 wt(i){const e=H(window.location.href),t=i.EventAttributes?.title||document.title,n=Me(),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 E=class E{constructor(){this.name=h,this.id=M,this.moduleId=M,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=Ze(),this.accountId=null,this._preselectState=Je()}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(y(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=H(window.location.href);const n=se(),r=wt(e);n.push(r);const s=Math.min(n.length,ne),o=Ue(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=$e(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(){Xe(this._preselectState,this.buildPreselectHost())}isLauncherReadyToAttach(){return!!window.Rokt&&N(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[E.EMAIL_SHA256_KEY]=e[n]),n&&delete t[n],t}logSelectPlacementsEvent(e){if(!window.mParticle||typeof a().logEvent!="function"||!f(e))return;const t=a().EventType.Other;a().logEvent(ot,t,e)}setRoktSessionId(e){if(!(!e||typeof e!="string"))try{const t=a().getInstance();t&&N(t.setIntegrationAttribute)&&t.setIntegrationAttribute(M,{roktSessionId:e})}catch{}}readMpSessionId(){const e=a()?.sessionManager,t=e?.getSessionId??e?.getSession;if(N(t))return t.call(e)||void 0}readMpDeviceId(){return a()?.getDeviceId?.()||void 0}attachLauncher(e,t,n=[]){et(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 Pt([...n],o),this.initRoktLauncher(o)}).catch(o=>{const c=this._launcherAttachState.lifecycle==="attached";if(nt(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 st(this._launcherAttachState,this.isLauncherReadyToAttach(),e=>this.attachLauncher(e.accountId,e.launcherOptions,e.legacyRoktExtensions))}initRoktLauncher(e){window.Rokt&&(window.Rokt.currentLauncher=e),this.launcher=e,tt(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,Pe(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=I(s),this._onboardingExpProvider=o.onboardingExpProvider;const u=x(o.placementEventMapping);this.placementEventMappingLookup=ye(u);const l=x(o.placementEventAttributeMapping);this.placementEventAttributeMappingLookup=Se(l),o.hashedEmailUserIdentityType&&(this._mappedEmailSha256Key=o.hashedEmailUserIdentityType.toLowerCase()),this._workspaceIdSyncApiKey=g(o.workspaceIdSyncApiKey)?o.workspaceIdSyncApiKey:void 0;const p=a().Rokt?.domain,{roktExtensionsQueryParams:w,legacyRoktExtensions:T,loadThankYouElement:G}=Ie(o.roktExtensions),_={...a().Rokt?.launcherOptions||{}};this.integrationName=bt(_.integrationName),_.integrationName=this.integrationName,this.domain=p;const L={loggingUrl:o.loggingUrl,errorUrl:o.errorUrl,integrationDomain:p,isLoggingEnabled:a().config?.isLoggingEnabled===!0},R=new Re(L,this.integrationName,window.__rokt_li_guid__,o.accountId),O=new ke(L,R,this.integrationName,window.__rokt_li_guid__,o.accountId);if(this.errorReportingService=R,this.loggingService=O,this.isTargetingDisabled())try{oe(),ce()}catch(m){this.errorReportingService?.report({message:"Rokt Kit: Failed to clear page views when targeting is disabled",code:"PAGE_VIEW_CAPTURE_FAILED",severity:P.INFO,stackTrace:m instanceof Error?m.stack:void 0})}return a()._registerErrorReportingService&&a()._registerErrorReportingService(R),a()._registerLoggingService&&a()._registerLoggingService(O),n?(this.testHelpers={generateLauncherScript:pe,generateThankYouElementScript:me,extractRoktExtensionConfig:Ie,hashEventMessage:Ae,parseSettingsString:x,generateMappedEventLookup:ye,generateMappedEventAttributeLookup:Se,sendAdBlockMeasurementSignals:Pe,createAutoRemovedIframe:X,djb2:ee,setAllowedOriginHashes:m=>{E._allowedOriginHashes=m},ReportingTransport:Y,ErrorReportingService:Re,LoggingService:ke,RateLimiter:be,ErrorCodes:Q,WSDKErrorSeverity:P,resetLauncherAttachState:()=>rt(this._launcherAttachState)},this.attachLauncher(c,_),"Successfully initialized: "+h):(G&&(a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this),_e(dt,me(p),{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,_,T):(_e(ut,pe(p,w),{onLoad:()=>{this.isLauncherReadyToAttach()?this.attachLauncher(c,_,T):console.error("Rokt object is not available after script load.")},onError:m=>{console.error("Error loading Rokt launcher script:",m)}}),this.captureTiming(E.PERFORMANCE_MARKS.RoktScriptAppended)),"Successfully initialized: "+h)}process(e){if(this.isTargetingDisabled()||(e.EventDataType===gt&&(Ke(this.loggingService),this.capturePageView(e),ge(this._preselectState,this.buildPreselectHost(),e)),e.EventDataType===ft&&(oe(),ce(),this.accountId&&v(this.accountId))),!this.isKitReady())return"Kit not ready for forwarder: "+h;if(N(a().Rokt?.setLocalSessionAttribute)&&(y(this.placementEventAttributeMappingLookup)||this.applyPlacementEventAttributeMapping(e),!y(this.placementEventMappingLookup))){const t=Ae(e.EventDataType,e.EventCategory,e.EventName??"");this.placementEventMappingLookup[String(t)]&&a().Rokt.setLocalSessionAttribute?.(this.placementEventMappingLookup[String(t)],!0)}return"Successfully sent to forwarder: "+h}setExtensionData(e){if(!this.isKitReady()){console.error("Rokt Kit: Not initialized");return}window.Rokt.setExtensionData(e)}setUserAttribute(e,t){return Z(e)||(this.userAttributes[e]=t),qe(this.accountId,e)&&this.flushPendingPreselectDispatches(),"Successfully set user attribute for forwarder: "+h}removeUserAttribute(e){return delete this.userAttributes[e],"Successfully removed user attribute for forwarder: "+h}handleIdentityComplete(e,t){return this.userAttributes=I(e.getAllUserAttributes()),"Successfully called "+t+" for forwarder: "+h}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&&v(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,fe))]):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,fe))]).then(()=>this._dispatchPlacements(e))}return this._dispatchPlacements(e)}_dispatchPlacements(e){const t=e&&e.attributes||{},r={...I(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=I(l);const p=this._onboardingExpProvider==="Optimizely"?this.fetchOptimizely():{},w=this.returnUserIdentities(c),T=this.returnLocalSessionAttributes(),G=Ce(se()),_=De(),L=this.readMpSessionId(),R=this.readMpDeviceId(),O={...w,...l,...p,...T,...G.length?{[pt]:JSON.stringify(G)}:{},..._?{[mt]:_}:{},...this.userIdentifiedInWorkspace?{[ht]:!0}:{},...L?{[Et]:L}:{},...R?{[_t]:R}:{},mpid:u},m=this.buildCacheMatchKeys(typeof e.identifier=="string"?e.identifier:void 0),Ot={...e,attributes:O,...m!==void 0?{cacheMatchKeys:m}:{}},ve=this.launcher.selectPlacements(Ot),we=e.preselect===!0,Nt=()=>{we||this.logSelectPlacementsEvent(O)};return Promise.resolve(ve).then(Ut=>{if(!we)return Ut?.context?.sessionId?.then(Ct=>this.setRoktSessionId(Ct))}).catch(()=>{}).finally(Nt),ve}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()?(it(this._launcherAttachState),this.launcher.terminate()):(console.error("Rokt Kit: Not initialized"),Promise.resolve())}onShoppableAdsReady(e){this._isThankYouElementLoaded?e():this._thankYouElementOnLoadCallback=e}};E._allowedOriginHashes=[-553112570,549508659],E.PERFORMANCE_MARKS={RoktScriptAppended:"mp:RoktScriptAppended"},E.EMAIL_SHA256_KEY="emailsha256";let b=E;function Tt(){return M}function Lt(i){if(!i){window.console.log("You must pass a config object to register the kit "+h);return}if(!f(i)){window.console.log("'config' must be an object. You passed in a "+typeof i);return}f(i.kits)?i.kits[h]={constructor:b}:(i.kits={},i.kits[h]={constructor:b}),window.console.log("Successfully registered "+h+" to your mParticle configuration")}return typeof window<"u"&&window.mParticle&&a().addForwarder&&a().addForwarder({name:h,constructor:b,getId:Tt}),j.register=Lt,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"}),j})({});
|
|
2
2
|
//# sourceMappingURL=Rokt-Kit.iife.js.map
|