@frigade/react 1.35.10 → 1.35.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -0
- package/lib/index.js +164 -161
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +114 -111
- package/lib/index.mjs.map +1 -1
- package/package.json +4 -4
package/lib/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import{ThemeProvider as Hp}from"styled-components";import bt,{useContext as xp,useEffect as Lo,useState as fr}from"react";import{useCallback as ht,useContext as Wl,useEffect as _l}from"react";import Yo,{useMemo as Dr}from"react";var Lr="1.35.10 ";var Ne="NOT_STARTED_STEP",q="COMPLETED_FLOW",xo="ABORTED_FLOW",xt="STARTED_FLOW",$e="NOT_STARTED_FLOW",Me="COMPLETED_STEP",ho="STARTED_STEP";function We(){let{publicApiKey:e,userId:t,apiUrl:o}=Yo.useContext(K);return{config:Dr(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Lr,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:Dr(()=>`${o}/v1/public/`,[o])}}var Bl="frigade-last-call-at-",El="frigade-last-call-data-";function It(){let{shouldGracefullyDegrade:e,readonly:t}=Yo.useContext(K);return async(o,i)=>{if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Nt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Nt();let r=Bl+o,n=El+o;if(window&&window.localStorage&&i&&i.body&&i.method==="POST"){let p=window.localStorage.getItem(r),c=window.localStorage.getItem(n);if(p&&c&&c==i.body){let a=new Date(p);if(new Date().getTime()-a.getTime()<1e3)return Nt()}window.localStorage.setItem(r,new Date().toISOString()),window.localStorage.setItem(n,i.body)}let s;try{s=await fetch(o,i)}catch(p){return Nt(p)}return s?s.ok?s:Nt(s.statusText):Nt()}}function Nt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Ot(){let{publicApiKey:e,shouldGracefullyDegrade:t}=Yo.useContext(K);function o(){return t?(console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize"),!1):e?!0:(console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider"),!1)}return{verifySDKInitiated:o}}import{useContext as Ml,useState as $r}from"react";import{useContext as Nl,useEffect as Il,useState as Ol}from"react";import Ll from"swr";import{useContext as Al}from"react";function we(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:r}=Al(K);function n(d,x=!1){return e[d]??x}function s(d,x){t(b=>({...b,[d]:x}))}function p(d){t(x=>{let{[d]:b,...w}=x;return{...w}})}function c(d){r.includes(d)||i(x=>[...x,d])}function a(d){return r.includes(d)}function g(d){return Object.entries(e).some(([x,b])=>b&&x!=d)||o}return{getOpenFlowState:n,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:g,setKeepCompletedFlowOpenDuringSession:c,shouldKeepCompletedFlowOpenDuringSession:a}}import Dl from"swr/immutable";var $l="unknown";function ve(){let{config:e,apiUrl:t}=We(),{publicApiKey:o,userId:i,organizationId:r,flows:n,setShouldGracefullyDegrade:s,readonly:p}=Nl(K),{resetOpenFlowState:c}=we(),[a,g]=Ol(!1),d={data:n.map(F=>({flowId:F.id,flowState:q,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},x=F=>fetch(F,e).then(k=>{if(k.ok)return k.json();throw new Error("Failed to fetch user flow states")}).catch(k=>(console.log(`Error fetching ${F}: ${k}. Will gracefully degrade and hide Frigade`),s(!0),d)),b=o&&n&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,{data:w,isLoading:v,mutate:f,error:E}=p?Dl(b,x):Ll(b,x,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),S=w==null?void 0:w.data;Il(()=>{!a&&!v&&S&&g(!0)},[S,a,v]);async function y(F){if(S&&!p){let k=S.find(O=>O.flowId===F);k&&k.flowState!==q&&(k.flowState=q),await f(Promise.resolve({...w,data:S}),{optimisticData:{...w,data:S},revalidate:!1,rollbackOnError:!1})}}async function A(F,k,O){if(S){let N=S.find(I=>I.flowId===F);N&&(N.stepStates[k]=O,N.flowState=xt),await f(Promise.resolve({...w,data:S}),{optimisticData:{...w,data:S},revalidate:!1,rollbackOnError:!1})}}async function C(F,k,O){if(S){let N=S.find(I=>I.flowId===F);N&&(N.lastStepId=k,N.stepStates[k]=O,N.flowState=xt),await f({...w,data:S},{optimisticData:{...w,data:S},revalidate:!1,rollbackOnError:!1})}}async function m(F){if(S){let k=S.find(O=>O.flowId===F);k&&k.flowState!==$e&&(k.flowState=$e,k.lastStepId=$l,Object.keys(k.stepStates).forEach(O=>{k.stepStates[O].actionType=Ne,k.stepStates[O].createdAt=new Date().toISOString()}),await f({...w,data:S},{optimisticData:{...w,data:S},revalidate:!1,rollbackOnError:!1}),c(F))}}async function B(F,k){if(S){let O=S.find(N=>N.flowId===F);O&&O.stepStates[k]!==Ne&&(O.stepStates[k]=Ne),await f({...w,data:S},{optimisticData:{...w,data:S},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:S,isLoadingUserFlowStateData:!a,mutateUserFlowState:f,optimisticallyMarkFlowCompleted:y,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:A,optimisticallyMarkStepNotStarted:B,optimisticallyMarkStepStarted:C,error:E}}function Xt(){let{config:e,apiUrl:t}=We(),{userFlowStatesData:o,mutateUserFlowState:i}=ve(),{failedFlowResponses:r,setFailedFlowResponses:n,flowResponses:s,setFlowResponses:p}=Ml(K),[c,a]=$r(new Set),[g,d]=$r(new Set),x=It();function b(f){let E=JSON.stringify(f);if(c.has(E))return null;c.add(E),a(c),g.add(f),d(g);let S=s==null?void 0:s.find(y=>y.flowSlug===f.flowSlug&&y.stepId===f.stepId&&y.actionType===f.actionType&&y.createdAt===f.createdAt);return x(`${t}flowResponses`,{...e,method:"POST",body:E}).then(y=>{y.status!==200&&y.status!==201?(console.log("Failed to send flow response for step "+f.stepId+". Will retry again later."),n([...r,f])):S||p(A=>[...A??[],f])})}async function w(f){f.foreignUserId&&(f.actionType===xt||f.actionType===$e?await b(f):f.actionType===q?await b(f):f.actionType===ho?await b(f):f.actionType===Me?await b(f):f.actionType===xo?await b(f):f.actionType===Ne&&await b(f))}function v(){let f=[];return o==null||o.forEach(E=>{if(E&&E.stepStates&&Object.keys(E.stepStates).length!==0)for(let S in E.stepStates){let y=E.stepStates[S];f.push({foreignUserId:E.foreignUserId,flowSlug:E.flowId,stepId:y.stepId,actionType:y.actionType,data:{},createdAt:new Date(y.createdAt),blocked:y.blocked,hidden:y.hidden})}}),[...f,...s]}return{addResponse:w,setFlowResponses:p,getFlowResponses:v}}import Hl from"swr";var Ul=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Mr=e=>{let t=Ul.exec(e);if(t===null)return null;let o=null;return t.forEach((i,r)=>{let n=zl(i,"'","");n.startsWith("flow_")&&(o=n)}),o},zl=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function Y(){let{config:e,apiUrl:t}=We(),{flows:o,setFlows:i,userId:r,publicApiKey:n,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:a,setFlowResponses:g,setShouldGracefullyDegrade:d,readonly:x}=Wl(K),b={data:[]},{verifySDKInitiated:w}=Ot(),{addResponse:v,getFlowResponses:f}=Xt(),E=u=>fetch(u,e).then(h=>h.ok?h.json():(console.log(`Error fetching ${u} (${h.status}): ${h.statusText}. .Will gracefully degrade and hide Frigade`),d(!0),b)).catch(h=>(console.log(`Error fetching ${u}: ${h}. Will gracefully degrade and hide Frigade`),d(!0),b)),{mutateUserFlowState:S,userFlowStatesData:y,isLoadingUserFlowStateData:A,optimisticallyMarkFlowCompleted:C,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:B,optimisticallyMarkStepNotStarted:F,optimisticallyMarkStepStarted:k}=ve(),{data:O,error:N,isLoading:I}=Hl(n?`${t}flows${x?"?readonly=true":""}`:null,E,{keepPreviousData:!0});_l(()=>{if(N){console.error(N);return}O&&O.data&&i(O.data)},[O,N]);function $(u){if(I)return null;let h=o.find(P=>P.slug===u);return!h&&o.length>0&&!A&&!I?(console.log(`Flow with id ${u} not found`),null):(h==null?void 0:h.active)===!1?null:h}function D(u){var W;if(!$(u))return[];let h=$(u).data;return h?(h=ee(h),(((W=JSON.parse(h))==null?void 0:W.data)??[]).map(M=>{let De=se(M);return{handleSecondaryButtonClick:()=>{M.skippable===!0&&j(u,M.id,{skipped:!0})},...M,complete:ge(u,M.id)===Me||De>=1,blocked:re(u,M.id),hidden:L(u,M.id),handlePrimaryButtonClick:()=>{(!M.completionCriteria&&(M.autoMarkCompleted||M.autoMarkCompleted===void 0)||M.completionCriteria&&M.autoMarkCompleted===!0)&&j(u,M.id)},progress:De}}).filter(M=>M.hidden!==!0)):[]}function ee(u){return u.replaceAll(/\${(.*?)}/g,(h,P)=>s[P]===void 0?"":String(s[P]).replace(/[\u00A0-\u9999<>\&]/g,function(W){return"&#"+W.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(u){if(!$(u))return[];let h=$(u).data;return h?(h=ee(h),JSON.parse(h)??{}):[]}function te(u,h){p(P=>({...P,[u]:h}))}function fe(u){!A&&!I&&u&&JSON.stringify(s)!=JSON.stringify({...s,...u})&&Object.keys(u).forEach(h=>{te(h,u[h])})}let X=ht(async(u,h,P)=>{if(!w())return;let W={foreignUserId:r,flowSlug:u,stepId:h,actionType:ho,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await k(u,h,W),v(W))},[r,y]),H=ht(async(u,h,P)=>{if(!w())return;let W={foreignUserId:r,flowSlug:u,stepId:h,actionType:Ne,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await F(u,h),v(W))},[r,y]),j=ht(async(u,h,P)=>{if(!w())return;let W={foreignUserId:r,flowSlug:u,stepId:h,actionType:Me,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await B(u,h,W),v(W))},[r,y]),Ce=ht(async(u,h)=>{if(!w()||pe(u)===$e)return;let P={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:$e,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};await m(u),J(P)&&v(P)},[r,y]),Ae=ht(async(u,h)=>{if(!w())return;let P={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:xt,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&v(P)},[r,y]),be=ht(async(u,h)=>{if(!w())return;let P={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:q,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&(await C(u),v(P))},[r,y]),me=ht(async(u,h)=>{if(!w())return;let P={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:xo,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&(await C(u),v(P))},[r,y]);function J(u){var h;if(!y&&u.actionType===Ne)return!1;if(y){let P=y.find(W=>W.flowId===u.flowSlug);if(u.actionType===Ne&&(!(P!=null&&P.stepStates[u.stepId])||P.stepStates[u.stepId].actionType===Ne)||P&&((h=P.stepStates[u.stepId])==null?void 0:h.actionType)===u.actionType||P&&P.flowState===q&&u.actionType===q)return!1}return!0}function ge(u,h){let P=V(u,h);return A?null:P?P.actionType:Ne}function re(u,h){let P=V(u,h);return P?P.blocked:!1}function L(u,h){let P=V(u,h);return P?P.hidden:!1}function V(u,h){if(A)return null;let P=y==null?void 0:y.find(W=>W.flowId===u);return!P||!P.stepStates[h]?null:P.stepStates[h]??null}function G(u){var P;if(A||!y)return null;if(pe(u)===$e)return D(u)[0]??null;let h=(P=y.find(W=>W.flowId===u))==null?void 0:P.lastStepId;return h?D(u).find(W=>W.id===h):null}function ne(u){let h=G(u);if(!h)return 0;let P=D(u).findIndex(W=>W.id===h.id)??0;return ge(u,h.id)===Me&&P<D(u).length-1?P+1:P}function se(u){if(!u.completionCriteria)return;let h=Mr(u.completionCriteria);if(h===null)return;let P=qe(h),W=Le(h);return W===0?void 0:P/W}function pe(u){let h=y==null?void 0:y.find(P=>P.flowId===u);return h?h.flowState:null}function qe(u){let h=D(u);return h.length===0?0:h.filter(W=>ge(u,W.id)===Me).length}function Le(u){return D(u).length}function Et(u){let h=o.find(P=>P.slug===u);return h?JSON.parse(h.data):null}function ft(u){if(x)return!1;if(A)return!0;if(u!=null&&u.targetingLogic&&y){let h=y.find(P=>P.flowId===u.slug);if(h)return h.shouldTrigger===!1}return!!(u!=null&&u.targetingLogic&&r&&r.startsWith("guest_"))}function At(u){return!ft($(u))}function gt(){r&&S()}return{getFlow:$,getFlowData:Et,isLoading:A||I,getStepStatus:ge,getFlowSteps:D,getCurrentStepIndex:ne,markStepStarted:X,markStepCompleted:j,markFlowNotStarted:Ce,markFlowStarted:Ae,markFlowCompleted:be,markFlowAborted:me,markStepNotStarted:H,getFlowStatus:pe,getNumberOfStepsCompleted:qe,getNumberOfSteps:Le,targetingLogicShouldHideFlow:ft,setCustomVariable:te,updateCustomVariables:fe,customVariables:s,getStepOptionalProgress:se,getFlowMetadata:U,isStepBlocked:re,isStepHidden:L,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:a,isFlowAvailableToUser:At,refresh:gt}}import{useCallback as Ur,useContext as jl,useEffect as Vl}from"react";var Lt="guest_";function Jt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=jl(K),{config:n,apiUrl:s}=We(),{mutateUserFlowState:p}=ve(),c=It(),{verifySDKInitiated:a}=Ot();Vl(()=>{if(e&&!t){if(e.startsWith(Lt))return;let x=`frigade-user-registered-${e}`;localStorage.getItem(x)||(c(`${s}users`,{...n,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(x,"true"))}},[e,r,t]);let g=Ur(async x=>{if(!a())return;let b={foreignId:e,properties:x};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(b)}),i(w=>({...w,...x})),p()},[e,n,r,p]),d=Ur(async(x,b)=>{if(!a())return;let v={foreignId:e,events:[{event:x,properties:b}]};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(v)}),p()},[e,n,p]);return{userId:e,setUserId:o,addPropertiesToUser:g,trackEventForUser:d}}import{v4 as hp}from"uuid";import Ve,{useEffect as mp,useState as up}from"react";import Ue,{useEffect as Rl}from"react";import So from"styled-components";import Gl from"react";import Kl from"styled-components";var zr="fr-",Qt="cfr-";function l(e,t){let o=`${zr}${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+" "+Qt+e}return o}function T(e){if(!e.className||e.className.indexOf(Qt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(zr)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Xo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function Ye(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Xo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function xe(...e){return e.filter(Boolean).join(" ")}function Zt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var ql=Kl.div`
|
|
2
|
+
import wt,{createContext as _p,useEffect as $o,useState as Oe}from"react";import{ThemeProvider as Hp}from"styled-components";import bt,{useContext as xp,useEffect as Lo,useState as gr}from"react";import{useCallback as ht,useContext as Wl,useEffect as _l}from"react";import Yo,{useMemo as $r}from"react";var Dr="1.35.12 ";var Ie="NOT_STARTED_STEP",q="COMPLETED_FLOW",xo="ABORTED_FLOW",xt="STARTED_FLOW",Me="NOT_STARTED_FLOW",Ue="COMPLETED_STEP",ho="STARTED_STEP";function _e(){let{publicApiKey:e,userId:t,apiUrl:o}=Yo.useContext(K);return{config:$r(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Dr,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:$r(()=>`${o}/v1/public/`,[o])}}var Bl="frigade-last-call-at-",El="frigade-last-call-data-";function It(){let{shouldGracefullyDegrade:e,readonly:t}=Yo.useContext(K);return async(o,i)=>{if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Nt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Nt();let r=Bl+o,n=El+o;if(window&&window.localStorage&&i&&i.body&&i.method==="POST"){let p=window.localStorage.getItem(r),c=window.localStorage.getItem(n);if(p&&c&&c==i.body){let a=new Date(p);if(new Date().getTime()-a.getTime()<1e3)return Nt()}window.localStorage.setItem(r,new Date().toISOString()),window.localStorage.setItem(n,i.body)}let s;try{s=await fetch(o,i)}catch(p){return Nt(p)}return s?s.ok?s:Nt(s.statusText):Nt()}}function Nt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Ot(){let{publicApiKey:e,shouldGracefullyDegrade:t}=Yo.useContext(K);function o(){return t?(console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize"),!1):e?!0:(console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider"),!1)}return{verifySDKInitiated:o}}import{useContext as Ml,useState as Mr}from"react";import{useContext as Nl,useEffect as Il,useState as Ol}from"react";import Ll from"swr";import{useContext as Al}from"react";function we(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:r}=Al(K);function n(d,y=!1){return e[d]??y}function s(d,y){t(w=>({...w,[d]:y}))}function p(d){t(y=>{let{[d]:w,...C}=y;return{...C}})}function c(d){r.includes(d)||i(y=>[...y,d])}function a(d){return r.includes(d)}function g(d){return Object.entries(e).some(([y,w])=>w&&y!=d)||o}return{getOpenFlowState:n,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:g,setKeepCompletedFlowOpenDuringSession:c,shouldKeepCompletedFlowOpenDuringSession:a}}import Dl from"swr/immutable";var $l="unknown";function Be(){let{config:e,apiUrl:t}=_e(),{publicApiKey:o,userId:i,organizationId:r,flows:n,setShouldGracefullyDegrade:s,readonly:p}=Nl(K),{resetOpenFlowState:c}=we(),[a,g]=Ol(!1),d={data:n.map(k=>({flowId:k.id,flowState:q,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},y=k=>fetch(k,e).then(P=>{if(P.ok)return P.json();throw new Error("Failed to fetch user flow states")}).catch(P=>(console.log(`Error fetching ${k}: ${P}. Will gracefully degrade and hide Frigade`),s(!0),d)),w=o&&n&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,{data:C,isLoading:T,mutate:f,error:B}=p?Dl(w,y):Ll(w,y,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),b=C==null?void 0:C.data;Il(()=>{!a&&!T&&b&&g(!0)},[b,a,T]);async function S(k){if(b&&!p){let P=b.find(O=>O.flowId===k);P&&P.flowState!==q&&(P.flowState=q),await f(Promise.resolve({...C,data:b}),{optimisticData:{...C,data:b},revalidate:!1,rollbackOnError:!1})}}async function A(k,P,O){if(b){let N=b.find(I=>I.flowId===k);N&&(N.stepStates[P]=O,N.flowState=xt),await f(Promise.resolve({...C,data:b}),{optimisticData:{...C,data:b},revalidate:!1,rollbackOnError:!1})}}async function h(k,P,O){if(b){let N=b.find(I=>I.flowId===k);N&&(N.lastStepId=P,N.stepStates[P]=O,N.flowState=xt),await f({...C,data:b},{optimisticData:{...C,data:b},revalidate:!1,rollbackOnError:!1})}}async function m(k){if(b){let P=b.find(O=>O.flowId===k);P&&P.flowState!==Me&&(P.flowState=Me,P.lastStepId=$l,Object.keys(P.stepStates).forEach(O=>{P.stepStates[O].actionType=Ie,P.stepStates[O].createdAt=new Date().toISOString()}),await f({...C,data:b},{optimisticData:{...C,data:b},revalidate:!1,rollbackOnError:!1}),c(k))}}async function E(k,P){if(b){let O=b.find(N=>N.flowId===k);O&&O.stepStates[P]!==Ie&&(O.stepStates[P]=Ie),await f({...C,data:b},{optimisticData:{...C,data:b},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:b,isLoadingUserFlowStateData:!a,mutateUserFlowState:f,optimisticallyMarkFlowCompleted:S,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:A,optimisticallyMarkStepNotStarted:E,optimisticallyMarkStepStarted:h,error:B}}function Xt(){let{config:e,apiUrl:t}=_e(),{userFlowStatesData:o,mutateUserFlowState:i}=Be(),{failedFlowResponses:r,setFailedFlowResponses:n,flowResponses:s,setFlowResponses:p}=Ml(K),[c,a]=Mr(new Set),[g,d]=Mr(new Set),y=It();function w(f){let B=JSON.stringify(f);if(c.has(B))return null;c.add(B),a(c),g.add(f),d(g);let b=s==null?void 0:s.find(S=>S.flowSlug===f.flowSlug&&S.stepId===f.stepId&&S.actionType===f.actionType&&S.createdAt===f.createdAt);return y(`${t}flowResponses`,{...e,method:"POST",body:B}).then(S=>{S.status!==200&&S.status!==201?(console.log("Failed to send flow response for step "+f.stepId+". Will retry again later."),n([...r,f])):b||p(A=>[...A??[],f])})}async function C(f){f.foreignUserId&&(f.actionType===xt||f.actionType===Me?await w(f):f.actionType===q?await w(f):f.actionType===ho?await w(f):f.actionType===Ue?await w(f):f.actionType===xo?await w(f):f.actionType===Ie&&await w(f))}function T(){let f=[];return o==null||o.forEach(B=>{if(B&&B.stepStates&&Object.keys(B.stepStates).length!==0)for(let b in B.stepStates){let S=B.stepStates[b];f.push({foreignUserId:B.foreignUserId,flowSlug:B.flowId,stepId:S.stepId,actionType:S.actionType,data:{},createdAt:new Date(S.createdAt),blocked:S.blocked,hidden:S.hidden})}}),[...f,...s]}return{addResponse:C,setFlowResponses:p,getFlowResponses:T}}import Hl from"swr";var Ul=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Ur=e=>{let t=Ul.exec(e);if(t===null)return null;let o=null;return t.forEach((i,r)=>{let n=zl(i,"'","");n.startsWith("flow_")&&(o=n)}),o},zl=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function Y(){let{config:e,apiUrl:t}=_e(),{flows:o,setFlows:i,userId:r,publicApiKey:n,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:a,setFlowResponses:g,setShouldGracefullyDegrade:d,readonly:y}=Wl(K),w={data:[]},{verifySDKInitiated:C}=Ot(),{addResponse:T,getFlowResponses:f}=Xt(),B=u=>fetch(u,e).then(x=>x.ok?x.json():(console.log(`Error fetching ${u} (${x.status}): ${x.statusText}. .Will gracefully degrade and hide Frigade`),d(!0),w)).catch(x=>(console.log(`Error fetching ${u}: ${x}. Will gracefully degrade and hide Frigade`),d(!0),w)),{mutateUserFlowState:b,userFlowStatesData:S,isLoadingUserFlowStateData:A,optimisticallyMarkFlowCompleted:h,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:E,optimisticallyMarkStepNotStarted:k,optimisticallyMarkStepStarted:P}=Be(),{data:O,error:N,isLoading:I}=Hl(n?`${t}flows${y?"?readonly=true":""}`:null,B,{keepPreviousData:!0});_l(()=>{if(N){console.error(N);return}O&&O.data&&i(O.data)},[O,N]);function $(u){if(I)return null;let x=o.find(v=>v.slug===u);return!x&&o.length>0&&!A&&!I?(console.log(`Flow with id ${u} not found`),null):(x==null?void 0:x.active)===!1?null:x}function D(u){var W;if(!$(u))return[];let x=$(u).data;return x?(x=ee(x),(((W=JSON.parse(x))==null?void 0:W.data)??[]).map(M=>{let $e=se(M);return{handleSecondaryButtonClick:()=>{M.skippable===!0&&j(u,M.id,{skipped:!0})},...M,complete:ge(u,M.id)===Ue||$e>=1,blocked:re(u,M.id),hidden:L(u,M.id),handlePrimaryButtonClick:()=>{(!M.completionCriteria&&(M.autoMarkCompleted||M.autoMarkCompleted===void 0)||M.completionCriteria&&M.autoMarkCompleted===!0)&&j(u,M.id)},progress:$e}}).filter(M=>M.hidden!==!0)):[]}function ee(u){return u.replaceAll(/\${(.*?)}/g,(x,v)=>s[v]===void 0?"":String(s[v]).replace(/[\u00A0-\u9999<>\&]/g,function(W){return"&#"+W.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(u){if(!$(u))return[];let x=$(u).data;return x?(x=ee(x),JSON.parse(x)??{}):[]}function te(u,x){p(v=>({...v,[u]:x}))}function fe(u){!A&&!I&&u&&JSON.stringify(s)!=JSON.stringify({...s,...u})&&Object.keys(u).forEach(x=>{te(x,u[x])})}let X=ht(async(u,x,v)=>{if(!C())return;let W={foreignUserId:r,flowSlug:u,stepId:x,actionType:ho,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await P(u,x,W),T(W))},[r,S]),H=ht(async(u,x,v)=>{if(!C())return;let W={foreignUserId:r,flowSlug:u,stepId:x,actionType:Ie,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await k(u,x),T(W))},[r,S]),j=ht(async(u,x,v)=>{if(!C())return;let W={foreignUserId:r,flowSlug:u,stepId:x,actionType:Ue,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await E(u,x,W),T(W))},[r,S]),Ce=ht(async(u,x)=>{if(!C()||pe(u)===Me)return;let v={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:Me,data:x??{},createdAt:new Date,blocked:!1,hidden:!1};await m(u),J(v)&&T(v)},[r,S]),Ne=ht(async(u,x)=>{if(!C())return;let v={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:xt,data:x??{},createdAt:new Date,blocked:!1,hidden:!1};J(v)&&T(v)},[r,S]),be=ht(async(u,x)=>{if(!C())return;let v={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:q,data:x??{},createdAt:new Date,blocked:!1,hidden:!1};J(v)&&(await h(u),T(v))},[r,S]),me=ht(async(u,x)=>{if(!C())return;let v={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:xo,data:x??{},createdAt:new Date,blocked:!1,hidden:!1};J(v)&&(await h(u),T(v))},[r,S]);function J(u){var x;if(!S&&u.actionType===Ie)return!1;if(S){let v=S.find(W=>W.flowId===u.flowSlug);if(u.actionType===Ie&&(!(v!=null&&v.stepStates[u.stepId])||v.stepStates[u.stepId].actionType===Ie)||v&&((x=v.stepStates[u.stepId])==null?void 0:x.actionType)===u.actionType||v&&v.flowState===q&&u.actionType===q)return!1}return!0}function ge(u,x){let v=V(u,x);return A?null:v?v.actionType:Ie}function re(u,x){let v=V(u,x);return v?v.blocked:!1}function L(u,x){let v=V(u,x);return v?v.hidden:!1}function V(u,x){if(A)return null;let v=S==null?void 0:S.find(W=>W.flowId===u);return!v||!v.stepStates[x]?null:v.stepStates[x]??null}function G(u){var v;if(A||!S)return null;if(pe(u)===Me)return D(u)[0]??null;let x=(v=S.find(W=>W.flowId===u))==null?void 0:v.lastStepId;return x?D(u).find(W=>W.id===x):null}function ne(u){let x=G(u);if(!x)return 0;let v=D(u).findIndex(W=>W.id===x.id)??0;return ge(u,x.id)===Ue&&v<D(u).length-1?v+1:v}function se(u){if(!u.completionCriteria)return;let x=Ur(u.completionCriteria);if(x===null)return;let v=Ye(x),W=De(x);return W===0?void 0:v/W}function pe(u){let x=S==null?void 0:S.find(v=>v.flowId===u);return x?x.flowState:null}function Ye(u){let x=D(u);return x.length===0?0:x.filter(W=>ge(u,W.id)===Ue).length}function De(u){return D(u).length}function Et(u){let x=o.find(v=>v.slug===u);return x?JSON.parse(x.data):null}function ft(u){if(y)return!1;if(A)return!0;if(u!=null&&u.targetingLogic&&S){let x=S.find(v=>v.flowId===u.slug);if(x)return x.shouldTrigger===!1}return!!(u!=null&&u.targetingLogic&&r&&r.startsWith("guest_"))}function At(u){return!ft($(u))}function gt(){r&&b()}return{getFlow:$,getFlowData:Et,isLoading:A||I,getStepStatus:ge,getFlowSteps:D,getCurrentStepIndex:ne,markStepStarted:X,markStepCompleted:j,markFlowNotStarted:Ce,markFlowStarted:Ne,markFlowCompleted:be,markFlowAborted:me,markStepNotStarted:H,getFlowStatus:pe,getNumberOfStepsCompleted:Ye,getNumberOfSteps:De,targetingLogicShouldHideFlow:ft,setCustomVariable:te,updateCustomVariables:fe,customVariables:s,getStepOptionalProgress:se,getFlowMetadata:U,isStepBlocked:re,isStepHidden:L,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:a,isFlowAvailableToUser:At,refresh:gt}}import{useCallback as Xo,useContext as jl,useEffect as Vl}from"react";var Lt="guest_";function Jt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=jl(K),{config:n,apiUrl:s}=_e(),{mutateUserFlowState:p}=Be(),c=It(),{verifySDKInitiated:a}=Ot();function g(C){return`frigade-user-registered-${C}`}Vl(()=>{if(e&&!t){if(e.startsWith(Lt))return;let C=g(e);localStorage.getItem(C)||(c(`${s}users`,{...n,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(C,"true"))}},[e,r,t]);let d=Xo(async C=>{if(!a())return;let T={foreignId:e,properties:C};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(T)}),i(f=>({...f,...C})),p()},[e,n,r,p]),y=Xo(async(C,T)=>{if(!a())return;let B={foreignId:e,events:[{event:C,properties:T}]};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(B)}),p()},[e,n,p]),w=Xo(async(C,T)=>{if(a())if(T){let f=g(C);localStorage.setItem(f,"true"),o(C);let B={foreignId:C,properties:T};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(B)}),i(b=>({...b,...T})),p()}else o(C)},[n,r,p]);return{userId:e,setUserId:o,setUserIdWithProperties:w,addPropertiesToUser:d,trackEventForUser:y}}import{v4 as hp}from"uuid";import Ge,{useEffect as mp,useState as up}from"react";import ze,{useEffect as Rl}from"react";import So from"styled-components";import Gl from"react";import Kl from"styled-components";var zr="fr-",Qt="cfr-";function l(e,t){let o=`${zr}${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+" "+Qt+e}return o}function F(e){if(!e.className||e.className.indexOf(Qt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(zr)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Jo(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=>`${Jo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function xe(...e){return e.filter(Boolean).join(" ")}function Zt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var ql=Kl.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -7,7 +7,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
7
7
|
left: 0;
|
|
8
8
|
bottom: 0;
|
|
9
9
|
right: 0;
|
|
10
|
-
${e=>
|
|
10
|
+
${e=>F(e)} {
|
|
11
11
|
background-color: rgba(0, 0, 0, 0.6);
|
|
12
12
|
z-index: 1400;
|
|
13
13
|
}
|
|
@@ -23,12 +23,12 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
23
23
|
opacity: 1;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
`,Wr=({onClose:e,appearance:t})=>Gl.createElement(ql,{className:l("modalBackground",t),onClick:()=>e()});import
|
|
26
|
+
`,Wr=({onClose:e,appearance:t})=>Gl.createElement(ql,{className:l("modalBackground",t),onClick:()=>e()});import Qo from"react";import Yl from"styled-components";var Xl=Yl.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
|
-
`,Te=()=>
|
|
31
|
-
${e=>
|
|
30
|
+
`,Te=()=>Qo.createElement(Xl,null,Qo.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 20 20"},Qo.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5 15L15 5M5 5l10 10"})));import{Portal as ea}from"react-portal";import Rr from"react";import Zo from"react";function Jl({style:e,className:t}){return Zo.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"54",height:"14",fill:"none",viewBox:"0 0 54 14",style:e,className:t},Zo.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"}),Zo.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 _r=Jl;import Ro from"styled-components";import Xe from"styled-components";var Co=Xe.div`
|
|
31
|
+
${e=>F(e)} {
|
|
32
32
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -57,11 +57,11 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
57
57
|
top: 12px;
|
|
58
58
|
right: 12px;
|
|
59
59
|
`,Hr=Xe.div`
|
|
60
|
-
${e=>
|
|
60
|
+
${e=>F(e)} {
|
|
61
61
|
${e=>e.hasImage?Ql:Zl};
|
|
62
62
|
}
|
|
63
63
|
`,jr=Xe.img`
|
|
64
|
-
${e=>
|
|
64
|
+
${e=>F(e)} {
|
|
65
65
|
display: block;
|
|
66
66
|
width: 100%;
|
|
67
67
|
height: auto;
|
|
@@ -69,7 +69,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
69
69
|
object-fit: cover;
|
|
70
70
|
}
|
|
71
71
|
`,Vr=Xe.div`
|
|
72
|
-
${e=>
|
|
72
|
+
${e=>F(e)} {
|
|
73
73
|
display: block;
|
|
74
74
|
width: 100%;
|
|
75
75
|
height: auto;
|
|
@@ -94,14 +94,14 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
94
94
|
flex-shrink: 1;
|
|
95
95
|
gap: 8px;
|
|
96
96
|
height: 64px;
|
|
97
|
-
${e=>
|
|
97
|
+
${e=>F(e)} {
|
|
98
98
|
flex-direction: row;
|
|
99
99
|
justify-content: ${e=>e.showStepCount?"flex-end":"flex-start"};
|
|
100
100
|
align-content: center;
|
|
101
101
|
align-items: center;
|
|
102
102
|
}
|
|
103
103
|
`,Xr=Xe.p`
|
|
104
|
-
${e=>
|
|
104
|
+
${e=>F(e)} {
|
|
105
105
|
font-style: normal;
|
|
106
106
|
font-weight: 600;
|
|
107
107
|
font-size: 15px;
|
|
@@ -109,7 +109,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
109
109
|
color: #808080;
|
|
110
110
|
}
|
|
111
111
|
margin: 0;
|
|
112
|
-
`;var Jr=
|
|
112
|
+
`;var Jr=Ro.div`
|
|
113
113
|
background-color: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
114
114
|
position: absolute;
|
|
115
115
|
bottom: -47px;
|
|
@@ -120,7 +120,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
120
120
|
align-items: center;
|
|
121
121
|
justify-content: center;
|
|
122
122
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
123
|
-
`,Qr=
|
|
123
|
+
`,Qr=Ro(Co)`
|
|
124
124
|
background-color: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
125
125
|
position: absolute;
|
|
126
126
|
bottom: -60px;
|
|
@@ -133,7 +133,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
133
133
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
134
134
|
padding: 0;
|
|
135
135
|
z-index: ${e=>e.zIndex};
|
|
136
|
-
`,Zr=
|
|
136
|
+
`,Zr=Ro.div`
|
|
137
137
|
display: flex;
|
|
138
138
|
justify-content: center;
|
|
139
139
|
align-items: center;
|
|
@@ -143,7 +143,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
143
143
|
line-height: 18px;
|
|
144
144
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
145
145
|
`;function yo({appearance:e}){return Rr.createElement(Zr,{className:l("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",Rr.createElement(_r,null))}var ta=So.div`
|
|
146
|
-
${e=>
|
|
146
|
+
${e=>F(e)} {
|
|
147
147
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
148
148
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
149
149
|
/* Mobile */
|
|
@@ -157,7 +157,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
157
157
|
width: ${e=>e.width??"1000px"};
|
|
158
158
|
z-index: 1500;
|
|
159
159
|
border-radius: ${e=>{var t,o;return((o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius)??8}}px;
|
|
160
|
-
${e=>
|
|
160
|
+
${e=>ke(e)}
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
padding: 32px;
|
|
@@ -193,7 +193,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
193
193
|
right: 16px;
|
|
194
194
|
cursor: pointer;
|
|
195
195
|
z-index: 1501;
|
|
196
|
-
${e=>
|
|
196
|
+
${e=>F(e)} {
|
|
197
197
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
198
198
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
199
199
|
}
|
|
@@ -204,7 +204,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
204
204
|
::-webkit-scrollbar {
|
|
205
205
|
display: none;
|
|
206
206
|
}
|
|
207
|
-
`,
|
|
207
|
+
`,He=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:r,appearance:n,dismissible:s=!0,showFrigadeBranding:p=!1})=>(Rl(()=>{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?ze.createElement(ea,null,ze.createElement(Wr,{appearance:n,onClose:()=>{s&&e()}}),ze.createElement(ta,{appearance:n,className:l("modalContainer",n),styleOverrides:i},s&&ze.createElement(ra,{className:l("modalClose",n),onClick:()=>e(),appearance:n},ze.createElement(Te,null)),o&&ze.createElement(oa,null,o),ze.createElement(ia,null,r),p&&ze.createElement(Jr,{appearance:n,className:l("poweredByFrigadeRibbon",n)},ze.createElement(yo,{appearance:n})))):ze.createElement(ze.Fragment,null));import nt,{useEffect as na}from"react";import bo from"styled-components";import{Portal as sa}from"react-portal";function la(e){switch(e){case"top-left":return`
|
|
208
208
|
top: 0;
|
|
209
209
|
left: 0;
|
|
210
210
|
`;case"top-right":return`
|
|
@@ -214,7 +214,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
214
214
|
bottom: 0;
|
|
215
215
|
left: 0;
|
|
216
216
|
`}return"right: 0; bottom: 0;"}var aa=bo.div`
|
|
217
|
-
${e=>
|
|
217
|
+
${e=>F(e)} {
|
|
218
218
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
219
219
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
220
220
|
position: fixed;
|
|
@@ -238,7 +238,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
238
238
|
right: 16px;
|
|
239
239
|
cursor: pointer;
|
|
240
240
|
z-index: 1501;
|
|
241
|
-
${e=>
|
|
241
|
+
${e=>F(e)} {
|
|
242
242
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
243
243
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
244
244
|
}
|
|
@@ -248,8 +248,8 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
248
248
|
::-webkit-scrollbar {
|
|
249
249
|
display: none;
|
|
250
250
|
}
|
|
251
|
-
`,wo=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:r,modalPosition:n="bottom-right",dismissible:s=!0})=>(na(()=>{if(!s)return;let p=c=>{c.key==="Escape"&&e()};return document.addEventListener("keydown",p),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",p)}},[e,t]),t?nt.createElement(sa,null,nt.createElement(aa,{appearance:r,className:l("cornerModalContainer",r),modalPosition:n},s&&nt.createElement(da,{className:l("cornerModalClose",r),onClick:()=>e()},nt.createElement(Te,null)),o&&nt.createElement(pa,null,o),nt.createElement(ca,null,i))):nt.createElement(nt.Fragment,null));import{useContext as ma}from"react";function Q(){let{defaultAppearance:e}=ma(K);function t(o){let i=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign(i.styleOverrides??{},o.styleOverrides??{}),theme:Object.assign(i.theme,o.theme??{})}:i}return{mergeAppearanceWithDefault:t}}import Ct,{useContext as Da,useEffect as $a,useState as
|
|
252
|
-
${e=>
|
|
251
|
+
`,wo=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:r,modalPosition:n="bottom-right",dismissible:s=!0})=>(na(()=>{if(!s)return;let p=c=>{c.key==="Escape"&&e()};return document.addEventListener("keydown",p),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",p)}},[e,t]),t?nt.createElement(sa,null,nt.createElement(aa,{appearance:r,className:l("cornerModalContainer",r),modalPosition:n},s&&nt.createElement(da,{className:l("cornerModalClose",r),onClick:()=>e()},nt.createElement(Te,null)),o&&nt.createElement(pa,null,o),nt.createElement(ca,null,i))):nt.createElement(nt.Fragment,null));import{useContext as ma}from"react";function Q(){let{defaultAppearance:e}=ma(K);function t(o){let i=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign(i.styleOverrides??{},o.styleOverrides??{}),theme:Object.assign(i.theme,o.theme??{})}:i}return{mergeAppearanceWithDefault:t}}import Ct,{useContext as Da,useEffect as $a,useState as ar}from"react";import vo from"styled-components";import ko,{useEffect as ua,useState as ni}from"react";import or from"styled-components";import To from"styled-components";var ei=To.label`
|
|
252
|
+
${e=>F(e)} {
|
|
253
253
|
font-size: 12px;
|
|
254
254
|
line-height: 18px;
|
|
255
255
|
margin-bottom: 5px;
|
|
@@ -260,7 +260,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
260
260
|
}
|
|
261
261
|
display: flex;
|
|
262
262
|
`,ti=To.label`
|
|
263
|
-
${e=>
|
|
263
|
+
${e=>F(e)} {
|
|
264
264
|
font-size: 12px;
|
|
265
265
|
line-height: 20px;
|
|
266
266
|
margin-bottom: 5px;
|
|
@@ -279,12 +279,12 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
279
279
|
align-items: flex-start;
|
|
280
280
|
justify-content: left;
|
|
281
281
|
margin-bottom: 10px;
|
|
282
|
-
`;import
|
|
282
|
+
`;import er from"react";var Je={theme:{colorPrimary:"#0171F8",colorSecondary:"#2E343D",colorText:"#0F1114",colorBackground:"#ffffff",colorBackgroundSecondary:"#d2d2d2",colorTextOnPrimaryBackground:"#ffffff",colorTextSecondary:"#2E343D",colorTextDisabled:"#5A6472",colorBorder:"#E5E5E5",colorTextError:"#c00000",colorTextSuccess:"#00D149",borderRadius:10}};function st({title:e,required:t,appearance:o=Je}){return e?er.createElement(Fo,null,t?er.createElement(oi,{className:l("formLabelRequired",o),appearance:o},"*"):null,er.createElement(ei,{className:l("formLabel",o)},e)):null}import ri from"react";function Dt({title:e,appearance:t}){return e?ri.createElement(Fo,null,ri.createElement(ti,{className:l("formSubLabel",t)},e)):null}import{z as tr}from"zod";function ii(e,t){try{if(t){if(t.type=="number"){let o=tr.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=tr.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 tr.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 fa=or.div`
|
|
283
283
|
display: flex;
|
|
284
284
|
flex-direction: column;
|
|
285
285
|
width: 100%;
|
|
286
|
-
`,or
|
|
287
|
-
${e=>
|
|
286
|
+
`,rr=or.input`
|
|
287
|
+
${e=>F(e)} {
|
|
288
288
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
289
289
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
290
290
|
font-size: 14px;
|
|
@@ -299,8 +299,8 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
299
299
|
box-sizing: border-box;
|
|
300
300
|
padding: 0 10px;
|
|
301
301
|
margin-bottom: 10px;
|
|
302
|
-
`,ga=
|
|
303
|
-
${e=>
|
|
302
|
+
`,ga=or.textarea`
|
|
303
|
+
${e=>F(e)} {
|
|
304
304
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
305
305
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
306
306
|
font-size: 14px;
|
|
@@ -315,14 +315,14 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
315
315
|
min-height: 70px;
|
|
316
316
|
box-sizing: border-box;
|
|
317
317
|
margin-bottom: 10px;
|
|
318
|
-
`;function
|
|
318
|
+
`;function ir({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:r}){let n=e,[s,p]=ni((r==null?void 0:r.text)||""),[c,a]=ni(!1),g=rr;ua(()=>{s===""&&!c&&(a(!0),d(""))},[]);function d(w){if(p(w),o({text:w}),n.required===!0&&w.trim()===""){i([{id:n.id,message:`${n.title??"Field"} is required`}]);return}let C=ii(w,n.validation);if(C){i([{id:n.id,message:C}]);return}i([])}n.multiline&&(g=ga);function y(){var w;switch((w=n==null?void 0:n.validation)==null?void 0:w.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return ko.createElement(fa,null,ko.createElement(st,{title:n.title,required:n.required,appearance:t.appearance}),ko.createElement(g,{className:l("inputComponent",t.appearance),value:s,onChange:w=>{d(w.target.value)},appearance:t.appearance,placeholder:n.placeholder,type:y()}),ko.createElement(Dt,{title:n.subtitle,appearance:t.appearance}))}import je,{useEffect as si,useState as li}from"react";import ai from"styled-components";var nr="",xa=ai.div`
|
|
319
319
|
display: flex;
|
|
320
320
|
flex-direction: column;
|
|
321
321
|
width: 100%;
|
|
322
322
|
-webkit-appearance: none;
|
|
323
323
|
appearance: none;
|
|
324
324
|
`,ha=ai.select`
|
|
325
|
-
${e=>
|
|
325
|
+
${e=>F(e)} {
|
|
326
326
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
327
327
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
328
328
|
font-size: 14px;
|
|
@@ -342,8 +342,8 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
342
342
|
background-repeat: no-repeat;
|
|
343
343
|
background-size: 1.5em 1.5em;
|
|
344
344
|
-webkit-print-color-adjust: exact;
|
|
345
|
-
`;function pi({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var g,d,
|
|
346
|
-
${e=>
|
|
345
|
+
`;function pi({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var g,d,y,w,C,T;let n=e,[s,p]=li(((g=i==null?void 0:i.choice)==null?void 0:g[0])||""),[c,a]=li(!1);return si(()=>{var f,B,b,S;if(s===""&&!c){if(a(!0),n.requireSelection){p(nr);return}if(n.defaultValue&&((f=n.props.options)!=null&&f.find(A=>A.id===n.defaultValue))){let A=(B=n.props.options)==null?void 0:B.find(h=>h.id===n.defaultValue);p(A.id),o({choice:[A.id]})}else p(((b=n.props.options)==null?void 0:b[0].id)||""),o({choice:[((S=n.props.options)==null?void 0:S[0].id)||""]})}},[]),si(()=>{n.requireSelection&&s===nr?r([{message:"Please select an option",id:n.id}]):r([])},[s]),je.createElement(xa,null,je.createElement(st,{title:n.title,required:!1,appearance:t.appearance}),je.createElement(ha,{value:s,onChange:f=>{p(f.target.value),o({choice:[f.target.value]})},placeholder:n.placeholder,appearance:t.appearance,className:l("multipleChoiceSelect",t.appearance)},n.requireSelection&&je.createElement("option",{key:"null-value",value:nr,disabled:!0},n.placeholder??"Select an option"),(d=n.props.options)==null?void 0:d.map(f=>je.createElement("option",{key:f.id,value:f.id},f.title))),((w=(y=n.props.options)==null?void 0:y.find(f=>f.id===s))==null?void 0:w.isOpenEnded)&&je.createElement(je.Fragment,null,je.createElement(st,{title:((T=(C=n.props.options)==null?void 0:C.find(f=>f.id===s))==null?void 0:T.openEndedLabel)??"Please specify",required:!1,appearance:t.appearance}),je.createElement(rr,{type:"text",placeholder:"Enter your answer here",onChange:f=>{o({choice:[f.target.value]})},appearance:t.appearance})),je.createElement(Dt,{title:n.subtitle,appearance:t.appearance}))}import to,{useEffect as sr,useState as ci}from"react";import mi from"styled-components";import eo from"react";import Rt from"react";var di=({color:e,percentage:t,size:o})=>{let i=o*.5-2,r=2*Math.PI*i,n=(1-t)*r;return Rt.createElement("circle",{r:i,cx:o*.5,cy:o*.5,fill:"transparent",stroke:n!==r?e:"",strokeWidth:"3px",strokeDasharray:r,strokeDashoffset:t?n:0})},Ca=({fillColor:e,size:t,percentage:o,children:i,bgColor:r="#D9D9D9",className:n,style:s})=>Rt.createElement("svg",{style:s,className:n,width:t,height:t,overflow:"visible"},Rt.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},Rt.createElement(di,{color:r,size:t}),Rt.createElement(di,{color:e,percentage:o,size:t})),i),$t=Ca;import ya from"styled-components";var Sa=({color:e="#FFFFFF"})=>eo.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},eo.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),ba={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},wa={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},Ta={border:"1px solid #000000",color:"#FFFFFF"},Fa={border:"1px solid #C5CBD3"},ka={color:"#FFFFFF"},Pa={border:"1px solid #C5CBD3"},va=e=>e==="square"?ba:wa,Ba=(e,t)=>e==="square"?t?Ta:Fa:t?ka:Pa,Ea=ya.div`
|
|
346
|
+
${e=>ke(e)}
|
|
347
347
|
`,Qe=({value:e,type:t="round",primaryColor:o="#000000",progress:i,appearance:r=Je,style:n,className:s})=>{let p=va(t),c=Ba(t,e);return e===!0?p={...p,...c,backgroundColor:r.theme.colorTextSuccess,borderColor:t==="square"?o:"none"}:p={...p,...c},e!==!0&&t==="round"&&i!==void 0&&i!==1?eo.createElement($t,{fillColor:o,percentage:i,size:22}):eo.createElement(Ea,{styleOverrides:p,style:n,role:"checkbox",className:xe(l("checkIconContainer",r),l(e?"checkIconContainerChecked":"checkIconContainerUnchecked",r),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&eo.createElement(Sa,{color:"#FFFFFF"}))};var Aa=mi.div`
|
|
348
348
|
display: flex;
|
|
349
349
|
flex-direction: column;
|
|
@@ -351,7 +351,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
351
351
|
-webkit-appearance: none;
|
|
352
352
|
appearance: none;
|
|
353
353
|
`,Na=mi.button`
|
|
354
|
-
${e=>
|
|
354
|
+
${e=>F(e)} {
|
|
355
355
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
356
356
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
357
357
|
font-size: 14px;
|
|
@@ -375,8 +375,8 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
375
375
|
height: 48px;
|
|
376
376
|
padding: 0 18px;
|
|
377
377
|
margin-bottom: 10px;
|
|
378
|
-
`;function ui({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var g;let n=e,[s,p]=ci((i==null?void 0:i.choice)||[]),[c,a]=ci(!1);return
|
|
379
|
-
${e=>
|
|
378
|
+
`;function ui({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var g;let n=e,[s,p]=ci((i==null?void 0:i.choice)||[]),[c,a]=ci(!1);return sr(()=>{s.length==0&&!c&&(a(!0),o({choice:[]}))},[]),sr(()=>{o({choice:s})},[s]),sr(()=>{n.required&&(s.length<n.props.minChoices||s.length>n.props.maxChoices)?r([{message:"",id:n.id}]):r([])},[s]),to.createElement(Aa,null,to.createElement(st,{title:n.title,required:n.required,appearance:t.appearance}),(g=n.props.options)==null?void 0:g.map(d=>to.createElement(Na,{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(y=>y!==d.id));return}s.length<n.props.maxChoices?p([...s,d.id]):s.length==1&&n.props.maxChoices==1&&p([d.id])}},d.title,to.createElement(Qe,{type:"round",primaryColor:t.appearance.theme.colorPrimary,value:s.includes(d.id),appearance:t.appearance}))),to.createElement(Dt,{title:n.subtitle,appearance:t.appearance}))}import Po from"react";import fi from"styled-components";import Ia from"dompurify";function le(e){return{__html:Ia.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var Oa=fi.h1`
|
|
379
|
+
${e=>F(e)} {
|
|
380
380
|
font-style: normal;
|
|
381
381
|
font-weight: 700;
|
|
382
382
|
font-size: ${e=>e.size=="small"?"15px":"18px"};
|
|
@@ -388,7 +388,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
388
388
|
color: ${e=>e.appearance.theme.colorText};
|
|
389
389
|
}
|
|
390
390
|
`,La=fi.h2`
|
|
391
|
-
${e=>
|
|
391
|
+
${e=>F(e)} {
|
|
392
392
|
font-style: normal;
|
|
393
393
|
font-weight: 400;
|
|
394
394
|
font-size: 14px;
|
|
@@ -396,7 +396,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
396
396
|
letter-spacing: 0.28px;
|
|
397
397
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
398
398
|
}
|
|
399
|
-
`;function Fe({appearance:e,title:t,subtitle:o,size:i="medium",classPrefix:r=""}){return Po.createElement(Po.Fragment,null,Po.createElement(Oa,{appearance:e,className:l(`${r}${r?Zt(i):i}Title`,e),dangerouslySetInnerHTML:le(t),size:i}),o&&Po.createElement(La,{appearance:e,className:l(`${r}${r?Zt(i):i}Subtitle`,e),dangerouslySetInnerHTML:le(o),size:i}))}import*as
|
|
399
|
+
`;function Fe({appearance:e,title:t,subtitle:o,size:i="medium",classPrefix:r=""}){return Po.createElement(Po.Fragment,null,Po.createElement(Oa,{appearance:e,className:l(`${r}${r?Zt(i):i}Title`,e),dangerouslySetInnerHTML:le(t),size:i}),o&&Po.createElement(La,{appearance:e,className:l(`${r}${r?Zt(i):i}Subtitle`,e),dangerouslySetInnerHTML:le(o),size:i}))}import*as lr from"react";var gi=e=>lr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:12,height:12,"aria-hidden":"true",viewBox:"0 0 16 16",...e},lr.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"m10.115 1.308 5.635 11.269A2.365 2.365 0 0 1 13.634 16H2.365A2.365 2.365 0 0 1 .25 12.577L5.884 1.308a2.365 2.365 0 0 1 4.231 0zM8 10.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM8 9c.552 0 1-.32 1-.714V4.714C9 4.32 8.552 4 8 4s-1 .32-1 .714v3.572C7 8.68 7.448 9 8 9z"}));var Ma=vo.div`
|
|
400
400
|
display: flex;
|
|
401
401
|
flex-direction: column;
|
|
402
402
|
justify-content: flex-end;
|
|
@@ -414,7 +414,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
414
414
|
`,Wa=vo.div`
|
|
415
415
|
padding-left: 1px;
|
|
416
416
|
padding-right: 1px;
|
|
417
|
-
`,_a={text:
|
|
417
|
+
`,_a={text:ir,multipleChoice:pi,multipleChoiceList:ui},pr="frigade-multiInputStepTypeData";function xi({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:r,appearance:n,customFormElements:s,prefillData:p}){var h;let c=t.props,[a,g]=ar([]),[d,y]=ar([]),{userId:w}=Jt(),[C,T]=ar(S()||(p?p[t.id]:null)||{}),{readonly:f}=Da(K),B={..._a,...s};$a(()=>{i(a.length===0)},[a,i]);function b(m,E){let k={...C,[m.id]:E};T(k),r(k),window&&window.localStorage&&!f&&window.localStorage.setItem(A(),JSON.stringify(k))}function S(){if(window&&window.localStorage){let m=window.localStorage.getItem(A());if(m)return JSON.parse(m)}return null}function A(){return`${pr}-${e}-${t.id}-${w}`}return Ct.createElement(Wa,{className:l("multiInput",n)},Ct.createElement(Fe,{appearance:n,title:t.title,subtitle:t.subtitle}),Ct.createElement(Ma,{className:l("multiInputContainer",n)},(h=c.data)==null?void 0:h.map(m=>{var k;let E=(k=a.reverse().find(P=>P.id===m.id))==null?void 0:k.message;return B[m.type]?Ct.createElement("span",{key:m.id,"data-field-id":m.id,className:l("multiInputField",n)},B[m.type]({formInput:m,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:r,appearance:n},onSaveInputData:P=>{!d.includes(m.id)&&P&&(P==null?void 0:P.text)!==""&&y(O=>[...O,m.id]),b(m,P)},inputData:C[m.id],setFormValidationErrors:P=>{g(O=>P.length===0?O.filter(N=>N.id!==m.id):[...O,...P])}}),E&&d.includes(m.id)&&Ct.createElement(Ua,{initial:{opacity:0,height:0,marginBottom:0},animate:{opacity:1,height:"auto",marginBottom:12},exit:{opacity:0,height:0,marginBottom:0},key:m.id,style:{overflow:"hidden"},transition:{duration:.1,ease:"easeInOut",delay:.5},appearance:n,className:l("multiInputValidationError",n)},Ct.createElement(za,{appearance:n,className:l("multiInputValidationErrorIcon",n)},Ct.createElement(gi,null)),E)):null})))}import yt from"styled-components";var hi=yt.div`
|
|
418
418
|
align-items: center;
|
|
419
419
|
display: flex;
|
|
420
420
|
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
@@ -458,7 +458,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
458
458
|
`;import lt from"react";import Ha from"react";import Fi from"styled-components";var ja=Fi.button`
|
|
459
459
|
justify-content: center;
|
|
460
460
|
align-content: center;
|
|
461
|
-
${e=>
|
|
461
|
+
${e=>F(e)} {
|
|
462
462
|
display: flex;
|
|
463
463
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
464
464
|
width: ${e=>e.type==="full-width"?"100%":"auto"};
|
|
@@ -473,7 +473,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
473
473
|
font-size: ${e=>e.size=="small"?"14px":"15px"};
|
|
474
474
|
line-height: 20px;
|
|
475
475
|
font-weight: 500;
|
|
476
|
-
${e=>
|
|
476
|
+
${e=>ke(e)}
|
|
477
477
|
}
|
|
478
478
|
|
|
479
479
|
font-family: inherit;
|
|
@@ -487,7 +487,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
487
487
|
cursor: not-allowed;
|
|
488
488
|
}
|
|
489
489
|
`,Bo=Fi.div`
|
|
490
|
-
${e=>
|
|
490
|
+
${e=>F(e)} {
|
|
491
491
|
display: flex;
|
|
492
492
|
flex-direction: row;
|
|
493
493
|
justify-content: flex-start;
|
|
@@ -497,9 +497,9 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
497
497
|
margin-right: 8px;
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
|
-
`,Z=({onClick:e,title:t,style:o,disabled:i,type:r="inline",size:n="medium",secondary:s=!1,appearance:p,withMargin:c=!0,classPrefix:a=""})=>{function g(){let d=s?"buttonSecondary":"button";return a===""?d:`${a}${Zt(d)}`}return Ha.createElement(ja,{secondary:s,appearance:p,disabled:i,onClick:e,styleOverrides:o,type:r,withMargin:c,size:n,className:l(g(),p)},t??"Continue")};var ki=({step:e,canContinue:t,appearance:o,onPrimaryClick:i,onSecondaryClick:r,selectedStep:n,steps:s,onBack:p,allowBackNavigation:c,errorMessage:a})=>{let g=s.length>1&&n!=0&&c,d=e.primaryButtonTitle&&e.secondaryButtonTitle||g?"inline":"full-width";return lt.createElement(lt.Fragment,null,a!==null&&a!=null&<.createElement(Ci,{appearance:o,className:l("formCTAError",o)},a),lt.createElement(hi,{showBackButton:g,className:l("formCTAContainer",o)},g&<.createElement(Z,{title:e.backButtonTitle??"Back",onClick:p,secondary:!0,withMargin:!1,type:d,appearance:o,style:{width:"90px",maxWidth:"90px"},classPrefix:"back"}),lt.createElement(yi,{className:l("ctaWrapper",o)},e.secondaryButtonTitle?lt.createElement(Z,{title:e.secondaryButtonTitle,onClick:r,secondary:!0,withMargin:!1,type:d,appearance:o}):null," ",e.primaryButtonTitle?lt.createElement(Z,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:i,type:d,appearance:o}):null)))};import
|
|
500
|
+
`,Z=({onClick:e,title:t,style:o,disabled:i,type:r="inline",size:n="medium",secondary:s=!1,appearance:p,withMargin:c=!0,classPrefix:a=""})=>{function g(){let d=s?"buttonSecondary":"button";return a===""?d:`${a}${Zt(d)}`}return Ha.createElement(ja,{secondary:s,appearance:p,disabled:i,onClick:e,styleOverrides:o,type:r,withMargin:c,size:n,className:l(g(),p)},t??"Continue")};var ki=({step:e,canContinue:t,appearance:o,onPrimaryClick:i,onSecondaryClick:r,selectedStep:n,steps:s,onBack:p,allowBackNavigation:c,errorMessage:a})=>{let g=s.length>1&&n!=0&&c,d=e.primaryButtonTitle&&e.secondaryButtonTitle||g?"inline":"full-width";return lt.createElement(lt.Fragment,null,a!==null&&a!=null&<.createElement(Ci,{appearance:o,className:l("formCTAError",o)},a),lt.createElement(hi,{showBackButton:g,className:l("formCTAContainer",o)},g&<.createElement(Z,{title:e.backButtonTitle??"Back",onClick:p,secondary:!0,withMargin:!1,type:d,appearance:o,style:{width:"90px",maxWidth:"90px"},classPrefix:"back"}),lt.createElement(yi,{className:l("ctaWrapper",o)},e.secondaryButtonTitle?lt.createElement(Z,{title:e.secondaryButtonTitle,onClick:r,secondary:!0,withMargin:!1,type:d,appearance:o}):null," ",e.primaryButtonTitle?lt.createElement(Z,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:i,type:d,appearance:o}):null)))};import dr from"react";import Va from"styled-components";var Ga=Va.div`
|
|
501
501
|
text-align: center;
|
|
502
|
-
`,Pi=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:r}=Q().mergeAppearanceWithDefault(i);return
|
|
502
|
+
`,Pi=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:r}=Q().mergeAppearanceWithDefault(i);return dr.createElement(Ga,{className:o},dr.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((n,s)=>dr.createElement("rect",{key:s,x:16*s,y:0,width:8,height:8,rx:4,fill:t===s?r.colorPrimary:"#E6E6E6"}))))};import St from"react";import Mt from"styled-components";import{useContext as Ka}from"react";function ie(){let e=Ka(K);function t(r){i(r.primaryButtonUri,r.primaryButtonUriTarget)}function o(r){i(r.secondaryButtonUri,r.secondaryButtonUriTarget)}function i(r,n){if(!r)return;let s=r.startsWith("http")?"_blank":"_self";n&&n!=="_blank"&&(s="_self"),e.navigate(r,s)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:i}}var qa=Mt.div`
|
|
503
503
|
display: flex;
|
|
504
504
|
flex-wrap: wrap;
|
|
505
505
|
align-content: center;
|
|
@@ -547,7 +547,7 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
547
547
|
margin-top: 12px;
|
|
548
548
|
margin-bottom: 16px;
|
|
549
549
|
max-width: 70%;
|
|
550
|
-
`;function vi({stepData:e,appearance:t}){var i,r;let{handleUrl:o}=ie();return St.createElement("div",null,St.createElement(Qa,null,e.title),St.createElement(Za,null,e.subtitle),St.createElement(qa,null,(r=(i=e.props)==null?void 0:i.links)==null?void 0:r.map(n=>St.createElement(Ya,{key:n.title},St.createElement(Xa,{src:n.imageUri}),St.createElement(Ja,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{n.uri&&o(n.uri,n.uriTarget??"_blank")}},n.title)))))}import Ut,{useEffect as np}from"react";import No from"styled-components";import
|
|
550
|
+
`;function vi({stepData:e,appearance:t}){var i,r;let{handleUrl:o}=ie();return St.createElement("div",null,St.createElement(Qa,null,e.title),St.createElement(Za,null,e.subtitle),St.createElement(qa,null,(r=(i=e.props)==null?void 0:i.links)==null?void 0:r.map(n=>St.createElement(Ya,{key:n.title},St.createElement(Xa,{src:n.imageUri}),St.createElement(Ja,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{n.uri&&o(n.uri,n.uriTarget??"_blank")}},n.title)))))}import Ut,{useEffect as np}from"react";import No from"styled-components";import cr from"react";var Eo=({style:e,className:t})=>cr.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},cr.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),cr.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 oo,{useRef as Ra,useState as ep}from"react";import Ao from"styled-components";var tp=Ao.div`
|
|
551
551
|
display: flex;
|
|
552
552
|
align-items: center;
|
|
553
553
|
justify-content: flex-start;
|
|
@@ -583,31 +583,31 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
583
583
|
height: 100%;
|
|
584
584
|
min-height: 260px;
|
|
585
585
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
586
|
-
`;function
|
|
587
|
-
${e=>
|
|
586
|
+
`;function Ve({appearance:e,videoUri:t}){let o=Ra(),[i,r]=ep(!1);if(t.includes("youtube")){let n=t.split("v=")[1],s=n.indexOf("&");return s!==-1&&(n=n.substring(0,s)),oo.createElement(ip,{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${n}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,appearance:e})}return oo.createElement(tp,{className:l("videoPlayerWrapper",e),appearance:e},!i&&oo.createElement(op,{onClick:()=>{r(!0),o.current.play()},appearance:e},oo.createElement(Eo,null)),oo.createElement(rp,{appearance:e,controls:i,ref:o,play:i,src:t}))}var sp=No.div`
|
|
587
|
+
${e=>F(e)} {
|
|
588
588
|
display: flex;
|
|
589
589
|
flex-direction: column;
|
|
590
590
|
justify-content: center;
|
|
591
591
|
}
|
|
592
592
|
`,lp=No.img`
|
|
593
|
-
${e=>
|
|
593
|
+
${e=>F(e)} {
|
|
594
594
|
width: 100%;
|
|
595
595
|
height: auto;
|
|
596
596
|
max-height: 250px;
|
|
597
597
|
margin-bottom: 24px;
|
|
598
598
|
}
|
|
599
599
|
`,ap=No.div`
|
|
600
|
-
${e=>
|
|
600
|
+
${e=>F(e)} {
|
|
601
601
|
margin-bottom: 24px;
|
|
602
602
|
}
|
|
603
603
|
`,pp=No.div`
|
|
604
|
-
${e=>
|
|
604
|
+
${e=>F(e)} {
|
|
605
605
|
width: 100%;
|
|
606
606
|
height: auto;
|
|
607
607
|
max-height: 250px;
|
|
608
608
|
margin-bottom: 24px;
|
|
609
609
|
}
|
|
610
|
-
`;function Bi({stepData:e,appearance:t,setCanContinue:o}){return np(()=>{o(!0)},[]),Ut.createElement(sp,{className:l("callToActionContainer",t)},Ut.createElement(ap,{className:l("callToActionTextContainer",t)},Ut.createElement(Fe,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&Ut.createElement(lp,{className:l("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&Ut.createElement(pp,{appearance:t,className:l("callToActionVideo",t)},Ut.createElement(
|
|
610
|
+
`;function Bi({stepData:e,appearance:t,setCanContinue:o}){return np(()=>{o(!0)},[]),Ut.createElement(sp,{className:l("callToActionContainer",t)},Ut.createElement(ap,{className:l("callToActionTextContainer",t)},Ut.createElement(Fe,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&Ut.createElement(lp,{className:l("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&Ut.createElement(pp,{appearance:t,className:l("callToActionVideo",t)},Ut.createElement(Ve,{appearance:t,videoUri:e.videoUri})))}import Ze,{useEffect as mr,useState as ur}from"react";import at from"styled-components";var Ei=at.div`
|
|
611
611
|
width: auto;
|
|
612
612
|
display: flex;
|
|
613
613
|
flex-direction: column;
|
|
@@ -660,8 +660,8 @@ import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import
|
|
|
660
660
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
661
661
|
display: flex;
|
|
662
662
|
align-self: center;
|
|
663
|
-
`;var Mi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let r=e.props,[n,s]=
|
|
664
|
-
${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map(([s,p])=>`${Xo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return io.createElement(o,{inlineStyles:t})}var Ui=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:r,customVariables:n,customFormElements:s,onComplete:p,appearance:c,hideOnFlowCompletion:a=!0,onStepCompletion:g,onButtonClick:d,dismissible:x=!0,endFlowOnDismiss:b=!1,modalPosition:w="center",repeatable:v=!1,onDismiss:f,showPagination:E=!1,allowBackNavigation:S=!1,validationHandler:y,showFrigadeBranding:A=!1,onFormDataChange:C,showFooter:m=!0,prefillData:B={}})=>{let{getFlow:F,getFlowSteps:k,isLoading:O,targetingLogicShouldHideFlow:N,getFlowStatus:I,getCurrentStepIndex:$,markFlowCompleted:D,markFlowNotStarted:ee}=Y(),U=$(e),{mergeAppearanceWithDefault:te}=Q(),[fe,X]=up(!1),{setOpenFlowState:H,getOpenFlowState:j,hasOpenModals:Ce}=we();c=te(c);let[Ae,be]=i!==void 0&&r!==void 0?[i,r]:[j(e,!0),re=>H(e,re)];if(mp(()=>{!fe&&!O&&(X(!0),I(e)===q&&v&&(ee(e),window&&window.localStorage&&Object.keys(window.localStorage).forEach(L=>{L.startsWith(ar)&&window.localStorage.removeItem(L)})),X(!0))},[fe,X,O]),O)return null;let me=F(e);if(!me||N(me))return null;let J=k(e);if(!J||i!==void 0&&i===!1||I(e)===q&&a||(o=="modal"||o=="corner-modal")&&Ce(e))return null;let ge=()=>{be(!1),f&&f(),b===!0&&D(e)};if(w=="center"&&o==="modal"||o==="large-modal"){let re={padding:"24px"};return o==="large-modal"?(re.width="85%",re.height="90%",re.maxHeight="800px",re.minHeight="500px",re.padding="0"):re.width="400px",Ve.createElement(_e,{appearance:c,onClose:ge,visible:Ae,style:re,dismissible:x,showFrigadeBranding:A},Ve.createElement(oe,{appearance:c}),Ve.createElement(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:E,customFormElements:s,allowBackNavigation:S,validationHandler:y,onFormDataChange:C,showFooter:m,prefillData:B}))}return o==="modal"&&w!=="center"?Ve.createElement(wo,{appearance:c,onClose:ge,visible:Ae,modalPosition:w},Ve.createElement(oe,{appearance:c}),Ve.createElement(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:E,customFormElements:s,allowBackNavigation:S,validationHandler:y,onFormDataChange:C,showFooter:m,prefillData:B})):Ve.createElement(Ve.Fragment,null,Ve.createElement(oe,{appearance:c}),Ve.createElement(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:E,customFormElements:s,allowBackNavigation:S,validationHandler:y,onFormDataChange:C,showFooter:m,prefillData:B}))},zi=Ui;import{useCallback as Wi,useContext as fp,useEffect as gp}from"react";function ur(){let{organizationId:e,userId:t,setOrganizationId:o}=fp(K),{mutateUserFlowState:i}=ve(),{config:r,apiUrl:n}=We(),s=It(),{verifySDKInitiated:p}=Ot();gp(()=>{if(t&&e){if(t.startsWith(Lt))return;let g=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(g)||(s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(g,"true"))}},[t,e]);let c=Wi(async g=>{if(!p())return;if(!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let d={foreignUserId:t,foreignUserGroupId:e,properties:g};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(d)}),i()},[e,t,r,i]),a=Wi(async(g,d)=>{if(!p())return;if(!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let b={foreignUserId:t,foreignUserGroupId:e,events:[{event:g,properties:d}]};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(b)}),i()},[e,t,r,i]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:c,trackEventForOrganization:a}}var _i="frigade-xFrigade_guestUserId",no="frigade-xFrigade_userId",Hi=({})=>{let{setFlowResponses:e}=Xt(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=ve(),{userId:r,setUserId:n}=Jt(),[s,p]=fr(null),{getFlowStatus:c}=Y(),{flows:a,userProperties:g,setIsNewGuestUser:d,flowResponses:x}=xp(K),[b,w]=fr([]),[v,f]=fr([]),{organizationId:E}=ur();Lo(()=>{if(!o&&t)for(let C=0;C<t.length;C++){let m=t[C],B=a.find(F=>F.slug===(m==null?void 0:m.flowId));if(B&&m&&m.shouldTrigger===!0&&B.type=="FORM"&&B.triggerType==="AUTOMATIC"&&!v.includes(B.slug)){setTimeout(()=>{S(m.flowId)},500);break}}},[o,t]),Lo(()=>{x.length>0&&i()},[x]);function S(C){let m=a.find(B=>B.slug===C);m&&m.triggerType==="AUTOMATIC"&&!v.includes(m.slug)&&(f([...v,m.slug]),w([m]))}function y(){if(!r){let C=localStorage.getItem(no);if(C){n(C);return}let m=localStorage.getItem(_i);if(m){n(m);return}d(!0);let B=Lt+hp();try{localStorage.setItem(_i,B)}catch(F){console.log("Failed to save guest user id locally: Local storage unavailable",F)}n(F=>F||B)}}Lo(()=>{try{if(a){let C=[];a.forEach(m=>{if(m.data){let B=m.data.match(/"imageUri":"(.*?)"/g);B&&B.forEach(F=>{let k=F.replace('"imageUri":"',"").replace('"',"");if(C.includes(k))return;let O=new Image;O.src=k,C.push(k)})}})}}catch{}},[a]),Lo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(Lt))try{localStorage.setItem(no,r)}catch(C){console.log("Failed to save user id locally: Local storage available",C)}r===null&&setTimeout(()=>{r===null&&y()},50)},[r,a,g]);function A(){return bt.createElement(bt.Fragment,null,b.map(C=>c(C.slug)!==$e?null:bt.createElement("span",{key:C.slug},bt.createElement(zi,{flowId:C.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return bt.createElement(bt.Fragment,null,bt.createElement(A,null))};import{ErrorBoundary as jp}from"react-error-boundary";import so from"core-js-pure/actual/structured-clone";function gr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pt(...e){let t=e.shift(),o=e.length===1?e[0]:pt(...e);if(!gr(t)||!gr(o))throw new Error("deepmerge can only merge Objects");let i=so(t);return Object.entries(o).forEach(([r,n])=>{gr(n)?i[r]!==void 0?Object.assign(i,{[r]:pt(i[r],so(n))}):Object.assign(i,{[r]:so(n)}):Array.isArray(n)?i[r]!==void 0?Object.assign(i,{[r]:[...i[r],...so(n)]}):Object.assign(i,{[r]:so(n)}):Object.assign(i,{[r]:n})}),i}var ji={colorPrimary:"colors.primary.background",colorText:"colors.neutral.foreground",colorBackground:"colors.neutral.background",colorBackgroundSecondary:"colors.secondary.background",colorTextOnPrimaryBackground:"colors.primary.foreground",colorTextSecondary:"colors.secondary.foreground",colorTextDisabled:"colors.gray700",colorBorder:"colors.gray800",colorTextError:"colors.negative.foreground",borderRadius:"radii.lg"};function Cp(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(ji[o]){let r=ji[o].split("."),n=t;r.forEach((s,p)=>{n[s]||(n[s]=p===r.length-1?i:{}),n=n[s]})}}),t}function yp(e){if(!e)return;let t=pt({},e),o={};return Object.keys(t).forEach(i=>{let r=`.fr-${i}`;o[r]=t[i]}),o}function Vi(e){let{theme:t,styleOverrides:o}=e,i=Cp(t),r=yp(o);return{overrides:i,css:r}}import Op from"styled-components";import{compose as Lp,variant as Ki}from"styled-system";import Gi from"react";import Sp,{ThemeProvider as bp,useTheme as wp}from"styled-components";import{border as Tp,color as Fp,compose as kp,get as Pp,shadow as vp,space as Bp,system as Ep,typography as Ap}from"styled-system";var Np={width:{property:"width",scale:"sizes",transform:(e,t)=>Pp(t,e,!(typeof e=="number"&&!isNaN(e))||e>1?e:e*100+"%")},height:{property:"height",scale:"sizes"},minWidth:{property:"minWidth",scale:"sizes"},minHeight:{property:"minHeight",scale:"sizes"},maxWidth:{property:"maxWidth",scale:"sizes"},maxHeight:{property:"maxHeight",scale:"sizes"},overflow:!0,overflowX:!0,overflowY:!0,display:!0,verticalAlign:!0},Ip=Sp("div")(({css:e})=>e,kp(Tp,Fp,vp,Bp,Ap,Ep(Np))),lo=({as:e,children:t,overrides:o,...i})=>{let r=wp(),n={border:"none",boxSizing:"border-box",m:0,p:0},s=()=>Gi.createElement(Ip,{as:e,...n,...i},t);if(o!==void 0){let p=pt(r,o);return Gi.createElement(bp,{theme:p},s())}return s()};var ao={Primary:{backgroundColor:"primary.background",color:"primary.foreground","&:hover":{backgroundColor:"blue400"}},Secondary:{backgroundColor:"white",border:"1px solid",borderColor:"gray800",color:"neutral.foreground","&:hover":{backgroundColor:"blue900"}},Link:{backgroundColor:"transparent",color:"primary.inverted"},Plain:{backgroundColor:"transparent",color:"neutral.foreground"}},Dp={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},qi=Op(lo)(()=>({whiteSpace:"nowrap"}),Lp(Ki({scale:"components.Button",variants:"components.Button"}),Ki({prop:"size",variants:Dp})));import $p from"styled-components";import{variant as Mp,system as Up}from"styled-system";var Do={Display1:{fontSize:"5xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"4xl"},Display2:{fontSize:"4xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"3xl"},H1:{fontSize:"3xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"2xl"},H2:{fontSize:"2xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"xl"},H3:{fontSize:"xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"lg"},H4:{fontSize:"lg",fontWeight:"bold",letterSpacing:"md",lineHeight:"md"},Body1:{fontSize:"md",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Body2:{fontSize:"sm",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Caption:{fontSize:"xs",fontWeight:"regular",letterSpacing:"md",lineHeight:"sm"}};var Yi=$p(lo)(Mp({scale:"components.Text",variants:"components.Text"}),Up({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Xi=4,Ji="px",zp=20,Wp=Object.fromEntries(Array.from(Array(zp+1),(e,t)=>t===0?[.5,`${.5*Xi}${Ji}`]:[t,`${t*Xi}${Ji}`])),zt={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",red500:"#c00000"},xr={colors:{...zt,neutral:{foreground:zt.gray300},primary:{background:zt.blue500,foreground:zt.white,inverted:zt.blue500},negative:{foreground:zt.red500}},fonts:{default:"TT Interphases Pro, sans-serif"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{regular:400,semibold:500,bold:700},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"},radii:{md:"8px",lg:"20px",round:"50%"},shadows:{md:"0px 4px 20px rgba(0, 0, 0, 0.06)"},space:Wp,components:{Button:ao,Text:Do}};var Qi="https://api.frigade.com",K=_p({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:Je,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{},apiUrl:Qi,readonly:!1});function Vp(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var Gp=({publicApiKey:e,userId:t,organizationId:o,config:i,children:r})=>{var fe,X;let[n,s]=Ie(t||null),[p,c]=Ie(o||null),[a,g]=Ie([]),[d,x]=Ie([]),[b,w]=Ie([]),[v,f]=Ie({}),[E,S]=Ie({}),[y,A]=Ie([]),[C,m]=Ie({}),[B,F]=Ie(!1),[k,O]=Ie(!1),[N,I]=Ie(!ee(e)),$=(H,j)=>{if(j==="_blank"){window.open(H,"_blank");return}setTimeout(()=>{window.location.href=H},50)},D={theme:{...Je.theme,...((fe=i==null?void 0:i.defaultAppearance)==null?void 0:fe.theme)??{}},styleOverrides:{...Je.styleOverrides,...((X=i==null?void 0:i.defaultAppearance)==null?void 0:X.styleOverrides)??{}}};function ee(H){return!!(H&&H.length>10&&H.substring(0,10)==="api_public")}$o(()=>{t&&s(t)},[t]),$o(()=>{n&&window&&window.localStorage&&window.localStorage.getItem(no)&&window.localStorage.getItem(no)!==n&&Vp()},[n]),$o(()=>{o&&c(o)},[o]),$o(()=>{if(ee(e))I(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),I(!0);return}},[e,I]);let U={publicApiKey:e,userId:n,setUserId:s,setFlows:g,flows:a,failedFlowResponses:d,setFailedFlowResponses:x,flowResponses:b,setFlowResponses:w,userProperties:v,setUserProperties:f,openFlowStates:E,setOpenFlowStates:S,completedFlowsToKeepOpenDuringSession:y,setCompletedFlowsToKeepOpenDuringSession:A,customVariables:C,setCustomVariables:m,isNewGuestUser:B,setIsNewGuestUser:F,hasActiveFullPageFlow:k,setHasActiveFullPageFlow:O,organizationId:p,setOrganizationId:c,navigate:i&&i.navigate?i.navigate:$,defaultAppearance:D,shouldGracefullyDegrade:N,setShouldGracefullyDegrade:I,apiUrl:i&&i.apiUrl?i.apiUrl:Qi,readonly:i&&i.readonly?i.readonly:!1};if(N)return wt.createElement(K.Provider,{value:U},r);let{overrides:te}=Vi(D);return wt.createElement(jp,{fallback:wt.createElement(wt.Fragment,null,r)},wt.createElement(K.Provider,{value:U},wt.createElement(Hp,{theme:pt(D.theme,xr,te??{},(i==null?void 0:i.theme)??{})},r,wt.createElement(Hi,null))))};import Ld from"react";import ce,{useEffect as vs,useState as Bs}from"react";import ze,{useState as pd}from"react";import kt from"styled-components";import zo from"react";import Tt from"react";import Ri from"styled-components";var Zi=Ri.span`
|
|
663
|
+
`;var Mi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let r=e.props,[n,s]=ur([]),[p,c]=ur(!1),[a,g]=ur(e.id);return mr(()=>{n.length==0&&!p&&(c(!0),o({choice:[]}))},[p]),mr(()=>{a!==e.id&&(g(e.id),s([]))},[e]),mr(()=>{o({choice:n}),n.length>=r.minChoices?t(!0):t(!1)},[n]),Ze.createElement(Ei,{className:l("selectListContainer",i)},Ze.createElement(Ai,null,Ze.createElement(Ni,{className:l("selectListTitle",i)},e.title),Ze.createElement(Ii,{appearance:i,className:l("selectListSubtitle",i)},e.subtitle)),r.options.map((d,y)=>{let w=n.includes(d.id);return Ze.createElement(Oi,{key:`select-item-${y}`,onClick:()=>{if(n.includes(d.id)){s(n.filter(C=>C!==d.id));return}n.length<r.maxChoices?s([...n,d.id]):n.length==1&&r.maxChoices==1&&s([d.id])},hideBottomBorder:y===r.options.length-1,className:l("selectListSelectItem",i)},Ze.createElement(Li,{className:l("selectListItemImage",i)},d.imageUri&&Ze.createElement(Di,{src:d.imageUri,alt:`select-icon-${y}`}),Ze.createElement($i,{appearance:i,className:l("selectListSelectItemText",i)},d.title)),Ze.createElement(Qe,{appearance:i,value:w,primaryColor:i.theme.colorPrimary}))}))};import Pe,{useEffect as Io,useState as ro}from"react";var dp=({children:e,id:t,shouldWrap:o=!1})=>Pe.createElement(Pe.Fragment,null,o?Pe.createElement("div",{key:t,style:{width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:1,overflowY:"auto"}},e):e),Oo=({appearance:e,steps:t,selectedStep:o,customStepTypes:i,customVariables:r,onButtonClick:n,onStepCompletion:s,flowId:p,type:c,hideOnFlowCompletion:a,onComplete:g,setVisible:d,setShowModal:y,onDismiss:w,showPagination:C=!1,customFormElements:T,allowBackNavigation:f,validationHandler:B,onFormDataChange:b,showFooter:S,prefillData:A})=>{var V;let m={...{linkCollection:vi,multiInput:xi,callToAction:Bi,selectList:Mi},...i},{primaryCTAClickSideEffects:E,secondaryCTAClickSideEffects:k}=ie(),[P,O]=ro(!1),[N,I]=ro({}),[$,D]=ro(!1),[ee,U]=ro(!1),[te,fe]=ro(null),X=t[o]??null,{markStepCompleted:H,markStepStarted:j,isLoading:Ce,updateCustomVariables:Ne,markFlowCompleted:be}=Y();Io(()=>{Ne(r)},[r,Ce]),Io(()=>{b&&b(N,me(),t[o],o)},[N]),Io(()=>{window&&f&&!ee&&(window.location.hash=t[o].id,U(!0))},[f,ee,U]),Io(()=>{var G;if(window&&((G=window==null?void 0:window.location)!=null&&G.hash)&&window.location.hash.replace("#","")!==t[o].id){let ne=window.location.hash.replace("#",""),se=t.findIndex(pe=>pe.id===ne);se!==-1&&j(p,t[se].id)}},[(V=window==null?void 0:window.location)==null?void 0:V.hash,j,o,t]);function me(){return{data:N[t[o].id]??{},stepId:t[o].id,customVariables:r}}function J(G,ne,se){let pe=o+1<t.length?t[o+1]:null;return s&&s(G,se,pe,N,me()),n?n(G,o,ne,pe):!0}function ge(G,ne){I(se=>{let pe={};return pe[G.id]=ne,{...se,...pe}})}function re(G){return G.selectedStep.imageUri?Pe.createElement(Ti,{image:G.selectedStep.imageUri,appearance:e,className:l("formContainerSidebarImage",e)}):null}let L=S&&Pe.createElement(ki,{step:t[o],canContinue:P&&!$,formType:c,selectedStep:o,appearance:e,onPrimaryClick:async()=>{if(D(!0),B){let se=await B(t[o],o,t[o+1],N,me());if(se||se===!1){fe(typeof se=="string"?se:null),D(!1);return}else fe(null)}let G={...me()};await H(p,t[o].id,G),o+1<t.length&&await j(p,t[o+1].id);let ne=J(t[o],"primary",o);o+1>=t.length&&(g&&g(),w&&w(),a&&ne&&(d&&d(!1),y(!1)),await be(p)),E(t[o]),D(!1),window&&f&&o+1<t.length&&(window.location.hash=t[o+1].id)},onSecondaryClick:()=>{J(t[o],"secondary",o),k(t[o])},onBack:async()=>{o-1>=0&&(D(!0),await j(p,t[o-1].id),D(!1))},steps:t,allowBackNavigation:f,errorMessage:te});return Pe.createElement(Pe.Fragment,null,Pe.createElement(Si,{className:l("formContainer",e)},Pe.createElement(bi,null,Pe.createElement(dp,{id:o,shouldWrap:c==="large-modal"},Pe.createElement(wi,{key:X.id,type:c,className:l("formContent",e)},t.map(G=>{let ne=m[G.type];return X.id!==G.id?null:Pe.createElement(ne,{key:G.id,stepData:G,canContinue:P,setCanContinue:O,onSaveData:se=>{ge(G,se)},appearance:e,customFormElements:T,flowId:p,prefillData:A})}),C&&Pe.createElement(Pi,{className:l("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),L))),c=="large-modal"&&Pe.createElement(re,{selectedStep:t[o]})))};import io from"react";import{createGlobalStyle as cp}from"styled-components";function oe({appearance:e}){if(!e||!e.styleOverrides)return io.createElement(io.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([i,r])=>typeof r=="object");if(t.length===0)return io.createElement(io.Fragment,null);let o=cp`
|
|
664
|
+
${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map(([s,p])=>`${Jo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return io.createElement(o,{inlineStyles:t})}var Ui=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:r,customVariables:n,customFormElements:s,onComplete:p,appearance:c,hideOnFlowCompletion:a=!0,onStepCompletion:g,onButtonClick:d,dismissible:y=!0,endFlowOnDismiss:w=!1,modalPosition:C="center",repeatable:T=!1,onDismiss:f,showPagination:B=!1,allowBackNavigation:b=!1,validationHandler:S,showFrigadeBranding:A=!1,onFormDataChange:h,showFooter:m=!0,prefillData:E={}})=>{let{getFlow:k,getFlowSteps:P,isLoading:O,targetingLogicShouldHideFlow:N,getFlowStatus:I,getCurrentStepIndex:$,markFlowCompleted:D,markFlowNotStarted:ee}=Y(),U=$(e),{mergeAppearanceWithDefault:te}=Q(),[fe,X]=up(!1),{setOpenFlowState:H,getOpenFlowState:j,hasOpenModals:Ce}=we();c=te(c);let[Ne,be]=i!==void 0&&r!==void 0?[i,r]:[j(e,!0),re=>H(e,re)];if(mp(()=>{!fe&&!O&&(X(!0),I(e)===q&&T&&(ee(e),window&&window.localStorage&&Object.keys(window.localStorage).forEach(L=>{L.startsWith(pr)&&window.localStorage.removeItem(L)})),X(!0))},[fe,X,O]),O)return null;let me=k(e);if(!me||N(me))return null;let J=P(e);if(!J||i!==void 0&&i===!1||I(e)===q&&a||(o=="modal"||o=="corner-modal")&&Ce(e))return null;let ge=()=>{be(!1),f&&f(),w===!0&&D(e)};if(C=="center"&&o==="modal"||o==="large-modal"){let re={padding:"24px"};return o==="large-modal"?(re.width="85%",re.height="90%",re.maxHeight="800px",re.minHeight="500px",re.padding="0"):re.width="400px",Ge.createElement(He,{appearance:c,onClose:ge,visible:Ne,style:re,dismissible:y,showFrigadeBranding:A},Ge.createElement(oe,{appearance:c}),Ge.createElement(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:B,customFormElements:s,allowBackNavigation:b,validationHandler:S,onFormDataChange:h,showFooter:m,prefillData:E}))}return o==="modal"&&C!=="center"?Ge.createElement(wo,{appearance:c,onClose:ge,visible:Ne,modalPosition:C},Ge.createElement(oe,{appearance:c}),Ge.createElement(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:B,customFormElements:s,allowBackNavigation:b,validationHandler:S,onFormDataChange:h,showFooter:m,prefillData:E})):Ge.createElement(Ge.Fragment,null,Ge.createElement(oe,{appearance:c}),Ge.createElement(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:B,customFormElements:s,allowBackNavigation:b,validationHandler:S,onFormDataChange:h,showFooter:m,prefillData:E}))},zi=Ui;import{useCallback as Wi,useContext as fp,useEffect as gp}from"react";function fr(){let{organizationId:e,userId:t,setOrganizationId:o}=fp(K),{mutateUserFlowState:i}=Be(),{config:r,apiUrl:n}=_e(),s=It(),{verifySDKInitiated:p}=Ot();gp(()=>{if(t&&e){if(t.startsWith(Lt))return;let g=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(g)||(s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(g,"true"))}},[t,e]);let c=Wi(async g=>{if(!p())return;if(!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let d={foreignUserId:t,foreignUserGroupId:e,properties:g};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(d)}),i()},[e,t,r,i]),a=Wi(async(g,d)=>{if(!p())return;if(!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let w={foreignUserId:t,foreignUserGroupId:e,events:[{event:g,properties:d}]};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(w)}),i()},[e,t,r,i]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:c,trackEventForOrganization:a}}var _i="frigade-xFrigade_guestUserId",no="frigade-xFrigade_userId",Hi=({})=>{let{setFlowResponses:e}=Xt(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=Be(),{userId:r,setUserId:n}=Jt(),[s,p]=gr(null),{getFlowStatus:c}=Y(),{flows:a,userProperties:g,setIsNewGuestUser:d,flowResponses:y}=xp(K),[w,C]=gr([]),[T,f]=gr([]),{organizationId:B}=fr();Lo(()=>{if(!o&&t)for(let h=0;h<t.length;h++){let m=t[h],E=a.find(k=>k.slug===(m==null?void 0:m.flowId));if(E&&m&&m.shouldTrigger===!0&&E.type=="FORM"&&E.triggerType==="AUTOMATIC"&&!T.includes(E.slug)){setTimeout(()=>{b(m.flowId)},500);break}}},[o,t]),Lo(()=>{y.length>0&&i()},[y]);function b(h){let m=a.find(E=>E.slug===h);m&&m.triggerType==="AUTOMATIC"&&!T.includes(m.slug)&&(f([...T,m.slug]),C([m]))}function S(){if(!r){let h=localStorage.getItem(no);if(h){n(h);return}let m=localStorage.getItem(_i);if(m){n(m);return}d(!0);let E=Lt+hp();try{localStorage.setItem(_i,E)}catch(k){console.log("Failed to save guest user id locally: Local storage unavailable",k)}n(k=>k||E)}}Lo(()=>{try{if(a){let h=[];a.forEach(m=>{if(m.data){let E=m.data.match(/"imageUri":"(.*?)"/g);E&&E.forEach(k=>{let P=k.replace('"imageUri":"',"").replace('"',"");if(h.includes(P))return;let O=new Image;O.src=P,h.push(P)})}})}}catch{}},[a]),Lo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(Lt))try{localStorage.setItem(no,r)}catch(h){console.log("Failed to save user id locally: Local storage available",h)}r===null&&setTimeout(()=>{r===null&&S()},50)},[r,a,g]);function A(){return bt.createElement(bt.Fragment,null,w.map(h=>c(h.slug)!==Me?null:bt.createElement("span",{key:h.slug},bt.createElement(zi,{flowId:h.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return bt.createElement(bt.Fragment,null,bt.createElement(A,null))};import{ErrorBoundary as jp}from"react-error-boundary";import so from"core-js-pure/actual/structured-clone";function xr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pt(...e){let t=e.shift(),o=e.length===1?e[0]:pt(...e);if(!xr(t)||!xr(o))throw new Error("deepmerge can only merge Objects");let i=so(t);return Object.entries(o).forEach(([r,n])=>{xr(n)?i[r]!==void 0?Object.assign(i,{[r]:pt(i[r],so(n))}):Object.assign(i,{[r]:so(n)}):Array.isArray(n)?i[r]!==void 0?Object.assign(i,{[r]:[...i[r],...so(n)]}):Object.assign(i,{[r]:so(n)}):Object.assign(i,{[r]:n})}),i}var ji={colorPrimary:"colors.primary.background",colorText:"colors.neutral.foreground",colorBackground:"colors.neutral.background",colorBackgroundSecondary:"colors.secondary.background",colorTextOnPrimaryBackground:"colors.primary.foreground",colorTextSecondary:"colors.secondary.foreground",colorTextDisabled:"colors.gray700",colorBorder:"colors.gray800",colorTextError:"colors.negative.foreground",borderRadius:"radii.lg"};function Cp(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(ji[o]){let r=ji[o].split("."),n=t;r.forEach((s,p)=>{n[s]||(n[s]=p===r.length-1?i:{}),n=n[s]})}}),t}function yp(e){if(!e)return;let t=pt({},e),o={};return Object.keys(t).forEach(i=>{let r=`.fr-${i}`;o[r]=t[i]}),o}function Vi(e){let{theme:t,styleOverrides:o}=e,i=Cp(t),r=yp(o);return{overrides:i,css:r}}import Op from"styled-components";import{compose as Lp,variant as Ki}from"styled-system";import Gi from"react";import Sp,{ThemeProvider as bp,useTheme as wp}from"styled-components";import{border as Tp,color as Fp,compose as kp,get as Pp,shadow as vp,space as Bp,system as Ep,typography as Ap}from"styled-system";var Np={width:{property:"width",scale:"sizes",transform:(e,t)=>Pp(t,e,!(typeof e=="number"&&!isNaN(e))||e>1?e:e*100+"%")},height:{property:"height",scale:"sizes"},minWidth:{property:"minWidth",scale:"sizes"},minHeight:{property:"minHeight",scale:"sizes"},maxWidth:{property:"maxWidth",scale:"sizes"},maxHeight:{property:"maxHeight",scale:"sizes"},overflow:!0,overflowX:!0,overflowY:!0,display:!0,verticalAlign:!0},Ip=Sp("div")(({css:e})=>e,kp(Tp,Fp,vp,Bp,Ap,Ep(Np))),lo=({as:e,children:t,overrides:o,...i})=>{let r=wp(),n={border:"none",boxSizing:"border-box",m:0,p:0},s=()=>Gi.createElement(Ip,{as:e,...n,...i},t);if(o!==void 0){let p=pt(r,o);return Gi.createElement(bp,{theme:p},s())}return s()};var ao={Primary:{backgroundColor:"primary.background",color:"primary.foreground","&:hover":{backgroundColor:"blue400"}},Secondary:{backgroundColor:"white",border:"1px solid",borderColor:"gray800",color:"neutral.foreground","&:hover":{backgroundColor:"blue900"}},Link:{backgroundColor:"transparent",color:"primary.inverted"},Plain:{backgroundColor:"transparent",color:"neutral.foreground"}},Dp={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},qi=Op(lo)(()=>({whiteSpace:"nowrap"}),Lp(Ki({scale:"components.Button",variants:"components.Button"}),Ki({prop:"size",variants:Dp})));import $p from"styled-components";import{variant as Mp,system as Up}from"styled-system";var Do={Display1:{fontSize:"5xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"4xl"},Display2:{fontSize:"4xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"3xl"},H1:{fontSize:"3xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"2xl"},H2:{fontSize:"2xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"xl"},H3:{fontSize:"xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"lg"},H4:{fontSize:"lg",fontWeight:"bold",letterSpacing:"md",lineHeight:"md"},Body1:{fontSize:"md",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Body2:{fontSize:"sm",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Caption:{fontSize:"xs",fontWeight:"regular",letterSpacing:"md",lineHeight:"sm"}};var Yi=$p(lo)(Mp({scale:"components.Text",variants:"components.Text"}),Up({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Xi=4,Ji="px",zp=20,Wp=Object.fromEntries(Array.from(Array(zp+1),(e,t)=>t===0?[.5,`${.5*Xi}${Ji}`]:[t,`${t*Xi}${Ji}`])),zt={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",red500:"#c00000"},hr={colors:{...zt,neutral:{foreground:zt.gray300},primary:{background:zt.blue500,foreground:zt.white,inverted:zt.blue500},negative:{foreground:zt.red500}},fonts:{default:"TT Interphases Pro, sans-serif"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{regular:400,semibold:500,bold:700},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"},radii:{md:"8px",lg:"20px",round:"50%"},shadows:{md:"0px 4px 20px rgba(0, 0, 0, 0.06)"},space:Wp,components:{Button:ao,Text:Do}};var Qi="https://api.frigade.com",K=_p({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:Je,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{},apiUrl:Qi,readonly:!1});function Vp(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var Gp=({publicApiKey:e,userId:t,organizationId:o,config:i,children:r})=>{var fe,X;let[n,s]=Oe(t||null),[p,c]=Oe(o||null),[a,g]=Oe([]),[d,y]=Oe([]),[w,C]=Oe([]),[T,f]=Oe({}),[B,b]=Oe({}),[S,A]=Oe([]),[h,m]=Oe({}),[E,k]=Oe(!1),[P,O]=Oe(!1),[N,I]=Oe(!ee(e)),$=(H,j)=>{if(j==="_blank"){window.open(H,"_blank");return}setTimeout(()=>{window.location.href=H},50)},D={theme:{...Je.theme,...((fe=i==null?void 0:i.defaultAppearance)==null?void 0:fe.theme)??{}},styleOverrides:{...Je.styleOverrides,...((X=i==null?void 0:i.defaultAppearance)==null?void 0:X.styleOverrides)??{}}};function ee(H){return!!(H&&H.length>10&&H.substring(0,10)==="api_public")}$o(()=>{t&&s(t)},[t]),$o(()=>{n&&window&&window.localStorage&&window.localStorage.getItem(no)&&window.localStorage.getItem(no)!==n&&Vp()},[n]),$o(()=>{o&&c(o)},[o]),$o(()=>{if(ee(e))I(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),I(!0);return}},[e,I]);let U={publicApiKey:e,userId:n,setUserId:s,setFlows:g,flows:a,failedFlowResponses:d,setFailedFlowResponses:y,flowResponses:w,setFlowResponses:C,userProperties:T,setUserProperties:f,openFlowStates:B,setOpenFlowStates:b,completedFlowsToKeepOpenDuringSession:S,setCompletedFlowsToKeepOpenDuringSession:A,customVariables:h,setCustomVariables:m,isNewGuestUser:E,setIsNewGuestUser:k,hasActiveFullPageFlow:P,setHasActiveFullPageFlow:O,organizationId:p,setOrganizationId:c,navigate:i&&i.navigate?i.navigate:$,defaultAppearance:D,shouldGracefullyDegrade:N,setShouldGracefullyDegrade:I,apiUrl:i&&i.apiUrl?i.apiUrl:Qi,readonly:i&&i.readonly?i.readonly:!1};if(N)return wt.createElement(K.Provider,{value:U},r);let{overrides:te}=Vi(D);return wt.createElement(jp,{fallback:wt.createElement(wt.Fragment,null,r)},wt.createElement(K.Provider,{value:U},wt.createElement(Hp,{theme:pt(D.theme,hr,te??{},(i==null?void 0:i.theme)??{})},r,wt.createElement(Hi,null))))};import Ld from"react";import ce,{useEffect as vs,useState as Bs}from"react";import We,{useState as pd}from"react";import kt from"styled-components";import zo from"react";import Tt from"react";import Ri from"styled-components";var Zi=Ri.span`
|
|
665
665
|
font-weight: 600;
|
|
666
666
|
font-size: 14px;
|
|
667
667
|
font-style: normal;
|
|
@@ -672,6 +672,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
672
672
|
vertical-align: middle;
|
|
673
673
|
margin-left: 32px;
|
|
674
674
|
padding-right: 12px;
|
|
675
|
+
${e=>ke(e)}
|
|
675
676
|
`,Kp=Ri.div`
|
|
676
677
|
flex-direction: row;
|
|
677
678
|
justify-content: space-between;
|
|
@@ -680,7 +681,8 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
680
681
|
padding-bottom: 20px;
|
|
681
682
|
padding-right: 8px;
|
|
682
683
|
width: 100%;
|
|
683
|
-
|
|
684
|
+
${e=>ke(e)}
|
|
685
|
+
`,Mo=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:r,primaryColor:n="#000000",checkBoxType:s="round",appearance:p})=>Tt.createElement(Tt.Fragment,null,Tt.createElement(Kp,{className:l("checklistStepsContainer",p),appearance:p,styleOverrides:{...r}},i==="left"&&e&&Tt.createElement(Zi,{className:l("checklistStepLabel",p),styleOverrides:o,appearnace:p},e),Tt.createElement(Qe,{appearance:p,value:t,type:s,primaryColor:n}),i==="right"&&e&&Tt.createElement(Zi,{className:l("checklistStepLabel",p),styleOverrides:o,appearance:p},e)),Tt.createElement(oe,{appearance:p}));import po from"styled-components";var en=po.div`
|
|
684
686
|
font-weight: 700;
|
|
685
687
|
font-size: 18px;
|
|
686
688
|
line-height: 22px;
|
|
@@ -713,7 +715,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
713
715
|
justify-content: flex-start;
|
|
714
716
|
border-bottom: 1px solid ${e=>e.theme.colorBorder};
|
|
715
717
|
padding-right: 16px;
|
|
716
|
-
`;var nn=({data:e,index:t,isSelected:o,primaryColor:i,style:r,onClick:n,appearance:s})=>{var p,c;return zo.createElement("div",{style:{position:"relative",paddingLeft:"0px"},onClick:()=>{n()}},o&&zo.createElement(Uo,{className:l("checklistStepItemSelectedIndicator",s),layoutId:"checklis-step-selected",style:{backgroundColor:((p=s==null?void 0:s.theme)==null?void 0:p.colorPrimary)??i}}),zo.createElement(rn,{className:l("checklistStepItem",s),key:`hero-checklist-step-${t}`,appearance:s,role:"listitem"},zo.createElement(Mo,{value:e.complete,labelPosition:"left",label:e.stepName??e.title,style:r,primaryColor:((c=s==null?void 0:s.theme)==null?void 0:c.colorPrimary)??i,appearance:s})))};import Ft from"react";import
|
|
718
|
+
`;var nn=({data:e,index:t,isSelected:o,primaryColor:i,style:r,onClick:n,appearance:s})=>{var p,c;return zo.createElement("div",{style:{position:"relative",paddingLeft:"0px"},onClick:()=>{n()}},o&&zo.createElement(Uo,{className:l("checklistStepItemSelectedIndicator",s),layoutId:"checklis-step-selected",style:{backgroundColor:((p=s==null?void 0:s.theme)==null?void 0:p.colorPrimary)??i}}),zo.createElement(rn,{className:l("checklistStepItem",s),key:`hero-checklist-step-${t}`,appearance:s,role:"listitem"},zo.createElement(Mo,{value:e.complete,labelPosition:"left",label:e.stepName??e.title,style:r,primaryColor:((c=s==null?void 0:s.theme)==null?void 0:c.colorPrimary)??i,appearance:s})))};import Ft from"react";import Cr from"styled-components";import Re from"styled-components";var ih=Re.div`
|
|
717
719
|
background: #ffffff;
|
|
718
720
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
719
721
|
border-radius: 20px;
|
|
@@ -757,31 +759,31 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
757
759
|
border-radius: 20px;
|
|
758
760
|
background-color: ${e=>e.theme.colorPrimary};
|
|
759
761
|
opacity: 0.12;
|
|
760
|
-
`;var qp=
|
|
762
|
+
`;var qp=Cr.div`
|
|
761
763
|
display: flex;
|
|
762
764
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
763
765
|
justify-content: flex-start;
|
|
764
766
|
align-items: ${e=>e.textLocation=="top"?"flex-end":"center"};
|
|
765
767
|
width: 100%;
|
|
766
768
|
|
|
767
|
-
${e=>
|
|
768
|
-
`,Yp=
|
|
769
|
+
${e=>ke(e)}
|
|
770
|
+
`,Yp=Cr.div`
|
|
769
771
|
flex-grow: 1;
|
|
770
772
|
position: relative;
|
|
771
773
|
${e=>e.textLocation=="top"?"width: 100%;":""}
|
|
772
|
-
`,Xp=
|
|
774
|
+
`,Xp=Cr.span`
|
|
773
775
|
font-weight: 600;
|
|
774
776
|
font-size: 14px;
|
|
775
777
|
line-height: 18px;
|
|
776
778
|
padding-right: ${e=>e.padding};
|
|
777
779
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
778
780
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
779
|
-
${e=>
|
|
780
|
-
`;var
|
|
781
|
+
${e=>ke(e)}
|
|
782
|
+
`;var Le=({count:e,total:t,display:o="count",textLocation:i="left",style:r={},textStyle:n={},appearance:s})=>{if(t===0)return Ft.createElement(Ft.Fragment,null);let p=e===0?"10px":`${e/t*100}%`,c=o==="compact"?"5px":"10px",a=Math.round(e/t*100),g=o==="compact"?"5px":"14px",d;return o==="count"?d=`${e}/${t}`:o==="compact"?d=`${a}%`:o==="percent"&&(d=`${a}% complete`),i==="top"&&(g="0px"),Ft.createElement(qp,{className:l("progressBarContainer",s),textLocation:i,styleOverrides:r},Ft.createElement(Xp,{className:l("progressBarStepText",s),style:{...n,fontSize:o==="compact"?12:14,fontWeight:o==="compact"?400:600},appearance:s,padding:g,textLocation:i},d),Ft.createElement(Yp,{textLocation:i,className:l("progressBar",s)},Ft.createElement(sn,{style:{zIndex:o=="compact"?1:5},fgWidth:p,barHeight:c,appearance:s,className:l("progressBarFill",s)}),Ft.createElement(ln,{className:l("progressBarBackground",s),barHeight:c,appearance:s})))};import co from"react";import Qp from"styled-components";import _o from"react";import Wo from"react";var Wt=({stepData:e,appearance:t})=>Wo.createElement(Wo.Fragment,null,Wo.createElement(tn,{appearance:t,className:l("checklistStepTitle",t),dangerouslySetInnerHTML:le(e.title)}),Wo.createElement(on,{appearance:t,className:l("checklistStepSubtitle",t),dangerouslySetInnerHTML:le(e.subtitle)}));import yr from"react";var _t=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},i=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return yr.createElement(Bo,{className:l("ctaContainer",t)},yr.createElement(Z,{appearance:t,title:e.primaryButtonTitle,onClick:o}),e.secondaryButtonTitle&&yr.createElement(Z,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:i,style:{width:"auto",marginRight:"12px"}}))};var Ht=({stepData:e,appearance:t})=>_o.createElement(_o.Fragment,null,_o.createElement(Wt,{stepData:e,appearance:t}),_o.createElement(_t,{stepData:e,appearance:t}));import Jp from"react";function an(e){return Jp.createElement(Ve,{appearance:e.appearance,videoUri:e.videoUri})}var Sr="default",Zp=Qp.img`
|
|
781
783
|
border-radius: 4px;
|
|
782
784
|
max-height: 260px;
|
|
783
785
|
min-height: 200px;
|
|
784
|
-
`,pn=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return co.createElement("div",null,o)}return co.createElement(en,{className:l("checklistStepContent",t)},e.imageUri?co.createElement(Zp,{className:l("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?co.createElement(an,{videoUri:e.videoUri,appearance:t}):null,co.createElement(Ht,{stepData:e,appearance:t}))};import
|
|
786
|
+
`,pn=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return co.createElement("div",null,o)}return co.createElement(en,{className:l("checklistStepContent",t)},e.imageUri?co.createElement(Zp,{className:l("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?co.createElement(an,{videoUri:e.videoUri,appearance:t}):null,co.createElement(Ht,{stepData:e,appearance:t}))};import Ee,{useRef as Rp,useState as ed}from"react";import jt from"styled-components";var dn=jt.div`
|
|
785
787
|
display: block;
|
|
786
788
|
`,td=jt.div`
|
|
787
789
|
display: flex;
|
|
@@ -826,7 +828,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
826
828
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
827
829
|
border-radius: 50%;
|
|
828
830
|
}
|
|
829
|
-
`,cn="videoCarousel",mn=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return
|
|
831
|
+
`,cn="videoCarousel",mn=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return Ee.createElement(dn,null,Ee.createElement(Ht,{stepData:e,appearance:t}));function o({video:n}){let s=Rp(),[p,c]=ed(!1);return Ee.createElement(od,null,!p&&Ee.createElement(nd,{onClick:()=>{c(!0),s.current.play()},appearance:t},Ee.createElement(Eo,null)),Ee.createElement(rd,{controls:p,ref:s,play:p,src:n.uri}),Ee.createElement(id,null,n.title))}let i=e.props;return i.videos?Ee.createElement(dn,null,Ee.createElement(Wt,{stepData:e,appearance:t}),Ee.createElement(td,null,i.videos.map((n,s)=>Ee.createElement("span",{key:`${n.uri}-${s}`},Ee.createElement(o,{video:n})))),Ee.createElement(_t,{stepData:e,appearance:t})):null};import et from"react";import Ho from"styled-components";var un=Ho.div`
|
|
830
832
|
display: block;
|
|
831
833
|
`,sd=Ho.pre`
|
|
832
834
|
display: block;
|
|
@@ -858,6 +860,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
858
860
|
min-width: ${e=>e.type!="modal"?"600px":"100%"};
|
|
859
861
|
background: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
860
862
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
863
|
+
${e=>ke(e)}
|
|
861
864
|
`,cd=kt.h1`
|
|
862
865
|
font-size: 18px;
|
|
863
866
|
font-style: normal;
|
|
@@ -886,9 +889,9 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
886
889
|
`,gd=kt.div`
|
|
887
890
|
flex: 2;
|
|
888
891
|
padding: 2rem 2rem 2rem 0rem;
|
|
889
|
-
`,xd=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:r,setSelectedStep:n,className:s="",customStepTypes:p=new Map,appearance:c,type:a})=>{let{mergeAppearanceWithDefault:g}=Q();c=g(c);let
|
|
892
|
+
`,xd=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:r,setSelectedStep:n,className:s="",customStepTypes:p=new Map,appearance:c,type:a})=>{let{mergeAppearanceWithDefault:g}=Q();c=g(c);let y={...{[Sr]:pn,[cn]:mn,[fn]:gn},...p},[w,C]=pd(0),T=r??w,f=n??C,B=o.filter(S=>S.complete===!0).length,b=()=>{var S;return!((S=o[T])!=null&&S.type)||!y[o[T].type]?y[Sr]({stepData:o[T],appearance:c}):y[o[T].type]({stepData:o[T],appearance:c})};return We.createElement(dd,{type:a,styleOverrides:i,className:s,appearance:c},We.createElement(xn,{style:{flex:1}},We.createElement(xn,{style:{padding:"28px 0px 28px 28px",borderBottom:"1px solid #E5E5E5"}},We.createElement(cd,{className:l("checklistTitle",c),appearance:c},e),We.createElement(md,{className:l("checklistSubtitle",c),appearance:c},t),We.createElement(Le,{total:o.length,count:B,style:{marginTop:"24px",paddingRight:"40px"},appearance:c})),We.createElement(ud,{className:l("checklistStepsContainer",c)},o.map((S,A)=>We.createElement(nn,{data:S,index:A,key:A,listLength:o.length,isSelected:A===T,primaryColor:c.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{f(A)},appearance:c})))),We.createElement(fd,{appearance:c,className:l("checklistDivider",c)}),We.createElement(gd,null,We.createElement(b,null)))},br=xd;import z,{useState as bd}from"react";import hn from"react";import hd from"styled-components";var Cd=hd.svg`
|
|
890
893
|
transition: 'transform 0.35s ease-in-out';
|
|
891
|
-
`,Vt=({style:e,className:t})=>hn.createElement(Cd,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e,className:t},hn.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import ue from"styled-components";var
|
|
894
|
+
`,Vt=({style:e,className:t})=>hn.createElement(Cd,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e,className:t},hn.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import ue from"styled-components";var wr={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},Cn=ue.div`
|
|
892
895
|
max-height: 350px;
|
|
893
896
|
padding-bottom: 40px;
|
|
894
897
|
`,yn=ue.div`
|
|
@@ -910,7 +913,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
910
913
|
padding-left: 1px;
|
|
911
914
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
912
915
|
`,wn=ue.div`
|
|
913
|
-
${e=>
|
|
916
|
+
${e=>F(e)} {
|
|
914
917
|
border: 1px solid #fafafa;
|
|
915
918
|
}
|
|
916
919
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
@@ -924,7 +927,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
924
927
|
flex-direction: row;
|
|
925
928
|
justify-content: space-between;
|
|
926
929
|
`,Fn=ue.p`
|
|
927
|
-
${e=>
|
|
930
|
+
${e=>F(e)} {
|
|
928
931
|
font-weight: 400;
|
|
929
932
|
font-size: 10px;
|
|
930
933
|
line-height: 12px;
|
|
@@ -938,7 +941,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
938
941
|
`,Pn=ue.div`
|
|
939
942
|
flex: 1;
|
|
940
943
|
`,vn=ue.div`
|
|
941
|
-
${e=>
|
|
944
|
+
${e=>F(e)} {
|
|
942
945
|
display: flex;
|
|
943
946
|
justify-content: center;
|
|
944
947
|
align-content: center;
|
|
@@ -948,7 +951,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
948
951
|
padding-right: 8px;
|
|
949
952
|
}
|
|
950
953
|
`,Bn=ue.p`
|
|
951
|
-
${e=>
|
|
954
|
+
${e=>F(e)} {
|
|
952
955
|
font-style: normal;
|
|
953
956
|
font-weight: 600;
|
|
954
957
|
font-size: 22px;
|
|
@@ -960,7 +963,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
960
963
|
margin-bottom: 16px;
|
|
961
964
|
}
|
|
962
965
|
`,En=ue.p`
|
|
963
|
-
${e=>
|
|
966
|
+
${e=>F(e)} {
|
|
964
967
|
font-weight: 400;
|
|
965
968
|
font-size: 14px;
|
|
966
969
|
line-height: 18px;
|
|
@@ -969,14 +972,14 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
969
972
|
margin-bottom: 8px;
|
|
970
973
|
}
|
|
971
974
|
`,An=ue.div`
|
|
972
|
-
${e=>
|
|
975
|
+
${e=>F(e)} {
|
|
973
976
|
display: flex;
|
|
974
977
|
flex-direction: row;
|
|
975
978
|
justify-content: center;
|
|
976
979
|
gap: 8px;
|
|
977
980
|
}
|
|
978
981
|
`,Nn=ue.div`
|
|
979
|
-
${e=>
|
|
982
|
+
${e=>F(e)} {
|
|
980
983
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
981
984
|
background-color: ${e=>e.selected?"#FAFAFA":"#FFFFFF"};
|
|
982
985
|
:hover {
|
|
@@ -996,7 +999,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
996
999
|
position: relative;
|
|
997
1000
|
cursor: pointer;
|
|
998
1001
|
`,In=ue.p`
|
|
999
|
-
${e=>
|
|
1002
|
+
${e=>F(e)} {
|
|
1000
1003
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1001
1004
|
color: ${e=>e.selected?"#434343":"#BFBFBF"};
|
|
1002
1005
|
}
|
|
@@ -1039,7 +1042,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1039
1042
|
overflow: hidden;
|
|
1040
1043
|
row-gap: 10px;
|
|
1041
1044
|
`,zn=tt.div`
|
|
1042
|
-
${e=>
|
|
1045
|
+
${e=>F(e)} {
|
|
1043
1046
|
color: #595959;
|
|
1044
1047
|
}
|
|
1045
1048
|
text-transform: uppercase;
|
|
@@ -1049,7 +1052,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1049
1052
|
letter-spacing: 0.09em;
|
|
1050
1053
|
margin-bottom: 12px;
|
|
1051
1054
|
`,Wn=tt.div`
|
|
1052
|
-
${e=>
|
|
1055
|
+
${e=>F(e)} {
|
|
1053
1056
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1054
1057
|
background: #ffffff;
|
|
1055
1058
|
border: 1px solid #fafafa;
|
|
@@ -1062,7 +1065,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1062
1065
|
max-width: 150px;
|
|
1063
1066
|
min-width: 200px;
|
|
1064
1067
|
`,_n=tt.div`
|
|
1065
|
-
${e=>
|
|
1068
|
+
${e=>F(e)} {
|
|
1066
1069
|
background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);
|
|
1067
1070
|
}
|
|
1068
1071
|
width: 40px;
|
|
@@ -1080,7 +1083,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1080
1083
|
width: 20px;
|
|
1081
1084
|
height: 20px;
|
|
1082
1085
|
`,jn=tt.div`
|
|
1083
|
-
${e=>
|
|
1086
|
+
${e=>F(e)} {
|
|
1084
1087
|
color: #434343;
|
|
1085
1088
|
}
|
|
1086
1089
|
font-weight: 600;
|
|
@@ -1089,7 +1092,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1089
1092
|
margin-top: 12px;
|
|
1090
1093
|
margin-bottom: 8px;
|
|
1091
1094
|
`,Vn=tt.div`
|
|
1092
|
-
${e=>
|
|
1095
|
+
${e=>F(e)} {
|
|
1093
1096
|
color: #8c8c8c;
|
|
1094
1097
|
}
|
|
1095
1098
|
font-weight: 400;
|
|
@@ -1101,7 +1104,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1101
1104
|
line-height: 14px;
|
|
1102
1105
|
font-weight: 400;
|
|
1103
1106
|
cursor: pointer;
|
|
1104
|
-
`;var Sd=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=ie();return ot.createElement(Mn,{style:t,className:l("guideContainer",r)},ot.createElement(zn,{className:l("guideTitle",r)},o),ot.createElement(Un,{className:l("guideItemContainer",r)},e.map((p,c)=>ot.createElement(Wn,{key:`guide-${p.id??c}`,className:l("guideItem",r)},p.icon&&ot.createElement(_n,{className:l("guideIcon",r)},ot.createElement(Hn,null,p.icon)),ot.createElement(jn,{className:l("guideItemTitle",r),dangerouslySetInnerHTML:le(p.title)}),ot.createElement(Vn,{className:l("guideItemSubtitle",r),dangerouslySetInnerHTML:le(p.subtitle)}),ot.createElement(Gn,{className:l("guideItemLink",r),color:i,onClick:()=>{p.primaryButtonUri&&s(p),n&&n(p)}},p.primaryButtonTitle)))))},mo=Sd;var wd=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:r,onClose:n,selectedStep:s,setSelectedStep:p,customStepTypes:c,appearance:a,guideData:g,guideTitle:d,onGuideButtonClick:
|
|
1107
|
+
`;var Sd=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=ie();return ot.createElement(Mn,{style:t,className:l("guideContainer",r)},ot.createElement(zn,{className:l("guideTitle",r)},o),ot.createElement(Un,{className:l("guideItemContainer",r)},e.map((p,c)=>ot.createElement(Wn,{key:`guide-${p.id??c}`,className:l("guideItem",r)},p.icon&&ot.createElement(_n,{className:l("guideIcon",r)},ot.createElement(Hn,null,p.icon)),ot.createElement(jn,{className:l("guideItemTitle",r),dangerouslySetInnerHTML:le(p.title)}),ot.createElement(Vn,{className:l("guideItemSubtitle",r),dangerouslySetInnerHTML:le(p.subtitle)}),ot.createElement(Gn,{className:l("guideItemLink",r),color:i,onClick:()=>{p.primaryButtonUri&&s(p),n&&n(p)}},p.primaryButtonTitle)))))},mo=Sd;var wd=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:r,onClose:n,selectedStep:s,setSelectedStep:p,customStepTypes:c,appearance:a,guideData:g,guideTitle:d,onGuideButtonClick:y})=>{let w=({stepData:m,handleSecondaryCTAClick:E,handleCTAClick:k})=>m?z.createElement(vn,{className:l("checklistStepContainer",a),"data-testid":"checklistStepContainer"},z.createElement(Bn,{appearance:a,className:l("checklistStepTitle",a),dangerouslySetInnerHTML:le(m.title)}),z.createElement(En,{appearance:a,className:l("checklistStepSubtitle",a),dangerouslySetInnerHTML:le(m.subtitle)}),z.createElement(An,{className:l("checklistCTAContainer",a)},m.secondaryButtonTitle&&z.createElement(Z,{title:m.secondaryButtonTitle,onClick:E,appearance:a,secondary:!0}),z.createElement(Z,{title:m.primaryButtonTitle,onClick:k,appearance:a}))):z.createElement(z.Fragment,null),T={...{default:m=>{var O;if((O=e[b])!=null&&O.StepContent){let N=e[b].StepContent;return z.createElement("div",null,N)}let E=e[b];return z.createElement(w,{stepData:m,handleCTAClick:()=>{E.handlePrimaryButtonClick&&E.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{E.handleSecondaryButtonClick&&E.handleSecondaryButtonClick()}})}},...c},[f,B]=bd(0),b=s??f,S=p??B,A=()=>{var m;return e?!((m=e[b])!=null&&m.type)||!T[e[b].type]?T.default(e[b]):T[e[b].type]({stepData:e[b],primaryColor:a.theme.colorPrimary}):z.createElement(z.Fragment,null)},h=e.filter(m=>m.complete).length;return r?(a.theme.modalContainer||(a.theme.borderRadius&&(wr.borderRadius=a.theme.borderRadius+"px"),a.theme.modalContainer=wr),z.createElement(He,{onClose:n,visible:r,appearance:a},z.createElement(Dn,null,z.createElement(yn,null,z.createElement(Sn,{appearance:a,className:l("checklistTitle",a)},t),z.createElement(bn,{appearance:a,className:l("checklistSubtitle",a)},o)),z.createElement(Cn,null,e&&e.length>0&&z.createElement(wn,{className:l("stepsContainer",a)},z.createElement(Tn,null,z.createElement("div",{style:{flex:3}},z.createElement(Fn,{className:l("stepsTitle",a)},i)),z.createElement(Ln,null,z.createElement(Le,{style:{width:"100%"},count:h,total:e.length,appearance:a}))),z.createElement(kn,null,z.createElement(Pn,{className:l("checklistStepListContainer",a),appearance:a},e.map((m,E)=>{let k=b===E;return z.createElement(Nn,{selected:k,className:l(`checklistStepListItem${k?"Selected":""}`,a),key:`checklist-guide-step-${m.id??E}`,disabled:m.blocked,onClick:()=>{m.blocked||S(E)},title:m.blocked?"Finish remaining steps to continue":void 0},k&&z.createElement(Uo,{className:l("checklistStepItemSelectedIndicator",a),layoutId:"checklist-step-selected",style:{backgroundColor:a.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),z.createElement(In,{selected:k,className:l(`checklistStepListStepName${k?"Selected":""}`,a)},m.stepName),z.createElement(On,null,z.createElement(Qe,{value:m.complete,type:"round",primaryColor:a.theme.colorPrimary,progress:m.progress,appearance:a}),z.createElement($n,null,z.createElement(Vt,{style:{marginLeft:"10px"},color:a.theme.colorBackgroundSecondary}))))})),z.createElement(A,null))),g&&g.length>0&&z.createElement(mo,{steps:g,title:d,primaryColor:a.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:a,onButtonClick:m=>(y&&y(m),!0)}))))):z.createElement(z.Fragment,null)},Tr=wd;import ve,{useEffect as ss,useState as Td}from"react";import he from"react";import rt from"styled-components";var Kn=rt.div`
|
|
1105
1108
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1106
1109
|
border: 1px solid;
|
|
1107
1110
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -1152,7 +1155,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1152
1155
|
flex-direction: row;
|
|
1153
1156
|
justify-content: flex-start;
|
|
1154
1157
|
align-items: center;
|
|
1155
|
-
`;var es=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:r,appearance:n,customStepTypes:s})=>{var d;let p=t?{}:{transform:"rotate(90deg)"},c=t?{overflow:"hidden",maxHeight:"0px",transition:"max-height 0.2s ease-out"}:{overflow:"hidden",maxHeight:"1000px",transition:"max-height 0.15s ease-in"};function a(){return he.createElement(he.Fragment,null,e.imageUri||e.videoUri?he.createElement(qn,{className:l("stepMediaContainer",n)},e.imageUri?he.createElement(Yn,{className:l("stepImage",n),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?he.createElement(
|
|
1158
|
+
`;var es=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:r,appearance:n,customStepTypes:s})=>{var d;let p=t?{}:{transform:"rotate(90deg)"},c=t?{overflow:"hidden",maxHeight:"0px",transition:"max-height 0.2s ease-out"}:{overflow:"hidden",maxHeight:"1000px",transition:"max-height 0.15s ease-in"};function a(){return he.createElement(he.Fragment,null,e.imageUri||e.videoUri?he.createElement(qn,{className:l("stepMediaContainer",n)},e.imageUri?he.createElement(Yn,{className:l("stepImage",n),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?he.createElement(Ve,{appearance:n,videoUri:e.videoUri}):null):null,he.createElement(Zn,{className:l("stepSubtitle",n),appearance:n,dangerouslySetInnerHTML:le(e.subtitle)}),he.createElement(Bo,{className:l("checklistCTAContainer",n)},e.secondaryButtonTitle?he.createElement(Z,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>r(),appearance:n}):null,he.createElement(Z,{title:e.primaryButtonTitle??"Continue",onClick:()=>i(),appearance:n})))}function g(){if(!s)return null;let y=s[e.type];return y?y(e,n):null}return he.createElement(Kn,{"data-testid":`step-${e.id}`,className:l("checklistStepContainer",n),appearance:n},he.createElement(Xn,{className:l("stepHeader",n)},he.createElement(Rn,null,he.createElement(Mo,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(d=n==null?void 0:n.theme)==null?void 0:d.colorPrimary,appearance:n}),he.createElement(Jn,{appearance:n,className:l("stepTitle",n),dangerouslySetInnerHTML:le(e.title),onClick:()=>o()})),he.createElement(Qn,{className:l("stepChevronContainer",n),onClick:()=>o(),appearance:n},he.createElement(Vt,{style:{...p,transition:"transform 0.2s ease-in-out"}}))),he.createElement("div",{key:e.id,style:{...c}},g()??a()))};import Gt from"styled-components";var x0=Gt.div`
|
|
1156
1159
|
background: #ffffff;
|
|
1157
1160
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
1158
1161
|
border-radius: 6px;
|
|
@@ -1193,7 +1196,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1193
1196
|
padding: 24px;
|
|
1194
1197
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
1195
1198
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1196
|
-
`;var Fd=({title:e,subtitle:t,steps:o,onClose:i,visible:r,autoExpandFirstIncompleteStep:n=!0,autoCollapse:s=!0,autoExpandNextStep:p=!0,selectedStep:c,setSelectedStep:a,appearance:g,type:d,className:
|
|
1199
|
+
`;var Fd=({title:e,subtitle:t,steps:o,onClose:i,visible:r,autoExpandFirstIncompleteStep:n=!0,autoCollapse:s=!0,autoExpandNextStep:p=!0,selectedStep:c,setSelectedStep:a,appearance:g,type:d,className:y,customStepTypes:w,style:C})=>{let T=o.filter(h=>h.complete).length,[f,B]=Td(Array(o.length).fill(!0));ss(()=>{let h=[...f];if(n){for(let m=0;m<o.length;m++)if(!o[m].complete){h[m]=!1;break}B(h)}},[]),ss(()=>{b(c)},[c]);let b=h=>{let m=[...f];if(s)for(let E=0;E<f.length;++E)E!==h&&(m[E]=!0);m[h]=!m[h],B(m)};if(!r&&d=="modal")return ve.createElement(ve.Fragment,null);let S=ve.createElement(ve.Fragment,null,ve.createElement(ts,null,ve.createElement(os,{appearance:g,className:l("checklistTitle",g),dangerouslySetInnerHTML:le(e)}),ve.createElement(rs,{appearance:g,className:l("checklistSubtitle",g),dangerouslySetInnerHTML:le(t)})),ve.createElement(Le,{display:"percent",count:T,total:o.length,style:{margin:"14px 0px 8px 0px"},appearance:g})),A=ve.createElement(is,{className:xe(l("checklistContainer",g),y)},o.map((h,m)=>{let E=f[m];return ve.createElement(es,{appearance:g,stepData:h,collapsed:E,key:`modal-checklist-${h.id??m}`,onClick:()=>{if(c===m){b(m);return}a(m)},onPrimaryButtonClick:()=>{h.handlePrimaryButtonClick&&h.handlePrimaryButtonClick(),p&&!h.completionCriteria&&m<f.length-1&&f[m+1]&&a(m+1)},onSecondaryButtonClick:()=>{h.handleSecondaryButtonClick&&h.handleSecondaryButtonClick()},customStepTypes:w})}));return d==="inline"?ve.createElement(ns,{appearance:g,className:xe(l("checklistInlineContainer",g),y),style:C},S,A):ve.createElement(ve.Fragment,null,ve.createElement(He,{onClose:i,visible:r,appearance:g,style:{maxWidth:"600px"},headerContent:S},A))},Fr=Fd;import ae,{useEffect as kr,useRef as Id,useState as Pt}from"react";import{useEffect as kd,useState as Pd}from"react";var ls=()=>{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]=Pd(t),r=null,n=()=>{r!==null?clearTimeout(r):s(),r=setTimeout(()=>{s()},16)},s=()=>{let p=Object.fromEntries(Object.entries(e).map(([c,a])=>{if(!window)return[c,!1];let g=window.matchMedia(a);return g.addEventListener("change",n),[c,g.matches]}));i(p)};return kd(()=>{s()},[]),o};import Kt from"react";import de,{css as as,keyframes as ps}from"styled-components";var ds=as`
|
|
1197
1200
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1198
1201
|
`,vd=as`
|
|
1199
1202
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
@@ -1276,7 +1279,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1276
1279
|
margin-bottom: 12px;
|
|
1277
1280
|
width: 40px;
|
|
1278
1281
|
`,Cs=de(gs)`
|
|
1279
|
-
${e=>
|
|
1282
|
+
${e=>F(e)} {
|
|
1280
1283
|
${vd}
|
|
1281
1284
|
|
|
1282
1285
|
background: ${({theme:e})=>e.colorBackground};
|
|
@@ -1335,7 +1338,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1335
1338
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1336
1339
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1337
1340
|
`}
|
|
1338
|
-
`;var Fs=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=Q(),{primaryCTAClickSideEffects:r}=ie();o=i(o);let{imageUri:n=null,subtitle:s=null,title:p=null,complete:c=!1,blocked:a=!1}=e,g=e.primaryButtonTitle||e.secondaryButtonTitle,d=()=>{r(e)};return Kt.createElement(xs,{className:l("carouselCard",o),onClick:a?null:d,style:t,blocked:a,complete:c},n&&Kt.createElement(hs,{className:l("carouselCardImage",o),src:n,alt:p,style:{opacity:c||a?.4:1}}),c&&Kt.createElement(ys,{className:l("carouselCompletedPill",o)},Kt.createElement(Ts,{style:{color:"#108E0B"}},"Complete")),p&&Kt.createElement(ws,{blocked:a,complete:c,className:l("carouselCardTitle",o)},p),s&&Kt.createElement(dt.Quiet,{blocked:a,complete:c,className:l("carouselCardSubtitle",o)},s))};var Od=()=>ae.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ae.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),ae.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),ae.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),ks=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,r]=Pt(!1),[n,s]=Pt(!1);
|
|
1341
|
+
`;var Fs=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=Q(),{primaryCTAClickSideEffects:r}=ie();o=i(o);let{imageUri:n=null,subtitle:s=null,title:p=null,complete:c=!1,blocked:a=!1}=e,g=e.primaryButtonTitle||e.secondaryButtonTitle,d=()=>{r(e)};return Kt.createElement(xs,{className:l("carouselCard",o),onClick:a?null:d,style:t,blocked:a,complete:c},n&&Kt.createElement(hs,{className:l("carouselCardImage",o),src:n,alt:p,style:{opacity:c||a?.4:1}}),c&&Kt.createElement(ys,{className:l("carouselCompletedPill",o)},Kt.createElement(Ts,{style:{color:"#108E0B"}},"Complete")),p&&Kt.createElement(ws,{blocked:a,complete:c,className:l("carouselCardTitle",o)},p),s&&Kt.createElement(dt.Quiet,{blocked:a,complete:c,className:l("carouselCardSubtitle",o)},s))};var Od=()=>ae.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ae.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),ae.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),ae.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),ks=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,r]=Pt(!1),[n,s]=Pt(!1);kr(()=>{t===!0&&i===!1?r(!0):t===!1&&i===!0&&s(!0)},[t]);let p=()=>{r(!1),s(!1)},c=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return i?ae.createElement(us,{style:c,reversed:n,onAnimationEnd:n?p:null},ae.createElement(fs,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},ae.createElement(Od,null))):null},Ps=({flowId:e,appearance:t,customVariables:o,className:i})=>{let r=Id(null),[n,s]=Pt(!1),[p,c]=Pt(!1),[a,g]=Pt(null),[d,y]=Pt([]),[w,C]=Pt(0),{isSmall:T}=ls(),f=T?1:3,{getFlowMetadata:B,getFlowSteps:b,getNumberOfStepsCompleted:S,updateCustomVariables:A,isLoading:h}=Y();kr(()=>{A(o)},[o,h]),kr(()=>{if(h)return;let N=B(e),I=S(e),$=b(e);g(N),N.data!==null&&(y($.sort((D,ee)=>Number(D.complete)-Number(ee.complete))),c($.length>f),C(I))},[h]);let m=[];for(let N=0;N<d.length;N+=f)m.push(d.slice(N,N+f));let E=N=>{let I=N.target,$=I.scrollWidth-I.clientWidth,D=Math.ceil(I.scrollLeft);D>0&&n===!1&&s(!0),D===0&&n===!0&&s(!1),D<$&&p===!1&&c(!0),D===$&&p===!0&&c(!1)},k=(N=!0)=>{let I=N?1:-1;r.current!==null&&r.current.scrollBy({left:r.current.clientWidth*I,behavior:"smooth"})},P=null,O=N=>{P!==null?clearTimeout(P):E(N),P=setTimeout(()=>{E(N)},16)};return h?null:ae.createElement(Cs,{className:xe(l("carouselContainer",t),i)},ae.createElement("div",{style:{display:"flex",justifyContent:T?"center":"space-between",marginBottom:20,flexWrap:T?"wrap":"nowrap",gap:T?16:20}},ae.createElement("div",null,ae.createElement(Ss,{className:l("carouselTitle",t)},a==null?void 0:a.title),ae.createElement(dt.Quiet,{className:l("carouselSubtitle",t)},a==null?void 0:a.subtitle)),ae.createElement(bs,{className:l("progressWrapper",t)},ae.createElement(Le,{count:w,total:d.length,appearance:t}))),ae.createElement("div",{style:{position:"relative"}},ae.createElement(ks,{show:n,onClick:()=>k(!1)}),ae.createElement(ks,{side:"right",show:p,onClick:k}),ae.createElement(cs,{ref:r,onScroll:O},m.map((N,I)=>ae.createElement(ms,{key:I,style:{flex:`0 0 calc(100% - ${d.length>f?36:0}px)`}},N.map(($,D)=>ae.createElement(Fs,{key:D,stepData:$,style:{flex:d.length>f?`0 1 calc(100% / ${f} - 16px * 2 / ${f})`:1},appearance:t})))))),ae.createElement(oe,{appearance:t}))};var Pr=({flowId:e,title:t,subtitle:o,style:i,initialSelectedStep:r,className:n,type:s="inline",onDismiss:p,visible:c,customVariables:a,onStepCompletion:g,onButtonClick:d,appearance:y,hideOnFlowCompletion:w,setVisible:C,customStepTypes:T,checklistStyle:f="default",autoExpandFirstIncompleteStep:B,autoExpandNextStep:b,...S})=>{let{getFlow:A,getFlowSteps:h,markStepCompleted:m,getStepStatus:E,getNumberOfStepsCompleted:k,isLoading:P,targetingLogicShouldHideFlow:O,updateCustomVariables:N,getFlowMetadata:I,isStepBlocked:$,getFlowStatus:D,hasActiveFullPageFlow:ee,setHasActiveFullPageFlow:U}=Y(),{primaryCTAClickSideEffects:te,secondaryCTAClickSideEffects:fe}=ie(),{getOpenFlowState:X,setOpenFlowState:H}=we(),[j,Ce]=Bs(r||0),[Ne,be]=Bs(!1),me=c===void 0?X(e):c,J=s==="modal",{mergeAppearanceWithDefault:ge}=Q();if(y=ge(y),vs(()=>{N(a)},[a,P]),vs(()=>{c!==void 0&&(J&&c===!0?U(!0):J&&c===!1&&U(!1))},[c,C,ee]),P)return null;let re=A(e);if(!re||O(re))return null;let L=h(e);if(!L||w===!0&&D(e)===q)return null;let V=I(e);if(V!=null&&V.title&&(t=V.title),V!=null&&V.subtitle&&(o=V.subtitle),!Ne&&r===void 0&&k(e)>0){let u=L.findIndex(x=>x.complete===!1);Ce(u>-1?u:L.length-1),be(!0)}function G(){if(j+1>=L.length){J&&H(e,!1);return}$(e,L[j+1].id)||Ce(j+1)}function ne(u,x,v){let W=j+1<L.length?L[j+1]:null;d&&d(u,j,x,W)===!0&&J&&De(),g&&g(u,v,W),!g&&!d&&(u.primaryButtonUri||u.secondaryButtonUri)&&J&&De()}function se(){return L.map((u,x)=>({...u,handleSecondaryButtonClick:()=>{G(),fe(u),u.skippable===!0&&m(e,u.id,{skipped:!0}),ne(u,"secondary",x)},handlePrimaryButtonClick:()=>{(!u.completionCriteria&&(u.autoMarkCompleted||u.autoMarkCompleted===void 0)||u.completionCriteria&&u.autoMarkCompleted===!0)&&(m(e,u.id),G()),ne(u,"primary",x),te(u),E(e,u.id)===Ue&&G()}}))}function pe(){return ce.createElement(oe,{appearance:y})}let Ye={steps:se(),title:t,subtitle:o,primaryColor:y.theme.colorPrimary,appearance:y,customStepTypes:T,type:s,className:n,autoExpandFirstIncompleteStep:B,autoExpandNextStep:b};function De(){H(e,!1),p&&p(),C&&C(!1)}function Et(){return ce.createElement(ce.Fragment,null,ce.createElement(pe,null),ce.createElement(Ps,{flowId:e,appearance:y,customVariables:a,className:n}))}function ft(){return ce.createElement(ce.Fragment,null,ce.createElement(pe,null),ce.createElement(Fr,{visible:me,onClose:()=>{De()},selectedStep:j,setSelectedStep:Ce,autoExpandNextStep:!0,appearance:y,...Ye}))}function At(){let u=S.guideFlowId,x;return u&&A(u)&&(x=h(u)),ce.createElement(ce.Fragment,null,ce.createElement(pe,null),ce.createElement(Tr,{visible:me,stepsTitle:V.stepsTitle?V.stepsTitle:"Your quick start guide",onClose:()=>{De()},selectedStep:j,setSelectedStep:Ce,guideData:x,guideTitle:S.guideTitle??"Guide",appearance:y,title:t,subtitle:o,onGuideButtonClick:v=>{ne(v,"link",0)},customStepTypes:T,...Ye}))}function gt(){let u=ce.createElement(br,{flowId:e,style:i,selectedStep:j,setSelectedStep:Ce,appearance:y,type:s,...Ye});return J?ce.createElement(He,{onClose:()=>{De()},visible:me,appearance:y,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},ce.createElement(pe,null),u):ce.createElement(ce.Fragment,null,ce.createElement(pe,null),u)}switch(f){case"condensed":return ft();case"with-guide":return At();case"default":return gt();case"carousel":return Et();default:return gt()}};var Dd=e=>Ld.createElement(Pr,{type:"inline",...e});import mt,{useEffect as $d}from"react";import Ke from"react";import jo from"styled-components";var Es=jo.div`
|
|
1339
1342
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1340
1343
|
border-radius: 8px;
|
|
1341
1344
|
padding: 6px 10px 6px 10px;
|
|
@@ -1363,7 +1366,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1363
1366
|
display: flex;
|
|
1364
1367
|
height: 100%;
|
|
1365
1368
|
align-items: center;
|
|
1366
|
-
`;var Os=({title:e,count:t,total:o,onClick:i,style:r={},className:n,appearance:s,type:p="default"})=>
|
|
1369
|
+
`;var Os=({title:e,count:t,total:o,onClick:i,style:r={},className:n,appearance:s,type:p="default"})=>Ke.createElement(Ke.Fragment,null,Ke.createElement(oe,{appearance:s}),Ke.createElement(Es,{onClick:()=>i!==void 0&&i(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...r},className:xe(n??"",l("progressRingContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&Ke.createElement(Is,{className:l("progressRingContainer",s)},Ke.createElement($t,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),Ke.createElement(As,{type:p,className:l("badgeTitleContainer",s)},Ke.createElement(Ns,{type:p,appearance:s,className:l("badgeTitle",s)},e),i!==void 0&&Ke.createElement(Vt,{className:l("badgeChevron",s),color:s.theme.colorPrimary})),p=="default"&&o&&o!==0&&Ke.createElement(Le,{display:"compact",count:t,total:o,bgColor:s.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:s})));import ct from"react";import uo from"styled-components";var Ls=uo.div`
|
|
1367
1370
|
display: flex;
|
|
1368
1371
|
flex-direction: row;
|
|
1369
1372
|
width: 100%;
|
|
@@ -1375,7 +1378,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1375
1378
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1376
1379
|
border-radius: 12px;
|
|
1377
1380
|
`,Ds=uo.div`
|
|
1378
|
-
${e=>
|
|
1381
|
+
${e=>F(e)} {
|
|
1379
1382
|
display: flex;
|
|
1380
1383
|
justify-content: center;
|
|
1381
1384
|
align-items: center;
|
|
@@ -1401,7 +1404,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1401
1404
|
:hover {
|
|
1402
1405
|
opacity: 0.8;
|
|
1403
1406
|
}
|
|
1404
|
-
`;var Us=({title:e,subtitle:t,icon:o,appearance:i,count:r,total:n,className:s,style:p})=>ct.createElement(ct.Fragment,null,ct.createElement(Ls,{appearance:i,className:xe(l("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&ct.createElement(Ds,{className:l("fullWidthProgressBadgeIcon",i)},o),ct.createElement($s,null,ct.createElement(Fe,{size:"small",appearance:i,title:e,subtitle:t})),ct.createElement(Ms,{className:l("fullWidthProgressBadgeProgressContainer",i)},ct.createElement(
|
|
1407
|
+
`;var Us=({title:e,subtitle:t,icon:o,appearance:i,count:r,total:n,className:s,style:p})=>ct.createElement(ct.Fragment,null,ct.createElement(Ls,{appearance:i,className:xe(l("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&ct.createElement(Ds,{className:l("fullWidthProgressBadgeIcon",i)},o),ct.createElement($s,null,ct.createElement(Fe,{size:"small",appearance:i,title:e,subtitle:t})),ct.createElement(Ms,{className:l("fullWidthProgressBadgeProgressContainer",i)},ct.createElement(Le,{count:r,total:n,display:"percent",textLocation:"top"}))));var Md=({flowId:e,title:t,subtitle:o,icon:i,style:r,onClick:n,className:s,customVariables:p,hideOnFlowCompletion:c,appearance:a,type:g="default"})=>{let{getFlow:d,getFlowSteps:y,getFlowStatus:w,getNumberOfStepsCompleted:C,isLoading:T,targetingLogicShouldHideFlow:f,updateCustomVariables:B}=Y(),{mergeAppearanceWithDefault:b}=Q();a=b(a);let{setOpenFlowState:S,getOpenFlowState:A}=we();if($d(()=>{B(p)},[p,T]),T)return null;let h=d(e);if(!h||f(h)||c===!0&&w(e)===q)return null;let m=y(e),E=C(e);return g==="full-width"?mt.createElement(mt.Fragment,null,mt.createElement(oe,{appearance:a}),mt.createElement(Us,{title:t,subtitle:o,count:E,total:m.length,style:r,className:s,appearance:a,icon:i,onClick:()=>{}})):mt.createElement(mt.Fragment,null,mt.createElement(oe,{appearance:a}),mt.createElement(Os,{count:E,total:m.length,title:t,style:r,onClick:()=>{S(e,!0),n&&n()},type:g,className:s,appearance:a}))};import Ud from"react";var zd=({flowId:e,style:t,appearance:o,...i})=>{let{getFlow:r,targetingLogicShouldHideFlow:n,getFlowSteps:s}=Y(),{mergeAppearanceWithDefault:p}=Q();o=p(o);let c=r(e);if(!c||n(c))return null;let a=s(e);return Ud.createElement(mo,{steps:a,style:t,appearance:o,...i})};import ut,{useContext as Jd,useEffect as Qd}from"react";import _,{useEffect as Vo,useLayoutEffect as Ws,useRef as jd,useState as fo}from"react";import go from"styled-components";import{useCallback as Wd,useEffect as _d,useState as Hd}from"react";var vr=(e,t,o,i={x:20,y:20},r)=>{let n=r=="fixed"?0:window.scrollY,s=r=="fixed"?0:window.scrollX;return t==="left"?{x:e.left-o+i.x+s,y:e.top-i.y+n}:t==="right"?{x:e.left+e.width+i.x+s,y:e.top-i.y+n}:{x:0,y:0}};function zs(e,t){let o="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[i,r]=Hd(o),n=Wd(()=>{e&&r(e.getBoundingClientRect())},[e]);return _d(()=>(n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)),[e,t]),i}var _s=300,Hs=100,Vd=500,qt=12,Gd=go.div`
|
|
1405
1408
|
width: 100%;
|
|
1406
1409
|
height: 100%;
|
|
1407
1410
|
border-radius: 9999px;
|
|
@@ -1442,8 +1445,8 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1442
1445
|
`,Yd=go(js)`
|
|
1443
1446
|
width: ${qt+12}px;
|
|
1444
1447
|
height: ${qt+12}px;
|
|
1445
|
-
`,Xd=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:r=!0,primaryColor:n="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:c={},selectedStep:a=0,customStepTypes:g,appearance:d,dismissible:
|
|
1446
|
-
${e=>
|
|
1448
|
+
`,Xd=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:r=!0,primaryColor:n="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:c={},selectedStep:a=0,customStepTypes:g,appearance:d,dismissible:y=!1,showHighlightOnly:w,showStepCount:C=!0,completedStepsCount:T=0,showFrigadeBranding:f=!1,cssPosition:B="absolute"})=>{var se,pe,Ye,De,Et,ft,At,gt,u,x,v,W;let[b,S]=fo(),[A,h]=fo(new Date),m=jd(null),[E,k]=fo(document.querySelector(e[a].selector)),P=zs(E,A),[O,N]=fo(),[I,$]=fo(!w),D=(pe=(se=e[a])==null?void 0:se.props)!=null&&pe.position?e[a].props.position:B,ee=((De=(Ye=e[a])==null?void 0:Ye.props)==null?void 0:De.zIndex)??90,U=(b==null?void 0:b.width)??_s,te=(b==null?void 0:b.height)??Hs,fe=window.location.pathname.split("/").pop();Ws(()=>{m.current&&S({width:m.current.clientWidth,height:m.current.clientHeight})},[a,A,D]),Vo(()=>{w||$(!0)},[a]);let X=()=>{let M=document.querySelector(e[a].selector);if(!M){N(void 0),k(null);return}O&&O===JSON.stringify(M==null?void 0:M.getBoundingClientRect())||(k(M),h(new Date),M&&N(JSON.stringify(M.getBoundingClientRect())))};if(Vo(()=>{let M=new MutationObserver(X);return M.observe(document.body,{subtree:!0,childList:!0}),()=>M.disconnect()},[X]),Vo(()=>{let M=new MutationObserver(X);return M.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>M.disconnect()},[X]),Vo(()=>{let M=setInterval(()=>{X()},10);return()=>clearInterval(M)},[X]),Ws(()=>{setTimeout(()=>{X()},Vd),X()},[a,fe]),E===null||!p||P.height===0&&P.width===0&&D!=="fixed"&&B!=="static")return null;let H=i==="auto"?"right":i,j=vr(P,H,U,s,D),Ce=P.right+U>(window.innerWidth||document.documentElement.clientWidth),Ne=P.bottom+Hs>(window.innerHeight||document.documentElement.clientHeight);Ce&&i==="auto"&&(j=vr(P,"left",U,s,D),H="left"),(ft=(Et=e[a])==null?void 0:Et.props)!=null&&ft.tooltipPosition&&((gt=(At=e[a])==null?void 0:At.props)==null?void 0:gt.tooltipPosition)!=="auto"&&(((x=(u=e[a])==null?void 0:u.props)==null?void 0:x.tooltipPosition)==="left"||((W=(v=e[a])==null?void 0:v.props)==null?void 0:W.tooltipPosition)==="right")&&(H=e[a].props.tooltipPosition);let be=()=>{let M=()=>{if(e[a].handlePrimaryButtonClick&&(e[a].handlePrimaryButtonClick(),$(!1),setTimeout(()=>{X()},30)),T===e.length-1)return o()},$e=()=>{e[a].handleSecondaryButtonClick&&(e[a].handleSecondaryButtonClick(),w&&!e[a].secondaryButtonUri&&$(!1))};return _.createElement(_.Fragment,null,C&&e.length>1&&_.createElement(qr,null,_.createElement(Xr,{className:l("tooltipStepCounter",d)},a+1," of ",e.length)),_.createElement(Yr,{showStepCount:C,className:l("tooltipCTAContainer",d)},e[a].secondaryButtonTitle&&_.createElement(Z,{title:e[a].secondaryButtonTitle,appearance:d,onClick:$e,size:"small",withMargin:!1,secondary:!0}),e[a].primaryButtonTitle&&_.createElement(Z,{title:e[a].primaryButtonTitle,appearance:d,onClick:M,withMargin:!1,size:"small"})))},me=()=>_.createElement(_.Fragment,null,y&&_.createElement(Hr,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:l("tooltipClose",d),hasImage:!!e[a].imageUri||!!e[a].videoUri},_.createElement(Te,null)),e[a].imageUri&&_.createElement(jr,{dismissible:y,appearance:d,src:e[a].imageUri,className:l("tooltipImageContainer",d)}),e[a].videoUri&&!e[a].imageUri&&_.createElement(Vr,{dismissible:y,appearance:d,className:l("tooltipVideoContainer",d)},_.createElement(Ve,{appearance:d,videoUri:e[a].videoUri})),_.createElement(Kr,{className:l("tooltipContentContainer",d)},_.createElement(Fe,{appearance:d,title:e[a].title,subtitle:e[a].subtitle,size:"small"}),_.createElement(Gr,{className:l("tooltipFooter",d)},_.createElement(be,null)))),ge={...{default:M=>{var $e;if(($e=e[a])!=null&&$e.StepContent){let vl=e[a].StepContent;return _.createElement("div",null,vl)}return _.createElement(me,null)}},...g},re=()=>{var M;return e?!((M=e[a])!=null&&M.type)||!ge[e[a].type]?ge.default(e[a]):ge[e[a].type]({stepData:e[a],primaryColor:n}):_.createElement(_.Fragment,null)};if(w&&e[a].complete===!0)return null;let L={top:(j==null?void 0:j.y)-qt,left:(H=="left"?P.x+s.x:(j==null?void 0:j.x)-qt)??0,cursor:w?"pointer":"default",position:D},V=()=>{let $e=L.left+(H=="left"?-U:24);return Math.min(Math.max($e,20),window.innerWidth-U-20)},G=()=>{if(D==="fixed")return L.top;let M=L.top+te,$e=20;return M>window.innerHeight-$e?L.top+-te:L.top},ne=()=>{w&&(h(new Date),$(!I))};return _.createElement(qd,null,_.createElement(Yd,{style:L,zIndex:ee,className:l("tourHighlightContainer",d)},r&&e[a].showHighlight!==!1&&B!=="static"&&_.createElement(_.Fragment,null,_.createElement(Kd,{style:{position:D},onClick:ne,primaryColor:d.theme.colorPrimary,className:l("tourHighlightInnerCircle",d)}),_.createElement(Gd,{style:{position:"absolute"},onClick:ne,primaryColor:d.theme.colorPrimary,className:l("tourHighlightOuterCircle",d)}))),_.createElement(js,{style:{...L,left:V(),top:G()},zIndex:ee+1,className:l("tooltipContainerWrapper",d)},I&&_.createElement(_.Fragment,null,_.createElement(Co,{ref:m,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:B!=="static"?12:0,...c},appearance:d,className:l("tooltipContainer",d),maxWidth:_s,zIndex:ee+10},_.createElement(re,null)),f&&_.createElement(Qr,{className:l("poweredByFrigadeTooltipRibbon",d),appearance:d,zIndex:ee+10},_.createElement(yo,{appearance:d})))))},Go=Xd;import{Portal as Zd}from"react-portal";var Rd=({flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:r,showTooltipsSimultaneously:n=!1,onDismiss:s,dismissible:p,tooltipPosition:c="auto",showHighlightOnly:a=!1,dismissBehavior:g="complete-flow",onComplete:d,skipIfNotFound:y=!1,cssPosition:w="absolute",...C})=>{let{getFlow:T,getFlowSteps:f,isLoading:B,targetingLogicShouldHideFlow:b,markStepCompleted:S,markStepStarted:A,markFlowCompleted:h,updateCustomVariables:m,getCurrentStepIndex:E,getStepStatus:k,isStepBlocked:P,getFlowStatus:O,getNumberOfStepsCompleted:N}=Y(),{isLoadingUserFlowStateData:I}=Be(),{primaryCTAClickSideEffects:$,secondaryCTAClickSideEffects:D}=ie(),{hasOpenModals:ee}=we(),U=E(e),{openFlowStates:te}=Jd(K),{mergeAppearanceWithDefault:fe}=Q();if(o=fe(o),Qd(()=>{m(t)},[t,B]),I)return null;let X=T(e);if(!X||b(X)||O(e)==q||ee())return null;let H=f(e);if(Object.keys(te).length>0){let L=Object.keys(te).find(V=>te[V]===!0);if(L!==void 0&&L!==e)return ut.createElement(ut.Fragment,null)}async function j(L){if(await S(e,L.id),H.map(V=>k(e,V.id)).every(V=>V===Ue)){await h(e);return}if(!a&&U+1<H.length){if(P(e,H[U+1].id))return;await A(e,H[U+1].id)}}function Ce(L,V,G){let ne=U+1<H.length?H[U+1]:null;r&&r(L,U,V,ne),i&&i(L,G,ne)}function Ne(){return H.map(L=>({...L,handleSecondaryButtonClick:async()=>{D(L),L.skippable===!0&&await S(e,L.id,{skipped:!0}),Ce(L,"secondary",U)},handlePrimaryButtonClick:async()=>{(!L.completionCriteria&&(L.autoMarkCompleted||L.autoMarkCompleted===void 0)||L.completionCriteria&&L.autoMarkCompleted===!0)&&await j(L),Ce(L,"primary",U),$(L)}}))}async function be(L){s&&s(),g==="complete-flow"?await h(e):await S(e,L.id)}function me(){d&&d()}let J=!document.querySelector(H[U].selector);function ge(){let L=H.findIndex(V=>!!document.querySelector(V.selector));return H.map((V,G)=>J&&!n&&G!==L&&y?null:ut.createElement(Go,{key:V.id,appearance:o,steps:Ne(),selectedStep:G,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>be(V),tooltipPosition:c,showHighlightOnly:a,completedStepsCount:N(e),onComplete:me,cssPosition:w,...C}))}function re(){return ut.createElement(ut.Fragment,null,ut.createElement(oe,{appearance:o}),n||J&&y?ge():ut.createElement(Go,{appearance:o,steps:Ne(),selectedStep:U,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>be(H[U]),tooltipPosition:c,completedStepsCount:N(e),showHighlightOnly:a,onComplete:me,cssPosition:w,...C}))}return w==="static"?re():ut.createElement(Zd,null,re())};import Ae,{useEffect as ec,useRef as tc,useState as oc}from"react";import{Portal as rc}from"react-portal";import vt from"styled-components";var Vs=vt.button`
|
|
1449
|
+
${e=>F(e)} {
|
|
1447
1450
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1448
1451
|
|
|
1449
1452
|
display: flex;
|
|
@@ -1461,12 +1464,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1461
1464
|
}
|
|
1462
1465
|
}
|
|
1463
1466
|
`,Gs=vt.span`
|
|
1464
|
-
${e=>
|
|
1467
|
+
${e=>F(e)} {
|
|
1465
1468
|
font-size: 12px;
|
|
1466
1469
|
display: inline-block;
|
|
1467
1470
|
}
|
|
1468
1471
|
`,Ks=vt.span`
|
|
1469
|
-
${e=>
|
|
1472
|
+
${e=>F(e)} {
|
|
1470
1473
|
font-size: 12px;
|
|
1471
1474
|
display: inline-block;
|
|
1472
1475
|
}
|
|
@@ -1481,7 +1484,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1481
1484
|
align-items: flex-end;
|
|
1482
1485
|
z-index: 50;
|
|
1483
1486
|
`,Ys=vt.button`
|
|
1484
|
-
${e=>
|
|
1487
|
+
${e=>F(e)} {
|
|
1485
1488
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1486
1489
|
background-color: #ffffff;
|
|
1487
1490
|
border: 1px solid #f5f5f5;
|
|
@@ -1497,7 +1500,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1497
1500
|
border-radius: 45px;
|
|
1498
1501
|
cursor: pointer;
|
|
1499
1502
|
`,Xs=vt.div`
|
|
1500
|
-
${e=>
|
|
1503
|
+
${e=>F(e)} {
|
|
1501
1504
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1502
1505
|
background: #ffffff;
|
|
1503
1506
|
}
|
|
@@ -1514,7 +1517,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1514
1517
|
top: ${e=>e.type=="inline"?"68px":0};
|
|
1515
1518
|
margin-left: ${e=>e.type=="inline"?"-127px":0};
|
|
1516
1519
|
`,Js=vt.button`
|
|
1517
|
-
${e=>
|
|
1520
|
+
${e=>F(e)} {
|
|
1518
1521
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1519
1522
|
color: #434343;
|
|
1520
1523
|
:hover {
|
|
@@ -1530,8 +1533,8 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1530
1533
|
font-size: 14px;
|
|
1531
1534
|
|
|
1532
1535
|
padding: 8px 12px;
|
|
1533
|
-
`;import Qs from"react";var Zs=({style:e,className:t})=>Qs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Qs.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 Rs from"react";var el=({style:e,className:t})=>Rs.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"},Rs.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 ic=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:r="inline",title:n="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:c,markStepCompleted:a,getStepStatus:g,getNumberOfStepsCompleted:d,isLoading:
|
|
1534
|
-
${e=>
|
|
1536
|
+
`;import Qs from"react";var Zs=({style:e,className:t})=>Qs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Qs.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 Rs from"react";var el=({style:e,className:t})=>Rs.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"},Rs.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 ic=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:r="inline",title:n="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:c,markStepCompleted:a,getStepStatus:g,getNumberOfStepsCompleted:d,isLoading:y,targetingLogicShouldHideFlow:w}=Y(),{primaryCTAClickSideEffects:C}=ie(),T=tc(null),[f,B]=oc(!1),{mergeAppearanceWithDefault:b}=Q();s=b(s),ec(()=>(document.addEventListener("click",S,!1),()=>{document.removeEventListener("click",S,!1)}),[]);let S=k=>{T.current&&!T.current.contains(k.target)&&B(!1)};if(y)return null;let A=p(e);if(!A||w(A))return null;let h=c(e);if(!h||!i)return null;function m(k,P){!k.completionCriteria&&(k.autoMarkCompleted||k.autoMarkCompleted===void 0)&&a(e,k.id),C(k),o&&o(k,P),B(!1)}function E(){return f&&Ae.createElement(Xs,{className:l("floatingWidgetMenu",s),initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:r},h.map((k,P)=>Ae.createElement(Js,{className:l("floatingWidgetMenuItem",s),key:P,onClick:()=>m(k,P)},k.title)))}return r=="inline"?Ae.createElement("span",{ref:T},Ae.createElement(Vs,{style:t,onClick:()=>{B(!f)},className:l("supportButton",s)},Ae.createElement(Ks,{className:l("supportIconContainer",s)},Ae.createElement(el,{className:l("supportIcon",s),style:{width:"18px",height:"18px"}})),Ae.createElement(Gs,{className:l("supportButtonTitle",s)},n)),Ae.createElement(E,null)):Ae.createElement(rc,null,Ae.createElement(qs,{style:t,ref:T},Ae.createElement(E,null),Ae.createElement(Ys,{onClick:()=>{B(!f)},whileHover:{scale:1.1},className:l("floatingWidgetButton",s)},Ae.createElement(Zs,{className:l("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import qe,{useEffect as nc}from"react";import Ko from"styled-components";var tl=Ko.div`
|
|
1537
|
+
${e=>F(e)} {
|
|
1535
1538
|
display: flex;
|
|
1536
1539
|
flex-direction: column;
|
|
1537
1540
|
width: 100%;
|
|
@@ -1556,7 +1559,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1556
1559
|
align-items: flex-start;
|
|
1557
1560
|
margin-top: 16px;
|
|
1558
1561
|
`,il=Ko.div`
|
|
1559
|
-
${e=>
|
|
1562
|
+
${e=>F(e)} {
|
|
1560
1563
|
position: absolute;
|
|
1561
1564
|
top: 16px;
|
|
1562
1565
|
right: 16px;
|
|
@@ -1566,9 +1569,9 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1566
1569
|
opacity: 0.8;
|
|
1567
1570
|
}
|
|
1568
1571
|
}
|
|
1569
|
-
`;var sc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p})=>{let{getFlow:c,markFlowCompleted:a,markStepCompleted:g,isLoading:d,targetingLogicShouldHideFlow:
|
|
1572
|
+
`;var sc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p})=>{let{getFlow:c,markFlowCompleted:a,markStepCompleted:g,isLoading:d,targetingLogicShouldHideFlow:y,updateCustomVariables:w,getFlowSteps:C,getFlowStatus:T,getCurrentStepIndex:f}=Y(),{primaryCTAClickSideEffects:B}=ie(),{mergeAppearanceWithDefault:b}=Q();if(r=b(r),nc(()=>{w(o)},[o,d]),d)return null;let S=c(e);if(!S||y(S)||T(e)===q)return null;let h=C(e)[f(e)];return qe.createElement(qe.Fragment,null,qe.createElement(oe,{appearance:r}),qe.createElement(tl,{appearance:r,className:xe(l("embeddedTipContainer",r),n),style:s},(p===!0||h.dismissible)&&qe.createElement(il,{onClick:async()=>{await a(e),t&&t()},className:l("embeddedTipDismissButton",r)},qe.createElement(Te,null)),qe.createElement(ol,null,qe.createElement(Fe,{size:"small",appearance:r,title:h.title,subtitle:h.subtitle})),h.primaryButtonTitle&&qe.createElement(rl,{className:l("embeddedTipCallToActionContainer",r)},qe.createElement(Z,{classPrefix:"embeddedTip",title:h.primaryButtonTitle,appearance:r,withMargin:!1,size:"medium",type:"inline",onClick:async()=>{h.handlePrimaryButtonClick(),B(h),!(i&&i(h,f(e),"primary")===!1)&&(await g(e,h.id),await a(e))}}))))};import ye,{useEffect as lc}from"react";import Yt from"styled-components";var nl=Yt.div`
|
|
1570
1573
|
// use the :not annotation
|
|
1571
|
-
${e=>
|
|
1574
|
+
${e=>F(e)} {
|
|
1572
1575
|
display: flex;
|
|
1573
1576
|
flex-direction: ${e=>e.type==="square"?"column":"row"};
|
|
1574
1577
|
width: 100%;
|
|
@@ -1579,7 +1582,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1579
1582
|
border-radius: 12px;
|
|
1580
1583
|
}
|
|
1581
1584
|
`,sl=Yt.div`
|
|
1582
|
-
${e=>
|
|
1585
|
+
${e=>F(e)} {
|
|
1583
1586
|
display: flex;
|
|
1584
1587
|
width: 46px;
|
|
1585
1588
|
height: 46px;
|
|
@@ -1595,7 +1598,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1595
1598
|
flex-direction: column;
|
|
1596
1599
|
justify-content: center;
|
|
1597
1600
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1598
|
-
`,
|
|
1601
|
+
`,Br=Yt.div`
|
|
1599
1602
|
display: flex;
|
|
1600
1603
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1601
1604
|
align-items: flex-end;
|
|
@@ -1603,12 +1606,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1603
1606
|
:hover {
|
|
1604
1607
|
opacity: 0.8;
|
|
1605
1608
|
}
|
|
1606
|
-
`,
|
|
1609
|
+
`,Er=Yt.div`
|
|
1607
1610
|
display: flex;
|
|
1608
1611
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1609
1612
|
align-items: flex-end;
|
|
1610
1613
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1611
|
-
`;import
|
|
1614
|
+
`;import Ar from"react";var pl=({style:e,className:t})=>Ar.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"46",height:"46",fill:"none",viewBox:"0 0 46 46",style:e,className:t},Ar.createElement("circle",{cx:"23",cy:"23",r:"23",fill:"#E6F1FF"}),Ar.createElement("path",{stroke:"#0171F8",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M32 18.5l-2.25-1.313M32 18.5v2.25m0-2.25l-2.25 1.313M14 18.5l2.25-1.313M14 18.5l2.25 1.313M14 18.5v2.25m9 3l2.25-1.313M23 23.75l-2.25-1.313M23 23.75V26m0 6.75l2.25-1.313M23 32.75V30.5m0 2.25l-2.25-1.313m0-16.875L23 13.25l2.25 1.313M32 25.25v2.25l-2.25 1.313m-13.5 0L14 27.5v-2.25"}));var ac=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:r,onButtonClick:n,appearance:s,type:p="full-width",icon:c})=>{let{getFlow:a,markFlowCompleted:g,isLoading:d,targetingLogicShouldHideFlow:y,updateCustomVariables:w,getFlowMetadata:C,getFlowStatus:T,getFlowSteps:f,getCurrentStepIndex:B}=Y(),{primaryCTAClickSideEffects:b}=ie(),{mergeAppearanceWithDefault:S}=Q();if(s=S(s),lc(()=>{w(r)},[r,d]),d)return null;let A=a(e);if(!A||y(A)||T(e)===q)return null;let h=f(e),m=h.length>0?h[B(e)]:C(e);return m!=null&&m.title&&(t=m.title),m!=null&&m.subtitle&&(o=m.subtitle),ye.createElement(ye.Fragment,null,ye.createElement(oe,{appearance:s}),ye.createElement(nl,{type:p,appearance:s,className:l("bannerContainer",s)},p!="square"&&ye.createElement(sl,{className:l("bannerIconContainer",s)},c||ye.createElement(pl,null)),p==="square"&&m.dismissible&&ye.createElement(Er,{type:p,className:l("bannerDismissButtonContainer",s)},ye.createElement(Br,{type:p,onClick:async()=>{await g(e),i&&i()},className:l("bannerDismissButton",s)},ye.createElement(Te,null))),ye.createElement(ll,{type:p},ye.createElement(Fe,{appearance:s,title:t,subtitle:o,classPrefix:"banner"})),(m==null?void 0:m.primaryButtonTitle)&&ye.createElement(al,{type:p,className:l("bannerCallToActionContainer",s)},ye.createElement(Z,{title:m==null?void 0:m.primaryButtonTitle,appearance:s,onClick:()=>{b(m),n&&n(m,0,"primary")},classPrefix:"banner"})),p!=="square"&&m.dismissible&&ye.createElement(Er,{type:p,className:l("bannerDismissButtonContainer",s)},ye.createElement(Br,{type:p,onClick:async()=>{await g(e),i&&i()},className:l("bannerDismissButton",s)},ye.createElement(Te,null)))))};import R,{useEffect as pc}from"react";import{Portal as dc}from"react-portal";import it from"styled-components";var dl=it.div`
|
|
1612
1615
|
display: flex;
|
|
1613
1616
|
flex-direction: column;
|
|
1614
1617
|
width: 100%;
|
|
@@ -1648,7 +1651,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1648
1651
|
display: flex;
|
|
1649
1652
|
justify-content: center;
|
|
1650
1653
|
align-items: center;
|
|
1651
|
-
`,
|
|
1654
|
+
`,Nr=it.div`
|
|
1652
1655
|
display: flex;
|
|
1653
1656
|
justify-content: space-between;
|
|
1654
1657
|
margin-top: 16px;
|
|
@@ -1657,14 +1660,14 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1657
1660
|
display: flex;
|
|
1658
1661
|
justify-content: space-between;
|
|
1659
1662
|
margin-top: 8px;
|
|
1660
|
-
`,
|
|
1663
|
+
`,Ir=it.div`
|
|
1661
1664
|
font-size: 12px;
|
|
1662
1665
|
line-height: 18px;
|
|
1663
1666
|
color: ${e=>e.appearance.theme.colorTextDisabled};
|
|
1664
1667
|
font-style: normal;
|
|
1665
1668
|
font-weight: 400;
|
|
1666
1669
|
letter-spacing: 0.24px;
|
|
1667
|
-
`,
|
|
1670
|
+
`,Or=it.div`
|
|
1668
1671
|
display: flex;
|
|
1669
1672
|
flex-direction: column;
|
|
1670
1673
|
flex: 1;
|
|
@@ -1675,7 +1678,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1675
1678
|
align-items: flex-start;
|
|
1676
1679
|
margin-top: 16px;
|
|
1677
1680
|
`,ul=it.textarea`
|
|
1678
|
-
${e=>
|
|
1681
|
+
${e=>F(e)} {
|
|
1679
1682
|
margin-top: 16px;
|
|
1680
1683
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1681
1684
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
@@ -1686,7 +1689,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1686
1689
|
height: 100px;
|
|
1687
1690
|
}
|
|
1688
1691
|
`,fl=it.div`
|
|
1689
|
-
${e=>
|
|
1692
|
+
${e=>F(e)} {
|
|
1690
1693
|
position: absolute;
|
|
1691
1694
|
top: 16px;
|
|
1692
1695
|
right: 16px;
|
|
@@ -1696,8 +1699,8 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1696
1699
|
opacity: 0.8;
|
|
1697
1700
|
}
|
|
1698
1701
|
}
|
|
1699
|
-
`;var cc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,type:p="modal"})=>{let{getFlow:c,markFlowCompleted:a,markStepCompleted:g,getNumberOfStepsCompleted:d,isLoading:
|
|
1700
|
-
${e=>
|
|
1702
|
+
`;var cc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,type:p="modal"})=>{let{getFlow:c,markFlowCompleted:a,markStepCompleted:g,getNumberOfStepsCompleted:d,isLoading:y,targetingLogicShouldHideFlow:w,updateCustomVariables:C,getFlowSteps:T,getFlowStatus:f,getCurrentStepIndex:B}=Y(),{primaryCTAClickSideEffects:b}=ie(),{mergeAppearanceWithDefault:S}=Q(),[A,h]=R.useState(null),[m,E]=R.useState(""),{hasOpenModals:k,setKeepCompletedFlowOpenDuringSession:P,shouldKeepCompletedFlowOpenDuringSession:O}=we();if(r=S(r),pc(()=>{C(o)},[o,y]),y)return null;let N=c(e);if(!N||w(N)||f(e)===q||d(e)===1&&!O(e)||k())return null;let $=T(e)[d(e)];function D(){return R.createElement(R.Fragment,null,R.createElement(Or,null,R.createElement(Fe,{size:"large",appearance:r,title:$.title,subtitle:$.subtitle})),R.createElement(Nr,{className:l("npsNumberButtonContainer",r),appearance:r},Array.from(Array(10).keys()).map(te=>R.createElement(cl,{className:l("npsNumberButton",r),selected:A===te+1,key:te,onClick:async()=>{P(e),h(te+1),await g(e,$.id,{score:te+1})},appearance:r},te+1))),R.createElement(ml,{appearance:r},R.createElement(Ir,{appearance:r},"Not likely at all"),R.createElement(Ir,{appearance:r},"Extremely likely")))}function ee(){return R.createElement(R.Fragment,null,R.createElement(Or,null,R.createElement(Fe,{appearance:r,title:$.title??"Why did you choose this score?",size:"large"})),R.createElement(ul,{appearance:r,value:m,onChange:te=>{E(te.target.value)},placeHolder:"Add your optional fedback here..."}),R.createElement(Nr,{appearance:r,className:l("npsNumberButtonContainer",r)},R.createElement(Z,{size:"large",withMargin:!1,onClick:async()=>{await a(e),i&&i($,1,"primary")},appearance:r,title:$.secondaryButtonTitle||"Skip",secondary:!0}),R.createElement(Z,{size:"large",withMargin:!1,onClick:async()=>{await g(e,$.id,{feedbackText:m}),await a(e),i&&i($,1,"primary")},appearance:r,title:$.primaryButtonTitle||"Submit"})))}function U(){return d(e)>=2?null:R.createElement(R.Fragment,null,R.createElement(oe,{appearance:r}),R.createElement(dl,{appearance:r,className:xe(l("npsSurveyContainer",r),n),style:s,type:p},R.createElement(fl,{onClick:async()=>{await a(e),t&&t()},className:l("npsSurveyDismissButton",r)},R.createElement(Te,null)),d(e)==0&&D(),d(e)==1&&ee()))}return p==="inline"?U():R.createElement(dc,null,U())};import Se,{useEffect as fc}from"react";import Bt from"styled-components";var gl=Bt.div`
|
|
1703
|
+
${e=>F(e)} {
|
|
1701
1704
|
display: flex;
|
|
1702
1705
|
flex-direction: column;
|
|
1703
1706
|
width: 100%;
|
|
@@ -1722,7 +1725,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1722
1725
|
margin-top: 16px;
|
|
1723
1726
|
margin-bottom: 16px;
|
|
1724
1727
|
`,yl=Bt.div`
|
|
1725
|
-
${e=>
|
|
1728
|
+
${e=>F(e)} {
|
|
1726
1729
|
position: absolute;
|
|
1727
1730
|
top: -16px;
|
|
1728
1731
|
right: -16px;
|
|
@@ -1733,7 +1736,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1733
1736
|
}
|
|
1734
1737
|
}
|
|
1735
1738
|
`,Sl=Bt.h1`
|
|
1736
|
-
${e=>
|
|
1739
|
+
${e=>F(e)} {
|
|
1737
1740
|
font-style: normal;
|
|
1738
1741
|
justify-content: center;
|
|
1739
1742
|
text-align: center;
|
|
@@ -1747,7 +1750,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1747
1750
|
margin-bottom: 8px;
|
|
1748
1751
|
}
|
|
1749
1752
|
`,bl=Bt.h2`
|
|
1750
|
-
${e=>
|
|
1753
|
+
${e=>F(e)} {
|
|
1751
1754
|
font-style: normal;
|
|
1752
1755
|
justify-content: center;
|
|
1753
1756
|
text-align: center;
|
|
@@ -1763,5 +1766,5 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1763
1766
|
height: 100%;
|
|
1764
1767
|
min-height: 200px;
|
|
1765
1768
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1766
|
-
`;function Tl({stepData:e,appearance:t,classPrefix:o=""}){return e.videoUri?wl.createElement(
|
|
1769
|
+
`;function Tl({stepData:e,appearance:t,classPrefix:o=""}){return e.videoUri?wl.createElement(Ve,{appearance:t,videoUri:e.videoUri}):e.imageUri?wl.createElement(uc,{className:l(`${o}image`,t),appearance:t,src:e.imageUri}):null}var gc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p=!0,modalPosition:c})=>{let{getFlow:a,markFlowCompleted:g,markStepCompleted:d,isLoading:y,targetingLogicShouldHideFlow:w,updateCustomVariables:C,getFlowSteps:T,getFlowStatus:f,getCurrentStepIndex:B}=Y(),{primaryCTAClickSideEffects:b,secondaryCTAClickSideEffects:S}=ie(),{mergeAppearanceWithDefault:A}=Q(),{setOpenFlowState:h,getOpenFlowState:m,hasOpenModals:E}=we(),[k,P]=[m(e,!0),U=>h(e,U)];if(r=A(r),fc(()=>{C(o)},[o,y]),y)return null;let O=a(e);if(!O||w(O)||f(e)===q||E())return null;let I=T(e)[B(e)],$=()=>{P(!1),t&&t(),g(e)};function D(){return Se.createElement(Se.Fragment,null,Se.createElement(oe,{appearance:r}),Se.createElement(gl,{appearance:r,className:xe(l("announcementContainer",r),n),style:s},(p===!0||I.dismissible)&&c=="inline"&&Se.createElement(yl,{onClick:async()=>{await g(e),t&&t()},className:l("announcementDismissButton",r)},Se.createElement(Te,null)),Se.createElement(xl,null,Se.createElement(Sl,{appearance:r,className:l("announcementTitle",r),dangerouslySetInnerHTML:le(I.title)}),I.subtitle&&Se.createElement(bl,{appearance:r,className:l("announcementSubtitle",r),dangerouslySetInnerHTML:le(I.subtitle)})),(I.imageUri||I.videoUri)&&Se.createElement(Cl,{className:l("announcementMediaContainer",r)},Se.createElement(Tl,{appearance:r,stepData:I})),(I.primaryButtonTitle||I.secondaryButtonTitle)&&Se.createElement(hl,{className:l("announcementCTAContainer",r)},I.secondaryButtonTitle&&Se.createElement(Z,{classPrefix:"announcement",title:I.secondaryButtonTitle,appearance:r,withMargin:!1,size:"small",type:"full-width",onClick:async()=>{I.handleSecondaryButtonClick(),S(I),i&&i(I,B(e),"secondary")},secondary:!0}),I.primaryButtonTitle&&Se.createElement(Z,{classPrefix:"announcement",title:I.primaryButtonTitle,appearance:r,withMargin:!1,size:"small",type:"full-width",onClick:async()=>{I.handlePrimaryButtonClick(),b(I),!(i&&i(I,B(e),"primary")===!1)&&(await d(e,I.id),await g(e))}}))))}let ee={padding:"24px",maxWidth:"400px"};return c==="inline"?D():c!=="center"?Se.createElement(wo,{modalPosition:c,onClose:$,visible:k,dismissible:p,appearance:r},D()):Se.createElement(He,{appearance:r,onClose:$,visible:k,style:ee,dismissible:p},D())};import*as qo from"react";import Fl from"react";var kl=({as:e="span",children:t,variant:o="Body1",...i})=>Fl.createElement(Yi,{color:"neutral.foreground",fontFamily:"default",forwardedAs:e,variant:o,...i},t),xc=Object.fromEntries(Object.keys(Do).map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=i=>Fl.createElement(kl,{as:t,...i,variant:e},i.children);return o.displayName=`Text.${e}`,[e,o]})),Lr=Object.assign(kl,xc);var Pl=({as:e="button",className:t,size:o="md",title:i,variant:r="Primary",...n})=>{var s;return qo.createElement(qi,{className:`fr-button-${r.toLowerCase()}${t?` ${t}`:""}`,forwardedAs:e,variant:r,size:o,borderRadius:"md",...n},qo.createElement(Lr,{color:(s=ao[r])==null?void 0:s.color,fontWeight:"semibold"},i))},hc=Object.fromEntries(Object.keys(ao).map(e=>{let t=o=>qo.createElement(Pl,{...o,variant:e});return t.displayName=`Button.${e}`,[e,t]})),Cc=Object.assign(Pl,hc);export{lo as Box,Cc as Button,Qe as CheckBox,st as FormLabel,ir as FormTextField,gc as FrigadeAnnouncement,ac as FrigadeBanner,Pr as FrigadeChecklist,Je as FrigadeDefaultAppearance,sc as FrigadeEmbeddedTip,Ui as FrigadeForm,zd as FrigadeGuide,Dd as FrigadeHeroChecklist,cc as FrigadeNPSSurvey,Md as FrigadeProgressBadge,Gp as FrigadeProvider,ic as FrigadeSupportWidget,Rd as FrigadeTour,$t as ProgressRing,Lr as Text,hr as tokens,we as useFlowOpens,Xt as useFlowResponses,Y as useFlows,fr as useOrganization,Jt as useUser,Be as useUserFlowStates};
|
|
1767
1770
|
//# sourceMappingURL=index.mjs.map
|