@mrrocket/sdk 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +12 -0
- package/dist/browser/mrrocket.js +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +2 -1
- package/dist/browser.js.map +1 -1
- package/dist/client.d.ts +11 -0
- package/dist/client.js +3 -1
- package/dist/client.js.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/onboarding-report.d.ts +19 -0
- package/dist/onboarding-report.js +23 -0
- package/dist/onboarding-report.js.map +1 -0
- package/dist/onboarding-state.d.ts +3 -0
- package/dist/onboarding-state.js +7 -1
- package/dist/onboarding-state.js.map +1 -1
- package/dist/react-native/index.d.cts +29 -2
- package/dist/react-native/index.d.ts +29 -2
- package/dist/react-native/index.js +234 -207
- package/dist/react-native/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this package. It follows semantic versioning; before 1.0 a minor version may change an API.
|
|
4
4
|
|
|
5
|
+
## 0.22.0 (not published yet)
|
|
6
|
+
|
|
7
|
+
- **Onboarding in your own code (web, script tag and React Native):** `useOnboardingReport(name, { order, type })` (script tag `mrrocket.onboarding.report(name, options)`) with `saw(step, title)`, `answered(question, answer, label)`, `done(step)` and `closed(step)`. Nothing to set up in MRRocket: the first report makes the item under Onboarding, marked "From your code". MRRocket shows who saw each step and what they answered, and keeps the answers on the contact. It follows the visitor's consent like any other event.
|
|
8
|
+
- `useOnboarding(id)` for items already drawn by the app keeps working.
|
|
9
|
+
- Version reported in event batches: `0.22.0`.
|
|
10
|
+
|
|
5
11
|
## 0.21.0 (not published yet, together with 0.20.0)
|
|
6
12
|
|
|
7
13
|
- **Onboarding questions (web, script tag and React Native):** a number scale (`type: "scale"` with `min`, `max`, `lowLabel`, `highLabel`), an "Other" option where people type their own words (`other`, `otherLabel`; stored as `other:<words>`), and a Skip button on an optional question (`optional`, `skipLabel`; `onboarding.skip()` records `skipped: true`). An older app shows a scale as a text field, leaves "Other" out and offers no Skip.
|
package/README.md
CHANGED
|
@@ -425,6 +425,18 @@ MRRocket never changes a subscription (its payment key is read-only): `onCancel`
|
|
|
425
425
|
|
|
426
426
|
**Onboarding** (Conversion › Onboarding): the product's live tours, checklists and modals. Each is one thing: a **tour** (bubbles that point at elements, one after another), a **checklist** (tasks in the corner) or a **modal** (one window). An item starts on its own when the person does its trigger: `track("Signed up")` (or `signup`, `sign_up`) for "Signed up", `track("first_export")` for "First export", the first page or screen for "First launch" / "First visit", and since 0.17.0 a page of your app ("/settings", "/projects/*", also after client-side navigation), once per person. Automatic starts need a signed-in person (`identify`) or stored progress (`consent="cookies"` / `"persistent"`), so nobody gets the same tour on every page; an item set to "Signed-in people only" (0.17.0) waits for `identify`. When an item ends, the next one of the same moment follows. `useCockpit().startOnboarding()` (script tag `mrrocket.onboarding.start()`, React Native `useOnboarding().start()`) starts one whenever you want; `onboarding={false}` on the provider switches the automatic start off. A tour step points at the element marked `data-ck-target="…"` or a CSS selector (web); a checklist task with an event ticks itself when you track it.
|
|
427
427
|
|
|
428
|
+
**Onboarding in your own code** (0.22.0): if your app already has its own questions or checklist, keep them and report what people do. There is nothing to set up in MRRocket: the first report makes the item under Onboarding, marked "From your code", with who saw each step and what they answered; answers stay on the contact. MRRocket never draws it and has no say in when it shows. Reports follow the visitor's consent like any other event.
|
|
429
|
+
|
|
430
|
+
```tsx
|
|
431
|
+
const report = useOnboardingReport("Welcome questions", { order: ["goal", "role", "source"] }); // script tag: mrrocket.onboarding.report(name, options)
|
|
432
|
+
|
|
433
|
+
report.saw("goal", "What brings you here?"); // when the question is on screen
|
|
434
|
+
report.answered("goal", "dream", "Dream game"); // an option's id and its words
|
|
435
|
+
report.closed("goal"); // they skipped the rest
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
Report the words in one language, whatever the visitor reads: the ids count the people, the words only name them in MRRocket. `order` keeps a question only some people see in its place. For a checklist or a tour pass `type: "checklist"` or `"tour"` and call `done(step)` when a step is done.
|
|
439
|
+
|
|
428
440
|
Since 0.17.0:
|
|
429
441
|
|
|
430
442
|
- **The bubble's side:** a tour step has `placement` `"auto" | "top" | "bottom" | "left" | "right"`. Auto (or no value) is the behaviour before: below the element, above it when there is no room. A chosen side flips to the opposite one, then to any side with room; an arrow points at the element. React Native shows tour steps as a card at the bottom, so the side does not apply there.
|
package/dist/browser/mrrocket.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){'use strict';var Nn=Object.defineProperty;var Tn=(e,n,o)=>n in e?Nn(e,n,{enumerable:true,configurable:true,writable:true,value:o}):e[n]=o;var Me=(e,n,o)=>Tn(e,typeof n!="symbol"?n+"":n,o);var qt=e=>{let n=0;for(let o=0;o<e.length;o++){let i=e.charCodeAt(o);i<128?n+=1:i<2048?n+=2:i>=55296&&i<=56319&&o+1<e.length&&(e.charCodeAt(o+1)&64512)===56320?(n+=4,o++):n+=3;}return n},Un=(e,n,o,i)=>{let d=`{"key":${JSON.stringify(e)},${i?`"userHash":${JSON.stringify(i)},`:""}"sdk":${JSON.stringify(o)},"events":[`,l=qt(d)+2,m=[],R=[],I=[],y=l,F=()=>{R.length&&m.push({body:`${d}${R.join(",")}]}`,events:I}),R=[],I=[],y=l;};for(let k of n){let v=JSON.stringify(k),O=qt(v)+1;l+O>6e4||((R.length===100||y+O>6e4)&&F(),R.push(v),I.push(k),y+=O);}return F(),m},Yt=(e,n,o,i)=>Un(e,n,o,i).map(d=>d.body);var Ke=class{constructor(n=1e3,o=30,i=3){Me(this,"windowMs",n);Me(this,"radius",o);Me(this,"count",i);Me(this,"clicks",[]);Me(this,"fired",false);}push(n,o,i){let d=this.clicks.filter(l=>i-l.t<=this.windowMs&&Math.hypot(l.x-n,l.y-o)<=this.radius);return d.length!==this.clicks.length&&(this.fired=false),this.clicks=[...d,{x:n,y:o,t:i}],this.clicks.length>=this.count&&!this.fired?(this.fired=true,true):false}};var Hn='a[href],button,input,select,textarea,label,summary,[role="button"],[role="link"],[role="tab"],[role="menuitem"],[role="checkbox"],[role="switch"],[onclick],[data-ck-goal]',Dn="[data-ck-mask]",Wn="[data-ck-block]",Xt=/\d{4,}|^[a-z]{1,3}-[a-z0-9]{5,}$|^_|__|css-|^sc-|^jsx-/i,jn=e=>{let n=e.tagName.toLowerCase();if(e.id&&!Xt.test(e.id)&&e.id.length<=40)return `${n}#${e.id}`;let o=typeof e.className=="string"?e.className.split(/\s+/).filter(l=>l&&!Xt.test(l)&&l.length<=30&&!l.includes(":")):[],i=o.length?`${n}.${o.slice(0,2).join(".")}`:n,d=e.parentElement?[...e.parentElement.children].filter(l=>l.tagName===e.tagName):[];return d.length>1?`${i}:nth-of-type(${d.indexOf(e)+1})`:i},Kn=e=>{let n=[],o=e;for(;o&&n.length<3&&o.tagName&&o.tagName!=="BODY"&&o.tagName!=="HTML";){let i=jn(o);if(n.unshift(i),i.includes("#"))break;o=o.parentElement;}return n.join(" > ").slice(0,160)},et=e=>(e!=null?e:"").replace(/\s+/g," ").trim().slice(0,40),Vn=e=>{var o,i,d,l,m;if(e.closest(`${Dn},${Wn}`))return "";let n=e.tagName.toLowerCase();if(n==="input"){let R=((o=e.getAttribute("type"))!=null?o:"text").toLowerCase();return et(R==="submit"||R==="button"?(i=e.getAttribute("aria-label"))!=null?i:e.value:e.getAttribute("aria-label"))}return et(n==="select"||n==="textarea"?e.getAttribute("aria-label"):(m=(l=(d=e.getAttribute("aria-label"))!=null?d:e.getAttribute("title"))!=null?l:e.innerText)!=null?m:e.textContent)},Jt=e=>{var l,m;let n=e.target instanceof Element?e.target:null;if(!n)return null;let o=n.closest(Hn),i=o!=null?o:n,d=document.documentElement;return {x:Math.round(e.clientX),y:Math.round(e.clientY+window.scrollY),vw:window.innerWidth,vh:window.innerHeight,docH:Math.max(d.scrollHeight,(m=(l=document.body)==null?void 0:l.scrollHeight)!=null?m:0),selector:Kn(i),label:o?Vn(o):"",interactive:!!o}},zt=()=>{var o,i;let e=document.documentElement,n=Math.max(e.scrollHeight,(i=(o=document.body)==null?void 0:o.scrollHeight)!=null?i:0);return n?Math.min(100,Math.round((window.scrollY+window.innerHeight)/n*100)):0};var nt="0.21.0",Bn=(e,n)=>{let o=n.trim().toLowerCase();for(let[i,d]of Object.entries(e))if(i.toLowerCase()===o)return d},qn=(e,n)=>{let o=e.trim().toLowerCase(),i=n.trim().toLowerCase();return i.startsWith("@")?o.endsWith(i):o===i},Yn=(e,n)=>{if(e.op==="in cohort")return false;let o=Bn(n,e.property),i=o==null?"":String(o);if(e.op==="\u2265"){let l=Number(i),m=Number(e.values[0]);return i!==""&&Number.isFinite(l)&&Number.isFinite(m)&&l>=m}let d=i!==""&&e.values.some(l=>qn(i,l));return e.op==="is"||e.op==="in"?d:!d},Xn=(e,n,o={})=>{var R;if(!e.on)return false;let i={id:n,...o},d=e.sets.length?e.sets.find(I=>I.conditions.every(y=>Yn(y,i))):{rollout:100};if(!d||Gt(`${e.key}:rollout:${n}`)*100>=d.rollout)return false;if(!((R=e.variants)!=null&&R.length))return true;let l=Gt(`${e.key}:variant:${n}`)*100,m=0;for(let I of e.variants)if(m+=I.split,l<m)return I.key;return e.variants[e.variants.length-1].key},Rt=(e,n,o,i={})=>{var l;let d=(l=n==null?void 0:n.flags)==null?void 0:l.find(m=>m.key===e);return d?Xn(d,o,i):false},Jn=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],Qt="ck_preview",Zt="ck_embed",Se="ck_id",Ae="ck_sid";var zn=e=>{var o;let n={};for(let i of Jn){let d=(o=e(i))==null?void 0:o.trim();d&&(n[i]=d.slice(0,150));}return n},en=e=>{let n=new URLSearchParams(e);return zn(o=>n.get(o))};var Gn=e=>{let n=2166136261;for(let o=0;o<e.length;o++)n^=e.charCodeAt(o),n=Math.imul(n,16777619);return (n>>>0)/4294967296},Gt=e=>{let n=2166136261;for(let o=0;o<e.length;o++)n^=e.charCodeAt(o),n=Math.imul(n,16777619);return n^=n>>>16,n=Math.imul(n,2246822507),n^=n>>>13,n=Math.imul(n,3266489909),n^=n>>>16,(n>>>0)/4294967296},Qn=(e,n)=>{var l,m,R,I;let o=(m=(l=e.variants[0])==null?void 0:l.id)!=null?m:"control";if(e.winner)return e.winner;if(e.status!=="running")return o;let i=Gn(`${e.key}:${n}`),d=0;for(let y of e.variants)if(d+=y.weight,i<d)return y.id;return (I=(R=e.variants[e.variants.length-1])==null?void 0:R.id)!=null?I:o},tn=e=>{let n=Array.isArray(e)?e[0]:e;if(!n)return {};let o={};for(let i of n.split(",")){let[d,l]=i.split(":");d&&l&&(o[d.trim()]=l.trim());}return o};var Be=(e,n,o,i)=>{if(i[e])return i[e];let d=n==null?void 0:n.experiments.find(l=>l.key===e);return d?Qn(d,o):"control"},nn=(e,n,o)=>{var d,l,m,R,I,y;let i={...(d=e==null?void 0:e.texts)!=null?d:{}};for(let F of (l=e==null?void 0:e.experiments)!=null?l:[]){let k=Be(F.key,e,n,o);k!==((R=(m=F.variants[0])==null?void 0:m.id)!=null?R:"control")&&Object.assign(i,(y=(I=F.variants.find(v=>v.id===k))==null?void 0:I.changes)!=null?y:{});}return i},Ve="ck_x",tt=e=>e.replace(/\/+$/,"")||"/",rn=(e,n,o,i={})=>{var R,I;if(!e)return null;let d;try{d=new URL(n);}catch(y){return null}if(d.searchParams.has(Ve))return null;let l=tt(d.pathname),m=(y,F)=>{let k;try{k=new URL(y,d);}catch(v){return}if(!(!/^https?:$/.test(k.protocol)||k.origin===d.origin&&tt(k.pathname)===l))return d.searchParams.forEach((v,O)=>{k.searchParams.has(O)||k.searchParams.set(O,v);}),F&&k.searchParams.set(Ve,F),k.hash||(k.hash=d.hash),k.href};for(let y of (R=e.redirects)!=null?R:[]){let F=y.from&&tt(y.from)===l?m(y.to):void 0;if(F)return {to:F}}for(let y of e.experiments){if(!y.path||tt(y.path)!==l)continue;let F=y.status==="running"&&!y.winner;if(F&&o===null&&!i[y.key])return null;let k=Be(y.key,e,o!=null?o:"",i),v=(I=y.variants.find(M=>M.id===k))==null?void 0:I.url,O=v?m(v,F?`${y.key}:${k}`:void 0):void 0;return F?{to:O,experiment:y.key,variant:k}:O?{to:O}:null}return null},on=(e,n)=>{let[o,i]=(n!=null?n:"").split(":"),d=e==null?void 0:e.experiments.find(l=>l.key===o);return d&&d.variants.some(l=>l.id===i)?{experiment:o,variant:i}:null};var Et=()=>typeof crypto!="undefined"&&"randomUUID"in crypto?crypto.randomUUID():`ck_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;var Zn="401: sign the user id on your server with userHash(id) from @mrrocket/sdk/next/server and pass identify(id, props, { hash }).",Le=(e,n=o=>console.warn(o))=>{let o=globalThis;e!==401||o.__mrrocketUnsigned||(o.__mrrocketUnsigned=true,n(`[MRRocket] ${Zn}`));},sn=(e,n,o,i=d=>console.warn(d))=>{let d=typeof o=="string"?o.trim().toLowerCase():"";return /^[0-9a-f]{64}$/.test(d)?{id:n,hash:d}:(d&&i("[MRRocket] identify: that hash is no userHash(id); not sent."),e&&e.id===n?e:null)},an=(e,n)=>e&&n&&e.id===n?e.hash:void 0,cn=(e,n)=>e&&n.some(o=>o===e.id)&&n.every(o=>!o||o===e.id)?e.hash:void 0;var er=8*1024,tr=20,nr=20,rr=2e3,qe=(e,n)=>e.length>n?`${e.slice(0,n-1)}\u2026`:e,or=e=>{var n;if(e instanceof Error)return {type:e.name||"Error",message:qe(e.message||String(e),1e3),stack:e.stack?qe(e.stack,er):void 0};if(typeof e=="string")return {type:"Error",message:qe(e,1e3)};try{return {type:"Error",message:qe((n=JSON.stringify(e))!=null?n:String(e),1e3)}}catch(o){return {type:"Error",message:String(e)}}},dn=e=>{let n=[],o=[],i=new Set,d=0,l=`${e.host}/api/sdk/errors`,m=(v=false)=>{for(;n.length;){let O=n.splice(0,4),M=e.context(),B=M.distinctId&&M.userHash?{id:M.distinctId,hash:M.userHash}:null,T=cn(B,O.map(D=>D.distinctId)),q=JSON.stringify({key:e.apiKey,...T?{userHash:T}:{},errors:O});v&&typeof navigator!="undefined"&&"sendBeacon"in navigator&&navigator.sendBeacon(l,q)||fetch(l,{method:"POST",headers:{"content-type":"application/json"},body:q,keepalive:true}).then(D=>{D.status===401?Le(401):!D.ok&&D.status!==429&&e.warn(`Error reports were rejected with ${D.status}. Check the public key and NEXT_PUBLIC_MRROCKET_HOST.`);}).catch(()=>{});}},R=(v,O="manual")=>{let M=e.context();if(!M.send||d>=tr)return;let B=or(v);if(/\/api\/sdk\/errors/.test(B.message))return;let T=`${B.type}:${B.message}`;i.has(T)||(i.add(T),d++,n.push({...B,mechanism:O,handled:O==="manual",url:window.location.href,ts:Date.now(),crumbs:o.slice(),...e.release?{release:e.release}:{},...M.distinctId?{distinctId:M.distinctId}:{},...M.sessionId?{sessionId:M.sessionId}:{}}));},I=v=>{var O;!v.error&&(!v.message||v.message==="Script error.")||R((O=v.error)!=null?O:new Error(v.message),"onerror");},y=v=>{var O;return R((O=v.reason)!=null?O:new Error("Unhandled promise rejection"),"onunhandledrejection")},F=()=>m(true);window.addEventListener("error",I),window.addEventListener("unhandledrejection",y),window.addEventListener("pagehide",F);let k=window.setInterval(()=>m(),rr);return {capture:R,crumb:(v,O)=>{o.push({ts:Date.now(),type:v,message:qe(O,120)}),o.length>nr&&o.shift();},stop:()=>{window.removeEventListener("error",I),window.removeEventListener("unhandledrejection",y),window.removeEventListener("pagehide",F),window.clearInterval(k),m(true);}}};var Ot=globalThis,ln,Q=(ln=Ot.__mrrocketI18n)!=null?ln:Ot.__mrrocketI18n={version:0,onWords:new Set,onLocale:new Set},_t=e=>{for(let n of [...e])try{n();}catch(o){}},Ye=e=>{var n;return ((n=Q.words)==null?void 0:n[e])||e};var un=(e,n)=>{var i;let o=Q.lang===n&&JSON.stringify((i=Q.words)!=null?i:{})===JSON.stringify(e!=null?e:{});Q.words=e,Q.lang=n,!o&&(Q.version++,_t(Q.onWords));},sr=e=>{let n=e==null?void 0:e.trim().replace(/_/g,"-");if(n)try{return Intl.getCanonicalLocales(n)[0]}catch(o){return o instanceof RangeError?void 0:n}},St=e=>{let n=sr(e);n!==Q.locale&&(Q.locale=n,Q.version++,_t(Q.onWords),_t(Q.onLocale));};var rt=()=>{var e,n;return (n=(e=Q.locale)!=null?e:Q.device)!=null?n:typeof navigator!="undefined"&&navigator.language||void 0},ot=()=>{let e=rt();return e?`&lang=${encodeURIComponent(e)}`:""};var fn=e=>(Q.onLocale.add(e),()=>{Q.onLocale.delete(e);});var Xe="$cancel_flow",J="$onboarding",It="$inapp";var ir={version:0,question:"",reasons:[],offers:{},get confirm(){return {title:Ye("Cancel your subscription?"),body:Ye("You keep access until the end of the billing period."),button:Ye("Cancel subscription")}},offersFor:"business"},Ft="mrrocket:onboarding",ge=e=>e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,""),pn=new Set(["signed_up","signup","sign_up","registered","account_created","user_signed_up"]),st=(e,n)=>{let o=ge(e),i=ge(n);return !o||!i?false:o===i||pn.has(o)&&pn.has(i)},gn=e=>/^(first (launch|visit|open|session|login|sign ?in|app open)|app (opened|launched)|on load|every visit|always)?$/i.test(e.trim());var mn=e=>e.trim().startsWith("/");var ar="Needs tracking code 0.18.0",ce=e=>{var n;return (n=e.when)!=null?n:e.trigger},it=e=>ge(e)==="from_a_checklist"||ge(e)==="from_your_code"||ge(e)===ge(ar),wn="after:",at=e=>{let n=(e!=null?e:"").trim();return n.toLowerCase().startsWith(wn)&&n.slice(wn.length).trim()||null},cr=e=>{var n;return (n=e.opens)!=null?n:e.startsTour?{kind:"tour",id:e.startsTour}:void 0},Ie="other:",dr=e=>{var i,d;let n=(i=e==null?void 0:e.min)!=null?i:0,o=(d=e==null?void 0:e.max)!=null?d:10;return Array.from({length:Math.max(0,Math.min(o-n,20)+1)},(l,m)=>n+m)},hn=(e,n)=>{var o;return !e||n==null?false:e.type==="choice"?e.other&&n.startsWith(Ie)?n.slice(Ie.length).trim().length>0:((o=e.options)!=null?o:[]).some(i=>i.id===n):e.type==="scale"?dr(e).some(i=>String(i)===n):n.trim().length>0&&n.length<=500},lr=(e,n)=>{var o,i,d;return (e==null?void 0:e.type)!=="choice"?n.trim():e.other&&n.startsWith(Ie)?n.slice(Ie.length).trim():(d=(i=(o=e.options)==null?void 0:o.find(l=>l.id===n))==null?void 0:i.label)!=null?d:n};var ur=()=>`cf_${Math.random().toString(36).slice(2,10)}${Date.now().toString(36)}`;var dt=e=>{let n=(e!=null?e:"").trim();return /^https?:\/\//i.test(n)||/^\/(?!\/)/.test(n)?n:void 0},ee=e=>{var n;return (n=e.nodes)!=null?n:e.steps},fr=e=>Math.max(0,e.amount)*(e.unit==="hours"?36e5:864e5),$t=(e,n)=>{let o=e.trim(),i=(n.split(/[?#]/)[0]||"/").replace(/\/+$/,"")||"/";if(!o)return false;if(o.endsWith("*")){let d=o.slice(0,-1).replace(/\/+$/,"");return !d||i===d||i.startsWith(`${d}/`)}return i===(o.replace(/\/+$/,"")||"/")},we=e=>e.flatMap(n=>n.kind==="condition"?[...we(n.yes),...we(n.no)]:n.kind==="wait"?[]:[n]),pr=(e,n=Date.now())=>e==null||e===""?NaN:Math.floor((n-new Date(e).getTime())/2630016e3),ct=e=>e==null?void 0:e.trim().toLowerCase(),gr=({when:e={}},n)=>(e.answer==null||ct(e.answer)===ct(n.answer))&&(e.plan==null||[e.plan].flat().some(o=>ct(o)===ct(n.plan)))&&!(n.months>=e.tenureUnder)&&!(n.months<e.tenureOver)&&(e.tenureUnder==null||n.months>=0)&&(e.tenureOver==null||n.months>=0),kn=e=>{let n=null,o=null,i=null,d=[],l=false,m=null,R,I=null,y=new Map,F=new Set,k=new Set,v=new Set,O=e.auto!==false,M=new Set,B=()=>{var t,r;return (r=(t=e.now)==null?void 0:t.call(e))!=null?r:Date.now()},T=null,q=null,z=new Map,D=new Map,he=new Set,de=null,xe=()=>{var t;return (t=n==null?void 0:n.onboarding)!=null?t:[]},Ne=()=>xe().filter(t=>t.shownBy!=="code"),W=t=>t?xe().find(r=>r.id===t):void 0,V=t=>{let r=y.get(t);return r||y.set(t,r={done:new Set,dismissed:false,answers:new Map,at:new Map,reached:new Map}),r},Ce=false,Y=t=>{e.track(J,t),Ce=true;},te=(t,r)=>{t.done.add(r),t.at.set(r,B());},ve=t=>{var r,a,c;if((r=t.page)!=null&&r.trim()){let u=(a=e.path)==null?void 0:a.call(e);return u===void 0?false:$t(t.page,u)}if((c=t.event)!=null&&c.trim()){if(!l)return;for(let u of M)if(st(t.event,u))return true;return false}return false},P=(t,r,a,c,u=0,g)=>{var h,C;for(let w=0;w<r.length;w++){let b=r[w];if(b.kind==="wait"){if(a.done.has(b.id)){g=(h=a.at.get(b.id))!=null?h:g;continue}let $=a.reached.get(b.id);if($===void 0){if(!c)return {at:"pending"};$=g!=null?g:B(),a.reached.set(b.id,$),Y({flow:t.id,step:b.id,kind:"wait",action:"shown"});}let S=$+fr(b);if(B()<S)return {at:"wait",until:S};if(!c)return {at:"pending"};te(a,b.id),Y({flow:t.id,step:b.id,kind:"wait",action:"completed"}),g=S;continue}if(b.kind==="condition"){let $=a.answers.get(b.id);if($===void 0){if(!c)return {at:"pending"};if($=ve(b),$===void 0)return {at:"pending"};a.answers.set(b.id,$),Y({flow:t.id,step:b.id,kind:"condition",action:"answered",answer:$?"yes":"no"});}return P(t,$?b.yes:b.no,a,c,u,g)}if(!a.done.has(b.id))return {at:"step",step:b,line:r,index:w,before:u};g=(C=a.at.get(b.id))!=null?C:g,u++;}return {at:"end"}},ne=t=>{let r=y.get(t.id);return !!r&&(r.dismissed||P(t,ee(t),r,false).at==="end")},Te=t=>`${Ft}:${t!=null?t:"visitor"}`,Ue=t=>`${Ft}:events:${t!=null?t:"visitor"}`,He=t=>`${Ft}:answers:${t!=null?t:"visitor"}`,pe=t=>{if(!t.finish||t.finish==="none"||t.shownBy==="code"||he.has(t.id))return;let r=y.get(t.id);!r||r.dismissed||P(t,ee(t),r,false).at!=="end"||(he.add(t.id),de={kind:t.finish,key:`${t.id}:${B()}`});},j=()=>{var a;Ce=false;let t=(a=e.storage)==null?void 0:a.call(e);if(!t)return;let r={};for(let[c,u]of y)r[c]={done:[...u.done],...u.dismissed?{dismissed:true}:{},...u.answers.size?{answers:Object.fromEntries([...u.answers].map(([g,h])=>[g,h?"yes":"no"]))}:{},...u.at.size?{at:Object.fromEntries(u.at)}:{},...u.reached.size?{reached:Object.fromEntries(u.reached)}:{}};try{t.set(Te(e.personId()),JSON.stringify(r)),z.size&&t.set(He(e.personId()),JSON.stringify(Object.fromEntries(z))),M.size&&t.set(Ue(e.personId()),JSON.stringify([...M].slice(-200)));}catch(c){}},Fe=t=>{var r,a,c,u;for(let[g,h]of Object.entries(t!=null?t:{})){let C=V(g);for(let w of (r=h.done)!=null?r:[])C.done.add(w);h.dismissed&&(C.dismissed=true);for(let[w,b]of Object.entries((a=h.answers)!=null?a:{}))C.answers.has(w)||C.answers.set(w,b==="yes");for(let[w,b]of Object.entries((c=h.at)!=null?c:{}))typeof b=="number"&&!C.at.has(w)&&C.at.set(w,b);for(let[w,b]of Object.entries((u=h.reached)!=null?u:{}))typeof b=="number"&&(!C.reached.has(w)||b<C.reached.get(w))&&C.reached.set(w,b);}},Ge=t=>{var a;T&&clearTimeout(T),T=null;let r=t-B();r>0&&r<=864e5&&(T=setTimeout(()=>(T=null,_()),r+50),(a=T.unref)==null||a.call(T));},X=false,N=()=>{var $;X=false;let t=W(i);if(!t)return null;let r=V(t.id);if(r.dismissed)return null;let a=P(t,ee(t),r,true);if(Ce&&j(),a.at==="wait"&&Ge(a.until),X=a.at==="wait"||a.at==="pending",a.at!=="step")return null;let{step:c,line:u,index:g}=a,h=S=>!!S&&S.kind!=="wait"&&S.kind!=="condition";if(c.kind==="checklist"){let S=g;for(;S>0&&h(u[S-1])&&u[S-1].kind==="checklist";)S--;let ie=g;for(;ie+1<u.length&&h(u[ie+1])&&u[ie+1].kind==="checklist";)ie++;let le=u.slice(S,ie+1).filter(h);for(let ue of le)!r.done.has(ue.id)&&!k.has(`s:${ue.id}`)&&(k.add(`s:${ue.id}`),e.track(J,{flow:t.id,step:ue.id,kind:"checklist",action:"shown"}));return {type:"checklist",flow:t,items:le.map(ue=>{let K=cr(ue),_e=K&&(K.kind==="tour"||K.kind==="modal")&&K.id!==t.id?W(K.id):void 0,be=_e&&_e.shownBy!=="code"&&ee(_e).length?_e:void 0,Qe=K&&(K.kind==="page"?K.target.trim():K.kind==="code"||be)?K:void 0;return {step:ue,done:r.done.has(ue.id),...be&&(K==null?void 0:K.kind)==="tour"?{tour:be}:{},...Qe?{opens:Qe}:{},...be?{target:be}:{}}})}}k.has(`s:${c.id}`)||(k.add(`s:${c.id}`),e.track(J,{flow:t.id,step:c.id,kind:c.kind,action:"shown"}));let C=u.slice(g+1),w=C.findIndex(S=>S.kind==="condition"),b=(w<0?C:C.slice(0,w)).filter(h).length;return {type:"step",flow:t,step:c,index:a.before,total:a.before+1+b,last:!b&&w<0,...c.kind==="question"?{answer:($=D.get(c.id))!=null?$:c.question?z.get(c.question.key):void 0,back:a.before>0}:{}}},G=()=>{var a,c,u;if(o){let g=o,h=(a=g.flow.followUps)==null?void 0:a[g.reason],C=h?1:0,w=g.plain?1:3+C+((c=g.flow.second)!=null&&c[g.reason]?1:0);return {type:"cancel",screen:g.screen,flow:g.flow,reason:g.reason,...g.screen==="followup"&&h?{followUp:h,answer:g.answer}:{},offer:g.screen==="offer"?g.offer:void 0,...g.screen==="offer"?{round:g.round}:{},price:g.options.price,busy:g.busy,error:g.error,step:g.screen==="survey"?1:g.screen==="followup"?2:g.screen==="offer"?1+C+g.round:w,steps:w}}let t=N();if(t)return t;if(i&&!X){let g=q,h=i;q=null,i=null;let C=g?W(g.flow):void 0;if(g&&C){let w=we(ee(C)).find(S=>S.id===g.step),b=V(C.id);w&&!w.event&&!((u=y.get(h))!=null&&u.dismissed)&&!b.done.has(w.id)&&(te(b,w.id),Y({flow:C.id,step:w.id,kind:"checklist",action:"completed"}),pe(C)),i=C.id;let $=N();if($)return $;X||(i=null);}else if(l){let w=W(h),b=w?ce(w):void 0;Promise.resolve().then(()=>se(b));}}let r=d.find(g=>!F.has(g.id));return r?{type:"message",message:r}:null},_=()=>{let t=G();(t==null?void 0:t.type)==="message"&&!k.has(`m:${t.message.id}`)&&(k.add(`m:${t.message.id}`),e.track(It,{message:t.message.id,journey:t.message.journey,action:"shown"}));for(let r of [...v])try{r();}catch(a){}},re=t=>i===t.id?true:i&&W(i)&&!ne(W(i))?false:(i=t.id,e.track(J,{flow:t.id,action:"started"}),_(),true),ke=t=>t.audience==="answered"?!!t.answered&&z.get(t.answered.question)===t.answered.option:t.audience!=="signed_in"||!!e.personId(),U=t=>{let r=W(t);return !r||ne(r)},oe=(t,r=ce(t))=>{var u;let a=(u=e.path)==null?void 0:u.call(e),c=at(r);if(c)return U(c);if(it(r))return false;if(mn(r))return a!==void 0&&$t(r,a);if(gn(r))return true;for(let g of M)if(st(r,g))return true;return false},se=t=>{var u,g;if(!O||i||!l||!e.personId()&&!((u=e.storage)!=null&&u.call(e)))return;let r=(g=e.path)==null?void 0:g.call(e),a=t&&!it(t)?ge(t):"",c=Ne().find(h=>(at(ce(h))?U(at(ce(h))):mn(ce(h))?r!==void 0&&$t(ce(h),r):gn(ce(h))||!!a&&ge(ce(h))===a)&&ke(h)&&ee(h).length&&!ne(h));c&&re(c);},Re=(t,r,a)=>{let c=V(a.id);c.done.clear(),c.at.clear(),c.dismissed=false,q={flow:t.id,step:r},i=a.id,e.track(J,{flow:a.id,action:"started",from:t.id}),j(),_();},$e=(t,r,a)=>{let c=r.question,u=c.type==="text"?a.trim().slice(0,500):a.startsWith(Ie)?Ie+a.slice(Ie.length).trim().slice(0,490):a;z.set(c.key,u),D.delete(r.id),te(V(t.id),r.id),e.track(J,{flow:t.id,step:r.id,kind:"question",action:"completed",question:c.key,answer:u,label:lr(c,u)}),pe(t),j();},L=t=>{j(),ne(t)&&Promise.resolve().then(()=>se()),_();},De=()=>{let t=e.personId();I!==null&&I!==t&&(y.clear(),M.clear(),z.clear(),D.clear(),F.clear(),i=null,q=null,R=void 0),I=t;let r=(async()=>{var u,g,h,C;let a=(u=e.storage)==null?void 0:u.call(e);if(a)try{let w=await a.get(Te(t));w&&Fe(JSON.parse(w));let b=await a.get(Ue(t));if(b)for(let S of JSON.parse(b))typeof S=="string"&&M.add(S);let $=await a.get(He(t));if($)for(let[S,ie]of Object.entries(JSON.parse($)))typeof ie=="string"&&z.set(S,ie);}catch(w){}let c=xe().length>0||!!(n!=null&&n.messages);if(t&&c&&R!==t){R=t;let w=await e.fetchInApp(t).catch(()=>null);if(w&&e.personId()===t){Fe(w.onboarding);for(let b of (g=w.events)!=null?g:[])typeof b=="string"&&M.add(ge(b));for(let[b,$]of Object.entries((h=w.answers)!=null?h:{}))typeof $=="string"&&!z.has(b)&&z.set(b,$);d=((C=w.messages)!=null?C:[]).filter(b=>b&&b.id&&b.title);}}t||(d=[]),l=true,se(),_();})();return m=r.finally(()=>{m===r&&(m=null);}),m},Ee=t=>t.round>1?{round:2}:t.rule>=0?{rule:t.rule}:{},Oe=t=>{var c,u,g,h;let r={answer:t.answer,plan:t.options.plan,months:pr(t.options.customerSince,(c=e.now)==null?void 0:c.call(e))},a=(g=(u=t.flow.rules)==null?void 0:u[t.reason])!=null?g:[];t.rule=a.findIndex(C=>gr(C,r)),t.offer=t.rule<0?t.flow.offers[t.reason]:(h=a[t.rule].offer)!=null?h:void 0,t.round=1,t.screen=t.offer?"offer":"confirm";},We=(t,r,a)=>{var u;let c=t.screen==="offer"?t.offer:void 0;return {outcome:r,run:t.run,...t.reason?{reason:t.reason,reasonLabel:(u=t.flow.reasons.find(g=>g.id===t.reason))==null?void 0:u.label}:{},...t.answer?{answer:t.answer}:{},...r==="saved"&&c?{offer:c}:{},...a!=null&&a.trim()?{comment:a.trim().slice(0,500)}:{}}},me=(t,r)=>{var a;e.track(Xe,{action:"finished",run:t.run,version:t.flow.version,outcome:r.outcome,customer:(a=t.options.customer)!=null?a:"consumer",...r.reason?{reason:r.reason}:{},...r.answer?{answer:r.answer}:{},...r.offer?{offer:r.offer.kind,...Ee(t)}:{},...r.comment?{comment:r.comment}:{}}),o===t&&(o=null),t.resolve(r),_();},je=(t,r,a)=>{if(t.busy)return;let c=We(t,r,a),u=r==="saved"?t.options.onSave:t.options.onCancel;t.busy=true,t.error=void 0,_(),Promise.resolve().then(()=>u==null?void 0:u(c)).then(()=>me(t,c),()=>{t.busy=false,t.error=Ye("Something went wrong. Please try again."),_();});};return {setConfig:t=>{n=t,i&&!W(i)&&(i=null),_();},refresh:De,onEvent:t=>{var C;if(t==="$pageview"&&se(),!t||t.startsWith("$"))return;let r=ge(t),a=!!r&&!M.has(r);a&&M.add(r);let c=W(i),u=false,g=[...c?[c]:[],...xe().filter(w=>w.shownBy==="code"&&w.id!==(c==null?void 0:c.id))];for(let w of g){let b=V(w.id),$=false;for(let S of we(ee(w)))S.kind==="checklist"&&S.event&&!b.done.has(S.id)&&st(S.event,t)&&(te(b,S.id),$=true,e.track(J,{flow:w.id,step:S.id,kind:S.kind,action:"completed"}));$&&(u=true,pe(w));}if(u||a&&(c||g.length)?(j(),_()):a&&j(),!O||!e.personId()&&!((C=e.storage)!=null&&C.call(e)))return;let h=Ne().find(w=>ee(w).length&&!it(ce(w))&&st(ce(w),t)&&ke(w)&&!ne(w));h&&re(h);},openCancelFlow:(t={})=>{var h,C;if(o)return o.promise;let r=(h=n==null?void 0:n.cancelFlow)!=null?h:ir,a=t.customer!=="business"||r.reasons.length<2,c=()=>{},u=new Promise(w=>c=w),g={flow:r,options:t,plain:a,screen:a?"confirm":"survey",round:1,run:ur(),busy:false,resolve:c,promise:u};return o=g,e.track(Xe,{action:"shown",run:g.run,version:r.version,customer:(C=t.customer)!=null?C:"consumer",plain:a}),_(),u},startOnboarding:t=>{let r=t?W(t):Ne().find(c=>ee(c).length&&!it(ce(c))&&!at(ce(c))&&!ne(c));if(!r||!ee(r).length||r.shownBy==="code")return false;let a=V(r.id);return a.dismissed=false,re(r)},view:G,subscribe:t=>(v.add(t),()=>v.delete(t)),cancel:{pick:t=>{!o||o.busy||o.screen!=="survey"||!o.flow.reasons.some(r=>r.id===t)||(o.reason!==t&&(o.answer=void 0),o.reason=t,o.error=void 0,_());},answer:t=>{let r=o;if(!r||r.busy||r.screen!=="followup")return;let a=t.slice(0,500);r.answer=a.trim()?a:void 0,_();},next:()=>{var r,a;let t=o;if(!(!t||!t.reason)){if(t.screen==="survey")e.track(Xe,{action:"answered",run:t.run,version:t.flow.version,reason:t.reason}),(r=t.flow.followUps)!=null&&r[t.reason]?t.screen="followup":Oe(t);else if(t.screen==="followup")t.answer=(a=t.answer)==null?void 0:a.trim(),Oe(t);else return;_();}},accept:t=>{var a;let r=o;!r||r.screen!=="offer"||!r.reason||(r.busy||e.track(Xe,{action:"offer",run:r.run,version:r.flow.version,reason:r.reason,offer:(a=r.offer)==null?void 0:a.kind,...Ee(r),outcome:"accepted"}),je(r,"saved",t));},decline:()=>{var a,c;let t=o;if(!t||t.screen!=="offer"||t.busy)return;e.track(Xe,{action:"offer",run:t.run,version:t.flow.version,reason:t.reason,offer:(a=t.offer)==null?void 0:a.kind,...Ee(t),outcome:"declined"});let r=t.round===1&&t.reason?(c=t.flow.second)==null?void 0:c[t.reason]:void 0;r?(t.offer=r,t.rule=void 0,t.round=2):t.screen="confirm",t.error=void 0,_();},confirm:t=>{let r=o;!r||r.screen!=="confirm"||je(r,"cancelled",t);},close:()=>{var a,c;let t=o;if(!t||t.busy)return;let r=We(t,"kept");(c=(a=t.options).onClose)==null||c.call(a,r),me(t,r);}},onboarding:{next:()=>{var a,c;let t=N();if((t==null?void 0:t.type)!=="step")return;if(t.step.kind==="question"){let u=t.step.question,g=(a=D.get(t.step.id))!=null?a:u?z.get(u.key):void 0;if(!u||!hn(u,g))return;$e(t.flow,t.step,g),_();return}te(V(t.flow.id),t.step.id),e.track(J,{flow:t.flow.id,step:t.step.id,kind:t.step.kind,action:"completed"}),pe(t.flow),j(),_();let r=t.step.kind==="modal"?dt(t.step.url):void 0;r&&((c=e.openUrl)==null||c.call(e,r));},check:t=>{let r=N();if((r==null?void 0:r.type)!=="checklist")return;let a=r.items.find(c=>c.step.id===t);!a||a.done||(te(V(r.flow.id),t),e.track(J,{flow:r.flow.id,step:t,kind:"checklist",action:"completed"}),pe(r.flow),j(),_());},dismiss:()=>{let t=N();!t||t.type!=="step"&&t.type!=="checklist"||(V(t.flow.id).dismissed=true,e.track(J,{flow:t.flow.id,...t.type==="step"?{step:t.step.id}:{},action:"dismissed"}),i=q&&q.flow!==t.flow.id&&W(q.flow)?q.flow:null,q=null,j(),_());},startTour:t=>{var c;let r=N();if((r==null?void 0:r.type)!=="checklist")return false;let a=(c=r.items.find(u=>u.step.id===t))==null?void 0:c.target;return a?(Re(r.flow,t,a),true):false},open:t=>{var u,g;let r=N();if((r==null?void 0:r.type)!=="checklist")return false;let a=r.items.find(h=>h.step.id===t),c=a==null?void 0:a.opens;return !a||!c?false:(e.track(J,{flow:r.flow.id,step:t,kind:"checklist",action:"opened",opens:c.kind}),(c.kind==="tour"||c.kind==="modal")&&a.target?(Re(r.flow,t,a.target),true):(!a.done&&!a.step.event&&(te(V(r.flow.id),t),e.track(J,{flow:r.flow.id,step:t,kind:"checklist",action:"completed"}),pe(r.flow)),j(),_(),c.kind==="page"?(u=e.navigate)==null||u.call(e,c.target.trim()):(g=e.task)==null||g.call(e,t,r.flow),true))},answer:t=>{let r=N();(r==null?void 0:r.type)!=="step"||r.step.kind!=="question"||(D.set(r.step.id,String(t).slice(0,500)),_());},skip:()=>{let t=N(),r=(t==null?void 0:t.type)==="step"&&t.step.kind==="question"?t.step.question:void 0;(t==null?void 0:t.type)!=="step"||!(r!=null&&r.optional)||(D.delete(t.step.id),te(V(t.flow.id),t.step.id),e.track(J,{flow:t.flow.id,step:t.step.id,kind:"question",action:"completed",question:r.key,skipped:true}),pe(t.flow),j(),_());},back:()=>{let t=N();if((t==null?void 0:t.type)!=="step"||t.step.kind!=="question"||!t.back)return;let r=we(ee(t.flow)),a=r.findIndex(u=>u.id===t.step.id),c=V(t.flow.id);for(let u=a-1;u>=0;u--)if(c.done.has(r[u].id)){c.done.delete(r[u].id),c.at.delete(r[u].id);break}j(),_();},item:t=>{let r=W(t);if(!r)return null;let a=y.get(r.id),c=we(ee(r)).map(h=>{let C=h.question?z.get(h.question.key):void 0;return {...h,done:!!(a!=null&&a.done.has(h.id)),...C!==void 0?{answer:C}:{}}}),u=c.length>0&&c.every(h=>h.done),g=!!(a!=null&&a.dismissed);return {item:r,steps:c,done:u,dismissed:g,eligible:!u&&!g&&ke(r)&&oe(r)}},seen:t=>{let r=W(t);if(!r||r.shownBy!=="code"||!l)return;k.has(`f:${r.id}`)||(k.add(`f:${r.id}`),e.track(J,{flow:r.id,action:"started"}));let a=y.get(r.id);for(let c of we(ee(r)))if(!(a!=null&&a.done.has(c.id))&&!k.has(`s:${c.id}`)&&(k.add(`s:${c.id}`),e.track(J,{flow:r.id,step:c.id,kind:c.kind,action:"shown"}),c.kind!=="checklist"))break},complete:(t,r)=>{let a=W(t),c=a&&we(ee(a)).find(g=>g.id===r);if(!a||!c||c.kind==="question")return;let u=V(a.id);u.done.has(c.id)||(te(u,c.id),e.track(J,{flow:a.id,step:c.id,kind:c.kind,action:"completed"}),L(a));},dismissItem:t=>{let r=W(t);if(!r)return;let a=V(r.id);a.dismissed||(a.dismissed=true,e.track(J,{flow:r.id,action:"dismissed"}),i===r.id&&(i=null),L(r));},answerItem:(t,r,a)=>{let c=W(t),u=c&&we(ee(c)).find(g=>{var h;return g.kind==="question"&&(g.id===r||((h=g.question)==null?void 0:h.key)===r)});!c||!(u!=null&&u.question)||!hn(u.question,a)||($e(c,u,a),L(c));}},finale:()=>de,accent:()=>n==null?void 0:n.onboardingAccent,answers:()=>Object.fromEntries(z),message:{click:()=>{var a;let t=G();if((t==null?void 0:t.type)!=="message")return;F.add(t.message.id),e.track(It,{message:t.message.id,journey:t.message.journey,action:"clicked"});let r=dt(t.message.url);_(),r&&((a=e.openUrl)==null||a.call(e,r));},dismiss:()=>{let t=G();(t==null?void 0:t.type)==="message"&&(F.add(t.message.id),e.track(It,{message:t.message.id,journey:t.message.journey,action:"dismissed"}),_());}}}};var mr="ck_pick",wr="ck_origin",lt=e=>typeof CSS!="undefined"&&CSS.escape?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,n=>`\\${n}`),hr=e=>[...e.classList].filter(n=>n.length<30&&!/\d{2,}|[_-][a-z0-9]{5,}$|^(is|has)-|hover|active|focus|open|selected|:|\[/.test(n)).slice(0,2),bn=e=>{let n=e.ownerDocument,o=m=>{try{return n.querySelectorAll(m).length===1}catch(R){return false}},i=e.getAttribute("data-ck-target");if(i)return `[data-ck-target="${i.replace(/"/g,'\\"')}"]`;if(e.id&&!/\d{3,}/.test(e.id)&&o(`#${lt(e.id)}`))return `#${lt(e.id)}`;let d=[],l=e;for(;l&&l!==n.documentElement&&d.length<6;){if(l!==e&&l.id&&!/\d{3,}/.test(l.id)){d.unshift(`#${lt(l.id)}`);break}let m=l.tagName.toLowerCase(),R=hr(l).map(v=>`.${lt(v)}`).join(""),I=l.parentElement,y=I?[...I.children].filter(v=>v.tagName===l.tagName):[],F=y.length>1?`:nth-of-type(${y.indexOf(l)+1})`:"";d.unshift(`${m}${R}${F}`);let k=d.join(" > ");if(o(k))return k;l=I;}return d.join(" > ")},yn=()=>{var F;if(typeof window=="undefined"||window.top===window)return null;let e=new URLSearchParams(window.location.search);if(e.get(mr)!=="1")return null;let n;try{n=new URL((F=e.get(wr))!=null?F:"").origin;}catch(k){return null}if(!/^https?:\/\//.test(n))return null;let o=k=>window.parent.postMessage(k,n),i=document.createElement("div");i.setAttribute("aria-hidden","true"),Object.assign(i.style,{position:"fixed",zIndex:"2147483647",pointerEvents:"none",border:"2px solid #0ea5e9",background:"rgba(14,165,233,.12)",borderRadius:"6px",transition:"all 60ms linear",display:"none"});let d=document.createElement("div");Object.assign(d.style,{position:"absolute",left:"-2px",bottom:"calc(100% + 4px)",font:"600 11px/1.4 system-ui, sans-serif",color:"#fff",background:"#0c4a6e",padding:"2px 6px",borderRadius:"4px",whiteSpace:"nowrap",maxWidth:"360px",overflow:"hidden",textOverflow:"ellipsis"}),i.appendChild(d),document.body.appendChild(i);let l=null,m=k=>{if(l=k&&k!==i&&!i.contains(k)?k:null,!l){i.style.display="none";return}let v=l.getBoundingClientRect();Object.assign(i.style,{display:"block",left:`${v.left-2}px`,top:`${v.top-2}px`,width:`${v.width+4}px`,height:`${v.height+4}px`}),d.textContent=bn(l);},R=k=>m(document.elementFromPoint(k.clientX,k.clientY)),I=k=>{var O,M;k.preventDefault(),k.stopPropagation();let v=(O=document.elementFromPoint(k.clientX,k.clientY))!=null?O:l;!v||v===i||o({type:"mrrocket:picked",selector:bn(v),text:((M=v.textContent)!=null?M:"").trim().replace(/\s+/g," ").slice(0,80)});},y=k=>{k.key==="Escape"&&o({type:"mrrocket:pick-cancel"});};return window.addEventListener("mousemove",R,true),window.addEventListener("click",I,true),window.addEventListener("keydown",y,true),o({type:"mrrocket:pick-ready"}),()=>{window.removeEventListener("mousemove",R,true),window.removeEventListener("click",I,true),window.removeEventListener("keydown",y,true),i.remove();}};var kr={get:e=>{try{return window.localStorage.getItem(e)}catch(n){return null}},set:(e,n)=>{try{window.localStorage.setItem(e,n);}catch(o){}}},xn=()=>{try{for(let e=window.localStorage.length-1;e>=0;e--){let n=window.localStorage.key(e);n!=null&&n.startsWith("mrrocket:onboarding")&&window.localStorage.removeItem(n);}}catch(e){}},Cn=e=>({track:e.track,personId:e.personId,auto:e.auto,storage:()=>e.canStore()?kr:null,openUrl:n=>window.location.assign(n),path:()=>window.location.pathname,navigate:n=>{var d;let o=(d=e.onNavigate)==null?void 0:d.call(e);if(o)return o(n);let i=dt(n);i&&window.location.assign(i);},task:(n,o)=>{var i,d;return (d=(i=e.onTask)==null?void 0:i.call(e))==null?void 0:d(n,o)},fetchInApp:async n=>{var d;if(!e.apiKey)return null;let o=(d=e.userHash)==null?void 0:d.call(e,n),i=await fetch(`${e.host}/api/sdk/inapp?key=${encodeURIComponent(e.apiKey)}&distinctId=${encodeURIComponent(n)}${o?`&userHash=${o}`:""}${ot()}`);return Le(i.status),i.ok?await i.json():null}});var pt="mrr_ref",gt="mrr_ref",br="mrr_ref",yr="mrr_click";var Je=/^[A-Za-z0-9_-]{1,64}$/;var xr=(e,n="ref")=>{let o=new URLSearchParams(e);return Cr(i=>o.get(i),n)},Cr=(e,n="ref")=>{let o=e(br);if(o&&Je.test(o)){let d=e(yr);return {code:o,clickId:d&&Je.test(d)?d:null,direct:false}}let i=e(n);return i&&Je.test(i)?{code:i,clickId:null,direct:true}:null},vn=e=>{var n;return `${e.code}.${(n=e.clickId)!=null?n:""}.${e.at}`},ut=(e,n=60,o=Date.now())=>{if(!e)return null;let[i,d,l]=e.split("."),m=Number(l);return !i||!Je.test(i)||!Number.isFinite(m)||d&&!Je.test(d)||o-m>n*864e5||m>o+864e5?null:{code:i,clickId:d||null,at:m}};var Z=null,mt=()=>typeof document!="undefined",Rn=e=>{var o;if(!mt())return;let n=(o=document.cookie.split("; ").find(i=>i.startsWith(`${e}=`)))==null?void 0:o.slice(e.length+1);try{return n?decodeURIComponent(n):void 0}catch(i){return n}},wt=()=>{try{return typeof localStorage=="undefined"?null:localStorage}catch(e){return null}},Pt=()=>{var e,n;return Z||(mt()?(n=ut(Rn(pt),3650))!=null?n:ut((e=wt())==null?void 0:e.getItem(gt),3650):null)};var ft=(e,n)=>{var d;if(!mt())return;let o=Math.max(1,Math.round(n))*86400,i=typeof location!="undefined"&&location.protocol==="https:"?"; secure":"";document.cookie=`${pt}=${encodeURIComponent(vn(e))}; path=/; max-age=${o}; samesite=lax${i}`;try{(d=wt())==null||d.setItem(gt,vn(e));}catch(l){}},ht=()=>{var e;if(mt()){document.cookie=`${pt}=; path=/; max-age=0; samesite=lax`;try{(e=wt())==null||e.removeItem(gt);}catch(n){}}},En=()=>{Z=null;},On=async e=>{var i,d,l;let n=xr(e.search,e.param),o=(i=e.now)!=null?i:Date.now();if(!n)return !Z&&e.store&&(Z=(l=ut(Rn(pt),e.days,o))!=null?l:ut((d=wt())==null?void 0:d.getItem(gt),e.days,o),Z||ht()),Z;if(Z={code:n.code,clickId:n.clickId,at:o},e.store&&ft(Z,e.days),e.beacon)try{let m=await e.beacon({code:n.code,clickId:n.clickId});m&&Z&&Z.code===n.code&&!Z.clickId&&(Z={...Z,clickId:m},e.store&&ft(Z,e.days));}catch(m){}return Z},_n=e=>e==="$identify"||!e.startsWith("$");var Mt=3600*24*365,Fn=e=>{var o;if(typeof document=="undefined")return;let n=(o=document.cookie.split("; ").find(i=>i.startsWith(`${e}=`)))==null?void 0:o.slice(e.length+1);if(n)try{return decodeURIComponent(n)}catch(i){return n}},kt=(e,n,o)=>{let i=window.location.protocol==="https:"?"; secure":"";document.cookie=`${e}=${encodeURIComponent(n)}; path=/; max-age=${o}; samesite=lax${i}`;},ze=e=>{document.cookie=`${e}=; path=/; max-age=0; samesite=lax`;},H={utm:{}},In=()=>{var e;return (e=H.id)!=null?e:H.id=Et()},At=(e,n)=>{if(e!=="cookies")return In();let o=Fn(Se);if(o)return H.id=o;let i=In();return kt(Se,i,Mt),i},Lt=e=>{var d;let n=Date.now(),o=H.session,i=(d=e?Fn(Ae):void 0)!=null?d:o&&n-o.last<18e5?o.id:Et();return H.session={id:i,last:n},e&&kt(Ae,i,18e5/1e3),i},Nt=()=>{var o;let e=window.location.href;if(H.url===e)return;H.referrer=(o=H.url)!=null?o:document.referrer||void 0,H.url=e;let n=en(window.location.search);Object.keys(n).length&&(H.utm=n);},$n=()=>{let e=navigator,n=window;return e.doNotTrack==="1"||n.doNotTrack==="1"||e.globalPrivacyControl===true};var bt=window,Rr=()=>{var e,n;return (n=(e=document.currentScript)!=null?e:document.querySelector('script[data-key][src*="sdk"]'))!=null?n:document.querySelector("script[data-key][src*='mrrocket']")},Pn=new Set,fe=e=>{Pn.has(e)||(Pn.add(e),console.warn(`[MRRocket] ${e}`));},Er=()=>{var Wt,jt,Kt,Vt;let e=Rr(),n=s=>{var f;return (f=e==null?void 0:e.getAttribute(`data-${s}`))!=null?f:void 0},o=(s,f)=>{let p=n(s);return p===void 0?f:!["false","0","off","no"].includes(p.trim().toLowerCase())},i=(Wt=e==null?void 0:e.src)!=null?Wt:"",d="";try{d=i?new URL(i,window.location.href).origin:"";}catch(s){d="";}n("locale")&&St(n("locale"));let l=((jt=n("key"))!=null?jt:"").trim(),m=((Kt=n("api-host"))!=null?Kt:d).trim().replace(/\/+$/,""),R=n("consent"),I=o("respect-dnt",false),y=o("heatmaps",true),F=o("errors",true),k=n("release"),v=n("attribution"),O=v==="always"||v==="off"?v:"consent",M=n("referral-param")||"ref",B={},T=(s,f)=>{var p;return (p=B[s])!=null?p:B[s]=new Promise((x,E)=>{var Bt;let A=()=>bt[f];if(A())return x(A());let ae=(Bt=n(`${s}-src`))!=null?Bt:i?i.replace(/(\.min)?\.js(\?[^#]*)?(#.*)?$/,`-${s}$1.js?v=${nt}`):"";if(!ae)return E(new Error(s));let ye=document.createElement("script");ye.async=true,ye.src=ae,ye.onload=()=>A()?x(A()):E(new Error(s)),ye.onerror=()=>E(new Error(s)),document.head.appendChild(ye);}).catch(x=>{throw B[s]=void 0,x})},q=n("theme"),z={theme:q==="light"||q==="dark"?q:"auto",accent:n("accent")},D=new URLSearchParams(window.location.search),he=tn(D.get(Qt)),de=D.get(Zt)==="1";de&&yn();let xe=D.get(Ve);if(xe!==null){D.delete(Ve);let s=D.toString();history.replaceState(history.state,"",`${window.location.pathname}${s?`?${s}`:""}${window.location.hash}`);}let Ne=$n(),W=R==="cookies"||R==="off"?R:"cookieless",V=o("replay",false),Ce="",Y,te=null,ve,P=null,ne=false,Te=false,Ue=null,He=null,pe=window.location.pathname,j=[],Fe=new Set,Ge=[],X=()=>I&&Ne?"off":W,N=()=>!de&&X()!=="off",G=()=>Y!=null?Y:Ce,_=()=>X()==="cookies"?G():Y,re=s=>an(te,s);l||fe('No public key. Add data-key="mrr_pub_\u2026" to the script tag; nothing is tracked until then.');let ke=(s=false)=>{if(!j.length)return;if(!l){j.length=0;return}let f=`${m}/api/sdk/events`;for(let p of Yt(l,j.splice(0),{v:nt,errors:F,platform:"web"},re(_())))s&&"sendBeacon"in navigator&&navigator.sendBeacon(f,p)||fetch(f,{method:"POST",headers:{"content-type":"application/json"},body:p,keepalive:true}).then(E=>{E.status===401?Le(401):E.ok||fe(`Events were rejected with ${E.status}. Check data-key (MRRocket \u203A Settings \u203A Products).`);}).catch(()=>fe(`Could not reach ${m||"this origin"} to send events. Check data-api-host.`));},U=null,oe=null,se=(s,f,p=Date.now(),x)=>{if(!N())return;let E=_n(s)?Pt():null;j.push({event:s,props:E?{...f,$referral:{code:E.code,clickId:E.clickId}}:f,distinctId:_(),sessionId:Lt(X()==="cookies"),ts:p,url:x!=null?x:window.location.href,referrer:H.referrer,...H.utm,screen:{w:window.screen.width,h:window.screen.height}});},Re=(s,f)=>{typeof s!="string"||!s||(se(s,f),N()&&(U==null||U.event(s)),L.onEvent(s));},$e={},L=kn(Cn({host:m,apiKey:l,track:se,personId:()=>N()?Y:void 0,userHash:re,canStore:()=>X()==="cookies",auto:o("onboarding",true),onNavigate:()=>$e.onNavigate,onTask:()=>$e.onTask})),De=false,Ee;L.subscribe(()=>{De||!L.view()||de||(De=true,T("flows","__mrrocketFlows").then(s=>s.mountFlows(L,z)).catch(()=>{De=false,fe("The cancel flow and onboarding dialogs did not load. Check that sdk-flows.js is served next to sdk.js.");}));});let Oe=(s,f)=>{if(!N())return;let p=`${window.location.pathname}|${s}`;Fe.has(p)||(Fe.add(p),Re("$exposure",{experiment:s,variant:f}));},We=()=>{let s=rn(P,window.location.href,G(),he);return s!=null&&s.to?(ke(true),window.location.replace(s.to),true):(s!=null&&s.experiment&&Oe(s.experiment,s.variant),false)},me=()=>{if(!P)return;let s=document.querySelectorAll("[data-ck-text]");if(!s.length)return;let f=nn(P,G(),he),p=new Set;s.forEach(x=>{var ae,ye;let E=x.dataset.ckText;if(!E)return;p.add(E),x.dataset.ckDefault===void 0&&(x.dataset.ckDefault=(ae=x.textContent)!=null?ae:"");let A=(ye=f[E])!=null?ye:x.dataset.ckDefault;x.textContent!==A&&(x.textContent=A);});for(let x of P.experiments)x.variants.some(E=>{var A;return Object.keys((A=E.changes)!=null?A:{}).some(ae=>p.has(ae))})&&Oe(x.key,Be(x.key,P,G(),he));},je=()=>{var s,f;return (f=(s=P==null?void 0:P.referral)==null?void 0:s.cookieDays)!=null?f:60},yt=()=>O==="always"?X()!=="off":O==="consent"&&X()==="cookies",xt=null,t=false,r=()=>{if(!ne||de)return;if(O==="off"||X()==="off"){En(),(O==="off"||t)&&ht();return}let s=window.location.href;xt!==s&&(xt=s,On({search:window.location.search,param:M,store:yt(),days:je(),beacon:l?({code:f,clickId:p})=>fetch(`${m}/api/sdk/affiliate/click`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:l,code:f,clickId:p,url:s,referrer:document.referrer||void 0}),keepalive:true}).then(x=>x.ok?x.json():null).then(x=>{var E;return (E=x==null?void 0:x.clickId)!=null?E:null}):void 0}));},a=()=>{let s=yt(),f=Pt();s&&f?ft(f,je()):!s&&t&&ht(),t=s;},c=0,u=false,g=()=>{var x,E;let s=N()&&V&&!!(P!=null&&P.replay)&&!!l;if(s===u)return;u=s;let f=++c;if(!s){U==null||U.stop(true),U=null;return}let p=(E=(x=P==null?void 0:P.replay)==null?void 0:x.sampleRate)!=null?E:.1;T("replay","__mrrocketReplay").then(A=>A.startReplay({host:m,apiKey:l,sessionId:Lt(X()==="cookies"),distinctId:_(),identified:!!Y,userHash:re(_()),sampleRate:p,warn:fe})).then(A=>{f!==c?A==null||A.stop(true):U=A;}).catch(()=>fe("Session recording could not start (the recorder did not load)."));},h=o("messenger",false),C=null,w=s=>{de||l&&(C!=null||(C=T("messenger","__mrrocketMessenger").then(f=>{var A;let p=ae=>n(`messenger-${ae}`)===void 0?void 0:o(`messenger-${ae}`,true),x=n("messenger-position"),E=(A=n("messenger-theme"))!=null?A:q;return f.mountMessenger({host:m,apiKey:l,distinctId:G,user:()=>ve,userHash:()=>re(G()),launcher:h,position:x,corners:n("messenger-corners"),header:n("messenger-header"),font:n("messenger-font"),title:n("messenger-title"),greeting:n("messenger-greeting"),label:n("messenger-label"),askEmail:p("ask-email"),help:p("help"),sound:p("sound"),preview:p("preview"),theme:E==="light"||E==="dark"||E==="auto"?E:void 0,accent:n("accent")})})),C.then(s).catch(()=>{C=null,fe("sdk-messenger.js did not load.");}));},b=n("forms")==="auto",$=false,S=()=>{$||!l||de||!document.querySelector(b?"form":"form[data-mrrocket-form]")||($=true,T("forms","__mrrocketForms").then(s=>s.watchForms({host:m,apiKey:l,auto:b,distinctId:()=>N()?_():void 0,userHash:re,identified:()=>!!Y,identify:Tt,tracking:N,referrer:()=>H.referrer,utm:()=>H.utm})).catch(()=>$=false));},ie=()=>{!Te||!N()||He===window.location.pathname||(He=window.location.pathname,Re("$pageview",{path:window.location.pathname}));},le=null,ue=()=>{let s=le;y&&s&&s.max>0&&se("$scroll",{depth:s.max,docH:s.docH,vw:window.innerWidth,vh:window.innerHeight},Date.now(),s.url),le=null;},K=()=>{var E,A;if(!y||!N()||de)return;let s=document.documentElement,f=Math.max(s.scrollHeight,(A=(E=document.body)==null?void 0:E.scrollHeight)!=null?A:0),p=zt(),x=window.location.href;(le==null?void 0:le.url)!==x?le={url:x,max:p,docH:f}:p>le.max&&(le={url:x,max:p,docH:f});},_e=()=>{let s=window.location.pathname;s!==pe&&(pe=s,!(ne&&We())&&(ue(),Nt(),U==null||U.page(s),oe==null||oe.crumb("navigation",s),ie(),r(),window.setTimeout(()=>{K(),me(),S();},0)));},be=()=>{let s=X(),f=Ue;Ue=s,f==="cookies"&&s!=="cookies"&&(ze(Se),ze(Ae)),s==="off"&&(j.length=0,H.session=void 0),f==="cookies"&&s!=="cookies"&&xn(),Ce=At(s),a(),r(),g(),ie(),K();},Qe=s=>{let{analytics:f,replay:p}=typeof s=="string"?{analytics:s,replay:void 0}:s!=null?s:{};if(f!==void 0&&f!=="cookieless"&&f!=="cookies"&&f!=="off"){fe(`setConsent: "${String(f)}" is not a consent mode. Use "cookieless", "cookies" or "off".`);return}f==="off"&&(j.length=0),f&&(W=f),typeof p=="boolean"&&(V=p),be(),ne&&L.refresh();},Tt=(s,f,p)=>{if(typeof s!="string"||!s)return;let x=_();te=sn(te,s,p==null?void 0:p.hash),Y=s,se("$identify",{...f,id:s,...x&&x!==s?{previousId:x}:{}}),U==null||U.identify(s,re(s)),X()==="cookies"&&kt(Se,s,Mt),ve={...f,id:s},me(),ne&&L.refresh();},Ze={track:Re,identify:Tt,reset:()=>{ke(),Y=void 0,te=null,ve=void 0,Fe.clear(),X()==="cookies"&&(ze(Se),ze(Ae)),H.id=void 0,H.session=void 0,Ce=At(X()),me(),ne&&L.refresh();},captureError:s=>oe==null?void 0:oe.capture(s,"manual"),setConsent:Qe,setLocale:St,currentLocale:rt,getFlag:s=>Rt(s,P,G(),{...ve})!==false,getFlagVariant:s=>{let f=Rt(s,P,G(),{...ve});return typeof f=="string"?f:null},getVariant:s=>{let f=Be(s,P,G(),he);return (P||he[s])&&Oe(s,f),f},ready:s=>{typeof s=="function"&&(ne?window.setTimeout(()=>s(Ze),0):Ge.push(s));},getDistinctId:G,cancelFlow:{open:s=>L.openCancelFlow(s)},onboarding:{start:s=>L.startOnboarding(s),get:s=>{let f=L.onboarding.item(s);return f&&!f.done&&!f.dismissed&&L.onboarding.seen(s),f},subscribe:s=>L.subscribe(()=>s()),complete:(s,f)=>L.onboarding.complete(s,f),dismiss:s=>L.onboarding.dismissItem(s),answer:(s,f,p)=>L.onboarding.answerItem(s,f,p),setHandlers:s=>{$e={onNavigate:typeof(s==null?void 0:s.onNavigate)=="function"?s.onNavigate:void 0,onTask:typeof(s==null?void 0:s.onTask)=="function"?s.onTask:void 0};}},openCancelFlow:s=>L.openCancelFlow(s),startOnboarding:s=>L.startOnboarding(s),paywall:{open:(s,f)=>(Ee!=null?Ee:Ee=T("flows","__mrrocketFlows").then(p=>p.paywallHost({config:()=>P,distinctId:G,track:se},z))).then(p=>p.open(s,f))},push:{subscribe:s=>{let f=N()?Y:void 0;if(!f)return Promise.resolve({status:"not-signed-in"});let p=window.Notification,x=Promise.resolve(p&&p.permission==="default"&&(s==null?void 0:s.ask)!==false?p.requestPermission():p==null?void 0:p.permission);return T("push","__mrrocketPush").then(E=>E.subscribeWebPush({host:m,apiKey:l,distinctId:f,userHash:re(f),permission:x},s))},unsubscribe:()=>T("push","__mrrocketPush").then(s=>s.unsubscribeWebPush({host:m,apiKey:l,distinctId:Y,userHash:re(Y)}))},messenger:{open:s=>w(f=>f.open(s)),close:()=>{C==null?void 0:C.then(s=>s.close()).catch(()=>{});},toggle:()=>w(s=>s.toggle())},openMessenger:()=>w(s=>s.open()),version:nt};Nt(),be();let Pe=bt.mrrocket,An=(Vt=Pe==null?void 0:Pe.q)!=null?Vt:[],Ct=Pe&&typeof Pe=="object"?Pe:{};Object.assign(Ct,Ze,{__loaded:true}),delete Ct.q,bt.mrrocket=Ct;for(let[s,f]of An){let p=Ze[s];if(typeof p=="function")try{p(...Array.from(f!=null?f:[]));}catch(x){console.error(x);}}Te=true,ie(),F&&l&&!de&&(oe=dn({host:m,apiKey:l,release:k,context:()=>{var s;return {send:N(),distinctId:_(),sessionId:(s=H.session)==null?void 0:s.id,userHash:re(_())}},warn:fe}),oe.crumb("navigation",window.location.pathname));for(let s of ["pushState","replaceState"]){let f=history[s];history[s]=function(...p){let x=f.apply(this,p);return _e(),x};}window.addEventListener("popstate",_e);let Ln=new Ke;document.addEventListener("click",s=>{var A;s.target instanceof Element&&s.target.closest("[data-ck-messenger]")&&(s.preventDefault(),w(ae=>ae.open()));let f=s.target instanceof Element?s.target.closest("[data-ck-goal]"):null;if(f!=null&&f.dataset.ckGoal&&Re(f.dataset.ckGoal,{text:(A=f.textContent)==null?void 0:A.trim().slice(0,80)}),!N())return;let p=Jt(s);if(!p)return;let x=Ln.push(p.x,p.y,Date.now());if((p.label||p.selector)&&(oe==null||oe.crumb("click",p.label||p.selector)),U==null||U.click(p,x),!y)return;let E={x:p.x,y:p.y,vw:p.vw,vh:p.vh,docH:p.docH,selector:p.selector,label:p.label,dead:!p.interactive};se("$click",E),x&&se("$rageclick",E);});let vt=0;window.addEventListener("scroll",()=>{vt||(vt=window.requestAnimationFrame(()=>{vt=0,K();}));},{passive:true}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>K()):K(),window.setInterval(()=>ke(),2e3),window.addEventListener("pagehide",()=>{ue(),ke(true);});let Ut=()=>{if(ne=true,We())return;let s=on(P,xe);s&&Oe(s.experiment,s.variant),document.documentElement.classList.remove("ck-hide"),r(),g(),L.setConfig(P),L.refresh(),h&&(document.body?w():document.addEventListener("DOMContentLoaded",()=>w())),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{me(),S();}):(me(),S());for(let f of Ge.splice(0))try{f(Ze);}catch(p){console.error(p);}},Ht=0,Dt=s=>{let f=++Ht;return fetch(`${m}/api/sdk/config?key=${encodeURIComponent(l)}${ot()}`).then(p=>(p.ok||fe(`Config request to ${m||"this origin"} answered ${p.status}. Check data-key and data-api-host.`),p.ok?p.json():null)).then(p=>{p&&Array.isArray(p.experiments)&&f===Ht&&(P=p,un(p.words,p.lang)),s();}).catch(()=>{fe(`Could not reach ${m||"this origin"}. Check data-api-host. The page keeps its own texts and flags stay off.`),s();})};l?(Dt(Ut),fn(()=>{Dt(()=>{L.setConfig(P),me();});})):Ut();},Mn;typeof window!="undefined"&&typeof document!="undefined"&&!((Mn=bt.mrrocket)!=null&&Mn.__loaded)&&Er();
|
|
1
|
+
(function(){'use strict';var Tn=Object.defineProperty;var Un=(e,n,r)=>n in e?Tn(e,n,{enumerable:true,configurable:true,writable:true,value:r}):e[n]=r;var Me=(e,n,r)=>Un(e,typeof n!="symbol"?n+"":n,r);var Bt=e=>{let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?n+=1:i<2048?n+=2:i>=55296&&i<=56319&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320?(n+=4,r++):n+=3;}return n},Hn=(e,n,r,i)=>{let d=`{"key":${JSON.stringify(e)},${i?`"userHash":${JSON.stringify(i)},`:""}"sdk":${JSON.stringify(r)},"events":[`,l=Bt(d)+2,m=[],v=[],E=[],w=l,O=()=>{v.length&&m.push({body:`${d}${v.join(",")}]}`,events:E}),v=[],E=[],w=l;};for(let k of n){let R=JSON.stringify(k),S=Bt(R)+1;l+S>6e4||((v.length===100||w+S>6e4)&&O(),v.push(R),E.push(k),w+=S);}return O(),m},Yt=(e,n,r,i)=>Hn(e,n,r,i).map(d=>d.body);var Ke=class{constructor(n=1e3,r=30,i=3){Me(this,"windowMs",n);Me(this,"radius",r);Me(this,"count",i);Me(this,"clicks",[]);Me(this,"fired",false);}push(n,r,i){let d=this.clicks.filter(l=>i-l.t<=this.windowMs&&Math.hypot(l.x-n,l.y-r)<=this.radius);return d.length!==this.clicks.length&&(this.fired=false),this.clicks=[...d,{x:n,y:r,t:i}],this.clicks.length>=this.count&&!this.fired?(this.fired=true,true):false}};var Dn='a[href],button,input,select,textarea,label,summary,[role="button"],[role="link"],[role="tab"],[role="menuitem"],[role="checkbox"],[role="switch"],[onclick],[data-ck-goal]',Wn="[data-ck-mask]",jn="[data-ck-block]",Xt=/\d{4,}|^[a-z]{1,3}-[a-z0-9]{5,}$|^_|__|css-|^sc-|^jsx-/i,Kn=e=>{let n=e.tagName.toLowerCase();if(e.id&&!Xt.test(e.id)&&e.id.length<=40)return `${n}#${e.id}`;let r=typeof e.className=="string"?e.className.split(/\s+/).filter(l=>l&&!Xt.test(l)&&l.length<=30&&!l.includes(":")):[],i=r.length?`${n}.${r.slice(0,2).join(".")}`:n,d=e.parentElement?[...e.parentElement.children].filter(l=>l.tagName===e.tagName):[];return d.length>1?`${i}:nth-of-type(${d.indexOf(e)+1})`:i},Vn=e=>{let n=[],r=e;for(;r&&n.length<3&&r.tagName&&r.tagName!=="BODY"&&r.tagName!=="HTML";){let i=Kn(r);if(n.unshift(i),i.includes("#"))break;r=r.parentElement;}return n.join(" > ").slice(0,160)},et=e=>(e!=null?e:"").replace(/\s+/g," ").trim().slice(0,40),qn=e=>{var r,i,d,l,m;if(e.closest(`${Wn},${jn}`))return "";let n=e.tagName.toLowerCase();if(n==="input"){let v=((r=e.getAttribute("type"))!=null?r:"text").toLowerCase();return et(v==="submit"||v==="button"?(i=e.getAttribute("aria-label"))!=null?i:e.value:e.getAttribute("aria-label"))}return et(n==="select"||n==="textarea"?e.getAttribute("aria-label"):(m=(l=(d=e.getAttribute("aria-label"))!=null?d:e.getAttribute("title"))!=null?l:e.innerText)!=null?m:e.textContent)},Jt=e=>{var l,m;let n=e.target instanceof Element?e.target:null;if(!n)return null;let r=n.closest(Dn),i=r!=null?r:n,d=document.documentElement;return {x:Math.round(e.clientX),y:Math.round(e.clientY+window.scrollY),vw:window.innerWidth,vh:window.innerHeight,docH:Math.max(d.scrollHeight,(m=(l=document.body)==null?void 0:l.scrollHeight)!=null?m:0),selector:Vn(i),label:r?qn(r):"",interactive:!!r}},zt=()=>{var r,i;let e=document.documentElement,n=Math.max(e.scrollHeight,(i=(r=document.body)==null?void 0:r.scrollHeight)!=null?i:0);return n?Math.min(100,Math.round((window.scrollY+window.innerHeight)/n*100)):0};var nt="0.22.0",Bn=(e,n)=>{let r=n.trim().toLowerCase();for(let[i,d]of Object.entries(e))if(i.toLowerCase()===r)return d},Yn=(e,n)=>{let r=e.trim().toLowerCase(),i=n.trim().toLowerCase();return i.startsWith("@")?r.endsWith(i):r===i},Xn=(e,n)=>{if(e.op==="in cohort")return false;let r=Bn(n,e.property),i=r==null?"":String(r);if(e.op==="\u2265"){let l=Number(i),m=Number(e.values[0]);return i!==""&&Number.isFinite(l)&&Number.isFinite(m)&&l>=m}let d=i!==""&&e.values.some(l=>Yn(i,l));return e.op==="is"||e.op==="in"?d:!d},Jn=(e,n,r={})=>{var v;if(!e.on)return false;let i={id:n,...r},d=e.sets.length?e.sets.find(E=>E.conditions.every(w=>Xn(w,i))):{rollout:100};if(!d||Gt(`${e.key}:rollout:${n}`)*100>=d.rollout)return false;if(!((v=e.variants)!=null&&v.length))return true;let l=Gt(`${e.key}:variant:${n}`)*100,m=0;for(let E of e.variants)if(m+=E.split,l<m)return E.key;return e.variants[e.variants.length-1].key},vt=(e,n,r,i={})=>{var l;let d=(l=n==null?void 0:n.flags)==null?void 0:l.find(m=>m.key===e);return d?Jn(d,r,i):false},zn=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],Qt="ck_preview",Zt="ck_embed",Se="ck_id",Ae="ck_sid";var Gn=e=>{var r;let n={};for(let i of zn){let d=(r=e(i))==null?void 0:r.trim();d&&(n[i]=d.slice(0,150));}return n},en=e=>{let n=new URLSearchParams(e);return Gn(r=>n.get(r))};var Qn=e=>{let n=2166136261;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619);return (n>>>0)/4294967296},Gt=e=>{let n=2166136261;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619);return n^=n>>>16,n=Math.imul(n,2246822507),n^=n>>>13,n=Math.imul(n,3266489909),n^=n>>>16,(n>>>0)/4294967296},Zn=(e,n)=>{var l,m,v,E;let r=(m=(l=e.variants[0])==null?void 0:l.id)!=null?m:"control";if(e.winner)return e.winner;if(e.status!=="running")return r;let i=Qn(`${e.key}:${n}`),d=0;for(let w of e.variants)if(d+=w.weight,i<d)return w.id;return (E=(v=e.variants[e.variants.length-1])==null?void 0:v.id)!=null?E:r},tn=e=>{let n=Array.isArray(e)?e[0]:e;if(!n)return {};let r={};for(let i of n.split(",")){let[d,l]=i.split(":");d&&l&&(r[d.trim()]=l.trim());}return r};var qe=(e,n,r,i)=>{if(i[e])return i[e];let d=n==null?void 0:n.experiments.find(l=>l.key===e);return d?Zn(d,r):"control"},nn=(e,n,r)=>{var d,l,m,v,E,w;let i={...(d=e==null?void 0:e.texts)!=null?d:{}};for(let O of (l=e==null?void 0:e.experiments)!=null?l:[]){let k=qe(O.key,e,n,r);k!==((v=(m=O.variants[0])==null?void 0:m.id)!=null?v:"control")&&Object.assign(i,(w=(E=O.variants.find(R=>R.id===k))==null?void 0:E.changes)!=null?w:{});}return i},Ve="ck_x",tt=e=>e.replace(/\/+$/,"")||"/",rn=(e,n,r,i={})=>{var v,E;if(!e)return null;let d;try{d=new URL(n);}catch(w){return null}if(d.searchParams.has(Ve))return null;let l=tt(d.pathname),m=(w,O)=>{let k;try{k=new URL(w,d);}catch(R){return}if(!(!/^https?:$/.test(k.protocol)||k.origin===d.origin&&tt(k.pathname)===l))return d.searchParams.forEach((R,S)=>{k.searchParams.has(S)||k.searchParams.set(S,R);}),O&&k.searchParams.set(Ve,O),k.hash||(k.hash=d.hash),k.href};for(let w of (v=e.redirects)!=null?v:[]){let O=w.from&&tt(w.from)===l?m(w.to):void 0;if(O)return {to:O}}for(let w of e.experiments){if(!w.path||tt(w.path)!==l)continue;let O=w.status==="running"&&!w.winner;if(O&&r===null&&!i[w.key])return null;let k=qe(w.key,e,r!=null?r:"",i),R=(E=w.variants.find(M=>M.id===k))==null?void 0:E.url,S=R?m(R,O?`${w.key}:${k}`:void 0):void 0;return O?{to:S,experiment:w.key,variant:k}:S?{to:S}:null}return null},on=(e,n)=>{let[r,i]=(n!=null?n:"").split(":"),d=e==null?void 0:e.experiments.find(l=>l.key===r);return d&&d.variants.some(l=>l.id===i)?{experiment:r,variant:i}:null};var Ot=()=>typeof crypto!="undefined"&&"randomUUID"in crypto?crypto.randomUUID():`ck_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;var er="401: sign the user id on your server with userHash(id) from @mrrocket/sdk/next/server and pass identify(id, props, { hash }).",Ne=(e,n=r=>console.warn(r))=>{let r=globalThis;e!==401||r.__mrrocketUnsigned||(r.__mrrocketUnsigned=true,n(`[MRRocket] ${er}`));},sn=(e,n,r,i=d=>console.warn(d))=>{let d=typeof r=="string"?r.trim().toLowerCase():"";return /^[0-9a-f]{64}$/.test(d)?{id:n,hash:d}:(d&&i("[MRRocket] identify: that hash is no userHash(id); not sent."),e&&e.id===n?e:null)},an=(e,n)=>e&&n&&e.id===n?e.hash:void 0,cn=(e,n)=>e&&n.some(r=>r===e.id)&&n.every(r=>!r||r===e.id)?e.hash:void 0;var tr=8*1024,nr=20,rr=20,or=2e3,Be=(e,n)=>e.length>n?`${e.slice(0,n-1)}\u2026`:e,sr=e=>{var n;if(e instanceof Error)return {type:e.name||"Error",message:Be(e.message||String(e),1e3),stack:e.stack?Be(e.stack,tr):void 0};if(typeof e=="string")return {type:"Error",message:Be(e,1e3)};try{return {type:"Error",message:Be((n=JSON.stringify(e))!=null?n:String(e),1e3)}}catch(r){return {type:"Error",message:String(e)}}},dn=e=>{let n=[],r=[],i=new Set,d=0,l=`${e.host}/api/sdk/errors`,m=(R=false)=>{for(;n.length;){let S=n.splice(0,4),M=e.context(),B=M.distinctId&&M.userHash?{id:M.distinctId,hash:M.userHash}:null,T=cn(B,S.map(D=>D.distinctId)),Y=JSON.stringify({key:e.apiKey,...T?{userHash:T}:{},errors:S});R&&typeof navigator!="undefined"&&"sendBeacon"in navigator&&navigator.sendBeacon(l,Y)||fetch(l,{method:"POST",headers:{"content-type":"application/json"},body:Y,keepalive:true}).then(D=>{D.status===401?Ne(401):!D.ok&&D.status!==429&&e.warn(`Error reports were rejected with ${D.status}. Check the public key and NEXT_PUBLIC_MRROCKET_HOST.`);}).catch(()=>{});}},v=(R,S="manual")=>{let M=e.context();if(!M.send||d>=nr)return;let B=sr(R);if(/\/api\/sdk\/errors/.test(B.message))return;let T=`${B.type}:${B.message}`;i.has(T)||(i.add(T),d++,n.push({...B,mechanism:S,handled:S==="manual",url:window.location.href,ts:Date.now(),crumbs:r.slice(),...e.release?{release:e.release}:{},...M.distinctId?{distinctId:M.distinctId}:{},...M.sessionId?{sessionId:M.sessionId}:{}}));},E=R=>{var S;!R.error&&(!R.message||R.message==="Script error.")||v((S=R.error)!=null?S:new Error(R.message),"onerror");},w=R=>{var S;return v((S=R.reason)!=null?S:new Error("Unhandled promise rejection"),"onunhandledrejection")},O=()=>m(true);window.addEventListener("error",E),window.addEventListener("unhandledrejection",w),window.addEventListener("pagehide",O);let k=window.setInterval(()=>m(),or);return {capture:v,crumb:(R,S)=>{r.push({ts:Date.now(),type:R,message:Be(S,120)}),r.length>rr&&r.shift();},stop:()=>{window.removeEventListener("error",E),window.removeEventListener("unhandledrejection",w),window.removeEventListener("pagehide",O),window.clearInterval(k),m(true);}}};var Et=globalThis,ln,Q=(ln=Et.__mrrocketI18n)!=null?ln:Et.__mrrocketI18n={version:0,onWords:new Set,onLocale:new Set},_t=e=>{for(let n of [...e])try{n();}catch(r){}},Ye=e=>{var n;return ((n=Q.words)==null?void 0:n[e])||e};var un=(e,n)=>{var i;let r=Q.lang===n&&JSON.stringify((i=Q.words)!=null?i:{})===JSON.stringify(e!=null?e:{});Q.words=e,Q.lang=n,!r&&(Q.version++,_t(Q.onWords));},ir=e=>{let n=e==null?void 0:e.trim().replace(/_/g,"-");if(n)try{return Intl.getCanonicalLocales(n)[0]}catch(r){return r instanceof RangeError?void 0:n}},St=e=>{let n=ir(e);n!==Q.locale&&(Q.locale=n,Q.version++,_t(Q.onWords),_t(Q.onLocale));};var rt=()=>{var e,n;return (n=(e=Q.locale)!=null?e:Q.device)!=null?n:typeof navigator!="undefined"&&navigator.language||void 0},ot=()=>{let e=rt();return e?`&lang=${encodeURIComponent(e)}`:""};var fn=e=>(Q.onLocale.add(e),()=>{Q.onLocale.delete(e);});var Xe="$cancel_flow",V="$onboarding",It="$inapp";var ar={version:0,question:"",reasons:[],offers:{},get confirm(){return {title:Ye("Cancel your subscription?"),body:Ye("You keep access until the end of the billing period."),button:Ye("Cancel subscription")}},offersFor:"business"},Ft="mrrocket:onboarding",de=e=>e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,""),pn=new Set(["signed_up","signup","sign_up","registered","account_created","user_signed_up"]),st=(e,n)=>{let r=de(e),i=de(n);return !r||!i?false:r===i||pn.has(r)&&pn.has(i)},gn=e=>/^(first (launch|visit|open|session|login|sign ?in|app open)|app (opened|launched)|on load|every visit|always)?$/i.test(e.trim());var mn=e=>e.trim().startsWith("/");var cr="Needs tracking code 0.18.0",ce=e=>{var n;return (n=e.when)!=null?n:e.trigger},it=e=>de(e)==="from_a_checklist"||de(e)==="from_your_code"||de(e)===de(cr),wn="after:",at=e=>{let n=(e!=null?e:"").trim();return n.toLowerCase().startsWith(wn)&&n.slice(wn.length).trim()||null},dr=e=>{var n;return (n=e.opens)!=null?n:e.startsTour?{kind:"tour",id:e.startsTour}:void 0},Ie="other:",lr=e=>{var i,d;let n=(i=e==null?void 0:e.min)!=null?i:0,r=(d=e==null?void 0:e.max)!=null?d:10;return Array.from({length:Math.max(0,Math.min(r-n,20)+1)},(l,m)=>n+m)},hn=(e,n)=>{var r;return !e||n==null?false:e.type==="choice"?e.other&&n.startsWith(Ie)?n.slice(Ie.length).trim().length>0:((r=e.options)!=null?r:[]).some(i=>i.id===n):e.type==="scale"?lr(e).some(i=>String(i)===n):n.trim().length>0&&n.length<=500},ur=(e,n)=>{var r,i,d;return (e==null?void 0:e.type)!=="choice"?n.trim():e.other&&n.startsWith(Ie)?n.slice(Ie.length).trim():(d=(i=(r=e.options)==null?void 0:r.find(l=>l.id===n))==null?void 0:i.label)!=null?d:n};var fr=()=>`cf_${Math.random().toString(36).slice(2,10)}${Date.now().toString(36)}`;var dt=e=>{let n=(e!=null?e:"").trim();return /^https?:\/\//i.test(n)||/^\/(?!\/)/.test(n)?n:void 0},ee=e=>{var n;return (n=e.nodes)!=null?n:e.steps},pr=e=>Math.max(0,e.amount)*(e.unit==="hours"?36e5:864e5),$t=(e,n)=>{let r=e.trim(),i=(n.split(/[?#]/)[0]||"/").replace(/\/+$/,"")||"/";if(!r)return false;if(r.endsWith("*")){let d=r.slice(0,-1).replace(/\/+$/,"");return !d||i===d||i.startsWith(`${d}/`)}return i===(r.replace(/\/+$/,"")||"/")},we=e=>e.flatMap(n=>n.kind==="condition"?[...we(n.yes),...we(n.no)]:n.kind==="wait"?[]:[n]),gr=(e,n=Date.now())=>e==null||e===""?NaN:Math.floor((n-new Date(e).getTime())/2630016e3),ct=e=>e==null?void 0:e.trim().toLowerCase(),mr=({when:e={}},n)=>(e.answer==null||ct(e.answer)===ct(n.answer))&&(e.plan==null||[e.plan].flat().some(r=>ct(r)===ct(n.plan)))&&!(n.months>=e.tenureUnder)&&!(n.months<e.tenureOver)&&(e.tenureUnder==null||n.months>=0)&&(e.tenureOver==null||n.months>=0),kn=e=>{let n=null,r=null,i=null,d=[],l=false,m=null,v,E=null,w=new Map,O=new Set,k=new Set,R=new Set,S=e.auto!==false,M=new Set,B=()=>{var t,o;return (o=(t=e.now)==null?void 0:t.call(e))!=null?o:Date.now()},T=null,Y=null,z=new Map,D=new Map,he=new Set,le=null,Ce=()=>{var t;return (t=n==null?void 0:n.onboarding)!=null?t:[]},Le=()=>Ce().filter(t=>t.shownBy!=="code"),W=t=>t?Ce().find(o=>o.id===t):void 0,q=t=>{let o=w.get(t);return o||w.set(t,o={done:new Set,dismissed:false,answers:new Map,at:new Map,reached:new Map}),o},Re=false,X=t=>{e.track(V,t),Re=true;},te=(t,o)=>{t.done.add(o),t.at.set(o,B());},ve=t=>{var o,a,c;if((o=t.page)!=null&&o.trim()){let u=(a=e.path)==null?void 0:a.call(e);return u===void 0?false:$t(t.page,u)}if((c=t.event)!=null&&c.trim()){if(!l)return;for(let u of M)if(st(t.event,u))return true;return false}return false},P=(t,o,a,c,u=0,g)=>{var b,C;for(let h=0;h<o.length;h++){let y=o[h];if(y.kind==="wait"){if(a.done.has(y.id)){g=(b=a.at.get(y.id))!=null?b:g;continue}let $=a.reached.get(y.id);if($===void 0){if(!c)return {at:"pending"};$=g!=null?g:B(),a.reached.set(y.id,$),X({flow:t.id,step:y.id,kind:"wait",action:"shown"});}let F=$+pr(y);if(B()<F)return {at:"wait",until:F};if(!c)return {at:"pending"};te(a,y.id),X({flow:t.id,step:y.id,kind:"wait",action:"completed"}),g=F;continue}if(y.kind==="condition"){let $=a.answers.get(y.id);if($===void 0){if(!c)return {at:"pending"};if($=ve(y),$===void 0)return {at:"pending"};a.answers.set(y.id,$),X({flow:t.id,step:y.id,kind:"condition",action:"answered",answer:$?"yes":"no"});}return P(t,$?y.yes:y.no,a,c,u,g)}if(!a.done.has(y.id))return {at:"step",step:y,line:o,index:h,before:u};g=(C=a.at.get(y.id))!=null?C:g,u++;}return {at:"end"}},ne=t=>{let o=w.get(t.id);return !!o&&(o.dismissed||P(t,ee(t),o,false).at==="end")},Te=t=>`${Ft}:${t!=null?t:"visitor"}`,Ue=t=>`${Ft}:events:${t!=null?t:"visitor"}`,He=t=>`${Ft}:answers:${t!=null?t:"visitor"}`,ge=t=>{if(!t.finish||t.finish==="none"||t.shownBy==="code"||he.has(t.id))return;let o=w.get(t.id);!o||o.dismissed||P(t,ee(t),o,false).at!=="end"||(he.add(t.id),le={kind:t.finish,key:`${t.id}:${B()}`});},j=()=>{var a;Re=false;let t=(a=e.storage)==null?void 0:a.call(e);if(!t)return;let o={};for(let[c,u]of w)o[c]={done:[...u.done],...u.dismissed?{dismissed:true}:{},...u.answers.size?{answers:Object.fromEntries([...u.answers].map(([g,b])=>[g,b?"yes":"no"]))}:{},...u.at.size?{at:Object.fromEntries(u.at)}:{},...u.reached.size?{reached:Object.fromEntries(u.reached)}:{}};try{t.set(Te(e.personId()),JSON.stringify(o)),z.size&&t.set(He(e.personId()),JSON.stringify(Object.fromEntries(z))),M.size&&t.set(Ue(e.personId()),JSON.stringify([...M].slice(-200)));}catch(c){}},Fe=t=>{var o,a,c,u;for(let[g,b]of Object.entries(t!=null?t:{})){let C=q(g);for(let h of (o=b.done)!=null?o:[])C.done.add(h);b.dismissed&&(C.dismissed=true);for(let[h,y]of Object.entries((a=b.answers)!=null?a:{}))C.answers.has(h)||C.answers.set(h,y==="yes");for(let[h,y]of Object.entries((c=b.at)!=null?c:{}))typeof y=="number"&&!C.at.has(h)&&C.at.set(h,y);for(let[h,y]of Object.entries((u=b.reached)!=null?u:{}))typeof y=="number"&&(!C.reached.has(h)||y<C.reached.get(h))&&C.reached.set(h,y);}},Ge=t=>{var a;T&&clearTimeout(T),T=null;let o=t-B();o>0&&o<=864e5&&(T=setTimeout(()=>(T=null,I()),o+50),(a=T.unref)==null||a.call(T));},J=false,L=()=>{var $;J=false;let t=W(i);if(!t)return null;let o=q(t.id);if(o.dismissed)return null;let a=P(t,ee(t),o,true);if(Re&&j(),a.at==="wait"&&Ge(a.until),J=a.at==="wait"||a.at==="pending",a.at!=="step")return null;let{step:c,line:u,index:g}=a,b=F=>!!F&&F.kind!=="wait"&&F.kind!=="condition";if(c.kind==="checklist"){let F=g;for(;F>0&&b(u[F-1])&&u[F-1].kind==="checklist";)F--;let ie=g;for(;ie+1<u.length&&b(u[ie+1])&&u[ie+1].kind==="checklist";)ie++;let ue=u.slice(F,ie+1).filter(b);for(let fe of ue)!o.done.has(fe.id)&&!k.has(`s:${fe.id}`)&&(k.add(`s:${fe.id}`),e.track(V,{flow:t.id,step:fe.id,kind:"checklist",action:"shown"}));return {type:"checklist",flow:t,items:ue.map(fe=>{let K=dr(fe),_e=K&&(K.kind==="tour"||K.kind==="modal")&&K.id!==t.id?W(K.id):void 0,ye=_e&&_e.shownBy!=="code"&&ee(_e).length?_e:void 0,Qe=K&&(K.kind==="page"?K.target.trim():K.kind==="code"||ye)?K:void 0;return {step:fe,done:o.done.has(fe.id),...ye&&(K==null?void 0:K.kind)==="tour"?{tour:ye}:{},...Qe?{opens:Qe}:{},...ye?{target:ye}:{}}})}}k.has(`s:${c.id}`)||(k.add(`s:${c.id}`),e.track(V,{flow:t.id,step:c.id,kind:c.kind,action:"shown"}));let C=u.slice(g+1),h=C.findIndex(F=>F.kind==="condition"),y=(h<0?C:C.slice(0,h)).filter(b).length;return {type:"step",flow:t,step:c,index:a.before,total:a.before+1+y,last:!y&&h<0,...c.kind==="question"?{answer:($=D.get(c.id))!=null?$:c.question?z.get(c.question.key):void 0,back:a.before>0}:{}}},G=()=>{var a,c,u;if(r){let g=r,b=(a=g.flow.followUps)==null?void 0:a[g.reason],C=b?1:0,h=g.plain?1:3+C+((c=g.flow.second)!=null&&c[g.reason]?1:0);return {type:"cancel",screen:g.screen,flow:g.flow,reason:g.reason,...g.screen==="followup"&&b?{followUp:b,answer:g.answer}:{},offer:g.screen==="offer"?g.offer:void 0,...g.screen==="offer"?{round:g.round}:{},price:g.options.price,busy:g.busy,error:g.error,step:g.screen==="survey"?1:g.screen==="followup"?2:g.screen==="offer"?1+C+g.round:h,steps:h}}let t=L();if(t)return t;if(i&&!J){let g=Y,b=i;Y=null,i=null;let C=g?W(g.flow):void 0;if(g&&C){let h=we(ee(C)).find(F=>F.id===g.step),y=q(C.id);h&&!h.event&&!((u=w.get(b))!=null&&u.dismissed)&&!y.done.has(h.id)&&(te(y,h.id),X({flow:C.id,step:h.id,kind:"checklist",action:"completed"}),ge(C)),i=C.id;let $=L();if($)return $;J||(i=null);}else if(l){let h=W(b),y=h?ce(h):void 0;Promise.resolve().then(()=>se(y));}}let o=d.find(g=>!O.has(g.id));return o?{type:"message",message:o}:null},I=()=>{let t=G();(t==null?void 0:t.type)==="message"&&!k.has(`m:${t.message.id}`)&&(k.add(`m:${t.message.id}`),e.track(It,{message:t.message.id,journey:t.message.journey,action:"shown"}));for(let o of [...R])try{o();}catch(a){}},re=t=>i===t.id?true:i&&W(i)&&!ne(W(i))?false:(i=t.id,e.track(V,{flow:t.id,action:"started"}),I(),true),ke=t=>t.audience==="answered"?!!t.answered&&z.get(t.answered.question)===t.answered.option:t.audience!=="signed_in"||!!e.personId(),U=t=>{let o=W(t);return !o||ne(o)},oe=(t,o=ce(t))=>{var u;let a=(u=e.path)==null?void 0:u.call(e),c=at(o);if(c)return U(c);if(it(o))return false;if(mn(o))return a!==void 0&&$t(o,a);if(gn(o))return true;for(let g of M)if(st(o,g))return true;return false},se=t=>{var u,g;if(!S||i||!l||!e.personId()&&!((u=e.storage)!=null&&u.call(e)))return;let o=(g=e.path)==null?void 0:g.call(e),a=t&&!it(t)?de(t):"",c=Le().find(b=>(at(ce(b))?U(at(ce(b))):mn(ce(b))?o!==void 0&&$t(ce(b),o):gn(ce(b))||!!a&&de(ce(b))===a)&&ke(b)&&ee(b).length&&!ne(b));c&&re(c);},be=(t,o,a)=>{let c=q(a.id);c.done.clear(),c.at.clear(),c.dismissed=false,Y={flow:t.id,step:o},i=a.id,e.track(V,{flow:a.id,action:"started",from:t.id}),j(),I();},$e=(t,o,a)=>{let c=o.question,u=c.type==="text"?a.trim().slice(0,500):a.startsWith(Ie)?Ie+a.slice(Ie.length).trim().slice(0,490):a;z.set(c.key,u),D.delete(o.id),te(q(t.id),o.id),e.track(V,{flow:t.id,step:o.id,kind:"question",action:"completed",question:c.key,answer:u,label:ur(c,u)}),ge(t),j();},N=t=>{j(),ne(t)&&Promise.resolve().then(()=>se()),I();},De=()=>{let t=e.personId();E!==null&&E!==t&&(w.clear(),M.clear(),z.clear(),D.clear(),O.clear(),i=null,Y=null,v=void 0),E=t;let o=(async()=>{var u,g,b,C;let a=(u=e.storage)==null?void 0:u.call(e);if(a)try{let h=await a.get(Te(t));h&&Fe(JSON.parse(h));let y=await a.get(Ue(t));if(y)for(let F of JSON.parse(y))typeof F=="string"&&M.add(F);let $=await a.get(He(t));if($)for(let[F,ie]of Object.entries(JSON.parse($)))typeof ie=="string"&&z.set(F,ie);}catch(h){}let c=Ce().length>0||!!(n!=null&&n.messages);if(t&&c&&v!==t){v=t;let h=await e.fetchInApp(t).catch(()=>null);if(h&&e.personId()===t){Fe(h.onboarding);for(let y of (g=h.events)!=null?g:[])typeof y=="string"&&M.add(de(y));for(let[y,$]of Object.entries((b=h.answers)!=null?b:{}))typeof $=="string"&&!z.has(y)&&z.set(y,$);d=((C=h.messages)!=null?C:[]).filter(y=>y&&y.id&&y.title);}}t||(d=[]),l=true,se(),I();})();return m=o.finally(()=>{m===o&&(m=null);}),m},Oe=t=>t.round>1?{round:2}:t.rule>=0?{rule:t.rule}:{},Ee=t=>{var c,u,g,b;let o={answer:t.answer,plan:t.options.plan,months:gr(t.options.customerSince,(c=e.now)==null?void 0:c.call(e))},a=(g=(u=t.flow.rules)==null?void 0:u[t.reason])!=null?g:[];t.rule=a.findIndex(C=>mr(C,o)),t.offer=t.rule<0?t.flow.offers[t.reason]:(b=a[t.rule].offer)!=null?b:void 0,t.round=1,t.screen=t.offer?"offer":"confirm";},We=(t,o,a)=>{var u;let c=t.screen==="offer"?t.offer:void 0;return {outcome:o,run:t.run,...t.reason?{reason:t.reason,reasonLabel:(u=t.flow.reasons.find(g=>g.id===t.reason))==null?void 0:u.label}:{},...t.answer?{answer:t.answer}:{},...o==="saved"&&c?{offer:c}:{},...a!=null&&a.trim()?{comment:a.trim().slice(0,500)}:{}}},me=(t,o)=>{var a;e.track(Xe,{action:"finished",run:t.run,version:t.flow.version,outcome:o.outcome,customer:(a=t.options.customer)!=null?a:"consumer",...o.reason?{reason:o.reason}:{},...o.answer?{answer:o.answer}:{},...o.offer?{offer:o.offer.kind,...Oe(t)}:{},...o.comment?{comment:o.comment}:{}}),r===t&&(r=null),t.resolve(o),I();},je=(t,o,a)=>{if(t.busy)return;let c=We(t,o,a),u=o==="saved"?t.options.onSave:t.options.onCancel;t.busy=true,t.error=void 0,I(),Promise.resolve().then(()=>u==null?void 0:u(c)).then(()=>me(t,c),()=>{t.busy=false,t.error=Ye("Something went wrong. Please try again."),I();});};return {setConfig:t=>{n=t,i&&!W(i)&&(i=null),I();},refresh:De,onEvent:t=>{var C;if(t==="$pageview"&&se(),!t||t.startsWith("$"))return;let o=de(t),a=!!o&&!M.has(o);a&&M.add(o);let c=W(i),u=false,g=[...c?[c]:[],...Ce().filter(h=>h.shownBy==="code"&&h.id!==(c==null?void 0:c.id))];for(let h of g){let y=q(h.id),$=false;for(let F of we(ee(h)))F.kind==="checklist"&&F.event&&!y.done.has(F.id)&&st(F.event,t)&&(te(y,F.id),$=true,e.track(V,{flow:h.id,step:F.id,kind:F.kind,action:"completed"}));$&&(u=true,ge(h));}if(u||a&&(c||g.length)?(j(),I()):a&&j(),!S||!e.personId()&&!((C=e.storage)!=null&&C.call(e)))return;let b=Le().find(h=>ee(h).length&&!it(ce(h))&&st(ce(h),t)&&ke(h)&&!ne(h));b&&re(b);},openCancelFlow:(t={})=>{var b,C;if(r)return r.promise;let o=(b=n==null?void 0:n.cancelFlow)!=null?b:ar,a=t.customer!=="business"||o.reasons.length<2,c=()=>{},u=new Promise(h=>c=h),g={flow:o,options:t,plain:a,screen:a?"confirm":"survey",round:1,run:fr(),busy:false,resolve:c,promise:u};return r=g,e.track(Xe,{action:"shown",run:g.run,version:o.version,customer:(C=t.customer)!=null?C:"consumer",plain:a}),I(),u},startOnboarding:t=>{let o=t?W(t):Le().find(c=>ee(c).length&&!it(ce(c))&&!at(ce(c))&&!ne(c));if(!o||!ee(o).length||o.shownBy==="code")return false;let a=q(o.id);return a.dismissed=false,re(o)},view:G,subscribe:t=>(R.add(t),()=>R.delete(t)),cancel:{pick:t=>{!r||r.busy||r.screen!=="survey"||!r.flow.reasons.some(o=>o.id===t)||(r.reason!==t&&(r.answer=void 0),r.reason=t,r.error=void 0,I());},answer:t=>{let o=r;if(!o||o.busy||o.screen!=="followup")return;let a=t.slice(0,500);o.answer=a.trim()?a:void 0,I();},next:()=>{var o,a;let t=r;if(!(!t||!t.reason)){if(t.screen==="survey")e.track(Xe,{action:"answered",run:t.run,version:t.flow.version,reason:t.reason}),(o=t.flow.followUps)!=null&&o[t.reason]?t.screen="followup":Ee(t);else if(t.screen==="followup")t.answer=(a=t.answer)==null?void 0:a.trim(),Ee(t);else return;I();}},accept:t=>{var a;let o=r;!o||o.screen!=="offer"||!o.reason||(o.busy||e.track(Xe,{action:"offer",run:o.run,version:o.flow.version,reason:o.reason,offer:(a=o.offer)==null?void 0:a.kind,...Oe(o),outcome:"accepted"}),je(o,"saved",t));},decline:()=>{var a,c;let t=r;if(!t||t.screen!=="offer"||t.busy)return;e.track(Xe,{action:"offer",run:t.run,version:t.flow.version,reason:t.reason,offer:(a=t.offer)==null?void 0:a.kind,...Oe(t),outcome:"declined"});let o=t.round===1&&t.reason?(c=t.flow.second)==null?void 0:c[t.reason]:void 0;o?(t.offer=o,t.rule=void 0,t.round=2):t.screen="confirm",t.error=void 0,I();},confirm:t=>{let o=r;!o||o.screen!=="confirm"||je(o,"cancelled",t);},close:()=>{var a,c;let t=r;if(!t||t.busy)return;let o=We(t,"kept");(c=(a=t.options).onClose)==null||c.call(a,o),me(t,o);}},onboarding:{next:()=>{var a,c;let t=L();if((t==null?void 0:t.type)!=="step")return;if(t.step.kind==="question"){let u=t.step.question,g=(a=D.get(t.step.id))!=null?a:u?z.get(u.key):void 0;if(!u||!hn(u,g))return;$e(t.flow,t.step,g),I();return}te(q(t.flow.id),t.step.id),e.track(V,{flow:t.flow.id,step:t.step.id,kind:t.step.kind,action:"completed"}),ge(t.flow),j(),I();let o=t.step.kind==="modal"?dt(t.step.url):void 0;o&&((c=e.openUrl)==null||c.call(e,o));},check:t=>{let o=L();if((o==null?void 0:o.type)!=="checklist")return;let a=o.items.find(c=>c.step.id===t);!a||a.done||(te(q(o.flow.id),t),e.track(V,{flow:o.flow.id,step:t,kind:"checklist",action:"completed"}),ge(o.flow),j(),I());},dismiss:()=>{let t=L();!t||t.type!=="step"&&t.type!=="checklist"||(q(t.flow.id).dismissed=true,e.track(V,{flow:t.flow.id,...t.type==="step"?{step:t.step.id}:{},action:"dismissed"}),i=Y&&Y.flow!==t.flow.id&&W(Y.flow)?Y.flow:null,Y=null,j(),I());},startTour:t=>{var c;let o=L();if((o==null?void 0:o.type)!=="checklist")return false;let a=(c=o.items.find(u=>u.step.id===t))==null?void 0:c.target;return a?(be(o.flow,t,a),true):false},open:t=>{var u,g;let o=L();if((o==null?void 0:o.type)!=="checklist")return false;let a=o.items.find(b=>b.step.id===t),c=a==null?void 0:a.opens;return !a||!c?false:(e.track(V,{flow:o.flow.id,step:t,kind:"checklist",action:"opened",opens:c.kind}),(c.kind==="tour"||c.kind==="modal")&&a.target?(be(o.flow,t,a.target),true):(!a.done&&!a.step.event&&(te(q(o.flow.id),t),e.track(V,{flow:o.flow.id,step:t,kind:"checklist",action:"completed"}),ge(o.flow)),j(),I(),c.kind==="page"?(u=e.navigate)==null||u.call(e,c.target.trim()):(g=e.task)==null||g.call(e,t,o.flow),true))},answer:t=>{let o=L();(o==null?void 0:o.type)!=="step"||o.step.kind!=="question"||(D.set(o.step.id,String(t).slice(0,500)),I());},skip:()=>{let t=L(),o=(t==null?void 0:t.type)==="step"&&t.step.kind==="question"?t.step.question:void 0;(t==null?void 0:t.type)!=="step"||!(o!=null&&o.optional)||(D.delete(t.step.id),te(q(t.flow.id),t.step.id),e.track(V,{flow:t.flow.id,step:t.step.id,kind:"question",action:"completed",question:o.key,skipped:true}),ge(t.flow),j(),I());},back:()=>{let t=L();if((t==null?void 0:t.type)!=="step"||t.step.kind!=="question"||!t.back)return;let o=we(ee(t.flow)),a=o.findIndex(u=>u.id===t.step.id),c=q(t.flow.id);for(let u=a-1;u>=0;u--)if(c.done.has(o[u].id)){c.done.delete(o[u].id),c.at.delete(o[u].id);break}j(),I();},item:t=>{let o=W(t);if(!o)return null;let a=w.get(o.id),c=we(ee(o)).map(b=>{let C=b.question?z.get(b.question.key):void 0;return {...b,done:!!(a!=null&&a.done.has(b.id)),...C!==void 0?{answer:C}:{}}}),u=c.length>0&&c.every(b=>b.done),g=!!(a!=null&&a.dismissed);return {item:o,steps:c,done:u,dismissed:g,eligible:!u&&!g&&ke(o)&&oe(o)}},seen:t=>{let o=W(t);if(!o||o.shownBy!=="code"||!l)return;k.has(`f:${o.id}`)||(k.add(`f:${o.id}`),e.track(V,{flow:o.id,action:"started"}));let a=w.get(o.id);for(let c of we(ee(o)))if(!(a!=null&&a.done.has(c.id))&&!k.has(`s:${c.id}`)&&(k.add(`s:${c.id}`),e.track(V,{flow:o.id,step:c.id,kind:c.kind,action:"shown"}),c.kind!=="checklist"))break},complete:(t,o)=>{let a=W(t),c=a&&we(ee(a)).find(g=>g.id===o);if(!a||!c||c.kind==="question")return;let u=q(a.id);u.done.has(c.id)||(te(u,c.id),e.track(V,{flow:a.id,step:c.id,kind:c.kind,action:"completed"}),N(a));},dismissItem:t=>{let o=W(t);if(!o)return;let a=q(o.id);a.dismissed||(a.dismissed=true,e.track(V,{flow:o.id,action:"dismissed"}),i===o.id&&(i=null),N(o));},answerItem:(t,o,a)=>{let c=W(t),u=c&&we(ee(c)).find(g=>{var b;return g.kind==="question"&&(g.id===o||((b=g.question)==null?void 0:b.key)===o)});!c||!(u!=null&&u.question)||!hn(u.question,a)||($e(c,u,a),N(c));}},finale:()=>le,accent:()=>n==null?void 0:n.onboardingAccent,answers:()=>Object.fromEntries(z),message:{click:()=>{var a;let t=G();if((t==null?void 0:t.type)!=="message")return;O.add(t.message.id),e.track(It,{message:t.message.id,journey:t.message.journey,action:"clicked"});let o=dt(t.message.url);I(),o&&((a=e.openUrl)==null||a.call(e,o));},dismiss:()=>{let t=G();(t==null?void 0:t.type)==="message"&&(O.add(t.message.id),e.track(It,{message:t.message.id,journey:t.message.journey,action:"dismissed"}),I());}}}};var wr={questions:"question",checklist:"checklist",tour:"tour"},bn=(e,n,r={})=>{var v,E;let i=(v=r.type)!=null?v:"questions",d=(E=wr[i])!=null?E:"question",l=new Set,m=w=>{var O;return e(V,{code:de(n),name:n,type:i,...(O=r.order)!=null&&O.length?{order:r.order}:{},...w})};return {saw:(w,O)=>{l.has(w)||(l.add(w),m({step:w,title:O,kind:d,action:"shown"}));},answered:(w,O,k)=>m({step:w,kind:"question",action:"completed",question:w,answer:O,label:k!=null?k:O}),done:w=>m({step:w,kind:d,action:"completed"}),closed:w=>m({...w?{step:w}:{},kind:d,action:"dismissed"})}};var hr="ck_pick",kr="ck_origin",lt=e=>typeof CSS!="undefined"&&CSS.escape?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,n=>`\\${n}`),br=e=>[...e.classList].filter(n=>n.length<30&&!/\d{2,}|[_-][a-z0-9]{5,}$|^(is|has)-|hover|active|focus|open|selected|:|\[/.test(n)).slice(0,2),yn=e=>{let n=e.ownerDocument,r=m=>{try{return n.querySelectorAll(m).length===1}catch(v){return false}},i=e.getAttribute("data-ck-target");if(i)return `[data-ck-target="${i.replace(/"/g,'\\"')}"]`;if(e.id&&!/\d{3,}/.test(e.id)&&r(`#${lt(e.id)}`))return `#${lt(e.id)}`;let d=[],l=e;for(;l&&l!==n.documentElement&&d.length<6;){if(l!==e&&l.id&&!/\d{3,}/.test(l.id)){d.unshift(`#${lt(l.id)}`);break}let m=l.tagName.toLowerCase(),v=br(l).map(R=>`.${lt(R)}`).join(""),E=l.parentElement,w=E?[...E.children].filter(R=>R.tagName===l.tagName):[],O=w.length>1?`:nth-of-type(${w.indexOf(l)+1})`:"";d.unshift(`${m}${v}${O}`);let k=d.join(" > ");if(r(k))return k;l=E;}return d.join(" > ")},xn=()=>{var O;if(typeof window=="undefined"||window.top===window)return null;let e=new URLSearchParams(window.location.search);if(e.get(hr)!=="1")return null;let n;try{n=new URL((O=e.get(kr))!=null?O:"").origin;}catch(k){return null}if(!/^https?:\/\//.test(n))return null;let r=k=>window.parent.postMessage(k,n),i=document.createElement("div");i.setAttribute("aria-hidden","true"),Object.assign(i.style,{position:"fixed",zIndex:"2147483647",pointerEvents:"none",border:"2px solid #0ea5e9",background:"rgba(14,165,233,.12)",borderRadius:"6px",transition:"all 60ms linear",display:"none"});let d=document.createElement("div");Object.assign(d.style,{position:"absolute",left:"-2px",bottom:"calc(100% + 4px)",font:"600 11px/1.4 system-ui, sans-serif",color:"#fff",background:"#0c4a6e",padding:"2px 6px",borderRadius:"4px",whiteSpace:"nowrap",maxWidth:"360px",overflow:"hidden",textOverflow:"ellipsis"}),i.appendChild(d),document.body.appendChild(i);let l=null,m=k=>{if(l=k&&k!==i&&!i.contains(k)?k:null,!l){i.style.display="none";return}let R=l.getBoundingClientRect();Object.assign(i.style,{display:"block",left:`${R.left-2}px`,top:`${R.top-2}px`,width:`${R.width+4}px`,height:`${R.height+4}px`}),d.textContent=yn(l);},v=k=>m(document.elementFromPoint(k.clientX,k.clientY)),E=k=>{var S,M;k.preventDefault(),k.stopPropagation();let R=(S=document.elementFromPoint(k.clientX,k.clientY))!=null?S:l;!R||R===i||r({type:"mrrocket:picked",selector:yn(R),text:((M=R.textContent)!=null?M:"").trim().replace(/\s+/g," ").slice(0,80)});},w=k=>{k.key==="Escape"&&r({type:"mrrocket:pick-cancel"});};return window.addEventListener("mousemove",v,true),window.addEventListener("click",E,true),window.addEventListener("keydown",w,true),r({type:"mrrocket:pick-ready"}),()=>{window.removeEventListener("mousemove",v,true),window.removeEventListener("click",E,true),window.removeEventListener("keydown",w,true),i.remove();}};var yr={get:e=>{try{return window.localStorage.getItem(e)}catch(n){return null}},set:(e,n)=>{try{window.localStorage.setItem(e,n);}catch(r){}}},Cn=()=>{try{for(let e=window.localStorage.length-1;e>=0;e--){let n=window.localStorage.key(e);n!=null&&n.startsWith("mrrocket:onboarding")&&window.localStorage.removeItem(n);}}catch(e){}},Rn=e=>({track:e.track,personId:e.personId,auto:e.auto,storage:()=>e.canStore()?yr:null,openUrl:n=>window.location.assign(n),path:()=>window.location.pathname,navigate:n=>{var d;let r=(d=e.onNavigate)==null?void 0:d.call(e);if(r)return r(n);let i=dt(n);i&&window.location.assign(i);},task:(n,r)=>{var i,d;return (d=(i=e.onTask)==null?void 0:i.call(e))==null?void 0:d(n,r)},fetchInApp:async n=>{var d;if(!e.apiKey)return null;let r=(d=e.userHash)==null?void 0:d.call(e,n),i=await fetch(`${e.host}/api/sdk/inapp?key=${encodeURIComponent(e.apiKey)}&distinctId=${encodeURIComponent(n)}${r?`&userHash=${r}`:""}${ot()}`);return Ne(i.status),i.ok?await i.json():null}});var pt="mrr_ref",gt="mrr_ref",xr="mrr_ref",Cr="mrr_click";var Je=/^[A-Za-z0-9_-]{1,64}$/;var Rr=(e,n="ref")=>{let r=new URLSearchParams(e);return vr(i=>r.get(i),n)},vr=(e,n="ref")=>{let r=e(xr);if(r&&Je.test(r)){let d=e(Cr);return {code:r,clickId:d&&Je.test(d)?d:null,direct:false}}let i=e(n);return i&&Je.test(i)?{code:i,clickId:null,direct:true}:null},vn=e=>{var n;return `${e.code}.${(n=e.clickId)!=null?n:""}.${e.at}`},ut=(e,n=60,r=Date.now())=>{if(!e)return null;let[i,d,l]=e.split("."),m=Number(l);return !i||!Je.test(i)||!Number.isFinite(m)||d&&!Je.test(d)||r-m>n*864e5||m>r+864e5?null:{code:i,clickId:d||null,at:m}};var Z=null,mt=()=>typeof document!="undefined",On=e=>{var r;if(!mt())return;let n=(r=document.cookie.split("; ").find(i=>i.startsWith(`${e}=`)))==null?void 0:r.slice(e.length+1);try{return n?decodeURIComponent(n):void 0}catch(i){return n}},wt=()=>{try{return typeof localStorage=="undefined"?null:localStorage}catch(e){return null}},Pt=()=>{var e,n;return Z||(mt()?(n=ut(On(pt),3650))!=null?n:ut((e=wt())==null?void 0:e.getItem(gt),3650):null)};var ft=(e,n)=>{var d;if(!mt())return;let r=Math.max(1,Math.round(n))*86400,i=typeof location!="undefined"&&location.protocol==="https:"?"; secure":"";document.cookie=`${pt}=${encodeURIComponent(vn(e))}; path=/; max-age=${r}; samesite=lax${i}`;try{(d=wt())==null||d.setItem(gt,vn(e));}catch(l){}},ht=()=>{var e;if(mt()){document.cookie=`${pt}=; path=/; max-age=0; samesite=lax`;try{(e=wt())==null||e.removeItem(gt);}catch(n){}}},En=()=>{Z=null;},_n=async e=>{var i,d,l;let n=Rr(e.search,e.param),r=(i=e.now)!=null?i:Date.now();if(!n)return !Z&&e.store&&(Z=(l=ut(On(pt),e.days,r))!=null?l:ut((d=wt())==null?void 0:d.getItem(gt),e.days,r),Z||ht()),Z;if(Z={code:n.code,clickId:n.clickId,at:r},e.store&&ft(Z,e.days),e.beacon)try{let m=await e.beacon({code:n.code,clickId:n.clickId});m&&Z&&Z.code===n.code&&!Z.clickId&&(Z={...Z,clickId:m},e.store&&ft(Z,e.days));}catch(m){}return Z},Sn=e=>e==="$identify"||!e.startsWith("$");var Mt=3600*24*365,$n=e=>{var r;if(typeof document=="undefined")return;let n=(r=document.cookie.split("; ").find(i=>i.startsWith(`${e}=`)))==null?void 0:r.slice(e.length+1);if(n)try{return decodeURIComponent(n)}catch(i){return n}},kt=(e,n,r)=>{let i=window.location.protocol==="https:"?"; secure":"";document.cookie=`${e}=${encodeURIComponent(n)}; path=/; max-age=${r}; samesite=lax${i}`;},ze=e=>{document.cookie=`${e}=; path=/; max-age=0; samesite=lax`;},H={utm:{}},Fn=()=>{var e;return (e=H.id)!=null?e:H.id=Ot()},At=(e,n)=>{if(e!=="cookies")return Fn();let r=$n(Se);if(r)return H.id=r;let i=Fn();return kt(Se,i,Mt),i},Nt=e=>{var d;let n=Date.now(),r=H.session,i=(d=e?$n(Ae):void 0)!=null?d:r&&n-r.last<18e5?r.id:Ot();return H.session={id:i,last:n},e&&kt(Ae,i,18e5/1e3),i},Lt=()=>{var r;let e=window.location.href;if(H.url===e)return;H.referrer=(r=H.url)!=null?r:document.referrer||void 0,H.url=e;let n=en(window.location.search);Object.keys(n).length&&(H.utm=n);},Pn=()=>{let e=navigator,n=window;return e.doNotTrack==="1"||n.doNotTrack==="1"||e.globalPrivacyControl===true};var bt=window,Er=()=>{var e,n;return (n=(e=document.currentScript)!=null?e:document.querySelector('script[data-key][src*="sdk"]'))!=null?n:document.querySelector("script[data-key][src*='mrrocket']")},Mn=new Set,pe=e=>{Mn.has(e)||(Mn.add(e),console.warn(`[MRRocket] ${e}`));},_r=()=>{var Wt,jt,Kt,Vt;let e=Er(),n=s=>{var f;return (f=e==null?void 0:e.getAttribute(`data-${s}`))!=null?f:void 0},r=(s,f)=>{let p=n(s);return p===void 0?f:!["false","0","off","no"].includes(p.trim().toLowerCase())},i=(Wt=e==null?void 0:e.src)!=null?Wt:"",d="";try{d=i?new URL(i,window.location.href).origin:"";}catch(s){d="";}n("locale")&&St(n("locale"));let l=((jt=n("key"))!=null?jt:"").trim(),m=((Kt=n("api-host"))!=null?Kt:d).trim().replace(/\/+$/,""),v=n("consent"),E=r("respect-dnt",false),w=r("heatmaps",true),O=r("errors",true),k=n("release"),R=n("attribution"),S=R==="always"||R==="off"?R:"consent",M=n("referral-param")||"ref",B={},T=(s,f)=>{var p;return (p=B[s])!=null?p:B[s]=new Promise((x,_)=>{var qt;let A=()=>bt[f];if(A())return x(A());let ae=(qt=n(`${s}-src`))!=null?qt:i?i.replace(/(\.min)?\.js(\?[^#]*)?(#.*)?$/,`-${s}$1.js?v=${nt}`):"";if(!ae)return _(new Error(s));let xe=document.createElement("script");xe.async=true,xe.src=ae,xe.onload=()=>A()?x(A()):_(new Error(s)),xe.onerror=()=>_(new Error(s)),document.head.appendChild(xe);}).catch(x=>{throw B[s]=void 0,x})},Y=n("theme"),z={theme:Y==="light"||Y==="dark"?Y:"auto",accent:n("accent")},D=new URLSearchParams(window.location.search),he=tn(D.get(Qt)),le=D.get(Zt)==="1";le&&xn();let Ce=D.get(Ve);if(Ce!==null){D.delete(Ve);let s=D.toString();history.replaceState(history.state,"",`${window.location.pathname}${s?`?${s}`:""}${window.location.hash}`);}let Le=Pn(),W=v==="cookies"||v==="off"?v:"cookieless",q=r("replay",false),Re="",X,te=null,ve,P=null,ne=false,Te=false,Ue=null,He=null,ge=window.location.pathname,j=[],Fe=new Set,Ge=[],J=()=>E&&Le?"off":W,L=()=>!le&&J()!=="off",G=()=>X!=null?X:Re,I=()=>J()==="cookies"?G():X,re=s=>an(te,s);l||pe('No public key. Add data-key="mrr_pub_\u2026" to the script tag; nothing is tracked until then.');let ke=(s=false)=>{if(!j.length)return;if(!l){j.length=0;return}let f=`${m}/api/sdk/events`;for(let p of Yt(l,j.splice(0),{v:nt,errors:O,platform:"web"},re(I())))s&&"sendBeacon"in navigator&&navigator.sendBeacon(f,p)||fetch(f,{method:"POST",headers:{"content-type":"application/json"},body:p,keepalive:true}).then(_=>{_.status===401?Ne(401):_.ok||pe(`Events were rejected with ${_.status}. Check data-key (MRRocket \u203A Settings \u203A Products).`);}).catch(()=>pe(`Could not reach ${m||"this origin"} to send events. Check data-api-host.`));},U=null,oe=null,se=(s,f,p=Date.now(),x)=>{if(!L())return;let _=Sn(s)?Pt():null;j.push({event:s,props:_?{...f,$referral:{code:_.code,clickId:_.clickId}}:f,distinctId:I(),sessionId:Nt(J()==="cookies"),ts:p,url:x!=null?x:window.location.href,referrer:H.referrer,...H.utm,screen:{w:window.screen.width,h:window.screen.height}});},be=(s,f)=>{typeof s!="string"||!s||(se(s,f),L()&&(U==null||U.event(s)),N.onEvent(s));},$e={},N=kn(Rn({host:m,apiKey:l,track:se,personId:()=>L()?X:void 0,userHash:re,canStore:()=>J()==="cookies",auto:r("onboarding",true),onNavigate:()=>$e.onNavigate,onTask:()=>$e.onTask})),De=false,Oe;N.subscribe(()=>{De||!N.view()||le||(De=true,T("flows","__mrrocketFlows").then(s=>s.mountFlows(N,z)).catch(()=>{De=false,pe("The cancel flow and onboarding dialogs did not load. Check that sdk-flows.js is served next to sdk.js.");}));});let Ee=(s,f)=>{if(!L())return;let p=`${window.location.pathname}|${s}`;Fe.has(p)||(Fe.add(p),be("$exposure",{experiment:s,variant:f}));},We=()=>{let s=rn(P,window.location.href,G(),he);return s!=null&&s.to?(ke(true),window.location.replace(s.to),true):(s!=null&&s.experiment&&Ee(s.experiment,s.variant),false)},me=()=>{if(!P)return;let s=document.querySelectorAll("[data-ck-text]");if(!s.length)return;let f=nn(P,G(),he),p=new Set;s.forEach(x=>{var ae,xe;let _=x.dataset.ckText;if(!_)return;p.add(_),x.dataset.ckDefault===void 0&&(x.dataset.ckDefault=(ae=x.textContent)!=null?ae:"");let A=(xe=f[_])!=null?xe:x.dataset.ckDefault;x.textContent!==A&&(x.textContent=A);});for(let x of P.experiments)x.variants.some(_=>{var A;return Object.keys((A=_.changes)!=null?A:{}).some(ae=>p.has(ae))})&&Ee(x.key,qe(x.key,P,G(),he));},je=()=>{var s,f;return (f=(s=P==null?void 0:P.referral)==null?void 0:s.cookieDays)!=null?f:60},yt=()=>S==="always"?J()!=="off":S==="consent"&&J()==="cookies",xt=null,t=false,o=()=>{if(!ne||le)return;if(S==="off"||J()==="off"){En(),(S==="off"||t)&&ht();return}let s=window.location.href;xt!==s&&(xt=s,_n({search:window.location.search,param:M,store:yt(),days:je(),beacon:l?({code:f,clickId:p})=>fetch(`${m}/api/sdk/affiliate/click`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:l,code:f,clickId:p,url:s,referrer:document.referrer||void 0}),keepalive:true}).then(x=>x.ok?x.json():null).then(x=>{var _;return (_=x==null?void 0:x.clickId)!=null?_:null}):void 0}));},a=()=>{let s=yt(),f=Pt();s&&f?ft(f,je()):!s&&t&&ht(),t=s;},c=0,u=false,g=()=>{var x,_;let s=L()&&q&&!!(P!=null&&P.replay)&&!!l;if(s===u)return;u=s;let f=++c;if(!s){U==null||U.stop(true),U=null;return}let p=(_=(x=P==null?void 0:P.replay)==null?void 0:x.sampleRate)!=null?_:.1;T("replay","__mrrocketReplay").then(A=>A.startReplay({host:m,apiKey:l,sessionId:Nt(J()==="cookies"),distinctId:I(),identified:!!X,userHash:re(I()),sampleRate:p,warn:pe})).then(A=>{f!==c?A==null||A.stop(true):U=A;}).catch(()=>pe("Session recording could not start (the recorder did not load)."));},b=r("messenger",false),C=null,h=s=>{le||l&&(C!=null||(C=T("messenger","__mrrocketMessenger").then(f=>{var A;let p=ae=>n(`messenger-${ae}`)===void 0?void 0:r(`messenger-${ae}`,true),x=n("messenger-position"),_=(A=n("messenger-theme"))!=null?A:Y;return f.mountMessenger({host:m,apiKey:l,distinctId:G,user:()=>ve,userHash:()=>re(G()),launcher:b,position:x,corners:n("messenger-corners"),header:n("messenger-header"),font:n("messenger-font"),title:n("messenger-title"),greeting:n("messenger-greeting"),label:n("messenger-label"),askEmail:p("ask-email"),help:p("help"),sound:p("sound"),preview:p("preview"),theme:_==="light"||_==="dark"||_==="auto"?_:void 0,accent:n("accent")})})),C.then(s).catch(()=>{C=null,pe("sdk-messenger.js did not load.");}));},y=n("forms")==="auto",$=false,F=()=>{$||!l||le||!document.querySelector(y?"form":"form[data-mrrocket-form]")||($=true,T("forms","__mrrocketForms").then(s=>s.watchForms({host:m,apiKey:l,auto:y,distinctId:()=>L()?I():void 0,userHash:re,identified:()=>!!X,identify:Tt,tracking:L,referrer:()=>H.referrer,utm:()=>H.utm})).catch(()=>$=false));},ie=()=>{!Te||!L()||He===window.location.pathname||(He=window.location.pathname,be("$pageview",{path:window.location.pathname}));},ue=null,fe=()=>{let s=ue;w&&s&&s.max>0&&se("$scroll",{depth:s.max,docH:s.docH,vw:window.innerWidth,vh:window.innerHeight},Date.now(),s.url),ue=null;},K=()=>{var _,A;if(!w||!L()||le)return;let s=document.documentElement,f=Math.max(s.scrollHeight,(A=(_=document.body)==null?void 0:_.scrollHeight)!=null?A:0),p=zt(),x=window.location.href;(ue==null?void 0:ue.url)!==x?ue={url:x,max:p,docH:f}:p>ue.max&&(ue={url:x,max:p,docH:f});},_e=()=>{let s=window.location.pathname;s!==ge&&(ge=s,!(ne&&We())&&(fe(),Lt(),U==null||U.page(s),oe==null||oe.crumb("navigation",s),ie(),o(),window.setTimeout(()=>{K(),me(),F();},0)));},ye=()=>{let s=J(),f=Ue;Ue=s,f==="cookies"&&s!=="cookies"&&(ze(Se),ze(Ae)),s==="off"&&(j.length=0,H.session=void 0),f==="cookies"&&s!=="cookies"&&Cn(),Re=At(s),a(),o(),g(),ie(),K();},Qe=s=>{let{analytics:f,replay:p}=typeof s=="string"?{analytics:s,replay:void 0}:s!=null?s:{};if(f!==void 0&&f!=="cookieless"&&f!=="cookies"&&f!=="off"){pe(`setConsent: "${String(f)}" is not a consent mode. Use "cookieless", "cookies" or "off".`);return}f==="off"&&(j.length=0),f&&(W=f),typeof p=="boolean"&&(q=p),ye(),ne&&N.refresh();},Tt=(s,f,p)=>{if(typeof s!="string"||!s)return;let x=I();te=sn(te,s,p==null?void 0:p.hash),X=s,se("$identify",{...f,id:s,...x&&x!==s?{previousId:x}:{}}),U==null||U.identify(s,re(s)),J()==="cookies"&&kt(Se,s,Mt),ve={...f,id:s},me(),ne&&N.refresh();},Ze={track:be,identify:Tt,reset:()=>{ke(),X=void 0,te=null,ve=void 0,Fe.clear(),J()==="cookies"&&(ze(Se),ze(Ae)),H.id=void 0,H.session=void 0,Re=At(J()),me(),ne&&N.refresh();},captureError:s=>oe==null?void 0:oe.capture(s,"manual"),setConsent:Qe,setLocale:St,currentLocale:rt,getFlag:s=>vt(s,P,G(),{...ve})!==false,getFlagVariant:s=>{let f=vt(s,P,G(),{...ve});return typeof f=="string"?f:null},getVariant:s=>{let f=qe(s,P,G(),he);return (P||he[s])&&Ee(s,f),f},ready:s=>{typeof s=="function"&&(ne?window.setTimeout(()=>s(Ze),0):Ge.push(s));},getDistinctId:G,cancelFlow:{open:s=>N.openCancelFlow(s)},onboarding:{start:s=>N.startOnboarding(s),get:s=>{let f=N.onboarding.item(s);return f&&!f.done&&!f.dismissed&&N.onboarding.seen(s),f},subscribe:s=>N.subscribe(()=>s()),complete:(s,f)=>N.onboarding.complete(s,f),dismiss:s=>N.onboarding.dismissItem(s),answer:(s,f,p)=>N.onboarding.answerItem(s,f,p),report:(s,f)=>bn(be,s,f),setHandlers:s=>{$e={onNavigate:typeof(s==null?void 0:s.onNavigate)=="function"?s.onNavigate:void 0,onTask:typeof(s==null?void 0:s.onTask)=="function"?s.onTask:void 0};}},openCancelFlow:s=>N.openCancelFlow(s),startOnboarding:s=>N.startOnboarding(s),paywall:{open:(s,f)=>(Oe!=null?Oe:Oe=T("flows","__mrrocketFlows").then(p=>p.paywallHost({config:()=>P,distinctId:G,track:se},z))).then(p=>p.open(s,f))},push:{subscribe:s=>{let f=L()?X:void 0;if(!f)return Promise.resolve({status:"not-signed-in"});let p=window.Notification,x=Promise.resolve(p&&p.permission==="default"&&(s==null?void 0:s.ask)!==false?p.requestPermission():p==null?void 0:p.permission);return T("push","__mrrocketPush").then(_=>_.subscribeWebPush({host:m,apiKey:l,distinctId:f,userHash:re(f),permission:x},s))},unsubscribe:()=>T("push","__mrrocketPush").then(s=>s.unsubscribeWebPush({host:m,apiKey:l,distinctId:X,userHash:re(X)}))},messenger:{open:s=>h(f=>f.open(s)),close:()=>{C==null?void 0:C.then(s=>s.close()).catch(()=>{});},toggle:()=>h(s=>s.toggle())},openMessenger:()=>h(s=>s.open()),version:nt};Lt(),ye();let Pe=bt.mrrocket,Nn=(Vt=Pe==null?void 0:Pe.q)!=null?Vt:[],Ct=Pe&&typeof Pe=="object"?Pe:{};Object.assign(Ct,Ze,{__loaded:true}),delete Ct.q,bt.mrrocket=Ct;for(let[s,f]of Nn){let p=Ze[s];if(typeof p=="function")try{p(...Array.from(f!=null?f:[]));}catch(x){console.error(x);}}Te=true,ie(),O&&l&&!le&&(oe=dn({host:m,apiKey:l,release:k,context:()=>{var s;return {send:L(),distinctId:I(),sessionId:(s=H.session)==null?void 0:s.id,userHash:re(I())}},warn:pe}),oe.crumb("navigation",window.location.pathname));for(let s of ["pushState","replaceState"]){let f=history[s];history[s]=function(...p){let x=f.apply(this,p);return _e(),x};}window.addEventListener("popstate",_e);let Ln=new Ke;document.addEventListener("click",s=>{var A;s.target instanceof Element&&s.target.closest("[data-ck-messenger]")&&(s.preventDefault(),h(ae=>ae.open()));let f=s.target instanceof Element?s.target.closest("[data-ck-goal]"):null;if(f!=null&&f.dataset.ckGoal&&be(f.dataset.ckGoal,{text:(A=f.textContent)==null?void 0:A.trim().slice(0,80)}),!L())return;let p=Jt(s);if(!p)return;let x=Ln.push(p.x,p.y,Date.now());if((p.label||p.selector)&&(oe==null||oe.crumb("click",p.label||p.selector)),U==null||U.click(p,x),!w)return;let _={x:p.x,y:p.y,vw:p.vw,vh:p.vh,docH:p.docH,selector:p.selector,label:p.label,dead:!p.interactive};se("$click",_),x&&se("$rageclick",_);});let Rt=0;window.addEventListener("scroll",()=>{Rt||(Rt=window.requestAnimationFrame(()=>{Rt=0,K();}));},{passive:true}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>K()):K(),window.setInterval(()=>ke(),2e3),window.addEventListener("pagehide",()=>{fe(),ke(true);});let Ut=()=>{if(ne=true,We())return;let s=on(P,Ce);s&&Ee(s.experiment,s.variant),document.documentElement.classList.remove("ck-hide"),o(),g(),N.setConfig(P),N.refresh(),b&&(document.body?h():document.addEventListener("DOMContentLoaded",()=>h())),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{me(),F();}):(me(),F());for(let f of Ge.splice(0))try{f(Ze);}catch(p){console.error(p);}},Ht=0,Dt=s=>{let f=++Ht;return fetch(`${m}/api/sdk/config?key=${encodeURIComponent(l)}${ot()}`).then(p=>(p.ok||pe(`Config request to ${m||"this origin"} answered ${p.status}. Check data-key and data-api-host.`),p.ok?p.json():null)).then(p=>{p&&Array.isArray(p.experiments)&&f===Ht&&(P=p,un(p.words,p.lang)),s();}).catch(()=>{pe(`Could not reach ${m||"this origin"}. Check data-api-host. The page keeps its own texts and flags stay off.`),s();})};l?(Dt(Ut),fn(()=>{Dt(()=>{N.setConfig(P),me();});})):Ut();},An;typeof window!="undefined"&&typeof document!="undefined"&&!((An=bt.mrrocket)!=null&&An.__loaded)&&_r();
|
|
2
2
|
})();
|
package/dist/browser.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* that the build keeps one client chunk: server components import these as client references, while the plain
|
|
4
4
|
* helpers (`core`, `server`, `proxy`) stay free of the directive.
|
|
5
5
|
*/
|
|
6
|
-
export { CockpitProvider, Experiment, Text, useCancelFlow, useCockpit, useFlag, useFlagVariant, useOnboarding, usePaywall, usePush, useVariant, type CockpitProviderProps } from "./client.js";
|
|
6
|
+
export { CockpitProvider, Experiment, Text, useCancelFlow, useCockpit, useFlag, useFlagVariant, useOnboarding, useOnboardingReport, usePaywall, usePush, useVariant, type CockpitProviderProps } from "./client.js";
|
|
7
7
|
export { FeedbackBoard, FeedbackWidget, useFeedback, type FeedbackBoardProps, type FeedbackWidgetProps } from "./feedback.js";
|
|
8
8
|
export { Messenger, useMessenger, type MessengerProps } from "./messenger.js";
|
|
9
9
|
export { Survey } from "./survey.js";
|
package/dist/browser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/browser.ts
|
|
4
|
-
import { CockpitProvider, Experiment, Text, useCancelFlow, useCockpit, useFlag, useFlagVariant, useOnboarding, usePaywall, usePush, useVariant } from "./client.js";
|
|
4
|
+
import { CockpitProvider, Experiment, Text, useCancelFlow, useCockpit, useFlag, useFlagVariant, useOnboarding, useOnboardingReport, usePaywall, usePush, useVariant } from "./client.js";
|
|
5
5
|
import { FeedbackBoard, FeedbackWidget, useFeedback } from "./feedback.js";
|
|
6
6
|
import { Messenger, useMessenger } from "./messenger.js";
|
|
7
7
|
import { Survey } from "./survey.js";
|
|
@@ -26,6 +26,7 @@ export {
|
|
|
26
26
|
useFlagVariant,
|
|
27
27
|
useMessenger,
|
|
28
28
|
useOnboarding,
|
|
29
|
+
useOnboardingReport,
|
|
29
30
|
usePaywall,
|
|
30
31
|
usePush,
|
|
31
32
|
useStyles,
|
package/dist/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/browser.ts"],"sourcesContent":["\"use client\";\n\n/**\n * Everything of the SDK that needs the browser or React state. It is its own file with the \"use client\" directive so\n * that the build keeps one client chunk: server components import these as client references, while the plain\n * helpers (`core`, `server`, `proxy`) stay free of the directive.\n */\nexport { CockpitProvider, Experiment, Text, useCancelFlow, useCockpit, useFlag, useFlagVariant, useOnboarding, usePaywall, usePush, useVariant, type CockpitProviderProps } from \"./client\";\nexport { FeedbackBoard, FeedbackWidget, useFeedback, type FeedbackBoardProps, type FeedbackWidgetProps } from \"./feedback\";\nexport { Messenger, useMessenger, type MessengerProps } from \"./messenger\";\nexport { Survey } from \"./survey\";\nexport type { CockpitUser } from \"./context\";\nexport {\n type ChangelogEntry,\n type ChatMessage,\n type ChatSummary,\n type ChatThread,\n type FeedbackBoardInfo,\n type FeedbackComment,\n type FeedbackList,\n type FeedbackPost,\n type FeedbackRoadmap,\n type PostStatus,\n type SurveyAnswer,\n type SurveyDefinition,\n type SurveyQuestion,\n type SurveyQuestionKind,\n createApi,\n} from \"./api\";\nexport { CSS as WIDGET_CSS, useStyles } from \"./styles\";\n"],"mappings":";;;AAOA,SAAS,iBAAiB,YAAY,MAAM,eAAe,YAAY,SAAS,gBAAgB,eAAe,YAAY,SAAS,kBAA6C;
|
|
1
|
+
{"version":3,"sources":["../src/browser.ts"],"sourcesContent":["\"use client\";\n\n/**\n * Everything of the SDK that needs the browser or React state. It is its own file with the \"use client\" directive so\n * that the build keeps one client chunk: server components import these as client references, while the plain\n * helpers (`core`, `server`, `proxy`) stay free of the directive.\n */\nexport { CockpitProvider, Experiment, Text, useCancelFlow, useCockpit, useFlag, useFlagVariant, useOnboarding, useOnboardingReport, usePaywall, usePush, useVariant, type CockpitProviderProps } from \"./client\";\nexport { FeedbackBoard, FeedbackWidget, useFeedback, type FeedbackBoardProps, type FeedbackWidgetProps } from \"./feedback\";\nexport { Messenger, useMessenger, type MessengerProps } from \"./messenger\";\nexport { Survey } from \"./survey\";\nexport type { CockpitUser } from \"./context\";\nexport {\n type ChangelogEntry,\n type ChatMessage,\n type ChatSummary,\n type ChatThread,\n type FeedbackBoardInfo,\n type FeedbackComment,\n type FeedbackList,\n type FeedbackPost,\n type FeedbackRoadmap,\n type PostStatus,\n type SurveyAnswer,\n type SurveyDefinition,\n type SurveyQuestion,\n type SurveyQuestionKind,\n createApi,\n} from \"./api\";\nexport { CSS as WIDGET_CSS, useStyles } from \"./styles\";\n"],"mappings":";;;AAOA,SAAS,iBAAiB,YAAY,MAAM,eAAe,YAAY,SAAS,gBAAgB,eAAe,qBAAqB,YAAY,SAAS,kBAA6C;AACtM,SAAS,eAAe,gBAAgB,mBAAsE;AAC9G,SAAS,WAAW,oBAAyC;AAC7D,SAAS,cAAc;AAEvB;AAAA,EAeI;AAAA,OACG;AACP,SAAgB,KAAY,iBAAiB;","names":[]}
|
package/dist/client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type AttributionMode } from "./referral.js";
|
|
|
3
3
|
import { type CockpitConfig, type ConsentChoice, type ConsentMode, type VariantId } from "./core.js";
|
|
4
4
|
import type { PushResult, WebPushOptions } from "./push-web.js";
|
|
5
5
|
import { type CancelFlowOptions, type CancelFlowResult, type OnboardingFlow } from "./flows.js";
|
|
6
|
+
import type { OnboardingReport, OnboardingReportOptions } from "./onboarding-report.js";
|
|
6
7
|
import { type UseOnboarding } from "./onboarding-state.js";
|
|
7
8
|
import type { FlowsTheme } from "./flows-ui.js";
|
|
8
9
|
import { type PaywallOptions, type PaywallResult } from "./paywall.js";
|
|
@@ -176,6 +177,16 @@ export declare const useCancelFlow: () => {
|
|
|
176
177
|
* return <MyChecklist title={item.name} tasks={steps} onTick={complete} onClose={dismiss} />;
|
|
177
178
|
*/
|
|
178
179
|
export declare const useOnboarding: (id?: string) => UseOnboarding;
|
|
180
|
+
/**
|
|
181
|
+
* 0.22.0: for an onboarding that lives in your own code. Nothing to set up in MRRocket: the first report makes the item
|
|
182
|
+
* under Onboarding, and MRRocket shows who saw each step and what they answered. It follows the visitor's consent.
|
|
183
|
+
*
|
|
184
|
+
* const report = useOnboardingReport("Welcome questions", { order: ["goal", "role"] });
|
|
185
|
+
* report.saw("goal", "What brings you here?");
|
|
186
|
+
* report.answered("goal", "dream", "Dream game");
|
|
187
|
+
* report.closed("goal");
|
|
188
|
+
*/
|
|
189
|
+
export declare const useOnboardingReport: (name: string, options?: OnboardingReportOptions) => OnboardingReport;
|
|
179
190
|
/**
|
|
180
191
|
* The paywalls you built in MRRocket › Paywalls, with their pages (benefits, social proof, plans). `open` shows the
|
|
181
192
|
* placement's paywall page by page; on its last page the button hands the chosen plan to `onPurchase`, where your code
|
package/dist/client.js
CHANGED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
import { bodies } from "./batch.js";
|
|
37
37
|
import { YEAR_S, deleteCookie, enterPage, page, privacySignal, touchSession, visitorId, writeCookie } from "./web-state.js";
|
|
38
38
|
import { createFlows } from "./flows.js";
|
|
39
|
-
import { useOnboardingItem } from "./onboarding-state.js";
|
|
39
|
+
import { useOnboardingItem, useReportWith } from "./onboarding-state.js";
|
|
40
40
|
import { startPicker } from "./pick.js";
|
|
41
41
|
import { forgetFlowsStorage, webFlowsEnv } from "./flows-web.js";
|
|
42
42
|
import { createPaywallHost } from "./paywall.js";
|
|
@@ -667,6 +667,7 @@ var useOnboarding = (id) => {
|
|
|
667
667
|
const { flows, startOnboarding } = useCtx();
|
|
668
668
|
return useOnboardingItem(flows, id, startOnboarding);
|
|
669
669
|
};
|
|
670
|
+
var useOnboardingReport = (name, options) => useReportWith(useCtx().track, name, options);
|
|
670
671
|
var usePaywall = () => {
|
|
671
672
|
const { openPaywall } = useCtx();
|
|
672
673
|
return useMemo(() => ({ open: openPaywall }), [openPaywall]);
|
|
@@ -680,6 +681,7 @@ export {
|
|
|
680
681
|
useFlag,
|
|
681
682
|
useFlagVariant,
|
|
682
683
|
useOnboarding,
|
|
684
|
+
useOnboardingReport,
|
|
683
685
|
usePaywall,
|
|
684
686
|
usePush,
|
|
685
687
|
useVariant
|