@frigade/react 1.32.41 → 1.32.43
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 +4 -1
- package/lib/index.js +137 -137
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +125 -125
- 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 gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import{ThemeProvider as va}from"styled-components";import ft,{useContext as Fa,useEffect as bo,useState as Ko}from"react";import{useCallback as pt,useContext as Qs,useEffect as Zs}from"react";import No,{useMemo as _s}from"react";var dr="1.32.41 ";var ke="https://api.frigade.com/v1/public/",Ie="NOT_STARTED_STEP",X="COMPLETED_FLOW",io="ABORTED_FLOW",at="STARTED_FLOW",Le="NOT_STARTED_FLOW",Oe="COMPLETED_STEP",no="STARTED_STEP";function Me(){let{publicApiKey:e,userId:t}=No.useContext(q);return{config:_s(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":dr,"X-Frigade-SDK-Platform":"React"}}),[e,t])}}var Ws="frigade-last-call-at-",zs="frigade-last-call-data-";function wt(){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 Tt(){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 cr}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}=Me(),{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=at),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=at),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}=Me(),{userFlowStatesData:t,mutateUserFlowState:o}=Be(),{failedFlowResponses:i,setFailedFlowResponses:r,flowResponses:n,setFlowResponses:s}=Ys(q),[p,d]=cr(new Set),[a,f]=cr(new Set),c=wt();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===at||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,mr=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}=Me(),{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}=Tt(),{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:M}=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(M)return null;let b=t.find(v=>v.slug===g);return!b&&t.length>0&&!E&&!M?(console.log(`Flow with slug ${g} not found`),null):(b==null?void 0:b.active)===!1?null:b}function $(g){var H;if(!U(g))return[];let b=U(g).data;return b?(b=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&&!M&&g&&JSON.stringify(n)!=JSON.stringify({...n,...g})&&Object.keys(g).forEach(b=>{B(b,g[b])})}let re=pt(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=pt(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]),_=pt(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=pt(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=pt(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:at,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};G(v)&&w(v)},[i,h]),W=pt(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=pt(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 $(g)[0]??null;let b=(v=h.find(H=>H.flowId===g))==null?void 0:v.lastStepId;return b?$(g).find(H=>H.id===b):null}function de(g){let b=V(g);if(!b)return 0;let v=$(g).findIndex(H=>H.id===b.id)??0;return L(g,b.id)===Oe&&v<$(g).length-1?v+1:v}function oe(g){if(!g.completionCriteria)return;let b=mr(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=$(g);return b.length===0?0:b.filter(H=>L(g,H.id)===Oe).length}function Ge(g){return $(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 st(g){return!Se(U(g))}return{getFlow:U,getFlowData:Y,isLoading:E||M,getStepStatus:L,getFlowSteps:$,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:st}}import{useCallback as ur,useContext as el,useEffect as tl}from"react";var Ft="guest_";function Lo(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=el(q),{config:n}=Me(),{mutateUserFlowState:s}=Be(),p=wt(),{verifySDKInitiated:d}=Tt();tl(()=>{if(e&&!t){if(e.startsWith(Ft))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=ur(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=ur(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 fr="fr-",Ht="cfr-";function l(e,t){let o=`${fr}${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(fr)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Oo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function dt(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 gr(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 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.43 ";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`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -23,7 +23,7 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
23
23
|
opacity: 1;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
`,
|
|
26
|
+
`,xr=({onClose:e,appearance:t})=>ol.createElement(il,{className:l("modalBackground",t),onClick:()=>e()});import so from"react";import nl from"styled-components";var sl=nl.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
@@ -45,7 +45,7 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
45
45
|
|
|
46
46
|
border-radius: ${e=>{var t,o;return((o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius)??8}}px;
|
|
47
47
|
|
|
48
|
-
${e=>
|
|
48
|
+
${e=>ct(e)}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
padding: 32px;
|
|
@@ -92,7 +92,7 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
92
92
|
::-webkit-scrollbar {
|
|
93
93
|
display: none;
|
|
94
94
|
}
|
|
95
|
-
`,
|
|
95
|
+
`,Re=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:r,appearance:n,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:n,onClose:()=>{s&&e()}}),Ve.createElement(pl,{appearance:n,className:l("modalContainer",n),styleOverrides:i},s&&Ve.createElement(cl,{className:l("modalClose",n),onClick:()=>e(),appearance:n},Ve.createElement(Ee,null)),o&&Ve.createElement(dl,null,o),Ve.createElement(ml,null,r))):Ve.createElement(Ve.Fragment,null));import et,{useEffect as ul}from"react";import ao from"styled-components";import{Portal as fl}from"react-portal";var gl=ao.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}};
|
|
@@ -129,7 +129,7 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
129
129
|
::-webkit-scrollbar {
|
|
130
130
|
display: none;
|
|
131
131
|
}
|
|
132
|
-
`,
|
|
132
|
+
`,Cr=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:r})=>(ul(()=>{let n=s=>{s.key==="Escape"&&e()};return document.addEventListener("keydown",n),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",n)}},[e,t]),t?et.createElement(fl,null,et.createElement(gl,{appearance:r,className:l("cornerModalContainer",r)},et.createElement(xl,{className:l("cornerModalClose",r),onClick:()=>e()},et.createElement(Ee,null)),o&&et.createElement(hl,null,o),et.createElement(Cl,null,i))):et.createElement(et.Fragment,null));import{useContext as Sl}from"react";function Q(){let{defaultAppearance:e}=Sl(q);function t(o){let i=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign(i.styleOverrides??{},o.styleOverrides??{}),theme:Object.assign(i.theme,o.theme??{})}:i}return{mergeAppearanceWithDefault:t}}import jt,{useEffect as Il,useState as Wo}from"react";import zo from"styled-components";import mo,{useEffect as yl,useState as Fr}from"react";import Mo from"styled-components";import po from"styled-components";var Sr=po.label`
|
|
133
133
|
${e=>k(e)} {
|
|
134
134
|
font-size: 14px;
|
|
135
135
|
line-height: 20px;
|
|
@@ -137,18 +137,18 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
137
137
|
margin-top: 10px;
|
|
138
138
|
}
|
|
139
139
|
display: flex;
|
|
140
|
-
`,
|
|
140
|
+
`,yr=po.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
|
-
`,
|
|
147
|
+
`,br=po.span`
|
|
148
148
|
font-weight: 400;
|
|
149
149
|
font-size: 14px;
|
|
150
150
|
line-height: 22px;
|
|
151
|
-
color:
|
|
151
|
+
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextError}};
|
|
152
152
|
display: flex;
|
|
153
153
|
margin-right: 5px;
|
|
154
154
|
margin-top: 10px;
|
|
@@ -157,11 +157,11 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
157
157
|
align-items: flex-start;
|
|
158
158
|
justify-content: left;
|
|
159
159
|
margin-bottom: 10px;
|
|
160
|
-
`;import Do from"react";function
|
|
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(co,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(co,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 i of t.props)i.requirement=="min"?o=o.min(Number(i.value),i.message??"Value is too small"):i.requirement=="max"?o=o.max(Number(i.value),i.message??"Value is too large"):i.requirement=="positive"?o=o.positive(i.message??"Value must be positive"):i.requirement=="negative"&&(o=o.nonpositive(i.message??"Value must be negative"));o.parse(Number(e))}if(t.type=="string"){let o=$o.string();if(t.props)for(let i of t.props)i.requirement=="min"?o=o.min(Number(i.value),i.message??"Value is too short"):i.requirement=="max"?o=o.max(Number(i.value),i.message??"Value is too long"):i.requirement=="regex"&&(o=o.regex(new RegExp(String(i.value)),i.message??"Value does not match requirements"));o.parse(e)}return}}catch(o){if(o instanceof $o.ZodError)return o.issues&&o.issues.length>0?o.issues[0].message:null;console.error("Frigade Form validation failed for rule ",t,o)}return null}var bl=Mo.div`
|
|
161
161
|
display: flex;
|
|
162
162
|
flex-direction: column;
|
|
163
163
|
width: 100%;
|
|
164
|
-
`,Uo
|
|
164
|
+
`,Uo=Mo.input`
|
|
165
165
|
${e=>k(e)} {
|
|
166
166
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
167
167
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -177,7 +177,7 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
177
177
|
box-sizing: border-box;
|
|
178
178
|
padding: 0 10px;
|
|
179
179
|
margin-bottom: 10px;
|
|
180
|
-
`,wl
|
|
180
|
+
`,wl=Mo.textarea`
|
|
181
181
|
${e=>k(e)} {
|
|
182
182
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
183
183
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -193,7 +193,7 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
193
193
|
min-height: 70px;
|
|
194
194
|
box-sizing: border-box;
|
|
195
195
|
margin-bottom: 10px;
|
|
196
|
-
`;function
|
|
196
|
+
`;function _o({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:r}){let n=e,[s,p]=Fr((r==null?void 0:r.text)||""),[d,a]=Fr(!1),f=Uo;yl(()=>{s===""&&!d&&(a(!0),c(""))},[]);function c(w){if(p(w),o({text:w}),n.required===!0&&w.trim()===""){i([{id:n.id,message:`${n.title} is required`}]);return}let T=Tr(w,n.validation);if(T){i([{id:n.id,message:T}]);return}i([])}n.multiline&&(f=wl);function u(){var w;switch((w=n==null?void 0:n.validation)==null?void 0:w.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return mo.createElement(bl,null,mo.createElement(tt,{title:n.title,required:n.required,appearance:t.appearance}),mo.createElement(f,{className:l("inputComponent",t.appearance),value:s,onChange:w=>{c(w.target.value)},appearance:t.appearance,placeholder:n.placeholder,type:u()}),mo.createElement(Pt,{title:n.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 gt,{createContext as Pa,useEffect as Yo,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
|
-
`,uo="null";function Er({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var f,c,u,w,T,S;let n=e,[s,p]=Pr(((f=i==null?void 0:i.choice)==null?void 0:f[0])||""),[d,a]=Pr(!1);return kr(()=>{var h,E,y,A;if(s===""&&!d){if(a(!0),n.requireSelection){p(uo);return}if(n.defaultValue&&((h=n.props.options)!=null&&h.find(F=>F.id===n.defaultValue))){let F=(E=n.props.options)==null?void 0:E.find(x=>x.id===n.defaultValue);p(F.id),o({choice:[F.id]})}else p(((y=n.props.options)==null?void 0:y[0].id)||""),o({choice:[((A=n.props.options)==null?void 0:A[0].id)||""]})}},[]),kr(()=>{n.requireSelection&&s===uo?r([{message:"Please select an option",id:n.id}]):r([])},[s])
|
|
226
|
+
`,uo="null";function Er({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var f,c,u,w,T,S;let n=e,[s,p]=Pr(((f=i==null?void 0:i.choice)==null?void 0:f[0])||""),[d,a]=Pr(!1);return kr(()=>{var h,E,y,A;if(s===""&&!d){if(a(!0),n.requireSelection){p(uo);return}if(n.defaultValue&&((h=n.props.options)!=null&&h.find(F=>F.id===n.defaultValue))){let F=(E=n.props.options)==null?void 0:E.find(x=>x.id===n.defaultValue);p(F.id),o({choice:[F.id]})}else p(((y=n.props.options)==null?void 0:y[0].id)||""),o({choice:[((A=n.props.options)==null?void 0:A[0].id)||""]})}},[]),kr(()=>{n.requireSelection&&s===uo?r([{message:"Please select an option",id:n.id}]):r([])},[s]),Me.createElement(Tl,null,Me.createElement(tt,{title:n.title,required:!1,appearance:t.appearance}),Me.createElement(Fl,{value:s,onChange:h=>{p(h.target.value),o({choice:[h.target.value]})},placeholder:n.placeholder,appearance:t.appearance,className:l("multipleChoiceSelect",t.appearance)},n.requireSelection&&Me.createElement("option",{key:uo,value:uo},"Select an option"),(c=n.props.options)==null?void 0:c.map(h=>Me.createElement("option",{key:h.id,value:h.id},h.title))),((w=(u=n.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=n.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:n.subtitle,appearance:t.appearance}))}import fo,{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 gt,{createContext as Pa,useEffect as Yo,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:i}){var a;let r=e,[n,s]=Ir((i==null?void 0:i.choice)||[]),[p,d]=Ir(!1);return Ar(()=>{n.length==0&&!p&&(d(!0),o({choice:[]}))},[]),Ar(()=>{o({choice:n})},[n]),fo.createElement(kl,null,fo.createElement(
|
|
254
|
+
`;function Nr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i}){var a;let r=e,[n,s]=Ir((i==null?void 0:i.choice)||[]),[p,d]=Ir(!1);return Ar(()=>{n.length==0&&!p&&(d(!0),o({choice:[]}))},[]),Ar(()=>{o({choice:n})},[n]),fo.createElement(kl,null,fo.createElement(tt,{title:r.title,required:r.required,appearance:t.appearance}),(a=r.props.options)==null?void 0:a.map(f=>fo.createElement(Pl,{appearance:t.appearance,key:f.id,value:f.id,"data-selected":n.includes(f.id),onClick:()=>{if(n.includes(f.id)){s(n.filter(c=>c!==f.id));return}n.length<r.props.maxChoices?s([...n,f.id]):n.length==1&&r.props.maxChoices==1&&s([f.id])}},f.title)),fo.createElement(Pt,{title:r.subtitle,appearance:t.appearance}))}import go 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,35 +270,35 @@ import gt,{createContext as Pa,useEffect as Yo,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:i="medium"}){return go.createElement(go.Fragment,null,go.createElement(El,{appearance:e,className:l(`${i}Title`,e),dangerouslySetInnerHTML:me(t),size:i}),o&&go.createElement(Al,{appearance:e,className:l(`${i}Subtitle`,e),dangerouslySetInnerHTML:me(o),size:i}))}var Bl=
|
|
273
|
+
`;function be({appearance:e,title:t,subtitle:o,size:i="medium"}){return go.createElement(go.Fragment,null,go.createElement(El,{appearance:e,className:l(`${i}Title`,e),dangerouslySetInnerHTML:me(t),size:i}),o&&go.createElement(Al,{appearance:e,className:l(`${i}Subtitle`,e),dangerouslySetInnerHTML:me(o),size:i}))}var Bl=zo.div`
|
|
274
274
|
display: flex;
|
|
275
275
|
flex-direction: column;
|
|
276
276
|
justify-content: flex-end;
|
|
277
277
|
padding-bottom: 14px;
|
|
278
278
|
overflow: visible;
|
|
279
|
-
`,Nl=
|
|
279
|
+
`,Nl=zo.div`
|
|
280
280
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextError}};
|
|
281
281
|
font-size: 12px;
|
|
282
282
|
margin-bottom: 12px;
|
|
283
|
-
`,Ll=
|
|
283
|
+
`,Ll=zo.div`
|
|
284
284
|
padding-left: 1px;
|
|
285
285
|
padding-right: 1px;
|
|
286
|
-
`,Ol={text:
|
|
286
|
+
`,Ol={text:_o,multipleChoice:Er,multipleChoiceList:Nr};function Or({stepData:e,canContinue:t,setCanContinue:o,onSaveData:i,appearance:r,customFormElements:n}){var E;let s=e.props,[p,d]=Wo(S()||{}),[a,f]=Wo([]),[c,u]=Wo([]),w={...Ol,...n};Il(()=>{o(a.length===0)},[a,o]);function T(y,A){let F={...p,[y.id]:A};d(F),i(F),window&&window.localStorage&&window.localStorage.setItem(h(),JSON.stringify(F))}function S(){if(window&&window.localStorage){let y=window.localStorage.getItem(h());if(y)return JSON.parse(y)}return{}}function h(){return`frigade-multiInputStepTypeData-${e.id}`}return jt.createElement(Ll,{className:l("multiInput",r)},jt.createElement(be,{appearance:r,title:e.title,subtitle:e.subtitle}),jt.createElement(Bl,{className:l("multiInputContainer",r)},(E=s.data)==null?void 0:E.map(y=>{var F;let A=(F=a.reverse().find(x=>x.id===y.id))==null?void 0:F.message;return w[y.type]?jt.createElement("span",{key:y.id},w[y.type]({formInput:y,customFormTypeProps:{stepData:e,canContinue:t,setCanContinue:o,onSaveData:i,appearance:r},onSaveInputData:x=>{!c.includes(y.id)&&x&&(x==null?void 0:x.text)!==""&&u(m=>[...m,y.id]),T(y,x)},inputData:p[y.id],setFormValidationErrors:x=>{f(m=>x.length===0?m.filter(C=>C.id!==y.id):[...m,...x])}}),A&&c.includes(y.id)&&jt.createElement(Nl,{appearance:r,className:l("multiInputValidationError",r)},A)):null})))}import mt from"styled-components";var Dr=mt.div`
|
|
287
287
|
align-items: center;
|
|
288
288
|
display: flex;
|
|
289
289
|
justify-content: space-between;
|
|
290
290
|
padding-top: 14px;
|
|
291
|
-
|
|
291
|
+
`,$r=mt.div`
|
|
292
292
|
color: ${e=>e.appearance.theme.colorTextError};
|
|
293
293
|
font-size: 12px;
|
|
294
|
-
|
|
294
|
+
`,Mr=mt.div`
|
|
295
295
|
display: flex;
|
|
296
296
|
gap: 12px;
|
|
297
|
-
`,Ur=
|
|
297
|
+
`,Ur=mt.div`
|
|
298
298
|
display: flex;
|
|
299
299
|
flex-direction: row;
|
|
300
300
|
flex: 1 1;
|
|
301
|
-
`,_r=
|
|
301
|
+
`,_r=mt.div`
|
|
302
302
|
display: flex;
|
|
303
303
|
// If type is set to large-modal, use padding 60px horizontal, 80px vertical
|
|
304
304
|
// Otherwise, use 4px padding
|
|
@@ -306,11 +306,11 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
306
306
|
flex-grow: 1;
|
|
307
307
|
flex-basis: 0;
|
|
308
308
|
position: relative;
|
|
309
|
-
`,Wr=
|
|
309
|
+
`,Wr=mt.div`
|
|
310
310
|
padding: ${e=>e.type==="large-modal"?"50px":"0px"};
|
|
311
311
|
position: relative;
|
|
312
312
|
overflow-y: auto;
|
|
313
|
-
`,zr=
|
|
313
|
+
`,zr=mt.div`
|
|
314
314
|
display: flex;
|
|
315
315
|
align-self: stretch;
|
|
316
316
|
flex-grow: 1;
|
|
@@ -322,7 +322,7 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
322
322
|
background-position: center;
|
|
323
323
|
border-top-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
324
324
|
border-bottom-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
325
|
-
`;import
|
|
325
|
+
`;import ot from"react";import Dl from"react";import Hr from"styled-components";var $l=Hr.button`
|
|
326
326
|
justify-content: center;
|
|
327
327
|
align-content: center;
|
|
328
328
|
${e=>k(e)} {
|
|
@@ -362,14 +362,14 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
362
362
|
margin-right: 8px;
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
-
`,ee=({onClick:e,title:t,style:o,disabled:i,type:r="inline",size:n="medium",secondary:s=!1,appearance:p,withMargin:d=!0,classPrefix:a=""})=>{function f(){let c=s?"buttonSecondary":"button";return a===""?c:`${a}${
|
|
365
|
+
`,ee=({onClick:e,title:t,style:o,disabled:i,type:r="inline",size:n="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:i,onClick:e,style:o,type:r,withMargin:d,size:n,className:l(f(),p)},t)};var jr=({step:e,canContinue:t,appearance:o,onPrimaryClick:i,onSecondaryClick:r,formType:n,selectedStep:s,steps:p,onBack:d,allowBackNavigation:a,errorMessage:f})=>{let c=n==="inline"?"inline":"full-width";return ot.createElement(ot.Fragment,null,f&&ot.createElement($r,{appearance:o,className:l("formCTAError",o)},f),ot.createElement(Dr,{className:l("formCTAContainer",o)},p.length>1&&s!=0&&a&&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:r,secondary:!0,withMargin:!1,type:c,appearance:o}):null," ",e.primaryButtonTitle?ot.createElement(ee,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:i,type:c,appearance:o}):null)))};import 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:i})=>{let{theme:r}=Q().mergeAppearanceWithDefault(i);return
|
|
367
|
+
`,Gr=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:r}=Q().mergeAppearanceWithDefault(i);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((n,s)=>Ho.createElement("rect",{key:s,x:16*s,y:0,width:8,height:8,rx:4,fill:t===s?r.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(r){i(r.primaryButtonUri,r.primaryButtonUriTarget)}function o(r){i(r.secondaryButtonUri,r.secondaryButtonUriTarget)}function i(r,n){if(!r)return;let s=r.startsWith("http")?"_blank":"_self";n&&n!=="_blank"&&(s="_self"),e.navigate(r,s)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:i}}var Wl=vt.div`
|
|
368
368
|
display: flex;
|
|
369
369
|
flex-wrap: wrap;
|
|
370
370
|
align-content: center;
|
|
371
371
|
justify-content: center;
|
|
372
|
-
`,zl=
|
|
372
|
+
`,zl=vt.div`
|
|
373
373
|
align-content: center;
|
|
374
374
|
align-items: center;
|
|
375
375
|
display: flex;
|
|
@@ -383,10 +383,10 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
383
383
|
flex-basis: 255px;
|
|
384
384
|
flex-grow: 0;
|
|
385
385
|
flex-shrink: 0;
|
|
386
|
-
`,Hl=
|
|
386
|
+
`,Hl=vt.img`
|
|
387
387
|
width: 78px;
|
|
388
388
|
height: auto;
|
|
389
|
-
`,jl=
|
|
389
|
+
`,jl=vt.button`
|
|
390
390
|
font-style: normal;
|
|
391
391
|
font-weight: 600;
|
|
392
392
|
font-size: 13px;
|
|
@@ -399,11 +399,11 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
399
399
|
border-radius: 100px;
|
|
400
400
|
padding: 8px 12px;
|
|
401
401
|
margin-top: 16px;
|
|
402
|
-
`,Gl=
|
|
402
|
+
`,Gl=vt.h1`
|
|
403
403
|
font-weight: 700;
|
|
404
404
|
font-size: 28px;
|
|
405
405
|
line-height: 34px;
|
|
406
|
-
`,Vl=
|
|
406
|
+
`,Vl=vt.h2`
|
|
407
407
|
font-style: normal;
|
|
408
408
|
font-weight: 400;
|
|
409
409
|
font-size: 16px;
|
|
@@ -412,7 +412,7 @@ import gt,{createContext as Pa,useEffect as Yo,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 i,r;let{handleUrl:o}=ne();return
|
|
415
|
+
`;function Vr({stepData:e,appearance:t}){var i,r;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,(r=(i=e.props)==null?void 0:i.links)==null?void 0:r.map(n=>ut.createElement(zl,{key:n.title},ut.createElement(Hl,{src:n.imageUri}),ut.createElement(jl,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{n.uri&&o(n.uri,n.uriTarget??"_blank")}},n.title)))))}import At,{useEffect as Zl}from"react";import So from"styled-components";import jo from"react";var xo=({style:e,className:t})=>jo.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:t,style:e},jo.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),jo.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.91 11.672a.375.375 0 010 .656l-5.603 3.113a.375.375 0 01-.557-.328V8.887c0-.286.307-.466.557-.327l5.603 3.112z"}));import Gt,{useRef as ql,useState as Kl}from"react";import Co from"styled-components";var Yl=Co.div`
|
|
416
416
|
display: flex;
|
|
417
417
|
align-items: center;
|
|
418
418
|
justify-content: flex-start;
|
|
@@ -449,7 +449,7 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
449
449
|
height: 100%;
|
|
450
450
|
min-height: 200px;
|
|
451
451
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
452
|
-
`;function
|
|
452
|
+
`;function Et({appearance:e,videoUri:t}){let o=ql(),[i,r]=Kl(!1);if(t.includes("youtube")){let n=t.split("v=")[1],s=n.indexOf("&");return s!==-1&&(n=n.substring(0,s)),Gt.createElement(Ql,{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${n}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,appearance:e})}return Gt.createElement(Yl,{appearance:e},!i&&Gt.createElement(Xl,{onClick:()=>{r(!0),o.current.play()},appearance:e},Gt.createElement(xo,null)),Gt.createElement(Jl,{appearance:e,controls:i,ref:o,play:i,src:t}))}var Rl=So.div`
|
|
453
453
|
${e=>k(e)} {
|
|
454
454
|
display: flex;
|
|
455
455
|
flex-direction: column;
|
|
@@ -473,25 +473,25 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
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)},[]),
|
|
477
|
-
${e=>
|
|
478
|
-
`,
|
|
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 qt from"react";import Vt from"react";import{motion as ra}from"framer-motion";var Kr=({color:e,percentage:t,size:o})=>{let i=o*.5-2,r=2*Math.PI*i,n=(1-t)*r,s={duration:.3,delay:0,ease:"easeIn"},p={hidden:{strokeDashoffset:r,transition:s},show:{strokeDashoffset:n,transition:s}};return Vt.createElement(ra.circle,{r:i,cx:o*.5,cy:o*.5,fill:"transparent",stroke:n!==r?e:"",strokeWidth:"3px",strokeDasharray:r,strokeDashoffset:t?n:0,variants:p,transition:s,initial:"hidden",animate:"show"})},ia=({fillColor:e,size:t,percentage:o,children:i,bgColor:r="#D9D9D9",className:n,style:s})=>Vt.createElement("svg",{style:s,className:n,width:t,height:t,overflow:"visible"},Vt.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},Vt.createElement(Kr,{color:r,size:t}),Vt.createElement(Kr,{color:e,percentage:o,size:t})),i),It=ia;import na from"styled-components";var sa=({color:e="#FFFFFF"})=>qt.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.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
|
+
${e=>ct(e)}
|
|
478
|
+
`,ft=({value:e,type:t="square",primaryColor:o="#000000",progress:i,appearance:r=qe,style:n,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"&&i!==void 0&&i!==1?qt.createElement(It,{fillColor:o,percentage:i,size:22}):qt.createElement(ga,{styleOverrides:p,style:n,role:"checkbox",className:ye(l("checkIconContainer",r),l(e?"checkIconContainerChecked":"checkIconContainerUnchecked",r),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&qt.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;
|
|
482
482
|
justify-content: center;
|
|
483
483
|
align-items: center;
|
|
484
484
|
padding: 4px;
|
|
485
|
-
`,Xr=
|
|
485
|
+
`,Xr=rt.div`
|
|
486
486
|
width: 100%;
|
|
487
487
|
text-align: left;
|
|
488
|
-
`,Jr=
|
|
488
|
+
`,Jr=rt.h1`
|
|
489
489
|
font-style: normal;
|
|
490
490
|
font-weight: 700;
|
|
491
491
|
font-size: 32px;
|
|
492
492
|
line-height: 38px;
|
|
493
493
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
494
|
-
`,Qr=
|
|
494
|
+
`,Qr=rt.h1`
|
|
495
495
|
font-style: normal;
|
|
496
496
|
font-weight: 400;
|
|
497
497
|
font-size: 16px;
|
|
@@ -499,7 +499,7 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
499
499
|
margin-top: 16px;
|
|
500
500
|
margin-bottom: 16px;
|
|
501
501
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
502
|
-
`,Zr=
|
|
502
|
+
`,Zr=rt.div`
|
|
503
503
|
padding-top: 12px;
|
|
504
504
|
padding-bottom: 12px;
|
|
505
505
|
flex-direction: row;
|
|
@@ -510,17 +510,17 @@ import gt,{createContext as Pa,useEffect as Yo,useState as Ne}from"react";import
|
|
|
510
510
|
cursor: pointer;
|
|
511
511
|
border-bottom: ${e=>e.hideBottomBorder?"none":"1px solid #D8D8D8"};
|
|
512
512
|
width: 100%;
|
|
513
|
-
`,Rr=
|
|
513
|
+
`,Rr=rt.div`
|
|
514
514
|
padding-top: 10px;
|
|
515
515
|
padding-bottom: 10px;
|
|
516
516
|
flex-direction: row;
|
|
517
517
|
display: flex;
|
|
518
518
|
justify-content: flex-start;
|
|
519
|
-
`,ei=
|
|
519
|
+
`,ei=rt.img`
|
|
520
520
|
width: 42px;
|
|
521
521
|
height: 42px;
|
|
522
522
|
margin-right: 12px;
|
|
523
|
-
`,ti=
|
|
523
|
+
`,ti=rt.p`
|
|
524
524
|
font-style: normal;
|
|
525
525
|
font-weight: 500;
|
|
526
526
|
font-size: 17px;
|
|
@@ -528,8 +528,8 @@ import gt,{createContext as Pa,useEffect as Yo,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:i})=>{let r=e.props,[n,s]=
|
|
532
|
-
${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map(([s,p])=>`${Oo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return Yt.createElement(o,{inlineStyles:t})}var ri=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:r,customVariables:n,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:y=!1,validationHandler:A})=>{let{getFlow:F,getFlowSteps:x,isLoading:m,targetingLogicShouldHideFlow:C,getFlowStatus:P,getCurrentStepIndex
|
|
531
|
+
`;var oi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let r=e.props,[n,s]=Vo([]),[p,d]=Vo(!1),[a,f]=Vo(e.id);return Go(()=>{n.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),Go(()=>{a!==e.id&&(f(e.id),s([]))},[e]),Go(()=>{o({choice:n}),n.length>=r.minChoices?t(!0):t(!1)},[n]),Ke.createElement(Yr,{className:l("selectListContainer",i)},Ke.createElement(Xr,null,Ke.createElement(Jr,{className:l("selectListTitle",i)},e.title),Ke.createElement(Qr,{appearance:i,className:l("selectListSubtitle",i)},e.subtitle)),r.options.map((c,u)=>{let w=n.includes(c.id);return Ke.createElement(Zr,{key:`select-item-${u}`,onClick:()=>{if(n.includes(c.id)){s(n.filter(T=>T!==c.id));return}n.length<r.maxChoices?s([...n,c.id]):n.length==1&&r.maxChoices==1&&s([c.id])},hideBottomBorder:u===r.options.length-1,className:l("selectListSelectItem",i)},Ke.createElement(Rr,{className:l("selectListItemImage",i)},c.imageUri&&Ke.createElement(ei,{src:c.imageUri,alt:`select-icon-${u}`}),Ke.createElement(ti,{appearance:i,className:l("selectListSelectItemText",i)},c.title)),Ke.createElement(ft,{appearance:i,value:w,primaryColor:i.theme.colorPrimary}))}))};import we,{useEffect as qo,useState as Kt}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),yo=({appearance:e,steps:t,selectedStep:o,customStepTypes:i,customVariables:r,onButtonClick:n,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},...i},{primaryCTAClickSideEffects:F,secondaryCTAClickSideEffects:x}=ne(),[m,C]=Kt(!1),[P,$]=Kt({}),[U,M]=Kt(!1),[I,j]=Kt(!1),[B,D]=Kt(null),re=t[o]??null,{markStepCompleted:R,markStepStarted:_,isLoading:he,updateCustomVariables:Fe,markFlowCompleted:W}=J();qo(()=>{Fe(r)},[r,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:P[t[o].id]??{},stepId:t[o].id,customVariables:r}}function G(V,de,oe){let K=o+1<t.length?t[o+1]:null;n&&n(V,o,de,K),s&&s(V,oe,K,P,se())}function L(V,de){$(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],P,se());if(de){D(de),M(!1);return}else D(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)),F(t[o]),M(!1),window&&h&&o+1<t.length&&(window.location.hash=t[o+1].id)},onSecondaryClick:()=>{G(t[o],"secondary",o),x(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:C,onSaveData:oe=>{L(V,oe)},appearance:e,customFormElements:S})}),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 Yt from"react";import{createGlobalStyle as Sa}from"styled-components";function ie({appearance:e}){if(!e||!e.styleOverrides)return Yt.createElement(Yt.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([i,r])=>typeof r=="object");if(t.length===0)return Yt.createElement(Yt.Fragment,null);let o=Sa`
|
|
532
|
+
${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map(([s,p])=>`${Oo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return Yt.createElement(o,{inlineStyles:t})}var ri=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:r,customVariables:n,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:y=!1,validationHandler:A})=>{let{getFlow:F,getFlowSteps:x,isLoading:m,targetingLogicShouldHideFlow:C,getFlowStatus:P,getCurrentStepIndex:$,markFlowCompleted:U,markFlowNotStarted:M}=J(),I=$(e),{mergeAppearanceWithDefault:j}=Q(),[B,D]=ba(!1),{setOpenFlowState:re,getOpenFlowState:R}=ve();d=j(d);let[_,he]=i!==void 0&&r!==void 0?[i,r]:[R(e,!0),G=>re(e,G)];if(ya(()=>{!B&&!m&&(D(!0),P(e)===X&&S&&M(e),D(!0))},[B,D,m]),m)return null;let Fe=F(e);if(!Fe||C(Fe))return null;let W=x(e);if(!W||i!==void 0&&i===!1||P(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(yo,{appearance:d,steps:W,selectedStep:I,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:f,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:he,onDismiss:h,showPagination:E,customFormElements:s,allowBackNavigation:y,validationHandler:A}))}return o==="modal"&&T!=="center"?Ue.createElement(Cr,{appearance:d,onClose:se,visible:_},Ue.createElement(ie,{appearance:d}),Ue.createElement(yo,{appearance:d,steps:W,selectedStep:I,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:f,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:he,onDismiss:h,showPagination:E,customFormElements:s,allowBackNavigation:y,validationHandler:A})):Ue.createElement(Ue.Fragment,null,Ue.createElement(ie,{appearance:d}),Ue.createElement(yo,{appearance:d,steps:W,selectedStep:I,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:f,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:he,onDismiss:h,showPagination:E,customFormElements:s,allowBackNavigation:y,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:i}=Be(),{config:r}=$e(),n=Tt(),{verifySDKInitiated:s}=Ft();Ta(()=>{if(t&&e){if(t.startsWith(kt))return;let a=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(a)||(n(`${ke}userGroups`,{...r,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 n(`${ke}userGroups`,{...r,method:"POST",body:JSON.stringify(f)}),i()},[e,t,r,i]),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 n(`${ke}userGroups`,{...r,method:"POST",body:JSON.stringify(u)}),i()},[e,t,r,i]);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:i}=Be(),{userId:r,setUserId:n}=Lo(),[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();bo(()=>{if(!o&&t)for(let x=0;x<t.length;x++){let m=t[x],C=a.find(P=>P.slug===(m==null?void 0:m.flowId));if(C&&m&&m.shouldTrigger===!0&&C.type=="FORM"&&C.triggerType==="AUTOMATIC"&&!S.includes(C.slug)){setTimeout(()=>{y(m.flowId)},500);break}}},[o,t]),bo(()=>{u.length>0&&i()},[u]);function y(x){let m=a.find(C=>C.slug===x);m&&m.triggerType==="AUTOMATIC"&&!S.includes(m.slug)&&(h([...S,m.slug]),T([m]))}function A(){if(!r){let x=localStorage.getItem(li);if(x){n(x);return}let m=localStorage.getItem(si);if(m){n(m);return}c(!0);let C=kt+ka();try{localStorage.setItem(si,C)}catch(P){console.log("Failed to save guest user id locally: Local storage unavailable",P)}n(P=>P||C)}}bo(()=>{try{if(a){let x=[];a.forEach(m=>{if(m.data){let C=m.data.match(/"imageUri":"(.*?)"/g);C&&C.forEach(P=>{let $=P.replace('"imageUri":"',"").replace('"',"");if(x.includes($))return;let U=new Image;U.src=$,x.push($)})}})}}catch{}},[a]),bo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(kt))try{localStorage.setItem(li,r)}catch(x){console.log("Failed to save user id locally: Local storage available",x)}r===null&&setTimeout(()=>{r===null&&A()},50)},[r,a,f]);function F(){return gt.createElement(gt.Fragment,null,w.map(x=>d(x.slug)!==Le?null:gt.createElement("span",{key:x.slug},gt.createElement(ii,{flowId:x.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return gt.createElement(gt.Fragment,null,gt.createElement(F,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:i,children:r})=>{var re,R;let[n,s]=Ne(t||null),[p,d]=Ne(o||null),[a,f]=Ne([]),[c,u]=Ne([]),[w,T]=Ne([]),[S,h]=Ne({}),[E,y]=Ne({}),[A,F]=Ne([]),[x,m]=Ne({}),[C,P]=Ne(!1),[$,U]=Ne(!1),[M,I]=Ne(!D(e)),j=(_,he)=>{if(he==="_blank"){window.open(_,"_blank");return}setTimeout(()=>{window.location.href=_},50)},B={theme:{...qe.theme,...((re=i==null?void 0:i.defaultAppearance)==null?void 0:re.theme)??{}},styleOverrides:{...qe.styleOverrides,...((R=i==null?void 0:i.defaultAppearance)==null?void 0:R.styleOverrides)??{}}};function D(_){return!!(_&&_.length>10&&_.substring(0,10)==="api_public")}return Xo(()=>{t&&s(t)},[t]),Xo(()=>{o&&d(o)},[o]),Xo(()=>{if(D(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:n,setUserId:s,setFlows:f,flows:a,failedFlowResponses:c,setFailedFlowResponses:u,flowResponses:w,setFlowResponses:T,userProperties:S,setUserProperties:h,openFlowStates:E,setOpenFlowStates:y,completedFlowsToKeepOpenDuringSession:A,setCompletedFlowsToKeepOpenDuringSession:F,customVariables:x,setCustomVariables:m,isNewGuestUser:C,setIsNewGuestUser:P,hasActiveFullPageFlow:$,setHasActiveFullPageFlow:U,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:j,defaultAppearance:B,shouldGracefullyDegrade:M,setShouldGracefullyDegrade:I}},r):ht.createElement(Ea,{fallback:ht.createElement(ht.Fragment,null,r)},ht.createElement(q.Provider,{value:{publicApiKey:e,userId:n,setUserId:s,setFlows:f,flows:a,failedFlowResponses:c,setFailedFlowResponses:u,flowResponses:w,setFlowResponses:T,userProperties:S,setUserProperties:h,openFlowStates:E,setOpenFlowStates:y,completedFlowsToKeepOpenDuringSession:A,setCompletedFlowsToKeepOpenDuringSession:F,customVariables:x,setCustomVariables:m,isNewGuestUser:C,setIsNewGuestUser:P,hasActiveFullPageFlow:$,setHasActiveFullPageFlow:U,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:j,defaultAppearance:B,shouldGracefullyDegrade:M,setShouldGracefullyDegrade:I}},ht.createElement(va,{theme:B.theme},r,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 Fo 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,7 +546,7 @@ ${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
|
-
`,wo=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:r,primaryColor:n="#000000",checkBoxType:s="square",appearance:p})=>
|
|
549
|
+
`,wo=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:r,primaryColor:n="#000000",checkBoxType:s="square",appearance:p})=>xt.createElement(xt.Fragment,null,xt.createElement(Ia,{className:l("checklistStepsContainer",p),appearance:p,style:{...r}},i==="left"&&e&&xt.createElement(pi,{className:l("checklistStepLabel",p),style:o},e),xt.createElement(ft,{appearance:p,value:t,type:s,primaryColor:n}),i==="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 Xt from"styled-components";var ci=Xt.div`
|
|
550
550
|
font-weight: 700;
|
|
551
551
|
font-size: 18px;
|
|
552
552
|
line-height: 22px;
|
|
@@ -574,26 +574,26 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
574
574
|
`,fi=Xt.div`
|
|
575
575
|
flex-direction: row;
|
|
576
576
|
justify-content: flex-start;
|
|
577
|
-
`;var gi=({data:e,index:t,isSelected:o,primaryColor:i,style:r,onClick:n,appearance:s})=>{var p,d;return Fo.createElement("div",{style:{position:"relative",paddingLeft:"20px"},onClick:()=>{n()}},o&&Fo.createElement(To,{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)??i}}),Fo.createElement(fi,{className:l("checklistStepItem",s),key:`hero-checklist-step-${t}`,role:"listitem"},Fo.createElement(wo,{value:e.complete,labelPosition:"left",label:e.stepName,style:r,primaryColor:((d=s==null?void 0:s.theme)==null?void 0:d.colorPrimary)??i,appearance:s})))};import
|
|
577
|
+
`;var gi=({data:e,index:t,isSelected:o,primaryColor:i,style:r,onClick:n,appearance:s})=>{var p,d;return Fo.createElement("div",{style:{position:"relative",paddingLeft:"20px"},onClick:()=>{n()}},o&&Fo.createElement(To,{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)??i}}),Fo.createElement(fi,{className:l("checklistStepItem",s),key:`hero-checklist-step-${t}`,role:"listitem"},Fo.createElement(wo,{value:e.complete,labelPosition:"left",label:e.stepName,style:r,primaryColor:((d=s==null?void 0:s.theme)==null?void 0:d.colorPrimary)??i,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;
|
|
581
581
|
align-items: ${e=>e.textLocation=="top"?"flex-end":"center"};
|
|
582
582
|
|
|
583
|
-
${e=>
|
|
584
|
-
`,Da=
|
|
583
|
+
${e=>ct(e)}
|
|
584
|
+
`,Da=Jo.div`
|
|
585
585
|
flex-grow: 1;
|
|
586
586
|
position: relative;
|
|
587
587
|
${e=>e.textLocation=="top"?"width: 100%;":""}
|
|
588
|
-
|
|
588
|
+
`,$a=Jo.span`
|
|
589
589
|
font-weight: 500;
|
|
590
590
|
font-size: 15px;
|
|
591
591
|
line-height: 18px;
|
|
592
592
|
padding-right: ${e=>e.padding};
|
|
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
|
-
${e=>
|
|
596
|
-
|
|
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:i=La.backgroundColor,display:r="count",textLocation:n="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=r==="compact"?"5px":"10px",c=Math.round(e/t*100),u=r==="compact"?"5px":"20px",w;return r==="count"?w=`${e} of ${t}`:r==="compact"?w=`${c}%`:r==="percent"&&(w=`${c}% complete`),n==="top"&&(u="0px"),Ct.createElement(Oa,{className:l("progressBarContainer",d),textLocation:n,styleOverrides:s},Ct.createElement($a,{className:l("progressBarStepText",d),style:{...p,fontSize:r==="compact"?12:15,fontWeight:r==="compact"?400:500},appearance:d,padding:u,textLocation:n},w),Ct.createElement(Da,{textLocation:n,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:r=="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)??i}})))};import Qt from"react";import _a from"styled-components";import Po from"react";import ko from"react";var Bt=({stepData:e,appearance:t})=>ko.createElement(ko.Fragment,null,ko.createElement(mi,{appearance:t,className:l("checklistStepTitle",t),dangerouslySetInnerHTML:me(e.title)}),ko.createElement(ui,{appearance:t,className:l("checklistStepSubtitle",t),dangerouslySetInnerHTML:me(e.subtitle)}));import Jt from"react";var Nt=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},i=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return Jt.createElement(Jt.Fragment,null,Jt.createElement(ho,null,e.secondaryButtonTitle&&Jt.createElement(ee,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:i,style:{width:"auto",marginRight:"12px"}}),Jt.createElement(ee,{appearance:t,title:e.primaryButtonTitle,onClick:o})))};var Lt=({stepData:e,appearance:t})=>Po.createElement(Po.Fragment,null,Po.createElement(Bt,{stepData:e,appearance:t}),Po.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;
|
|
@@ -642,7 +642,7 @@ ${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 r;if(!((r=e.props)!=null&&r.videos))return Ae.createElement(Si,null,Ae.createElement(Lt,{stepData:e,appearance:t}));function o({video:n}){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(xo,null)),Ae.createElement(Va,{controls:p,ref:s,play:p,src:n.uri}),Ae.createElement(qa,null,n.title))}let i=e.props;return i.videos?Ae.createElement(Si,null,Ae.createElement(Bt,{stepData:e,appearance:t}),Ae.createElement(ja,null,i.videos.map((n,s)=>Ae.createElement("span",{key:`${n.uri}-${s}`},Ae.createElement(o,{video:n})))),Ae.createElement(Nt,{stepData:e,appearance:t})):null};import
|
|
645
|
+
`,yi="videoCarousel",bi=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return Ae.createElement(Si,null,Ae.createElement(Lt,{stepData:e,appearance:t}));function o({video:n}){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(xo,null)),Ae.createElement(Va,{controls:p,ref:s,play:p,src:n.uri}),Ae.createElement(qa,null,n.title))}let i=e.props;return i.videos?Ae.createElement(Si,null,Ae.createElement(Bt,{stepData:e,appearance:t}),Ae.createElement(ja,null,i.videos.map((n,s)=>Ae.createElement("span",{key:`${n.uri}-${s}`},Ae.createElement(o,{video:n})))),Ae.createElement(Nt,{stepData:e,appearance:t})):null};import Ye from"react";import vo from"styled-components";var wi=vo.div`
|
|
646
646
|
display: block;
|
|
647
647
|
`,Ya=vo.pre`
|
|
648
648
|
display: block;
|
|
@@ -667,40 +667,40 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
667
667
|
margin-top: 12px;
|
|
668
668
|
`,Ja=vo.div`
|
|
669
669
|
margin-top: 24px;
|
|
670
|
-
`,Ti="codeSnippet",Fi=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.codeSnippets))return
|
|
670
|
+
`,Ti="codeSnippet",Fi=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.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((r,n)=>Ye.createElement("div",{key:n},r.title?Ye.createElement(Xa,null,r.title):null,r.code?Ye.createElement(Ya,null,r.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%"};
|
|
674
674
|
background: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
675
675
|
box-shadow: ${e=>e.type!="modal"?"0px 6px 25px rgba(0, 0, 0, 0.06)":"none"};
|
|
676
676
|
border-radius: 8px;
|
|
677
|
-
`,Ra=
|
|
677
|
+
`,Ra=St.h1`
|
|
678
678
|
font-size: 24px;
|
|
679
679
|
font-weight: 600;
|
|
680
680
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
681
|
-
`,ep=
|
|
681
|
+
`,ep=St.h2`
|
|
682
682
|
font-size: 15px;
|
|
683
683
|
line-height: 20px;
|
|
684
684
|
color: ${e=>{var t,o;return((o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary)??"#4d4d4d"}};
|
|
685
685
|
margin: 10px 0px 0px 0px;
|
|
686
|
-
`,ki=
|
|
686
|
+
`,ki=St.div`
|
|
687
687
|
padding-bottom: 16px;
|
|
688
|
-
`,tp=
|
|
688
|
+
`,tp=St.div`
|
|
689
689
|
list-style: none;
|
|
690
690
|
padding: 0;
|
|
691
691
|
margin: 0;
|
|
692
692
|
cursor: pointer;
|
|
693
693
|
width: 300px;
|
|
694
|
-
`,op=
|
|
694
|
+
`,op=St.div`
|
|
695
695
|
width: 1px;
|
|
696
696
|
margin: 40px;
|
|
697
697
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
698
|
-
`,rp=
|
|
698
|
+
`,rp=St.div`
|
|
699
699
|
flex: 2;
|
|
700
700
|
padding: 2rem;
|
|
701
|
-
`,ip=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:r,setSelectedStep:n,className:s="",customStepTypes:p=new Map,appearance:d,type:a})=>{let{mergeAppearanceWithDefault:f}=Q();d=f(d);let u={...{[
|
|
701
|
+
`,ip=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:r,setSelectedStep:n,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=r??w,h=n??T,E=o.filter(A=>A.complete===!0).length,y=()=>{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:i,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,F)=>De.createElement(gi,{data:A,index:F,key:F,listLength:o.length,isSelected:F===S,primaryColor:d.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{h(F)}})))),De.createElement(op,{appearance:d,className:l("checklistDivider",d)}),De.createElement(rp,null,De.createElement(y,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
|
-
`,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
|
|
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;
|
|
705
705
|
padding-bottom: 40px;
|
|
706
706
|
`,Ei=ue.div`
|
|
@@ -749,7 +749,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
749
749
|
flex-direction: row;
|
|
750
750
|
`,Di=ue.div`
|
|
751
751
|
flex: 1;
|
|
752
|
-
|
|
752
|
+
`,$i=ue.div`
|
|
753
753
|
${e=>k(e)} {
|
|
754
754
|
display: flex;
|
|
755
755
|
justify-content: center;
|
|
@@ -759,7 +759,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
759
759
|
padding-left: 8px;
|
|
760
760
|
padding-right: 8px;
|
|
761
761
|
}
|
|
762
|
-
|
|
762
|
+
`,Mi=ue.p`
|
|
763
763
|
${e=>k(e)} {
|
|
764
764
|
font-style: normal;
|
|
765
765
|
font-weight: 600;
|
|
@@ -836,7 +836,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
836
836
|
flex-direction: column;
|
|
837
837
|
justify-content: center;
|
|
838
838
|
display: flex;
|
|
839
|
-
`;import
|
|
839
|
+
`;import Je from"react";import{motion as ap}from"framer-motion";import Xe from"styled-components";var qi=Xe.div`
|
|
840
840
|
border: 1px solid #fafafa;
|
|
841
841
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
842
842
|
border-radius: 14px;
|
|
@@ -844,13 +844,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
844
844
|
display: flex;
|
|
845
845
|
flex-direction: column;
|
|
846
846
|
overflow: hidden;
|
|
847
|
-
`,Ki=
|
|
847
|
+
`,Ki=Xe.div`
|
|
848
848
|
display: flex;
|
|
849
849
|
flex-wrap: wrap;
|
|
850
850
|
justify-content: space-between;
|
|
851
851
|
overflow: hidden;
|
|
852
852
|
row-gap: 10px;
|
|
853
|
-
`,Yi=
|
|
853
|
+
`,Yi=Xe.div`
|
|
854
854
|
${e=>k(e)} {
|
|
855
855
|
color: #595959;
|
|
856
856
|
}
|
|
@@ -860,7 +860,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
860
860
|
line-height: 12px;
|
|
861
861
|
letter-spacing: 0.09em;
|
|
862
862
|
margin-bottom: 12px;
|
|
863
|
-
`,Xi=
|
|
863
|
+
`,Xi=Xe.div`
|
|
864
864
|
${e=>k(e)} {
|
|
865
865
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
866
866
|
background: #ffffff;
|
|
@@ -873,7 +873,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
873
873
|
|
|
874
874
|
max-width: 150px;
|
|
875
875
|
min-width: 200px;
|
|
876
|
-
`,Ji=
|
|
876
|
+
`,Ji=Xe.div`
|
|
877
877
|
${e=>k(e)} {
|
|
878
878
|
background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);
|
|
879
879
|
}
|
|
@@ -885,13 +885,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
885
885
|
justify-content: center;
|
|
886
886
|
align-content: center;
|
|
887
887
|
align-items: center;
|
|
888
|
-
`,Qi=
|
|
888
|
+
`,Qi=Xe.div`
|
|
889
889
|
font-weight: 600;
|
|
890
890
|
font-size: 20px;
|
|
891
891
|
line-height: 24px;
|
|
892
892
|
width: 20px;
|
|
893
893
|
height: 20px;
|
|
894
|
-
`,Zi=
|
|
894
|
+
`,Zi=Xe.div`
|
|
895
895
|
${e=>k(e)} {
|
|
896
896
|
color: #434343;
|
|
897
897
|
}
|
|
@@ -900,20 +900,20 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
900
900
|
line-height: 17px;
|
|
901
901
|
margin-top: 12px;
|
|
902
902
|
margin-bottom: 8px;
|
|
903
|
-
`,Ri=
|
|
903
|
+
`,Ri=Xe.div`
|
|
904
904
|
${e=>k(e)} {
|
|
905
905
|
color: #8c8c8c;
|
|
906
906
|
}
|
|
907
907
|
font-weight: 400;
|
|
908
908
|
font-size: 12px;
|
|
909
909
|
line-height: 14px;
|
|
910
|
-
`,en=
|
|
910
|
+
`,en=Xe.a`
|
|
911
911
|
color: ${e=>e.color};
|
|
912
912
|
font-size: 12px;
|
|
913
913
|
line-height: 14px;
|
|
914
914
|
font-weight: 400;
|
|
915
915
|
cursor: pointer;
|
|
916
|
-
`;var pp=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=ne();return
|
|
916
|
+
`;var pp=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=ne();return Je.createElement(qi,{style:t,className:l("guideContainer",r)},Je.createElement(Yi,{className:l("guideTitle",r)},o),Je.createElement(Ki,{className:l("guideItemContainer",r)},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",r)},p.icon&&Je.createElement(Ji,{className:l("guideIcon",r)},Je.createElement(Qi,null,p.icon)),Je.createElement(Zi,{className:l("guideItemTitle",r),dangerouslySetInnerHTML:me(p.title)}),Je.createElement(Ri,{className:l("guideItemSubtitle",r),dangerouslySetInnerHTML:me(p.subtitle)}),Je.createElement(en,{className:l("guideItemLink",r),color:i,onClick:()=>{p.primaryButtonUri&&s(p),n&&n(p)}},p.primaryButtonTitle)))))},Zt=pp;var mp=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:r,onClose:n,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:a,guideData:f,guideTitle:c,onGuideButtonClick:u})=>{let w=({stepData:m,handleSecondaryCTAClick:C,handleCTAClick:P})=>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:C,appearance:a,secondary:!0}),N.createElement(ee,{title:m.primaryButtonTitle,onClick:P,appearance:a}))):N.createElement(N.Fragment,null),S={...{default:m=>{var U;if((U=e[y])!=null&&U.StepContent){let M=e[y].StepContent;return N.createElement("div",null,M)}let C=e[y];return N.createElement(w,{stepData:m,handleCTAClick:()=>{C.handlePrimaryButtonClick&&C.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{C.handleSecondaryButtonClick&&C.handleSecondaryButtonClick()}})}},...d},[h,E]=dp(0),y=s??h,A=p??E,F=()=>{var m;return e?!((m=e[y])!=null&&m.type)||!S[e[y].type]?S.default(e[y]):S[e[y].type]({stepData:e[y],primaryColor:a.theme.colorPrimary}):N.createElement(N.Fragment,null)},x=e.filter(m=>m.complete).length;return r?(a.theme.modalContainer||(a.theme.borderRadius&&(Ro.borderRadius=a.theme.borderRadius+"px"),a.theme.modalContainer=Ro),N.createElement(Re,{onClose:n,visible:r,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)},i)),N.createElement(ji,null,N.createElement(_e,{fillColor:a.theme.colorPrimary,style:{width:"100%"},count:x,total:e.length,appearance:a}))),N.createElement(Oi,null,N.createElement(Di,{className:l("checklistStepListContainer",a),appearance:a},e.map((m,C)=>{let P=y===C;return N.createElement(Wi,{selected:P,className:l(`checklistStepListItem${P?"Selected":""}`,a),key:`checklist-guide-step-${m.id??C}`,disabled:m.blocked,onClick:()=>{m.blocked||A(C)},title:m.blocked?"Finish remaining steps to continue":void 0},P&&N.createElement(To,{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:P,className:l(`checklistStepListStepName${P?"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(F,null))),f&&f.length>0&&N.createElement(Zt,{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,i]=fp(t),r=null,n=()=>{r!==null?clearTimeout(r):s(),r=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",n),[d,f.matches]}));i(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}};
|
|
@@ -925,42 +925,42 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
925
925
|
display: flex;
|
|
926
926
|
flex-direction: column;
|
|
927
927
|
transition: max-height 0.25s;
|
|
928
|
-
`,rn=
|
|
928
|
+
`,rn=Qe.div`
|
|
929
929
|
display: flex;
|
|
930
930
|
margin-bottom: 20px;
|
|
931
|
-
`,nn=
|
|
931
|
+
`,nn=Qe.img`
|
|
932
932
|
border-radius: 4px;
|
|
933
933
|
max-height: 260px;
|
|
934
934
|
min-height: 200px;
|
|
935
|
-
`,sn=
|
|
935
|
+
`,sn=Qe.div`
|
|
936
936
|
display: flex;
|
|
937
937
|
flex-direction: row;
|
|
938
938
|
justify-content: space-between;
|
|
939
939
|
align-items: center;
|
|
940
|
-
`,ln=
|
|
940
|
+
`,ln=Qe.p`
|
|
941
941
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
942
942
|
font-style: normal;
|
|
943
943
|
font-weight: 500;
|
|
944
944
|
font-size: 16px;
|
|
945
945
|
line-height: 18px;
|
|
946
946
|
margin-left: 8px;
|
|
947
|
-
`,an=
|
|
947
|
+
`,an=Qe.div`
|
|
948
948
|
padding: 20px;
|
|
949
949
|
cursor: pointer;
|
|
950
950
|
:hover {
|
|
951
951
|
opacity: 0.8;
|
|
952
952
|
}
|
|
953
|
-
`,
|
|
953
|
+
`,Wh=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;
|
|
957
957
|
line-height: 22px;
|
|
958
|
-
`,dn=
|
|
958
|
+
`,dn=Qe.div`
|
|
959
959
|
display: flex;
|
|
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:i,onSecondaryButtonClick:r,appearance:n,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",n)},e.imageUri?fe.createElement(nn,{className:l("stepImage",n),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?fe.createElement(
|
|
963
|
+
`;var cn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:r,appearance:n,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",n)},e.imageUri?fe.createElement(nn,{className:l("stepImage",n),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?fe.createElement(Et,{appearance:n,videoUri:e.videoUri}):null):null,fe.createElement(pn,{className:l("stepSubtitle",n),appearance:n,dangerouslySetInnerHTML:me(e.subtitle)}),fe.createElement(ho,{className:l("checklistCTAContainer",n)},e.secondaryButtonTitle?fe.createElement(ee,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>r(),appearance:n}):null,fe.createElement(ee,{title:e.primaryButtonTitle??"Continue",onClick:()=>i(),appearance:n})))}function a(){if(!s)return null;let u=s[e.type];return u?u(e,n):null}return fe.createElement(on,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:l("checklistStepContainer",n),appearance:n},fe.createElement(sn,{className:l("stepHeader",n)},fe.createElement(dn,null,fe.createElement(wo,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(f=n==null?void 0:n.theme)==null?void 0:f.colorPrimary,appearance:n}),fe.createElement(ln,{appearance:n,className:l("stepTitle",n),dangerouslySetInnerHTML:me(e.title)})),fe.createElement(an,{className:l("stepChevronContainer",n),onClick:()=>o()},fe.createElement(Dt,{style:{...p,transition:"transform 0.1s ease-in-out"},color:(c=n==null?void 0:n.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 ex=$t.div`
|
|
964
964
|
background: #ffffff;
|
|
965
965
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
966
966
|
border-radius: 6px;
|
|
@@ -974,33 +974,33 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
974
974
|
|
|
975
975
|
max-width: 800px;
|
|
976
976
|
min-width: 350px;
|
|
977
|
-
`,mn
|
|
977
|
+
`,mn=$t.div`
|
|
978
978
|
display: flex;
|
|
979
979
|
flex-direction: column;
|
|
980
|
-
`,un
|
|
980
|
+
`,un=$t.h1`
|
|
981
981
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
982
982
|
font-style: normal;
|
|
983
983
|
font-weight: 700;
|
|
984
984
|
font-size: 20px;
|
|
985
985
|
line-height: 24px;
|
|
986
986
|
margin-bottom: 8px;
|
|
987
|
-
`,fn
|
|
987
|
+
`,fn=$t.h2`
|
|
988
988
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
989
989
|
font-weight: 400;
|
|
990
990
|
font-size: 14px;
|
|
991
991
|
line-height: 23px;
|
|
992
992
|
margin: 2px 0 0 0;
|
|
993
|
-
`,gn
|
|
993
|
+
`,gn=$t.div`
|
|
994
994
|
display: block;
|
|
995
995
|
width: 100%;
|
|
996
|
-
`,hn
|
|
996
|
+
`,hn=$t.div`
|
|
997
997
|
display: flex;
|
|
998
998
|
width: 100%;
|
|
999
999
|
flex-direction: column;
|
|
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:i,visible:r,onCompleteStep:n,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,y]=xp(Array(o.length).fill(!0));xn(()=>{let m=[...E];if(s){for(let C=0;C<o.length;C++)if(!o[C].complete){m[C]=!1;break}y(m)}},[]),xn(()=>{A(f)},[f]);let A=m=>{let C=[...E];if(p)for(let P=0;P<E.length;++P)P!==m&&(C[P]=!0);C[m]=!C[m],y(C)};if(!r&&w=="modal")return Pe.createElement(Pe.Fragment,null);let F=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})),x=Pe.createElement(gn,{className:ye(l("checklistContainer",u),T)},o.map((m,C)=>{let P=E[C];return Pe.createElement(cn,{appearance:u,stepData:m,collapsed:P,key:`modal-checklist-${m.id??C}`,onClick:()=>{if(f===C){A(C);return}c(C)},onPrimaryButtonClick:()=>{n&&n(C,m),m.handlePrimaryButtonClick&&m.handlePrimaryButtonClick(),d&&!m.completionCriteria&&C<E.length-1&&E[C+1]&&c(C+1)},onSecondaryButtonClick:()=>{m.handleSecondaryButtonClick&&m.handleSecondaryButtonClick()},customStepTypes:S})}));return w==="inline"?Pe.createElement(hn,{appearance:u,className:ye(l("checklistInlineContainer",u),T)},F,x):Pe.createElement(Pe.Fragment,null,Pe.createElement(
|
|
1003
|
+
`;var Cp=({title:e,subtitle:t,steps:o,onClose:i,visible:r,onCompleteStep:n,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,y]=xp(Array(o.length).fill(!0));xn(()=>{let m=[...E];if(s){for(let C=0;C<o.length;C++)if(!o[C].complete){m[C]=!1;break}y(m)}},[]),xn(()=>{A(f)},[f]);let A=m=>{let C=[...E];if(p)for(let P=0;P<E.length;++P)P!==m&&(C[P]=!0);C[m]=!C[m],y(C)};if(!r&&w=="modal")return Pe.createElement(Pe.Fragment,null);let F=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})),x=Pe.createElement(gn,{className:ye(l("checklistContainer",u),T)},o.map((m,C)=>{let P=E[C];return Pe.createElement(cn,{appearance:u,stepData:m,collapsed:P,key:`modal-checklist-${m.id??C}`,onClick:()=>{if(f===C){A(C);return}c(C)},onPrimaryButtonClick:()=>{n&&n(C,m),m.handlePrimaryButtonClick&&m.handlePrimaryButtonClick(),d&&!m.completionCriteria&&C<E.length-1&&E[C+1]&&c(C+1)},onSecondaryButtonClick:()=>{m.handleSecondaryButtonClick&&m.handleSecondaryButtonClick()},customStepTypes:S})}));return w==="inline"?Pe.createElement(hn,{appearance:u,className:ye(l("checklistInlineContainer",u),T)},F,x):Pe.createElement(Pe.Fragment,null,Pe.createElement(Re,{onClose:i,visible:r,appearance:u,style:{maxWidth:"600px"},headerContent:F},x))},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,7 +1135,7 @@ ${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:i}=Q(),{primaryCTAClickSideEffects:r}=ne(),{theme:n,styleOverrides:s}=i(o),{imageUri:p=null,subtitle:d=null,title:a=null,complete:f=!1,blocked:c=!1}=e,u=()=>{r(e)};return
|
|
1138
|
+
`;var Dn=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=Q(),{primaryCTAClickSideEffects:r}=ne(),{theme:n,styleOverrides:s}=i(o),{imageUri:p=null,subtitle:d=null,title:a=null,complete:f=!1,blocked:c=!1}=e,u=()=>{r(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 Rt from"react";var $n=({numberOfStepsCompleted:e,numberOfSteps:t,appearance:o})=>{let i=t>0?e/t:0,r=200,n=Math.min(r,Math.max(10,Math.round(r*i)));return Rt.createElement(An,{className:l("carouselProgressBar",o)},Rt.createElement(In,{as:We.Loud,style:{marginRight:8}},e," of ",t),Rt.createElement("svg",{height:10,width:r},Rt.createElement("rect",{x:0,y:0,rx:5,width:r,height:10,fill:"#E6E6E6"}),Rt.createElement("rect",{x:0,y:0,rx:5,width:n,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[i,r]=bt(!1),[n,s]=bt(!1);or(()=>{t===!0&&i===!1?r(!0):t===!1&&i===!0&&s(!0)},[t]);let p=()=>{r(!1),s(!1)},d=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return i?ae.createElement(Tn,{style:d,reversed:n,onAnimationEnd:n?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:i})=>{let r=Fp(null),[n,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:y,getFlowStatus:A,isLoading:F,targetingLogicShouldHideFlow:x,getFlow:m}=J();or(()=>{y(o)},[o,F]),or(()=>{if(F)return;let I=S(e),j=E(e),B=h(e);f(I),I.data!==null&&(u(B.sort((D,re)=>Number(D.complete)-Number(re.complete))),d(B.length>3),T(j))},[F]);let C=[];for(let I=0;I<c.length;I+=3)C.push(c.slice(I,I+3));let P=I=>{let j=I.target,B=j.scrollWidth-j.clientWidth,D=Math.ceil(j.scrollLeft);D>0&&n===!1&&s(!0),D===0&&n===!0&&s(!1),D<B&&p===!1&&d(!0),D===B&&p===!0&&d(!1)},$=(I=!0)=>{let j=I?1:-1;r.current!==null&&r.current.scrollBy({left:r.current.clientWidth*j,behavior:"smooth"})},U=null,M=I=>{U!==null?clearTimeout(U):P(I),U=setTimeout(()=>{P(I)},16)};return F?null:ae.createElement(En,{className:ye(l("carouselContainer",t),i)},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:n,onClick:()=>$(!1)}),ae.createElement(Mn,{side:"right",show:p,onClick:$}),ae.createElement(bn,{ref:r,onScroll:M},C.map((I,j)=>ae.createElement(wn,{key:j,style:{flex:`0 0 calc(100% - ${c.length>3?36:0}px)`}},I.map((B,D)=>ae.createElement(Dn,{key:D,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:i,initialSelectedStep:r,className:n,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:y,...A})=>{let{getFlow:F,getFlowSteps:x,markStepCompleted:m,getStepStatus:C,getNumberOfStepsCompleted:P,isLoading:$,targetingLogicShouldHideFlow:U,updateCustomVariables:M,getFlowMetadata:I,isStepBlocked:j,getFlowStatus:B,hasActiveFullPageFlow:D,setHasActiveFullPageFlow:re}=J(),{primaryCTAClickSideEffects:R,secondaryCTAClickSideEffects:_}=ne(),{getOpenFlowState:he,setOpenFlowState:Fe}=ve(),[W,se]=Wn(r||0),[G,L]=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,$]),_n(()=>{d!==void 0&&(xe&&d===!0?re(!0):xe&&d===!1&&re(!1))},[d,T,D]),$)return null;let de=F(e);if(!de||U(de))return null;let oe=x(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&&r===void 0&&P(e)>0){let z=Math.min(P(e),oe.length-1);se(z),L(!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,ro){let dr=W+1<oe.length?oe[W+1]:null;c&&c(z,W,at,dr)===!0&&xe&&g(),f&&f(z,ro,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),C(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:n,autoExpandFirstIncompleteStep:E,autoExpandNextStep:y};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:n}))}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&&F(z)&&(at=x(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:ro=>{Ge(ro,"link",0)},customStepTypes:S,...lt}))}function ce(){if(!V)return v();let z=pe.createElement(Zo,{flowId:e,style:i,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 Eo from"styled-components";var zn=Eo.div`
|
|
1139
1139
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1140
1140
|
border-radius: 8px;
|
|
1141
1141
|
padding: 6px 10px 6px 10px;
|
|
@@ -1162,7 +1162,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
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:i,style:r={},className:n,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:()=>i!==void 0&&i(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...r},className:ye(n??"",l("progressRingContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&ze.createElement(Gn,{className:l("progressRingContainer",s)},ze.createElement(
|
|
1165
|
+
`;import{motion as Ep}from"framer-motion";var Vn=({title:e,count:t,total:o,onClick:i,style:r={},className:n,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:()=>i!==void 0&&i(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...r},className:ye(n??"",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),i!==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 eo from"styled-components";var qn=eo.div`
|
|
1166
1166
|
display: flex;
|
|
1167
1167
|
flex-direction: row;
|
|
1168
1168
|
width: 100%;
|
|
@@ -1191,7 +1191,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1191
1191
|
justify-content: center;
|
|
1192
1192
|
margin-left: 16px;
|
|
1193
1193
|
min-width: 200px;
|
|
1194
|
-
`,
|
|
1194
|
+
`,hC=eo.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:i,count:r,total:n,className:s,style:p})=>
|
|
1203
|
+
`;var Jn=({title:e,subtitle:t,icon:o,appearance:i,count:r,total:n,className:s,style:p})=>it.createElement(it.Fragment,null,it.createElement(qn,{appearance:i,className:ye(l("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&it.createElement(Kn,{className:l("fullWidthProgressBadgeIcon",i)},o),it.createElement(Yn,null,it.createElement(be,{size:"small",appearance:i,title:e,subtitle:t})),it.createElement(Xn,{className:l("fullWidthProgressBadgeProgressContainer",i)},it.createElement(_e,{count:r,total:n,display:"percent",textLocation:"top",fillColor:i.theme.colorPrimary}))));var Ip=({flowId:e,title:t,subtitle:o,icon:i,style:r,onClick:n,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:y}=Q();a=y(a);let{setOpenFlowState:A,getOpenFlowState:F}=ve();if(Ap(()=>{E(p)},[p,S]),S)return null;let x=c(e);if(!x||h(x)||d===!0&&w(e)===X)return null;let m=u(e),C=T(e);return f==="full-width"?nt.createElement(nt.Fragment,null,nt.createElement(ie,{appearance:a}),nt.createElement(Jn,{title:t,subtitle:o,count:C,total:m.length,style:r,className:s,appearance:a,icon:i,onClick:()=>{}})):nt.createElement(nt.Fragment,null,nt.createElement(ie,{appearance:a}),nt.createElement(Vn,{count:C,total:m.length,title:t,style:r,onClick:()=>{A(e,!0),n&&n()},type:f,className:s,appearance:a}))};import Bp from"react";var Np=({flowId:e,style:t,appearance:o,...i})=>{let{getFlow:r,targetingLogicShouldHideFlow:n,getFlowSteps:s}=J(),{mergeAppearanceWithDefault:p}=Q();o=p(o);let d=r(e);if(!d||n(d))return null;let a=s(e);return Bp.createElement(Zt,{steps:a,style:t,appearance:o,...i})};import Ut,{useContext as Gp,useEffect as Vp}from"react";import O,{useEffect as Ao,useLayoutEffect as ls,useRef as Mp,useState as to}from"react";import oo from"styled-components";import{useCallback as Lp,useEffect as Op,useState as Dp}from"react";var ir=(e,t,o,i={x:20,y:20},r)=>{let n=r=="fixed"?0:window.scrollY,s=r=="fixed"?0:window.scrollX;return!e||!e.left||!e.top?{x:0,y:0}:t==="left"?{x:e.left-o+i.x+s,y:e.top-i.y+n}:t==="right"?{x:e.left+e.width+i.x+s,y:e.top-i.y+n}:{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,i]=Dp(Qn),r=Lp(()=>{e&&i($p(e))},[e]);return Op(()=>(r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)),[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
|
}
|
|
@@ -1211,13 +1211,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1211
1211
|
min-width: 300px;
|
|
1212
1212
|
padding: 22px 22px 12px;
|
|
1213
1213
|
z-index: ${e=>e.zIndex};
|
|
1214
|
-
`,es=
|
|
1214
|
+
`,es=st.div`
|
|
1215
1215
|
display: block;
|
|
1216
1216
|
cursor: pointer;
|
|
1217
1217
|
position: absolute;
|
|
1218
1218
|
top: 25px;
|
|
1219
1219
|
right: 22px;
|
|
1220
|
-
`,ts=
|
|
1220
|
+
`,ts=st.img`
|
|
1221
1221
|
${e=>k(e)} {
|
|
1222
1222
|
display: block;
|
|
1223
1223
|
width: 100%;
|
|
@@ -1226,7 +1226,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1226
1226
|
margin-top: ${e=>e.dismissible?"24px":"0px"};
|
|
1227
1227
|
margin-bottom: 16px;
|
|
1228
1228
|
}
|
|
1229
|
-
`,os=
|
|
1229
|
+
`,os=st.div`
|
|
1230
1230
|
${e=>k(e)} {
|
|
1231
1231
|
display: block;
|
|
1232
1232
|
width: 100%;
|
|
@@ -1235,17 +1235,17 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1235
1235
|
margin-top: ${e=>e.dismissible?"24px":"0px"};
|
|
1236
1236
|
margin-bottom: 16px;
|
|
1237
1237
|
}
|
|
1238
|
-
`,rs=
|
|
1238
|
+
`,rs=st.div`
|
|
1239
1239
|
display: flex;
|
|
1240
1240
|
flex-direction: row;
|
|
1241
1241
|
justify-content: space-between;
|
|
1242
1242
|
align-content: center;
|
|
1243
|
-
`,is=
|
|
1243
|
+
`,is=st.div`
|
|
1244
1244
|
display: flex;
|
|
1245
1245
|
flex: 1;
|
|
1246
1246
|
flex-direction: column;
|
|
1247
1247
|
justify-content: center;
|
|
1248
|
-
`,ns=
|
|
1248
|
+
`,ns=st.div`
|
|
1249
1249
|
display: flex;
|
|
1250
1250
|
flex: 2;
|
|
1251
1251
|
flex-shrink: 1;
|
|
@@ -1257,7 +1257,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1257
1257
|
align-content: center;
|
|
1258
1258
|
align-items: center;
|
|
1259
1259
|
}
|
|
1260
|
-
`,ss=
|
|
1260
|
+
`,ss=st.p`
|
|
1261
1261
|
${e=>k(e)} {
|
|
1262
1262
|
font-style: normal;
|
|
1263
1263
|
font-weight: 600;
|
|
@@ -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
|
|
1269
|
+
`;var as=300,ps=100,Up=500,Mt=12,_p=oo.div`
|
|
1270
1270
|
width: 100%;
|
|
1271
1271
|
height: 100%;
|
|
1272
1272
|
border-radius: 9999px;
|
|
@@ -1290,8 +1290,8 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
1292
1292
|
`,Wp=oo.div`
|
|
1293
|
-
width: ${
|
|
1294
|
-
height: ${
|
|
1293
|
+
width: ${Mt}px;
|
|
1294
|
+
height: ${Mt}px;
|
|
1295
1295
|
border-radius: 100px;
|
|
1296
1296
|
background-color: ${e=>e.primaryColor};
|
|
1297
1297
|
z-index: 20;
|
|
@@ -1305,9 +1305,9 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1305
1305
|
align-items: center;
|
|
1306
1306
|
z-index: ${e=>e.zIndex?e.zIndex:90};
|
|
1307
1307
|
`,Hp=oo(ds)`
|
|
1308
|
-
width: ${
|
|
1309
|
-
height: ${
|
|
1310
|
-
`,jp=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:r=!0,primaryColor:n="#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]=to(),[y,A]=to(new Date),F
|
|
1308
|
+
width: ${Mt+12}px;
|
|
1309
|
+
height: ${Mt+12}px;
|
|
1310
|
+
`,jp=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:r=!0,primaryColor:n="#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]=to(),[y,A]=to(new Date),F=Mp(null),[x,m]=to(document.querySelector(e[a].selector)),C=Zn(x,y),[P,$]=to(),[U,M]=to(!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,D=(h==null?void 0:h.height)??ps;ls(()=>{F.current&&E({width:F.current.clientWidth,height:F.current.clientHeight})},[a,y,I]),Ao(()=>{w||M(!0)},[a]);let re=i==="auto"?"right":i,R=ir(C,re,B,s,I),_=C.right+B>(window.innerWidth||document.documentElement.clientWidth),he=C.bottom+ps>(window.innerHeight||document.documentElement.clientHeight);_&&i==="auto"&&(R=ir(C,"left",B,s,I),re="left");let Fe=window.location.pathname.split("/").pop(),W=()=>{let Y=document.querySelector(e[a].selector);P&&P===JSON.stringify(Y==null?void 0:Y.getBoundingClientRect())||(m(Y),A(new Date),Y&&$(JSON.stringify(Y.getBoundingClientRect())))};if(Ao(()=>{let Y=new MutationObserver(W);return Y.observe(document.body,{subtree:!0,childList:!0}),()=>Y.disconnect()},[W]),Ao(()=>{let Y=new MutationObserver(W);return Y.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>Y.disconnect()},[W]),Ao(()=>{let Y=setInterval(()=>{W()},10);return()=>clearInterval(Y)},[W]),ls(()=>{setTimeout(()=>{W()},Up),W()},[a,Fe]),x===null)return O.createElement(O.Fragment,null);if(R.x==0&&R.y==0)return O.createElement(O.Fragment,null);if(!p)return O.createElement(O.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 O.createElement(O.Fragment,null,T&&O.createElement(is,null,O.createElement(ss,{className:l("tooltipStepCounter",c)},a+1," of ",e.length)),O.createElement(ns,{showStepCount:T,className:l("tooltipCTAContainer",c)},e[a].secondaryButtonTitle&&O.createElement(ee,{title:e[a].secondaryButtonTitle,appearance:c,onClick:Se,size:"small",withMargin:!1,secondary:!0}),e[a].primaryButtonTitle&&O.createElement(ee,{title:e[a].primaryButtonTitle,appearance:c,onClick:Y,withMargin:!1,size:"small"})))},G=()=>O.createElement(O.Fragment,null,u&&O.createElement(es,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:l("tooltipClose",c)},O.createElement(Ee,null)),e[a].imageUri&&O.createElement(ts,{dismissible:u,appearance:c,src:e[a].imageUri,className:l("tooltipImageContainer",c)}),e[a].videoUri&&!e[a].imageUri&&O.createElement(os,{dismissible:u,appearance:c,className:l("tooltipVideoContainer",c)},O.createElement(Et,{appearance:c,videoUri:e[a].videoUri})),O.createElement(be,{appearance:c,title:e[a].title,subtitle:e[a].subtitle,size:"small"}),O.createElement(rs,{className:l("tooltipFooter",c)},O.createElement(se,null))),te={...{default:Y=>{var Se;if((Se=e[a])!=null&&Se.StepContent){let lt=e[a].StepContent;return O.createElement("div",null,lt)}return O.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:n}):O.createElement(O.Fragment,null)};if(w&&e[a].complete===!0)return null;let Ce={top:(R==null?void 0:R.y)-Mt,left:(re=="left"?C.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 O.createElement(zp,null,O.createElement(Hp,{style:Ce,zIndex:j,className:l("tourHighlightContainer",c)},r&&e[a].showHighlight!==!1&&O.createElement(O.Fragment,null,O.createElement(Wp,{style:{position:I},onClick:de,primaryColor:c.theme.colorPrimary}),O.createElement(_p,{style:{position:"absolute"},onClick:de,primaryColor:c.theme.colorPrimary}))),O.createElement(ds,{style:{...Ce,left:V()},zIndex:j+1,className:l("tooltipContainerWrapper",c)},U&&O.createElement(Rn,{ref:F,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},O.createElement(xe,null))))},Io=jp;import{Portal as qp}from"react-portal";var Kp=({flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:r,showTooltipsSimultaneously:n=!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:y,markFlowCompleted:A,updateCustomVariables:F,getCurrentStepIndex:x,getStepStatus:m,isStepBlocked:C,getFlowStatus:P,getNumberOfStepsCompleted:$}=J(),{isLoadingUserFlowStateData:U}=Be(),{primaryCTAClickSideEffects:M,secondaryCTAClickSideEffects:I}=ne(),{hasOpenModals:j}=ve(),B=x(e),{openFlowStates:D}=Gp(q),{mergeAppearanceWithDefault:re}=Q();if(o=re(o),Vp(()=>{F(t)},[t,S]),U)return null;let R=w(e);if(!R||h(R)||P(e)==X||j())return null;let _=T(e);if(Object.keys(D).length>0){let L=Object.keys(D).find(te=>D[te]===!0);if(L!==void 0&&L!==e)return Ut.createElement(Ut.Fragment,null)}async function he(L){if(await E(e,L.id),_.map(te=>m(e,te.id)).every(te=>te===Oe)){await A(e);return}if(!a&&B+1<_.length){if(C(e,_[B+1].id))return;await y(e,_[B+1].id)}}function Fe(L,te,xe){let Ce=B+1<_.length?_[B+1]:null;r&&r(L,B,te,Ce),i&&i(L,xe,Ce)}function W(){return _.map(L=>({...L,handleSecondaryButtonClick:async()=>{I(L),L.skippable===!0&&await E(e,L.id,{skipped:!0}),Fe(L,"secondary",B)},handlePrimaryButtonClick:async()=>{(!L.completionCriteria&&(L.autoMarkCompleted||L.autoMarkCompleted===void 0)||L.completionCriteria&&L.autoMarkCompleted===!0)&&await he(L),Fe(L,"primary",B),M(L)}}))}async function se(L){s&&s(),f==="complete-flow"?await A(e):await E(e,L.id)}function G(){c&&c()}return Ut.createElement(qp,null,Ut.createElement(ie,{appearance:o}),n?_.map((L,te)=>Ut.createElement(Io,{key:L.id,appearance:o,steps:W(),selectedStep:te,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>se(L),tooltipPosition:d,showHighlightOnly:a,completedStepsCount:$(e),onComplete:G,...u})):Ut.createElement(Io,{appearance:o,steps:W(),selectedStep:B,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>se(_[B]),tooltipPosition:d,completedStepsCount:$(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
|
|
|
@@ -1325,17 +1325,17 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1325
1325
|
opacity: 0.8;
|
|
1326
1326
|
}
|
|
1327
1327
|
}
|
|
1328
|
-
`,ms=
|
|
1328
|
+
`,ms=wt.span`
|
|
1329
1329
|
${e=>k(e)} {
|
|
1330
1330
|
font-size: 12px;
|
|
1331
1331
|
display: inline-block;
|
|
1332
1332
|
}
|
|
1333
|
-
`,us=
|
|
1333
|
+
`,us=wt.span`
|
|
1334
1334
|
${e=>k(e)} {
|
|
1335
1335
|
font-size: 12px;
|
|
1336
1336
|
display: inline-block;
|
|
1337
1337
|
}
|
|
1338
|
-
`,fs=
|
|
1338
|
+
`,fs=wt.div`
|
|
1339
1339
|
position: fixed;
|
|
1340
1340
|
right: 0;
|
|
1341
1341
|
bottom: 0;
|
|
@@ -1345,7 +1345,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1345
1345
|
flex-direction: column;
|
|
1346
1346
|
align-items: flex-end;
|
|
1347
1347
|
z-index: 50;
|
|
1348
|
-
`,gs=
|
|
1348
|
+
`,gs=wt.button`
|
|
1349
1349
|
${e=>k(e)} {
|
|
1350
1350
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1351
1351
|
background-color: #ffffff;
|
|
@@ -1361,7 +1361,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1361
1361
|
0px 3px 6px -4px rgba(0, 0, 0, 0.12);
|
|
1362
1362
|
border-radius: 45px;
|
|
1363
1363
|
cursor: pointer;
|
|
1364
|
-
`,hs=
|
|
1364
|
+
`,hs=wt.div`
|
|
1365
1365
|
${e=>k(e)} {
|
|
1366
1366
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1367
1367
|
background: #ffffff;
|
|
@@ -1378,7 +1378,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1378
1378
|
position: ${e=>e.type=="inline"?"absolute":"relative"};
|
|
1379
1379
|
top: ${e=>e.type=="inline"?"68px":0};
|
|
1380
1380
|
margin-left: ${e=>e.type=="inline"?"-127px":0};
|
|
1381
|
-
`,xs=
|
|
1381
|
+
`,xs=wt.button`
|
|
1382
1382
|
${e=>k(e)} {
|
|
1383
1383
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1384
1384
|
color: #434343;
|
|
@@ -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:i=!0,type:r="inline",title:n="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:y}=Q();s=y(s),Yp(()=>(document.addEventListener("click",A,!1),()=>{document.removeEventListener("click",A,!1)}),[]);let A=P=>{S.current&&!S.current.contains(P.target)&&E(!1)};if(u)return null;let F=p(e);if(!F||w(F))return null;let x=d(e);if(!x||!i)return null;function m(P
|
|
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:i=!0,type:r="inline",title:n="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:y}=Q();s=y(s),Yp(()=>(document.addEventListener("click",A,!1),()=>{document.removeEventListener("click",A,!1)}),[]);let A=P=>{S.current&&!S.current.contains(P.target)&&E(!1)};if(u)return null;let F=p(e);if(!F||w(F))return null;let x=d(e);if(!x||!i)return null;function m(P,$){!P.completionCriteria&&(P.autoMarkCompleted||P.autoMarkCompleted===void 0)&&a(e,P.id),T(P),o&&o(P,$),E(!1)}function C(){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:r},x.map((P,$)=>Te.createElement(xs,{className:l("floatingWidgetMenuItem",s),key:$,onClick:()=>m(P,$)},P.title)))}return r=="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)},n)),Te.createElement(ws,null,Te.createElement(C,null))):Te.createElement(Qp,null,Te.createElement(fs,{style:t,ref:S},Te.createElement(ws,null,Te.createElement(C,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 Bo from"styled-components";var Fs=Bo.div`
|
|
1399
1399
|
${e=>k(e)} {
|
|
1400
1400
|
display: flex;
|
|
1401
1401
|
flex-direction: column;
|
|
@@ -1462,7 +1462,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1462
1462
|
flex-direction: column;
|
|
1463
1463
|
justify-content: center;
|
|
1464
1464
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1465
|
-
`,
|
|
1465
|
+
`,nr=_t.div`
|
|
1466
1466
|
display: flex;
|
|
1467
1467
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1468
1468
|
align-items: flex-end;
|
|
@@ -1471,12 +1471,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1471
1471
|
:hover {
|
|
1472
1472
|
opacity: 0.8;
|
|
1473
1473
|
}
|
|
1474
|
-
`,
|
|
1474
|
+
`,sr=_t.div`
|
|
1475
1475
|
display: flex;
|
|
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:i,customVariables:r,onButtonClick:n,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:y}=ne(),{mergeAppearanceWithDefault:A}=Q();if(s=A(s),td(()=>{w(r)},[r,c]),c)return null;let F=a(e);if(!F||u(F)||S(e)===X)return null;let x=h(e),m=x.length>0?x[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(
|
|
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:i,customVariables:r,onButtonClick:n,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:y}=ne(),{mergeAppearanceWithDefault:A}=Q();if(s=A(s),td(()=>{w(r)},[r,c]),c)return null;let F=a(e);if(!F||u(F)||S(e)===X)return null;let x=h(e),m=x.length>0?x[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),i&&i()},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:()=>{y(m),n&&n(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),i&&i()},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;
|
|
@@ -1497,7 +1497,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1497
1497
|
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
|
|
1498
1498
|
min-width: 550px;
|
|
1499
1499
|
}
|
|
1500
|
-
`,Ds=
|
|
1500
|
+
`,Ds=Ze.button`
|
|
1501
1501
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1502
1502
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1503
1503
|
// If selected make border color primary and text color color priamry
|
|
@@ -1518,30 +1518,30 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1518
1518
|
display: flex;
|
|
1519
1519
|
justify-content: center;
|
|
1520
1520
|
align-items: center;
|
|
1521
|
-
`,
|
|
1521
|
+
`,lr=Ze.div`
|
|
1522
1522
|
display: flex;
|
|
1523
1523
|
justify-content: flex-end;
|
|
1524
1524
|
margin-top: 24px;
|
|
1525
1525
|
gap: 8px;
|
|
1526
|
-
|
|
1526
|
+
`,$s=Ze.div`
|
|
1527
1527
|
display: flex;
|
|
1528
1528
|
justify-content: space-between;
|
|
1529
1529
|
margin-top: 24px;
|
|
1530
|
-
`,
|
|
1530
|
+
`,ar=Ze.div`
|
|
1531
1531
|
font-size: 12px;
|
|
1532
1532
|
line-height: 16px;
|
|
1533
1533
|
color: ${e=>e.appearance.theme.colorTextDisabled};
|
|
1534
|
-
`,
|
|
1534
|
+
`,pr=Ze.div`
|
|
1535
1535
|
display: flex;
|
|
1536
1536
|
flex-direction: column;
|
|
1537
1537
|
flex: 1;
|
|
1538
|
-
`,
|
|
1538
|
+
`,Ey=Ze.div`
|
|
1539
1539
|
display: flex;
|
|
1540
1540
|
flex-direction: column;
|
|
1541
1541
|
justify-content: center;
|
|
1542
1542
|
align-items: flex-start;
|
|
1543
1543
|
margin-top: 16px;
|
|
1544
|
-
|
|
1544
|
+
`,Ms=Ze.textarea`
|
|
1545
1545
|
${e=>k(e)} {
|
|
1546
1546
|
margin-top: 16px;
|
|
1547
1547
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
@@ -1552,7 +1552,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Ht}${r}.${Ht}${r} { ${Object.entries(n).map
|
|
|
1552
1552
|
width: 100%;
|
|
1553
1553
|
height: 100px;
|
|
1554
1554
|
}
|
|
1555
|
-
`,Us=
|
|
1555
|
+
`,Us=Ze.div`
|
|
1556
1556
|
${e=>k(e)} {
|
|
1557
1557
|
position: absolute;
|
|
1558
1558
|
top: 16px;
|
|
@@ -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:i,appearance:r,className:n,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:y}=Q(),[A,F]=Z.useState(null),[x,m]=Z.useState(""),{hasOpenModals:C,setKeepCompletedFlowOpenDuringSession:P,shouldKeepCompletedFlowOpenDuringSession
|
|
1566
|
+
`;var nd=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,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:y}=Q(),[A,F]=Z.useState(null),[x,m]=Z.useState(""),{hasOpenModals:C,setKeepCompletedFlowOpenDuringSession:P,shouldKeepCompletedFlowOpenDuringSession:$}=ve();if(r=y(r),rd(()=>{w(o)},[o,c]),c)return null;let U=p(e);if(!U||u(U)||S(e)===X||f(e)===1&&!$(e)||C())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:r,title:I.title,subtitle:I.subtitle})),Z.createElement(lr,{className:l("npsNumberButtonContainer",r),appearance:r},Array.from(Array(10).keys()).map(D=>Z.createElement(Ds,{className:l("npsNumberButton",r),selected:A===D+1,key:D,onClick:async()=>{P(e),F(D+1),await a(e,I.id,{score:D+1})},appearance:r},D+1))),Z.createElement($s,{appearance:r},Z.createElement(ar,{appearance:r},"Not likely at all"),Z.createElement(ar,{appearance:r},"Extremely likely")))}function B(){return Z.createElement(Z.Fragment,null,Z.createElement(pr,null,Z.createElement(be,{appearance:r,title:"Why did you choose this score?",size:"large"})),Z.createElement(Ms,{appearance:r,value:x,onChange:D=>{m(D.target.value)},placeHolder:"Add your optional fedback here..."}),Z.createElement(lr,{appearance:r,className:l("npsNumberButtonContainer",r)},Z.createElement(ee,{size:"large",withMargin:!1,onClick:async()=>{await d(e),i&&i(I,1,"primary")},appearance:r,title:I.secondaryButtonTitle||"Skip",secondary:!0}),Z.createElement(ee,{size:"large",withMargin:!1,onClick:async()=>{await a(e,I.id,{feedbackText:x}),await d(e),i&&i(I,1,"primary")},appearance:r,title:I.primaryButtonTitle||"Submit"})))}return Z.createElement(id,null,Z.createElement(ie,{appearance:r}),Z.createElement(Os,{appearance:r,className:ye(l("npsSurveyContainer",r),n),style:s},Z.createElement(Us,{onClick:async()=>{await d(e),t&&t()},className:l("npsSurveyDismissButton",r)},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,Lo as useUser};
|
|
1567
1567
|
//# sourceMappingURL=index.mjs.map
|