@frigade/react 1.32.29 → 1.32.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +113 -113
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +110 -110
- 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 ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import{ThemeProvider as Sa}from"styled-components";import dt,{useContext as ha,useEffect as ho,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.29 ";var Ce="https://api.frigade.com/v1/public/",ke="NOT_STARTED_STEP",Q="COMPLETED_FLOW",Zt="ABORTED_FLOW",nt="STARTED_FLOW",Ne="NOT_STARTED_FLOW",Ee="COMPLETED_STEP",Rt="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 xt(){let{shouldGracefullyDegrade:e}=Io.useContext(G);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),Qt();let n;try{n=await fetch(t,o)}catch(r){return Qt(r)}return n?n.ok?n:Qt(n.statusText):Qt()}}function Qt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Ct(){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 $t(){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=xt();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===Rt?await m(S):S.actionType===Ee?await m(S):S.actionType===Zt?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}=Ct(),{addResponse:b,getFlowResponses:w}=$t(),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:Rt,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:Zt,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 St="guest_";function Bo(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:n,shouldGracefullyDegrade:r}=Ks(G),{config:i}=Le(),{mutateUserFlowState:s}=Pe(),p=xt(),{verifySDKInitiated:d}=Ct();qs(()=>{if(e&&!t){if(e.startsWith(St))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 to from"styled-components";import Ys from"react";import Xs from"styled-components";var ar="fr-",Mt="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+" "+Mt+e}return o}function F(e){if(!e.className||e.className.indexOf(Mt)!==-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 ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import{ThemeProvider as Sa}from"styled-components";import dt,{useContext as ha,useEffect as xo,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.30 ";var Ce="https://api.frigade.com/v1/public/",ke="NOT_STARTED_STEP",Q="COMPLETED_FLOW",Rt="ABORTED_FLOW",nt="STARTED_FLOW",Ne="NOT_STARTED_FLOW",Ee="COMPLETED_STEP",eo="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 Ct(){let{shouldGracefullyDegrade:e}=Io.useContext(G);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),Zt();let n;try{n=await fetch(t,o)}catch(r){return Zt(r)}return n?n.ok?n:Zt(n.statusText):Zt()}}function Zt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function St(){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 Mt(){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=Ct();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===eo?await m(S):S.actionType===Ee?await m(S):S.actionType===Rt?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}=St(),{addResponse:b,getFlowResponses:w}=Mt(),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 ie=st(async(x,y,E)=>{m();let I={foreignUserId:n,flowSlug:x,stepId:y,actionType:eo,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]),ne=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:Rt,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:ie,markStepCompleted:_,markFlowNotStarted:ee,markFlowStarted:ne,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 yt="guest_";function Bo(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:n,shouldGracefullyDegrade:r}=Ks(G),{config:i}=Le(),{mutateUserFlowState:s}=Pe(),p=Ct(),{verifySDKInitiated:d}=St();qs(()=>{if(e&&!t){if(e.startsWith(yt))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 oo from"styled-components";import Ys from"react";import Xs from"styled-components";var ar="fr-",Ut="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+" "+Ut+e}return o}function F(e){if(!e.className||e.className.indexOf(Ut)!==-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,11 +23,11 @@ import ct,{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:a("modalBackground",t),onClick:()=>e()});import
|
|
26
|
+
`,dr=({onClose:e,appearance:t})=>Ys.createElement(Js,{className:a("modalBackground",t),onClick:()=>e()});import to from"react";import Qs from"styled-components";var Zs=Qs.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
|
-
`,we=()=>
|
|
30
|
+
`,we=()=>to.createElement(Zs,null,to.createElement("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},to.createElement("rect",{y:"1.39844",width:"1.97669",height:"17.8213",rx:"0.988346",transform:"rotate(-45 0 1.39844)",fill:"currentColor"}),to.createElement("rect",{x:"12.6023",width:"1.97669",height:"17.8213",rx:"0.988346",transform:"rotate(45 12.6023 0)",fill:"currentColor"})));import{Portal as el}from"react-portal";var tl=oo.div`
|
|
31
31
|
${e=>F(e)} {
|
|
32
32
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
33
33
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -71,10 +71,10 @@ import ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
71
71
|
opacity: 1;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
`,ol=
|
|
74
|
+
`,ol=oo.div`
|
|
75
75
|
position: relative;
|
|
76
76
|
flex: 0 1 auto;
|
|
77
|
-
`,rl=
|
|
77
|
+
`,rl=oo.div`
|
|
78
78
|
position: absolute;
|
|
79
79
|
top: 24px;
|
|
80
80
|
right: 24px;
|
|
@@ -84,14 +84,14 @@ import ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
84
84
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
85
85
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
86
86
|
}
|
|
87
|
-
`,il=
|
|
87
|
+
`,il=oo.div`
|
|
88
88
|
overflow: scroll;
|
|
89
89
|
flex: 1 1;
|
|
90
90
|
display: flex;
|
|
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: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
|
|
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 ro from"styled-components";import{Portal as sl}from"react-portal";var ll=ro.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}};
|
|
@@ -109,10 +109,10 @@ import ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
109
109
|
bottom: 0;
|
|
110
110
|
margin-right: 28px;
|
|
111
111
|
margin-bottom: 28px;
|
|
112
|
-
`,al=
|
|
112
|
+
`,al=ro.div`
|
|
113
113
|
position: relative;
|
|
114
114
|
flex: 1;
|
|
115
|
-
`,pl=
|
|
115
|
+
`,pl=ro.div`
|
|
116
116
|
position: absolute;
|
|
117
117
|
top: 24px;
|
|
118
118
|
right: 24px;
|
|
@@ -122,13 +122,13 @@ import ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
122
122
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
123
123
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
124
124
|
}
|
|
125
|
-
`,dl=
|
|
125
|
+
`,dl=ro.div`
|
|
126
126
|
overflow: scroll;
|
|
127
127
|
flex: 5;
|
|
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: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
|
|
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 co,{useEffect as wl,useState as vr}from"react";import Er from"styled-components";import so,{useEffect as ml,useState as hr}from"react";import Lo from"styled-components";import io from"styled-components";var mr=io.label`
|
|
132
132
|
${e=>F(e)} {
|
|
133
133
|
font-size: 14px;
|
|
134
134
|
line-height: 20px;
|
|
@@ -136,14 +136,14 @@ import ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
136
136
|
margin-top: 10px;
|
|
137
137
|
}
|
|
138
138
|
display: flex;
|
|
139
|
-
`,ur=
|
|
139
|
+
`,ur=io.label`
|
|
140
140
|
${e=>F(e)} {
|
|
141
141
|
font-size: 12px;
|
|
142
142
|
line-height: 20px;
|
|
143
143
|
margin-bottom: 5px;
|
|
144
144
|
}
|
|
145
145
|
display: flex;
|
|
146
|
-
`,fr=
|
|
146
|
+
`,fr=io.span`
|
|
147
147
|
font-weight: 400;
|
|
148
148
|
font-size: 14px;
|
|
149
149
|
line-height: 22px;
|
|
@@ -151,12 +151,12 @@ import ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
151
151
|
display: flex;
|
|
152
152
|
margin-right: 5px;
|
|
153
153
|
margin-top: 10px;
|
|
154
|
-
`,io
|
|
154
|
+
`,no=io.div`
|
|
155
155
|
display: flex;
|
|
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(
|
|
159
|
+
`;import No from"react";function Ze({title:e,required:t,appearance:o}){return No.createElement(no,null,t?No.createElement(fr,null,"*"):null,No.createElement(mr,{className:a("formLabel",o)},e))}import gr from"react";function bt({title:e,appearance:t}){return e?gr.createElement(no,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 ct,{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,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
|
|
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 so.createElement(ul,null,so.createElement(Ze,{title:i.title,required:i.required,appearance:t.appearance}),so.createElement(u,{className:a("inputComponent",t.appearance),value:s,onChange:b=>{c(b.target.value)},appearance:t.appearance,placeholder:i.placeholder,type:m()}),so.createElement(bt,{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 ct,{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
|
-
`,
|
|
225
|
+
`,lo="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(lo);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===lo?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:lo,value:lo},"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(bt,{title:i.subtitle,appearance:t.appearance}))}import ao,{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 ct,{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 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]),
|
|
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]),ao.createElement(xl,null,ao.createElement(Ze,{title:r.title,required:r.required,appearance:t.appearance}),(l=r.props.options)==null?void 0:l.map(u=>ao.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)),ao.createElement(bt,{title:r.subtitle,appearance:t.appearance}))}import po 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 ct,{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
|
|
272
|
+
`;function ge({appearance:e,title:t,subtitle:o,size:n="medium"}){return po.createElement(po.Fragment,null,po.createElement(yl,{appearance:e,className:a(`${n}Title`,e),dangerouslySetInnerHTML:pe(t),size:n}),o&&po.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,19 +278,19 @@ import ct,{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 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
|
|
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 co.createElement(Fl,{className:a("multiInput",r)},co.createElement(ge,{appearance:r,title:e.title,subtitle:e.subtitle}),co.createElement(Tl,{className:a("multiInputContainer",r)},(S=s.data)==null?void 0:S.map(f=>c[f.type]?co.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 wt from"styled-components";var Br=wt.div`
|
|
282
282
|
align-items: center;
|
|
283
283
|
display: flex;
|
|
284
284
|
justify-content: space-between;
|
|
285
285
|
padding-top: 14px;
|
|
286
|
-
`,Ar=
|
|
286
|
+
`,Ar=wt.div`
|
|
287
287
|
display: flex;
|
|
288
288
|
gap: 12px;
|
|
289
|
-
`,Nr=
|
|
289
|
+
`,Nr=wt.div`
|
|
290
290
|
display: flex;
|
|
291
291
|
flex-direction: row;
|
|
292
292
|
flex: 1 1;
|
|
293
|
-
`,Lr=
|
|
293
|
+
`,Lr=wt.div`
|
|
294
294
|
display: flex;
|
|
295
295
|
// If type is set to large-modal, use padding 60px horizontal, 80px vertical
|
|
296
296
|
// Otherwise, use 4px padding
|
|
@@ -298,11 +298,11 @@ import ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
298
298
|
flex-grow: 1;
|
|
299
299
|
flex-basis: 0;
|
|
300
300
|
position: relative;
|
|
301
|
-
`,Or=
|
|
301
|
+
`,Or=wt.div`
|
|
302
302
|
padding: ${e=>e.type==="large-modal"?"50px":"0px"};
|
|
303
303
|
position: relative;
|
|
304
304
|
overflow-y: auto;
|
|
305
|
-
`,Dr=
|
|
305
|
+
`,Dr=wt.div`
|
|
306
306
|
display: flex;
|
|
307
307
|
align-self: stretch;
|
|
308
308
|
flex-grow: 1;
|
|
@@ -314,7 +314,7 @@ import ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
314
314
|
background-position: center;
|
|
315
315
|
border-top-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
316
316
|
border-bottom-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
317
|
-
`;import
|
|
317
|
+
`;import _t from"react";import Pl from"react";import $r from"styled-components";var vl=$r.button`
|
|
318
318
|
justify-content: center;
|
|
319
319
|
align-content: center;
|
|
320
320
|
${e=>F(e)} {
|
|
@@ -344,7 +344,7 @@ import ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
344
344
|
opacity: 0.3;
|
|
345
345
|
cursor: not-allowed;
|
|
346
346
|
}
|
|
347
|
-
`,
|
|
347
|
+
`,mo=$r.div`
|
|
348
348
|
${e=>F(e)} {
|
|
349
349
|
display: flex;
|
|
350
350
|
flex-direction: row;
|
|
@@ -354,14 +354,14 @@ import ct,{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: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
|
|
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
|
-
`,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
|
|
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 Tt from"styled-components";import{useContext as Bl}from"react";function re(){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=Tt.div`
|
|
360
360
|
display: flex;
|
|
361
361
|
flex-wrap: wrap;
|
|
362
362
|
align-content: center;
|
|
363
363
|
justify-content: center;
|
|
364
|
-
`,Nl=
|
|
364
|
+
`,Nl=Tt.div`
|
|
365
365
|
align-content: center;
|
|
366
366
|
align-items: center;
|
|
367
367
|
display: flex;
|
|
@@ -375,10 +375,10 @@ import ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
375
375
|
flex-basis: 255px;
|
|
376
376
|
flex-grow: 0;
|
|
377
377
|
flex-shrink: 0;
|
|
378
|
-
`,Ll=
|
|
378
|
+
`,Ll=Tt.img`
|
|
379
379
|
width: 78px;
|
|
380
380
|
height: auto;
|
|
381
|
-
`,Ol=
|
|
381
|
+
`,Ol=Tt.button`
|
|
382
382
|
font-style: normal;
|
|
383
383
|
font-weight: 600;
|
|
384
384
|
font-size: 13px;
|
|
@@ -391,11 +391,11 @@ import ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
391
391
|
border-radius: 100px;
|
|
392
392
|
padding: 8px 12px;
|
|
393
393
|
margin-top: 16px;
|
|
394
|
-
`,Dl=
|
|
394
|
+
`,Dl=Tt.h1`
|
|
395
395
|
font-weight: 700;
|
|
396
396
|
font-size: 28px;
|
|
397
397
|
line-height: 34px;
|
|
398
|
-
`,$l=
|
|
398
|
+
`,$l=Tt.h2`
|
|
399
399
|
font-style: normal;
|
|
400
400
|
font-weight: 400;
|
|
401
401
|
font-size: 16px;
|
|
@@ -404,7 +404,7 @@ import ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
404
404
|
margin-top: 12px;
|
|
405
405
|
margin-bottom: 16px;
|
|
406
406
|
max-width: 70%;
|
|
407
|
-
`;function _r({stepData:e,appearance:t}){var n,r;let{handleUrl:o}=
|
|
407
|
+
`;function _r({stepData:e,appearance:t}){var n,r;let{handleUrl:o}=re();return at.createElement("div",null,at.createElement(Dl,null,e.title),at.createElement($l,null,e.subtitle),at.createElement(Al,null,(r=(n=e.props)==null?void 0:n.links)==null?void 0:r.map(i=>at.createElement(Nl,{key:i.title},at.createElement(Ll,{src:i.imageUri}),at.createElement(Ol,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{i.uri&&o(i.uri,i.uriTarget??"_blank")}},i.title)))))}import kt,{useEffect as jl}from"react";import go from"styled-components";import $o from"react";var uo=({style:e,className:t})=>$o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:t,style:e},$o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),$o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.91 11.672a.375.375 0 010 .656l-5.603 3.113a.375.375 0 01-.557-.328V8.887c0-.286.307-.466.557-.327l5.603 3.112z"}));import Wt,{useRef as Ml,useState as Ul}from"react";import fo from"styled-components";var _l=fo.div`
|
|
408
408
|
display: flex;
|
|
409
409
|
align-items: center;
|
|
410
410
|
justify-content: flex-start;
|
|
@@ -412,7 +412,7 @@ import ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
412
412
|
width: 100%;
|
|
413
413
|
height: 100%;
|
|
414
414
|
position: relative;
|
|
415
|
-
`,Wl=
|
|
415
|
+
`,Wl=fo.div`
|
|
416
416
|
position: absolute;
|
|
417
417
|
display: flex;
|
|
418
418
|
align-items: center;
|
|
@@ -431,43 +431,43 @@ import ct,{createContext as Ca,useEffect as Ho,useState as ve}from"react";import
|
|
|
431
431
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
432
432
|
border-radius: 50%;
|
|
433
433
|
}
|
|
434
|
-
`,zl=
|
|
434
|
+
`,zl=fo.video`
|
|
435
435
|
width: 100%;
|
|
436
436
|
height: 100%;
|
|
437
437
|
min-height: 200px;
|
|
438
438
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
439
|
-
`,Hl=
|
|
439
|
+
`,Hl=fo.iframe`
|
|
440
440
|
width: 100%;
|
|
441
441
|
height: 100%;
|
|
442
442
|
min-height: 200px;
|
|
443
443
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
444
|
-
`;function
|
|
444
|
+
`;function Ft({appearance:e,videoUri:t}){let o=Ml(),[n,r]=Ul(!1);if(t.includes("youtube")){let i=t.split("v=")[1],s=i.indexOf("&");return s!==-1&&(i=i.substring(0,s)),Wt.createElement(Hl,{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${i}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,appearance:e})}return Wt.createElement(_l,{appearance:e},!n&&Wt.createElement(Wl,{onClick:()=>{r(!0),o.current.play()},appearance:e},Wt.createElement(uo,null)),Wt.createElement(zl,{appearance:e,controls:n,ref:o,play:n,src:t}))}var Gl=go.div`
|
|
445
445
|
${e=>F(e)} {
|
|
446
446
|
display: flex;
|
|
447
447
|
flex-direction: column;
|
|
448
448
|
justify-content: center;
|
|
449
449
|
}
|
|
450
|
-
`,Vl=
|
|
450
|
+
`,Vl=go.img`
|
|
451
451
|
${e=>F(e)} {
|
|
452
452
|
width: 100%;
|
|
453
453
|
height: auto;
|
|
454
454
|
max-height: 250px;
|
|
455
455
|
margin-bottom: 24px;
|
|
456
456
|
}
|
|
457
|
-
`,Kl=
|
|
457
|
+
`,Kl=go.div`
|
|
458
458
|
${e=>F(e)} {
|
|
459
459
|
margin-bottom: 24px;
|
|
460
460
|
}
|
|
461
|
-
`,ql=
|
|
461
|
+
`,ql=go.div`
|
|
462
462
|
${e=>F(e)} {
|
|
463
463
|
width: 100%;
|
|
464
464
|
height: auto;
|
|
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)},[]),
|
|
468
|
+
`;function Wr({stepData:e,appearance:t,setCanContinue:o}){return jl(()=>{o(!0)},[]),kt.createElement(Gl,{className:a("callToActionContainer",t)},kt.createElement(Kl,{className:a("callToActionTextContainer",t)},kt.createElement(ge,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&kt.createElement(Vl,{className:a("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&kt.createElement(ql,{appearance:t,className:a("callToActionVideo",t)},kt.createElement(Ft,{appearance:t,videoUri:e.videoUri})))}import Ge,{useEffect as Mo,useState as Uo}from"react";import Ht from"react";import zt 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 zt.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",className:i,style:s})=>zt.createElement("svg",{style:s,className:i,width:t,height:t,overflow:"visible"},zt.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},zt.createElement(zr,{color:r,size:t}),zt.createElement(zr,{color:e,percentage:o,size:t})),n),Pt=Xl;var vt={theme:{colorPrimary:"#000000",colorText:"#000000",colorBackground:"#ffffff",colorBackgroundSecondary:"#d2d2d2",colorTextOnPrimaryBackground:"#ffffff",colorTextSecondary:"#505050",colorTextDisabled:"#999999",colorBorder:"#E5E5E5",borderRadius:20}};import Jl from"styled-components";var Ql=({color:e="#FFFFFF"})=>Ht.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ht.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
|
-
`,pt=({value:e,type:t="square",primaryColor:o="#000000",progress:n,appearance:r=
|
|
470
|
+
`,pt=({value:e,type:t="square",primaryColor:o="#000000",progress:n,appearance:r=vt,style:i,className:s})=>{let p=ia(t),d=na(t,e);return e===!0?p={...p,...d,backgroundColor:o,borderColor:t==="square"?o:"none"}:p={...p,...d},e!==!0&&t==="round"&&n!==void 0&&n!==1?Ht.createElement(Pt,{fillColor:o,percentage:n,size:22}):Ht.createElement(sa,{styleOverrides:p,style:i,role:"checkbox",className:fe(a("checkIconContainer",r),a(e?"checkIconContainerChecked":"checkIconContainerUnchecked",r),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&Ht.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 ct,{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),[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(pt,{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),
|
|
524
|
-
${n=>n.inlineStyles.map(([r,i])=>`.${
|
|
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(pt,{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),ho=({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}=re(),[g,h]=_o(!1),[C,v]=_o({}),[U,$]=_o(!1),W=t[o]??null,{markStepCompleted:A,markStepStarted:H,isLoading:L,updateCustomVariables:z,markFlowCompleted:ie}=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 ne(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 ie(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(ne,{selectedStep:t[o]})))};import jt from"react";import{createGlobalStyle as ca}from"styled-components";function oe({appearance:e}){if(!e||!e.styleOverrides)return jt.createElement(jt.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([n,r])=>typeof r=="object");if(t.length===0)return jt.createElement(jt.Fragment,null);let o=ca`
|
|
524
|
+
${n=>n.inlineStyles.map(([r,i])=>`.${Ut}${r}.${Ut}${r} { ${Object.entries(i).map(([s,p])=>`${Ao(s)}: ${p};`).join(" ")} }`).join(" ")}`;return jt.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:ie}=be();d=A(d);let[V,_]=n!==void 0&&r!==void 0?[n,r]:[ie(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 ne=P(e);if(!ne||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(oe,{appearance:d}),De.createElement(ho,{appearance:d,steps:ne,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(oe,{appearance:d}),De.createElement(ho,{appearance:d,steps:ne,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(oe,{appearance:d}),De.createElement(ho,{appearance:d,steps:ne,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=Ct(),{verifySDKInitiated:s}=St();ga(()=>{if(t&&e){if(t.startsWith(yt))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}=Mt(),{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();xo(()=>{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]),xo(()=>{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=yt+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)}}xo(()=>{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]),xo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(yt))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 dt.createElement(dt.Fragment,null,b.map(g=>d(g.slug)!==Ne?null:dt.createElement("span",{key:g.slug},dt.createElement(Zr,{flowId:g.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return dt.createElement(dt.Fragment,null,dt.createElement(P,null))};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:vt,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{}}),ba=({publicApiKey:e,userId:t,organizationId:o,config:n,children:r})=>{var ie,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:{...vt.theme,...((ie=n==null?void 0:n.defaultAppearance)==null?void 0:ie.theme)??{}},styleOverrides:{...vt.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?ct.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):ct.createElement(ya,{fallback:ct.createElement(ct.Fragment,null,r)},ct.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}},ct.createElement(Sa,{theme:L.theme},r,ct.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 ft from"styled-components";import yo from"react";import mt 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,24 +538,24 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${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})=>
|
|
541
|
+
`,Co=({label:e,value:t,labelStyle:o={},labelPosition:n="right",style:r,primaryColor:i="#000000",checkBoxType:s="square",appearance:p})=>mt.createElement(mt.Fragment,null,mt.createElement(wa,{className:a("checklistStepsContainer",p),appearance:p,style:{...r}},n==="left"&&e&&mt.createElement(ri,{className:a("checklistStepLabel",p),style:o},e),mt.createElement(pt,{appearance:p,value:t,type:s,primaryColor:i}),n==="right"&&e&&mt.createElement(ri,{className:a("checklistStepLabel",p),style:o},e)),mt.createElement(oe,{appearance:p}));import{motion as Ta}from"framer-motion";import Gt from"styled-components";var ni=Gt.div`
|
|
542
542
|
font-weight: 700;
|
|
543
543
|
font-size: 18px;
|
|
544
544
|
line-height: 22px;
|
|
545
|
-
`,si=
|
|
545
|
+
`,si=Gt.p`
|
|
546
546
|
font-weight: 700;
|
|
547
547
|
font-size: 18px;
|
|
548
548
|
line-height: 22px;
|
|
549
549
|
margin: 20px 0px 0px 0px;
|
|
550
550
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
551
|
-
`,li=
|
|
551
|
+
`,li=Gt.p`
|
|
552
552
|
font-weight: 400;
|
|
553
553
|
font-size: 15px;
|
|
554
554
|
line-height: 28px;
|
|
555
555
|
max-width: 540px;
|
|
556
556
|
margin: 8px 0px 0px 0px;
|
|
557
557
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
558
|
-
`,So=
|
|
558
|
+
`,So=Gt.div`
|
|
559
559
|
width: 4px;
|
|
560
560
|
position: absolute;
|
|
561
561
|
left: 0;
|
|
@@ -563,10 +563,10 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
563
563
|
height: 80%;
|
|
564
564
|
border-top-right-radius: 8px;
|
|
565
565
|
border-bottom-right-radius: 8px;
|
|
566
|
-
`,ai=
|
|
566
|
+
`,ai=Gt.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: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
|
|
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 ut 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,13 +585,13 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${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 w,S;if(t===0)return
|
|
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 ut.createElement(ut.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"),ut.createElement(Pa,{className:a("progressBarContainer",d),textLocation:i,styleOverrides:s},ut.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),ut.createElement(va,{textLocation:i,className:a("progressBar",d)},ut.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)}),ut.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 Kt from"react";import Aa from"styled-components";import wo from"react";import bo from"react";var Et=({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 Vt from"react";var It=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},n=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return Vt.createElement(Vt.Fragment,null,Vt.createElement(mo,null,e.secondaryButtonTitle&&Vt.createElement(Z,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:n,style:{width:"auto",marginRight:"12px"}}),Vt.createElement(Z,{appearance:t,title:e.primaryButtonTitle,onClick:o})))};var Bt=({stepData:e,appearance:t})=>wo.createElement(wo.Fragment,null,wo.createElement(Et,{stepData:e,appearance:t}),wo.createElement(It,{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
|
|
592
|
+
`,mi=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return Kt.createElement("div",null,o)}return Kt.createElement(ni,{className:a("checklistStepContent",t)},e.imageUri?Kt.createElement(Na,{className:a("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Kt.createElement(ci,{videoUri:e.videoUri,appearance:t}):null,Kt.createElement(Bt,{stepData:e,appearance:t}))};import Te,{useRef as La,useState as Oa}from"react";import At from"styled-components";var ui=At.div`
|
|
593
593
|
display: block;
|
|
594
|
-
`,Da=
|
|
594
|
+
`,Da=At.div`
|
|
595
595
|
display: flex;
|
|
596
596
|
flex-direction: row;
|
|
597
597
|
flex-wrap: wrap;
|
|
@@ -601,20 +601,20 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
601
601
|
align-content: center;
|
|
602
602
|
margin-top: 24px;
|
|
603
603
|
margin-bottom: 24px;
|
|
604
|
-
`,$a=
|
|
604
|
+
`,$a=At.div`
|
|
605
605
|
display: flex;
|
|
606
606
|
align-items: center;
|
|
607
607
|
justify-content: flex-start;
|
|
608
608
|
flex-direction: column;
|
|
609
609
|
margin-right: 16px;
|
|
610
|
-
`,Ma=
|
|
610
|
+
`,Ma=At.video`
|
|
611
611
|
width: 200px;
|
|
612
612
|
height: 120px;
|
|
613
|
-
`,Ua=
|
|
613
|
+
`,Ua=At.div`
|
|
614
614
|
font-size: 14px;
|
|
615
615
|
line-height: 20px;
|
|
616
616
|
text-align: center;
|
|
617
|
-
`,_a=
|
|
617
|
+
`,_a=At.div`
|
|
618
618
|
position: absolute;
|
|
619
619
|
width: 200px;
|
|
620
620
|
height: 120px;
|
|
@@ -634,7 +634,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
634
634
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
635
635
|
border-radius: 50%;
|
|
636
636
|
}
|
|
637
|
-
`,fi="videoCarousel",gi=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return Te.createElement(ui,null,Te.createElement(
|
|
637
|
+
`,fi="videoCarousel",gi=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return Te.createElement(ui,null,Te.createElement(Bt,{stepData:e,appearance:t}));function o({video:i}){let s=La(),[p,d]=Oa(!1);return Te.createElement($a,null,!p&&Te.createElement(_a,{onClick:()=>{d(!0),s.current.play()},appearance:t},Te.createElement(uo,null)),Te.createElement(Ma,{controls:p,ref:s,play:p,src:i.uri}),Te.createElement(Ua,null,i.title))}let n=e.props;return n.videos?Te.createElement(ui,null,Te.createElement(Et,{stepData:e,appearance:t}),Te.createElement(Da,null,n.videos.map((i,s)=>Te.createElement("span",{key:`${i.uri}-${s}`},Te.createElement(o,{video:i})))),Te.createElement(It,{stepData:e,appearance:t})):null};import Ve from"react";import To from"styled-components";var hi=To.div`
|
|
638
638
|
display: block;
|
|
639
639
|
`,Wa=To.pre`
|
|
640
640
|
display: block;
|
|
@@ -659,40 +659,40 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
659
659
|
margin-top: 12px;
|
|
660
660
|
`,Ha=To.div`
|
|
661
661
|
margin-top: 24px;
|
|
662
|
-
`,xi="codeSnippet",Ci=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.codeSnippets))return Ve.createElement(hi,null,Ve.createElement(
|
|
662
|
+
`,xi="codeSnippet",Ci=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.codeSnippets))return Ve.createElement(hi,null,Ve.createElement(Bt,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?Ve.createElement(hi,null,Ve.createElement(Et,{stepData:e,appearance:t}),Ve.createElement(Ha,null,o.codeSnippets.map((r,i)=>Ve.createElement("div",{key:i},r.title?Ve.createElement(za,null,r.title):null,r.code?Ve.createElement(Wa,null,r.code):null))),Ve.createElement(It,{stepData:e,appearance:t})):null};var Ga=ft.div`
|
|
663
663
|
display: flex;
|
|
664
664
|
flex-direction: row;
|
|
665
665
|
min-width: ${e=>e.type!="modal"?"1000px":"100%"};
|
|
666
666
|
background: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
667
667
|
box-shadow: ${e=>e.type!="modal"?"0px 6px 25px rgba(0, 0, 0, 0.06)":"none"};
|
|
668
668
|
border-radius: 8px;
|
|
669
|
-
`,Va=
|
|
669
|
+
`,Va=ft.h1`
|
|
670
670
|
font-size: 24px;
|
|
671
671
|
font-weight: 600;
|
|
672
672
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
673
|
-
`,Ka=
|
|
673
|
+
`,Ka=ft.h2`
|
|
674
674
|
font-size: 15px;
|
|
675
675
|
line-height: 20px;
|
|
676
676
|
color: ${e=>{var t,o;return((o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary)??"#4d4d4d"}};
|
|
677
677
|
margin: 10px 0px 0px 0px;
|
|
678
|
-
`,Si=
|
|
678
|
+
`,Si=ft.div`
|
|
679
679
|
padding-bottom: 16px;
|
|
680
|
-
`,qa=
|
|
680
|
+
`,qa=ft.div`
|
|
681
681
|
list-style: none;
|
|
682
682
|
padding: 0;
|
|
683
683
|
margin: 0;
|
|
684
684
|
cursor: pointer;
|
|
685
685
|
width: 300px;
|
|
686
|
-
`,Ya=
|
|
686
|
+
`,Ya=ft.div`
|
|
687
687
|
width: 1px;
|
|
688
688
|
margin: 40px;
|
|
689
689
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
690
|
-
`,Xa=
|
|
690
|
+
`,Xa=ft.div`
|
|
691
691
|
flex: 2;
|
|
692
692
|
padding: 2rem;
|
|
693
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
|
+
`,Nt=({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;
|
|
697
697
|
padding-bottom: 40px;
|
|
698
698
|
`,wi=de.div`
|
|
@@ -905,7 +905,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${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}=
|
|
908
|
+
`;var tp=({steps:e,style:t,title:o,primaryColor:n,appearance:r,onButtonClick:i})=>{let{primaryCTAClickSideEffects:s}=re();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)))))},qt=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(pt,{value:h.complete,type:"round",primaryColor:l.theme.colorPrimary,progress:h.progress,appearance:l}),O.createElement(_i,null,O.createElement(Nt,{style:{marginLeft:"10px"},color:l.theme.colorBackgroundSecondary}))))})),O.createElement(P,null))),u&&u.length>0&&O.createElement(qt,{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}};
|
|
@@ -942,7 +942,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
942
942
|
:hover {
|
|
943
943
|
opacity: 0.8;
|
|
944
944
|
}
|
|
945
|
-
`,
|
|
945
|
+
`,vh=Ye.div``,on=Ye.p`
|
|
946
946
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
947
947
|
font-weight: 400;
|
|
948
948
|
font-size: 14px;
|
|
@@ -952,7 +952,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${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,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(
|
|
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(Ft,{appearance:i,videoUri:e.videoUri}):null):null,ce.createElement(on,{className:a("stepSubtitle",i),appearance:i,dangerouslySetInnerHTML:pe(e.subtitle)}),ce.createElement(mo,{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(Nt,{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 Lt from"styled-components";var zh=Lt.div`
|
|
956
956
|
background: #ffffff;
|
|
957
957
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
958
958
|
border-radius: 6px;
|
|
@@ -966,33 +966,33 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
966
966
|
|
|
967
967
|
max-width: 800px;
|
|
968
968
|
min-width: 350px;
|
|
969
|
-
`,sn=
|
|
969
|
+
`,sn=Lt.div`
|
|
970
970
|
display: flex;
|
|
971
971
|
flex-direction: column;
|
|
972
|
-
`,ln=
|
|
972
|
+
`,ln=Lt.h1`
|
|
973
973
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
974
974
|
font-style: normal;
|
|
975
975
|
font-weight: 700;
|
|
976
976
|
font-size: 20px;
|
|
977
977
|
line-height: 24px;
|
|
978
978
|
margin-bottom: 8px;
|
|
979
|
-
`,an=
|
|
979
|
+
`,an=Lt.h2`
|
|
980
980
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
981
981
|
font-weight: 400;
|
|
982
982
|
font-size: 14px;
|
|
983
983
|
line-height: 23px;
|
|
984
984
|
margin: 2px 0 0 0;
|
|
985
|
-
`,pn=
|
|
985
|
+
`,pn=Lt.div`
|
|
986
986
|
display: block;
|
|
987
987
|
width: 100%;
|
|
988
|
-
`,dn=
|
|
988
|
+
`,dn=Lt.div`
|
|
989
989
|
display: flex;
|
|
990
990
|
width: 100%;
|
|
991
991
|
flex-direction: column;
|
|
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: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
|
|
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 ht}from"react";import gt 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])=>`.${Mt}${r}.${Mt}${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}=
|
|
1130
|
+
`;var In=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:n}=Y(),{primaryCTAClickSideEffects:r}=re(),{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 gt.createElement(yn,{className:a("carouselCard",o),onClick:c?null:m,style:t,blocked:c,complete:u},gt.createElement("div",{style:{alignItems:"flex-start",display:"flex",justifyContent:"space-between"}},p&>.createElement(bn,{className:a("carouselCardImage",o),src:p,alt:l,style:{opacity:u||c?.4:1}}),u&>.createElement(kn,{className:a("carouselCompletedPill",o)},gt.createElement(En,{style:{color:"#108E0B"}},"Complete"))),l&>.createElement(vn,{blocked:c,complete:u,className:a("carouselCardTitle",o)},l),d&>.createElement(Me.Quiet,{blocked:c,complete:u,className:a("carouselCardSubtitle",o)},d))};import Yt 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 Yt.createElement(Tn,{className:a("carouselProgressBar",o)},Yt.createElement(Fn,{as:Me.Loud,style:{marginRight:8}},e," of ",t),Yt.createElement("svg",{height:10,width:r},Yt.createElement("rect",{x:0,y:0,rx:5,width:r,height:10,fill:"#E6E6E6"}),Yt.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]=ht(!1),[i,s]=ht(!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]=ht(!1),[p,d]=ht(!1),[l,u]=ht(null),[c,m]=ht([]),[b,w]=ht(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,ie)=>Number(z.complete)-Number(ie.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:ie}=re(),{getOpenFlowState:V,setOpenFlowState:_}=be(),[ee,ne]=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);ne(I),M(!0)}function ze(){if(ee+1>=Fe.length){N&&_(e,!1);return}W(e,Fe[ee+1].id)||ne(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(),ie(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(oe,{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:ne,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:ne,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:ne,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])=>`.${Mt}${r}.${Mt}${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(
|
|
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(oe,{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(Pt,{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(Nt,{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 Xt from"styled-components";var Wn=Xt.div`
|
|
1158
1158
|
display: flex;
|
|
1159
1159
|
flex-direction: row;
|
|
1160
1160
|
width: 100%;
|
|
@@ -1165,25 +1165,25 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
1165
1165
|
border-width: 1px;
|
|
1166
1166
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1167
1167
|
border-radius: 12px;
|
|
1168
|
-
`,zn=
|
|
1168
|
+
`,zn=Xt.div`
|
|
1169
1169
|
${e=>F(e)} {
|
|
1170
1170
|
display: flex;
|
|
1171
1171
|
justify-content: center;
|
|
1172
1172
|
align-items: center;
|
|
1173
1173
|
margin-right: 16px;
|
|
1174
1174
|
}
|
|
1175
|
-
`,Hn=
|
|
1175
|
+
`,Hn=Xt.div`
|
|
1176
1176
|
display: flex;
|
|
1177
1177
|
flex-direction: column;
|
|
1178
1178
|
flex: 1;
|
|
1179
1179
|
margin-top: 0;
|
|
1180
|
-
`,jn=
|
|
1180
|
+
`,jn=Xt.div`
|
|
1181
1181
|
display: flex;
|
|
1182
1182
|
flex-direction: column;
|
|
1183
1183
|
justify-content: center;
|
|
1184
1184
|
margin-left: 16px;
|
|
1185
1185
|
min-width: 200px;
|
|
1186
|
-
`,
|
|
1186
|
+
`,rC=Xt.div`
|
|
1187
1187
|
display: flex;
|
|
1188
1188
|
justify-content: center;
|
|
1189
1189
|
align-items: flex-end;
|
|
@@ -1192,7 +1192,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${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(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(
|
|
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(oe,{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(oe,{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(qt,{steps:l,style:t,appearance:o,...n})};import Dt,{useContext as $p,useEffect as Mp}from"react";import D,{useEffect as ko,useLayoutEffect as ts,useRef as Ip,useState as Jt}from"react";import Qt 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
|
}
|
|
@@ -1258,7 +1258,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
1258
1258
|
color: #808080;
|
|
1259
1259
|
}
|
|
1260
1260
|
margin: 0;
|
|
1261
|
-
`;var os=300,rs=100,Bp=500,
|
|
1261
|
+
`;var os=300,rs=100,Bp=500,Ot=12,Ap=Qt.div`
|
|
1262
1262
|
width: 100%;
|
|
1263
1263
|
height: 100%;
|
|
1264
1264
|
border-radius: 9999px;
|
|
@@ -1281,25 +1281,25 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
1281
1281
|
opacity: 0;
|
|
1282
1282
|
}
|
|
1283
1283
|
}
|
|
1284
|
-
`,Np=
|
|
1285
|
-
width: ${
|
|
1286
|
-
height: ${
|
|
1284
|
+
`,Np=Qt.div`
|
|
1285
|
+
width: ${Ot}px;
|
|
1286
|
+
height: ${Ot}px;
|
|
1287
1287
|
border-radius: 100px;
|
|
1288
1288
|
background-color: ${e=>e.primaryColor};
|
|
1289
1289
|
z-index: 20;
|
|
1290
1290
|
opacity: 1;
|
|
1291
|
-
`,Lp=
|
|
1291
|
+
`,Lp=Qt.div`
|
|
1292
1292
|
pointer-events: all;
|
|
1293
|
-
`,is=
|
|
1293
|
+
`,is=Qt.div`
|
|
1294
1294
|
display: flex;
|
|
1295
1295
|
align-content: center;
|
|
1296
1296
|
justify-content: center;
|
|
1297
1297
|
align-items: center;
|
|
1298
1298
|
z-index: ${e=>e.zIndex?e.zIndex:90};
|
|
1299
|
-
`,Op=
|
|
1300
|
-
width: ${
|
|
1301
|
-
height: ${
|
|
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]=
|
|
1299
|
+
`,Op=Qt(is)`
|
|
1300
|
+
width: ${Ot+12}px;
|
|
1301
|
+
height: ${Ot+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: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]=Jt(),[T,B]=Jt(new Date),P=Ip(null),[g,h]=Jt(document.querySelector(e[l].selector)),C=Kn(g,T),[v,U]=Jt(),[$,W]=Jt(!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 ie=n==="auto"?"right":n,V=Qo(C,ie,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),ie="left");let ne=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,ne]),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(Ft,{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)-Ot,left:(ie=="left"?C.x+s.x:(V==null?void 0:V.x)-Ot)??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+(ie=="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}=re(),{hasOpenModals:H}=be(),L=g(e),{openFlowStates:z}=$p(G),{mergeAppearanceWithDefault:ie}=Y();if(o=ie(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 Dt.createElement(Dt.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 ne(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}),ne(N,"secondary",L)},handlePrimaryButtonClick:async()=>{(!N.completionCriteria&&(N.autoMarkCompleted||N.autoMarkCompleted===void 0)||N.completionCriteria&&N.autoMarkCompleted===!0)&&await ee(N),ne(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 Dt.createElement(Up,null,Dt.createElement(oe,{appearance:o}),i?_.map((N,q)=>Dt.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})):Dt.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 xt from"styled-components";var ns=xt.button`
|
|
1303
1303
|
${e=>F(e)} {
|
|
1304
1304
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1305
1305
|
|
|
@@ -1317,17 +1317,17 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
1317
1317
|
opacity: 0.8;
|
|
1318
1318
|
}
|
|
1319
1319
|
}
|
|
1320
|
-
`,ss=
|
|
1320
|
+
`,ss=xt.span`
|
|
1321
1321
|
${e=>F(e)} {
|
|
1322
1322
|
font-size: 12px;
|
|
1323
1323
|
display: inline-block;
|
|
1324
1324
|
}
|
|
1325
|
-
`,ls=
|
|
1325
|
+
`,ls=xt.span`
|
|
1326
1326
|
${e=>F(e)} {
|
|
1327
1327
|
font-size: 12px;
|
|
1328
1328
|
display: inline-block;
|
|
1329
1329
|
}
|
|
1330
|
-
`,as=
|
|
1330
|
+
`,as=xt.div`
|
|
1331
1331
|
position: fixed;
|
|
1332
1332
|
right: 0;
|
|
1333
1333
|
bottom: 0;
|
|
@@ -1337,7 +1337,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
1337
1337
|
flex-direction: column;
|
|
1338
1338
|
align-items: flex-end;
|
|
1339
1339
|
z-index: 50;
|
|
1340
|
-
`,ps=
|
|
1340
|
+
`,ps=xt.button`
|
|
1341
1341
|
${e=>F(e)} {
|
|
1342
1342
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1343
1343
|
background-color: #ffffff;
|
|
@@ -1353,7 +1353,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
1353
1353
|
0px 3px 6px -4px rgba(0, 0, 0, 0.12);
|
|
1354
1354
|
border-radius: 45px;
|
|
1355
1355
|
cursor: pointer;
|
|
1356
|
-
`,ds=
|
|
1356
|
+
`,ds=xt.div`
|
|
1357
1357
|
${e=>F(e)} {
|
|
1358
1358
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1359
1359
|
background: #ffffff;
|
|
@@ -1370,7 +1370,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
1370
1370
|
position: ${e=>e.type=="inline"?"absolute":"relative"};
|
|
1371
1371
|
top: ${e=>e.type=="inline"?"68px":0};
|
|
1372
1372
|
margin-left: ${e=>e.type=="inline"?"-127px":0};
|
|
1373
|
-
`,cs=
|
|
1373
|
+
`,cs=xt.button`
|
|
1374
1374
|
${e=>F(e)} {
|
|
1375
1375
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1376
1376
|
color: #434343;
|
|
@@ -1387,7 +1387,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${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:l,getStepStatus:u,getNumberOfStepsCompleted:c,isLoading:m,targetingLogicShouldHideFlow:b}=K(),{primaryCTAClickSideEffects:w}=
|
|
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}=re(),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])=>`.${Mt}${r}.${Mt}${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:l,markStepCompleted:u,isLoading:c,targetingLogicShouldHideFlow:m,updateCustomVariables:b,getFlowSteps:w,getFlowStatus:S,getCurrentStepIndex:f}=K(),{primaryCTAClickSideEffects:k}=
|
|
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}=re(),{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(oe,{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 $t from"styled-components";var ws=$t.div`
|
|
1427
1427
|
// use the :not annotation
|
|
1428
1428
|
${e=>F(e)} {
|
|
1429
1429
|
display: flex;
|
|
@@ -1437,24 +1437,24 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
1437
1437
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1438
1438
|
border-radius: 12px;
|
|
1439
1439
|
}
|
|
1440
|
-
`,Ts
|
|
1440
|
+
`,Ts=$t.div`
|
|
1441
1441
|
${e=>F(e)} {
|
|
1442
1442
|
display: flex;
|
|
1443
1443
|
width: 36px;
|
|
1444
1444
|
height: 36px;
|
|
1445
1445
|
}
|
|
1446
|
-
`,Fs
|
|
1446
|
+
`,Fs=$t.div`
|
|
1447
1447
|
display: flex;
|
|
1448
1448
|
flex-direction: column;
|
|
1449
1449
|
flex: 1;
|
|
1450
1450
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1451
1451
|
margin-top: ${e=>e.type==="square"?"12px":"0"};
|
|
1452
|
-
`,ks
|
|
1452
|
+
`,ks=$t.div`
|
|
1453
1453
|
display: flex;
|
|
1454
1454
|
flex-direction: column;
|
|
1455
1455
|
justify-content: center;
|
|
1456
1456
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1457
|
-
`,Zo
|
|
1457
|
+
`,Zo=$t.div`
|
|
1458
1458
|
display: flex;
|
|
1459
1459
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1460
1460
|
align-items: flex-end;
|
|
@@ -1463,12 +1463,12 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
1463
1463
|
:hover {
|
|
1464
1464
|
opacity: 0.8;
|
|
1465
1465
|
}
|
|
1466
|
-
`,Ro
|
|
1466
|
+
`,Ro=$t.div`
|
|
1467
1467
|
display: flex;
|
|
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:l,isLoading:u,targetingLogicShouldHideFlow:c,updateCustomVariables:m,getFlowMetadata:b,getFlowStatus:w,getFlowSteps:S,getCurrentStepIndex:f}=K(),{primaryCTAClickSideEffects:k}=
|
|
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}=re(),{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(oe,{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;
|
|
@@ -1527,7 +1527,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${r} { ${Object.entries(i).map
|
|
|
1527
1527
|
display: flex;
|
|
1528
1528
|
flex-direction: column;
|
|
1529
1529
|
flex: 1;
|
|
1530
|
-
`,
|
|
1530
|
+
`,gy=Xe.div`
|
|
1531
1531
|
display: flex;
|
|
1532
1532
|
flex-direction: column;
|
|
1533
1533
|
justify-content: center;
|
|
@@ -1555,5 +1555,5 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Mt}${r}.${Mt}${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:l,getNumberOfStepsCompleted:u,isLoading:c,targetingLogicShouldHideFlow:m,updateCustomVariables:b,getFlowSteps:w,getFlowStatus:S,getCurrentStepIndex:f}=K(),{primaryCTAClickSideEffects:k}=
|
|
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}=re(),{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(oe,{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{pt as CheckBox,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,Pt as ProgressRing,be as useFlowOpens,Mt as useFlowResponses,K as useFlows,Wo as useOrganization,Bo as useUser};
|
|
1559
1559
|
//# sourceMappingURL=index.mjs.map
|