@frigade/react 1.32.27 → 1.32.28
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 +2 -2
- package/lib/index.js +32 -32
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +31 -31
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import dt,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import{ThemeProvider as Sa}from"styled-components";import pt,{useContext as ha,useEffect as go,useState as zo}from"react";import{useCallback as st,useContext as js,useEffect as Gs}from"react";import Io,{useMemo as Ls}from"react";var ir="1.32.27 ";var Ce="https://api.frigade.com/v1/public/",ke="NOT_STARTED_STEP",Q="COMPLETED_FLOW",Qt="ABORTED_FLOW",nt="STARTED_FLOW",Ne="NOT_STARTED_FLOW",Ee="COMPLETED_STEP",Zt="STARTED_STEP";function Le(){let{publicApiKey:e,userId:t}=Io.useContext(G);return{config:Ls(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":ir,"X-Frigade-SDK-Platform":"React"}}),[e,t])}}function ht(){let{shouldGracefullyDegrade:e}=Io.useContext(G);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),Jt();let n;try{n=await fetch(t,o)}catch(r){return Jt(r)}return n?n.ok?n:Jt(n.statusText):Jt()}}function Jt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function xt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=Io.useContext(G);function o(){if(t){console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize");return}e||console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider")}return{verifySDKInitiated:o}}import{useContext as Ws,useState as nr}from"react";import{useContext as Ds,useEffect as $s,useState as Ms}from"react";import Us from"swr";import{useContext as Os}from"react";function be(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:n,completedFlowsToKeepOpenDuringSession:r}=Os(G);function i(c,f=!1){return e[c]??f}function s(c,f){t(y=>({...y,[c]:f}))}function p(c){t(f=>{let{[c]:y,...b}=f;return{...b}})}function d(c){r.includes(c)||n(f=>[...f,c])}function a(c){return r.includes(c)}function g(){return Object.values(e).some(c=>c)||o}return{getOpenFlowState:i,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:g,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:a}}var _s="unknown";function Pe(){let{config:e}=Le(),{publicApiKey:t,userId:o,flows:n,setShouldGracefullyDegrade:r}=Ds(G),{resetOpenFlowState:i}=be(),[s,p]=Ms(!1),d={data:n.map(k=>({flowId:k.id,flowState:Q,lastStepId:null,userId:o,foreignUserId:o,stepStates:{},shouldTrigger:!1}))},a=k=>fetch(k,e).then(m=>{if(m.ok)return m.json();throw new Error("Failed to fetch user flow states")}).catch(m=>(console.log(`Error fetching ${k}: ${m}. Will gracefully degrade and hide Frigade`),r(!0),d)),{data:g,isLoading:c,mutate:f,error:y}=Us(t&&n&&o?`${Ce}userFlowStates?foreignUserId=${encodeURIComponent(o)}`:null,a,{keepPreviousData:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),b=g==null?void 0:g.data;$s(()=>{!s&&!c&&b&&p(!0)},[b,s,c]);async function C(k){if(b){let m=b.find(h=>h.flowId===k);m&&m.flowState!==Q&&(m.flowState=Q),await f(Promise.resolve({...g,data:b}),{optimisticData:{...g,data:b},revalidate:!1,rollbackOnError:!1})}}async function u(k,m,h){if(b){let w=b.find(I=>I.flowId===k);w&&(w.stepStates[m]=h,w.flowState=nt),await f(Promise.resolve({...g,data:b}),{optimisticData:{...g,data:b},revalidate:!1,rollbackOnError:!1})}}async function v(k,m,h){if(b){let w=b.find(I=>I.flowId===k);w&&(w.lastStepId=m,w.stepStates[m]=h,w.flowState=nt),await f({...g,data:b},{optimisticData:{...g,data:b},revalidate:!1,rollbackOnError:!1})}}async function T(k){if(b){let m=b.find(h=>h.flowId===k);m&&m.flowState!==Ne&&(m.flowState=Ne,m.lastStepId=_s,Object.keys(m.stepStates).forEach(h=>{m.stepStates[h].actionType=ke,m.stepStates[h].createdAt=new Date().toISOString()}),await f({...g,data:b},{optimisticData:{...g,data:b},revalidate:!1,rollbackOnError:!1}),i(k))}}async function B(k,m){if(b){let h=b.find(w=>w.flowId===k);h&&h.stepStates[m]!==ke&&(h.stepStates[m]=ke),await f({...g,data:b},{optimisticData:{...g,data:b},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:b,isLoadingUserFlowStateData:!s,mutateUserFlowState:f,optimisticallyMarkFlowCompleted:C,optimisticallyMarkFlowNotStarted:T,optimisticallyMarkStepCompleted:u,optimisticallyMarkStepNotStarted:B,optimisticallyMarkStepStarted:v,error:y}}function Ot(){let{config:e}=Le(),{userFlowStatesData:t,mutateUserFlowState:o}=Pe(),{failedFlowResponses:n,setFailedFlowResponses:r,flowResponses:i,setFlowResponses:s}=Ws(G),[p,d]=nr(new Set),[a,g]=nr(new Set),c=ht();function f(C){let u=JSON.stringify(C);if(p.has(u))return null;p.add(u),d(p),a.add(C),g(a);let v=i==null?void 0:i.find(T=>T.flowSlug===C.flowSlug&&T.stepId===C.stepId&&T.actionType===C.actionType&&T.createdAt===C.createdAt);return c(`${Ce}flowResponses`,{...e,method:"POST",body:u}).then(T=>{T.status!==200&&T.status!==201?(console.log("Failed to send flow response for step "+C.stepId+". Will retry again later."),r([...n,C])):v||s(B=>[...B??[],C])})}async function y(C){C.foreignUserId&&(C.actionType===nt||C.actionType===Ne?await f(C):C.actionType===Q?await f(C):C.actionType===Zt?await f(C):C.actionType===Ee?await f(C):C.actionType===Qt?await f(C):C.actionType===ke&&await f(C))}function b(){let C=[];return t==null||t.forEach(u=>{if(u&&u.stepStates&&Object.keys(u.stepStates).length!==0)for(let v in u.stepStates){let T=u.stepStates[v];C.push({foreignUserId:u.foreignUserId,flowSlug:u.flowId,stepId:T.stepId,actionType:T.actionType,data:{},createdAt:new Date(T.createdAt),blocked:T.blocked,hidden:T.hidden})}}),[...C,...i]}return{addResponse:y,setFlowResponses:s,getFlowResponses:b}}import Vs from"swr";var zs=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,sr=e=>{let t=zs.exec(e);if(t===null)return null;let o=null;return t.forEach((n,r)=>{let i=Hs(n,"'","");i.startsWith("flow_")&&(o=i)}),o},Hs=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function K(){let{config:e}=Le(),{flows:t,setFlows:o,userId:n,publicApiKey:r,customVariables:i,setCustomVariables:s,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,setFlowResponses:a,setShouldGracefullyDegrade:g}=js(G),c={data:[]},{verifySDKInitiated:f}=xt(),{addResponse:y,getFlowResponses:b}=Ot(),C=x=>fetch(x,e).then(S=>S.ok?S.json():(console.log(`Error fetching ${x} (${S.status}): ${S.statusText}. .Will gracefully degrade and hide Frigade`),g(!0),c)).catch(S=>(console.log(`Error fetching ${x}: ${S}. Will gracefully degrade and hide Frigade`),g(!0),c)),{userFlowStatesData:u,isLoadingUserFlowStateData:v,optimisticallyMarkFlowCompleted:T,optimisticallyMarkFlowNotStarted:B,optimisticallyMarkStepCompleted:k,optimisticallyMarkStepNotStarted:m,optimisticallyMarkStepStarted:h}=Pe(),{data:w,error:I,isLoading:U}=Vs(r?`${Ce}flows`:null,C,{keepPreviousData:!0});Gs(()=>{if(I){console.error(I);return}w&&w.data&&(w.data=o(w.data))},[w,I]);function $(x){if(U)return null;let S=t.find(P=>P.slug===x);return!S&&t.length>0&&!v&&!U?(console.log(`Flow with slug ${x} not found`),null):(S==null?void 0:S.active)===!1?null:S}function W(x){var E;if(!$(x))return[];let S=$(x).data;return S?(S=A(S),(((E=JSON.parse(S))==null?void 0:E.data)??[]).map(J=>{let it=ze(J);return{handleSecondaryButtonClick:()=>{J.skippable===!0&&_(x,J.id,{skipped:!0})},...J,complete:N(x,J.id)===Ee||it>=1,blocked:q(x,J.id),hidden:We(x,J.id),handlePrimaryButtonClick:()=>{(!J.completionCriteria&&(J.autoMarkCompleted||J.autoMarkCompleted===void 0)||J.completionCriteria&&J.autoMarkCompleted===!0)&&_(x,J.id)},progress:it}}).filter(J=>J.hidden!==!0)):[]}function A(x){return x.replace(/\${(.*?)}/g,(S,P)=>i[P]!==void 0?String(i[P]):"")}function H(x){if(!$(x))return[];let S=$(x).data;return S?(S=A(S),JSON.parse(S)??{}):[]}function L(x,S){s(P=>({...P,[x]:S}))}function z(x){!v&&!U&&x&&JSON.stringify(i)!=JSON.stringify({...i,...x})&&Object.keys(x).forEach(S=>{L(S,x[S])})}let re=st(async(x,S,P)=>{f();let E={foreignUserId:n,flowSlug:x,stepId:S,actionType:Zt,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};R(E)&&(await h(x,S,E),y(E))},[n,u]),V=st(async(x,S,P)=>{f();let E={foreignUserId:n,flowSlug:x,stepId:S,actionType:ke,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};R(E)&&(await m(x,S),y(E))},[n,u]),_=st(async(x,S,P)=>{console.log("markStepCompleted",x,S,P),f();let E={foreignUserId:n,flowSlug:x,stepId:S,actionType:Ee,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};R(E)&&(await k(x,S,E),y(E))},[n,u]),ee=st(async(x,S)=>{f();let P={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:Ne,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};await B(x),R(P)&&y(P)},[n,u]),ie=st(async(x,S)=>{f();let P={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:nt,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};R(P)&&y(P)},[n,u]),te=st(async(x,S)=>{f();let P={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:Q,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};R(P)&&(await T(x),y(P))},[n,u]),M=st(async(x,S)=>{f();let P={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:Qt,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};R(P)&&(await T(x),y(P))},[n,u]);function R(x){var S;if(!u&&x.actionType===ke)return!1;if(u){let P=u.find(E=>E.flowId===x.flowSlug);if(x.actionType===ke&&(!(P!=null&&P.stepStates[x.stepId])||P.stepStates[x.stepId].actionType===ke)||P&&((S=P.stepStates[x.stepId])==null?void 0:S.actionType)===x.actionType)return!1}return!0}function N(x,S){let P=ye(x,S);return v?null:P?P.actionType:ke}function q(x,S){let P=ye(x,S);return P?P.blocked:!1}function We(x,S){let P=ye(x,S);return P?P.hidden:!1}function ye(x,S){if(v)return null;let P=u==null?void 0:u.find(E=>E.flowId===x);return!P||!P.stepStates[S]?null:P.stepStates[S]??null}function Fe(x){var P;if(v||!u)return null;if(He(x)===Ne)return W(x)[0]??null;let S=(P=u.find(E=>E.flowId===x))==null?void 0:P.lastStepId;return S?W(x).find(E=>E.id===S):null}function ue(x){let S=Fe(x);if(!S)return 0;let P=W(x).findIndex(E=>E.id===S.id)??0;return N(x,S.id)===Ee&&P<W(x).length-1?P+1:P}function ze(x){if(!x.completionCriteria)return;let S=sr(x.completionCriteria);if(S===null)return;let P=rt(S),E=j(S);return E===0?void 0:P/E}function He(x){let S=u==null?void 0:u.find(P=>P.flowId===x);return S?S.flowState:null}function rt(x){let S=W(x);return S.length===0?0:S.filter(E=>N(x,E.id)===Ee).length}function j(x){return W(x).length}function Be(x){return JSON.parse(t.find(S=>S.slug===x).data)}function Ae(x){if(v)return!0;if(x!=null&&x.targetingLogic&&u){let S=u.find(P=>P.flowId===x.slug);if(S)return S.shouldTrigger===!1}return!!(x!=null&&x.targetingLogic&&n&&n.startsWith("guest_"))}function Eo(x){return!Ae($(x))}return{getFlow:$,getFlowData:Be,isLoading:v||U,getStepStatus:N,getFlowSteps:W,getCurrentStepIndex:ue,markStepStarted:re,markStepCompleted:_,markFlowNotStarted:ee,markFlowStarted:ie,markFlowCompleted:te,markFlowAborted:M,markStepNotStarted:V,getFlowStatus:He,getNumberOfStepsCompleted:rt,getNumberOfSteps:j,targetingLogicShouldHideFlow:Ae,setCustomVariable:L,updateCustomVariables:z,customVariables:i,getStepOptionalProgress:ze,getFlowMetadata:H,isStepBlocked:q,isStepHidden:We,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,isFlowAvailableToUser:Eo}}import{useCallback as lr,useContext as Ks,useEffect as qs}from"react";var Ct="guest_";function Bo(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:n,shouldGracefullyDegrade:r}=Ks(G),{config:i}=Le(),{mutateUserFlowState:s}=Pe(),p=ht(),{verifySDKInitiated:d}=xt();qs(()=>{if(e&&!t){if(e.startsWith(Ct))return;let c=`frigade-user-registered-${e}`;localStorage.getItem(c)||(p(`${Ce}users`,{...i,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(c,"true"))}},[e,r,t]);let a=lr(async c=>{d();let f={foreignId:e,properties:c};await p(`${Ce}users`,{...i,method:"POST",body:JSON.stringify(f)}),n(y=>({...y,...c})),s()},[e,i,r,s]),g=lr(async(c,f)=>{d();let b={foreignId:e,events:[{event:c,properties:f}]};await p(`${Ce}users`,{...i,method:"POST",body:JSON.stringify(b)}),s()},[e,i,s]);return{userId:e,setUserId:o,addPropertiesToUser:a,trackEventForUser:g}}import{v4 as xa}from"uuid";import De,{useEffect as ma,useState as ua}from"react";import je,{useEffect as Rs}from"react";import eo from"styled-components";import Ys from"react";import Xs from"styled-components";var ar="fr-",Dt="cfr-";function l(e,t){let o=`${ar}${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+" "+Dt+e}return o}function F(e){if(!e.className||e.className.indexOf(Dt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(ar)?"":`:not(${o.map(n=>`.${n}`).join(", ")})`}function Ao(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function lt(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Ao(t)}: ${e.styleOverrides[t]};`).join(" "):""}function fe(...e){return e.filter(Boolean).join(" ")}function pr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Js=Xs.div`
|
|
2
|
+
import dt,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import{ThemeProvider as Sa}from"styled-components";import pt,{useContext as ha,useEffect as go,useState as zo}from"react";import{useCallback as st,useContext as js,useEffect as Gs}from"react";import Io,{useMemo as Ls}from"react";var ir="1.32.28 ";var Ce="https://api.frigade.com/v1/public/",ke="NOT_STARTED_STEP",Q="COMPLETED_FLOW",Qt="ABORTED_FLOW",nt="STARTED_FLOW",Ne="NOT_STARTED_FLOW",Ee="COMPLETED_STEP",Zt="STARTED_STEP";function Le(){let{publicApiKey:e,userId:t}=Io.useContext(G);return{config:Ls(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":ir,"X-Frigade-SDK-Platform":"React"}}),[e,t])}}function ht(){let{shouldGracefullyDegrade:e}=Io.useContext(G);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),Jt();let n;try{n=await fetch(t,o)}catch(r){return Jt(r)}return n?n.ok?n:Jt(n.statusText):Jt()}}function Jt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function xt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=Io.useContext(G);function o(){if(t){console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize");return}e||console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider")}return{verifySDKInitiated:o}}import{useContext as Ws,useState as nr}from"react";import{useContext as Ds,useEffect as $s,useState as Ms}from"react";import Us from"swr";import{useContext as Os}from"react";function be(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:n,completedFlowsToKeepOpenDuringSession:r}=Os(G);function i(c,m=!1){return e[c]??m}function s(c,m){t(b=>({...b,[c]:m}))}function p(c){t(m=>{let{[c]:b,...w}=m;return{...w}})}function d(c){r.includes(c)||n(m=>[...m,c])}function l(c){return r.includes(c)}function u(){return Object.values(e).some(c=>c)||o}return{getOpenFlowState:i,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:u,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:l}}var _s="unknown";function Pe(){let{config:e}=Le(),{publicApiKey:t,userId:o,flows:n,setShouldGracefullyDegrade:r}=Ds(G),{resetOpenFlowState:i}=be(),[s,p]=Ms(!1),d={data:n.map(P=>({flowId:P.id,flowState:Q,lastStepId:null,userId:o,foreignUserId:o,stepStates:{},shouldTrigger:!1}))},l=P=>fetch(P,e).then(g=>{if(g.ok)return g.json();throw new Error("Failed to fetch user flow states")}).catch(g=>(console.log(`Error fetching ${P}: ${g}. Will gracefully degrade and hide Frigade`),r(!0),d)),{data:u,isLoading:c,mutate:m,error:b}=Us(t&&n&&o?`${Ce}userFlowStates?foreignUserId=${encodeURIComponent(o)}`:null,l,{keepPreviousData:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),w=u==null?void 0:u.data;$s(()=>{!s&&!c&&w&&p(!0)},[w,s,c]);async function S(P){if(w){let g=w.find(h=>h.flowId===P);g&&g.flowState!==Q&&(g.flowState=Q),await m(Promise.resolve({...u,data:w}),{optimisticData:{...u,data:w},revalidate:!1,rollbackOnError:!1})}}async function f(P,g,h){if(w){let C=w.find(v=>v.flowId===P);C&&(C.stepStates[g]=h,C.flowState=nt),await m(Promise.resolve({...u,data:w}),{optimisticData:{...u,data:w},revalidate:!1,rollbackOnError:!1})}}async function k(P,g,h){if(w){let C=w.find(v=>v.flowId===P);C&&(C.lastStepId=g,C.stepStates[g]=h,C.flowState=nt),await m({...u,data:w},{optimisticData:{...u,data:w},revalidate:!1,rollbackOnError:!1})}}async function T(P){if(w){let g=w.find(h=>h.flowId===P);g&&g.flowState!==Ne&&(g.flowState=Ne,g.lastStepId=_s,Object.keys(g.stepStates).forEach(h=>{g.stepStates[h].actionType=ke,g.stepStates[h].createdAt=new Date().toISOString()}),await m({...u,data:w},{optimisticData:{...u,data:w},revalidate:!1,rollbackOnError:!1}),i(P))}}async function B(P,g){if(w){let h=w.find(C=>C.flowId===P);h&&h.stepStates[g]!==ke&&(h.stepStates[g]=ke),await m({...u,data:w},{optimisticData:{...u,data:w},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:w,isLoadingUserFlowStateData:!s,mutateUserFlowState:m,optimisticallyMarkFlowCompleted:S,optimisticallyMarkFlowNotStarted:T,optimisticallyMarkStepCompleted:f,optimisticallyMarkStepNotStarted:B,optimisticallyMarkStepStarted:k,error:b}}function Ot(){let{config:e}=Le(),{userFlowStatesData:t,mutateUserFlowState:o}=Pe(),{failedFlowResponses:n,setFailedFlowResponses:r,flowResponses:i,setFlowResponses:s}=Ws(G),[p,d]=nr(new Set),[l,u]=nr(new Set),c=ht();function m(S){let f=JSON.stringify(S);if(p.has(f))return null;p.add(f),d(p),l.add(S),u(l);let k=i==null?void 0:i.find(T=>T.flowSlug===S.flowSlug&&T.stepId===S.stepId&&T.actionType===S.actionType&&T.createdAt===S.createdAt);return c(`${Ce}flowResponses`,{...e,method:"POST",body:f}).then(T=>{T.status!==200&&T.status!==201?(console.log("Failed to send flow response for step "+S.stepId+". Will retry again later."),r([...n,S])):k||s(B=>[...B??[],S])})}async function b(S){S.foreignUserId&&(S.actionType===nt||S.actionType===Ne?await m(S):S.actionType===Q?await m(S):S.actionType===Zt?await m(S):S.actionType===Ee?await m(S):S.actionType===Qt?await m(S):S.actionType===ke&&await m(S))}function w(){let S=[];return t==null||t.forEach(f=>{if(f&&f.stepStates&&Object.keys(f.stepStates).length!==0)for(let k in f.stepStates){let T=f.stepStates[k];S.push({foreignUserId:f.foreignUserId,flowSlug:f.flowId,stepId:T.stepId,actionType:T.actionType,data:{},createdAt:new Date(T.createdAt),blocked:T.blocked,hidden:T.hidden})}}),[...S,...i]}return{addResponse:b,setFlowResponses:s,getFlowResponses:w}}import Vs from"swr";var zs=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,sr=e=>{let t=zs.exec(e);if(t===null)return null;let o=null;return t.forEach((n,r)=>{let i=Hs(n,"'","");i.startsWith("flow_")&&(o=i)}),o},Hs=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function K(){let{config:e}=Le(),{flows:t,setFlows:o,userId:n,publicApiKey:r,customVariables:i,setCustomVariables:s,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,setFlowResponses:l,setShouldGracefullyDegrade:u}=js(G),c={data:[]},{verifySDKInitiated:m}=xt(),{addResponse:b,getFlowResponses:w}=Ot(),S=x=>fetch(x,e).then(y=>y.ok?y.json():(console.log(`Error fetching ${x} (${y.status}): ${y.statusText}. .Will gracefully degrade and hide Frigade`),u(!0),c)).catch(y=>(console.log(`Error fetching ${x}: ${y}. Will gracefully degrade and hide Frigade`),u(!0),c)),{userFlowStatesData:f,isLoadingUserFlowStateData:k,optimisticallyMarkFlowCompleted:T,optimisticallyMarkFlowNotStarted:B,optimisticallyMarkStepCompleted:P,optimisticallyMarkStepNotStarted:g,optimisticallyMarkStepStarted:h}=Pe(),{data:C,error:v,isLoading:U}=Vs(r?`${Ce}flows`:null,S,{keepPreviousData:!0});Gs(()=>{if(v){console.error(v);return}C&&C.data&&(C.data=o(C.data))},[C,v]);function $(x){if(U)return null;let y=t.find(E=>E.slug===x);return!y&&t.length>0&&!k&&!U?(console.log(`Flow with slug ${x} not found`),null):(y==null?void 0:y.active)===!1?null:y}function W(x){var I;if(!$(x))return[];let y=$(x).data;return y?(y=A(y),(((I=JSON.parse(y))==null?void 0:I.data)??[]).map(J=>{let it=ze(J);return{handleSecondaryButtonClick:()=>{J.skippable===!0&&_(x,J.id,{skipped:!0})},...J,complete:N(x,J.id)===Ee||it>=1,blocked:q(x,J.id),hidden:We(x,J.id),handlePrimaryButtonClick:()=>{(!J.completionCriteria&&(J.autoMarkCompleted||J.autoMarkCompleted===void 0)||J.completionCriteria&&J.autoMarkCompleted===!0)&&_(x,J.id)},progress:it}}).filter(J=>J.hidden!==!0)):[]}function A(x){return x.replace(/\${(.*?)}/g,(y,E)=>i[E]!==void 0?String(i[E]):"")}function H(x){if(!$(x))return[];let y=$(x).data;return y?(y=A(y),JSON.parse(y)??{}):[]}function L(x,y){s(E=>({...E,[x]:y}))}function z(x){!k&&!U&&x&&JSON.stringify(i)!=JSON.stringify({...i,...x})&&Object.keys(x).forEach(y=>{L(y,x[y])})}let re=st(async(x,y,E)=>{m();let I={foreignUserId:n,flowSlug:x,stepId:y,actionType:Zt,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};R(I)&&(await h(x,y,I),b(I))},[n,f]),V=st(async(x,y,E)=>{m();let I={foreignUserId:n,flowSlug:x,stepId:y,actionType:ke,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};R(I)&&(await g(x,y),b(I))},[n,f]),_=st(async(x,y,E)=>{console.log("markStepCompleted",x,y,E),m();let I={foreignUserId:n,flowSlug:x,stepId:y,actionType:Ee,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};R(I)&&(await P(x,y,I),b(I))},[n,f]),ee=st(async(x,y)=>{m();let E={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:Ne,data:y??{},createdAt:new Date,blocked:!1,hidden:!1};await B(x),R(E)&&b(E)},[n,f]),ie=st(async(x,y)=>{m();let E={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:nt,data:y??{},createdAt:new Date,blocked:!1,hidden:!1};R(E)&&b(E)},[n,f]),te=st(async(x,y)=>{m();let E={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:Q,data:y??{},createdAt:new Date,blocked:!1,hidden:!1};R(E)&&(await T(x),b(E))},[n,f]),M=st(async(x,y)=>{m();let E={foreignUserId:n,flowSlug:x,stepId:"unknown",actionType:Qt,data:y??{},createdAt:new Date,blocked:!1,hidden:!1};R(E)&&(await T(x),b(E))},[n,f]);function R(x){var y;if(!f&&x.actionType===ke)return!1;if(f){let E=f.find(I=>I.flowId===x.flowSlug);if(x.actionType===ke&&(!(E!=null&&E.stepStates[x.stepId])||E.stepStates[x.stepId].actionType===ke)||E&&((y=E.stepStates[x.stepId])==null?void 0:y.actionType)===x.actionType)return!1}return!0}function N(x,y){let E=ye(x,y);return k?null:E?E.actionType:ke}function q(x,y){let E=ye(x,y);return E?E.blocked:!1}function We(x,y){let E=ye(x,y);return E?E.hidden:!1}function ye(x,y){if(k)return null;let E=f==null?void 0:f.find(I=>I.flowId===x);return!E||!E.stepStates[y]?null:E.stepStates[y]??null}function Fe(x){var E;if(k||!f)return null;if(He(x)===Ne)return W(x)[0]??null;let y=(E=f.find(I=>I.flowId===x))==null?void 0:E.lastStepId;return y?W(x).find(I=>I.id===y):null}function ue(x){let y=Fe(x);if(!y)return 0;let E=W(x).findIndex(I=>I.id===y.id)??0;return N(x,y.id)===Ee&&E<W(x).length-1?E+1:E}function ze(x){if(!x.completionCriteria)return;let y=sr(x.completionCriteria);if(y===null)return;let E=rt(y),I=j(y);return I===0?void 0:E/I}function He(x){let y=f==null?void 0:f.find(E=>E.flowId===x);return y?y.flowState:null}function rt(x){let y=W(x);return y.length===0?0:y.filter(I=>N(x,I.id)===Ee).length}function j(x){return W(x).length}function Be(x){return JSON.parse(t.find(y=>y.slug===x).data)}function Ae(x){if(k)return!0;if(x!=null&&x.targetingLogic&&f){let y=f.find(E=>E.flowId===x.slug);if(y)return y.shouldTrigger===!1}return!!(x!=null&&x.targetingLogic&&n&&n.startsWith("guest_"))}function Eo(x){return!Ae($(x))}return{getFlow:$,getFlowData:Be,isLoading:k||U,getStepStatus:N,getFlowSteps:W,getCurrentStepIndex:ue,markStepStarted:re,markStepCompleted:_,markFlowNotStarted:ee,markFlowStarted:ie,markFlowCompleted:te,markFlowAborted:M,markStepNotStarted:V,getFlowStatus:He,getNumberOfStepsCompleted:rt,getNumberOfSteps:j,targetingLogicShouldHideFlow:Ae,setCustomVariable:L,updateCustomVariables:z,customVariables:i,getStepOptionalProgress:ze,getFlowMetadata:H,isStepBlocked:q,isStepHidden:We,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,isFlowAvailableToUser:Eo}}import{useCallback as lr,useContext as Ks,useEffect as qs}from"react";var Ct="guest_";function Bo(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:n,shouldGracefullyDegrade:r}=Ks(G),{config:i}=Le(),{mutateUserFlowState:s}=Pe(),p=ht(),{verifySDKInitiated:d}=xt();qs(()=>{if(e&&!t){if(e.startsWith(Ct))return;let c=`frigade-user-registered-${e}`;localStorage.getItem(c)||(p(`${Ce}users`,{...i,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(c,"true"))}},[e,r,t]);let l=lr(async c=>{d();let m={foreignId:e,properties:c};await p(`${Ce}users`,{...i,method:"POST",body:JSON.stringify(m)}),n(b=>({...b,...c})),s()},[e,i,r,s]),u=lr(async(c,m)=>{d();let w={foreignId:e,events:[{event:c,properties:m}]};await p(`${Ce}users`,{...i,method:"POST",body:JSON.stringify(w)}),s()},[e,i,s]);return{userId:e,setUserId:o,addPropertiesToUser:l,trackEventForUser:u}}import{v4 as xa}from"uuid";import De,{useEffect as ma,useState as ua}from"react";import je,{useEffect as Rs}from"react";import eo from"styled-components";import Ys from"react";import Xs from"styled-components";var ar="fr-",Dt="cfr-";function a(e,t){let o=`${ar}${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+" "+Dt+e}return o}function F(e){if(!e.className||e.className.indexOf(Dt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(ar)?"":`:not(${o.map(n=>`.${n}`).join(", ")})`}function Ao(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function lt(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Ao(t)}: ${e.styleOverrides[t]};`).join(" "):""}function fe(...e){return e.filter(Boolean).join(" ")}function pr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Js=Xs.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -23,7 +23,7 @@ import dt,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
23
23
|
opacity: 1;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
`,dr=({onClose:e,appearance:t})=>Ys.createElement(Js,{className:
|
|
26
|
+
`,dr=({onClose:e,appearance:t})=>Ys.createElement(Js,{className:a("modalBackground",t),onClick:()=>e()});import Rt from"react";import Qs from"styled-components";var Zs=Qs.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
@@ -91,7 +91,7 @@ import dt,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
91
91
|
::-webkit-scrollbar {
|
|
92
92
|
display: none;
|
|
93
93
|
}
|
|
94
|
-
`,Je=({onClose:e,visible:t,headerContent:o=null,style:n=null,children:r,appearance:i,dismissible:s=!0})=>(Rs(()=>{let p=d=>{d.key==="Escape"&&e()};return document.addEventListener("keydown",p),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",p)}},[e,t]),t?je.createElement(el,null,je.createElement(dr,{appearance:i,onClose:()=>{s&&e()}}),je.createElement(tl,{appearance:i,className:
|
|
94
|
+
`,Je=({onClose:e,visible:t,headerContent:o=null,style:n=null,children:r,appearance:i,dismissible:s=!0})=>(Rs(()=>{let p=d=>{d.key==="Escape"&&e()};return document.addEventListener("keydown",p),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",p)}},[e,t]),t?je.createElement(el,null,je.createElement(dr,{appearance:i,onClose:()=>{s&&e()}}),je.createElement(tl,{appearance:i,className:a("modalContainer",i),styleOverrides:n},s&&je.createElement(rl,{className:a("modalClose",i),onClick:()=>e(),appearance:i},je.createElement(we,null)),o&&je.createElement(ol,null,o),je.createElement(il,null,r))):je.createElement(je.Fragment,null));import Qe,{useEffect as nl}from"react";import to from"styled-components";import{Portal as sl}from"react-portal";var ll=to.div`
|
|
95
95
|
${e=>F(e)} {
|
|
96
96
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
97
97
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -128,7 +128,7 @@ import dt,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
128
128
|
::-webkit-scrollbar {
|
|
129
129
|
display: none;
|
|
130
130
|
}
|
|
131
|
-
`,cr=({onClose:e,visible:t,headerContent:o=null,children:n,appearance:r})=>(nl(()=>{let i=s=>{s.key==="Escape"&&e()};return document.addEventListener("keydown",i),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",i)}},[e,t]),t?Qe.createElement(sl,null,Qe.createElement(ll,{appearance:r,className:
|
|
131
|
+
`,cr=({onClose:e,visible:t,headerContent:o=null,children:n,appearance:r})=>(nl(()=>{let i=s=>{s.key==="Escape"&&e()};return document.addEventListener("keydown",i),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",i)}},[e,t]),t?Qe.createElement(sl,null,Qe.createElement(ll,{appearance:r,className:a("cornerModalContainer",r)},Qe.createElement(pl,{className:a("cornerModalClose",r),onClick:()=>e()},Qe.createElement(we,null)),o&&Qe.createElement(al,null,o),Qe.createElement(dl,null,n))):Qe.createElement(Qe.Fragment,null));import{useContext as cl}from"react";function Y(){let{defaultAppearance:e}=cl(G);function t(o){let n=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign(n.styleOverrides??{},o.styleOverrides??{}),theme:Object.assign(n.theme,o.theme??{})}:n}return{mergeAppearanceWithDefault:t}}import ao,{useEffect as wl,useState as vr}from"react";import Er from"styled-components";import io,{useEffect as ml,useState as hr}from"react";import Lo from"styled-components";import oo from"styled-components";var mr=oo.label`
|
|
132
132
|
${e=>F(e)} {
|
|
133
133
|
font-size: 14px;
|
|
134
134
|
line-height: 20px;
|
|
@@ -156,7 +156,7 @@ import dt,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
156
156
|
align-items: flex-start;
|
|
157
157
|
justify-content: left;
|
|
158
158
|
margin-bottom: 10px;
|
|
159
|
-
`;import No from"react";function Ze({title:e,required:t,appearance:o}){return No.createElement(ro,null,t?No.createElement(fr,null,"*"):null,No.createElement(mr,{className:
|
|
159
|
+
`;import No from"react";function Ze({title:e,required:t,appearance:o}){return No.createElement(ro,null,t?No.createElement(fr,null,"*"):null,No.createElement(mr,{className:a("formLabel",o)},e))}import gr from"react";function St({title:e,appearance:t}){return e?gr.createElement(ro,null,gr.createElement(ur,{className:a("formSubLabel",t)},e)):null}var ul=Lo.div`
|
|
160
160
|
display: flex;
|
|
161
161
|
flex-direction: column;
|
|
162
162
|
width: 100%;
|
|
@@ -192,7 +192,7 @@ import dt,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
192
192
|
min-height: 70px;
|
|
193
193
|
box-sizing: border-box;
|
|
194
194
|
margin-bottom: 10px;
|
|
195
|
-
`;function xr({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:n,inputData:r}){let i=e,[s,p]=hr((r==null?void 0:r.text)||""),[d,
|
|
195
|
+
`;function xr({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:n,inputData:r}){let i=e,[s,p]=hr((r==null?void 0:r.text)||""),[d,l]=hr(!1),u=Oo;ml(()=>{s===""&&!d&&(l(!0),c(""))},[]);function c(b){if(p(b),i.required===!0&&b.trim()===""){n([{id:i.id,message:`${i.title} is required`}]);return}n([]),o({text:b})}i.multiline&&(u=fl);function m(){var b;switch((b=i==null?void 0:i.validation)==null?void 0:b.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return io.createElement(ul,null,io.createElement(Ze,{title:i.title,required:i.required,appearance:t.appearance}),io.createElement(u,{className:a("inputComponent",t.appearance),value:s,onChange:b=>{c(b.target.value)},appearance:t.appearance,placeholder:i.placeholder,type:m()}),io.createElement(St,{title:i.subtitle,appearance:t.appearance}))}import Oe,{useEffect as Cr,useState as Sr}from"react";import yr from"styled-components";var gl=yr.div`
|
|
196
196
|
display: flex;
|
|
197
197
|
flex-direction: column;
|
|
198
198
|
width: 100%;
|
|
@@ -222,7 +222,7 @@ import dt,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
222
222
|
background-repeat: no-repeat;
|
|
223
223
|
background-size: 1.5em 1.5em;
|
|
224
224
|
-webkit-print-color-adjust: exact;
|
|
225
|
-
`,no="null";function br({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n,setFormValidationErrors:r}){var
|
|
225
|
+
`,no="null";function br({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n,setFormValidationErrors:r}){var u,c,m,b,w,S;let i=e,[s,p]=Sr(((u=n==null?void 0:n.choice)==null?void 0:u[0])||""),[d,l]=Sr(!1);return Cr(()=>{var f,k,T,B;if(s===""&&!d){if(l(!0),i.requireSelection){p(no);return}if(i.defaultValue&&((f=i.props.options)!=null&&f.find(P=>P.id===i.defaultValue))){let P=(k=i.props.options)==null?void 0:k.find(g=>g.id===i.defaultValue);p(P.id),o({choice:[P.id]})}else p(((T=i.props.options)==null?void 0:T[0].id)||""),o({choice:[((B=i.props.options)==null?void 0:B[0].id)||""]})}},[]),Cr(()=>{i.requireSelection&&s===no?r([{message:"Please select an option",id:i.id}]):r([])},[s]),Oe.createElement(gl,null,Oe.createElement(Ze,{title:i.title,required:!1,appearance:t.appearance}),Oe.createElement(hl,{value:s,onChange:f=>{p(f.target.value),o({choice:[f.target.value]})},placeholder:i.placeholder,appearance:t.appearance,className:a("multipleChoiceSelect",t.appearance)},i.requireSelection&&Oe.createElement("option",{key:no,value:no},"Select an option"),(c=i.props.options)==null?void 0:c.map(f=>Oe.createElement("option",{key:f.id,value:f.id},f.title))),((b=(m=i.props.options)==null?void 0:m.find(f=>f.id===s))==null?void 0:b.isOpenEnded)&&Oe.createElement(Oe.Fragment,null,Oe.createElement(Ze,{title:((S=(w=i.props.options)==null?void 0:w.find(f=>f.id===s))==null?void 0:S.openEndedLabel)??"Please specify",required:!1,appearance:t.appearance}),Oe.createElement(Oo,{type:"text",placeholder:"Enter your answer here",onChange:f=>{o({choice:[f.target.value]})},appearance:t.appearance})),Oe.createElement(St,{title:i.subtitle,appearance:t.appearance}))}import so,{useEffect as wr,useState as Tr}from"react";import Fr from"styled-components";var xl=Fr.div`
|
|
226
226
|
display: flex;
|
|
227
227
|
flex-direction: column;
|
|
228
228
|
width: 100%;
|
|
@@ -250,7 +250,7 @@ import dt,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
250
250
|
height: 60px;
|
|
251
251
|
padding: 0 18px;
|
|
252
252
|
margin-bottom: 10px;
|
|
253
|
-
`;function kr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n}){var
|
|
253
|
+
`;function kr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n}){var l;let r=e,[i,s]=Tr(n.choice||[]),[p,d]=Tr(!1);return wr(()=>{i.length==0&&!p&&(d(!0),o({choice:[]}))},[]),wr(()=>{o({choice:i})},[i]),so.createElement(xl,null,so.createElement(Ze,{title:r.title,required:r.required,appearance:t.appearance}),(l=r.props.options)==null?void 0:l.map(u=>so.createElement(Cl,{appearance:t.appearance,key:u.id,value:u.id,"data-selected":i.includes(u.id),onClick:()=>{if(i.includes(u.id)){s(i.filter(c=>c!==u.id));return}i.length<r.props.maxChoices?s([...i,u.id]):i.length==1&&r.props.maxChoices==1&&s([u.id])}},u.title)),so.createElement(St,{title:r.subtitle,appearance:t.appearance}))}import lo from"react";import Pr from"styled-components";import Sl from"dompurify";function pe(e){return{__html:Sl.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var yl=Pr.h1`
|
|
254
254
|
${e=>F(e)} {
|
|
255
255
|
font-style: normal;
|
|
256
256
|
font-weight: 600;
|
|
@@ -269,7 +269,7 @@ import dt,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
269
269
|
line-height: 20px;
|
|
270
270
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
271
271
|
}
|
|
272
|
-
`;function ge({appearance:e,title:t,subtitle:o,size:n="medium"}){return lo.createElement(lo.Fragment,null,lo.createElement(yl,{appearance:e,className:
|
|
272
|
+
`;function ge({appearance:e,title:t,subtitle:o,size:n="medium"}){return lo.createElement(lo.Fragment,null,lo.createElement(yl,{appearance:e,className:a(`${n}Title`,e),dangerouslySetInnerHTML:pe(t),size:n}),o&&lo.createElement(bl,{appearance:e,className:a(`${n}Subtitle`,e),dangerouslySetInnerHTML:pe(o),size:n}))}var Tl=Er.div`
|
|
273
273
|
display: flex;
|
|
274
274
|
flex-direction: column;
|
|
275
275
|
justify-content: flex-end;
|
|
@@ -278,7 +278,7 @@ import dt,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
278
278
|
`,Fl=Er.div`
|
|
279
279
|
padding-left: 1px;
|
|
280
280
|
padding-right: 1px;
|
|
281
|
-
`,kl={text:xr,multipleChoice:br,multipleChoiceList:kr};function Ir({stepData:e,canContinue:t,setCanContinue:o,onSaveData:n,appearance:r,customFormElements:i}){var
|
|
281
|
+
`,kl={text:xr,multipleChoice:br,multipleChoiceList:kr};function Ir({stepData:e,canContinue:t,setCanContinue:o,onSaveData:n,appearance:r,customFormElements:i}){var S;let s=e.props,[p,d]=vr(b()||{}),[l,u]=vr([]),c={...kl,...i};wl(()=>{o(l.length===0)},[l,o]);function m(f,k){let T={...p,[f.id]:k};d(T),n(T),window&&window.localStorage&&window.localStorage.setItem(w(),JSON.stringify(T))}function b(){if(window&&window.localStorage){let f=window.localStorage.getItem(w());if(f)return JSON.parse(f)}return{}}function w(){return`frigade-multiInputStepTypeData-${e.id}`}return ao.createElement(Fl,{className:a("multiInput",r)},ao.createElement(ge,{appearance:r,title:e.title,subtitle:e.subtitle}),ao.createElement(Tl,{className:a("multiInputContainer",r)},(S=s.data)==null?void 0:S.map(f=>c[f.type]?ao.createElement("span",{key:f.id},c[f.type]({formInput:f,customFormTypeProps:{stepData:e,canContinue:t,setCanContinue:o,onSaveData:n,appearance:r},onSaveInputData:k=>{m(f,k)},inputData:p[f.id],setFormValidationErrors:k=>{u(T=>k.length===0?T.filter(B=>B.id!==f.id):[...T,...k])}})):null)))}import yt from"styled-components";var Br=yt.div`
|
|
282
282
|
align-items: center;
|
|
283
283
|
display: flex;
|
|
284
284
|
justify-content: space-between;
|
|
@@ -354,7 +354,7 @@ import dt,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
354
354
|
margin-right: 8px;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
`,Z=({onClick:e,title:t,style:o,disabled:n,type:r="inline",size:i="medium",secondary:s=!1,appearance:p,withMargin:d=!0,classPrefix:
|
|
357
|
+
`,Z=({onClick:e,title:t,style:o,disabled:n,type:r="inline",size:i="medium",secondary:s=!1,appearance:p,withMargin:d=!0,classPrefix:l=""})=>{function u(){let c=s?"buttonSecondary":"button";return l===""?c:`${l}${pr(c)}`}return Pl.createElement(vl,{secondary:s,appearance:p,disabled:n,onClick:e,style:o,type:r,withMargin:d,size:i,className:a(u(),p)},t)};var Mr=({step:e,canContinue:t,appearance:o,onPrimaryClick:n,onSecondaryClick:r,formType:i,selectedStep:s,steps:p,onBack:d,allowBackNavigation:l})=>{let u=i==="inline"?"inline":"full-width";return $t.createElement(Br,{className:a("formCTAContainer",o)},p.length>1&&s!=0&&l&&$t.createElement(Z,{title:"\u2190",onClick:d,secondary:!0,withMargin:!1,type:u,appearance:o}),$t.createElement(Ar,{className:a("ctaWrapper",o)},e.secondaryButtonTitle?$t.createElement(Z,{title:e.secondaryButtonTitle,onClick:r,secondary:!0,withMargin:!1,type:u,appearance:o}):null," ",e.primaryButtonTitle?$t.createElement(Z,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:n,type:u,appearance:o}):null))};import Do from"react";import El from"styled-components";var Il=El.div`
|
|
358
358
|
text-align: center;
|
|
359
359
|
`,Ur=({stepCount:e=0,currentStep:t=0,className:o,appearance:n})=>{let{theme:r}=Y().mergeAppearanceWithDefault(n);return Do.createElement(Il,{className:o},Do.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((i,s)=>Do.createElement("rect",{key:s,x:16*s,y:0,width:8,height:8,rx:4,fill:t===s?r.colorPrimary:"#E6E6E6"}))))};import at from"react";import bt from"styled-components";import{useContext as Bl}from"react";function oe(){let e=Bl(G);function t(r){n(r.primaryButtonUri,r.primaryButtonUriTarget)}function o(r){n(r.secondaryButtonUri,r.secondaryButtonUriTarget)}function n(r,i){if(!r)return;let s=r.startsWith("http")?"_blank":"_self";i&&i!=="_blank"&&(s="_self"),e.navigate(r,s)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:n}}var Al=bt.div`
|
|
360
360
|
display: flex;
|
|
@@ -465,9 +465,9 @@ import dt,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
465
465
|
max-height: 250px;
|
|
466
466
|
margin-bottom: 24px;
|
|
467
467
|
}
|
|
468
|
-
`;function Wr({stepData:e,appearance:t,setCanContinue:o}){return jl(()=>{o(!0)},[]),Tt.createElement(Gl,{className:
|
|
468
|
+
`;function Wr({stepData:e,appearance:t,setCanContinue:o}){return jl(()=>{o(!0)},[]),Tt.createElement(Gl,{className:a("callToActionContainer",t)},Tt.createElement(Kl,{className:a("callToActionTextContainer",t)},Tt.createElement(ge,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&Tt.createElement(Vl,{className:a("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&Tt.createElement(ql,{appearance:t,className:a("callToActionVideo",t)},Tt.createElement(wt,{appearance:t,videoUri:e.videoUri})))}import Ge,{useEffect as Mo,useState as Uo}from"react";import Wt from"react";import Ut from"react";import{motion as Yl}from"framer-motion";var zr=({color:e,percentage:t,size:o})=>{let n=o*.5-2,r=2*Math.PI*n,i=(1-t)*r,s={duration:.3,delay:0,ease:"easeIn"},p={hidden:{strokeDashoffset:r,transition:s},show:{strokeDashoffset:i,transition:s}};return Ut.createElement(Yl.circle,{r:n,cx:o*.5,cy:o*.5,fill:"transparent",stroke:i!==r?e:"",strokeWidth:"3px",strokeDasharray:r,strokeDashoffset:t?i:0,variants:p,transition:s,initial:"hidden",animate:"show"})},Xl=({fillColor:e,size:t,percentage:o,children:n,bgColor:r="#D9D9D9"})=>Ut.createElement("svg",{width:t,height:t,overflow:"visible"},Ut.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},Ut.createElement(zr,{color:r,size:t}),Ut.createElement(zr,{color:e,percentage:o,size:t})),n),_t=Xl;import Jl from"styled-components";var Ql=({color:e="#FFFFFF"})=>Wt.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Wt.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),Zl={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},Rl={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},ea={border:"1px solid #000000",color:"#FFFFFF"},ta={border:"1px solid #E6E6E6"},oa={color:"#FFFFFF"},ra={border:"3px solid #D9D9D9"},ia=e=>e==="square"?Zl:Rl,na=(e,t)=>e==="square"?t?ea:ta:t?oa:ra,sa=Jl.div`
|
|
469
469
|
${e=>lt(e)}
|
|
470
|
-
`,Ft=({value:e,type:t="square",primaryColor:o="#000000",progress:n,appearance:r})=>{let i=ia(t),s=na(t,e);return e===!0?i={...i,...s,backgroundColor:o,borderColor:t==="square"?o:"none"}:i={...i,...s},e!==!0&&t==="round"&&n!==void 0&&n!==1?Wt.createElement(_t,{fillColor:o,percentage:n,size:22}):Wt.createElement(sa,{styleOverrides:i,role:"checkbox",className:fe(
|
|
470
|
+
`,Ft=({value:e,type:t="square",primaryColor:o="#000000",progress:n,appearance:r})=>{let i=ia(t),s=na(t,e);return e===!0?i={...i,...s,backgroundColor:o,borderColor:t==="square"?o:"none"}:i={...i,...s},e!==!0&&t==="round"&&n!==void 0&&n!==1?Wt.createElement(_t,{fillColor:o,percentage:n,size:22}):Wt.createElement(sa,{styleOverrides:i,role:"checkbox",className:fe(a("checkIconContainer",r),a(e?"checkIconContainerChecked":"checkIconContainerUnchecked",r),e?"checkIconContainerChecked":"checkIconContainerUnchecked")},e&&Wt.createElement(Ql,{color:"#FFFFFF"}))};import Re from"styled-components";var Hr=Re.div`
|
|
471
471
|
width: auto;
|
|
472
472
|
display: flex;
|
|
473
473
|
flex-direction: column;
|
|
@@ -520,8 +520,8 @@ import dt,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
520
520
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
521
521
|
display: flex;
|
|
522
522
|
align-self: center;
|
|
523
|
-
`;var Jr=({stepData:e,setCanContinue:t,onSaveData:o,appearance:n})=>{let r=e.props,[i,s]=Uo([]),[p,d]=Uo(!1),[
|
|
524
|
-
${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map(([s,p])=>`${Ao(s)}: ${p};`).join(" ")} }`).join(" ")}`;return zt.createElement(o,{inlineStyles:t})}var Qr=({flowId:e,customStepTypes:t={},type:o="inline",visible:n,setVisible:r,customVariables:i,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:
|
|
523
|
+
`;var Jr=({stepData:e,setCanContinue:t,onSaveData:o,appearance:n})=>{let r=e.props,[i,s]=Uo([]),[p,d]=Uo(!1),[l,u]=Uo(e.id);return Mo(()=>{i.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),Mo(()=>{l!==e.id&&(u(e.id),s([]))},[e]),Mo(()=>{o({choice:i}),i.length>=r.minChoices?t(!0):t(!1)},[i]),Ge.createElement(Hr,{className:a("selectListContainer",n)},Ge.createElement(jr,null,Ge.createElement(Gr,{className:a("selectListTitle",n)},e.title),Ge.createElement(Vr,{appearance:n,className:a("selectListSubtitle",n)},e.subtitle)),r.options.map((c,m)=>{let b=i.includes(c.id);return Ge.createElement(Kr,{key:`select-item-${m}`,onClick:()=>{if(i.includes(c.id)){s(i.filter(w=>w!==c.id));return}i.length<r.maxChoices?s([...i,c.id]):i.length==1&&r.maxChoices==1&&s([c.id])},hideBottomBorder:m===r.options.length-1,className:a("selectListSelectItem",n)},Ge.createElement(qr,{className:a("selectListItemImage",n)},c.imageUri&&Ge.createElement(Yr,{src:c.imageUri,alt:`select-icon-${m}`}),Ge.createElement(Xr,{appearance:n,className:a("selectListSelectItemText",n)},c.title)),Ge.createElement(Ft,{appearance:n,value:b,primaryColor:n.theme.colorPrimary}))}))};import he,{useEffect as la,useState as _o}from"react";import{AnimatePresence as aa,motion as pa}from"framer-motion";var da=({children:e,id:t,shouldWrap:o=!1})=>he.createElement(he.Fragment,null,o?he.createElement(aa,{initial:!1},he.createElement(pa.div,{key:t,initial:{opacity:1,y:"100%"},animate:{opacity:1,y:0},exit:{opacity:0,y:"-100%"},transition:{duration:.5,ease:"easeInOut"},style:{width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:1,overflowY:"auto"}},e)):e),fo=({appearance:e,steps:t,selectedStep:o,customStepTypes:n,customVariables:r,onButtonClick:i,onStepCompletion:s,flowId:p,type:d,hideOnFlowCompletion:l,onComplete:u,setVisible:c,setShowModal:m,onDismiss:b,showPagination:w=!1,customFormElements:S,allowBackNavigation:f})=>{let T={...{linkCollection:_r,multiInput:Ir,callToAction:Wr,selectList:Jr},...n},{primaryCTAClickSideEffects:B,secondaryCTAClickSideEffects:P}=oe(),[g,h]=_o(!1),[C,v]=_o({}),[U,$]=_o(!1),W=t[o]??null,{markStepCompleted:A,markStepStarted:H,isLoading:L,updateCustomVariables:z,markFlowCompleted:re}=K();la(()=>{z(r)},[r,L]);function V(){return{data:C[t[o].id]??{},stepId:t[o].id,customVariables:r}}function _(M,R,N){let q=o+1<t.length?t[o+1]:null;i&&i(M,o,R,q),s&&s(M,N,q,C,V())}function ee(M,R){v(N=>{let q={};return q[M.id]=R,{...N,...q}})}function ie(M){return M.selectedStep.imageUri?he.createElement(Dr,{image:M.selectedStep.imageUri,appearance:e,className:a("formContainerSidebarImage",e)}):null}let te=he.createElement(Mr,{step:t[o],canContinue:g||!U,formType:d,selectedStep:o,appearance:e,onPrimaryClick:async()=>{$(!0);let M={...V()};await A(p,t[o].id,M),o+1<t.length&&await H(p,t[o+1].id),_(t[o],"primary",o),o+1>=t.length&&(u&&u(),b&&b(),l&&(c&&c(!1),m(!1)),await re(p)),B(t[o]),$(!1)},onSecondaryClick:()=>{_(t[o],"secondary",o),P(t[o])},onBack:async()=>{o-1>=0&&($(!0),await H(p,t[o-1].id),$(!1))},steps:t,allowBackNavigation:f});return he.createElement(he.Fragment,null,he.createElement(Nr,{className:a("formContainer",e)},he.createElement(Lr,null,he.createElement(da,{id:o,shouldWrap:d==="large-modal"},he.createElement(Or,{key:W.id,type:d,className:a("formContent",e)},t.map(M=>{let R=T[M.type];return W.id!==M.id?null:he.createElement(R,{key:M.id,stepData:M,canContinue:g,setCanContinue:h,onSaveData:N=>{ee(M,N)},appearance:e,customFormElements:S})}),w&&he.createElement(Ur,{className:a("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),te))),d=="large-modal"&&he.createElement(ie,{selectedStep:t[o]})))};import zt from"react";import{createGlobalStyle as ca}from"styled-components";function ne({appearance:e}){if(!e||!e.styleOverrides)return zt.createElement(zt.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([n,r])=>typeof r=="object");if(t.length===0)return zt.createElement(zt.Fragment,null);let o=ca`
|
|
524
|
+
${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map(([s,p])=>`${Ao(s)}: ${p};`).join(" ")} }`).join(" ")}`;return zt.createElement(o,{inlineStyles:t})}var Qr=({flowId:e,customStepTypes:t={},type:o="inline",visible:n,setVisible:r,customVariables:i,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:l=!0,onStepCompletion:u,onButtonClick:c,dismissible:m=!0,endFlowOnDismiss:b=!1,modalPosition:w="center",repeatable:S=!1,onDismiss:f,showPagination:k=!1,allowBackNavigation:T=!1})=>{let{getFlow:B,getFlowSteps:P,isLoading:g,targetingLogicShouldHideFlow:h,getFlowStatus:C,getCurrentStepIndex:v,markFlowCompleted:U,markFlowNotStarted:$}=K(),W=v(e),{mergeAppearanceWithDefault:A}=Y(),[H,L]=ua(!1),{setOpenFlowState:z,getOpenFlowState:re}=be();d=A(d);let[V,_]=n!==void 0&&r!==void 0?[n,r]:[re(e,!0),M=>z(e,M)];if(ma(()=>{!H&&!g&&(L(!0),C(e)===Q&&S&&$(e),L(!0))},[H,L,g]),g)return null;let ee=B(e);if(!ee||h(ee))return null;let ie=P(e);if(!ie||n!==void 0&&n===!1||C(e)===Q&&l)return null;let te=()=>{_(!1),f&&f(),b===!0&&U(e)};if(w=="center"&&o==="modal"||o==="large-modal"){let M={padding:"24px"};return o==="large-modal"?(M.width="85%",M.height="90%",M.maxHeight="800px",M.minHeight="500px",M.padding="0"):M.width="400px",De.createElement(Je,{appearance:d,onClose:te,visible:V,style:M,dismissible:m},De.createElement(ne,{appearance:d}),De.createElement(fo,{appearance:d,steps:ie,selectedStep:W,customStepTypes:t,customVariables:i,onButtonClick:c,onStepCompletion:u,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:r,setShowModal:_,onDismiss:f,showPagination:k,customFormElements:s,allowBackNavigation:T}))}return o==="modal"&&w!=="center"?De.createElement(cr,{appearance:d,onClose:te,visible:V},De.createElement(ne,{appearance:d}),De.createElement(fo,{appearance:d,steps:ie,selectedStep:W,customStepTypes:t,customVariables:i,onButtonClick:c,onStepCompletion:u,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:r,setShowModal:_,onDismiss:f,showPagination:k,customFormElements:s,allowBackNavigation:T})):De.createElement(De.Fragment,null,De.createElement(ne,{appearance:d}),De.createElement(fo,{appearance:d,steps:ie,selectedStep:W,customStepTypes:t,customVariables:i,onButtonClick:c,onStepCompletion:u,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:r,setShowModal:_,onDismiss:f,showPagination:k,customFormElements:s,allowBackNavigation:T}))},Zr=Qr;import{useCallback as Rr,useContext as fa,useEffect as ga}from"react";function Wo(){let{organizationId:e,userId:t,setOrganizationId:o}=fa(G),{mutateUserFlowState:n}=Pe(),{config:r}=Le(),i=ht(),{verifySDKInitiated:s}=xt();ga(()=>{if(t&&e){if(t.startsWith(Ct))return;let l=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(l)||(i(`${Ce}userGroups`,{...r,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(l,"true"))}},[t,e]);let p=Rr(async l=>{if(s(),!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let u={foreignUserId:t,foreignUserGroupId:e,properties:l};await i(`${Ce}userGroups`,{...r,method:"POST",body:JSON.stringify(u)}),n()},[e,t,r,n]),d=Rr(async(l,u)=>{if(s(),!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let m={foreignUserId:t,foreignUserGroupId:e,events:[{event:l,properties:u}]};await i(`${Ce}userGroups`,{...r,method:"POST",body:JSON.stringify(m)}),n()},[e,t,r,n]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:p,trackEventForOrganization:d}}var ei="xFrigade_guestUserId",ti="xFrigade_userId",oi=({})=>{let{setFlowResponses:e}=Ot(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:n}=Pe(),{userId:r,setUserId:i}=Bo(),[s,p]=zo(null),{getFlowStatus:d}=K(),{flows:l,userProperties:u,setIsNewGuestUser:c,flowResponses:m}=ha(G),[b,w]=zo([]),[S,f]=zo([]),{organizationId:k}=Wo();go(()=>{if(!o&&t)for(let g=0;g<t.length;g++){let h=t[g],C=l.find(v=>v.slug===(h==null?void 0:h.flowId));if(C&&h&&h.shouldTrigger===!0&&C.type=="FORM"&&C.triggerType==="AUTOMATIC"&&!S.includes(C.slug)){setTimeout(()=>{T(h.flowId)},500);break}}},[o,t]),go(()=>{m.length>0&&n()},[m]);function T(g){let h=l.find(C=>C.slug===g);h&&h.triggerType==="AUTOMATIC"&&!S.includes(h.slug)&&(f([...S,h.slug]),w([h]))}function B(){if(!r){let g=localStorage.getItem(ti);if(g){i(g);return}let h=localStorage.getItem(ei);if(h){i(h);return}c(!0);let C=Ct+xa();try{localStorage.setItem(ei,C)}catch(v){console.log("Failed to save guest user id locally: Local storage unavailable",v)}i(v=>v||C)}}go(()=>{try{if(l){let g=[];l.forEach(h=>{if(h.data){let C=h.data.match(/"imageUri":"(.*?)"/g);C&&C.forEach(v=>{let U=v.replace('"imageUri":"',"").replace('"',"");if(g.includes(U))return;let $=new Image;$.src=U,g.push(U)})}})}}catch{}},[l]),go(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(Ct))try{localStorage.setItem(ti,r)}catch(g){console.log("Failed to save user id locally: Local storage available",g)}r===null&&setTimeout(()=>{r===null&&B()},50)},[r,l,u]);function P(){return pt.createElement(pt.Fragment,null,b.map(g=>d(g.slug)!==Ne?null:pt.createElement("span",{key:g.slug},pt.createElement(Zr,{flowId:g.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return pt.createElement(pt.Fragment,null,pt.createElement(P,null))};var ho={theme:{colorPrimary:"#000000",colorText:"#000000",colorBackground:"#ffffff",colorBackgroundSecondary:"#d2d2d2",colorTextOnPrimaryBackground:"#ffffff",colorTextSecondary:"#505050",colorTextDisabled:"#999999",colorBorder:"#E5E5E5",borderRadius:20}};import{ErrorBoundary as ya}from"react-error-boundary";var G=Ca({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:ho,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{}}),ba=({publicApiKey:e,userId:t,organizationId:o,config:n,children:r})=>{var re,V;let[i,s]=ve(t||null),[p,d]=ve(o||null),[l,u]=ve([]),[c,m]=ve([]),[b,w]=ve([]),[S,f]=ve({}),[k,T]=ve({}),[B,P]=ve([]),[g,h]=ve({}),[C,v]=ve(!1),[U,$]=ve(!1),[W,A]=ve(!z(e)),H=(_,ee)=>{if(ee==="_blank"){window.open(_,"_blank");return}setTimeout(()=>{window.location.href=_},50)},L={theme:{...ho.theme,...((re=n==null?void 0:n.defaultAppearance)==null?void 0:re.theme)??{}},styleOverrides:{...ho.styleOverrides,...((V=n==null?void 0:n.defaultAppearance)==null?void 0:V.styleOverrides)??{}}};function z(_){return!!(_&&_.length>10&&_.substring(0,10)==="api_public")}return Ho(()=>{t&&s(t)},[t]),Ho(()=>{o&&d(o)},[o]),Ho(()=>{if(z(e))A(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),A(!0);return}},[e,A]),W?dt.createElement(G.Provider,{value:{publicApiKey:e,userId:i,setUserId:s,setFlows:u,flows:l,failedFlowResponses:c,setFailedFlowResponses:m,flowResponses:b,setFlowResponses:w,userProperties:S,setUserProperties:f,openFlowStates:k,setOpenFlowStates:T,completedFlowsToKeepOpenDuringSession:B,setCompletedFlowsToKeepOpenDuringSession:P,customVariables:g,setCustomVariables:h,isNewGuestUser:C,setIsNewGuestUser:v,hasActiveFullPageFlow:U,setHasActiveFullPageFlow:$,organizationId:p,setOrganizationId:d,navigate:n&&n.navigate?n.navigate:H,defaultAppearance:L,shouldGracefullyDegrade:W,setShouldGracefullyDegrade:A}},r):dt.createElement(ya,{fallback:dt.createElement(dt.Fragment,null,r)},dt.createElement(G.Provider,{value:{publicApiKey:e,userId:i,setUserId:s,setFlows:u,flows:l,failedFlowResponses:c,setFailedFlowResponses:m,flowResponses:b,setFlowResponses:w,userProperties:S,setUserProperties:f,openFlowStates:k,setOpenFlowStates:T,completedFlowsToKeepOpenDuringSession:B,setCompletedFlowsToKeepOpenDuringSession:P,customVariables:g,setCustomVariables:h,isNewGuestUser:C,setIsNewGuestUser:v,hasActiveFullPageFlow:U,setHasActiveFullPageFlow:$,organizationId:p,setOrganizationId:d,navigate:n&&n.navigate?n.navigate:H,defaultAppearance:L,shouldGracefullyDegrade:W,setShouldGracefullyDegrade:A}},dt.createElement(Sa,{theme:L.theme},r,dt.createElement(oi,null))))};import Cp from"react";import ae,{useEffect as Ln,useState as On}from"react";import Ie,{useState as ja}from"react";import mt from"styled-components";import yo from"react";import xo from"react";import ii from"styled-components";var ri=ii.span`
|
|
525
525
|
font-weight: 400;
|
|
526
526
|
font-size: 15px;
|
|
527
527
|
line-height: 20px;
|
|
@@ -538,7 +538,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
538
538
|
padding-bottom: 20px;
|
|
539
539
|
border-top: 1px solid ${e=>e.theme.colorBorder};
|
|
540
540
|
width: 100%;
|
|
541
|
-
`,Co=({label:e,value:t,labelStyle:o={},labelPosition:n="right",style:r,primaryColor:i="#000000",checkBoxType:s="square",appearance:p})=>xo.createElement(wa,{className:
|
|
541
|
+
`,Co=({label:e,value:t,labelStyle:o={},labelPosition:n="right",style:r,primaryColor:i="#000000",checkBoxType:s="square",appearance:p})=>xo.createElement(wa,{className:a("checklistStepsContainer",p),appearance:p,style:{...r}},n==="left"&&e&&xo.createElement(ri,{className:a("checklistStepLabel",p),style:o},e),xo.createElement(Ft,{appearance:p,value:t,type:s,primaryColor:i}),n==="right"&&e&&xo.createElement(ri,{className:a("checklistStepLabel",p),style:o},e));import{motion as Ta}from"framer-motion";import Ht from"styled-components";var ni=Ht.div`
|
|
542
542
|
font-weight: 700;
|
|
543
543
|
font-size: 18px;
|
|
544
544
|
line-height: 22px;
|
|
@@ -566,7 +566,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
566
566
|
`,ai=Ht.div`
|
|
567
567
|
flex-direction: row;
|
|
568
568
|
justify-content: flex-start;
|
|
569
|
-
`;var pi=({data:e,index:t,isSelected:o,primaryColor:n,style:r,onClick:i,appearance:s})=>{var p,d;return yo.createElement("div",{style:{position:"relative",paddingLeft:"20px"},onClick:()=>{i()}},o&&yo.createElement(So,{className:
|
|
569
|
+
`;var pi=({data:e,index:t,isSelected:o,primaryColor:n,style:r,onClick:i,appearance:s})=>{var p,d;return yo.createElement("div",{style:{position:"relative",paddingLeft:"20px"},onClick:()=>{i()}},o&&yo.createElement(So,{className:a("checklistStepItemSelectedIndicator",s),as:Ta.div,layoutId:"checklis-step-selected",style:{backgroundColor:((p=s==null?void 0:s.theme)==null?void 0:p.colorPrimary)??n}}),yo.createElement(ai,{className:a("checklistStepItem",s),key:`hero-checklist-step-${t}`,role:"listitem"},yo.createElement(Co,{value:e.complete,labelPosition:"left",label:e.stepName,style:r,primaryColor:((d=s==null?void 0:s.theme)==null?void 0:d.colorPrimary)??n,appearance:s})))};import ct from"react";import{motion as Fa}from"framer-motion";import jo from"styled-components";var ka={backgroundColor:"#E6E6E6"},Pa=jo.div`
|
|
570
570
|
display: flex;
|
|
571
571
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
572
572
|
justify-content: flex-start;
|
|
@@ -585,11 +585,11 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
585
585
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
586
586
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
587
587
|
${e=>lt(e)}
|
|
588
|
-
`,Ia={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},Ba={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},$e=({count:e,total:t,fillColor:o,bgColor:n=ka.backgroundColor,display:r="count",textLocation:i="left",style:s={},textStyle:p={},appearance:d})=>{var
|
|
588
|
+
`,Ia={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},Ba={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},$e=({count:e,total:t,fillColor:o,bgColor:n=ka.backgroundColor,display:r="count",textLocation:i="left",style:s={},textStyle:p={},appearance:d})=>{var w,S;if(t===0)return ct.createElement(ct.Fragment,null);let l=e===0?"10px":`${e/t*100}%`,u=r==="compact"?"5px":"10px",c=Math.round(e/t*100),m=r==="compact"?"5px":"20px",b;return r==="count"?b=`${e} of ${t}`:r==="compact"?b=`${c}%`:r==="percent"&&(b=`${c}% complete`),i==="top"&&(m="0px"),ct.createElement(Pa,{className:a("progressBarContainer",d),textLocation:i,styleOverrides:s},ct.createElement(Ea,{className:a("progressBarStepText",d),style:{...p,fontSize:r==="compact"?12:15,fontWeight:r==="compact"?400:500},appearance:d,padding:m,textLocation:i},b),ct.createElement(va,{textLocation:i,className:a("progressBar",d)},ct.createElement(Fa.div,{style:{...Ba,width:l,height:u,backgroundColor:((w=d==null?void 0:d.theme)==null?void 0:w.colorPrimary)??o,zIndex:r=="compact"?1:5},className:a("progressBarFill",d)}),ct.createElement("div",{className:a("progressBarBackground",d),style:{...Ia,height:u,backgroundColor:((S=d==null?void 0:d.theme)==null?void 0:S.colorSecondary)??n}})))};import Gt from"react";import Aa from"styled-components";import wo from"react";import bo from"react";var kt=({stepData:e,appearance:t})=>bo.createElement(bo.Fragment,null,bo.createElement(si,{appearance:t,className:a("checklistStepTitle",t),dangerouslySetInnerHTML:pe(e.title)}),bo.createElement(li,{appearance:t,className:a("checklistStepSubtitle",t),dangerouslySetInnerHTML:pe(e.subtitle)}));import jt from"react";var Pt=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},n=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return jt.createElement(jt.Fragment,null,jt.createElement(po,null,e.secondaryButtonTitle&&jt.createElement(Z,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:n,style:{width:"auto",marginRight:"12px"}}),jt.createElement(Z,{appearance:t,title:e.primaryButtonTitle,onClick:o})))};var vt=({stepData:e,appearance:t})=>wo.createElement(wo.Fragment,null,wo.createElement(kt,{stepData:e,appearance:t}),wo.createElement(Pt,{stepData:e,appearance:t}));import di from"react";function ci(e){if(e.videoUri.includes("youtube")){let t=e.videoUri.split("v=")[1],o=t.indexOf("&");return o!==-1&&(t=t.substring(0,o)),di.createElement("iframe",{width:"480",height:"260",src:`https://www.youtube.com/embed/${t}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:a("checklistStepVideo",e.appearance)})}else return di.createElement("video",{width:"480",height:"260",controls:!0,src:e.videoUri})}var Go="default",Na=Aa.img`
|
|
589
589
|
border-radius: 4px;
|
|
590
590
|
max-height: 260px;
|
|
591
591
|
min-height: 200px;
|
|
592
|
-
`,mi=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return Gt.createElement("div",null,o)}return Gt.createElement(ni,{className:
|
|
592
|
+
`,mi=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return Gt.createElement("div",null,o)}return Gt.createElement(ni,{className:a("checklistStepContent",t)},e.imageUri?Gt.createElement(Na,{className:a("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Gt.createElement(ci,{videoUri:e.videoUri,appearance:t}):null,Gt.createElement(vt,{stepData:e,appearance:t}))};import Te,{useRef as La,useState as Oa}from"react";import Et from"styled-components";var ui=Et.div`
|
|
593
593
|
display: block;
|
|
594
594
|
`,Da=Et.div`
|
|
595
595
|
display: flex;
|
|
@@ -690,7 +690,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
690
690
|
`,Xa=mt.div`
|
|
691
691
|
flex: 2;
|
|
692
692
|
padding: 2rem;
|
|
693
|
-
`,Ja=({title:e,subtitle:t,steps:o=[],style:n={},selectedStep:r,setSelectedStep:i,className:s="",customStepTypes:p=new Map,appearance:d,type:
|
|
693
|
+
`,Ja=({title:e,subtitle:t,steps:o=[],style:n={},selectedStep:r,setSelectedStep:i,className:s="",customStepTypes:p=new Map,appearance:d,type:l})=>{let{mergeAppearanceWithDefault:u}=Y();d=u(d);let m={...{[Go]:mi,[fi]:gi,[xi]:Ci},...p},[b,w]=ja(0),S=r??b,f=i??w,k=o.filter(B=>B.complete===!0).length,T=()=>{var B;return!((B=o[S])!=null&&B.type)||!m[o[S].type]?m[Go]({stepData:o[S],appearance:d}):m[o[S].type]({stepData:o[S],appearance:d})};return Ie.createElement(Ga,{type:l,style:n,className:s,appearance:d},Ie.createElement(Si,{style:{flex:1}},Ie.createElement(Si,{style:{padding:"30px 0px 30px 30px",borderBottom:"none"}},Ie.createElement(Va,{className:a("checklistTitle",d),appearance:d},e),Ie.createElement(Ka,{className:a("checklistSubtitle",d),appearance:d},t),Ie.createElement($e,{total:o.length,count:k,fillColor:d.theme.colorPrimary,style:{marginTop:"24px"},appearance:d})),Ie.createElement(qa,{className:a("checklistStepsContainer",d)},o.map((B,P)=>Ie.createElement(pi,{data:B,index:P,key:P,listLength:o.length,isSelected:P===S,primaryColor:d.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{f(P)}})))),Ie.createElement(Ya,{appearance:d,className:a("checklistDivider",d)}),Ie.createElement(Xa,null,Ie.createElement(T,null)))},Vo=Ja;import O,{useState as op}from"react";import yi from"react";import Qa from"styled-components";var Za=Qa.svg`
|
|
694
694
|
transition: 'transform 0.35s ease-in-out';
|
|
695
695
|
`,It=({color:e="#323232",style:t,className:o})=>yi.createElement(Za,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},yi.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as rp}from"framer-motion";import de from"styled-components";var Ko={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},bi=de.div`
|
|
696
696
|
max-height: 350px;
|
|
@@ -905,7 +905,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
905
905
|
line-height: 14px;
|
|
906
906
|
font-weight: 400;
|
|
907
907
|
cursor: pointer;
|
|
908
|
-
`;var tp=({steps:e,style:t,title:o,primaryColor:n,appearance:r,onButtonClick:i})=>{let{primaryCTAClickSideEffects:s}=oe();return qe.createElement(Wi,{style:t,className:
|
|
908
|
+
`;var tp=({steps:e,style:t,title:o,primaryColor:n,appearance:r,onButtonClick:i})=>{let{primaryCTAClickSideEffects:s}=oe();return qe.createElement(Wi,{style:t,className:a("guideContainer",r)},qe.createElement(Hi,{className:a("guideTitle",r)},o),qe.createElement(zi,{className:a("guideItemContainer",r)},e.map((p,d)=>qe.createElement(ji,{key:`guide-${p.id??d}`,as:ep.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:a("guideItem",r)},p.icon&&qe.createElement(Gi,{className:a("guideIcon",r)},qe.createElement(Vi,null,p.icon)),qe.createElement(Ki,{className:a("guideItemTitle",r),dangerouslySetInnerHTML:pe(p.title)}),qe.createElement(qi,{className:a("guideItemSubtitle",r),dangerouslySetInnerHTML:pe(p.subtitle)}),qe.createElement(Yi,{className:a("guideItemLink",r),color:n,onClick:()=>{p.primaryButtonUri&&s(p),i&&i(p)}},p.primaryButtonTitle)))))},Vt=tp;var ip=({steps:e,title:t,subtitle:o,stepsTitle:n,visible:r,onClose:i,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:l,guideData:u,guideTitle:c,onGuideButtonClick:m})=>{let b=({stepData:h,handleSecondaryCTAClick:C,handleCTAClick:v})=>h?O.createElement(Bi,{className:a("checklistStepContainer",l),"data-testid":"checklistStepContainer"},O.createElement(Ai,{appearance:l,className:a("checklistStepTitle",l),dangerouslySetInnerHTML:pe(h.title)}),O.createElement(Ni,{appearance:l,className:a("checklistStepSubtitle",l),dangerouslySetInnerHTML:pe(h.subtitle)}),O.createElement(Li,{className:a("checklistCTAContainer",l)},h.secondaryButtonTitle&&O.createElement(Z,{title:h.secondaryButtonTitle,onClick:C,appearance:l,secondary:!0}),O.createElement(Z,{title:h.primaryButtonTitle,onClick:v,appearance:l}))):O.createElement(O.Fragment,null),S={...{default:h=>{var $;if(($=e[T])!=null&&$.StepContent){let W=e[T].StepContent;return O.createElement("div",null,W)}let C=e[T];return O.createElement(b,{stepData:h,handleCTAClick:()=>{C.handlePrimaryButtonClick&&C.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{C.handleSecondaryButtonClick&&C.handleSecondaryButtonClick()}})}},...d},[f,k]=op(0),T=s??f,B=p??k,P=()=>{var h;return e?!((h=e[T])!=null&&h.type)||!S[e[T].type]?S.default(e[T]):S[e[T].type]({stepData:e[T],primaryColor:l.theme.colorPrimary}):O.createElement(O.Fragment,null)},g=e.filter(h=>h.complete).length;return r?(l.theme.modalContainer||(l.theme.borderRadius&&(Ko.borderRadius=l.theme.borderRadius+"px"),l.theme.modalContainer=Ko),O.createElement(Je,{onClose:i,visible:r,appearance:l},O.createElement(Ui,null,O.createElement(wi,null,O.createElement(Ti,{appearance:l,className:a("checklistTitle",l)},t),O.createElement(Fi,{appearance:l,className:a("checklistSubtitle",l)},o)),O.createElement(bi,null,e&&e.length>0&&O.createElement(ki,{className:a("stepsContainer",l)},O.createElement(Pi,null,O.createElement("div",{style:{flex:3}},O.createElement(vi,{className:a("stepsTitle",l)},n)),O.createElement(Mi,null,O.createElement($e,{fillColor:l.theme.colorPrimary,style:{width:"100%"},count:g,total:e.length,appearance:l}))),O.createElement(Ei,null,O.createElement(Ii,{className:a("checklistStepListContainer",l),appearance:l},e.map((h,C)=>{let v=T===C;return O.createElement(Oi,{selected:v,className:a(`checklistStepListItem${v?"Selected":""}`,l),key:`checklist-guide-step-${h.id??C}`,disabled:h.blocked,onClick:()=>{h.blocked||B(C)},title:h.blocked?"Finish remaining steps to continue":void 0},v&&O.createElement(So,{className:a("checklistStepItemSelectedIndicator",l),as:rp.div,layoutId:"checklist-step-selected",style:{backgroundColor:l.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),O.createElement(Di,{selected:v,className:a(`checklistStepListStepName${v?"Selected":""}`,l)},h.stepName),O.createElement($i,null,O.createElement(Ft,{value:h.complete,type:"round",primaryColor:l.theme.colorPrimary,progress:h.progress,appearance:l}),O.createElement(_i,null,O.createElement(It,{style:{marginLeft:"10px"},color:l.theme.colorBackgroundSecondary}))))})),O.createElement(P,null))),u&&u.length>0&&O.createElement(Vt,{steps:u,title:c,primaryColor:l.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:l,onButtonClick:h=>(m&&m(h),!0)}))))):O.createElement(O.Fragment,null)},qo=ip;import{useEffect as np,useState as sp}from"react";var Xi=()=>{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,n]=sp(t),r=null,i=()=>{r!==null?clearTimeout(r):s(),r=setTimeout(()=>{s()},16)},s=()=>{let p=Object.fromEntries(Object.entries(e).map(([d,l])=>{if(!window)return[d,!1];let u=window.matchMedia(l);return u.addEventListener("change",i),[d,u.matches]}));n(p)};return np(()=>{s()},[]),o};import Se,{useEffect as cn,useState as pp}from"react";import ce from"react";import{AnimatePresence as lp,motion as ap}from"framer-motion";import Ye from"styled-components";var Ji=Ye.div`
|
|
909
909
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
910
910
|
border: 1px solid;
|
|
911
911
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -952,7 +952,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
952
952
|
flex-direction: row;
|
|
953
953
|
justify-content: flex-start;
|
|
954
954
|
align-items: center;
|
|
955
|
-
`;var nn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:n,onSecondaryButtonClick:r,appearance:i})=>{var
|
|
955
|
+
`;var nn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:n,onSecondaryButtonClick:r,appearance:i,customStepTypes:s})=>{var u,c;let p=t?{}:{transform:"rotate(90deg)"};function d(){return ce.createElement(ce.Fragment,null,e.imageUri||e.videoUri?ce.createElement(Qi,{className:a("stepMediaContainer",i)},e.imageUri?ce.createElement(Zi,{className:a("stepImage",i),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?ce.createElement(wt,{appearance:i,videoUri:e.videoUri}):null):null,ce.createElement(on,{className:a("stepSubtitle",i),appearance:i,dangerouslySetInnerHTML:pe(e.subtitle)}),ce.createElement(po,{className:a("checklistCTAContainer",i)},e.secondaryButtonTitle?ce.createElement(Z,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>r(),appearance:i}):null,ce.createElement(Z,{title:e.primaryButtonTitle??"Continue",onClick:()=>n(),appearance:i})))}function l(){if(!s)return null;let m=s[e.type];return m?m(e,i):null}return ce.createElement(Ji,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:a("checklistStepContainer",i),appearance:i},ce.createElement(Ri,{className:a("stepHeader",i)},ce.createElement(rn,null,ce.createElement(Co,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(u=i==null?void 0:i.theme)==null?void 0:u.colorPrimary,appearance:i}),ce.createElement(en,{appearance:i,className:a("stepTitle",i),dangerouslySetInnerHTML:pe(e.title)})),ce.createElement(tn,{className:a("stepChevronContainer",i),onClick:()=>o()},ce.createElement(It,{style:{...p,transition:"transform 0.1s ease-in-out"},color:(c=i==null?void 0:i.theme)==null?void 0:c.colorTextSecondary}))),ce.createElement(lp,null,!t&&ce.createElement(ap.div,{initial:{opacity:1,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:1,height:0},key:e.id,style:{overflow:"hidden"}},l()??d())))};import Bt from"styled-components";var Uh=Bt.div`
|
|
956
956
|
background: #ffffff;
|
|
957
957
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
958
958
|
border-radius: 6px;
|
|
@@ -992,7 +992,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
992
992
|
justify-content: space-between;
|
|
993
993
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
994
994
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
995
|
-
`;var dp=({title:e,subtitle:t,steps:o,onClose:n,visible:r,onCompleteStep:i,autoExpandFirstIncompleteStep:s=!0,autoCollapse:p=!0,autoExpandNextStep:d=!0,primaryColor:
|
|
995
|
+
`;var dp=({title:e,subtitle:t,steps:o,onClose:n,visible:r,onCompleteStep:i,autoExpandFirstIncompleteStep:s=!0,autoCollapse:p=!0,autoExpandNextStep:d=!0,primaryColor:l="#000000",selectedStep:u,setSelectedStep:c,appearance:m,type:b,className:w,customStepTypes:S})=>{let f=o.filter(h=>h.complete).length,[k,T]=pp(Array(o.length).fill(!0));cn(()=>{let h=[...k];if(s){for(let C=0;C<o.length;C++)if(!o[C].complete){h[C]=!1;break}T(h)}},[]),cn(()=>{B(u)},[u]);let B=h=>{let C=[...k];if(p)for(let v=0;v<k.length;++v)v!==h&&(C[v]=!0);C[h]=!C[h],T(C)};if(!r&&b=="modal")return Se.createElement(Se.Fragment,null);let P=Se.createElement(Se.Fragment,null,Se.createElement(sn,null,Se.createElement(ln,{appearance:m,className:a("checklistTitle",m),dangerouslySetInnerHTML:pe(e)}),Se.createElement(an,{appearance:m,className:a("checklistSubtitle",m),dangerouslySetInnerHTML:pe(t)})),Se.createElement($e,{display:"percent",count:f,total:o.length,fillColor:l,style:{margin:"14px 0px 8px 0px"},appearance:m})),g=Se.createElement(pn,{className:fe(a("checklistContainer",m),w)},o.map((h,C)=>{let v=k[C];return Se.createElement(nn,{appearance:m,stepData:h,collapsed:v,key:`modal-checklist-${h.id??C}`,onClick:()=>{if(u===C){B(C);return}c(C)},onPrimaryButtonClick:()=>{i&&i(C,h),h.handlePrimaryButtonClick&&h.handlePrimaryButtonClick(),d&&!h.completionCriteria&&C<k.length-1&&k[C+1]&&c(C+1)},onSecondaryButtonClick:()=>{h.handleSecondaryButtonClick&&h.handleSecondaryButtonClick()},customStepTypes:S})}));return b==="inline"?Se.createElement(dn,{appearance:m,className:fe(a("checklistInlineContainer",m),w)},P,g):Se.createElement(Se.Fragment,null,Se.createElement(Je,{onClose:n,visible:r,appearance:m,style:{maxWidth:"600px"},headerContent:P},g))},Yo=dp;import le,{useEffect as Xo,useRef as hp,useState as ft}from"react";import ut from"react";import se,{css as mn,keyframes as un}from"styled-components";var fn=mn`
|
|
996
996
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
997
997
|
`,cp=mn`
|
|
998
998
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
@@ -1127,7 +1127,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
1127
1127
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1128
1128
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1129
1129
|
`}
|
|
1130
|
-
`;var In=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:n}=Y(),{primaryCTAClickSideEffects:r}=oe(),{theme:i,styleOverrides:s}=n(o),{imageUri:p=null,subtitle:d=null,title:
|
|
1130
|
+
`;var In=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:n}=Y(),{primaryCTAClickSideEffects:r}=oe(),{theme:i,styleOverrides:s}=n(o),{imageUri:p=null,subtitle:d=null,title:l=null,complete:u=!1,blocked:c=!1}=e,m=()=>{r(e)};return ut.createElement(yn,{className:a("carouselCard",o),onClick:c?null:m,style:t,blocked:c,complete:u},ut.createElement("div",{style:{alignItems:"flex-start",display:"flex",justifyContent:"space-between"}},p&&ut.createElement(bn,{className:a("carouselCardImage",o),src:p,alt:l,style:{opacity:u||c?.4:1}}),u&&ut.createElement(kn,{className:a("carouselCompletedPill",o)},ut.createElement(En,{style:{color:"#108E0B"}},"Complete"))),l&&ut.createElement(vn,{blocked:c,complete:u,className:a("carouselCardTitle",o)},l),d&&ut.createElement(Me.Quiet,{blocked:c,complete:u,className:a("carouselCardSubtitle",o)},d))};import Kt from"react";var Bn=({numberOfStepsCompleted:e,numberOfSteps:t,appearance:o})=>{let n=t>0?e/t:0,r=200,i=Math.min(r,Math.max(10,Math.round(r*n)));return Kt.createElement(Tn,{className:a("carouselProgressBar",o)},Kt.createElement(Fn,{as:Me.Loud,style:{marginRight:8}},e," of ",t),Kt.createElement("svg",{height:10,width:r},Kt.createElement("rect",{x:0,y:0,rx:5,width:r,height:10,fill:"#E6E6E6"}),Kt.createElement("rect",{x:0,y:0,rx:5,width:i,height:10,fill:"currentColor"})))};var xp=()=>le.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},le.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),le.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),le.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),An=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[n,r]=ft(!1),[i,s]=ft(!1);Xo(()=>{t===!0&&n===!1?r(!0):t===!1&&n===!0&&s(!0)},[t]);let p=()=>{r(!1),s(!1)},d=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return n?le.createElement(xn,{style:d,reversed:i,onAnimationEnd:i?p:null},le.createElement(Cn,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},le.createElement(xp,null))):null},Nn=({flowId:e,appearance:t,customVariables:o,className:n})=>{let r=hp(null),[i,s]=ft(!1),[p,d]=ft(!1),[l,u]=ft(null),[c,m]=ft([]),[b,w]=ft(0),{getFlowMetadata:S,getFlowSteps:f,getNumberOfStepsCompleted:k,updateCustomVariables:T,getFlowStatus:B,isLoading:P,targetingLogicShouldHideFlow:g,getFlow:h}=K();Xo(()=>{T(o)},[o,P]),Xo(()=>{if(P)return;let A=S(e),H=k(e),L=f(e);u(A),A.data!==null&&(m(L.sort((z,re)=>Number(z.complete)-Number(re.complete))),d(L.length>3),w(H))},[P]);let C=[];for(let A=0;A<c.length;A+=3)C.push(c.slice(A,A+3));let v=A=>{let H=A.target,L=H.scrollWidth-H.clientWidth,z=Math.ceil(H.scrollLeft);z>0&&i===!1&&s(!0),z===0&&i===!0&&s(!1),z<L&&p===!1&&d(!0),z===L&&p===!0&&d(!1)},U=(A=!0)=>{let H=A?1:-1;r.current!==null&&r.current.scrollBy({left:r.current.clientWidth*H,behavior:"smooth"})},$=null,W=A=>{$!==null?clearTimeout($):v(A),$=setTimeout(()=>{v(A)},16)};return P?null:le.createElement(wn,{className:fe(a("carouselContainer",t),n)},le.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:20}},le.createElement("div",null,le.createElement(Pn,{className:a("carouselTitle",t)},l==null?void 0:l.title),le.createElement(Me.Quiet,{className:a("carouselSubtitle",t)},l==null?void 0:l.subtitle)),le.createElement(Bn,{numberOfStepsCompleted:b,numberOfSteps:c.length})),le.createElement("div",{style:{position:"relative"}},le.createElement(An,{show:i,onClick:()=>U(!1)}),le.createElement(An,{side:"right",show:p,onClick:U}),le.createElement(gn,{ref:r,onScroll:W},C.map((A,H)=>le.createElement(hn,{key:H,style:{flex:`0 0 calc(100% - ${c.length>3?36:0}px)`}},A.map((L,z)=>le.createElement(In,{key:z,stepData:L,style:{flex:c.length>3?"0 1 calc(33% - 16px * 2 / 3)":1},appearance:t})))))))};var Jo=({flowId:e,title:t,subtitle:o,style:n,initialSelectedStep:r,className:i,type:s="inline",onDismiss:p,visible:d,customVariables:l,onStepCompletion:u,onButtonClick:c,appearance:m,hideOnFlowCompletion:b,setVisible:w,customStepTypes:S,checklistStyle:f="default",...k})=>{let{getFlow:T,getFlowSteps:B,markStepCompleted:P,getStepStatus:g,getNumberOfStepsCompleted:h,isLoading:C,targetingLogicShouldHideFlow:v,updateCustomVariables:U,getFlowMetadata:$,isStepBlocked:W,getFlowStatus:A,hasActiveFullPageFlow:H,setHasActiveFullPageFlow:L}=K(),{primaryCTAClickSideEffects:z,secondaryCTAClickSideEffects:re}=oe(),{getOpenFlowState:V,setOpenFlowState:_}=be(),[ee,ie]=On(r||0),[te,M]=On(!1),R=d===void 0?V(e):d,N=s==="modal",{mergeAppearanceWithDefault:q}=Y(),{isLarge:We}=Xi();if(m=q(m),Ln(()=>{U(l)},[l,C]),Ln(()=>{d!==void 0&&(N&&d===!0?L(!0):N&&d===!1&&L(!1))},[d,w,H]),C)return null;let ye=T(e);if(!ye||v(ye))return null;let Fe=B(e);if(!Fe||b===!0&&A(e)===Q)return null;let ue=$(e);if(ue!=null&&ue.title&&(t=ue.title),ue!=null&&ue.subtitle&&(o=ue.subtitle),!te&&r===void 0&&h(e)>0){let I=Math.min(h(e),Fe.length-1);ie(I),M(!0)}function ze(){if(ee+1>=Fe.length){N&&_(e,!1);return}W(e,Fe[ee+1].id)||ie(ee+1)}function He(I,J,it){let rr=ee+1<Fe.length?Fe[ee+1]:null;c&&c(I,ee,J,rr)===!0&&N&&Ae(),u&&u(I,it,rr),!u&&!c&&(I.primaryButtonUri||I.secondaryButtonUri)&&N&&Ae()}function rt(){return Fe.map((I,J)=>({...I,handleSecondaryButtonClick:()=>{ze(),re(I),I.skippable===!0&&P(e,I.id,{skipped:!0}),He(I,"secondary",J)},handlePrimaryButtonClick:()=>{(!I.completionCriteria&&(I.autoMarkCompleted||I.autoMarkCompleted===void 0)||I.completionCriteria&&I.autoMarkCompleted===!0)&&(P(e,I.id),ze()),He(I,"primary",J),z(I),g(e,I.id)===Ee&&ze()}}))}function j(){return ae.createElement(ne,{appearance:m})}let Be={steps:rt(),title:t,subtitle:o,primaryColor:m.theme.colorPrimary,appearance:m,customStepTypes:S,type:s,className:i};function Ae(){_(e,!1),p&&p(),w&&w(!1)}function Eo(){return ae.createElement(ae.Fragment,null,ae.createElement(j,null),ae.createElement(Nn,{flowId:e,appearance:m,customVariables:l,className:i}))}function x(){return ae.createElement(ae.Fragment,null,ae.createElement(j,null),ae.createElement(Yo,{visible:R,onClose:()=>{Ae()},selectedStep:ee,setSelectedStep:ie,autoExpandNextStep:!0,appearance:m,...Be}))}function y(){if(!We)return x();let I=k.guideFlowId,J;return I&&T(I)&&(J=B(I)),ae.createElement(ae.Fragment,null,ae.createElement(j,null),ae.createElement(qo,{visible:R,stepsTitle:ue.stepsTitle?ue.stepsTitle:"Your quick start guide",onClose:()=>{Ae()},selectedStep:ee,setSelectedStep:ie,guideData:J,guideTitle:k.guideTitle??"Guide",appearance:m,title:t,subtitle:o,onGuideButtonClick:it=>{He(it,"link",0)},customStepTypes:S,...Be}))}function E(){if(!We)return x();let I=ae.createElement(Vo,{flowId:e,style:n,selectedStep:ee,setSelectedStep:ie,appearance:m,type:s,...Be});return N?ae.createElement(Je,{onClose:()=>{Ae()},visible:R,appearance:m,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},ae.createElement(j,null),I):ae.createElement(ae.Fragment,null,ae.createElement(j,null),I)}switch(f){case"condensed":return x();case"with-guide":return y();case"default":return E();case"carousel":return Eo();default:return E()}};var Sp=e=>Cp.createElement(Jo,{type:"inline",...e});import tt,{useEffect as bp}from"react";import Ue from"react";import Fo from"styled-components";var Dn=Fo.div`
|
|
1131
1131
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1132
1132
|
border-radius: 8px;
|
|
1133
1133
|
padding: 6px 10px 6px 10px;
|
|
@@ -1154,7 +1154,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
1154
1154
|
display: flex;
|
|
1155
1155
|
height: 100%;
|
|
1156
1156
|
align-items: center;
|
|
1157
|
-
`;import{motion as yp}from"framer-motion";var _n=({title:e,count:t,total:o,onClick:n,style:r={},className:i,appearance:s,type:p="default"})=>Ue.createElement(Ue.Fragment,null,Ue.createElement(ne,{appearance:s}),Ue.createElement(Dn,{as:yp.div,whileHover:{opacity:.9},whileTap:{scale:.98},onClick:()=>n!==void 0&&n(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...r},className:fe(i??"",
|
|
1157
|
+
`;import{motion as yp}from"framer-motion";var _n=({title:e,count:t,total:o,onClick:n,style:r={},className:i,appearance:s,type:p="default"})=>Ue.createElement(Ue.Fragment,null,Ue.createElement(ne,{appearance:s}),Ue.createElement(Dn,{as:yp.div,whileHover:{opacity:.9},whileTap:{scale:.98},onClick:()=>n!==void 0&&n(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...r},className:fe(i??"",a("progressRingContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&Ue.createElement(Un,{className:a("progressRingContainer",s)},Ue.createElement(_t,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),Ue.createElement($n,{type:p,className:a("badgeTitleContainer",s)},Ue.createElement(Mn,{type:p,appearance:s,className:a("badgeTitle",s)},e),n!==void 0&&Ue.createElement(It,{className:a("badgeChevron",s),color:s.theme.colorPrimary})),p=="default"&&o&&o!==0&&Ue.createElement($e,{display:"compact",count:t,total:o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:s})));import et from"react";import qt from"styled-components";var Wn=qt.div`
|
|
1158
1158
|
display: flex;
|
|
1159
1159
|
flex-direction: row;
|
|
1160
1160
|
width: 100%;
|
|
@@ -1192,7 +1192,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
1192
1192
|
:hover {
|
|
1193
1193
|
opacity: 0.8;
|
|
1194
1194
|
}
|
|
1195
|
-
`;var Gn=({title:e,subtitle:t,icon:o,appearance:n,count:r,total:i,className:s,style:p})=>et.createElement(et.Fragment,null,et.createElement(Wn,{appearance:n,className:fe(
|
|
1195
|
+
`;var Gn=({title:e,subtitle:t,icon:o,appearance:n,count:r,total:i,className:s,style:p})=>et.createElement(et.Fragment,null,et.createElement(Wn,{appearance:n,className:fe(a("fullWidthProgressBadgeContainer",n),s??""),style:p},o&&et.createElement(zn,{className:a("fullWidthProgressBadgeIcon",n)},o),et.createElement(Hn,null,et.createElement(ge,{size:"small",appearance:n,title:e,subtitle:t})),et.createElement(jn,{className:a("fullWidthProgressBadgeProgressContainer",n)},et.createElement($e,{count:r,total:i,display:"percent",textLocation:"top",fillColor:n.theme.colorPrimary}))));var wp=({flowId:e,title:t,subtitle:o,icon:n,style:r,onClick:i,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:l,type:u="default"})=>{let{getFlow:c,getFlowSteps:m,getFlowStatus:b,getNumberOfStepsCompleted:w,isLoading:S,targetingLogicShouldHideFlow:f,updateCustomVariables:k}=K(),{mergeAppearanceWithDefault:T}=Y();l=T(l);let{setOpenFlowState:B,getOpenFlowState:P}=be();if(bp(()=>{k(p)},[p,S]),S)return null;let g=c(e);if(!g||f(g)||d===!0&&b(e)===Q)return null;let h=m(e),C=w(e);return u==="full-width"?tt.createElement(tt.Fragment,null,tt.createElement(ne,{appearance:l}),tt.createElement(Gn,{title:t,subtitle:o,count:C,total:h.length,style:r,className:s,appearance:l,icon:n,onClick:()=>{}})):tt.createElement(tt.Fragment,null,tt.createElement(ne,{appearance:l}),tt.createElement(_n,{count:C,total:h.length,title:t,style:r,onClick:()=>{B(e,!0),i&&i()},type:u,className:s,appearance:l}))};import Tp from"react";var Fp=({flowId:e,style:t,appearance:o,...n})=>{let{getFlow:r,targetingLogicShouldHideFlow:i,getFlowSteps:s}=K(),{mergeAppearanceWithDefault:p}=Y();o=p(o);let d=r(e);if(!d||i(d))return null;let l=s(e);return Tp.createElement(Vt,{steps:l,style:t,appearance:o,...n})};import Nt,{useContext as $p,useEffect as Mp}from"react";import D,{useEffect as ko,useLayoutEffect as ts,useRef as Ip,useState as Yt}from"react";import Xt from"styled-components";import{useCallback as kp,useEffect as Pp,useState as vp}from"react";var Qo=(e,t,o,n={x:20,y:20},r)=>{let i=r=="fixed"?0:window.scrollY,s=r=="fixed"?0:window.scrollX;return!e||!e.left||!e.top?{x:0,y:0}:t==="left"?{x:e.left-o+n.x+s,y:e.top-n.y+i}:t==="right"?{x:e.left+e.width+n.x+s,y:e.top-n.y+i}:{x:0,y:0}},Vn={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Ep(e){let t=Vn;return e&&(t=e.getBoundingClientRect()),t}function Kn(e,t){let[o,n]=vp(Vn),r=kp(()=>{e&&n(Ep(e))},[e]);return Pp(()=>(r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)),[e,t]),o}import ot from"styled-components";var qn=ot.div`
|
|
1196
1196
|
${e=>F(e)} {
|
|
1197
1197
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
1198
1198
|
}
|
|
@@ -1299,7 +1299,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
1299
1299
|
`,Op=Xt(is)`
|
|
1300
1300
|
width: ${At+12}px;
|
|
1301
1301
|
height: ${At+12}px;
|
|
1302
|
-
`,Dp=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:n="auto",showHighlight:r=!0,primaryColor:i="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:
|
|
1302
|
+
`,Dp=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:n="auto",showHighlight:r=!0,primaryColor:i="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:l=0,customStepTypes:u,appearance:c,dismissible:m=!1,showHighlightOnly:b,showStepCount:w=!0,completedStepsCount:S=0})=>{var ue,ze,He,rt;let[f,k]=Yt(),[T,B]=Yt(new Date),P=Ip(null),[g,h]=Yt(document.querySelector(e[l].selector)),C=Kn(g,T),[v,U]=Yt(),[$,W]=Yt(!b),A=(ze=(ue=e[l])==null?void 0:ue.props)!=null&&ze.position?e[l].props.position:"absolute",H=((rt=(He=e[l])==null?void 0:He.props)==null?void 0:rt.zIndex)??90,L=(f==null?void 0:f.width)??os,z=(f==null?void 0:f.height)??rs;ts(()=>{P.current&&k({width:P.current.clientWidth,height:P.current.clientHeight})},[l,T,A]),ko(()=>{b||W(!0)},[l]);let re=n==="auto"?"right":n,V=Qo(C,re,L,s,A),_=C.right+L>(window.innerWidth||document.documentElement.clientWidth),ee=C.bottom+rs>(window.innerHeight||document.documentElement.clientHeight);_&&n==="auto"&&(V=Qo(C,"left",L,s,A),re="left");let ie=window.location.pathname.split("/").pop(),te=()=>{let j=document.querySelector(e[l].selector);v&&v===JSON.stringify(j==null?void 0:j.getBoundingClientRect())||(h(j),B(new Date),j&&U(JSON.stringify(j.getBoundingClientRect())))};if(ko(()=>{let j=new MutationObserver(te);return j.observe(document.body,{subtree:!0,childList:!0}),()=>j.disconnect()},[te]),ko(()=>{let j=new MutationObserver(te);return j.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>j.disconnect()},[te]),ko(()=>{let j=setInterval(()=>{te()},10);return()=>clearInterval(j)},[te]),ts(()=>{setTimeout(()=>{te()},Bp),te()},[l,ie]),g===null)return D.createElement(D.Fragment,null);if(V.x==0&&V.y==0)return D.createElement(D.Fragment,null);if(!p)return D.createElement(D.Fragment,null);let M=()=>{let j=()=>{if(e[l].handlePrimaryButtonClick&&(e[l].handlePrimaryButtonClick(),W(!1),setTimeout(()=>{te()},30)),S===e.length-1)return o()},Be=()=>{e[l].handleSecondaryButtonClick&&(e[l].handleSecondaryButtonClick(),b&&W(!1))};return D.createElement(D.Fragment,null,w&&D.createElement(Zn,null,D.createElement(es,{className:a("tooltipStepCounter",c)},l+1," of ",e.length)),D.createElement(Rn,{showStepCount:w,className:a("tooltipCTAContainer",c)},e[l].secondaryButtonTitle&&D.createElement(Z,{title:e[l].secondaryButtonTitle,appearance:c,onClick:Be,size:"small",withMargin:!1,secondary:!0}),e[l].primaryButtonTitle&&D.createElement(Z,{title:e[l].primaryButtonTitle,appearance:c,onClick:j,withMargin:!1,size:"small"})))},R=()=>D.createElement(D.Fragment,null,m&&D.createElement(Yn,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:a("tooltipClose",c)},D.createElement(we,null)),e[l].imageUri&&D.createElement(Xn,{dismissible:m,appearance:c,src:e[l].imageUri,className:a("tooltipImageContainer",c)}),e[l].videoUri&&!e[l].imageUri&&D.createElement(Jn,{dismissible:m,appearance:c,className:a("tooltipVideoContainer",c)},D.createElement(wt,{appearance:c,videoUri:e[l].videoUri})),D.createElement(ge,{appearance:c,title:e[l].title,subtitle:e[l].subtitle,size:"small"}),D.createElement(Qn,{className:a("tooltipFooter",c)},D.createElement(M,null))),q={...{default:j=>{var Be;if((Be=e[l])!=null&&Be.StepContent){let Ae=e[l].StepContent;return D.createElement("div",null,Ae)}return D.createElement(R,null)}},...u},We=()=>{var j;return e?!((j=e[l])!=null&&j.type)||!q[e[l].type]?q.default(e[l]):q[e[l].type]({stepData:e[l],primaryColor:i}):D.createElement(D.Fragment,null)};if(b&&e[l].complete===!0)return null;let ye={top:(V==null?void 0:V.y)-At,left:(re=="left"?C.x+s.x:(V==null?void 0:V.x)-At)??0,cursor:b?"pointer":"default",position:A},Fe=()=>{b&&(B(new Date),W(!$))};return D.createElement(Lp,null,D.createElement(Op,{style:ye,zIndex:H,className:a("tourHighlightContainer",c)},r&&e[l].showHighlight!==!1&&D.createElement(D.Fragment,null,D.createElement(Np,{style:{position:A},onClick:Fe,primaryColor:c.theme.colorPrimary}),D.createElement(Ap,{style:{position:"absolute"},onClick:Fe,primaryColor:c.theme.colorPrimary}))),D.createElement(is,{style:{...ye,left:ye.left+(re=="left"?-L:24)},zIndex:H+1,className:a("tooltipContainerWrapper",c)},$&&D.createElement(qn,{ref:P,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:12,...d},appearance:c,className:a("tooltipContainer",c),maxWidth:os,zIndex:H+10},D.createElement(We,null))))},Po=Dp;import{Portal as Up}from"react-portal";var _p=({flowId:e,customVariables:t,appearance:o,onStepCompletion:n,onButtonClick:r,showTooltipsSimultaneously:i=!1,onDismiss:s,dismissible:p,tooltipPosition:d="auto",showHighlightOnly:l=!1,dismissBehavior:u="complete-flow",onComplete:c,...m})=>{let{getFlow:b,getFlowSteps:w,isLoading:S,targetingLogicShouldHideFlow:f,markStepCompleted:k,markStepStarted:T,markFlowCompleted:B,updateCustomVariables:P,getCurrentStepIndex:g,getStepStatus:h,isStepBlocked:C,getFlowStatus:v,getNumberOfStepsCompleted:U}=K(),{isLoadingUserFlowStateData:$}=Pe(),{primaryCTAClickSideEffects:W,secondaryCTAClickSideEffects:A}=oe(),{hasOpenModals:H}=be(),L=g(e),{openFlowStates:z}=$p(G),{mergeAppearanceWithDefault:re}=Y();if(o=re(o),Mp(()=>{P(t)},[t,S]),$)return null;let V=b(e);if(!V||f(V)||v(e)==Q||H())return null;let _=w(e);if(Object.keys(z).length>0){let N=Object.keys(z).find(q=>z[q]===!0);if(N!==void 0&&N!==e)return Nt.createElement(Nt.Fragment,null)}async function ee(N){if(await k(e,N.id),_.map(q=>h(e,q.id)).every(q=>q===Ee)){await B(e);return}if(!l&&L+1<_.length){if(C(e,_[L+1].id))return;await T(e,_[L+1].id)}}function ie(N,q,We){let ye=L+1<_.length?_[L+1]:null;r&&r(N,L,q,ye),n&&n(N,We,ye)}function te(){return _.map(N=>({...N,handleSecondaryButtonClick:async()=>{A(N),N.skippable===!0&&await k(e,N.id,{skipped:!0}),ie(N,"secondary",L)},handlePrimaryButtonClick:async()=>{(!N.completionCriteria&&(N.autoMarkCompleted||N.autoMarkCompleted===void 0)||N.completionCriteria&&N.autoMarkCompleted===!0)&&await ee(N),ie(N,"primary",L),W(N)}}))}async function M(N){s&&s(),u==="complete-flow"?await B(e):await k(e,N.id)}function R(){c&&c()}return Nt.createElement(Up,null,Nt.createElement(ne,{appearance:o}),i?_.map((N,q)=>Nt.createElement(Po,{key:N.id,appearance:o,steps:te(),selectedStep:q,showTooltipsSimultaneously:i,dismissible:p,onDismiss:()=>M(N),tooltipPosition:d,showHighlightOnly:l,completedStepsCount:U(e),onComplete:R,...m})):Nt.createElement(Po,{appearance:o,steps:te(),selectedStep:L,showTooltipsSimultaneously:i,dismissible:p,onDismiss:()=>M(_[L]),tooltipPosition:d,completedStepsCount:U(e),showHighlightOnly:l,onComplete:R,...m}))};import xe,{useEffect as Wp,useRef as zp,useState as Hp}from"react";import{Portal as jp}from"react-portal";import gt from"styled-components";var ns=gt.button`
|
|
1303
1303
|
${e=>F(e)} {
|
|
1304
1304
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1305
1305
|
|
|
@@ -1387,7 +1387,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
1387
1387
|
font-size: 14px;
|
|
1388
1388
|
|
|
1389
1389
|
padding: 8px 12px;
|
|
1390
|
-
`;import{AnimatePresence as hs,motion as xs}from"framer-motion";import ms from"react";var us=({style:e,className:t})=>ms.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},ms.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 fs from"react";var gs=({style:e,className:t})=>fs.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"},fs.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 Gp=({flowId:e,style:t,onStepCompletion:o,visible:n=!0,type:r="inline",title:i="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:
|
|
1390
|
+
`;import{AnimatePresence as hs,motion as xs}from"framer-motion";import ms from"react";var us=({style:e,className:t})=>ms.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},ms.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 fs from"react";var gs=({style:e,className:t})=>fs.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"},fs.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 Gp=({flowId:e,style:t,onStepCompletion:o,visible:n=!0,type:r="inline",title:i="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:l,getStepStatus:u,getNumberOfStepsCompleted:c,isLoading:m,targetingLogicShouldHideFlow:b}=K(),{primaryCTAClickSideEffects:w}=oe(),S=zp(null),[f,k]=Hp(!1),{mergeAppearanceWithDefault:T}=Y();s=T(s),Wp(()=>(document.addEventListener("click",B,!1),()=>{document.removeEventListener("click",B,!1)}),[]);let B=v=>{S.current&&!S.current.contains(v.target)&&k(!1)};if(m)return null;let P=p(e);if(!P||b(P))return null;let g=d(e);if(!g||!n)return null;function h(v,U){!v.completionCriteria&&(v.autoMarkCompleted||v.autoMarkCompleted===void 0)&&l(e,v.id),w(v),o&&o(v,U),k(!1)}function C(){return f&&xe.createElement(ds,{className:a("floatingWidgetMenu",s),as:xs.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:r},g.map((v,U)=>xe.createElement(cs,{className:a("floatingWidgetMenuItem",s),key:U,onClick:()=>h(v,U)},v.title)))}return r=="inline"?xe.createElement("span",{ref:S},xe.createElement(ns,{style:t,onClick:()=>{k(!f)},className:a("supportButton",s)},xe.createElement(ls,{className:a("supportIconContainer",s)},xe.createElement(gs,{className:a("supportIcon",s),style:{width:"18px",height:"18px"}})),xe.createElement(ss,{className:a("supportButtonTitle",s)},i)),xe.createElement(hs,null,xe.createElement(C,null))):xe.createElement(jp,null,xe.createElement(as,{style:t,ref:S},xe.createElement(hs,null,xe.createElement(C,null)),xe.createElement(ps,{onClick:()=>{k(!f)},as:xs.button,whileHover:{scale:1.1},className:a("floatingWidgetButton",s)},xe.createElement(us,{className:a("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import _e,{useEffect as Vp}from"react";import vo from"styled-components";var Cs=vo.div`
|
|
1391
1391
|
${e=>F(e)} {
|
|
1392
1392
|
display: flex;
|
|
1393
1393
|
flex-direction: column;
|
|
@@ -1423,7 +1423,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
1423
1423
|
opacity: 0.8;
|
|
1424
1424
|
}
|
|
1425
1425
|
}
|
|
1426
|
-
`;var Kp=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:n,appearance:r,className:i,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:
|
|
1426
|
+
`;var Kp=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:n,appearance:r,className:i,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:l,markStepCompleted:u,isLoading:c,targetingLogicShouldHideFlow:m,updateCustomVariables:b,getFlowSteps:w,getFlowStatus:S,getCurrentStepIndex:f}=K(),{primaryCTAClickSideEffects:k}=oe(),{mergeAppearanceWithDefault:T}=Y();if(r=T(r),Vp(()=>{b(o)},[o,c]),c)return null;let B=d(e);if(!B||m(B)||S(e)===Q)return null;let g=w(e)[f(e)];return _e.createElement(_e.Fragment,null,_e.createElement(ne,{appearance:r}),_e.createElement(Cs,{appearance:r,className:fe(a("embeddedTipContainer",r),i),style:s},(p===!0||g.dismissible)&&_e.createElement(bs,{onClick:async()=>{await l(e),t&&t()},className:a("embeddedTipDismissButton",r)},_e.createElement(we,null)),_e.createElement(Ss,null,_e.createElement(ge,{size:"small",appearance:r,title:g.title,subtitle:g.subtitle})),g.primaryButtonTitle&&_e.createElement(ys,{className:a("embeddedTipCallToActionContainer",r)},_e.createElement(Z,{classPrefix:"embeddedTip",title:g.primaryButtonTitle,appearance:r,withMargin:!1,size:"small",type:"inline",onClick:async()=>{g.handlePrimaryButtonClick(),k(g),!(n&&n(g,f(e),"primary")===!1)&&(await u(e,g.id),await l(e))}}))))};import me,{useEffect as qp}from"react";import Lt from"styled-components";var ws=Lt.div`
|
|
1427
1427
|
// use the :not annotation
|
|
1428
1428
|
${e=>F(e)} {
|
|
1429
1429
|
display: flex;
|
|
@@ -1468,7 +1468,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
1468
1468
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1469
1469
|
align-items: flex-end;
|
|
1470
1470
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1471
|
-
`;import Ps from"react";var vs=({style:e,className:t})=>Ps.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"},Ps.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"}));var Yp=({flowId:e,title:t,subtitle:o,onDismiss:n,customVariables:r,onButtonClick:i,appearance:s,type:p="full-width"})=>{let{getFlow:d,markFlowCompleted:
|
|
1471
|
+
`;import Ps from"react";var vs=({style:e,className:t})=>Ps.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"},Ps.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"}));var Yp=({flowId:e,title:t,subtitle:o,onDismiss:n,customVariables:r,onButtonClick:i,appearance:s,type:p="full-width"})=>{let{getFlow:d,markFlowCompleted:l,isLoading:u,targetingLogicShouldHideFlow:c,updateCustomVariables:m,getFlowMetadata:b,getFlowStatus:w,getFlowSteps:S,getCurrentStepIndex:f}=K(),{primaryCTAClickSideEffects:k}=oe(),{mergeAppearanceWithDefault:T}=Y();if(s=T(s),qp(()=>{m(r)},[r,u]),u)return null;let B=d(e);if(!B||c(B)||w(e)===Q)return null;let P=S(e),g=P.length>0?P[f(e)]:b(e);return g!=null&&g.title&&(t=g.title),g!=null&&g.subtitle&&(o=g.subtitle),me.createElement(me.Fragment,null,me.createElement(ne,{appearance:s}),me.createElement(ws,{type:p,appearance:s,className:a("bannerContainer",s)},p!="square"&&me.createElement(Ts,null,me.createElement(vs,null)),p==="square"&&g.dismissible&&me.createElement(Ro,{type:p,className:a("bannerDismissButtonContainer",s)},me.createElement(Zo,{type:p,onClick:async()=>{await l(e),n&&n()},className:a("bannerDismissButton",s)},me.createElement(we,null))),me.createElement(Fs,{type:p},me.createElement(ge,{appearance:s,title:t,subtitle:o})),me.createElement(ks,{type:p,className:a("bannerCallToActionContainer",s)},me.createElement(Z,{title:(g==null?void 0:g.primaryButtonTitle)??"Get started",appearance:s,onClick:()=>{k(g),i&&i(g,0,"primary")}})),p!=="square"&&g.dismissible&&me.createElement(Ro,{type:p,className:a("bannerDismissButtonContainer",s)},me.createElement(Zo,{type:p,onClick:async()=>{await l(e),n&&n()},className:a("bannerDismissButton",s)},me.createElement(we,null)))))};import X,{useEffect as Xp}from"react";import{Portal as Jp}from"react-portal";import Xe from"styled-components";var Es=Xe.div`
|
|
1472
1472
|
${e=>F(e)} {
|
|
1473
1473
|
display: flex;
|
|
1474
1474
|
flex-direction: column;
|
|
@@ -1555,5 +1555,5 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Dt}${r}.${Dt}${r} { ${Object.entries(i).map
|
|
|
1555
1555
|
opacity: 0.8;
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
1558
|
-
`;var Qp=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:n,appearance:r,className:i,style:s})=>{let{getFlow:p,markFlowCompleted:d,markStepCompleted:
|
|
1558
|
+
`;var Qp=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:n,appearance:r,className:i,style:s})=>{let{getFlow:p,markFlowCompleted:d,markStepCompleted:l,getNumberOfStepsCompleted:u,isLoading:c,targetingLogicShouldHideFlow:m,updateCustomVariables:b,getFlowSteps:w,getFlowStatus:S,getCurrentStepIndex:f}=K(),{primaryCTAClickSideEffects:k}=oe(),{mergeAppearanceWithDefault:T}=Y(),[B,P]=X.useState(null),[g,h]=X.useState(""),{hasOpenModals:C,setKeepCompletedFlowOpenDuringSession:v,shouldKeepCompletedFlowOpenDuringSession:U}=be();if(r=T(r),Xp(()=>{b(o)},[o,c]),c)return null;let $=p(e);if(!$||m($)||S(e)===Q||u(e)===1&&!U(e)||C())return null;let A=w(e)[f(e)];function H(){return X.createElement(X.Fragment,null,X.createElement(or,null,X.createElement(ge,{size:"large",appearance:r,title:A.title,subtitle:A.subtitle})),X.createElement(er,{className:a("npsNumberButtonContainer",r),appearance:r},Array.from(Array(10).keys()).map(z=>X.createElement(Is,{className:a("npsNumberButton",r),selected:B===z+1,key:z,onClick:async()=>{v(e),P(z+1),await l(e,A.id,{score:z+1})},appearance:r},z+1))),X.createElement(Bs,{appearance:r},X.createElement(tr,{appearance:r},"Not likely at all"),X.createElement(tr,{appearance:r},"Extremely likely")))}function L(){return X.createElement(X.Fragment,null,X.createElement(or,null,X.createElement(ge,{appearance:r,title:"Why did you choose this score?",size:"large"})),X.createElement(As,{appearance:r,value:g,onChange:z=>{h(z.target.value)},placeHolder:"Add your optional fedback here..."}),X.createElement(er,{appearance:r,className:a("npsNumberButtonContainer",r)},X.createElement(Z,{size:"large",withMargin:!1,onClick:async()=>{await d(e),n&&n(A,1,"primary")},appearance:r,title:A.secondaryButtonTitle||"Skip",secondary:!0}),X.createElement(Z,{size:"large",withMargin:!1,onClick:async()=>{await l(e,A.id,{feedbackText:g}),await d(e),n&&n(A,1,"primary")},appearance:r,title:A.primaryButtonTitle||"Submit"})))}return X.createElement(Jp,null,X.createElement(ne,{appearance:r}),X.createElement(Es,{appearance:r,className:fe(a("npsSurveyContainer",r),i),style:s},X.createElement(Ns,{onClick:async()=>{await d(e),t&&t()},className:a("npsSurveyDismissButton",r)},X.createElement(we,null)),u(e)==0&&H(),u(e)==1&&L()))};export{Ze as FormLabel,Yp as FrigadeBanner,Jo as FrigadeChecklist,Kp as FrigadeEmbeddedTip,Qr as FrigadeForm,Fp as FrigadeGuide,Sp as FrigadeHeroChecklist,Qp as FrigadeNPSSurvey,wp as FrigadeProgressBadge,ba as FrigadeProvider,Gp as FrigadeSupportWidget,_p as FrigadeTour,be as useFlowOpens,Ot as useFlowResponses,K as useFlows,Wo as useOrganization,Bo as useUser};
|
|
1559
1559
|
//# sourceMappingURL=index.mjs.map
|