@frigade/react 1.32.44 → 1.32.46
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 +84 -84
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +80 -80
- 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 bo,useState as Yo}from"react";import{useCallback as dt,useContext as Qs,useEffect as Zs}from"react";import No,{useMemo as _s}from"react";var cr="1.32.44 ";var ke="https://api.frigade.com/v1/public/",Ie="NOT_STARTED_STEP",X="COMPLETED_FLOW",io="ABORTED_FLOW",pt="STARTED_FLOW",Le="NOT_STARTED_FLOW",Oe="COMPLETED_STEP",no="STARTED_STEP";function $e(){let{publicApiKey:e,userId:t}=No.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}=No.useContext(q);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),Wt();let i=Ws+t,r=zs+t;if(window&&window.localStorage&&o&&o.body&&o.method==="POST"){let s=window.localStorage.getItem(i),p=window.localStorage.getItem(r);if(s&&p&&p==o.body){let d=new Date(s);if(new Date().getTime()-d.getTime()<1e3)return Wt()}window.localStorage.setItem(i,new Date().toISOString()),window.localStorage.setItem(r,o.body)}let n;try{n=await fetch(t,o)}catch(s){return Wt(s)}return n?n.ok?n:Wt(n.statusText):Wt()}}function Wt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Ft(){let{publicApiKey:e,shouldGracefullyDegrade:t}=No.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:i,completedFlowsToKeepOpenDuringSession:r}=Hs(q);function n(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){r.includes(c)||i(u=>[...u,c])}function a(c){return r.includes(c)}function f(){return Object.values(e).some(c=>c)||o}return{getOpenFlowState:n,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:f,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:a}}var Ks="unknown";function Be(){let{config:e}=$e(),{publicApiKey:t,userId:o,flows:i,setShouldGracefullyDegrade:r}=js(q),{resetOpenFlowState:n}=ve(),[s,p]=Vs(!1),d={data:i.map(F=>({flowId:F.id,flowState:X,lastStepId:null,userId:o,foreignUserId:o,stepStates:{},shouldTrigger:!1}))},a=F=>fetch(F,e).then(x=>{if(x.ok)return x.json();throw new Error("Failed to fetch user flow states")}).catch(x=>(console.log(`Error fetching ${F}: ${x}. Will gracefully degrade and hide Frigade`),r(!0),d)),{data:f,isLoading:c,mutate:u,error:w}=qs(t&&i&&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(F){if(T){let x=T.find(m=>m.flowId===F);x&&x.flowState!==X&&(x.flowState=X),await u(Promise.resolve({...f,data:T}),{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1})}}async function h(F,x,m){if(T){let C=T.find(P=>P.flowId===F);C&&(C.stepStates[x]=m,C.flowState=pt),await u(Promise.resolve({...f,data:T}),{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1})}}async function E(F,x,m){if(T){let C=T.find(P=>P.flowId===F);C&&(C.lastStepId=x,C.stepStates[x]=m,C.flowState=pt),await u({...f,data:T},{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1})}}async function y(F){if(T){let x=T.find(m=>m.flowId===F);x&&x.flowState!==Le&&(x.flowState=Le,x.lastStepId=Ks,Object.keys(x.stepStates).forEach(m=>{x.stepStates[m].actionType=Ie,x.stepStates[m].createdAt=new Date().toISOString()}),await u({...f,data:T},{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1}),n(F))}}async function A(F,x){if(T){let m=T.find(C=>C.flowId===F);m&&m.stepStates[x]!==Ie&&(m.stepStates[x]=Ie),await u({...f,data:T},{optimisticData:{...f,data:T},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:T,isLoadingUserFlowStateData:!s,mutateUserFlowState:u,optimisticallyMarkFlowCompleted:S,optimisticallyMarkFlowNotStarted:y,optimisticallyMarkStepCompleted:h,optimisticallyMarkStepNotStarted:A,optimisticallyMarkStepStarted:E,error:w}}function zt(){let{config:e}=$e(),{userFlowStatesData:t,mutateUserFlowState:o}=Be(),{failedFlowResponses:i,setFailedFlowResponses:r,flowResponses:n,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=n==null?void 0:n.find(y=>y.flowSlug===S.flowSlug&&y.stepId===S.stepId&&y.actionType===S.actionType&&y.createdAt===S.createdAt);return c(`${ke}flowResponses`,{...e,method:"POST",body:h}).then(y=>{y.status!==200&&y.status!==201?(console.log("Failed to send flow response for step "+S.stepId+". Will retry again later."),r([...i,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===no?await u(S):S.actionType===Oe?await u(S):S.actionType===io?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 y=h.stepStates[E];S.push({foreignUserId:h.foreignUserId,flowSlug:h.flowId,stepId:y.stepId,actionType:y.actionType,data:{},createdAt:new Date(y.createdAt),blocked:y.blocked,hidden:y.hidden})}}),[...S,...n]}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((i,r)=>{let n=Js(i,"'","");n.startsWith("flow_")&&(o=n)}),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:i,publicApiKey:r,customVariables:n,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:y,optimisticallyMarkFlowNotStarted:A,optimisticallyMarkStepCompleted:F,optimisticallyMarkStepNotStarted:x,optimisticallyMarkStepStarted:m}=Be(),{data:C,error:P,isLoading:$}=Rs(r?`${ke}flows`:null,S,{keepPreviousData:!0});Zs(()=>{if(P){console.error(P);return}C&&C.data&&(C.data=o(C.data))},[C,P]);function U(g){if($)return null;let b=t.find(v=>v.slug===g);return!b&&t.length>0&&!E&&!$?(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:L(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)=>n[v]!==void 0?String(n[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 D(g){!E&&!$&&g&&JSON.stringify(n)!=JSON.stringify({...n,...g})&&Object.keys(g).forEach(b=>{B(b,g[b])})}let re=dt(async(g,b,v)=>{u();let H={foreignUserId:i,flowSlug:g,stepId:b,actionType:no,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};G(H)&&(await m(g,b,H),w(H))},[i,h]),R=dt(async(g,b,v)=>{u();let H={foreignUserId:i,flowSlug:g,stepId:b,actionType:Ie,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};G(H)&&(await x(g,b),w(H))},[i,h]),_=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};G(H)&&(await F(g,b,H),w(H))},[i,h]),he=dt(async(g,b)=>{if(u(),K(g)===Le)return;let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:Le,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};await A(g),G(v)&&w(v)},[i,h]),Fe=dt(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:pt,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};G(v)&&w(v)},[i,h]),W=dt(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:X,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};G(v)&&(await y(g),w(v))},[i,h]),se=dt(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:io,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};G(v)&&(await y(g),w(v))},[i,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 L(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 L(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=>L(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&&i&&i.startsWith("guest_"))}function lt(g){return!Se(U(g))}return{getFlow:U,getFlowData:Y,isLoading:E||$,getStepStatus:L,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:D,customVariables:n,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 Lo(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=el(q),{config:n}=$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`,{...n,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(c,"true"))}},[e,r,t]);let a=fr(async c=>{d();let u={foreignId:e,properties:c};await p(`${ke}users`,{...n,method:"POST",body:JSON.stringify(u)}),i(w=>({...w,...c})),s()},[e,n,r,s]),f=fr(async(c,u)=>{d();let T={foreignId:e,events:[{event:c,properties:u}]};await p(`${ke}users`,{...n,method:"POST",body:JSON.stringify(T)}),s()},[e,n,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 lo from"styled-components";import ol from"react";import rl from"styled-components";var gr="fr-",Ht="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+" "+Ht+e}return o}function k(e){if(!e.className||e.className.indexOf(Ht)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(gr)?"":`: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 hr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var il=rl.div`
|
|
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.46 ";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`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -23,11 +23,11 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
23
23
|
opacity: 1;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
`,xr=({onClose:e,appearance:t})=>ol.createElement(il,{className:l("modalBackground",t),onClick:()=>e()});import
|
|
26
|
+
`,xr=({onClose:e,appearance:t})=>ol.createElement(il,{className:l("modalBackground",t),onClick:()=>e()});import lo from"react";import nl from"styled-components";var sl=nl.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
|
-
`,Ee=()=>
|
|
30
|
+
`,Ee=()=>lo.createElement(sl,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 al}from"react-portal";var pl=ao.div`
|
|
31
31
|
${e=>k(e)} {
|
|
32
32
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
33
33
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -72,10 +72,10 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
72
72
|
opacity: 1;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
`,dl=
|
|
75
|
+
`,dl=ao.div`
|
|
76
76
|
position: relative;
|
|
77
77
|
flex: 0 1 auto;
|
|
78
|
-
`,cl=
|
|
78
|
+
`,cl=ao.div`
|
|
79
79
|
position: absolute;
|
|
80
80
|
top: 24px;
|
|
81
81
|
right: 24px;
|
|
@@ -85,14 +85,14 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
85
85
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
86
86
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
87
87
|
}
|
|
88
|
-
`,ml=
|
|
88
|
+
`,ml=ao.div`
|
|
89
89
|
overflow: scroll;
|
|
90
90
|
flex: 1 1;
|
|
91
91
|
display: flex;
|
|
92
92
|
::-webkit-scrollbar {
|
|
93
93
|
display: none;
|
|
94
94
|
}
|
|
95
|
-
`,Re=({onClose:e,visible:t,headerContent:o=null,style:
|
|
95
|
+
`,Re=({onClose:e,visible:t,headerContent:o=null,style:r=null,children:n,appearance:i,dismissible:s=!0})=>(ll(()=>{let p=d=>{d.key==="Escape"&&e()};return document.addEventListener("keydown",p),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",p)}},[e,t]),t?Ve.createElement(al,null,Ve.createElement(xr,{appearance:i,onClose:()=>{s&&e()}}),Ve.createElement(pl,{appearance:i,className:l("modalContainer",i),styleOverrides:r},s&&Ve.createElement(cl,{className:l("modalClose",i),onClick:()=>e(),appearance:i},Ve.createElement(Ee,null)),o&&Ve.createElement(dl,null,o),Ve.createElement(ml,null,n))):Ve.createElement(Ve.Fragment,null));import et,{useEffect as ul}from"react";import po from"styled-components";import{Portal as fl}from"react-portal";var gl=po.div`
|
|
96
96
|
${e=>k(e)} {
|
|
97
97
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
98
98
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -110,10 +110,10 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
110
110
|
bottom: 0;
|
|
111
111
|
margin-right: 28px;
|
|
112
112
|
margin-bottom: 28px;
|
|
113
|
-
`,hl=
|
|
113
|
+
`,hl=po.div`
|
|
114
114
|
position: relative;
|
|
115
115
|
flex: 1;
|
|
116
|
-
`,xl=
|
|
116
|
+
`,xl=po.div`
|
|
117
117
|
position: absolute;
|
|
118
118
|
top: 24px;
|
|
119
119
|
right: 24px;
|
|
@@ -123,13 +123,13 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
123
123
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
124
124
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
125
125
|
}
|
|
126
|
-
`,Cl=
|
|
126
|
+
`,Cl=po.div`
|
|
127
127
|
overflow: scroll;
|
|
128
128
|
flex: 5;
|
|
129
129
|
::-webkit-scrollbar {
|
|
130
130
|
display: none;
|
|
131
131
|
}
|
|
132
|
-
`,Cr=({onClose:e,visible:t,headerContent:o=null,children:
|
|
132
|
+
`,Cr=({onClose:e,visible:t,headerContent:o=null,children:r,appearance:n})=>(ul(()=>{let i=s=>{s.key==="Escape"&&e()};return document.addEventListener("keydown",i),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",i)}},[e,t]),t?et.createElement(fl,null,et.createElement(gl,{appearance:n,className:l("cornerModalContainer",n)},et.createElement(xl,{className:l("cornerModalClose",n),onClick:()=>e()},et.createElement(Ee,null)),o&&et.createElement(hl,null,o),et.createElement(Cl,null,r))):et.createElement(et.Fragment,null));import{useContext as Sl}from"react";function Q(){let{defaultAppearance:e}=Sl(q);function t(o){let r=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign(r.styleOverrides??{},o.styleOverrides??{}),theme:Object.assign(r.theme,o.theme??{})}:r}return{mergeAppearanceWithDefault:t}}import Gt,{useEffect as Il,useState as Wo}from"react";import zo from"styled-components";import uo,{useEffect as yl,useState as Fr}from"react";import Mo from"styled-components";import co from"styled-components";var Sr=co.label`
|
|
133
133
|
${e=>k(e)} {
|
|
134
134
|
font-size: 14px;
|
|
135
135
|
line-height: 20px;
|
|
@@ -137,14 +137,14 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
137
137
|
margin-top: 10px;
|
|
138
138
|
}
|
|
139
139
|
display: flex;
|
|
140
|
-
`,yr=
|
|
140
|
+
`,yr=co.label`
|
|
141
141
|
${e=>k(e)} {
|
|
142
142
|
font-size: 12px;
|
|
143
143
|
line-height: 20px;
|
|
144
144
|
margin-bottom: 5px;
|
|
145
145
|
}
|
|
146
146
|
display: flex;
|
|
147
|
-
`,br=
|
|
147
|
+
`,br=co.span`
|
|
148
148
|
font-weight: 400;
|
|
149
149
|
font-size: 14px;
|
|
150
150
|
line-height: 22px;
|
|
@@ -152,12 +152,12 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
152
152
|
display: flex;
|
|
153
153
|
margin-right: 5px;
|
|
154
154
|
margin-top: 10px;
|
|
155
|
-
`,co
|
|
155
|
+
`,mo=co.div`
|
|
156
156
|
display: flex;
|
|
157
157
|
align-items: flex-start;
|
|
158
158
|
justify-content: left;
|
|
159
159
|
margin-bottom: 10px;
|
|
160
|
-
`;import Do 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 Do.createElement(
|
|
160
|
+
`;import Do 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 Do.createElement(mo,null,t?Do.createElement(br,{className:l("formLabelRequired",o),appearance:o},"*"):null,Do.createElement(Sr,{className:l("formLabel",o)},e))}import wr from"react";function Pt({title:e,appearance:t}){return e?wr.createElement(mo,null,wr.createElement(yr,{className:l("formSubLabel",t)},e)):null}import{z as $o}from"zod";function Tr(e,t){try{if(t){if(t.type=="number"){let o=$o.number();if(t.props)for(let r of t.props)r.requirement=="min"?o=o.min(Number(r.value),r.message??"Value is too small"):r.requirement=="max"?o=o.max(Number(r.value),r.message??"Value is too large"):r.requirement=="positive"?o=o.positive(r.message??"Value must be positive"):r.requirement=="negative"&&(o=o.nonpositive(r.message??"Value must be negative"));o.parse(Number(e))}if(t.type=="string"){let o=$o.string();if(t.props)for(let r of t.props)r.requirement=="min"?o=o.min(Number(r.value),r.message??"Value is too short"):r.requirement=="max"?o=o.max(Number(r.value),r.message??"Value is too long"):r.requirement=="regex"&&(o=o.regex(new RegExp(String(r.value)),r.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=Mo.div`
|
|
161
161
|
display: flex;
|
|
162
162
|
flex-direction: column;
|
|
163
163
|
width: 100%;
|
|
@@ -193,7 +193,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
193
193
|
min-height: 70px;
|
|
194
194
|
box-sizing: border-box;
|
|
195
195
|
margin-bottom: 10px;
|
|
196
|
-
`;function _o({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:
|
|
196
|
+
`;function _o({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:r,inputData:n}){let i=e,[s,p]=Fr((n==null?void 0:n.text)||""),[d,a]=Fr(!1),f=Uo;yl(()=>{s===""&&!d&&(a(!0),c(""))},[]);function c(w){if(p(w),o({text:w}),i.required===!0&&w.trim()===""){r([{id:i.id,message:`${i.title} is required`}]);return}let T=Tr(w,i.validation);if(T){r([{id:i.id,message:T}]);return}r([])}i.multiline&&(f=wl);function u(){var w;switch((w=i==null?void 0:i.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:i.title,required:i.required,appearance:t.appearance}),uo.createElement(f,{className:l("inputComponent",t.appearance),value:s,onChange:w=>{c(w.target.value)},appearance:t.appearance,placeholder:i.placeholder,type:u()}),uo.createElement(Pt,{title:i.subtitle,appearance:t.appearance}))}import Me,{useEffect as kr,useState as Pr}from"react";import vr from"styled-components";var Tl=vr.div`
|
|
197
197
|
display: flex;
|
|
198
198
|
flex-direction: column;
|
|
199
199
|
width: 100%;
|
|
@@ -223,7 +223,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
223
223
|
background-repeat: no-repeat;
|
|
224
224
|
background-size: 1.5em 1.5em;
|
|
225
225
|
-webkit-print-color-adjust: exact;
|
|
226
|
-
`,
|
|
226
|
+
`,fo="null";function Er({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:r,setFormValidationErrors:n}){var f,c,u,w,T,S;let i=e,[s,p]=Pr(((f=r==null?void 0:r.choice)==null?void 0:f[0])||""),[d,a]=Pr(!1);return kr(()=>{var h,E,P,A;if(s===""&&!d){if(a(!0),i.requireSelection){p(fo);return}if(i.defaultValue&&((h=i.props.options)!=null&&h.find(y=>y.id===i.defaultValue))){let y=(E=i.props.options)==null?void 0:E.find(C=>C.id===i.defaultValue);p(y.id),o({choice:[y.id]})}else p(((P=i.props.options)==null?void 0:P[0].id)||""),o({choice:[((A=i.props.options)==null?void 0:A[0].id)||""]})}},[]),kr(()=>{i.requireSelection&&s===fo?n([{message:"Please select an option",id:i.id}]):n([])},[s]),Me.createElement(Tl,null,Me.createElement(tt,{title:i.title,required:!1,appearance:t.appearance}),Me.createElement(Fl,{value:s,onChange:h=>{p(h.target.value),o({choice:[h.target.value]})},placeholder:i.placeholder,appearance:t.appearance,className:l("multipleChoiceSelect",t.appearance)},i.requireSelection&&Me.createElement("option",{key:fo,value:fo},"Select an option"),(c=i.props.options)==null?void 0:c.map(h=>Me.createElement("option",{key:h.id,value:h.id},h.title))),((w=(u=i.props.options)==null?void 0:u.find(h=>h.id===s))==null?void 0:w.isOpenEnded)&&Me.createElement(Me.Fragment,null,Me.createElement(tt,{title:((S=(T=i.props.options)==null?void 0:T.find(h=>h.id===s))==null?void 0:S.openEndedLabel)??"Please specify",required:!1,appearance:t.appearance}),Me.createElement(Uo,{type:"text",placeholder:"Enter your answer here",onChange:h=>{o({choice:[h.target.value]})},appearance:t.appearance})),Me.createElement(Pt,{title:i.subtitle,appearance:t.appearance}))}import go,{useEffect as Ar,useState as Ir}from"react";import Br from"styled-components";var kl=Br.div`
|
|
227
227
|
display: flex;
|
|
228
228
|
flex-direction: column;
|
|
229
229
|
width: 100%;
|
|
@@ -251,7 +251,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
251
251
|
height: 60px;
|
|
252
252
|
padding: 0 18px;
|
|
253
253
|
margin-bottom: 10px;
|
|
254
|
-
`;function Nr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:
|
|
254
|
+
`;function Nr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:r}){var a;let n=e,[i,s]=Ir((r==null?void 0:r.choice)||[]),[p,d]=Ir(!1);return Ar(()=>{i.length==0&&!p&&(d(!0),o({choice:[]}))},[]),Ar(()=>{o({choice:i})},[i]),go.createElement(kl,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(Pl,{appearance:t.appearance,key:f.id,value:f.id,"data-selected":i.includes(f.id),onClick:()=>{if(i.includes(f.id)){s(i.filter(c=>c!==f.id));return}i.length<n.props.maxChoices?s([...i,f.id]):i.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 Lr from"styled-components";import vl from"dompurify";function me(e){return{__html:vl.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var El=Lr.h1`
|
|
255
255
|
${e=>k(e)} {
|
|
256
256
|
font-style: normal;
|
|
257
257
|
font-weight: 600;
|
|
@@ -270,7 +270,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
270
270
|
line-height: 20px;
|
|
271
271
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
272
272
|
}
|
|
273
|
-
`;function be({appearance:e,title:t,subtitle:o,size:
|
|
273
|
+
`;function be({appearance:e,title:t,subtitle:o,size:r="medium"}){return ho.createElement(ho.Fragment,null,ho.createElement(El,{appearance:e,className:l(`${r}Title`,e),dangerouslySetInnerHTML:me(t),size:r}),o&&ho.createElement(Al,{appearance:e,className:l(`${r}Subtitle`,e),dangerouslySetInnerHTML:me(o),size:r}))}var Bl=zo.div`
|
|
274
274
|
display: flex;
|
|
275
275
|
flex-direction: column;
|
|
276
276
|
justify-content: flex-end;
|
|
@@ -283,10 +283,10 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
283
283
|
`,Ll=zo.div`
|
|
284
284
|
padding-left: 1px;
|
|
285
285
|
padding-right: 1px;
|
|
286
|
-
`,Ol={text:_o,multipleChoice:Er,multipleChoiceList:Nr};function Or({
|
|
286
|
+
`,Ol={text:_o,multipleChoice:Er,multipleChoiceList:Nr};function Or({flowId:e,stepData:t,canContinue:o,setCanContinue:r,onSaveData:n,appearance:i,customFormElements:s}){var A;let p=t.props,[d,a]=Wo([]),[f,c]=Wo([]),{userId:u}=Ht(),[w,T]=Wo(E()||{}),S={...Ol,...s};Il(()=>{r(d.length===0)},[d,r]);function h(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 Gt.createElement(Ll,{className:l("multiInput",i)},Gt.createElement(be,{appearance:i,title:t.title,subtitle:t.subtitle}),Gt.createElement(Bl,{className:l("multiInputContainer",i)},(A=p.data)==null?void 0:A.map(y=>{var m;let C=(m=d.reverse().find(x=>x.id===y.id))==null?void 0:m.message;return S[y.type]?Gt.createElement("span",{key:y.id},S[y.type]({formInput:y,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:r,onSaveData:n,appearance:i},onSaveInputData:x=>{!f.includes(y.id)&&x&&(x==null?void 0:x.text)!==""&&c(F=>[...F,y.id]),h(y,x)},inputData:w[y.id],setFormValidationErrors:x=>{a(F=>x.length===0?F.filter(L=>L.id!==y.id):[...F,...x])}}),C&&f.includes(y.id)&&Gt.createElement(Nl,{appearance:i,className:l("multiInputValidationError",i)},C)):null})))}import mt from"styled-components";var Dr=mt.div`
|
|
287
287
|
align-items: center;
|
|
288
288
|
display: flex;
|
|
289
|
-
justify-content: space-between;
|
|
289
|
+
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
290
290
|
padding-top: 14px;
|
|
291
291
|
`,$r=mt.div`
|
|
292
292
|
color: ${e=>e.appearance.theme.colorTextError};
|
|
@@ -333,8 +333,8 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
333
333
|
${e=>e.withMargin?"margin: 16px 0px 16px 0px;":""}
|
|
334
334
|
|
|
335
335
|
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,
|
|
336
|
+
color: ${e=>{var t,o,r,n;return e.secondary?(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorPrimary:(n=(r=e.appearance)==null?void 0:r.theme)==null?void 0:n.colorTextOnPrimaryBackground}};
|
|
337
|
+
background-color: ${e=>{var t,o,r,n;return e.secondary?(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground:(n=(r=e==null?void 0:e.appearance)==null?void 0:r.theme)==null?void 0:n.colorPrimary}};
|
|
338
338
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
339
339
|
padding: ${e=>e.size=="small"?"6px 14px 6px 14px":"8px 20px 8px 20px"};
|
|
340
340
|
font-size: ${e=>e.size=="small"?"14px":"15px"};
|
|
@@ -352,7 +352,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
352
352
|
opacity: 0.3;
|
|
353
353
|
cursor: not-allowed;
|
|
354
354
|
}
|
|
355
|
-
`,
|
|
355
|
+
`,xo=Hr.div`
|
|
356
356
|
${e=>k(e)} {
|
|
357
357
|
display: flex;
|
|
358
358
|
flex-direction: row;
|
|
@@ -362,9 +362,9 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
362
362
|
margin-right: 8px;
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
-
`,ee=({onClick:e,title:t,style:o,disabled:
|
|
365
|
+
`,ee=({onClick:e,title:t,style:o,disabled:r,type:n="inline",size:i="medium",secondary:s=!1,appearance:p,withMargin:d=!0,classPrefix:a=""})=>{function f(){let c=s?"buttonSecondary":"button";return a===""?c:`${a}${hr(c)}`}return Dl.createElement($l,{secondary:s,appearance:p,disabled:r,onClick:e,style:o,type:n,withMargin:d,size:i,className:l(f(),p)},t)};var jr=({step:e,canContinue:t,appearance:o,onPrimaryClick:r,onSecondaryClick:n,formType:i,selectedStep:s,steps:p,onBack:d,allowBackNavigation:a,errorMessage:f})=>{let c=i==="inline"?"inline":"full-width",u=p.length>1&&s!=0&&a;return ot.createElement(ot.Fragment,null,f&&ot.createElement($r,{appearance:o,className:l("formCTAError",o)},f),ot.createElement(Dr,{showBackButton:u,className:l("formCTAContainer",o)},u&&ot.createElement(ee,{title:"\u2190",onClick:d,secondary:!0,withMargin:!1,type:c,appearance:o}),ot.createElement(Mr,{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:r,type:c,appearance:o}):null)))};import Ho from"react";import Ml from"styled-components";var Ul=Ml.div`
|
|
366
366
|
text-align: center;
|
|
367
|
-
`,Gr=({stepCount:e=0,currentStep:t=0,className:o,appearance:
|
|
367
|
+
`,Gr=({stepCount:e=0,currentStep:t=0,className:o,appearance:r})=>{let{theme:n}=Q().mergeAppearanceWithDefault(r);return Ho.createElement(Ul,{className:o},Ho.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((i,s)=>Ho.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 _l}from"react";function ne(){let e=_l(q);function t(n){r(n.primaryButtonUri,n.primaryButtonUriTarget)}function o(n){r(n.secondaryButtonUri,n.secondaryButtonUriTarget)}function r(n,i){if(!n)return;let s=n.startsWith("http")?"_blank":"_self";i&&i!=="_blank"&&(s="_self"),e.navigate(n,s)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:r}}var Wl=vt.div`
|
|
368
368
|
display: flex;
|
|
369
369
|
flex-wrap: wrap;
|
|
370
370
|
align-content: center;
|
|
@@ -412,7 +412,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
412
412
|
margin-top: 12px;
|
|
413
413
|
margin-bottom: 16px;
|
|
414
414
|
max-width: 70%;
|
|
415
|
-
`;function Vr({stepData:e,appearance:t}){var
|
|
415
|
+
`;function Vr({stepData:e,appearance:t}){var r,n;let{handleUrl:o}=ne();return ut.createElement("div",null,ut.createElement(Gl,null,e.title),ut.createElement(Vl,null,e.subtitle),ut.createElement(Wl,null,(n=(r=e.props)==null?void 0:r.links)==null?void 0:n.map(i=>ut.createElement(zl,{key:i.title},ut.createElement(Hl,{src:i.imageUri}),ut.createElement(jl,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{i.uri&&o(i.uri,i.uriTarget??"_blank")}},i.title)))))}import At,{useEffect as Zl}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 Vt,{useRef as ql,useState as Kl}from"react";import So from"styled-components";var Yl=So.div`
|
|
416
416
|
display: flex;
|
|
417
417
|
align-items: center;
|
|
418
418
|
justify-content: flex-start;
|
|
@@ -420,7 +420,7 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
420
420
|
width: 100%;
|
|
421
421
|
height: 100%;
|
|
422
422
|
position: relative;
|
|
423
|
-
`,Xl=
|
|
423
|
+
`,Xl=So.div`
|
|
424
424
|
position: absolute;
|
|
425
425
|
display: flex;
|
|
426
426
|
align-items: center;
|
|
@@ -439,43 +439,43 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
439
439
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
440
440
|
border-radius: 50%;
|
|
441
441
|
}
|
|
442
|
-
`,Jl=
|
|
442
|
+
`,Jl=So.video`
|
|
443
443
|
width: 100%;
|
|
444
444
|
height: 100%;
|
|
445
445
|
min-height: 200px;
|
|
446
446
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
447
|
-
`,Ql=
|
|
447
|
+
`,Ql=So.iframe`
|
|
448
448
|
width: 100%;
|
|
449
449
|
height: 100%;
|
|
450
450
|
min-height: 200px;
|
|
451
451
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
452
|
-
`;function Et({appearance:e,videoUri:t}){let o=ql(),[
|
|
452
|
+
`;function Et({appearance:e,videoUri:t}){let o=ql(),[r,n]=Kl(!1);if(t.includes("youtube")){let i=t.split("v=")[1],s=i.indexOf("&");return s!==-1&&(i=i.substring(0,s)),Vt.createElement(Ql,{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${i}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,appearance:e})}return Vt.createElement(Yl,{appearance:e},!r&&Vt.createElement(Xl,{onClick:()=>{n(!0),o.current.play()},appearance:e},Vt.createElement(Co,null)),Vt.createElement(Jl,{appearance:e,controls:r,ref:o,play:r,src:t}))}var Rl=yo.div`
|
|
453
453
|
${e=>k(e)} {
|
|
454
454
|
display: flex;
|
|
455
455
|
flex-direction: column;
|
|
456
456
|
justify-content: center;
|
|
457
457
|
}
|
|
458
|
-
`,ea=
|
|
458
|
+
`,ea=yo.img`
|
|
459
459
|
${e=>k(e)} {
|
|
460
460
|
width: 100%;
|
|
461
461
|
height: auto;
|
|
462
462
|
max-height: 250px;
|
|
463
463
|
margin-bottom: 24px;
|
|
464
464
|
}
|
|
465
|
-
`,ta=
|
|
465
|
+
`,ta=yo.div`
|
|
466
466
|
${e=>k(e)} {
|
|
467
467
|
margin-bottom: 24px;
|
|
468
468
|
}
|
|
469
|
-
`,oa=
|
|
469
|
+
`,oa=yo.div`
|
|
470
470
|
${e=>k(e)} {
|
|
471
471
|
width: 100%;
|
|
472
472
|
height: auto;
|
|
473
473
|
max-height: 250px;
|
|
474
474
|
margin-bottom: 24px;
|
|
475
475
|
}
|
|
476
|
-
`;function qr({stepData:e,appearance:t,setCanContinue:o}){return Zl(()=>{o(!0)},[]),At.createElement(Rl,{className:l("callToActionContainer",t)},At.createElement(ta,{className:l("callToActionTextContainer",t)},At.createElement(be,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&At.createElement(ea,{className:l("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&At.createElement(oa,{appearance:t,className:l("callToActionVideo",t)},At.createElement(Et,{appearance:t,videoUri:e.videoUri})))}import Ke,{useEffect as Go,useState as Vo}from"react";import
|
|
476
|
+
`;function qr({stepData:e,appearance:t,setCanContinue:o}){return Zl(()=>{o(!0)},[]),At.createElement(Rl,{className:l("callToActionContainer",t)},At.createElement(ta,{className:l("callToActionTextContainer",t)},At.createElement(be,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&At.createElement(ea,{className:l("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&At.createElement(oa,{appearance:t,className:l("callToActionVideo",t)},At.createElement(Et,{appearance:t,videoUri:e.videoUri})))}import Ke,{useEffect as Go,useState as Vo}from"react";import Kt from"react";import qt from"react";import{motion as ra}from"framer-motion";var Kr=({color:e,percentage:t,size:o})=>{let r=o*.5-2,n=2*Math.PI*r,i=(1-t)*n,s={duration:.3,delay:0,ease:"easeIn"},p={hidden:{strokeDashoffset:n,transition:s},show:{strokeDashoffset:i,transition:s}};return qt.createElement(ra.circle,{r,cx:o*.5,cy:o*.5,fill:"transparent",stroke:i!==n?e:"",strokeWidth:"3px",strokeDasharray:n,strokeDashoffset:t?i:0,variants:p,transition:s,initial:"hidden",animate:"show"})},ia=({fillColor:e,size:t,percentage:o,children:r,bgColor:n="#D9D9D9",className:i,style:s})=>qt.createElement("svg",{style:s,className:i,width:t,height:t,overflow:"visible"},qt.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},qt.createElement(Kr,{color:n,size:t}),qt.createElement(Kr,{color:e,percentage:o,size:t})),r),It=ia;import na from"styled-components";var sa=({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"})),la={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},aa={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},pa={border:"1px solid #000000",color:"#FFFFFF"},da={border:"1px solid #E6E6E6"},ca={color:"#FFFFFF"},ma={border:"3px solid #D9D9D9"},ua=e=>e==="square"?la:aa,fa=(e,t)=>e==="square"?t?pa:da:t?ca:ma,ga=na.div`
|
|
477
477
|
${e=>ct(e)}
|
|
478
|
-
`,ft=({value:e,type:t="square",primaryColor:o="#000000",progress:
|
|
478
|
+
`,ft=({value:e,type:t="square",primaryColor:o="#000000",progress:r,appearance:n=qe,style:i,className:s})=>{let p=ua(t),d=fa(t,e);return e===!0?p={...p,...d,backgroundColor:o,borderColor:t==="square"?o:"none"}:p={...p,...d},e!==!0&&t==="round"&&r!==void 0&&r!==1?Kt.createElement(It,{fillColor:o,percentage:r,size:22}):Kt.createElement(ga,{styleOverrides:p,style:i,role:"checkbox",className:ye(l("checkIconContainer",n),l(e?"checkIconContainerChecked":"checkIconContainerUnchecked",n),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&Kt.createElement(sa,{color:"#FFFFFF"}))};import rt from"styled-components";var Yr=rt.div`
|
|
479
479
|
width: auto;
|
|
480
480
|
display: flex;
|
|
481
481
|
flex-direction: column;
|
|
@@ -528,8 +528,8 @@ import ht,{createContext as Pa,useEffect as Xo,useState as Ne}from"react";import
|
|
|
528
528
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
529
529
|
display: flex;
|
|
530
530
|
align-self: center;
|
|
531
|
-
`;var oi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:
|
|
532
|
-
${
|
|
531
|
+
`;var oi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:r})=>{let n=e.props,[i,s]=Vo([]),[p,d]=Vo(!1),[a,f]=Vo(e.id);return Go(()=>{i.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),Go(()=>{a!==e.id&&(f(e.id),s([]))},[e]),Go(()=>{o({choice:i}),i.length>=n.minChoices?t(!0):t(!1)},[i]),Ke.createElement(Yr,{className:l("selectListContainer",r)},Ke.createElement(Xr,null,Ke.createElement(Jr,{className:l("selectListTitle",r)},e.title),Ke.createElement(Qr,{appearance:r,className:l("selectListSubtitle",r)},e.subtitle)),n.options.map((c,u)=>{let w=i.includes(c.id);return Ke.createElement(Zr,{key:`select-item-${u}`,onClick:()=>{if(i.includes(c.id)){s(i.filter(T=>T!==c.id));return}i.length<n.maxChoices?s([...i,c.id]):i.length==1&&n.maxChoices==1&&s([c.id])},hideBottomBorder:u===n.options.length-1,className:l("selectListSelectItem",r)},Ke.createElement(Rr,{className:l("selectListItemImage",r)},c.imageUri&&Ke.createElement(ei,{src:c.imageUri,alt:`select-icon-${u}`}),Ke.createElement(ti,{appearance:r,className:l("selectListSelectItemText",r)},c.title)),Ke.createElement(ft,{appearance:r,value:w,primaryColor:r.theme.colorPrimary}))}))};import we,{useEffect as qo,useState as Yt}from"react";import{AnimatePresence as ha,motion as xa}from"framer-motion";var Ca=({children:e,id:t,shouldWrap:o=!1})=>we.createElement(we.Fragment,null,o?we.createElement(ha,{initial:!1},we.createElement(xa.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:r,customVariables:n,onButtonClick:i,onStepCompletion:s,flowId:p,type:d,hideOnFlowCompletion:a,onComplete:f,setVisible:c,setShowModal:u,onDismiss:w,showPagination:T=!1,customFormElements:S,allowBackNavigation:h,validationHandler:E})=>{var Ce;let A={...{linkCollection:Vr,multiInput:Or,callToAction:qr,selectList:oi},...r},{primaryCTAClickSideEffects:y,secondaryCTAClickSideEffects:C}=ne(),[m,x]=Yt(!1),[F,L]=Yt({}),[U,M]=Yt(!1),[I,j]=Yt(!1),[B,$]=Yt(null),re=t[o]??null,{markStepCompleted:R,markStepStarted:_,isLoading:he,updateCustomVariables:Fe,markFlowCompleted:W}=J();qo(()=>{Fe(n)},[n,he]),qo(()=>{window&&h&&!I&&(window.location.hash=t[o].id,j(!0))},[h,I,j]),qo(()=>{var V;if(window&&((V=window==null?void 0:window.location)!=null&&V.hash)&&window.location.hash.replace("#","")!==t[o].id){let de=window.location.hash.replace("#",""),oe=t.findIndex(K=>K.id===de);oe!==-1&&_(p,t[oe].id)}},[(Ce=window==null?void 0:window.location)==null?void 0:Ce.hash,_,o,t]);function se(){return{data:F[t[o].id]??{},stepId:t[o].id,customVariables:n}}function G(V,de,oe){let K=o+1<t.length?t[o+1]:null;i&&i(V,o,de,K),s&&s(V,oe,K,F,se())}function O(V,de){L(oe=>{let K={};return K[V.id]=de,{...oe,...K}})}function te(V){return V.selectedStep.imageUri?we.createElement(zr,{image:V.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(M(!0),E){let de=E(t[o],o,t[o+1],F,se());if(de){$(de),M(!1);return}else $(null)}let V={...se()};await R(p,t[o].id,V),o+1<t.length&&await _(p,t[o+1].id),G(t[o],"primary",o),o+1>=t.length&&(f&&f(),w&&w(),a&&(c&&c(!1),u(!1)),await W(p)),y(t[o]),M(!1),window&&h&&o+1<t.length&&(window.location.hash=t[o+1].id)},onSecondaryClick:()=>{G(t[o],"secondary",o),C(t[o])},onBack:async()=>{o-1>=0&&(M(!0),await _(p,t[o-1].id),M(!1))},steps:t,allowBackNavigation:h,errorMessage:B});return we.createElement(we.Fragment,null,we.createElement(Ur,{className:l("formContainer",e)},we.createElement(_r,null,we.createElement(Ca,{id:o,shouldWrap:d==="large-modal"},we.createElement(Wr,{key:re.id,type:d,className:l("formContent",e)},t.map(V=>{let de=A[V.type];return re.id!==V.id?null:we.createElement(de,{key:V.id,stepData:V,canContinue:m,setCanContinue:x,onSaveData:oe=>{O(V,oe)},appearance:e,customFormElements:S,flowId:p})}),T&&we.createElement(Gr,{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 Sa}from"styled-components";function ie({appearance:e}){if(!e||!e.styleOverrides)return Xt.createElement(Xt.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([r,n])=>typeof n=="object");if(t.length===0)return Xt.createElement(Xt.Fragment,null);let o=Sa`
|
|
532
|
+
${r=>r.inlineStyles.map(([n,i])=>`.${jt}${n}.${jt}${n} { ${Object.entries(i).map(([s,p])=>`${Oo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return Xt.createElement(o,{inlineStyles:t})}var ri=({flowId:e,customStepTypes:t={},type:o="inline",visible:r,setVisible:n,customVariables:i,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:h,showPagination:E=!1,allowBackNavigation:P=!1,validationHandler:A})=>{let{getFlow:y,getFlowSteps:C,isLoading:m,targetingLogicShouldHideFlow:x,getFlowStatus:F,getCurrentStepIndex:L,markFlowCompleted:U,markFlowNotStarted:M}=J(),I=L(e),{mergeAppearanceWithDefault:j}=Q(),[B,$]=ba(!1),{setOpenFlowState:re,getOpenFlowState:R}=ve();d=j(d);let[_,he]=r!==void 0&&n!==void 0?[r,n]:[R(e,!0),G=>re(e,G)];if(ya(()=>{!B&&!m&&($(!0),F(e)===X&&S&&M(e),$(!0))},[B,$,m]),m)return null;let Fe=y(e);if(!Fe||x(Fe))return null;let W=C(e);if(!W||r!==void 0&&r===!1||F(e)===X&&a)return null;let se=()=>{he(!1),h&&h(),w===!0&&U(e)};if(T=="center"&&o==="modal"||o==="large-modal"){let G={padding:"24px"};return o==="large-modal"?(G.width="85%",G.height="90%",G.maxHeight="800px",G.minHeight="500px",G.padding="0"):G.width="400px",Ue.createElement(Re,{appearance:d,onClose:se,visible:_,style:G,dismissible:u},Ue.createElement(ie,{appearance:d}),Ue.createElement(bo,{appearance:d,steps:W,selectedStep:I,customStepTypes:t,customVariables:i,onButtonClick:c,onStepCompletion:f,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:n,setShowModal:he,onDismiss:h,showPagination:E,customFormElements:s,allowBackNavigation:P,validationHandler:A}))}return o==="modal"&&T!=="center"?Ue.createElement(Cr,{appearance:d,onClose:se,visible:_},Ue.createElement(ie,{appearance:d}),Ue.createElement(bo,{appearance:d,steps:W,selectedStep:I,customStepTypes:t,customVariables:i,onButtonClick:c,onStepCompletion:f,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:n,setShowModal:he,onDismiss:h,showPagination:E,customFormElements:s,allowBackNavigation:P,validationHandler:A})):Ue.createElement(Ue.Fragment,null,Ue.createElement(ie,{appearance:d}),Ue.createElement(bo,{appearance:d,steps:W,selectedStep:I,customStepTypes:t,customVariables:i,onButtonClick:c,onStepCompletion:f,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:n,setShowModal:he,onDismiss:h,showPagination:E,customFormElements:s,allowBackNavigation:P,validationHandler:A}))},ii=ri;import{useCallback as ni,useContext as wa,useEffect as Ta}from"react";function Ko(){let{organizationId:e,userId:t,setOrganizationId:o}=wa(q),{mutateUserFlowState:r}=Be(),{config:n}=$e(),i=Tt(),{verifySDKInitiated:s}=Ft();Ta(()=>{if(t&&e){if(t.startsWith(kt))return;let a=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(a)||(i(`${ke}userGroups`,{...n,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(a,"true"))}},[t,e]);let p=ni(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 i(`${ke}userGroups`,{...n,method:"POST",body:JSON.stringify(f)}),r()},[e,t,n,r]),d=ni(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 i(`${ke}userGroups`,{...n,method:"POST",body:JSON.stringify(u)}),r()},[e,t,n,r]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:p,trackEventForOrganization:d}}var si="xFrigade_guestUserId",li="xFrigade_userId",ai=({})=>{let{setFlowResponses:e}=zt(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:r}=Be(),{userId:n,setUserId:i}=Ht(),[s,p]=Yo(null),{getFlowStatus:d}=J(),{flows:a,userProperties:f,setIsNewGuestUser:c,flowResponses:u}=Fa(q),[w,T]=Yo([]),[S,h]=Yo([]),{organizationId:E}=Ko();wo(()=>{if(!o&&t)for(let C=0;C<t.length;C++){let m=t[C],x=a.find(F=>F.slug===(m==null?void 0:m.flowId));if(x&&m&&m.shouldTrigger===!0&&x.type=="FORM"&&x.triggerType==="AUTOMATIC"&&!S.includes(x.slug)){setTimeout(()=>{P(m.flowId)},500);break}}},[o,t]),wo(()=>{u.length>0&&r()},[u]);function P(C){let m=a.find(x=>x.slug===C);m&&m.triggerType==="AUTOMATIC"&&!S.includes(m.slug)&&(h([...S,m.slug]),T([m]))}function A(){if(!n){let C=localStorage.getItem(li);if(C){i(C);return}let m=localStorage.getItem(si);if(m){i(m);return}c(!0);let x=kt+ka();try{localStorage.setItem(si,x)}catch(F){console.log("Failed to save guest user id locally: Local storage unavailable",F)}i(F=>F||x)}}wo(()=>{try{if(a){let C=[];a.forEach(m=>{if(m.data){let x=m.data.match(/"imageUri":"(.*?)"/g);x&&x.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(li,n)}catch(C){console.log("Failed to save user id locally: Local storage available",C)}n===null&&setTimeout(()=>{n===null&&A()},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(ii,{flowId:C.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return gt.createElement(gt.Fragment,null,gt.createElement(y,null))};import{ErrorBoundary as Ea}from"react-error-boundary";var q=Pa({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:()=>{}}),Aa=({publicApiKey:e,userId:t,organizationId:o,config:r,children:n})=>{var re,R;let[i,s]=Ne(t||null),[p,d]=Ne(o||null),[a,f]=Ne([]),[c,u]=Ne([]),[w,T]=Ne([]),[S,h]=Ne({}),[E,P]=Ne({}),[A,y]=Ne([]),[C,m]=Ne({}),[x,F]=Ne(!1),[L,U]=Ne(!1),[M,I]=Ne(!$(e)),j=(_,he)=>{if(he==="_blank"){window.open(_,"_blank");return}setTimeout(()=>{window.location.href=_},50)},B={theme:{...qe.theme,...((re=r==null?void 0:r.defaultAppearance)==null?void 0:re.theme)??{}},styleOverrides:{...qe.styleOverrides,...((R=r==null?void 0:r.defaultAppearance)==null?void 0:R.styleOverrides)??{}}};function $(_){return!!(_&&_.length>10&&_.substring(0,10)==="api_public")}return Xo(()=>{t&&s(t)},[t]),Xo(()=>{o&&d(o)},[o]),Xo(()=>{if($(e))I(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),I(!0);return}},[e,I]),M?ht.createElement(q.Provider,{value:{publicApiKey:e,userId:i,setUserId:s,setFlows:f,flows:a,failedFlowResponses:c,setFailedFlowResponses:u,flowResponses:w,setFlowResponses:T,userProperties:S,setUserProperties:h,openFlowStates:E,setOpenFlowStates:P,completedFlowsToKeepOpenDuringSession:A,setCompletedFlowsToKeepOpenDuringSession:y,customVariables:C,setCustomVariables:m,isNewGuestUser:x,setIsNewGuestUser:F,hasActiveFullPageFlow:L,setHasActiveFullPageFlow:U,organizationId:p,setOrganizationId:d,navigate:r&&r.navigate?r.navigate:j,defaultAppearance:B,shouldGracefullyDegrade:M,setShouldGracefullyDegrade:I}},n):ht.createElement(Ea,{fallback:ht.createElement(ht.Fragment,null,n)},ht.createElement(q.Provider,{value:{publicApiKey:e,userId:i,setUserId:s,setFlows:f,flows:a,failedFlowResponses:c,setFailedFlowResponses:u,flowResponses:w,setFlowResponses:T,userProperties:S,setUserProperties:h,openFlowStates:E,setOpenFlowStates:P,completedFlowsToKeepOpenDuringSession:A,setCompletedFlowsToKeepOpenDuringSession:y,customVariables:C,setCustomVariables:m,isNewGuestUser:x,setIsNewGuestUser:F,hasActiveFullPageFlow:L,setHasActiveFullPageFlow:U,organizationId:p,setOrganizationId:d,navigate:r&&r.navigate?r.navigate:j,defaultAppearance:B,shouldGracefullyDegrade:M,setShouldGracefullyDegrade:I}},ht.createElement(va,{theme:B.theme},n,ht.createElement(ai,null))))};import Pp from"react";import pe,{useEffect as _n,useState as Wn}from"react";import De,{useState as Qa}from"react";import St from"styled-components";import ko from"react";import xt from"react";import di from"styled-components";var pi=di.span`
|
|
533
533
|
font-weight: 400;
|
|
534
534
|
font-size: 15px;
|
|
535
535
|
line-height: 20px;
|
|
@@ -546,24 +546,24 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
546
546
|
padding-bottom: 20px;
|
|
547
547
|
border-top: 1px solid ${e=>e.theme.colorBorder};
|
|
548
548
|
width: 100%;
|
|
549
|
-
`,
|
|
549
|
+
`,To=({label:e,value:t,labelStyle:o={},labelPosition:r="right",style:n,primaryColor:i="#000000",checkBoxType:s="square",appearance:p})=>xt.createElement(xt.Fragment,null,xt.createElement(Ia,{className:l("checklistStepsContainer",p),appearance:p,style:{...n}},r==="left"&&e&&xt.createElement(pi,{className:l("checklistStepLabel",p),style:o},e),xt.createElement(ft,{appearance:p,value:t,type:s,primaryColor:i}),r==="right"&&e&&xt.createElement(pi,{className:l("checklistStepLabel",p),style:o},e)),xt.createElement(ie,{appearance:p}));import{motion as Ba}from"framer-motion";import Jt from"styled-components";var ci=Jt.div`
|
|
550
550
|
font-weight: 700;
|
|
551
551
|
font-size: 18px;
|
|
552
552
|
line-height: 22px;
|
|
553
|
-
`,mi=
|
|
553
|
+
`,mi=Jt.p`
|
|
554
554
|
font-weight: 700;
|
|
555
555
|
font-size: 18px;
|
|
556
556
|
line-height: 22px;
|
|
557
557
|
margin: 20px 0px 0px 0px;
|
|
558
558
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
559
|
-
`,ui=
|
|
559
|
+
`,ui=Jt.p`
|
|
560
560
|
font-weight: 400;
|
|
561
561
|
font-size: 15px;
|
|
562
562
|
line-height: 28px;
|
|
563
563
|
max-width: 540px;
|
|
564
564
|
margin: 8px 0px 0px 0px;
|
|
565
565
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
566
|
-
`,
|
|
566
|
+
`,Fo=Jt.div`
|
|
567
567
|
width: 4px;
|
|
568
568
|
position: absolute;
|
|
569
569
|
left: 0;
|
|
@@ -571,10 +571,10 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
571
571
|
height: 80%;
|
|
572
572
|
border-top-right-radius: 8px;
|
|
573
573
|
border-bottom-right-radius: 8px;
|
|
574
|
-
`,fi=
|
|
574
|
+
`,fi=Jt.div`
|
|
575
575
|
flex-direction: row;
|
|
576
576
|
justify-content: flex-start;
|
|
577
|
-
`;var gi=({data:e,index:t,isSelected:o,primaryColor:
|
|
577
|
+
`;var gi=({data:e,index:t,isSelected:o,primaryColor:r,style:n,onClick:i,appearance:s})=>{var p,d;return ko.createElement("div",{style:{position:"relative",paddingLeft:"20px"},onClick:()=>{i()}},o&&ko.createElement(Fo,{className:l("checklistStepItemSelectedIndicator",s),as:Ba.div,layoutId:"checklis-step-selected",style:{backgroundColor:((p=s==null?void 0:s.theme)==null?void 0:p.colorPrimary)??r}}),ko.createElement(fi,{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)??r,appearance:s})))};import Ct from"react";import{motion as Na}from"framer-motion";import Jo from"styled-components";var La={backgroundColor:"#E6E6E6"},Oa=Jo.div`
|
|
578
578
|
display: flex;
|
|
579
579
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
580
580
|
justify-content: flex-start;
|
|
@@ -593,11 +593,11 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
593
593
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
594
594
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
595
595
|
${e=>ct(e)}
|
|
596
|
-
`,Ma={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},Ua={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},_e=({count:e,total:t,fillColor:o,bgColor:
|
|
596
|
+
`,Ma={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},Ua={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},_e=({count:e,total:t,fillColor:o,bgColor:r=La.backgroundColor,display:n="count",textLocation:i="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`),i==="top"&&(u="0px"),Ct.createElement(Oa,{className:l("progressBarContainer",d),textLocation:i,styleOverrides:s},Ct.createElement($a,{className:l("progressBarStepText",d),style:{...p,fontSize:n==="compact"?12:15,fontWeight:n==="compact"?400:500},appearance:d,padding:u,textLocation:i},w),Ct.createElement(Da,{textLocation:i,className:l("progressBar",d)},Ct.createElement(Na.div,{style:{...Ua,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:{...Ma,height:f,backgroundColor:((S=d==null?void 0:d.theme)==null?void 0:S.colorSecondary)??r}})))};import Zt from"react";import _a from"styled-components";import vo from"react";import Po from"react";var Bt=({stepData:e,appearance:t})=>Po.createElement(Po.Fragment,null,Po.createElement(mi,{appearance:t,className:l("checklistStepTitle",t),dangerouslySetInnerHTML:me(e.title)}),Po.createElement(ui,{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()},r=()=>{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:r,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(Bt,{stepData:e,appearance:t}),vo.createElement(Nt,{stepData:e,appearance:t}));import hi from"react";function xi(e){if(e.videoUri.includes("youtube")){let t=e.videoUri.split("v=")[1],o=t.indexOf("&");return o!==-1&&(t=t.substring(0,o)),hi.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 hi.createElement("video",{width:"480",height:"260",controls:!0,src:e.videoUri})}var Qo="default",Wa=_a.img`
|
|
597
597
|
border-radius: 4px;
|
|
598
598
|
max-height: 260px;
|
|
599
599
|
min-height: 200px;
|
|
600
|
-
`,Ci=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return
|
|
600
|
+
`,Ci=({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(Wa,{className:l("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Zt.createElement(xi,{videoUri:e.videoUri,appearance:t}):null,Zt.createElement(Lt,{stepData:e,appearance:t}))};import Ae,{useRef as za,useState as Ha}from"react";import Ot from"styled-components";var Si=Ot.div`
|
|
601
601
|
display: block;
|
|
602
602
|
`,ja=Ot.div`
|
|
603
603
|
display: flex;
|
|
@@ -642,9 +642,9 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
642
642
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
643
643
|
border-radius: 50%;
|
|
644
644
|
}
|
|
645
|
-
`,yi="videoCarousel",bi=({stepData:e,appearance:t})=>{var
|
|
645
|
+
`,yi="videoCarousel",bi=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.videos))return Ae.createElement(Si,null,Ae.createElement(Lt,{stepData:e,appearance:t}));function o({video:i}){let s=za(),[p,d]=Ha(!1);return Ae.createElement(Ga,null,!p&&Ae.createElement(Ka,{onClick:()=>{d(!0),s.current.play()},appearance:t},Ae.createElement(Co,null)),Ae.createElement(Va,{controls:p,ref:s,play:p,src:i.uri}),Ae.createElement(qa,null,i.title))}let r=e.props;return r.videos?Ae.createElement(Si,null,Ae.createElement(Bt,{stepData:e,appearance:t}),Ae.createElement(ja,null,r.videos.map((i,s)=>Ae.createElement("span",{key:`${i.uri}-${s}`},Ae.createElement(o,{video:i})))),Ae.createElement(Nt,{stepData:e,appearance:t})):null};import Ye from"react";import Eo from"styled-components";var wi=Eo.div`
|
|
646
646
|
display: block;
|
|
647
|
-
`,Ya=
|
|
647
|
+
`,Ya=Eo.pre`
|
|
648
648
|
display: block;
|
|
649
649
|
background-color: #2a2a2a;
|
|
650
650
|
color: #f8f8f8;
|
|
@@ -660,14 +660,14 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
660
660
|
white-space: -o-pre-wrap; /* Opera 7 */
|
|
661
661
|
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
|
662
662
|
margin-bottom: 24px;
|
|
663
|
-
`,Xa=
|
|
663
|
+
`,Xa=Eo.div`
|
|
664
664
|
font-size: 15px;
|
|
665
665
|
line-height: 20px;
|
|
666
666
|
margin-bottom: 12px;
|
|
667
667
|
margin-top: 12px;
|
|
668
|
-
`,Ja=
|
|
668
|
+
`,Ja=Eo.div`
|
|
669
669
|
margin-top: 24px;
|
|
670
|
-
`,Ti="codeSnippet",Fi=({stepData:e,appearance:t})=>{var
|
|
670
|
+
`,Ti="codeSnippet",Fi=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.codeSnippets))return Ye.createElement(wi,null,Ye.createElement(Lt,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?Ye.createElement(wi,null,Ye.createElement(Bt,{stepData:e,appearance:t}),Ye.createElement(Ja,null,o.codeSnippets.map((n,i)=>Ye.createElement("div",{key:i},n.title?Ye.createElement(Xa,null,n.title):null,n.code?Ye.createElement(Ya,null,n.code):null))),Ye.createElement(Nt,{stepData:e,appearance:t})):null};var Za=St.div`
|
|
671
671
|
display: flex;
|
|
672
672
|
flex-direction: row;
|
|
673
673
|
min-width: ${e=>e.type!="modal"?"1000px":"100%"};
|
|
@@ -698,7 +698,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
698
698
|
`,rp=St.div`
|
|
699
699
|
flex: 2;
|
|
700
700
|
padding: 2rem;
|
|
701
|
-
`,ip=({title:e,subtitle:t,steps:o=[],style:
|
|
701
|
+
`,ip=({title:e,subtitle:t,steps:o=[],style:r={},selectedStep:n,setSelectedStep:i,className:s="",customStepTypes:p=new Map,appearance:d,type:a})=>{let{mergeAppearanceWithDefault:f}=Q();d=f(d);let u={...{[Qo]:Ci,[yi]:bi,[Ti]:Fi},...p},[w,T]=Qa(0),S=n??w,h=i??T,E=o.filter(A=>A.complete===!0).length,P=()=>{var A;return!((A=o[S])!=null&&A.type)||!u[o[S].type]?u[Qo]({stepData:o[S],appearance:d}):u[o[S].type]({stepData:o[S],appearance:d})};return De.createElement(Za,{type:a,style:r,className:s,appearance:d},De.createElement(ki,{style:{flex:1}},De.createElement(ki,{style:{padding:"30px 0px 30px 30px",borderBottom:"none"}},De.createElement(Ra,{className:l("checklistTitle",d),appearance:d},e),De.createElement(ep,{className:l("checklistSubtitle",d),appearance:d},t),De.createElement(_e,{total:o.length,count:E,fillColor:d.theme.colorPrimary,style:{marginTop:"24px"},appearance:d})),De.createElement(tp,{className:l("checklistStepsContainer",d)},o.map((A,y)=>De.createElement(gi,{data:A,index:y,key:y,listLength:o.length,isSelected:y===S,primaryColor:d.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{h(y)}})))),De.createElement(op,{appearance:d,className:l("checklistDivider",d)}),De.createElement(rp,null,De.createElement(P,null)))},Zo=ip;import N,{useState as dp}from"react";import Pi from"react";import np from"styled-components";var sp=np.svg`
|
|
702
702
|
transition: 'transform 0.35s ease-in-out';
|
|
703
703
|
`,Dt=({color:e="#323232",style:t,className:o})=>Pi.createElement(sp,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},Pi.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as cp}from"framer-motion";import ue from"styled-components";var Ro={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},vi=ue.div`
|
|
704
704
|
max-height: 350px;
|
|
@@ -913,7 +913,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
913
913
|
line-height: 14px;
|
|
914
914
|
font-weight: 400;
|
|
915
915
|
cursor: pointer;
|
|
916
|
-
`;var pp=({steps:e,style:t,title:o,primaryColor:
|
|
916
|
+
`;var pp=({steps:e,style:t,title:o,primaryColor:r,appearance:n,onButtonClick:i})=>{let{primaryCTAClickSideEffects:s}=ne();return Je.createElement(qi,{style:t,className:l("guideContainer",n)},Je.createElement(Yi,{className:l("guideTitle",n)},o),Je.createElement(Ki,{className:l("guideItemContainer",n)},e.map((p,d)=>Je.createElement(Xi,{key:`guide-${p.id??d}`,as:ap.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:l("guideItem",n)},p.icon&&Je.createElement(Ji,{className:l("guideIcon",n)},Je.createElement(Qi,null,p.icon)),Je.createElement(Zi,{className:l("guideItemTitle",n),dangerouslySetInnerHTML:me(p.title)}),Je.createElement(Ri,{className:l("guideItemSubtitle",n),dangerouslySetInnerHTML:me(p.subtitle)}),Je.createElement(en,{className:l("guideItemLink",n),color:r,onClick:()=>{p.primaryButtonUri&&s(p),i&&i(p)}},p.primaryButtonTitle)))))},Rt=pp;var mp=({steps:e,title:t,subtitle:o,stepsTitle:r,visible:n,onClose:i,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:a,guideData:f,guideTitle:c,onGuideButtonClick:u})=>{let w=({stepData:m,handleSecondaryCTAClick:x,handleCTAClick:F})=>m?N.createElement($i,{className:l("checklistStepContainer",a),"data-testid":"checklistStepContainer"},N.createElement(Mi,{appearance:a,className:l("checklistStepTitle",a),dangerouslySetInnerHTML:me(m.title)}),N.createElement(Ui,{appearance:a,className:l("checklistStepSubtitle",a),dangerouslySetInnerHTML:me(m.subtitle)}),N.createElement(_i,{className:l("checklistCTAContainer",a)},m.secondaryButtonTitle&&N.createElement(ee,{title:m.secondaryButtonTitle,onClick:x,appearance:a,secondary:!0}),N.createElement(ee,{title:m.primaryButtonTitle,onClick:F,appearance:a}))):N.createElement(N.Fragment,null),S={...{default:m=>{var U;if((U=e[P])!=null&&U.StepContent){let M=e[P].StepContent;return N.createElement("div",null,M)}let x=e[P];return N.createElement(w,{stepData:m,handleCTAClick:()=>{x.handlePrimaryButtonClick&&x.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{x.handleSecondaryButtonClick&&x.handleSecondaryButtonClick()}})}},...d},[h,E]=dp(0),P=s??h,A=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}):N.createElement(N.Fragment,null)},C=e.filter(m=>m.complete).length;return n?(a.theme.modalContainer||(a.theme.borderRadius&&(Ro.borderRadius=a.theme.borderRadius+"px"),a.theme.modalContainer=Ro),N.createElement(Re,{onClose:i,visible:n,appearance:a},N.createElement(Gi,null,N.createElement(Ei,null,N.createElement(Ai,{appearance:a,className:l("checklistTitle",a)},t),N.createElement(Ii,{appearance:a,className:l("checklistSubtitle",a)},o)),N.createElement(vi,null,e&&e.length>0&&N.createElement(Bi,{className:l("stepsContainer",a)},N.createElement(Ni,null,N.createElement("div",{style:{flex:3}},N.createElement(Li,{className:l("stepsTitle",a)},r)),N.createElement(ji,null,N.createElement(_e,{fillColor:a.theme.colorPrimary,style:{width:"100%"},count:C,total:e.length,appearance:a}))),N.createElement(Oi,null,N.createElement(Di,{className:l("checklistStepListContainer",a),appearance:a},e.map((m,x)=>{let F=P===x;return N.createElement(Wi,{selected:F,className:l(`checklistStepListItem${F?"Selected":""}`,a),key:`checklist-guide-step-${m.id??x}`,disabled:m.blocked,onClick:()=>{m.blocked||A(x)},title:m.blocked?"Finish remaining steps to continue":void 0},F&&N.createElement(Fo,{className:l("checklistStepItemSelectedIndicator",a),as:cp.div,layoutId:"checklist-step-selected",style:{backgroundColor:a.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),N.createElement(zi,{selected:F,className:l(`checklistStepListStepName${F?"Selected":""}`,a)},m.stepName),N.createElement(Hi,null,N.createElement(ft,{value:m.complete,type:"round",primaryColor:a.theme.colorPrimary,progress:m.progress,appearance:a}),N.createElement(Vi,null,N.createElement(Dt,{style:{marginLeft:"10px"},color:a.theme.colorBackgroundSecondary}))))})),N.createElement(y,null))),f&&f.length>0&&N.createElement(Rt,{steps:f,title:c,primaryColor:a.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:a,onButtonClick:m=>(u&&u(m),!0)}))))):N.createElement(N.Fragment,null)},er=mp;import{useEffect as up,useState as fp}from"react";var tn=()=>{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,r]=fp(t),n=null,i=()=>{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",i),[d,f.matches]}));r(p)};return up(()=>{s()},[]),o};import Pe,{useEffect as xn,useState as xp}from"react";import fe from"react";import{AnimatePresence as gp,motion as hp}from"framer-motion";import Qe from"styled-components";var on=Qe.div`
|
|
917
917
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
918
918
|
border: 1px solid;
|
|
919
919
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -950,7 +950,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
950
950
|
:hover {
|
|
951
951
|
opacity: 0.8;
|
|
952
952
|
}
|
|
953
|
-
`,
|
|
953
|
+
`,zh=Qe.div``,pn=Qe.p`
|
|
954
954
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
955
955
|
font-weight: 400;
|
|
956
956
|
font-size: 14px;
|
|
@@ -960,7 +960,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
960
960
|
flex-direction: row;
|
|
961
961
|
justify-content: flex-start;
|
|
962
962
|
align-items: center;
|
|
963
|
-
`;var cn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:
|
|
963
|
+
`;var cn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:r,onSecondaryButtonClick:n,appearance:i,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(rn,{className:l("stepMediaContainer",i)},e.imageUri?fe.createElement(nn,{className:l("stepImage",i),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?fe.createElement(Et,{appearance:i,videoUri:e.videoUri}):null):null,fe.createElement(pn,{className:l("stepSubtitle",i),appearance:i,dangerouslySetInnerHTML:me(e.subtitle)}),fe.createElement(xo,{className:l("checklistCTAContainer",i)},e.secondaryButtonTitle?fe.createElement(ee,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>n(),appearance:i}):null,fe.createElement(ee,{title:e.primaryButtonTitle??"Continue",onClick:()=>r(),appearance:i})))}function a(){if(!s)return null;let u=s[e.type];return u?u(e,i):null}return fe.createElement(on,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:l("checklistStepContainer",i),appearance:i},fe.createElement(sn,{className:l("stepHeader",i)},fe.createElement(dn,null,fe.createElement(To,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(f=i==null?void 0:i.theme)==null?void 0:f.colorPrimary,appearance:i}),fe.createElement(ln,{appearance:i,className:l("stepTitle",i),dangerouslySetInnerHTML:me(e.title)})),fe.createElement(an,{className:l("stepChevronContainer",i),onClick:()=>o()},fe.createElement(Dt,{style:{...p,transition:"transform 0.1s ease-in-out"},color:(c=i==null?void 0:i.theme)==null?void 0:c.colorTextSecondary}))),fe.createElement(gp,null,!t&&fe.createElement(hp.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 $t from"styled-components";var tx=$t.div`
|
|
964
964
|
background: #ffffff;
|
|
965
965
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
966
966
|
border-radius: 6px;
|
|
@@ -1000,7 +1000,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1000
1000
|
justify-content: space-between;
|
|
1001
1001
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1002
1002
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
1003
|
-
`;var Cp=({title:e,subtitle:t,steps:o,onClose:
|
|
1003
|
+
`;var Cp=({title:e,subtitle:t,steps:o,onClose:r,visible:n,onCompleteStep:i,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 h=o.filter(m=>m.complete).length,[E,P]=xp(Array(o.length).fill(!0));xn(()=>{let m=[...E];if(s){for(let x=0;x<o.length;x++)if(!o[x].complete){m[x]=!1;break}P(m)}},[]),xn(()=>{A(f)},[f]);let A=m=>{let x=[...E];if(p)for(let F=0;F<E.length;++F)F!==m&&(x[F]=!0);x[m]=!x[m],P(x)};if(!n&&w=="modal")return Pe.createElement(Pe.Fragment,null);let y=Pe.createElement(Pe.Fragment,null,Pe.createElement(mn,null,Pe.createElement(un,{appearance:u,className:l("checklistTitle",u),dangerouslySetInnerHTML:me(e)}),Pe.createElement(fn,{appearance:u,className:l("checklistSubtitle",u),dangerouslySetInnerHTML:me(t)})),Pe.createElement(_e,{display:"percent",count:h,total:o.length,fillColor:a,style:{margin:"14px 0px 8px 0px"},appearance:u})),C=Pe.createElement(gn,{className:ye(l("checklistContainer",u),T)},o.map((m,x)=>{let F=E[x];return Pe.createElement(cn,{appearance:u,stepData:m,collapsed:F,key:`modal-checklist-${m.id??x}`,onClick:()=>{if(f===x){A(x);return}c(x)},onPrimaryButtonClick:()=>{i&&i(x,m),m.handlePrimaryButtonClick&&m.handlePrimaryButtonClick(),d&&!m.completionCriteria&&x<E.length-1&&E[x+1]&&c(x+1)},onSecondaryButtonClick:()=>{m.handleSecondaryButtonClick&&m.handleSecondaryButtonClick()},customStepTypes:S})}));return w==="inline"?Pe.createElement(hn,{appearance:u,className:ye(l("checklistInlineContainer",u),T)},y,C):Pe.createElement(Pe.Fragment,null,Pe.createElement(Re,{onClose:r,visible:n,appearance:u,style:{maxWidth:"600px"},headerContent:y},C))},tr=Cp;import ae,{useEffect as or,useRef as Fp,useState as bt}from"react";import yt from"react";import le,{css as Cn,keyframes as Sn}from"styled-components";var yn=Cn`
|
|
1004
1004
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1005
1005
|
`,Sp=Cn`
|
|
1006
1006
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
@@ -1135,34 +1135,34 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1135
1135
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1136
1136
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1137
1137
|
`}
|
|
1138
|
-
`;var Dn=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:
|
|
1138
|
+
`;var Dn=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:r}=Q(),{primaryCTAClickSideEffects:n}=ne(),{theme:i,styleOverrides:s}=r(o),{imageUri:p=null,subtitle:d=null,title:a=null,complete:f=!1,blocked:c=!1}=e,u=()=>{n(e)};return yt.createElement(Pn,{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(vn,{className:l("carouselCardImage",o),src:p,alt:a,style:{opacity:f||c?.4:1}}),f&&yt.createElement(Bn,{className:l("carouselCompletedPill",o)},yt.createElement(On,{style:{color:"#108E0B"}},"Complete"))),a&&yt.createElement(Ln,{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 $n=({numberOfStepsCompleted:e,numberOfSteps:t,appearance:o})=>{let r=t>0?e/t:0,n=200,i=Math.min(n,Math.max(10,Math.round(n*r)));return eo.createElement(An,{className:l("carouselProgressBar",o)},eo.createElement(In,{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:i,height:10,fill:"currentColor"})))};var kp=()=>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"})),Mn=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[r,n]=bt(!1),[i,s]=bt(!1);or(()=>{t===!0&&r===!1?n(!0):t===!1&&r===!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 r?ae.createElement(Tn,{style:d,reversed:i,onAnimationEnd:i?p:null},ae.createElement(Fn,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},ae.createElement(kp,null))):null},Un=({flowId:e,appearance:t,customVariables:o,className:r})=>{let n=Fp(null),[i,s]=bt(!1),[p,d]=bt(!1),[a,f]=bt(null),[c,u]=bt([]),[w,T]=bt(0),{getFlowMetadata:S,getFlowSteps:h,getNumberOfStepsCompleted:E,updateCustomVariables:P,getFlowStatus:A,isLoading:y,targetingLogicShouldHideFlow:C,getFlow:m}=J();or(()=>{P(o)},[o,y]),or(()=>{if(y)return;let I=S(e),j=E(e),B=h(e);f(I),I.data!==null&&(u(B.sort(($,re)=>Number($.complete)-Number(re.complete))),d(B.length>3),T(j))},[y]);let x=[];for(let I=0;I<c.length;I+=3)x.push(c.slice(I,I+3));let F=I=>{let j=I.target,B=j.scrollWidth-j.clientWidth,$=Math.ceil(j.scrollLeft);$>0&&i===!1&&s(!0),$===0&&i===!0&&s(!1),$<B&&p===!1&&d(!0),$===B&&p===!0&&d(!1)},L=(I=!0)=>{let j=I?1:-1;n.current!==null&&n.current.scrollBy({left:n.current.clientWidth*j,behavior:"smooth"})},U=null,M=I=>{U!==null?clearTimeout(U):F(I),U=setTimeout(()=>{F(I)},16)};return y?null:ae.createElement(En,{className:ye(l("carouselContainer",t),r)},ae.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:20}},ae.createElement("div",null,ae.createElement(Nn,{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($n,{numberOfStepsCompleted:w,numberOfSteps:c.length})),ae.createElement("div",{style:{position:"relative"}},ae.createElement(Mn,{show:i,onClick:()=>L(!1)}),ae.createElement(Mn,{side:"right",show:p,onClick:L}),ae.createElement(bn,{ref:n,onScroll:M},x.map((I,j)=>ae.createElement(wn,{key:j,style:{flex:`0 0 calc(100% - ${c.length>3?36:0}px)`}},I.map((B,$)=>ae.createElement(Dn,{key:$,stepData:B,style:{flex:c.length>3?"0 1 calc(33% - 16px * 2 / 3)":1},appearance:t})))))))};var rr=({flowId:e,title:t,subtitle:o,style:r,initialSelectedStep:n,className:i,type:s="inline",onDismiss:p,visible:d,customVariables:a,onStepCompletion:f,onButtonClick:c,appearance:u,hideOnFlowCompletion:w,setVisible:T,customStepTypes:S,checklistStyle:h="default",autoExpandFirstIncompleteStep:E,autoExpandNextStep:P,...A})=>{let{getFlow:y,getFlowSteps:C,markStepCompleted:m,getStepStatus:x,getNumberOfStepsCompleted:F,isLoading:L,targetingLogicShouldHideFlow:U,updateCustomVariables:M,getFlowMetadata:I,isStepBlocked:j,getFlowStatus:B,hasActiveFullPageFlow:$,setHasActiveFullPageFlow:re}=J(),{primaryCTAClickSideEffects:R,secondaryCTAClickSideEffects:_}=ne(),{getOpenFlowState:he,setOpenFlowState:Fe}=ve(),[W,se]=Wn(n||0),[G,O]=Wn(!1),te=d===void 0?he(e):d,xe=s==="modal",{mergeAppearanceWithDefault:Ce}=Q(),{isLarge:V}=tn();if(u=Ce(u),_n(()=>{M(a)},[a,L]),_n(()=>{d!==void 0&&(xe&&d===!0?re(!0):xe&&d===!1&&re(!1))},[d,T,$]),L)return null;let de=y(e);if(!de||U(de))return null;let oe=C(e);if(!oe||w===!0&&B(e)===X)return null;let K=I(e);if(K!=null&&K.title&&(t=K.title),K!=null&&K.subtitle&&(o=K.subtitle),!G&&n===void 0&&F(e)>0){let z=Math.min(F(e),oe.length-1);se(z),O(!0)}function je(){if(W+1>=oe.length){xe&&Fe(e,!1);return}j(e,oe[W+1].id)||se(W+1)}function Ge(z,at,io){let dr=W+1<oe.length?oe[W+1]:null;c&&c(z,W,at,dr)===!0&&xe&&g(),f&&f(z,io,dr),!f&&!c&&(z.primaryButtonUri||z.secondaryButtonUri)&&xe&&g()}function Y(){return oe.map((z,at)=>({...z,handleSecondaryButtonClick:()=>{je(),_(z),z.skippable===!0&&m(e,z.id,{skipped:!0}),Ge(z,"secondary",at)},handlePrimaryButtonClick:()=>{(!z.completionCriteria&&(z.autoMarkCompleted||z.autoMarkCompleted===void 0)||z.completionCriteria&&z.autoMarkCompleted===!0)&&(m(e,z.id),je()),Ge(z,"primary",at),R(z),x(e,z.id)===Oe&&je()}}))}function Se(){return pe.createElement(ie,{appearance:u})}let lt={steps:Y(),title:t,subtitle:o,primaryColor:u.theme.colorPrimary,appearance:u,customStepTypes:S,type:s,className:i,autoExpandFirstIncompleteStep:E,autoExpandNextStep:P};function g(){Fe(e,!1),p&&p(),T&&T(!1)}function b(){return pe.createElement(pe.Fragment,null,pe.createElement(Se,null),pe.createElement(Un,{flowId:e,appearance:u,customVariables:a,className:i}))}function v(){return pe.createElement(pe.Fragment,null,pe.createElement(Se,null),pe.createElement(tr,{visible:te,onClose:()=>{g()},selectedStep:W,setSelectedStep:se,autoExpandNextStep:!0,appearance:u,...lt}))}function H(){if(!V)return v();let z=A.guideFlowId,at;return z&&y(z)&&(at=C(z)),pe.createElement(pe.Fragment,null,pe.createElement(Se,null),pe.createElement(er,{visible:te,stepsTitle:K.stepsTitle?K.stepsTitle:"Your quick start guide",onClose:()=>{g()},selectedStep:W,setSelectedStep:se,guideData:at,guideTitle:A.guideTitle??"Guide",appearance:u,title:t,subtitle:o,onGuideButtonClick:io=>{Ge(io,"link",0)},customStepTypes:S,...lt}))}function ce(){if(!V)return v();let z=pe.createElement(Zo,{flowId:e,style:r,selectedStep:W,setSelectedStep:se,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),z):pe.createElement(pe.Fragment,null,pe.createElement(Se,null),z)}switch(h){case"condensed":return v();case"with-guide":return H();case"default":return ce();case"carousel":return b();default:return ce()}};var vp=e=>Pp.createElement(rr,{type:"inline",...e});import nt,{useEffect as Ap}from"react";import ze from"react";import Ao from"styled-components";var zn=Ao.div`
|
|
1139
1139
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1140
1140
|
border-radius: 8px;
|
|
1141
1141
|
padding: 6px 10px 6px 10px;
|
|
1142
1142
|
min-width: 160px;
|
|
1143
1143
|
cursor: pointer;
|
|
1144
1144
|
background-color: ${e=>e.appearance.theme.colorBackground}};
|
|
1145
|
-
`,Hn=
|
|
1145
|
+
`,Hn=Ao.div`
|
|
1146
1146
|
display: flex;
|
|
1147
1147
|
flex-direction: row;
|
|
1148
1148
|
justify-content: space-between;
|
|
1149
1149
|
align-items: center;
|
|
1150
1150
|
margin-bottom: 2px;
|
|
1151
1151
|
flex-grow: 2;
|
|
1152
|
-
`,jn=
|
|
1152
|
+
`,jn=Ao.div`
|
|
1153
1153
|
text-overflow: ellipsis;
|
|
1154
1154
|
font-weight: 600;
|
|
1155
1155
|
font-size: 12px;
|
|
1156
1156
|
line-height: 15px;
|
|
1157
1157
|
text-align: ${e=>e.type==="condensed"?"left":"right"};
|
|
1158
1158
|
color: ${e=>e.appearance.theme.colorPrimary};
|
|
1159
|
-
`,Gn=
|
|
1159
|
+
`,Gn=Ao.div`
|
|
1160
1160
|
width: 20px;
|
|
1161
1161
|
margin-right: 8px;
|
|
1162
1162
|
display: flex;
|
|
1163
1163
|
height: 100%;
|
|
1164
1164
|
align-items: center;
|
|
1165
|
-
`;import{motion as Ep}from"framer-motion";var Vn=({title:e,count:t,total:o,onClick:
|
|
1165
|
+
`;import{motion as Ep}from"framer-motion";var Vn=({title:e,count:t,total:o,onClick:r,style:n={},className:i,appearance:s,type:p="default"})=>ze.createElement(ze.Fragment,null,ze.createElement(ie,{appearance:s}),ze.createElement(zn,{as:Ep.div,whileHover:{opacity:.9},whileTap:{scale:.98},onClick:()=>r!==void 0&&r(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...n},className:ye(i??"",l("progressRingContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&ze.createElement(Gn,{className:l("progressRingContainer",s)},ze.createElement(It,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),ze.createElement(Hn,{type:p,className:l("badgeTitleContainer",s)},ze.createElement(jn,{type:p,appearance:s,className:l("badgeTitle",s)},e),r!==void 0&&ze.createElement(Dt,{className:l("badgeChevron",s),color:s.theme.colorPrimary})),p=="default"&&o&&o!==0&&ze.createElement(_e,{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 qn=to.div`
|
|
1166
1166
|
display: flex;
|
|
1167
1167
|
flex-direction: row;
|
|
1168
1168
|
width: 100%;
|
|
@@ -1173,25 +1173,25 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1173
1173
|
border-width: 1px;
|
|
1174
1174
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1175
1175
|
border-radius: 12px;
|
|
1176
|
-
`,Kn=
|
|
1176
|
+
`,Kn=to.div`
|
|
1177
1177
|
${e=>k(e)} {
|
|
1178
1178
|
display: flex;
|
|
1179
1179
|
justify-content: center;
|
|
1180
1180
|
align-items: center;
|
|
1181
1181
|
margin-right: 16px;
|
|
1182
1182
|
}
|
|
1183
|
-
`,Yn=
|
|
1183
|
+
`,Yn=to.div`
|
|
1184
1184
|
display: flex;
|
|
1185
1185
|
flex-direction: column;
|
|
1186
1186
|
flex: 1;
|
|
1187
1187
|
margin-top: 0;
|
|
1188
|
-
`,Xn=
|
|
1188
|
+
`,Xn=to.div`
|
|
1189
1189
|
display: flex;
|
|
1190
1190
|
flex-direction: column;
|
|
1191
1191
|
justify-content: center;
|
|
1192
1192
|
margin-left: 16px;
|
|
1193
1193
|
min-width: 200px;
|
|
1194
|
-
`,
|
|
1194
|
+
`,xC=to.div`
|
|
1195
1195
|
display: flex;
|
|
1196
1196
|
justify-content: center;
|
|
1197
1197
|
align-items: flex-end;
|
|
@@ -1200,7 +1200,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1200
1200
|
:hover {
|
|
1201
1201
|
opacity: 0.8;
|
|
1202
1202
|
}
|
|
1203
|
-
`;var Jn=({title:e,subtitle:t,icon:o,appearance:
|
|
1203
|
+
`;var Jn=({title:e,subtitle:t,icon:o,appearance:r,count:n,total:i,className:s,style:p})=>it.createElement(it.Fragment,null,it.createElement(qn,{appearance:r,className:ye(l("fullWidthProgressBadgeContainer",r),s??""),style:p},o&&it.createElement(Kn,{className:l("fullWidthProgressBadgeIcon",r)},o),it.createElement(Yn,null,it.createElement(be,{size:"small",appearance:r,title:e,subtitle:t})),it.createElement(Xn,{className:l("fullWidthProgressBadgeProgressContainer",r)},it.createElement(_e,{count:n,total:i,display:"percent",textLocation:"top",fillColor:r.theme.colorPrimary}))));var Ip=({flowId:e,title:t,subtitle:o,icon:r,style:n,onClick:i,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:a,type:f="default"})=>{let{getFlow:c,getFlowSteps:u,getFlowStatus:w,getNumberOfStepsCompleted:T,isLoading:S,targetingLogicShouldHideFlow:h,updateCustomVariables:E}=J(),{mergeAppearanceWithDefault:P}=Q();a=P(a);let{setOpenFlowState:A,getOpenFlowState:y}=ve();if(Ap(()=>{E(p)},[p,S]),S)return null;let C=c(e);if(!C||h(C)||d===!0&&w(e)===X)return null;let m=u(e),x=T(e);return f==="full-width"?nt.createElement(nt.Fragment,null,nt.createElement(ie,{appearance:a}),nt.createElement(Jn,{title:t,subtitle:o,count:x,total:m.length,style:n,className:s,appearance:a,icon:r,onClick:()=>{}})):nt.createElement(nt.Fragment,null,nt.createElement(ie,{appearance:a}),nt.createElement(Vn,{count:x,total:m.length,title:t,style:n,onClick:()=>{A(e,!0),i&&i()},type:f,className:s,appearance:a}))};import Bp from"react";var Np=({flowId:e,style:t,appearance:o,...r})=>{let{getFlow:n,targetingLogicShouldHideFlow:i,getFlowSteps:s}=J(),{mergeAppearanceWithDefault:p}=Q();o=p(o);let d=n(e);if(!d||i(d))return null;let a=s(e);return Bp.createElement(Rt,{steps:a,style:t,appearance:o,...r})};import Ut,{useContext as Gp,useEffect as Vp}from"react";import D,{useEffect as Io,useLayoutEffect as ls,useRef as Mp,useState as oo}from"react";import ro from"styled-components";import{useCallback as Lp,useEffect as Op,useState as Dp}from"react";var ir=(e,t,o,r={x:20,y:20},n)=>{let i=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+r.x+s,y:e.top-r.y+i}:t==="right"?{x:e.left+e.width+r.x+s,y:e.top-r.y+i}:{x:0,y:0}},Qn={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function $p(e){let t=Qn;return e&&(t=e.getBoundingClientRect()),t}function Zn(e,t){let[o,r]=Dp(Qn),n=Lp(()=>{e&&r($p(e))},[e]);return Op(()=>(n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)),[e,t]),o}import st from"styled-components";var Rn=st.div`
|
|
1204
1204
|
${e=>k(e)} {
|
|
1205
1205
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
1206
1206
|
}
|
|
@@ -1266,7 +1266,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1266
1266
|
color: #808080;
|
|
1267
1267
|
}
|
|
1268
1268
|
margin: 0;
|
|
1269
|
-
`;var as=300,ps=100,Up=500,Mt=12,_p=
|
|
1269
|
+
`;var as=300,ps=100,Up=500,Mt=12,_p=ro.div`
|
|
1270
1270
|
width: 100%;
|
|
1271
1271
|
height: 100%;
|
|
1272
1272
|
border-radius: 9999px;
|
|
@@ -1289,25 +1289,25 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1289
1289
|
opacity: 0;
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
1292
|
-
`,Wp=
|
|
1292
|
+
`,Wp=ro.div`
|
|
1293
1293
|
width: ${Mt}px;
|
|
1294
1294
|
height: ${Mt}px;
|
|
1295
1295
|
border-radius: 100px;
|
|
1296
1296
|
background-color: ${e=>e.primaryColor};
|
|
1297
1297
|
z-index: 20;
|
|
1298
1298
|
opacity: 1;
|
|
1299
|
-
`,zp=
|
|
1299
|
+
`,zp=ro.div`
|
|
1300
1300
|
pointer-events: all;
|
|
1301
|
-
`,ds=
|
|
1301
|
+
`,ds=ro.div`
|
|
1302
1302
|
display: flex;
|
|
1303
1303
|
align-content: center;
|
|
1304
1304
|
justify-content: center;
|
|
1305
1305
|
align-items: center;
|
|
1306
1306
|
z-index: ${e=>e.zIndex?e.zIndex:90};
|
|
1307
|
-
`,Hp=
|
|
1307
|
+
`,Hp=ro(ds)`
|
|
1308
1308
|
width: ${Mt+12}px;
|
|
1309
1309
|
height: ${Mt+12}px;
|
|
1310
|
-
`,jp=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:
|
|
1310
|
+
`,jp=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:r="auto",showHighlight:n=!0,primaryColor:i="#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,K,je,Ge;let[h,E]=oo(),[P,A]=oo(new Date),y=Mp(null),[C,m]=oo(document.querySelector(e[a].selector)),x=Zn(C,P),[F,L]=oo(),[U,M]=oo(!w),I=(K=(oe=e[a])==null?void 0:oe.props)!=null&&K.position?e[a].props.position:"absolute",j=((Ge=(je=e[a])==null?void 0:je.props)==null?void 0:Ge.zIndex)??90,B=(h==null?void 0:h.width)??as,$=(h==null?void 0:h.height)??ps;ls(()=>{y.current&&E({width:y.current.clientWidth,height:y.current.clientHeight})},[a,P,I]),Io(()=>{w||M(!0)},[a]);let re=r==="auto"?"right":r,R=ir(x,re,B,s,I),_=x.right+B>(window.innerWidth||document.documentElement.clientWidth),he=x.bottom+ps>(window.innerHeight||document.documentElement.clientHeight);_&&r==="auto"&&(R=ir(x,"left",B,s,I),re="left");let Fe=window.location.pathname.split("/").pop(),W=()=>{let Y=document.querySelector(e[a].selector);F&&F===JSON.stringify(Y==null?void 0:Y.getBoundingClientRect())||(m(Y),A(new Date),Y&&L(JSON.stringify(Y.getBoundingClientRect())))};if(Io(()=>{let Y=new MutationObserver(W);return Y.observe(document.body,{subtree:!0,childList:!0}),()=>Y.disconnect()},[W]),Io(()=>{let Y=new MutationObserver(W);return Y.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>Y.disconnect()},[W]),Io(()=>{let Y=setInterval(()=>{W()},10);return()=>clearInterval(Y)},[W]),ls(()=>{setTimeout(()=>{W()},Up),W()},[a,Fe]),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 se=()=>{let Y=()=>{if(e[a].handlePrimaryButtonClick&&(e[a].handlePrimaryButtonClick(),M(!1),setTimeout(()=>{W()},30)),S===e.length-1)return o()},Se=()=>{e[a].handleSecondaryButtonClick&&(e[a].handleSecondaryButtonClick(),w&&M(!1))};return D.createElement(D.Fragment,null,T&&D.createElement(is,null,D.createElement(ss,{className:l("tooltipStepCounter",c)},a+1," of ",e.length)),D.createElement(ns,{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:Y,withMargin:!1,size:"small"})))},G=()=>D.createElement(D.Fragment,null,u&&D.createElement(es,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:l("tooltipClose",c)},D.createElement(Ee,null)),e[a].imageUri&&D.createElement(ts,{dismissible:u,appearance:c,src:e[a].imageUri,className:l("tooltipImageContainer",c)}),e[a].videoUri&&!e[a].imageUri&&D.createElement(os,{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(rs,{className:l("tooltipFooter",c)},D.createElement(se,null))),te={...{default:Y=>{var Se;if((Se=e[a])!=null&&Se.StepContent){let lt=e[a].StepContent;return D.createElement("div",null,lt)}return D.createElement(G,null)}},...f},xe=()=>{var Y;return e?!((Y=e[a])!=null&&Y.type)||!te[e[a].type]?te.default(e[a]):te[e[a].type]({stepData:e[a],primaryColor:i}):D.createElement(D.Fragment,null)};if(w&&e[a].complete===!0)return null;let Ce={top:(R==null?void 0:R.y)-Mt,left:(re=="left"?x.x+s.x:(R==null?void 0:R.x)-Mt)??0,cursor:w?"pointer":"default",position:I},V=()=>{let Se=Ce.left+(re=="left"?-B:24);return Math.min(Math.max(Se,20),window.innerWidth-B-20)},de=()=>{w&&(A(new Date),M(!U))};return D.createElement(zp,null,D.createElement(Hp,{style:Ce,zIndex:j,className:l("tourHighlightContainer",c)},n&&e[a].showHighlight!==!1&&D.createElement(D.Fragment,null,D.createElement(Wp,{style:{position:I},onClick:de,primaryColor:c.theme.colorPrimary}),D.createElement(_p,{style:{position:"absolute"},onClick:de,primaryColor:c.theme.colorPrimary}))),D.createElement(ds,{style:{...Ce,left:V()},zIndex:j+1,className:l("tooltipContainerWrapper",c)},U&&D.createElement(Rn,{ref:y,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:12,...d},appearance:c,className:l("tooltipContainer",c),maxWidth:as,zIndex:j+10},D.createElement(xe,null))))},Bo=jp;import{Portal as qp}from"react-portal";var Kp=({flowId:e,customVariables:t,appearance:o,onStepCompletion:r,onButtonClick:n,showTooltipsSimultaneously:i=!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:h,markStepCompleted:E,markStepStarted:P,markFlowCompleted:A,updateCustomVariables:y,getCurrentStepIndex:C,getStepStatus:m,isStepBlocked:x,getFlowStatus:F,getNumberOfStepsCompleted:L}=J(),{isLoadingUserFlowStateData:U}=Be(),{primaryCTAClickSideEffects:M,secondaryCTAClickSideEffects:I}=ne(),{hasOpenModals:j}=ve(),B=C(e),{openFlowStates:$}=Gp(q),{mergeAppearanceWithDefault:re}=Q();if(o=re(o),Vp(()=>{y(t)},[t,S]),U)return null;let R=w(e);if(!R||h(R)||F(e)==X||j())return null;let _=T(e);if(Object.keys($).length>0){let O=Object.keys($).find(te=>$[te]===!0);if(O!==void 0&&O!==e)return Ut.createElement(Ut.Fragment,null)}async function he(O){if(await E(e,O.id),_.map(te=>m(e,te.id)).every(te=>te===Oe)){await A(e);return}if(!a&&B+1<_.length){if(x(e,_[B+1].id))return;await P(e,_[B+1].id)}}function Fe(O,te,xe){let Ce=B+1<_.length?_[B+1]:null;n&&n(O,B,te,Ce),r&&r(O,xe,Ce)}function W(){return _.map(O=>({...O,handleSecondaryButtonClick:async()=>{I(O),O.skippable===!0&&await E(e,O.id,{skipped:!0}),Fe(O,"secondary",B)},handlePrimaryButtonClick:async()=>{(!O.completionCriteria&&(O.autoMarkCompleted||O.autoMarkCompleted===void 0)||O.completionCriteria&&O.autoMarkCompleted===!0)&&await he(O),Fe(O,"primary",B),M(O)}}))}async function se(O){s&&s(),f==="complete-flow"?await A(e):await E(e,O.id)}function G(){c&&c()}return Ut.createElement(qp,null,Ut.createElement(ie,{appearance:o}),i?_.map((O,te)=>Ut.createElement(Bo,{key:O.id,appearance:o,steps:W(),selectedStep:te,showTooltipsSimultaneously:i,dismissible:p,onDismiss:()=>se(O),tooltipPosition:d,showHighlightOnly:a,completedStepsCount:L(e),onComplete:G,...u})):Ut.createElement(Bo,{appearance:o,steps:W(),selectedStep:B,showTooltipsSimultaneously:i,dismissible:p,onDismiss:()=>se(_[B]),tooltipPosition:d,completedStepsCount:L(e),showHighlightOnly:a,onComplete:G,...u}))};import Te,{useEffect as Yp,useRef as Xp,useState as Jp}from"react";import{Portal as Qp}from"react-portal";import wt from"styled-components";var cs=wt.button`
|
|
1311
1311
|
${e=>k(e)} {
|
|
1312
1312
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1313
1313
|
|
|
@@ -1395,7 +1395,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1395
1395
|
font-size: 14px;
|
|
1396
1396
|
|
|
1397
1397
|
padding: 8px 12px;
|
|
1398
|
-
`;import{AnimatePresence as ws,motion as Ts}from"framer-motion";import Cs from"react";var Ss=({style:e,className:t})=>Cs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Cs.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 ys from"react";var bs=({style:e,className:t})=>ys.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"},ys.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 Zp=({flowId:e,style:t,onStepCompletion:o,visible:
|
|
1398
|
+
`;import{AnimatePresence as ws,motion as Ts}from"framer-motion";import Cs from"react";var Ss=({style:e,className:t})=>Cs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Cs.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 ys from"react";var bs=({style:e,className:t})=>ys.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"},ys.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 Zp=({flowId:e,style:t,onStepCompletion:o,visible:r=!0,type:n="inline",title:i="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:a,getStepStatus:f,getNumberOfStepsCompleted:c,isLoading:u,targetingLogicShouldHideFlow:w}=J(),{primaryCTAClickSideEffects:T}=ne(),S=Xp(null),[h,E]=Jp(!1),{mergeAppearanceWithDefault:P}=Q();s=P(s),Yp(()=>(document.addEventListener("click",A,!1),()=>{document.removeEventListener("click",A,!1)}),[]);let A=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||!r)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 x(){return h&&Te.createElement(hs,{className:l("floatingWidgetMenu",s),as:Ts.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:n},C.map((F,L)=>Te.createElement(xs,{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(!h)},className:l("supportButton",s)},Te.createElement(us,{className:l("supportIconContainer",s)},Te.createElement(bs,{className:l("supportIcon",s),style:{width:"18px",height:"18px"}})),Te.createElement(ms,{className:l("supportButtonTitle",s)},i)),Te.createElement(ws,null,Te.createElement(x,null))):Te.createElement(Qp,null,Te.createElement(fs,{style:t,ref:S},Te.createElement(ws,null,Te.createElement(x,null)),Te.createElement(gs,{onClick:()=>{E(!h)},as:Ts.button,whileHover:{scale:1.1},className:l("floatingWidgetButton",s)},Te.createElement(Ss,{className:l("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import He,{useEffect as Rp}from"react";import No from"styled-components";var Fs=No.div`
|
|
1399
1399
|
${e=>k(e)} {
|
|
1400
1400
|
display: flex;
|
|
1401
1401
|
flex-direction: column;
|
|
@@ -1410,17 +1410,17 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1410
1410
|
border-radius: 12px;
|
|
1411
1411
|
position: relative;
|
|
1412
1412
|
}
|
|
1413
|
-
`,ks=
|
|
1413
|
+
`,ks=No.div`
|
|
1414
1414
|
display: flex;
|
|
1415
1415
|
flex-direction: column;
|
|
1416
1416
|
flex: 1;
|
|
1417
|
-
`,Ps=
|
|
1417
|
+
`,Ps=No.div`
|
|
1418
1418
|
display: flex;
|
|
1419
1419
|
flex-direction: column;
|
|
1420
1420
|
justify-content: center;
|
|
1421
1421
|
align-items: flex-start;
|
|
1422
1422
|
margin-top: 16px;
|
|
1423
|
-
`,vs=
|
|
1423
|
+
`,vs=No.div`
|
|
1424
1424
|
${e=>k(e)} {
|
|
1425
1425
|
position: absolute;
|
|
1426
1426
|
top: 16px;
|
|
@@ -1431,7 +1431,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1431
1431
|
opacity: 0.8;
|
|
1432
1432
|
}
|
|
1433
1433
|
}
|
|
1434
|
-
`;var ed=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:
|
|
1434
|
+
`;var ed=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:r,appearance:n,className:i,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:a,markStepCompleted:f,isLoading:c,targetingLogicShouldHideFlow:u,updateCustomVariables:w,getFlowSteps:T,getFlowStatus:S,getCurrentStepIndex:h}=J(),{primaryCTAClickSideEffects:E}=ne(),{mergeAppearanceWithDefault:P}=Q();if(n=P(n),Rp(()=>{w(o)},[o,c]),c)return null;let A=d(e);if(!A||u(A)||S(e)===X)return null;let C=T(e)[h(e)];return He.createElement(He.Fragment,null,He.createElement(ie,{appearance:n}),He.createElement(Fs,{appearance:n,className:ye(l("embeddedTipContainer",n),i),style:s},(p===!0||C.dismissible)&&He.createElement(vs,{onClick:async()=>{await a(e),t&&t()},className:l("embeddedTipDismissButton",n)},He.createElement(Ee,null)),He.createElement(ks,null,He.createElement(be,{size:"small",appearance:n,title:C.title,subtitle:C.subtitle})),C.primaryButtonTitle&&He.createElement(Ps,{className:l("embeddedTipCallToActionContainer",n)},He.createElement(ee,{classPrefix:"embeddedTip",title:C.primaryButtonTitle,appearance:n,withMargin:!1,size:"small",type:"inline",onClick:async()=>{C.handlePrimaryButtonClick(),E(C),!(r&&r(C,h(e),"primary")===!1)&&(await f(e,C.id),await a(e))}}))))};import ge,{useEffect as td}from"react";import _t from"styled-components";var Es=_t.div`
|
|
1435
1435
|
// use the :not annotation
|
|
1436
1436
|
${e=>k(e)} {
|
|
1437
1437
|
display: flex;
|
|
@@ -1476,7 +1476,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1476
1476
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1477
1477
|
align-items: flex-end;
|
|
1478
1478
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1479
|
-
`;import Ns from"react";var Ls=({style:e,className:t})=>Ns.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"},Ns.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 od=({flowId:e,title:t,subtitle:o,onDismiss:
|
|
1479
|
+
`;import Ns from"react";var Ls=({style:e,className:t})=>Ns.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"},Ns.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 od=({flowId:e,title:t,subtitle:o,onDismiss:r,customVariables:n,onButtonClick:i,appearance:s,type:p="full-width",icon:d})=>{let{getFlow:a,markFlowCompleted:f,isLoading:c,targetingLogicShouldHideFlow:u,updateCustomVariables:w,getFlowMetadata:T,getFlowStatus:S,getFlowSteps:h,getCurrentStepIndex:E}=J(),{primaryCTAClickSideEffects:P}=ne(),{mergeAppearanceWithDefault:A}=Q();if(s=A(s),td(()=>{w(n)},[n,c]),c)return null;let y=a(e);if(!y||u(y)||S(e)===X)return null;let C=h(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),ge.createElement(ge.Fragment,null,ge.createElement(ie,{appearance:s}),ge.createElement(Es,{type:p,appearance:s,className:l("bannerContainer",s)},p!="square"&&ge.createElement(As,{className:l("bannerIconContainer",s)},d||ge.createElement(Ls,null)),p==="square"&&m.dismissible&&ge.createElement(sr,{type:p,className:l("bannerDismissButtonContainer",s)},ge.createElement(nr,{type:p,onClick:async()=>{await f(e),r&&r()},className:l("bannerDismissButton",s)},ge.createElement(Ee,null))),ge.createElement(Is,{type:p},ge.createElement(be,{appearance:s,title:t,subtitle:o})),ge.createElement(Bs,{type:p,className:l("bannerCallToActionContainer",s)},ge.createElement(ee,{title:(m==null?void 0:m.primaryButtonTitle)??"Get started",appearance:s,onClick:()=>{P(m),i&&i(m,0,"primary")}})),p!=="square"&&m.dismissible&&ge.createElement(sr,{type:p,className:l("bannerDismissButtonContainer",s)},ge.createElement(nr,{type:p,onClick:async()=>{await f(e),r&&r()},className:l("bannerDismissButton",s)},ge.createElement(Ee,null)))))};import Z,{useEffect as rd}from"react";import{Portal as id}from"react-portal";import Ze from"styled-components";var Os=Ze.div`
|
|
1480
1480
|
${e=>k(e)} {
|
|
1481
1481
|
display: flex;
|
|
1482
1482
|
flex-direction: column;
|
|
@@ -1535,7 +1535,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1535
1535
|
display: flex;
|
|
1536
1536
|
flex-direction: column;
|
|
1537
1537
|
flex: 1;
|
|
1538
|
-
`,
|
|
1538
|
+
`,Ay=Ze.div`
|
|
1539
1539
|
display: flex;
|
|
1540
1540
|
flex-direction: column;
|
|
1541
1541
|
justify-content: center;
|
|
@@ -1563,5 +1563,5 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1563
1563
|
opacity: 0.8;
|
|
1564
1564
|
}
|
|
1565
1565
|
}
|
|
1566
|
-
`;var nd=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:
|
|
1566
|
+
`;var nd=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:r,appearance:n,className:i,style:s})=>{let{getFlow:p,markFlowCompleted:d,markStepCompleted:a,getNumberOfStepsCompleted:f,isLoading:c,targetingLogicShouldHideFlow:u,updateCustomVariables:w,getFlowSteps:T,getFlowStatus:S,getCurrentStepIndex:h}=J(),{primaryCTAClickSideEffects:E}=ne(),{mergeAppearanceWithDefault:P}=Q(),[A,y]=Z.useState(null),[C,m]=Z.useState(""),{hasOpenModals:x,setKeepCompletedFlowOpenDuringSession:F,shouldKeepCompletedFlowOpenDuringSession:L}=ve();if(n=P(n),rd(()=>{w(o)},[o,c]),c)return null;let U=p(e);if(!U||u(U)||S(e)===X||f(e)===1&&!L(e)||x())return null;let I=T(e)[h(e)];function j(){return Z.createElement(Z.Fragment,null,Z.createElement(pr,null,Z.createElement(be,{size:"large",appearance:n,title:I.title,subtitle:I.subtitle})),Z.createElement(lr,{className:l("npsNumberButtonContainer",n),appearance:n},Array.from(Array(10).keys()).map($=>Z.createElement(Ds,{className:l("npsNumberButton",n),selected:A===$+1,key:$,onClick:async()=>{F(e),y($+1),await a(e,I.id,{score:$+1})},appearance:n},$+1))),Z.createElement($s,{appearance:n},Z.createElement(ar,{appearance:n},"Not likely at all"),Z.createElement(ar,{appearance:n},"Extremely likely")))}function B(){return Z.createElement(Z.Fragment,null,Z.createElement(pr,null,Z.createElement(be,{appearance:n,title:"Why did you choose this score?",size:"large"})),Z.createElement(Ms,{appearance:n,value:C,onChange:$=>{m($.target.value)},placeHolder:"Add your optional fedback here..."}),Z.createElement(lr,{appearance:n,className:l("npsNumberButtonContainer",n)},Z.createElement(ee,{size:"large",withMargin:!1,onClick:async()=>{await d(e),r&&r(I,1,"primary")},appearance:n,title:I.secondaryButtonTitle||"Skip",secondary:!0}),Z.createElement(ee,{size:"large",withMargin:!1,onClick:async()=>{await a(e,I.id,{feedbackText:C}),await d(e),r&&r(I,1,"primary")},appearance:n,title:I.primaryButtonTitle||"Submit"})))}return Z.createElement(id,null,Z.createElement(ie,{appearance:n}),Z.createElement(Os,{appearance:n,className:ye(l("npsSurveyContainer",n),i),style:s},Z.createElement(Us,{onClick:async()=>{await d(e),t&&t()},className:l("npsSurveyDismissButton",n)},Z.createElement(Ee,null)),f(e)==0&&j(),f(e)==1&&B()))};export{ft as CheckBox,tt as FormLabel,_o as FormTextField,od as FrigadeBanner,rr as FrigadeChecklist,qe as FrigadeDefaultAppearance,ed as FrigadeEmbeddedTip,ri as FrigadeForm,Np as FrigadeGuide,vp as FrigadeHeroChecklist,nd as FrigadeNPSSurvey,Ip as FrigadeProgressBadge,Aa as FrigadeProvider,Zp as FrigadeSupportWidget,Kp as FrigadeTour,It as ProgressRing,ve as useFlowOpens,zt as useFlowResponses,J as useFlows,Ko as useOrganization,Ht as useUser};
|
|
1567
1567
|
//# sourceMappingURL=index.mjs.map
|