@frigade/react 1.32.60 → 1.32.62
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.js +106 -106
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +122 -122
- 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 Da,useEffect as Ro,useState as Ne}from"react";import{ThemeProvider as $a}from"styled-components";import ft,{useContext as La,useEffect as wo,useState as Zo}from"react";import{useCallback as ct,useContext as nl,useEffect as sl}from"react";import Lo,{useMemo as Ks}from"react";var hr="1.32.60 ";var Te="https://api.frigade.com/v1/public/",Ae="NOT_STARTED_STEP",Y="COMPLETED_FLOW",no="ABORTED_FLOW",dt="STARTED_FLOW",Le="NOT_STARTED_FLOW",Oe="COMPLETED_STEP",so="STARTED_STEP";function Me(){let{publicApiKey:e,userId:t}=Lo.useContext(q);return{config:Ks(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":hr,"X-Frigade-SDK-Platform":"React"}}),[e,t])}}var Ys="frigade-last-call-at-",Xs="frigade-last-call-data-";function wt(){let{shouldGracefullyDegrade:e}=Lo.useContext(q);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),zt();let i=Ys+t,n=Xs+t;if(window&&window.localStorage&&o&&o.body&&o.method==="POST"){let s=window.localStorage.getItem(i),p=window.localStorage.getItem(n);if(s&&p&&p==o.body){let c=new Date(s);if(new Date().getTime()-c.getTime()<1e3)return zt()}window.localStorage.setItem(i,new Date().toISOString()),window.localStorage.setItem(n,o.body)}let r;try{r=await fetch(t,o)}catch(s){return zt(s)}return r?r.ok?r:zt(r.statusText):zt()}}function zt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Tt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=Lo.useContext(q);function o(){if(t){console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize");return}e||console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider")}return{verifySDKInitiated:o}}import{useContext as ol,useState as xr}from"react";import{useContext as Qs,useEffect as Zs,useState as Rs}from"react";import el from"swr";import{useContext as Js}from"react";function Pe(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:n}=Js(q);function r(d,u=!1){return e[d]??u}function s(d,u){t(y=>({...y,[d]:u}))}function p(d){t(u=>{let{[d]:y,...E}=u;return{...E}})}function c(d){n.includes(d)||i(u=>[...u,d])}function a(d){return n.includes(d)}function C(){return Object.values(e).some(d=>d)||o}return{getOpenFlowState:r,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:C,setKeepCompletedFlowOpenDuringSession:c,shouldKeepCompletedFlowOpenDuringSession:a}}var tl="unknown";function Ie(){let{config:e}=Me(),{publicApiKey:t,userId:o,organizationId:i,flows:n,setShouldGracefullyDegrade:r}=Qs(q),{resetOpenFlowState:s}=Pe(),[p,c]=Rs(!1),a={data:n.map(S=>({flowId:S.id,flowState:Y,lastStepId:null,userId:o,foreignUserId:o,stepStates:{},shouldTrigger:!1}))},C=S=>fetch(S,e).then(m=>{if(m.ok)return m.json();throw new Error("Failed to fetch user flow states")}).catch(m=>(console.log(`Error fetching ${S}: ${m}. Will gracefully degrade and hide Frigade`),r(!0),a)),{data:d,isLoading:u,mutate:y,error:E}=el(t&&n&&o?`${Te}userFlowStates?foreignUserId=${encodeURIComponent(o)}${i?`&foreignUserGroupId=${encodeURIComponent(i)}`:""}`:null,C,{revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>a,onLoadingSlow:()=>a}),f=d==null?void 0:d.data;Zs(()=>{!p&&!u&&f&&c(!0)},[f,p,u]);async function x(S){if(f){let m=f.find(h=>h.flowId===S);m&&m.flowState!==Y&&(m.flowState=Y),await y(Promise.resolve({...d,data:f}),{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1})}}async function F(S,m,h){if(f){let w=f.find(N=>N.flowId===S);w&&(w.stepStates[m]=h,w.flowState=dt),await y(Promise.resolve({...d,data:f}),{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1})}}async function k(S,m,h){if(f){let w=f.find(N=>N.flowId===S);w&&(w.lastStepId=m,w.stepStates[m]=h,w.flowState=dt),await y({...d,data:f},{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1})}}async function B(S){if(f){let m=f.find(h=>h.flowId===S);m&&m.flowState!==Le&&(m.flowState=Le,m.lastStepId=tl,Object.keys(m.stepStates).forEach(h=>{m.stepStates[h].actionType=Ae,m.stepStates[h].createdAt=new Date().toISOString()}),await y({...d,data:f},{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1}),s(S))}}async function P(S,m){if(f){let h=f.find(w=>w.flowId===S);h&&h.stepStates[m]!==Ae&&(h.stepStates[m]=Ae),await y({...d,data:f},{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:f,isLoadingUserFlowStateData:!p,mutateUserFlowState:y,optimisticallyMarkFlowCompleted:x,optimisticallyMarkFlowNotStarted:B,optimisticallyMarkStepCompleted:F,optimisticallyMarkStepNotStarted:P,optimisticallyMarkStepStarted:k,error:E}}function Wt(){let{config:e}=Me(),{userFlowStatesData:t,mutateUserFlowState:o}=Ie(),{failedFlowResponses:i,setFailedFlowResponses:n,flowResponses:r,setFlowResponses:s}=ol(q),[p,c]=xr(new Set),[a,C]=xr(new Set),d=wt();function u(f){let x=JSON.stringify(f);if(p.has(x))return null;p.add(x),c(p),a.add(f),C(a);let F=r==null?void 0:r.find(k=>k.flowSlug===f.flowSlug&&k.stepId===f.stepId&&k.actionType===f.actionType&&k.createdAt===f.createdAt);return d(`${Te}flowResponses`,{...e,method:"POST",body:x}).then(k=>{k.status!==200&&k.status!==201?(console.log("Failed to send flow response for step "+f.stepId+". Will retry again later."),n([...i,f])):F||s(B=>[...B??[],f])})}async function y(f){f.foreignUserId&&(f.actionType===dt||f.actionType===Le?await u(f):f.actionType===Y?await u(f):f.actionType===so?await u(f):f.actionType===Oe?await u(f):f.actionType===no?await u(f):f.actionType===Ae&&await u(f))}function E(){let f=[];return t==null||t.forEach(x=>{if(x&&x.stepStates&&Object.keys(x.stepStates).length!==0)for(let F in x.stepStates){let k=x.stepStates[F];f.push({foreignUserId:x.foreignUserId,flowSlug:x.flowId,stepId:k.stepId,actionType:k.actionType,data:{},createdAt:new Date(k.createdAt),blocked:k.blocked,hidden:k.hidden})}}),[...f,...r]}return{addResponse:y,setFlowResponses:s,getFlowResponses:E}}import ll from"swr";var rl=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Cr=e=>{let t=rl.exec(e);if(t===null)return null;let o=null;return t.forEach((i,n)=>{let r=il(i,"'","");r.startsWith("flow_")&&(o=r)}),o},il=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function X(){let{config:e}=Me(),{flows:t,setFlows:o,userId:i,publicApiKey:n,customVariables:r,setCustomVariables:s,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:c,setFlowResponses:a,setShouldGracefullyDegrade:C}=nl(q),d={data:[]},{verifySDKInitiated:u}=Tt(),{addResponse:y,getFlowResponses:E}=Wt(),f=g=>fetch(g,e).then(b=>b.ok?b.json():(console.log(`Error fetching ${g} (${b.status}): ${b.statusText}. .Will gracefully degrade and hide Frigade`),C(!0),d)).catch(b=>(console.log(`Error fetching ${g}: ${b}. Will gracefully degrade and hide Frigade`),C(!0),d)),{userFlowStatesData:x,isLoadingUserFlowStateData:F,optimisticallyMarkFlowCompleted:k,optimisticallyMarkFlowNotStarted:B,optimisticallyMarkStepCompleted:P,optimisticallyMarkStepNotStarted:S,optimisticallyMarkStepStarted:m}=Ie(),{data:h,error:w,isLoading:N}=ll(n?`${Te}flows`:null,f,{keepPreviousData:!0});sl(()=>{if(w){console.error(w);return}h&&h.data&&(h.data=o(h.data))},[h,w]);function z(g){if(N)return null;let b=t.find(v=>v.slug===g);return!b&&t.length>0&&!F&&!N?(console.log(`Flow with slug ${g} not found`),null):(b==null?void 0:b.active)===!1?null:b}function W(g){var V;if(!z(g))return[];let b=z(g).data;return b?(b=A(b),(((V=JSON.parse(b))==null?void 0:V.data)??[]).map(de=>{let _=Z(de);return{handleSecondaryButtonClick:()=>{de.skippable===!0&&D(g,de.id,{skipped:!0})},...de,complete:I(g,de.id)===Oe||_>=1,blocked:se(g,de.id),hidden:fe(g,de.id),handlePrimaryButtonClick:()=>{(!de.completionCriteria&&(de.autoMarkCompleted||de.autoMarkCompleted===void 0)||de.completionCriteria&&de.autoMarkCompleted===!0)&&D(g,de.id)},progress:_}}).filter(de=>de.hidden!==!0)):[]}function A(g){return g.replace(/\${(.*?)}/g,(b,v)=>r[v]!==void 0?String(r[v]):"")}function U(g){if(!z(g))return[];let b=z(g).data;return b?(b=A(b),JSON.parse(b)??{}):[]}function $(g,b){s(v=>({...v,[g]:b}))}function O(g){!F&&!N&&g&&JSON.stringify(r)!=JSON.stringify({...r,...g})&&Object.keys(g).forEach(b=>{$(b,g[b])})}let ne=ct(async(g,b,v)=>{u();let V={foreignUserId:i,flowSlug:g,stepId:b,actionType:so,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};oe(V)&&(await m(g,b,V),y(V))},[i,x]),pe=ct(async(g,b,v)=>{u();let V={foreignUserId:i,flowSlug:g,stepId:b,actionType:Ae,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};oe(V)&&(await S(g,b),y(V))},[i,x]),D=ct(async(g,b,v)=>{u();let V={foreignUserId:i,flowSlug:g,stepId:b,actionType:Oe,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};oe(V)&&(await P(g,b,V),y(V))},[i,x]),we=ct(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 B(g),oe(v)&&y(v)},[i,x]),xe=ct(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:dt,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};oe(v)&&y(v)},[i,x]),te=ct(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:Y,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};oe(v)&&(await k(g),y(v))},[i,x]),j=ct(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:no,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};oe(v)&&(await k(g),y(v))},[i,x]);function oe(g){var b;if(!x&&g.actionType===Ae)return!1;if(x){let v=x.find(V=>V.flowId===g.flowSlug);if(g.actionType===Ae&&(!(v!=null&&v.stepStates[g.stepId])||v.stepStates[g.stepId].actionType===Ae)||v&&((b=v.stepStates[g.stepId])==null?void 0:b.actionType)===g.actionType||v&&v.flowState===Y&&g.actionType===Y)return!1}return!0}function I(g,b){let v=ke(g,b);return F?null:v?v.actionType:Ae}function se(g,b){let v=ke(g,b);return v?v.blocked:!1}function fe(g,b){let v=ke(g,b);return v?v.hidden:!1}function ke(g,b){if(F)return null;let v=x==null?void 0:x.find(V=>V.flowId===g);return!v||!v.stepStates[b]?null:v.stepStates[b]??null}function G(g){var v;if(F||!x)return null;if(K(g)===Le)return W(g)[0]??null;let b=(v=x.find(V=>V.flowId===g))==null?void 0:v.lastStepId;return b?W(g).find(V=>V.id===b):null}function ge(g){let b=G(g);if(!b)return 0;let v=W(g).findIndex(V=>V.id===b.id)??0;return I(g,b.id)===Oe&&v<W(g).length-1?v+1:v}function Z(g){if(!g.completionCriteria)return;let b=Cr(g.completionCriteria);if(b===null)return;let v=je(b),V=Ge(b);return V===0?void 0:v/V}function K(g){let b=x==null?void 0:x.find(v=>v.flowId===g);return b?b.flowState:null}function je(g){let b=W(g);return b.length===0?0:b.filter(V=>I(g,V.id)===Oe).length}function Ge(g){return W(g).length}function bt(g){return JSON.parse(t.find(b=>b.slug===g).data)}function H(g){if(F)return!0;if(g!=null&&g.targetingLogic&&x){let b=x.find(v=>v.flowId===g.slug);if(b)return b.shouldTrigger===!1}return!!(g!=null&&g.targetingLogic&&i&&i.startsWith("guest_"))}function Be(g){return!H(z(g))}return{getFlow:z,getFlowData:bt,isLoading:F||N,getStepStatus:I,getFlowSteps:W,getCurrentStepIndex:ge,markStepStarted:ne,markStepCompleted:D,markFlowNotStarted:we,markFlowStarted:xe,markFlowCompleted:te,markFlowAborted:j,markStepNotStarted:pe,getFlowStatus:K,getNumberOfStepsCompleted:je,getNumberOfSteps:Ge,targetingLogicShouldHideFlow:H,setCustomVariable:$,updateCustomVariables:O,customVariables:r,getStepOptionalProgress:Z,getFlowMetadata:U,isStepBlocked:se,isStepHidden:fe,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:c,isFlowAvailableToUser:Be}}import{useCallback as Sr,useContext as al,useEffect as pl}from"react";var Ft="guest_";function Ht(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:n}=al(q),{config:r}=Me(),{mutateUserFlowState:s}=Ie(),p=wt(),{verifySDKInitiated:c}=Tt();pl(()=>{if(e&&!t){if(e.startsWith(Ft))return;let d=`frigade-user-registered-${e}`;localStorage.getItem(d)||(p(`${Te}users`,{...r,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(d,"true"))}},[e,n,t]);let a=Sr(async d=>{c();let u={foreignId:e,properties:d};await p(`${Te}users`,{...r,method:"POST",body:JSON.stringify(u)}),i(y=>({...y,...d})),s()},[e,r,n,s]),C=Sr(async(d,u)=>{c();let E={foreignId:e,events:[{event:d,properties:u}]};await p(`${Te}users`,{...r,method:"POST",body:JSON.stringify(E)}),s()},[e,r,s]);return{userId:e,setUserId:o,addPropertiesToUser:a,trackEventForUser:C}}import{v4 as Oa}from"uuid";import _e,{useEffect as Ba,useState as Aa}from"react";import De,{useEffect as hl}from"react";import po from"styled-components";import dl from"react";import cl from"styled-components";var yr="fr-",Vt="cfr-";function l(e,t){let o=`${yr}${e}`;if(!t)return o;if(t.styleOverrides&&t.styleOverrides[e]){if(typeof t.styleOverrides[e]=="string")return o+" "+t.styleOverrides[e];if(typeof t.styleOverrides[e]=="object")return o+" "+Vt+e}return o}function T(e){if(!e.className||e.className.indexOf(Vt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(yr)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Oo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function Ke(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Oo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Ce(...e){return e.filter(Boolean).join(" ")}function br(e){return e.charAt(0).toUpperCase()+e.slice(1)}var ml=cl.div`
|
|
2
|
+
import gt,{createContext as Da,useEffect as Fo,useState as Ne}from"react";import{ThemeProvider as $a}from"styled-components";import ft,{useContext as La,useEffect as wo,useState as er}from"react";import{useCallback as ct,useContext as nl,useEffect as sl}from"react";import Do,{useMemo as Ks}from"react";var xr="1.32.62 ";var Te="https://api.frigade.com/v1/public/",Ae="NOT_STARTED_STEP",Y="COMPLETED_FLOW",no="ABORTED_FLOW",dt="STARTED_FLOW",Le="NOT_STARTED_FLOW",Oe="COMPLETED_STEP",so="STARTED_STEP";function Me(){let{publicApiKey:e,userId:t}=Do.useContext(q);return{config:Ks(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":xr,"X-Frigade-SDK-Platform":"React"}}),[e,t])}}var Ys="frigade-last-call-at-",Xs="frigade-last-call-data-";function wt(){let{shouldGracefullyDegrade:e}=Do.useContext(q);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),zt();let i=Ys+t,n=Xs+t;if(window&&window.localStorage&&o&&o.body&&o.method==="POST"){let s=window.localStorage.getItem(i),p=window.localStorage.getItem(n);if(s&&p&&p==o.body){let c=new Date(s);if(new Date().getTime()-c.getTime()<1e3)return zt()}window.localStorage.setItem(i,new Date().toISOString()),window.localStorage.setItem(n,o.body)}let r;try{r=await fetch(t,o)}catch(s){return zt(s)}return r?r.ok?r:zt(r.statusText):zt()}}function zt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Tt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=Do.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 ol,useState as Cr}from"react";import{useContext as Qs,useEffect as Zs,useState as Rs}from"react";import el from"swr";import{useContext as Js}from"react";function Pe(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:n}=Js(q);function r(d,u=!1){return e[d]??u}function s(d,u){t(y=>({...y,[d]:u}))}function p(d){t(u=>{let{[d]:y,...E}=u;return{...E}})}function c(d){n.includes(d)||i(u=>[...u,d])}function a(d){return n.includes(d)}function C(){return Object.values(e).some(d=>d)||o}return{getOpenFlowState:r,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:C,setKeepCompletedFlowOpenDuringSession:c,shouldKeepCompletedFlowOpenDuringSession:a}}var tl="unknown";function Ie(){let{config:e}=Me(),{publicApiKey:t,userId:o,organizationId:i,flows:n,setShouldGracefullyDegrade:r}=Qs(q),{resetOpenFlowState:s}=Pe(),[p,c]=Rs(!1),a={data:n.map(S=>({flowId:S.id,flowState:Y,lastStepId:null,userId:o,foreignUserId:o,stepStates:{},shouldTrigger:!1}))},C=S=>fetch(S,e).then(m=>{if(m.ok)return m.json();throw new Error("Failed to fetch user flow states")}).catch(m=>(console.log(`Error fetching ${S}: ${m}. Will gracefully degrade and hide Frigade`),r(!0),a)),{data:d,isLoading:u,mutate:y,error:E}=el(t&&n&&o?`${Te}userFlowStates?foreignUserId=${encodeURIComponent(o)}${i?`&foreignUserGroupId=${encodeURIComponent(i)}`:""}`:null,C,{revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>a,onLoadingSlow:()=>a}),f=d==null?void 0:d.data;Zs(()=>{!p&&!u&&f&&c(!0)},[f,p,u]);async function x(S){if(f){let m=f.find(h=>h.flowId===S);m&&m.flowState!==Y&&(m.flowState=Y),await y(Promise.resolve({...d,data:f}),{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1})}}async function F(S,m,h){if(f){let w=f.find(N=>N.flowId===S);w&&(w.stepStates[m]=h,w.flowState=dt),await y(Promise.resolve({...d,data:f}),{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1})}}async function k(S,m,h){if(f){let w=f.find(N=>N.flowId===S);w&&(w.lastStepId=m,w.stepStates[m]=h,w.flowState=dt),await y({...d,data:f},{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1})}}async function B(S){if(f){let m=f.find(h=>h.flowId===S);m&&m.flowState!==Le&&(m.flowState=Le,m.lastStepId=tl,Object.keys(m.stepStates).forEach(h=>{m.stepStates[h].actionType=Ae,m.stepStates[h].createdAt=new Date().toISOString()}),await y({...d,data:f},{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1}),s(S))}}async function P(S,m){if(f){let h=f.find(w=>w.flowId===S);h&&h.stepStates[m]!==Ae&&(h.stepStates[m]=Ae),await y({...d,data:f},{optimisticData:{...d,data:f},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:f,isLoadingUserFlowStateData:!p,mutateUserFlowState:y,optimisticallyMarkFlowCompleted:x,optimisticallyMarkFlowNotStarted:B,optimisticallyMarkStepCompleted:F,optimisticallyMarkStepNotStarted:P,optimisticallyMarkStepStarted:k,error:E}}function Wt(){let{config:e}=Me(),{userFlowStatesData:t,mutateUserFlowState:o}=Ie(),{failedFlowResponses:i,setFailedFlowResponses:n,flowResponses:r,setFlowResponses:s}=ol(q),[p,c]=Cr(new Set),[a,C]=Cr(new Set),d=wt();function u(f){let x=JSON.stringify(f);if(p.has(x))return null;p.add(x),c(p),a.add(f),C(a);let F=r==null?void 0:r.find(k=>k.flowSlug===f.flowSlug&&k.stepId===f.stepId&&k.actionType===f.actionType&&k.createdAt===f.createdAt);return d(`${Te}flowResponses`,{...e,method:"POST",body:x}).then(k=>{k.status!==200&&k.status!==201?(console.log("Failed to send flow response for step "+f.stepId+". Will retry again later."),n([...i,f])):F||s(B=>[...B??[],f])})}async function y(f){f.foreignUserId&&(f.actionType===dt||f.actionType===Le?await u(f):f.actionType===Y?await u(f):f.actionType===so?await u(f):f.actionType===Oe?await u(f):f.actionType===no?await u(f):f.actionType===Ae&&await u(f))}function E(){let f=[];return t==null||t.forEach(x=>{if(x&&x.stepStates&&Object.keys(x.stepStates).length!==0)for(let F in x.stepStates){let k=x.stepStates[F];f.push({foreignUserId:x.foreignUserId,flowSlug:x.flowId,stepId:k.stepId,actionType:k.actionType,data:{},createdAt:new Date(k.createdAt),blocked:k.blocked,hidden:k.hidden})}}),[...f,...r]}return{addResponse:y,setFlowResponses:s,getFlowResponses:E}}import ll from"swr";var rl=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Sr=e=>{let t=rl.exec(e);if(t===null)return null;let o=null;return t.forEach((i,n)=>{let r=il(i,"'","");r.startsWith("flow_")&&(o=r)}),o},il=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function X(){let{config:e}=Me(),{flows:t,setFlows:o,userId:i,publicApiKey:n,customVariables:r,setCustomVariables:s,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:c,setFlowResponses:a,setShouldGracefullyDegrade:C}=nl(q),d={data:[]},{verifySDKInitiated:u}=Tt(),{addResponse:y,getFlowResponses:E}=Wt(),f=g=>fetch(g,e).then(b=>b.ok?b.json():(console.log(`Error fetching ${g} (${b.status}): ${b.statusText}. .Will gracefully degrade and hide Frigade`),C(!0),d)).catch(b=>(console.log(`Error fetching ${g}: ${b}. Will gracefully degrade and hide Frigade`),C(!0),d)),{userFlowStatesData:x,isLoadingUserFlowStateData:F,optimisticallyMarkFlowCompleted:k,optimisticallyMarkFlowNotStarted:B,optimisticallyMarkStepCompleted:P,optimisticallyMarkStepNotStarted:S,optimisticallyMarkStepStarted:m}=Ie(),{data:h,error:w,isLoading:N}=ll(n?`${Te}flows`:null,f,{keepPreviousData:!0});sl(()=>{if(w){console.error(w);return}h&&h.data&&(h.data=o(h.data))},[h,w]);function W(g){if(N)return null;let b=t.find(v=>v.slug===g);return!b&&t.length>0&&!F&&!N?(console.log(`Flow with slug ${g} not found`),null):(b==null?void 0:b.active)===!1?null:b}function H(g){var _;if(!W(g))return[];let b=W(g).data;return b?(b=A(b),(((_=JSON.parse(b))==null?void 0:_.data)??[]).map(de=>{let z=Z(de);return{handleSecondaryButtonClick:()=>{de.skippable===!0&&D(g,de.id,{skipped:!0})},...de,complete:I(g,de.id)===Oe||z>=1,blocked:se(g,de.id),hidden:fe(g,de.id),handlePrimaryButtonClick:()=>{(!de.completionCriteria&&(de.autoMarkCompleted||de.autoMarkCompleted===void 0)||de.completionCriteria&&de.autoMarkCompleted===!0)&&D(g,de.id)},progress:z}}).filter(de=>de.hidden!==!0)):[]}function A(g){return g.replaceAll(/\${(.*?)}/g,(b,v)=>r[v]===void 0?"":String(r[v]).replace(/[\u00A0-\u9999<>\&]/g,function(_){return"&#"+_.charCodeAt(0)+";"}).replaceAll(/[\\]/g,"\\\\").replaceAll(/[\"]/g,'\\"').replaceAll(/[\/]/g,"\\/").replaceAll(/[\b]/g,"\\b").replaceAll(/[\f]/g,"\\f").replaceAll(/[\n]/g,"\\n").replaceAll(/[\r]/g,"\\r").replaceAll(/[\t]/g,"\\t"))}function U(g){if(!W(g))return[];let b=W(g).data;return b?(b=A(b),JSON.parse(b)??{}):[]}function $(g,b){s(v=>({...v,[g]:b}))}function O(g){!F&&!N&&g&&JSON.stringify(r)!=JSON.stringify({...r,...g})&&Object.keys(g).forEach(b=>{$(b,g[b])})}let ne=ct(async(g,b,v)=>{u();let _={foreignUserId:i,flowSlug:g,stepId:b,actionType:so,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};oe(_)&&(await m(g,b,_),y(_))},[i,x]),pe=ct(async(g,b,v)=>{u();let _={foreignUserId:i,flowSlug:g,stepId:b,actionType:Ae,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};oe(_)&&(await S(g,b),y(_))},[i,x]),D=ct(async(g,b,v)=>{u();let _={foreignUserId:i,flowSlug:g,stepId:b,actionType:Oe,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};oe(_)&&(await P(g,b,_),y(_))},[i,x]),we=ct(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 B(g),oe(v)&&y(v)},[i,x]),xe=ct(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:dt,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};oe(v)&&y(v)},[i,x]),te=ct(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:Y,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};oe(v)&&(await k(g),y(v))},[i,x]),V=ct(async(g,b)=>{u();let v={foreignUserId:i,flowSlug:g,stepId:"unknown",actionType:no,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};oe(v)&&(await k(g),y(v))},[i,x]);function oe(g){var b;if(!x&&g.actionType===Ae)return!1;if(x){let v=x.find(_=>_.flowId===g.flowSlug);if(g.actionType===Ae&&(!(v!=null&&v.stepStates[g.stepId])||v.stepStates[g.stepId].actionType===Ae)||v&&((b=v.stepStates[g.stepId])==null?void 0:b.actionType)===g.actionType||v&&v.flowState===Y&&g.actionType===Y)return!1}return!0}function I(g,b){let v=ke(g,b);return F?null:v?v.actionType:Ae}function se(g,b){let v=ke(g,b);return v?v.blocked:!1}function fe(g,b){let v=ke(g,b);return v?v.hidden:!1}function ke(g,b){if(F)return null;let v=x==null?void 0:x.find(_=>_.flowId===g);return!v||!v.stepStates[b]?null:v.stepStates[b]??null}function G(g){var v;if(F||!x)return null;if(K(g)===Le)return H(g)[0]??null;let b=(v=x.find(_=>_.flowId===g))==null?void 0:v.lastStepId;return b?H(g).find(_=>_.id===b):null}function ge(g){let b=G(g);if(!b)return 0;let v=H(g).findIndex(_=>_.id===b.id)??0;return I(g,b.id)===Oe&&v<H(g).length-1?v+1:v}function Z(g){if(!g.completionCriteria)return;let b=Sr(g.completionCriteria);if(b===null)return;let v=Ve(b),_=Ge(b);return _===0?void 0:v/_}function K(g){let b=x==null?void 0:x.find(v=>v.flowId===g);return b?b.flowState:null}function Ve(g){let b=H(g);return b.length===0?0:b.filter(_=>I(g,_.id)===Oe).length}function Ge(g){return H(g).length}function bt(g){return JSON.parse(t.find(b=>b.slug===g).data)}function j(g){if(F)return!0;if(g!=null&&g.targetingLogic&&x){let b=x.find(v=>v.flowId===g.slug);if(b)return b.shouldTrigger===!1}return!!(g!=null&&g.targetingLogic&&i&&i.startsWith("guest_"))}function Be(g){return!j(W(g))}return{getFlow:W,getFlowData:bt,isLoading:F||N,getStepStatus:I,getFlowSteps:H,getCurrentStepIndex:ge,markStepStarted:ne,markStepCompleted:D,markFlowNotStarted:we,markFlowStarted:xe,markFlowCompleted:te,markFlowAborted:V,markStepNotStarted:pe,getFlowStatus:K,getNumberOfStepsCompleted:Ve,getNumberOfSteps:Ge,targetingLogicShouldHideFlow:j,setCustomVariable:$,updateCustomVariables:O,customVariables:r,getStepOptionalProgress:Z,getFlowMetadata:U,isStepBlocked:se,isStepHidden:fe,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:c,isFlowAvailableToUser:Be}}import{useCallback as yr,useContext as al,useEffect as pl}from"react";var Ft="guest_";function Ht(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:n}=al(q),{config:r}=Me(),{mutateUserFlowState:s}=Ie(),p=wt(),{verifySDKInitiated:c}=Tt();pl(()=>{if(e&&!t){if(e.startsWith(Ft))return;let d=`frigade-user-registered-${e}`;localStorage.getItem(d)||(p(`${Te}users`,{...r,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(d,"true"))}},[e,n,t]);let a=yr(async d=>{c();let u={foreignId:e,properties:d};await p(`${Te}users`,{...r,method:"POST",body:JSON.stringify(u)}),i(y=>({...y,...d})),s()},[e,r,n,s]),C=yr(async(d,u)=>{c();let E={foreignId:e,events:[{event:d,properties:u}]};await p(`${Te}users`,{...r,method:"POST",body:JSON.stringify(E)}),s()},[e,r,s]);return{userId:e,setUserId:o,addPropertiesToUser:a,trackEventForUser:C}}import{v4 as Oa}from"uuid";import _e,{useEffect as Ba,useState as Aa}from"react";import De,{useEffect as hl}from"react";import po from"styled-components";import dl from"react";import cl from"styled-components";var br="fr-",jt="cfr-";function l(e,t){let o=`${br}${e}`;if(!t)return o;if(t.styleOverrides&&t.styleOverrides[e]){if(typeof t.styleOverrides[e]=="string")return o+" "+t.styleOverrides[e];if(typeof t.styleOverrides[e]=="object")return o+" "+jt+e}return o}function T(e){if(!e.className||e.className.indexOf(jt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(br)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function $o(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function Ke(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${$o(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Ce(...e){return e.filter(Boolean).join(" ")}function wr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var ml=cl.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -23,11 +23,11 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
23
23
|
opacity: 1;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
`,
|
|
26
|
+
`,Tr=({onClose:e,appearance:t})=>dl.createElement(ml,{className:l("modalBackground",t),onClick:()=>e()});import Mo from"react";import ul from"styled-components";var fl=ul.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
|
-
`,ve=()=>
|
|
30
|
+
`,ve=()=>Mo.createElement(fl,null,Mo.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 20 20"},Mo.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5 15L15 5M5 5l10 10"})));import{Portal as xl}from"react-portal";import Dr from"react";import Uo from"react";function gl({style:e,className:t}){return Uo.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"54",height:"14",fill:"none",viewBox:"0 0 54 14",style:e,className:t},Uo.createElement("path",{fill:"currentColor",d:"M16.293 3.476v1.036h1.593v1.256h-1.593v5.098h-1.41V5.768H14V4.512h.883V3.244c0-.67.294-1.744 1.777-1.744.515 0 .969.049 1.361.146l-.233 1.232a5.939 5.939 0 00-.833-.073c-.442 0-.662.22-.662.67zm6.534.975V5.83c-.846 0-1.63.159-2.342.476v4.56h-1.41V4.513h1.263l.086.61c.846-.451 1.655-.67 2.403-.67zm2.505-.951c-.331.33-.944.33-1.287 0a.93.93 0 01-.246-.659c0-.268.086-.487.246-.646.343-.33.956-.33 1.287 0 .343.33.343.964 0 1.305zm.061 7.366h-1.41V4.512h1.41v6.354zm6.928-5.756c.246.146.368.402.368.756v4.976c0 1.804-.858 2.658-2.672 2.658-.92 0-1.753-.146-2.514-.439l.417-1.073c.674.22 1.336.33 1.974.33.98 0 1.385-.379 1.385-1.403v-.171c-.588.134-1.09.207-1.52.207-.907 0-1.655-.305-2.231-.902-.576-.598-.87-1.39-.87-2.354 0-.963.294-1.756.87-2.354.576-.61 1.324-.914 2.231-.914 1.005 0 1.864.232 2.562.683zm-2.488 4.634a5.15 5.15 0 001.446-.22V5.951a3.695 3.695 0 00-1.446-.292c-1.08 0-1.778.841-1.778 2.048 0 1.22.699 2.037 1.778 2.037zm7.34-5.317c1.52 0 2.28.878 2.28 2.634v3.805h-1.275l-.073-.524c-.601.414-1.288.621-2.084.621-1.263 0-2.06-.658-2.06-1.731 0-1.269 1.25-2.025 3.408-2.025.135 0 .503.013.662.013v-.171c0-1.012-.343-1.451-1.115-1.451-.675 0-1.435.158-2.256.475l-.466-1.012c1.017-.427 2.01-.634 2.979-.634zm-1.839 4.756c0 .427.343.695 1.017.695.528 0 1.251-.22 1.68-.512V8.22h-.441c-1.508 0-2.256.317-2.256.963zm9.953-4.549v-2.83h1.41v7.72c0 .354-.123.598-.368.757-.71.45-1.57.67-2.562.67-.907 0-1.655-.305-2.231-.902-.577-.61-.87-1.39-.87-2.354 0-.963.293-1.756.87-2.354.576-.61 1.324-.914 2.23-.914.43 0 .933.073 1.521.207zM43.84 9.72c.503 0 .981-.098 1.447-.293V5.854a5.15 5.15 0 00-1.447-.22c-1.078 0-1.777.817-1.777 2.037s.699 2.049 1.777 2.049zM54 7.866v.439h-4.573c.184.963.858 1.512 1.827 1.512.613 0 1.275-.146 1.986-.451l.466 1.024c-.87.378-1.729.573-2.575.573-.931 0-1.692-.304-2.268-.902-.576-.61-.87-1.402-.87-2.366 0-.975.294-1.768.87-2.366.576-.597 1.324-.902 2.244-.902.968 0 1.691.33 2.17.975.478.647.723 1.464.723 2.464zm-4.61-.586h3.298c-.086-1.073-.613-1.731-1.581-1.731-.969 0-1.582.695-1.717 1.731z"}),Uo.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M1.196 1.229A4.009 4.009 0 014.08 0l4.092.027C9.183.027 10 .867 10 1.904c0 .6-.273 1.133-.7 1.478-.31.25-.7.399-1.126.4h-.001l-4.09-.027h-.002a4.804 4.804 0 00-2.614.77A4.986 4.986 0 000 5.974v-1.78C0 3.036.456 1.988 1.196 1.23zm4.525 4.65a4.282 4.282 0 00-1.184 2.513l3.637.023c.131 0 .259-.015.382-.042h.002c.81-.178 1.42-.908 1.44-1.788v-.046a1.9 1.9 0 00-.533-1.328 1.813 1.813 0 00-.908-.508h-.002l-.002-.001a1.68 1.68 0 00-.366-.042A4.084 4.084 0 005.72 5.88zm-4.525-.016A4.235 4.235 0 000 8.829C0 10.997 1.601 12.78 3.654 13V9.265h-.005l.005-.439v-.437h.023a5.175 5.175 0 011.439-3.13 5.05 5.05 0 01.72-.614l-1.754-.011H4.08c-.787 0-1.521.229-2.144.625a4.11 4.11 0 00-.74.603z",clipRule:"evenodd"}))}var Fr=gl;import _o from"styled-components";import ot from"styled-components";var lo=ot.div`
|
|
31
31
|
${e=>T(e)} {
|
|
32
32
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
33
33
|
}
|
|
@@ -38,13 +38,13 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
38
38
|
min-width: 300px;
|
|
39
39
|
padding: 22px 22px 12px;
|
|
40
40
|
z-index: ${e=>e.zIndex};
|
|
41
|
-
`,
|
|
41
|
+
`,kr=ot.div`
|
|
42
42
|
display: block;
|
|
43
43
|
cursor: pointer;
|
|
44
44
|
position: absolute;
|
|
45
45
|
top: 12px;
|
|
46
46
|
right: 12px;
|
|
47
|
-
`,
|
|
47
|
+
`,Pr=ot.img`
|
|
48
48
|
${e=>T(e)} {
|
|
49
49
|
display: block;
|
|
50
50
|
width: 100%;
|
|
@@ -53,7 +53,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
53
53
|
margin-top: ${e=>e.dismissible?"24px":"0px"};
|
|
54
54
|
margin-bottom: 16px;
|
|
55
55
|
}
|
|
56
|
-
`,
|
|
56
|
+
`,vr=ot.div`
|
|
57
57
|
${e=>T(e)} {
|
|
58
58
|
display: block;
|
|
59
59
|
width: 100%;
|
|
@@ -62,17 +62,17 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
62
62
|
margin-top: ${e=>e.dismissible?"24px":"0px"};
|
|
63
63
|
margin-bottom: 16px;
|
|
64
64
|
}
|
|
65
|
-
`,
|
|
65
|
+
`,Er=ot.div`
|
|
66
66
|
display: flex;
|
|
67
67
|
flex-direction: row;
|
|
68
68
|
justify-content: space-between;
|
|
69
69
|
align-content: center;
|
|
70
|
-
`,
|
|
70
|
+
`,Br=ot.div`
|
|
71
71
|
display: flex;
|
|
72
72
|
flex: 1;
|
|
73
73
|
flex-direction: column;
|
|
74
74
|
justify-content: center;
|
|
75
|
-
`,
|
|
75
|
+
`,Ar=ot.div`
|
|
76
76
|
display: flex;
|
|
77
77
|
flex: 2;
|
|
78
78
|
flex-shrink: 1;
|
|
@@ -84,7 +84,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
84
84
|
align-content: center;
|
|
85
85
|
align-items: center;
|
|
86
86
|
}
|
|
87
|
-
`,
|
|
87
|
+
`,Ir=ot.p`
|
|
88
88
|
${e=>T(e)} {
|
|
89
89
|
font-style: normal;
|
|
90
90
|
font-weight: 600;
|
|
@@ -93,7 +93,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
93
93
|
color: #808080;
|
|
94
94
|
}
|
|
95
95
|
margin: 0;
|
|
96
|
-
`;var
|
|
96
|
+
`;var Nr=_o.div`
|
|
97
97
|
background-color: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
98
98
|
position: absolute;
|
|
99
99
|
bottom: -47px;
|
|
@@ -104,7 +104,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
104
104
|
align-items: center;
|
|
105
105
|
justify-content: center;
|
|
106
106
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
107
|
-
`,
|
|
107
|
+
`,Lr=_o(lo)`
|
|
108
108
|
background-color: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
109
109
|
position: absolute;
|
|
110
110
|
bottom: -60px;
|
|
@@ -117,7 +117,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
117
117
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
118
118
|
padding: 0;
|
|
119
119
|
z-index: ${e=>e.zIndex};
|
|
120
|
-
`,
|
|
120
|
+
`,Or=_o.div`
|
|
121
121
|
display: flex;
|
|
122
122
|
justify-content: center;
|
|
123
123
|
align-items: center;
|
|
@@ -126,7 +126,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
126
126
|
font-size: 12px;
|
|
127
127
|
line-height: 18px;
|
|
128
128
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
129
|
-
`;function ao({appearance:e}){return
|
|
129
|
+
`;function ao({appearance:e}){return Dr.createElement(Or,{className:l("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",Dr.createElement(Fr,null))}var Cl=po.div`
|
|
130
130
|
${e=>T(e)} {
|
|
131
131
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
132
132
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -188,7 +188,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
188
188
|
::-webkit-scrollbar {
|
|
189
189
|
display: none;
|
|
190
190
|
}
|
|
191
|
-
`,rt=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:n,appearance:r,dismissible:s=!0,showFrigadeBranding:p=!1})=>(hl(()=>{let c=a=>{a.key==="Escape"&&e()};return document.addEventListener("keydown",c),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",c)}},[e,t]),t?De.createElement(xl,null,De.createElement(
|
|
191
|
+
`,rt=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:n,appearance:r,dismissible:s=!0,showFrigadeBranding:p=!1})=>(hl(()=>{let c=a=>{a.key==="Escape"&&e()};return document.addEventListener("keydown",c),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",c)}},[e,t]),t?De.createElement(xl,null,De.createElement(Tr,{appearance:r,onClose:()=>{s&&e()}}),De.createElement(Cl,{appearance:r,className:l("modalContainer",r),styleOverrides:i},s&&De.createElement(yl,{className:l("modalClose",r),onClick:()=>e(),appearance:r},De.createElement(ve,null)),o&&De.createElement(Sl,null,o),De.createElement(bl,null,n),p&&De.createElement(Nr,{appearance:r,className:l("poweredByFrigadeRibbon",r)},De.createElement(ao,{appearance:r})))):De.createElement(De.Fragment,null));import it,{useEffect as wl}from"react";import co from"styled-components";import{Portal as Tl}from"react-portal";var Fl=co.div`
|
|
192
192
|
${e=>T(e)} {
|
|
193
193
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
194
194
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -225,7 +225,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
225
225
|
::-webkit-scrollbar {
|
|
226
226
|
display: none;
|
|
227
227
|
}
|
|
228
|
-
|
|
228
|
+
`,$r=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:n})=>(wl(()=>{let r=s=>{s.key==="Escape"&&e()};return document.addEventListener("keydown",r),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",r)}},[e,t]),t?it.createElement(Tl,null,it.createElement(Fl,{appearance:n,className:l("cornerModalContainer",n)},it.createElement(Pl,{className:l("cornerModalClose",n),onClick:()=>e()},it.createElement(ve,null)),o&&it.createElement(kl,null,o),it.createElement(vl,null,i))):it.createElement(it.Fragment,null));import{useContext as El}from"react";function J(){let{defaultAppearance:e}=El(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 Kt,{useEffect as Zl,useState as qo}from"react";import Ko from"styled-components";import fo,{useEffect as Bl,useState as Hr}from"react";import Ho from"styled-components";import mo from"styled-components";var Mr=mo.label`
|
|
229
229
|
${e=>T(e)} {
|
|
230
230
|
font-size: 14px;
|
|
231
231
|
line-height: 20px;
|
|
@@ -233,14 +233,14 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
233
233
|
margin-top: 10px;
|
|
234
234
|
}
|
|
235
235
|
display: flex;
|
|
236
|
-
`,
|
|
236
|
+
`,Ur=mo.label`
|
|
237
237
|
${e=>T(e)} {
|
|
238
238
|
font-size: 12px;
|
|
239
239
|
line-height: 20px;
|
|
240
240
|
margin-bottom: 5px;
|
|
241
241
|
}
|
|
242
242
|
display: flex;
|
|
243
|
-
`,
|
|
243
|
+
`,_r=mo.span`
|
|
244
244
|
font-weight: 400;
|
|
245
245
|
font-size: 14px;
|
|
246
246
|
line-height: 22px;
|
|
@@ -253,11 +253,11 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
253
253
|
align-items: flex-start;
|
|
254
254
|
justify-content: left;
|
|
255
255
|
margin-bottom: 10px;
|
|
256
|
-
`;import
|
|
256
|
+
`;import zo from"react";var Ye={theme:{colorPrimary:"#000000",colorText:"#000000",colorBackground:"#ffffff",colorBackgroundSecondary:"#d2d2d2",colorTextOnPrimaryBackground:"#ffffff",colorTextSecondary:"#505050",colorTextDisabled:"#999999",colorBorder:"#E5E5E5",colorTextError:"#c00000",borderRadius:20}};function nt({title:e,required:t,appearance:o=Ye}){return e?zo.createElement(uo,null,t?zo.createElement(_r,{className:l("formLabelRequired",o),appearance:o},"*"):null,zo.createElement(Mr,{className:l("formLabel",o)},e)):null}import zr from"react";function kt({title:e,appearance:t}){return e?zr.createElement(uo,null,zr.createElement(Ur,{className:l("formSubLabel",t)},e)):null}import{z as Wo}from"zod";function Wr(e,t){try{if(t){if(t.type=="number"){let o=Wo.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=Wo.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 Wo.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 Al=Ho.div`
|
|
257
257
|
display: flex;
|
|
258
258
|
flex-direction: column;
|
|
259
259
|
width: 100%;
|
|
260
|
-
`,
|
|
260
|
+
`,jo=Ho.input`
|
|
261
261
|
${e=>T(e)} {
|
|
262
262
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
263
263
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -273,7 +273,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
273
273
|
box-sizing: border-box;
|
|
274
274
|
padding: 0 10px;
|
|
275
275
|
margin-bottom: 10px;
|
|
276
|
-
`,Il=
|
|
276
|
+
`,Il=Ho.textarea`
|
|
277
277
|
${e=>T(e)} {
|
|
278
278
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
279
279
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -289,13 +289,13 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
289
289
|
min-height: 70px;
|
|
290
290
|
box-sizing: border-box;
|
|
291
291
|
margin-bottom: 10px;
|
|
292
|
-
`;function
|
|
292
|
+
`;function Vo({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:n}){let r=e,[s,p]=Hr((n==null?void 0:n.text)||""),[c,a]=Hr(!1),C=jo;Bl(()=>{s===""&&!c&&(a(!0),d(""))},[]);function d(y){if(p(y),o({text:y}),r.required===!0&&y.trim()===""){i([{id:r.id,message:`${r.title} is required`}]);return}let E=Wr(y,r.validation);if(E){i([{id:r.id,message:E}]);return}i([])}r.multiline&&(C=Il);function u(){var y;switch((y=r==null?void 0:r.validation)==null?void 0:y.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return fo.createElement(Al,null,fo.createElement(nt,{title:r.title,required:r.required,appearance:t.appearance}),fo.createElement(C,{className:l("inputComponent",t.appearance),value:s,onChange:y=>{d(y.target.value)},appearance:t.appearance,placeholder:r.placeholder,type:u()}),fo.createElement(kt,{title:r.subtitle,appearance:t.appearance}))}import Ue,{useEffect as jr,useState as Vr}from"react";import Gr from"styled-components";var Nl=Gr.div`
|
|
293
293
|
display: flex;
|
|
294
294
|
flex-direction: column;
|
|
295
295
|
width: 100%;
|
|
296
296
|
-webkit-appearance: none;
|
|
297
297
|
appearance: none;
|
|
298
|
-
`,Ll=
|
|
298
|
+
`,Ll=Gr.select`
|
|
299
299
|
${e=>T(e)} {
|
|
300
300
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
301
301
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -319,15 +319,15 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
319
319
|
background-repeat: no-repeat;
|
|
320
320
|
background-size: 1.5em 1.5em;
|
|
321
321
|
-webkit-print-color-adjust: exact;
|
|
322
|
-
`,go="null";function
|
|
322
|
+
`,go="null";function qr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var C,d,u,y,E,f;let r=e,[s,p]=Vr(((C=i==null?void 0:i.choice)==null?void 0:C[0])||""),[c,a]=Vr(!1);return jr(()=>{var x,F,k,B;if(s===""&&!c){if(a(!0),r.requireSelection){p(go);return}if(r.defaultValue&&((x=r.props.options)!=null&&x.find(P=>P.id===r.defaultValue))){let P=(F=r.props.options)==null?void 0:F.find(S=>S.id===r.defaultValue);p(P.id),o({choice:[P.id]})}else p(((k=r.props.options)==null?void 0:k[0].id)||""),o({choice:[((B=r.props.options)==null?void 0:B[0].id)||""]})}},[]),jr(()=>{r.requireSelection&&s===go?n([{message:"Please select an option",id:r.id}]):n([])},[s]),Ue.createElement(Nl,null,Ue.createElement(nt,{title:r.title,required:!1,appearance:t.appearance}),Ue.createElement(Ll,{value:s,onChange:x=>{p(x.target.value),o({choice:[x.target.value]})},placeholder:r.placeholder,appearance:t.appearance,className:l("multipleChoiceSelect",t.appearance)},r.requireSelection&&Ue.createElement("option",{key:go,value:go},"Select an option"),(d=r.props.options)==null?void 0:d.map(x=>Ue.createElement("option",{key:x.id,value:x.id},x.title))),((y=(u=r.props.options)==null?void 0:u.find(x=>x.id===s))==null?void 0:y.isOpenEnded)&&Ue.createElement(Ue.Fragment,null,Ue.createElement(nt,{title:((f=(E=r.props.options)==null?void 0:E.find(x=>x.id===s))==null?void 0:f.openEndedLabel)??"Please specify",required:!1,appearance:t.appearance}),Ue.createElement(jo,{type:"text",placeholder:"Enter your answer here",onChange:x=>{o({choice:[x.target.value]})},appearance:t.appearance})),Ue.createElement(kt,{title:r.subtitle,appearance:t.appearance}))}import qt,{useEffect as Go,useState as Yr}from"react";import Xr from"styled-components";import Gt from"react";import Vt from"react";import{motion as Ol}from"framer-motion";var Kr=({color:e,percentage:t,size:o})=>{let i=o*.5-2,n=2*Math.PI*i,r=(1-t)*n,s={duration:.3,delay:0,ease:"easeIn"},p={hidden:{strokeDashoffset:n,transition:s},show:{strokeDashoffset:r,transition:s}};return Vt.createElement(Ol.circle,{r:i,cx:o*.5,cy:o*.5,fill:"transparent",stroke:r!==n?e:"",strokeWidth:"3px",strokeDasharray:n,strokeDashoffset:t?r:0,variants:p,transition:s,initial:"hidden",animate:"show"})},Dl=({fillColor:e,size:t,percentage:o,children:i,bgColor:n="#D9D9D9",className:r,style:s})=>Vt.createElement("svg",{style:s,className:r,width:t,height:t,overflow:"visible"},Vt.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},Vt.createElement(Kr,{color:n,size:t}),Vt.createElement(Kr,{color:e,percentage:o,size:t})),i),Pt=Dl;import $l from"styled-components";var Ml=({color:e="#FFFFFF"})=>Gt.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Gt.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),Ul={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},_l={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},zl={border:"1px solid #000000",color:"#FFFFFF"},Wl={border:"1px solid #E6E6E6"},Hl={color:"#FFFFFF"},jl={border:"3px solid #D9D9D9"},Vl=e=>e==="square"?Ul:_l,Gl=(e,t)=>e==="square"?t?zl:Wl:t?Hl:jl,ql=$l.div`
|
|
323
323
|
${e=>Ke(e)}
|
|
324
|
-
`,Xe=({value:e,type:t="square",primaryColor:o="#000000",progress:i,appearance:n=Ye,style:r,className:s})=>{let p=
|
|
324
|
+
`,Xe=({value:e,type:t="square",primaryColor:o="#000000",progress:i,appearance:n=Ye,style:r,className:s})=>{let p=Vl(t),c=Gl(t,e);return e===!0?p={...p,...c,backgroundColor:o,borderColor:t==="square"?o:"none"}:p={...p,...c},e!==!0&&t==="round"&&i!==void 0&&i!==1?Gt.createElement(Pt,{fillColor:o,percentage:i,size:22}):Gt.createElement(ql,{styleOverrides:p,style:r,role:"checkbox",className:Ce(l("checkIconContainer",n),l(e?"checkIconContainerChecked":"checkIconContainerUnchecked",n),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&Gt.createElement(Ml,{color:"#FFFFFF"}))};var Kl=Xr.div`
|
|
325
325
|
display: flex;
|
|
326
326
|
flex-direction: column;
|
|
327
327
|
width: 100%;
|
|
328
328
|
-webkit-appearance: none;
|
|
329
329
|
appearance: none;
|
|
330
|
-
`,Yl=
|
|
330
|
+
`,Yl=Xr.button`
|
|
331
331
|
${e=>T(e)} {
|
|
332
332
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
333
333
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -352,7 +352,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
352
352
|
height: 60px;
|
|
353
353
|
padding: 0 18px;
|
|
354
354
|
margin-bottom: 10px;
|
|
355
|
-
`;function
|
|
355
|
+
`;function Jr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var C;let r=e,[s,p]=Yr((i==null?void 0:i.choice)||[]),[c,a]=Yr(!1);return Go(()=>{s.length==0&&!c&&(a(!0),o({choice:[]}))},[]),Go(()=>{o({choice:s})},[s]),Go(()=>{r.required&&(s.length<r.props.minChoices||s.length>r.props.maxChoices)?n([{message:"",id:r.id}]):n([])},[s]),qt.createElement(Kl,null,qt.createElement(nt,{title:r.title,required:r.required,appearance:t.appearance}),(C=r.props.options)==null?void 0:C.map(d=>qt.createElement(Yl,{appearance:t.appearance,className:l("multipleChoiceListItem",t.appearance),key:d.id,value:d.id,"data-selected":s.includes(d.id),onClick:()=>{if(s.includes(d.id)){p(s.filter(u=>u!==d.id));return}s.length<r.props.maxChoices?p([...s,d.id]):s.length==1&&r.props.maxChoices==1&&p([d.id])}},d.title,qt.createElement(Xe,{type:"round",primaryColor:t.appearance.theme.colorPrimary,value:s.includes(d.id),appearance:t.appearance}))),qt.createElement(kt,{title:r.subtitle,appearance:t.appearance}))}import ho from"react";import Qr from"styled-components";import Xl from"dompurify";function ce(e){return{__html:Xl.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var Jl=Qr.h1`
|
|
356
356
|
${e=>T(e)} {
|
|
357
357
|
font-style: normal;
|
|
358
358
|
font-weight: 600;
|
|
@@ -363,7 +363,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
363
363
|
margin-bottom: 4px;
|
|
364
364
|
color: ${e=>e.appearance.theme.colorText};
|
|
365
365
|
}
|
|
366
|
-
`,Ql=
|
|
366
|
+
`,Ql=Qr.h2`
|
|
367
367
|
${e=>T(e)} {
|
|
368
368
|
font-style: normal;
|
|
369
369
|
font-weight: 400;
|
|
@@ -371,35 +371,35 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
371
371
|
line-height: 20px;
|
|
372
372
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
373
373
|
}
|
|
374
|
-
`;function Se({appearance:e,title:t,subtitle:o,size:i="medium"}){return ho.createElement(ho.Fragment,null,ho.createElement(Jl,{appearance:e,className:l(`${i}Title`,e),dangerouslySetInnerHTML:ce(t),size:i}),o&&ho.createElement(Ql,{appearance:e,className:l(`${i}Subtitle`,e),dangerouslySetInnerHTML:ce(o),size:i}))}var Rl=
|
|
374
|
+
`;function Se({appearance:e,title:t,subtitle:o,size:i="medium"}){return ho.createElement(ho.Fragment,null,ho.createElement(Jl,{appearance:e,className:l(`${i}Title`,e),dangerouslySetInnerHTML:ce(t),size:i}),o&&ho.createElement(Ql,{appearance:e,className:l(`${i}Subtitle`,e),dangerouslySetInnerHTML:ce(o),size:i}))}var Rl=Ko.div`
|
|
375
375
|
display: flex;
|
|
376
376
|
flex-direction: column;
|
|
377
377
|
justify-content: flex-end;
|
|
378
378
|
padding-bottom: 14px;
|
|
379
379
|
overflow: visible;
|
|
380
|
-
`,ea=
|
|
380
|
+
`,ea=Ko.div`
|
|
381
381
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextError}};
|
|
382
382
|
font-size: 12px;
|
|
383
383
|
margin-bottom: 12px;
|
|
384
|
-
`,ta=
|
|
384
|
+
`,ta=Ko.div`
|
|
385
385
|
padding-left: 1px;
|
|
386
386
|
padding-right: 1px;
|
|
387
|
-
`,oa={text:
|
|
387
|
+
`,oa={text:Vo,multipleChoice:qr,multipleChoiceList:Jr};function Zr({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r,customFormElements:s}){var B;let p=t.props,[c,a]=qo([]),[C,d]=qo([]),{userId:u}=Ht(),[y,E]=qo(F()||{}),f={...oa,...s};Zl(()=>{i(c.length===0)},[c,i]);function x(P,S){let m={...y,[P.id]:S};E(m),n(m),window&&window.localStorage&&window.localStorage.setItem(k(),JSON.stringify(m))}function F(){if(window&&window.localStorage){let P=window.localStorage.getItem(k());if(P)return JSON.parse(P)}return{}}function k(){return`frigade-multiInputStepTypeData-${e}-${t.id}-${u}`}return Kt.createElement(ta,{className:l("multiInput",r)},Kt.createElement(Se,{appearance:r,title:t.title,subtitle:t.subtitle}),Kt.createElement(Rl,{className:l("multiInputContainer",r)},(B=p.data)==null?void 0:B.map(P=>{var m;let S=(m=c.reverse().find(h=>h.id===P.id))==null?void 0:m.message;return f[P.type]?Kt.createElement("span",{key:P.id},f[P.type]({formInput:P,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r},onSaveInputData:h=>{!C.includes(P.id)&&h&&(h==null?void 0:h.text)!==""&&d(w=>[...w,P.id]),x(P,h)},inputData:y[P.id],setFormValidationErrors:h=>{a(w=>h.length===0?w.filter(N=>N.id!==P.id):[...w,...h])}}),S&&C.includes(P.id)&&Kt.createElement(ea,{appearance:r,className:l("multiInputValidationError",r)},S)):null})))}import mt from"styled-components";var Rr=mt.div`
|
|
388
388
|
align-items: center;
|
|
389
389
|
display: flex;
|
|
390
390
|
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
391
391
|
padding-top: 14px;
|
|
392
|
-
`,
|
|
392
|
+
`,ei=mt.div`
|
|
393
393
|
color: ${e=>e.appearance.theme.colorTextError};
|
|
394
394
|
font-size: 12px;
|
|
395
|
-
`,
|
|
395
|
+
`,ti=mt.div`
|
|
396
396
|
display: flex;
|
|
397
397
|
gap: 12px;
|
|
398
|
-
`,
|
|
398
|
+
`,oi=mt.div`
|
|
399
399
|
display: flex;
|
|
400
400
|
flex-direction: row;
|
|
401
401
|
flex: 1 1;
|
|
402
|
-
`,
|
|
402
|
+
`,ri=mt.div`
|
|
403
403
|
display: flex;
|
|
404
404
|
// If type is set to large-modal, use padding 60px horizontal, 80px vertical
|
|
405
405
|
// Otherwise, use 4px padding
|
|
@@ -407,11 +407,11 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
407
407
|
flex-grow: 1;
|
|
408
408
|
flex-basis: 0;
|
|
409
409
|
position: relative;
|
|
410
|
-
`,
|
|
410
|
+
`,ii=mt.div`
|
|
411
411
|
padding: ${e=>e.type==="large-modal"?"50px":"0px"};
|
|
412
412
|
position: relative;
|
|
413
413
|
overflow-y: auto;
|
|
414
|
-
`,
|
|
414
|
+
`,ni=mt.div`
|
|
415
415
|
display: flex;
|
|
416
416
|
align-self: stretch;
|
|
417
417
|
flex-grow: 1;
|
|
@@ -423,7 +423,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
423
423
|
background-position: center;
|
|
424
424
|
border-top-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
425
425
|
border-bottom-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
426
|
-
`;import st from"react";import ra from"react";import
|
|
426
|
+
`;import st from"react";import ra from"react";import si from"styled-components";var ia=si.button`
|
|
427
427
|
justify-content: center;
|
|
428
428
|
align-content: center;
|
|
429
429
|
${e=>T(e)} {
|
|
@@ -454,7 +454,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
454
454
|
opacity: 0.3;
|
|
455
455
|
cursor: not-allowed;
|
|
456
456
|
}
|
|
457
|
-
`,xo=
|
|
457
|
+
`,xo=si.div`
|
|
458
458
|
${e=>T(e)} {
|
|
459
459
|
display: flex;
|
|
460
460
|
flex-direction: row;
|
|
@@ -464,9 +464,9 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
464
464
|
margin-right: 8px;
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
`,R=({onClick:e,title:t,style:o,disabled:i,type:n="inline",size:r="medium",secondary:s=!1,appearance:p,withMargin:c=!0,classPrefix:a=""})=>{function C(){let d=s?"buttonSecondary":"button";return a===""?d:`${a}${
|
|
467
|
+
`,R=({onClick:e,title:t,style:o,disabled:i,type:n="inline",size:r="medium",secondary:s=!1,appearance:p,withMargin:c=!0,classPrefix:a=""})=>{function C(){let d=s?"buttonSecondary":"button";return a===""?d:`${a}${wr(d)}`}return ra.createElement(ia,{secondary:s,appearance:p,disabled:i,onClick:e,styleOverrides:o,type:n,withMargin:c,size:r,className:l(C(),p)},t)};var li=({step:e,canContinue:t,appearance:o,onPrimaryClick:i,onSecondaryClick:n,formType:r,selectedStep:s,steps:p,onBack:c,allowBackNavigation:a,errorMessage:C})=>{let d=r==="inline"?"inline":"full-width",u=p.length>1&&s!=0&&a;return st.createElement(st.Fragment,null,C&&st.createElement(ei,{appearance:o,className:l("formCTAError",o)},C),st.createElement(Rr,{showBackButton:u,className:l("formCTAContainer",o)},u&&st.createElement(R,{title:e.backButtonTitle??"\u2190",onClick:c,secondary:!0,withMargin:!1,type:d,appearance:o,style:{width:"90px",maxWidth:"90px"},classPrefix:"back"}),st.createElement(ti,{className:l("ctaWrapper",o)},e.secondaryButtonTitle?st.createElement(R,{title:e.secondaryButtonTitle,onClick:n,secondary:!0,withMargin:!1,type:d,appearance:o}):null," ",e.primaryButtonTitle?st.createElement(R,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:i,type:d,appearance:o}):null)))};import Yo from"react";import na from"styled-components";var sa=na.div`
|
|
468
468
|
text-align: center;
|
|
469
|
-
`,
|
|
469
|
+
`,ai=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:n}=J().mergeAppearanceWithDefault(i);return Yo.createElement(sa,{className:o},Yo.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((r,s)=>Yo.createElement("rect",{key:s,x:16*s,y:0,width:8,height:8,rx:4,fill:t===s?n.colorPrimary:"#E6E6E6"}))))};import ut from"react";import vt from"styled-components";import{useContext as la}from"react";function re(){let e=la(q);function t(n){i(n.primaryButtonUri,n.primaryButtonUriTarget)}function o(n){i(n.secondaryButtonUri,n.secondaryButtonUriTarget)}function i(n,r){if(!n)return;let s=n.startsWith("http")?"_blank":"_self";r&&r!=="_blank"&&(s="_self"),e.navigate(n,s)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:i}}var aa=vt.div`
|
|
470
470
|
display: flex;
|
|
471
471
|
flex-wrap: wrap;
|
|
472
472
|
align-content: center;
|
|
@@ -514,7 +514,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
514
514
|
margin-top: 12px;
|
|
515
515
|
margin-bottom: 16px;
|
|
516
516
|
max-width: 70%;
|
|
517
|
-
`;function
|
|
517
|
+
`;function pi({stepData:e,appearance:t}){var i,n;let{handleUrl:o}=re();return ut.createElement("div",null,ut.createElement(ma,null,e.title),ut.createElement(ua,null,e.subtitle),ut.createElement(aa,null,(n=(i=e.props)==null?void 0:i.links)==null?void 0:n.map(r=>ut.createElement(pa,{key:r.title},ut.createElement(da,{src:r.imageUri}),ut.createElement(ca,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{r.uri&&o(r.uri,r.uriTarget??"_blank")}},r.title)))))}import Bt,{useEffect as ya}from"react";import yo from"styled-components";import Xo from"react";var Co=({style:e,className:t})=>Xo.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},Xo.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),Xo.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 Yt,{useRef as fa,useState as ga}from"react";import So from"styled-components";var ha=So.div`
|
|
518
518
|
display: flex;
|
|
519
519
|
align-items: center;
|
|
520
520
|
justify-content: flex-start;
|
|
@@ -575,23 +575,23 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
575
575
|
max-height: 250px;
|
|
576
576
|
margin-bottom: 24px;
|
|
577
577
|
}
|
|
578
|
-
`;function
|
|
578
|
+
`;function di({stepData:e,appearance:t,setCanContinue:o}){return ya(()=>{o(!0)},[]),Bt.createElement(ba,{className:l("callToActionContainer",t)},Bt.createElement(Ta,{className:l("callToActionTextContainer",t)},Bt.createElement(Se,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&Bt.createElement(wa,{className:l("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&Bt.createElement(Fa,{appearance:t,className:l("callToActionVideo",t)},Bt.createElement(Et,{appearance:t,videoUri:e.videoUri})))}import Je,{useEffect as Jo,useState as Qo}from"react";import lt from"styled-components";var ci=lt.div`
|
|
579
579
|
width: auto;
|
|
580
580
|
display: flex;
|
|
581
581
|
flex-direction: column;
|
|
582
582
|
justify-content: center;
|
|
583
583
|
align-items: center;
|
|
584
584
|
padding: 4px;
|
|
585
|
-
`,
|
|
585
|
+
`,mi=lt.div`
|
|
586
586
|
width: 100%;
|
|
587
587
|
text-align: left;
|
|
588
|
-
`,
|
|
588
|
+
`,ui=lt.h1`
|
|
589
589
|
font-style: normal;
|
|
590
590
|
font-weight: 700;
|
|
591
591
|
font-size: 32px;
|
|
592
592
|
line-height: 38px;
|
|
593
593
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
594
|
-
`,
|
|
594
|
+
`,fi=lt.h1`
|
|
595
595
|
font-style: normal;
|
|
596
596
|
font-weight: 400;
|
|
597
597
|
font-size: 16px;
|
|
@@ -599,7 +599,7 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
599
599
|
margin-top: 16px;
|
|
600
600
|
margin-bottom: 16px;
|
|
601
601
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
602
|
-
`,
|
|
602
|
+
`,gi=lt.div`
|
|
603
603
|
padding-top: 12px;
|
|
604
604
|
padding-bottom: 12px;
|
|
605
605
|
flex-direction: row;
|
|
@@ -610,17 +610,17 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
610
610
|
cursor: pointer;
|
|
611
611
|
border-bottom: ${e=>e.hideBottomBorder?"none":"1px solid #D8D8D8"};
|
|
612
612
|
width: 100%;
|
|
613
|
-
`,
|
|
613
|
+
`,hi=lt.div`
|
|
614
614
|
padding-top: 10px;
|
|
615
615
|
padding-bottom: 10px;
|
|
616
616
|
flex-direction: row;
|
|
617
617
|
display: flex;
|
|
618
618
|
justify-content: flex-start;
|
|
619
|
-
`,
|
|
619
|
+
`,xi=lt.img`
|
|
620
620
|
width: 42px;
|
|
621
621
|
height: 42px;
|
|
622
622
|
margin-right: 12px;
|
|
623
|
-
`,
|
|
623
|
+
`,Ci=lt.p`
|
|
624
624
|
font-style: normal;
|
|
625
625
|
font-weight: 500;
|
|
626
626
|
font-size: 17px;
|
|
@@ -628,8 +628,8 @@ import gt,{createContext as Da,useEffect as Ro,useState as Ne}from"react";import
|
|
|
628
628
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
629
629
|
display: flex;
|
|
630
630
|
align-self: center;
|
|
631
|
-
`;var
|
|
632
|
-
${i=>i.inlineStyles.map(([n,r])=>`.${
|
|
631
|
+
`;var Si=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let n=e.props,[r,s]=Qo([]),[p,c]=Qo(!1),[a,C]=Qo(e.id);return Jo(()=>{r.length==0&&!p&&(c(!0),o({choice:[]}))},[p]),Jo(()=>{a!==e.id&&(C(e.id),s([]))},[e]),Jo(()=>{o({choice:r}),r.length>=n.minChoices?t(!0):t(!1)},[r]),Je.createElement(ci,{className:l("selectListContainer",i)},Je.createElement(mi,null,Je.createElement(ui,{className:l("selectListTitle",i)},e.title),Je.createElement(fi,{appearance:i,className:l("selectListSubtitle",i)},e.subtitle)),n.options.map((d,u)=>{let y=r.includes(d.id);return Je.createElement(gi,{key:`select-item-${u}`,onClick:()=>{if(r.includes(d.id)){s(r.filter(E=>E!==d.id));return}r.length<n.maxChoices?s([...r,d.id]):r.length==1&&n.maxChoices==1&&s([d.id])},hideBottomBorder:u===n.options.length-1,className:l("selectListSelectItem",i)},Je.createElement(hi,{className:l("selectListItemImage",i)},d.imageUri&&Je.createElement(xi,{src:d.imageUri,alt:`select-icon-${u}`}),Je.createElement(Ci,{appearance:i,className:l("selectListSelectItemText",i)},d.title)),Je.createElement(Xe,{appearance:i,value:y,primaryColor:i.theme.colorPrimary}))}))};import ye,{useEffect as Zo,useState as Xt}from"react";import{AnimatePresence as ka,motion as Pa}from"framer-motion";var va=({children:e,id:t,shouldWrap:o=!1})=>ye.createElement(ye.Fragment,null,o?ye.createElement(ka,{initial:!1},ye.createElement(Pa.div,{key:t,initial:{opacity:1,y:"100%"},animate:{opacity:1,y:0},exit:{opacity:0,y:"-100%"},transition:{duration:.5,ease:"easeInOut"},style:{width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:1,overflowY:"auto"}},e)):e),bo=({appearance:e,steps:t,selectedStep:o,customStepTypes:i,customVariables:n,onButtonClick:r,onStepCompletion:s,flowId:p,type:c,hideOnFlowCompletion:a,onComplete:C,setVisible:d,setShowModal:u,onDismiss:y,showPagination:E=!1,customFormElements:f,allowBackNavigation:x,validationHandler:F})=>{var ke;let B={...{linkCollection:pi,multiInput:Zr,callToAction:di,selectList:Si},...i},{primaryCTAClickSideEffects:P,secondaryCTAClickSideEffects:S}=re(),[m,h]=Xt(!1),[w,N]=Xt({}),[W,H]=Xt(!1),[A,U]=Xt(!1),[$,O]=Xt(null),ne=t[o]??null,{markStepCompleted:pe,markStepStarted:D,isLoading:we,updateCustomVariables:xe,markFlowCompleted:te}=X();Zo(()=>{xe(n)},[n,we]),Zo(()=>{window&&x&&!A&&(window.location.hash=t[o].id,U(!0))},[x,A,U]),Zo(()=>{var G;if(window&&((G=window==null?void 0:window.location)!=null&&G.hash)&&window.location.hash.replace("#","")!==t[o].id){let ge=window.location.hash.replace("#",""),Z=t.findIndex(K=>K.id===ge);Z!==-1&&D(p,t[Z].id)}},[(ke=window==null?void 0:window.location)==null?void 0:ke.hash,D,o,t]);function V(){return{data:w[t[o].id]??{},stepId:t[o].id,customVariables:n}}function oe(G,ge,Z){let K=o+1<t.length?t[o+1]:null;r&&r(G,o,ge,K),s&&s(G,Z,K,w,V())}function I(G,ge){N(Z=>{let K={};return K[G.id]=ge,{...Z,...K}})}function se(G){return G.selectedStep.imageUri?ye.createElement(ni,{image:G.selectedStep.imageUri,appearance:e,className:l("formContainerSidebarImage",e)}):null}let fe=ye.createElement(li,{step:t[o],canContinue:m&&!W,formType:c,selectedStep:o,appearance:e,onPrimaryClick:async()=>{if(H(!0),F){let ge=await F(t[o],o,t[o+1],w,V());if(ge){O(ge),H(!1);return}else O(null)}let G={...V()};await pe(p,t[o].id,G),o+1<t.length&&await D(p,t[o+1].id),oe(t[o],"primary",o),o+1>=t.length&&(C&&C(),y&&y(),a&&(d&&d(!1),u(!1)),await te(p)),P(t[o]),H(!1),window&&x&&o+1<t.length&&(window.location.hash=t[o+1].id)},onSecondaryClick:()=>{oe(t[o],"secondary",o),S(t[o])},onBack:async()=>{o-1>=0&&(H(!0),await D(p,t[o-1].id),H(!1))},steps:t,allowBackNavigation:x,errorMessage:$});return ye.createElement(ye.Fragment,null,ye.createElement(oi,{className:l("formContainer",e)},ye.createElement(ri,null,ye.createElement(va,{id:o,shouldWrap:c==="large-modal"},ye.createElement(ii,{key:ne.id,type:c,className:l("formContent",e)},t.map(G=>{let ge=B[G.type];return ne.id!==G.id?null:ye.createElement(ge,{key:G.id,stepData:G,canContinue:m,setCanContinue:h,onSaveData:Z=>{I(G,Z)},appearance:e,customFormElements:f,flowId:p})}),E&&ye.createElement(ai,{className:l("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),fe))),c=="large-modal"&&ye.createElement(se,{selectedStep:t[o]})))};import Jt from"react";import{createGlobalStyle as Ea}from"styled-components";function ee({appearance:e}){if(!e||!e.styleOverrides)return Jt.createElement(Jt.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([i,n])=>typeof n=="object");if(t.length===0)return Jt.createElement(Jt.Fragment,null);let o=Ea`
|
|
632
|
+
${i=>i.inlineStyles.map(([n,r])=>`.${jt}${n}.${jt}${n} { ${Object.entries(r).map(([s,p])=>`${$o(s)}: ${p};`).join(" ")} }`).join(" ")}`;return Jt.createElement(o,{inlineStyles:t})}var yi=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:n,customVariables:r,customFormElements:s,onComplete:p,appearance:c,hideOnFlowCompletion:a=!0,onStepCompletion:C,onButtonClick:d,dismissible:u=!0,endFlowOnDismiss:y=!1,modalPosition:E="center",repeatable:f=!1,onDismiss:x,showPagination:F=!1,allowBackNavigation:k=!1,validationHandler:B,showFrigadeBranding:P=!1})=>{let{getFlow:S,getFlowSteps:m,isLoading:h,targetingLogicShouldHideFlow:w,getFlowStatus:N,getCurrentStepIndex:W,markFlowCompleted:H,markFlowNotStarted:A}=X(),U=W(e),{mergeAppearanceWithDefault:$}=J(),[O,ne]=Aa(!1),{setOpenFlowState:pe,getOpenFlowState:D}=Pe();c=$(c);let[we,xe]=i!==void 0&&n!==void 0?[i,n]:[D(e,!0),I=>pe(e,I)];if(Ba(()=>{!O&&!h&&(ne(!0),N(e)===Y&&f&&A(e),ne(!0))},[O,ne,h]),h)return null;let te=S(e);if(!te||w(te))return null;let V=m(e);if(!V||i!==void 0&&i===!1||N(e)===Y&&a)return null;let oe=()=>{xe(!1),x&&x(),y===!0&&H(e)};if(E=="center"&&o==="modal"||o==="large-modal"){let I={padding:"24px"};return o==="large-modal"?(I.width="85%",I.height="90%",I.maxHeight="800px",I.minHeight="500px",I.padding="0"):I.width="400px",_e.createElement(rt,{appearance:c,onClose:oe,visible:we,style:I,dismissible:u,showFrigadeBranding:P},_e.createElement(ee,{appearance:c}),_e.createElement(bo,{appearance:c,steps:V,selectedStep:U,customStepTypes:t,customVariables:r,onButtonClick:d,onStepCompletion:C,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:n,setShowModal:xe,onDismiss:x,showPagination:F,customFormElements:s,allowBackNavigation:k,validationHandler:B}))}return o==="modal"&&E!=="center"?_e.createElement($r,{appearance:c,onClose:oe,visible:we},_e.createElement(ee,{appearance:c}),_e.createElement(bo,{appearance:c,steps:V,selectedStep:U,customStepTypes:t,customVariables:r,onButtonClick:d,onStepCompletion:C,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:n,setShowModal:xe,onDismiss:x,showPagination:F,customFormElements:s,allowBackNavigation:k,validationHandler:B})):_e.createElement(_e.Fragment,null,_e.createElement(ee,{appearance:c}),_e.createElement(bo,{appearance:c,steps:V,selectedStep:U,customStepTypes:t,customVariables:r,onButtonClick:d,onStepCompletion:C,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:n,setShowModal:xe,onDismiss:x,showPagination:F,customFormElements:s,allowBackNavigation:k,validationHandler:B}))},bi=yi;import{useCallback as wi,useContext as Ia,useEffect as Na}from"react";function Ro(){let{organizationId:e,userId:t,setOrganizationId:o}=Ia(q),{mutateUserFlowState:i}=Ie(),{config:n}=Me(),r=wt(),{verifySDKInitiated:s}=Tt();Na(()=>{if(t&&e){if(t.startsWith(Ft))return;let a=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(a)||(r(`${Te}userGroups`,{...n,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(a,"true"))}},[t,e]);let p=wi(async a=>{if(s(),!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let C={foreignUserId:t,foreignUserGroupId:e,properties:a};await r(`${Te}userGroups`,{...n,method:"POST",body:JSON.stringify(C)}),i()},[e,t,n,i]),c=wi(async(a,C)=>{if(s(),!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let u={foreignUserId:t,foreignUserGroupId:e,events:[{event:a,properties:C}]};await r(`${Te}userGroups`,{...n,method:"POST",body:JSON.stringify(u)}),i()},[e,t,n,i]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:p,trackEventForOrganization:c}}var Ti="frigade-xFrigade_guestUserId",To="frigade-xFrigade_userId",Fi=({})=>{let{setFlowResponses:e}=Wt(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=Ie(),{userId:n,setUserId:r}=Ht(),[s,p]=er(null),{getFlowStatus:c}=X(),{flows:a,userProperties:C,setIsNewGuestUser:d,flowResponses:u}=La(q),[y,E]=er([]),[f,x]=er([]),{organizationId:F}=Ro();wo(()=>{if(!o&&t)for(let S=0;S<t.length;S++){let m=t[S],h=a.find(w=>w.slug===(m==null?void 0:m.flowId));if(h&&m&&m.shouldTrigger===!0&&h.type=="FORM"&&h.triggerType==="AUTOMATIC"&&!f.includes(h.slug)){setTimeout(()=>{k(m.flowId)},500);break}}},[o,t]),wo(()=>{u.length>0&&i()},[u]);function k(S){let m=a.find(h=>h.slug===S);m&&m.triggerType==="AUTOMATIC"&&!f.includes(m.slug)&&(x([...f,m.slug]),E([m]))}function B(){if(!n){let S=localStorage.getItem(To);if(S){r(S);return}let m=localStorage.getItem(Ti);if(m){r(m);return}d(!0);let h=Ft+Oa();try{localStorage.setItem(Ti,h)}catch(w){console.log("Failed to save guest user id locally: Local storage unavailable",w)}r(w=>w||h)}}wo(()=>{try{if(a){let S=[];a.forEach(m=>{if(m.data){let h=m.data.match(/"imageUri":"(.*?)"/g);h&&h.forEach(w=>{let N=w.replace('"imageUri":"',"").replace('"',"");if(S.includes(N))return;let W=new Image;W.src=N,S.push(N)})}})}}catch{}},[a]),wo(()=>{if(n!==s&&e([]),p(n),n&&!n.startsWith(Ft))try{localStorage.setItem(To,n)}catch(S){console.log("Failed to save user id locally: Local storage available",S)}n===null&&setTimeout(()=>{n===null&&B()},50)},[n,a,C]);function P(){return ft.createElement(ft.Fragment,null,y.map(S=>c(S.slug)!==Le?null:ft.createElement("span",{key:S.slug},ft.createElement(bi,{flowId:S.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return ft.createElement(ft.Fragment,null,ft.createElement(P,null))};import{ErrorBoundary as Ma}from"react-error-boundary";var q=Da({publicApiKey:"",setUserId:()=>{},flows:[],setFlows:()=>{},failedFlowResponses:[],setFailedFlowResponses:()=>{},flowResponses:[],setFlowResponses:()=>{},userProperties:{},setUserProperties:()=>{},openFlowStates:{},setOpenFlowStates:()=>{},completedFlowsToKeepOpenDuringSession:[],setCompletedFlowsToKeepOpenDuringSession:()=>{},customVariables:{},setCustomVariables:()=>{},isNewGuestUser:!1,setIsNewGuestUser:()=>{},hasActiveFullPageFlow:!1,setHasActiveFullPageFlow:()=>{},organizationId:"",setOrganizationId:()=>{},navigate:()=>{},defaultAppearance:Ye,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{}});function Ua(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var _a=({publicApiKey:e,userId:t,organizationId:o,config:i,children:n})=>{var ne,pe;let[r,s]=Ne(t||null),[p,c]=Ne(o||null),[a,C]=Ne([]),[d,u]=Ne([]),[y,E]=Ne([]),[f,x]=Ne({}),[F,k]=Ne({}),[B,P]=Ne([]),[S,m]=Ne({}),[h,w]=Ne(!1),[N,W]=Ne(!1),[H,A]=Ne(!O(e)),U=(D,we)=>{if(we==="_blank"){window.open(D,"_blank");return}setTimeout(()=>{window.location.href=D},50)},$={theme:{...Ye.theme,...((ne=i==null?void 0:i.defaultAppearance)==null?void 0:ne.theme)??{}},styleOverrides:{...Ye.styleOverrides,...((pe=i==null?void 0:i.defaultAppearance)==null?void 0:pe.styleOverrides)??{}}};function O(D){return!!(D&&D.length>10&&D.substring(0,10)==="api_public")}return Fo(()=>{t&&s(t)},[t]),Fo(()=>{r&&window&&window.localStorage&&window.localStorage.getItem(To)!==r&&Ua()},[r]),Fo(()=>{o&&c(o)},[o]),Fo(()=>{if(O(e))A(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),A(!0);return}},[e,A]),H?gt.createElement(q.Provider,{value:{publicApiKey:e,userId:r,setUserId:s,setFlows:C,flows:a,failedFlowResponses:d,setFailedFlowResponses:u,flowResponses:y,setFlowResponses:E,userProperties:f,setUserProperties:x,openFlowStates:F,setOpenFlowStates:k,completedFlowsToKeepOpenDuringSession:B,setCompletedFlowsToKeepOpenDuringSession:P,customVariables:S,setCustomVariables:m,isNewGuestUser:h,setIsNewGuestUser:w,hasActiveFullPageFlow:N,setHasActiveFullPageFlow:W,organizationId:p,setOrganizationId:c,navigate:i&&i.navigate?i.navigate:U,defaultAppearance:$,shouldGracefullyDegrade:H,setShouldGracefullyDegrade:A}},n):gt.createElement(Ma,{fallback:gt.createElement(gt.Fragment,null,n)},gt.createElement(q.Provider,{value:{publicApiKey:e,userId:r,setUserId:s,setFlows:C,flows:a,failedFlowResponses:d,setFailedFlowResponses:u,flowResponses:y,setFlowResponses:E,userProperties:f,setUserProperties:x,openFlowStates:F,setOpenFlowStates:k,completedFlowsToKeepOpenDuringSession:B,setCompletedFlowsToKeepOpenDuringSession:P,customVariables:S,setCustomVariables:m,isNewGuestUser:h,setIsNewGuestUser:w,hasActiveFullPageFlow:N,setHasActiveFullPageFlow:W,organizationId:p,setOrganizationId:c,navigate:i&&i.navigate?i.navigate:U,defaultAppearance:$,shouldGracefullyDegrade:H,setShouldGracefullyDegrade:A}},gt.createElement($a,{theme:$.theme},n,gt.createElement(Fi,null))))};import $p from"react";import ae,{useEffect as ts,useState as os}from"react";import $e,{useState as lp}from"react";import Ct from"styled-components";import vo from"react";import ht from"react";import Pi from"styled-components";var ki=Pi.span`
|
|
633
633
|
font-weight: 400;
|
|
634
634
|
font-size: 15px;
|
|
635
635
|
line-height: 20px;
|
|
@@ -638,7 +638,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
638
638
|
vertical-align: middle;
|
|
639
639
|
margin-left: 12px;
|
|
640
640
|
padding-right: 12px;
|
|
641
|
-
`,
|
|
641
|
+
`,za=Pi.div`
|
|
642
642
|
flex-direction: row;
|
|
643
643
|
justify-content: space-between;
|
|
644
644
|
display: flex;
|
|
@@ -646,7 +646,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
646
646
|
padding-bottom: 20px;
|
|
647
647
|
border-top: 1px solid ${e=>e.theme.colorBorder};
|
|
648
648
|
width: 100%;
|
|
649
|
-
`,
|
|
649
|
+
`,ko=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:n,primaryColor:r="#000000",checkBoxType:s="square",appearance:p})=>ht.createElement(ht.Fragment,null,ht.createElement(za,{className:l("checklistStepsContainer",p),appearance:p,style:{...n}},i==="left"&&e&&ht.createElement(ki,{className:l("checklistStepLabel",p),style:o},e),ht.createElement(Xe,{appearance:p,value:t,type:s,primaryColor:r}),i==="right"&&e&&ht.createElement(ki,{className:l("checklistStepLabel",p),style:o},e)),ht.createElement(ee,{appearance:p}));import{motion as Wa}from"framer-motion";import Qt from"styled-components";var vi=Qt.div`
|
|
650
650
|
font-weight: 700;
|
|
651
651
|
font-size: 18px;
|
|
652
652
|
line-height: 22px;
|
|
@@ -663,7 +663,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
663
663
|
max-width: 540px;
|
|
664
664
|
margin: 8px 0px 0px 0px;
|
|
665
665
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
666
|
-
`,
|
|
666
|
+
`,Po=Qt.div`
|
|
667
667
|
width: 4px;
|
|
668
668
|
position: absolute;
|
|
669
669
|
left: 0;
|
|
@@ -674,18 +674,18 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
674
674
|
`,Ai=Qt.div`
|
|
675
675
|
flex-direction: row;
|
|
676
676
|
justify-content: flex-start;
|
|
677
|
-
`;var Ii=({data:e,index:t,isSelected:o,primaryColor:i,style:n,onClick:r,appearance:s})=>{var p,c;return
|
|
677
|
+
`;var Ii=({data:e,index:t,isSelected:o,primaryColor:i,style:n,onClick:r,appearance:s})=>{var p,c;return vo.createElement("div",{style:{position:"relative",paddingLeft:"20px"},onClick:()=>{r()}},o&&vo.createElement(Po,{className:l("checklistStepItemSelectedIndicator",s),as:Wa.div,layoutId:"checklis-step-selected",style:{backgroundColor:((p=s==null?void 0:s.theme)==null?void 0:p.colorPrimary)??i}}),vo.createElement(Ai,{className:l("checklistStepItem",s),key:`hero-checklist-step-${t}`,role:"listitem"},vo.createElement(ko,{value:e.complete,labelPosition:"left",label:e.stepName,style:n,primaryColor:((c=s==null?void 0:s.theme)==null?void 0:c.colorPrimary)??i,appearance:s})))};import xt from"react";import{motion as Ha}from"framer-motion";import tr from"styled-components";var ja={backgroundColor:"#E6E6E6"},Va=tr.div`
|
|
678
678
|
display: flex;
|
|
679
679
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
680
680
|
justify-content: flex-start;
|
|
681
681
|
align-items: ${e=>e.textLocation=="top"?"flex-end":"center"};
|
|
682
682
|
|
|
683
683
|
${e=>Ke(e)}
|
|
684
|
-
`,
|
|
684
|
+
`,Ga=tr.div`
|
|
685
685
|
flex-grow: 1;
|
|
686
686
|
position: relative;
|
|
687
687
|
${e=>e.textLocation=="top"?"width: 100%;":""}
|
|
688
|
-
`,
|
|
688
|
+
`,qa=tr.span`
|
|
689
689
|
font-weight: 500;
|
|
690
690
|
font-size: 15px;
|
|
691
691
|
line-height: 18px;
|
|
@@ -693,13 +693,13 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
693
693
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
694
694
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
695
695
|
${e=>Ke(e)}
|
|
696
|
-
`,
|
|
696
|
+
`,Ka={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},Ya={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},ze=({count:e,total:t,fillColor:o,bgColor:i=ja.backgroundColor,display:n="count",textLocation:r="left",style:s={},textStyle:p={},appearance:c})=>{var E,f;if(t===0)return xt.createElement(xt.Fragment,null);let a=e===0?"10px":`${e/t*100}%`,C=n==="compact"?"5px":"10px",d=Math.round(e/t*100),u=n==="compact"?"5px":"20px",y;return n==="count"?y=`${e} of ${t}`:n==="compact"?y=`${d}%`:n==="percent"&&(y=`${d}% complete`),r==="top"&&(u="0px"),xt.createElement(Va,{className:l("progressBarContainer",c),textLocation:r,styleOverrides:s},xt.createElement(qa,{className:l("progressBarStepText",c),style:{...p,fontSize:n==="compact"?12:15,fontWeight:n==="compact"?400:500},appearance:c,padding:u,textLocation:r},y),xt.createElement(Ga,{textLocation:r,className:l("progressBar",c)},xt.createElement(Ha.div,{style:{...Ya,width:a,height:C,backgroundColor:((E=c==null?void 0:c.theme)==null?void 0:E.colorPrimary)??o,zIndex:n=="compact"?1:5},className:l("progressBarFill",c)}),xt.createElement("div",{className:l("progressBarBackground",c),style:{...Ka,height:C,backgroundColor:((f=c==null?void 0:c.theme)==null?void 0:f.colorSecondary)??i}})))};import Zt from"react";import Xa from"styled-components";import Bo from"react";import Eo from"react";var At=({stepData:e,appearance:t})=>Eo.createElement(Eo.Fragment,null,Eo.createElement(Ei,{appearance:t,className:l("checklistStepTitle",t),dangerouslySetInnerHTML:ce(e.title)}),Eo.createElement(Bi,{appearance:t,className:l("checklistStepSubtitle",t),dangerouslySetInnerHTML:ce(e.subtitle)}));import or from"react";var It=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},i=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return or.createElement(xo,{className:l("ctaContainer",t)},e.secondaryButtonTitle&&or.createElement(R,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:i,style:{width:"auto",marginRight:"12px"}}),or.createElement(R,{appearance:t,title:e.primaryButtonTitle,onClick:o}))};var Nt=({stepData:e,appearance:t})=>Bo.createElement(Bo.Fragment,null,Bo.createElement(At,{stepData:e,appearance:t}),Bo.createElement(It,{stepData:e,appearance:t}));import Ni from"react";function Li(e){if(e.videoUri.includes("youtube")){let t=e.videoUri.split("v=")[1],o=t.indexOf("&");return o!==-1&&(t=t.substring(0,o)),Ni.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 Ni.createElement("video",{width:"480",height:"260",controls:!0,src:e.videoUri})}var rr="default",Ja=Xa.img`
|
|
697
697
|
border-radius: 4px;
|
|
698
698
|
max-height: 260px;
|
|
699
699
|
min-height: 200px;
|
|
700
|
-
`,Oi=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return Zt.createElement("div",null,o)}return Zt.createElement(vi,{className:l("checklistStepContent",t)},e.imageUri?Zt.createElement(
|
|
700
|
+
`,Oi=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return Zt.createElement("div",null,o)}return Zt.createElement(vi,{className:l("checklistStepContent",t)},e.imageUri?Zt.createElement(Ja,{className:l("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Zt.createElement(Li,{videoUri:e.videoUri,appearance:t}):null,Zt.createElement(Nt,{stepData:e,appearance:t}))};import Ee,{useRef as Qa,useState as Za}from"react";import Lt from"styled-components";var Di=Lt.div`
|
|
701
701
|
display: block;
|
|
702
|
-
`,
|
|
702
|
+
`,Ra=Lt.div`
|
|
703
703
|
display: flex;
|
|
704
704
|
flex-direction: row;
|
|
705
705
|
flex-wrap: wrap;
|
|
@@ -709,20 +709,20 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
709
709
|
align-content: center;
|
|
710
710
|
margin-top: 24px;
|
|
711
711
|
margin-bottom: 24px;
|
|
712
|
-
`,
|
|
712
|
+
`,ep=Lt.div`
|
|
713
713
|
display: flex;
|
|
714
714
|
align-items: center;
|
|
715
715
|
justify-content: flex-start;
|
|
716
716
|
flex-direction: column;
|
|
717
717
|
margin-right: 16px;
|
|
718
|
-
`,
|
|
718
|
+
`,tp=Lt.video`
|
|
719
719
|
width: 200px;
|
|
720
720
|
height: 120px;
|
|
721
|
-
`,
|
|
721
|
+
`,op=Lt.div`
|
|
722
722
|
font-size: 14px;
|
|
723
723
|
line-height: 20px;
|
|
724
724
|
text-align: center;
|
|
725
|
-
`,
|
|
725
|
+
`,rp=Lt.div`
|
|
726
726
|
position: absolute;
|
|
727
727
|
width: 200px;
|
|
728
728
|
height: 120px;
|
|
@@ -742,9 +742,9 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
742
742
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
743
743
|
border-radius: 50%;
|
|
744
744
|
}
|
|
745
|
-
`,$i="videoCarousel",Mi=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.videos))return Ee.createElement(Di,null,Ee.createElement(Nt,{stepData:e,appearance:t}));function o({video:r}){let s=
|
|
745
|
+
`,$i="videoCarousel",Mi=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.videos))return Ee.createElement(Di,null,Ee.createElement(Nt,{stepData:e,appearance:t}));function o({video:r}){let s=Qa(),[p,c]=Za(!1);return Ee.createElement(ep,null,!p&&Ee.createElement(rp,{onClick:()=>{c(!0),s.current.play()},appearance:t},Ee.createElement(Co,null)),Ee.createElement(tp,{controls:p,ref:s,play:p,src:r.uri}),Ee.createElement(op,null,r.title))}let i=e.props;return i.videos?Ee.createElement(Di,null,Ee.createElement(At,{stepData:e,appearance:t}),Ee.createElement(Ra,null,i.videos.map((r,s)=>Ee.createElement("span",{key:`${r.uri}-${s}`},Ee.createElement(o,{video:r})))),Ee.createElement(It,{stepData:e,appearance:t})):null};import Qe from"react";import Ao from"styled-components";var Ui=Ao.div`
|
|
746
746
|
display: block;
|
|
747
|
-
`,
|
|
747
|
+
`,ip=Ao.pre`
|
|
748
748
|
display: block;
|
|
749
749
|
background-color: #2a2a2a;
|
|
750
750
|
color: #f8f8f8;
|
|
@@ -760,50 +760,50 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
760
760
|
white-space: -o-pre-wrap; /* Opera 7 */
|
|
761
761
|
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
|
762
762
|
margin-bottom: 24px;
|
|
763
|
-
`,
|
|
763
|
+
`,np=Ao.div`
|
|
764
764
|
font-size: 15px;
|
|
765
765
|
line-height: 20px;
|
|
766
766
|
margin-bottom: 12px;
|
|
767
767
|
margin-top: 12px;
|
|
768
|
-
`,
|
|
768
|
+
`,sp=Ao.div`
|
|
769
769
|
margin-top: 24px;
|
|
770
|
-
`,_i="codeSnippet",zi=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.codeSnippets))return Qe.createElement(Ui,null,Qe.createElement(Nt,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?Qe.createElement(Ui,null,Qe.createElement(At,{stepData:e,appearance:t}),Qe.createElement(
|
|
770
|
+
`,_i="codeSnippet",zi=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.codeSnippets))return Qe.createElement(Ui,null,Qe.createElement(Nt,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?Qe.createElement(Ui,null,Qe.createElement(At,{stepData:e,appearance:t}),Qe.createElement(sp,null,o.codeSnippets.map((n,r)=>Qe.createElement("div",{key:r},n.title?Qe.createElement(np,null,n.title):null,n.code?Qe.createElement(ip,null,n.code):null))),Qe.createElement(It,{stepData:e,appearance:t})):null};var ap=Ct.div`
|
|
771
771
|
display: flex;
|
|
772
772
|
flex-direction: row;
|
|
773
773
|
min-width: ${e=>e.type!="modal"?"1000px":"100%"};
|
|
774
774
|
background: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
775
775
|
box-shadow: ${e=>e.type!="modal"?"0px 6px 25px rgba(0, 0, 0, 0.06)":"none"};
|
|
776
776
|
border-radius: 8px;
|
|
777
|
-
`,
|
|
777
|
+
`,pp=Ct.h1`
|
|
778
778
|
font-size: 24px;
|
|
779
779
|
font-weight: 600;
|
|
780
780
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
781
|
-
`,
|
|
781
|
+
`,dp=Ct.h2`
|
|
782
782
|
font-size: 15px;
|
|
783
783
|
line-height: 20px;
|
|
784
784
|
color: ${e=>{var t,o;return((o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary)??"#4d4d4d"}};
|
|
785
785
|
margin: 10px 0px 0px 0px;
|
|
786
786
|
`,Wi=Ct.div`
|
|
787
787
|
padding-bottom: 16px;
|
|
788
|
-
`,
|
|
788
|
+
`,cp=Ct.div`
|
|
789
789
|
list-style: none;
|
|
790
790
|
padding: 0;
|
|
791
791
|
margin: 0;
|
|
792
792
|
cursor: pointer;
|
|
793
793
|
width: 300px;
|
|
794
|
-
`,
|
|
794
|
+
`,mp=Ct.div`
|
|
795
795
|
width: 1px;
|
|
796
796
|
margin: 40px;
|
|
797
797
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
798
|
-
`,
|
|
798
|
+
`,up=Ct.div`
|
|
799
799
|
flex: 2;
|
|
800
800
|
padding: 2rem;
|
|
801
|
-
`,
|
|
801
|
+
`,fp=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:n,setSelectedStep:r,className:s="",customStepTypes:p=new Map,appearance:c,type:a})=>{let{mergeAppearanceWithDefault:C}=J();c=C(c);let u={...{[rr]:Oi,[$i]:Mi,[_i]:zi},...p},[y,E]=lp(0),f=n??y,x=r??E,F=o.filter(B=>B.complete===!0).length,k=()=>{var B;return!((B=o[f])!=null&&B.type)||!u[o[f].type]?u[rr]({stepData:o[f],appearance:c}):u[o[f].type]({stepData:o[f],appearance:c})};return $e.createElement(ap,{type:a,style:i,className:s,appearance:c},$e.createElement(Wi,{style:{flex:1}},$e.createElement(Wi,{style:{padding:"30px 0px 30px 30px",borderBottom:"none"}},$e.createElement(pp,{className:l("checklistTitle",c),appearance:c},e),$e.createElement(dp,{className:l("checklistSubtitle",c),appearance:c},t),$e.createElement(ze,{total:o.length,count:F,fillColor:c.theme.colorPrimary,style:{marginTop:"24px"},appearance:c})),$e.createElement(cp,{className:l("checklistStepsContainer",c)},o.map((B,P)=>$e.createElement(Ii,{data:B,index:P,key:P,listLength:o.length,isSelected:P===f,primaryColor:c.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{x(P)}})))),$e.createElement(mp,{appearance:c,className:l("checklistDivider",c)}),$e.createElement(up,null,$e.createElement(k,null)))},ir=fp;import M,{useState as yp}from"react";import Hi from"react";import gp from"styled-components";var hp=gp.svg`
|
|
802
802
|
transition: 'transform 0.35s ease-in-out';
|
|
803
|
-
`,Ot=({color:e="#323232",style:t,className:o})=>Hi.createElement(
|
|
803
|
+
`,Ot=({color:e="#323232",style:t,className:o})=>Hi.createElement(hp,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},Hi.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as bp}from"framer-motion";import me from"styled-components";var nr={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},ji=me.div`
|
|
804
804
|
max-height: 350px;
|
|
805
805
|
padding-bottom: 40px;
|
|
806
|
-
`,
|
|
806
|
+
`,Vi=me.div`
|
|
807
807
|
display: flex;
|
|
808
808
|
flex-direction: column;
|
|
809
809
|
margin-top: 20px;
|
|
@@ -932,11 +932,11 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
932
932
|
`,ln=me.div`
|
|
933
933
|
display: block;
|
|
934
934
|
width: 100%;
|
|
935
|
-
`;import
|
|
935
|
+
`;import xp from"styled-components";var an=xp.div`
|
|
936
936
|
flex-direction: column;
|
|
937
937
|
justify-content: center;
|
|
938
938
|
display: flex;
|
|
939
|
-
`;import Re from"react";import{motion as
|
|
939
|
+
`;import Re from"react";import{motion as Cp}from"framer-motion";import Ze from"styled-components";var pn=Ze.div`
|
|
940
940
|
border: 1px solid #fafafa;
|
|
941
941
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
942
942
|
border-radius: 14px;
|
|
@@ -1013,7 +1013,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1013
1013
|
line-height: 14px;
|
|
1014
1014
|
font-weight: 400;
|
|
1015
1015
|
cursor: pointer;
|
|
1016
|
-
`;var
|
|
1016
|
+
`;var Sp=({steps:e,style:t,title:o,primaryColor:i,appearance:n,onButtonClick:r})=>{let{primaryCTAClickSideEffects:s}=re();return Re.createElement(pn,{style:t,className:l("guideContainer",n)},Re.createElement(cn,{className:l("guideTitle",n)},o),Re.createElement(dn,{className:l("guideItemContainer",n)},e.map((p,c)=>Re.createElement(mn,{key:`guide-${p.id??c}`,as:Cp.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:l("guideItem",n)},p.icon&&Re.createElement(un,{className:l("guideIcon",n)},Re.createElement(fn,null,p.icon)),Re.createElement(gn,{className:l("guideItemTitle",n),dangerouslySetInnerHTML:ce(p.title)}),Re.createElement(hn,{className:l("guideItemSubtitle",n),dangerouslySetInnerHTML:ce(p.subtitle)}),Re.createElement(xn,{className:l("guideItemLink",n),color:i,onClick:()=>{p.primaryButtonUri&&s(p),r&&r(p)}},p.primaryButtonTitle)))))},Rt=Sp;var wp=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:n,onClose:r,selectedStep:s,setSelectedStep:p,customStepTypes:c,appearance:a,guideData:C,guideTitle:d,onGuideButtonClick:u})=>{let y=({stepData:m,handleSecondaryCTAClick:h,handleCTAClick:w})=>m?M.createElement(Zi,{className:l("checklistStepContainer",a),"data-testid":"checklistStepContainer"},M.createElement(Ri,{appearance:a,className:l("checklistStepTitle",a),dangerouslySetInnerHTML:ce(m.title)}),M.createElement(en,{appearance:a,className:l("checklistStepSubtitle",a),dangerouslySetInnerHTML:ce(m.subtitle)}),M.createElement(tn,{className:l("checklistCTAContainer",a)},m.secondaryButtonTitle&&M.createElement(R,{title:m.secondaryButtonTitle,onClick:h,appearance:a,secondary:!0}),M.createElement(R,{title:m.primaryButtonTitle,onClick:w,appearance:a}))):M.createElement(M.Fragment,null),f={...{default:m=>{var W;if((W=e[k])!=null&&W.StepContent){let H=e[k].StepContent;return M.createElement("div",null,H)}let h=e[k];return M.createElement(y,{stepData:m,handleCTAClick:()=>{h.handlePrimaryButtonClick&&h.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{h.handleSecondaryButtonClick&&h.handleSecondaryButtonClick()}})}},...c},[x,F]=yp(0),k=s??x,B=p??F,P=()=>{var m;return e?!((m=e[k])!=null&&m.type)||!f[e[k].type]?f.default(e[k]):f[e[k].type]({stepData:e[k],primaryColor:a.theme.colorPrimary}):M.createElement(M.Fragment,null)},S=e.filter(m=>m.complete).length;return n?(a.theme.modalContainer||(a.theme.borderRadius&&(nr.borderRadius=a.theme.borderRadius+"px"),a.theme.modalContainer=nr),M.createElement(rt,{onClose:r,visible:n,appearance:a},M.createElement(ln,null,M.createElement(Vi,null,M.createElement(Gi,{appearance:a,className:l("checklistTitle",a)},t),M.createElement(qi,{appearance:a,className:l("checklistSubtitle",a)},o)),M.createElement(ji,null,e&&e.length>0&&M.createElement(Ki,{className:l("stepsContainer",a)},M.createElement(Yi,null,M.createElement("div",{style:{flex:3}},M.createElement(Xi,{className:l("stepsTitle",a)},i)),M.createElement(sn,null,M.createElement(ze,{fillColor:a.theme.colorPrimary,style:{width:"100%"},count:S,total:e.length,appearance:a}))),M.createElement(Ji,null,M.createElement(Qi,{className:l("checklistStepListContainer",a),appearance:a},e.map((m,h)=>{let w=k===h;return M.createElement(on,{selected:w,className:l(`checklistStepListItem${w?"Selected":""}`,a),key:`checklist-guide-step-${m.id??h}`,disabled:m.blocked,onClick:()=>{m.blocked||B(h)},title:m.blocked?"Finish remaining steps to continue":void 0},w&&M.createElement(Po,{className:l("checklistStepItemSelectedIndicator",a),as:bp.div,layoutId:"checklist-step-selected",style:{backgroundColor:a.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),M.createElement(rn,{selected:w,className:l(`checklistStepListStepName${w?"Selected":""}`,a)},m.stepName),M.createElement(nn,null,M.createElement(Xe,{value:m.complete,type:"round",primaryColor:a.theme.colorPrimary,progress:m.progress,appearance:a}),M.createElement(an,null,M.createElement(Ot,{style:{marginLeft:"10px"},color:a.theme.colorBackgroundSecondary}))))})),M.createElement(P,null))),C&&C.length>0&&M.createElement(Rt,{steps:C,title:d,primaryColor:a.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:a,onButtonClick:m=>(u&&u(m),!0)}))))):M.createElement(M.Fragment,null)},sr=wp;import{useEffect as Tp,useState as Fp}from"react";var Cn=()=>{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),n=null,r=()=>{n!==null?clearTimeout(n):s(),n=setTimeout(()=>{s()},16)},s=()=>{let p=Object.fromEntries(Object.entries(e).map(([c,a])=>{if(!window)return[c,!1];let C=window.matchMedia(a);return C.addEventListener("change",r),[c,C.matches]}));i(p)};return Tp(()=>{s()},[]),o};import Fe,{useEffect as Ln,useState as vp}from"react";import ue from"react";import{AnimatePresence as kp,motion as Pp}from"framer-motion";import et from"styled-components";var Sn=et.div`
|
|
1017
1017
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1018
1018
|
border: 1px solid;
|
|
1019
1019
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -1050,7 +1050,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1050
1050
|
:hover {
|
|
1051
1051
|
opacity: 0.8;
|
|
1052
1052
|
}
|
|
1053
|
-
`,
|
|
1053
|
+
`,gx=et.div``,kn=et.p`
|
|
1054
1054
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1055
1055
|
font-weight: 400;
|
|
1056
1056
|
font-size: 14px;
|
|
@@ -1060,7 +1060,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1060
1060
|
flex-direction: row;
|
|
1061
1061
|
justify-content: flex-start;
|
|
1062
1062
|
align-items: center;
|
|
1063
|
-
`;var vn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:n,appearance:r,customStepTypes:s})=>{var C,d;let p=t?{}:{transform:"rotate(90deg)"};function c(){return ue.createElement(ue.Fragment,null,e.imageUri||e.videoUri?ue.createElement(yn,{className:l("stepMediaContainer",r)},e.imageUri?ue.createElement(bn,{className:l("stepImage",r),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?ue.createElement(Et,{appearance:r,videoUri:e.videoUri}):null):null,ue.createElement(kn,{className:l("stepSubtitle",r),appearance:r,dangerouslySetInnerHTML:ce(e.subtitle)}),ue.createElement(xo,{className:l("checklistCTAContainer",r)},e.secondaryButtonTitle?ue.createElement(R,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>n(),appearance:r}):null,ue.createElement(R,{title:e.primaryButtonTitle??"Continue",onClick:()=>i(),appearance:r})))}function a(){if(!s)return null;let u=s[e.type];return u?u(e,r):null}return ue.createElement(Sn,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:l("checklistStepContainer",r),appearance:r},ue.createElement(wn,{className:l("stepHeader",r)},ue.createElement(Pn,null,ue.createElement(
|
|
1063
|
+
`;var vn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:n,appearance:r,customStepTypes:s})=>{var C,d;let p=t?{}:{transform:"rotate(90deg)"};function c(){return ue.createElement(ue.Fragment,null,e.imageUri||e.videoUri?ue.createElement(yn,{className:l("stepMediaContainer",r)},e.imageUri?ue.createElement(bn,{className:l("stepImage",r),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?ue.createElement(Et,{appearance:r,videoUri:e.videoUri}):null):null,ue.createElement(kn,{className:l("stepSubtitle",r),appearance:r,dangerouslySetInnerHTML:ce(e.subtitle)}),ue.createElement(xo,{className:l("checklistCTAContainer",r)},e.secondaryButtonTitle?ue.createElement(R,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>n(),appearance:r}):null,ue.createElement(R,{title:e.primaryButtonTitle??"Continue",onClick:()=>i(),appearance:r})))}function a(){if(!s)return null;let u=s[e.type];return u?u(e,r):null}return ue.createElement(Sn,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:l("checklistStepContainer",r),appearance:r},ue.createElement(wn,{className:l("stepHeader",r)},ue.createElement(Pn,null,ue.createElement(ko,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(C=r==null?void 0:r.theme)==null?void 0:C.colorPrimary,appearance:r}),ue.createElement(Tn,{appearance:r,className:l("stepTitle",r),dangerouslySetInnerHTML:ce(e.title)})),ue.createElement(Fn,{className:l("stepChevronContainer",r),onClick:()=>o()},ue.createElement(Ot,{style:{...p,transition:"transform 0.1s ease-in-out"},color:(d=r==null?void 0:r.theme)==null?void 0:d.colorTextSecondary}))),ue.createElement(kp,null,!t&&ue.createElement(Pp.div,{initial:{opacity:1,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:1,height:0},key:e.id,style:{overflow:"hidden"}},a()??c())))};import Dt from"styled-components";var Bx=Dt.div`
|
|
1064
1064
|
background: #ffffff;
|
|
1065
1065
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
1066
1066
|
border-radius: 6px;
|
|
@@ -1100,17 +1100,17 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1100
1100
|
justify-content: space-between;
|
|
1101
1101
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1102
1102
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
1103
|
-
`;var
|
|
1103
|
+
`;var Ep=({title:e,subtitle:t,steps:o,onClose:i,visible:n,onCompleteStep:r,autoExpandFirstIncompleteStep:s=!0,autoCollapse:p=!0,autoExpandNextStep:c=!0,primaryColor:a="#000000",selectedStep:C,setSelectedStep:d,appearance:u,type:y,className:E,customStepTypes:f})=>{let x=o.filter(m=>m.complete).length,[F,k]=vp(Array(o.length).fill(!0));Ln(()=>{let m=[...F];if(s){for(let h=0;h<o.length;h++)if(!o[h].complete){m[h]=!1;break}k(m)}},[]),Ln(()=>{B(C)},[C]);let B=m=>{let h=[...F];if(p)for(let w=0;w<F.length;++w)w!==m&&(h[w]=!0);h[m]=!h[m],k(h)};if(!n&&y=="modal")return Fe.createElement(Fe.Fragment,null);let P=Fe.createElement(Fe.Fragment,null,Fe.createElement(En,null,Fe.createElement(Bn,{appearance:u,className:l("checklistTitle",u),dangerouslySetInnerHTML:ce(e)}),Fe.createElement(An,{appearance:u,className:l("checklistSubtitle",u),dangerouslySetInnerHTML:ce(t)})),Fe.createElement(ze,{display:"percent",count:x,total:o.length,fillColor:a,style:{margin:"14px 0px 8px 0px"},appearance:u})),S=Fe.createElement(In,{className:Ce(l("checklistContainer",u),E)},o.map((m,h)=>{let w=F[h];return Fe.createElement(vn,{appearance:u,stepData:m,collapsed:w,key:`modal-checklist-${m.id??h}`,onClick:()=>{if(C===h){B(h);return}d(h)},onPrimaryButtonClick:()=>{r&&r(h,m),m.handlePrimaryButtonClick&&m.handlePrimaryButtonClick(),c&&!m.completionCriteria&&h<F.length-1&&F[h+1]&&d(h+1)},onSecondaryButtonClick:()=>{m.handleSecondaryButtonClick&&m.handleSecondaryButtonClick()},customStepTypes:f})}));return y==="inline"?Fe.createElement(Nn,{appearance:u,className:Ce(l("checklistInlineContainer",u),E)},P,S):Fe.createElement(Fe.Fragment,null,Fe.createElement(rt,{onClose:i,visible:n,appearance:u,style:{maxWidth:"600px"},headerContent:P},S))},lr=Ep;import ie,{useEffect as ar,useRef as Op,useState as St}from"react";import $t from"react";import le,{css as On,keyframes as Dn}from"styled-components";var $n=On`
|
|
1104
1104
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1105
|
-
`,
|
|
1105
|
+
`,Bp=On`
|
|
1106
1106
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
1107
|
-
`,
|
|
1107
|
+
`,Ap=Dn`
|
|
1108
1108
|
from {
|
|
1109
1109
|
opacity: 0;
|
|
1110
1110
|
} to {
|
|
1111
1111
|
opacity: 1;
|
|
1112
1112
|
}
|
|
1113
|
-
`,
|
|
1113
|
+
`,Ip=Dn`
|
|
1114
1114
|
from {
|
|
1115
1115
|
opacity: 1;
|
|
1116
1116
|
} to {
|
|
@@ -1140,7 +1140,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1140
1140
|
scroll-snap-align: center;
|
|
1141
1141
|
scroll-snap-stop: always;
|
|
1142
1142
|
`,_n=le.div`
|
|
1143
|
-
animation: ${e=>e.reversed?Ap
|
|
1143
|
+
animation: ${e=>e.reversed?Ip:Ap} 0.25s ease-out;
|
|
1144
1144
|
background: linear-gradient(
|
|
1145
1145
|
to right,
|
|
1146
1146
|
${({theme:e})=>e.colorBackground}00,
|
|
@@ -1177,14 +1177,14 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1177
1177
|
${e=>e.blocked?"":`border: 1px solid ${e.theme.colorPrimary};`}
|
|
1178
1178
|
${e=>e.blocked?"cursor: default":"cursor: pointer"}
|
|
1179
1179
|
}
|
|
1180
|
-
`,
|
|
1180
|
+
`,jn=le.img`
|
|
1181
1181
|
border-radius: 50%;
|
|
1182
1182
|
height: 40px;
|
|
1183
1183
|
margin-bottom: 12px;
|
|
1184
1184
|
width: 40px;
|
|
1185
|
-
`,
|
|
1185
|
+
`,Vn=le(Wn)`
|
|
1186
1186
|
${e=>T(e)} {
|
|
1187
|
-
${
|
|
1187
|
+
${Bp}
|
|
1188
1188
|
|
|
1189
1189
|
background: ${({theme:e})=>e.colorBackground};
|
|
1190
1190
|
}
|
|
@@ -1202,21 +1202,21 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1202
1202
|
float: right;
|
|
1203
1203
|
margin-bottom: 12px;
|
|
1204
1204
|
padding: 4px 10px;
|
|
1205
|
-
`,
|
|
1205
|
+
`,Np=le.p`
|
|
1206
1206
|
font-weight: bold;
|
|
1207
1207
|
font-size: 18px;
|
|
1208
1208
|
line-height: 22px;
|
|
1209
1209
|
letter-spacing: calc(18px * -0.01);
|
|
1210
1210
|
margin: 0;
|
|
1211
|
-
`,Yn=le(
|
|
1211
|
+
`,Yn=le(Np)`
|
|
1212
1212
|
margin-bottom: 4px;
|
|
1213
|
-
`,
|
|
1213
|
+
`,Lp=le.p`
|
|
1214
1214
|
font-weight: bold;
|
|
1215
1215
|
font-size: 16px;
|
|
1216
1216
|
line-height: 20px;
|
|
1217
1217
|
letter-spacing: calc(16px * -0.01);
|
|
1218
1218
|
margin: 0;
|
|
1219
|
-
`,Xn=le(
|
|
1219
|
+
`,Xn=le(Lp)`
|
|
1220
1220
|
margin-bottom: 4px;
|
|
1221
1221
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1222
1222
|
`}
|
|
@@ -1238,34 +1238,34 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1238
1238
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1239
1239
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1240
1240
|
`}
|
|
1241
|
-
`;var Qn=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=J(),{primaryCTAClickSideEffects:n}=re();o=i(o);let{imageUri:r=null,subtitle:s=null,title:p=null,complete:c=!1,blocked:a=!1}=e,C=e.primaryButtonTitle||e.secondaryButtonTitle,d=()=>{n(e)};return $t.createElement(Hn,{className:l("carouselCard",o),onClick:a?null:d,style:t,blocked:a,complete:c},r&&$t.createElement(
|
|
1241
|
+
`;var Qn=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=J(),{primaryCTAClickSideEffects:n}=re();o=i(o);let{imageUri:r=null,subtitle:s=null,title:p=null,complete:c=!1,blocked:a=!1}=e,C=e.primaryButtonTitle||e.secondaryButtonTitle,d=()=>{n(e)};return $t.createElement(Hn,{className:l("carouselCard",o),onClick:a?null:d,style:t,blocked:a,complete:c},r&&$t.createElement(jn,{className:l("carouselCardImage",o),src:r,alt:p,style:{opacity:c||a?.4:1}}),(c||!0)&&$t.createElement(Kn,{className:l("carouselCompletedPill",o)},$t.createElement(Jn,{style:{color:"#108E0B"}},"Complete")),p&&$t.createElement(Xn,{blocked:a,complete:c,className:l("carouselCardTitle",o)},p),s&&$t.createElement(We.Quiet,{blocked:a,complete:c,className:l("carouselCardSubtitle",o)},s))};import eo from"react";var Zn=({numberOfStepsCompleted:e,numberOfSteps:t,appearance:o})=>{let i=t>0?e/t:0,n=200,r=Math.min(n,Math.max(10,Math.round(n*i)));return eo.createElement(Gn,{className:l("carouselProgressBar",o)},eo.createElement(qn,{as:We.Loud,style:{marginRight:8}},e," of ",t),eo.createElement("svg",{height:10,width:n},eo.createElement("rect",{x:0,y:0,rx:5,width:n,height:10,fill:"#E6E6E6"}),eo.createElement("rect",{x:0,y:0,rx:5,width:r,height:10,fill:"currentColor"})))};var Dp=()=>ie.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ie.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),ie.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),ie.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),Rn=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,n]=St(!1),[r,s]=St(!1);ar(()=>{t===!0&&i===!1?n(!0):t===!1&&i===!0&&s(!0)},[t]);let p=()=>{n(!1),s(!1)},c=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return i?ie.createElement(_n,{style:c,reversed:r,onAnimationEnd:r?p:null},ie.createElement(zn,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},ie.createElement(Dp,null))):null},es=({flowId:e,appearance:t,customVariables:o,className:i})=>{let n=Op(null),[r,s]=St(!1),[p,c]=St(!1),[a,C]=St(null),[d,u]=St([]),[y,E]=St(0),{getFlowMetadata:f,getFlowSteps:x,getNumberOfStepsCompleted:F,updateCustomVariables:k,getFlowStatus:B,isLoading:P,targetingLogicShouldHideFlow:S,getFlow:m}=X();ar(()=>{k(o)},[o,P]),ar(()=>{if(P)return;let A=f(e),U=F(e),$=x(e);C(A),A.data!==null&&(u($.sort((O,ne)=>Number(O.complete)-Number(ne.complete))),c($.length>3),E(U))},[P]);let h=[];for(let A=0;A<d.length;A+=3)h.push(d.slice(A,A+3));let w=A=>{let U=A.target,$=U.scrollWidth-U.clientWidth,O=Math.ceil(U.scrollLeft);O>0&&r===!1&&s(!0),O===0&&r===!0&&s(!1),O<$&&p===!1&&c(!0),O===$&&p===!0&&c(!1)},N=(A=!0)=>{let U=A?1:-1;n.current!==null&&n.current.scrollBy({left:n.current.clientWidth*U,behavior:"smooth"})},W=null,H=A=>{W!==null?clearTimeout(W):w(A),W=setTimeout(()=>{w(A)},16)};return P?null:ie.createElement(Vn,{className:Ce(l("carouselContainer",t),i)},ie.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:20}},ie.createElement("div",null,ie.createElement(Yn,{className:l("carouselTitle",t)},a==null?void 0:a.title),ie.createElement(We.Quiet,{className:l("carouselSubtitle",t)},a==null?void 0:a.subtitle)),ie.createElement(Zn,{numberOfStepsCompleted:y,numberOfSteps:d.length})),ie.createElement("div",{style:{position:"relative"}},ie.createElement(Rn,{show:r,onClick:()=>N(!1)}),ie.createElement(Rn,{side:"right",show:p,onClick:N}),ie.createElement(Mn,{ref:n,onScroll:H},h.map((A,U)=>ie.createElement(Un,{key:U,style:{flex:`0 0 calc(100% - ${d.length>3?36:0}px)`}},A.map(($,O)=>ie.createElement(Qn,{key:O,stepData:$,style:{flex:d.length>3?"0 1 calc(33% - 16px * 2 / 3)":1},appearance:t})))))),ie.createElement(ee,{appearance:t}))};var pr=({flowId:e,title:t,subtitle:o,style:i,initialSelectedStep:n,className:r,type:s="inline",onDismiss:p,visible:c,customVariables:a,onStepCompletion:C,onButtonClick:d,appearance:u,hideOnFlowCompletion:y,setVisible:E,customStepTypes:f,checklistStyle:x="default",autoExpandFirstIncompleteStep:F,autoExpandNextStep:k,...B})=>{let{getFlow:P,getFlowSteps:S,markStepCompleted:m,getStepStatus:h,getNumberOfStepsCompleted:w,isLoading:N,targetingLogicShouldHideFlow:W,updateCustomVariables:H,getFlowMetadata:A,isStepBlocked:U,getFlowStatus:$,hasActiveFullPageFlow:O,setHasActiveFullPageFlow:ne}=X(),{primaryCTAClickSideEffects:pe,secondaryCTAClickSideEffects:D}=re(),{getOpenFlowState:we,setOpenFlowState:xe}=Pe(),[te,V]=os(n||0),[oe,I]=os(!1),se=c===void 0?we(e):c,fe=s==="modal",{mergeAppearanceWithDefault:ke}=J(),{isLarge:G}=Cn();if(u=ke(u),ts(()=>{H(a)},[a,N]),ts(()=>{c!==void 0&&(fe&&c===!0?ne(!0):fe&&c===!1&&ne(!1))},[c,E,O]),N)return null;let ge=P(e);if(!ge||W(ge))return null;let Z=S(e);if(!Z||y===!0&&$(e)===Y)return null;let K=A(e);if(K!=null&&K.title&&(t=K.title),K!=null&&K.subtitle&&(o=K.subtitle),!oe&&n===void 0&&w(e)>0){let z=Z.findIndex(qe=>qe.complete===!1);V(z>-1?z:Z.length-1),I(!0)}function Ve(){if(te+1>=Z.length){fe&&xe(e,!1);return}U(e,Z[te+1].id)||V(te+1)}function Ge(z,qe,io){let hr=te+1<Z.length?Z[te+1]:null;d&&d(z,te,qe,hr)===!0&&fe&&g(),C&&C(z,io,hr),!C&&!d&&(z.primaryButtonUri||z.secondaryButtonUri)&&fe&&g()}function bt(){return Z.map((z,qe)=>({...z,handleSecondaryButtonClick:()=>{Ve(),D(z),z.skippable===!0&&m(e,z.id,{skipped:!0}),Ge(z,"secondary",qe)},handlePrimaryButtonClick:()=>{(!z.completionCriteria&&(z.autoMarkCompleted||z.autoMarkCompleted===void 0)||z.completionCriteria&&z.autoMarkCompleted===!0)&&(m(e,z.id),Ve()),Ge(z,"primary",qe),pe(z),h(e,z.id)===Oe&&Ve()}}))}function j(){return ae.createElement(ee,{appearance:u})}let Be={steps:bt(),title:t,subtitle:o,primaryColor:u.theme.colorPrimary,appearance:u,customStepTypes:f,type:s,className:r,autoExpandFirstIncompleteStep:F,autoExpandNextStep:k};function g(){xe(e,!1),p&&p(),E&&E(!1)}function b(){return ae.createElement(ae.Fragment,null,ae.createElement(j,null),ae.createElement(es,{flowId:e,appearance:u,customVariables:a,className:r}))}function v(){return ae.createElement(ae.Fragment,null,ae.createElement(j,null),ae.createElement(lr,{visible:se,onClose:()=>{g()},selectedStep:te,setSelectedStep:V,autoExpandNextStep:!0,appearance:u,...Be}))}function _(){if(!G)return v();let z=B.guideFlowId,qe;return z&&P(z)&&(qe=S(z)),ae.createElement(ae.Fragment,null,ae.createElement(j,null),ae.createElement(sr,{visible:se,stepsTitle:K.stepsTitle?K.stepsTitle:"Your quick start guide",onClose:()=>{g()},selectedStep:te,setSelectedStep:V,guideData:qe,guideTitle:B.guideTitle??"Guide",appearance:u,title:t,subtitle:o,onGuideButtonClick:io=>{Ge(io,"link",0)},customStepTypes:f,...Be}))}function de(){if(!G)return v();let z=ae.createElement(ir,{flowId:e,style:i,selectedStep:te,setSelectedStep:V,appearance:u,type:s,...Be});return fe?ae.createElement(rt,{onClose:()=>{g()},visible:se,appearance:u,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},ae.createElement(j,null),z):ae.createElement(ae.Fragment,null,ae.createElement(j,null),z)}switch(x){case"condensed":return v();case"with-guide":return _();case"default":return de();case"carousel":return b();default:return de()}};var Mp=e=>$p.createElement(pr,{type:"inline",...e});import pt,{useEffect as _p}from"react";import He from"react";import Io from"styled-components";var rs=Io.div`
|
|
1242
1242
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1243
1243
|
border-radius: 8px;
|
|
1244
1244
|
padding: 6px 10px 6px 10px;
|
|
1245
1245
|
min-width: 160px;
|
|
1246
1246
|
cursor: pointer;
|
|
1247
1247
|
background-color: ${e=>e.appearance.theme.colorBackground}};
|
|
1248
|
-
`,is=
|
|
1248
|
+
`,is=Io.div`
|
|
1249
1249
|
display: flex;
|
|
1250
1250
|
flex-direction: row;
|
|
1251
1251
|
justify-content: space-between;
|
|
1252
1252
|
align-items: center;
|
|
1253
1253
|
margin-bottom: 2px;
|
|
1254
1254
|
flex-grow: 2;
|
|
1255
|
-
`,ns=
|
|
1255
|
+
`,ns=Io.div`
|
|
1256
1256
|
text-overflow: ellipsis;
|
|
1257
1257
|
font-weight: 600;
|
|
1258
1258
|
font-size: 12px;
|
|
1259
1259
|
line-height: 15px;
|
|
1260
1260
|
text-align: ${e=>e.type==="condensed"?"left":"right"};
|
|
1261
1261
|
color: ${e=>e.appearance.theme.colorPrimary};
|
|
1262
|
-
`,ss=
|
|
1262
|
+
`,ss=Io.div`
|
|
1263
1263
|
width: 20px;
|
|
1264
1264
|
margin-right: 8px;
|
|
1265
1265
|
display: flex;
|
|
1266
1266
|
height: 100%;
|
|
1267
1267
|
align-items: center;
|
|
1268
|
-
`;import{motion as
|
|
1268
|
+
`;import{motion as Up}from"framer-motion";var ls=({title:e,count:t,total:o,onClick:i,style:n={},className:r,appearance:s,type:p="default"})=>He.createElement(He.Fragment,null,He.createElement(ee,{appearance:s}),He.createElement(rs,{as:Up.div,whileHover:{opacity:.9},whileTap:{scale:.98},onClick:()=>i!==void 0&&i(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...n},className:Ce(r??"",l("progressRingContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&He.createElement(ss,{className:l("progressRingContainer",s)},He.createElement(Pt,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),He.createElement(is,{type:p,className:l("badgeTitleContainer",s)},He.createElement(ns,{type:p,appearance:s,className:l("badgeTitle",s)},e),i!==void 0&&He.createElement(Ot,{className:l("badgeChevron",s),color:s.theme.colorPrimary})),p=="default"&&o&&o!==0&&He.createElement(ze,{display:"compact",count:t,total:o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:s})));import at from"react";import to from"styled-components";var as=to.div`
|
|
1269
1269
|
display: flex;
|
|
1270
1270
|
flex-direction: row;
|
|
1271
1271
|
width: 100%;
|
|
@@ -1294,7 +1294,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1294
1294
|
justify-content: center;
|
|
1295
1295
|
margin-left: 16px;
|
|
1296
1296
|
min-width: 200px;
|
|
1297
|
-
`,
|
|
1297
|
+
`,qC=to.div`
|
|
1298
1298
|
display: flex;
|
|
1299
1299
|
justify-content: center;
|
|
1300
1300
|
align-items: flex-end;
|
|
@@ -1303,7 +1303,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1303
1303
|
:hover {
|
|
1304
1304
|
opacity: 0.8;
|
|
1305
1305
|
}
|
|
1306
|
-
`;var ms=({title:e,subtitle:t,icon:o,appearance:i,count:n,total:r,className:s,style:p})=>at.createElement(at.Fragment,null,at.createElement(as,{appearance:i,className:Ce(l("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&at.createElement(ps,{className:l("fullWidthProgressBadgeIcon",i)},o),at.createElement(ds,null,at.createElement(Se,{size:"small",appearance:i,title:e,subtitle:t})),at.createElement(cs,{className:l("fullWidthProgressBadgeProgressContainer",i)},at.createElement(ze,{count:n,total:r,display:"percent",textLocation:"top",fillColor:i.theme.colorPrimary}))));var
|
|
1306
|
+
`;var ms=({title:e,subtitle:t,icon:o,appearance:i,count:n,total:r,className:s,style:p})=>at.createElement(at.Fragment,null,at.createElement(as,{appearance:i,className:Ce(l("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&at.createElement(ps,{className:l("fullWidthProgressBadgeIcon",i)},o),at.createElement(ds,null,at.createElement(Se,{size:"small",appearance:i,title:e,subtitle:t})),at.createElement(cs,{className:l("fullWidthProgressBadgeProgressContainer",i)},at.createElement(ze,{count:n,total:r,display:"percent",textLocation:"top",fillColor:i.theme.colorPrimary}))));var zp=({flowId:e,title:t,subtitle:o,icon:i,style:n,onClick:r,className:s,customVariables:p,hideOnFlowCompletion:c,appearance:a,type:C="default"})=>{let{getFlow:d,getFlowSteps:u,getFlowStatus:y,getNumberOfStepsCompleted:E,isLoading:f,targetingLogicShouldHideFlow:x,updateCustomVariables:F}=X(),{mergeAppearanceWithDefault:k}=J();a=k(a);let{setOpenFlowState:B,getOpenFlowState:P}=Pe();if(_p(()=>{F(p)},[p,f]),f)return null;let S=d(e);if(!S||x(S)||c===!0&&y(e)===Y)return null;let m=u(e),h=E(e);return C==="full-width"?pt.createElement(pt.Fragment,null,pt.createElement(ee,{appearance:a}),pt.createElement(ms,{title:t,subtitle:o,count:h,total:m.length,style:n,className:s,appearance:a,icon:i,onClick:()=>{}})):pt.createElement(pt.Fragment,null,pt.createElement(ee,{appearance:a}),pt.createElement(ls,{count:h,total:m.length,title:t,style:n,onClick:()=>{B(e,!0),r&&r()},type:C,className:s,appearance:a}))};import Wp from"react";var Hp=({flowId:e,style:t,appearance:o,...i})=>{let{getFlow:n,targetingLogicShouldHideFlow:r,getFlowSteps:s}=X(),{mergeAppearanceWithDefault:p}=J();o=p(o);let c=n(e);if(!c||r(c))return null;let a=s(e);return Wp.createElement(Rt,{steps:a,style:t,appearance:o,...i})};import Ut,{useContext as ed,useEffect as td}from"react";import L,{useEffect as No,useLayoutEffect as gs,useRef as Kp,useState as oo}from"react";import ro from"styled-components";import{useCallback as jp,useEffect as Vp,useState as Gp}from"react";var dr=(e,t,o,i={x:20,y:20},n)=>{let r=n=="fixed"?0:window.scrollY,s=n=="fixed"?0:window.scrollX;return!e||!e.left||!e.top?{x:0,y:0}:t==="left"?{x:e.left-o+i.x+s,y:e.top-i.y+r}:t==="right"?{x:e.left+e.width+i.x+s,y:e.top-i.y+r}:{x:0,y:0}},us={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function qp(e){let t=us;return e&&(t=e.getBoundingClientRect()),t}function fs(e,t){let[o,i]=Gp(us),n=jp(()=>{e&&i(qp(e))},[e]);return Vp(()=>(n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)),[e,t]),o}var hs=300,xs=100,Yp=500,Mt=12,Xp=ro.div`
|
|
1307
1307
|
width: 100%;
|
|
1308
1308
|
height: 100%;
|
|
1309
1309
|
border-radius: 9999px;
|
|
@@ -1326,14 +1326,14 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1326
1326
|
opacity: 0;
|
|
1327
1327
|
}
|
|
1328
1328
|
}
|
|
1329
|
-
`,
|
|
1329
|
+
`,Jp=ro.div`
|
|
1330
1330
|
width: ${Mt}px;
|
|
1331
1331
|
height: ${Mt}px;
|
|
1332
1332
|
border-radius: 100px;
|
|
1333
1333
|
background-color: ${e=>e.primaryColor};
|
|
1334
1334
|
z-index: 20;
|
|
1335
1335
|
opacity: 1;
|
|
1336
|
-
`,
|
|
1336
|
+
`,Qp=ro.div`
|
|
1337
1337
|
pointer-events: all;
|
|
1338
1338
|
`,Cs=ro.div`
|
|
1339
1339
|
display: flex;
|
|
@@ -1341,10 +1341,10 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1341
1341
|
justify-content: center;
|
|
1342
1342
|
align-items: center;
|
|
1343
1343
|
z-index: ${e=>e.zIndex?e.zIndex:90};
|
|
1344
|
-
`,
|
|
1344
|
+
`,Zp=ro(Cs)`
|
|
1345
1345
|
width: ${Mt+12}px;
|
|
1346
1346
|
height: ${Mt+12}px;
|
|
1347
|
-
`,
|
|
1347
|
+
`,Rp=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:n=!0,primaryColor:r="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:c={},selectedStep:a=0,customStepTypes:C,appearance:d,dismissible:u=!1,showHighlightOnly:y,showStepCount:E=!0,completedStepsCount:f=0,showFrigadeBranding:x=!1})=>{var K,Ve,Ge,bt;let[F,k]=oo(),[B,P]=oo(new Date),S=Kp(null),[m,h]=oo(document.querySelector(e[a].selector)),w=fs(m,B),[N,W]=oo(),[H,A]=oo(!y),U=(Ve=(K=e[a])==null?void 0:K.props)!=null&&Ve.position?e[a].props.position:"absolute",$=((bt=(Ge=e[a])==null?void 0:Ge.props)==null?void 0:bt.zIndex)??90,O=(F==null?void 0:F.width)??hs,ne=(F==null?void 0:F.height)??xs;gs(()=>{S.current&&k({width:S.current.clientWidth,height:S.current.clientHeight})},[a,B,U]),No(()=>{y||A(!0)},[a]);let pe=i==="auto"?"right":i,D=dr(w,pe,O,s,U),we=w.right+O>(window.innerWidth||document.documentElement.clientWidth),xe=w.bottom+xs>(window.innerHeight||document.documentElement.clientHeight);we&&i==="auto"&&(D=dr(w,"left",O,s,U),pe="left");let te=window.location.pathname.split("/").pop(),V=()=>{let j=document.querySelector(e[a].selector);N&&N===JSON.stringify(j==null?void 0:j.getBoundingClientRect())||(h(j),P(new Date),j&&W(JSON.stringify(j.getBoundingClientRect())))};if(No(()=>{let j=new MutationObserver(V);return j.observe(document.body,{subtree:!0,childList:!0}),()=>j.disconnect()},[V]),No(()=>{let j=new MutationObserver(V);return j.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>j.disconnect()},[V]),No(()=>{let j=setInterval(()=>{V()},10);return()=>clearInterval(j)},[V]),gs(()=>{setTimeout(()=>{V()},Yp),V()},[a,te]),m===null)return L.createElement(L.Fragment,null);if(D.x==0&&D.y==0)return L.createElement(L.Fragment,null);if(!p)return L.createElement(L.Fragment,null);let oe=()=>{let j=()=>{if(e[a].handlePrimaryButtonClick&&(e[a].handlePrimaryButtonClick(),A(!1),setTimeout(()=>{V()},30)),f===e.length-1)return o()},Be=()=>{e[a].handleSecondaryButtonClick&&(e[a].handleSecondaryButtonClick(),y&&A(!1))};return L.createElement(L.Fragment,null,E&&L.createElement(Br,null,L.createElement(Ir,{className:l("tooltipStepCounter",d)},a+1," of ",e.length)),L.createElement(Ar,{showStepCount:E,className:l("tooltipCTAContainer",d)},e[a].secondaryButtonTitle&&L.createElement(R,{title:e[a].secondaryButtonTitle,appearance:d,onClick:Be,size:"small",withMargin:!1,secondary:!0}),e[a].primaryButtonTitle&&L.createElement(R,{title:e[a].primaryButtonTitle,appearance:d,onClick:j,withMargin:!1,size:"small"})))},I=()=>L.createElement(L.Fragment,null,u&&L.createElement(kr,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:l("tooltipClose",d)},L.createElement(ve,null)),e[a].imageUri&&L.createElement(Pr,{dismissible:u,appearance:d,src:e[a].imageUri,className:l("tooltipImageContainer",d)}),e[a].videoUri&&!e[a].imageUri&&L.createElement(vr,{dismissible:u,appearance:d,className:l("tooltipVideoContainer",d)},L.createElement(Et,{appearance:d,videoUri:e[a].videoUri})),L.createElement(Se,{appearance:d,title:e[a].title,subtitle:e[a].subtitle,size:"small"}),L.createElement(Er,{className:l("tooltipFooter",d)},L.createElement(oe,null))),fe={...{default:j=>{var Be;if((Be=e[a])!=null&&Be.StepContent){let g=e[a].StepContent;return L.createElement("div",null,g)}return L.createElement(I,null)}},...C},ke=()=>{var j;return e?!((j=e[a])!=null&&j.type)||!fe[e[a].type]?fe.default(e[a]):fe[e[a].type]({stepData:e[a],primaryColor:r}):L.createElement(L.Fragment,null)};if(y&&e[a].complete===!0)return null;let G={top:(D==null?void 0:D.y)-Mt,left:(pe=="left"?w.x+s.x:(D==null?void 0:D.x)-Mt)??0,cursor:y?"pointer":"default",position:U},ge=()=>{let Be=G.left+(pe=="left"?-O:24);return Math.min(Math.max(Be,20),window.innerWidth-O-20)},Z=()=>{y&&(P(new Date),A(!H))};return L.createElement(Qp,null,L.createElement(Zp,{style:G,zIndex:$,className:l("tourHighlightContainer",d)},n&&e[a].showHighlight!==!1&&L.createElement(L.Fragment,null,L.createElement(Jp,{style:{position:U},onClick:Z,primaryColor:d.theme.colorPrimary}),L.createElement(Xp,{style:{position:"absolute"},onClick:Z,primaryColor:d.theme.colorPrimary}))),L.createElement(Cs,{style:{...G,left:ge()},zIndex:$+1,className:l("tooltipContainerWrapper",d)},H&&L.createElement(L.Fragment,null,L.createElement(lo,{ref:S,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:12,...c},appearance:d,className:l("tooltipContainer",d),maxWidth:hs,zIndex:$+10},L.createElement(ke,null)),x&&L.createElement(Lr,{className:l("poweredByFrigadeTooltipRibbon",d),appearance:d,zIndex:$+10},L.createElement(ao,{appearance:d})))))},Lo=Rp;import{Portal as od}from"react-portal";var rd=({flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:n,showTooltipsSimultaneously:r=!1,onDismiss:s,dismissible:p,tooltipPosition:c="auto",showHighlightOnly:a=!1,dismissBehavior:C="complete-flow",onComplete:d,...u})=>{let{getFlow:y,getFlowSteps:E,isLoading:f,targetingLogicShouldHideFlow:x,markStepCompleted:F,markStepStarted:k,markFlowCompleted:B,updateCustomVariables:P,getCurrentStepIndex:S,getStepStatus:m,isStepBlocked:h,getFlowStatus:w,getNumberOfStepsCompleted:N}=X(),{isLoadingUserFlowStateData:W}=Ie(),{primaryCTAClickSideEffects:H,secondaryCTAClickSideEffects:A}=re(),{hasOpenModals:U}=Pe(),$=S(e),{openFlowStates:O}=ed(q),{mergeAppearanceWithDefault:ne}=J();if(o=ne(o),td(()=>{P(t)},[t,f]),W)return null;let pe=y(e);if(!pe||x(pe)||w(e)==Y||U())return null;let D=E(e);if(Object.keys(O).length>0){let I=Object.keys(O).find(se=>O[se]===!0);if(I!==void 0&&I!==e)return Ut.createElement(Ut.Fragment,null)}async function we(I){if(await F(e,I.id),D.map(se=>m(e,se.id)).every(se=>se===Oe)){await B(e);return}if(!a&&$+1<D.length){if(h(e,D[$+1].id))return;await k(e,D[$+1].id)}}function xe(I,se,fe){let ke=$+1<D.length?D[$+1]:null;n&&n(I,$,se,ke),i&&i(I,fe,ke)}function te(){return D.map(I=>({...I,handleSecondaryButtonClick:async()=>{A(I),I.skippable===!0&&await F(e,I.id,{skipped:!0}),xe(I,"secondary",$)},handlePrimaryButtonClick:async()=>{(!I.completionCriteria&&(I.autoMarkCompleted||I.autoMarkCompleted===void 0)||I.completionCriteria&&I.autoMarkCompleted===!0)&&await we(I),xe(I,"primary",$),H(I)}}))}async function V(I){s&&s(),C==="complete-flow"?await B(e):await F(e,I.id)}function oe(){d&&d()}return Ut.createElement(od,null,Ut.createElement(ee,{appearance:o}),r?D.map((I,se)=>Ut.createElement(Lo,{key:I.id,appearance:o,steps:te(),selectedStep:se,showTooltipsSimultaneously:r,dismissible:p,onDismiss:()=>V(I),tooltipPosition:c,showHighlightOnly:a,completedStepsCount:N(e),onComplete:oe,...u})):Ut.createElement(Lo,{appearance:o,steps:te(),selectedStep:$,showTooltipsSimultaneously:r,dismissible:p,onDismiss:()=>V(D[$]),tooltipPosition:c,completedStepsCount:N(e),showHighlightOnly:a,onComplete:oe,...u}))};import be,{useEffect as id,useRef as nd,useState as sd}from"react";import{Portal as ld}from"react-portal";import yt from"styled-components";var Ss=yt.button`
|
|
1348
1348
|
${e=>T(e)} {
|
|
1349
1349
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1350
1350
|
|
|
@@ -1432,7 +1432,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1432
1432
|
font-size: 14px;
|
|
1433
1433
|
|
|
1434
1434
|
padding: 8px 12px;
|
|
1435
|
-
`;import{AnimatePresence as As,motion as Is}from"framer-motion";import Ps from"react";var vs=({style:e,className:t})=>Ps.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Ps.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 Es from"react";var Bs=({style:e,className:t})=>Es.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"},Es.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
|
|
1435
|
+
`;import{AnimatePresence as As,motion as Is}from"framer-motion";import Ps from"react";var vs=({style:e,className:t})=>Ps.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Ps.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 Es from"react";var Bs=({style:e,className:t})=>Es.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"},Es.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 ad=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:n="inline",title:r="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:c,markStepCompleted:a,getStepStatus:C,getNumberOfStepsCompleted:d,isLoading:u,targetingLogicShouldHideFlow:y}=X(),{primaryCTAClickSideEffects:E}=re(),f=nd(null),[x,F]=sd(!1),{mergeAppearanceWithDefault:k}=J();s=k(s),id(()=>(document.addEventListener("click",B,!1),()=>{document.removeEventListener("click",B,!1)}),[]);let B=w=>{f.current&&!f.current.contains(w.target)&&F(!1)};if(u)return null;let P=p(e);if(!P||y(P))return null;let S=c(e);if(!S||!i)return null;function m(w,N){!w.completionCriteria&&(w.autoMarkCompleted||w.autoMarkCompleted===void 0)&&a(e,w.id),E(w),o&&o(w,N),F(!1)}function h(){return x&&be.createElement(Fs,{className:l("floatingWidgetMenu",s),as:Is.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:n},S.map((w,N)=>be.createElement(ks,{className:l("floatingWidgetMenuItem",s),key:N,onClick:()=>m(w,N)},w.title)))}return n=="inline"?be.createElement("span",{ref:f},be.createElement(Ss,{style:t,onClick:()=>{F(!x)},className:l("supportButton",s)},be.createElement(bs,{className:l("supportIconContainer",s)},be.createElement(Bs,{className:l("supportIcon",s),style:{width:"18px",height:"18px"}})),be.createElement(ys,{className:l("supportButtonTitle",s)},r)),be.createElement(As,null,be.createElement(h,null))):be.createElement(ld,null,be.createElement(ws,{style:t,ref:f},be.createElement(As,null,be.createElement(h,null)),be.createElement(Ts,{onClick:()=>{F(!x)},as:Is.button,whileHover:{scale:1.1},className:l("floatingWidgetButton",s)},be.createElement(vs,{className:l("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import je,{useEffect as pd}from"react";import Oo from"styled-components";var Ns=Oo.div`
|
|
1436
1436
|
${e=>T(e)} {
|
|
1437
1437
|
display: flex;
|
|
1438
1438
|
flex-direction: column;
|
|
@@ -1447,17 +1447,17 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1447
1447
|
border-radius: 12px;
|
|
1448
1448
|
position: relative;
|
|
1449
1449
|
}
|
|
1450
|
-
`,Ls=
|
|
1450
|
+
`,Ls=Oo.div`
|
|
1451
1451
|
display: flex;
|
|
1452
1452
|
flex-direction: column;
|
|
1453
1453
|
flex: 1;
|
|
1454
|
-
`,Os=
|
|
1454
|
+
`,Os=Oo.div`
|
|
1455
1455
|
display: flex;
|
|
1456
1456
|
flex-direction: column;
|
|
1457
1457
|
justify-content: center;
|
|
1458
1458
|
align-items: flex-start;
|
|
1459
1459
|
margin-top: 16px;
|
|
1460
|
-
`,Ds=
|
|
1460
|
+
`,Ds=Oo.div`
|
|
1461
1461
|
${e=>T(e)} {
|
|
1462
1462
|
position: absolute;
|
|
1463
1463
|
top: 16px;
|
|
@@ -1468,7 +1468,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1468
1468
|
opacity: 0.8;
|
|
1469
1469
|
}
|
|
1470
1470
|
}
|
|
1471
|
-
`;var
|
|
1471
|
+
`;var dd=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:s,dismissible:p})=>{let{getFlow:c,markFlowCompleted:a,markStepCompleted:C,isLoading:d,targetingLogicShouldHideFlow:u,updateCustomVariables:y,getFlowSteps:E,getFlowStatus:f,getCurrentStepIndex:x}=X(),{primaryCTAClickSideEffects:F}=re(),{mergeAppearanceWithDefault:k}=J();if(n=k(n),pd(()=>{y(o)},[o,d]),d)return null;let B=c(e);if(!B||u(B)||f(e)===Y)return null;let S=E(e)[x(e)];return je.createElement(je.Fragment,null,je.createElement(ee,{appearance:n}),je.createElement(Ns,{appearance:n,className:Ce(l("embeddedTipContainer",n),r),style:s},(p===!0||S.dismissible)&&je.createElement(Ds,{onClick:async()=>{await a(e),t&&t()},className:l("embeddedTipDismissButton",n)},je.createElement(ve,null)),je.createElement(Ls,null,je.createElement(Se,{size:"small",appearance:n,title:S.title,subtitle:S.subtitle})),S.primaryButtonTitle&&je.createElement(Os,{className:l("embeddedTipCallToActionContainer",n)},je.createElement(R,{classPrefix:"embeddedTip",title:S.primaryButtonTitle,appearance:n,withMargin:!1,size:"small",type:"inline",onClick:async()=>{S.handlePrimaryButtonClick(),F(S),!(i&&i(S,x(e),"primary")===!1)&&(await C(e,S.id),await a(e))}}))))};import he,{useEffect as cd}from"react";import _t from"styled-components";var $s=_t.div`
|
|
1472
1472
|
// use the :not annotation
|
|
1473
1473
|
${e=>T(e)} {
|
|
1474
1474
|
display: flex;
|
|
@@ -1499,7 +1499,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1499
1499
|
flex-direction: column;
|
|
1500
1500
|
justify-content: center;
|
|
1501
1501
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1502
|
-
`,
|
|
1502
|
+
`,cr=_t.div`
|
|
1503
1503
|
display: flex;
|
|
1504
1504
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1505
1505
|
align-items: flex-end;
|
|
@@ -1508,12 +1508,12 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1508
1508
|
:hover {
|
|
1509
1509
|
opacity: 0.8;
|
|
1510
1510
|
}
|
|
1511
|
-
`,
|
|
1511
|
+
`,mr=_t.div`
|
|
1512
1512
|
display: flex;
|
|
1513
1513
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1514
1514
|
align-items: flex-end;
|
|
1515
1515
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1516
|
-
`;import zs from"react";var Ws=({style:e,className:t})=>zs.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"},zs.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
|
|
1516
|
+
`;import zs from"react";var Ws=({style:e,className:t})=>zs.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"},zs.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 md=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:n,onButtonClick:r,appearance:s,type:p="full-width",icon:c})=>{let{getFlow:a,markFlowCompleted:C,isLoading:d,targetingLogicShouldHideFlow:u,updateCustomVariables:y,getFlowMetadata:E,getFlowStatus:f,getFlowSteps:x,getCurrentStepIndex:F}=X(),{primaryCTAClickSideEffects:k}=re(),{mergeAppearanceWithDefault:B}=J();if(s=B(s),cd(()=>{y(n)},[n,d]),d)return null;let P=a(e);if(!P||u(P)||f(e)===Y)return null;let S=x(e),m=S.length>0?S[F(e)]:E(e);return m!=null&&m.title&&(t=m.title),m!=null&&m.subtitle&&(o=m.subtitle),he.createElement(he.Fragment,null,he.createElement(ee,{appearance:s}),he.createElement($s,{type:p,appearance:s,className:l("bannerContainer",s)},p!="square"&&he.createElement(Ms,{className:l("bannerIconContainer",s)},c||he.createElement(Ws,null)),p==="square"&&m.dismissible&&he.createElement(mr,{type:p,className:l("bannerDismissButtonContainer",s)},he.createElement(cr,{type:p,onClick:async()=>{await C(e),i&&i()},className:l("bannerDismissButton",s)},he.createElement(ve,null))),he.createElement(Us,{type:p},he.createElement(Se,{appearance:s,title:t,subtitle:o})),he.createElement(_s,{type:p,className:l("bannerCallToActionContainer",s)},he.createElement(R,{title:(m==null?void 0:m.primaryButtonTitle)??"Get started",appearance:s,onClick:()=>{k(m),r&&r(m,0,"primary")}})),p!=="square"&&m.dismissible&&he.createElement(mr,{type:p,className:l("bannerDismissButtonContainer",s)},he.createElement(cr,{type:p,onClick:async()=>{await C(e),i&&i()},className:l("bannerDismissButton",s)},he.createElement(ve,null)))))};import Q,{useEffect as ud}from"react";import{Portal as fd}from"react-portal";import tt from"styled-components";var Hs=tt.div`
|
|
1517
1517
|
${e=>T(e)} {
|
|
1518
1518
|
display: flex;
|
|
1519
1519
|
flex-direction: column;
|
|
@@ -1534,7 +1534,7 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1534
1534
|
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
|
|
1535
1535
|
min-width: 550px;
|
|
1536
1536
|
}
|
|
1537
|
-
`,
|
|
1537
|
+
`,js=tt.button`
|
|
1538
1538
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1539
1539
|
border-radius: 8px;
|
|
1540
1540
|
// If selected make border color primary and text color color priamry
|
|
@@ -1555,24 +1555,24 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1555
1555
|
display: flex;
|
|
1556
1556
|
justify-content: center;
|
|
1557
1557
|
align-items: center;
|
|
1558
|
-
`,
|
|
1558
|
+
`,ur=tt.div`
|
|
1559
1559
|
display: flex;
|
|
1560
1560
|
justify-content: flex-end;
|
|
1561
1561
|
margin-top: 16px;
|
|
1562
1562
|
gap: 8px;
|
|
1563
|
-
`,
|
|
1563
|
+
`,Vs=tt.div`
|
|
1564
1564
|
display: flex;
|
|
1565
1565
|
justify-content: space-between;
|
|
1566
1566
|
margin-top: 8px;
|
|
1567
|
-
`,
|
|
1567
|
+
`,fr=tt.div`
|
|
1568
1568
|
font-size: 12px;
|
|
1569
1569
|
line-height: 16px;
|
|
1570
1570
|
color: ${e=>e.appearance.theme.colorTextDisabled};
|
|
1571
|
-
`,
|
|
1571
|
+
`,gr=tt.div`
|
|
1572
1572
|
display: flex;
|
|
1573
1573
|
flex-direction: column;
|
|
1574
1574
|
flex: 1;
|
|
1575
|
-
`,
|
|
1575
|
+
`,ry=tt.div`
|
|
1576
1576
|
display: flex;
|
|
1577
1577
|
flex-direction: column;
|
|
1578
1578
|
justify-content: center;
|
|
@@ -1600,5 +1600,5 @@ ${i=>i.inlineStyles.map(([n,r])=>`.${Vt}${n}.${Vt}${n} { ${Object.entries(r).map
|
|
|
1600
1600
|
opacity: 0.8;
|
|
1601
1601
|
}
|
|
1602
1602
|
}
|
|
1603
|
-
`;var
|
|
1603
|
+
`;var gd=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:s})=>{let{getFlow:p,markFlowCompleted:c,markStepCompleted:a,getNumberOfStepsCompleted:C,isLoading:d,targetingLogicShouldHideFlow:u,updateCustomVariables:y,getFlowSteps:E,getFlowStatus:f,getCurrentStepIndex:x}=X(),{primaryCTAClickSideEffects:F}=re(),{mergeAppearanceWithDefault:k}=J(),[B,P]=Q.useState(null),[S,m]=Q.useState(""),{hasOpenModals:h,setKeepCompletedFlowOpenDuringSession:w,shouldKeepCompletedFlowOpenDuringSession:N}=Pe();if(n=k(n),ud(()=>{y(o)},[o,d]),d)return null;let W=p(e);if(!W||u(W)||f(e)===Y||C(e)===1&&!N(e)||h())return null;let A=E(e)[x(e)];function U(){return Q.createElement(Q.Fragment,null,Q.createElement(gr,null,Q.createElement(Se,{size:"large",appearance:n,title:A.title,subtitle:A.subtitle})),Q.createElement(ur,{className:l("npsNumberButtonContainer",n),appearance:n},Array.from(Array(10).keys()).map(O=>Q.createElement(js,{className:l("npsNumberButton",n),selected:B===O+1,key:O,onClick:async()=>{w(e),P(O+1),await a(e,A.id,{score:O+1})},appearance:n},O+1))),Q.createElement(Vs,{appearance:n},Q.createElement(fr,{appearance:n},"Not likely at all"),Q.createElement(fr,{appearance:n},"Extremely likely")))}function $(){return Q.createElement(Q.Fragment,null,Q.createElement(gr,null,Q.createElement(Se,{appearance:n,title:"Why did you choose this score?",size:"large"})),Q.createElement(Gs,{appearance:n,value:S,onChange:O=>{m(O.target.value)},placeHolder:"Add your optional fedback here..."}),Q.createElement(ur,{appearance:n,className:l("npsNumberButtonContainer",n)},Q.createElement(R,{size:"large",withMargin:!1,onClick:async()=>{await c(e),i&&i(A,1,"primary")},appearance:n,title:A.secondaryButtonTitle||"Skip",secondary:!0}),Q.createElement(R,{size:"large",withMargin:!1,onClick:async()=>{await a(e,A.id,{feedbackText:S}),await c(e),i&&i(A,1,"primary")},appearance:n,title:A.primaryButtonTitle||"Submit"})))}return Q.createElement(fd,null,Q.createElement(ee,{appearance:n}),Q.createElement(Hs,{appearance:n,className:Ce(l("npsSurveyContainer",n),r),style:s},Q.createElement(qs,{onClick:async()=>{await c(e),t&&t()},className:l("npsSurveyDismissButton",n)},Q.createElement(ve,null)),C(e)==0&&U(),C(e)==1&&$()))};export{Xe as CheckBox,nt as FormLabel,Vo as FormTextField,md as FrigadeBanner,pr as FrigadeChecklist,Ye as FrigadeDefaultAppearance,dd as FrigadeEmbeddedTip,yi as FrigadeForm,Hp as FrigadeGuide,Mp as FrigadeHeroChecklist,gd as FrigadeNPSSurvey,zp as FrigadeProgressBadge,_a as FrigadeProvider,ad as FrigadeSupportWidget,rd as FrigadeTour,Pt as ProgressRing,Pe as useFlowOpens,Wt as useFlowResponses,X as useFlows,Ro as useOrganization,Ht as useUser};
|
|
1604
1604
|
//# sourceMappingURL=index.mjs.map
|