@frigade/react 1.32.76 → 1.32.78
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/lib/index.d.ts +50 -17
- package/lib/index.js +78 -78
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +68 -68
- package/lib/index.mjs.map +1 -1
- package/package.json +3 -1
package/lib/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import ht,{createContext as za,useEffect as ko,useState as Ne}from"react";import{ThemeProvider as Wa}from"styled-components";import gt,{useContext as Ua,useEffect as Fo,useState as or}from"react";import{useCallback as mt,useContext as ll,useEffect as al}from"react";import $o,{useMemo as Xs}from"react";var Sr="1.32.76 ";var be="https://api.frigade.com/v1/public/",Ae="NOT_STARTED_STEP",J="COMPLETED_FLOW",lo="ABORTED_FLOW",ct="STARTED_FLOW",Le="NOT_STARTED_FLOW",Oe="COMPLETED_STEP",ao="STARTED_STEP";function Me(){let{publicApiKey:e,userId:t}=$o.useContext(Y);return{config:Xs(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Sr,"X-Frigade-SDK-Platform":"React"}}),[e,t])}}var Js="frigade-last-call-at-",Qs="frigade-last-call-data-";function Tt(){let{shouldGracefullyDegrade:e}=$o.useContext(Y);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),Wt();let i=Js+t,n=Qs+t;if(window&&window.localStorage&&o&&o.body&&o.method==="POST"){let s=window.localStorage.getItem(i),p=window.localStorage.getItem(n);if(s&&p&&p==o.body){let c=new Date(s);if(new Date().getTime()-c.getTime()<1e3)return Wt()}window.localStorage.setItem(i,new Date().toISOString()),window.localStorage.setItem(n,o.body)}let r;try{r=await fetch(t,o)}catch(s){return Wt(s)}return r?r.ok?r:Wt(r.statusText):Wt()}}function Wt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Ft(){let{publicApiKey:e,shouldGracefullyDegrade:t}=$o.useContext(Y);function o(){if(t){console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize");return}e||console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider")}return{verifySDKInitiated:o}}import{useContext as il,useState as yr}from"react";import{useContext as Rs,useEffect as el,useState as tl}from"react";import ol from"swr";import{useContext as Zs}from"react";function Pe(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:n}=Zs(Y);function r(d,u=!1){return e[d]??u}function s(d,u){t(y=>({...y,[d]:u}))}function p(d){t(u=>{let{[d]:y,...E}=u;return{...E}})}function c(d){n.includes(d)||i(u=>[...u,d])}function a(d){return n.includes(d)}function C(d){return Object.entries(e).some(([u,y])=>y&&u!=d)||o}return{getOpenFlowState:r,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:C,setKeepCompletedFlowOpenDuringSession:c,shouldKeepCompletedFlowOpenDuringSession:a}}var rl="unknown";function Ie(){let{config:e}=Me(),{publicApiKey:t,userId:o,organizationId:i,flows:n,setShouldGracefullyDegrade:r}=Rs(Y),{resetOpenFlowState:s}=Pe(),[p,c]=tl(!1),a={data:n.map(S=>({flowId:S.id,flowState:J,lastStepId:null,userId:o,foreignUserId:o,stepStates:{},shouldTrigger:!1}))},C=S=>fetch(S,e).then(m=>{if(m.ok)return m.json();throw new Error("Failed to fetch user flow states")}).catch(m=>(console.log(`Error fetching ${S}: ${m}. Will gracefully degrade and hide Frigade`),r(!0),a)),{data:d,isLoading:u,mutate:y,error:E}=ol(t&&n&&o?`${be}userFlowStates?foreignUserId=${encodeURIComponent(o)}${i?`&foreignUserGroupId=${encodeURIComponent(i)}`:""}`:null,C,{revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>a,onLoadingSlow:()=>a}),f=d==null?void 0:d.data;el(()=>{!p&&!u&&f&&c(!0)},[f,p,u]);async function x(S){if(f){let m=f.find(h=>h.flowId===S);m&&m.flowState!==J&&(m.flowState=J),await y(Promise.resolve({...d,data:f}),{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1})}}async function k(S,m,h){if(f){let w=f.find(I=>I.flowId===S);w&&(w.stepStates[m]=h,w.flowState=ct),await y(Promise.resolve({...d,data:f}),{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1})}}async function P(S,m,h){if(f){let w=f.find(I=>I.flowId===S);w&&(w.lastStepId=m,w.stepStates[m]=h,w.flowState=ct),await y({...d,data:f},{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1})}}async function B(S){if(f){let m=f.find(h=>h.flowId===S);m&&m.flowState!==Le&&(m.flowState=Le,m.lastStepId=rl,Object.keys(m.stepStates).forEach(h=>{m.stepStates[h].actionType=Ae,m.stepStates[h].createdAt=new Date().toISOString()}),await y({...d,data:f},{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1}),s(S))}}async function F(S,m){if(f){let h=f.find(w=>w.flowId===S);h&&h.stepStates[m]!==Ae&&(h.stepStates[m]=Ae),await y({...d,data:f},{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:f,isLoadingUserFlowStateData:!p,mutateUserFlowState:y,optimisticallyMarkFlowCompleted:x,optimisticallyMarkFlowNotStarted:B,optimisticallyMarkStepCompleted:k,optimisticallyMarkStepNotStarted:F,optimisticallyMarkStepStarted:P,error:E}}function Ht(){let{config:e}=Me(),{userFlowStatesData:t,mutateUserFlowState:o}=Ie(),{failedFlowResponses:i,setFailedFlowResponses:n,flowResponses:r,setFlowResponses:s}=il(Y),[p,c]=yr(new Set),[a,C]=yr(new Set),d=Tt();function u(f){let x=JSON.stringify(f);if(p.has(x))return null;p.add(x),c(p),a.add(f),C(a);let k=r==null?void 0:r.find(P=>P.flowSlug===f.flowSlug&&P.stepId===f.stepId&&P.actionType===f.actionType&&P.createdAt===f.createdAt);return d(`${be}flowResponses`,{...e,method:"POST",body:x}).then(P=>{P.status!==200&&P.status!==201?(console.log("Failed to send flow response for step "+f.stepId+". Will retry again later."),n([...i,f])):k||s(B=>[...B??[],f])})}async function y(f){f.foreignUserId&&(f.actionType===ct||f.actionType===Le?await u(f):f.actionType===J?await u(f):f.actionType===ao?await u(f):f.actionType===Oe?await u(f):f.actionType===lo?await u(f):f.actionType===Ae&&await u(f))}function E(){let f=[];return t==null||t.forEach(x=>{if(x&&x.stepStates&&Object.keys(x.stepStates).length!==0)for(let k in x.stepStates){let P=x.stepStates[k];f.push({foreignUserId:x.foreignUserId,flowSlug:x.flowId,stepId:P.stepId,actionType:P.actionType,data:{},createdAt:new Date(P.createdAt),blocked:P.blocked,hidden:P.hidden})}}),[...f,...r]}return{addResponse:y,setFlowResponses:s,getFlowResponses:E}}import pl from"swr";var nl=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,br=e=>{let t=nl.exec(e);if(t===null)return null;let o=null;return t.forEach((i,n)=>{let r=sl(i,"'","");r.startsWith("flow_")&&(o=r)}),o},sl=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function Q(){let{config:e}=Me(),{flows:t,setFlows:o,userId:i,publicApiKey:n,customVariables:r,setCustomVariables:s,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:c,setFlowResponses:a,setShouldGracefullyDegrade:C}=ll(Y),d={data:[]},{verifySDKInitiated:u}=Ft(),{addResponse:y,getFlowResponses:E}=Ht(),f=g=>fetch(g,e).then(b=>b.ok?b.json():(console.log(`Error fetching ${g} (${b.status}): ${b.statusText}. .Will gracefully degrade and hide Frigade`),C(!0),d)).catch(b=>(console.log(`Error fetching ${g}: ${b}. Will gracefully degrade and hide Frigade`),C(!0),d)),{userFlowStatesData:x,isLoadingUserFlowStateData:k,optimisticallyMarkFlowCompleted:P,optimisticallyMarkFlowNotStarted:B,optimisticallyMarkStepCompleted:F,optimisticallyMarkStepNotStarted:S,optimisticallyMarkStepStarted:m}=Ie(),{data:h,error:w,isLoading:I}=pl(n?`${be}flows`:null,f,{keepPreviousData:!0});al(()=>{if(w){console.error(w);return}h&&h.data&&(h.data=o(h.data))},[h,w]);function W(g){if(I)return null;let b=t.find(v=>v.slug===g);return!b&&t.length>0&&!k&&!I?(console.log(`Flow with slug ${g} not found`),null):(b==null?void 0:b.active)===!1?null:b}function H(g){var _;if(!W(g))return[];let b=W(g).data;return b?(b=A(b),(((_=JSON.parse(b))==null?void 0:_.data)??[]).map(de=>{let z=K(de);return{handleSecondaryButtonClick:()=>{de.skippable===!0&&D(g,de.id,{skipped:!0})},...de,complete:N(g,de.id)===Oe||z>=1,blocked:j(g,de.id),hidden:fe(g,de.id),handlePrimaryButtonClick:()=>{(!de.completionCriteria&&(de.autoMarkCompleted||de.autoMarkCompleted===void 0)||de.completionCriteria&&de.autoMarkCompleted===!0)&&D(g,de.id)},progress:z}}).filter(de=>de.hidden!==!0)):[]}function A(g){return g.replaceAll(/\${(.*?)}/g,(b,v)=>r[v]===void 0?"":String(r[v]).replace(/[\u00A0-\u9999<>\&]/g,function(_){return"&#"+_.charCodeAt(0)+";"}).replaceAll(/[\\]/g,"\\\\").replaceAll(/[\"]/g,'\\"').replaceAll(/[\/]/g,"\\/").replaceAll(/[\b]/g,"\\b").replaceAll(/[\f]/g,"\\f").replaceAll(/[\n]/g,"\\n").replaceAll(/[\r]/g,"\\r").replaceAll(/[\t]/g,"\\t"))}function U(g){if(!W(g))return[];let b=W(g).data;return b?(b=A(b),JSON.parse(b)??{}):[]}function $(g,b){s(v=>({...v,[g]:b}))}function O(g){!k&&!I&&g&&JSON.stringify(r)!=JSON.stringify({...r,...g})&&Object.keys(g).forEach(b=>{$(b,g[b])})}let se=mt(async(g,b,v)=>{u();let _={foreignUserId:i,flowSlug:g,stepId:b,actionType:ao,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};re(_)&&(await m(g,b,_),y(_))},[i,x]),pe=mt(async(g,b,v)=>{u();let _={foreignUserId:i,flowSlug:g,stepId:b,actionType:Ae,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};re(_)&&(await S(g,b),y(_))},[i,x]),D=mt(async(g,b,v)=>{u();let _={foreignUserId:i,flowSlug:g,stepId:b,actionType:Oe,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};re(_)&&(await F(g,b,_),y(_))},[i,x]),Te=mt(async(g,b)=>{if(u(),X(g)===Le)return;let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:Le,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};await B(g),re(v)&&y(v)},[i,x]),Fe=mt(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:ct,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};re(v)&&y(v)},[i,x]),ee=mt(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:J,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};re(v)&&(await P(g),y(v))},[i,x]),q=mt(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:lo,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};re(v)&&(await P(g),y(v))},[i,x]);function re(g){var b;if(!x&&g.actionType===Ae)return!1;if(x){let v=x.find(_=>_.flowId===g.flowSlug);if(g.actionType===Ae&&(!(v!=null&&v.stepStates[g.stepId])||v.stepStates[g.stepId].actionType===Ae)||v&&((b=v.stepStates[g.stepId])==null?void 0:b.actionType)===g.actionType||v&&v.flowState===J&&g.actionType===J)return!1}return!0}function N(g,b){let v=ke(g,b);return k?null:v?v.actionType:Ae}function j(g,b){let v=ke(g,b);return v?v.blocked:!1}function fe(g,b){let v=ke(g,b);return v?v.hidden:!1}function ke(g,b){if(k)return null;let v=x==null?void 0:x.find(_=>_.flowId===g);return!v||!v.stepStates[b]?null:v.stepStates[b]??null}function G(g){var v;if(k||!x)return null;if(X(g)===Le)return H(g)[0]??null;let b=(v=x.find(_=>_.flowId===g))==null?void 0:v.lastStepId;return b?H(g).find(_=>_.id===b):null}function ge(g){let b=G(g);if(!b)return 0;let v=H(g).findIndex(_=>_.id===b.id)??0;return N(g,b.id)===Oe&&v<H(g).length-1?v+1:v}function K(g){if(!g.completionCriteria)return;let b=br(g.completionCriteria);if(b===null)return;let v=je(b),_=Ge(b);return _===0?void 0:v/_}function X(g){let b=x==null?void 0:x.find(v=>v.flowId===g);return b?b.flowState:null}function je(g){let b=H(g);return b.length===0?0:b.filter(_=>N(g,_.id)===Oe).length}function Ge(g){return H(g).length}function wt(g){return JSON.parse(t.find(b=>b.slug===g).data)}function V(g){if(k)return!0;if(g!=null&&g.targetingLogic&&x){let b=x.find(v=>v.flowId===g.slug);if(b)return b.shouldTrigger===!1}return!!(g!=null&&g.targetingLogic&&i&&i.startsWith("guest_"))}function Be(g){return!V(W(g))}return{getFlow:W,getFlowData:wt,isLoading:k||I,getStepStatus:N,getFlowSteps:H,getCurrentStepIndex:ge,markStepStarted:se,markStepCompleted:D,markFlowNotStarted:Te,markFlowStarted:Fe,markFlowCompleted:ee,markFlowAborted:q,markStepNotStarted:pe,getFlowStatus:X,getNumberOfStepsCompleted:je,getNumberOfSteps:Ge,targetingLogicShouldHideFlow:V,setCustomVariable:$,updateCustomVariables:O,customVariables:r,getStepOptionalProgress:K,getFlowMetadata:U,isStepBlocked:j,isStepHidden:fe,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:c,isFlowAvailableToUser:Be}}import{useCallback as wr,useContext as dl,useEffect as cl}from"react";var kt="guest_";function Vt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:n}=dl(Y),{config:r}=Me(),{mutateUserFlowState:s}=Ie(),p=Tt(),{verifySDKInitiated:c}=Ft();cl(()=>{if(e&&!t){if(e.startsWith(kt))return;let d=`frigade-user-registered-${e}`;localStorage.getItem(d)||(p(`${be}users`,{...r,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(d,"true"))}},[e,n,t]);let a=wr(async d=>{c();let u={foreignId:e,properties:d};await p(`${be}users`,{...r,method:"POST",body:JSON.stringify(u)}),i(y=>({...y,...d})),s()},[e,r,n,s]),C=wr(async(d,u)=>{c();let E={foreignId:e,events:[{event:d,properties:u}]};await p(`${be}users`,{...r,method:"POST",body:JSON.stringify(E)}),s()},[e,r,s]);return{userId:e,setUserId:o,addPropertiesToUser:a,trackEventForUser:C}}import{v4 as _a}from"uuid";import _e,{useEffect as Oa,useState as Da}from"react";import De,{useEffect as Cl}from"react";import mo from"styled-components";import ml from"react";import ul from"styled-components";var Tr="fr-",jt="cfr-";function l(e,t){let o=`${Tr}${e}`;if(!t)return o;if(t.styleOverrides&&t.styleOverrides[e]){if(typeof t.styleOverrides[e]=="string")return o+" "+t.styleOverrides[e];if(typeof t.styleOverrides[e]=="object")return o+" "+jt+e}return o}function T(e){if(!e.className||e.className.indexOf(jt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(Tr)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Mo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function Ke(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Mo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function xe(...e){return e.filter(Boolean).join(" ")}function Gt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var fl=ul.div`
|
|
2
|
+
import ht,{createContext as za,useEffect as ko,useState as Ne}from"react";import{ThemeProvider as Wa}from"styled-components";import gt,{useContext as Ua,useEffect as Fo,useState as or}from"react";import{useCallback as mt,useContext as ll,useEffect as al}from"react";import $o,{useMemo as Xs}from"react";var Sr="1.32.78 ";var we="https://api.frigade.com/v1/public/",Ae="NOT_STARTED_STEP",X="COMPLETED_FLOW",lo="ABORTED_FLOW",ct="STARTED_FLOW",Le="NOT_STARTED_FLOW",Oe="COMPLETED_STEP",ao="STARTED_STEP";function Me(){let{publicApiKey:e,userId:t}=$o.useContext(K);return{config:Xs(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Sr,"X-Frigade-SDK-Platform":"React"}}),[e,t])}}var Js="frigade-last-call-at-",Qs="frigade-last-call-data-";function Tt(){let{shouldGracefullyDegrade:e}=$o.useContext(K);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),Wt();let i=Js+t,n=Qs+t;if(window&&window.localStorage&&o&&o.body&&o.method==="POST"){let s=window.localStorage.getItem(i),d=window.localStorage.getItem(n);if(s&&d&&d==o.body){let c=new Date(s);if(new Date().getTime()-c.getTime()<1e3)return Wt()}window.localStorage.setItem(i,new Date().toISOString()),window.localStorage.setItem(n,o.body)}let r;try{r=await fetch(t,o)}catch(s){return Wt(s)}return r?r.ok?r:Wt(r.statusText):Wt()}}function Wt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Ft(){let{publicApiKey:e,shouldGracefullyDegrade:t}=$o.useContext(K);function o(){if(t){console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize");return}e||console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider")}return{verifySDKInitiated:o}}import{useContext as il,useState as yr}from"react";import{useContext as Rs,useEffect as el,useState as tl}from"react";import ol from"swr";import{useContext as Zs}from"react";function Pe(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:n}=Zs(K);function r(p,f=!1){return e[p]??f}function s(p,f){t(y=>({...y,[p]:f}))}function d(p){t(f=>{let{[p]:y,...E}=f;return{...E}})}function c(p){n.includes(p)||i(f=>[...f,p])}function a(p){return n.includes(p)}function C(p){return Object.entries(e).some(([f,y])=>y&&f!=p)||o}return{getOpenFlowState:r,setOpenFlowState:s,resetOpenFlowState:d,hasOpenModals:C,setKeepCompletedFlowOpenDuringSession:c,shouldKeepCompletedFlowOpenDuringSession:a}}var rl="unknown";function Ie(){let{config:e}=Me(),{publicApiKey:t,userId:o,organizationId:i,flows:n,setShouldGracefullyDegrade:r}=Rs(K),{resetOpenFlowState:s}=Pe(),[d,c]=tl(!1),a={data:n.map(h=>({flowId:h.id,flowState:X,lastStepId:null,userId:o,foreignUserId:o,stepStates:{},shouldTrigger:!1}))},C=h=>fetch(h,e).then(m=>{if(m.ok)return m.json();throw new Error("Failed to fetch user flow states")}).catch(m=>(console.log(`Error fetching ${h}: ${m}. Will gracefully degrade and hide Frigade`),r(!0),a)),{data:p,isLoading:f,mutate:y,error:E}=ol(t&&n&&o?`${we}userFlowStates?foreignUserId=${encodeURIComponent(o)}${i?`&foreignUserGroupId=${encodeURIComponent(i)}`:""}`:null,C,{revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>a,onLoadingSlow:()=>a}),u=p==null?void 0:p.data;el(()=>{!d&&!f&&u&&c(!0)},[u,d,f]);async function x(h){if(u){let m=u.find(S=>S.flowId===h);m&&m.flowState!==X&&(m.flowState=X),await y(Promise.resolve({...p,data:u}),{optimisticData:{...p,data:u},revalidate:!1,rollbackOnError:!1})}}async function v(h,m,S){if(u){let w=u.find(I=>I.flowId===h);w&&(w.stepStates[m]=S,w.flowState=ct),await y(Promise.resolve({...p,data:u}),{optimisticData:{...p,data:u},revalidate:!1,rollbackOnError:!1})}}async function k(h,m,S){if(u){let w=u.find(I=>I.flowId===h);w&&(w.lastStepId=m,w.stepStates[m]=S,w.flowState=ct),await y({...p,data:u},{optimisticData:{...p,data:u},revalidate:!1,rollbackOnError:!1})}}async function B(h){if(u){let m=u.find(S=>S.flowId===h);m&&m.flowState!==Le&&(m.flowState=Le,m.lastStepId=rl,Object.keys(m.stepStates).forEach(S=>{m.stepStates[S].actionType=Ae,m.stepStates[S].createdAt=new Date().toISOString()}),await y({...p,data:u},{optimisticData:{...p,data:u},revalidate:!1,rollbackOnError:!1}),s(h))}}async function F(h,m){if(u){let S=u.find(w=>w.flowId===h);S&&S.stepStates[m]!==Ae&&(S.stepStates[m]=Ae),await y({...p,data:u},{optimisticData:{...p,data:u},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:u,isLoadingUserFlowStateData:!d,mutateUserFlowState:y,optimisticallyMarkFlowCompleted:x,optimisticallyMarkFlowNotStarted:B,optimisticallyMarkStepCompleted:v,optimisticallyMarkStepNotStarted:F,optimisticallyMarkStepStarted:k,error:E}}function Ht(){let{config:e}=Me(),{userFlowStatesData:t,mutateUserFlowState:o}=Ie(),{failedFlowResponses:i,setFailedFlowResponses:n,flowResponses:r,setFlowResponses:s}=il(K),[d,c]=yr(new Set),[a,C]=yr(new Set),p=Tt();function f(u){let x=JSON.stringify(u);if(d.has(x))return null;d.add(x),c(d),a.add(u),C(a);let v=r==null?void 0:r.find(k=>k.flowSlug===u.flowSlug&&k.stepId===u.stepId&&k.actionType===u.actionType&&k.createdAt===u.createdAt);return p(`${we}flowResponses`,{...e,method:"POST",body:x}).then(k=>{k.status!==200&&k.status!==201?(console.log("Failed to send flow response for step "+u.stepId+". Will retry again later."),n([...i,u])):v||s(B=>[...B??[],u])})}async function y(u){u.foreignUserId&&(u.actionType===ct||u.actionType===Le?await f(u):u.actionType===X?await f(u):u.actionType===ao?await f(u):u.actionType===Oe?await f(u):u.actionType===lo?await f(u):u.actionType===Ae&&await f(u))}function E(){let u=[];return t==null||t.forEach(x=>{if(x&&x.stepStates&&Object.keys(x.stepStates).length!==0)for(let v in x.stepStates){let k=x.stepStates[v];u.push({foreignUserId:x.foreignUserId,flowSlug:x.flowId,stepId:k.stepId,actionType:k.actionType,data:{},createdAt:new Date(k.createdAt),blocked:k.blocked,hidden:k.hidden})}}),[...u,...r]}return{addResponse:y,setFlowResponses:s,getFlowResponses:E}}import pl from"swr";var nl=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,br=e=>{let t=nl.exec(e);if(t===null)return null;let o=null;return t.forEach((i,n)=>{let r=sl(i,"'","");r.startsWith("flow_")&&(o=r)}),o},sl=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function J(){let{config:e}=Me(),{flows:t,setFlows:o,userId:i,publicApiKey:n,customVariables:r,setCustomVariables:s,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:c,setFlowResponses:a,setShouldGracefullyDegrade:C}=ll(K),p={data:[]},{verifySDKInitiated:f}=Ft(),{addResponse:y,getFlowResponses:E}=Ht(),u=g=>fetch(g,e).then(b=>b.ok?b.json():(console.log(`Error fetching ${g} (${b.status}): ${b.statusText}. .Will gracefully degrade and hide Frigade`),C(!0),p)).catch(b=>(console.log(`Error fetching ${g}: ${b}. Will gracefully degrade and hide Frigade`),C(!0),p)),{userFlowStatesData:x,isLoadingUserFlowStateData:v,optimisticallyMarkFlowCompleted:k,optimisticallyMarkFlowNotStarted:B,optimisticallyMarkStepCompleted:F,optimisticallyMarkStepNotStarted:h,optimisticallyMarkStepStarted:m}=Ie(),{data:S,error:w,isLoading:I}=pl(n?`${we}flows`:null,u,{keepPreviousData:!0});al(()=>{if(w){console.error(w);return}S&&S.data&&(S.data=o(S.data))},[S,w]);function H(g){if(I)return null;let b=t.find(P=>P.slug===g);return!b&&t.length>0&&!v&&!I?(console.log(`Flow with slug ${g} not found`),null):(b==null?void 0:b.active)===!1?null:b}function V(g){var z;if(!H(g))return[];let b=H(g).data;return b?(b=A(b),(((z=JSON.parse(b))==null?void 0:z.data)??[]).map(me=>{let W=q(me);return{handleSecondaryButtonClick:()=>{me.skippable===!0&&N(g,me.id,{skipped:!0})},...me,complete:he(g,me.id)===Oe||W>=1,blocked:ie(g,me.id),hidden:L(g,me.id),handlePrimaryButtonClick:()=>{(!me.completionCriteria&&(me.autoMarkCompleted||me.autoMarkCompleted===void 0)||me.completionCriteria&&me.autoMarkCompleted===!0)&&N(g,me.id)},progress:W}}).filter(me=>me.hidden!==!0)):[]}function A(g){return g.replaceAll(/\${(.*?)}/g,(b,P)=>r[P]===void 0?"":String(r[P]).replace(/[\u00A0-\u9999<>\&]/g,function(z){return"&#"+z.charCodeAt(0)+";"}).replaceAll(/[\\]/g,"\\\\").replaceAll(/[\"]/g,'\\"').replaceAll(/[\/]/g,"\\/").replaceAll(/[\b]/g,"\\b").replaceAll(/[\f]/g,"\\f").replaceAll(/[\n]/g,"\\n").replaceAll(/[\r]/g,"\\r").replaceAll(/[\t]/g,"\\t"))}function U(g){if(!H(g))return[];let b=H(g).data;return b?(b=A(b),JSON.parse(b)??{}):[]}function D(g,b){s(P=>({...P,[g]:b}))}function $(g){!v&&!I&&g&&JSON.stringify(r)!=JSON.stringify({...r,...g})&&Object.keys(g).forEach(b=>{D(b,g[b])})}let le=mt(async(g,b,P)=>{f();let z={foreignUserId:i,flowSlug:g,stepId:b,actionType:ao,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};re(z)&&(await m(g,b,z),y(z))},[i,x]),ce=mt(async(g,b,P)=>{f();let z={foreignUserId:i,flowSlug:g,stepId:b,actionType:Ae,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};re(z)&&(await h(g,b),y(z))},[i,x]),N=mt(async(g,b,P)=>{f();let z={foreignUserId:i,flowSlug:g,stepId:b,actionType:Oe,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};re(z)&&(await F(g,b,z),y(z))},[i,x]),Fe=mt(async(g,b)=>{if(f(),Y(g)===Le)return;let P={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:Le,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};await B(g),re(P)&&y(P)},[i,x]),ke=mt(async(g,b)=>{f();let P={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:ct,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};re(P)&&y(P)},[i,x]),R=mt(async(g,b)=>{f();let P={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:X,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};re(P)&&(await k(g),y(P))},[i,x]),G=mt(async(g,b)=>{f();let P={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:lo,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};re(P)&&(await k(g),y(P))},[i,x]);function re(g){var b;if(!x&&g.actionType===Ae)return!1;if(x){let P=x.find(z=>z.flowId===g.flowSlug);if(g.actionType===Ae&&(!(P!=null&&P.stepStates[g.stepId])||P.stepStates[g.stepId].actionType===Ae)||P&&((b=P.stepStates[g.stepId])==null?void 0:b.actionType)===g.actionType||P&&P.flowState===X&&g.actionType===X)return!1}return!0}function he(g,b){let P=ee(g,b);return v?null:P?P.actionType:Ae}function ie(g,b){let P=ee(g,b);return P?P.blocked:!1}function L(g,b){let P=ee(g,b);return P?P.hidden:!1}function ee(g,b){if(v)return null;let P=x==null?void 0:x.find(z=>z.flowId===g);return!P||!P.stepStates[b]?null:P.stepStates[b]??null}function _(g){var P;if(v||!x)return null;if(Y(g)===Le)return V(g)[0]??null;let b=(P=x.find(z=>z.flowId===g))==null?void 0:P.lastStepId;return b?V(g).find(z=>z.id===b):null}function ae(g){let b=_(g);if(!b)return 0;let P=V(g).findIndex(z=>z.id===b.id)??0;return he(g,b.id)===Oe&&P<V(g).length-1?P+1:P}function q(g){if(!g.completionCriteria)return;let b=br(g.completionCriteria);if(b===null)return;let P=je(b),z=Ge(b);return z===0?void 0:P/z}function Y(g){let b=x==null?void 0:x.find(P=>P.flowId===g);return b?b.flowState:null}function je(g){let b=V(g);return b.length===0?0:b.filter(z=>he(g,z.id)===Oe).length}function Ge(g){return V(g).length}function wt(g){return JSON.parse(t.find(b=>b.slug===g).data)}function j(g){if(v)return!0;if(g!=null&&g.targetingLogic&&x){let b=x.find(P=>P.flowId===g.slug);if(b)return b.shouldTrigger===!1}return!!(g!=null&&g.targetingLogic&&i&&i.startsWith("guest_"))}function Be(g){return!j(H(g))}return{getFlow:H,getFlowData:wt,isLoading:v||I,getStepStatus:he,getFlowSteps:V,getCurrentStepIndex:ae,markStepStarted:le,markStepCompleted:N,markFlowNotStarted:Fe,markFlowStarted:ke,markFlowCompleted:R,markFlowAborted:G,markStepNotStarted:ce,getFlowStatus:Y,getNumberOfStepsCompleted:je,getNumberOfSteps:Ge,targetingLogicShouldHideFlow:j,setCustomVariable:D,updateCustomVariables:$,customVariables:r,getStepOptionalProgress:q,getFlowMetadata:U,isStepBlocked:ie,isStepHidden:L,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:c,isFlowAvailableToUser:Be}}import{useCallback as wr,useContext as dl,useEffect as cl}from"react";var kt="guest_";function Vt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:n}=dl(K),{config:r}=Me(),{mutateUserFlowState:s}=Ie(),d=Tt(),{verifySDKInitiated:c}=Ft();cl(()=>{if(e&&!t){if(e.startsWith(kt))return;let p=`frigade-user-registered-${e}`;localStorage.getItem(p)||(d(`${we}users`,{...r,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(p,"true"))}},[e,n,t]);let a=wr(async p=>{c();let f={foreignId:e,properties:p};await d(`${we}users`,{...r,method:"POST",body:JSON.stringify(f)}),i(y=>({...y,...p})),s()},[e,r,n,s]),C=wr(async(p,f)=>{c();let E={foreignId:e,events:[{event:p,properties:f}]};await d(`${we}users`,{...r,method:"POST",body:JSON.stringify(E)}),s()},[e,r,s]);return{userId:e,setUserId:o,addPropertiesToUser:a,trackEventForUser:C}}import{v4 as _a}from"uuid";import _e,{useEffect as Oa,useState as Da}from"react";import De,{useEffect as Cl}from"react";import mo from"styled-components";import ml from"react";import ul from"styled-components";var Tr="fr-",jt="cfr-";function l(e,t){let o=`${Tr}${e}`;if(!t)return o;if(t.styleOverrides&&t.styleOverrides[e]){if(typeof t.styleOverrides[e]=="string")return o+" "+t.styleOverrides[e];if(typeof t.styleOverrides[e]=="object")return o+" "+jt+e}return o}function T(e){if(!e.className||e.className.indexOf(jt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(Tr)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Mo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function Ke(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Mo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Ce(...e){return e.filter(Boolean).join(" ")}function Gt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var fl=ul.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -188,7 +188,7 @@ import ht,{createContext as za,useEffect as ko,useState as Ne}from"react";import
|
|
|
188
188
|
::-webkit-scrollbar {
|
|
189
189
|
display: none;
|
|
190
190
|
}
|
|
191
|
-
`,rt=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:n,appearance:r,dismissible:s=!0,showFrigadeBranding:
|
|
191
|
+
`,rt=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:n,appearance:r,dismissible:s=!0,showFrigadeBranding:d=!1})=>(Cl(()=>{let c=a=>{a.key==="Escape"&&e()};return document.addEventListener("keydown",c),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",c)}},[e,t]),t?De.createElement(Sl,null,De.createElement(Fr,{appearance:r,onClose:()=>{s&&e()}}),De.createElement(yl,{appearance:r,className:l("modalContainer",r),styleOverrides:i},s&&De.createElement(wl,{className:l("modalClose",r),onClick:()=>e(),appearance:r},De.createElement(ve,null)),o&&De.createElement(bl,null,o),De.createElement(Tl,null,n),d&&De.createElement(Lr,{appearance:r,className:l("poweredByFrigadeRibbon",r)},De.createElement(co,{appearance:r})))):De.createElement(De.Fragment,null));import it,{useEffect as Fl}from"react";import uo from"styled-components";import{Portal as kl}from"react-portal";var Pl=uo.div`
|
|
192
192
|
${e=>T(e)} {
|
|
193
193
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
194
194
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -225,7 +225,7 @@ import ht,{createContext as za,useEffect as ko,useState as Ne}from"react";import
|
|
|
225
225
|
::-webkit-scrollbar {
|
|
226
226
|
display: none;
|
|
227
227
|
}
|
|
228
|
-
`,Mr=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:n})=>(Fl(()=>{let r=s=>{s.key==="Escape"&&e()};return document.addEventListener("keydown",r),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",r)}},[e,t]),t?it.createElement(kl,null,it.createElement(Pl,{appearance:n,className:l("cornerModalContainer",n)},it.createElement(El,{className:l("cornerModalClose",n),onClick:()=>e()},it.createElement(ve,null)),o&&it.createElement(vl,null,o),it.createElement(Bl,null,i))):it.createElement(it.Fragment,null));import{useContext as Al}from"react";function
|
|
228
|
+
`,Mr=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:n})=>(Fl(()=>{let r=s=>{s.key==="Escape"&&e()};return document.addEventListener("keydown",r),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",r)}},[e,t]),t?it.createElement(kl,null,it.createElement(Pl,{appearance:n,className:l("cornerModalContainer",n)},it.createElement(El,{className:l("cornerModalClose",n),onClick:()=>e()},it.createElement(ve,null)),o&&it.createElement(vl,null,o),it.createElement(Bl,null,i))):it.createElement(it.Fragment,null));import{useContext as Al}from"react";function Q(){let{defaultAppearance:e}=Al(K);function t(o){let i=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign(i.styleOverrides??{},o.styleOverrides??{}),theme:Object.assign(i.theme,o.theme??{})}:i}return{mergeAppearanceWithDefault:t}}import st,{useEffect as ea,useState as Xo}from"react";import Co from"styled-components";import ho,{useEffect as Il,useState as Vr}from"react";import Vo from"styled-components";import fo from"styled-components";var Ur=fo.label`
|
|
229
229
|
${e=>T(e)} {
|
|
230
230
|
font-size: 14px;
|
|
231
231
|
line-height: 20px;
|
|
@@ -289,7 +289,7 @@ import ht,{createContext as za,useEffect as ko,useState as Ne}from"react";import
|
|
|
289
289
|
min-height: 70px;
|
|
290
290
|
box-sizing: border-box;
|
|
291
291
|
margin-bottom: 10px;
|
|
292
|
-
`;function Go({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:n}){let r=e,[s,
|
|
292
|
+
`;function Go({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:n}){let r=e,[s,d]=Vr((n==null?void 0:n.text)||""),[c,a]=Vr(!1),C=jo;Il(()=>{s===""&&!c&&(a(!0),p(""))},[]);function p(y){if(d(y),o({text:y}),r.required===!0&&y.trim()===""){i([{id:r.id,message:`${r.title??"Field"} is required`}]);return}let E=Hr(y,r.validation);if(E){i([{id:r.id,message:E}]);return}i([])}r.multiline&&(C=Ll);function f(){var y;switch((y=r==null?void 0:r.validation)==null?void 0:y.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return ho.createElement(Nl,null,ho.createElement(nt,{title:r.title,required:r.required,appearance:t.appearance}),ho.createElement(C,{className:l("inputComponent",t.appearance),value:s,onChange:y=>{p(y.target.value)},appearance:t.appearance,placeholder:r.placeholder,type:f()}),ho.createElement(Pt,{title:r.subtitle,appearance:t.appearance}))}import Ue,{useEffect as jr,useState as Gr}from"react";import qr from"styled-components";var qo="",Ol=qr.div`
|
|
293
293
|
display: flex;
|
|
294
294
|
flex-direction: column;
|
|
295
295
|
width: 100%;
|
|
@@ -316,9 +316,9 @@ import ht,{createContext as za,useEffect as ko,useState as Ne}from"react";import
|
|
|
316
316
|
background-repeat: no-repeat;
|
|
317
317
|
background-size: 1.5em 1.5em;
|
|
318
318
|
-webkit-print-color-adjust: exact;
|
|
319
|
-
`;function Kr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var C,
|
|
319
|
+
`;function Kr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var C,p,f,y,E,u;let r=e,[s,d]=Gr(((C=i==null?void 0:i.choice)==null?void 0:C[0])||""),[c,a]=Gr(!1);return jr(()=>{var x,v,k,B;if(s===""&&!c){if(a(!0),r.requireSelection){d(qo);return}if(r.defaultValue&&((x=r.props.options)!=null&&x.find(F=>F.id===r.defaultValue))){let F=(v=r.props.options)==null?void 0:v.find(h=>h.id===r.defaultValue);d(F.id),o({choice:[F.id]})}else d(((k=r.props.options)==null?void 0:k[0].id)||""),o({choice:[((B=r.props.options)==null?void 0:B[0].id)||""]})}},[]),jr(()=>{r.requireSelection&&s===qo?n([{message:"Please select an option",id:r.id}]):n([])},[s]),Ue.createElement(Ol,null,Ue.createElement(nt,{title:r.title,required:!1,appearance:t.appearance}),Ue.createElement(Dl,{value:s,onChange:x=>{d(x.target.value),o({choice:[x.target.value]})},placeholder:r.placeholder,appearance:t.appearance,className:l("multipleChoiceSelect",t.appearance)},r.requireSelection&&Ue.createElement("option",{key:"null-value",value:qo,disabled:!0},r.placeholder??"Select an option"),(p=r.props.options)==null?void 0:p.map(x=>Ue.createElement("option",{key:x.id,value:x.id},x.title))),((y=(f=r.props.options)==null?void 0:f.find(x=>x.id===s))==null?void 0:y.isOpenEnded)&&Ue.createElement(Ue.Fragment,null,Ue.createElement(nt,{title:((u=(E=r.props.options)==null?void 0:E.find(x=>x.id===s))==null?void 0:u.openEndedLabel)??"Please specify",required:!1,appearance:t.appearance}),Ue.createElement(jo,{type:"text",placeholder:"Enter your answer here",onChange:x=>{o({choice:[x.target.value]})},appearance:t.appearance})),Ue.createElement(Pt,{title:r.subtitle,appearance:t.appearance}))}import Yt,{useEffect as Ko,useState as Xr}from"react";import Jr from"styled-components";import Kt from"react";import qt from"react";import{motion as $l}from"framer-motion";var Yr=({color:e,percentage:t,size:o})=>{let i=o*.5-2,n=2*Math.PI*i,r=(1-t)*n,s={duration:.3,delay:0,ease:"easeIn"},d={hidden:{strokeDashoffset:n,transition:s},show:{strokeDashoffset:r,transition:s}};return qt.createElement($l.circle,{r:i,cx:o*.5,cy:o*.5,fill:"transparent",stroke:r!==n?e:"",strokeWidth:"3px",strokeDasharray:n,strokeDashoffset:t?r:0,variants:d,transition:s,initial:"hidden",animate:"show"})},Ml=({fillColor:e,size:t,percentage:o,children:i,bgColor:n="#D9D9D9",className:r,style:s})=>qt.createElement("svg",{style:s,className:r,width:t,height:t,overflow:"visible"},qt.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},qt.createElement(Yr,{color:n,size:t}),qt.createElement(Yr,{color:e,percentage:o,size:t})),i),vt=Ml;import Ul from"styled-components";var _l=({color:e="#FFFFFF"})=>Kt.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Kt.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),zl={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},Wl={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},Hl={border:"1px solid #000000",color:"#FFFFFF"},Vl={border:"1px solid #E6E6E6"},jl={color:"#FFFFFF"},Gl={border:"3px solid #D9D9D9"},ql=e=>e==="square"?zl:Wl,Kl=(e,t)=>e==="square"?t?Hl:Vl:t?jl:Gl,Yl=Ul.div`
|
|
320
320
|
${e=>Ke(e)}
|
|
321
|
-
`,Xe=({value:e,type:t="square",primaryColor:o="#000000",progress:i,appearance:n=Ye,style:r,className:s})=>{let
|
|
321
|
+
`,Xe=({value:e,type:t="square",primaryColor:o="#000000",progress:i,appearance:n=Ye,style:r,className:s})=>{let d=ql(t),c=Kl(t,e);return e===!0?d={...d,...c,backgroundColor:o,borderColor:t==="square"?o:"none"}:d={...d,...c},e!==!0&&t==="round"&&i!==void 0&&i!==1?Kt.createElement(vt,{fillColor:o,percentage:i,size:22}):Kt.createElement(Yl,{styleOverrides:d,style:r,role:"checkbox",className:Ce(l("checkIconContainer",n),l(e?"checkIconContainerChecked":"checkIconContainerUnchecked",n),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&Kt.createElement(_l,{color:"#FFFFFF"}))};var Xl=Jr.div`
|
|
322
322
|
display: flex;
|
|
323
323
|
flex-direction: column;
|
|
324
324
|
width: 100%;
|
|
@@ -349,7 +349,7 @@ import ht,{createContext as za,useEffect as ko,useState as Ne}from"react";import
|
|
|
349
349
|
height: 60px;
|
|
350
350
|
padding: 0 18px;
|
|
351
351
|
margin-bottom: 10px;
|
|
352
|
-
`;function Qr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var C;let r=e,[s,
|
|
352
|
+
`;function Qr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var C;let r=e,[s,d]=Xr((i==null?void 0:i.choice)||[]),[c,a]=Xr(!1);return Ko(()=>{s.length==0&&!c&&(a(!0),o({choice:[]}))},[]),Ko(()=>{o({choice:s})},[s]),Ko(()=>{r.required&&(s.length<r.props.minChoices||s.length>r.props.maxChoices)?n([{message:"",id:r.id}]):n([])},[s]),Yt.createElement(Xl,null,Yt.createElement(nt,{title:r.title,required:r.required,appearance:t.appearance}),(C=r.props.options)==null?void 0:C.map(p=>Yt.createElement(Jl,{appearance:t.appearance,className:l("multipleChoiceListItem",t.appearance),key:p.id,value:p.id,"data-selected":s.includes(p.id),onClick:()=>{if(s.includes(p.id)){d(s.filter(f=>f!==p.id));return}s.length<r.props.maxChoices?d([...s,p.id]):s.length==1&&r.props.maxChoices==1&&d([p.id])}},p.title,Yt.createElement(Xe,{type:"round",primaryColor:t.appearance.theme.colorPrimary,value:s.includes(p.id),appearance:t.appearance}))),Yt.createElement(Pt,{title:r.subtitle,appearance:t.appearance}))}import xo from"react";import Zr from"styled-components";import Ql from"dompurify";function ue(e){return{__html:Ql.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var Zl=Zr.h1`
|
|
353
353
|
${e=>T(e)} {
|
|
354
354
|
font-style: normal;
|
|
355
355
|
font-weight: 600;
|
|
@@ -368,7 +368,7 @@ import ht,{createContext as za,useEffect as ko,useState as Ne}from"react";import
|
|
|
368
368
|
line-height: 20px;
|
|
369
369
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
370
370
|
}
|
|
371
|
-
`;function
|
|
371
|
+
`;function Se({appearance:e,title:t,subtitle:o,size:i="medium",classPrefix:n=""}){return xo.createElement(xo.Fragment,null,xo.createElement(Zl,{appearance:e,className:l(`${n}${n?Gt(i):i}Title`,e),dangerouslySetInnerHTML:ue(t),size:i}),o&&xo.createElement(Rl,{appearance:e,className:l(`${n}${n?Gt(i):i}Subtitle`,e),dangerouslySetInnerHTML:ue(o),size:i}))}import*as Yo from"react";var Rr=e=>Yo.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:12,height:12,"aria-hidden":"true",viewBox:"0 0 16 16",...e},Yo.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"m10.115 1.308 5.635 11.269A2.365 2.365 0 0 1 13.634 16H2.365A2.365 2.365 0 0 1 .25 12.577L5.884 1.308a2.365 2.365 0 0 1 4.231 0zM8 10.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM8 9c.552 0 1-.32 1-.714V4.714C9 4.32 8.552 4 8 4s-1 .32-1 .714v3.572C7 8.68 7.448 9 8 9z"}));import{AnimatePresence as ta,motion as oa}from"framer-motion";var ra=Co.div`
|
|
372
372
|
display: flex;
|
|
373
373
|
flex-direction: column;
|
|
374
374
|
justify-content: flex-end;
|
|
@@ -386,7 +386,7 @@ import ht,{createContext as za,useEffect as ko,useState as Ne}from"react";import
|
|
|
386
386
|
`,sa=Co.div`
|
|
387
387
|
padding-left: 1px;
|
|
388
388
|
padding-right: 1px;
|
|
389
|
-
`,la={text:Go,multipleChoice:Kr,multipleChoiceList:Qr};function ei({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r,customFormElements:s}){var B;let
|
|
389
|
+
`,la={text:Go,multipleChoice:Kr,multipleChoiceList:Qr};function ei({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r,customFormElements:s}){var B;let d=t.props,[c,a]=Xo([]),[C,p]=Xo([]),{userId:f}=Vt(),[y,E]=Xo(v()||{}),u={...la,...s};ea(()=>{i(c.length===0)},[c,i]);function x(F,h){let m={...y,[F.id]:h};E(m),n(m),window&&window.localStorage&&window.localStorage.setItem(k(),JSON.stringify(m))}function v(){if(window&&window.localStorage){let F=window.localStorage.getItem(k());if(F)return JSON.parse(F)}return{}}function k(){return`frigade-multiInputStepTypeData-${e}-${t.id}-${f}`}return st.createElement(sa,{className:l("multiInput",r)},st.createElement(Se,{appearance:r,title:t.title,subtitle:t.subtitle}),st.createElement(ra,{className:l("multiInputContainer",r)},(B=d.data)==null?void 0:B.map(F=>{var m;let h=(m=c.reverse().find(S=>S.id===F.id))==null?void 0:m.message;return u[F.type]?st.createElement("span",{key:F.id,"data-field-id":F.id,className:l("multiInputField",r)},u[F.type]({formInput:F,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r},onSaveInputData:S=>{!C.includes(F.id)&&S&&(S==null?void 0:S.text)!==""&&p(w=>[...w,F.id]),x(F,S)},inputData:y[F.id],setFormValidationErrors:S=>{a(w=>S.length===0?w.filter(I=>I.id!==F.id):[...w,...S])}}),st.createElement(ta,null,h&&C.includes(F.id)&&st.createElement(ia,{initial:{opacity:0,height:0,marginBottom:0},animate:{opacity:1,height:"auto",marginBottom:12},exit:{opacity:0,height:0,marginBottom:0},key:F.id,style:{overflow:"hidden"},transition:{duration:.1,ease:"easeInOut",delay:.5},appearance:r,className:l("multiInputValidationError",r)},st.createElement(na,{appearance:r,className:l("multiInputValidationErrorIcon",r)},st.createElement(Rr,null)),h))):null})))}import ut from"styled-components";var ti=ut.div`
|
|
390
390
|
align-items: center;
|
|
391
391
|
display: flex;
|
|
392
392
|
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
@@ -466,9 +466,9 @@ import ht,{createContext as za,useEffect as ko,useState as Ne}from"react";import
|
|
|
466
466
|
margin-right: 8px;
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
`,te=({onClick:e,title:t,style:o,disabled:i,type:n="inline",size:r="medium",secondary:s=!1,appearance:
|
|
469
|
+
`,te=({onClick:e,title:t,style:o,disabled:i,type:n="inline",size:r="medium",secondary:s=!1,appearance:d,withMargin:c=!0,classPrefix:a=""})=>{function C(){let p=s?"buttonSecondary":"button";return a===""?p:`${a}${Gt(p)}`}return aa.createElement(pa,{secondary:s,appearance:d,disabled:i,onClick:e,styleOverrides:o,type:n,withMargin:c,size:r,className:l(C(),d)},t)};var pi=({step:e,canContinue:t,appearance:o,onPrimaryClick:i,onSecondaryClick:n,formType:r,selectedStep:s,steps:d,onBack:c,allowBackNavigation:a,errorMessage:C})=>{let p=r==="inline"?"inline":"full-width",f=d.length>1&&s!=0&&a;return lt.createElement(lt.Fragment,null,C&<.createElement(oi,{appearance:o,className:l("formCTAError",o)},C),lt.createElement(ti,{showBackButton:f,className:l("formCTAContainer",o)},f&<.createElement(te,{title:e.backButtonTitle??"\u2190",onClick:c,secondary:!0,withMargin:!1,type:p,appearance:o,style:{width:"90px",maxWidth:"90px"},classPrefix:"back"}),lt.createElement(ri,{className:l("ctaWrapper",o)},e.secondaryButtonTitle?lt.createElement(te,{title:e.secondaryButtonTitle,onClick:n,secondary:!0,withMargin:!1,type:p,appearance:o}):null," ",e.primaryButtonTitle?lt.createElement(te,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:i,type:p,appearance:o}):null)))};import Jo from"react";import da from"styled-components";var ca=da.div`
|
|
470
470
|
text-align: center;
|
|
471
|
-
`,di=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:n}=
|
|
471
|
+
`,di=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:n}=Q().mergeAppearanceWithDefault(i);return Jo.createElement(ca,{className:o},Jo.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((r,s)=>Jo.createElement("rect",{key:s,x:16*s,y:0,width:8,height:8,rx:4,fill:t===s?n.colorPrimary:"#E6E6E6"}))))};import ft from"react";import Et from"styled-components";import{useContext as ma}from"react";function ne(){let e=ma(K);function t(n){i(n.primaryButtonUri,n.primaryButtonUriTarget)}function o(n){i(n.secondaryButtonUri,n.secondaryButtonUriTarget)}function i(n,r){if(!n)return;let s=n.startsWith("http")?"_blank":"_self";r&&r!=="_blank"&&(s="_self"),e.navigate(n,s)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:i}}var ua=Et.div`
|
|
472
472
|
display: flex;
|
|
473
473
|
flex-wrap: wrap;
|
|
474
474
|
align-content: center;
|
|
@@ -516,7 +516,7 @@ import ht,{createContext as za,useEffect as ko,useState as Ne}from"react";import
|
|
|
516
516
|
margin-top: 12px;
|
|
517
517
|
margin-bottom: 16px;
|
|
518
518
|
max-width: 70%;
|
|
519
|
-
`;function ci({stepData:e,appearance:t}){var i,n;let{handleUrl:o}=
|
|
519
|
+
`;function ci({stepData:e,appearance:t}){var i,n;let{handleUrl:o}=ne();return ft.createElement("div",null,ft.createElement(xa,null,e.title),ft.createElement(Ca,null,e.subtitle),ft.createElement(ua,null,(n=(i=e.props)==null?void 0:i.links)==null?void 0:n.map(r=>ft.createElement(fa,{key:r.title},ft.createElement(ga,{src:r.imageUri}),ft.createElement(ha,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{r.uri&&o(r.uri,r.uriTarget??"_blank")}},r.title)))))}import At,{useEffect as ka}from"react";import wo from"styled-components";import Qo from"react";var yo=({style:e,className:t})=>Qo.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:t,style:e},Qo.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),Qo.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.91 11.672a.375.375 0 010 .656l-5.603 3.113a.375.375 0 01-.557-.328V8.887c0-.286.307-.466.557-.327l5.603 3.112z"}));import Xt,{useRef as Sa,useState as ya}from"react";import bo from"styled-components";var ba=bo.div`
|
|
520
520
|
display: flex;
|
|
521
521
|
align-items: center;
|
|
522
522
|
justify-content: flex-start;
|
|
@@ -577,7 +577,7 @@ import ht,{createContext as za,useEffect as ko,useState as Ne}from"react";import
|
|
|
577
577
|
max-height: 250px;
|
|
578
578
|
margin-bottom: 24px;
|
|
579
579
|
}
|
|
580
|
-
`;function mi({stepData:e,appearance:t,setCanContinue:o}){return ka(()=>{o(!0)},[]),At.createElement(Pa,{className:l("callToActionContainer",t)},At.createElement(Ea,{className:l("callToActionTextContainer",t)},At.createElement(
|
|
580
|
+
`;function mi({stepData:e,appearance:t,setCanContinue:o}){return ka(()=>{o(!0)},[]),At.createElement(Pa,{className:l("callToActionContainer",t)},At.createElement(Ea,{className:l("callToActionTextContainer",t)},At.createElement(Se,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&At.createElement(va,{className:l("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&At.createElement(Ba,{appearance:t,className:l("callToActionVideo",t)},At.createElement(Bt,{appearance:t,videoUri:e.videoUri})))}import Je,{useEffect as Zo,useState as Ro}from"react";import at from"styled-components";var ui=at.div`
|
|
581
581
|
width: auto;
|
|
582
582
|
display: flex;
|
|
583
583
|
flex-direction: column;
|
|
@@ -630,8 +630,8 @@ import ht,{createContext as za,useEffect as ko,useState as Ne}from"react";import
|
|
|
630
630
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
631
631
|
display: flex;
|
|
632
632
|
align-self: center;
|
|
633
|
-
`;var bi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let n=e.props,[r,s]=Ro([]),[
|
|
634
|
-
${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map(([s,
|
|
633
|
+
`;var bi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let n=e.props,[r,s]=Ro([]),[d,c]=Ro(!1),[a,C]=Ro(e.id);return Zo(()=>{r.length==0&&!d&&(c(!0),o({choice:[]}))},[d]),Zo(()=>{a!==e.id&&(C(e.id),s([]))},[e]),Zo(()=>{o({choice:r}),r.length>=n.minChoices?t(!0):t(!1)},[r]),Je.createElement(ui,{className:l("selectListContainer",i)},Je.createElement(fi,null,Je.createElement(gi,{className:l("selectListTitle",i)},e.title),Je.createElement(hi,{appearance:i,className:l("selectListSubtitle",i)},e.subtitle)),n.options.map((p,f)=>{let y=r.includes(p.id);return Je.createElement(xi,{key:`select-item-${f}`,onClick:()=>{if(r.includes(p.id)){s(r.filter(E=>E!==p.id));return}r.length<n.maxChoices?s([...r,p.id]):r.length==1&&n.maxChoices==1&&s([p.id])},hideBottomBorder:f===n.options.length-1,className:l("selectListSelectItem",i)},Je.createElement(Ci,{className:l("selectListItemImage",i)},p.imageUri&&Je.createElement(Si,{src:p.imageUri,alt:`select-icon-${f}`}),Je.createElement(yi,{appearance:i,className:l("selectListSelectItemText",i)},p.title)),Je.createElement(Xe,{appearance:i,value:y,primaryColor:i.theme.colorPrimary}))}))};import ye,{useEffect as er,useState as Jt}from"react";import{AnimatePresence as Aa,motion as Ia}from"framer-motion";var Na=({children:e,id:t,shouldWrap:o=!1})=>ye.createElement(ye.Fragment,null,o?ye.createElement(Aa,{initial:!1},ye.createElement(Ia.div,{key:t,initial:{opacity:1,y:"100%"},animate:{opacity:1,y:0},exit:{opacity:0,y:"-100%"},transition:{duration:.5,ease:"easeInOut"},style:{width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:1,overflowY:"auto"}},e)):e),To=({appearance:e,steps:t,selectedStep:o,customStepTypes:i,customVariables:n,onButtonClick:r,onStepCompletion:s,flowId:d,type:c,hideOnFlowCompletion:a,onComplete:C,setVisible:p,setShowModal:f,onDismiss:y,showPagination:E=!1,customFormElements:u,allowBackNavigation:x,validationHandler:v})=>{var ee;let B={...{linkCollection:ci,multiInput:ei,callToAction:mi,selectList:bi},...i},{primaryCTAClickSideEffects:F,secondaryCTAClickSideEffects:h}=ne(),[m,S]=Jt(!1),[w,I]=Jt({}),[H,V]=Jt(!1),[A,U]=Jt(!1),[D,$]=Jt(null),le=t[o]??null,{markStepCompleted:ce,markStepStarted:N,isLoading:Fe,updateCustomVariables:ke,markFlowCompleted:R}=J();er(()=>{ke(n)},[n,Fe]),er(()=>{window&&x&&!A&&(window.location.hash=t[o].id,U(!0))},[x,A,U]),er(()=>{var _;if(window&&((_=window==null?void 0:window.location)!=null&&_.hash)&&window.location.hash.replace("#","")!==t[o].id){let ae=window.location.hash.replace("#",""),q=t.findIndex(Y=>Y.id===ae);q!==-1&&N(d,t[q].id)}},[(ee=window==null?void 0:window.location)==null?void 0:ee.hash,N,o,t]);function G(){return{data:w[t[o].id]??{},stepId:t[o].id,customVariables:n}}function re(_,ae,q){let Y=o+1<t.length?t[o+1]:null;return s&&s(_,q,Y,w,G()),r?r(_,o,ae,Y):!0}function he(_,ae){I(q=>{let Y={};return Y[_.id]=ae,{...q,...Y}})}function ie(_){return _.selectedStep.imageUri?ye.createElement(li,{image:_.selectedStep.imageUri,appearance:e,className:l("formContainerSidebarImage",e)}):null}let L=ye.createElement(pi,{step:t[o],canContinue:m&&!H,formType:c,selectedStep:o,appearance:e,onPrimaryClick:async()=>{if(V(!0),v){let q=await v(t[o],o,t[o+1],w,G());if(q){$(q),V(!1);return}else $(null)}let _={...G()};await ce(d,t[o].id,_),o+1<t.length&&await N(d,t[o+1].id);let ae=re(t[o],"primary",o);o+1>=t.length&&(C&&C(),y&&y(),a&&ae&&(p&&p(!1),f(!1)),await R(d)),F(t[o]),V(!1),window&&x&&o+1<t.length&&(window.location.hash=t[o+1].id)},onSecondaryClick:()=>{re(t[o],"secondary",o),h(t[o])},onBack:async()=>{o-1>=0&&(V(!0),await N(d,t[o-1].id),V(!1))},steps:t,allowBackNavigation:x,errorMessage:D});return ye.createElement(ye.Fragment,null,ye.createElement(ii,{className:l("formContainer",e)},ye.createElement(ni,null,ye.createElement(Na,{id:o,shouldWrap:c==="large-modal"},ye.createElement(si,{key:le.id,type:c,className:l("formContent",e)},t.map(_=>{let ae=B[_.type];return le.id!==_.id?null:ye.createElement(ae,{key:_.id,stepData:_,canContinue:m,setCanContinue:S,onSaveData:q=>{he(_,q)},appearance:e,customFormElements:u,flowId:d})}),E&&ye.createElement(di,{className:l("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),L))),c=="large-modal"&&ye.createElement(ie,{selectedStep:t[o]})))};import Qt from"react";import{createGlobalStyle as La}from"styled-components";function oe({appearance:e}){if(!e||!e.styleOverrides)return Qt.createElement(Qt.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([i,n])=>typeof n=="object");if(t.length===0)return Qt.createElement(Qt.Fragment,null);let o=La`
|
|
634
|
+
${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map(([s,d])=>`${Mo(s)}: ${d};`).join(" ")} }`).join(" ")}`;return Qt.createElement(o,{inlineStyles:t})}var wi=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:n,customVariables:r,customFormElements:s,onComplete:d,appearance:c,hideOnFlowCompletion:a=!0,onStepCompletion:C,onButtonClick:p,dismissible:f=!0,endFlowOnDismiss:y=!1,modalPosition:E="center",repeatable:u=!1,onDismiss:x,showPagination:v=!1,allowBackNavigation:k=!1,validationHandler:B,showFrigadeBranding:F=!1})=>{let{getFlow:h,getFlowSteps:m,isLoading:S,targetingLogicShouldHideFlow:w,getFlowStatus:I,getCurrentStepIndex:H,markFlowCompleted:V,markFlowNotStarted:A}=J(),U=H(e),{mergeAppearanceWithDefault:D}=Q(),[$,le]=Da(!1),{setOpenFlowState:ce,getOpenFlowState:N,hasOpenModals:Fe}=Pe();c=D(c);let[ke,R]=i!==void 0&&n!==void 0?[i,n]:[N(e,!0),ie=>ce(e,ie)];if(Oa(()=>{!$&&!S&&(le(!0),I(e)===X&&u&&A(e),le(!0))},[$,le,S]),S)return null;let G=h(e);if(!G||w(G))return null;let re=m(e);if(!re||i!==void 0&&i===!1||I(e)===X&&a||(o=="modal"||o=="corner-modal")&&Fe(e))return null;let he=()=>{R(!1),x&&x(),y===!0&&V(e)};if(E=="center"&&o==="modal"||o==="large-modal"){let ie={padding:"24px"};return o==="large-modal"?(ie.width="85%",ie.height="90%",ie.maxHeight="800px",ie.minHeight="500px",ie.padding="0"):ie.width="400px",_e.createElement(rt,{appearance:c,onClose:he,visible:ke,style:ie,dismissible:f,showFrigadeBranding:F},_e.createElement(oe,{appearance:c}),_e.createElement(To,{appearance:c,steps:re,selectedStep:U,customStepTypes:t,customVariables:r,onButtonClick:p,onStepCompletion:C,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:d,setVisible:n,setShowModal:R,onDismiss:x,showPagination:v,customFormElements:s,allowBackNavigation:k,validationHandler:B}))}return o==="modal"&&E!=="center"?_e.createElement(Mr,{appearance:c,onClose:he,visible:ke},_e.createElement(oe,{appearance:c}),_e.createElement(To,{appearance:c,steps:re,selectedStep:U,customStepTypes:t,customVariables:r,onButtonClick:p,onStepCompletion:C,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:d,setVisible:n,setShowModal:R,onDismiss:x,showPagination:v,customFormElements:s,allowBackNavigation:k,validationHandler:B})):_e.createElement(_e.Fragment,null,_e.createElement(oe,{appearance:c}),_e.createElement(To,{appearance:c,steps:re,selectedStep:U,customStepTypes:t,customVariables:r,onButtonClick:p,onStepCompletion:C,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:d,setVisible:n,setShowModal:R,onDismiss:x,showPagination:v,customFormElements:s,allowBackNavigation:k,validationHandler:B}))},Ti=wi;import{useCallback as Fi,useContext as $a,useEffect as Ma}from"react";function tr(){let{organizationId:e,userId:t,setOrganizationId:o}=$a(K),{mutateUserFlowState:i}=Ie(),{config:n}=Me(),r=Tt(),{verifySDKInitiated:s}=Ft();Ma(()=>{if(t&&e){if(t.startsWith(kt))return;let a=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(a)||(r(`${we}userGroups`,{...n,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(a,"true"))}},[t,e]);let d=Fi(async a=>{if(s(),!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let C={foreignUserId:t,foreignUserGroupId:e,properties:a};await r(`${we}userGroups`,{...n,method:"POST",body:JSON.stringify(C)}),i()},[e,t,n,i]),c=Fi(async(a,C)=>{if(s(),!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let f={foreignUserId:t,foreignUserGroupId:e,events:[{event:a,properties:C}]};await r(`${we}userGroups`,{...n,method:"POST",body:JSON.stringify(f)}),i()},[e,t,n,i]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:d,trackEventForOrganization:c}}var ki="frigade-xFrigade_guestUserId",Zt="frigade-xFrigade_userId",Pi=({})=>{let{setFlowResponses:e}=Ht(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=Ie(),{userId:n,setUserId:r}=Vt(),[s,d]=or(null),{getFlowStatus:c}=J(),{flows:a,userProperties:C,setIsNewGuestUser:p,flowResponses:f}=Ua(K),[y,E]=or([]),[u,x]=or([]),{organizationId:v}=tr();Fo(()=>{if(!o&&t)for(let h=0;h<t.length;h++){let m=t[h],S=a.find(w=>w.slug===(m==null?void 0:m.flowId));if(S&&m&&m.shouldTrigger===!0&&S.type=="FORM"&&S.triggerType==="AUTOMATIC"&&!u.includes(S.slug)){setTimeout(()=>{k(m.flowId)},500);break}}},[o,t]),Fo(()=>{f.length>0&&i()},[f]);function k(h){let m=a.find(S=>S.slug===h);m&&m.triggerType==="AUTOMATIC"&&!u.includes(m.slug)&&(x([...u,m.slug]),E([m]))}function B(){if(!n){let h=localStorage.getItem(Zt);if(h){r(h);return}let m=localStorage.getItem(ki);if(m){r(m);return}p(!0);let S=kt+_a();try{localStorage.setItem(ki,S)}catch(w){console.log("Failed to save guest user id locally: Local storage unavailable",w)}r(w=>w||S)}}Fo(()=>{try{if(a){let h=[];a.forEach(m=>{if(m.data){let S=m.data.match(/"imageUri":"(.*?)"/g);S&&S.forEach(w=>{let I=w.replace('"imageUri":"',"").replace('"',"");if(h.includes(I))return;let H=new Image;H.src=I,h.push(I)})}})}}catch{}},[a]),Fo(()=>{if(n!==s&&e([]),d(n),n&&!n.startsWith(kt))try{localStorage.setItem(Zt,n)}catch(h){console.log("Failed to save user id locally: Local storage available",h)}n===null&&setTimeout(()=>{n===null&&B()},50)},[n,a,C]);function F(){return gt.createElement(gt.Fragment,null,y.map(h=>c(h.slug)!==Le?null:gt.createElement("span",{key:h.slug},gt.createElement(Ti,{flowId:h.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return gt.createElement(gt.Fragment,null,gt.createElement(F,null))};import{ErrorBoundary as Ha}from"react-error-boundary";var K=za({publicApiKey:"",setUserId:()=>{},flows:[],setFlows:()=>{},failedFlowResponses:[],setFailedFlowResponses:()=>{},flowResponses:[],setFlowResponses:()=>{},userProperties:{},setUserProperties:()=>{},openFlowStates:{},setOpenFlowStates:()=>{},completedFlowsToKeepOpenDuringSession:[],setCompletedFlowsToKeepOpenDuringSession:()=>{},customVariables:{},setCustomVariables:()=>{},isNewGuestUser:!1,setIsNewGuestUser:()=>{},hasActiveFullPageFlow:!1,setHasActiveFullPageFlow:()=>{},organizationId:"",setOrganizationId:()=>{},navigate:()=>{},defaultAppearance:Ye,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{}});function Va(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var ja=({publicApiKey:e,userId:t,organizationId:o,config:i,children:n})=>{var le,ce;let[r,s]=Ne(t||null),[d,c]=Ne(o||null),[a,C]=Ne([]),[p,f]=Ne([]),[y,E]=Ne([]),[u,x]=Ne({}),[v,k]=Ne({}),[B,F]=Ne([]),[h,m]=Ne({}),[S,w]=Ne(!1),[I,H]=Ne(!1),[V,A]=Ne(!$(e)),U=(N,Fe)=>{if(Fe==="_blank"){window.open(N,"_blank");return}setTimeout(()=>{window.location.href=N},50)},D={theme:{...Ye.theme,...((le=i==null?void 0:i.defaultAppearance)==null?void 0:le.theme)??{}},styleOverrides:{...Ye.styleOverrides,...((ce=i==null?void 0:i.defaultAppearance)==null?void 0:ce.styleOverrides)??{}}};function $(N){return!!(N&&N.length>10&&N.substring(0,10)==="api_public")}return ko(()=>{t&&s(t)},[t]),ko(()=>{r&&window&&window.localStorage&&window.localStorage.getItem(Zt)&&window.localStorage.getItem(Zt)!==r&&Va()},[r]),ko(()=>{o&&c(o)},[o]),ko(()=>{if($(e))A(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),A(!0);return}},[e,A]),V?ht.createElement(K.Provider,{value:{publicApiKey:e,userId:r,setUserId:s,setFlows:C,flows:a,failedFlowResponses:p,setFailedFlowResponses:f,flowResponses:y,setFlowResponses:E,userProperties:u,setUserProperties:x,openFlowStates:v,setOpenFlowStates:k,completedFlowsToKeepOpenDuringSession:B,setCompletedFlowsToKeepOpenDuringSession:F,customVariables:h,setCustomVariables:m,isNewGuestUser:S,setIsNewGuestUser:w,hasActiveFullPageFlow:I,setHasActiveFullPageFlow:H,organizationId:d,setOrganizationId:c,navigate:i&&i.navigate?i.navigate:U,defaultAppearance:D,shouldGracefullyDegrade:V,setShouldGracefullyDegrade:A}},n):ht.createElement(Ha,{fallback:ht.createElement(ht.Fragment,null,n)},ht.createElement(K.Provider,{value:{publicApiKey:e,userId:r,setUserId:s,setFlows:C,flows:a,failedFlowResponses:p,setFailedFlowResponses:f,flowResponses:y,setFlowResponses:E,userProperties:u,setUserProperties:x,openFlowStates:v,setOpenFlowStates:k,completedFlowsToKeepOpenDuringSession:B,setCompletedFlowsToKeepOpenDuringSession:F,customVariables:h,setCustomVariables:m,isNewGuestUser:S,setIsNewGuestUser:w,hasActiveFullPageFlow:I,setHasActiveFullPageFlow:H,organizationId:d,setOrganizationId:c,navigate:i&&i.navigate?i.navigate:U,defaultAppearance:D,shouldGracefullyDegrade:V,setShouldGracefullyDegrade:A}},ht.createElement(Wa,{theme:D.theme},n,ht.createElement(Pi,null))))};import Wp from"react";import de,{useEffect as rs,useState as is}from"react";import $e,{useState as mp}from"react";import St from"styled-components";import Eo from"react";import xt from"react";import Ei from"styled-components";var vi=Ei.span`
|
|
635
635
|
font-weight: 400;
|
|
636
636
|
font-size: 15px;
|
|
637
637
|
line-height: 20px;
|
|
@@ -648,7 +648,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
648
648
|
padding-bottom: 20px;
|
|
649
649
|
border-top: 1px solid ${e=>e.theme.colorBorder};
|
|
650
650
|
width: 100%;
|
|
651
|
-
`,Po=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:n,primaryColor:r="#000000",checkBoxType:s="square",appearance:
|
|
651
|
+
`,Po=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:n,primaryColor:r="#000000",checkBoxType:s="square",appearance:d})=>xt.createElement(xt.Fragment,null,xt.createElement(Ga,{className:l("checklistStepsContainer",d),appearance:d,style:{...n}},i==="left"&&e&&xt.createElement(vi,{className:l("checklistStepLabel",d),style:o},e),xt.createElement(Xe,{appearance:d,value:t,type:s,primaryColor:r}),i==="right"&&e&&xt.createElement(vi,{className:l("checklistStepLabel",d),style:o},e)),xt.createElement(oe,{appearance:d}));import{motion as qa}from"framer-motion";import Rt from"styled-components";var Bi=Rt.div`
|
|
652
652
|
font-weight: 700;
|
|
653
653
|
font-size: 18px;
|
|
654
654
|
line-height: 22px;
|
|
@@ -676,7 +676,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
676
676
|
`,Ni=Rt.div`
|
|
677
677
|
flex-direction: row;
|
|
678
678
|
justify-content: flex-start;
|
|
679
|
-
`;var Li=({data:e,index:t,isSelected:o,primaryColor:i,style:n,onClick:r,appearance:s})=>{var
|
|
679
|
+
`;var Li=({data:e,index:t,isSelected:o,primaryColor:i,style:n,onClick:r,appearance:s})=>{var d,c;return Eo.createElement("div",{style:{position:"relative",paddingLeft:"20px"},onClick:()=>{r()}},o&&Eo.createElement(vo,{className:l("checklistStepItemSelectedIndicator",s),as:qa.div,layoutId:"checklis-step-selected",style:{backgroundColor:((d=s==null?void 0:s.theme)==null?void 0:d.colorPrimary)??i}}),Eo.createElement(Ni,{className:l("checklistStepItem",s),key:`hero-checklist-step-${t}`,role:"listitem"},Eo.createElement(Po,{value:e.complete,labelPosition:"left",label:e.stepName,style:n,primaryColor:((c=s==null?void 0:s.theme)==null?void 0:c.colorPrimary)??i,appearance:s})))};import Ct from"react";import{motion as Ka}from"framer-motion";import rr from"styled-components";var Ya={backgroundColor:"#E6E6E6"},Xa=rr.div`
|
|
680
680
|
display: flex;
|
|
681
681
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
682
682
|
justify-content: flex-start;
|
|
@@ -695,7 +695,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
695
695
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
696
696
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
697
697
|
${e=>Ke(e)}
|
|
698
|
-
`,Za={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},Ra={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},ze=({count:e,total:t,fillColor:o,bgColor:i=Ya.backgroundColor,display:n="count",textLocation:r="left",style:s={},textStyle:
|
|
698
|
+
`,Za={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},Ra={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},ze=({count:e,total:t,fillColor:o,bgColor:i=Ya.backgroundColor,display:n="count",textLocation:r="left",style:s={},textStyle:d={},appearance:c})=>{var E,u;if(t===0)return Ct.createElement(Ct.Fragment,null);let a=e===0?"10px":`${e/t*100}%`,C=n==="compact"?"5px":"10px",p=Math.round(e/t*100),f=n==="compact"?"5px":"20px",y;return n==="count"?y=`${e} of ${t}`:n==="compact"?y=`${p}%`:n==="percent"&&(y=`${p}% complete`),r==="top"&&(f="0px"),Ct.createElement(Xa,{className:l("progressBarContainer",c),textLocation:r,styleOverrides:s},Ct.createElement(Qa,{className:l("progressBarStepText",c),style:{...d,fontSize:n==="compact"?12:15,fontWeight:n==="compact"?400:500},appearance:c,padding:f,textLocation:r},y),Ct.createElement(Ja,{textLocation:r,className:l("progressBar",c)},Ct.createElement(Ka.div,{style:{...Ra,width:a,height:C,backgroundColor:((E=c==null?void 0:c.theme)==null?void 0:E.colorPrimary)??o,zIndex:n=="compact"?1:5},className:l("progressBarFill",c)}),Ct.createElement("div",{className:l("progressBarBackground",c),style:{...Za,height:C,backgroundColor:((u=c==null?void 0:c.theme)==null?void 0:u.colorSecondary)??i}})))};import eo from"react";import ep from"styled-components";import Ao from"react";import Bo from"react";var It=({stepData:e,appearance:t})=>Bo.createElement(Bo.Fragment,null,Bo.createElement(Ai,{appearance:t,className:l("checklistStepTitle",t),dangerouslySetInnerHTML:ue(e.title)}),Bo.createElement(Ii,{appearance:t,className:l("checklistStepSubtitle",t),dangerouslySetInnerHTML:ue(e.subtitle)}));import ir from"react";var Nt=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},i=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return ir.createElement(So,{className:l("ctaContainer",t)},e.secondaryButtonTitle&&ir.createElement(te,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:i,style:{width:"auto",marginRight:"12px"}}),ir.createElement(te,{appearance:t,title:e.primaryButtonTitle,onClick:o}))};var Lt=({stepData:e,appearance:t})=>Ao.createElement(Ao.Fragment,null,Ao.createElement(It,{stepData:e,appearance:t}),Ao.createElement(Nt,{stepData:e,appearance:t}));import Oi from"react";function Di(e){if(e.videoUri.includes("youtube")){let t=e.videoUri.split("v=")[1],o=t.indexOf("&");return o!==-1&&(t=t.substring(0,o)),Oi.createElement("iframe",{width:"480",height:"260",src:`https://www.youtube.com/embed/${t}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:l("checklistStepVideo",e.appearance)})}else return Oi.createElement("video",{width:"480",height:"260",controls:!0,src:e.videoUri})}var nr="default",tp=ep.img`
|
|
699
699
|
border-radius: 4px;
|
|
700
700
|
max-height: 260px;
|
|
701
701
|
min-height: 200px;
|
|
@@ -744,7 +744,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
744
744
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
745
745
|
border-radius: 50%;
|
|
746
746
|
}
|
|
747
|
-
`,Ui="videoCarousel",_i=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.videos))return Ee.createElement(Mi,null,Ee.createElement(Lt,{stepData:e,appearance:t}));function o({video:r}){let s=op(),[
|
|
747
|
+
`,Ui="videoCarousel",_i=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.videos))return Ee.createElement(Mi,null,Ee.createElement(Lt,{stepData:e,appearance:t}));function o({video:r}){let s=op(),[d,c]=rp(!1);return Ee.createElement(np,null,!d&&Ee.createElement(ap,{onClick:()=>{c(!0),s.current.play()},appearance:t},Ee.createElement(yo,null)),Ee.createElement(sp,{controls:d,ref:s,play:d,src:r.uri}),Ee.createElement(lp,null,r.title))}let i=e.props;return i.videos?Ee.createElement(Mi,null,Ee.createElement(It,{stepData:e,appearance:t}),Ee.createElement(ip,null,i.videos.map((r,s)=>Ee.createElement("span",{key:`${r.uri}-${s}`},Ee.createElement(o,{video:r})))),Ee.createElement(Nt,{stepData:e,appearance:t})):null};import Qe from"react";import Io from"styled-components";var zi=Io.div`
|
|
748
748
|
display: block;
|
|
749
749
|
`,pp=Io.pre`
|
|
750
750
|
display: block;
|
|
@@ -800,30 +800,30 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
800
800
|
`,Cp=St.div`
|
|
801
801
|
flex: 2;
|
|
802
802
|
padding: 2rem;
|
|
803
|
-
`,Sp=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:n,setSelectedStep:r,className:s="",customStepTypes:
|
|
803
|
+
`,Sp=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:n,setSelectedStep:r,className:s="",customStepTypes:d=new Map,appearance:c,type:a})=>{let{mergeAppearanceWithDefault:C}=Q();c=C(c);let f={...{[nr]:$i,[Ui]:_i,[Wi]:Hi},...d},[y,E]=mp(0),u=n??y,x=r??E,v=o.filter(B=>B.complete===!0).length,k=()=>{var B;return!((B=o[u])!=null&&B.type)||!f[o[u].type]?f[nr]({stepData:o[u],appearance:c}):f[o[u].type]({stepData:o[u],appearance:c})};return $e.createElement(up,{type:a,style:i,className:s,appearance:c},$e.createElement(Vi,{style:{flex:1}},$e.createElement(Vi,{style:{padding:"30px 0px 30px 30px",borderBottom:"none"}},$e.createElement(fp,{className:l("checklistTitle",c),appearance:c},e),$e.createElement(gp,{className:l("checklistSubtitle",c),appearance:c},t),$e.createElement(ze,{total:o.length,count:v,fillColor:c.theme.colorPrimary,style:{marginTop:"24px"},appearance:c})),$e.createElement(hp,{className:l("checklistStepsContainer",c)},o.map((B,F)=>$e.createElement(Li,{data:B,index:F,key:F,listLength:o.length,isSelected:F===u,primaryColor:c.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{x(F)}})))),$e.createElement(xp,{appearance:c,className:l("checklistDivider",c)}),$e.createElement(Cp,null,$e.createElement(k,null)))},sr=Sp;import M,{useState as kp}from"react";import ji from"react";import yp from"styled-components";var bp=yp.svg`
|
|
804
804
|
transition: 'transform 0.35s ease-in-out';
|
|
805
|
-
`,Dt=({color:e="#323232",style:t,className:o})=>ji.createElement(bp,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},ji.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as Pp}from"framer-motion";import
|
|
805
|
+
`,Dt=({color:e="#323232",style:t,className:o})=>ji.createElement(bp,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},ji.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as Pp}from"framer-motion";import fe from"styled-components";var lr={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},Gi=fe.div`
|
|
806
806
|
max-height: 350px;
|
|
807
807
|
padding-bottom: 40px;
|
|
808
|
-
`,qi=
|
|
808
|
+
`,qi=fe.div`
|
|
809
809
|
display: flex;
|
|
810
810
|
flex-direction: column;
|
|
811
811
|
margin-top: 20px;
|
|
812
|
-
`,Ki=
|
|
812
|
+
`,Ki=fe.h1`
|
|
813
813
|
font-style: normal;
|
|
814
814
|
font-weight: 600;
|
|
815
815
|
font-size: 30px;
|
|
816
816
|
line-height: 36px;
|
|
817
817
|
margin-bottom: 16px;
|
|
818
818
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
819
|
-
`,Yi=
|
|
819
|
+
`,Yi=fe.h2`
|
|
820
820
|
font-weight: 400;
|
|
821
821
|
font-size: 16px;
|
|
822
822
|
line-height: 20px;
|
|
823
823
|
margin-bottom: 16px;
|
|
824
824
|
padding-left: 1px;
|
|
825
825
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
826
|
-
`,Xi=
|
|
826
|
+
`,Xi=fe.div`
|
|
827
827
|
${e=>T(e)} {
|
|
828
828
|
border: 1px solid #fafafa;
|
|
829
829
|
}
|
|
@@ -833,11 +833,11 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
833
833
|
flex-direction: column;
|
|
834
834
|
min-height: 240px;
|
|
835
835
|
overflow: hidden;
|
|
836
|
-
`,Ji=
|
|
836
|
+
`,Ji=fe.div`
|
|
837
837
|
display: flex;
|
|
838
838
|
flex-direction: row;
|
|
839
839
|
justify-content: space-between;
|
|
840
|
-
`,Qi=
|
|
840
|
+
`,Qi=fe.p`
|
|
841
841
|
${e=>T(e)} {
|
|
842
842
|
font-weight: 400;
|
|
843
843
|
font-size: 10px;
|
|
@@ -846,12 +846,12 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
846
846
|
color: #8c8c8c;
|
|
847
847
|
margin: 20px;
|
|
848
848
|
}
|
|
849
|
-
`,Zi=
|
|
849
|
+
`,Zi=fe.div`
|
|
850
850
|
display: flex;
|
|
851
851
|
flex-direction: row;
|
|
852
|
-
`,Ri=
|
|
852
|
+
`,Ri=fe.div`
|
|
853
853
|
flex: 1;
|
|
854
|
-
`,en=
|
|
854
|
+
`,en=fe.div`
|
|
855
855
|
${e=>T(e)} {
|
|
856
856
|
display: flex;
|
|
857
857
|
justify-content: center;
|
|
@@ -861,7 +861,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
861
861
|
padding-left: 8px;
|
|
862
862
|
padding-right: 8px;
|
|
863
863
|
}
|
|
864
|
-
`,tn=
|
|
864
|
+
`,tn=fe.p`
|
|
865
865
|
${e=>T(e)} {
|
|
866
866
|
font-style: normal;
|
|
867
867
|
font-weight: 600;
|
|
@@ -873,7 +873,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
873
873
|
margin-top: 20px;
|
|
874
874
|
margin-bottom: 16px;
|
|
875
875
|
}
|
|
876
|
-
`,on=
|
|
876
|
+
`,on=fe.p`
|
|
877
877
|
${e=>T(e)} {
|
|
878
878
|
font-weight: 400;
|
|
879
879
|
font-size: 14px;
|
|
@@ -882,14 +882,14 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
882
882
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
883
883
|
margin-bottom: 8px;
|
|
884
884
|
}
|
|
885
|
-
`,rn=
|
|
885
|
+
`,rn=fe.div`
|
|
886
886
|
${e=>T(e)} {
|
|
887
887
|
display: flex;
|
|
888
888
|
flex-direction: row;
|
|
889
889
|
justify-content: center;
|
|
890
890
|
gap: 8px;
|
|
891
891
|
}
|
|
892
|
-
`,nn=
|
|
892
|
+
`,nn=fe.div`
|
|
893
893
|
${e=>T(e)} {
|
|
894
894
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
895
895
|
background-color: ${e=>e.selected?"#FAFAFA":"#FFFFFF"};
|
|
@@ -909,7 +909,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
909
909
|
justify-content: space-between;
|
|
910
910
|
position: relative;
|
|
911
911
|
cursor: pointer;
|
|
912
|
-
`,sn=
|
|
912
|
+
`,sn=fe.p`
|
|
913
913
|
${e=>T(e)} {
|
|
914
914
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
915
915
|
color: ${e=>e.selected?"#434343":"#BFBFBF"};
|
|
@@ -918,12 +918,12 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
918
918
|
font-size: 14px;
|
|
919
919
|
line-height: 22px;
|
|
920
920
|
margin: 0;
|
|
921
|
-
`,ln=
|
|
921
|
+
`,ln=fe.div`
|
|
922
922
|
display: flex;
|
|
923
923
|
flex-direction: row;
|
|
924
924
|
justify-content: flex-end;
|
|
925
925
|
align-content: center;
|
|
926
|
-
`,an=
|
|
926
|
+
`,an=fe.div`
|
|
927
927
|
display: flex;
|
|
928
928
|
flex: 1;
|
|
929
929
|
flex-direction: row;
|
|
@@ -931,7 +931,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
931
931
|
align-content: center;
|
|
932
932
|
align-items: center;
|
|
933
933
|
margin-right: 20px;
|
|
934
|
-
`,pn=
|
|
934
|
+
`,pn=fe.div`
|
|
935
935
|
display: block;
|
|
936
936
|
width: 100%;
|
|
937
937
|
`;import wp from"styled-components";var dn=wp.div`
|
|
@@ -1015,7 +1015,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1015
1015
|
line-height: 14px;
|
|
1016
1016
|
font-weight: 400;
|
|
1017
1017
|
cursor: pointer;
|
|
1018
|
-
`;var Fp=({steps:e,style:t,title:o,primaryColor:i,appearance:n,onButtonClick:r})=>{let{primaryCTAClickSideEffects:s}=
|
|
1018
|
+
`;var Fp=({steps:e,style:t,title:o,primaryColor:i,appearance:n,onButtonClick:r})=>{let{primaryCTAClickSideEffects:s}=ne();return Re.createElement(cn,{style:t,className:l("guideContainer",n)},Re.createElement(un,{className:l("guideTitle",n)},o),Re.createElement(mn,{className:l("guideItemContainer",n)},e.map((d,c)=>Re.createElement(fn,{key:`guide-${d.id??c}`,as:Tp.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:l("guideItem",n)},d.icon&&Re.createElement(gn,{className:l("guideIcon",n)},Re.createElement(hn,null,d.icon)),Re.createElement(xn,{className:l("guideItemTitle",n),dangerouslySetInnerHTML:ue(d.title)}),Re.createElement(Cn,{className:l("guideItemSubtitle",n),dangerouslySetInnerHTML:ue(d.subtitle)}),Re.createElement(Sn,{className:l("guideItemLink",n),color:i,onClick:()=>{d.primaryButtonUri&&s(d),r&&r(d)}},d.primaryButtonTitle)))))},to=Fp;var vp=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:n,onClose:r,selectedStep:s,setSelectedStep:d,customStepTypes:c,appearance:a,guideData:C,guideTitle:p,onGuideButtonClick:f})=>{let y=({stepData:m,handleSecondaryCTAClick:S,handleCTAClick:w})=>m?M.createElement(en,{className:l("checklistStepContainer",a),"data-testid":"checklistStepContainer"},M.createElement(tn,{appearance:a,className:l("checklistStepTitle",a),dangerouslySetInnerHTML:ue(m.title)}),M.createElement(on,{appearance:a,className:l("checklistStepSubtitle",a),dangerouslySetInnerHTML:ue(m.subtitle)}),M.createElement(rn,{className:l("checklistCTAContainer",a)},m.secondaryButtonTitle&&M.createElement(te,{title:m.secondaryButtonTitle,onClick:S,appearance:a,secondary:!0}),M.createElement(te,{title:m.primaryButtonTitle,onClick:w,appearance:a}))):M.createElement(M.Fragment,null),u={...{default:m=>{var H;if((H=e[k])!=null&&H.StepContent){let V=e[k].StepContent;return M.createElement("div",null,V)}let S=e[k];return M.createElement(y,{stepData:m,handleCTAClick:()=>{S.handlePrimaryButtonClick&&S.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{S.handleSecondaryButtonClick&&S.handleSecondaryButtonClick()}})}},...c},[x,v]=kp(0),k=s??x,B=d??v,F=()=>{var m;return e?!((m=e[k])!=null&&m.type)||!u[e[k].type]?u.default(e[k]):u[e[k].type]({stepData:e[k],primaryColor:a.theme.colorPrimary}):M.createElement(M.Fragment,null)},h=e.filter(m=>m.complete).length;return n?(a.theme.modalContainer||(a.theme.borderRadius&&(lr.borderRadius=a.theme.borderRadius+"px"),a.theme.modalContainer=lr),M.createElement(rt,{onClose:r,visible:n,appearance:a},M.createElement(pn,null,M.createElement(qi,null,M.createElement(Ki,{appearance:a,className:l("checklistTitle",a)},t),M.createElement(Yi,{appearance:a,className:l("checklistSubtitle",a)},o)),M.createElement(Gi,null,e&&e.length>0&&M.createElement(Xi,{className:l("stepsContainer",a)},M.createElement(Ji,null,M.createElement("div",{style:{flex:3}},M.createElement(Qi,{className:l("stepsTitle",a)},i)),M.createElement(an,null,M.createElement(ze,{fillColor:a.theme.colorPrimary,style:{width:"100%"},count:h,total:e.length,appearance:a}))),M.createElement(Zi,null,M.createElement(Ri,{className:l("checklistStepListContainer",a),appearance:a},e.map((m,S)=>{let w=k===S;return M.createElement(nn,{selected:w,className:l(`checklistStepListItem${w?"Selected":""}`,a),key:`checklist-guide-step-${m.id??S}`,disabled:m.blocked,onClick:()=>{m.blocked||B(S)},title:m.blocked?"Finish remaining steps to continue":void 0},w&&M.createElement(vo,{className:l("checklistStepItemSelectedIndicator",a),as:Pp.div,layoutId:"checklist-step-selected",style:{backgroundColor:a.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),M.createElement(sn,{selected:w,className:l(`checklistStepListStepName${w?"Selected":""}`,a)},m.stepName),M.createElement(ln,null,M.createElement(Xe,{value:m.complete,type:"round",primaryColor:a.theme.colorPrimary,progress:m.progress,appearance:a}),M.createElement(dn,null,M.createElement(Dt,{style:{marginLeft:"10px"},color:a.theme.colorBackgroundSecondary}))))})),M.createElement(F,null))),C&&C.length>0&&M.createElement(to,{steps:C,title:p,primaryColor:a.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:a,onButtonClick:m=>(f&&f(m),!0)}))))):M.createElement(M.Fragment,null)},ar=vp;import{useEffect as Ep,useState as Bp}from"react";var yn=()=>{let e={isSmall:"(max-width: 480px)",isMedium:"(min-width: 481px) AND (max-width: 1023px)",isLarge:"(min-width: 1025px)"},t=Object.fromEntries(Object.entries(e).map(([d])=>[d,!1])),[o,i]=Bp(t),n=null,r=()=>{n!==null?clearTimeout(n):s(),n=setTimeout(()=>{s()},16)},s=()=>{let d=Object.fromEntries(Object.entries(e).map(([c,a])=>{if(!window)return[c,!1];let C=window.matchMedia(a);return C.addEventListener("change",r),[c,C.matches]}));i(d)};return Ep(()=>{s()},[]),o};import Te,{useEffect as Dn,useState as Np}from"react";import ge from"react";import{AnimatePresence as Ap,motion as Ip}from"framer-motion";import et from"styled-components";var bn=et.div`
|
|
1019
1019
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1020
1020
|
border: 1px solid;
|
|
1021
1021
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -1062,7 +1062,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1062
1062
|
flex-direction: row;
|
|
1063
1063
|
justify-content: flex-start;
|
|
1064
1064
|
align-items: center;
|
|
1065
|
-
`;var Bn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:n,appearance:r,customStepTypes:s})=>{var C,
|
|
1065
|
+
`;var Bn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:n,appearance:r,customStepTypes:s})=>{var C,p;let d=t?{}:{transform:"rotate(90deg)"};function c(){return ge.createElement(ge.Fragment,null,e.imageUri||e.videoUri?ge.createElement(wn,{className:l("stepMediaContainer",r)},e.imageUri?ge.createElement(Tn,{className:l("stepImage",r),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?ge.createElement(Bt,{appearance:r,videoUri:e.videoUri}):null):null,ge.createElement(vn,{className:l("stepSubtitle",r),appearance:r,dangerouslySetInnerHTML:ue(e.subtitle)}),ge.createElement(So,{className:l("checklistCTAContainer",r)},e.secondaryButtonTitle?ge.createElement(te,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>n(),appearance:r}):null,ge.createElement(te,{title:e.primaryButtonTitle??"Continue",onClick:()=>i(),appearance:r})))}function a(){if(!s)return null;let f=s[e.type];return f?f(e,r):null}return ge.createElement(bn,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:l("checklistStepContainer",r),appearance:r},ge.createElement(Fn,{className:l("stepHeader",r)},ge.createElement(En,null,ge.createElement(Po,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(C=r==null?void 0:r.theme)==null?void 0:C.colorPrimary,appearance:r}),ge.createElement(kn,{appearance:r,className:l("stepTitle",r),dangerouslySetInnerHTML:ue(e.title)})),ge.createElement(Pn,{className:l("stepChevronContainer",r),onClick:()=>o()},ge.createElement(Dt,{style:{...d,transition:"transform 0.1s ease-in-out"},color:(p=r==null?void 0:r.theme)==null?void 0:p.colorTextSecondary}))),ge.createElement(Ap,null,!t&&ge.createElement(Ip.div,{initial:{opacity:1,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:1,height:0},key:e.id,style:{overflow:"hidden"}},a()??c())))};import $t from"styled-components";var Mx=$t.div`
|
|
1066
1066
|
background: #ffffff;
|
|
1067
1067
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
1068
1068
|
border-radius: 6px;
|
|
@@ -1102,7 +1102,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1102
1102
|
justify-content: space-between;
|
|
1103
1103
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1104
1104
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
1105
|
-
`;var Lp=({title:e,subtitle:t,steps:o,onClose:i,visible:n,
|
|
1105
|
+
`;var Lp=({title:e,subtitle:t,steps:o,onClose:i,visible:n,autoExpandFirstIncompleteStep:r=!0,autoCollapse:s=!0,autoExpandNextStep:d=!0,primaryColor:c="#000000",selectedStep:a,setSelectedStep:C,appearance:p,type:f,className:y,customStepTypes:E})=>{let u=o.filter(h=>h.complete).length,[x,v]=Np(Array(o.length).fill(!0));Dn(()=>{let h=[...x];if(r){for(let m=0;m<o.length;m++)if(!o[m].complete){h[m]=!1;break}v(h)}},[]),Dn(()=>{k(a)},[a]);let k=h=>{let m=[...x];if(s)for(let S=0;S<x.length;++S)S!==h&&(m[S]=!0);m[h]=!m[h],v(m)};if(!n&&f=="modal")return Te.createElement(Te.Fragment,null);let B=Te.createElement(Te.Fragment,null,Te.createElement(An,null,Te.createElement(In,{appearance:p,className:l("checklistTitle",p),dangerouslySetInnerHTML:ue(e)}),Te.createElement(Nn,{appearance:p,className:l("checklistSubtitle",p),dangerouslySetInnerHTML:ue(t)})),Te.createElement(ze,{display:"percent",count:u,total:o.length,fillColor:c,style:{margin:"14px 0px 8px 0px"},appearance:p})),F=Te.createElement(Ln,{className:Ce(l("checklistContainer",p),y)},o.map((h,m)=>{let S=x[m];return Te.createElement(Bn,{appearance:p,stepData:h,collapsed:S,key:`modal-checklist-${h.id??m}`,onClick:()=>{if(a===m){k(m);return}C(m)},onPrimaryButtonClick:()=>{h.handlePrimaryButtonClick&&h.handlePrimaryButtonClick(),d&&!h.completionCriteria&&m<x.length-1&&x[m+1]&&C(m+1)},onSecondaryButtonClick:()=>{h.handleSecondaryButtonClick&&h.handleSecondaryButtonClick()},customStepTypes:E})}));return f==="inline"?Te.createElement(On,{appearance:p,className:Ce(l("checklistInlineContainer",p),y)},B,F):Te.createElement(Te.Fragment,null,Te.createElement(rt,{onClose:i,visible:n,appearance:p,style:{maxWidth:"600px"},headerContent:B},F))},pr=Lp;import se,{useEffect as dr,useRef as _p,useState as yt}from"react";import Mt from"react";import pe,{css as $n,keyframes as Mn}from"styled-components";var Un=$n`
|
|
1106
1106
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1107
1107
|
`,Op=$n`
|
|
1108
1108
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
@@ -1118,7 +1118,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1118
1118
|
} to {
|
|
1119
1119
|
opacity: 0;
|
|
1120
1120
|
}
|
|
1121
|
-
`,_n=
|
|
1121
|
+
`,_n=pe.div`
|
|
1122
1122
|
margin: 0 -20px;
|
|
1123
1123
|
overflow-x: auto;
|
|
1124
1124
|
padding-left: 20px;
|
|
@@ -1135,13 +1135,13 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1135
1135
|
::-webkit-scrollbar {
|
|
1136
1136
|
display: none;
|
|
1137
1137
|
}
|
|
1138
|
-
`,zn=
|
|
1138
|
+
`,zn=pe.div`
|
|
1139
1139
|
display: flex;
|
|
1140
1140
|
flex-flow: row nowrap;
|
|
1141
1141
|
gap: 0 16px;
|
|
1142
1142
|
scroll-snap-align: center;
|
|
1143
1143
|
scroll-snap-stop: always;
|
|
1144
|
-
`,Wn=
|
|
1144
|
+
`,Wn=pe.div`
|
|
1145
1145
|
animation: ${e=>e.reversed?$p:Dp} 0.25s ease-out;
|
|
1146
1146
|
background: linear-gradient(
|
|
1147
1147
|
to right,
|
|
@@ -1151,7 +1151,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1151
1151
|
position: absolute;
|
|
1152
1152
|
width: 64px;
|
|
1153
1153
|
z-index: 10;
|
|
1154
|
-
`,Hn=
|
|
1154
|
+
`,Hn=pe.button`
|
|
1155
1155
|
${Un}
|
|
1156
1156
|
box-shadow: 0 3px 10px 0 rgba(0, 0, 0, 0.1);
|
|
1157
1157
|
align-items: center;
|
|
@@ -1163,10 +1163,10 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1163
1163
|
justify-content: center;
|
|
1164
1164
|
position: absolute;
|
|
1165
1165
|
width: 48px;
|
|
1166
|
-
`,Vn=
|
|
1166
|
+
`,Vn=pe.div`
|
|
1167
1167
|
border-radius: ${({theme:e})=>e.borderRadius}px;
|
|
1168
1168
|
padding: 20px;
|
|
1169
|
-
`,jn=
|
|
1169
|
+
`,jn=pe(Vn)`
|
|
1170
1170
|
${Un}
|
|
1171
1171
|
background: ${({theme:e})=>e.colorBackground};
|
|
1172
1172
|
position: relative;
|
|
@@ -1179,68 +1179,68 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1179
1179
|
${e=>e.blocked?"":`border: 1px solid ${e.theme.colorPrimary};`}
|
|
1180
1180
|
${e=>e.blocked?"cursor: default":"cursor: pointer"}
|
|
1181
1181
|
}
|
|
1182
|
-
`,Gn=
|
|
1182
|
+
`,Gn=pe.img`
|
|
1183
1183
|
border-radius: 50%;
|
|
1184
1184
|
height: 40px;
|
|
1185
1185
|
margin-bottom: 12px;
|
|
1186
1186
|
width: 40px;
|
|
1187
|
-
`,qn=
|
|
1187
|
+
`,qn=pe(Vn)`
|
|
1188
1188
|
${e=>T(e)} {
|
|
1189
1189
|
${Op}
|
|
1190
1190
|
|
|
1191
1191
|
background: ${({theme:e})=>e.colorBackground};
|
|
1192
1192
|
}
|
|
1193
|
-
`,Kn=
|
|
1193
|
+
`,Kn=pe.div`
|
|
1194
1194
|
color: ${({theme:e})=>e.colorPrimary};
|
|
1195
1195
|
display: flex;
|
|
1196
1196
|
flex-flow: row nowrap;
|
|
1197
1197
|
align-items: center;
|
|
1198
1198
|
margin-left: 20px;
|
|
1199
|
-
`,Yn=
|
|
1199
|
+
`,Yn=pe.div`
|
|
1200
1200
|
white-space: nowrap;
|
|
1201
|
-
`,Xn=
|
|
1201
|
+
`,Xn=pe.div`
|
|
1202
1202
|
background: #d8fed8;
|
|
1203
1203
|
border-radius: 6px;
|
|
1204
1204
|
float: right;
|
|
1205
1205
|
margin-bottom: 12px;
|
|
1206
1206
|
padding: 4px 10px;
|
|
1207
|
-
`,Mp=
|
|
1207
|
+
`,Mp=pe.p`
|
|
1208
1208
|
font-weight: bold;
|
|
1209
1209
|
font-size: 18px;
|
|
1210
1210
|
line-height: 22px;
|
|
1211
1211
|
letter-spacing: calc(18px * -0.01);
|
|
1212
1212
|
margin: 0;
|
|
1213
|
-
`,Jn=
|
|
1213
|
+
`,Jn=pe(Mp)`
|
|
1214
1214
|
margin-bottom: 4px;
|
|
1215
|
-
`,Up=
|
|
1215
|
+
`,Up=pe.p`
|
|
1216
1216
|
font-weight: bold;
|
|
1217
1217
|
font-size: 16px;
|
|
1218
1218
|
line-height: 20px;
|
|
1219
1219
|
letter-spacing: calc(16px * -0.01);
|
|
1220
1220
|
margin: 0;
|
|
1221
|
-
`,Qn=
|
|
1221
|
+
`,Qn=pe(Up)`
|
|
1222
1222
|
margin-bottom: 4px;
|
|
1223
1223
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1224
1224
|
`}
|
|
1225
|
-
`,We=
|
|
1225
|
+
`,We=pe.p`
|
|
1226
1226
|
color: ${({theme:e})=>e.colorText};
|
|
1227
1227
|
font-weight: normal;
|
|
1228
1228
|
font-size: 14px;
|
|
1229
1229
|
line-height: 22px;
|
|
1230
1230
|
margin: 0;
|
|
1231
|
-
`,Zn=
|
|
1231
|
+
`,Zn=pe.p`
|
|
1232
1232
|
color: ${({theme:e})=>e.colorText};
|
|
1233
1233
|
font-weight: 600;
|
|
1234
1234
|
font-size: 12px;
|
|
1235
1235
|
line-height: 16px;
|
|
1236
1236
|
margin: 0;
|
|
1237
|
-
`;We.Loud=
|
|
1237
|
+
`;We.Loud=pe(We)`
|
|
1238
1238
|
font-weight: 600;
|
|
1239
|
-
`;We.Quiet=
|
|
1239
|
+
`;We.Quiet=pe(We)`
|
|
1240
1240
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1241
1241
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1242
1242
|
`}
|
|
1243
|
-
`;var Rn=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=
|
|
1243
|
+
`;var Rn=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=Q(),{primaryCTAClickSideEffects:n}=ne();o=i(o);let{imageUri:r=null,subtitle:s=null,title:d=null,complete:c=!1,blocked:a=!1}=e,C=e.primaryButtonTitle||e.secondaryButtonTitle,p=()=>{n(e)};return Mt.createElement(jn,{className:l("carouselCard",o),onClick:a?null:p,style:t,blocked:a,complete:c},r&&Mt.createElement(Gn,{className:l("carouselCardImage",o),src:r,alt:d,style:{opacity:c||a?.4:1}}),(c||!0)&&Mt.createElement(Xn,{className:l("carouselCompletedPill",o)},Mt.createElement(Zn,{style:{color:"#108E0B"}},"Complete")),d&&Mt.createElement(Qn,{blocked:a,complete:c,className:l("carouselCardTitle",o)},d),s&&Mt.createElement(We.Quiet,{blocked:a,complete:c,className:l("carouselCardSubtitle",o)},s))};import oo from"react";var es=({numberOfStepsCompleted:e,numberOfSteps:t,appearance:o})=>{let i=t>0?e/t:0,n=200,r=Math.min(n,Math.max(10,Math.round(n*i)));return oo.createElement(Kn,{className:l("carouselProgressBar",o)},oo.createElement(Yn,{as:We.Loud,style:{marginRight:8}},e," of ",t),oo.createElement("svg",{height:10,width:n},oo.createElement("rect",{x:0,y:0,rx:5,width:n,height:10,fill:"#E6E6E6"}),oo.createElement("rect",{x:0,y:0,rx:5,width:r,height:10,fill:"currentColor"})))};var zp=()=>se.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},se.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),se.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),se.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),ts=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,n]=yt(!1),[r,s]=yt(!1);dr(()=>{t===!0&&i===!1?n(!0):t===!1&&i===!0&&s(!0)},[t]);let d=()=>{n(!1),s(!1)},c=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return i?se.createElement(Wn,{style:c,reversed:r,onAnimationEnd:r?d:null},se.createElement(Hn,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},se.createElement(zp,null))):null},os=({flowId:e,appearance:t,customVariables:o,className:i})=>{let n=_p(null),[r,s]=yt(!1),[d,c]=yt(!1),[a,C]=yt(null),[p,f]=yt([]),[y,E]=yt(0),{getFlowMetadata:u,getFlowSteps:x,getNumberOfStepsCompleted:v,updateCustomVariables:k,getFlowStatus:B,isLoading:F,targetingLogicShouldHideFlow:h,getFlow:m}=J();dr(()=>{k(o)},[o,F]),dr(()=>{if(F)return;let A=u(e),U=v(e),D=x(e);C(A),A.data!==null&&(f(D.sort(($,le)=>Number($.complete)-Number(le.complete))),c(D.length>3),E(U))},[F]);let S=[];for(let A=0;A<p.length;A+=3)S.push(p.slice(A,A+3));let w=A=>{let U=A.target,D=U.scrollWidth-U.clientWidth,$=Math.ceil(U.scrollLeft);$>0&&r===!1&&s(!0),$===0&&r===!0&&s(!1),$<D&&d===!1&&c(!0),$===D&&d===!0&&c(!1)},I=(A=!0)=>{let U=A?1:-1;n.current!==null&&n.current.scrollBy({left:n.current.clientWidth*U,behavior:"smooth"})},H=null,V=A=>{H!==null?clearTimeout(H):w(A),H=setTimeout(()=>{w(A)},16)};return F?null:se.createElement(qn,{className:Ce(l("carouselContainer",t),i)},se.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:20}},se.createElement("div",null,se.createElement(Jn,{className:l("carouselTitle",t)},a==null?void 0:a.title),se.createElement(We.Quiet,{className:l("carouselSubtitle",t)},a==null?void 0:a.subtitle)),se.createElement(es,{numberOfStepsCompleted:y,numberOfSteps:p.length})),se.createElement("div",{style:{position:"relative"}},se.createElement(ts,{show:r,onClick:()=>I(!1)}),se.createElement(ts,{side:"right",show:d,onClick:I}),se.createElement(_n,{ref:n,onScroll:V},S.map((A,U)=>se.createElement(zn,{key:U,style:{flex:`0 0 calc(100% - ${p.length>3?36:0}px)`}},A.map((D,$)=>se.createElement(Rn,{key:$,stepData:D,style:{flex:p.length>3?"0 1 calc(33% - 16px * 2 / 3)":1},appearance:t})))))),se.createElement(oe,{appearance:t}))};var cr=({flowId:e,title:t,subtitle:o,style:i,initialSelectedStep:n,className:r,type:s="inline",onDismiss:d,visible:c,customVariables:a,onStepCompletion:C,onButtonClick:p,appearance:f,hideOnFlowCompletion:y,setVisible:E,customStepTypes:u,checklistStyle:x="default",autoExpandFirstIncompleteStep:v,autoExpandNextStep:k,...B})=>{let{getFlow:F,getFlowSteps:h,markStepCompleted:m,getStepStatus:S,getNumberOfStepsCompleted:w,isLoading:I,targetingLogicShouldHideFlow:H,updateCustomVariables:V,getFlowMetadata:A,isStepBlocked:U,getFlowStatus:D,hasActiveFullPageFlow:$,setHasActiveFullPageFlow:le}=J(),{primaryCTAClickSideEffects:ce,secondaryCTAClickSideEffects:N}=ne(),{getOpenFlowState:Fe,setOpenFlowState:ke}=Pe(),[R,G]=is(n||0),[re,he]=is(!1),ie=c===void 0?Fe(e):c,L=s==="modal",{mergeAppearanceWithDefault:ee}=Q(),{isLarge:_}=yn();if(f=ee(f),rs(()=>{V(a)},[a,I]),rs(()=>{c!==void 0&&(L&&c===!0?le(!0):L&&c===!1&&le(!1))},[c,E,$]),I)return null;let ae=F(e);if(!ae||H(ae))return null;let q=h(e);if(!q||y===!0&&D(e)===X)return null;let Y=A(e);if(Y!=null&&Y.title&&(t=Y.title),Y!=null&&Y.subtitle&&(o=Y.subtitle),!re&&n===void 0&&w(e)>0){let W=q.findIndex(qe=>qe.complete===!1);G(W>-1?W:q.length-1),he(!0)}function je(){if(R+1>=q.length){L&&ke(e,!1);return}U(e,q[R+1].id)||G(R+1)}function Ge(W,qe,so){let Cr=R+1<q.length?q[R+1]:null;p&&p(W,R,qe,Cr)===!0&&L&&g(),C&&C(W,so,Cr),!C&&!p&&(W.primaryButtonUri||W.secondaryButtonUri)&&L&&g()}function wt(){return q.map((W,qe)=>({...W,handleSecondaryButtonClick:()=>{je(),N(W),W.skippable===!0&&m(e,W.id,{skipped:!0}),Ge(W,"secondary",qe)},handlePrimaryButtonClick:()=>{(!W.completionCriteria&&(W.autoMarkCompleted||W.autoMarkCompleted===void 0)||W.completionCriteria&&W.autoMarkCompleted===!0)&&(m(e,W.id),je()),Ge(W,"primary",qe),ce(W),S(e,W.id)===Oe&&je()}}))}function j(){return de.createElement(oe,{appearance:f})}let Be={steps:wt(),title:t,subtitle:o,primaryColor:f.theme.colorPrimary,appearance:f,customStepTypes:u,type:s,className:r,autoExpandFirstIncompleteStep:v,autoExpandNextStep:k};function g(){ke(e,!1),d&&d(),E&&E(!1)}function b(){return de.createElement(de.Fragment,null,de.createElement(j,null),de.createElement(os,{flowId:e,appearance:f,customVariables:a,className:r}))}function P(){return de.createElement(de.Fragment,null,de.createElement(j,null),de.createElement(pr,{visible:ie,onClose:()=>{g()},selectedStep:R,setSelectedStep:G,autoExpandNextStep:!0,appearance:f,...Be}))}function z(){if(!_)return P();let W=B.guideFlowId,qe;return W&&F(W)&&(qe=h(W)),de.createElement(de.Fragment,null,de.createElement(j,null),de.createElement(ar,{visible:ie,stepsTitle:Y.stepsTitle?Y.stepsTitle:"Your quick start guide",onClose:()=>{g()},selectedStep:R,setSelectedStep:G,guideData:qe,guideTitle:B.guideTitle??"Guide",appearance:f,title:t,subtitle:o,onGuideButtonClick:so=>{Ge(so,"link",0)},customStepTypes:u,...Be}))}function me(){if(!_)return P();let W=de.createElement(sr,{flowId:e,style:i,selectedStep:R,setSelectedStep:G,appearance:f,type:s,...Be});return L?de.createElement(rt,{onClose:()=>{g()},visible:ie,appearance:f,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},de.createElement(j,null),W):de.createElement(de.Fragment,null,de.createElement(j,null),W)}switch(x){case"condensed":return P();case"with-guide":return z();case"default":return me();case"carousel":return b();default:return me()}};var Hp=e=>Wp.createElement(cr,{type:"inline",...e});import dt,{useEffect as jp}from"react";import He from"react";import No from"styled-components";var ns=No.div`
|
|
1244
1244
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1245
1245
|
border-radius: 8px;
|
|
1246
1246
|
padding: 6px 10px 6px 10px;
|
|
@@ -1267,7 +1267,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1267
1267
|
display: flex;
|
|
1268
1268
|
height: 100%;
|
|
1269
1269
|
align-items: center;
|
|
1270
|
-
`;import{motion as Vp}from"framer-motion";var ps=({title:e,count:t,total:o,onClick:i,style:n={},className:r,appearance:s,type:
|
|
1270
|
+
`;import{motion as Vp}from"framer-motion";var ps=({title:e,count:t,total:o,onClick:i,style:n={},className:r,appearance:s,type:d="default"})=>He.createElement(He.Fragment,null,He.createElement(oe,{appearance:s}),He.createElement(ns,{as:Vp.div,whileHover:{opacity:.9},whileTap:{scale:.98},onClick:()=>i!==void 0&&i(),style:{...d=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...n},className:Ce(r??"",l("progressRingContainer",s)),appearance:s},d=="condensed"&&o&&o!==0&&He.createElement(as,{className:l("progressRingContainer",s)},He.createElement(vt,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),He.createElement(ss,{type:d,className:l("badgeTitleContainer",s)},He.createElement(ls,{type:d,appearance:s,className:l("badgeTitle",s)},e),i!==void 0&&He.createElement(Dt,{className:l("badgeChevron",s),color:s.theme.colorPrimary})),d=="default"&&o&&o!==0&&He.createElement(ze,{display:"compact",count:t,total:o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:s})));import pt from"react";import ro from"styled-components";var ds=ro.div`
|
|
1271
1271
|
display: flex;
|
|
1272
1272
|
flex-direction: row;
|
|
1273
1273
|
width: 100%;
|
|
@@ -1305,7 +1305,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1305
1305
|
:hover {
|
|
1306
1306
|
opacity: 0.8;
|
|
1307
1307
|
}
|
|
1308
|
-
`;var fs=({title:e,subtitle:t,icon:o,appearance:i,count:n,total:r,className:s,style:
|
|
1308
|
+
`;var fs=({title:e,subtitle:t,icon:o,appearance:i,count:n,total:r,className:s,style:d})=>pt.createElement(pt.Fragment,null,pt.createElement(ds,{appearance:i,className:Ce(l("fullWidthProgressBadgeContainer",i),s??""),style:d},o&&pt.createElement(cs,{className:l("fullWidthProgressBadgeIcon",i)},o),pt.createElement(ms,null,pt.createElement(Se,{size:"small",appearance:i,title:e,subtitle:t})),pt.createElement(us,{className:l("fullWidthProgressBadgeProgressContainer",i)},pt.createElement(ze,{count:n,total:r,display:"percent",textLocation:"top",fillColor:i.theme.colorPrimary}))));var Gp=({flowId:e,title:t,subtitle:o,icon:i,style:n,onClick:r,className:s,customVariables:d,hideOnFlowCompletion:c,appearance:a,type:C="default"})=>{let{getFlow:p,getFlowSteps:f,getFlowStatus:y,getNumberOfStepsCompleted:E,isLoading:u,targetingLogicShouldHideFlow:x,updateCustomVariables:v}=J(),{mergeAppearanceWithDefault:k}=Q();a=k(a);let{setOpenFlowState:B,getOpenFlowState:F}=Pe();if(jp(()=>{v(d)},[d,u]),u)return null;let h=p(e);if(!h||x(h)||c===!0&&y(e)===X)return null;let m=f(e),S=E(e);return C==="full-width"?dt.createElement(dt.Fragment,null,dt.createElement(oe,{appearance:a}),dt.createElement(fs,{title:t,subtitle:o,count:S,total:m.length,style:n,className:s,appearance:a,icon:i,onClick:()=>{}})):dt.createElement(dt.Fragment,null,dt.createElement(oe,{appearance:a}),dt.createElement(ps,{count:S,total:m.length,title:t,style:n,onClick:()=>{B(e,!0),r&&r()},type:C,className:s,appearance:a}))};import qp from"react";var Kp=({flowId:e,style:t,appearance:o,...i})=>{let{getFlow:n,targetingLogicShouldHideFlow:r,getFlowSteps:s}=J(),{mergeAppearanceWithDefault:d}=Q();o=d(o);let c=n(e);if(!c||r(c))return null;let a=s(e);return qp.createElement(to,{steps:a,style:t,appearance:o,...i})};import _t,{useContext as nd,useEffect as sd}from"react";import O,{useEffect as Lo,useLayoutEffect as xs,useRef as Zp,useState as io}from"react";import no from"styled-components";import{useCallback as Yp,useEffect as Xp,useState as Jp}from"react";var mr=(e,t,o,i={x:20,y:20},n)=>{let r=n=="fixed"?0:window.scrollY,s=n=="fixed"?0:window.scrollX;return!e||!e.left||!e.top?{x:0,y:0}:t==="left"?{x:e.left-o+i.x+s,y:e.top-i.y+r}:t==="right"?{x:e.left+e.width+i.x+s,y:e.top-i.y+r}:{x:0,y:0}},gs={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Qp(e){let t=gs;return e&&(t=e.getBoundingClientRect()),t}function hs(e,t){let[o,i]=Jp(gs),n=Yp(()=>{e&&i(Qp(e))},[e]);return Xp(()=>(n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)),[e,t]),o}var Cs=300,Ss=100,Rp=500,Ut=12,ed=no.div`
|
|
1309
1309
|
width: 100%;
|
|
1310
1310
|
height: 100%;
|
|
1311
1311
|
border-radius: 9999px;
|
|
@@ -1346,7 +1346,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1346
1346
|
`,rd=no(ys)`
|
|
1347
1347
|
width: ${Ut+12}px;
|
|
1348
1348
|
height: ${Ut+12}px;
|
|
1349
|
-
`,id=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:n=!0,primaryColor:r="#000000",offset:s={x:0,y:0},visible:
|
|
1349
|
+
`,id=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:n=!0,primaryColor:r="#000000",offset:s={x:0,y:0},visible:d=!0,containerStyle:c={},selectedStep:a=0,customStepTypes:C,appearance:p,dismissible:f=!1,showHighlightOnly:y,showStepCount:E=!0,completedStepsCount:u=0,showFrigadeBranding:x=!1})=>{var Y,je,Ge,wt;let[v,k]=io(),[B,F]=io(new Date),h=Zp(null),[m,S]=io(document.querySelector(e[a].selector)),w=hs(m,B),[I,H]=io(),[V,A]=io(!y),U=(je=(Y=e[a])==null?void 0:Y.props)!=null&&je.position?e[a].props.position:"absolute",D=((wt=(Ge=e[a])==null?void 0:Ge.props)==null?void 0:wt.zIndex)??90,$=(v==null?void 0:v.width)??Cs,le=(v==null?void 0:v.height)??Ss;xs(()=>{h.current&&k({width:h.current.clientWidth,height:h.current.clientHeight})},[a,B,U]),Lo(()=>{y||A(!0)},[a]);let ce=i==="auto"?"right":i,N=mr(w,ce,$,s,U),Fe=w.right+$>(window.innerWidth||document.documentElement.clientWidth),ke=w.bottom+Ss>(window.innerHeight||document.documentElement.clientHeight);Fe&&i==="auto"&&(N=mr(w,"left",$,s,U),ce="left");let R=window.location.pathname.split("/").pop(),G=()=>{let j=document.querySelector(e[a].selector);I&&I===JSON.stringify(j==null?void 0:j.getBoundingClientRect())||(S(j),F(new Date),j&&H(JSON.stringify(j.getBoundingClientRect())))};if(Lo(()=>{let j=new MutationObserver(G);return j.observe(document.body,{subtree:!0,childList:!0}),()=>j.disconnect()},[G]),Lo(()=>{let j=new MutationObserver(G);return j.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>j.disconnect()},[G]),Lo(()=>{let j=setInterval(()=>{G()},10);return()=>clearInterval(j)},[G]),xs(()=>{setTimeout(()=>{G()},Rp),G()},[a,R]),m===null)return O.createElement(O.Fragment,null);if(N.x==0&&N.y==0)return O.createElement(O.Fragment,null);if(!d)return O.createElement(O.Fragment,null);let re=()=>{let j=()=>{if(e[a].handlePrimaryButtonClick&&(e[a].handlePrimaryButtonClick(),A(!1),setTimeout(()=>{G()},30)),u===e.length-1)return o()},Be=()=>{e[a].handleSecondaryButtonClick&&(e[a].handleSecondaryButtonClick(),y&&!e[a].secondaryButtonUri&&A(!1))};return O.createElement(O.Fragment,null,E&&e.length>1&&O.createElement(Ar,null,O.createElement(Nr,{className:l("tooltipStepCounter",p)},a+1," of ",e.length)),O.createElement(Ir,{showStepCount:E,className:l("tooltipCTAContainer",p)},e[a].secondaryButtonTitle&&O.createElement(te,{title:e[a].secondaryButtonTitle,appearance:p,onClick:Be,size:"small",withMargin:!1,secondary:!0}),e[a].primaryButtonTitle&&O.createElement(te,{title:e[a].primaryButtonTitle,appearance:p,onClick:j,withMargin:!1,size:"small"})))},he=()=>O.createElement(O.Fragment,null,f&&O.createElement(Pr,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:l("tooltipClose",p)},O.createElement(ve,null)),e[a].imageUri&&O.createElement(vr,{dismissible:f,appearance:p,src:e[a].imageUri,className:l("tooltipImageContainer",p)}),e[a].videoUri&&!e[a].imageUri&&O.createElement(Er,{dismissible:f,appearance:p,className:l("tooltipVideoContainer",p)},O.createElement(Bt,{appearance:p,videoUri:e[a].videoUri})),O.createElement(Se,{appearance:p,title:e[a].title,subtitle:e[a].subtitle,size:"small"}),O.createElement(Br,{className:l("tooltipFooter",p)},O.createElement(re,null))),L={...{default:j=>{var Be;if((Be=e[a])!=null&&Be.StepContent){let g=e[a].StepContent;return O.createElement("div",null,g)}return O.createElement(he,null)}},...C},ee=()=>{var j;return e?!((j=e[a])!=null&&j.type)||!L[e[a].type]?L.default(e[a]):L[e[a].type]({stepData:e[a],primaryColor:r}):O.createElement(O.Fragment,null)};if(y&&e[a].complete===!0)return null;let _={top:(N==null?void 0:N.y)-Ut,left:(ce=="left"?w.x+s.x:(N==null?void 0:N.x)-Ut)??0,cursor:y?"pointer":"default",position:U},ae=()=>{let Be=_.left+(ce=="left"?-$:24);return Math.min(Math.max(Be,20),window.innerWidth-$-20)},q=()=>{y&&(F(new Date),A(!V))};return O.createElement(od,null,O.createElement(rd,{style:_,zIndex:D,className:l("tourHighlightContainer",p)},n&&e[a].showHighlight!==!1&&O.createElement(O.Fragment,null,O.createElement(td,{style:{position:U},onClick:q,primaryColor:p.theme.colorPrimary,className:l("tourHighlightInnerCircle",p)}),O.createElement(ed,{style:{position:"absolute"},onClick:q,primaryColor:p.theme.colorPrimary,className:l("tourHighlightOuterCircle",p)}))),O.createElement(ys,{style:{..._,left:ae()},zIndex:D+1,className:l("tooltipContainerWrapper",p)},V&&O.createElement(O.Fragment,null,O.createElement(po,{ref:h,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:12,...c},appearance:p,className:l("tooltipContainer",p),maxWidth:Cs,zIndex:D+10},O.createElement(ee,null)),x&&O.createElement(Or,{className:l("poweredByFrigadeTooltipRibbon",p),appearance:p,zIndex:D+10},O.createElement(co,{appearance:p})))))},Oo=id;import{Portal as ld}from"react-portal";var ad=({flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:n,showTooltipsSimultaneously:r=!1,onDismiss:s,dismissible:d,tooltipPosition:c="auto",showHighlightOnly:a=!1,dismissBehavior:C="complete-flow",onComplete:p,...f})=>{let{getFlow:y,getFlowSteps:E,isLoading:u,targetingLogicShouldHideFlow:x,markStepCompleted:v,markStepStarted:k,markFlowCompleted:B,updateCustomVariables:F,getCurrentStepIndex:h,getStepStatus:m,isStepBlocked:S,getFlowStatus:w,getNumberOfStepsCompleted:I}=J(),{isLoadingUserFlowStateData:H}=Ie(),{primaryCTAClickSideEffects:V,secondaryCTAClickSideEffects:A}=ne(),{hasOpenModals:U}=Pe(),D=h(e),{openFlowStates:$}=nd(K),{mergeAppearanceWithDefault:le}=Q();if(o=le(o),sd(()=>{F(t)},[t,u]),H)return null;let ce=y(e);if(!ce||x(ce)||w(e)==X||U())return null;let N=E(e);if(Object.keys($).length>0){let L=Object.keys($).find(ee=>$[ee]===!0);if(L!==void 0&&L!==e)return _t.createElement(_t.Fragment,null)}async function Fe(L){if(await v(e,L.id),N.map(ee=>m(e,ee.id)).every(ee=>ee===Oe)){await B(e);return}if(!a&&D+1<N.length){if(S(e,N[D+1].id))return;await k(e,N[D+1].id)}}function ke(L,ee,_){let ae=D+1<N.length?N[D+1]:null;n&&n(L,D,ee,ae),i&&i(L,_,ae)}function R(){return N.map(L=>({...L,handleSecondaryButtonClick:async()=>{A(L),L.skippable===!0&&await v(e,L.id,{skipped:!0}),ke(L,"secondary",D)},handlePrimaryButtonClick:async()=>{(!L.completionCriteria&&(L.autoMarkCompleted||L.autoMarkCompleted===void 0)||L.completionCriteria&&L.autoMarkCompleted===!0)&&await Fe(L),ke(L,"primary",D),V(L)}}))}async function G(L){s&&s(),C==="complete-flow"?await B(e):await v(e,L.id)}function re(){p&&p()}let he=!document.querySelector(N[D].selector);function ie(){let L=N.findIndex(ee=>!!document.querySelector(ee.selector));return N.map((ee,_)=>he&&!r&&_!==L?null:_t.createElement(Oo,{key:ee.id,appearance:o,steps:R(),selectedStep:_,showTooltipsSimultaneously:r,dismissible:d,onDismiss:()=>G(ee),tooltipPosition:c,showHighlightOnly:a,completedStepsCount:I(e),onComplete:re,...f}))}return _t.createElement(ld,null,_t.createElement(oe,{appearance:o}),r||he?ie():_t.createElement(Oo,{appearance:o,steps:R(),selectedStep:D,showTooltipsSimultaneously:r,dismissible:d,onDismiss:()=>G(N[D]),tooltipPosition:c,completedStepsCount:I(e),showHighlightOnly:a,onComplete:re,...f}))};import be,{useEffect as pd,useRef as dd,useState as cd}from"react";import{Portal as md}from"react-portal";import bt from"styled-components";var bs=bt.button`
|
|
1350
1350
|
${e=>T(e)} {
|
|
1351
1351
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1352
1352
|
|
|
@@ -1434,7 +1434,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1434
1434
|
font-size: 14px;
|
|
1435
1435
|
|
|
1436
1436
|
padding: 8px 12px;
|
|
1437
|
-
`;import{AnimatePresence as Ns,motion as Ls}from"framer-motion";import Es from"react";var Bs=({style:e,className:t})=>Es.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Es.createElement("path",{fill:"currentColor",d:"M13.43 4.938a4.494 4.494 0 00-1.043-1.435A4.955 4.955 0 009 2.197c-1.276 0-2.48.464-3.387 1.305A4.502 4.502 0 004.57 4.938a4.242 4.242 0 00-.386 1.773v.475c0 .109.087.197.196.197h.95a.197.197 0 00.197-.197V6.71c0-1.749 1.557-3.17 3.473-3.17s3.473 1.421 3.473 3.17c0 .718-.254 1.393-.738 1.955a3.537 3.537 0 01-1.9 1.125 1.928 1.928 0 00-1.085.682c-.271.343-.42.768-.42 1.206v.552c0 .109.088.197.197.197h.95a.197.197 0 00.196-.197v-.552c0-.276.192-.519.457-.578a4.904 4.904 0 002.625-1.56c.335-.392.597-.828.778-1.3a4.256 4.256 0 00-.103-3.303zM9 13.834a.985.985 0 10.001 1.97.985.985 0 00-.001-1.97z"}));import As from"react";var Is=({style:e,className:t})=>As.createElement("svg",{style:e,className:t,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor"},As.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"}));var ud=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:n="inline",title:r="Help",appearance:s})=>{let{getFlow:
|
|
1437
|
+
`;import{AnimatePresence as Ns,motion as Ls}from"framer-motion";import Es from"react";var Bs=({style:e,className:t})=>Es.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Es.createElement("path",{fill:"currentColor",d:"M13.43 4.938a4.494 4.494 0 00-1.043-1.435A4.955 4.955 0 009 2.197c-1.276 0-2.48.464-3.387 1.305A4.502 4.502 0 004.57 4.938a4.242 4.242 0 00-.386 1.773v.475c0 .109.087.197.196.197h.95a.197.197 0 00.197-.197V6.71c0-1.749 1.557-3.17 3.473-3.17s3.473 1.421 3.473 3.17c0 .718-.254 1.393-.738 1.955a3.537 3.537 0 01-1.9 1.125 1.928 1.928 0 00-1.085.682c-.271.343-.42.768-.42 1.206v.552c0 .109.088.197.197.197h.95a.197.197 0 00.196-.197v-.552c0-.276.192-.519.457-.578a4.904 4.904 0 002.625-1.56c.335-.392.597-.828.778-1.3a4.256 4.256 0 00-.103-3.303zM9 13.834a.985.985 0 10.001 1.97.985.985 0 00-.001-1.97z"}));import As from"react";var Is=({style:e,className:t})=>As.createElement("svg",{style:e,className:t,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor"},As.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"}));var ud=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:n="inline",title:r="Help",appearance:s})=>{let{getFlow:d,getFlowSteps:c,markStepCompleted:a,getStepStatus:C,getNumberOfStepsCompleted:p,isLoading:f,targetingLogicShouldHideFlow:y}=J(),{primaryCTAClickSideEffects:E}=ne(),u=dd(null),[x,v]=cd(!1),{mergeAppearanceWithDefault:k}=Q();s=k(s),pd(()=>(document.addEventListener("click",B,!1),()=>{document.removeEventListener("click",B,!1)}),[]);let B=w=>{u.current&&!u.current.contains(w.target)&&v(!1)};if(f)return null;let F=d(e);if(!F||y(F))return null;let h=c(e);if(!h||!i)return null;function m(w,I){!w.completionCriteria&&(w.autoMarkCompleted||w.autoMarkCompleted===void 0)&&a(e,w.id),E(w),o&&o(w,I),v(!1)}function S(){return x&&be.createElement(Ps,{className:l("floatingWidgetMenu",s),as:Ls.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:n},h.map((w,I)=>be.createElement(vs,{className:l("floatingWidgetMenuItem",s),key:I,onClick:()=>m(w,I)},w.title)))}return n=="inline"?be.createElement("span",{ref:u},be.createElement(bs,{style:t,onClick:()=>{v(!x)},className:l("supportButton",s)},be.createElement(Ts,{className:l("supportIconContainer",s)},be.createElement(Is,{className:l("supportIcon",s),style:{width:"18px",height:"18px"}})),be.createElement(ws,{className:l("supportButtonTitle",s)},r)),be.createElement(Ns,null,be.createElement(S,null))):be.createElement(md,null,be.createElement(Fs,{style:t,ref:u},be.createElement(Ns,null,be.createElement(S,null)),be.createElement(ks,{onClick:()=>{v(!x)},as:Ls.button,whileHover:{scale:1.1},className:l("floatingWidgetButton",s)},be.createElement(Bs,{className:l("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import Ve,{useEffect as fd}from"react";import Do from"styled-components";var Os=Do.div`
|
|
1438
1438
|
${e=>T(e)} {
|
|
1439
1439
|
display: flex;
|
|
1440
1440
|
flex-direction: column;
|
|
@@ -1470,7 +1470,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1470
1470
|
opacity: 0.8;
|
|
1471
1471
|
}
|
|
1472
1472
|
}
|
|
1473
|
-
`;var gd=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:s,dismissible:
|
|
1473
|
+
`;var gd=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:s,dismissible:d})=>{let{getFlow:c,markFlowCompleted:a,markStepCompleted:C,isLoading:p,targetingLogicShouldHideFlow:f,updateCustomVariables:y,getFlowSteps:E,getFlowStatus:u,getCurrentStepIndex:x}=J(),{primaryCTAClickSideEffects:v}=ne(),{mergeAppearanceWithDefault:k}=Q();if(n=k(n),fd(()=>{y(o)},[o,p]),p)return null;let B=c(e);if(!B||f(B)||u(e)===X)return null;let h=E(e)[x(e)];return Ve.createElement(Ve.Fragment,null,Ve.createElement(oe,{appearance:n}),Ve.createElement(Os,{appearance:n,className:Ce(l("embeddedTipContainer",n),r),style:s},(d===!0||h.dismissible)&&Ve.createElement(Ms,{onClick:async()=>{await a(e),t&&t()},className:l("embeddedTipDismissButton",n)},Ve.createElement(ve,null)),Ve.createElement(Ds,null,Ve.createElement(Se,{size:"small",appearance:n,title:h.title,subtitle:h.subtitle})),h.primaryButtonTitle&&Ve.createElement($s,{className:l("embeddedTipCallToActionContainer",n)},Ve.createElement(te,{classPrefix:"embeddedTip",title:h.primaryButtonTitle,appearance:n,withMargin:!1,size:"small",type:"inline",onClick:async()=>{h.handlePrimaryButtonClick(),v(h),!(i&&i(h,x(e),"primary")===!1)&&(await C(e,h.id),await a(e))}}))))};import xe,{useEffect as hd}from"react";import zt from"styled-components";var Us=zt.div`
|
|
1474
1474
|
// use the :not annotation
|
|
1475
1475
|
${e=>T(e)} {
|
|
1476
1476
|
display: flex;
|
|
@@ -1515,7 +1515,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1515
1515
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1516
1516
|
align-items: flex-end;
|
|
1517
1517
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1518
|
-
`;import Hs from"react";var Vs=({style:e,className:t})=>Hs.createElement("svg",{style:e,className:t,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor"},Hs.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"}));var xd=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:n,onButtonClick:r,appearance:s,type:
|
|
1518
|
+
`;import Hs from"react";var Vs=({style:e,className:t})=>Hs.createElement("svg",{style:e,className:t,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor"},Hs.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"}));var xd=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:n,onButtonClick:r,appearance:s,type:d="full-width",icon:c})=>{let{getFlow:a,markFlowCompleted:C,isLoading:p,targetingLogicShouldHideFlow:f,updateCustomVariables:y,getFlowMetadata:E,getFlowStatus:u,getFlowSteps:x,getCurrentStepIndex:v}=J(),{primaryCTAClickSideEffects:k}=ne(),{mergeAppearanceWithDefault:B}=Q();if(s=B(s),hd(()=>{y(n)},[n,p]),p)return null;let F=a(e);if(!F||f(F)||u(e)===X)return null;let h=x(e),m=h.length>0?h[v(e)]:E(e);return m!=null&&m.title&&(t=m.title),m!=null&&m.subtitle&&(o=m.subtitle),xe.createElement(xe.Fragment,null,xe.createElement(oe,{appearance:s}),xe.createElement(Us,{type:d,appearance:s,className:l("bannerContainer",s)},d!="square"&&xe.createElement(_s,{className:l("bannerIconContainer",s)},c||xe.createElement(Vs,null)),d==="square"&&m.dismissible&&xe.createElement(fr,{type:d,className:l("bannerDismissButtonContainer",s)},xe.createElement(ur,{type:d,onClick:async()=>{await C(e),i&&i()},className:l("bannerDismissButton",s)},xe.createElement(ve,null))),xe.createElement(zs,{type:d},xe.createElement(Se,{appearance:s,title:t,subtitle:o,classPrefix:"banner"})),xe.createElement(Ws,{type:d,className:l("bannerCallToActionContainer",s)},xe.createElement(te,{title:(m==null?void 0:m.primaryButtonTitle)??"Get started",appearance:s,onClick:()=>{k(m),r&&r(m,0,"primary")},classPrefix:"banner"})),d!=="square"&&m.dismissible&&xe.createElement(fr,{type:d,className:l("bannerDismissButtonContainer",s)},xe.createElement(ur,{type:d,onClick:async()=>{await C(e),i&&i()},className:l("bannerDismissButton",s)},xe.createElement(ve,null)))))};import Z,{useEffect as Cd}from"react";import{Portal as Sd}from"react-portal";import tt from"styled-components";var js=tt.div`
|
|
1519
1519
|
${e=>T(e)} {
|
|
1520
1520
|
display: flex;
|
|
1521
1521
|
flex-direction: column;
|
|
@@ -1602,5 +1602,5 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map
|
|
|
1602
1602
|
opacity: 0.8;
|
|
1603
1603
|
}
|
|
1604
1604
|
}
|
|
1605
|
-
`;var yd=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:s})=>{let{getFlow:
|
|
1605
|
+
`;var yd=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:s})=>{let{getFlow:d,markFlowCompleted:c,markStepCompleted:a,getNumberOfStepsCompleted:C,isLoading:p,targetingLogicShouldHideFlow:f,updateCustomVariables:y,getFlowSteps:E,getFlowStatus:u,getCurrentStepIndex:x}=J(),{primaryCTAClickSideEffects:v}=ne(),{mergeAppearanceWithDefault:k}=Q(),[B,F]=Z.useState(null),[h,m]=Z.useState(""),{hasOpenModals:S,setKeepCompletedFlowOpenDuringSession:w,shouldKeepCompletedFlowOpenDuringSession:I}=Pe();if(n=k(n),Cd(()=>{y(o)},[o,p]),p)return null;let H=d(e);if(!H||f(H)||u(e)===X||C(e)===1&&!I(e)||S())return null;let A=E(e)[x(e)];function U(){return Z.createElement(Z.Fragment,null,Z.createElement(xr,null,Z.createElement(Se,{size:"large",appearance:n,title:A.title,subtitle:A.subtitle})),Z.createElement(gr,{className:l("npsNumberButtonContainer",n),appearance:n},Array.from(Array(10).keys()).map($=>Z.createElement(Gs,{className:l("npsNumberButton",n),selected:B===$+1,key:$,onClick:async()=>{w(e),F($+1),await a(e,A.id,{score:$+1})},appearance:n},$+1))),Z.createElement(qs,{appearance:n},Z.createElement(hr,{appearance:n},"Not likely at all"),Z.createElement(hr,{appearance:n},"Extremely likely")))}function D(){return Z.createElement(Z.Fragment,null,Z.createElement(xr,null,Z.createElement(Se,{appearance:n,title:"Why did you choose this score?",size:"large"})),Z.createElement(Ks,{appearance:n,value:h,onChange:$=>{m($.target.value)},placeHolder:"Add your optional fedback here..."}),Z.createElement(gr,{appearance:n,className:l("npsNumberButtonContainer",n)},Z.createElement(te,{size:"large",withMargin:!1,onClick:async()=>{await c(e),i&&i(A,1,"primary")},appearance:n,title:A.secondaryButtonTitle||"Skip",secondary:!0}),Z.createElement(te,{size:"large",withMargin:!1,onClick:async()=>{await a(e,A.id,{feedbackText:h}),await c(e),i&&i(A,1,"primary")},appearance:n,title:A.primaryButtonTitle||"Submit"})))}return Z.createElement(Sd,null,Z.createElement(oe,{appearance:n}),Z.createElement(js,{appearance:n,className:Ce(l("npsSurveyContainer",n),r),style:s},Z.createElement(Ys,{onClick:async()=>{await c(e),t&&t()},className:l("npsSurveyDismissButton",n)},Z.createElement(ve,null)),C(e)==0&&U(),C(e)==1&&D()))};export{Xe as CheckBox,nt as FormLabel,Go as FormTextField,xd as FrigadeBanner,cr as FrigadeChecklist,Ye as FrigadeDefaultAppearance,gd as FrigadeEmbeddedTip,wi as FrigadeForm,Kp as FrigadeGuide,Hp as FrigadeHeroChecklist,yd as FrigadeNPSSurvey,Gp as FrigadeProgressBadge,ja as FrigadeProvider,ud as FrigadeSupportWidget,ad as FrigadeTour,vt as ProgressRing,Pe as useFlowOpens,Ht as useFlowResponses,J as useFlows,tr as useOrganization,Vt as useUser};
|
|
1606
1606
|
//# sourceMappingURL=index.mjs.map
|