@frigade/react 1.32.39 → 1.32.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -1
- package/lib/index.js +68 -68
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +64 -64
- 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 ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import{ThemeProvider as Pa}from"styled-components";import mt,{useContext as Ta,useEffect as bo,useState as Ko}from"react";import{useCallback as at,useContext as Js,useEffect as Qs}from"react";import No,{useMemo as Us}from"react";var pr="1.32.39 ";var Te="https://api.frigade.com/v1/public/",Ie="NOT_STARTED_STEP",q="COMPLETED_FLOW",ro="ABORTED_FLOW",lt="STARTED_FLOW",Ne="NOT_STARTED_FLOW",Le="COMPLETED_STEP",io="STARTED_STEP";function De(){let{publicApiKey:e,userId:t}=No.useContext(V);return{config:Us(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":pr,"X-Frigade-SDK-Platform":"React"}}),[e,t])}}var _s="frigade-last-call-at-",Ws="frigade-last-call-data-";function yt(){let{shouldGracefullyDegrade:e}=No.useContext(V);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),_t();let n=_s+t,r=Ws+t;if(window&&window.localStorage&&o&&o.body&&o.method==="POST"){let s=window.localStorage.getItem(n),p=window.localStorage.getItem(r);if(s&&p&&p==o.body){let d=new Date(s);if(new Date().getTime()-d.getTime()<1e3)return _t()}window.localStorage.setItem(n,new Date().toISOString()),window.localStorage.setItem(r,o.body)}let i;try{i=await fetch(t,o)}catch(s){return _t(s)}return i?i.ok?i:_t(i.statusText):_t()}}function _t(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function bt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=No.useContext(V);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 qs,useState as dr}from"react";import{useContext as Hs,useEffect as Gs,useState as js}from"react";import Vs from"swr";import{useContext as zs}from"react";function Pe(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:n,completedFlowsToKeepOpenDuringSession:r}=zs(V);function i(c,f=!1){return e[c]??f}function s(c,f){t(w=>({...w,[c]:f}))}function p(c){t(f=>{let{[c]:w,...T}=f;return{...T}})}function d(c){r.includes(c)||n(f=>[...f,c])}function a(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:a}}var Ks="unknown";function Ae(){let{config:e}=De(),{publicApiKey:t,userId:o,flows:n,setShouldGracefullyDegrade:r}=Hs(V),{resetOpenFlowState:i}=Pe(),[s,p]=js(!1),d={data:n.map(F=>({flowId:F.id,flowState:q,lastStepId:null,userId:o,foreignUserId:o,stepStates:{},shouldTrigger:!1}))},a=F=>fetch(F,e).then(x=>{if(x.ok)return x.json();throw new Error("Failed to fetch user flow states")}).catch(x=>(console.log(`Error fetching ${F}: ${x}. Will gracefully degrade and hide Frigade`),r(!0),d)),{data:u,isLoading:c,mutate:f,error:w}=Vs(t&&n&&o?`${Te}userFlowStates?foreignUserId=${encodeURIComponent(o)}`:null,a,{revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),T=u==null?void 0:u.data;Gs(()=>{!s&&!c&&T&&p(!0)},[T,s,c]);async function S(F){if(T){let x=T.find(m=>m.flowId===F);x&&x.flowState!==q&&(x.flowState=q),await f(Promise.resolve({...u,data:T}),{optimisticData:{...u,data:T},revalidate:!1,rollbackOnError:!1})}}async function h(F,x,m){if(T){let C=T.find(v=>v.flowId===F);C&&(C.stepStates[x]=m,C.flowState=lt),await f(Promise.resolve({...u,data:T}),{optimisticData:{...u,data:T},revalidate:!1,rollbackOnError:!1})}}async function E(F,x,m){if(T){let C=T.find(v=>v.flowId===F);C&&(C.lastStepId=x,C.stepStates[x]=m,C.flowState=lt),await f({...u,data:T},{optimisticData:{...u,data:T},revalidate:!1,rollbackOnError:!1})}}async function y(F){if(T){let x=T.find(m=>m.flowId===F);x&&x.flowState!==Ne&&(x.flowState=Ne,x.lastStepId=Ks,Object.keys(x.stepStates).forEach(m=>{x.stepStates[m].actionType=Ie,x.stepStates[m].createdAt=new Date().toISOString()}),await f({...u,data:T},{optimisticData:{...u,data:T},revalidate:!1,rollbackOnError:!1}),i(F))}}async function I(F,x){if(T){let m=T.find(C=>C.flowId===F);m&&m.stepStates[x]!==Ie&&(m.stepStates[x]=Ie),await f({...u,data:T},{optimisticData:{...u,data:T},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:T,isLoadingUserFlowStateData:!s,mutateUserFlowState:f,optimisticallyMarkFlowCompleted:S,optimisticallyMarkFlowNotStarted:y,optimisticallyMarkStepCompleted:h,optimisticallyMarkStepNotStarted:I,optimisticallyMarkStepStarted:E,error:w}}function Wt(){let{config:e}=De(),{userFlowStatesData:t,mutateUserFlowState:o}=Ae(),{failedFlowResponses:n,setFailedFlowResponses:r,flowResponses:i,setFlowResponses:s}=qs(V),[p,d]=dr(new Set),[a,u]=dr(new Set),c=yt();function f(S){let h=JSON.stringify(S);if(p.has(h))return null;p.add(h),d(p),a.add(S),u(a);let E=i==null?void 0:i.find(y=>y.flowSlug===S.flowSlug&&y.stepId===S.stepId&&y.actionType===S.actionType&&y.createdAt===S.createdAt);return c(`${Te}flowResponses`,{...e,method:"POST",body:h}).then(y=>{y.status!==200&&y.status!==201?(console.log("Failed to send flow response for step "+S.stepId+". Will retry again later."),r([...n,S])):E||s(I=>[...I??[],S])})}async function w(S){S.foreignUserId&&(S.actionType===lt||S.actionType===Ne?await f(S):S.actionType===q?await f(S):S.actionType===io?await f(S):S.actionType===Le?await f(S):S.actionType===ro?await f(S):S.actionType===Ie&&await f(S))}function T(){let S=[];return t==null||t.forEach(h=>{if(h&&h.stepStates&&Object.keys(h.stepStates).length!==0)for(let E in h.stepStates){let y=h.stepStates[E];S.push({foreignUserId:h.foreignUserId,flowSlug:h.flowId,stepId:y.stepId,actionType:y.actionType,data:{},createdAt:new Date(y.createdAt),blocked:y.blocked,hidden:y.hidden})}}),[...S,...i]}return{addResponse:w,setFlowResponses:s,getFlowResponses:T}}import Zs from"swr";var Ys=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,cr=e=>{let t=Ys.exec(e);if(t===null)return null;let o=null;return t.forEach((n,r)=>{let i=Xs(n,"'","");i.startsWith("flow_")&&(o=i)}),o},Xs=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function Y(){let{config:e}=De(),{flows:t,setFlows:o,userId:n,publicApiKey:r,customVariables:i,setCustomVariables:s,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,setFlowResponses:a,setShouldGracefullyDegrade:u}=Js(V),c={data:[]},{verifySDKInitiated:f}=bt(),{addResponse:w,getFlowResponses:T}=Wt(),S=g=>fetch(g,e).then(b=>b.ok?b.json():(console.log(`Error fetching ${g} (${b.status}): ${b.statusText}. .Will gracefully degrade and hide Frigade`),u(!0),c)).catch(b=>(console.log(`Error fetching ${g}: ${b}. Will gracefully degrade and hide Frigade`),u(!0),c)),{userFlowStatesData:h,isLoadingUserFlowStateData:E,optimisticallyMarkFlowCompleted:y,optimisticallyMarkFlowNotStarted:I,optimisticallyMarkStepCompleted:F,optimisticallyMarkStepNotStarted:x,optimisticallyMarkStepStarted:m}=Ae(),{data:C,error:v,isLoading:U}=Zs(r?`${Te}flows`:null,S,{keepPreviousData:!0});Qs(()=>{if(v){console.error(v);return}C&&C.data&&(C.data=o(C.data))},[C,v]);function $(g){if(U)return null;let b=t.find(P=>P.slug===g);return!b&&t.length>0&&!E&&!U?(console.log(`Flow with slug ${g} not found`),null):(b==null?void 0:b.active)===!1?null:b}function _(g){var G;if(!$(g))return[];let b=$(g).data;return b?(b=A(b),(((G=JSON.parse(b))==null?void 0:G.data)??[]).map(ae=>{let z=ke(ae);return{handleSecondaryButtonClick:()=>{ae.skippable===!0&&W(g,ae.id,{skipped:!0})},...ae,complete:L(g,ae.id)===Le||z>=1,blocked:N(g,ae.id),hidden:ee(g,ae.id),handlePrimaryButtonClick:()=>{(!ae.completionCriteria&&(ae.autoMarkCompleted||ae.autoMarkCompleted===void 0)||ae.completionCriteria&&ae.autoMarkCompleted===!0)&&W(g,ae.id)},progress:z}}).filter(ae=>ae.hidden!==!0)):[]}function A(g){return g.replace(/\${(.*?)}/g,(b,P)=>i[P]!==void 0?String(i[P]):"")}function H(g){if(!$(g))return[];let b=$(g).data;return b?(b=A(b),JSON.parse(b)??{}):[]}function B(g,b){s(P=>({...P,[g]:b}))}function M(g){!E&&!U&&g&&JSON.stringify(i)!=JSON.stringify({...i,...g})&&Object.keys(g).forEach(b=>{B(b,g[b])})}let re=at(async(g,b,P)=>{f();let G={foreignUserId:n,flowSlug:g,stepId:b,actionType:io,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};fe(G)&&(await m(g,b,G),w(G))},[n,h]),X=at(async(g,b,P)=>{f();let G={foreignUserId:n,flowSlug:g,stepId:b,actionType:Ie,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};fe(G)&&(await x(g,b),w(G))},[n,h]),W=at(async(g,b,P)=>{f();let G={foreignUserId:n,flowSlug:g,stepId:b,actionType:Le,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};fe(G)&&(await F(g,b,G),w(G))},[n,h]),be=at(async(g,b)=>{if(f(),ue(g)===Ne)return;let P={foreignUserId:n,flowSlug:g,stepId:"unknown",actionType:Ne,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};await I(g),fe(P)&&w(P)},[n,h]),me=at(async(g,b)=>{f();let P={foreignUserId:n,flowSlug:g,stepId:"unknown",actionType:lt,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};fe(P)&&w(P)},[n,h]),j=at(async(g,b)=>{f();let P={foreignUserId:n,flowSlug:g,stepId:"unknown",actionType:q,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};fe(P)&&(await y(g),w(P))},[n,h]),J=at(async(g,b)=>{f();let P={foreignUserId:n,flowSlug:g,stepId:"unknown",actionType:ro,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};fe(P)&&(await y(g),w(P))},[n,h]);function fe(g){var b;if(!h&&g.actionType===Ie)return!1;if(h){let P=h.find(G=>G.flowId===g.flowSlug);if(g.actionType===Ie&&(!(P!=null&&P.stepStates[g.stepId])||P.stepStates[g.stepId].actionType===Ie)||P&&((b=P.stepStates[g.stepId])==null?void 0:b.actionType)===g.actionType||P&&P.flowState===q&&g.actionType===q)return!1}return!0}function L(g,b){let P=te(g,b);return E?null:P?P.actionType:Ie}function N(g,b){let P=te(g,b);return P?P.blocked:!1}function ee(g,b){let P=te(g,b);return P?P.hidden:!1}function te(g,b){if(E)return null;let P=h==null?void 0:h.find(G=>G.flowId===g);return!P||!P.stepStates[b]?null:P.stepStates[b]??null}function we(g){var P;if(E||!h)return null;if(ue(g)===Ne)return _(g)[0]??null;let b=(P=h.find(G=>G.flowId===g))==null?void 0:P.lastStepId;return b?_(g).find(G=>G.id===b):null}function it(g){let b=we(g);if(!b)return 0;let P=_(g).findIndex(G=>G.id===b.id)??0;return L(g,b.id)===Le&&P<_(g).length-1?P+1:P}function ke(g){if(!g.completionCriteria)return;let b=cr(g.completionCriteria);if(b===null)return;let P=He(b),G=Ge(b);return G===0?void 0:P/G}function ue(g){let b=h==null?void 0:h.find(P=>P.flowId===g);return b?b.flowState:null}function He(g){let b=_(g);return b.length===0?0:b.filter(G=>L(g,G.id)===Le).length}function Ge(g){return _(g).length}function K(g){return JSON.parse(t.find(b=>b.slug===g).data)}function he(g){if(E)return!0;if(g!=null&&g.targetingLogic&&h){let b=h.find(P=>P.flowId===g.slug);if(b)return b.shouldTrigger===!1}return!!(g!=null&&g.targetingLogic&&n&&n.startsWith("guest_"))}function nt(g){return!he($(g))}return{getFlow:$,getFlowData:K,isLoading:E||U,getStepStatus:L,getFlowSteps:_,getCurrentStepIndex:it,markStepStarted:re,markStepCompleted:W,markFlowNotStarted:be,markFlowStarted:me,markFlowCompleted:j,markFlowAborted:J,markStepNotStarted:X,getFlowStatus:ue,getNumberOfStepsCompleted:He,getNumberOfSteps:Ge,targetingLogicShouldHideFlow:he,setCustomVariable:B,updateCustomVariables:M,customVariables:i,getStepOptionalProgress:ke,getFlowMetadata:H,isStepBlocked:N,isStepHidden:ee,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,isFlowAvailableToUser:nt}}import{useCallback as mr,useContext as Rs,useEffect as el}from"react";var wt="guest_";function Lo(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:n,shouldGracefullyDegrade:r}=Rs(V),{config:i}=De(),{mutateUserFlowState:s}=Ae(),p=yt(),{verifySDKInitiated:d}=bt();el(()=>{if(e&&!t){if(e.startsWith(wt))return;let c=`frigade-user-registered-${e}`;localStorage.getItem(c)||(p(`${Te}users`,{...i,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(c,"true"))}},[e,r,t]);let a=mr(async c=>{d();let f={foreignId:e,properties:c};await p(`${Te}users`,{...i,method:"POST",body:JSON.stringify(f)}),n(w=>({...w,...c})),s()},[e,i,r,s]),u=mr(async(c,f)=>{d();let T={foreignId:e,events:[{event:c,properties:f}]};await p(`${Te}users`,{...i,method:"POST",body:JSON.stringify(T)}),s()},[e,i,s]);return{userId:e,setUserId:o,addPropertiesToUser:a,trackEventForUser:u}}import{v4 as Fa}from"uuid";import Me,{useEffect as Sa,useState as ya}from"react";import je,{useEffect as sl}from"react";import so from"styled-components";import tl from"react";import ol from"styled-components";var ur="fr-",zt="cfr-";function l(e,t){let o=`${ur}${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+" "+zt+e}return o}function k(e){if(!e.className||e.className.indexOf(zt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(ur)?"":`:not(${o.map(n=>`.${n}`).join(", ")})`}function Oo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function pt(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Oo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function xe(...e){return e.filter(Boolean).join(" ")}function fr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var rl=ol.div`
|
|
2
|
+
import ut,{createContext as ka,useEffect as Yo,useState as Be}from"react";import{ThemeProvider as Pa}from"styled-components";import mt,{useContext as Ta,useEffect as bo,useState as Ko}from"react";import{useCallback as at,useContext as Js,useEffect as Qs}from"react";import No,{useMemo as Us}from"react";var dr="1.32.40 ";var Te="https://api.frigade.com/v1/public/",Ie="NOT_STARTED_STEP",K="COMPLETED_FLOW",ro="ABORTED_FLOW",lt="STARTED_FLOW",Ne="NOT_STARTED_FLOW",Le="COMPLETED_STEP",io="STARTED_STEP";function De(){let{publicApiKey:e,userId:t}=No.useContext(V);return{config:Us(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":dr,"X-Frigade-SDK-Platform":"React"}}),[e,t])}}var _s="frigade-last-call-at-",Ws="frigade-last-call-data-";function yt(){let{shouldGracefullyDegrade:e}=No.useContext(V);return async(t,o)=>{if(e)return console.log(`Skipping ${t} call to Frigade due to error`),_t();let i=_s+t,r=Ws+t;if(window&&window.localStorage&&o&&o.body&&o.method==="POST"){let s=window.localStorage.getItem(i),p=window.localStorage.getItem(r);if(s&&p&&p==o.body){let d=new Date(s);if(new Date().getTime()-d.getTime()<1e3)return _t()}window.localStorage.setItem(i,new Date().toISOString()),window.localStorage.setItem(r,o.body)}let n;try{n=await fetch(t,o)}catch(s){return _t(s)}return n?n.ok?n:_t(n.statusText):_t()}}function _t(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function bt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=No.useContext(V);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 Ks,useState as cr}from"react";import{useContext as Hs,useEffect as Gs,useState as js}from"react";import Vs from"swr";import{useContext as zs}from"react";function Pe(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:r}=zs(V);function n(c,f=!1){return e[c]??f}function s(c,f){t(w=>({...w,[c]:f}))}function p(c){t(f=>{let{[c]:w,...T}=f;return{...T}})}function d(c){r.includes(c)||i(f=>[...f,c])}function a(c){return r.includes(c)}function u(){return Object.values(e).some(c=>c)||o}return{getOpenFlowState:n,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:u,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:a}}var qs="unknown";function Ae(){let{config:e}=De(),{publicApiKey:t,userId:o,flows:i,setShouldGracefullyDegrade:r}=Hs(V),{resetOpenFlowState:n}=Pe(),[s,p]=js(!1),d={data:i.map(F=>({flowId:F.id,flowState:K,lastStepId:null,userId:o,foreignUserId:o,stepStates:{},shouldTrigger:!1}))},a=F=>fetch(F,e).then(g=>{if(g.ok)return g.json();throw new Error("Failed to fetch user flow states")}).catch(g=>(console.log(`Error fetching ${F}: ${g}. Will gracefully degrade and hide Frigade`),r(!0),d)),{data:u,isLoading:c,mutate:f,error:w}=Vs(t&&i&&o?`${Te}userFlowStates?foreignUserId=${encodeURIComponent(o)}`:null,a,{revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),T=u==null?void 0:u.data;Gs(()=>{!s&&!c&&T&&p(!0)},[T,s,c]);async function S(F){if(T){let g=T.find(m=>m.flowId===F);g&&g.flowState!==K&&(g.flowState=K),await f(Promise.resolve({...u,data:T}),{optimisticData:{...u,data:T},revalidate:!1,rollbackOnError:!1})}}async function x(F,g,m){if(T){let C=T.find(v=>v.flowId===F);C&&(C.stepStates[g]=m,C.flowState=lt),await f(Promise.resolve({...u,data:T}),{optimisticData:{...u,data:T},revalidate:!1,rollbackOnError:!1})}}async function E(F,g,m){if(T){let C=T.find(v=>v.flowId===F);C&&(C.lastStepId=g,C.stepStates[g]=m,C.flowState=lt),await f({...u,data:T},{optimisticData:{...u,data:T},revalidate:!1,rollbackOnError:!1})}}async function y(F){if(T){let g=T.find(m=>m.flowId===F);g&&g.flowState!==Ne&&(g.flowState=Ne,g.lastStepId=qs,Object.keys(g.stepStates).forEach(m=>{g.stepStates[m].actionType=Ie,g.stepStates[m].createdAt=new Date().toISOString()}),await f({...u,data:T},{optimisticData:{...u,data:T},revalidate:!1,rollbackOnError:!1}),n(F))}}async function I(F,g){if(T){let m=T.find(C=>C.flowId===F);m&&m.stepStates[g]!==Ie&&(m.stepStates[g]=Ie),await f({...u,data:T},{optimisticData:{...u,data:T},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:T,isLoadingUserFlowStateData:!s,mutateUserFlowState:f,optimisticallyMarkFlowCompleted:S,optimisticallyMarkFlowNotStarted:y,optimisticallyMarkStepCompleted:x,optimisticallyMarkStepNotStarted:I,optimisticallyMarkStepStarted:E,error:w}}function Wt(){let{config:e}=De(),{userFlowStatesData:t,mutateUserFlowState:o}=Ae(),{failedFlowResponses:i,setFailedFlowResponses:r,flowResponses:n,setFlowResponses:s}=Ks(V),[p,d]=cr(new Set),[a,u]=cr(new Set),c=yt();function f(S){let x=JSON.stringify(S);if(p.has(x))return null;p.add(x),d(p),a.add(S),u(a);let E=n==null?void 0:n.find(y=>y.flowSlug===S.flowSlug&&y.stepId===S.stepId&&y.actionType===S.actionType&&y.createdAt===S.createdAt);return c(`${Te}flowResponses`,{...e,method:"POST",body:x}).then(y=>{y.status!==200&&y.status!==201?(console.log("Failed to send flow response for step "+S.stepId+". Will retry again later."),r([...i,S])):E||s(I=>[...I??[],S])})}async function w(S){S.foreignUserId&&(S.actionType===lt||S.actionType===Ne?await f(S):S.actionType===K?await f(S):S.actionType===io?await f(S):S.actionType===Le?await f(S):S.actionType===ro?await f(S):S.actionType===Ie&&await f(S))}function T(){let S=[];return t==null||t.forEach(x=>{if(x&&x.stepStates&&Object.keys(x.stepStates).length!==0)for(let E in x.stepStates){let y=x.stepStates[E];S.push({foreignUserId:x.foreignUserId,flowSlug:x.flowId,stepId:y.stepId,actionType:y.actionType,data:{},createdAt:new Date(y.createdAt),blocked:y.blocked,hidden:y.hidden})}}),[...S,...n]}return{addResponse:w,setFlowResponses:s,getFlowResponses:T}}import Zs from"swr";var Ys=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,mr=e=>{let t=Ys.exec(e);if(t===null)return null;let o=null;return t.forEach((i,r)=>{let n=Xs(i,"'","");n.startsWith("flow_")&&(o=n)}),o},Xs=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function Y(){let{config:e}=De(),{flows:t,setFlows:o,userId:i,publicApiKey:r,customVariables:n,setCustomVariables:s,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,setFlowResponses:a,setShouldGracefullyDegrade:u}=Js(V),c={data:[]},{verifySDKInitiated:f}=bt(),{addResponse:w,getFlowResponses:T}=Wt(),S=h=>fetch(h,e).then(b=>b.ok?b.json():(console.log(`Error fetching ${h} (${b.status}): ${b.statusText}. .Will gracefully degrade and hide Frigade`),u(!0),c)).catch(b=>(console.log(`Error fetching ${h}: ${b}. Will gracefully degrade and hide Frigade`),u(!0),c)),{userFlowStatesData:x,isLoadingUserFlowStateData:E,optimisticallyMarkFlowCompleted:y,optimisticallyMarkFlowNotStarted:I,optimisticallyMarkStepCompleted:F,optimisticallyMarkStepNotStarted:g,optimisticallyMarkStepStarted:m}=Ae(),{data:C,error:v,isLoading:U}=Zs(r?`${Te}flows`:null,S,{keepPreviousData:!0});Qs(()=>{if(v){console.error(v);return}C&&C.data&&(C.data=o(C.data))},[C,v]);function $(h){if(U)return null;let b=t.find(P=>P.slug===h);return!b&&t.length>0&&!E&&!U?(console.log(`Flow with slug ${h} not found`),null):(b==null?void 0:b.active)===!1?null:b}function _(h){var G;if(!$(h))return[];let b=$(h).data;return b?(b=A(b),(((G=JSON.parse(b))==null?void 0:G.data)??[]).map(ae=>{let z=ke(ae);return{handleSecondaryButtonClick:()=>{ae.skippable===!0&&W(h,ae.id,{skipped:!0})},...ae,complete:L(h,ae.id)===Le||z>=1,blocked:N(h,ae.id),hidden:ee(h,ae.id),handlePrimaryButtonClick:()=>{(!ae.completionCriteria&&(ae.autoMarkCompleted||ae.autoMarkCompleted===void 0)||ae.completionCriteria&&ae.autoMarkCompleted===!0)&&W(h,ae.id)},progress:z}}).filter(ae=>ae.hidden!==!0)):[]}function A(h){return h.replace(/\${(.*?)}/g,(b,P)=>n[P]!==void 0?String(n[P]):"")}function H(h){if(!$(h))return[];let b=$(h).data;return b?(b=A(b),JSON.parse(b)??{}):[]}function B(h,b){s(P=>({...P,[h]:b}))}function M(h){!E&&!U&&h&&JSON.stringify(n)!=JSON.stringify({...n,...h})&&Object.keys(h).forEach(b=>{B(b,h[b])})}let re=at(async(h,b,P)=>{f();let G={foreignUserId:i,flowSlug:h,stepId:b,actionType:io,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};fe(G)&&(await m(h,b,G),w(G))},[i,x]),X=at(async(h,b,P)=>{f();let G={foreignUserId:i,flowSlug:h,stepId:b,actionType:Ie,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};fe(G)&&(await g(h,b),w(G))},[i,x]),W=at(async(h,b,P)=>{f();let G={foreignUserId:i,flowSlug:h,stepId:b,actionType:Le,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};fe(G)&&(await F(h,b,G),w(G))},[i,x]),be=at(async(h,b)=>{if(f(),ue(h)===Ne)return;let P={foreignUserId:i,flowSlug:h,stepId:"unknown",actionType:Ne,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};await I(h),fe(P)&&w(P)},[i,x]),me=at(async(h,b)=>{f();let P={foreignUserId:i,flowSlug:h,stepId:"unknown",actionType:lt,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};fe(P)&&w(P)},[i,x]),j=at(async(h,b)=>{f();let P={foreignUserId:i,flowSlug:h,stepId:"unknown",actionType:K,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};fe(P)&&(await y(h),w(P))},[i,x]),J=at(async(h,b)=>{f();let P={foreignUserId:i,flowSlug:h,stepId:"unknown",actionType:ro,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};fe(P)&&(await y(h),w(P))},[i,x]);function fe(h){var b;if(!x&&h.actionType===Ie)return!1;if(x){let P=x.find(G=>G.flowId===h.flowSlug);if(h.actionType===Ie&&(!(P!=null&&P.stepStates[h.stepId])||P.stepStates[h.stepId].actionType===Ie)||P&&((b=P.stepStates[h.stepId])==null?void 0:b.actionType)===h.actionType||P&&P.flowState===K&&h.actionType===K)return!1}return!0}function L(h,b){let P=te(h,b);return E?null:P?P.actionType:Ie}function N(h,b){let P=te(h,b);return P?P.blocked:!1}function ee(h,b){let P=te(h,b);return P?P.hidden:!1}function te(h,b){if(E)return null;let P=x==null?void 0:x.find(G=>G.flowId===h);return!P||!P.stepStates[b]?null:P.stepStates[b]??null}function we(h){var P;if(E||!x)return null;if(ue(h)===Ne)return _(h)[0]??null;let b=(P=x.find(G=>G.flowId===h))==null?void 0:P.lastStepId;return b?_(h).find(G=>G.id===b):null}function it(h){let b=we(h);if(!b)return 0;let P=_(h).findIndex(G=>G.id===b.id)??0;return L(h,b.id)===Le&&P<_(h).length-1?P+1:P}function ke(h){if(!h.completionCriteria)return;let b=mr(h.completionCriteria);if(b===null)return;let P=He(b),G=Ge(b);return G===0?void 0:P/G}function ue(h){let b=x==null?void 0:x.find(P=>P.flowId===h);return b?b.flowState:null}function He(h){let b=_(h);return b.length===0?0:b.filter(G=>L(h,G.id)===Le).length}function Ge(h){return _(h).length}function q(h){return JSON.parse(t.find(b=>b.slug===h).data)}function he(h){if(E)return!0;if(h!=null&&h.targetingLogic&&x){let b=x.find(P=>P.flowId===h.slug);if(b)return b.shouldTrigger===!1}return!!(h!=null&&h.targetingLogic&&i&&i.startsWith("guest_"))}function nt(h){return!he($(h))}return{getFlow:$,getFlowData:q,isLoading:E||U,getStepStatus:L,getFlowSteps:_,getCurrentStepIndex:it,markStepStarted:re,markStepCompleted:W,markFlowNotStarted:be,markFlowStarted:me,markFlowCompleted:j,markFlowAborted:J,markStepNotStarted:X,getFlowStatus:ue,getNumberOfStepsCompleted:He,getNumberOfSteps:Ge,targetingLogicShouldHideFlow:he,setCustomVariable:B,updateCustomVariables:M,customVariables:n,getStepOptionalProgress:ke,getFlowMetadata:H,isStepBlocked:N,isStepHidden:ee,hasActiveFullPageFlow:p,setHasActiveFullPageFlow:d,isFlowAvailableToUser:nt}}import{useCallback as ur,useContext as Rs,useEffect as el}from"react";var wt="guest_";function Lo(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=Rs(V),{config:n}=De(),{mutateUserFlowState:s}=Ae(),p=yt(),{verifySDKInitiated:d}=bt();el(()=>{if(e&&!t){if(e.startsWith(wt))return;let c=`frigade-user-registered-${e}`;localStorage.getItem(c)||(p(`${Te}users`,{...n,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(c,"true"))}},[e,r,t]);let a=ur(async c=>{d();let f={foreignId:e,properties:c};await p(`${Te}users`,{...n,method:"POST",body:JSON.stringify(f)}),i(w=>({...w,...c})),s()},[e,n,r,s]),u=ur(async(c,f)=>{d();let T={foreignId:e,events:[{event:c,properties:f}]};await p(`${Te}users`,{...n,method:"POST",body:JSON.stringify(T)}),s()},[e,n,s]);return{userId:e,setUserId:o,addPropertiesToUser:a,trackEventForUser:u}}import{v4 as Fa}from"uuid";import Me,{useEffect as Sa,useState as ya}from"react";import je,{useEffect as sl}from"react";import so from"styled-components";import tl from"react";import ol from"styled-components";var fr="fr-",zt="cfr-";function l(e,t){let o=`${fr}${e}`;if(!t)return o;if(t.styleOverrides&&t.styleOverrides[e]){if(typeof t.styleOverrides[e]=="string")return o+" "+t.styleOverrides[e];if(typeof t.styleOverrides[e]=="object")return o+" "+zt+e}return o}function k(e){if(!e.className||e.className.indexOf(zt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(fr)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Oo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function pt(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Oo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function xe(...e){return e.filter(Boolean).join(" ")}function gr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var rl=ol.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -23,7 +23,7 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
23
23
|
opacity: 1;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
`,
|
|
26
|
+
`,hr=({onClose:e,appearance:t})=>tl.createElement(rl,{className:l("modalBackground",t),onClick:()=>e()});import no from"react";import il from"styled-components";var nl=il.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
@@ -92,7 +92,7 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
92
92
|
::-webkit-scrollbar {
|
|
93
93
|
display: none;
|
|
94
94
|
}
|
|
95
|
-
`,Qe=({onClose:e,visible:t,headerContent:o=null,style:
|
|
95
|
+
`,Qe=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:r,appearance:n,dismissible:s=!0})=>(sl(()=>{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(ll,null,je.createElement(hr,{appearance:n,onClose:()=>{s&&e()}}),je.createElement(al,{appearance:n,className:l("modalContainer",n),styleOverrides:i},s&&je.createElement(dl,{className:l("modalClose",n),onClick:()=>e(),appearance:n},je.createElement(ve,null)),o&&je.createElement(pl,null,o),je.createElement(cl,null,r))):je.createElement(je.Fragment,null));import Ze,{useEffect as ml}from"react";import lo from"styled-components";import{Portal as ul}from"react-portal";var fl=lo.div`
|
|
96
96
|
${e=>k(e)} {
|
|
97
97
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
98
98
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -129,7 +129,7 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
129
129
|
::-webkit-scrollbar {
|
|
130
130
|
display: none;
|
|
131
131
|
}
|
|
132
|
-
`,
|
|
132
|
+
`,xr=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:r})=>(ml(()=>{let n=s=>{s.key==="Escape"&&e()};return document.addEventListener("keydown",n),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",n)}},[e,t]),t?Ze.createElement(ul,null,Ze.createElement(fl,{appearance:r,className:l("cornerModalContainer",r)},Ze.createElement(hl,{className:l("cornerModalClose",r),onClick:()=>e()},Ze.createElement(ve,null)),o&&Ze.createElement(gl,null,o),Ze.createElement(xl,null,i))):Ze.createElement(Ze.Fragment,null));import{useContext as Cl}from"react";function Q(){let{defaultAppearance:e}=Cl(V);function t(o){let i=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign(i.styleOverrides??{},o.styleOverrides??{}),theme:Object.assign(i.theme,o.theme??{})}:i}return{mergeAppearanceWithDefault:t}}import Ht,{useEffect as Il,useState as _o}from"react";import Wo from"styled-components";import co,{useEffect as Sl,useState as Tr}from"react";import Mo from"styled-components";import ao from"styled-components";var Cr=ao.label`
|
|
133
133
|
${e=>k(e)} {
|
|
134
134
|
font-size: 14px;
|
|
135
135
|
line-height: 20px;
|
|
@@ -137,14 +137,14 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
137
137
|
margin-top: 10px;
|
|
138
138
|
}
|
|
139
139
|
display: flex;
|
|
140
|
-
`,
|
|
140
|
+
`,Sr=ao.label`
|
|
141
141
|
${e=>k(e)} {
|
|
142
142
|
font-size: 12px;
|
|
143
143
|
line-height: 20px;
|
|
144
144
|
margin-bottom: 5px;
|
|
145
145
|
}
|
|
146
146
|
display: flex;
|
|
147
|
-
`,
|
|
147
|
+
`,yr=ao.span`
|
|
148
148
|
font-weight: 400;
|
|
149
149
|
font-size: 14px;
|
|
150
150
|
line-height: 22px;
|
|
@@ -157,11 +157,11 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
157
157
|
align-items: flex-start;
|
|
158
158
|
justify-content: left;
|
|
159
159
|
margin-bottom: 10px;
|
|
160
|
-
`;import Do from"react";function Re({title:e,required:t,appearance:o}){return Do.createElement(po,null,t?Do.createElement(
|
|
160
|
+
`;import Do from"react";function Re({title:e,required:t,appearance:o}){return Do.createElement(po,null,t?Do.createElement(yr,null,"*"):null,Do.createElement(Cr,{className:l("formLabel",o)},e))}import br from"react";function Tt({title:e,appearance:t}){return e?br.createElement(po,null,br.createElement(Sr,{className:l("formSubLabel",t)},e)):null}import{z as $o}from"zod";function wr(e,t){try{if(t){if(t.type=="number"){let o=$o.number();if(t.props)for(let i of t.props)i.requirement=="min"?o=o.min(Number(i.value),i.message??"Value is too small"):i.requirement=="max"?o=o.max(Number(i.value),i.message??"Value is too large"):i.requirement=="positive"?o=o.positive(i.message??"Value must be positive"):i.requirement=="negative"&&(o=o.nonpositive(i.message??"Value must be negative"));o.parse(Number(e))}if(t.type=="string"){let o=$o.string();if(t.props)for(let i of t.props)i.requirement=="min"?o=o.min(Number(i.value),i.message??"Value is too short"):i.requirement=="max"?o=o.max(Number(i.value),i.message??"Value is too long"):i.requirement=="regex"&&(o=o.regex(new RegExp(String(i.value)),i.message??"Value does not match requirements"));o.parse(e)}return}}catch(o){if(o instanceof $o.ZodError)return o.issues&&o.issues.length>0?o.issues[0].message:null;console.error("Frigade Form validation failed for rule ",t,o)}return null}var yl=Mo.div`
|
|
161
161
|
display: flex;
|
|
162
162
|
flex-direction: column;
|
|
163
163
|
width: 100%;
|
|
164
|
-
`,Mo
|
|
164
|
+
`,Uo=Mo.input`
|
|
165
165
|
${e=>k(e)} {
|
|
166
166
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
167
167
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -177,7 +177,7 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
177
177
|
box-sizing: border-box;
|
|
178
178
|
padding: 0 10px;
|
|
179
179
|
margin-bottom: 10px;
|
|
180
|
-
`,bl
|
|
180
|
+
`,bl=Mo.textarea`
|
|
181
181
|
${e=>k(e)} {
|
|
182
182
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
183
183
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -193,7 +193,7 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
193
193
|
min-height: 70px;
|
|
194
194
|
box-sizing: border-box;
|
|
195
195
|
margin-bottom: 10px;
|
|
196
|
-
`;function Fr({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:
|
|
196
|
+
`;function Fr({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:r}){let n=e,[s,p]=Tr((r==null?void 0:r.text)||""),[d,a]=Tr(!1),u=Uo;Sl(()=>{s===""&&!d&&(a(!0),c(""))},[]);function c(w){if(p(w),o({text:w}),n.required===!0&&w.trim()===""){i([{id:n.id,message:`${n.title} is required`}]);return}let T=wr(w,n.validation);if(T){i([{id:n.id,message:T}]);return}i([])}n.multiline&&(u=bl);function f(){var w;switch((w=n==null?void 0:n.validation)==null?void 0:w.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return co.createElement(yl,null,co.createElement(Re,{title:n.title,required:n.required,appearance:t.appearance}),co.createElement(u,{className:l("inputComponent",t.appearance),value:s,onChange:w=>{c(w.target.value)},appearance:t.appearance,placeholder:n.placeholder,type:f()}),co.createElement(Tt,{title:n.subtitle,appearance:t.appearance}))}import $e,{useEffect as kr,useState as Pr}from"react";import vr from"styled-components";var wl=vr.div`
|
|
197
197
|
display: flex;
|
|
198
198
|
flex-direction: column;
|
|
199
199
|
width: 100%;
|
|
@@ -223,7 +223,7 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
223
223
|
background-repeat: no-repeat;
|
|
224
224
|
background-size: 1.5em 1.5em;
|
|
225
225
|
-webkit-print-color-adjust: exact;
|
|
226
|
-
`,mo="null";function Er({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:
|
|
226
|
+
`,mo="null";function Er({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var u,c,f,w,T,S;let n=e,[s,p]=Pr(((u=i==null?void 0:i.choice)==null?void 0:u[0])||""),[d,a]=Pr(!1);return kr(()=>{var x,E,y,I;if(s===""&&!d){if(a(!0),n.requireSelection){p(mo);return}if(n.defaultValue&&((x=n.props.options)!=null&&x.find(F=>F.id===n.defaultValue))){let F=(E=n.props.options)==null?void 0:E.find(g=>g.id===n.defaultValue);p(F.id),o({choice:[F.id]})}else p(((y=n.props.options)==null?void 0:y[0].id)||""),o({choice:[((I=n.props.options)==null?void 0:I[0].id)||""]})}},[]),kr(()=>{n.requireSelection&&s===mo?r([{message:"Please select an option",id:n.id}]):r([])},[s]),$e.createElement(wl,null,$e.createElement(Re,{title:n.title,required:!1,appearance:t.appearance}),$e.createElement(Tl,{value:s,onChange:x=>{p(x.target.value),o({choice:[x.target.value]})},placeholder:n.placeholder,appearance:t.appearance,className:l("multipleChoiceSelect",t.appearance)},n.requireSelection&&$e.createElement("option",{key:mo,value:mo},"Select an option"),(c=n.props.options)==null?void 0:c.map(x=>$e.createElement("option",{key:x.id,value:x.id},x.title))),((w=(f=n.props.options)==null?void 0:f.find(x=>x.id===s))==null?void 0:w.isOpenEnded)&&$e.createElement($e.Fragment,null,$e.createElement(Re,{title:((S=(T=n.props.options)==null?void 0:T.find(x=>x.id===s))==null?void 0:S.openEndedLabel)??"Please specify",required:!1,appearance:t.appearance}),$e.createElement(Uo,{type:"text",placeholder:"Enter your answer here",onChange:x=>{o({choice:[x.target.value]})},appearance:t.appearance})),$e.createElement(Tt,{title:n.subtitle,appearance:t.appearance}))}import uo,{useEffect as Ir,useState as Ar}from"react";import Br from"styled-components";var Fl=Br.div`
|
|
227
227
|
display: flex;
|
|
228
228
|
flex-direction: column;
|
|
229
229
|
width: 100%;
|
|
@@ -251,7 +251,7 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
251
251
|
height: 60px;
|
|
252
252
|
padding: 0 18px;
|
|
253
253
|
margin-bottom: 10px;
|
|
254
|
-
`;function Nr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:
|
|
254
|
+
`;function Nr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i}){var a;let r=e,[n,s]=Ar((i==null?void 0:i.choice)||[]),[p,d]=Ar(!1);return Ir(()=>{n.length==0&&!p&&(d(!0),o({choice:[]}))},[]),Ir(()=>{o({choice:n})},[n]),uo.createElement(Fl,null,uo.createElement(Re,{title:r.title,required:r.required,appearance:t.appearance}),(a=r.props.options)==null?void 0:a.map(u=>uo.createElement(kl,{appearance:t.appearance,key:u.id,value:u.id,"data-selected":n.includes(u.id),onClick:()=>{if(n.includes(u.id)){s(n.filter(c=>c!==u.id));return}n.length<r.props.maxChoices?s([...n,u.id]):n.length==1&&r.props.maxChoices==1&&s([u.id])}},u.title)),uo.createElement(Tt,{title:r.subtitle,appearance:t.appearance}))}import fo from"react";import Lr from"styled-components";import Pl from"dompurify";function pe(e){return{__html:Pl.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var vl=Lr.h1`
|
|
255
255
|
${e=>k(e)} {
|
|
256
256
|
font-style: normal;
|
|
257
257
|
font-weight: 600;
|
|
@@ -270,20 +270,20 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
270
270
|
line-height: 20px;
|
|
271
271
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
272
272
|
}
|
|
273
|
-
`;function Ce({appearance:e,title:t,subtitle:o,size:
|
|
273
|
+
`;function Ce({appearance:e,title:t,subtitle:o,size:i="medium"}){return fo.createElement(fo.Fragment,null,fo.createElement(vl,{appearance:e,className:l(`${i}Title`,e),dangerouslySetInnerHTML:pe(t),size:i}),o&&fo.createElement(El,{appearance:e,className:l(`${i}Subtitle`,e),dangerouslySetInnerHTML:pe(o),size:i}))}var Al=Wo.div`
|
|
274
274
|
display: flex;
|
|
275
275
|
flex-direction: column;
|
|
276
276
|
justify-content: flex-end;
|
|
277
277
|
padding-bottom: 14px;
|
|
278
278
|
overflow: visible;
|
|
279
|
-
`,Bl=
|
|
279
|
+
`,Bl=Wo.div`
|
|
280
280
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextError}};
|
|
281
281
|
font-size: 12px;
|
|
282
282
|
margin-bottom: 12px;
|
|
283
|
-
`,Nl=
|
|
283
|
+
`,Nl=Wo.div`
|
|
284
284
|
padding-left: 1px;
|
|
285
285
|
padding-right: 1px;
|
|
286
|
-
`,Ll={text:Fr,multipleChoice:Er,multipleChoiceList:Nr};function Or({stepData:e,canContinue:t,setCanContinue:o,onSaveData:
|
|
286
|
+
`,Ll={text:Fr,multipleChoice:Er,multipleChoiceList:Nr};function Or({stepData:e,canContinue:t,setCanContinue:o,onSaveData:i,appearance:r,customFormElements:n}){var E;let s=e.props,[p,d]=_o(S()||{}),[a,u]=_o([]),[c,f]=_o([]),w={...Ll,...n};Il(()=>{o(a.length===0)},[a,o]);function T(y,I){let F={...p,[y.id]:I};d(F),i(F),window&&window.localStorage&&window.localStorage.setItem(x(),JSON.stringify(F))}function S(){if(window&&window.localStorage){let y=window.localStorage.getItem(x());if(y)return JSON.parse(y)}return{}}function x(){return`frigade-multiInputStepTypeData-${e.id}`}return Ht.createElement(Nl,{className:l("multiInput",r)},Ht.createElement(Ce,{appearance:r,title:e.title,subtitle:e.subtitle}),Ht.createElement(Al,{className:l("multiInputContainer",r)},(E=s.data)==null?void 0:E.map(y=>{var F;let I=(F=a.reverse().find(g=>g.id===y.id))==null?void 0:F.message;return w[y.type]?Ht.createElement("span",{key:y.id},w[y.type]({formInput:y,customFormTypeProps:{stepData:e,canContinue:t,setCanContinue:o,onSaveData:i,appearance:r},onSaveInputData:g=>{!c.includes(y.id)&&g&&(g==null?void 0:g.text)!==""&&f(m=>[...m,y.id]),T(y,g)},inputData:p[y.id],setFormValidationErrors:g=>{u(m=>g.length===0?m.filter(C=>C.id!==y.id):[...m,...g])}}),I&&c.includes(y.id)&&Ht.createElement(Bl,{appearance:r,className:l("multiInputValidationError",r)},I)):null})))}import Ft from"styled-components";var Dr=Ft.div`
|
|
287
287
|
align-items: center;
|
|
288
288
|
display: flex;
|
|
289
289
|
justify-content: space-between;
|
|
@@ -330,8 +330,8 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
330
330
|
${e=>e.withMargin?"margin: 16px 0px 16px 0px;":""}
|
|
331
331
|
|
|
332
332
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorPrimary}};
|
|
333
|
-
color: ${e=>{var t,o,
|
|
334
|
-
background-color: ${e=>{var t,o,
|
|
333
|
+
color: ${e=>{var t,o,i,r;return e.secondary?(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorPrimary:(r=(i=e.appearance)==null?void 0:i.theme)==null?void 0:r.colorTextOnPrimaryBackground}};
|
|
334
|
+
background-color: ${e=>{var t,o,i,r;return e.secondary?(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground:(r=(i=e==null?void 0:e.appearance)==null?void 0:i.theme)==null?void 0:r.colorPrimary}};
|
|
335
335
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
336
336
|
padding: ${e=>e.size=="small"?"6px 14px 6px 14px":"8px 20px 8px 20px"};
|
|
337
337
|
font-size: ${e=>e.size=="small"?"14px":"15px"};
|
|
@@ -359,9 +359,9 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
359
359
|
margin-right: 8px;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
`,R=({onClick:e,title:t,style:o,disabled:
|
|
362
|
+
`,R=({onClick:e,title:t,style:o,disabled:i,type:r="inline",size:n="medium",secondary:s=!1,appearance:p,withMargin:d=!0,classPrefix:a=""})=>{function u(){let c=s?"buttonSecondary":"button";return a===""?c:`${a}${gr(c)}`}return Ol.createElement(Dl,{secondary:s,appearance:p,disabled:i,onClick:e,style:o,type:r,withMargin:d,size:n,className:l(u(),p)},t)};var Hr=({step:e,canContinue:t,appearance:o,onPrimaryClick:i,onSecondaryClick:r,formType:n,selectedStep:s,steps:p,onBack:d,allowBackNavigation:a})=>{let u=n==="inline"?"inline":"full-width";return Gt.createElement(Dr,{className:l("formCTAContainer",o)},p.length>1&&s!=0&&a&&Gt.createElement(R,{title:"\u2190",onClick:d,secondary:!0,withMargin:!1,type:u,appearance:o}),Gt.createElement($r,{className:l("ctaWrapper",o)},e.secondaryButtonTitle?Gt.createElement(R,{title:e.secondaryButtonTitle,onClick:r,secondary:!0,withMargin:!1,type:u,appearance:o}):null," ",e.primaryButtonTitle?Gt.createElement(R,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:i,type:u,appearance:o}):null))};import zo from"react";import $l from"styled-components";var Ml=$l.div`
|
|
363
363
|
text-align: center;
|
|
364
|
-
`,Gr=({stepCount:e=0,currentStep:t=0,className:o,appearance:
|
|
364
|
+
`,Gr=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:r}=Q().mergeAppearanceWithDefault(i);return zo.createElement(Ml,{className:o},zo.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((n,s)=>zo.createElement("rect",{key:s,x:16*s,y:0,width:8,height:8,rx:4,fill:t===s?r.colorPrimary:"#E6E6E6"}))))};import dt from"react";import kt from"styled-components";import{useContext as Ul}from"react";function ie(){let e=Ul(V);function t(r){i(r.primaryButtonUri,r.primaryButtonUriTarget)}function o(r){i(r.secondaryButtonUri,r.secondaryButtonUriTarget)}function i(r,n){if(!r)return;let s=r.startsWith("http")?"_blank":"_self";n&&n!=="_blank"&&(s="_self"),e.navigate(r,s)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:i}}var _l=kt.div`
|
|
365
365
|
display: flex;
|
|
366
366
|
flex-wrap: wrap;
|
|
367
367
|
align-content: center;
|
|
@@ -409,7 +409,7 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
409
409
|
margin-top: 12px;
|
|
410
410
|
margin-bottom: 16px;
|
|
411
411
|
max-width: 70%;
|
|
412
|
-
`;function jr({stepData:e,appearance:t}){var
|
|
412
|
+
`;function jr({stepData:e,appearance:t}){var i,r;let{handleUrl:o}=ie();return dt.createElement("div",null,dt.createElement(Gl,null,e.title),dt.createElement(jl,null,e.subtitle),dt.createElement(_l,null,(r=(i=e.props)==null?void 0:i.links)==null?void 0:r.map(n=>dt.createElement(Wl,{key:n.title},dt.createElement(zl,{src:n.imageUri}),dt.createElement(Hl,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{n.uri&&o(n.uri,n.uriTarget??"_blank")}},n.title)))))}import vt,{useEffect as Ql}from"react";import Co from"styled-components";import Ho from"react";var ho=({style:e,className:t})=>Ho.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},Ho.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),Ho.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 jt,{useRef as Vl,useState as ql}from"react";import xo from"styled-components";var Kl=xo.div`
|
|
413
413
|
display: flex;
|
|
414
414
|
align-items: center;
|
|
415
415
|
justify-content: flex-start;
|
|
@@ -446,7 +446,7 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
446
446
|
height: 100%;
|
|
447
447
|
min-height: 200px;
|
|
448
448
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
449
|
-
`;function Pt({appearance:e,videoUri:t}){let o=Vl(),[
|
|
449
|
+
`;function Pt({appearance:e,videoUri:t}){let o=Vl(),[i,r]=ql(!1);if(t.includes("youtube")){let n=t.split("v=")[1],s=n.indexOf("&");return s!==-1&&(n=n.substring(0,s)),jt.createElement(Jl,{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${n}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,appearance:e})}return jt.createElement(Kl,{appearance:e},!i&&jt.createElement(Yl,{onClick:()=>{r(!0),o.current.play()},appearance:e},jt.createElement(ho,null)),jt.createElement(Xl,{appearance:e,controls:i,ref:o,play:i,src:t}))}var Zl=Co.div`
|
|
450
450
|
${e=>k(e)} {
|
|
451
451
|
display: flex;
|
|
452
452
|
flex-direction: column;
|
|
@@ -470,9 +470,9 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
470
470
|
max-height: 250px;
|
|
471
471
|
margin-bottom: 24px;
|
|
472
472
|
}
|
|
473
|
-
`;function Vr({stepData:e,appearance:t,setCanContinue:o}){return Ql(()=>{o(!0)},[]),vt.createElement(Zl,{className:l("callToActionContainer",t)},vt.createElement(ea,{className:l("callToActionTextContainer",t)},vt.createElement(Ce,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&vt.createElement(Rl,{className:l("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&vt.createElement(ta,{appearance:t,className:l("callToActionVideo",t)},vt.createElement(Pt,{appearance:t,videoUri:e.videoUri})))}import Ve,{useEffect as
|
|
473
|
+
`;function Vr({stepData:e,appearance:t,setCanContinue:o}){return Ql(()=>{o(!0)},[]),vt.createElement(Zl,{className:l("callToActionContainer",t)},vt.createElement(ea,{className:l("callToActionTextContainer",t)},vt.createElement(Ce,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&vt.createElement(Rl,{className:l("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&vt.createElement(ta,{appearance:t,className:l("callToActionVideo",t)},vt.createElement(Pt,{appearance:t,videoUri:e.videoUri})))}import Ve,{useEffect as Go,useState as jo}from"react";import qt from"react";import Vt from"react";import{motion as oa}from"framer-motion";var qr=({color:e,percentage:t,size:o})=>{let i=o*.5-2,r=2*Math.PI*i,n=(1-t)*r,s={duration:.3,delay:0,ease:"easeIn"},p={hidden:{strokeDashoffset:r,transition:s},show:{strokeDashoffset:n,transition:s}};return Vt.createElement(oa.circle,{r:i,cx:o*.5,cy:o*.5,fill:"transparent",stroke:n!==r?e:"",strokeWidth:"3px",strokeDasharray:r,strokeDashoffset:t?n:0,variants:p,transition:s,initial:"hidden",animate:"show"})},ra=({fillColor:e,size:t,percentage:o,children:i,bgColor:r="#D9D9D9",className:n,style:s})=>Vt.createElement("svg",{style:s,className:n,width:t,height:t,overflow:"visible"},Vt.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},Vt.createElement(qr,{color:r,size:t}),Vt.createElement(qr,{color:e,percentage:o,size:t})),i),Et=ra;var It={theme:{colorPrimary:"#000000",colorText:"#000000",colorBackground:"#ffffff",colorBackgroundSecondary:"#d2d2d2",colorTextOnPrimaryBackground:"#ffffff",colorTextSecondary:"#505050",colorTextDisabled:"#999999",colorBorder:"#E5E5E5",colorTextError:"#c00000",borderRadius:20}};import ia from"styled-components";var na=({color:e="#FFFFFF"})=>qt.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),sa={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},la={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},aa={border:"1px solid #000000",color:"#FFFFFF"},pa={border:"1px solid #E6E6E6"},da={color:"#FFFFFF"},ca={border:"3px solid #D9D9D9"},ma=e=>e==="square"?sa:la,ua=(e,t)=>e==="square"?t?aa:pa:t?da:ca,fa=ia.div`
|
|
474
474
|
${e=>pt(e)}
|
|
475
|
-
`,ct=({value:e,type:t="square",primaryColor:o="#000000",progress:
|
|
475
|
+
`,ct=({value:e,type:t="square",primaryColor:o="#000000",progress:i,appearance:r=It,style:n,className:s})=>{let p=ma(t),d=ua(t,e);return e===!0?p={...p,...d,backgroundColor:o,borderColor:t==="square"?o:"none"}:p={...p,...d},e!==!0&&t==="round"&&i!==void 0&&i!==1?qt.createElement(Et,{fillColor:o,percentage:i,size:22}):qt.createElement(fa,{styleOverrides:p,style:n,role:"checkbox",className:xe(l("checkIconContainer",r),l(e?"checkIconContainerChecked":"checkIconContainerUnchecked",r),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&qt.createElement(na,{color:"#FFFFFF"}))};import et from"styled-components";var Kr=et.div`
|
|
476
476
|
width: auto;
|
|
477
477
|
display: flex;
|
|
478
478
|
flex-direction: column;
|
|
@@ -525,8 +525,8 @@ import ut,{createContext as ka,useEffect as qo,useState as Be}from"react";import
|
|
|
525
525
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
526
526
|
display: flex;
|
|
527
527
|
align-self: center;
|
|
528
|
-
`;var ti=({stepData:e,setCanContinue:t,onSaveData:o,appearance:
|
|
529
|
-
${
|
|
528
|
+
`;var ti=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let r=e.props,[n,s]=jo([]),[p,d]=jo(!1),[a,u]=jo(e.id);return Go(()=>{n.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),Go(()=>{a!==e.id&&(u(e.id),s([]))},[e]),Go(()=>{o({choice:n}),n.length>=r.minChoices?t(!0):t(!1)},[n]),Ve.createElement(Kr,{className:l("selectListContainer",i)},Ve.createElement(Yr,null,Ve.createElement(Xr,{className:l("selectListTitle",i)},e.title),Ve.createElement(Jr,{appearance:i,className:l("selectListSubtitle",i)},e.subtitle)),r.options.map((c,f)=>{let w=n.includes(c.id);return Ve.createElement(Qr,{key:`select-item-${f}`,onClick:()=>{if(n.includes(c.id)){s(n.filter(T=>T!==c.id));return}n.length<r.maxChoices?s([...n,c.id]):n.length==1&&r.maxChoices==1&&s([c.id])},hideBottomBorder:f===r.options.length-1,className:l("selectListSelectItem",i)},Ve.createElement(Zr,{className:l("selectListItemImage",i)},c.imageUri&&Ve.createElement(Rr,{src:c.imageUri,alt:`select-icon-${f}`}),Ve.createElement(ei,{appearance:i,className:l("selectListSelectItemText",i)},c.title)),Ve.createElement(ct,{appearance:i,value:w,primaryColor:i.theme.colorPrimary}))}))};import Se,{useEffect as Vo,useState as So}from"react";import{AnimatePresence as ga,motion as ha}from"framer-motion";var xa=({children:e,id:t,shouldWrap:o=!1})=>Se.createElement(Se.Fragment,null,o?Se.createElement(ga,{initial:!1},Se.createElement(ha.div,{key:t,initial:{opacity:1,y:"100%"},animate:{opacity:1,y:0},exit:{opacity:0,y:"-100%"},transition:{duration:.5,ease:"easeInOut"},style:{width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:1,overflowY:"auto"}},e)):e),yo=({appearance:e,steps:t,selectedStep:o,customStepTypes:i,customVariables:r,onButtonClick:n,onStepCompletion:s,flowId:p,type:d,hideOnFlowCompletion:a,onComplete:u,setVisible:c,setShowModal:f,onDismiss:w,showPagination:T=!1,customFormElements:S,allowBackNavigation:x})=>{var L;let y={...{linkCollection:jr,multiInput:Or,callToAction:Vr,selectList:ti},...i},{primaryCTAClickSideEffects:I,secondaryCTAClickSideEffects:F}=ie(),[g,m]=So(!1),[C,v]=So({}),[U,$]=So(!1),[_,A]=So(!1),H=t[o]??null,{markStepCompleted:B,markStepStarted:M,isLoading:re,updateCustomVariables:X,markFlowCompleted:W}=Y();Vo(()=>{X(r)},[r,re]),Vo(()=>{window&&x&&!_&&(window.location.hash=t[o].id,A(!0))},[x,_,A]),Vo(()=>{var N;if(window&&((N=window==null?void 0:window.location)!=null&&N.hash)&&window.location.hash.replace("#","")!==t[o].id){let ee=window.location.hash.replace("#",""),te=t.findIndex(we=>we.id===ee);te!==-1&&M(p,t[te].id)}},[(L=window==null?void 0:window.location)==null?void 0:L.hash,M,o,t]);function be(){return{data:C[t[o].id]??{},stepId:t[o].id,customVariables:r}}function me(N,ee,te){let we=o+1<t.length?t[o+1]:null;n&&n(N,o,ee,we),s&&s(N,te,we,C,be())}function j(N,ee){v(te=>{let we={};return we[N.id]=ee,{...te,...we}})}function J(N){return N.selectedStep.imageUri?Se.createElement(Wr,{image:N.selectedStep.imageUri,appearance:e,className:l("formContainerSidebarImage",e)}):null}let fe=Se.createElement(Hr,{step:t[o],canContinue:g&&!U,formType:d,selectedStep:o,appearance:e,onPrimaryClick:async()=>{$(!0);let N={...be()};await B(p,t[o].id,N),o+1<t.length&&await M(p,t[o+1].id),me(t[o],"primary",o),o+1>=t.length&&(u&&u(),w&&w(),a&&(c&&c(!1),f(!1)),await W(p)),I(t[o]),$(!1),window&&x&&o+1<t.length&&(window.location.hash=t[o+1].id)},onSecondaryClick:()=>{me(t[o],"secondary",o),F(t[o])},onBack:async()=>{o-1>=0&&($(!0),await M(p,t[o-1].id),$(!1))},steps:t,allowBackNavigation:x});return Se.createElement(Se.Fragment,null,Se.createElement(Mr,{className:l("formContainer",e)},Se.createElement(Ur,null,Se.createElement(xa,{id:o,shouldWrap:d==="large-modal"},Se.createElement(_r,{key:H.id,type:d,className:l("formContent",e)},t.map(N=>{let ee=y[N.type];return H.id!==N.id?null:Se.createElement(ee,{key:N.id,stepData:N,canContinue:g,setCanContinue:m,onSaveData:te=>{j(N,te)},appearance:e,customFormElements:S})}),T&&Se.createElement(Gr,{className:l("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),fe))),d=="large-modal"&&Se.createElement(J,{selectedStep:t[o]})))};import Kt from"react";import{createGlobalStyle as Ca}from"styled-components";function oe({appearance:e}){if(!e||!e.styleOverrides)return Kt.createElement(Kt.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([i,r])=>typeof r=="object");if(t.length===0)return Kt.createElement(Kt.Fragment,null);let o=Ca`
|
|
529
|
+
${i=>i.inlineStyles.map(([r,n])=>`.${zt}${r}.${zt}${r} { ${Object.entries(n).map(([s,p])=>`${Oo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return Kt.createElement(o,{inlineStyles:t})}var oi=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:r,customVariables:n,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:a=!0,onStepCompletion:u,onButtonClick:c,dismissible:f=!0,endFlowOnDismiss:w=!1,modalPosition:T="center",repeatable:S=!1,onDismiss:x,showPagination:E=!1,allowBackNavigation:y=!1})=>{let{getFlow:I,getFlowSteps:F,isLoading:g,targetingLogicShouldHideFlow:m,getFlowStatus:C,getCurrentStepIndex:v,markFlowCompleted:U,markFlowNotStarted:$}=Y(),_=v(e),{mergeAppearanceWithDefault:A}=Q(),[H,B]=ya(!1),{setOpenFlowState:M,getOpenFlowState:re}=Pe();d=A(d);let[X,W]=i!==void 0&&r!==void 0?[i,r]:[re(e,!0),J=>M(e,J)];if(Sa(()=>{!H&&!g&&(B(!0),C(e)===K&&S&&$(e),B(!0))},[H,B,g]),g)return null;let be=I(e);if(!be||m(be))return null;let me=F(e);if(!me||i!==void 0&&i===!1||C(e)===K&&a)return null;let j=()=>{W(!1),x&&x(),w===!0&&U(e)};if(T=="center"&&o==="modal"||o==="large-modal"){let J={padding:"24px"};return o==="large-modal"?(J.width="85%",J.height="90%",J.maxHeight="800px",J.minHeight="500px",J.padding="0"):J.width="400px",Me.createElement(Qe,{appearance:d,onClose:j,visible:X,style:J,dismissible:f},Me.createElement(oe,{appearance:d}),Me.createElement(yo,{appearance:d,steps:me,selectedStep:_,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:u,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:W,onDismiss:x,showPagination:E,customFormElements:s,allowBackNavigation:y}))}return o==="modal"&&T!=="center"?Me.createElement(xr,{appearance:d,onClose:j,visible:X},Me.createElement(oe,{appearance:d}),Me.createElement(yo,{appearance:d,steps:me,selectedStep:_,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:u,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:W,onDismiss:x,showPagination:E,customFormElements:s,allowBackNavigation:y})):Me.createElement(Me.Fragment,null,Me.createElement(oe,{appearance:d}),Me.createElement(yo,{appearance:d,steps:me,selectedStep:_,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:u,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:W,onDismiss:x,showPagination:E,customFormElements:s,allowBackNavigation:y}))},ri=oi;import{useCallback as ii,useContext as ba,useEffect as wa}from"react";function qo(){let{organizationId:e,userId:t,setOrganizationId:o}=ba(V),{mutateUserFlowState:i}=Ae(),{config:r}=De(),n=yt(),{verifySDKInitiated:s}=bt();wa(()=>{if(t&&e){if(t.startsWith(wt))return;let a=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(a)||(n(`${Te}userGroups`,{...r,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(a,"true"))}},[t,e]);let p=ii(async a=>{if(s(),!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let u={foreignUserId:t,foreignUserGroupId:e,properties:a};await n(`${Te}userGroups`,{...r,method:"POST",body:JSON.stringify(u)}),i()},[e,t,r,i]),d=ii(async(a,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 f={foreignUserId:t,foreignUserGroupId:e,events:[{event:a,properties:u}]};await n(`${Te}userGroups`,{...r,method:"POST",body:JSON.stringify(f)}),i()},[e,t,r,i]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:p,trackEventForOrganization:d}}var ni="xFrigade_guestUserId",si="xFrigade_userId",li=({})=>{let{setFlowResponses:e}=Wt(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=Ae(),{userId:r,setUserId:n}=Lo(),[s,p]=Ko(null),{getFlowStatus:d}=Y(),{flows:a,userProperties:u,setIsNewGuestUser:c,flowResponses:f}=Ta(V),[w,T]=Ko([]),[S,x]=Ko([]),{organizationId:E}=qo();bo(()=>{if(!o&&t)for(let g=0;g<t.length;g++){let m=t[g],C=a.find(v=>v.slug===(m==null?void 0:m.flowId));if(C&&m&&m.shouldTrigger===!0&&C.type=="FORM"&&C.triggerType==="AUTOMATIC"&&!S.includes(C.slug)){setTimeout(()=>{y(m.flowId)},500);break}}},[o,t]),bo(()=>{f.length>0&&i()},[f]);function y(g){let m=a.find(C=>C.slug===g);m&&m.triggerType==="AUTOMATIC"&&!S.includes(m.slug)&&(x([...S,m.slug]),T([m]))}function I(){if(!r){let g=localStorage.getItem(si);if(g){n(g);return}let m=localStorage.getItem(ni);if(m){n(m);return}c(!0);let C=wt+Fa();try{localStorage.setItem(ni,C)}catch(v){console.log("Failed to save guest user id locally: Local storage unavailable",v)}n(v=>v||C)}}bo(()=>{try{if(a){let g=[];a.forEach(m=>{if(m.data){let C=m.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{}},[a]),bo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(wt))try{localStorage.setItem(si,r)}catch(g){console.log("Failed to save user id locally: Local storage available",g)}r===null&&setTimeout(()=>{r===null&&I()},50)},[r,a,u]);function F(){return mt.createElement(mt.Fragment,null,w.map(g=>d(g.slug)!==Ne?null:mt.createElement("span",{key:g.slug},mt.createElement(ri,{flowId:g.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return mt.createElement(mt.Fragment,null,mt.createElement(F,null))};import{ErrorBoundary as va}from"react-error-boundary";var V=ka({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:It,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{}}),Ea=({publicApiKey:e,userId:t,organizationId:o,config:i,children:r})=>{var re,X;let[n,s]=Be(t||null),[p,d]=Be(o||null),[a,u]=Be([]),[c,f]=Be([]),[w,T]=Be([]),[S,x]=Be({}),[E,y]=Be({}),[I,F]=Be([]),[g,m]=Be({}),[C,v]=Be(!1),[U,$]=Be(!1),[_,A]=Be(!M(e)),H=(W,be)=>{if(be==="_blank"){window.open(W,"_blank");return}setTimeout(()=>{window.location.href=W},50)},B={theme:{...It.theme,...((re=i==null?void 0:i.defaultAppearance)==null?void 0:re.theme)??{}},styleOverrides:{...It.styleOverrides,...((X=i==null?void 0:i.defaultAppearance)==null?void 0:X.styleOverrides)??{}}};function M(W){return!!(W&&W.length>10&&W.substring(0,10)==="api_public")}return Yo(()=>{t&&s(t)},[t]),Yo(()=>{o&&d(o)},[o]),Yo(()=>{if(M(e))A(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),A(!0);return}},[e,A]),_?ut.createElement(V.Provider,{value:{publicApiKey:e,userId:n,setUserId:s,setFlows:u,flows:a,failedFlowResponses:c,setFailedFlowResponses:f,flowResponses:w,setFlowResponses:T,userProperties:S,setUserProperties:x,openFlowStates:E,setOpenFlowStates:y,completedFlowsToKeepOpenDuringSession:I,setCompletedFlowsToKeepOpenDuringSession:F,customVariables:g,setCustomVariables:m,isNewGuestUser:C,setIsNewGuestUser:v,hasActiveFullPageFlow:U,setHasActiveFullPageFlow:$,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:H,defaultAppearance:B,shouldGracefullyDegrade:_,setShouldGracefullyDegrade:A}},r):ut.createElement(va,{fallback:ut.createElement(ut.Fragment,null,r)},ut.createElement(V.Provider,{value:{publicApiKey:e,userId:n,setUserId:s,setFlows:u,flows:a,failedFlowResponses:c,setFailedFlowResponses:f,flowResponses:w,setFlowResponses:T,userProperties:S,setUserProperties:x,openFlowStates:E,setOpenFlowStates:y,completedFlowsToKeepOpenDuringSession:I,setCompletedFlowsToKeepOpenDuringSession:F,customVariables:g,setCustomVariables:m,isNewGuestUser:C,setIsNewGuestUser:v,hasActiveFullPageFlow:U,setHasActiveFullPageFlow:$,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:H,defaultAppearance:B,shouldGracefullyDegrade:_,setShouldGracefullyDegrade:A}},ut.createElement(Pa,{theme:B.theme},r,ut.createElement(li,null))))};import kp from"react";import le,{useEffect as Un,useState as _n}from"react";import Oe,{useState as Ja}from"react";import ht from"styled-components";import Fo from"react";import ft from"react";import pi from"styled-components";var ai=pi.span`
|
|
530
530
|
font-weight: 400;
|
|
531
531
|
font-size: 15px;
|
|
532
532
|
line-height: 20px;
|
|
@@ -543,7 +543,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
543
543
|
padding-bottom: 20px;
|
|
544
544
|
border-top: 1px solid ${e=>e.theme.colorBorder};
|
|
545
545
|
width: 100%;
|
|
546
|
-
`,wo=({label:e,value:t,labelStyle:o={},labelPosition:
|
|
546
|
+
`,wo=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:r,primaryColor:n="#000000",checkBoxType:s="square",appearance:p})=>ft.createElement(ft.Fragment,null,ft.createElement(Ia,{className:l("checklistStepsContainer",p),appearance:p,style:{...r}},i==="left"&&e&&ft.createElement(ai,{className:l("checklistStepLabel",p),style:o},e),ft.createElement(ct,{appearance:p,value:t,type:s,primaryColor:n}),i==="right"&&e&&ft.createElement(ai,{className:l("checklistStepLabel",p),style:o},e)),ft.createElement(oe,{appearance:p}));import{motion as Aa}from"framer-motion";import Yt from"styled-components";var di=Yt.div`
|
|
547
547
|
font-weight: 700;
|
|
548
548
|
font-size: 18px;
|
|
549
549
|
line-height: 22px;
|
|
@@ -571,18 +571,18 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
571
571
|
`,ui=Yt.div`
|
|
572
572
|
flex-direction: row;
|
|
573
573
|
justify-content: flex-start;
|
|
574
|
-
`;var fi=({data:e,index:t,isSelected:o,primaryColor:
|
|
574
|
+
`;var fi=({data:e,index:t,isSelected:o,primaryColor:i,style:r,onClick:n,appearance:s})=>{var p,d;return Fo.createElement("div",{style:{position:"relative",paddingLeft:"20px"},onClick:()=>{n()}},o&&Fo.createElement(To,{className:l("checklistStepItemSelectedIndicator",s),as:Aa.div,layoutId:"checklis-step-selected",style:{backgroundColor:((p=s==null?void 0:s.theme)==null?void 0:p.colorPrimary)??i}}),Fo.createElement(ui,{className:l("checklistStepItem",s),key:`hero-checklist-step-${t}`,role:"listitem"},Fo.createElement(wo,{value:e.complete,labelPosition:"left",label:e.stepName,style:r,primaryColor:((d=s==null?void 0:s.theme)==null?void 0:d.colorPrimary)??i,appearance:s})))};import gt from"react";import{motion as Ba}from"framer-motion";import Xo from"styled-components";var Na={backgroundColor:"#E6E6E6"},La=Xo.div`
|
|
575
575
|
display: flex;
|
|
576
576
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
577
577
|
justify-content: flex-start;
|
|
578
578
|
align-items: ${e=>e.textLocation=="top"?"flex-end":"center"};
|
|
579
579
|
|
|
580
580
|
${e=>pt(e)}
|
|
581
|
-
`,Oa=
|
|
581
|
+
`,Oa=Xo.div`
|
|
582
582
|
flex-grow: 1;
|
|
583
583
|
position: relative;
|
|
584
584
|
${e=>e.textLocation=="top"?"width: 100%;":""}
|
|
585
|
-
`,Da=
|
|
585
|
+
`,Da=Xo.span`
|
|
586
586
|
font-weight: 500;
|
|
587
587
|
font-size: 15px;
|
|
588
588
|
line-height: 18px;
|
|
@@ -590,7 +590,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
590
590
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
591
591
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
592
592
|
${e=>pt(e)}
|
|
593
|
-
`,$a={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},Ma={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},Ue=({count:e,total:t,fillColor:o,bgColor:
|
|
593
|
+
`,$a={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},Ma={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},Ue=({count:e,total:t,fillColor:o,bgColor:i=Na.backgroundColor,display:r="count",textLocation:n="left",style:s={},textStyle:p={},appearance:d})=>{var T,S;if(t===0)return gt.createElement(gt.Fragment,null);let a=e===0?"10px":`${e/t*100}%`,u=r==="compact"?"5px":"10px",c=Math.round(e/t*100),f=r==="compact"?"5px":"20px",w;return r==="count"?w=`${e} of ${t}`:r==="compact"?w=`${c}%`:r==="percent"&&(w=`${c}% complete`),n==="top"&&(f="0px"),gt.createElement(La,{className:l("progressBarContainer",d),textLocation:n,styleOverrides:s},gt.createElement(Da,{className:l("progressBarStepText",d),style:{...p,fontSize:r==="compact"?12:15,fontWeight:r==="compact"?400:500},appearance:d,padding:f,textLocation:n},w),gt.createElement(Oa,{textLocation:n,className:l("progressBar",d)},gt.createElement(Ba.div,{style:{...Ma,width:a,height:u,backgroundColor:((T=d==null?void 0:d.theme)==null?void 0:T.colorPrimary)??o,zIndex:r=="compact"?1:5},className:l("progressBarFill",d)}),gt.createElement("div",{className:l("progressBarBackground",d),style:{...$a,height:u,backgroundColor:((S=d==null?void 0:d.theme)==null?void 0:S.colorSecondary)??i}})))};import Jt from"react";import Ua from"styled-components";import Po from"react";import ko from"react";var At=({stepData:e,appearance:t})=>ko.createElement(ko.Fragment,null,ko.createElement(ci,{appearance:t,className:l("checklistStepTitle",t),dangerouslySetInnerHTML:pe(e.title)}),ko.createElement(mi,{appearance:t,className:l("checklistStepSubtitle",t),dangerouslySetInnerHTML:pe(e.subtitle)}));import Xt from"react";var Bt=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},i=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return Xt.createElement(Xt.Fragment,null,Xt.createElement(go,null,e.secondaryButtonTitle&&Xt.createElement(R,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:i,style:{width:"auto",marginRight:"12px"}}),Xt.createElement(R,{appearance:t,title:e.primaryButtonTitle,onClick:o})))};var Nt=({stepData:e,appearance:t})=>Po.createElement(Po.Fragment,null,Po.createElement(At,{stepData:e,appearance:t}),Po.createElement(Bt,{stepData:e,appearance:t}));import gi from"react";function hi(e){if(e.videoUri.includes("youtube")){let t=e.videoUri.split("v=")[1],o=t.indexOf("&");return o!==-1&&(t=t.substring(0,o)),gi.createElement("iframe",{width:"480",height:"260",src:`https://www.youtube.com/embed/${t}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:l("checklistStepVideo",e.appearance)})}else return gi.createElement("video",{width:"480",height:"260",controls:!0,src:e.videoUri})}var Jo="default",_a=Ua.img`
|
|
594
594
|
border-radius: 4px;
|
|
595
595
|
max-height: 260px;
|
|
596
596
|
min-height: 200px;
|
|
@@ -619,7 +619,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
619
619
|
font-size: 14px;
|
|
620
620
|
line-height: 20px;
|
|
621
621
|
text-align: center;
|
|
622
|
-
`,
|
|
622
|
+
`,qa=Lt.div`
|
|
623
623
|
position: absolute;
|
|
624
624
|
width: 200px;
|
|
625
625
|
height: 120px;
|
|
@@ -639,9 +639,9 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
639
639
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
640
640
|
border-radius: 50%;
|
|
641
641
|
}
|
|
642
|
-
`,Si="videoCarousel",yi=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return Ee.createElement(Ci,null,Ee.createElement(Nt,{stepData:e,appearance:t}));function o({video:
|
|
642
|
+
`,Si="videoCarousel",yi=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return Ee.createElement(Ci,null,Ee.createElement(Nt,{stepData:e,appearance:t}));function o({video:n}){let s=Wa(),[p,d]=za(!1);return Ee.createElement(Ga,null,!p&&Ee.createElement(qa,{onClick:()=>{d(!0),s.current.play()},appearance:t},Ee.createElement(ho,null)),Ee.createElement(ja,{controls:p,ref:s,play:p,src:n.uri}),Ee.createElement(Va,null,n.title))}let i=e.props;return i.videos?Ee.createElement(Ci,null,Ee.createElement(At,{stepData:e,appearance:t}),Ee.createElement(Ha,null,i.videos.map((n,s)=>Ee.createElement("span",{key:`${n.uri}-${s}`},Ee.createElement(o,{video:n})))),Ee.createElement(Bt,{stepData:e,appearance:t})):null};import qe from"react";import vo from"styled-components";var bi=vo.div`
|
|
643
643
|
display: block;
|
|
644
|
-
`,
|
|
644
|
+
`,Ka=vo.pre`
|
|
645
645
|
display: block;
|
|
646
646
|
background-color: #2a2a2a;
|
|
647
647
|
color: #f8f8f8;
|
|
@@ -664,7 +664,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
664
664
|
margin-top: 12px;
|
|
665
665
|
`,Xa=vo.div`
|
|
666
666
|
margin-top: 24px;
|
|
667
|
-
`,wi="codeSnippet",Ti=({stepData:e,appearance:t})=>{var
|
|
667
|
+
`,wi="codeSnippet",Ti=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.codeSnippets))return qe.createElement(bi,null,qe.createElement(Nt,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?qe.createElement(bi,null,qe.createElement(At,{stepData:e,appearance:t}),qe.createElement(Xa,null,o.codeSnippets.map((r,n)=>qe.createElement("div",{key:n},r.title?qe.createElement(Ya,null,r.title):null,r.code?qe.createElement(Ka,null,r.code):null))),qe.createElement(Bt,{stepData:e,appearance:t})):null};var Qa=ht.div`
|
|
668
668
|
display: flex;
|
|
669
669
|
flex-direction: row;
|
|
670
670
|
min-width: ${e=>e.type!="modal"?"1000px":"100%"};
|
|
@@ -695,9 +695,9 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
695
695
|
`,op=ht.div`
|
|
696
696
|
flex: 2;
|
|
697
697
|
padding: 2rem;
|
|
698
|
-
`,rp=({title:e,subtitle:t,steps:o=[],style:
|
|
698
|
+
`,rp=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:r,setSelectedStep:n,className:s="",customStepTypes:p=new Map,appearance:d,type:a})=>{let{mergeAppearanceWithDefault:u}=Q();d=u(d);let f={...{[Jo]:xi,[Si]:yi,[wi]:Ti},...p},[w,T]=Ja(0),S=r??w,x=n??T,E=o.filter(I=>I.complete===!0).length,y=()=>{var I;return!((I=o[S])!=null&&I.type)||!f[o[S].type]?f[Jo]({stepData:o[S],appearance:d}):f[o[S].type]({stepData:o[S],appearance:d})};return Oe.createElement(Qa,{type:a,style:i,className:s,appearance:d},Oe.createElement(Fi,{style:{flex:1}},Oe.createElement(Fi,{style:{padding:"30px 0px 30px 30px",borderBottom:"none"}},Oe.createElement(Za,{className:l("checklistTitle",d),appearance:d},e),Oe.createElement(Ra,{className:l("checklistSubtitle",d),appearance:d},t),Oe.createElement(Ue,{total:o.length,count:E,fillColor:d.theme.colorPrimary,style:{marginTop:"24px"},appearance:d})),Oe.createElement(ep,{className:l("checklistStepsContainer",d)},o.map((I,F)=>Oe.createElement(fi,{data:I,index:F,key:F,listLength:o.length,isSelected:F===S,primaryColor:d.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{x(F)}})))),Oe.createElement(tp,{appearance:d,className:l("checklistDivider",d)}),Oe.createElement(op,null,Oe.createElement(y,null)))},Qo=rp;import O,{useState as pp}from"react";import ki from"react";import ip from"styled-components";var np=ip.svg`
|
|
699
699
|
transition: 'transform 0.35s ease-in-out';
|
|
700
|
-
`,Ot=({color:e="#323232",style:t,className:o})=>ki.createElement(np,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},ki.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as dp}from"framer-motion";import de from"styled-components";var
|
|
700
|
+
`,Ot=({color:e="#323232",style:t,className:o})=>ki.createElement(np,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},ki.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as dp}from"framer-motion";import de from"styled-components";var Zo={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},Pi=de.div`
|
|
701
701
|
max-height: 350px;
|
|
702
702
|
padding-bottom: 40px;
|
|
703
703
|
`,vi=de.div`
|
|
@@ -833,7 +833,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
833
833
|
flex-direction: column;
|
|
834
834
|
justify-content: center;
|
|
835
835
|
display: flex;
|
|
836
|
-
`;import Ye from"react";import{motion as lp}from"framer-motion";import
|
|
836
|
+
`;import Ye from"react";import{motion as lp}from"framer-motion";import Ke from"styled-components";var Vi=Ke.div`
|
|
837
837
|
border: 1px solid #fafafa;
|
|
838
838
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
839
839
|
border-radius: 14px;
|
|
@@ -841,13 +841,13 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
841
841
|
display: flex;
|
|
842
842
|
flex-direction: column;
|
|
843
843
|
overflow: hidden;
|
|
844
|
-
`,
|
|
844
|
+
`,qi=Ke.div`
|
|
845
845
|
display: flex;
|
|
846
846
|
flex-wrap: wrap;
|
|
847
847
|
justify-content: space-between;
|
|
848
848
|
overflow: hidden;
|
|
849
849
|
row-gap: 10px;
|
|
850
|
-
`,
|
|
850
|
+
`,Ki=Ke.div`
|
|
851
851
|
${e=>k(e)} {
|
|
852
852
|
color: #595959;
|
|
853
853
|
}
|
|
@@ -857,7 +857,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
857
857
|
line-height: 12px;
|
|
858
858
|
letter-spacing: 0.09em;
|
|
859
859
|
margin-bottom: 12px;
|
|
860
|
-
`,Yi=
|
|
860
|
+
`,Yi=Ke.div`
|
|
861
861
|
${e=>k(e)} {
|
|
862
862
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
863
863
|
background: #ffffff;
|
|
@@ -870,7 +870,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
870
870
|
|
|
871
871
|
max-width: 150px;
|
|
872
872
|
min-width: 200px;
|
|
873
|
-
`,Xi=
|
|
873
|
+
`,Xi=Ke.div`
|
|
874
874
|
${e=>k(e)} {
|
|
875
875
|
background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);
|
|
876
876
|
}
|
|
@@ -882,13 +882,13 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
882
882
|
justify-content: center;
|
|
883
883
|
align-content: center;
|
|
884
884
|
align-items: center;
|
|
885
|
-
`,Ji=
|
|
885
|
+
`,Ji=Ke.div`
|
|
886
886
|
font-weight: 600;
|
|
887
887
|
font-size: 20px;
|
|
888
888
|
line-height: 24px;
|
|
889
889
|
width: 20px;
|
|
890
890
|
height: 20px;
|
|
891
|
-
`,Qi=
|
|
891
|
+
`,Qi=Ke.div`
|
|
892
892
|
${e=>k(e)} {
|
|
893
893
|
color: #434343;
|
|
894
894
|
}
|
|
@@ -897,20 +897,20 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
897
897
|
line-height: 17px;
|
|
898
898
|
margin-top: 12px;
|
|
899
899
|
margin-bottom: 8px;
|
|
900
|
-
`,Zi=
|
|
900
|
+
`,Zi=Ke.div`
|
|
901
901
|
${e=>k(e)} {
|
|
902
902
|
color: #8c8c8c;
|
|
903
903
|
}
|
|
904
904
|
font-weight: 400;
|
|
905
905
|
font-size: 12px;
|
|
906
906
|
line-height: 14px;
|
|
907
|
-
`,Ri=
|
|
907
|
+
`,Ri=Ke.a`
|
|
908
908
|
color: ${e=>e.color};
|
|
909
909
|
font-size: 12px;
|
|
910
910
|
line-height: 14px;
|
|
911
911
|
font-weight: 400;
|
|
912
912
|
cursor: pointer;
|
|
913
|
-
`;var ap=({steps:e,style:t,title:o,primaryColor:
|
|
913
|
+
`;var ap=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=ie();return Ye.createElement(Vi,{style:t,className:l("guideContainer",r)},Ye.createElement(Ki,{className:l("guideTitle",r)},o),Ye.createElement(qi,{className:l("guideItemContainer",r)},e.map((p,d)=>Ye.createElement(Yi,{key:`guide-${p.id??d}`,as:lp.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:l("guideItem",r)},p.icon&&Ye.createElement(Xi,{className:l("guideIcon",r)},Ye.createElement(Ji,null,p.icon)),Ye.createElement(Qi,{className:l("guideItemTitle",r),dangerouslySetInnerHTML:pe(p.title)}),Ye.createElement(Zi,{className:l("guideItemSubtitle",r),dangerouslySetInnerHTML:pe(p.subtitle)}),Ye.createElement(Ri,{className:l("guideItemLink",r),color:i,onClick:()=>{p.primaryButtonUri&&s(p),n&&n(p)}},p.primaryButtonTitle)))))},Qt=ap;var cp=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:r,onClose:n,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:a,guideData:u,guideTitle:c,onGuideButtonClick:f})=>{let w=({stepData:m,handleSecondaryCTAClick:C,handleCTAClick:v})=>m?O.createElement(Di,{className:l("checklistStepContainer",a),"data-testid":"checklistStepContainer"},O.createElement($i,{appearance:a,className:l("checklistStepTitle",a),dangerouslySetInnerHTML:pe(m.title)}),O.createElement(Mi,{appearance:a,className:l("checklistStepSubtitle",a),dangerouslySetInnerHTML:pe(m.subtitle)}),O.createElement(Ui,{className:l("checklistCTAContainer",a)},m.secondaryButtonTitle&&O.createElement(R,{title:m.secondaryButtonTitle,onClick:C,appearance:a,secondary:!0}),O.createElement(R,{title:m.primaryButtonTitle,onClick:v,appearance:a}))):O.createElement(O.Fragment,null),S={...{default:m=>{var $;if(($=e[y])!=null&&$.StepContent){let _=e[y].StepContent;return O.createElement("div",null,_)}let C=e[y];return O.createElement(w,{stepData:m,handleCTAClick:()=>{C.handlePrimaryButtonClick&&C.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{C.handleSecondaryButtonClick&&C.handleSecondaryButtonClick()}})}},...d},[x,E]=pp(0),y=s??x,I=p??E,F=()=>{var m;return e?!((m=e[y])!=null&&m.type)||!S[e[y].type]?S.default(e[y]):S[e[y].type]({stepData:e[y],primaryColor:a.theme.colorPrimary}):O.createElement(O.Fragment,null)},g=e.filter(m=>m.complete).length;return r?(a.theme.modalContainer||(a.theme.borderRadius&&(Zo.borderRadius=a.theme.borderRadius+"px"),a.theme.modalContainer=Zo),O.createElement(Qe,{onClose:n,visible:r,appearance:a},O.createElement(Gi,null,O.createElement(vi,null,O.createElement(Ei,{appearance:a,className:l("checklistTitle",a)},t),O.createElement(Ii,{appearance:a,className:l("checklistSubtitle",a)},o)),O.createElement(Pi,null,e&&e.length>0&&O.createElement(Ai,{className:l("stepsContainer",a)},O.createElement(Bi,null,O.createElement("div",{style:{flex:3}},O.createElement(Ni,{className:l("stepsTitle",a)},i)),O.createElement(Hi,null,O.createElement(Ue,{fillColor:a.theme.colorPrimary,style:{width:"100%"},count:g,total:e.length,appearance:a}))),O.createElement(Li,null,O.createElement(Oi,{className:l("checklistStepListContainer",a),appearance:a},e.map((m,C)=>{let v=y===C;return O.createElement(_i,{selected:v,className:l(`checklistStepListItem${v?"Selected":""}`,a),key:`checklist-guide-step-${m.id??C}`,disabled:m.blocked,onClick:()=>{m.blocked||I(C)},title:m.blocked?"Finish remaining steps to continue":void 0},v&&O.createElement(To,{className:l("checklistStepItemSelectedIndicator",a),as:dp.div,layoutId:"checklist-step-selected",style:{backgroundColor:a.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),O.createElement(Wi,{selected:v,className:l(`checklistStepListStepName${v?"Selected":""}`,a)},m.stepName),O.createElement(zi,null,O.createElement(ct,{value:m.complete,type:"round",primaryColor:a.theme.colorPrimary,progress:m.progress,appearance:a}),O.createElement(ji,null,O.createElement(Ot,{style:{marginLeft:"10px"},color:a.theme.colorBackgroundSecondary}))))})),O.createElement(F,null))),u&&u.length>0&&O.createElement(Qt,{steps:u,title:c,primaryColor:a.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:a,onButtonClick:m=>(f&&f(m),!0)}))))):O.createElement(O.Fragment,null)},Ro=cp;import{useEffect as mp,useState as up}from"react";var en=()=>{let e={isSmall:"(max-width: 480px)",isMedium:"(min-width: 481px) AND (max-width: 1023px)",isLarge:"(min-width: 1025px)"},t=Object.fromEntries(Object.entries(e).map(([p])=>[p,!1])),[o,i]=up(t),r=null,n=()=>{r!==null?clearTimeout(r):s(),r=setTimeout(()=>{s()},16)},s=()=>{let p=Object.fromEntries(Object.entries(e).map(([d,a])=>{if(!window)return[d,!1];let u=window.matchMedia(a);return u.addEventListener("change",n),[d,u.matches]}));i(p)};return mp(()=>{s()},[]),o};import Fe,{useEffect as hn,useState as hp}from"react";import ce from"react";import{AnimatePresence as fp,motion as gp}from"framer-motion";import Xe from"styled-components";var tn=Xe.div`
|
|
914
914
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
915
915
|
border: 1px solid;
|
|
916
916
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -957,7 +957,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
957
957
|
flex-direction: row;
|
|
958
958
|
justify-content: flex-start;
|
|
959
959
|
align-items: center;
|
|
960
|
-
`;var dn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:
|
|
960
|
+
`;var dn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:r,appearance:n,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(on,{className:l("stepMediaContainer",n)},e.imageUri?ce.createElement(rn,{className:l("stepImage",n),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?ce.createElement(Pt,{appearance:n,videoUri:e.videoUri}):null):null,ce.createElement(an,{className:l("stepSubtitle",n),appearance:n,dangerouslySetInnerHTML:pe(e.subtitle)}),ce.createElement(go,{className:l("checklistCTAContainer",n)},e.secondaryButtonTitle?ce.createElement(R,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>r(),appearance:n}):null,ce.createElement(R,{title:e.primaryButtonTitle??"Continue",onClick:()=>i(),appearance:n})))}function a(){if(!s)return null;let f=s[e.type];return f?f(e,n):null}return ce.createElement(tn,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:l("checklistStepContainer",n),appearance:n},ce.createElement(nn,{className:l("stepHeader",n)},ce.createElement(pn,null,ce.createElement(wo,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(u=n==null?void 0:n.theme)==null?void 0:u.colorPrimary,appearance:n}),ce.createElement(sn,{appearance:n,className:l("stepTitle",n),dangerouslySetInnerHTML:pe(e.title)})),ce.createElement(ln,{className:l("stepChevronContainer",n),onClick:()=>o()},ce.createElement(Ot,{style:{...p,transition:"transform 0.1s ease-in-out"},color:(c=n==null?void 0:n.theme)==null?void 0:c.colorTextSecondary}))),ce.createElement(fp,null,!t&&ce.createElement(gp.div,{initial:{opacity:1,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:1,height:0},key:e.id,style:{overflow:"hidden"}},a()??d())))};import Dt from"styled-components";var Qh=Dt.div`
|
|
961
961
|
background: #ffffff;
|
|
962
962
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
963
963
|
border-radius: 6px;
|
|
@@ -997,7 +997,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
997
997
|
justify-content: space-between;
|
|
998
998
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
999
999
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
1000
|
-
`;var xp=({title:e,subtitle:t,steps:o,onClose:
|
|
1000
|
+
`;var xp=({title:e,subtitle:t,steps:o,onClose:i,visible:r,onCompleteStep:n,autoExpandFirstIncompleteStep:s=!0,autoCollapse:p=!0,autoExpandNextStep:d=!0,primaryColor:a="#000000",selectedStep:u,setSelectedStep:c,appearance:f,type:w,className:T,customStepTypes:S})=>{let x=o.filter(m=>m.complete).length,[E,y]=hp(Array(o.length).fill(!0));hn(()=>{let m=[...E];if(s){for(let C=0;C<o.length;C++)if(!o[C].complete){m[C]=!1;break}y(m)}},[]),hn(()=>{I(u)},[u]);let I=m=>{let C=[...E];if(p)for(let v=0;v<E.length;++v)v!==m&&(C[v]=!0);C[m]=!C[m],y(C)};if(!r&&w=="modal")return Fe.createElement(Fe.Fragment,null);let F=Fe.createElement(Fe.Fragment,null,Fe.createElement(cn,null,Fe.createElement(mn,{appearance:f,className:l("checklistTitle",f),dangerouslySetInnerHTML:pe(e)}),Fe.createElement(un,{appearance:f,className:l("checklistSubtitle",f),dangerouslySetInnerHTML:pe(t)})),Fe.createElement(Ue,{display:"percent",count:x,total:o.length,fillColor:a,style:{margin:"14px 0px 8px 0px"},appearance:f})),g=Fe.createElement(fn,{className:xe(l("checklistContainer",f),T)},o.map((m,C)=>{let v=E[C];return Fe.createElement(dn,{appearance:f,stepData:m,collapsed:v,key:`modal-checklist-${m.id??C}`,onClick:()=>{if(u===C){I(C);return}c(C)},onPrimaryButtonClick:()=>{n&&n(C,m),m.handlePrimaryButtonClick&&m.handlePrimaryButtonClick(),d&&!m.completionCriteria&&C<E.length-1&&E[C+1]&&c(C+1)},onSecondaryButtonClick:()=>{m.handleSecondaryButtonClick&&m.handleSecondaryButtonClick()},customStepTypes:S})}));return w==="inline"?Fe.createElement(gn,{appearance:f,className:xe(l("checklistInlineContainer",f),T)},F,g):Fe.createElement(Fe.Fragment,null,Fe.createElement(Qe,{onClose:i,visible:r,appearance:f,style:{maxWidth:"600px"},headerContent:F},g))},er=xp;import se,{useEffect as tr,useRef as Tp,useState as Ct}from"react";import xt from"react";import ne,{css as xn,keyframes as Cn}from"styled-components";var Sn=xn`
|
|
1001
1001
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1002
1002
|
`,Cp=xn`
|
|
1003
1003
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
@@ -1132,7 +1132,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
1132
1132
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1133
1133
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1134
1134
|
`}
|
|
1135
|
-
`;var On=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:
|
|
1135
|
+
`;var On=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=Q(),{primaryCTAClickSideEffects:r}=ie(),{theme:n,styleOverrides:s}=i(o),{imageUri:p=null,subtitle:d=null,title:a=null,complete:u=!1,blocked:c=!1}=e,f=()=>{r(e)};return xt.createElement(kn,{className:l("carouselCard",o),onClick:c?null:f,style:t,blocked:c,complete:u},xt.createElement("div",{style:{alignItems:"flex-start",display:"flex",justifyContent:"space-between"}},p&&xt.createElement(Pn,{className:l("carouselCardImage",o),src:p,alt:a,style:{opacity:u||c?.4:1}}),u&&xt.createElement(An,{className:l("carouselCompletedPill",o)},xt.createElement(Ln,{style:{color:"#108E0B"}},"Complete"))),a&&xt.createElement(Nn,{blocked:c,complete:u,className:l("carouselCardTitle",o)},a),d&&xt.createElement(_e.Quiet,{blocked:c,complete:u,className:l("carouselCardSubtitle",o)},d))};import Zt from"react";var Dn=({numberOfStepsCompleted:e,numberOfSteps:t,appearance:o})=>{let i=t>0?e/t:0,r=200,n=Math.min(r,Math.max(10,Math.round(r*i)));return Zt.createElement(En,{className:l("carouselProgressBar",o)},Zt.createElement(In,{as:_e.Loud,style:{marginRight:8}},e," of ",t),Zt.createElement("svg",{height:10,width:r},Zt.createElement("rect",{x:0,y:0,rx:5,width:r,height:10,fill:"#E6E6E6"}),Zt.createElement("rect",{x:0,y:0,rx:5,width:n,height:10,fill:"currentColor"})))};var Fp=()=>se.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},se.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),se.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),se.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),$n=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,r]=Ct(!1),[n,s]=Ct(!1);tr(()=>{t===!0&&i===!1?r(!0):t===!1&&i===!0&&s(!0)},[t]);let p=()=>{r(!1),s(!1)},d=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return i?se.createElement(wn,{style:d,reversed:n,onAnimationEnd:n?p:null},se.createElement(Tn,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},se.createElement(Fp,null))):null},Mn=({flowId:e,appearance:t,customVariables:o,className:i})=>{let r=Tp(null),[n,s]=Ct(!1),[p,d]=Ct(!1),[a,u]=Ct(null),[c,f]=Ct([]),[w,T]=Ct(0),{getFlowMetadata:S,getFlowSteps:x,getNumberOfStepsCompleted:E,updateCustomVariables:y,getFlowStatus:I,isLoading:F,targetingLogicShouldHideFlow:g,getFlow:m}=Y();tr(()=>{y(o)},[o,F]),tr(()=>{if(F)return;let A=S(e),H=E(e),B=x(e);u(A),A.data!==null&&(f(B.sort((M,re)=>Number(M.complete)-Number(re.complete))),d(B.length>3),T(H))},[F]);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,B=H.scrollWidth-H.clientWidth,M=Math.ceil(H.scrollLeft);M>0&&n===!1&&s(!0),M===0&&n===!0&&s(!1),M<B&&p===!1&&d(!0),M===B&&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,_=A=>{$!==null?clearTimeout($):v(A),$=setTimeout(()=>{v(A)},16)};return F?null:se.createElement(vn,{className:xe(l("carouselContainer",t),i)},se.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:20}},se.createElement("div",null,se.createElement(Bn,{className:l("carouselTitle",t)},a==null?void 0:a.title),se.createElement(_e.Quiet,{className:l("carouselSubtitle",t)},a==null?void 0:a.subtitle)),se.createElement(Dn,{numberOfStepsCompleted:w,numberOfSteps:c.length})),se.createElement("div",{style:{position:"relative"}},se.createElement($n,{show:n,onClick:()=>U(!1)}),se.createElement($n,{side:"right",show:p,onClick:U}),se.createElement(yn,{ref:r,onScroll:_},C.map((A,H)=>se.createElement(bn,{key:H,style:{flex:`0 0 calc(100% - ${c.length>3?36:0}px)`}},A.map((B,M)=>se.createElement(On,{key:M,stepData:B,style:{flex:c.length>3?"0 1 calc(33% - 16px * 2 / 3)":1},appearance:t})))))))};var or=({flowId:e,title:t,subtitle:o,style:i,initialSelectedStep:r,className:n,type:s="inline",onDismiss:p,visible:d,customVariables:a,onStepCompletion:u,onButtonClick:c,appearance:f,hideOnFlowCompletion:w,setVisible:T,customStepTypes:S,checklistStyle:x="default",autoExpandFirstIncompleteStep:E,autoExpandNextStep:y,...I})=>{let{getFlow:F,getFlowSteps:g,markStepCompleted:m,getStepStatus:C,getNumberOfStepsCompleted:v,isLoading:U,targetingLogicShouldHideFlow:$,updateCustomVariables:_,getFlowMetadata:A,isStepBlocked:H,getFlowStatus:B,hasActiveFullPageFlow:M,setHasActiveFullPageFlow:re}=Y(),{primaryCTAClickSideEffects:X,secondaryCTAClickSideEffects:W}=ie(),{getOpenFlowState:be,setOpenFlowState:me}=Pe(),[j,J]=_n(r||0),[fe,L]=_n(!1),N=d===void 0?be(e):d,ee=s==="modal",{mergeAppearanceWithDefault:te}=Q(),{isLarge:we}=en();if(f=te(f),Un(()=>{_(a)},[a,U]),Un(()=>{d!==void 0&&(ee&&d===!0?re(!0):ee&&d===!1&&re(!1))},[d,T,M]),U)return null;let it=F(e);if(!it||$(it))return null;let ke=g(e);if(!ke||w===!0&&B(e)===K)return null;let ue=A(e);if(ue!=null&&ue.title&&(t=ue.title),ue!=null&&ue.subtitle&&(o=ue.subtitle),!fe&&r===void 0&&v(e)>0){let z=Math.min(v(e),ke.length-1);J(z),L(!0)}function He(){if(j+1>=ke.length){ee&&me(e,!1);return}H(e,ke[j+1].id)||J(j+1)}function Ge(z,st,oo){let pr=j+1<ke.length?ke[j+1]:null;c&&c(z,j,st,pr)===!0&&ee&&h(),u&&u(z,oo,pr),!u&&!c&&(z.primaryButtonUri||z.secondaryButtonUri)&&ee&&h()}function q(){return ke.map((z,st)=>({...z,handleSecondaryButtonClick:()=>{He(),W(z),z.skippable===!0&&m(e,z.id,{skipped:!0}),Ge(z,"secondary",st)},handlePrimaryButtonClick:()=>{(!z.completionCriteria&&(z.autoMarkCompleted||z.autoMarkCompleted===void 0)||z.completionCriteria&&z.autoMarkCompleted===!0)&&(m(e,z.id),He()),Ge(z,"primary",st),X(z),C(e,z.id)===Le&&He()}}))}function he(){return le.createElement(oe,{appearance:f})}let nt={steps:q(),title:t,subtitle:o,primaryColor:f.theme.colorPrimary,appearance:f,customStepTypes:S,type:s,className:n,autoExpandFirstIncompleteStep:E,autoExpandNextStep:y};function h(){me(e,!1),p&&p(),T&&T(!1)}function b(){return le.createElement(le.Fragment,null,le.createElement(he,null),le.createElement(Mn,{flowId:e,appearance:f,customVariables:a,className:n}))}function P(){return le.createElement(le.Fragment,null,le.createElement(he,null),le.createElement(er,{visible:N,onClose:()=>{h()},selectedStep:j,setSelectedStep:J,autoExpandNextStep:!0,appearance:f,...nt}))}function G(){if(!we)return P();let z=I.guideFlowId,st;return z&&F(z)&&(st=g(z)),le.createElement(le.Fragment,null,le.createElement(he,null),le.createElement(Ro,{visible:N,stepsTitle:ue.stepsTitle?ue.stepsTitle:"Your quick start guide",onClose:()=>{h()},selectedStep:j,setSelectedStep:J,guideData:st,guideTitle:I.guideTitle??"Guide",appearance:f,title:t,subtitle:o,onGuideButtonClick:oo=>{Ge(oo,"link",0)},customStepTypes:S,...nt}))}function ae(){if(!we)return P();let z=le.createElement(Qo,{flowId:e,style:i,selectedStep:j,setSelectedStep:J,appearance:f,type:s,...nt});return ee?le.createElement(Qe,{onClose:()=>{h()},visible:N,appearance:f,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},le.createElement(he,null),z):le.createElement(le.Fragment,null,le.createElement(he,null),z)}switch(x){case"condensed":return P();case"with-guide":return G();case"default":return ae();case"carousel":return b();default:return ae()}};var Pp=e=>kp.createElement(or,{type:"inline",...e});import ot,{useEffect as Ep}from"react";import We from"react";import Eo from"styled-components";var Wn=Eo.div`
|
|
1136
1136
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1137
1137
|
border-radius: 8px;
|
|
1138
1138
|
padding: 6px 10px 6px 10px;
|
|
@@ -1159,7 +1159,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
1159
1159
|
display: flex;
|
|
1160
1160
|
height: 100%;
|
|
1161
1161
|
align-items: center;
|
|
1162
|
-
`;import{motion as vp}from"framer-motion";var jn=({title:e,count:t,total:o,onClick:
|
|
1162
|
+
`;import{motion as vp}from"framer-motion";var jn=({title:e,count:t,total:o,onClick:i,style:r={},className:n,appearance:s,type:p="default"})=>We.createElement(We.Fragment,null,We.createElement(oe,{appearance:s}),We.createElement(Wn,{as:vp.div,whileHover:{opacity:.9},whileTap:{scale:.98},onClick:()=>i!==void 0&&i(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...r},className:xe(n??"",l("progressRingContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&We.createElement(Gn,{className:l("progressRingContainer",s)},We.createElement(Et,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),We.createElement(zn,{type:p,className:l("badgeTitleContainer",s)},We.createElement(Hn,{type:p,appearance:s,className:l("badgeTitle",s)},e),i!==void 0&&We.createElement(Ot,{className:l("badgeChevron",s),color:s.theme.colorPrimary})),p=="default"&&o&&o!==0&&We.createElement(Ue,{display:"compact",count:t,total:o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:s})));import tt from"react";import Rt from"styled-components";var Vn=Rt.div`
|
|
1163
1163
|
display: flex;
|
|
1164
1164
|
flex-direction: row;
|
|
1165
1165
|
width: 100%;
|
|
@@ -1170,14 +1170,14 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
1170
1170
|
border-width: 1px;
|
|
1171
1171
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1172
1172
|
border-radius: 12px;
|
|
1173
|
-
`,
|
|
1173
|
+
`,qn=Rt.div`
|
|
1174
1174
|
${e=>k(e)} {
|
|
1175
1175
|
display: flex;
|
|
1176
1176
|
justify-content: center;
|
|
1177
1177
|
align-items: center;
|
|
1178
1178
|
margin-right: 16px;
|
|
1179
1179
|
}
|
|
1180
|
-
`,
|
|
1180
|
+
`,Kn=Rt.div`
|
|
1181
1181
|
display: flex;
|
|
1182
1182
|
flex-direction: column;
|
|
1183
1183
|
flex: 1;
|
|
@@ -1197,7 +1197,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
1197
1197
|
:hover {
|
|
1198
1198
|
opacity: 0.8;
|
|
1199
1199
|
}
|
|
1200
|
-
`;var Xn=({title:e,subtitle:t,icon:o,appearance:
|
|
1200
|
+
`;var Xn=({title:e,subtitle:t,icon:o,appearance:i,count:r,total:n,className:s,style:p})=>tt.createElement(tt.Fragment,null,tt.createElement(Vn,{appearance:i,className:xe(l("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&tt.createElement(qn,{className:l("fullWidthProgressBadgeIcon",i)},o),tt.createElement(Kn,null,tt.createElement(Ce,{size:"small",appearance:i,title:e,subtitle:t})),tt.createElement(Yn,{className:l("fullWidthProgressBadgeProgressContainer",i)},tt.createElement(Ue,{count:r,total:n,display:"percent",textLocation:"top",fillColor:i.theme.colorPrimary}))));var Ip=({flowId:e,title:t,subtitle:o,icon:i,style:r,onClick:n,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:a,type:u="default"})=>{let{getFlow:c,getFlowSteps:f,getFlowStatus:w,getNumberOfStepsCompleted:T,isLoading:S,targetingLogicShouldHideFlow:x,updateCustomVariables:E}=Y(),{mergeAppearanceWithDefault:y}=Q();a=y(a);let{setOpenFlowState:I,getOpenFlowState:F}=Pe();if(Ep(()=>{E(p)},[p,S]),S)return null;let g=c(e);if(!g||x(g)||d===!0&&w(e)===K)return null;let m=f(e),C=T(e);return u==="full-width"?ot.createElement(ot.Fragment,null,ot.createElement(oe,{appearance:a}),ot.createElement(Xn,{title:t,subtitle:o,count:C,total:m.length,style:r,className:s,appearance:a,icon:i,onClick:()=>{}})):ot.createElement(ot.Fragment,null,ot.createElement(oe,{appearance:a}),ot.createElement(jn,{count:C,total:m.length,title:t,style:r,onClick:()=>{I(e,!0),n&&n()},type:u,className:s,appearance:a}))};import Ap from"react";var Bp=({flowId:e,style:t,appearance:o,...i})=>{let{getFlow:r,targetingLogicShouldHideFlow:n,getFlowSteps:s}=Y(),{mergeAppearanceWithDefault:p}=Q();o=p(o);let d=r(e);if(!d||n(d))return null;let a=s(e);return Ap.createElement(Qt,{steps:a,style:t,appearance:o,...i})};import Mt,{useContext as Gp,useEffect as jp}from"react";import D,{useEffect as Io,useLayoutEffect as ss,useRef as $p,useState as eo}from"react";import to from"styled-components";import{useCallback as Np,useEffect as Lp,useState as Op}from"react";var rr=(e,t,o,i={x:20,y:20},r)=>{let n=r=="fixed"?0:window.scrollY,s=r=="fixed"?0:window.scrollX;return!e||!e.left||!e.top?{x:0,y:0}:t==="left"?{x:e.left-o+i.x+s,y:e.top-i.y+n}:t==="right"?{x:e.left+e.width+i.x+s,y:e.top-i.y+n}:{x:0,y:0}},Jn={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Dp(e){let t=Jn;return e&&(t=e.getBoundingClientRect()),t}function Qn(e,t){let[o,i]=Op(Jn),r=Np(()=>{e&&i(Dp(e))},[e]);return Lp(()=>(r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)),[e,t]),o}import rt from"styled-components";var Zn=rt.div`
|
|
1201
1201
|
${e=>k(e)} {
|
|
1202
1202
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
1203
1203
|
}
|
|
@@ -1304,7 +1304,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
1304
1304
|
`,zp=to(ps)`
|
|
1305
1305
|
width: ${$t+12}px;
|
|
1306
1306
|
height: ${$t+12}px;
|
|
1307
|
-
`,Hp=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:
|
|
1307
|
+
`,Hp=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:r=!0,primaryColor:n="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:a=0,customStepTypes:u,appearance:c,dismissible:f=!1,showHighlightOnly:w,showStepCount:T=!0,completedStepsCount:S=0})=>{var ke,ue,He,Ge;let[x,E]=eo(),[y,I]=eo(new Date),F=$p(null),[g,m]=eo(document.querySelector(e[a].selector)),C=Qn(g,y),[v,U]=eo(),[$,_]=eo(!w),A=(ue=(ke=e[a])==null?void 0:ke.props)!=null&&ue.position?e[a].props.position:"absolute",H=((Ge=(He=e[a])==null?void 0:He.props)==null?void 0:Ge.zIndex)??90,B=(x==null?void 0:x.width)??ls,M=(x==null?void 0:x.height)??as;ss(()=>{F.current&&E({width:F.current.clientWidth,height:F.current.clientHeight})},[a,y,A]),Io(()=>{w||_(!0)},[a]);let re=i==="auto"?"right":i,X=rr(C,re,B,s,A),W=C.right+B>(window.innerWidth||document.documentElement.clientWidth),be=C.bottom+as>(window.innerHeight||document.documentElement.clientHeight);W&&i==="auto"&&(X=rr(C,"left",B,s,A),re="left");let me=window.location.pathname.split("/").pop(),j=()=>{let q=document.querySelector(e[a].selector);v&&v===JSON.stringify(q==null?void 0:q.getBoundingClientRect())||(m(q),I(new Date),q&&U(JSON.stringify(q.getBoundingClientRect())))};if(Io(()=>{let q=new MutationObserver(j);return q.observe(document.body,{subtree:!0,childList:!0}),()=>q.disconnect()},[j]),Io(()=>{let q=new MutationObserver(j);return q.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>q.disconnect()},[j]),Io(()=>{let q=setInterval(()=>{j()},10);return()=>clearInterval(q)},[j]),ss(()=>{setTimeout(()=>{j()},Mp),j()},[a,me]),g===null)return D.createElement(D.Fragment,null);if(X.x==0&&X.y==0)return D.createElement(D.Fragment,null);if(!p)return D.createElement(D.Fragment,null);let J=()=>{let q=()=>{if(e[a].handlePrimaryButtonClick&&(e[a].handlePrimaryButtonClick(),_(!1),setTimeout(()=>{j()},30)),S===e.length-1)return o()},he=()=>{e[a].handleSecondaryButtonClick&&(e[a].handleSecondaryButtonClick(),w&&_(!1))};return D.createElement(D.Fragment,null,T&&D.createElement(rs,null,D.createElement(ns,{className:l("tooltipStepCounter",c)},a+1," of ",e.length)),D.createElement(is,{showStepCount:T,className:l("tooltipCTAContainer",c)},e[a].secondaryButtonTitle&&D.createElement(R,{title:e[a].secondaryButtonTitle,appearance:c,onClick:he,size:"small",withMargin:!1,secondary:!0}),e[a].primaryButtonTitle&&D.createElement(R,{title:e[a].primaryButtonTitle,appearance:c,onClick:q,withMargin:!1,size:"small"})))},fe=()=>D.createElement(D.Fragment,null,f&&D.createElement(Rn,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:l("tooltipClose",c)},D.createElement(ve,null)),e[a].imageUri&&D.createElement(es,{dismissible:f,appearance:c,src:e[a].imageUri,className:l("tooltipImageContainer",c)}),e[a].videoUri&&!e[a].imageUri&&D.createElement(ts,{dismissible:f,appearance:c,className:l("tooltipVideoContainer",c)},D.createElement(Pt,{appearance:c,videoUri:e[a].videoUri})),D.createElement(Ce,{appearance:c,title:e[a].title,subtitle:e[a].subtitle,size:"small"}),D.createElement(os,{className:l("tooltipFooter",c)},D.createElement(J,null))),N={...{default:q=>{var he;if((he=e[a])!=null&&he.StepContent){let nt=e[a].StepContent;return D.createElement("div",null,nt)}return D.createElement(fe,null)}},...u},ee=()=>{var q;return e?!((q=e[a])!=null&&q.type)||!N[e[a].type]?N.default(e[a]):N[e[a].type]({stepData:e[a],primaryColor:n}):D.createElement(D.Fragment,null)};if(w&&e[a].complete===!0)return null;let te={top:(X==null?void 0:X.y)-$t,left:(re=="left"?C.x+s.x:(X==null?void 0:X.x)-$t)??0,cursor:w?"pointer":"default",position:A},we=()=>{let he=te.left+(re=="left"?-B:24);return Math.min(Math.max(he,20),window.innerWidth-B-20)},it=()=>{w&&(I(new Date),_(!$))};return D.createElement(Wp,null,D.createElement(zp,{style:te,zIndex:H,className:l("tourHighlightContainer",c)},r&&e[a].showHighlight!==!1&&D.createElement(D.Fragment,null,D.createElement(_p,{style:{position:A},onClick:it,primaryColor:c.theme.colorPrimary}),D.createElement(Up,{style:{position:"absolute"},onClick:it,primaryColor:c.theme.colorPrimary}))),D.createElement(ps,{style:{...te,left:we()},zIndex:H+1,className:l("tooltipContainerWrapper",c)},$&&D.createElement(Zn,{ref:F,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:12,...d},appearance:c,className:l("tooltipContainer",c),maxWidth:ls,zIndex:H+10},D.createElement(ee,null))))},Ao=Hp;import{Portal as Vp}from"react-portal";var qp=({flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:r,showTooltipsSimultaneously:n=!1,onDismiss:s,dismissible:p,tooltipPosition:d="auto",showHighlightOnly:a=!1,dismissBehavior:u="complete-flow",onComplete:c,...f})=>{let{getFlow:w,getFlowSteps:T,isLoading:S,targetingLogicShouldHideFlow:x,markStepCompleted:E,markStepStarted:y,markFlowCompleted:I,updateCustomVariables:F,getCurrentStepIndex:g,getStepStatus:m,isStepBlocked:C,getFlowStatus:v,getNumberOfStepsCompleted:U}=Y(),{isLoadingUserFlowStateData:$}=Ae(),{primaryCTAClickSideEffects:_,secondaryCTAClickSideEffects:A}=ie(),{hasOpenModals:H}=Pe(),B=g(e),{openFlowStates:M}=Gp(V),{mergeAppearanceWithDefault:re}=Q();if(o=re(o),jp(()=>{F(t)},[t,S]),$)return null;let X=w(e);if(!X||x(X)||v(e)==K||H())return null;let W=T(e);if(Object.keys(M).length>0){let L=Object.keys(M).find(N=>M[N]===!0);if(L!==void 0&&L!==e)return Mt.createElement(Mt.Fragment,null)}async function be(L){if(await E(e,L.id),W.map(N=>m(e,N.id)).every(N=>N===Le)){await I(e);return}if(!a&&B+1<W.length){if(C(e,W[B+1].id))return;await y(e,W[B+1].id)}}function me(L,N,ee){let te=B+1<W.length?W[B+1]:null;r&&r(L,B,N,te),i&&i(L,ee,te)}function j(){return W.map(L=>({...L,handleSecondaryButtonClick:async()=>{A(L),L.skippable===!0&&await E(e,L.id,{skipped:!0}),me(L,"secondary",B)},handlePrimaryButtonClick:async()=>{(!L.completionCriteria&&(L.autoMarkCompleted||L.autoMarkCompleted===void 0)||L.completionCriteria&&L.autoMarkCompleted===!0)&&await be(L),me(L,"primary",B),_(L)}}))}async function J(L){s&&s(),u==="complete-flow"?await I(e):await E(e,L.id)}function fe(){c&&c()}return Mt.createElement(Vp,null,Mt.createElement(oe,{appearance:o}),n?W.map((L,N)=>Mt.createElement(Ao,{key:L.id,appearance:o,steps:j(),selectedStep:N,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>J(L),tooltipPosition:d,showHighlightOnly:a,completedStepsCount:U(e),onComplete:fe,...f})):Mt.createElement(Ao,{appearance:o,steps:j(),selectedStep:B,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>J(W[B]),tooltipPosition:d,completedStepsCount:U(e),showHighlightOnly:a,onComplete:fe,...f}))};import ye,{useEffect as Kp,useRef as Yp,useState as Xp}from"react";import{Portal as Jp}from"react-portal";import St from"styled-components";var ds=St.button`
|
|
1308
1308
|
${e=>k(e)} {
|
|
1309
1309
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1310
1310
|
|
|
@@ -1392,7 +1392,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
1392
1392
|
font-size: 14px;
|
|
1393
1393
|
|
|
1394
1394
|
padding: 8px 12px;
|
|
1395
|
-
`;import{AnimatePresence as bs,motion as ws}from"framer-motion";import xs from"react";var Cs=({style:e,className:t})=>xs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},xs.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 Ss from"react";var ys=({style:e,className:t})=>Ss.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"},Ss.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 Qp=({flowId:e,style:t,onStepCompletion:o,visible:
|
|
1395
|
+
`;import{AnimatePresence as bs,motion as ws}from"framer-motion";import xs from"react";var Cs=({style:e,className:t})=>xs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},xs.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 Ss from"react";var ys=({style:e,className:t})=>Ss.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"},Ss.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 Qp=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:r="inline",title:n="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:a,getStepStatus:u,getNumberOfStepsCompleted:c,isLoading:f,targetingLogicShouldHideFlow:w}=Y(),{primaryCTAClickSideEffects:T}=ie(),S=Yp(null),[x,E]=Xp(!1),{mergeAppearanceWithDefault:y}=Q();s=y(s),Kp(()=>(document.addEventListener("click",I,!1),()=>{document.removeEventListener("click",I,!1)}),[]);let I=v=>{S.current&&!S.current.contains(v.target)&&E(!1)};if(f)return null;let F=p(e);if(!F||w(F))return null;let g=d(e);if(!g||!i)return null;function m(v,U){!v.completionCriteria&&(v.autoMarkCompleted||v.autoMarkCompleted===void 0)&&a(e,v.id),T(v),o&&o(v,U),E(!1)}function C(){return x&&ye.createElement(gs,{className:l("floatingWidgetMenu",s),as:ws.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:r},g.map((v,U)=>ye.createElement(hs,{className:l("floatingWidgetMenuItem",s),key:U,onClick:()=>m(v,U)},v.title)))}return r=="inline"?ye.createElement("span",{ref:S},ye.createElement(ds,{style:t,onClick:()=>{E(!x)},className:l("supportButton",s)},ye.createElement(ms,{className:l("supportIconContainer",s)},ye.createElement(ys,{className:l("supportIcon",s),style:{width:"18px",height:"18px"}})),ye.createElement(cs,{className:l("supportButtonTitle",s)},n)),ye.createElement(bs,null,ye.createElement(C,null))):ye.createElement(Jp,null,ye.createElement(us,{style:t,ref:S},ye.createElement(bs,null,ye.createElement(C,null)),ye.createElement(fs,{onClick:()=>{E(!x)},as:ws.button,whileHover:{scale:1.1},className:l("floatingWidgetButton",s)},ye.createElement(Cs,{className:l("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import ze,{useEffect as Zp}from"react";import Bo from"styled-components";var Ts=Bo.div`
|
|
1396
1396
|
${e=>k(e)} {
|
|
1397
1397
|
display: flex;
|
|
1398
1398
|
flex-direction: column;
|
|
@@ -1428,7 +1428,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
1428
1428
|
opacity: 0.8;
|
|
1429
1429
|
}
|
|
1430
1430
|
}
|
|
1431
|
-
`;var Rp=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:
|
|
1431
|
+
`;var Rp=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:a,markStepCompleted:u,isLoading:c,targetingLogicShouldHideFlow:f,updateCustomVariables:w,getFlowSteps:T,getFlowStatus:S,getCurrentStepIndex:x}=Y(),{primaryCTAClickSideEffects:E}=ie(),{mergeAppearanceWithDefault:y}=Q();if(r=y(r),Zp(()=>{w(o)},[o,c]),c)return null;let I=d(e);if(!I||f(I)||S(e)===K)return null;let g=T(e)[x(e)];return ze.createElement(ze.Fragment,null,ze.createElement(oe,{appearance:r}),ze.createElement(Ts,{appearance:r,className:xe(l("embeddedTipContainer",r),n),style:s},(p===!0||g.dismissible)&&ze.createElement(Ps,{onClick:async()=>{await a(e),t&&t()},className:l("embeddedTipDismissButton",r)},ze.createElement(ve,null)),ze.createElement(Fs,null,ze.createElement(Ce,{size:"small",appearance:r,title:g.title,subtitle:g.subtitle})),g.primaryButtonTitle&&ze.createElement(ks,{className:l("embeddedTipCallToActionContainer",r)},ze.createElement(R,{classPrefix:"embeddedTip",title:g.primaryButtonTitle,appearance:r,withMargin:!1,size:"small",type:"inline",onClick:async()=>{g.handlePrimaryButtonClick(),E(g),!(i&&i(g,x(e),"primary")===!1)&&(await u(e,g.id),await a(e))}}))))};import ge,{useEffect as ed}from"react";import Ut from"styled-components";var vs=Ut.div`
|
|
1432
1432
|
// use the :not annotation
|
|
1433
1433
|
${e=>k(e)} {
|
|
1434
1434
|
display: flex;
|
|
@@ -1459,7 +1459,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
1459
1459
|
flex-direction: column;
|
|
1460
1460
|
justify-content: center;
|
|
1461
1461
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1462
|
-
`,
|
|
1462
|
+
`,ir=Ut.div`
|
|
1463
1463
|
display: flex;
|
|
1464
1464
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1465
1465
|
align-items: flex-end;
|
|
@@ -1468,12 +1468,12 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
1468
1468
|
:hover {
|
|
1469
1469
|
opacity: 0.8;
|
|
1470
1470
|
}
|
|
1471
|
-
`,
|
|
1471
|
+
`,nr=Ut.div`
|
|
1472
1472
|
display: flex;
|
|
1473
1473
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1474
1474
|
align-items: flex-end;
|
|
1475
1475
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1476
|
-
`;import Bs from"react";var Ns=({style:e,className:t})=>Bs.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"},Bs.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 td=({flowId:e,title:t,subtitle:o,onDismiss:
|
|
1476
|
+
`;import Bs from"react";var Ns=({style:e,className:t})=>Bs.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"},Bs.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 td=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:r,onButtonClick:n,appearance:s,type:p="full-width",icon:d})=>{let{getFlow:a,markFlowCompleted:u,isLoading:c,targetingLogicShouldHideFlow:f,updateCustomVariables:w,getFlowMetadata:T,getFlowStatus:S,getFlowSteps:x,getCurrentStepIndex:E}=Y(),{primaryCTAClickSideEffects:y}=ie(),{mergeAppearanceWithDefault:I}=Q();if(s=I(s),ed(()=>{w(r)},[r,c]),c)return null;let F=a(e);if(!F||f(F)||S(e)===K)return null;let g=x(e),m=g.length>0?g[E(e)]:T(e);return m!=null&&m.title&&(t=m.title),m!=null&&m.subtitle&&(o=m.subtitle),ge.createElement(ge.Fragment,null,ge.createElement(oe,{appearance:s}),ge.createElement(vs,{type:p,appearance:s,className:l("bannerContainer",s)},p!="square"&&ge.createElement(Es,{className:l("bannerIconContainer",s)},d||ge.createElement(Ns,null)),p==="square"&&m.dismissible&&ge.createElement(nr,{type:p,className:l("bannerDismissButtonContainer",s)},ge.createElement(ir,{type:p,onClick:async()=>{await u(e),i&&i()},className:l("bannerDismissButton",s)},ge.createElement(ve,null))),ge.createElement(Is,{type:p},ge.createElement(Ce,{appearance:s,title:t,subtitle:o})),ge.createElement(As,{type:p,className:l("bannerCallToActionContainer",s)},ge.createElement(R,{title:(m==null?void 0:m.primaryButtonTitle)??"Get started",appearance:s,onClick:()=>{y(m),n&&n(m,0,"primary")}})),p!=="square"&&m.dismissible&&ge.createElement(nr,{type:p,className:l("bannerDismissButtonContainer",s)},ge.createElement(ir,{type:p,onClick:async()=>{await u(e),i&&i()},className:l("bannerDismissButton",s)},ge.createElement(ve,null)))))};import Z,{useEffect as od}from"react";import{Portal as rd}from"react-portal";import Je from"styled-components";var Ls=Je.div`
|
|
1477
1477
|
${e=>k(e)} {
|
|
1478
1478
|
display: flex;
|
|
1479
1479
|
flex-direction: column;
|
|
@@ -1515,7 +1515,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
1515
1515
|
display: flex;
|
|
1516
1516
|
justify-content: center;
|
|
1517
1517
|
align-items: center;
|
|
1518
|
-
`,
|
|
1518
|
+
`,sr=Je.div`
|
|
1519
1519
|
display: flex;
|
|
1520
1520
|
justify-content: flex-end;
|
|
1521
1521
|
margin-top: 24px;
|
|
@@ -1524,11 +1524,11 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
1524
1524
|
display: flex;
|
|
1525
1525
|
justify-content: space-between;
|
|
1526
1526
|
margin-top: 24px;
|
|
1527
|
-
`,
|
|
1527
|
+
`,lr=Je.div`
|
|
1528
1528
|
font-size: 12px;
|
|
1529
1529
|
line-height: 16px;
|
|
1530
1530
|
color: ${e=>e.appearance.theme.colorTextDisabled};
|
|
1531
|
-
`,
|
|
1531
|
+
`,ar=Je.div`
|
|
1532
1532
|
display: flex;
|
|
1533
1533
|
flex-direction: column;
|
|
1534
1534
|
flex: 1;
|
|
@@ -1560,5 +1560,5 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${zt}${r}.${zt}${r} { ${Object.entries(i).map
|
|
|
1560
1560
|
opacity: 0.8;
|
|
1561
1561
|
}
|
|
1562
1562
|
}
|
|
1563
|
-
`;var id=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:
|
|
1563
|
+
`;var id=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s})=>{let{getFlow:p,markFlowCompleted:d,markStepCompleted:a,getNumberOfStepsCompleted:u,isLoading:c,targetingLogicShouldHideFlow:f,updateCustomVariables:w,getFlowSteps:T,getFlowStatus:S,getCurrentStepIndex:x}=Y(),{primaryCTAClickSideEffects:E}=ie(),{mergeAppearanceWithDefault:y}=Q(),[I,F]=Z.useState(null),[g,m]=Z.useState(""),{hasOpenModals:C,setKeepCompletedFlowOpenDuringSession:v,shouldKeepCompletedFlowOpenDuringSession:U}=Pe();if(r=y(r),od(()=>{w(o)},[o,c]),c)return null;let $=p(e);if(!$||f($)||S(e)===K||u(e)===1&&!U(e)||C())return null;let A=T(e)[x(e)];function H(){return Z.createElement(Z.Fragment,null,Z.createElement(ar,null,Z.createElement(Ce,{size:"large",appearance:r,title:A.title,subtitle:A.subtitle})),Z.createElement(sr,{className:l("npsNumberButtonContainer",r),appearance:r},Array.from(Array(10).keys()).map(M=>Z.createElement(Os,{className:l("npsNumberButton",r),selected:I===M+1,key:M,onClick:async()=>{v(e),F(M+1),await a(e,A.id,{score:M+1})},appearance:r},M+1))),Z.createElement(Ds,{appearance:r},Z.createElement(lr,{appearance:r},"Not likely at all"),Z.createElement(lr,{appearance:r},"Extremely likely")))}function B(){return Z.createElement(Z.Fragment,null,Z.createElement(ar,null,Z.createElement(Ce,{appearance:r,title:"Why did you choose this score?",size:"large"})),Z.createElement($s,{appearance:r,value:g,onChange:M=>{m(M.target.value)},placeHolder:"Add your optional fedback here..."}),Z.createElement(sr,{appearance:r,className:l("npsNumberButtonContainer",r)},Z.createElement(R,{size:"large",withMargin:!1,onClick:async()=>{await d(e),i&&i(A,1,"primary")},appearance:r,title:A.secondaryButtonTitle||"Skip",secondary:!0}),Z.createElement(R,{size:"large",withMargin:!1,onClick:async()=>{await a(e,A.id,{feedbackText:g}),await d(e),i&&i(A,1,"primary")},appearance:r,title:A.primaryButtonTitle||"Submit"})))}return Z.createElement(rd,null,Z.createElement(oe,{appearance:r}),Z.createElement(Ls,{appearance:r,className:xe(l("npsSurveyContainer",r),n),style:s},Z.createElement(Ms,{onClick:async()=>{await d(e),t&&t()},className:l("npsSurveyDismissButton",r)},Z.createElement(ve,null)),u(e)==0&&H(),u(e)==1&&B()))};export{ct as CheckBox,Re as FormLabel,td as FrigadeBanner,or as FrigadeChecklist,Rp as FrigadeEmbeddedTip,oi as FrigadeForm,Bp as FrigadeGuide,Pp as FrigadeHeroChecklist,id as FrigadeNPSSurvey,Ip as FrigadeProgressBadge,Ea as FrigadeProvider,Qp as FrigadeSupportWidget,qp as FrigadeTour,Et as ProgressRing,Pe as useFlowOpens,Wt as useFlowResponses,Y as useFlows,qo as useOrganization,Lo as useUser};
|
|
1564
1564
|
//# sourceMappingURL=index.mjs.map
|