@frigade/react 1.32.47 → 1.32.48
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 +1 -0
- package/lib/index.js +226 -209
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +228 -211
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import{ThemeProvider as va}from"styled-components";import gt,{useContext as Fa,useEffect as wo,useState as Yo}from"react";import{useCallback as dt,useContext as Qs,useEffect as Zs}from"react";import Lo,{useMemo as _s}from"react";var cr="1.32.47 ";var ke="https://api.frigade.com/v1/public/",Ie="NOT_STARTED_STEP",X="COMPLETED_FLOW",no="ABORTED_FLOW",pt="STARTED_FLOW",Le="NOT_STARTED_FLOW",Oe="COMPLETED_STEP",so="STARTED_STEP";function $e(){let{publicApiKey:e,userId:t}=Lo.useContext(q);return{config:_s(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":cr,"X-Frigade-SDK-Platform":"React"}}),[e,t])}}var Ws="frigade-last-call-at-",zs="frigade-last-call-data-";function Tt(){let{shouldGracefullyDegrade:e}=Lo.useContext(q);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),Wt();let r=Ws+t,n=zs+t;if(window&&window.localStorage&&o&&o.body&&o.method==="POST"){let s=window.localStorage.getItem(r),p=window.localStorage.getItem(n);if(s&&p&&p==o.body){let d=new Date(s);if(new Date().getTime()-d.getTime()<1e3)return Wt()}window.localStorage.setItem(r,new Date().toISOString()),window.localStorage.setItem(n,o.body)}let i;try{i=await fetch(t,o)}catch(s){return Wt(s)}return i?i.ok?i:Wt(i.statusText):Wt()}}function Wt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Ft(){let{publicApiKey:e,shouldGracefullyDegrade:t}=Lo.useContext(q);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 Ys,useState as mr}from"react";import{useContext as js,useEffect as Gs,useState as Vs}from"react";import qs from"swr";import{useContext as Hs}from"react";function ve(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:r,completedFlowsToKeepOpenDuringSession:n}=Hs(q);function i(c,u=!1){return e[c]??u}function s(c,u){t(w=>({...w,[c]:u}))}function p(c){t(u=>{let{[c]:w,...T}=u;return{...T}})}function d(c){n.includes(c)||r(u=>[...u,c])}function a(c){return n.includes(c)}function f(){return Object.values(e).some(c=>c)||o}return{getOpenFlowState:i,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:f,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:a}}var Ks="unknown";function Be(){let{config:e}=$e(),{publicApiKey:t,userId:o,flows:r,setShouldGracefullyDegrade:n}=js(q),{resetOpenFlowState:i}=ve(),[s,p]=Vs(!1),d={data:r.map(y=>({flowId:y.id,flowState:X,lastStepId:null,userId:o,foreignUserId:o,stepStates:{},shouldTrigger:!1}))},a=y=>fetch(y,e).then(C=>{if(C.ok)return C.json();throw new Error("Failed to fetch user flow states")}).catch(C=>(console.log(`Error fetching ${y}: ${C}. Will gracefully degrade and hide Frigade`),n(!0),d)),{data:f,isLoading:c,mutate:u,error:w}=qs(t&&r&&o?`${ke}userFlowStates?foreignUserId=${encodeURIComponent(o)}`:null,a,{revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),T=f==null?void 0:f.data;Gs(()=>{!s&&!c&&T&&p(!0)},[T,s,c]);async function S(y){if(T){let C=T.find(m=>m.flowId===y);C&&C.flowState!==X&&(C.flowState=X),await u(Promise.resolve({...f,data:T}),{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1})}}async function h(y,C,m){if(T){let x=T.find(F=>F.flowId===y);x&&(x.stepStates[C]=m,x.flowState=pt),await u(Promise.resolve({...f,data:T}),{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1})}}async function E(y,C,m){if(T){let x=T.find(F=>F.flowId===y);x&&(x.lastStepId=C,x.stepStates[C]=m,x.flowState=pt),await u({...f,data:T},{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1})}}async function P(y){if(T){let C=T.find(m=>m.flowId===y);C&&C.flowState!==Le&&(C.flowState=Le,C.lastStepId=Ks,Object.keys(C.stepStates).forEach(m=>{C.stepStates[m].actionType=Ie,C.stepStates[m].createdAt=new Date().toISOString()}),await u({...f,data:T},{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1}),i(y))}}async function A(y,C){if(T){let m=T.find(x=>x.flowId===y);m&&m.stepStates[C]!==Ie&&(m.stepStates[C]=Ie),await u({...f,data:T},{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:T,isLoadingUserFlowStateData:!s,mutateUserFlowState:u,optimisticallyMarkFlowCompleted:S,optimisticallyMarkFlowNotStarted:P,optimisticallyMarkStepCompleted:h,optimisticallyMarkStepNotStarted:A,optimisticallyMarkStepStarted:E,error:w}}function zt(){let{config:e}=$e(),{userFlowStatesData:t,mutateUserFlowState:o}=Be(),{failedFlowResponses:r,setFailedFlowResponses:n,flowResponses:i,setFlowResponses:s}=Ys(q),[p,d]=mr(new Set),[a,f]=mr(new Set),c=Tt();function u(S){let h=JSON.stringify(S);if(p.has(h))return null;p.add(h),d(p),a.add(S),f(a);let E=i==null?void 0:i.find(P=>P.flowSlug===S.flowSlug&&P.stepId===S.stepId&&P.actionType===S.actionType&&P.createdAt===S.createdAt);return c(`${ke}flowResponses`,{...e,method:"POST",body:h}).then(P=>{P.status!==200&&P.status!==201?(console.log("Failed to send flow response for step "+S.stepId+". Will retry again later."),n([...r,S])):E||s(A=>[...A??[],S])})}async function w(S){S.foreignUserId&&(S.actionType===pt||S.actionType===Le?await u(S):S.actionType===X?await u(S):S.actionType===so?await u(S):S.actionType===Oe?await u(S):S.actionType===no?await u(S):S.actionType===Ie&&await u(S))}function T(){let S=[];return t==null||t.forEach(h=>{if(h&&h.stepStates&&Object.keys(h.stepStates).length!==0)for(let E in h.stepStates){let P=h.stepStates[E];S.push({foreignUserId:h.foreignUserId,flowSlug:h.flowId,stepId:P.stepId,actionType:P.actionType,data:{},createdAt:new Date(P.createdAt),blocked:P.blocked,hidden:P.hidden})}}),[...S,...i]}return{addResponse:w,setFlowResponses:s,getFlowResponses:T}}import Rs from"swr";var Xs=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,ur=e=>{let t=Xs.exec(e);if(t===null)return null;let o=null;return t.forEach((r,n)=>{let i=Js(r,"'","");i.startsWith("flow_")&&(o=i)}),o},Js=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function J(){let{config:e}=$e(),{flows:t,setFlows:o,userId:r,publicApiKey:n,customVariables:i,setCustomVariables:s,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,setFlowResponses:a,setShouldGracefullyDegrade:f}=Qs(q),c={data:[]},{verifySDKInitiated:u}=Ft(),{addResponse:w,getFlowResponses:T}=zt(),S=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`),f(!0),c)).catch(b=>(console.log(`Error fetching ${g}: ${b}. Will gracefully degrade and hide Frigade`),f(!0),c)),{userFlowStatesData:h,isLoadingUserFlowStateData:E,optimisticallyMarkFlowCompleted:P,optimisticallyMarkFlowNotStarted:A,optimisticallyMarkStepCompleted:y,optimisticallyMarkStepNotStarted:C,optimisticallyMarkStepStarted:m}=Be(),{data:x,error:F,isLoading:L}=Rs(n?`${ke}flows`:null,S,{keepPreviousData:!0});Zs(()=>{if(F){console.error(F);return}x&&x.data&&(x.data=o(x.data))},[x,F]);function U(g){if(L)return null;let b=t.find(v=>v.slug===g);return!b&&t.length>0&&!E&&!L?(console.log(`Flow with slug ${g} not found`),null):(b==null?void 0:b.active)===!1?null:b}function M(g){var H;if(!U(g))return[];let b=U(g).data;return b?(b=I(b),(((H=JSON.parse(b))==null?void 0:H.data)??[]).map(ce=>{let z=oe(ce);return{handleSecondaryButtonClick:()=>{ce.skippable===!0&&_(g,ce.id,{skipped:!0})},...ce,complete:O(g,ce.id)===Oe||z>=1,blocked:te(g,ce.id),hidden:xe(g,ce.id),handlePrimaryButtonClick:()=>{(!ce.completionCriteria&&(ce.autoMarkCompleted||ce.autoMarkCompleted===void 0)||ce.completionCriteria&&ce.autoMarkCompleted===!0)&&_(g,ce.id)},progress:z}}).filter(ce=>ce.hidden!==!0)):[]}function I(g){return g.replace(/\${(.*?)}/g,(b,v)=>i[v]!==void 0?String(i[v]):"")}function j(g){if(!U(g))return[];let b=U(g).data;return b?(b=I(b),JSON.parse(b)??{}):[]}function B(g,b){s(v=>({...v,[g]:b}))}function $(g){!E&&!L&&g&&JSON.stringify(i)!=JSON.stringify({...i,...g})&&Object.keys(g).forEach(b=>{B(b,g[b])})}let re=dt(async(g,b,v)=>{u();let H={foreignUserId:r,flowSlug:g,stepId:b,actionType:so,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};G(H)&&(await m(g,b,H),w(H))},[r,h]),R=dt(async(g,b,v)=>{u();let H={foreignUserId:r,flowSlug:g,stepId:b,actionType:Ie,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};G(H)&&(await C(g,b),w(H))},[r,h]),_=dt(async(g,b,v)=>{u();let H={foreignUserId:r,flowSlug:g,stepId:b,actionType:Oe,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};G(H)&&(await y(g,b,H),w(H))},[r,h]),he=dt(async(g,b)=>{if(u(),K(g)===Le)return;let v={foreignUserId:r,flowSlug:g,stepId:"unknown",actionType:Le,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};await A(g),G(v)&&w(v)},[r,h]),Fe=dt(async(g,b)=>{u();let v={foreignUserId:r,flowSlug:g,stepId:"unknown",actionType:pt,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};G(v)&&w(v)},[r,h]),W=dt(async(g,b)=>{u();let v={foreignUserId:r,flowSlug:g,stepId:"unknown",actionType:X,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};G(v)&&(await P(g),w(v))},[r,h]),se=dt(async(g,b)=>{u();let v={foreignUserId:r,flowSlug:g,stepId:"unknown",actionType:no,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};G(v)&&(await P(g),w(v))},[r,h]);function G(g){var b;if(!h&&g.actionType===Ie)return!1;if(h){let v=h.find(H=>H.flowId===g.flowSlug);if(g.actionType===Ie&&(!(v!=null&&v.stepStates[g.stepId])||v.stepStates[g.stepId].actionType===Ie)||v&&((b=v.stepStates[g.stepId])==null?void 0:b.actionType)===g.actionType||v&&v.flowState===X&&g.actionType===X)return!1}return!0}function O(g,b){let v=Ce(g,b);return E?null:v?v.actionType:Ie}function te(g,b){let v=Ce(g,b);return v?v.blocked:!1}function xe(g,b){let v=Ce(g,b);return v?v.hidden:!1}function Ce(g,b){if(E)return null;let v=h==null?void 0:h.find(H=>H.flowId===g);return!v||!v.stepStates[b]?null:v.stepStates[b]??null}function V(g){var v;if(E||!h)return null;if(K(g)===Le)return M(g)[0]??null;let b=(v=h.find(H=>H.flowId===g))==null?void 0:v.lastStepId;return b?M(g).find(H=>H.id===b):null}function de(g){let b=V(g);if(!b)return 0;let v=M(g).findIndex(H=>H.id===b.id)??0;return O(g,b.id)===Oe&&v<M(g).length-1?v+1:v}function oe(g){if(!g.completionCriteria)return;let b=ur(g.completionCriteria);if(b===null)return;let v=je(b),H=Ge(b);return H===0?void 0:v/H}function K(g){let b=h==null?void 0:h.find(v=>v.flowId===g);return b?b.flowState:null}function je(g){let b=M(g);return b.length===0?0:b.filter(H=>O(g,H.id)===Oe).length}function Ge(g){return M(g).length}function Y(g){return JSON.parse(t.find(b=>b.slug===g).data)}function Se(g){if(E)return!0;if(g!=null&&g.targetingLogic&&h){let b=h.find(v=>v.flowId===g.slug);if(b)return b.shouldTrigger===!1}return!!(g!=null&&g.targetingLogic&&r&&r.startsWith("guest_"))}function lt(g){return!Se(U(g))}return{getFlow:U,getFlowData:Y,isLoading:E||L,getStepStatus:O,getFlowSteps:M,getCurrentStepIndex:de,markStepStarted:re,markStepCompleted:_,markFlowNotStarted:he,markFlowStarted:Fe,markFlowCompleted:W,markFlowAborted:se,markStepNotStarted:R,getFlowStatus:K,getNumberOfStepsCompleted:je,getNumberOfSteps:Ge,targetingLogicShouldHideFlow:Se,setCustomVariable:B,updateCustomVariables:$,customVariables:i,getStepOptionalProgress:oe,getFlowMetadata:j,isStepBlocked:te,isStepHidden:xe,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,isFlowAvailableToUser:lt}}import{useCallback as fr,useContext as el,useEffect as tl}from"react";var kt="guest_";function Ht(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:r,shouldGracefullyDegrade:n}=el(q),{config:i}=$e(),{mutateUserFlowState:s}=Be(),p=Tt(),{verifySDKInitiated:d}=Ft();tl(()=>{if(e&&!t){if(e.startsWith(kt))return;let c=`frigade-user-registered-${e}`;localStorage.getItem(c)||(p(`${ke}users`,{...i,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(c,"true"))}},[e,n,t]);let a=fr(async c=>{d();let u={foreignId:e,properties:c};await p(`${ke}users`,{...i,method:"POST",body:JSON.stringify(u)}),r(w=>({...w,...c})),s()},[e,i,n,s]),f=fr(async(c,u)=>{d();let T={foreignId:e,events:[{event:c,properties:u}]};await p(`${ke}users`,{...i,method:"POST",body:JSON.stringify(T)}),s()},[e,i,s]);return{userId:e,setUserId:o,addPropertiesToUser:a,trackEventForUser:f}}import{v4 as ka}from"uuid";import Ue,{useEffect as ya,useState as ba}from"react";import Ve,{useEffect as ll}from"react";import ao from"styled-components";import ol from"react";import rl from"styled-components";var gr="fr-",jt="cfr-";function l(e,t){let o=`${gr}${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 k(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(gr)?"":`:not(${o.map(r=>`.${r}`).join(", ")})`}function Oo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function ct(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Oo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function ye(...e){return e.filter(Boolean).join(" ")}function hr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var il=rl.div`
|
|
2
|
+
import ht,{createContext as Oa,useEffect as Jo,useState as Ne}from"react";import{ThemeProvider as Da}from"styled-components";import gt,{useContext as Na,useEffect as wo,useState as Xo}from"react";import{useCallback as dt,useContext as il,useEffect as nl}from"react";import Lo,{useMemo as qs}from"react";var mr="1.32.48 ";var Fe="https://api.frigade.com/v1/public/",Ae="NOT_STARTED_STEP",Y="COMPLETED_FLOW",no="ABORTED_FLOW",pt="STARTED_FLOW",Le="NOT_STARTED_FLOW",Oe="COMPLETED_STEP",so="STARTED_STEP";function $e(){let{publicApiKey:e,userId:t}=Lo.useContext(G);return{config:qs(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":mr,"X-Frigade-SDK-Platform":"React"}}),[e,t])}}var Ks="frigade-last-call-at-",Ys="frigade-last-call-data-";function Tt(){let{shouldGracefullyDegrade:e}=Lo.useContext(G);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),zt();let i=Ks+t,n=Ys+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 d=new Date(s);if(new Date().getTime()-d.getTime()<1e3)return zt()}window.localStorage.setItem(i,new Date().toISOString()),window.localStorage.setItem(n,o.body)}let r;try{r=await fetch(t,o)}catch(s){return zt(s)}return r?r.ok?r:zt(r.statusText):zt()}}function zt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Ft(){let{publicApiKey:e,shouldGracefullyDegrade:t}=Lo.useContext(G);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 tl,useState as ur}from"react";import{useContext as Js,useEffect as Qs,useState as Zs}from"react";import Rs from"swr";import{useContext as Xs}from"react";function ve(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:n}=Xs(G);function r(c,u=!1){return e[c]??u}function s(c,u){t(w=>({...w,[c]:u}))}function p(c){t(u=>{let{[c]:w,...T}=u;return{...T}})}function d(c){n.includes(c)||i(u=>[...u,c])}function a(c){return n.includes(c)}function f(){return Object.values(e).some(c=>c)||o}return{getOpenFlowState:r,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:f,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:a}}var el="unknown";function Ie(){let{config:e}=$e(),{publicApiKey:t,userId:o,flows:i,setShouldGracefullyDegrade:n}=Js(G),{resetOpenFlowState:r}=ve(),[s,p]=Zs(!1),d={data:i.map(y=>({flowId:y.id,flowState:Y,lastStepId:null,userId:o,foreignUserId:o,stepStates:{},shouldTrigger:!1}))},a=y=>fetch(y,e).then(C=>{if(C.ok)return C.json();throw new Error("Failed to fetch user flow states")}).catch(C=>(console.log(`Error fetching ${y}: ${C}. Will gracefully degrade and hide Frigade`),n(!0),d)),{data:f,isLoading:c,mutate:u,error:w}=Rs(t&&i&&o?`${Fe}userFlowStates?foreignUserId=${encodeURIComponent(o)}`:null,a,{revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),T=f==null?void 0:f.data;Qs(()=>{!s&&!c&&T&&p(!0)},[T,s,c]);async function S(y){if(T){let C=T.find(m=>m.flowId===y);C&&C.flowState!==Y&&(C.flowState=Y),await u(Promise.resolve({...f,data:T}),{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1})}}async function x(y,C,m){if(T){let h=T.find(F=>F.flowId===y);h&&(h.stepStates[C]=m,h.flowState=pt),await u(Promise.resolve({...f,data:T}),{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1})}}async function E(y,C,m){if(T){let h=T.find(F=>F.flowId===y);h&&(h.lastStepId=C,h.stepStates[C]=m,h.flowState=pt),await u({...f,data:T},{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1})}}async function P(y){if(T){let C=T.find(m=>m.flowId===y);C&&C.flowState!==Le&&(C.flowState=Le,C.lastStepId=el,Object.keys(C.stepStates).forEach(m=>{C.stepStates[m].actionType=Ae,C.stepStates[m].createdAt=new Date().toISOString()}),await u({...f,data:T},{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1}),r(y))}}async function B(y,C){if(T){let m=T.find(h=>h.flowId===y);m&&m.stepStates[C]!==Ae&&(m.stepStates[C]=Ae),await u({...f,data:T},{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:T,isLoadingUserFlowStateData:!s,mutateUserFlowState:u,optimisticallyMarkFlowCompleted:S,optimisticallyMarkFlowNotStarted:P,optimisticallyMarkStepCompleted:x,optimisticallyMarkStepNotStarted:B,optimisticallyMarkStepStarted:E,error:w}}function Wt(){let{config:e}=$e(),{userFlowStatesData:t,mutateUserFlowState:o}=Ie(),{failedFlowResponses:i,setFailedFlowResponses:n,flowResponses:r,setFlowResponses:s}=tl(G),[p,d]=ur(new Set),[a,f]=ur(new Set),c=Tt();function u(S){let x=JSON.stringify(S);if(p.has(x))return null;p.add(x),d(p),a.add(S),f(a);let E=r==null?void 0:r.find(P=>P.flowSlug===S.flowSlug&&P.stepId===S.stepId&&P.actionType===S.actionType&&P.createdAt===S.createdAt);return c(`${Fe}flowResponses`,{...e,method:"POST",body:x}).then(P=>{P.status!==200&&P.status!==201?(console.log("Failed to send flow response for step "+S.stepId+". Will retry again later."),n([...i,S])):E||s(B=>[...B??[],S])})}async function w(S){S.foreignUserId&&(S.actionType===pt||S.actionType===Le?await u(S):S.actionType===Y?await u(S):S.actionType===so?await u(S):S.actionType===Oe?await u(S):S.actionType===no?await u(S):S.actionType===Ae&&await u(S))}function T(){let S=[];return t==null||t.forEach(x=>{if(x&&x.stepStates&&Object.keys(x.stepStates).length!==0)for(let E in x.stepStates){let P=x.stepStates[E];S.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})}}),[...S,...r]}return{addResponse:w,setFlowResponses:s,getFlowResponses:T}}import sl from"swr";var ol=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,fr=e=>{let t=ol.exec(e);if(t===null)return null;let o=null;return t.forEach((i,n)=>{let r=rl(i,"'","");r.startsWith("flow_")&&(o=r)}),o},rl=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function X(){let{config:e}=$e(),{flows:t,setFlows:o,userId:i,publicApiKey:n,customVariables:r,setCustomVariables:s,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,setFlowResponses:a,setShouldGracefullyDegrade:f}=il(G),c={data:[]},{verifySDKInitiated:u}=Ft(),{addResponse:w,getFlowResponses:T}=Wt(),S=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`),f(!0),c)).catch(b=>(console.log(`Error fetching ${g}: ${b}. Will gracefully degrade and hide Frigade`),f(!0),c)),{userFlowStatesData:x,isLoadingUserFlowStateData:E,optimisticallyMarkFlowCompleted:P,optimisticallyMarkFlowNotStarted:B,optimisticallyMarkStepCompleted:y,optimisticallyMarkStepNotStarted:C,optimisticallyMarkStepStarted:m}=Ie(),{data:h,error:F,isLoading:L}=sl(n?`${Fe}flows`:null,S,{keepPreviousData:!0});nl(()=>{if(F){console.error(F);return}h&&h.data&&(h.data=o(h.data))},[h,F]);function U(g){if(L)return null;let b=t.find(v=>v.slug===g);return!b&&t.length>0&&!E&&!L?(console.log(`Flow with slug ${g} not found`),null):(b==null?void 0:b.active)===!1?null:b}function $(g){var H;if(!U(g))return[];let b=U(g).data;return b?(b=A(b),(((H=JSON.parse(b))==null?void 0:H.data)??[]).map(ce=>{let W=oe(ce);return{handleSecondaryButtonClick:()=>{ce.skippable===!0&&z(g,ce.id,{skipped:!0})},...ce,complete:I(g,ce.id)===Oe||W>=1,blocked:te(g,ce.id),hidden:xe(g,ce.id),handlePrimaryButtonClick:()=>{(!ce.completionCriteria&&(ce.autoMarkCompleted||ce.autoMarkCompleted===void 0)||ce.completionCriteria&&ce.autoMarkCompleted===!0)&&z(g,ce.id)},progress:W}}).filter(ce=>ce.hidden!==!0)):[]}function A(g){return g.replace(/\${(.*?)}/g,(b,v)=>r[v]!==void 0?String(r[v]):"")}function _(g){if(!U(g))return[];let b=U(g).data;return b?(b=A(b),JSON.parse(b)??{}):[]}function N(g,b){s(v=>({...v,[g]:b}))}function M(g){!E&&!L&&g&&JSON.stringify(r)!=JSON.stringify({...r,...g})&&Object.keys(g).forEach(b=>{N(b,g[b])})}let Z=dt(async(g,b,v)=>{u();let H={foreignUserId:i,flowSlug:g,stepId:b,actionType:so,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};ne(H)&&(await m(g,b,H),w(H))},[i,x]),R=dt(async(g,b,v)=>{u();let H={foreignUserId:i,flowSlug:g,stepId:b,actionType:Ae,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};ne(H)&&(await C(g,b),w(H))},[i,x]),z=dt(async(g,b,v)=>{u();let H={foreignUserId:i,flowSlug:g,stepId:b,actionType:Oe,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};ne(H)&&(await y(g,b,H),w(H))},[i,x]),Pe=dt(async(g,b)=>{if(u(),q(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),ne(v)&&w(v)},[i,x]),ge=dt(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:pt,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};ne(v)&&w(v)},[i,x]),V=dt(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:Y,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};ne(v)&&(await P(g),w(v))},[i,x]),re=dt(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:no,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};ne(v)&&(await P(g),w(v))},[i,x]);function ne(g){var b;if(!x&&g.actionType===Ae)return!1;if(x){let v=x.find(H=>H.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===Y&&g.actionType===Y)return!1}return!0}function I(g,b){let v=Ce(g,b);return E?null:v?v.actionType:Ae}function te(g,b){let v=Ce(g,b);return v?v.blocked:!1}function xe(g,b){let v=Ce(g,b);return v?v.hidden:!1}function Ce(g,b){if(E)return null;let v=x==null?void 0:x.find(H=>H.flowId===g);return!v||!v.stepStates[b]?null:v.stepStates[b]??null}function j(g){var v;if(E||!x)return null;if(q(g)===Le)return $(g)[0]??null;let b=(v=x.find(H=>H.flowId===g))==null?void 0:v.lastStepId;return b?$(g).find(H=>H.id===b):null}function de(g){let b=j(g);if(!b)return 0;let v=$(g).findIndex(H=>H.id===b.id)??0;return I(g,b.id)===Oe&&v<$(g).length-1?v+1:v}function oe(g){if(!g.completionCriteria)return;let b=fr(g.completionCriteria);if(b===null)return;let v=je(b),H=Ge(b);return H===0?void 0:v/H}function q(g){let b=x==null?void 0:x.find(v=>v.flowId===g);return b?b.flowState:null}function je(g){let b=$(g);return b.length===0?0:b.filter(H=>I(g,H.id)===Oe).length}function Ge(g){return $(g).length}function K(g){return JSON.parse(t.find(b=>b.slug===g).data)}function Se(g){if(E)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 lt(g){return!Se(U(g))}return{getFlow:U,getFlowData:K,isLoading:E||L,getStepStatus:I,getFlowSteps:$,getCurrentStepIndex:de,markStepStarted:Z,markStepCompleted:z,markFlowNotStarted:Pe,markFlowStarted:ge,markFlowCompleted:V,markFlowAborted:re,markStepNotStarted:R,getFlowStatus:q,getNumberOfStepsCompleted:je,getNumberOfSteps:Ge,targetingLogicShouldHideFlow:Se,setCustomVariable:N,updateCustomVariables:M,customVariables:r,getStepOptionalProgress:oe,getFlowMetadata:_,isStepBlocked:te,isStepHidden:xe,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,isFlowAvailableToUser:lt}}import{useCallback as gr,useContext as ll,useEffect as al}from"react";var kt="guest_";function Ht(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:n}=ll(G),{config:r}=$e(),{mutateUserFlowState:s}=Ie(),p=Tt(),{verifySDKInitiated:d}=Ft();al(()=>{if(e&&!t){if(e.startsWith(kt))return;let c=`frigade-user-registered-${e}`;localStorage.getItem(c)||(p(`${Fe}users`,{...r,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(c,"true"))}},[e,n,t]);let a=gr(async c=>{d();let u={foreignId:e,properties:c};await p(`${Fe}users`,{...r,method:"POST",body:JSON.stringify(u)}),i(w=>({...w,...c})),s()},[e,r,n,s]),f=gr(async(c,u)=>{d();let T={foreignId:e,events:[{event:c,properties:u}]};await p(`${Fe}users`,{...r,method:"POST",body:JSON.stringify(T)}),s()},[e,r,s]);return{userId:e,setUserId:o,addPropertiesToUser:a,trackEventForUser:f}}import{v4 as La}from"uuid";import _e,{useEffect as Ea,useState as Ba}from"react";import De,{useEffect as gl}from"react";import ao from"styled-components";import pl from"react";import dl from"styled-components";var hr="fr-",Vt="cfr-";function l(e,t){let o=`${hr}${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+" "+Vt+e}return o}function k(e){if(!e.className||e.className.indexOf(Vt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(hr)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Oo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function ct(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Oo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function ye(...e){return e.filter(Boolean).join(" ")}function xr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var cl=dl.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -23,11 +23,31 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
23
23
|
opacity: 1;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
`,
|
|
26
|
+
`,Cr=({onClose:e,appearance:t})=>pl.createElement(cl,{className:l("modalBackground",t),onClick:()=>e()});import lo from"react";import ml from"styled-components";var ul=ml.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
|
-
`,Ee=()=>lo.createElement(
|
|
30
|
+
`,Ee=()=>lo.createElement(ul,null,lo.createElement("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},lo.createElement("rect",{y:"1.39844",width:"1.97669",height:"17.8213",rx:"0.988346",transform:"rotate(-45 0 1.39844)",fill:"currentColor"}),lo.createElement("rect",{x:"12.6023",width:"1.97669",height:"17.8213",rx:"0.988346",transform:"rotate(45 12.6023 0)",fill:"currentColor"})));import{Portal as hl}from"react-portal";import Tr from"react";import Do from"react";function fl({style:e,className:t}){return Do.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"54",height:"14",fill:"none",viewBox:"0 0 54 14",style:e,className:t},Do.createElement("path",{fill:"currentColor",d:"M16.293 3.476v1.036h1.593v1.256h-1.593v5.098h-1.41V5.768H14V4.512h.883V3.244c0-.67.294-1.744 1.777-1.744.515 0 .969.049 1.361.146l-.233 1.232a5.939 5.939 0 00-.833-.073c-.442 0-.662.22-.662.67zm6.534.975V5.83c-.846 0-1.63.159-2.342.476v4.56h-1.41V4.513h1.263l.086.61c.846-.451 1.655-.67 2.403-.67zm2.505-.951c-.331.33-.944.33-1.287 0a.93.93 0 01-.246-.659c0-.268.086-.487.246-.646.343-.33.956-.33 1.287 0 .343.33.343.964 0 1.305zm.061 7.366h-1.41V4.512h1.41v6.354zm6.928-5.756c.246.146.368.402.368.756v4.976c0 1.804-.858 2.658-2.672 2.658-.92 0-1.753-.146-2.514-.439l.417-1.073c.674.22 1.336.33 1.974.33.98 0 1.385-.379 1.385-1.403v-.171c-.588.134-1.09.207-1.52.207-.907 0-1.655-.305-2.231-.902-.576-.598-.87-1.39-.87-2.354 0-.963.294-1.756.87-2.354.576-.61 1.324-.914 2.231-.914 1.005 0 1.864.232 2.562.683zm-2.488 4.634a5.15 5.15 0 001.446-.22V5.951a3.695 3.695 0 00-1.446-.292c-1.08 0-1.778.841-1.778 2.048 0 1.22.699 2.037 1.778 2.037zm7.34-5.317c1.52 0 2.28.878 2.28 2.634v3.805h-1.275l-.073-.524c-.601.414-1.288.621-2.084.621-1.263 0-2.06-.658-2.06-1.731 0-1.269 1.25-2.025 3.408-2.025.135 0 .503.013.662.013v-.171c0-1.012-.343-1.451-1.115-1.451-.675 0-1.435.158-2.256.475l-.466-1.012c1.017-.427 2.01-.634 2.979-.634zm-1.839 4.756c0 .427.343.695 1.017.695.528 0 1.251-.22 1.68-.512V8.22h-.441c-1.508 0-2.256.317-2.256.963zm9.953-4.549v-2.83h1.41v7.72c0 .354-.123.598-.368.757-.71.45-1.57.67-2.562.67-.907 0-1.655-.305-2.231-.902-.577-.61-.87-1.39-.87-2.354 0-.963.293-1.756.87-2.354.576-.61 1.324-.914 2.23-.914.43 0 .933.073 1.521.207zM43.84 9.72c.503 0 .981-.098 1.447-.293V5.854a5.15 5.15 0 00-1.447-.22c-1.078 0-1.777.817-1.777 2.037s.699 2.049 1.777 2.049zM54 7.866v.439h-4.573c.184.963.858 1.512 1.827 1.512.613 0 1.275-.146 1.986-.451l.466 1.024c-.87.378-1.729.573-2.575.573-.931 0-1.692-.304-2.268-.902-.576-.61-.87-1.402-.87-2.366 0-.975.294-1.768.87-2.366.576-.597 1.324-.902 2.244-.902.968 0 1.691.33 2.17.975.478.647.723 1.464.723 2.464zm-4.61-.586h3.298c-.086-1.073-.613-1.731-1.581-1.731-.969 0-1.582.695-1.717 1.731z"}),Do.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M1.196 1.229A4.009 4.009 0 014.08 0l4.092.027C9.183.027 10 .867 10 1.904c0 .6-.273 1.133-.7 1.478-.31.25-.7.399-1.126.4h-.001l-4.09-.027h-.002a4.804 4.804 0 00-2.614.77A4.986 4.986 0 000 5.974v-1.78C0 3.036.456 1.988 1.196 1.23zm4.525 4.65a4.282 4.282 0 00-1.184 2.513l3.637.023c.131 0 .259-.015.382-.042h.002c.81-.178 1.42-.908 1.44-1.788v-.046a1.9 1.9 0 00-.533-1.328 1.813 1.813 0 00-.908-.508h-.002l-.002-.001a1.68 1.68 0 00-.366-.042A4.084 4.084 0 005.72 5.88zm-4.525-.016A4.235 4.235 0 000 8.829C0 10.997 1.601 12.78 3.654 13V9.265h-.005l.005-.439v-.437h.023a5.175 5.175 0 011.439-3.13 5.05 5.05 0 01.72-.614l-1.754-.011H4.08c-.787 0-1.521.229-2.144.625a4.11 4.11 0 00-.74.603z",clipRule:"evenodd"}))}var Sr=fl;import yr from"styled-components";var br=yr.div`
|
|
31
|
+
background-color: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
32
|
+
position: absolute;
|
|
33
|
+
bottom: -47px;
|
|
34
|
+
left: 0;
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 40px;
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
41
|
+
`,wr=yr.div`
|
|
42
|
+
display: flex;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
align-items: center;
|
|
45
|
+
font-style: normal;
|
|
46
|
+
font-weight: 500;
|
|
47
|
+
font-size: 12px;
|
|
48
|
+
line-height: 18px;
|
|
49
|
+
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
50
|
+
`;function Fr({appearance:e}){return Tr.createElement(wr,{className:l("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",Tr.createElement(Sr,null))}var xl=ao.div`
|
|
31
51
|
${e=>k(e)} {
|
|
32
52
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
33
53
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -40,11 +60,8 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
40
60
|
}
|
|
41
61
|
|
|
42
62
|
width: ${e=>e.width??"1000px"};
|
|
43
|
-
|
|
44
63
|
z-index: 1500;
|
|
45
|
-
|
|
46
64
|
border-radius: ${e=>{var t,o;return((o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius)??8}}px;
|
|
47
|
-
|
|
48
65
|
${e=>ct(e)}
|
|
49
66
|
}
|
|
50
67
|
|
|
@@ -72,10 +89,10 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
72
89
|
opacity: 1;
|
|
73
90
|
}
|
|
74
91
|
}
|
|
75
|
-
`,
|
|
92
|
+
`,Cl=ao.div`
|
|
76
93
|
position: relative;
|
|
77
94
|
flex: 0 1 auto;
|
|
78
|
-
`,
|
|
95
|
+
`,Sl=ao.div`
|
|
79
96
|
position: absolute;
|
|
80
97
|
top: 24px;
|
|
81
98
|
right: 24px;
|
|
@@ -85,14 +102,14 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
85
102
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
86
103
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
87
104
|
}
|
|
88
|
-
`,
|
|
105
|
+
`,yl=ao.div`
|
|
89
106
|
overflow: scroll;
|
|
90
107
|
flex: 1 1;
|
|
91
108
|
display: flex;
|
|
92
109
|
::-webkit-scrollbar {
|
|
93
110
|
display: none;
|
|
94
111
|
}
|
|
95
|
-
`,Re=({onClose:e,visible:t,headerContent:o=null,style:
|
|
112
|
+
`,Re=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:n,appearance:r,dismissible:s=!0,showFrigadeBranding:p=!1})=>(gl(()=>{let d=a=>{a.key==="Escape"&&e()};return document.addEventListener("keydown",d),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",d)}},[e,t]),t?De.createElement(hl,null,De.createElement(Cr,{appearance:r,onClose:()=>{s&&e()}}),De.createElement(xl,{appearance:r,className:l("modalContainer",r),styleOverrides:i},s&&De.createElement(Sl,{className:l("modalClose",r),onClick:()=>e(),appearance:r},De.createElement(Ee,null)),o&&De.createElement(Cl,null,o),De.createElement(yl,null,n),p&&De.createElement(br,{appearance:r,className:l("poweredByFrigadeRibbon",r)},De.createElement(Fr,{appearance:r})))):De.createElement(De.Fragment,null));import et,{useEffect as bl}from"react";import po from"styled-components";import{Portal as wl}from"react-portal";var Tl=po.div`
|
|
96
113
|
${e=>k(e)} {
|
|
97
114
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
98
115
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -110,10 +127,10 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
110
127
|
bottom: 0;
|
|
111
128
|
margin-right: 28px;
|
|
112
129
|
margin-bottom: 28px;
|
|
113
|
-
`,
|
|
130
|
+
`,Fl=po.div`
|
|
114
131
|
position: relative;
|
|
115
132
|
flex: 1;
|
|
116
|
-
`,
|
|
133
|
+
`,kl=po.div`
|
|
117
134
|
position: absolute;
|
|
118
135
|
top: 24px;
|
|
119
136
|
right: 24px;
|
|
@@ -123,13 +140,13 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
123
140
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
124
141
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
125
142
|
}
|
|
126
|
-
`,
|
|
143
|
+
`,Pl=po.div`
|
|
127
144
|
overflow: scroll;
|
|
128
145
|
flex: 5;
|
|
129
146
|
::-webkit-scrollbar {
|
|
130
147
|
display: none;
|
|
131
148
|
}
|
|
132
|
-
`,
|
|
149
|
+
`,kr=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:n})=>(bl(()=>{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?et.createElement(wl,null,et.createElement(Tl,{appearance:n,className:l("cornerModalContainer",n)},et.createElement(kl,{className:l("cornerModalClose",n),onClick:()=>e()},et.createElement(Ee,null)),o&&et.createElement(Fl,null,o),et.createElement(Pl,null,i))):et.createElement(et.Fragment,null));import{useContext as vl}from"react";function J(){let{defaultAppearance:e}=vl(G);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 jt,{useEffect as Ul,useState as Wo}from"react";import Ho from"styled-components";import uo,{useEffect as El,useState as Ir}from"react";import Uo from"styled-components";import co from"styled-components";var Pr=co.label`
|
|
133
150
|
${e=>k(e)} {
|
|
134
151
|
font-size: 14px;
|
|
135
152
|
line-height: 20px;
|
|
@@ -137,14 +154,14 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
137
154
|
margin-top: 10px;
|
|
138
155
|
}
|
|
139
156
|
display: flex;
|
|
140
|
-
`,
|
|
157
|
+
`,vr=co.label`
|
|
141
158
|
${e=>k(e)} {
|
|
142
159
|
font-size: 12px;
|
|
143
160
|
line-height: 20px;
|
|
144
161
|
margin-bottom: 5px;
|
|
145
162
|
}
|
|
146
163
|
display: flex;
|
|
147
|
-
`,
|
|
164
|
+
`,Er=co.span`
|
|
148
165
|
font-weight: 400;
|
|
149
166
|
font-size: 14px;
|
|
150
167
|
line-height: 22px;
|
|
@@ -157,11 +174,11 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
157
174
|
align-items: flex-start;
|
|
158
175
|
justify-content: left;
|
|
159
176
|
margin-bottom: 10px;
|
|
160
|
-
`;import
|
|
177
|
+
`;import Mo from"react";var qe={theme:{colorPrimary:"#000000",colorText:"#000000",colorBackground:"#ffffff",colorBackgroundSecondary:"#d2d2d2",colorTextOnPrimaryBackground:"#ffffff",colorTextSecondary:"#505050",colorTextDisabled:"#999999",colorBorder:"#E5E5E5",colorTextError:"#c00000",borderRadius:20}};function tt({title:e,required:t,appearance:o=qe}){return Mo.createElement(mo,null,t?Mo.createElement(Er,{className:l("formLabelRequired",o),appearance:o},"*"):null,Mo.createElement(Pr,{className:l("formLabel",o)},e))}import Br from"react";function Pt({title:e,appearance:t}){return e?Br.createElement(mo,null,Br.createElement(vr,{className:l("formSubLabel",t)},e)):null}import{z as $o}from"zod";function Ar(e,t){try{if(t){if(t.type=="number"){let o=$o.number();if(t.props)for(let i of t.props)i.requirement=="min"?o=o.min(Number(i.value),i.message??"Value is too small"):i.requirement=="max"?o=o.max(Number(i.value),i.message??"Value is too large"):i.requirement=="positive"?o=o.positive(i.message??"Value must be positive"):i.requirement=="negative"&&(o=o.nonpositive(i.message??"Value must be negative"));o.parse(Number(e))}if(t.type=="string"){let o=$o.string();if(t.props)for(let i of t.props)i.requirement=="min"?o=o.min(Number(i.value),i.message??"Value is too short"):i.requirement=="max"?o=o.max(Number(i.value),i.message??"Value is too long"):i.requirement=="regex"&&(o=o.regex(new RegExp(String(i.value)),i.message??"Value does not match requirements"));o.parse(e)}return}}catch(o){if(o instanceof $o.ZodError)return o.issues&&o.issues.length>0?o.issues[0].message:null;console.error("Frigade Form validation failed for rule ",t,o)}return null}var Bl=Uo.div`
|
|
161
178
|
display: flex;
|
|
162
179
|
flex-direction: column;
|
|
163
180
|
width: 100%;
|
|
164
|
-
`,Uo
|
|
181
|
+
`,_o=Uo.input`
|
|
165
182
|
${e=>k(e)} {
|
|
166
183
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
167
184
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -177,7 +194,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
177
194
|
box-sizing: border-box;
|
|
178
195
|
padding: 0 10px;
|
|
179
196
|
margin-bottom: 10px;
|
|
180
|
-
`,
|
|
197
|
+
`,Al=Uo.textarea`
|
|
181
198
|
${e=>k(e)} {
|
|
182
199
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
183
200
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -193,13 +210,13 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
193
210
|
min-height: 70px;
|
|
194
211
|
box-sizing: border-box;
|
|
195
212
|
margin-bottom: 10px;
|
|
196
|
-
`;function
|
|
213
|
+
`;function zo({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:n}){let r=e,[s,p]=Ir((n==null?void 0:n.text)||""),[d,a]=Ir(!1),f=_o;El(()=>{s===""&&!d&&(a(!0),c(""))},[]);function c(w){if(p(w),o({text:w}),r.required===!0&&w.trim()===""){i([{id:r.id,message:`${r.title} is required`}]);return}let T=Ar(w,r.validation);if(T){i([{id:r.id,message:T}]);return}i([])}r.multiline&&(f=Al);function u(){var w;switch((w=r==null?void 0:r.validation)==null?void 0:w.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return uo.createElement(Bl,null,uo.createElement(tt,{title:r.title,required:r.required,appearance:t.appearance}),uo.createElement(f,{className:l("inputComponent",t.appearance),value:s,onChange:w=>{c(w.target.value)},appearance:t.appearance,placeholder:r.placeholder,type:u()}),uo.createElement(Pt,{title:r.subtitle,appearance:t.appearance}))}import Ue,{useEffect as Nr,useState as Lr}from"react";import Or from"styled-components";var Il=Or.div`
|
|
197
214
|
display: flex;
|
|
198
215
|
flex-direction: column;
|
|
199
216
|
width: 100%;
|
|
200
217
|
-webkit-appearance: none;
|
|
201
218
|
appearance: none;
|
|
202
|
-
`,
|
|
219
|
+
`,Nl=Or.select`
|
|
203
220
|
${e=>k(e)} {
|
|
204
221
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
205
222
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -223,13 +240,13 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
223
240
|
background-repeat: no-repeat;
|
|
224
241
|
background-size: 1.5em 1.5em;
|
|
225
242
|
-webkit-print-color-adjust: exact;
|
|
226
|
-
`,fo="null";function
|
|
243
|
+
`,fo="null";function Dr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var f,c,u,w,T,S;let r=e,[s,p]=Lr(((f=i==null?void 0:i.choice)==null?void 0:f[0])||""),[d,a]=Lr(!1);return Nr(()=>{var x,E,P,B;if(s===""&&!d){if(a(!0),r.requireSelection){p(fo);return}if(r.defaultValue&&((x=r.props.options)!=null&&x.find(y=>y.id===r.defaultValue))){let y=(E=r.props.options)==null?void 0:E.find(C=>C.id===r.defaultValue);p(y.id),o({choice:[y.id]})}else p(((P=r.props.options)==null?void 0:P[0].id)||""),o({choice:[((B=r.props.options)==null?void 0:B[0].id)||""]})}},[]),Nr(()=>{r.requireSelection&&s===fo?n([{message:"Please select an option",id:r.id}]):n([])},[s]),Ue.createElement(Il,null,Ue.createElement(tt,{title:r.title,required:!1,appearance:t.appearance}),Ue.createElement(Nl,{value:s,onChange:x=>{p(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:fo,value:fo},"Select an option"),(c=r.props.options)==null?void 0:c.map(x=>Ue.createElement("option",{key:x.id,value:x.id},x.title))),((w=(u=r.props.options)==null?void 0:u.find(x=>x.id===s))==null?void 0:w.isOpenEnded)&&Ue.createElement(Ue.Fragment,null,Ue.createElement(tt,{title:((S=(T=r.props.options)==null?void 0:T.find(x=>x.id===s))==null?void 0:S.openEndedLabel)??"Please specify",required:!1,appearance:t.appearance}),Ue.createElement(_o,{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 go,{useEffect as Mr,useState as $r}from"react";import Ur from"styled-components";var Ll=Ur.div`
|
|
227
244
|
display: flex;
|
|
228
245
|
flex-direction: column;
|
|
229
246
|
width: 100%;
|
|
230
247
|
-webkit-appearance: none;
|
|
231
248
|
appearance: none;
|
|
232
|
-
`,
|
|
249
|
+
`,Ol=Ur.button`
|
|
233
250
|
${e=>k(e)} {
|
|
234
251
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
235
252
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -251,7 +268,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
251
268
|
height: 60px;
|
|
252
269
|
padding: 0 18px;
|
|
253
270
|
margin-bottom: 10px;
|
|
254
|
-
`;function
|
|
271
|
+
`;function _r({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i}){var a;let n=e,[r,s]=$r((i==null?void 0:i.choice)||[]),[p,d]=$r(!1);return Mr(()=>{r.length==0&&!p&&(d(!0),o({choice:[]}))},[]),Mr(()=>{o({choice:r})},[r]),go.createElement(Ll,null,go.createElement(tt,{title:n.title,required:n.required,appearance:t.appearance}),(a=n.props.options)==null?void 0:a.map(f=>go.createElement(Ol,{appearance:t.appearance,key:f.id,value:f.id,"data-selected":r.includes(f.id),onClick:()=>{if(r.includes(f.id)){s(r.filter(c=>c!==f.id));return}r.length<n.props.maxChoices?s([...r,f.id]):r.length==1&&n.props.maxChoices==1&&s([f.id])}},f.title)),go.createElement(Pt,{title:n.subtitle,appearance:t.appearance}))}import ho from"react";import zr from"styled-components";import Dl from"dompurify";function me(e){return{__html:Dl.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var Ml=zr.h1`
|
|
255
272
|
${e=>k(e)} {
|
|
256
273
|
font-style: normal;
|
|
257
274
|
font-weight: 600;
|
|
@@ -262,7 +279,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
262
279
|
margin-bottom: 4px;
|
|
263
280
|
color: ${e=>e.appearance.theme.colorText};
|
|
264
281
|
}
|
|
265
|
-
|
|
282
|
+
`,$l=zr.h2`
|
|
266
283
|
${e=>k(e)} {
|
|
267
284
|
font-style: normal;
|
|
268
285
|
font-weight: 400;
|
|
@@ -270,35 +287,35 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
270
287
|
line-height: 20px;
|
|
271
288
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
272
289
|
}
|
|
273
|
-
`;function be({appearance:e,title:t,subtitle:o,size:
|
|
290
|
+
`;function be({appearance:e,title:t,subtitle:o,size:i="medium"}){return ho.createElement(ho.Fragment,null,ho.createElement(Ml,{appearance:e,className:l(`${i}Title`,e),dangerouslySetInnerHTML:me(t),size:i}),o&&ho.createElement($l,{appearance:e,className:l(`${i}Subtitle`,e),dangerouslySetInnerHTML:me(o),size:i}))}var _l=Ho.div`
|
|
274
291
|
display: flex;
|
|
275
292
|
flex-direction: column;
|
|
276
293
|
justify-content: flex-end;
|
|
277
294
|
padding-bottom: 14px;
|
|
278
295
|
overflow: visible;
|
|
279
|
-
`,
|
|
296
|
+
`,zl=Ho.div`
|
|
280
297
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextError}};
|
|
281
298
|
font-size: 12px;
|
|
282
299
|
margin-bottom: 12px;
|
|
283
|
-
`,
|
|
300
|
+
`,Wl=Ho.div`
|
|
284
301
|
padding-left: 1px;
|
|
285
302
|
padding-right: 1px;
|
|
286
|
-
`,
|
|
303
|
+
`,Hl={text:zo,multipleChoice:Dr,multipleChoiceList:_r};function Wr({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r,customFormElements:s}){var B;let p=t.props,[d,a]=Wo([]),[f,c]=Wo([]),{userId:u}=Ht(),[w,T]=Wo(E()||{}),S={...Hl,...s};Ul(()=>{i(d.length===0)},[d,i]);function x(y,C){let m={...w,[y.id]:C};T(m),n(m),window&&window.localStorage&&window.localStorage.setItem(P(),JSON.stringify(m))}function E(){if(window&&window.localStorage){let y=window.localStorage.getItem(P());if(y)return JSON.parse(y)}return{}}function P(){return`frigade-multiInputStepTypeData-${e}-${t.id}-${u}`}return jt.createElement(Wl,{className:l("multiInput",r)},jt.createElement(be,{appearance:r,title:t.title,subtitle:t.subtitle}),jt.createElement(_l,{className:l("multiInputContainer",r)},(B=p.data)==null?void 0:B.map(y=>{var m;let C=(m=d.reverse().find(h=>h.id===y.id))==null?void 0:m.message;return S[y.type]?jt.createElement("span",{key:y.id},S[y.type]({formInput:y,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r},onSaveInputData:h=>{!f.includes(y.id)&&h&&(h==null?void 0:h.text)!==""&&c(F=>[...F,y.id]),x(y,h)},inputData:w[y.id],setFormValidationErrors:h=>{a(F=>h.length===0?F.filter(L=>L.id!==y.id):[...F,...h])}}),C&&f.includes(y.id)&&jt.createElement(zl,{appearance:r,className:l("multiInputValidationError",r)},C)):null})))}import mt from"styled-components";var Hr=mt.div`
|
|
287
304
|
align-items: center;
|
|
288
305
|
display: flex;
|
|
289
306
|
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
290
307
|
padding-top: 14px;
|
|
291
|
-
|
|
308
|
+
`,Vr=mt.div`
|
|
292
309
|
color: ${e=>e.appearance.theme.colorTextError};
|
|
293
310
|
font-size: 12px;
|
|
294
|
-
`,
|
|
311
|
+
`,jr=mt.div`
|
|
295
312
|
display: flex;
|
|
296
313
|
gap: 12px;
|
|
297
|
-
`,
|
|
314
|
+
`,Gr=mt.div`
|
|
298
315
|
display: flex;
|
|
299
316
|
flex-direction: row;
|
|
300
317
|
flex: 1 1;
|
|
301
|
-
`,
|
|
318
|
+
`,qr=mt.div`
|
|
302
319
|
display: flex;
|
|
303
320
|
// If type is set to large-modal, use padding 60px horizontal, 80px vertical
|
|
304
321
|
// Otherwise, use 4px padding
|
|
@@ -306,11 +323,11 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
306
323
|
flex-grow: 1;
|
|
307
324
|
flex-basis: 0;
|
|
308
325
|
position: relative;
|
|
309
|
-
`,
|
|
326
|
+
`,Kr=mt.div`
|
|
310
327
|
padding: ${e=>e.type==="large-modal"?"50px":"0px"};
|
|
311
328
|
position: relative;
|
|
312
329
|
overflow-y: auto;
|
|
313
|
-
`,
|
|
330
|
+
`,Yr=mt.div`
|
|
314
331
|
display: flex;
|
|
315
332
|
align-self: stretch;
|
|
316
333
|
flex-grow: 1;
|
|
@@ -322,7 +339,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
322
339
|
background-position: center;
|
|
323
340
|
border-top-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
324
341
|
border-bottom-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
325
|
-
`;import ot from"react";import
|
|
342
|
+
`;import ot from"react";import Vl from"react";import Xr from"styled-components";var jl=Xr.button`
|
|
326
343
|
justify-content: center;
|
|
327
344
|
align-content: center;
|
|
328
345
|
${e=>k(e)} {
|
|
@@ -333,8 +350,8 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
333
350
|
${e=>e.withMargin?"margin: 16px 0px 16px 0px;":""}
|
|
334
351
|
|
|
335
352
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorPrimary}};
|
|
336
|
-
color: ${e=>{var t,o,
|
|
337
|
-
background-color: ${e=>{var t,o,
|
|
353
|
+
color: ${e=>{var t,o,i,n;return e.secondary?(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorPrimary:(n=(i=e.appearance)==null?void 0:i.theme)==null?void 0:n.colorTextOnPrimaryBackground}};
|
|
354
|
+
background-color: ${e=>{var t,o,i,n;return e.secondary?(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground:(n=(i=e==null?void 0:e.appearance)==null?void 0:i.theme)==null?void 0:n.colorPrimary}};
|
|
338
355
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
339
356
|
padding: ${e=>e.size=="small"?"6px 14px 6px 14px":"8px 20px 8px 20px"};
|
|
340
357
|
font-size: ${e=>e.size=="small"?"14px":"15px"};
|
|
@@ -352,7 +369,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
352
369
|
opacity: 0.3;
|
|
353
370
|
cursor: not-allowed;
|
|
354
371
|
}
|
|
355
|
-
`,xo=
|
|
372
|
+
`,xo=Xr.div`
|
|
356
373
|
${e=>k(e)} {
|
|
357
374
|
display: flex;
|
|
358
375
|
flex-direction: row;
|
|
@@ -362,14 +379,14 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
362
379
|
margin-right: 8px;
|
|
363
380
|
}
|
|
364
381
|
}
|
|
365
|
-
`,ee=({onClick:e,title:t,style:o,disabled:
|
|
382
|
+
`,ee=({onClick:e,title:t,style:o,disabled:i,type:n="inline",size:r="medium",secondary:s=!1,appearance:p,withMargin:d=!0,classPrefix:a=""})=>{function f(){let c=s?"buttonSecondary":"button";return a===""?c:`${a}${xr(c)}`}return Vl.createElement(jl,{secondary:s,appearance:p,disabled:i,onClick:e,style:o,type:n,withMargin:d,size:r,className:l(f(),p)},t)};var Jr=({step:e,canContinue:t,appearance:o,onPrimaryClick:i,onSecondaryClick:n,formType:r,selectedStep:s,steps:p,onBack:d,allowBackNavigation:a,errorMessage:f})=>{let c=r==="inline"?"inline":"full-width",u=p.length>1&&s!=0&&a;return ot.createElement(ot.Fragment,null,f&&ot.createElement(Vr,{appearance:o,className:l("formCTAError",o)},f),ot.createElement(Hr,{showBackButton:u,className:l("formCTAContainer",o)},u&&ot.createElement(ee,{title:"\u2190",onClick:d,secondary:!0,withMargin:!1,type:c,appearance:o}),ot.createElement(jr,{className:l("ctaWrapper",o)},e.secondaryButtonTitle?ot.createElement(ee,{title:e.secondaryButtonTitle,onClick:n,secondary:!0,withMargin:!1,type:c,appearance:o}):null," ",e.primaryButtonTitle?ot.createElement(ee,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:i,type:c,appearance:o}):null)))};import Vo from"react";import Gl from"styled-components";var ql=Gl.div`
|
|
366
383
|
text-align: center;
|
|
367
|
-
`,
|
|
384
|
+
`,Qr=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:n}=J().mergeAppearanceWithDefault(i);return Vo.createElement(ql,{className:o},Vo.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((r,s)=>Vo.createElement("rect",{key:s,x:16*s,y:0,width:8,height:8,rx:4,fill:t===s?n.colorPrimary:"#E6E6E6"}))))};import ut from"react";import vt from"styled-components";import{useContext as Kl}from"react";function se(){let e=Kl(G);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 Yl=vt.div`
|
|
368
385
|
display: flex;
|
|
369
386
|
flex-wrap: wrap;
|
|
370
387
|
align-content: center;
|
|
371
388
|
justify-content: center;
|
|
372
|
-
`,
|
|
389
|
+
`,Xl=vt.div`
|
|
373
390
|
align-content: center;
|
|
374
391
|
align-items: center;
|
|
375
392
|
display: flex;
|
|
@@ -383,10 +400,10 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
383
400
|
flex-basis: 255px;
|
|
384
401
|
flex-grow: 0;
|
|
385
402
|
flex-shrink: 0;
|
|
386
|
-
`,
|
|
403
|
+
`,Jl=vt.img`
|
|
387
404
|
width: 78px;
|
|
388
405
|
height: auto;
|
|
389
|
-
`,
|
|
406
|
+
`,Ql=vt.button`
|
|
390
407
|
font-style: normal;
|
|
391
408
|
font-weight: 600;
|
|
392
409
|
font-size: 13px;
|
|
@@ -399,11 +416,11 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
399
416
|
border-radius: 100px;
|
|
400
417
|
padding: 8px 12px;
|
|
401
418
|
margin-top: 16px;
|
|
402
|
-
`,
|
|
419
|
+
`,Zl=vt.h1`
|
|
403
420
|
font-weight: 700;
|
|
404
421
|
font-size: 28px;
|
|
405
422
|
line-height: 34px;
|
|
406
|
-
`,
|
|
423
|
+
`,Rl=vt.h2`
|
|
407
424
|
font-style: normal;
|
|
408
425
|
font-weight: 400;
|
|
409
426
|
font-size: 16px;
|
|
@@ -412,7 +429,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
412
429
|
margin-top: 12px;
|
|
413
430
|
margin-bottom: 16px;
|
|
414
431
|
max-width: 70%;
|
|
415
|
-
`;function
|
|
432
|
+
`;function Zr({stepData:e,appearance:t}){var i,n;let{handleUrl:o}=se();return ut.createElement("div",null,ut.createElement(Zl,null,e.title),ut.createElement(Rl,null,e.subtitle),ut.createElement(Yl,null,(n=(i=e.props)==null?void 0:i.links)==null?void 0:n.map(r=>ut.createElement(Xl,{key:r.title},ut.createElement(Jl,{src:r.imageUri}),ut.createElement(Ql,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{r.uri&&o(r.uri,r.uriTarget??"_blank")}},r.title)))))}import Bt,{useEffect as sa}from"react";import yo from"styled-components";import jo from"react";var Co=({style:e,className:t})=>jo.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},jo.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),jo.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 Gt,{useRef as ea,useState as ta}from"react";import So from"styled-components";var oa=So.div`
|
|
416
433
|
display: flex;
|
|
417
434
|
align-items: center;
|
|
418
435
|
justify-content: flex-start;
|
|
@@ -420,7 +437,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
420
437
|
width: 100%;
|
|
421
438
|
height: 100%;
|
|
422
439
|
position: relative;
|
|
423
|
-
`,
|
|
440
|
+
`,ra=So.div`
|
|
424
441
|
position: absolute;
|
|
425
442
|
display: flex;
|
|
426
443
|
align-items: center;
|
|
@@ -439,59 +456,59 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
439
456
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
440
457
|
border-radius: 50%;
|
|
441
458
|
}
|
|
442
|
-
`,
|
|
459
|
+
`,ia=So.video`
|
|
443
460
|
width: 100%;
|
|
444
461
|
height: 100%;
|
|
445
462
|
min-height: 200px;
|
|
446
463
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
447
|
-
`,
|
|
464
|
+
`,na=So.iframe`
|
|
448
465
|
width: 100%;
|
|
449
466
|
height: 100%;
|
|
450
467
|
min-height: 200px;
|
|
451
468
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
452
|
-
`;function Et({appearance:e,videoUri:t}){let o=
|
|
469
|
+
`;function Et({appearance:e,videoUri:t}){let o=ea(),[i,n]=ta(!1);if(t.includes("youtube")){let r=t.split("v=")[1],s=r.indexOf("&");return s!==-1&&(r=r.substring(0,s)),Gt.createElement(na,{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${r}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,appearance:e})}return Gt.createElement(oa,{appearance:e},!i&&Gt.createElement(ra,{onClick:()=>{n(!0),o.current.play()},appearance:e},Gt.createElement(Co,null)),Gt.createElement(ia,{appearance:e,controls:i,ref:o,play:i,src:t}))}var la=yo.div`
|
|
453
470
|
${e=>k(e)} {
|
|
454
471
|
display: flex;
|
|
455
472
|
flex-direction: column;
|
|
456
473
|
justify-content: center;
|
|
457
474
|
}
|
|
458
|
-
`,
|
|
475
|
+
`,aa=yo.img`
|
|
459
476
|
${e=>k(e)} {
|
|
460
477
|
width: 100%;
|
|
461
478
|
height: auto;
|
|
462
479
|
max-height: 250px;
|
|
463
480
|
margin-bottom: 24px;
|
|
464
481
|
}
|
|
465
|
-
`,
|
|
482
|
+
`,pa=yo.div`
|
|
466
483
|
${e=>k(e)} {
|
|
467
484
|
margin-bottom: 24px;
|
|
468
485
|
}
|
|
469
|
-
`,
|
|
486
|
+
`,da=yo.div`
|
|
470
487
|
${e=>k(e)} {
|
|
471
488
|
width: 100%;
|
|
472
489
|
height: auto;
|
|
473
490
|
max-height: 250px;
|
|
474
491
|
margin-bottom: 24px;
|
|
475
492
|
}
|
|
476
|
-
`;function
|
|
493
|
+
`;function Rr({stepData:e,appearance:t,setCanContinue:o}){return sa(()=>{o(!0)},[]),Bt.createElement(la,{className:l("callToActionContainer",t)},Bt.createElement(pa,{className:l("callToActionTextContainer",t)},Bt.createElement(be,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&Bt.createElement(aa,{className:l("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&Bt.createElement(da,{appearance:t,className:l("callToActionVideo",t)},Bt.createElement(Et,{appearance:t,videoUri:e.videoUri})))}import Ke,{useEffect as Go,useState as qo}from"react";import Kt from"react";import qt from"react";import{motion as ca}from"framer-motion";var ei=({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"},p={hidden:{strokeDashoffset:n,transition:s},show:{strokeDashoffset:r,transition:s}};return qt.createElement(ca.circle,{r:i,cx:o*.5,cy:o*.5,fill:"transparent",stroke:r!==n?e:"",strokeWidth:"3px",strokeDasharray:n,strokeDashoffset:t?r:0,variants:p,transition:s,initial:"hidden",animate:"show"})},ma=({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(ei,{color:n,size:t}),qt.createElement(ei,{color:e,percentage:o,size:t})),i),At=ma;import ua from"styled-components";var fa=({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"})),ga={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},ha={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},xa={border:"1px solid #000000",color:"#FFFFFF"},Ca={border:"1px solid #E6E6E6"},Sa={color:"#FFFFFF"},ya={border:"3px solid #D9D9D9"},ba=e=>e==="square"?ga:ha,wa=(e,t)=>e==="square"?t?xa:Ca:t?Sa:ya,Ta=ua.div`
|
|
477
494
|
${e=>ct(e)}
|
|
478
|
-
`,ft=({value:e,type:t="square",primaryColor:o="#000000",progress:
|
|
495
|
+
`,ft=({value:e,type:t="square",primaryColor:o="#000000",progress:i,appearance:n=qe,style:r,className:s})=>{let p=ba(t),d=wa(t,e);return e===!0?p={...p,...d,backgroundColor:o,borderColor:t==="square"?o:"none"}:p={...p,...d},e!==!0&&t==="round"&&i!==void 0&&i!==1?Kt.createElement(At,{fillColor:o,percentage:i,size:22}):Kt.createElement(Ta,{styleOverrides:p,style:r,role:"checkbox",className:ye(l("checkIconContainer",n),l(e?"checkIconContainerChecked":"checkIconContainerUnchecked",n),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&Kt.createElement(fa,{color:"#FFFFFF"}))};import rt from"styled-components";var ti=rt.div`
|
|
479
496
|
width: auto;
|
|
480
497
|
display: flex;
|
|
481
498
|
flex-direction: column;
|
|
482
499
|
justify-content: center;
|
|
483
500
|
align-items: center;
|
|
484
501
|
padding: 4px;
|
|
485
|
-
`,
|
|
502
|
+
`,oi=rt.div`
|
|
486
503
|
width: 100%;
|
|
487
504
|
text-align: left;
|
|
488
|
-
`,
|
|
505
|
+
`,ri=rt.h1`
|
|
489
506
|
font-style: normal;
|
|
490
507
|
font-weight: 700;
|
|
491
508
|
font-size: 32px;
|
|
492
509
|
line-height: 38px;
|
|
493
510
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
494
|
-
`,
|
|
511
|
+
`,ii=rt.h1`
|
|
495
512
|
font-style: normal;
|
|
496
513
|
font-weight: 400;
|
|
497
514
|
font-size: 16px;
|
|
@@ -499,7 +516,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
499
516
|
margin-top: 16px;
|
|
500
517
|
margin-bottom: 16px;
|
|
501
518
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
502
|
-
`,
|
|
519
|
+
`,ni=rt.div`
|
|
503
520
|
padding-top: 12px;
|
|
504
521
|
padding-bottom: 12px;
|
|
505
522
|
flex-direction: row;
|
|
@@ -510,17 +527,17 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
510
527
|
cursor: pointer;
|
|
511
528
|
border-bottom: ${e=>e.hideBottomBorder?"none":"1px solid #D8D8D8"};
|
|
512
529
|
width: 100%;
|
|
513
|
-
`,
|
|
530
|
+
`,si=rt.div`
|
|
514
531
|
padding-top: 10px;
|
|
515
532
|
padding-bottom: 10px;
|
|
516
533
|
flex-direction: row;
|
|
517
534
|
display: flex;
|
|
518
535
|
justify-content: flex-start;
|
|
519
|
-
`,
|
|
536
|
+
`,li=rt.img`
|
|
520
537
|
width: 42px;
|
|
521
538
|
height: 42px;
|
|
522
539
|
margin-right: 12px;
|
|
523
|
-
`,
|
|
540
|
+
`,ai=rt.p`
|
|
524
541
|
font-style: normal;
|
|
525
542
|
font-weight: 500;
|
|
526
543
|
font-size: 17px;
|
|
@@ -528,8 +545,8 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
528
545
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
529
546
|
display: flex;
|
|
530
547
|
align-self: center;
|
|
531
|
-
`;var
|
|
532
|
-
${
|
|
548
|
+
`;var pi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let n=e.props,[r,s]=qo([]),[p,d]=qo(!1),[a,f]=qo(e.id);return Go(()=>{r.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),Go(()=>{a!==e.id&&(f(e.id),s([]))},[e]),Go(()=>{o({choice:r}),r.length>=n.minChoices?t(!0):t(!1)},[r]),Ke.createElement(ti,{className:l("selectListContainer",i)},Ke.createElement(oi,null,Ke.createElement(ri,{className:l("selectListTitle",i)},e.title),Ke.createElement(ii,{appearance:i,className:l("selectListSubtitle",i)},e.subtitle)),n.options.map((c,u)=>{let w=r.includes(c.id);return Ke.createElement(ni,{key:`select-item-${u}`,onClick:()=>{if(r.includes(c.id)){s(r.filter(T=>T!==c.id));return}r.length<n.maxChoices?s([...r,c.id]):r.length==1&&n.maxChoices==1&&s([c.id])},hideBottomBorder:u===n.options.length-1,className:l("selectListSelectItem",i)},Ke.createElement(si,{className:l("selectListItemImage",i)},c.imageUri&&Ke.createElement(li,{src:c.imageUri,alt:`select-icon-${u}`}),Ke.createElement(ai,{appearance:i,className:l("selectListSelectItemText",i)},c.title)),Ke.createElement(ft,{appearance:i,value:w,primaryColor:i.theme.colorPrimary}))}))};import we,{useEffect as Ko,useState as Yt}from"react";import{AnimatePresence as Fa,motion as ka}from"framer-motion";var Pa=({children:e,id:t,shouldWrap:o=!1})=>we.createElement(we.Fragment,null,o?we.createElement(Fa,{initial:!1},we.createElement(ka.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),bo=({appearance:e,steps:t,selectedStep:o,customStepTypes:i,customVariables:n,onButtonClick:r,onStepCompletion:s,flowId:p,type:d,hideOnFlowCompletion:a,onComplete:f,setVisible:c,setShowModal:u,onDismiss:w,showPagination:T=!1,customFormElements:S,allowBackNavigation:x,validationHandler:E})=>{var Ce;let B={...{linkCollection:Zr,multiInput:Wr,callToAction:Rr,selectList:pi},...i},{primaryCTAClickSideEffects:y,secondaryCTAClickSideEffects:C}=se(),[m,h]=Yt(!1),[F,L]=Yt({}),[U,$]=Yt(!1),[A,_]=Yt(!1),[N,M]=Yt(null),Z=t[o]??null,{markStepCompleted:R,markStepStarted:z,isLoading:Pe,updateCustomVariables:ge,markFlowCompleted:V}=X();Ko(()=>{ge(n)},[n,Pe]),Ko(()=>{window&&x&&!A&&(window.location.hash=t[o].id,_(!0))},[x,A,_]),Ko(()=>{var j;if(window&&((j=window==null?void 0:window.location)!=null&&j.hash)&&window.location.hash.replace("#","")!==t[o].id){let de=window.location.hash.replace("#",""),oe=t.findIndex(q=>q.id===de);oe!==-1&&z(p,t[oe].id)}},[(Ce=window==null?void 0:window.location)==null?void 0:Ce.hash,z,o,t]);function re(){return{data:F[t[o].id]??{},stepId:t[o].id,customVariables:n}}function ne(j,de,oe){let q=o+1<t.length?t[o+1]:null;r&&r(j,o,de,q),s&&s(j,oe,q,F,re())}function I(j,de){L(oe=>{let q={};return q[j.id]=de,{...oe,...q}})}function te(j){return j.selectedStep.imageUri?we.createElement(Yr,{image:j.selectedStep.imageUri,appearance:e,className:l("formContainerSidebarImage",e)}):null}let xe=we.createElement(Jr,{step:t[o],canContinue:m&&!U,formType:d,selectedStep:o,appearance:e,onPrimaryClick:async()=>{if($(!0),E){let de=await E(t[o],o,t[o+1],F,re());if(de){M(de),$(!1);return}else M(null)}let j={...re()};await R(p,t[o].id,j),o+1<t.length&&await z(p,t[o+1].id),ne(t[o],"primary",o),o+1>=t.length&&(f&&f(),w&&w(),a&&(c&&c(!1),u(!1)),await V(p)),y(t[o]),$(!1),window&&x&&o+1<t.length&&(window.location.hash=t[o+1].id)},onSecondaryClick:()=>{ne(t[o],"secondary",o),C(t[o])},onBack:async()=>{o-1>=0&&($(!0),await z(p,t[o-1].id),$(!1))},steps:t,allowBackNavigation:x,errorMessage:N});return we.createElement(we.Fragment,null,we.createElement(Gr,{className:l("formContainer",e)},we.createElement(qr,null,we.createElement(Pa,{id:o,shouldWrap:d==="large-modal"},we.createElement(Kr,{key:Z.id,type:d,className:l("formContent",e)},t.map(j=>{let de=B[j.type];return Z.id!==j.id?null:we.createElement(de,{key:j.id,stepData:j,canContinue:m,setCanContinue:h,onSaveData:oe=>{I(j,oe)},appearance:e,customFormElements:S,flowId:p})}),T&&we.createElement(Qr,{className:l("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),xe))),d=="large-modal"&&we.createElement(te,{selectedStep:t[o]})))};import Xt from"react";import{createGlobalStyle as va}from"styled-components";function ie({appearance:e}){if(!e||!e.styleOverrides)return Xt.createElement(Xt.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([i,n])=>typeof n=="object");if(t.length===0)return Xt.createElement(Xt.Fragment,null);let o=va`
|
|
549
|
+
${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map(([s,p])=>`${Oo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return Xt.createElement(o,{inlineStyles:t})}var di=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:n,customVariables:r,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:a=!0,onStepCompletion:f,onButtonClick:c,dismissible:u=!0,endFlowOnDismiss:w=!1,modalPosition:T="center",repeatable:S=!1,onDismiss:x,showPagination:E=!1,allowBackNavigation:P=!1,validationHandler:B,showFrigadeBranding:y=!1})=>{let{getFlow:C,getFlowSteps:m,isLoading:h,targetingLogicShouldHideFlow:F,getFlowStatus:L,getCurrentStepIndex:U,markFlowCompleted:$,markFlowNotStarted:A}=X(),_=U(e),{mergeAppearanceWithDefault:N}=J(),[M,Z]=Ba(!1),{setOpenFlowState:R,getOpenFlowState:z}=ve();d=N(d);let[Pe,ge]=i!==void 0&&n!==void 0?[i,n]:[z(e,!0),I=>R(e,I)];if(Ea(()=>{!M&&!h&&(Z(!0),L(e)===Y&&S&&A(e),Z(!0))},[M,Z,h]),h)return null;let V=C(e);if(!V||F(V))return null;let re=m(e);if(!re||i!==void 0&&i===!1||L(e)===Y&&a)return null;let ne=()=>{ge(!1),x&&x(),w===!0&&$(e)};if(T=="center"&&o==="modal"||o==="large-modal"){let I={padding:"24px"};return o==="large-modal"?(I.width="85%",I.height="90%",I.maxHeight="800px",I.minHeight="500px",I.padding="0"):I.width="400px",_e.createElement(Re,{appearance:d,onClose:ne,visible:Pe,style:I,dismissible:u,showFrigadeBranding:y},_e.createElement(ie,{appearance:d}),_e.createElement(bo,{appearance:d,steps:re,selectedStep:_,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:f,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:n,setShowModal:ge,onDismiss:x,showPagination:E,customFormElements:s,allowBackNavigation:P,validationHandler:B}))}return o==="modal"&&T!=="center"?_e.createElement(kr,{appearance:d,onClose:ne,visible:Pe},_e.createElement(ie,{appearance:d}),_e.createElement(bo,{appearance:d,steps:re,selectedStep:_,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:f,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:n,setShowModal:ge,onDismiss:x,showPagination:E,customFormElements:s,allowBackNavigation:P,validationHandler:B})):_e.createElement(_e.Fragment,null,_e.createElement(ie,{appearance:d}),_e.createElement(bo,{appearance:d,steps:re,selectedStep:_,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:f,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:n,setShowModal:ge,onDismiss:x,showPagination:E,customFormElements:s,allowBackNavigation:P,validationHandler:B}))},ci=di;import{useCallback as mi,useContext as Aa,useEffect as Ia}from"react";function Yo(){let{organizationId:e,userId:t,setOrganizationId:o}=Aa(G),{mutateUserFlowState:i}=Ie(),{config:n}=$e(),r=Tt(),{verifySDKInitiated:s}=Ft();Ia(()=>{if(t&&e){if(t.startsWith(kt))return;let a=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(a)||(r(`${Fe}userGroups`,{...n,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(a,"true"))}},[t,e]);let p=mi(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 f={foreignUserId:t,foreignUserGroupId:e,properties:a};await r(`${Fe}userGroups`,{...n,method:"POST",body:JSON.stringify(f)}),i()},[e,t,n,i]),d=mi(async(a,f)=>{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 u={foreignUserId:t,foreignUserGroupId:e,events:[{event:a,properties:f}]};await r(`${Fe}userGroups`,{...n,method:"POST",body:JSON.stringify(u)}),i()},[e,t,n,i]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:p,trackEventForOrganization:d}}var ui="xFrigade_guestUserId",fi="xFrigade_userId",gi=({})=>{let{setFlowResponses:e}=Wt(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=Ie(),{userId:n,setUserId:r}=Ht(),[s,p]=Xo(null),{getFlowStatus:d}=X(),{flows:a,userProperties:f,setIsNewGuestUser:c,flowResponses:u}=Na(G),[w,T]=Xo([]),[S,x]=Xo([]),{organizationId:E}=Yo();wo(()=>{if(!o&&t)for(let C=0;C<t.length;C++){let m=t[C],h=a.find(F=>F.slug===(m==null?void 0:m.flowId));if(h&&m&&m.shouldTrigger===!0&&h.type=="FORM"&&h.triggerType==="AUTOMATIC"&&!S.includes(h.slug)){setTimeout(()=>{P(m.flowId)},500);break}}},[o,t]),wo(()=>{u.length>0&&i()},[u]);function P(C){let m=a.find(h=>h.slug===C);m&&m.triggerType==="AUTOMATIC"&&!S.includes(m.slug)&&(x([...S,m.slug]),T([m]))}function B(){if(!n){let C=localStorage.getItem(fi);if(C){r(C);return}let m=localStorage.getItem(ui);if(m){r(m);return}c(!0);let h=kt+La();try{localStorage.setItem(ui,h)}catch(F){console.log("Failed to save guest user id locally: Local storage unavailable",F)}r(F=>F||h)}}wo(()=>{try{if(a){let C=[];a.forEach(m=>{if(m.data){let h=m.data.match(/"imageUri":"(.*?)"/g);h&&h.forEach(F=>{let L=F.replace('"imageUri":"',"").replace('"',"");if(C.includes(L))return;let U=new Image;U.src=L,C.push(L)})}})}}catch{}},[a]),wo(()=>{if(n!==s&&e([]),p(n),n&&!n.startsWith(kt))try{localStorage.setItem(fi,n)}catch(C){console.log("Failed to save user id locally: Local storage available",C)}n===null&&setTimeout(()=>{n===null&&B()},50)},[n,a,f]);function y(){return gt.createElement(gt.Fragment,null,w.map(C=>d(C.slug)!==Le?null:gt.createElement("span",{key:C.slug},gt.createElement(ci,{flowId:C.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return gt.createElement(gt.Fragment,null,gt.createElement(y,null))};import{ErrorBoundary as Ma}from"react-error-boundary";var G=Oa({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:qe,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{}}),$a=({publicApiKey:e,userId:t,organizationId:o,config:i,children:n})=>{var Z,R;let[r,s]=Ne(t||null),[p,d]=Ne(o||null),[a,f]=Ne([]),[c,u]=Ne([]),[w,T]=Ne([]),[S,x]=Ne({}),[E,P]=Ne({}),[B,y]=Ne([]),[C,m]=Ne({}),[h,F]=Ne(!1),[L,U]=Ne(!1),[$,A]=Ne(!M(e)),_=(z,Pe)=>{if(Pe==="_blank"){window.open(z,"_blank");return}setTimeout(()=>{window.location.href=z},50)},N={theme:{...qe.theme,...((Z=i==null?void 0:i.defaultAppearance)==null?void 0:Z.theme)??{}},styleOverrides:{...qe.styleOverrides,...((R=i==null?void 0:i.defaultAppearance)==null?void 0:R.styleOverrides)??{}}};function M(z){return!!(z&&z.length>10&&z.substring(0,10)==="api_public")}return Jo(()=>{t&&s(t)},[t]),Jo(()=>{o&&d(o)},[o]),Jo(()=>{if(M(e))A(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),A(!0);return}},[e,A]),$?ht.createElement(G.Provider,{value:{publicApiKey:e,userId:r,setUserId:s,setFlows:f,flows:a,failedFlowResponses:c,setFailedFlowResponses:u,flowResponses:w,setFlowResponses:T,userProperties:S,setUserProperties:x,openFlowStates:E,setOpenFlowStates:P,completedFlowsToKeepOpenDuringSession:B,setCompletedFlowsToKeepOpenDuringSession:y,customVariables:C,setCustomVariables:m,isNewGuestUser:h,setIsNewGuestUser:F,hasActiveFullPageFlow:L,setHasActiveFullPageFlow:U,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:_,defaultAppearance:N,shouldGracefullyDegrade:$,setShouldGracefullyDegrade:A}},n):ht.createElement(Ma,{fallback:ht.createElement(ht.Fragment,null,n)},ht.createElement(G.Provider,{value:{publicApiKey:e,userId:r,setUserId:s,setFlows:f,flows:a,failedFlowResponses:c,setFailedFlowResponses:u,flowResponses:w,setFlowResponses:T,userProperties:S,setUserProperties:x,openFlowStates:E,setOpenFlowStates:P,completedFlowsToKeepOpenDuringSession:B,setCompletedFlowsToKeepOpenDuringSession:y,customVariables:C,setCustomVariables:m,isNewGuestUser:h,setIsNewGuestUser:F,hasActiveFullPageFlow:L,setHasActiveFullPageFlow:U,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:_,defaultAppearance:N,shouldGracefullyDegrade:$,setShouldGracefullyDegrade:A}},ht.createElement(Da,{theme:N.theme},n,ht.createElement(gi,null))))};import Op from"react";import pe,{useEffect as qn,useState as Kn}from"react";import Me,{useState as np}from"react";import St from"styled-components";import ko from"react";import xt from"react";import xi from"styled-components";var hi=xi.span`
|
|
533
550
|
font-weight: 400;
|
|
534
551
|
font-size: 15px;
|
|
535
552
|
line-height: 20px;
|
|
@@ -538,7 +555,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
538
555
|
vertical-align: middle;
|
|
539
556
|
margin-left: 12px;
|
|
540
557
|
padding-right: 12px;
|
|
541
|
-
`,
|
|
558
|
+
`,Ua=xi.div`
|
|
542
559
|
flex-direction: row;
|
|
543
560
|
justify-content: space-between;
|
|
544
561
|
display: flex;
|
|
@@ -546,17 +563,17 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
546
563
|
padding-bottom: 20px;
|
|
547
564
|
border-top: 1px solid ${e=>e.theme.colorBorder};
|
|
548
565
|
width: 100%;
|
|
549
|
-
`,To=({label:e,value:t,labelStyle:o={},labelPosition:
|
|
566
|
+
`,To=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:n,primaryColor:r="#000000",checkBoxType:s="square",appearance:p})=>xt.createElement(xt.Fragment,null,xt.createElement(Ua,{className:l("checklistStepsContainer",p),appearance:p,style:{...n}},i==="left"&&e&&xt.createElement(hi,{className:l("checklistStepLabel",p),style:o},e),xt.createElement(ft,{appearance:p,value:t,type:s,primaryColor:r}),i==="right"&&e&&xt.createElement(hi,{className:l("checklistStepLabel",p),style:o},e)),xt.createElement(ie,{appearance:p}));import{motion as _a}from"framer-motion";import Jt from"styled-components";var Ci=Jt.div`
|
|
550
567
|
font-weight: 700;
|
|
551
568
|
font-size: 18px;
|
|
552
569
|
line-height: 22px;
|
|
553
|
-
`,
|
|
570
|
+
`,Si=Jt.p`
|
|
554
571
|
font-weight: 700;
|
|
555
572
|
font-size: 18px;
|
|
556
573
|
line-height: 22px;
|
|
557
574
|
margin: 20px 0px 0px 0px;
|
|
558
575
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
559
|
-
`,
|
|
576
|
+
`,yi=Jt.p`
|
|
560
577
|
font-weight: 400;
|
|
561
578
|
font-size: 15px;
|
|
562
579
|
line-height: 28px;
|
|
@@ -571,21 +588,21 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
571
588
|
height: 80%;
|
|
572
589
|
border-top-right-radius: 8px;
|
|
573
590
|
border-bottom-right-radius: 8px;
|
|
574
|
-
`,
|
|
591
|
+
`,bi=Jt.div`
|
|
575
592
|
flex-direction: row;
|
|
576
593
|
justify-content: flex-start;
|
|
577
|
-
`;var
|
|
594
|
+
`;var wi=({data:e,index:t,isSelected:o,primaryColor:i,style:n,onClick:r,appearance:s})=>{var p,d;return ko.createElement("div",{style:{position:"relative",paddingLeft:"20px"},onClick:()=>{r()}},o&&ko.createElement(Fo,{className:l("checklistStepItemSelectedIndicator",s),as:_a.div,layoutId:"checklis-step-selected",style:{backgroundColor:((p=s==null?void 0:s.theme)==null?void 0:p.colorPrimary)??i}}),ko.createElement(bi,{className:l("checklistStepItem",s),key:`hero-checklist-step-${t}`,role:"listitem"},ko.createElement(To,{value:e.complete,labelPosition:"left",label:e.stepName,style:n,primaryColor:((d=s==null?void 0:s.theme)==null?void 0:d.colorPrimary)??i,appearance:s})))};import Ct from"react";import{motion as za}from"framer-motion";import Qo from"styled-components";var Wa={backgroundColor:"#E6E6E6"},Ha=Qo.div`
|
|
578
595
|
display: flex;
|
|
579
596
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
580
597
|
justify-content: flex-start;
|
|
581
598
|
align-items: ${e=>e.textLocation=="top"?"flex-end":"center"};
|
|
582
599
|
|
|
583
600
|
${e=>ct(e)}
|
|
584
|
-
`,
|
|
601
|
+
`,Va=Qo.div`
|
|
585
602
|
flex-grow: 1;
|
|
586
603
|
position: relative;
|
|
587
604
|
${e=>e.textLocation=="top"?"width: 100%;":""}
|
|
588
|
-
|
|
605
|
+
`,ja=Qo.span`
|
|
589
606
|
font-weight: 500;
|
|
590
607
|
font-size: 15px;
|
|
591
608
|
line-height: 18px;
|
|
@@ -593,13 +610,13 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
593
610
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
594
611
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
595
612
|
${e=>ct(e)}
|
|
596
|
-
`,
|
|
613
|
+
`,Ga={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},qa={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},ze=({count:e,total:t,fillColor:o,bgColor:i=Wa.backgroundColor,display:n="count",textLocation:r="left",style:s={},textStyle:p={},appearance:d})=>{var T,S;if(t===0)return Ct.createElement(Ct.Fragment,null);let a=e===0?"10px":`${e/t*100}%`,f=n==="compact"?"5px":"10px",c=Math.round(e/t*100),u=n==="compact"?"5px":"20px",w;return n==="count"?w=`${e} of ${t}`:n==="compact"?w=`${c}%`:n==="percent"&&(w=`${c}% complete`),r==="top"&&(u="0px"),Ct.createElement(Ha,{className:l("progressBarContainer",d),textLocation:r,styleOverrides:s},Ct.createElement(ja,{className:l("progressBarStepText",d),style:{...p,fontSize:n==="compact"?12:15,fontWeight:n==="compact"?400:500},appearance:d,padding:u,textLocation:r},w),Ct.createElement(Va,{textLocation:r,className:l("progressBar",d)},Ct.createElement(za.div,{style:{...qa,width:a,height:f,backgroundColor:((T=d==null?void 0:d.theme)==null?void 0:T.colorPrimary)??o,zIndex:n=="compact"?1:5},className:l("progressBarFill",d)}),Ct.createElement("div",{className:l("progressBarBackground",d),style:{...Ga,height:f,backgroundColor:((S=d==null?void 0:d.theme)==null?void 0:S.colorSecondary)??i}})))};import Zt from"react";import Ka from"styled-components";import vo from"react";import Po from"react";var It=({stepData:e,appearance:t})=>Po.createElement(Po.Fragment,null,Po.createElement(Si,{appearance:t,className:l("checklistStepTitle",t),dangerouslySetInnerHTML:me(e.title)}),Po.createElement(yi,{appearance:t,className:l("checklistStepSubtitle",t),dangerouslySetInnerHTML:me(e.subtitle)}));import Qt from"react";var Nt=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},i=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return Qt.createElement(Qt.Fragment,null,Qt.createElement(xo,null,e.secondaryButtonTitle&&Qt.createElement(ee,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:i,style:{width:"auto",marginRight:"12px"}}),Qt.createElement(ee,{appearance:t,title:e.primaryButtonTitle,onClick:o})))};var Lt=({stepData:e,appearance:t})=>vo.createElement(vo.Fragment,null,vo.createElement(It,{stepData:e,appearance:t}),vo.createElement(Nt,{stepData:e,appearance:t}));import Ti from"react";function Fi(e){if(e.videoUri.includes("youtube")){let t=e.videoUri.split("v=")[1],o=t.indexOf("&");return o!==-1&&(t=t.substring(0,o)),Ti.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 Ti.createElement("video",{width:"480",height:"260",controls:!0,src:e.videoUri})}var Zo="default",Ya=Ka.img`
|
|
597
614
|
border-radius: 4px;
|
|
598
615
|
max-height: 260px;
|
|
599
616
|
min-height: 200px;
|
|
600
|
-
`,
|
|
617
|
+
`,ki=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return Zt.createElement("div",null,o)}return Zt.createElement(Ci,{className:l("checklistStepContent",t)},e.imageUri?Zt.createElement(Ya,{className:l("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Zt.createElement(Fi,{videoUri:e.videoUri,appearance:t}):null,Zt.createElement(Lt,{stepData:e,appearance:t}))};import Be,{useRef as Xa,useState as Ja}from"react";import Ot from"styled-components";var Pi=Ot.div`
|
|
601
618
|
display: block;
|
|
602
|
-
`,
|
|
619
|
+
`,Qa=Ot.div`
|
|
603
620
|
display: flex;
|
|
604
621
|
flex-direction: row;
|
|
605
622
|
flex-wrap: wrap;
|
|
@@ -609,20 +626,20 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
609
626
|
align-content: center;
|
|
610
627
|
margin-top: 24px;
|
|
611
628
|
margin-bottom: 24px;
|
|
612
|
-
`,
|
|
629
|
+
`,Za=Ot.div`
|
|
613
630
|
display: flex;
|
|
614
631
|
align-items: center;
|
|
615
632
|
justify-content: flex-start;
|
|
616
633
|
flex-direction: column;
|
|
617
634
|
margin-right: 16px;
|
|
618
|
-
`,
|
|
635
|
+
`,Ra=Ot.video`
|
|
619
636
|
width: 200px;
|
|
620
637
|
height: 120px;
|
|
621
|
-
`,
|
|
638
|
+
`,ep=Ot.div`
|
|
622
639
|
font-size: 14px;
|
|
623
640
|
line-height: 20px;
|
|
624
641
|
text-align: center;
|
|
625
|
-
`,
|
|
642
|
+
`,tp=Ot.div`
|
|
626
643
|
position: absolute;
|
|
627
644
|
width: 200px;
|
|
628
645
|
height: 120px;
|
|
@@ -642,9 +659,9 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
642
659
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
643
660
|
border-radius: 50%;
|
|
644
661
|
}
|
|
645
|
-
`,
|
|
662
|
+
`,vi="videoCarousel",Ei=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.videos))return Be.createElement(Pi,null,Be.createElement(Lt,{stepData:e,appearance:t}));function o({video:r}){let s=Xa(),[p,d]=Ja(!1);return Be.createElement(Za,null,!p&&Be.createElement(tp,{onClick:()=>{d(!0),s.current.play()},appearance:t},Be.createElement(Co,null)),Be.createElement(Ra,{controls:p,ref:s,play:p,src:r.uri}),Be.createElement(ep,null,r.title))}let i=e.props;return i.videos?Be.createElement(Pi,null,Be.createElement(It,{stepData:e,appearance:t}),Be.createElement(Qa,null,i.videos.map((r,s)=>Be.createElement("span",{key:`${r.uri}-${s}`},Be.createElement(o,{video:r})))),Be.createElement(Nt,{stepData:e,appearance:t})):null};import Ye from"react";import Eo from"styled-components";var Bi=Eo.div`
|
|
646
663
|
display: block;
|
|
647
|
-
`,
|
|
664
|
+
`,op=Eo.pre`
|
|
648
665
|
display: block;
|
|
649
666
|
background-color: #2a2a2a;
|
|
650
667
|
color: #f8f8f8;
|
|
@@ -660,68 +677,68 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
660
677
|
white-space: -o-pre-wrap; /* Opera 7 */
|
|
661
678
|
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
|
662
679
|
margin-bottom: 24px;
|
|
663
|
-
`,
|
|
680
|
+
`,rp=Eo.div`
|
|
664
681
|
font-size: 15px;
|
|
665
682
|
line-height: 20px;
|
|
666
683
|
margin-bottom: 12px;
|
|
667
684
|
margin-top: 12px;
|
|
668
|
-
`,
|
|
685
|
+
`,ip=Eo.div`
|
|
669
686
|
margin-top: 24px;
|
|
670
|
-
`,
|
|
687
|
+
`,Ai="codeSnippet",Ii=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.codeSnippets))return Ye.createElement(Bi,null,Ye.createElement(Lt,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?Ye.createElement(Bi,null,Ye.createElement(It,{stepData:e,appearance:t}),Ye.createElement(ip,null,o.codeSnippets.map((n,r)=>Ye.createElement("div",{key:r},n.title?Ye.createElement(rp,null,n.title):null,n.code?Ye.createElement(op,null,n.code):null))),Ye.createElement(Nt,{stepData:e,appearance:t})):null};var sp=St.div`
|
|
671
688
|
display: flex;
|
|
672
689
|
flex-direction: row;
|
|
673
690
|
min-width: ${e=>e.type!="modal"?"1000px":"100%"};
|
|
674
691
|
background: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
675
692
|
box-shadow: ${e=>e.type!="modal"?"0px 6px 25px rgba(0, 0, 0, 0.06)":"none"};
|
|
676
693
|
border-radius: 8px;
|
|
677
|
-
`,
|
|
694
|
+
`,lp=St.h1`
|
|
678
695
|
font-size: 24px;
|
|
679
696
|
font-weight: 600;
|
|
680
697
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
681
|
-
`,
|
|
698
|
+
`,ap=St.h2`
|
|
682
699
|
font-size: 15px;
|
|
683
700
|
line-height: 20px;
|
|
684
701
|
color: ${e=>{var t,o;return((o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary)??"#4d4d4d"}};
|
|
685
702
|
margin: 10px 0px 0px 0px;
|
|
686
|
-
`,
|
|
703
|
+
`,Ni=St.div`
|
|
687
704
|
padding-bottom: 16px;
|
|
688
|
-
`,
|
|
705
|
+
`,pp=St.div`
|
|
689
706
|
list-style: none;
|
|
690
707
|
padding: 0;
|
|
691
708
|
margin: 0;
|
|
692
709
|
cursor: pointer;
|
|
693
710
|
width: 300px;
|
|
694
|
-
`,
|
|
711
|
+
`,dp=St.div`
|
|
695
712
|
width: 1px;
|
|
696
713
|
margin: 40px;
|
|
697
714
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
698
|
-
`,
|
|
715
|
+
`,cp=St.div`
|
|
699
716
|
flex: 2;
|
|
700
717
|
padding: 2rem;
|
|
701
|
-
`,
|
|
718
|
+
`,mp=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:n,setSelectedStep:r,className:s="",customStepTypes:p=new Map,appearance:d,type:a})=>{let{mergeAppearanceWithDefault:f}=J();d=f(d);let u={...{[Zo]:ki,[vi]:Ei,[Ai]:Ii},...p},[w,T]=np(0),S=n??w,x=r??T,E=o.filter(B=>B.complete===!0).length,P=()=>{var B;return!((B=o[S])!=null&&B.type)||!u[o[S].type]?u[Zo]({stepData:o[S],appearance:d}):u[o[S].type]({stepData:o[S],appearance:d})};return Me.createElement(sp,{type:a,style:i,className:s,appearance:d},Me.createElement(Ni,{style:{flex:1}},Me.createElement(Ni,{style:{padding:"30px 0px 30px 30px",borderBottom:"none"}},Me.createElement(lp,{className:l("checklistTitle",d),appearance:d},e),Me.createElement(ap,{className:l("checklistSubtitle",d),appearance:d},t),Me.createElement(ze,{total:o.length,count:E,fillColor:d.theme.colorPrimary,style:{marginTop:"24px"},appearance:d})),Me.createElement(pp,{className:l("checklistStepsContainer",d)},o.map((B,y)=>Me.createElement(wi,{data:B,index:y,key:y,listLength:o.length,isSelected:y===S,primaryColor:d.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{x(y)}})))),Me.createElement(dp,{appearance:d,className:l("checklistDivider",d)}),Me.createElement(cp,null,Me.createElement(P,null)))},Ro=mp;import O,{useState as Cp}from"react";import Li from"react";import up from"styled-components";var fp=up.svg`
|
|
702
719
|
transition: 'transform 0.35s ease-in-out';
|
|
703
|
-
`,Dt=({color:e="#323232",style:t,className:o})=>
|
|
720
|
+
`,Dt=({color:e="#323232",style:t,className:o})=>Li.createElement(fp,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},Li.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as Sp}from"framer-motion";import ue from"styled-components";var er={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},Oi=ue.div`
|
|
704
721
|
max-height: 350px;
|
|
705
722
|
padding-bottom: 40px;
|
|
706
|
-
`,
|
|
723
|
+
`,Di=ue.div`
|
|
707
724
|
display: flex;
|
|
708
725
|
flex-direction: column;
|
|
709
726
|
margin-top: 20px;
|
|
710
|
-
`,
|
|
727
|
+
`,Mi=ue.h1`
|
|
711
728
|
font-style: normal;
|
|
712
729
|
font-weight: 600;
|
|
713
730
|
font-size: 30px;
|
|
714
731
|
line-height: 36px;
|
|
715
732
|
margin-bottom: 16px;
|
|
716
733
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
717
|
-
|
|
734
|
+
`,$i=ue.h2`
|
|
718
735
|
font-weight: 400;
|
|
719
736
|
font-size: 16px;
|
|
720
737
|
line-height: 20px;
|
|
721
738
|
margin-bottom: 16px;
|
|
722
739
|
padding-left: 1px;
|
|
723
740
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
724
|
-
`,
|
|
741
|
+
`,Ui=ue.div`
|
|
725
742
|
${e=>k(e)} {
|
|
726
743
|
border: 1px solid #fafafa;
|
|
727
744
|
}
|
|
@@ -731,11 +748,11 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
731
748
|
flex-direction: column;
|
|
732
749
|
min-height: 240px;
|
|
733
750
|
overflow: hidden;
|
|
734
|
-
`,
|
|
751
|
+
`,_i=ue.div`
|
|
735
752
|
display: flex;
|
|
736
753
|
flex-direction: row;
|
|
737
754
|
justify-content: space-between;
|
|
738
|
-
`,
|
|
755
|
+
`,zi=ue.p`
|
|
739
756
|
${e=>k(e)} {
|
|
740
757
|
font-weight: 400;
|
|
741
758
|
font-size: 10px;
|
|
@@ -744,12 +761,12 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
744
761
|
color: #8c8c8c;
|
|
745
762
|
margin: 20px;
|
|
746
763
|
}
|
|
747
|
-
`,
|
|
764
|
+
`,Wi=ue.div`
|
|
748
765
|
display: flex;
|
|
749
766
|
flex-direction: row;
|
|
750
|
-
`,
|
|
767
|
+
`,Hi=ue.div`
|
|
751
768
|
flex: 1;
|
|
752
|
-
|
|
769
|
+
`,Vi=ue.div`
|
|
753
770
|
${e=>k(e)} {
|
|
754
771
|
display: flex;
|
|
755
772
|
justify-content: center;
|
|
@@ -759,7 +776,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
759
776
|
padding-left: 8px;
|
|
760
777
|
padding-right: 8px;
|
|
761
778
|
}
|
|
762
|
-
`,
|
|
779
|
+
`,ji=ue.p`
|
|
763
780
|
${e=>k(e)} {
|
|
764
781
|
font-style: normal;
|
|
765
782
|
font-weight: 600;
|
|
@@ -771,7 +788,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
771
788
|
margin-top: 20px;
|
|
772
789
|
margin-bottom: 16px;
|
|
773
790
|
}
|
|
774
|
-
`,
|
|
791
|
+
`,Gi=ue.p`
|
|
775
792
|
${e=>k(e)} {
|
|
776
793
|
font-weight: 400;
|
|
777
794
|
font-size: 14px;
|
|
@@ -780,14 +797,14 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
780
797
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
781
798
|
margin-bottom: 8px;
|
|
782
799
|
}
|
|
783
|
-
`,
|
|
800
|
+
`,qi=ue.div`
|
|
784
801
|
${e=>k(e)} {
|
|
785
802
|
display: flex;
|
|
786
803
|
flex-direction: row;
|
|
787
804
|
justify-content: center;
|
|
788
805
|
gap: 8px;
|
|
789
806
|
}
|
|
790
|
-
`,
|
|
807
|
+
`,Ki=ue.div`
|
|
791
808
|
${e=>k(e)} {
|
|
792
809
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
793
810
|
background-color: ${e=>e.selected?"#FAFAFA":"#FFFFFF"};
|
|
@@ -807,7 +824,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
807
824
|
justify-content: space-between;
|
|
808
825
|
position: relative;
|
|
809
826
|
cursor: pointer;
|
|
810
|
-
`,
|
|
827
|
+
`,Yi=ue.p`
|
|
811
828
|
${e=>k(e)} {
|
|
812
829
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
813
830
|
color: ${e=>e.selected?"#434343":"#BFBFBF"};
|
|
@@ -816,12 +833,12 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
816
833
|
font-size: 14px;
|
|
817
834
|
line-height: 22px;
|
|
818
835
|
margin: 0;
|
|
819
|
-
`,
|
|
836
|
+
`,Xi=ue.div`
|
|
820
837
|
display: flex;
|
|
821
838
|
flex-direction: row;
|
|
822
839
|
justify-content: flex-end;
|
|
823
840
|
align-content: center;
|
|
824
|
-
`,
|
|
841
|
+
`,Ji=ue.div`
|
|
825
842
|
display: flex;
|
|
826
843
|
flex: 1;
|
|
827
844
|
flex-direction: row;
|
|
@@ -829,14 +846,14 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
829
846
|
align-content: center;
|
|
830
847
|
align-items: center;
|
|
831
848
|
margin-right: 20px;
|
|
832
|
-
`,
|
|
849
|
+
`,Qi=ue.div`
|
|
833
850
|
display: block;
|
|
834
851
|
width: 100%;
|
|
835
|
-
`;import
|
|
852
|
+
`;import gp from"styled-components";var Zi=gp.div`
|
|
836
853
|
flex-direction: column;
|
|
837
854
|
justify-content: center;
|
|
838
855
|
display: flex;
|
|
839
|
-
`;import Je from"react";import{motion as
|
|
856
|
+
`;import Je from"react";import{motion as hp}from"framer-motion";import Xe from"styled-components";var Ri=Xe.div`
|
|
840
857
|
border: 1px solid #fafafa;
|
|
841
858
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
842
859
|
border-radius: 14px;
|
|
@@ -844,13 +861,13 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
844
861
|
display: flex;
|
|
845
862
|
flex-direction: column;
|
|
846
863
|
overflow: hidden;
|
|
847
|
-
`,
|
|
864
|
+
`,en=Xe.div`
|
|
848
865
|
display: flex;
|
|
849
866
|
flex-wrap: wrap;
|
|
850
867
|
justify-content: space-between;
|
|
851
868
|
overflow: hidden;
|
|
852
869
|
row-gap: 10px;
|
|
853
|
-
`,
|
|
870
|
+
`,tn=Xe.div`
|
|
854
871
|
${e=>k(e)} {
|
|
855
872
|
color: #595959;
|
|
856
873
|
}
|
|
@@ -860,7 +877,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
860
877
|
line-height: 12px;
|
|
861
878
|
letter-spacing: 0.09em;
|
|
862
879
|
margin-bottom: 12px;
|
|
863
|
-
`,
|
|
880
|
+
`,on=Xe.div`
|
|
864
881
|
${e=>k(e)} {
|
|
865
882
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
866
883
|
background: #ffffff;
|
|
@@ -873,7 +890,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
873
890
|
|
|
874
891
|
max-width: 150px;
|
|
875
892
|
min-width: 200px;
|
|
876
|
-
`,
|
|
893
|
+
`,rn=Xe.div`
|
|
877
894
|
${e=>k(e)} {
|
|
878
895
|
background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);
|
|
879
896
|
}
|
|
@@ -885,13 +902,13 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
885
902
|
justify-content: center;
|
|
886
903
|
align-content: center;
|
|
887
904
|
align-items: center;
|
|
888
|
-
`,
|
|
905
|
+
`,nn=Xe.div`
|
|
889
906
|
font-weight: 600;
|
|
890
907
|
font-size: 20px;
|
|
891
908
|
line-height: 24px;
|
|
892
909
|
width: 20px;
|
|
893
910
|
height: 20px;
|
|
894
|
-
`,
|
|
911
|
+
`,sn=Xe.div`
|
|
895
912
|
${e=>k(e)} {
|
|
896
913
|
color: #434343;
|
|
897
914
|
}
|
|
@@ -900,20 +917,20 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
900
917
|
line-height: 17px;
|
|
901
918
|
margin-top: 12px;
|
|
902
919
|
margin-bottom: 8px;
|
|
903
|
-
`,
|
|
920
|
+
`,ln=Xe.div`
|
|
904
921
|
${e=>k(e)} {
|
|
905
922
|
color: #8c8c8c;
|
|
906
923
|
}
|
|
907
924
|
font-weight: 400;
|
|
908
925
|
font-size: 12px;
|
|
909
926
|
line-height: 14px;
|
|
910
|
-
`,
|
|
927
|
+
`,an=Xe.a`
|
|
911
928
|
color: ${e=>e.color};
|
|
912
929
|
font-size: 12px;
|
|
913
930
|
line-height: 14px;
|
|
914
931
|
font-weight: 400;
|
|
915
932
|
cursor: pointer;
|
|
916
|
-
`;var
|
|
933
|
+
`;var xp=({steps:e,style:t,title:o,primaryColor:i,appearance:n,onButtonClick:r})=>{let{primaryCTAClickSideEffects:s}=se();return Je.createElement(Ri,{style:t,className:l("guideContainer",n)},Je.createElement(tn,{className:l("guideTitle",n)},o),Je.createElement(en,{className:l("guideItemContainer",n)},e.map((p,d)=>Je.createElement(on,{key:`guide-${p.id??d}`,as:hp.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:l("guideItem",n)},p.icon&&Je.createElement(rn,{className:l("guideIcon",n)},Je.createElement(nn,null,p.icon)),Je.createElement(sn,{className:l("guideItemTitle",n),dangerouslySetInnerHTML:me(p.title)}),Je.createElement(ln,{className:l("guideItemSubtitle",n),dangerouslySetInnerHTML:me(p.subtitle)}),Je.createElement(an,{className:l("guideItemLink",n),color:i,onClick:()=>{p.primaryButtonUri&&s(p),r&&r(p)}},p.primaryButtonTitle)))))},Rt=xp;var yp=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:n,onClose:r,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:a,guideData:f,guideTitle:c,onGuideButtonClick:u})=>{let w=({stepData:m,handleSecondaryCTAClick:h,handleCTAClick:F})=>m?O.createElement(Vi,{className:l("checklistStepContainer",a),"data-testid":"checklistStepContainer"},O.createElement(ji,{appearance:a,className:l("checklistStepTitle",a),dangerouslySetInnerHTML:me(m.title)}),O.createElement(Gi,{appearance:a,className:l("checklistStepSubtitle",a),dangerouslySetInnerHTML:me(m.subtitle)}),O.createElement(qi,{className:l("checklistCTAContainer",a)},m.secondaryButtonTitle&&O.createElement(ee,{title:m.secondaryButtonTitle,onClick:h,appearance:a,secondary:!0}),O.createElement(ee,{title:m.primaryButtonTitle,onClick:F,appearance:a}))):O.createElement(O.Fragment,null),S={...{default:m=>{var U;if((U=e[P])!=null&&U.StepContent){let $=e[P].StepContent;return O.createElement("div",null,$)}let h=e[P];return O.createElement(w,{stepData:m,handleCTAClick:()=>{h.handlePrimaryButtonClick&&h.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{h.handleSecondaryButtonClick&&h.handleSecondaryButtonClick()}})}},...d},[x,E]=Cp(0),P=s??x,B=p??E,y=()=>{var m;return e?!((m=e[P])!=null&&m.type)||!S[e[P].type]?S.default(e[P]):S[e[P].type]({stepData:e[P],primaryColor:a.theme.colorPrimary}):O.createElement(O.Fragment,null)},C=e.filter(m=>m.complete).length;return n?(a.theme.modalContainer||(a.theme.borderRadius&&(er.borderRadius=a.theme.borderRadius+"px"),a.theme.modalContainer=er),O.createElement(Re,{onClose:r,visible:n,appearance:a},O.createElement(Qi,null,O.createElement(Di,null,O.createElement(Mi,{appearance:a,className:l("checklistTitle",a)},t),O.createElement($i,{appearance:a,className:l("checklistSubtitle",a)},o)),O.createElement(Oi,null,e&&e.length>0&&O.createElement(Ui,{className:l("stepsContainer",a)},O.createElement(_i,null,O.createElement("div",{style:{flex:3}},O.createElement(zi,{className:l("stepsTitle",a)},i)),O.createElement(Ji,null,O.createElement(ze,{fillColor:a.theme.colorPrimary,style:{width:"100%"},count:C,total:e.length,appearance:a}))),O.createElement(Wi,null,O.createElement(Hi,{className:l("checklistStepListContainer",a),appearance:a},e.map((m,h)=>{let F=P===h;return O.createElement(Ki,{selected:F,className:l(`checklistStepListItem${F?"Selected":""}`,a),key:`checklist-guide-step-${m.id??h}`,disabled:m.blocked,onClick:()=>{m.blocked||B(h)},title:m.blocked?"Finish remaining steps to continue":void 0},F&&O.createElement(Fo,{className:l("checklistStepItemSelectedIndicator",a),as:Sp.div,layoutId:"checklist-step-selected",style:{backgroundColor:a.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),O.createElement(Yi,{selected:F,className:l(`checklistStepListStepName${F?"Selected":""}`,a)},m.stepName),O.createElement(Xi,null,O.createElement(ft,{value:m.complete,type:"round",primaryColor:a.theme.colorPrimary,progress:m.progress,appearance:a}),O.createElement(Zi,null,O.createElement(Dt,{style:{marginLeft:"10px"},color:a.theme.colorBackgroundSecondary}))))})),O.createElement(y,null))),f&&f.length>0&&O.createElement(Rt,{steps:f,title:c,primaryColor:a.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:a,onButtonClick:m=>(u&&u(m),!0)}))))):O.createElement(O.Fragment,null)},tr=yp;import{useEffect as bp,useState as wp}from"react";var pn=()=>{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(([p])=>[p,!1])),[o,i]=wp(t),n=null,r=()=>{n!==null?clearTimeout(n):s(),n=setTimeout(()=>{s()},16)},s=()=>{let p=Object.fromEntries(Object.entries(e).map(([d,a])=>{if(!window)return[d,!1];let f=window.matchMedia(a);return f.addEventListener("change",r),[d,f.matches]}));i(p)};return bp(()=>{s()},[]),o};import ke,{useEffect as Fn,useState as kp}from"react";import fe from"react";import{AnimatePresence as Tp,motion as Fp}from"framer-motion";import Qe from"styled-components";var dn=Qe.div`
|
|
917
934
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
918
935
|
border: 1px solid;
|
|
919
936
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -925,42 +942,42 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
925
942
|
display: flex;
|
|
926
943
|
flex-direction: column;
|
|
927
944
|
transition: max-height 0.25s;
|
|
928
|
-
`,
|
|
945
|
+
`,cn=Qe.div`
|
|
929
946
|
display: flex;
|
|
930
947
|
margin-bottom: 20px;
|
|
931
|
-
`,
|
|
948
|
+
`,mn=Qe.img`
|
|
932
949
|
border-radius: 4px;
|
|
933
950
|
max-height: 260px;
|
|
934
951
|
min-height: 200px;
|
|
935
|
-
`,
|
|
952
|
+
`,un=Qe.div`
|
|
936
953
|
display: flex;
|
|
937
954
|
flex-direction: row;
|
|
938
955
|
justify-content: space-between;
|
|
939
956
|
align-items: center;
|
|
940
|
-
`,
|
|
957
|
+
`,fn=Qe.p`
|
|
941
958
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
942
959
|
font-style: normal;
|
|
943
960
|
font-weight: 500;
|
|
944
961
|
font-size: 16px;
|
|
945
962
|
line-height: 18px;
|
|
946
963
|
margin-left: 8px;
|
|
947
|
-
`,
|
|
964
|
+
`,gn=Qe.div`
|
|
948
965
|
padding: 20px;
|
|
949
966
|
cursor: pointer;
|
|
950
967
|
:hover {
|
|
951
968
|
opacity: 0.8;
|
|
952
969
|
}
|
|
953
|
-
`,
|
|
970
|
+
`,lx=Qe.div``,hn=Qe.p`
|
|
954
971
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
955
972
|
font-weight: 400;
|
|
956
973
|
font-size: 14px;
|
|
957
974
|
line-height: 22px;
|
|
958
|
-
`,
|
|
975
|
+
`,xn=Qe.div`
|
|
959
976
|
display: flex;
|
|
960
977
|
flex-direction: row;
|
|
961
978
|
justify-content: flex-start;
|
|
962
979
|
align-items: center;
|
|
963
|
-
`;var
|
|
980
|
+
`;var Cn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:n,appearance:r,customStepTypes:s})=>{var f,c;let p=t?{}:{transform:"rotate(90deg)"};function d(){return fe.createElement(fe.Fragment,null,e.imageUri||e.videoUri?fe.createElement(cn,{className:l("stepMediaContainer",r)},e.imageUri?fe.createElement(mn,{className:l("stepImage",r),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?fe.createElement(Et,{appearance:r,videoUri:e.videoUri}):null):null,fe.createElement(hn,{className:l("stepSubtitle",r),appearance:r,dangerouslySetInnerHTML:me(e.subtitle)}),fe.createElement(xo,{className:l("checklistCTAContainer",r)},e.secondaryButtonTitle?fe.createElement(ee,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>n(),appearance:r}):null,fe.createElement(ee,{title:e.primaryButtonTitle??"Continue",onClick:()=>i(),appearance:r})))}function a(){if(!s)return null;let u=s[e.type];return u?u(e,r):null}return fe.createElement(dn,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:l("checklistStepContainer",r),appearance:r},fe.createElement(un,{className:l("stepHeader",r)},fe.createElement(xn,null,fe.createElement(To,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(f=r==null?void 0:r.theme)==null?void 0:f.colorPrimary,appearance:r}),fe.createElement(fn,{appearance:r,className:l("stepTitle",r),dangerouslySetInnerHTML:me(e.title)})),fe.createElement(gn,{className:l("stepChevronContainer",r),onClick:()=>o()},fe.createElement(Dt,{style:{...p,transition:"transform 0.1s ease-in-out"},color:(c=r==null?void 0:r.theme)==null?void 0:c.colorTextSecondary}))),fe.createElement(Tp,null,!t&&fe.createElement(Fp.div,{initial:{opacity:1,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:1,height:0},key:e.id,style:{overflow:"hidden"}},a()??d())))};import Mt from"styled-components";var bx=Mt.div`
|
|
964
981
|
background: #ffffff;
|
|
965
982
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
966
983
|
border-radius: 6px;
|
|
@@ -974,49 +991,49 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
974
991
|
|
|
975
992
|
max-width: 800px;
|
|
976
993
|
min-width: 350px;
|
|
977
|
-
`,
|
|
994
|
+
`,Sn=Mt.div`
|
|
978
995
|
display: flex;
|
|
979
996
|
flex-direction: column;
|
|
980
|
-
`,
|
|
997
|
+
`,yn=Mt.h1`
|
|
981
998
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
982
999
|
font-style: normal;
|
|
983
1000
|
font-weight: 700;
|
|
984
1001
|
font-size: 20px;
|
|
985
1002
|
line-height: 24px;
|
|
986
1003
|
margin-bottom: 8px;
|
|
987
|
-
`,
|
|
1004
|
+
`,bn=Mt.h2`
|
|
988
1005
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
989
1006
|
font-weight: 400;
|
|
990
1007
|
font-size: 14px;
|
|
991
1008
|
line-height: 23px;
|
|
992
1009
|
margin: 2px 0 0 0;
|
|
993
|
-
`,
|
|
1010
|
+
`,wn=Mt.div`
|
|
994
1011
|
display: block;
|
|
995
1012
|
width: 100%;
|
|
996
|
-
`,
|
|
1013
|
+
`,Tn=Mt.div`
|
|
997
1014
|
display: flex;
|
|
998
1015
|
width: 100%;
|
|
999
1016
|
flex-direction: column;
|
|
1000
1017
|
justify-content: space-between;
|
|
1001
1018
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1002
1019
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
1003
|
-
`;var
|
|
1020
|
+
`;var Pp=({title:e,subtitle:t,steps:o,onClose:i,visible:n,onCompleteStep:r,autoExpandFirstIncompleteStep:s=!0,autoCollapse:p=!0,autoExpandNextStep:d=!0,primaryColor:a="#000000",selectedStep:f,setSelectedStep:c,appearance:u,type:w,className:T,customStepTypes:S})=>{let x=o.filter(m=>m.complete).length,[E,P]=kp(Array(o.length).fill(!0));Fn(()=>{let m=[...E];if(s){for(let h=0;h<o.length;h++)if(!o[h].complete){m[h]=!1;break}P(m)}},[]),Fn(()=>{B(f)},[f]);let B=m=>{let h=[...E];if(p)for(let F=0;F<E.length;++F)F!==m&&(h[F]=!0);h[m]=!h[m],P(h)};if(!n&&w=="modal")return ke.createElement(ke.Fragment,null);let y=ke.createElement(ke.Fragment,null,ke.createElement(Sn,null,ke.createElement(yn,{appearance:u,className:l("checklistTitle",u),dangerouslySetInnerHTML:me(e)}),ke.createElement(bn,{appearance:u,className:l("checklistSubtitle",u),dangerouslySetInnerHTML:me(t)})),ke.createElement(ze,{display:"percent",count:x,total:o.length,fillColor:a,style:{margin:"14px 0px 8px 0px"},appearance:u})),C=ke.createElement(wn,{className:ye(l("checklistContainer",u),T)},o.map((m,h)=>{let F=E[h];return ke.createElement(Cn,{appearance:u,stepData:m,collapsed:F,key:`modal-checklist-${m.id??h}`,onClick:()=>{if(f===h){B(h);return}c(h)},onPrimaryButtonClick:()=>{r&&r(h,m),m.handlePrimaryButtonClick&&m.handlePrimaryButtonClick(),d&&!m.completionCriteria&&h<E.length-1&&E[h+1]&&c(h+1)},onSecondaryButtonClick:()=>{m.handleSecondaryButtonClick&&m.handleSecondaryButtonClick()},customStepTypes:S})}));return w==="inline"?ke.createElement(Tn,{appearance:u,className:ye(l("checklistInlineContainer",u),T)},y,C):ke.createElement(ke.Fragment,null,ke.createElement(Re,{onClose:i,visible:n,appearance:u,style:{maxWidth:"600px"},headerContent:y},C))},or=Pp;import ae,{useEffect as rr,useRef as Np,useState as bt}from"react";import yt from"react";import le,{css as kn,keyframes as Pn}from"styled-components";var vn=kn`
|
|
1004
1021
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1005
|
-
`,
|
|
1022
|
+
`,vp=kn`
|
|
1006
1023
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
1007
|
-
`,
|
|
1024
|
+
`,Ep=Pn`
|
|
1008
1025
|
from {
|
|
1009
1026
|
opacity: 0;
|
|
1010
1027
|
} to {
|
|
1011
1028
|
opacity: 1;
|
|
1012
1029
|
}
|
|
1013
|
-
`,
|
|
1030
|
+
`,Bp=Pn`
|
|
1014
1031
|
from {
|
|
1015
1032
|
opacity: 1;
|
|
1016
1033
|
} to {
|
|
1017
1034
|
opacity: 0;
|
|
1018
1035
|
}
|
|
1019
|
-
`,
|
|
1036
|
+
`,En=le.div`
|
|
1020
1037
|
margin: 0 -20px;
|
|
1021
1038
|
overflow-x: auto;
|
|
1022
1039
|
padding-left: 20px;
|
|
@@ -1033,14 +1050,14 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1033
1050
|
::-webkit-scrollbar {
|
|
1034
1051
|
display: none;
|
|
1035
1052
|
}
|
|
1036
|
-
`,
|
|
1053
|
+
`,Bn=le.div`
|
|
1037
1054
|
display: flex;
|
|
1038
1055
|
flex-flow: row nowrap;
|
|
1039
1056
|
gap: 0 16px;
|
|
1040
1057
|
scroll-snap-align: center;
|
|
1041
1058
|
scroll-snap-stop: always;
|
|
1042
|
-
`,
|
|
1043
|
-
animation: ${e=>e.reversed?
|
|
1059
|
+
`,An=le.div`
|
|
1060
|
+
animation: ${e=>e.reversed?Bp:Ep} 0.25s ease-out;
|
|
1044
1061
|
background: linear-gradient(
|
|
1045
1062
|
to right,
|
|
1046
1063
|
${({theme:e})=>e.colorBackground}00,
|
|
@@ -1048,8 +1065,8 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1048
1065
|
);
|
|
1049
1066
|
position: absolute;
|
|
1050
1067
|
width: 64px;
|
|
1051
|
-
`,
|
|
1052
|
-
${
|
|
1068
|
+
`,In=le.button`
|
|
1069
|
+
${vn}
|
|
1053
1070
|
box-shadow: 0 3px 10px 0 rgba(0, 0, 0, 0.1);
|
|
1054
1071
|
align-items: center;
|
|
1055
1072
|
border-radius: 50%;
|
|
@@ -1060,11 +1077,11 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1060
1077
|
justify-content: center;
|
|
1061
1078
|
position: absolute;
|
|
1062
1079
|
width: 48px;
|
|
1063
|
-
`,
|
|
1080
|
+
`,Nn=le.div`
|
|
1064
1081
|
border-radius: ${({theme:e})=>e.borderRadius}px;
|
|
1065
1082
|
padding: 20px;
|
|
1066
|
-
`,
|
|
1067
|
-
${
|
|
1083
|
+
`,Ln=le(Nn)`
|
|
1084
|
+
${vn}
|
|
1068
1085
|
background: ${({theme:e})=>e.colorBackground};
|
|
1069
1086
|
|
|
1070
1087
|
&:active {
|
|
@@ -1075,45 +1092,45 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1075
1092
|
${e=>e.blocked?"":`border: 1px solid ${e.theme.colorPrimary};`}
|
|
1076
1093
|
${e=>e.blocked?"cursor: default":"cursor: pointer"}
|
|
1077
1094
|
}
|
|
1078
|
-
`,
|
|
1095
|
+
`,On=le.img`
|
|
1079
1096
|
border-radius: 50%;
|
|
1080
1097
|
height: 40px;
|
|
1081
1098
|
margin-bottom: 12px;
|
|
1082
1099
|
width: 40px;
|
|
1083
|
-
`,
|
|
1100
|
+
`,Dn=le(Nn)`
|
|
1084
1101
|
${e=>k(e)} {
|
|
1085
|
-
${
|
|
1102
|
+
${vp}
|
|
1086
1103
|
|
|
1087
1104
|
background: ${({theme:e})=>e.colorBackground};
|
|
1088
1105
|
}
|
|
1089
|
-
`,
|
|
1106
|
+
`,Mn=le.div`
|
|
1090
1107
|
color: ${({theme:e})=>e.colorPrimary};
|
|
1091
1108
|
display: flex;
|
|
1092
1109
|
flex-flow: row nowrap;
|
|
1093
1110
|
align-items: center;
|
|
1094
1111
|
margin-left: 20px;
|
|
1095
|
-
|
|
1112
|
+
`,$n=le.div`
|
|
1096
1113
|
white-space: nowrap;
|
|
1097
|
-
`,
|
|
1114
|
+
`,Un=le.div`
|
|
1098
1115
|
background: #d8fed8;
|
|
1099
1116
|
border-radius: 6px;
|
|
1100
1117
|
margin-bottom: 12px;
|
|
1101
1118
|
padding: 4px 10px;
|
|
1102
|
-
`,
|
|
1119
|
+
`,Ap=le.p`
|
|
1103
1120
|
font-weight: bold;
|
|
1104
1121
|
font-size: 18px;
|
|
1105
1122
|
line-height: 22px;
|
|
1106
1123
|
letter-spacing: calc(18px * -0.01);
|
|
1107
1124
|
margin: 0;
|
|
1108
|
-
`,
|
|
1125
|
+
`,_n=le(Ap)`
|
|
1109
1126
|
margin-bottom: 4px;
|
|
1110
|
-
`,
|
|
1127
|
+
`,Ip=le.p`
|
|
1111
1128
|
font-weight: bold;
|
|
1112
1129
|
font-size: 16px;
|
|
1113
1130
|
line-height: 20px;
|
|
1114
1131
|
letter-spacing: calc(16px * -0.01);
|
|
1115
1132
|
margin: 0;
|
|
1116
|
-
`,
|
|
1133
|
+
`,zn=le(Ip)`
|
|
1117
1134
|
margin-bottom: 4px;
|
|
1118
1135
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1119
1136
|
`}
|
|
@@ -1123,7 +1140,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1123
1140
|
font-size: 14px;
|
|
1124
1141
|
line-height: 22px;
|
|
1125
1142
|
margin: 0;
|
|
1126
|
-
`,
|
|
1143
|
+
`,Wn=le.p`
|
|
1127
1144
|
color: ${({theme:e})=>e.colorText};
|
|
1128
1145
|
font-weight: 600;
|
|
1129
1146
|
font-size: 12px;
|
|
@@ -1135,34 +1152,34 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1135
1152
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1136
1153
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1137
1154
|
`}
|
|
1138
|
-
`;var
|
|
1155
|
+
`;var Hn=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=J(),{primaryCTAClickSideEffects:n}=se(),{theme:r,styleOverrides:s}=i(o),{imageUri:p=null,subtitle:d=null,title:a=null,complete:f=!1,blocked:c=!1}=e,u=()=>{n(e)};return yt.createElement(Ln,{className:l("carouselCard",o),onClick:c?null:u,style:t,blocked:c,complete:f},yt.createElement("div",{style:{alignItems:"flex-start",display:"flex",justifyContent:"space-between"}},p&&yt.createElement(On,{className:l("carouselCardImage",o),src:p,alt:a,style:{opacity:f||c?.4:1}}),f&&yt.createElement(Un,{className:l("carouselCompletedPill",o)},yt.createElement(Wn,{style:{color:"#108E0B"}},"Complete"))),a&&yt.createElement(zn,{blocked:c,complete:f,className:l("carouselCardTitle",o)},a),d&&yt.createElement(We.Quiet,{blocked:c,complete:f,className:l("carouselCardSubtitle",o)},d))};import eo from"react";var Vn=({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 eo.createElement(Mn,{className:l("carouselProgressBar",o)},eo.createElement($n,{as:We.Loud,style:{marginRight:8}},e," of ",t),eo.createElement("svg",{height:10,width:n},eo.createElement("rect",{x:0,y:0,rx:5,width:n,height:10,fill:"#E6E6E6"}),eo.createElement("rect",{x:0,y:0,rx:5,width:r,height:10,fill:"currentColor"})))};var Lp=()=>ae.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ae.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),ae.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),ae.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),jn=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,n]=bt(!1),[r,s]=bt(!1);rr(()=>{t===!0&&i===!1?n(!0):t===!1&&i===!0&&s(!0)},[t]);let p=()=>{n(!1),s(!1)},d=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return i?ae.createElement(An,{style:d,reversed:r,onAnimationEnd:r?p:null},ae.createElement(In,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},ae.createElement(Lp,null))):null},Gn=({flowId:e,appearance:t,customVariables:o,className:i})=>{let n=Np(null),[r,s]=bt(!1),[p,d]=bt(!1),[a,f]=bt(null),[c,u]=bt([]),[w,T]=bt(0),{getFlowMetadata:S,getFlowSteps:x,getNumberOfStepsCompleted:E,updateCustomVariables:P,getFlowStatus:B,isLoading:y,targetingLogicShouldHideFlow:C,getFlow:m}=X();rr(()=>{P(o)},[o,y]),rr(()=>{if(y)return;let A=S(e),_=E(e),N=x(e);f(A),A.data!==null&&(u(N.sort((M,Z)=>Number(M.complete)-Number(Z.complete))),d(N.length>3),T(_))},[y]);let h=[];for(let A=0;A<c.length;A+=3)h.push(c.slice(A,A+3));let F=A=>{let _=A.target,N=_.scrollWidth-_.clientWidth,M=Math.ceil(_.scrollLeft);M>0&&r===!1&&s(!0),M===0&&r===!0&&s(!1),M<N&&p===!1&&d(!0),M===N&&p===!0&&d(!1)},L=(A=!0)=>{let _=A?1:-1;n.current!==null&&n.current.scrollBy({left:n.current.clientWidth*_,behavior:"smooth"})},U=null,$=A=>{U!==null?clearTimeout(U):F(A),U=setTimeout(()=>{F(A)},16)};return y?null:ae.createElement(Dn,{className:ye(l("carouselContainer",t),i)},ae.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:20}},ae.createElement("div",null,ae.createElement(_n,{className:l("carouselTitle",t)},a==null?void 0:a.title),ae.createElement(We.Quiet,{className:l("carouselSubtitle",t)},a==null?void 0:a.subtitle)),ae.createElement(Vn,{numberOfStepsCompleted:w,numberOfSteps:c.length})),ae.createElement("div",{style:{position:"relative"}},ae.createElement(jn,{show:r,onClick:()=>L(!1)}),ae.createElement(jn,{side:"right",show:p,onClick:L}),ae.createElement(En,{ref:n,onScroll:$},h.map((A,_)=>ae.createElement(Bn,{key:_,style:{flex:`0 0 calc(100% - ${c.length>3?36:0}px)`}},A.map((N,M)=>ae.createElement(Hn,{key:M,stepData:N,style:{flex:c.length>3?"0 1 calc(33% - 16px * 2 / 3)":1},appearance:t})))))))};var ir=({flowId:e,title:t,subtitle:o,style:i,initialSelectedStep:n,className:r,type:s="inline",onDismiss:p,visible:d,customVariables:a,onStepCompletion:f,onButtonClick:c,appearance:u,hideOnFlowCompletion:w,setVisible:T,customStepTypes:S,checklistStyle:x="default",autoExpandFirstIncompleteStep:E,autoExpandNextStep:P,...B})=>{let{getFlow:y,getFlowSteps:C,markStepCompleted:m,getStepStatus:h,getNumberOfStepsCompleted:F,isLoading:L,targetingLogicShouldHideFlow:U,updateCustomVariables:$,getFlowMetadata:A,isStepBlocked:_,getFlowStatus:N,hasActiveFullPageFlow:M,setHasActiveFullPageFlow:Z}=X(),{primaryCTAClickSideEffects:R,secondaryCTAClickSideEffects:z}=se(),{getOpenFlowState:Pe,setOpenFlowState:ge}=ve(),[V,re]=Kn(n||0),[ne,I]=Kn(!1),te=d===void 0?Pe(e):d,xe=s==="modal",{mergeAppearanceWithDefault:Ce}=J(),{isLarge:j}=pn();if(u=Ce(u),qn(()=>{$(a)},[a,L]),qn(()=>{d!==void 0&&(xe&&d===!0?Z(!0):xe&&d===!1&&Z(!1))},[d,T,M]),L)return null;let de=y(e);if(!de||U(de))return null;let oe=C(e);if(!oe||w===!0&&N(e)===Y)return null;let q=A(e);if(q!=null&&q.title&&(t=q.title),q!=null&&q.subtitle&&(o=q.subtitle),!ne&&n===void 0&&F(e)>0){let W=Math.min(F(e),oe.length-1);re(W),I(!0)}function je(){if(V+1>=oe.length){xe&&ge(e,!1);return}_(e,oe[V+1].id)||re(V+1)}function Ge(W,at,io){let cr=V+1<oe.length?oe[V+1]:null;c&&c(W,V,at,cr)===!0&&xe&&g(),f&&f(W,io,cr),!f&&!c&&(W.primaryButtonUri||W.secondaryButtonUri)&&xe&&g()}function K(){return oe.map((W,at)=>({...W,handleSecondaryButtonClick:()=>{je(),z(W),W.skippable===!0&&m(e,W.id,{skipped:!0}),Ge(W,"secondary",at)},handlePrimaryButtonClick:()=>{(!W.completionCriteria&&(W.autoMarkCompleted||W.autoMarkCompleted===void 0)||W.completionCriteria&&W.autoMarkCompleted===!0)&&(m(e,W.id),je()),Ge(W,"primary",at),R(W),h(e,W.id)===Oe&&je()}}))}function Se(){return pe.createElement(ie,{appearance:u})}let lt={steps:K(),title:t,subtitle:o,primaryColor:u.theme.colorPrimary,appearance:u,customStepTypes:S,type:s,className:r,autoExpandFirstIncompleteStep:E,autoExpandNextStep:P};function g(){ge(e,!1),p&&p(),T&&T(!1)}function b(){return pe.createElement(pe.Fragment,null,pe.createElement(Se,null),pe.createElement(Gn,{flowId:e,appearance:u,customVariables:a,className:r}))}function v(){return pe.createElement(pe.Fragment,null,pe.createElement(Se,null),pe.createElement(or,{visible:te,onClose:()=>{g()},selectedStep:V,setSelectedStep:re,autoExpandNextStep:!0,appearance:u,...lt}))}function H(){if(!j)return v();let W=B.guideFlowId,at;return W&&y(W)&&(at=C(W)),pe.createElement(pe.Fragment,null,pe.createElement(Se,null),pe.createElement(tr,{visible:te,stepsTitle:q.stepsTitle?q.stepsTitle:"Your quick start guide",onClose:()=>{g()},selectedStep:V,setSelectedStep:re,guideData:at,guideTitle:B.guideTitle??"Guide",appearance:u,title:t,subtitle:o,onGuideButtonClick:io=>{Ge(io,"link",0)},customStepTypes:S,...lt}))}function ce(){if(!j)return v();let W=pe.createElement(Ro,{flowId:e,style:i,selectedStep:V,setSelectedStep:re,appearance:u,type:s,...lt});return xe?pe.createElement(Re,{onClose:()=>{g()},visible:te,appearance:u,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},pe.createElement(Se,null),W):pe.createElement(pe.Fragment,null,pe.createElement(Se,null),W)}switch(x){case"condensed":return v();case"with-guide":return H();case"default":return ce();case"carousel":return b();default:return ce()}};var Dp=e=>Op.createElement(ir,{type:"inline",...e});import nt,{useEffect as $p}from"react";import He from"react";import Bo from"styled-components";var Yn=Bo.div`
|
|
1139
1156
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1140
1157
|
border-radius: 8px;
|
|
1141
1158
|
padding: 6px 10px 6px 10px;
|
|
1142
1159
|
min-width: 160px;
|
|
1143
1160
|
cursor: pointer;
|
|
1144
1161
|
background-color: ${e=>e.appearance.theme.colorBackground}};
|
|
1145
|
-
`,
|
|
1162
|
+
`,Xn=Bo.div`
|
|
1146
1163
|
display: flex;
|
|
1147
1164
|
flex-direction: row;
|
|
1148
1165
|
justify-content: space-between;
|
|
1149
1166
|
align-items: center;
|
|
1150
1167
|
margin-bottom: 2px;
|
|
1151
1168
|
flex-grow: 2;
|
|
1152
|
-
`,
|
|
1169
|
+
`,Jn=Bo.div`
|
|
1153
1170
|
text-overflow: ellipsis;
|
|
1154
1171
|
font-weight: 600;
|
|
1155
1172
|
font-size: 12px;
|
|
1156
1173
|
line-height: 15px;
|
|
1157
1174
|
text-align: ${e=>e.type==="condensed"?"left":"right"};
|
|
1158
1175
|
color: ${e=>e.appearance.theme.colorPrimary};
|
|
1159
|
-
`,
|
|
1176
|
+
`,Qn=Bo.div`
|
|
1160
1177
|
width: 20px;
|
|
1161
1178
|
margin-right: 8px;
|
|
1162
1179
|
display: flex;
|
|
1163
1180
|
height: 100%;
|
|
1164
1181
|
align-items: center;
|
|
1165
|
-
`;import{motion as
|
|
1182
|
+
`;import{motion as Mp}from"framer-motion";var Zn=({title:e,count:t,total:o,onClick:i,style:n={},className:r,appearance:s,type:p="default"})=>He.createElement(He.Fragment,null,He.createElement(ie,{appearance:s}),He.createElement(Yn,{as:Mp.div,whileHover:{opacity:.9},whileTap:{scale:.98},onClick:()=>i!==void 0&&i(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...n},className:ye(r??"",l("progressRingContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&He.createElement(Qn,{className:l("progressRingContainer",s)},He.createElement(At,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),He.createElement(Xn,{type:p,className:l("badgeTitleContainer",s)},He.createElement(Jn,{type:p,appearance:s,className:l("badgeTitle",s)},e),i!==void 0&&He.createElement(Dt,{className:l("badgeChevron",s),color:s.theme.colorPrimary})),p=="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 it from"react";import to from"styled-components";var Rn=to.div`
|
|
1166
1183
|
display: flex;
|
|
1167
1184
|
flex-direction: row;
|
|
1168
1185
|
width: 100%;
|
|
@@ -1173,25 +1190,25 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1173
1190
|
border-width: 1px;
|
|
1174
1191
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1175
1192
|
border-radius: 12px;
|
|
1176
|
-
`,
|
|
1193
|
+
`,es=to.div`
|
|
1177
1194
|
${e=>k(e)} {
|
|
1178
1195
|
display: flex;
|
|
1179
1196
|
justify-content: center;
|
|
1180
1197
|
align-items: center;
|
|
1181
1198
|
margin-right: 16px;
|
|
1182
1199
|
}
|
|
1183
|
-
`,
|
|
1200
|
+
`,ts=to.div`
|
|
1184
1201
|
display: flex;
|
|
1185
1202
|
flex-direction: column;
|
|
1186
1203
|
flex: 1;
|
|
1187
1204
|
margin-top: 0;
|
|
1188
|
-
`,
|
|
1205
|
+
`,os=to.div`
|
|
1189
1206
|
display: flex;
|
|
1190
1207
|
flex-direction: column;
|
|
1191
1208
|
justify-content: center;
|
|
1192
1209
|
margin-left: 16px;
|
|
1193
1210
|
min-width: 200px;
|
|
1194
|
-
|
|
1211
|
+
`,$C=to.div`
|
|
1195
1212
|
display: flex;
|
|
1196
1213
|
justify-content: center;
|
|
1197
1214
|
align-items: flex-end;
|
|
@@ -1200,7 +1217,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1200
1217
|
:hover {
|
|
1201
1218
|
opacity: 0.8;
|
|
1202
1219
|
}
|
|
1203
|
-
`;var
|
|
1220
|
+
`;var rs=({title:e,subtitle:t,icon:o,appearance:i,count:n,total:r,className:s,style:p})=>it.createElement(it.Fragment,null,it.createElement(Rn,{appearance:i,className:ye(l("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&it.createElement(es,{className:l("fullWidthProgressBadgeIcon",i)},o),it.createElement(ts,null,it.createElement(be,{size:"small",appearance:i,title:e,subtitle:t})),it.createElement(os,{className:l("fullWidthProgressBadgeProgressContainer",i)},it.createElement(ze,{count:n,total:r,display:"percent",textLocation:"top",fillColor:i.theme.colorPrimary}))));var Up=({flowId:e,title:t,subtitle:o,icon:i,style:n,onClick:r,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:a,type:f="default"})=>{let{getFlow:c,getFlowSteps:u,getFlowStatus:w,getNumberOfStepsCompleted:T,isLoading:S,targetingLogicShouldHideFlow:x,updateCustomVariables:E}=X(),{mergeAppearanceWithDefault:P}=J();a=P(a);let{setOpenFlowState:B,getOpenFlowState:y}=ve();if($p(()=>{E(p)},[p,S]),S)return null;let C=c(e);if(!C||x(C)||d===!0&&w(e)===Y)return null;let m=u(e),h=T(e);return f==="full-width"?nt.createElement(nt.Fragment,null,nt.createElement(ie,{appearance:a}),nt.createElement(rs,{title:t,subtitle:o,count:h,total:m.length,style:n,className:s,appearance:a,icon:i,onClick:()=>{}})):nt.createElement(nt.Fragment,null,nt.createElement(ie,{appearance:a}),nt.createElement(Zn,{count:h,total:m.length,title:t,style:n,onClick:()=>{B(e,!0),r&&r()},type:f,className:s,appearance:a}))};import _p from"react";var zp=({flowId:e,style:t,appearance:o,...i})=>{let{getFlow:n,targetingLogicShouldHideFlow:r,getFlowSteps:s}=X(),{mergeAppearanceWithDefault:p}=J();o=p(o);let d=n(e);if(!d||r(d))return null;let a=s(e);return _p.createElement(Rt,{steps:a,style:t,appearance:o,...i})};import Ut,{useContext as Zp,useEffect as Rp}from"react";import D,{useEffect as Ao,useLayoutEffect as fs,useRef as Gp,useState as oo}from"react";import ro from"styled-components";import{useCallback as Wp,useEffect as Hp,useState as Vp}from"react";var nr=(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}},is={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function jp(e){let t=is;return e&&(t=e.getBoundingClientRect()),t}function ns(e,t){let[o,i]=Vp(is),n=Wp(()=>{e&&i(jp(e))},[e]);return Hp(()=>(n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)),[e,t]),o}import st from"styled-components";var ss=st.div`
|
|
1204
1221
|
${e=>k(e)} {
|
|
1205
1222
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
1206
1223
|
}
|
|
@@ -1211,13 +1228,13 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1211
1228
|
min-width: 300px;
|
|
1212
1229
|
padding: 22px 22px 12px;
|
|
1213
1230
|
z-index: ${e=>e.zIndex};
|
|
1214
|
-
`,
|
|
1231
|
+
`,ls=st.div`
|
|
1215
1232
|
display: block;
|
|
1216
1233
|
cursor: pointer;
|
|
1217
1234
|
position: absolute;
|
|
1218
1235
|
top: 25px;
|
|
1219
1236
|
right: 22px;
|
|
1220
|
-
`,
|
|
1237
|
+
`,as=st.img`
|
|
1221
1238
|
${e=>k(e)} {
|
|
1222
1239
|
display: block;
|
|
1223
1240
|
width: 100%;
|
|
@@ -1226,7 +1243,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1226
1243
|
margin-top: ${e=>e.dismissible?"24px":"0px"};
|
|
1227
1244
|
margin-bottom: 16px;
|
|
1228
1245
|
}
|
|
1229
|
-
`,
|
|
1246
|
+
`,ps=st.div`
|
|
1230
1247
|
${e=>k(e)} {
|
|
1231
1248
|
display: block;
|
|
1232
1249
|
width: 100%;
|
|
@@ -1235,17 +1252,17 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1235
1252
|
margin-top: ${e=>e.dismissible?"24px":"0px"};
|
|
1236
1253
|
margin-bottom: 16px;
|
|
1237
1254
|
}
|
|
1238
|
-
`,
|
|
1255
|
+
`,ds=st.div`
|
|
1239
1256
|
display: flex;
|
|
1240
1257
|
flex-direction: row;
|
|
1241
1258
|
justify-content: space-between;
|
|
1242
1259
|
align-content: center;
|
|
1243
|
-
`,
|
|
1260
|
+
`,cs=st.div`
|
|
1244
1261
|
display: flex;
|
|
1245
1262
|
flex: 1;
|
|
1246
1263
|
flex-direction: column;
|
|
1247
1264
|
justify-content: center;
|
|
1248
|
-
`,
|
|
1265
|
+
`,ms=st.div`
|
|
1249
1266
|
display: flex;
|
|
1250
1267
|
flex: 2;
|
|
1251
1268
|
flex-shrink: 1;
|
|
@@ -1257,7 +1274,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1257
1274
|
align-content: center;
|
|
1258
1275
|
align-items: center;
|
|
1259
1276
|
}
|
|
1260
|
-
`,
|
|
1277
|
+
`,us=st.p`
|
|
1261
1278
|
${e=>k(e)} {
|
|
1262
1279
|
font-style: normal;
|
|
1263
1280
|
font-weight: 600;
|
|
@@ -1266,7 +1283,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1266
1283
|
color: #808080;
|
|
1267
1284
|
}
|
|
1268
1285
|
margin: 0;
|
|
1269
|
-
`;var
|
|
1286
|
+
`;var gs=300,hs=100,qp=500,$t=12,Kp=ro.div`
|
|
1270
1287
|
width: 100%;
|
|
1271
1288
|
height: 100%;
|
|
1272
1289
|
border-radius: 9999px;
|
|
@@ -1289,25 +1306,25 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1289
1306
|
opacity: 0;
|
|
1290
1307
|
}
|
|
1291
1308
|
}
|
|
1292
|
-
`,
|
|
1293
|
-
width: ${
|
|
1294
|
-
height: ${
|
|
1309
|
+
`,Yp=ro.div`
|
|
1310
|
+
width: ${$t}px;
|
|
1311
|
+
height: ${$t}px;
|
|
1295
1312
|
border-radius: 100px;
|
|
1296
1313
|
background-color: ${e=>e.primaryColor};
|
|
1297
1314
|
z-index: 20;
|
|
1298
1315
|
opacity: 1;
|
|
1299
|
-
`,
|
|
1316
|
+
`,Xp=ro.div`
|
|
1300
1317
|
pointer-events: all;
|
|
1301
|
-
`,
|
|
1318
|
+
`,xs=ro.div`
|
|
1302
1319
|
display: flex;
|
|
1303
1320
|
align-content: center;
|
|
1304
1321
|
justify-content: center;
|
|
1305
1322
|
align-items: center;
|
|
1306
1323
|
z-index: ${e=>e.zIndex?e.zIndex:90};
|
|
1307
|
-
`,
|
|
1308
|
-
width: ${
|
|
1309
|
-
height: ${
|
|
1310
|
-
`,
|
|
1324
|
+
`,Jp=ro(xs)`
|
|
1325
|
+
width: ${$t+12}px;
|
|
1326
|
+
height: ${$t+12}px;
|
|
1327
|
+
`,Qp=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:n=!0,primaryColor:r="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:a=0,customStepTypes:f,appearance:c,dismissible:u=!1,showHighlightOnly:w,showStepCount:T=!0,completedStepsCount:S=0})=>{var oe,q,je,Ge;let[x,E]=oo(),[P,B]=oo(new Date),y=Gp(null),[C,m]=oo(document.querySelector(e[a].selector)),h=ns(C,P),[F,L]=oo(),[U,$]=oo(!w),A=(q=(oe=e[a])==null?void 0:oe.props)!=null&&q.position?e[a].props.position:"absolute",_=((Ge=(je=e[a])==null?void 0:je.props)==null?void 0:Ge.zIndex)??90,N=(x==null?void 0:x.width)??gs,M=(x==null?void 0:x.height)??hs;fs(()=>{y.current&&E({width:y.current.clientWidth,height:y.current.clientHeight})},[a,P,A]),Ao(()=>{w||$(!0)},[a]);let Z=i==="auto"?"right":i,R=nr(h,Z,N,s,A),z=h.right+N>(window.innerWidth||document.documentElement.clientWidth),Pe=h.bottom+hs>(window.innerHeight||document.documentElement.clientHeight);z&&i==="auto"&&(R=nr(h,"left",N,s,A),Z="left");let ge=window.location.pathname.split("/").pop(),V=()=>{let K=document.querySelector(e[a].selector);F&&F===JSON.stringify(K==null?void 0:K.getBoundingClientRect())||(m(K),B(new Date),K&&L(JSON.stringify(K.getBoundingClientRect())))};if(Ao(()=>{let K=new MutationObserver(V);return K.observe(document.body,{subtree:!0,childList:!0}),()=>K.disconnect()},[V]),Ao(()=>{let K=new MutationObserver(V);return K.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>K.disconnect()},[V]),Ao(()=>{let K=setInterval(()=>{V()},10);return()=>clearInterval(K)},[V]),fs(()=>{setTimeout(()=>{V()},qp),V()},[a,ge]),C===null)return D.createElement(D.Fragment,null);if(R.x==0&&R.y==0)return D.createElement(D.Fragment,null);if(!p)return D.createElement(D.Fragment,null);let re=()=>{let K=()=>{if(e[a].handlePrimaryButtonClick&&(e[a].handlePrimaryButtonClick(),$(!1),setTimeout(()=>{V()},30)),S===e.length-1)return o()},Se=()=>{e[a].handleSecondaryButtonClick&&(e[a].handleSecondaryButtonClick(),w&&$(!1))};return D.createElement(D.Fragment,null,T&&D.createElement(cs,null,D.createElement(us,{className:l("tooltipStepCounter",c)},a+1," of ",e.length)),D.createElement(ms,{showStepCount:T,className:l("tooltipCTAContainer",c)},e[a].secondaryButtonTitle&&D.createElement(ee,{title:e[a].secondaryButtonTitle,appearance:c,onClick:Se,size:"small",withMargin:!1,secondary:!0}),e[a].primaryButtonTitle&&D.createElement(ee,{title:e[a].primaryButtonTitle,appearance:c,onClick:K,withMargin:!1,size:"small"})))},ne=()=>D.createElement(D.Fragment,null,u&&D.createElement(ls,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:l("tooltipClose",c)},D.createElement(Ee,null)),e[a].imageUri&&D.createElement(as,{dismissible:u,appearance:c,src:e[a].imageUri,className:l("tooltipImageContainer",c)}),e[a].videoUri&&!e[a].imageUri&&D.createElement(ps,{dismissible:u,appearance:c,className:l("tooltipVideoContainer",c)},D.createElement(Et,{appearance:c,videoUri:e[a].videoUri})),D.createElement(be,{appearance:c,title:e[a].title,subtitle:e[a].subtitle,size:"small"}),D.createElement(ds,{className:l("tooltipFooter",c)},D.createElement(re,null))),te={...{default:K=>{var Se;if((Se=e[a])!=null&&Se.StepContent){let lt=e[a].StepContent;return D.createElement("div",null,lt)}return D.createElement(ne,null)}},...f},xe=()=>{var K;return e?!((K=e[a])!=null&&K.type)||!te[e[a].type]?te.default(e[a]):te[e[a].type]({stepData:e[a],primaryColor:r}):D.createElement(D.Fragment,null)};if(w&&e[a].complete===!0)return null;let Ce={top:(R==null?void 0:R.y)-$t,left:(Z=="left"?h.x+s.x:(R==null?void 0:R.x)-$t)??0,cursor:w?"pointer":"default",position:A},j=()=>{let Se=Ce.left+(Z=="left"?-N:24);return Math.min(Math.max(Se,20),window.innerWidth-N-20)},de=()=>{w&&(B(new Date),$(!U))};return D.createElement(Xp,null,D.createElement(Jp,{style:Ce,zIndex:_,className:l("tourHighlightContainer",c)},n&&e[a].showHighlight!==!1&&D.createElement(D.Fragment,null,D.createElement(Yp,{style:{position:A},onClick:de,primaryColor:c.theme.colorPrimary}),D.createElement(Kp,{style:{position:"absolute"},onClick:de,primaryColor:c.theme.colorPrimary}))),D.createElement(xs,{style:{...Ce,left:j()},zIndex:_+1,className:l("tooltipContainerWrapper",c)},U&&D.createElement(ss,{ref:y,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:12,...d},appearance:c,className:l("tooltipContainer",c),maxWidth:gs,zIndex:_+10},D.createElement(xe,null))))},Io=Qp;import{Portal as ed}from"react-portal";var td=({flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:n,showTooltipsSimultaneously:r=!1,onDismiss:s,dismissible:p,tooltipPosition:d="auto",showHighlightOnly:a=!1,dismissBehavior:f="complete-flow",onComplete:c,...u})=>{let{getFlow:w,getFlowSteps:T,isLoading:S,targetingLogicShouldHideFlow:x,markStepCompleted:E,markStepStarted:P,markFlowCompleted:B,updateCustomVariables:y,getCurrentStepIndex:C,getStepStatus:m,isStepBlocked:h,getFlowStatus:F,getNumberOfStepsCompleted:L}=X(),{isLoadingUserFlowStateData:U}=Ie(),{primaryCTAClickSideEffects:$,secondaryCTAClickSideEffects:A}=se(),{hasOpenModals:_}=ve(),N=C(e),{openFlowStates:M}=Zp(G),{mergeAppearanceWithDefault:Z}=J();if(o=Z(o),Rp(()=>{y(t)},[t,S]),U)return null;let R=w(e);if(!R||x(R)||F(e)==Y||_())return null;let z=T(e);if(Object.keys(M).length>0){let I=Object.keys(M).find(te=>M[te]===!0);if(I!==void 0&&I!==e)return Ut.createElement(Ut.Fragment,null)}async function Pe(I){if(await E(e,I.id),z.map(te=>m(e,te.id)).every(te=>te===Oe)){await B(e);return}if(!a&&N+1<z.length){if(h(e,z[N+1].id))return;await P(e,z[N+1].id)}}function ge(I,te,xe){let Ce=N+1<z.length?z[N+1]:null;n&&n(I,N,te,Ce),i&&i(I,xe,Ce)}function V(){return z.map(I=>({...I,handleSecondaryButtonClick:async()=>{A(I),I.skippable===!0&&await E(e,I.id,{skipped:!0}),ge(I,"secondary",N)},handlePrimaryButtonClick:async()=>{(!I.completionCriteria&&(I.autoMarkCompleted||I.autoMarkCompleted===void 0)||I.completionCriteria&&I.autoMarkCompleted===!0)&&await Pe(I),ge(I,"primary",N),$(I)}}))}async function re(I){s&&s(),f==="complete-flow"?await B(e):await E(e,I.id)}function ne(){c&&c()}return Ut.createElement(ed,null,Ut.createElement(ie,{appearance:o}),r?z.map((I,te)=>Ut.createElement(Io,{key:I.id,appearance:o,steps:V(),selectedStep:te,showTooltipsSimultaneously:r,dismissible:p,onDismiss:()=>re(I),tooltipPosition:d,showHighlightOnly:a,completedStepsCount:L(e),onComplete:ne,...u})):Ut.createElement(Io,{appearance:o,steps:V(),selectedStep:N,showTooltipsSimultaneously:r,dismissible:p,onDismiss:()=>re(z[N]),tooltipPosition:d,completedStepsCount:L(e),showHighlightOnly:a,onComplete:ne,...u}))};import Te,{useEffect as od,useRef as rd,useState as id}from"react";import{Portal as nd}from"react-portal";import wt from"styled-components";var Cs=wt.button`
|
|
1311
1328
|
${e=>k(e)} {
|
|
1312
1329
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1313
1330
|
|
|
@@ -1325,17 +1342,17 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1325
1342
|
opacity: 0.8;
|
|
1326
1343
|
}
|
|
1327
1344
|
}
|
|
1328
|
-
`,
|
|
1345
|
+
`,Ss=wt.span`
|
|
1329
1346
|
${e=>k(e)} {
|
|
1330
1347
|
font-size: 12px;
|
|
1331
1348
|
display: inline-block;
|
|
1332
1349
|
}
|
|
1333
|
-
`,
|
|
1350
|
+
`,ys=wt.span`
|
|
1334
1351
|
${e=>k(e)} {
|
|
1335
1352
|
font-size: 12px;
|
|
1336
1353
|
display: inline-block;
|
|
1337
1354
|
}
|
|
1338
|
-
`,
|
|
1355
|
+
`,bs=wt.div`
|
|
1339
1356
|
position: fixed;
|
|
1340
1357
|
right: 0;
|
|
1341
1358
|
bottom: 0;
|
|
@@ -1345,7 +1362,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1345
1362
|
flex-direction: column;
|
|
1346
1363
|
align-items: flex-end;
|
|
1347
1364
|
z-index: 50;
|
|
1348
|
-
`,
|
|
1365
|
+
`,ws=wt.button`
|
|
1349
1366
|
${e=>k(e)} {
|
|
1350
1367
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1351
1368
|
background-color: #ffffff;
|
|
@@ -1361,7 +1378,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1361
1378
|
0px 3px 6px -4px rgba(0, 0, 0, 0.12);
|
|
1362
1379
|
border-radius: 45px;
|
|
1363
1380
|
cursor: pointer;
|
|
1364
|
-
`,
|
|
1381
|
+
`,Ts=wt.div`
|
|
1365
1382
|
${e=>k(e)} {
|
|
1366
1383
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1367
1384
|
background: #ffffff;
|
|
@@ -1378,7 +1395,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1378
1395
|
position: ${e=>e.type=="inline"?"absolute":"relative"};
|
|
1379
1396
|
top: ${e=>e.type=="inline"?"68px":0};
|
|
1380
1397
|
margin-left: ${e=>e.type=="inline"?"-127px":0};
|
|
1381
|
-
`,
|
|
1398
|
+
`,Fs=wt.button`
|
|
1382
1399
|
${e=>k(e)} {
|
|
1383
1400
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1384
1401
|
color: #434343;
|
|
@@ -1395,7 +1412,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1395
1412
|
font-size: 14px;
|
|
1396
1413
|
|
|
1397
1414
|
padding: 8px 12px;
|
|
1398
|
-
`;import{AnimatePresence as
|
|
1415
|
+
`;import{AnimatePresence as Bs,motion as As}from"framer-motion";import ks from"react";var Ps=({style:e,className:t})=>ks.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},ks.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 vs from"react";var Es=({style:e,className:t})=>vs.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"},vs.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 sd=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:n="inline",title:r="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:a,getStepStatus:f,getNumberOfStepsCompleted:c,isLoading:u,targetingLogicShouldHideFlow:w}=X(),{primaryCTAClickSideEffects:T}=se(),S=rd(null),[x,E]=id(!1),{mergeAppearanceWithDefault:P}=J();s=P(s),od(()=>(document.addEventListener("click",B,!1),()=>{document.removeEventListener("click",B,!1)}),[]);let B=F=>{S.current&&!S.current.contains(F.target)&&E(!1)};if(u)return null;let y=p(e);if(!y||w(y))return null;let C=d(e);if(!C||!i)return null;function m(F,L){!F.completionCriteria&&(F.autoMarkCompleted||F.autoMarkCompleted===void 0)&&a(e,F.id),T(F),o&&o(F,L),E(!1)}function h(){return x&&Te.createElement(Ts,{className:l("floatingWidgetMenu",s),as:As.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:n},C.map((F,L)=>Te.createElement(Fs,{className:l("floatingWidgetMenuItem",s),key:L,onClick:()=>m(F,L)},F.title)))}return n=="inline"?Te.createElement("span",{ref:S},Te.createElement(Cs,{style:t,onClick:()=>{E(!x)},className:l("supportButton",s)},Te.createElement(ys,{className:l("supportIconContainer",s)},Te.createElement(Es,{className:l("supportIcon",s),style:{width:"18px",height:"18px"}})),Te.createElement(Ss,{className:l("supportButtonTitle",s)},r)),Te.createElement(Bs,null,Te.createElement(h,null))):Te.createElement(nd,null,Te.createElement(bs,{style:t,ref:S},Te.createElement(Bs,null,Te.createElement(h,null)),Te.createElement(ws,{onClick:()=>{E(!x)},as:As.button,whileHover:{scale:1.1},className:l("floatingWidgetButton",s)},Te.createElement(Ps,{className:l("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import Ve,{useEffect as ld}from"react";import No from"styled-components";var Is=No.div`
|
|
1399
1416
|
${e=>k(e)} {
|
|
1400
1417
|
display: flex;
|
|
1401
1418
|
flex-direction: column;
|
|
@@ -1410,17 +1427,17 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1410
1427
|
border-radius: 12px;
|
|
1411
1428
|
position: relative;
|
|
1412
1429
|
}
|
|
1413
|
-
`,
|
|
1430
|
+
`,Ns=No.div`
|
|
1414
1431
|
display: flex;
|
|
1415
1432
|
flex-direction: column;
|
|
1416
1433
|
flex: 1;
|
|
1417
|
-
`,
|
|
1434
|
+
`,Ls=No.div`
|
|
1418
1435
|
display: flex;
|
|
1419
1436
|
flex-direction: column;
|
|
1420
1437
|
justify-content: center;
|
|
1421
1438
|
align-items: flex-start;
|
|
1422
1439
|
margin-top: 16px;
|
|
1423
|
-
`,
|
|
1440
|
+
`,Os=No.div`
|
|
1424
1441
|
${e=>k(e)} {
|
|
1425
1442
|
position: absolute;
|
|
1426
1443
|
top: 16px;
|
|
@@ -1431,7 +1448,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1431
1448
|
opacity: 0.8;
|
|
1432
1449
|
}
|
|
1433
1450
|
}
|
|
1434
|
-
`;var
|
|
1451
|
+
`;var ad=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:a,markStepCompleted:f,isLoading:c,targetingLogicShouldHideFlow:u,updateCustomVariables:w,getFlowSteps:T,getFlowStatus:S,getCurrentStepIndex:x}=X(),{primaryCTAClickSideEffects:E}=se(),{mergeAppearanceWithDefault:P}=J();if(n=P(n),ld(()=>{w(o)},[o,c]),c)return null;let B=d(e);if(!B||u(B)||S(e)===Y)return null;let C=T(e)[x(e)];return Ve.createElement(Ve.Fragment,null,Ve.createElement(ie,{appearance:n}),Ve.createElement(Is,{appearance:n,className:ye(l("embeddedTipContainer",n),r),style:s},(p===!0||C.dismissible)&&Ve.createElement(Os,{onClick:async()=>{await a(e),t&&t()},className:l("embeddedTipDismissButton",n)},Ve.createElement(Ee,null)),Ve.createElement(Ns,null,Ve.createElement(be,{size:"small",appearance:n,title:C.title,subtitle:C.subtitle})),C.primaryButtonTitle&&Ve.createElement(Ls,{className:l("embeddedTipCallToActionContainer",n)},Ve.createElement(ee,{classPrefix:"embeddedTip",title:C.primaryButtonTitle,appearance:n,withMargin:!1,size:"small",type:"inline",onClick:async()=>{C.handlePrimaryButtonClick(),E(C),!(i&&i(C,x(e),"primary")===!1)&&(await f(e,C.id),await a(e))}}))))};import he,{useEffect as pd}from"react";import _t from"styled-components";var Ds=_t.div`
|
|
1435
1452
|
// use the :not annotation
|
|
1436
1453
|
${e=>k(e)} {
|
|
1437
1454
|
display: flex;
|
|
@@ -1445,24 +1462,24 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1445
1462
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1446
1463
|
border-radius: 12px;
|
|
1447
1464
|
}
|
|
1448
|
-
`,
|
|
1465
|
+
`,Ms=_t.div`
|
|
1449
1466
|
${e=>k(e)} {
|
|
1450
1467
|
display: flex;
|
|
1451
1468
|
width: 36px;
|
|
1452
1469
|
height: 36px;
|
|
1453
1470
|
}
|
|
1454
|
-
|
|
1471
|
+
`,$s=_t.div`
|
|
1455
1472
|
display: flex;
|
|
1456
1473
|
flex-direction: column;
|
|
1457
1474
|
flex: 1;
|
|
1458
1475
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1459
1476
|
margin-top: ${e=>e.type==="square"?"12px":"0"};
|
|
1460
|
-
`,
|
|
1477
|
+
`,Us=_t.div`
|
|
1461
1478
|
display: flex;
|
|
1462
1479
|
flex-direction: column;
|
|
1463
1480
|
justify-content: center;
|
|
1464
1481
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1465
|
-
`,
|
|
1482
|
+
`,sr=_t.div`
|
|
1466
1483
|
display: flex;
|
|
1467
1484
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1468
1485
|
align-items: flex-end;
|
|
@@ -1471,12 +1488,12 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1471
1488
|
:hover {
|
|
1472
1489
|
opacity: 0.8;
|
|
1473
1490
|
}
|
|
1474
|
-
`,
|
|
1491
|
+
`,lr=_t.div`
|
|
1475
1492
|
display: flex;
|
|
1476
1493
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1477
1494
|
align-items: flex-end;
|
|
1478
1495
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1479
|
-
`;import
|
|
1496
|
+
`;import _s from"react";var zs=({style:e,className:t})=>_s.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"},_s.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 dd=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:n,onButtonClick:r,appearance:s,type:p="full-width",icon:d})=>{let{getFlow:a,markFlowCompleted:f,isLoading:c,targetingLogicShouldHideFlow:u,updateCustomVariables:w,getFlowMetadata:T,getFlowStatus:S,getFlowSteps:x,getCurrentStepIndex:E}=X(),{primaryCTAClickSideEffects:P}=se(),{mergeAppearanceWithDefault:B}=J();if(s=B(s),pd(()=>{w(n)},[n,c]),c)return null;let y=a(e);if(!y||u(y)||S(e)===Y)return null;let C=x(e),m=C.length>0?C[E(e)]:T(e);return m!=null&&m.title&&(t=m.title),m!=null&&m.subtitle&&(o=m.subtitle),he.createElement(he.Fragment,null,he.createElement(ie,{appearance:s}),he.createElement(Ds,{type:p,appearance:s,className:l("bannerContainer",s)},p!="square"&&he.createElement(Ms,{className:l("bannerIconContainer",s)},d||he.createElement(zs,null)),p==="square"&&m.dismissible&&he.createElement(lr,{type:p,className:l("bannerDismissButtonContainer",s)},he.createElement(sr,{type:p,onClick:async()=>{await f(e),i&&i()},className:l("bannerDismissButton",s)},he.createElement(Ee,null))),he.createElement($s,{type:p},he.createElement(be,{appearance:s,title:t,subtitle:o})),he.createElement(Us,{type:p,className:l("bannerCallToActionContainer",s)},he.createElement(ee,{title:(m==null?void 0:m.primaryButtonTitle)??"Get started",appearance:s,onClick:()=>{P(m),r&&r(m,0,"primary")}})),p!=="square"&&m.dismissible&&he.createElement(lr,{type:p,className:l("bannerDismissButtonContainer",s)},he.createElement(sr,{type:p,onClick:async()=>{await f(e),i&&i()},className:l("bannerDismissButton",s)},he.createElement(Ee,null)))))};import Q,{useEffect as cd}from"react";import{Portal as md}from"react-portal";import Ze from"styled-components";var Ws=Ze.div`
|
|
1480
1497
|
${e=>k(e)} {
|
|
1481
1498
|
display: flex;
|
|
1482
1499
|
flex-direction: column;
|
|
@@ -1497,7 +1514,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1497
1514
|
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
|
|
1498
1515
|
min-width: 550px;
|
|
1499
1516
|
}
|
|
1500
|
-
`,
|
|
1517
|
+
`,Hs=Ze.button`
|
|
1501
1518
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1502
1519
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1503
1520
|
// If selected make border color primary and text color color priamry
|
|
@@ -1518,30 +1535,30 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1518
1535
|
display: flex;
|
|
1519
1536
|
justify-content: center;
|
|
1520
1537
|
align-items: center;
|
|
1521
|
-
`,
|
|
1538
|
+
`,ar=Ze.div`
|
|
1522
1539
|
display: flex;
|
|
1523
1540
|
justify-content: flex-end;
|
|
1524
1541
|
margin-top: 24px;
|
|
1525
1542
|
gap: 8px;
|
|
1526
|
-
|
|
1543
|
+
`,Vs=Ze.div`
|
|
1527
1544
|
display: flex;
|
|
1528
1545
|
justify-content: space-between;
|
|
1529
1546
|
margin-top: 24px;
|
|
1530
|
-
`,
|
|
1547
|
+
`,pr=Ze.div`
|
|
1531
1548
|
font-size: 12px;
|
|
1532
1549
|
line-height: 16px;
|
|
1533
1550
|
color: ${e=>e.appearance.theme.colorTextDisabled};
|
|
1534
|
-
`,
|
|
1551
|
+
`,dr=Ze.div`
|
|
1535
1552
|
display: flex;
|
|
1536
1553
|
flex-direction: column;
|
|
1537
1554
|
flex: 1;
|
|
1538
|
-
`,
|
|
1555
|
+
`,XS=Ze.div`
|
|
1539
1556
|
display: flex;
|
|
1540
1557
|
flex-direction: column;
|
|
1541
1558
|
justify-content: center;
|
|
1542
1559
|
align-items: flex-start;
|
|
1543
1560
|
margin-top: 16px;
|
|
1544
|
-
`,
|
|
1561
|
+
`,js=Ze.textarea`
|
|
1545
1562
|
${e=>k(e)} {
|
|
1546
1563
|
margin-top: 16px;
|
|
1547
1564
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
@@ -1552,7 +1569,7 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1552
1569
|
width: 100%;
|
|
1553
1570
|
height: 100px;
|
|
1554
1571
|
}
|
|
1555
|
-
`,
|
|
1572
|
+
`,Gs=Ze.div`
|
|
1556
1573
|
${e=>k(e)} {
|
|
1557
1574
|
position: absolute;
|
|
1558
1575
|
top: 16px;
|
|
@@ -1563,5 +1580,5 @@ ${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map
|
|
|
1563
1580
|
opacity: 0.8;
|
|
1564
1581
|
}
|
|
1565
1582
|
}
|
|
1566
|
-
`;var
|
|
1583
|
+
`;var ud=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:s})=>{let{getFlow:p,markFlowCompleted:d,markStepCompleted:a,getNumberOfStepsCompleted:f,isLoading:c,targetingLogicShouldHideFlow:u,updateCustomVariables:w,getFlowSteps:T,getFlowStatus:S,getCurrentStepIndex:x}=X(),{primaryCTAClickSideEffects:E}=se(),{mergeAppearanceWithDefault:P}=J(),[B,y]=Q.useState(null),[C,m]=Q.useState(""),{hasOpenModals:h,setKeepCompletedFlowOpenDuringSession:F,shouldKeepCompletedFlowOpenDuringSession:L}=ve();if(n=P(n),cd(()=>{w(o)},[o,c]),c)return null;let U=p(e);if(!U||u(U)||S(e)===Y||f(e)===1&&!L(e)||h())return null;let A=T(e)[x(e)];function _(){return Q.createElement(Q.Fragment,null,Q.createElement(dr,null,Q.createElement(be,{size:"large",appearance:n,title:A.title,subtitle:A.subtitle})),Q.createElement(ar,{className:l("npsNumberButtonContainer",n),appearance:n},Array.from(Array(10).keys()).map(M=>Q.createElement(Hs,{className:l("npsNumberButton",n),selected:B===M+1,key:M,onClick:async()=>{F(e),y(M+1),await a(e,A.id,{score:M+1})},appearance:n},M+1))),Q.createElement(Vs,{appearance:n},Q.createElement(pr,{appearance:n},"Not likely at all"),Q.createElement(pr,{appearance:n},"Extremely likely")))}function N(){return Q.createElement(Q.Fragment,null,Q.createElement(dr,null,Q.createElement(be,{appearance:n,title:"Why did you choose this score?",size:"large"})),Q.createElement(js,{appearance:n,value:C,onChange:M=>{m(M.target.value)},placeHolder:"Add your optional fedback here..."}),Q.createElement(ar,{appearance:n,className:l("npsNumberButtonContainer",n)},Q.createElement(ee,{size:"large",withMargin:!1,onClick:async()=>{await d(e),i&&i(A,1,"primary")},appearance:n,title:A.secondaryButtonTitle||"Skip",secondary:!0}),Q.createElement(ee,{size:"large",withMargin:!1,onClick:async()=>{await a(e,A.id,{feedbackText:C}),await d(e),i&&i(A,1,"primary")},appearance:n,title:A.primaryButtonTitle||"Submit"})))}return Q.createElement(md,null,Q.createElement(ie,{appearance:n}),Q.createElement(Ws,{appearance:n,className:ye(l("npsSurveyContainer",n),r),style:s},Q.createElement(Gs,{onClick:async()=>{await d(e),t&&t()},className:l("npsSurveyDismissButton",n)},Q.createElement(Ee,null)),f(e)==0&&_(),f(e)==1&&N()))};export{ft as CheckBox,tt as FormLabel,zo as FormTextField,dd as FrigadeBanner,ir as FrigadeChecklist,qe as FrigadeDefaultAppearance,ad as FrigadeEmbeddedTip,di as FrigadeForm,zp as FrigadeGuide,Dp as FrigadeHeroChecklist,ud as FrigadeNPSSurvey,Up as FrigadeProgressBadge,$a as FrigadeProvider,sd as FrigadeSupportWidget,td as FrigadeTour,At as ProgressRing,ve as useFlowOpens,Wt as useFlowResponses,X as useFlows,Yo as useOrganization,Ht as useUser};
|
|
1567
1584
|
//# sourceMappingURL=index.mjs.map
|