@frigade/react 1.33.18 → 1.33.20
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 +22 -1
- package/lib/index.js +90 -90
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +77 -77
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import{ThemeProvider as Bp}from"styled-components";import ht,{useContext as op,useEffect as vo,useState as ar}from"react";import{useCallback as ft,useContext as Fl,useEffect as kl}from"react";import Vo,{useMemo as Er}from"react";var Br="1.33.18 ";var Ie="NOT_STARTED_STEP",Z="COMPLETED_FLOW",po="ABORTED_FLOW",ut="STARTED_FLOW",De="NOT_STARTED_FLOW",$e="COMPLETED_STEP",co="STARTED_STEP";function _e(){let{publicApiKey:e,userId:t,apiUrl:o}=Vo.useContext(G);return{config:Er(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Br,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:Er(()=>`${o}/v1/public/`,[o])}}var ml="frigade-last-call-at-",ul="frigade-last-call-data-";function kt(){let{shouldGracefullyDegrade:e,readonly:t}=Vo.useContext(G);return async(o,i)=>{if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Ft();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Ft();let r=ml+o,n=ul+o;if(window&&window.localStorage&&i&&i.body&&i.method==="POST"){let p=window.localStorage.getItem(r),c=window.localStorage.getItem(n);if(p&&c&&c==i.body){let a=new Date(p);if(new Date().getTime()-a.getTime()<1e3)return Ft()}window.localStorage.setItem(r,new Date().toISOString()),window.localStorage.setItem(n,i.body)}let s;try{s=await fetch(o,i)}catch(p){return Ft(p)}return s?s.ok?s:Ft(s.statusText):Ft()}}function Ft(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Pt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=Vo.useContext(G);function o(){return t?(console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize"),!1):e?!0:(console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider"),!1)}return{verifySDKInitiated:o}}import{useContext as bl,useState as Ar}from"react";import{useContext as gl,useEffect as xl,useState as hl}from"react";import Cl from"swr";import{useContext as fl}from"react";function ve(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:r}=fl(G);function n(d,g=!1){return e[d]??g}function s(d,g){t(C=>({...C,[d]:g}))}function p(d){t(g=>{let{[d]:C,...b}=g;return{...b}})}function c(d){r.includes(d)||i(g=>[...g,d])}function a(d){return r.includes(d)}function h(d){return Object.entries(e).some(([g,C])=>C&&g!=d)||o}return{getOpenFlowState:n,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:h,setKeepCompletedFlowOpenDuringSession:c,shouldKeepCompletedFlowOpenDuringSession:a}}import yl from"swr/immutable";var Sl="unknown";function Ne(){let{config:e,apiUrl:t}=_e(),{publicApiKey:o,userId:i,organizationId:r,flows:n,setShouldGracefullyDegrade:s,readonly:p}=gl(G),{resetOpenFlowState:c}=ve(),[a,h]=hl(!1),d={data:n.map(y=>({flowId:y.id,flowState:Z,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},g=y=>fetch(y,e).then(P=>{if(P.ok)return P.json();throw new Error("Failed to fetch user flow states")}).catch(P=>(console.log(`Error fetching ${y}: ${P}. Will gracefully degrade and hide Frigade`),s(!0),d)),C=o&&n&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,{data:b,isLoading:k,mutate:u,error:B}=p?yl(C,g):Cl(C,g,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),x=b==null?void 0:b.data;xl(()=>{!a&&!k&&x&&h(!0)},[x,a,k]);async function F(y){if(x&&!p){let P=x.find(O=>O.flowId===y);P&&P.flowState!==Z&&(P.flowState=Z),await u(Promise.resolve({...b,data:x}),{optimisticData:{...b,data:x},revalidate:!1,rollbackOnError:!1})}}async function N(y,P,O){if(x){let I=x.find(L=>L.flowId===y);I&&(I.stepStates[P]=O,I.flowState=ut),await u(Promise.resolve({...b,data:x}),{optimisticData:{...b,data:x},revalidate:!1,rollbackOnError:!1})}}async function T(y,P,O){if(x){let I=x.find(L=>L.flowId===y);I&&(I.lastStepId=P,I.stepStates[P]=O,I.flowState=ut),await u({...b,data:x},{optimisticData:{...b,data:x},revalidate:!1,rollbackOnError:!1})}}async function m(y){if(x){let P=x.find(O=>O.flowId===y);P&&P.flowState!==De&&(P.flowState=De,P.lastStepId=Sl,Object.keys(P.stepStates).forEach(O=>{P.stepStates[O].actionType=Ie,P.stepStates[O].createdAt=new Date().toISOString()}),await u({...b,data:x},{optimisticData:{...b,data:x},revalidate:!1,rollbackOnError:!1}),c(y))}}async function w(y,P){if(x){let O=x.find(I=>I.flowId===y);O&&O.stepStates[P]!==Ie&&(O.stepStates[P]=Ie),await u({...b,data:x},{optimisticData:{...b,data:x},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:x,isLoadingUserFlowStateData:!a,mutateUserFlowState:u,optimisticallyMarkFlowCompleted:F,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:N,optimisticallyMarkStepNotStarted:w,optimisticallyMarkStepStarted:T,error:B}}function Vt(){let{config:e,apiUrl:t}=_e(),{userFlowStatesData:o,mutateUserFlowState:i}=Ne(),{failedFlowResponses:r,setFailedFlowResponses:n,flowResponses:s,setFlowResponses:p}=bl(G),[c,a]=Ar(new Set),[h,d]=Ar(new Set),g=kt();function C(u){let B=JSON.stringify(u);if(c.has(B))return null;c.add(B),a(c),h.add(u),d(h);let x=s==null?void 0:s.find(F=>F.flowSlug===u.flowSlug&&F.stepId===u.stepId&&F.actionType===u.actionType&&F.createdAt===u.createdAt);return g(`${t}flowResponses`,{...e,method:"POST",body:B}).then(F=>{F.status!==200&&F.status!==201?(console.log("Failed to send flow response for step "+u.stepId+". Will retry again later."),n([...r,u])):x||p(N=>[...N??[],u])})}async function b(u){u.foreignUserId&&(u.actionType===ut||u.actionType===De?await C(u):u.actionType===Z?await C(u):u.actionType===co?await C(u):u.actionType===$e?await C(u):u.actionType===po?await C(u):u.actionType===Ie&&await C(u))}function k(){let u=[];return o==null||o.forEach(B=>{if(B&&B.stepStates&&Object.keys(B.stepStates).length!==0)for(let x in B.stepStates){let F=B.stepStates[x];u.push({foreignUserId:B.foreignUserId,flowSlug:B.flowId,stepId:F.stepId,actionType:F.actionType,data:{},createdAt:new Date(F.createdAt),blocked:F.blocked,hidden:F.hidden})}}),[...u,...s]}return{addResponse:b,setFlowResponses:p,getFlowResponses:k}}import Pl from"swr";var wl=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Ir=e=>{let t=wl.exec(e);if(t===null)return null;let o=null;return t.forEach((i,r)=>{let n=Tl(i,"'","");n.startsWith("flow_")&&(o=n)}),o},Tl=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function R(){let{config:e,apiUrl:t}=_e(),{flows:o,setFlows:i,userId:r,publicApiKey:n,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:a,setFlowResponses:h,setShouldGracefullyDegrade:d,readonly:g}=Fl(G),C={data:[]},{verifySDKInitiated:b}=Pt(),{addResponse:k,getFlowResponses:u}=Vt(),B=f=>fetch(f,e).then(S=>S.ok?S.json():(console.log(`Error fetching ${f} (${S.status}): ${S.statusText}. .Will gracefully degrade and hide Frigade`),d(!0),C)).catch(S=>(console.log(`Error fetching ${f}: ${S}. Will gracefully degrade and hide Frigade`),d(!0),C)),{userFlowStatesData:x,isLoadingUserFlowStateData:F,optimisticallyMarkFlowCompleted:N,optimisticallyMarkFlowNotStarted:T,optimisticallyMarkStepCompleted:m,optimisticallyMarkStepNotStarted:w,optimisticallyMarkStepStarted:y}=Ne(),{data:P,error:O,isLoading:I}=Pl(n?`${t}flows${g?"?readonly=true":""}`:null,B,{keepPreviousData:!0});kl(()=>{if(O){console.error(O);return}P&&P.data&&i(P.data)},[P,O]);function L(f){if(I)return null;let S=o.find(E=>E.slug===f);return!S&&o.length>0&&!F&&!I?(console.log(`Flow with slug ${f} not found`),null):(S==null?void 0:S.active)===!1?null:S}function D(f){var A;if(!L(f))return[];let S=L(f).data;return S?(S=z(S),(((A=JSON.parse(S))==null?void 0:A.data)??[]).map(Q=>{let mt=ce(Q);return{handleSecondaryButtonClick:()=>{Q.skippable===!0&&q(f,Q.id,{skipped:!0})},...Q,complete:J(f,Q.id)===$e||mt>=1,blocked:$(f,Q.id),hidden:_(f,Q.id),handlePrimaryButtonClick:()=>{(!Q.completionCriteria&&(Q.autoMarkCompleted||Q.autoMarkCompleted===void 0)||Q.completionCriteria&&Q.autoMarkCompleted===!0)&&q(f,Q.id)},progress:mt}}).filter(Q=>Q.hidden!==!0)):[]}function z(f){return f.replaceAll(/\${(.*?)}/g,(S,E)=>s[E]===void 0?"":String(s[E]).replace(/[\u00A0-\u9999<>\&]/g,function(A){return"&#"+A.charCodeAt(0)+";"}).replaceAll(/[\\]/g,"\\\\").replaceAll(/[\"]/g,'\\"').replaceAll(/[\/]/g,"\\/").replaceAll(/[\b]/g,"\\b").replaceAll(/[\f]/g,"\\f").replaceAll(/[\n]/g,"\\n").replaceAll(/[\r]/g,"\\r").replaceAll(/[\t]/g,"\\t"))}function H(f){if(!L(f))return[];let S=L(f).data;return S?(S=z(S),JSON.parse(S)??{}):[]}function oe(f,S){p(E=>({...E,[f]:S}))}function se(f){!F&&!I&&f&&JSON.stringify(s)!=JSON.stringify({...s,...f})&&Object.keys(f).forEach(S=>{oe(S,f[S])})}let K=ft(async(f,S,E)=>{if(!b())return;let A={foreignUserId:r,flowSlug:f,stepId:S,actionType:co,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};re(A)&&(await y(f,S,A),k(A))},[r,x]),j=ft(async(f,S,E)=>{if(!b())return;let A={foreignUserId:r,flowSlug:f,stepId:S,actionType:Ie,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};re(A)&&(await w(f,S),k(A))},[r,x]),q=ft(async(f,S,E)=>{if(!b())return;let A={foreignUserId:r,flowSlug:f,stepId:S,actionType:$e,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};re(A)&&(await m(f,S,A),k(A))},[r,x]),X=ft(async(f,S)=>{if(!b()||ee(f)===De)return;let E={foreignUserId:r,flowSlug:f,stepId:"unknown",actionType:De,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};await T(f),re(E)&&k(E)},[r,x]),he=ft(async(f,S)=>{if(!b())return;let E={foreignUserId:r,flowSlug:f,stepId:"unknown",actionType:ut,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};re(E)&&k(E)},[r,x]),Pe=ft(async(f,S)=>{if(!b())return;let E={foreignUserId:r,flowSlug:f,stepId:"unknown",actionType:Z,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};re(E)&&(await N(f),k(E))},[r,x]),Ce=ft(async(f,S)=>{if(!b())return;let E={foreignUserId:r,flowSlug:f,stepId:"unknown",actionType:po,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};re(E)&&(await N(f),k(E))},[r,x]);function re(f){var S;if(!x&&f.actionType===Ie)return!1;if(x){let E=x.find(A=>A.flowId===f.flowSlug);if(f.actionType===Ie&&(!(E!=null&&E.stepStates[f.stepId])||E.stepStates[f.stepId].actionType===Ie)||E&&((S=E.stepStates[f.stepId])==null?void 0:S.actionType)===f.actionType||E&&E.flowState===Z&&f.actionType===Z)return!1}return!0}function J(f,S){let E=ye(f,S);return F?null:E?E.actionType:Ie}function $(f,S){let E=ye(f,S);return E?E.blocked:!1}function _(f,S){let E=ye(f,S);return E?E.hidden:!1}function ye(f,S){if(F)return null;let E=x==null?void 0:x.find(A=>A.flowId===f);return!E||!E.stepStates[S]?null:E.stepStates[S]??null}function de(f){var E;if(F||!x)return null;if(ee(f)===De)return D(f)[0]??null;let S=(E=x.find(A=>A.flowId===f))==null?void 0:E.lastStepId;return S?D(f).find(A=>A.id===S):null}function U(f){let S=de(f);if(!S)return 0;let E=D(f).findIndex(A=>A.id===S.id)??0;return J(f,S.id)===$e&&E<D(f).length-1?E+1:E}function ce(f){if(!f.completionCriteria)return;let S=Ir(f.completionCriteria);if(S===null)return;let E=Se(S),A=V(S);return A===0?void 0:E/A}function ee(f){let S=x==null?void 0:x.find(E=>E.flowId===f);return S?S.flowState:null}function Se(f){let S=D(f);return S.length===0?0:S.filter(A=>J(f,A.id)===$e).length}function V(f){return D(f).length}function Ae(f){let S=o.find(E=>E.slug===f);return S?JSON.parse(S.data):null}function ze(f){if(g)return!1;if(F)return!0;if(f!=null&&f.targetingLogic&&x){let S=x.find(E=>E.flowId===f.slug);if(S)return S.shouldTrigger===!1}return!!(f!=null&&f.targetingLogic&&r&&r.startsWith("guest_"))}function Ho(f){return!ze(L(f))}return{getFlow:L,getFlowData:Ae,isLoading:F||I,getStepStatus:J,getFlowSteps:D,getCurrentStepIndex:U,markStepStarted:K,markStepCompleted:q,markFlowNotStarted:X,markFlowStarted:he,markFlowCompleted:Pe,markFlowAborted:Ce,markStepNotStarted:j,getFlowStatus:ee,getNumberOfStepsCompleted:Se,getNumberOfSteps:V,targetingLogicShouldHideFlow:ze,setCustomVariable:oe,updateCustomVariables:se,customVariables:s,getStepOptionalProgress:ce,getFlowMetadata:H,isStepBlocked:$,isStepHidden:_,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:a,isFlowAvailableToUser:Ho}}import{useCallback as Nr,useContext as vl,useEffect as Bl}from"react";var vt="guest_";function jt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=vl(G),{config:n,apiUrl:s}=_e(),{mutateUserFlowState:p}=Ne(),c=kt(),{verifySDKInitiated:a}=Pt();Bl(()=>{if(e&&!t){if(e.startsWith(vt))return;let g=`frigade-user-registered-${e}`;localStorage.getItem(g)||(c(`${s}users`,{...n,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(g,"true"))}},[e,r,t]);let h=Nr(async g=>{if(!a())return;let C={foreignId:e,properties:g};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(C)}),i(b=>({...b,...g})),p()},[e,n,r,p]),d=Nr(async(g,C)=>{if(!a())return;let k={foreignId:e,events:[{event:g,properties:C}]};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(k)}),p()},[e,n,p]);return{userId:e,setUserId:o,addPropertiesToUser:h,trackEventForUser:d}}import{v4 as rp}from"uuid";import He,{useEffect as Za,useState as Ra}from"react";import Me,{useEffect as Dl}from"react";import fo from"styled-components";import El from"react";import Al from"styled-components";var Or="fr-",Gt="cfr-";function l(e,t){let o=`${Or}${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+" "+Gt+e}return o}function v(e){if(!e.className||e.className.indexOf(Gt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(Or)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function jo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function Ge(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${jo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function be(...e){return e.filter(Boolean).join(" ")}function qt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Il=Al.div`
|
|
2
|
+
import Ct,{createContext as vp,useEffect as Ao,useState as Oe}from"react";import{ThemeProvider as Bp}from"styled-components";import ht,{useContext as op,useEffect as Bo,useState as ar}from"react";import{useCallback as ft,useContext as Fl,useEffect as kl}from"react";import Vo,{useMemo as Er}from"react";var Br="1.33.20 ";var Ne="NOT_STARTED_STEP",R="COMPLETED_FLOW",co="ABORTED_FLOW",ut="STARTED_FLOW",$e="NOT_STARTED_FLOW",Me="COMPLETED_STEP",mo="STARTED_STEP";function _e(){let{publicApiKey:e,userId:t,apiUrl:o}=Vo.useContext(G);return{config:Er(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Br,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:Er(()=>`${o}/v1/public/`,[o])}}var ml="frigade-last-call-at-",ul="frigade-last-call-data-";function kt(){let{shouldGracefullyDegrade:e,readonly:t}=Vo.useContext(G);return async(o,i)=>{if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Ft();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Ft();let r=ml+o,n=ul+o;if(window&&window.localStorage&&i&&i.body&&i.method==="POST"){let p=window.localStorage.getItem(r),c=window.localStorage.getItem(n);if(p&&c&&c==i.body){let a=new Date(p);if(new Date().getTime()-a.getTime()<1e3)return Ft()}window.localStorage.setItem(r,new Date().toISOString()),window.localStorage.setItem(n,i.body)}let s;try{s=await fetch(o,i)}catch(p){return Ft(p)}return s?s.ok?s:Ft(s.statusText):Ft()}}function Ft(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Pt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=Vo.useContext(G);function o(){return t?(console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize"),!1):e?!0:(console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider"),!1)}return{verifySDKInitiated:o}}import{useContext as bl,useState as Ar}from"react";import{useContext as gl,useEffect as xl,useState as hl}from"react";import Cl from"swr";import{useContext as fl}from"react";function Be(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:r}=fl(G);function n(d,g=!1){return e[d]??g}function s(d,g){t(C=>({...C,[d]:g}))}function p(d){t(g=>{let{[d]:C,...b}=g;return{...b}})}function c(d){r.includes(d)||i(g=>[...g,d])}function a(d){return r.includes(d)}function h(d){return Object.entries(e).some(([g,C])=>C&&g!=d)||o}return{getOpenFlowState:n,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:h,setKeepCompletedFlowOpenDuringSession:c,shouldKeepCompletedFlowOpenDuringSession:a}}import yl from"swr/immutable";var Sl="unknown";function Ee(){let{config:e,apiUrl:t}=_e(),{publicApiKey:o,userId:i,organizationId:r,flows:n,setShouldGracefullyDegrade:s,readonly:p}=gl(G),{resetOpenFlowState:c}=Be(),[a,h]=hl(!1),d={data:n.map(y=>({flowId:y.id,flowState:R,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},g=y=>fetch(y,e).then(P=>{if(P.ok)return P.json();throw new Error("Failed to fetch user flow states")}).catch(P=>(console.log(`Error fetching ${y}: ${P}. Will gracefully degrade and hide Frigade`),s(!0),d)),C=o&&n&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,{data:b,isLoading:k,mutate:u,error:B}=p?yl(C,g):Cl(C,g,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),x=b==null?void 0:b.data;xl(()=>{!a&&!k&&x&&h(!0)},[x,a,k]);async function F(y){if(x&&!p){let P=x.find(O=>O.flowId===y);P&&P.flowState!==R&&(P.flowState=R),await u(Promise.resolve({...b,data:x}),{optimisticData:{...b,data:x},revalidate:!1,rollbackOnError:!1})}}async function N(y,P,O){if(x){let I=x.find(D=>D.flowId===y);I&&(I.stepStates[P]=O,I.flowState=ut),await u(Promise.resolve({...b,data:x}),{optimisticData:{...b,data:x},revalidate:!1,rollbackOnError:!1})}}async function T(y,P,O){if(x){let I=x.find(D=>D.flowId===y);I&&(I.lastStepId=P,I.stepStates[P]=O,I.flowState=ut),await u({...b,data:x},{optimisticData:{...b,data:x},revalidate:!1,rollbackOnError:!1})}}async function m(y){if(x){let P=x.find(O=>O.flowId===y);P&&P.flowState!==$e&&(P.flowState=$e,P.lastStepId=Sl,Object.keys(P.stepStates).forEach(O=>{P.stepStates[O].actionType=Ne,P.stepStates[O].createdAt=new Date().toISOString()}),await u({...b,data:x},{optimisticData:{...b,data:x},revalidate:!1,rollbackOnError:!1}),c(y))}}async function w(y,P){if(x){let O=x.find(I=>I.flowId===y);O&&O.stepStates[P]!==Ne&&(O.stepStates[P]=Ne),await u({...b,data:x},{optimisticData:{...b,data:x},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:x,isLoadingUserFlowStateData:!a,mutateUserFlowState:u,optimisticallyMarkFlowCompleted:F,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:N,optimisticallyMarkStepNotStarted:w,optimisticallyMarkStepStarted:T,error:B}}function jt(){let{config:e,apiUrl:t}=_e(),{userFlowStatesData:o,mutateUserFlowState:i}=Ee(),{failedFlowResponses:r,setFailedFlowResponses:n,flowResponses:s,setFlowResponses:p}=bl(G),[c,a]=Ar(new Set),[h,d]=Ar(new Set),g=kt();function C(u){let B=JSON.stringify(u);if(c.has(B))return null;c.add(B),a(c),h.add(u),d(h);let x=s==null?void 0:s.find(F=>F.flowSlug===u.flowSlug&&F.stepId===u.stepId&&F.actionType===u.actionType&&F.createdAt===u.createdAt);return g(`${t}flowResponses`,{...e,method:"POST",body:B}).then(F=>{F.status!==200&&F.status!==201?(console.log("Failed to send flow response for step "+u.stepId+". Will retry again later."),n([...r,u])):x||p(N=>[...N??[],u])})}async function b(u){u.foreignUserId&&(u.actionType===ut||u.actionType===$e?await C(u):u.actionType===R?await C(u):u.actionType===mo?await C(u):u.actionType===Me?await C(u):u.actionType===co?await C(u):u.actionType===Ne&&await C(u))}function k(){let u=[];return o==null||o.forEach(B=>{if(B&&B.stepStates&&Object.keys(B.stepStates).length!==0)for(let x in B.stepStates){let F=B.stepStates[x];u.push({foreignUserId:B.foreignUserId,flowSlug:B.flowId,stepId:F.stepId,actionType:F.actionType,data:{},createdAt:new Date(F.createdAt),blocked:F.blocked,hidden:F.hidden})}}),[...u,...s]}return{addResponse:b,setFlowResponses:p,getFlowResponses:k}}import Pl from"swr";var wl=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Ir=e=>{let t=wl.exec(e);if(t===null)return null;let o=null;return t.forEach((i,r)=>{let n=Tl(i,"'","");n.startsWith("flow_")&&(o=n)}),o},Tl=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function ee(){let{config:e,apiUrl:t}=_e(),{flows:o,setFlows:i,userId:r,publicApiKey:n,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:a,setFlowResponses:h,setShouldGracefullyDegrade:d,readonly:g}=Fl(G),C={data:[]},{verifySDKInitiated:b}=Pt(),{addResponse:k,getFlowResponses:u}=jt(),B=f=>fetch(f,e).then(S=>S.ok?S.json():(console.log(`Error fetching ${f} (${S.status}): ${S.statusText}. .Will gracefully degrade and hide Frigade`),d(!0),C)).catch(S=>(console.log(`Error fetching ${f}: ${S}. Will gracefully degrade and hide Frigade`),d(!0),C)),{userFlowStatesData:x,isLoadingUserFlowStateData:F,optimisticallyMarkFlowCompleted:N,optimisticallyMarkFlowNotStarted:T,optimisticallyMarkStepCompleted:m,optimisticallyMarkStepNotStarted:w,optimisticallyMarkStepStarted:y}=Ee(),{data:P,error:O,isLoading:I}=Pl(n?`${t}flows${g?"?readonly=true":""}`:null,B,{keepPreviousData:!0});kl(()=>{if(O){console.error(O);return}P&&P.data&&i(P.data)},[P,O]);function D(f){if(I)return null;let S=o.find(E=>E.slug===f);return!S&&o.length>0&&!F&&!I?(console.log(`Flow with slug ${f} not found`),null):(S==null?void 0:S.active)===!1?null:S}function L(f){var A;if(!D(f))return[];let S=D(f).data;return S?(S=_(S),(((A=JSON.parse(S))==null?void 0:A.data)??[]).map(Z=>{let mt=de(Z);return{handleSecondaryButtonClick:()=>{Z.skippable===!0&&q(f,Z.id,{skipped:!0})},...Z,complete:Q(f,Z.id)===Me||mt>=1,blocked:M(f,Z.id),hidden:$(f,Z.id),handlePrimaryButtonClick:()=>{(!Z.completionCriteria&&(Z.autoMarkCompleted||Z.autoMarkCompleted===void 0)||Z.completionCriteria&&Z.autoMarkCompleted===!0)&&q(f,Z.id)},progress:mt}}).filter(Z=>Z.hidden!==!0)):[]}function _(f){return f.replaceAll(/\${(.*?)}/g,(S,E)=>s[E]===void 0?"":String(s[E]).replace(/[\u00A0-\u9999<>\&]/g,function(A){return"&#"+A.charCodeAt(0)+";"}).replaceAll(/[\\]/g,"\\\\").replaceAll(/[\"]/g,'\\"').replaceAll(/[\/]/g,"\\/").replaceAll(/[\b]/g,"\\b").replaceAll(/[\f]/g,"\\f").replaceAll(/[\n]/g,"\\n").replaceAll(/[\r]/g,"\\r").replaceAll(/[\t]/g,"\\t"))}function H(f){if(!D(f))return[];let S=D(f).data;return S?(S=_(S),JSON.parse(S)??{}):[]}function X(f,S){p(E=>({...E,[f]:S}))}function se(f){!F&&!I&&f&&JSON.stringify(s)!=JSON.stringify({...s,...f})&&Object.keys(f).forEach(S=>{X(S,f[S])})}let K=ft(async(f,S,E)=>{if(!b())return;let A={foreignUserId:r,flowSlug:f,stepId:S,actionType:mo,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};re(A)&&(await y(f,S,A),k(A))},[r,x]),V=ft(async(f,S,E)=>{if(!b())return;let A={foreignUserId:r,flowSlug:f,stepId:S,actionType:Ne,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};re(A)&&(await w(f,S),k(A))},[r,x]),q=ft(async(f,S,E)=>{if(!b())return;let A={foreignUserId:r,flowSlug:f,stepId:S,actionType:Me,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};re(A)&&(await m(f,S,A),k(A))},[r,x]),J=ft(async(f,S)=>{if(!b()||te(f)===$e)return;let E={foreignUserId:r,flowSlug:f,stepId:"unknown",actionType:$e,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};await T(f),re(E)&&k(E)},[r,x]),Ce=ft(async(f,S)=>{if(!b())return;let E={foreignUserId:r,flowSlug:f,stepId:"unknown",actionType:ut,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};re(E)&&k(E)},[r,x]),ve=ft(async(f,S)=>{if(!b())return;let E={foreignUserId:r,flowSlug:f,stepId:"unknown",actionType:R,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};re(E)&&(await N(f),k(E))},[r,x]),ye=ft(async(f,S)=>{if(!b())return;let E={foreignUserId:r,flowSlug:f,stepId:"unknown",actionType:co,data:S??{},createdAt:new Date,blocked:!1,hidden:!1};re(E)&&(await N(f),k(E))},[r,x]);function re(f){var S;if(!x&&f.actionType===Ne)return!1;if(x){let E=x.find(A=>A.flowId===f.flowSlug);if(f.actionType===Ne&&(!(E!=null&&E.stepStates[f.stepId])||E.stepStates[f.stepId].actionType===Ne)||E&&((S=E.stepStates[f.stepId])==null?void 0:S.actionType)===f.actionType||E&&E.flowState===R&&f.actionType===R)return!1}return!0}function Q(f,S){let E=Se(f,S);return F?null:E?E.actionType:Ne}function M(f,S){let E=Se(f,S);return E?E.blocked:!1}function $(f,S){let E=Se(f,S);return E?E.hidden:!1}function Se(f,S){if(F)return null;let E=x==null?void 0:x.find(A=>A.flowId===f);return!E||!E.stepStates[S]?null:E.stepStates[S]??null}function me(f){var E;if(F||!x)return null;if(te(f)===$e)return L(f)[0]??null;let S=(E=x.find(A=>A.flowId===f))==null?void 0:E.lastStepId;return S?L(f).find(A=>A.id===S):null}function z(f){let S=me(f);if(!S)return 0;let E=L(f).findIndex(A=>A.id===S.id)??0;return Q(f,S.id)===Me&&E<L(f).length-1?E+1:E}function de(f){if(!f.completionCriteria)return;let S=Ir(f.completionCriteria);if(S===null)return;let E=be(S),A=De(S);return A===0?void 0:E/A}function te(f){let S=x==null?void 0:x.find(E=>E.flowId===f);return S?S.flowState:null}function be(f){let S=L(f);return S.length===0?0:S.filter(A=>Q(f,A.id)===Me).length}function De(f){return L(f).length}function j(f){let S=o.find(E=>E.slug===f);return S?JSON.parse(S.data):null}function xe(f){if(g)return!1;if(F)return!0;if(f!=null&&f.targetingLogic&&x){let S=x.find(E=>E.flowId===f.slug);if(S)return S.shouldTrigger===!1}return!!(f!=null&&f.targetingLogic&&r&&r.startsWith("guest_"))}function Vt(f){return!xe(D(f))}return{getFlow:D,getFlowData:j,isLoading:F||I,getStepStatus:Q,getFlowSteps:L,getCurrentStepIndex:z,markStepStarted:K,markStepCompleted:q,markFlowNotStarted:J,markFlowStarted:Ce,markFlowCompleted:ve,markFlowAborted:ye,markStepNotStarted:V,getFlowStatus:te,getNumberOfStepsCompleted:be,getNumberOfSteps:De,targetingLogicShouldHideFlow:xe,setCustomVariable:X,updateCustomVariables:se,customVariables:s,getStepOptionalProgress:de,getFlowMetadata:H,isStepBlocked:M,isStepHidden:$,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:a,isFlowAvailableToUser:Vt}}import{useCallback as Nr,useContext as vl,useEffect as Bl}from"react";var vt="guest_";function Gt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=vl(G),{config:n,apiUrl:s}=_e(),{mutateUserFlowState:p}=Ee(),c=kt(),{verifySDKInitiated:a}=Pt();Bl(()=>{if(e&&!t){if(e.startsWith(vt))return;let g=`frigade-user-registered-${e}`;localStorage.getItem(g)||(c(`${s}users`,{...n,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(g,"true"))}},[e,r,t]);let h=Nr(async g=>{if(!a())return;let C={foreignId:e,properties:g};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(C)}),i(b=>({...b,...g})),p()},[e,n,r,p]),d=Nr(async(g,C)=>{if(!a())return;let k={foreignId:e,events:[{event:g,properties:C}]};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(k)}),p()},[e,n,p]);return{userId:e,setUserId:o,addPropertiesToUser:h,trackEventForUser:d}}import{v4 as rp}from"uuid";import He,{useEffect as Za,useState as Ra}from"react";import Ue,{useEffect as Dl}from"react";import go from"styled-components";import El from"react";import Al from"styled-components";var Or="fr-",qt="cfr-";function l(e,t){let o=`${Or}${e}`;if(!t)return o;if(t.styleOverrides&&t.styleOverrides[e]){if(typeof t.styleOverrides[e]=="string")return o+" "+t.styleOverrides[e];if(typeof t.styleOverrides[e]=="object")return o+" "+qt+e}return o}function v(e){if(!e.className||e.className.indexOf(qt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(Or)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function jo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function Ge(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${jo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function we(...e){return e.filter(Boolean).join(" ")}function Kt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Il=Al.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -27,7 +27,7 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
|
-
`,
|
|
30
|
+
`,Ae=()=>Go.createElement(Ol,null,Go.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 20 20"},Go.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5 15L15 5M5 5l10 10"})));import{Portal as $l}from"react-portal";import qr from"react";import qo from"react";function Ll({style:e,className:t}){return qo.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"54",height:"14",fill:"none",viewBox:"0 0 54 14",style:e,className:t},qo.createElement("path",{fill:"currentColor",d:"M16.293 3.476v1.036h1.593v1.256h-1.593v5.098h-1.41V5.768H14V4.512h.883V3.244c0-.67.294-1.744 1.777-1.744.515 0 .969.049 1.361.146l-.233 1.232a5.939 5.939 0 00-.833-.073c-.442 0-.662.22-.662.67zm6.534.975V5.83c-.846 0-1.63.159-2.342.476v4.56h-1.41V4.513h1.263l.086.61c.846-.451 1.655-.67 2.403-.67zm2.505-.951c-.331.33-.944.33-1.287 0a.93.93 0 01-.246-.659c0-.268.086-.487.246-.646.343-.33.956-.33 1.287 0 .343.33.343.964 0 1.305zm.061 7.366h-1.41V4.512h1.41v6.354zm6.928-5.756c.246.146.368.402.368.756v4.976c0 1.804-.858 2.658-2.672 2.658-.92 0-1.753-.146-2.514-.439l.417-1.073c.674.22 1.336.33 1.974.33.98 0 1.385-.379 1.385-1.403v-.171c-.588.134-1.09.207-1.52.207-.907 0-1.655-.305-2.231-.902-.576-.598-.87-1.39-.87-2.354 0-.963.294-1.756.87-2.354.576-.61 1.324-.914 2.231-.914 1.005 0 1.864.232 2.562.683zm-2.488 4.634a5.15 5.15 0 001.446-.22V5.951a3.695 3.695 0 00-1.446-.292c-1.08 0-1.778.841-1.778 2.048 0 1.22.699 2.037 1.778 2.037zm7.34-5.317c1.52 0 2.28.878 2.28 2.634v3.805h-1.275l-.073-.524c-.601.414-1.288.621-2.084.621-1.263 0-2.06-.658-2.06-1.731 0-1.269 1.25-2.025 3.408-2.025.135 0 .503.013.662.013v-.171c0-1.012-.343-1.451-1.115-1.451-.675 0-1.435.158-2.256.475l-.466-1.012c1.017-.427 2.01-.634 2.979-.634zm-1.839 4.756c0 .427.343.695 1.017.695.528 0 1.251-.22 1.68-.512V8.22h-.441c-1.508 0-2.256.317-2.256.963zm9.953-4.549v-2.83h1.41v7.72c0 .354-.123.598-.368.757-.71.45-1.57.67-2.562.67-.907 0-1.655-.305-2.231-.902-.577-.61-.87-1.39-.87-2.354 0-.963.293-1.756.87-2.354.576-.61 1.324-.914 2.23-.914.43 0 .933.073 1.521.207zM43.84 9.72c.503 0 .981-.098 1.447-.293V5.854a5.15 5.15 0 00-1.447-.22c-1.078 0-1.777.817-1.777 2.037s.699 2.049 1.777 2.049zM54 7.866v.439h-4.573c.184.963.858 1.512 1.827 1.512.613 0 1.275-.146 1.986-.451l.466 1.024c-.87.378-1.729.573-2.575.573-.931 0-1.692-.304-2.268-.902-.576-.61-.87-1.402-.87-2.366 0-.975.294-1.768.87-2.366.576-.597 1.324-.902 2.244-.902.968 0 1.691.33 2.17.975.478.647.723 1.464.723 2.464zm-4.61-.586h3.298c-.086-1.073-.613-1.731-1.581-1.731-.969 0-1.582.695-1.717 1.731z"}),qo.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M1.196 1.229A4.009 4.009 0 014.08 0l4.092.027C9.183.027 10 .867 10 1.904c0 .6-.273 1.133-.7 1.478-.31.25-.7.399-1.126.4h-.001l-4.09-.027h-.002a4.804 4.804 0 00-2.614.77A4.986 4.986 0 000 5.974v-1.78C0 3.036.456 1.988 1.196 1.23zm4.525 4.65a4.282 4.282 0 00-1.184 2.513l3.637.023c.131 0 .259-.015.382-.042h.002c.81-.178 1.42-.908 1.44-1.788v-.046a1.9 1.9 0 00-.533-1.328 1.813 1.813 0 00-.908-.508h-.002l-.002-.001a1.68 1.68 0 00-.366-.042A4.084 4.084 0 005.72 5.88zm-4.525-.016A4.235 4.235 0 000 8.829C0 10.997 1.601 12.78 3.654 13V9.265h-.005l.005-.439v-.437h.023a5.175 5.175 0 011.439-3.13 5.05 5.05 0 01.72-.614l-1.754-.011H4.08c-.787 0-1.521.229-2.144.625a4.11 4.11 0 00-.74.603z",clipRule:"evenodd"}))}var Dr=Ll;import Ko from"styled-components";import et from"styled-components";var uo=et.div`
|
|
31
31
|
${e=>v(e)} {
|
|
32
32
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
33
33
|
}
|
|
@@ -103,7 +103,7 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
103
103
|
align-items: center;
|
|
104
104
|
justify-content: center;
|
|
105
105
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
106
|
-
`,jr=Ko(
|
|
106
|
+
`,jr=Ko(uo)`
|
|
107
107
|
background-color: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
108
108
|
position: absolute;
|
|
109
109
|
bottom: -60px;
|
|
@@ -125,7 +125,7 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
125
125
|
font-size: 12px;
|
|
126
126
|
line-height: 18px;
|
|
127
127
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
128
|
-
`;function
|
|
128
|
+
`;function fo({appearance:e}){return qr.createElement(Gr,{className:l("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",qr.createElement(Dr,null))}var Ml=go.div`
|
|
129
129
|
${e=>v(e)} {
|
|
130
130
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
131
131
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -167,10 +167,10 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
167
167
|
opacity: 1;
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
`,Ul=
|
|
170
|
+
`,Ul=go.div`
|
|
171
171
|
position: relative;
|
|
172
172
|
flex: 0 1 auto;
|
|
173
|
-
`,zl=
|
|
173
|
+
`,zl=go.div`
|
|
174
174
|
position: absolute;
|
|
175
175
|
top: 24px;
|
|
176
176
|
right: 24px;
|
|
@@ -180,14 +180,14 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
180
180
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
181
181
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
182
182
|
}
|
|
183
|
-
`,_l=
|
|
183
|
+
`,_l=go.div`
|
|
184
184
|
overflow: scroll;
|
|
185
185
|
flex: 1 1;
|
|
186
186
|
display: flex;
|
|
187
187
|
::-webkit-scrollbar {
|
|
188
188
|
display: none;
|
|
189
189
|
}
|
|
190
|
-
`,tt=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:r,appearance:n,dismissible:s=!0,showFrigadeBranding:p=!1})=>(Dl(()=>{let c=a=>{a.key==="Escape"&&e()};return document.addEventListener("keydown",c),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",c)}},[e,t]),t?
|
|
190
|
+
`,tt=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:r,appearance:n,dismissible:s=!0,showFrigadeBranding:p=!1})=>(Dl(()=>{let c=a=>{a.key==="Escape"&&e()};return document.addEventListener("keydown",c),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",c)}},[e,t]),t?Ue.createElement($l,null,Ue.createElement(Lr,{appearance:n,onClose:()=>{s&&e()}}),Ue.createElement(Ml,{appearance:n,className:l("modalContainer",n),styleOverrides:i},s&&Ue.createElement(zl,{className:l("modalClose",n),onClick:()=>e(),appearance:n},Ue.createElement(Ae,null)),o&&Ue.createElement(Ul,null,o),Ue.createElement(_l,null,r),p&&Ue.createElement(Vr,{appearance:n,className:l("poweredByFrigadeRibbon",n)},Ue.createElement(fo,{appearance:n})))):Ue.createElement(Ue.Fragment,null));import ot,{useEffect as Wl}from"react";import xo from"styled-components";import{Portal as Hl}from"react-portal";var Vl=xo.div`
|
|
191
191
|
${e=>v(e)} {
|
|
192
192
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
193
193
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -205,10 +205,10 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
205
205
|
bottom: 0;
|
|
206
206
|
margin-right: 28px;
|
|
207
207
|
margin-bottom: 28px;
|
|
208
|
-
`,jl=
|
|
208
|
+
`,jl=xo.div`
|
|
209
209
|
position: relative;
|
|
210
210
|
flex: 1;
|
|
211
|
-
`,Gl=
|
|
211
|
+
`,Gl=xo.div`
|
|
212
212
|
position: absolute;
|
|
213
213
|
top: 24px;
|
|
214
214
|
right: 24px;
|
|
@@ -218,13 +218,13 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
218
218
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
219
219
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
220
220
|
}
|
|
221
|
-
`,ql=
|
|
221
|
+
`,ql=xo.div`
|
|
222
222
|
overflow: scroll;
|
|
223
223
|
flex: 5;
|
|
224
224
|
::-webkit-scrollbar {
|
|
225
225
|
display: none;
|
|
226
226
|
}
|
|
227
|
-
`,Kr=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:r})=>(Wl(()=>{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?ot.createElement(Hl,null,ot.createElement(Vl,{appearance:r,className:l("cornerModalContainer",r)},ot.createElement(Gl,{className:l("cornerModalClose",r),onClick:()=>e()},ot.createElement(
|
|
227
|
+
`,Kr=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:r})=>(Wl(()=>{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?ot.createElement(Hl,null,ot.createElement(Vl,{appearance:r,className:l("cornerModalContainer",r)},ot.createElement(Gl,{className:l("cornerModalClose",r),onClick:()=>e()},ot.createElement(Ae,null)),o&&ot.createElement(jl,null,o),ot.createElement(ql,null,i))):ot.createElement(ot.Fragment,null));import{useContext as Kl}from"react";function oe(){let{defaultAppearance:e}=Kl(G);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 it,{useContext as ha,useEffect as Ca,useState as or}from"react";import bo from"styled-components";import yo,{useEffect as Yl,useState as Rr}from"react";import Jo from"styled-components";import ho from"styled-components";var Yr=ho.label`
|
|
228
228
|
${e=>v(e)} {
|
|
229
229
|
font-size: 14px;
|
|
230
230
|
line-height: 20px;
|
|
@@ -232,14 +232,14 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
232
232
|
margin-top: 10px;
|
|
233
233
|
}
|
|
234
234
|
display: flex;
|
|
235
|
-
`,Xr=
|
|
235
|
+
`,Xr=ho.label`
|
|
236
236
|
${e=>v(e)} {
|
|
237
237
|
font-size: 12px;
|
|
238
238
|
line-height: 20px;
|
|
239
239
|
margin-bottom: 5px;
|
|
240
240
|
}
|
|
241
241
|
display: flex;
|
|
242
|
-
`,Jr=
|
|
242
|
+
`,Jr=ho.span`
|
|
243
243
|
font-weight: 400;
|
|
244
244
|
font-size: 14px;
|
|
245
245
|
line-height: 22px;
|
|
@@ -247,12 +247,12 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
247
247
|
display: flex;
|
|
248
248
|
margin-right: 5px;
|
|
249
249
|
margin-top: 10px;
|
|
250
|
-
`,ho
|
|
250
|
+
`,Co=ho.div`
|
|
251
251
|
display: flex;
|
|
252
252
|
align-items: flex-start;
|
|
253
253
|
justify-content: left;
|
|
254
254
|
margin-bottom: 10px;
|
|
255
|
-
`;import Yo from"react";var qe={theme:{colorPrimary:"#000000",colorText:"#000000",colorBackground:"#ffffff",colorBackgroundSecondary:"#d2d2d2",colorTextOnPrimaryBackground:"#ffffff",colorTextSecondary:"#505050",colorTextDisabled:"#C7C7C7",colorBorder:"#E5E5E5",colorTextError:"#c00000",borderRadius:20}};function rt({title:e,required:t,appearance:o=qe}){return e?Yo.createElement(
|
|
255
|
+
`;import Yo from"react";var qe={theme:{colorPrimary:"#000000",colorText:"#000000",colorBackground:"#ffffff",colorBackgroundSecondary:"#d2d2d2",colorTextOnPrimaryBackground:"#ffffff",colorTextSecondary:"#505050",colorTextDisabled:"#C7C7C7",colorBorder:"#E5E5E5",colorTextError:"#c00000",borderRadius:20}};function rt({title:e,required:t,appearance:o=qe}){return e?Yo.createElement(Co,null,t?Yo.createElement(Jr,{className:l("formLabelRequired",o),appearance:o},"*"):null,Yo.createElement(Yr,{className:l("formLabel",o)},e)):null}import Qr from"react";function Bt({title:e,appearance:t}){return e?Qr.createElement(Co,null,Qr.createElement(Xr,{className:l("formSubLabel",t)},e)):null}import{z as Xo}from"zod";function Zr(e,t){try{if(t){if(t.type=="number"){let o=Xo.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=Xo.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 Xo.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 Xl=Jo.div`
|
|
256
256
|
display: flex;
|
|
257
257
|
flex-direction: column;
|
|
258
258
|
width: 100%;
|
|
@@ -288,7 +288,7 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
288
288
|
min-height: 70px;
|
|
289
289
|
box-sizing: border-box;
|
|
290
290
|
margin-bottom: 10px;
|
|
291
|
-
`;function Zo({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:r}){let n=e,[s,p]=Rr((r==null?void 0:r.text)||""),[c,a]=Rr(!1),h=Qo;Yl(()=>{s===""&&!c&&(a(!0),d(""))},[]);function d(C){if(p(C),o({text:C}),n.required===!0&&C.trim()===""){i([{id:n.id,message:`${n.title??"Field"} is required`}]);return}let b=Zr(C,n.validation);if(b){i([{id:n.id,message:b}]);return}i([])}n.multiline&&(h=Jl);function g(){var C;switch((C=n==null?void 0:n.validation)==null?void 0:C.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return
|
|
291
|
+
`;function Zo({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:r}){let n=e,[s,p]=Rr((r==null?void 0:r.text)||""),[c,a]=Rr(!1),h=Qo;Yl(()=>{s===""&&!c&&(a(!0),d(""))},[]);function d(C){if(p(C),o({text:C}),n.required===!0&&C.trim()===""){i([{id:n.id,message:`${n.title??"Field"} is required`}]);return}let b=Zr(C,n.validation);if(b){i([{id:n.id,message:b}]);return}i([])}n.multiline&&(h=Jl);function g(){var C;switch((C=n==null?void 0:n.validation)==null?void 0:C.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return yo.createElement(Xl,null,yo.createElement(rt,{title:n.title,required:n.required,appearance:t.appearance}),yo.createElement(h,{className:l("inputComponent",t.appearance),value:s,onChange:C=>{d(C.target.value)},appearance:t.appearance,placeholder:n.placeholder,type:g()}),yo.createElement(Bt,{title:n.subtitle,appearance:t.appearance}))}import We,{useEffect as ei,useState as ti}from"react";import oi from"styled-components";var Ro="",Ql=oi.div`
|
|
292
292
|
display: flex;
|
|
293
293
|
flex-direction: column;
|
|
294
294
|
width: 100%;
|
|
@@ -315,9 +315,9 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
315
315
|
background-repeat: no-repeat;
|
|
316
316
|
background-size: 1.5em 1.5em;
|
|
317
317
|
-webkit-print-color-adjust: exact;
|
|
318
|
-
`;function ri({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var h,d,g,C,b,k;let n=e,[s,p]=ti(((h=i==null?void 0:i.choice)==null?void 0:h[0])||""),[c,a]=ti(!1);return ei(()=>{var u,B,x,F;if(s===""&&!c){if(a(!0),n.requireSelection){p(Ro);return}if(n.defaultValue&&((u=n.props.options)!=null&&u.find(N=>N.id===n.defaultValue))){let N=(B=n.props.options)==null?void 0:B.find(T=>T.id===n.defaultValue);p(N.id),o({choice:[N.id]})}else p(((x=n.props.options)==null?void 0:x[0].id)||""),o({choice:[((F=n.props.options)==null?void 0:F[0].id)||""]})}},[]),ei(()=>{n.requireSelection&&s===Ro?r([{message:"Please select an option",id:n.id}]):r([])},[s]),We.createElement(Ql,null,We.createElement(rt,{title:n.title,required:!1,appearance:t.appearance}),We.createElement(Zl,{value:s,onChange:u=>{p(u.target.value),o({choice:[u.target.value]})},placeholder:n.placeholder,appearance:t.appearance,className:l("multipleChoiceSelect",t.appearance)},n.requireSelection&&We.createElement("option",{key:"null-value",value:Ro,disabled:!0},n.placeholder??"Select an option"),(d=n.props.options)==null?void 0:d.map(u=>We.createElement("option",{key:u.id,value:u.id},u.title))),((C=(g=n.props.options)==null?void 0:g.find(u=>u.id===s))==null?void 0:C.isOpenEnded)&&We.createElement(We.Fragment,null,We.createElement(rt,{title:((k=(b=n.props.options)==null?void 0:b.find(u=>u.id===s))==null?void 0:k.openEndedLabel)??"Please specify",required:!1,appearance:t.appearance}),We.createElement(Qo,{type:"text",placeholder:"Enter your answer here",onChange:u=>{o({choice:[u.target.value]})},appearance:t.appearance})),We.createElement(Bt,{title:n.subtitle,appearance:t.appearance}))}import
|
|
318
|
+
`;function ri({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var h,d,g,C,b,k;let n=e,[s,p]=ti(((h=i==null?void 0:i.choice)==null?void 0:h[0])||""),[c,a]=ti(!1);return ei(()=>{var u,B,x,F;if(s===""&&!c){if(a(!0),n.requireSelection){p(Ro);return}if(n.defaultValue&&((u=n.props.options)!=null&&u.find(N=>N.id===n.defaultValue))){let N=(B=n.props.options)==null?void 0:B.find(T=>T.id===n.defaultValue);p(N.id),o({choice:[N.id]})}else p(((x=n.props.options)==null?void 0:x[0].id)||""),o({choice:[((F=n.props.options)==null?void 0:F[0].id)||""]})}},[]),ei(()=>{n.requireSelection&&s===Ro?r([{message:"Please select an option",id:n.id}]):r([])},[s]),We.createElement(Ql,null,We.createElement(rt,{title:n.title,required:!1,appearance:t.appearance}),We.createElement(Zl,{value:s,onChange:u=>{p(u.target.value),o({choice:[u.target.value]})},placeholder:n.placeholder,appearance:t.appearance,className:l("multipleChoiceSelect",t.appearance)},n.requireSelection&&We.createElement("option",{key:"null-value",value:Ro,disabled:!0},n.placeholder??"Select an option"),(d=n.props.options)==null?void 0:d.map(u=>We.createElement("option",{key:u.id,value:u.id},u.title))),((C=(g=n.props.options)==null?void 0:g.find(u=>u.id===s))==null?void 0:C.isOpenEnded)&&We.createElement(We.Fragment,null,We.createElement(rt,{title:((k=(b=n.props.options)==null?void 0:b.find(u=>u.id===s))==null?void 0:k.openEndedLabel)??"Please specify",required:!1,appearance:t.appearance}),We.createElement(Qo,{type:"text",placeholder:"Enter your answer here",onChange:u=>{o({choice:[u.target.value]})},appearance:t.appearance})),We.createElement(Bt,{title:n.subtitle,appearance:t.appearance}))}import Jt,{useEffect as er,useState as ni}from"react";import si from"styled-components";import Xt from"react";import Yt from"react";import{motion as Rl}from"framer-motion";var ii=({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 Yt.createElement(Rl.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"})},ea=({fillColor:e,size:t,percentage:o,children:i,bgColor:r="#D9D9D9",className:n,style:s})=>Yt.createElement("svg",{style:s,className:n,width:t,height:t,overflow:"visible"},Yt.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},Yt.createElement(ii,{color:r,size:t}),Yt.createElement(ii,{color:e,percentage:o,size:t})),i),Et=ea;import ta from"styled-components";var oa=({color:e="#FFFFFF"})=>Xt.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Xt.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),ra={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},ia={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},na={border:"1px solid #000000",color:"#FFFFFF"},sa={border:"1px solid #E6E6E6"},la={color:"#FFFFFF"},aa={border:"3px solid #D9D9D9"},pa=e=>e==="square"?ra:ia,da=(e,t)=>e==="square"?t?na:sa:t?la:aa,ca=ta.div`
|
|
319
319
|
${e=>Ge(e)}
|
|
320
|
-
`,Ke=({value:e,type:t="square",primaryColor:o="#000000",progress:i,appearance:r=qe,style:n,className:s})=>{let p=pa(t),c=da(t,e);return e===!0?p={...p,...c,backgroundColor:o,borderColor:t==="square"?o:"none"}:p={...p,...c},e!==!0&&t==="round"&&i!==void 0&&i!==1?
|
|
320
|
+
`,Ke=({value:e,type:t="square",primaryColor:o="#000000",progress:i,appearance:r=qe,style:n,className:s})=>{let p=pa(t),c=da(t,e);return e===!0?p={...p,...c,backgroundColor:o,borderColor:t==="square"?o:"none"}:p={...p,...c},e!==!0&&t==="round"&&i!==void 0&&i!==1?Xt.createElement(Et,{fillColor:o,percentage:i,size:22}):Xt.createElement(ca,{styleOverrides:p,style:n,role:"checkbox",className:we(l("checkIconContainer",r),l(e?"checkIconContainerChecked":"checkIconContainerUnchecked",r),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&Xt.createElement(oa,{color:"#FFFFFF"}))};var ma=si.div`
|
|
321
321
|
display: flex;
|
|
322
322
|
flex-direction: column;
|
|
323
323
|
width: 100%;
|
|
@@ -348,7 +348,7 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
348
348
|
height: 60px;
|
|
349
349
|
padding: 0 18px;
|
|
350
350
|
margin-bottom: 10px;
|
|
351
|
-
`;function li({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var h;let n=e,[s,p]=ni((i==null?void 0:i.choice)||[]),[c,a]=ni(!1);return er(()=>{s.length==0&&!c&&(a(!0),o({choice:[]}))},[]),er(()=>{o({choice:s})},[s]),er(()=>{n.required&&(s.length<n.props.minChoices||s.length>n.props.maxChoices)?r([{message:"",id:n.id}]):r([])},[s]),
|
|
351
|
+
`;function li({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var h;let n=e,[s,p]=ni((i==null?void 0:i.choice)||[]),[c,a]=ni(!1);return er(()=>{s.length==0&&!c&&(a(!0),o({choice:[]}))},[]),er(()=>{o({choice:s})},[s]),er(()=>{n.required&&(s.length<n.props.minChoices||s.length>n.props.maxChoices)?r([{message:"",id:n.id}]):r([])},[s]),Jt.createElement(ma,null,Jt.createElement(rt,{title:n.title,required:n.required,appearance:t.appearance}),(h=n.props.options)==null?void 0:h.map(d=>Jt.createElement(ua,{appearance:t.appearance,className:l("multipleChoiceListItem",t.appearance),key:d.id,value:d.id,"data-selected":s.includes(d.id),onClick:()=>{if(s.includes(d.id)){p(s.filter(g=>g!==d.id));return}s.length<n.props.maxChoices?p([...s,d.id]):s.length==1&&n.props.maxChoices==1&&p([d.id])}},d.title,Jt.createElement(Ke,{type:"round",primaryColor:t.appearance.theme.colorPrimary,value:s.includes(d.id),appearance:t.appearance}))),Jt.createElement(Bt,{title:n.subtitle,appearance:t.appearance}))}import So from"react";import ai from"styled-components";import fa from"dompurify";function ue(e){return{__html:fa.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var ga=ai.h1`
|
|
352
352
|
${e=>v(e)} {
|
|
353
353
|
font-style: normal;
|
|
354
354
|
font-weight: 600;
|
|
@@ -367,25 +367,25 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
367
367
|
line-height: 20px;
|
|
368
368
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
369
369
|
}
|
|
370
|
-
`;function
|
|
370
|
+
`;function Te({appearance:e,title:t,subtitle:o,size:i="medium",classPrefix:r=""}){return So.createElement(So.Fragment,null,So.createElement(ga,{appearance:e,className:l(`${r}${r?Kt(i):i}Title`,e),dangerouslySetInnerHTML:ue(t),size:i}),o&&So.createElement(xa,{appearance:e,className:l(`${r}${r?Kt(i):i}Subtitle`,e),dangerouslySetInnerHTML:ue(o),size:i}))}import*as tr from"react";var pi=e=>tr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:12,height:12,"aria-hidden":"true",viewBox:"0 0 16 16",...e},tr.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"m10.115 1.308 5.635 11.269A2.365 2.365 0 0 1 13.634 16H2.365A2.365 2.365 0 0 1 .25 12.577L5.884 1.308a2.365 2.365 0 0 1 4.231 0zM8 10.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM8 9c.552 0 1-.32 1-.714V4.714C9 4.32 8.552 4 8 4s-1 .32-1 .714v3.572C7 8.68 7.448 9 8 9z"}));import{AnimatePresence as ya,motion as Sa}from"framer-motion";var ba=bo.div`
|
|
371
371
|
display: flex;
|
|
372
372
|
flex-direction: column;
|
|
373
373
|
justify-content: flex-end;
|
|
374
374
|
padding-bottom: 14px;
|
|
375
375
|
overflow: visible;
|
|
376
|
-
`,wa=
|
|
376
|
+
`,wa=bo(Sa.div)`
|
|
377
377
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextError}};
|
|
378
378
|
font-size: 12px;
|
|
379
379
|
margin-bottom: 12px;
|
|
380
380
|
display: flex;
|
|
381
381
|
align-items: center;
|
|
382
|
-
`,Ta=
|
|
382
|
+
`,Ta=bo.div`
|
|
383
383
|
margin-right: 4px;
|
|
384
384
|
display: inline-flex;
|
|
385
|
-
`,Fa=
|
|
385
|
+
`,Fa=bo.div`
|
|
386
386
|
padding-left: 1px;
|
|
387
387
|
padding-right: 1px;
|
|
388
|
-
`,ka={text:Zo,multipleChoice:ri,multipleChoiceList:li};function di({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:r,appearance:n,customFormElements:s,prefillData:p}){var T;let c=t.props,[a,h]=or([]),[d,g]=or([]),{userId:C}=
|
|
388
|
+
`,ka={text:Zo,multipleChoice:ri,multipleChoiceList:li};function di({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:r,appearance:n,customFormElements:s,prefillData:p}){var T;let c=t.props,[a,h]=or([]),[d,g]=or([]),{userId:C}=Gt(),[b,k]=or(F()||(p?p[t.id]:null)||{}),{readonly:u}=ha(G),B={...ka,...s};Ca(()=>{i(a.length===0)},[a,i]);function x(m,w){let y={...b,[m.id]:w};k(y),r(y),window&&window.localStorage&&!u&&window.localStorage.setItem(N(),JSON.stringify(y))}function F(){if(window&&window.localStorage){let m=window.localStorage.getItem(N());if(m)return JSON.parse(m)}return null}function N(){return`frigade-multiInputStepTypeData-${e}-${t.id}-${C}`}return it.createElement(Fa,{className:l("multiInput",n)},it.createElement(Te,{appearance:n,title:t.title,subtitle:t.subtitle}),it.createElement(ba,{className:l("multiInputContainer",n)},(T=c.data)==null?void 0:T.map(m=>{var y;let w=(y=a.reverse().find(P=>P.id===m.id))==null?void 0:y.message;return B[m.type]?it.createElement("span",{key:m.id,"data-field-id":m.id,className:l("multiInputField",n)},B[m.type]({formInput:m,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:r,appearance:n},onSaveInputData:P=>{!d.includes(m.id)&&P&&(P==null?void 0:P.text)!==""&&g(O=>[...O,m.id]),x(m,P)},inputData:b[m.id],setFormValidationErrors:P=>{h(O=>P.length===0?O.filter(I=>I.id!==m.id):[...O,...P])}}),it.createElement(ya,null,w&&d.includes(m.id)&&it.createElement(wa,{initial:{opacity:0,height:0,marginBottom:0},animate:{opacity:1,height:"auto",marginBottom:12},exit:{opacity:0,height:0,marginBottom:0},key:m.id,style:{overflow:"hidden"},transition:{duration:.1,ease:"easeInOut",delay:.5},appearance:n,className:l("multiInputValidationError",n)},it.createElement(Ta,{appearance:n,className:l("multiInputValidationErrorIcon",n)},it.createElement(pi,null)),w))):null})))}import gt from"styled-components";var ci=gt.div`
|
|
389
389
|
align-items: center;
|
|
390
390
|
display: flex;
|
|
391
391
|
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
@@ -455,7 +455,7 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
455
455
|
opacity: 0.3;
|
|
456
456
|
cursor: not-allowed;
|
|
457
457
|
}
|
|
458
|
-
`,
|
|
458
|
+
`,wo=Ci.div`
|
|
459
459
|
${e=>v(e)} {
|
|
460
460
|
display: flex;
|
|
461
461
|
flex-direction: row;
|
|
@@ -466,9 +466,9 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
466
466
|
margin-right: 8px;
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
`,ie=({onClick:e,title:t,style:o,disabled:i,type:r="inline",size:n="medium",secondary:s=!1,appearance:p,withMargin:c=!0,classPrefix:a=""})=>{function h(){let d=s?"buttonSecondary":"button";return a===""?d:`${a}${
|
|
469
|
+
`,ie=({onClick:e,title:t,style:o,disabled:i,type:r="inline",size:n="medium",secondary:s=!1,appearance:p,withMargin:c=!0,classPrefix:a=""})=>{function h(){let d=s?"buttonSecondary":"button";return a===""?d:`${a}${Kt(d)}`}return Pa.createElement(va,{secondary:s,appearance:p,disabled:i,onClick:e,styleOverrides:o,type:r,withMargin:c,size:n,className:l(h(),p)},t??"Continue")};var yi=({step:e,canContinue:t,appearance:o,onPrimaryClick:i,onSecondaryClick:r,formType:n,selectedStep:s,steps:p,onBack:c,allowBackNavigation:a,errorMessage:h})=>{let d=n==="inline"?"inline":"full-width",g=p.length>1&&s!=0&&a;return nt.createElement(nt.Fragment,null,h!==null&&h!=null&&nt.createElement(mi,{appearance:o,className:l("formCTAError",o)},h),nt.createElement(ci,{showBackButton:g,className:l("formCTAContainer",o)},g&&nt.createElement(ie,{title:e.backButtonTitle??"\u2190",onClick:c,secondary:!0,withMargin:!1,type:d,appearance:o,style:{width:"90px",maxWidth:"90px"},classPrefix:"back"}),nt.createElement(ui,{className:l("ctaWrapper",o)},e.secondaryButtonTitle?nt.createElement(ie,{title:e.secondaryButtonTitle,onClick:r,secondary:!0,withMargin:!1,type:d,appearance:o}):null," ",e.primaryButtonTitle?nt.createElement(ie,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:i,type:d,appearance:o}):null)))};import rr from"react";import Ba from"styled-components";var Ea=Ba.div`
|
|
470
470
|
text-align: center;
|
|
471
|
-
`,Si=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:r}=
|
|
471
|
+
`,Si=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:r}=oe().mergeAppearanceWithDefault(i);return rr.createElement(Ea,{className:o},rr.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((n,s)=>rr.createElement("rect",{key:s,x:16*s,y:0,width:8,height:8,rx:4,fill:t===s?r.colorPrimary:"#E6E6E6"}))))};import xt from"react";import At from"styled-components";import{useContext as Aa}from"react";function ae(){let e=Aa(G);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 Ia=At.div`
|
|
472
472
|
display: flex;
|
|
473
473
|
flex-wrap: wrap;
|
|
474
474
|
align-content: center;
|
|
@@ -516,7 +516,7 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
516
516
|
margin-top: 12px;
|
|
517
517
|
margin-bottom: 16px;
|
|
518
518
|
max-width: 70%;
|
|
519
|
-
`;function bi({stepData:e,appearance:t}){var i,r;let{handleUrl:o}=ae();return xt.createElement("div",null,xt.createElement(Da,null,e.title),xt.createElement($a,null,e.subtitle),xt.createElement(Ia,null,(r=(i=e.props)==null?void 0:i.links)==null?void 0:r.map(n=>xt.createElement(Na,{key:n.title},xt.createElement(Oa,{src:n.imageUri}),xt.createElement(La,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{n.uri&&o(n.uri,n.uriTarget??"_blank")}},n.title)))))}import It,{useEffect as Va}from"react";import
|
|
519
|
+
`;function bi({stepData:e,appearance:t}){var i,r;let{handleUrl:o}=ae();return xt.createElement("div",null,xt.createElement(Da,null,e.title),xt.createElement($a,null,e.subtitle),xt.createElement(Ia,null,(r=(i=e.props)==null?void 0:i.links)==null?void 0:r.map(n=>xt.createElement(Na,{key:n.title},xt.createElement(Oa,{src:n.imageUri}),xt.createElement(La,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{n.uri&&o(n.uri,n.uriTarget??"_blank")}},n.title)))))}import It,{useEffect as Va}from"react";import ko from"styled-components";import ir from"react";var To=({style:e,className:t})=>ir.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},ir.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),ir.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 Qt,{useRef as Ma,useState as Ua}from"react";import Fo from"styled-components";var za=Fo.div`
|
|
520
520
|
display: flex;
|
|
521
521
|
align-items: center;
|
|
522
522
|
justify-content: flex-start;
|
|
@@ -524,7 +524,7 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
524
524
|
width: 100%;
|
|
525
525
|
height: 100%;
|
|
526
526
|
position: relative;
|
|
527
|
-
`,_a=
|
|
527
|
+
`,_a=Fo.div`
|
|
528
528
|
position: absolute;
|
|
529
529
|
display: flex;
|
|
530
530
|
align-items: center;
|
|
@@ -543,40 +543,40 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
543
543
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
544
544
|
border-radius: 50%;
|
|
545
545
|
}
|
|
546
|
-
`,Wa=
|
|
546
|
+
`,Wa=Fo.video`
|
|
547
547
|
width: 100%;
|
|
548
548
|
height: 100%;
|
|
549
549
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
550
|
-
`,Ha=
|
|
550
|
+
`,Ha=Fo.iframe`
|
|
551
551
|
width: 100%;
|
|
552
552
|
height: 100%;
|
|
553
553
|
min-height: 260px;
|
|
554
554
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
555
|
-
`;function st({appearance:e,videoUri:t}){let o=Ma(),[i,r]=Ua(!1);if(t.includes("youtube")){let n=t.split("v=")[1],s=n.indexOf("&");return s!==-1&&(n=n.substring(0,s)),
|
|
555
|
+
`;function st({appearance:e,videoUri:t}){let o=Ma(),[i,r]=Ua(!1);if(t.includes("youtube")){let n=t.split("v=")[1],s=n.indexOf("&");return s!==-1&&(n=n.substring(0,s)),Qt.createElement(Ha,{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 Qt.createElement(za,{className:l("videoPlayerWrapper",e),appearance:e},!i&&Qt.createElement(_a,{onClick:()=>{r(!0),o.current.play()},appearance:e},Qt.createElement(To,null)),Qt.createElement(Wa,{appearance:e,controls:i,ref:o,play:i,src:t}))}var ja=ko.div`
|
|
556
556
|
${e=>v(e)} {
|
|
557
557
|
display: flex;
|
|
558
558
|
flex-direction: column;
|
|
559
559
|
justify-content: center;
|
|
560
560
|
}
|
|
561
|
-
`,Ga=
|
|
561
|
+
`,Ga=ko.img`
|
|
562
562
|
${e=>v(e)} {
|
|
563
563
|
width: 100%;
|
|
564
564
|
height: auto;
|
|
565
565
|
max-height: 250px;
|
|
566
566
|
margin-bottom: 24px;
|
|
567
567
|
}
|
|
568
|
-
`,qa=
|
|
568
|
+
`,qa=ko.div`
|
|
569
569
|
${e=>v(e)} {
|
|
570
570
|
margin-bottom: 24px;
|
|
571
571
|
}
|
|
572
|
-
`,Ka=
|
|
572
|
+
`,Ka=ko.div`
|
|
573
573
|
${e=>v(e)} {
|
|
574
574
|
width: 100%;
|
|
575
575
|
height: auto;
|
|
576
576
|
max-height: 250px;
|
|
577
577
|
margin-bottom: 24px;
|
|
578
578
|
}
|
|
579
|
-
`;function wi({stepData:e,appearance:t,setCanContinue:o}){return Va(()=>{o(!0)},[]),It.createElement(ja,{className:l("callToActionContainer",t)},It.createElement(qa,{className:l("callToActionTextContainer",t)},It.createElement(
|
|
579
|
+
`;function wi({stepData:e,appearance:t,setCanContinue:o}){return Va(()=>{o(!0)},[]),It.createElement(ja,{className:l("callToActionContainer",t)},It.createElement(qa,{className:l("callToActionTextContainer",t)},It.createElement(Te,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&It.createElement(Ga,{className:l("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&It.createElement(Ka,{appearance:t,className:l("callToActionVideo",t)},It.createElement(st,{appearance:t,videoUri:e.videoUri})))}import Ye,{useEffect as nr,useState as sr}from"react";import lt from"styled-components";var Ti=lt.div`
|
|
580
580
|
width: auto;
|
|
581
581
|
display: flex;
|
|
582
582
|
flex-direction: column;
|
|
@@ -629,8 +629,8 @@ import Ct,{createContext as vp,useEffect as Eo,useState as Oe}from"react";import
|
|
|
629
629
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
630
630
|
display: flex;
|
|
631
631
|
align-self: center;
|
|
632
|
-
`;var Ii=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let r=e.props,[n,s]=sr([]),[p,c]=sr(!1),[a,h]=sr(e.id);return nr(()=>{n.length==0&&!p&&(c(!0),o({choice:[]}))},[p]),nr(()=>{a!==e.id&&(h(e.id),s([]))},[e]),nr(()=>{o({choice:n}),n.length>=r.minChoices?t(!0):t(!1)},[n]),Ye.createElement(Ti,{className:l("selectListContainer",i)},Ye.createElement(Fi,null,Ye.createElement(ki,{className:l("selectListTitle",i)},e.title),Ye.createElement(Pi,{appearance:i,className:l("selectListSubtitle",i)},e.subtitle)),r.options.map((d,g)=>{let C=n.includes(d.id);return Ye.createElement(vi,{key:`select-item-${g}`,onClick:()=>{if(n.includes(d.id)){s(n.filter(b=>b!==d.id));return}n.length<r.maxChoices?s([...n,d.id]):n.length==1&&r.maxChoices==1&&s([d.id])},hideBottomBorder:g===r.options.length-1,className:l("selectListSelectItem",i)},Ye.createElement(Bi,{className:l("selectListItemImage",i)},d.imageUri&&Ye.createElement(Ei,{src:d.imageUri,alt:`select-icon-${g}`}),Ye.createElement(Ai,{appearance:i,className:l("selectListSelectItemText",i)},d.title)),Ye.createElement(Ke,{appearance:i,value:C,primaryColor:i.theme.colorPrimary}))}))};import
|
|
633
|
-
${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map(([s,p])=>`${jo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return Zt.createElement(o,{inlineStyles:t})}var Ni=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:r,customVariables:n,customFormElements:s,onComplete:p,appearance:c,hideOnFlowCompletion:a=!0,onStepCompletion:h,onButtonClick:d,dismissible:g=!0,endFlowOnDismiss:C=!1,modalPosition:b="center",repeatable:k=!1,onDismiss:u,showPagination:B=!1,allowBackNavigation:x=!1,validationHandler:F,showFrigadeBranding:N=!1,onFormDataChange:T,showFooter:m=!0,prefillData:w={}})=>{let{getFlow:y,getFlowSteps:P,isLoading:O,targetingLogicShouldHideFlow:I,getFlowStatus:L,getCurrentStepIndex:D,markFlowCompleted:z,markFlowNotStarted:H}=R(),oe=D(e),{mergeAppearanceWithDefault:se}=te(),[K,j]=Ra(!1),{setOpenFlowState:q,getOpenFlowState:X,hasOpenModals:he}=ve();c=se(c);let[Pe,Ce]=i!==void 0&&r!==void 0?[i,r]:[X(e,!0),_=>q(e,_)];if(Za(()=>{!K&&!O&&(j(!0),L(e)===Z&&k&&H(e),j(!0))},[K,j,O]),O)return null;let re=y(e);if(!re||I(re))return null;let J=P(e);if(!J||i!==void 0&&i===!1||L(e)===Z&&a||(o=="modal"||o=="corner-modal")&&he(e))return null;let $=()=>{Ce(!1),u&&u(),C===!0&&z(e)};if(b=="center"&&o==="modal"||o==="large-modal"){let _={padding:"24px"};return o==="large-modal"?(_.width="85%",_.height="90%",_.maxHeight="800px",_.minHeight="500px",_.padding="0"):_.width="400px",He.createElement(tt,{appearance:c,onClose:$,visible:Pe,style:_,dismissible:g,showFrigadeBranding:N},He.createElement(ne,{appearance:c}),He.createElement(Po,{appearance:c,steps:J,selectedStep:oe,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:Ce,onDismiss:u,showPagination:B,customFormElements:s,allowBackNavigation:x,validationHandler:F,onFormDataChange:T,showFooter:m,prefillData:w}))}return o==="modal"&&b!=="center"?He.createElement(Kr,{appearance:c,onClose:$,visible:Pe},He.createElement(ne,{appearance:c}),He.createElement(Po,{appearance:c,steps:J,selectedStep:oe,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:Ce,onDismiss:u,showPagination:B,customFormElements:s,allowBackNavigation:x,validationHandler:F,onFormDataChange:T,showFooter:m,prefillData:w})):He.createElement(He.Fragment,null,He.createElement(ne,{appearance:c}),He.createElement(Po,{appearance:c,steps:J,selectedStep:oe,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:Ce,onDismiss:u,showPagination:B,customFormElements:s,allowBackNavigation:x,validationHandler:F,onFormDataChange:T,showFooter:m,prefillData:w}))},Oi=Ni;import{useCallback as Li,useContext as ep,useEffect as tp}from"react";function lr(){let{organizationId:e,userId:t,setOrganizationId:o}=ep(G),{mutateUserFlowState:i}=Ne(),{config:r,apiUrl:n}=_e(),s=kt(),{verifySDKInitiated:p}=Pt();tp(()=>{if(t&&e){if(t.startsWith(vt))return;let h=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(h)||(s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(h,"true"))}},[t,e]);let c=Li(async h=>{if(!p())return;if(!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let d={foreignUserId:t,foreignUserGroupId:e,properties:h};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(d)}),i()},[e,t,r,i]),a=Li(async(h,d)=>{if(!p())return;if(!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let C={foreignUserId:t,foreignUserGroupId:e,events:[{event:h,properties:d}]};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(C)}),i()},[e,t,r,i]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:c,trackEventForOrganization:a}}var Di="frigade-xFrigade_guestUserId",Rt="frigade-xFrigade_userId",$i=({})=>{let{setFlowResponses:e}=Vt(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=Ne(),{userId:r,setUserId:n}=jt(),[s,p]=ar(null),{getFlowStatus:c}=R(),{flows:a,userProperties:h,setIsNewGuestUser:d,flowResponses:g}=op(G),[C,b]=ar([]),[k,u]=ar([]),{organizationId:B}=lr();vo(()=>{if(!o&&t)for(let T=0;T<t.length;T++){let m=t[T],w=a.find(y=>y.slug===(m==null?void 0:m.flowId));if(w&&m&&m.shouldTrigger===!0&&w.type=="FORM"&&w.triggerType==="AUTOMATIC"&&!k.includes(w.slug)){setTimeout(()=>{x(m.flowId)},500);break}}},[o,t]),vo(()=>{g.length>0&&i()},[g]);function x(T){let m=a.find(w=>w.slug===T);m&&m.triggerType==="AUTOMATIC"&&!k.includes(m.slug)&&(u([...k,m.slug]),b([m]))}function F(){if(!r){let T=localStorage.getItem(Rt);if(T){n(T);return}let m=localStorage.getItem(Di);if(m){n(m);return}d(!0);let w=vt+rp();try{localStorage.setItem(Di,w)}catch(y){console.log("Failed to save guest user id locally: Local storage unavailable",y)}n(y=>y||w)}}vo(()=>{try{if(a){let T=[];a.forEach(m=>{if(m.data){let w=m.data.match(/"imageUri":"(.*?)"/g);w&&w.forEach(y=>{let P=y.replace('"imageUri":"',"").replace('"',"");if(T.includes(P))return;let O=new Image;O.src=P,T.push(P)})}})}}catch{}},[a]),vo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(vt))try{localStorage.setItem(Rt,r)}catch(T){console.log("Failed to save user id locally: Local storage available",T)}r===null&&setTimeout(()=>{r===null&&F()},50)},[r,a,h]);function N(){return ht.createElement(ht.Fragment,null,C.map(T=>c(T.slug)!==De?null:ht.createElement("span",{key:T.slug},ht.createElement(Oi,{flowId:T.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return ht.createElement(ht.Fragment,null,ht.createElement(N,null))};import{ErrorBoundary as Ep}from"react-error-boundary";import eo from"core-js-pure/actual/structured-clone";function pr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function at(...e){let t=e.shift(),o=e.length===1?e[0]:at(...e);if(!pr(t)||!pr(o))throw new Error("deepmerge can only merge Objects");let i=eo(t);return Object.entries(o).forEach(([r,n])=>{pr(n)?i[r]!==void 0?Object.assign(i,{[r]:at(i[r],eo(n))}):Object.assign(i,{[r]:eo(n)}):Array.isArray(n)?i[r]!==void 0?Object.assign(i,{[r]:[...i[r],...eo(n)]}):Object.assign(i,{[r]:eo(n)}):Object.assign(i,{[r]:n})}),i}var Mi={colorPrimary:"colors.primary.background",colorText:"colors.neutral.foreground",colorBackground:"colors.neutral.background",colorBackgroundSecondary:"colors.secondary.background",colorTextOnPrimaryBackground:"colors.primary.foreground",colorTextSecondary:"colors.secondary.foreground",colorTextDisabled:"colors.gray700",colorBorder:"colors.gray800",colorTextError:"colors.negative.foreground",borderRadius:"radii.lg"};function ip(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(Mi[o]){let r=Mi[o].split("."),n=t;r.forEach((s,p)=>{n[s]||(n[s]=p===r.length-1?i:{}),n=n[s]})}}),t}function np(e){if(!e)return;let t=at({},e),o={};return Object.keys(t).forEach(i=>{let r=`.fr-${i}`;o[r]=t[i]}),o}function Ui(e){let{theme:t,styleOverrides:o}=e,i=ip(t),r=np(o);return{overrides:i,css:r}}import yp from"styled-components";import{compose as Sp,variant as _i}from"styled-system";import zi from"react";import sp,{ThemeProvider as lp,useTheme as ap}from"styled-components";import{border as pp,color as dp,compose as cp,get as mp,shadow as up,space as fp,system as gp,typography as xp}from"styled-system";var hp={width:{property:"width",scale:"sizes",transform:(e,t)=>mp(t,e,!(typeof e=="number"&&!isNaN(e))||e>1?e:e*100+"%")},height:{property:"height",scale:"sizes"},minWidth:{property:"minWidth",scale:"sizes"},minHeight:{property:"minHeight",scale:"sizes"},maxWidth:{property:"maxWidth",scale:"sizes"},maxHeight:{property:"maxHeight",scale:"sizes"},overflow:!0,overflowX:!0,overflowY:!0,display:!0,verticalAlign:!0},Cp=sp("div")(({css:e})=>e,cp(pp,dp,up,fp,xp,gp(hp))),to=({as:e,children:t,overrides:o,...i})=>{let r=ap(),n={border:"none",boxSizing:"border-box",m:0,p:0},s=()=>zi.createElement(Cp,{as:e,...n,...i},t);if(o!==void 0){let p=at(r,o);return zi.createElement(lp,{theme:p},s())}return s()};var oo={Primary:{backgroundColor:"primary.background",color:"primary.foreground","&:hover":{backgroundColor:"blue400"}},Secondary:{backgroundColor:"white",border:"1px solid",borderColor:"gray800",color:"neutral.foreground","&:hover":{backgroundColor:"blue900"}},Link:{backgroundColor:"transparent",color:"primary.inverted"},Plain:{backgroundColor:"transparent",color:"neutral.foreground"}},bp={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},Wi=yp(to)(()=>({whiteSpace:"nowrap"}),Sp(_i({scale:"components.Button",variants:"components.Button"}),_i({prop:"size",variants:bp})));import wp from"styled-components";import{variant as Tp,system as Fp}from"styled-system";var Bo={Display1:{fontSize:"5xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"4xl"},Display2:{fontSize:"4xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"3xl"},H1:{fontSize:"3xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"2xl"},H2:{fontSize:"2xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"xl"},H3:{fontSize:"xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"lg"},H4:{fontSize:"lg",fontWeight:"bold",letterSpacing:"md",lineHeight:"md"},Body1:{fontSize:"md",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Body2:{fontSize:"sm",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Caption:{fontSize:"xs",fontWeight:"regular",letterSpacing:"md",lineHeight:"sm"}};var Hi=wp(to)(Tp({scale:"components.Text",variants:"components.Text"}),Fp({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Vi=4,ji="px",kp=20,Pp=Object.fromEntries(Array.from(Array(kp+1),(e,t)=>t===0?[.5,`${.5*Vi}${ji}`]:[t,`${t*Vi}${ji}`])),Nt={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",red500:"#c00000"},dr={colors:{...Nt,neutral:{foreground:Nt.gray300},primary:{background:Nt.blue500,foreground:Nt.white,inverted:Nt.blue500},negative:{foreground:Nt.red500}},fonts:{default:"TT Interphases Pro, sans-serif"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{regular:400,semibold:500,bold:700},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"},radii:{md:"8px",lg:"20px",round:"50%"},shadows:{md:"0px 4px 20px rgba(0, 0, 0, 0.06)"},space:Pp,components:{Button:oo,Text:Bo}};var Gi="https://api.frigade.com",G=vp({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:qe,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{},apiUrl:Gi,readonly:!1});function Ap(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var Ip=({publicApiKey:e,userId:t,organizationId:o,config:i,children:r})=>{var K,j;let[n,s]=Oe(t||null),[p,c]=Oe(o||null),[a,h]=Oe([]),[d,g]=Oe([]),[C,b]=Oe([]),[k,u]=Oe({}),[B,x]=Oe({}),[F,N]=Oe([]),[T,m]=Oe({}),[w,y]=Oe(!1),[P,O]=Oe(!1),[I,L]=Oe(!H(e)),D=(q,X)=>{if(X==="_blank"){window.open(q,"_blank");return}setTimeout(()=>{window.location.href=q},50)},z={theme:{...qe.theme,...((K=i==null?void 0:i.defaultAppearance)==null?void 0:K.theme)??{}},styleOverrides:{...qe.styleOverrides,...((j=i==null?void 0:i.defaultAppearance)==null?void 0:j.styleOverrides)??{}}};function H(q){return!!(q&&q.length>10&&q.substring(0,10)==="api_public")}Eo(()=>{t&&s(t)},[t]),Eo(()=>{n&&window&&window.localStorage&&window.localStorage.getItem(Rt)&&window.localStorage.getItem(Rt)!==n&&Ap()},[n]),Eo(()=>{o&&c(o)},[o]),Eo(()=>{if(H(e))L(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),L(!0);return}},[e,L]);let oe={publicApiKey:e,userId:n,setUserId:s,setFlows:h,flows:a,failedFlowResponses:d,setFailedFlowResponses:g,flowResponses:C,setFlowResponses:b,userProperties:k,setUserProperties:u,openFlowStates:B,setOpenFlowStates:x,completedFlowsToKeepOpenDuringSession:F,setCompletedFlowsToKeepOpenDuringSession:N,customVariables:T,setCustomVariables:m,isNewGuestUser:w,setIsNewGuestUser:y,hasActiveFullPageFlow:P,setHasActiveFullPageFlow:O,organizationId:p,setOrganizationId:c,navigate:i&&i.navigate?i.navigate:D,defaultAppearance:z,shouldGracefullyDegrade:I,setShouldGracefullyDegrade:L,apiUrl:i&&i.apiUrl?i.apiUrl:Gi,readonly:i&&i.readonly?i.readonly:!1};if(I)return Ct.createElement(G.Provider,{value:oe},r);let{overrides:se}=Ui(z);return Ct.createElement(Ep,{fallback:Ct.createElement(Ct.Fragment,null,r)},Ct.createElement(G.Provider,{value:oe},Ct.createElement(Bp,{theme:at(z.theme,dr,se??{},(i==null?void 0:i.theme)??{})},r,Ct.createElement($i,null))))};import Ed from"react";import me,{useEffect as Cs,useState as ys}from"react";import Ue,{useState as ed}from"react";import bt from"styled-components";import No from"react";import yt from"react";import Ki from"styled-components";var qi=Ki.span`
|
|
632
|
+
`;var Ii=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let r=e.props,[n,s]=sr([]),[p,c]=sr(!1),[a,h]=sr(e.id);return nr(()=>{n.length==0&&!p&&(c(!0),o({choice:[]}))},[p]),nr(()=>{a!==e.id&&(h(e.id),s([]))},[e]),nr(()=>{o({choice:n}),n.length>=r.minChoices?t(!0):t(!1)},[n]),Ye.createElement(Ti,{className:l("selectListContainer",i)},Ye.createElement(Fi,null,Ye.createElement(ki,{className:l("selectListTitle",i)},e.title),Ye.createElement(Pi,{appearance:i,className:l("selectListSubtitle",i)},e.subtitle)),r.options.map((d,g)=>{let C=n.includes(d.id);return Ye.createElement(vi,{key:`select-item-${g}`,onClick:()=>{if(n.includes(d.id)){s(n.filter(b=>b!==d.id));return}n.length<r.maxChoices?s([...n,d.id]):n.length==1&&r.maxChoices==1&&s([d.id])},hideBottomBorder:g===r.options.length-1,className:l("selectListSelectItem",i)},Ye.createElement(Bi,{className:l("selectListItemImage",i)},d.imageUri&&Ye.createElement(Ei,{src:d.imageUri,alt:`select-icon-${g}`}),Ye.createElement(Ai,{appearance:i,className:l("selectListSelectItemText",i)},d.title)),Ye.createElement(Ke,{appearance:i,value:C,primaryColor:i.theme.colorPrimary}))}))};import Fe,{useEffect as Po,useState as Zt}from"react";import{AnimatePresence as Ya,motion as Xa}from"framer-motion";var Ja=({children:e,id:t,shouldWrap:o=!1})=>Fe.createElement(Fe.Fragment,null,o?Fe.createElement(Ya,{initial:!1},Fe.createElement(Xa.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),vo=({appearance:e,steps:t,selectedStep:o,customStepTypes:i,customVariables:r,onButtonClick:n,onStepCompletion:s,flowId:p,type:c,hideOnFlowCompletion:a,onComplete:h,setVisible:d,setShowModal:g,onDismiss:C,showPagination:b=!1,customFormElements:k,allowBackNavigation:u,validationHandler:B,onFormDataChange:x,showFooter:F,prefillData:N})=>{var me;let m={...{linkCollection:bi,multiInput:di,callToAction:wi,selectList:Ii},...i},{primaryCTAClickSideEffects:w,secondaryCTAClickSideEffects:y}=ae(),[P,O]=Zt(!1),[I,D]=Zt({}),[L,_]=Zt(!1),[H,X]=Zt(!1),[se,K]=Zt(null),V=t[o]??null,{markStepCompleted:q,markStepStarted:J,isLoading:Ce,updateCustomVariables:ve,markFlowCompleted:ye}=ee();Po(()=>{ve(r)},[r,Ce]),Po(()=>{x&&x(I,re(),t[o],o)},[I]),Po(()=>{window&&u&&!H&&(window.location.hash=t[o].id,X(!0))},[u,H,X]),Po(()=>{var z;if(window&&((z=window==null?void 0:window.location)!=null&&z.hash)&&window.location.hash.replace("#","")!==t[o].id){let de=window.location.hash.replace("#",""),te=t.findIndex(be=>be.id===de);te!==-1&&J(p,t[te].id)}},[(me=window==null?void 0:window.location)==null?void 0:me.hash,J,o,t]);function re(){return{data:I[t[o].id]??{},stepId:t[o].id,customVariables:r}}function Q(z,de,te){let be=o+1<t.length?t[o+1]:null;return s&&s(z,te,be,I,re()),n?n(z,o,de,be):!0}function M(z,de){D(te=>{let be={};return be[z.id]=de,{...te,...be}})}function $(z){return z.selectedStep.imageUri?Fe.createElement(hi,{image:z.selectedStep.imageUri,appearance:e,className:l("formContainerSidebarImage",e)}):null}let Se=F&&Fe.createElement(yi,{step:t[o],canContinue:P&&!L,formType:c,selectedStep:o,appearance:e,onPrimaryClick:async()=>{if(_(!0),B){let te=await B(t[o],o,t[o+1],I,re());if(te||te===!1){K(typeof te=="string"?te:null),_(!1);return}else K(null)}let z={...re()};await q(p,t[o].id,z),o+1<t.length&&await J(p,t[o+1].id);let de=Q(t[o],"primary",o);o+1>=t.length&&(h&&h(),C&&C(),a&&de&&(d&&d(!1),g(!1)),await ye(p)),w(t[o]),_(!1),window&&u&&o+1<t.length&&(window.location.hash=t[o+1].id)},onSecondaryClick:()=>{Q(t[o],"secondary",o),y(t[o])},onBack:async()=>{o-1>=0&&(_(!0),await J(p,t[o-1].id),_(!1))},steps:t,allowBackNavigation:u,errorMessage:se});return Fe.createElement(Fe.Fragment,null,Fe.createElement(fi,{className:l("formContainer",e)},Fe.createElement(gi,null,Fe.createElement(Ja,{id:o,shouldWrap:c==="large-modal"},Fe.createElement(xi,{key:V.id,type:c,className:l("formContent",e)},t.map(z=>{let de=m[z.type];return V.id!==z.id?null:Fe.createElement(de,{key:z.id,stepData:z,canContinue:P,setCanContinue:O,onSaveData:te=>{M(z,te)},appearance:e,customFormElements:k,flowId:p,prefillData:N})}),b&&Fe.createElement(Si,{className:l("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),Se))),c=="large-modal"&&Fe.createElement($,{selectedStep:t[o]})))};import Rt from"react";import{createGlobalStyle as Qa}from"styled-components";function ne({appearance:e}){if(!e||!e.styleOverrides)return Rt.createElement(Rt.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([i,r])=>typeof r=="object");if(t.length===0)return Rt.createElement(Rt.Fragment,null);let o=Qa`
|
|
633
|
+
${i=>i.inlineStyles.map(([r,n])=>`.${qt}${r}.${qt}${r} { ${Object.entries(n).map(([s,p])=>`${jo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return Rt.createElement(o,{inlineStyles:t})}var Ni=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:r,customVariables:n,customFormElements:s,onComplete:p,appearance:c,hideOnFlowCompletion:a=!0,onStepCompletion:h,onButtonClick:d,dismissible:g=!0,endFlowOnDismiss:C=!1,modalPosition:b="center",repeatable:k=!1,onDismiss:u,showPagination:B=!1,allowBackNavigation:x=!1,validationHandler:F,showFrigadeBranding:N=!1,onFormDataChange:T,showFooter:m=!0,prefillData:w={}})=>{let{getFlow:y,getFlowSteps:P,isLoading:O,targetingLogicShouldHideFlow:I,getFlowStatus:D,getCurrentStepIndex:L,markFlowCompleted:_,markFlowNotStarted:H}=ee(),X=L(e),{mergeAppearanceWithDefault:se}=oe(),[K,V]=Ra(!1),{setOpenFlowState:q,getOpenFlowState:J,hasOpenModals:Ce}=Be();c=se(c);let[ve,ye]=i!==void 0&&r!==void 0?[i,r]:[J(e,!0),$=>q(e,$)];if(Za(()=>{!K&&!O&&(V(!0),D(e)===R&&k&&H(e),V(!0))},[K,V,O]),O)return null;let re=y(e);if(!re||I(re))return null;let Q=P(e);if(!Q||i!==void 0&&i===!1||D(e)===R&&a||(o=="modal"||o=="corner-modal")&&Ce(e))return null;let M=()=>{ye(!1),u&&u(),C===!0&&_(e)};if(b=="center"&&o==="modal"||o==="large-modal"){let $={padding:"24px"};return o==="large-modal"?($.width="85%",$.height="90%",$.maxHeight="800px",$.minHeight="500px",$.padding="0"):$.width="400px",He.createElement(tt,{appearance:c,onClose:M,visible:ve,style:$,dismissible:g,showFrigadeBranding:N},He.createElement(ne,{appearance:c}),He.createElement(vo,{appearance:c,steps:Q,selectedStep:X,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:ye,onDismiss:u,showPagination:B,customFormElements:s,allowBackNavigation:x,validationHandler:F,onFormDataChange:T,showFooter:m,prefillData:w}))}return o==="modal"&&b!=="center"?He.createElement(Kr,{appearance:c,onClose:M,visible:ve},He.createElement(ne,{appearance:c}),He.createElement(vo,{appearance:c,steps:Q,selectedStep:X,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:ye,onDismiss:u,showPagination:B,customFormElements:s,allowBackNavigation:x,validationHandler:F,onFormDataChange:T,showFooter:m,prefillData:w})):He.createElement(He.Fragment,null,He.createElement(ne,{appearance:c}),He.createElement(vo,{appearance:c,steps:Q,selectedStep:X,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:ye,onDismiss:u,showPagination:B,customFormElements:s,allowBackNavigation:x,validationHandler:F,onFormDataChange:T,showFooter:m,prefillData:w}))},Oi=Ni;import{useCallback as Li,useContext as ep,useEffect as tp}from"react";function lr(){let{organizationId:e,userId:t,setOrganizationId:o}=ep(G),{mutateUserFlowState:i}=Ee(),{config:r,apiUrl:n}=_e(),s=kt(),{verifySDKInitiated:p}=Pt();tp(()=>{if(t&&e){if(t.startsWith(vt))return;let h=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(h)||(s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(h,"true"))}},[t,e]);let c=Li(async h=>{if(!p())return;if(!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let d={foreignUserId:t,foreignUserGroupId:e,properties:h};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(d)}),i()},[e,t,r,i]),a=Li(async(h,d)=>{if(!p())return;if(!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let C={foreignUserId:t,foreignUserGroupId:e,events:[{event:h,properties:d}]};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(C)}),i()},[e,t,r,i]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:c,trackEventForOrganization:a}}var Di="frigade-xFrigade_guestUserId",eo="frigade-xFrigade_userId",$i=({})=>{let{setFlowResponses:e}=jt(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=Ee(),{userId:r,setUserId:n}=Gt(),[s,p]=ar(null),{getFlowStatus:c}=ee(),{flows:a,userProperties:h,setIsNewGuestUser:d,flowResponses:g}=op(G),[C,b]=ar([]),[k,u]=ar([]),{organizationId:B}=lr();Bo(()=>{if(!o&&t)for(let T=0;T<t.length;T++){let m=t[T],w=a.find(y=>y.slug===(m==null?void 0:m.flowId));if(w&&m&&m.shouldTrigger===!0&&w.type=="FORM"&&w.triggerType==="AUTOMATIC"&&!k.includes(w.slug)){setTimeout(()=>{x(m.flowId)},500);break}}},[o,t]),Bo(()=>{g.length>0&&i()},[g]);function x(T){let m=a.find(w=>w.slug===T);m&&m.triggerType==="AUTOMATIC"&&!k.includes(m.slug)&&(u([...k,m.slug]),b([m]))}function F(){if(!r){let T=localStorage.getItem(eo);if(T){n(T);return}let m=localStorage.getItem(Di);if(m){n(m);return}d(!0);let w=vt+rp();try{localStorage.setItem(Di,w)}catch(y){console.log("Failed to save guest user id locally: Local storage unavailable",y)}n(y=>y||w)}}Bo(()=>{try{if(a){let T=[];a.forEach(m=>{if(m.data){let w=m.data.match(/"imageUri":"(.*?)"/g);w&&w.forEach(y=>{let P=y.replace('"imageUri":"',"").replace('"',"");if(T.includes(P))return;let O=new Image;O.src=P,T.push(P)})}})}}catch{}},[a]),Bo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(vt))try{localStorage.setItem(eo,r)}catch(T){console.log("Failed to save user id locally: Local storage available",T)}r===null&&setTimeout(()=>{r===null&&F()},50)},[r,a,h]);function N(){return ht.createElement(ht.Fragment,null,C.map(T=>c(T.slug)!==$e?null:ht.createElement("span",{key:T.slug},ht.createElement(Oi,{flowId:T.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return ht.createElement(ht.Fragment,null,ht.createElement(N,null))};import{ErrorBoundary as Ep}from"react-error-boundary";import to from"core-js-pure/actual/structured-clone";function pr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function at(...e){let t=e.shift(),o=e.length===1?e[0]:at(...e);if(!pr(t)||!pr(o))throw new Error("deepmerge can only merge Objects");let i=to(t);return Object.entries(o).forEach(([r,n])=>{pr(n)?i[r]!==void 0?Object.assign(i,{[r]:at(i[r],to(n))}):Object.assign(i,{[r]:to(n)}):Array.isArray(n)?i[r]!==void 0?Object.assign(i,{[r]:[...i[r],...to(n)]}):Object.assign(i,{[r]:to(n)}):Object.assign(i,{[r]:n})}),i}var Mi={colorPrimary:"colors.primary.background",colorText:"colors.neutral.foreground",colorBackground:"colors.neutral.background",colorBackgroundSecondary:"colors.secondary.background",colorTextOnPrimaryBackground:"colors.primary.foreground",colorTextSecondary:"colors.secondary.foreground",colorTextDisabled:"colors.gray700",colorBorder:"colors.gray800",colorTextError:"colors.negative.foreground",borderRadius:"radii.lg"};function ip(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(Mi[o]){let r=Mi[o].split("."),n=t;r.forEach((s,p)=>{n[s]||(n[s]=p===r.length-1?i:{}),n=n[s]})}}),t}function np(e){if(!e)return;let t=at({},e),o={};return Object.keys(t).forEach(i=>{let r=`.fr-${i}`;o[r]=t[i]}),o}function Ui(e){let{theme:t,styleOverrides:o}=e,i=ip(t),r=np(o);return{overrides:i,css:r}}import yp from"styled-components";import{compose as Sp,variant as _i}from"styled-system";import zi from"react";import sp,{ThemeProvider as lp,useTheme as ap}from"styled-components";import{border as pp,color as dp,compose as cp,get as mp,shadow as up,space as fp,system as gp,typography as xp}from"styled-system";var hp={width:{property:"width",scale:"sizes",transform:(e,t)=>mp(t,e,!(typeof e=="number"&&!isNaN(e))||e>1?e:e*100+"%")},height:{property:"height",scale:"sizes"},minWidth:{property:"minWidth",scale:"sizes"},minHeight:{property:"minHeight",scale:"sizes"},maxWidth:{property:"maxWidth",scale:"sizes"},maxHeight:{property:"maxHeight",scale:"sizes"},overflow:!0,overflowX:!0,overflowY:!0,display:!0,verticalAlign:!0},Cp=sp("div")(({css:e})=>e,cp(pp,dp,up,fp,xp,gp(hp))),oo=({as:e,children:t,overrides:o,...i})=>{let r=ap(),n={border:"none",boxSizing:"border-box",m:0,p:0},s=()=>zi.createElement(Cp,{as:e,...n,...i},t);if(o!==void 0){let p=at(r,o);return zi.createElement(lp,{theme:p},s())}return s()};var ro={Primary:{backgroundColor:"primary.background",color:"primary.foreground","&:hover":{backgroundColor:"blue400"}},Secondary:{backgroundColor:"white",border:"1px solid",borderColor:"gray800",color:"neutral.foreground","&:hover":{backgroundColor:"blue900"}},Link:{backgroundColor:"transparent",color:"primary.inverted"},Plain:{backgroundColor:"transparent",color:"neutral.foreground"}},bp={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},Wi=yp(oo)(()=>({whiteSpace:"nowrap"}),Sp(_i({scale:"components.Button",variants:"components.Button"}),_i({prop:"size",variants:bp})));import wp from"styled-components";import{variant as Tp,system as Fp}from"styled-system";var Eo={Display1:{fontSize:"5xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"4xl"},Display2:{fontSize:"4xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"3xl"},H1:{fontSize:"3xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"2xl"},H2:{fontSize:"2xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"xl"},H3:{fontSize:"xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"lg"},H4:{fontSize:"lg",fontWeight:"bold",letterSpacing:"md",lineHeight:"md"},Body1:{fontSize:"md",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Body2:{fontSize:"sm",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Caption:{fontSize:"xs",fontWeight:"regular",letterSpacing:"md",lineHeight:"sm"}};var Hi=wp(oo)(Tp({scale:"components.Text",variants:"components.Text"}),Fp({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Vi=4,ji="px",kp=20,Pp=Object.fromEntries(Array.from(Array(kp+1),(e,t)=>t===0?[.5,`${.5*Vi}${ji}`]:[t,`${t*Vi}${ji}`])),Nt={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",red500:"#c00000"},dr={colors:{...Nt,neutral:{foreground:Nt.gray300},primary:{background:Nt.blue500,foreground:Nt.white,inverted:Nt.blue500},negative:{foreground:Nt.red500}},fonts:{default:"TT Interphases Pro, sans-serif"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{regular:400,semibold:500,bold:700},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"},radii:{md:"8px",lg:"20px",round:"50%"},shadows:{md:"0px 4px 20px rgba(0, 0, 0, 0.06)"},space:Pp,components:{Button:ro,Text:Eo}};var Gi="https://api.frigade.com",G=vp({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:qe,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{},apiUrl:Gi,readonly:!1});function Ap(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var Ip=({publicApiKey:e,userId:t,organizationId:o,config:i,children:r})=>{var K,V;let[n,s]=Oe(t||null),[p,c]=Oe(o||null),[a,h]=Oe([]),[d,g]=Oe([]),[C,b]=Oe([]),[k,u]=Oe({}),[B,x]=Oe({}),[F,N]=Oe([]),[T,m]=Oe({}),[w,y]=Oe(!1),[P,O]=Oe(!1),[I,D]=Oe(!H(e)),L=(q,J)=>{if(J==="_blank"){window.open(q,"_blank");return}setTimeout(()=>{window.location.href=q},50)},_={theme:{...qe.theme,...((K=i==null?void 0:i.defaultAppearance)==null?void 0:K.theme)??{}},styleOverrides:{...qe.styleOverrides,...((V=i==null?void 0:i.defaultAppearance)==null?void 0:V.styleOverrides)??{}}};function H(q){return!!(q&&q.length>10&&q.substring(0,10)==="api_public")}Ao(()=>{t&&s(t)},[t]),Ao(()=>{n&&window&&window.localStorage&&window.localStorage.getItem(eo)&&window.localStorage.getItem(eo)!==n&&Ap()},[n]),Ao(()=>{o&&c(o)},[o]),Ao(()=>{if(H(e))D(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),D(!0);return}},[e,D]);let X={publicApiKey:e,userId:n,setUserId:s,setFlows:h,flows:a,failedFlowResponses:d,setFailedFlowResponses:g,flowResponses:C,setFlowResponses:b,userProperties:k,setUserProperties:u,openFlowStates:B,setOpenFlowStates:x,completedFlowsToKeepOpenDuringSession:F,setCompletedFlowsToKeepOpenDuringSession:N,customVariables:T,setCustomVariables:m,isNewGuestUser:w,setIsNewGuestUser:y,hasActiveFullPageFlow:P,setHasActiveFullPageFlow:O,organizationId:p,setOrganizationId:c,navigate:i&&i.navigate?i.navigate:L,defaultAppearance:_,shouldGracefullyDegrade:I,setShouldGracefullyDegrade:D,apiUrl:i&&i.apiUrl?i.apiUrl:Gi,readonly:i&&i.readonly?i.readonly:!1};if(I)return Ct.createElement(G.Provider,{value:X},r);let{overrides:se}=Ui(_);return Ct.createElement(Ep,{fallback:Ct.createElement(Ct.Fragment,null,r)},Ct.createElement(G.Provider,{value:X},Ct.createElement(Bp,{theme:at(_.theme,dr,se??{},(i==null?void 0:i.theme)??{})},r,Ct.createElement($i,null))))};import Ed from"react";import ce,{useEffect as Cs,useState as ys}from"react";import ze,{useState as ed}from"react";import bt from"styled-components";import Oo from"react";import yt from"react";import Ki from"styled-components";var qi=Ki.span`
|
|
634
634
|
font-weight: 400;
|
|
635
635
|
font-size: 15px;
|
|
636
636
|
line-height: 20px;
|
|
@@ -647,24 +647,24 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
647
647
|
padding-bottom: 20px;
|
|
648
648
|
border-top: 1px solid ${e=>e.theme.colorBorder};
|
|
649
649
|
width: 100%;
|
|
650
|
-
`,
|
|
650
|
+
`,Io=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:r,primaryColor:n="#000000",checkBoxType:s="square",appearance:p})=>yt.createElement(yt.Fragment,null,yt.createElement(Np,{className:l("checklistStepsContainer",p),appearance:p,style:{...r}},i==="left"&&e&&yt.createElement(qi,{className:l("checklistStepLabel",p),style:o},e),yt.createElement(Ke,{appearance:p,value:t,type:s,primaryColor:n}),i==="right"&&e&&yt.createElement(qi,{className:l("checklistStepLabel",p),style:o},e)),yt.createElement(ne,{appearance:p}));import{motion as Op}from"framer-motion";import io from"styled-components";var Yi=io.div`
|
|
651
651
|
font-weight: 700;
|
|
652
652
|
font-size: 18px;
|
|
653
653
|
line-height: 22px;
|
|
654
|
-
`,Xi=
|
|
654
|
+
`,Xi=io.p`
|
|
655
655
|
font-weight: 700;
|
|
656
656
|
font-size: 18px;
|
|
657
657
|
line-height: 30px;
|
|
658
658
|
margin: 20px 0px 0px 0px;
|
|
659
659
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
660
|
-
`,Ji=
|
|
660
|
+
`,Ji=io.p`
|
|
661
661
|
font-weight: 400;
|
|
662
662
|
font-size: 15px;
|
|
663
663
|
line-height: 28px;
|
|
664
664
|
max-width: 540px;
|
|
665
665
|
margin: 8px 0px 0px 0px;
|
|
666
666
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
667
|
-
`,
|
|
667
|
+
`,No=io.div`
|
|
668
668
|
width: 4px;
|
|
669
669
|
position: absolute;
|
|
670
670
|
left: 0;
|
|
@@ -672,10 +672,10 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
672
672
|
height: 80%;
|
|
673
673
|
border-top-right-radius: 8px;
|
|
674
674
|
border-bottom-right-radius: 8px;
|
|
675
|
-
`,Qi=
|
|
675
|
+
`,Qi=io.div`
|
|
676
676
|
flex-direction: row;
|
|
677
677
|
justify-content: flex-start;
|
|
678
|
-
`;var Zi=({data:e,index:t,isSelected:o,primaryColor:i,style:r,onClick:n,appearance:s})=>{var p,c;return
|
|
678
|
+
`;var Zi=({data:e,index:t,isSelected:o,primaryColor:i,style:r,onClick:n,appearance:s})=>{var p,c;return Oo.createElement("div",{style:{position:"relative",paddingLeft:"20px"},onClick:()=>{n()}},o&&Oo.createElement(No,{className:l("checklistStepItemSelectedIndicator",s),as:Op.div,layoutId:"checklis-step-selected",style:{backgroundColor:((p=s==null?void 0:s.theme)==null?void 0:p.colorPrimary)??i}}),Oo.createElement(Qi,{className:l("checklistStepItem",s),key:`hero-checklist-step-${t}`,role:"listitem"},Oo.createElement(Io,{value:e.complete,labelPosition:"left",label:e.stepName??e.title,style:r,primaryColor:((c=s==null?void 0:s.theme)==null?void 0:c.colorPrimary)??i,appearance:s})))};import St from"react";import{motion as Lp}from"framer-motion";import cr from"styled-components";var Dp={backgroundColor:"#E6E6E6"},$p=cr.div`
|
|
679
679
|
display: flex;
|
|
680
680
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
681
681
|
justify-content: flex-start;
|
|
@@ -695,11 +695,11 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
695
695
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
696
696
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
697
697
|
${e=>Ge(e)}
|
|
698
|
-
`,zp={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},_p={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},Le=({count:e,total:t,fillColor:o,bgColor:i=Dp.backgroundColor,display:r="count",textLocation:n="left",style:s={},textStyle:p={},appearance:c})=>{var b,k;if(t===0)return St.createElement(St.Fragment,null);let a=e===0?"10px":`${e/t*100}%`,h=r==="compact"?"5px":"10px",d=Math.round(e/t*100),g=r==="compact"?"5px":"20px",C;return r==="count"?C=`${e} of ${t}`:r==="compact"?C=`${d}%`:r==="percent"&&(C=`${d}% complete`),n==="top"&&(g="0px"),St.createElement($p,{className:l("progressBarContainer",c),textLocation:n,styleOverrides:s},St.createElement(Up,{className:l("progressBarStepText",c),style:{...p,fontSize:r==="compact"?12:15,fontWeight:r==="compact"?400:500},appearance:c,padding:g,textLocation:n},C),St.createElement(Mp,{textLocation:n,className:l("progressBar",c)},St.createElement(Lp.div,{style:{..._p,width:a,height:h,backgroundColor:((b=c==null?void 0:c.theme)==null?void 0:b.colorPrimary)??o,zIndex:r=="compact"?1:5},className:l("progressBarFill",c)}),St.createElement("div",{className:l("progressBarBackground",c),style:{...zp,height:h,backgroundColor:((k=c==null?void 0:c.theme)==null?void 0:k.colorSecondary)??i}})))};import
|
|
698
|
+
`,zp={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},_p={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},Le=({count:e,total:t,fillColor:o,bgColor:i=Dp.backgroundColor,display:r="count",textLocation:n="left",style:s={},textStyle:p={},appearance:c})=>{var b,k;if(t===0)return St.createElement(St.Fragment,null);let a=e===0?"10px":`${e/t*100}%`,h=r==="compact"?"5px":"10px",d=Math.round(e/t*100),g=r==="compact"?"5px":"20px",C;return r==="count"?C=`${e} of ${t}`:r==="compact"?C=`${d}%`:r==="percent"&&(C=`${d}% complete`),n==="top"&&(g="0px"),St.createElement($p,{className:l("progressBarContainer",c),textLocation:n,styleOverrides:s},St.createElement(Up,{className:l("progressBarStepText",c),style:{...p,fontSize:r==="compact"?12:15,fontWeight:r==="compact"?400:500},appearance:c,padding:g,textLocation:n},C),St.createElement(Mp,{textLocation:n,className:l("progressBar",c)},St.createElement(Lp.div,{style:{..._p,width:a,height:h,backgroundColor:((b=c==null?void 0:c.theme)==null?void 0:b.colorPrimary)??o,zIndex:r=="compact"?1:5},className:l("progressBarFill",c)}),St.createElement("div",{className:l("progressBarBackground",c),style:{...zp,height:h,backgroundColor:((k=c==null?void 0:c.theme)==null?void 0:k.colorSecondary)??i}})))};import no from"react";import Hp from"styled-components";import Do from"react";import Lo from"react";var Ot=({stepData:e,appearance:t})=>Lo.createElement(Lo.Fragment,null,Lo.createElement(Xi,{appearance:t,className:l("checklistStepTitle",t),dangerouslySetInnerHTML:ue(e.title)}),Lo.createElement(Ji,{appearance:t,className:l("checklistStepSubtitle",t),dangerouslySetInnerHTML:ue(e.subtitle)}));import mr from"react";var Lt=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},i=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return mr.createElement(wo,{className:l("ctaContainer",t)},e.secondaryButtonTitle&&mr.createElement(ie,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:i,style:{width:"auto",marginRight:"12px"}}),mr.createElement(ie,{appearance:t,title:e.primaryButtonTitle,onClick:o}))};var Dt=({stepData:e,appearance:t})=>Do.createElement(Do.Fragment,null,Do.createElement(Ot,{stepData:e,appearance:t}),Do.createElement(Lt,{stepData:e,appearance:t}));import Wp from"react";function Ri(e){return Wp.createElement(st,{appearance:e.appearance,videoUri:e.videoUri})}var ur="default",Vp=Hp.img`
|
|
699
699
|
border-radius: 4px;
|
|
700
700
|
max-height: 260px;
|
|
701
701
|
min-height: 200px;
|
|
702
|
-
`,en=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return
|
|
702
|
+
`,en=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return no.createElement("div",null,o)}return no.createElement(Yi,{className:l("checklistStepContent",t)},e.imageUri?no.createElement(Vp,{className:l("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?no.createElement(Ri,{videoUri:e.videoUri,appearance:t}):null,no.createElement(Dt,{stepData:e,appearance:t}))};import Ie,{useRef as jp,useState as Gp}from"react";import $t from"styled-components";var tn=$t.div`
|
|
703
703
|
display: block;
|
|
704
704
|
`,qp=$t.div`
|
|
705
705
|
display: flex;
|
|
@@ -744,9 +744,9 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
744
744
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
745
745
|
border-radius: 50%;
|
|
746
746
|
}
|
|
747
|
-
`,on="videoCarousel",rn=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return
|
|
747
|
+
`,on="videoCarousel",rn=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return Ie.createElement(tn,null,Ie.createElement(Dt,{stepData:e,appearance:t}));function o({video:n}){let s=jp(),[p,c]=Gp(!1);return Ie.createElement(Kp,null,!p&&Ie.createElement(Jp,{onClick:()=>{c(!0),s.current.play()},appearance:t},Ie.createElement(To,null)),Ie.createElement(Yp,{controls:p,ref:s,play:p,src:n.uri}),Ie.createElement(Xp,null,n.title))}let i=e.props;return i.videos?Ie.createElement(tn,null,Ie.createElement(Ot,{stepData:e,appearance:t}),Ie.createElement(qp,null,i.videos.map((n,s)=>Ie.createElement("span",{key:`${n.uri}-${s}`},Ie.createElement(o,{video:n})))),Ie.createElement(Lt,{stepData:e,appearance:t})):null};import Xe from"react";import $o from"styled-components";var nn=$o.div`
|
|
748
748
|
display: block;
|
|
749
|
-
`,Qp
|
|
749
|
+
`,Qp=$o.pre`
|
|
750
750
|
display: block;
|
|
751
751
|
background-color: #2a2a2a;
|
|
752
752
|
color: #f8f8f8;
|
|
@@ -762,12 +762,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
762
762
|
white-space: -o-pre-wrap; /* Opera 7 */
|
|
763
763
|
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
|
764
764
|
margin-bottom: 24px;
|
|
765
|
-
`,Zp
|
|
765
|
+
`,Zp=$o.div`
|
|
766
766
|
font-size: 15px;
|
|
767
767
|
line-height: 20px;
|
|
768
768
|
margin-bottom: 12px;
|
|
769
769
|
margin-top: 12px;
|
|
770
|
-
`,Rp
|
|
770
|
+
`,Rp=$o.div`
|
|
771
771
|
margin-top: 24px;
|
|
772
772
|
`,sn="codeSnippet",ln=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.codeSnippets))return Xe.createElement(nn,null,Xe.createElement(Dt,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?Xe.createElement(nn,null,Xe.createElement(Ot,{stepData:e,appearance:t}),Xe.createElement(Rp,null,o.codeSnippets.map((r,n)=>Xe.createElement("div",{key:n},r.title?Xe.createElement(Zp,null,r.title):null,r.code?Xe.createElement(Qp,null,r.code):null))),Xe.createElement(Lt,{stepData:e,appearance:t})):null};var td=bt.div`
|
|
773
773
|
display: flex;
|
|
@@ -800,7 +800,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
800
800
|
`,sd=bt.div`
|
|
801
801
|
flex: 2;
|
|
802
802
|
padding: 2rem;
|
|
803
|
-
`,ld=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:r,setSelectedStep:n,className:s="",customStepTypes:p=new Map,appearance:c,type:a})=>{let{mergeAppearanceWithDefault:h}=
|
|
803
|
+
`,ld=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:r,setSelectedStep:n,className:s="",customStepTypes:p=new Map,appearance:c,type:a})=>{let{mergeAppearanceWithDefault:h}=oe();c=h(c);let g={...{[ur]:en,[on]:rn,[sn]:ln},...p},[C,b]=ed(0),k=r??C,u=n??b,B=o.filter(F=>F.complete===!0).length,x=()=>{var F;return!((F=o[k])!=null&&F.type)||!g[o[k].type]?g[ur]({stepData:o[k],appearance:c}):g[o[k].type]({stepData:o[k],appearance:c})};return ze.createElement(td,{type:a,style:i,className:s,appearance:c},ze.createElement(an,{style:{flex:1}},ze.createElement(an,{style:{padding:"30px 0px 30px 30px",borderBottom:"none"}},ze.createElement(od,{className:l("checklistTitle",c),appearance:c},e),ze.createElement(rd,{className:l("checklistSubtitle",c),appearance:c},t),ze.createElement(Le,{total:o.length,count:B,fillColor:c.theme.colorPrimary,style:{marginTop:"24px"},appearance:c})),ze.createElement(id,{className:l("checklistStepsContainer",c)},o.map((F,N)=>ze.createElement(Zi,{data:F,index:N,key:N,listLength:o.length,isSelected:N===k,primaryColor:c.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{u(N)}})))),ze.createElement(nd,{appearance:c,className:l("checklistDivider",c)}),ze.createElement(sd,null,ze.createElement(x,null)))},fr=ld;import U,{useState as ud}from"react";import pn from"react";import ad from"styled-components";var pd=ad.svg`
|
|
804
804
|
transition: 'transform 0.35s ease-in-out';
|
|
805
805
|
`,Mt=({color:e="#323232",style:t,className:o})=>pn.createElement(pd,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},pn.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as fd}from"framer-motion";import fe from"styled-components";var gr={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},dn=fe.div`
|
|
806
806
|
max-height: 350px;
|
|
@@ -1015,7 +1015,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
1015
1015
|
line-height: 14px;
|
|
1016
1016
|
font-weight: 400;
|
|
1017
1017
|
cursor: pointer;
|
|
1018
|
-
`;var md=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=ae();return Qe.createElement(En,{style:t,className:l("guideContainer",r)},Qe.createElement(In,{className:l("guideTitle",r)},o),Qe.createElement(An,{className:l("guideItemContainer",r)},e.map((p,c)=>Qe.createElement(Nn,{key:`guide-${p.id??c}`,as:cd.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:l("guideItem",r)},p.icon&&Qe.createElement(On,{className:l("guideIcon",r)},Qe.createElement(Ln,null,p.icon)),Qe.createElement(Dn,{className:l("guideItemTitle",r),dangerouslySetInnerHTML:ue(p.title)}),Qe.createElement($n,{className:l("guideItemSubtitle",r),dangerouslySetInnerHTML:ue(p.subtitle)}),Qe.createElement(Mn,{className:l("guideItemLink",r),color:i,onClick:()=>{p.primaryButtonUri&&s(p),n&&n(p)}},p.primaryButtonTitle)))))},
|
|
1018
|
+
`;var md=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=ae();return Qe.createElement(En,{style:t,className:l("guideContainer",r)},Qe.createElement(In,{className:l("guideTitle",r)},o),Qe.createElement(An,{className:l("guideItemContainer",r)},e.map((p,c)=>Qe.createElement(Nn,{key:`guide-${p.id??c}`,as:cd.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:l("guideItem",r)},p.icon&&Qe.createElement(On,{className:l("guideIcon",r)},Qe.createElement(Ln,null,p.icon)),Qe.createElement(Dn,{className:l("guideItemTitle",r),dangerouslySetInnerHTML:ue(p.title)}),Qe.createElement($n,{className:l("guideItemSubtitle",r),dangerouslySetInnerHTML:ue(p.subtitle)}),Qe.createElement(Mn,{className:l("guideItemLink",r),color:i,onClick:()=>{p.primaryButtonUri&&s(p),n&&n(p)}},p.primaryButtonTitle)))))},so=md;var gd=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:r,onClose:n,selectedStep:s,setSelectedStep:p,customStepTypes:c,appearance:a,guideData:h,guideTitle:d,onGuideButtonClick:g})=>{let C=({stepData:m,handleSecondaryCTAClick:w,handleCTAClick:y})=>m?U.createElement(yn,{className:l("checklistStepContainer",a),"data-testid":"checklistStepContainer"},U.createElement(Sn,{appearance:a,className:l("checklistStepTitle",a),dangerouslySetInnerHTML:ue(m.title)}),U.createElement(bn,{appearance:a,className:l("checklistStepSubtitle",a),dangerouslySetInnerHTML:ue(m.subtitle)}),U.createElement(wn,{className:l("checklistCTAContainer",a)},m.secondaryButtonTitle&&U.createElement(ie,{title:m.secondaryButtonTitle,onClick:w,appearance:a,secondary:!0}),U.createElement(ie,{title:m.primaryButtonTitle,onClick:y,appearance:a}))):U.createElement(U.Fragment,null),k={...{default:m=>{var O;if((O=e[x])!=null&&O.StepContent){let I=e[x].StepContent;return U.createElement("div",null,I)}let w=e[x];return U.createElement(C,{stepData:m,handleCTAClick:()=>{w.handlePrimaryButtonClick&&w.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{w.handleSecondaryButtonClick&&w.handleSecondaryButtonClick()}})}},...c},[u,B]=ud(0),x=s??u,F=p??B,N=()=>{var m;return e?!((m=e[x])!=null&&m.type)||!k[e[x].type]?k.default(e[x]):k[e[x].type]({stepData:e[x],primaryColor:a.theme.colorPrimary}):U.createElement(U.Fragment,null)},T=e.filter(m=>m.complete).length;return r?(a.theme.modalContainer||(a.theme.borderRadius&&(gr.borderRadius=a.theme.borderRadius+"px"),a.theme.modalContainer=gr),U.createElement(tt,{onClose:n,visible:r,appearance:a},U.createElement(vn,null,U.createElement(cn,null,U.createElement(mn,{appearance:a,className:l("checklistTitle",a)},t),U.createElement(un,{appearance:a,className:l("checklistSubtitle",a)},o)),U.createElement(dn,null,e&&e.length>0&&U.createElement(fn,{className:l("stepsContainer",a)},U.createElement(gn,null,U.createElement("div",{style:{flex:3}},U.createElement(xn,{className:l("stepsTitle",a)},i)),U.createElement(Pn,null,U.createElement(Le,{fillColor:a.theme.colorPrimary,style:{width:"100%"},count:T,total:e.length,appearance:a}))),U.createElement(hn,null,U.createElement(Cn,{className:l("checklistStepListContainer",a),appearance:a},e.map((m,w)=>{let y=x===w;return U.createElement(Tn,{selected:y,className:l(`checklistStepListItem${y?"Selected":""}`,a),key:`checklist-guide-step-${m.id??w}`,disabled:m.blocked,onClick:()=>{m.blocked||F(w)},title:m.blocked?"Finish remaining steps to continue":void 0},y&&U.createElement(No,{className:l("checklistStepItemSelectedIndicator",a),as:fd.div,layoutId:"checklist-step-selected",style:{backgroundColor:a.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),U.createElement(Fn,{selected:y,className:l(`checklistStepListStepName${y?"Selected":""}`,a)},m.stepName),U.createElement(kn,null,U.createElement(Ke,{value:m.complete,type:"round",primaryColor:a.theme.colorPrimary,progress:m.progress,appearance:a}),U.createElement(Bn,null,U.createElement(Mt,{style:{marginLeft:"10px"},color:a.theme.colorBackgroundSecondary}))))})),U.createElement(N,null))),h&&h.length>0&&U.createElement(so,{steps:h,title:d,primaryColor:a.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:a,onButtonClick:m=>(g&&g(m),!0)}))))):U.createElement(U.Fragment,null)},xr=gd;import{useEffect as xd,useState as hd}from"react";var Mo=()=>{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]=hd(t),r=null,n=()=>{r!==null?clearTimeout(r):s(),r=setTimeout(()=>{s()},16)},s=()=>{let p=Object.fromEntries(Object.entries(e).map(([c,a])=>{if(!window)return[c,!1];let h=window.matchMedia(a);return h.addEventListener("change",n),[c,h.matches]}));i(p)};return xd(()=>{s()},[]),o};import Pe,{useEffect as Zn,useState as Sd}from"react";import ge from"react";import{AnimatePresence as Cd,motion as yd}from"framer-motion";import Ze from"styled-components";var Un=Ze.div`
|
|
1019
1019
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1020
1020
|
border: 1px solid;
|
|
1021
1021
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -1062,7 +1062,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
1062
1062
|
flex-direction: row;
|
|
1063
1063
|
justify-content: flex-start;
|
|
1064
1064
|
align-items: center;
|
|
1065
|
-
`;var qn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:r,appearance:n,customStepTypes:s})=>{var h,d;let p=t?{}:{transform:"rotate(90deg)"};function c(){return ge.createElement(ge.Fragment,null,e.imageUri||e.videoUri?ge.createElement(zn,{className:l("stepMediaContainer",n)},e.imageUri?ge.createElement(_n,{className:l("stepImage",n),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?ge.createElement(st,{appearance:n,videoUri:e.videoUri}):null):null,ge.createElement(jn,{className:l("stepSubtitle",n),appearance:n,dangerouslySetInnerHTML:ue(e.subtitle)}),ge.createElement(
|
|
1065
|
+
`;var qn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:r,appearance:n,customStepTypes:s})=>{var h,d;let p=t?{}:{transform:"rotate(90deg)"};function c(){return ge.createElement(ge.Fragment,null,e.imageUri||e.videoUri?ge.createElement(zn,{className:l("stepMediaContainer",n)},e.imageUri?ge.createElement(_n,{className:l("stepImage",n),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?ge.createElement(st,{appearance:n,videoUri:e.videoUri}):null):null,ge.createElement(jn,{className:l("stepSubtitle",n),appearance:n,dangerouslySetInnerHTML:ue(e.subtitle)}),ge.createElement(wo,{className:l("checklistCTAContainer",n)},e.secondaryButtonTitle?ge.createElement(ie,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>r(),appearance:n}):null,ge.createElement(ie,{title:e.primaryButtonTitle??"Continue",onClick:()=>i(),appearance:n})))}function a(){if(!s)return null;let g=s[e.type];return g?g(e,n):null}return ge.createElement(Un,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:l("checklistStepContainer",n),appearance:n},ge.createElement(Wn,{className:l("stepHeader",n)},ge.createElement(Gn,null,ge.createElement(Io,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(h=n==null?void 0:n.theme)==null?void 0:h.colorPrimary,appearance:n}),ge.createElement(Hn,{appearance:n,className:l("stepTitle",n),dangerouslySetInnerHTML:ue(e.title)})),ge.createElement(Vn,{className:l("stepChevronContainer",n),onClick:()=>o()},ge.createElement(Mt,{style:{...p,transition:"transform 0.1s ease-in-out"},color:(d=n==null?void 0:n.theme)==null?void 0:d.colorTextSecondary}))),ge.createElement(Cd,null,!t&&ge.createElement(yd.div,{initial:{opacity:1,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:1,height:0},key:e.id,style:{overflow:"hidden"}},a()??c())))};import Ut from"styled-components";var a0=Ut.div`
|
|
1066
1066
|
background: #ffffff;
|
|
1067
1067
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
1068
1068
|
border-radius: 6px;
|
|
@@ -1101,7 +1101,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
1101
1101
|
flex-direction: column;
|
|
1102
1102
|
justify-content: space-between;
|
|
1103
1103
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1104
|
-
`;var bd=({title:e,subtitle:t,steps:o,onClose:i,visible:r,autoExpandFirstIncompleteStep:n=!0,autoCollapse:s=!0,autoExpandNextStep:p=!0,primaryColor:c="#000000",selectedStep:a,setSelectedStep:h,appearance:d,type:g,className:C,customStepTypes:b,style:k})=>{let u=o.filter(m=>m.complete).length,[B,x]=Sd(Array(o.length).fill(!0));Zn(()=>{let m=[...B];if(n){for(let w=0;w<o.length;w++)if(!o[w].complete){m[w]=!1;break}x(m)}},[]),Zn(()=>{F(a)},[a]);let F=m=>{let w=[...B];if(s)for(let y=0;y<B.length;++y)y!==m&&(w[y]=!0);w[m]=!w[m],x(w)};if(!r&&g=="modal")return
|
|
1104
|
+
`;var bd=({title:e,subtitle:t,steps:o,onClose:i,visible:r,autoExpandFirstIncompleteStep:n=!0,autoCollapse:s=!0,autoExpandNextStep:p=!0,primaryColor:c="#000000",selectedStep:a,setSelectedStep:h,appearance:d,type:g,className:C,customStepTypes:b,style:k})=>{let u=o.filter(m=>m.complete).length,[B,x]=Sd(Array(o.length).fill(!0));Zn(()=>{let m=[...B];if(n){for(let w=0;w<o.length;w++)if(!o[w].complete){m[w]=!1;break}x(m)}},[]),Zn(()=>{F(a)},[a]);let F=m=>{let w=[...B];if(s)for(let y=0;y<B.length;++y)y!==m&&(w[y]=!0);w[m]=!w[m],x(w)};if(!r&&g=="modal")return Pe.createElement(Pe.Fragment,null);let N=Pe.createElement(Pe.Fragment,null,Pe.createElement(Kn,null,Pe.createElement(Yn,{appearance:d,className:l("checklistTitle",d),dangerouslySetInnerHTML:ue(e)}),Pe.createElement(Xn,{appearance:d,className:l("checklistSubtitle",d),dangerouslySetInnerHTML:ue(t)})),Pe.createElement(Le,{display:"percent",count:u,total:o.length,fillColor:c,style:{margin:"14px 0px 8px 0px"},appearance:d})),T=Pe.createElement(Jn,{className:we(l("checklistContainer",d),C)},o.map((m,w)=>{let y=B[w];return Pe.createElement(qn,{appearance:d,stepData:m,collapsed:y,key:`modal-checklist-${m.id??w}`,onClick:()=>{if(a===w){F(w);return}h(w)},onPrimaryButtonClick:()=>{m.handlePrimaryButtonClick&&m.handlePrimaryButtonClick(),p&&!m.completionCriteria&&w<B.length-1&&B[w+1]&&h(w+1)},onSecondaryButtonClick:()=>{m.handleSecondaryButtonClick&&m.handleSecondaryButtonClick()},customStepTypes:b})}));return g==="inline"?Pe.createElement(Qn,{appearance:d,className:we(l("checklistInlineContainer",d),C),style:k},N,T):Pe.createElement(Pe.Fragment,null,Pe.createElement(tt,{onClose:i,visible:r,appearance:d,style:{maxWidth:"600px"},headerContent:N},T))},hr=bd;import le,{useEffect as Cr,useRef as vd,useState as wt}from"react";import zt from"react";import pe,{css as Rn,keyframes as es}from"styled-components";var ts=Rn`
|
|
1105
1105
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1106
1106
|
`,wd=Rn`
|
|
1107
1107
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
@@ -1243,21 +1243,21 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
1243
1243
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1244
1244
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1245
1245
|
`}
|
|
1246
|
-
`;var gs=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=
|
|
1246
|
+
`;var gs=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=oe(),{primaryCTAClickSideEffects:r}=ae();o=i(o);let{imageUri:n=null,subtitle:s=null,title:p=null,complete:c=!1,blocked:a=!1}=e,h=e.primaryButtonTitle||e.secondaryButtonTitle,d=()=>{r(e)};return zt.createElement(ls,{className:l("carouselCard",o),onClick:a?null:d,style:t,blocked:a,complete:c},n&&zt.createElement(as,{className:l("carouselCardImage",o),src:n,alt:p,style:{opacity:c||a?.4:1}}),c&&zt.createElement(ds,{className:l("carouselCompletedPill",o)},zt.createElement(fs,{style:{color:"#108E0B"}},"Complete")),p&&zt.createElement(us,{blocked:a,complete:c,className:l("carouselCardTitle",o)},p),s&&zt.createElement(pt.Quiet,{blocked:a,complete:c,className:l("carouselCardSubtitle",o)},s))};var Bd=()=>le.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},le.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),le.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),le.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),xs=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,r]=wt(!1),[n,s]=wt(!1);Cr(()=>{t===!0&&i===!1?r(!0):t===!1&&i===!0&&s(!0)},[t]);let p=()=>{r(!1),s(!1)},c=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return i?le.createElement(is,{style:c,reversed:n,onAnimationEnd:n?p:null},le.createElement(ns,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},le.createElement(Bd,null))):null},hs=({flowId:e,appearance:t,customVariables:o,className:i})=>{let r=vd(null),[n,s]=wt(!1),[p,c]=wt(!1),[a,h]=wt(null),[d,g]=wt([]),[C,b]=wt(0),{isSmall:k}=Mo(),u=k?1:3,{getFlowMetadata:B,getFlowSteps:x,getNumberOfStepsCompleted:F,updateCustomVariables:N,isLoading:T}=ee();Cr(()=>{N(o)},[o,T]),Cr(()=>{if(T)return;let I=B(e),D=F(e),L=x(e);h(I),I.data!==null&&(g(L.sort((_,H)=>Number(_.complete)-Number(H.complete))),c(L.length>u),b(D))},[T]);let m=[];for(let I=0;I<d.length;I+=u)m.push(d.slice(I,I+u));let w=I=>{let D=I.target,L=D.scrollWidth-D.clientWidth,_=Math.ceil(D.scrollLeft);_>0&&n===!1&&s(!0),_===0&&n===!0&&s(!1),_<L&&p===!1&&c(!0),_===L&&p===!0&&c(!1)},y=(I=!0)=>{let D=I?1:-1;r.current!==null&&r.current.scrollBy({left:r.current.clientWidth*D,behavior:"smooth"})},P=null,O=I=>{P!==null?clearTimeout(P):w(I),P=setTimeout(()=>{w(I)},16)};return T?null:le.createElement(ps,{className:we(l("carouselContainer",t),i)},le.createElement("div",{style:{display:"flex",justifyContent:k?"center":"space-between",marginBottom:20,flexWrap:k?"wrap":"nowrap",gap:k?16:20}},le.createElement("div",null,le.createElement(cs,{className:l("carouselTitle",t)},a==null?void 0:a.title),le.createElement(pt.Quiet,{className:l("carouselSubtitle",t)},a==null?void 0:a.subtitle)),le.createElement(ms,{className:l("progressWrapper",t)},le.createElement(Le,{count:C,total:d.length,appearance:t}))),le.createElement("div",{style:{position:"relative"}},le.createElement(xs,{show:n,onClick:()=>y(!1)}),le.createElement(xs,{side:"right",show:p,onClick:y}),le.createElement(os,{ref:r,onScroll:O},m.map((I,D)=>le.createElement(rs,{key:D,style:{flex:`0 0 calc(100% - ${d.length>u?36:0}px)`}},I.map((L,_)=>le.createElement(gs,{key:_,stepData:L,style:{flex:d.length>u?`0 1 calc(100% / ${u} - 16px * 2 / ${u})`:1},appearance:t})))))),le.createElement(ne,{appearance:t}))};var yr=({flowId:e,title:t,subtitle:o,style:i,initialSelectedStep:r,className:n,type:s="inline",onDismiss:p,visible:c,customVariables:a,onStepCompletion:h,onButtonClick:d,appearance:g,hideOnFlowCompletion:C,setVisible:b,customStepTypes:k,checklistStyle:u="default",autoExpandFirstIncompleteStep:B,autoExpandNextStep:x,...F})=>{let{getFlow:N,getFlowSteps:T,markStepCompleted:m,getStepStatus:w,getNumberOfStepsCompleted:y,isLoading:P,targetingLogicShouldHideFlow:O,updateCustomVariables:I,getFlowMetadata:D,isStepBlocked:L,getFlowStatus:_,hasActiveFullPageFlow:H,setHasActiveFullPageFlow:X}=ee(),{primaryCTAClickSideEffects:se,secondaryCTAClickSideEffects:K}=ae(),{getOpenFlowState:V,setOpenFlowState:q}=Be(),[J,Ce]=ys(r||0),[ve,ye]=ys(!1),re=c===void 0?V(e):c,Q=s==="modal",{mergeAppearanceWithDefault:M}=oe(),{isLarge:$}=Mo();if(g=M(g),Cs(()=>{I(a)},[a,P]),Cs(()=>{c!==void 0&&(Q&&c===!0?X(!0):Q&&c===!1&&X(!1))},[c,b,H]),P)return null;let Se=N(e);if(!Se||O(Se))return null;let me=T(e);if(!me||C===!0&&_(e)===R)return null;let z=D(e);if(z!=null&&z.title&&(t=z.title),z!=null&&z.subtitle&&(o=z.subtitle),!ve&&r===void 0&&y(e)>0){let A=me.findIndex(Z=>Z.complete===!1);Ce(A>-1?A:me.length-1),ye(!0)}function de(){if(J+1>=me.length){Q&&q(e,!1);return}L(e,me[J+1].id)||Ce(J+1)}function te(A,Z,mt){let vr=J+1<me.length?me[J+1]:null;d&&d(A,J,Z,vr)===!0&&Q&&xe(),h&&h(A,mt,vr),!h&&!d&&(A.primaryButtonUri||A.secondaryButtonUri)&&Q&&xe()}function be(){return me.map((A,Z)=>({...A,handleSecondaryButtonClick:()=>{de(),K(A),A.skippable===!0&&m(e,A.id,{skipped:!0}),te(A,"secondary",Z)},handlePrimaryButtonClick:()=>{(!A.completionCriteria&&(A.autoMarkCompleted||A.autoMarkCompleted===void 0)||A.completionCriteria&&A.autoMarkCompleted===!0)&&(m(e,A.id),de()),te(A,"primary",Z),se(A),w(e,A.id)===Me&&de()}}))}function De(){return ce.createElement(ne,{appearance:g})}let j={steps:be(),title:t,subtitle:o,primaryColor:g.theme.colorPrimary,appearance:g,customStepTypes:k,type:s,className:n,autoExpandFirstIncompleteStep:B,autoExpandNextStep:x};function xe(){q(e,!1),p&&p(),b&&b(!1)}function Vt(){return ce.createElement(ce.Fragment,null,ce.createElement(De,null),ce.createElement(hs,{flowId:e,appearance:g,customVariables:a,className:n}))}function f(){return ce.createElement(ce.Fragment,null,ce.createElement(De,null),ce.createElement(hr,{visible:re,onClose:()=>{xe()},selectedStep:J,setSelectedStep:Ce,autoExpandNextStep:!0,appearance:g,...j}))}function S(){if(!$)return f();let A=F.guideFlowId,Z;return A&&N(A)&&(Z=T(A)),ce.createElement(ce.Fragment,null,ce.createElement(De,null),ce.createElement(xr,{visible:re,stepsTitle:z.stepsTitle?z.stepsTitle:"Your quick start guide",onClose:()=>{xe()},selectedStep:J,setSelectedStep:Ce,guideData:Z,guideTitle:F.guideTitle??"Guide",appearance:g,title:t,subtitle:o,onGuideButtonClick:mt=>{te(mt,"link",0)},customStepTypes:k,...j}))}function E(){if(!$)return f();let A=ce.createElement(fr,{flowId:e,style:i,selectedStep:J,setSelectedStep:Ce,appearance:g,type:s,...j});return Q?ce.createElement(tt,{onClose:()=>{xe()},visible:re,appearance:g,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},ce.createElement(De,null),A):ce.createElement(ce.Fragment,null,ce.createElement(De,null),A)}switch(u){case"condensed":return f();case"with-guide":return S();case"default":return E();case"carousel":return Vt();default:return E()}};var Ad=e=>Ed.createElement(yr,{type:"inline",...e});import ct,{useEffect as Nd}from"react";import Ve from"react";import Uo from"styled-components";var Ss=Uo.div`
|
|
1247
1247
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1248
1248
|
border-radius: 8px;
|
|
1249
1249
|
padding: 6px 10px 6px 10px;
|
|
1250
1250
|
min-width: 160px;
|
|
1251
1251
|
cursor: pointer;
|
|
1252
1252
|
background-color: ${e=>e.appearance.theme.colorBackground}};
|
|
1253
|
-
`,bs=
|
|
1253
|
+
`,bs=Uo.div`
|
|
1254
1254
|
display: flex;
|
|
1255
1255
|
flex-direction: row;
|
|
1256
1256
|
justify-content: space-between;
|
|
1257
1257
|
align-items: center;
|
|
1258
1258
|
margin-bottom: 2px;
|
|
1259
1259
|
flex-grow: 2;
|
|
1260
|
-
`,ws=
|
|
1260
|
+
`,ws=Uo.div`
|
|
1261
1261
|
text-overflow: ellipsis;
|
|
1262
1262
|
font-weight: 600;
|
|
1263
1263
|
font-size: 12px;
|
|
@@ -1265,13 +1265,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
1265
1265
|
margin-right: ${e=>e.type==="condensed"?"8px":"0"};
|
|
1266
1266
|
text-align: ${e=>e.type==="condensed"?"left":"right"};
|
|
1267
1267
|
color: ${e=>e.appearance.theme.colorPrimary};
|
|
1268
|
-
`,Ts=
|
|
1268
|
+
`,Ts=Uo.div`
|
|
1269
1269
|
width: 20px;
|
|
1270
1270
|
margin-right: 8px;
|
|
1271
1271
|
display: flex;
|
|
1272
1272
|
height: 100%;
|
|
1273
1273
|
align-items: center;
|
|
1274
|
-
`;import{motion as Id}from"framer-motion";var Fs=({title:e,count:t,total:o,onClick:i,style:r={},className:n,appearance:s,type:p="default"})=>Ve.createElement(Ve.Fragment,null,Ve.createElement(ne,{appearance:s}),Ve.createElement(Ss,{as:Id.div,whileHover:{opacity:.9},whileTap:{scale:.98},onClick:()=>i!==void 0&&i(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...r},className:
|
|
1274
|
+
`;import{motion as Id}from"framer-motion";var Fs=({title:e,count:t,total:o,onClick:i,style:r={},className:n,appearance:s,type:p="default"})=>Ve.createElement(Ve.Fragment,null,Ve.createElement(ne,{appearance:s}),Ve.createElement(Ss,{as:Id.div,whileHover:{opacity:.9},whileTap:{scale:.98},onClick:()=>i!==void 0&&i(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...r},className:we(n??"",l("progressRingContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&Ve.createElement(Ts,{className:l("progressRingContainer",s)},Ve.createElement(Et,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),Ve.createElement(bs,{type:p,className:l("badgeTitleContainer",s)},Ve.createElement(ws,{type:p,appearance:s,className:l("badgeTitle",s)},e),i!==void 0&&Ve.createElement(Mt,{className:l("badgeChevron",s),color:s.theme.colorPrimary})),p=="default"&&o&&o!==0&&Ve.createElement(Le,{display:"compact",count:t,total:o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:s})));import dt from"react";import lo from"styled-components";var ks=lo.div`
|
|
1275
1275
|
display: flex;
|
|
1276
1276
|
flex-direction: row;
|
|
1277
1277
|
width: 100%;
|
|
@@ -1282,25 +1282,25 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
1282
1282
|
border-width: 1px;
|
|
1283
1283
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1284
1284
|
border-radius: 12px;
|
|
1285
|
-
`,Ps=
|
|
1285
|
+
`,Ps=lo.div`
|
|
1286
1286
|
${e=>v(e)} {
|
|
1287
1287
|
display: flex;
|
|
1288
1288
|
justify-content: center;
|
|
1289
1289
|
align-items: center;
|
|
1290
1290
|
margin-right: 16px;
|
|
1291
1291
|
}
|
|
1292
|
-
`,vs=
|
|
1292
|
+
`,vs=lo.div`
|
|
1293
1293
|
display: flex;
|
|
1294
1294
|
flex-direction: column;
|
|
1295
1295
|
flex: 1;
|
|
1296
1296
|
margin-top: 0;
|
|
1297
|
-
`,Bs=
|
|
1297
|
+
`,Bs=lo.div`
|
|
1298
1298
|
display: flex;
|
|
1299
1299
|
flex-direction: column;
|
|
1300
1300
|
justify-content: center;
|
|
1301
1301
|
margin-left: 16px;
|
|
1302
1302
|
min-width: 200px;
|
|
1303
|
-
`,Ty=
|
|
1303
|
+
`,Ty=lo.div`
|
|
1304
1304
|
display: flex;
|
|
1305
1305
|
justify-content: center;
|
|
1306
1306
|
align-items: flex-end;
|
|
@@ -1309,7 +1309,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
1309
1309
|
:hover {
|
|
1310
1310
|
opacity: 0.8;
|
|
1311
1311
|
}
|
|
1312
|
-
`;var Es=({title:e,subtitle:t,icon:o,appearance:i,count:r,total:n,className:s,style:p})=>dt.createElement(dt.Fragment,null,dt.createElement(ks,{appearance:i,className:
|
|
1312
|
+
`;var Es=({title:e,subtitle:t,icon:o,appearance:i,count:r,total:n,className:s,style:p})=>dt.createElement(dt.Fragment,null,dt.createElement(ks,{appearance:i,className:we(l("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&dt.createElement(Ps,{className:l("fullWidthProgressBadgeIcon",i)},o),dt.createElement(vs,null,dt.createElement(Te,{size:"small",appearance:i,title:e,subtitle:t})),dt.createElement(Bs,{className:l("fullWidthProgressBadgeProgressContainer",i)},dt.createElement(Le,{count:r,total:n,display:"percent",textLocation:"top",fillColor:i.theme.colorPrimary}))));var Od=({flowId:e,title:t,subtitle:o,icon:i,style:r,onClick:n,className:s,customVariables:p,hideOnFlowCompletion:c,appearance:a,type:h="default"})=>{let{getFlow:d,getFlowSteps:g,getFlowStatus:C,getNumberOfStepsCompleted:b,isLoading:k,targetingLogicShouldHideFlow:u,updateCustomVariables:B}=ee(),{mergeAppearanceWithDefault:x}=oe();a=x(a);let{setOpenFlowState:F,getOpenFlowState:N}=Be();if(Nd(()=>{B(p)},[p,k]),k)return null;let T=d(e);if(!T||u(T)||c===!0&&C(e)===R)return null;let m=g(e),w=b(e);return h==="full-width"?ct.createElement(ct.Fragment,null,ct.createElement(ne,{appearance:a}),ct.createElement(Es,{title:t,subtitle:o,count:w,total:m.length,style:r,className:s,appearance:a,icon:i,onClick:()=>{}})):ct.createElement(ct.Fragment,null,ct.createElement(ne,{appearance:a}),ct.createElement(Fs,{count:w,total:m.length,title:t,style:r,onClick:()=>{F(e,!0),n&&n()},type:h,className:s,appearance:a}))};import Ld from"react";var Dd=({flowId:e,style:t,appearance:o,...i})=>{let{getFlow:r,targetingLogicShouldHideFlow:n,getFlowSteps:s}=ee(),{mergeAppearanceWithDefault:p}=oe();o=p(o);let c=r(e);if(!c||n(c))return null;let a=s(e);return Ld.createElement(so,{steps:a,style:t,appearance:o,...i})};import Wt,{useContext as qd,useEffect as Kd}from"react";import W,{useEffect as zo,useLayoutEffect as Is,useRef as zd,useState as ao}from"react";import po from"styled-components";import{useCallback as $d,useEffect as Md,useState as Ud}from"react";var Sr=(e,t,o,i={x:20,y:20},r)=>{let n=r=="fixed"?0:window.scrollY,s=r=="fixed"?0:window.scrollX;return t==="left"?{x:e.left-o+i.x+s,y:e.top-i.y+n}:t==="right"?{x:e.left+e.width+i.x+s,y:e.top-i.y+n}:{x:0,y:0}};function As(e,t){let o="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[i,r]=Ud(o),n=$d(()=>{e&&r(e.getBoundingClientRect())},[e]);return Md(()=>(n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)),[e,t]),i}var Ns=300,Os=100,_d=500,_t=12,Wd=po.div`
|
|
1313
1313
|
width: 100%;
|
|
1314
1314
|
height: 100%;
|
|
1315
1315
|
border-radius: 9999px;
|
|
@@ -1332,25 +1332,25 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
1332
1332
|
opacity: 0;
|
|
1333
1333
|
}
|
|
1334
1334
|
}
|
|
1335
|
-
`,Hd=
|
|
1335
|
+
`,Hd=po.div`
|
|
1336
1336
|
width: ${_t}px;
|
|
1337
1337
|
height: ${_t}px;
|
|
1338
1338
|
border-radius: 100px;
|
|
1339
1339
|
background-color: ${e=>e.primaryColor};
|
|
1340
1340
|
z-index: 20;
|
|
1341
1341
|
opacity: 1;
|
|
1342
|
-
`,Vd=
|
|
1342
|
+
`,Vd=po.div`
|
|
1343
1343
|
pointer-events: all;
|
|
1344
|
-
`,Ls=
|
|
1344
|
+
`,Ls=po.div`
|
|
1345
1345
|
display: flex;
|
|
1346
1346
|
align-content: center;
|
|
1347
1347
|
justify-content: center;
|
|
1348
1348
|
align-items: center;
|
|
1349
1349
|
z-index: ${e=>e.zIndex?e.zIndex:90};
|
|
1350
|
-
`,jd=
|
|
1350
|
+
`,jd=po(Ls)`
|
|
1351
1351
|
width: ${_t+12}px;
|
|
1352
1352
|
height: ${_t+12}px;
|
|
1353
|
-
`,Gd=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:r=!0,primaryColor:n="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:c={},selectedStep:a=0,customStepTypes:h,appearance:d,dismissible:g=!1,showHighlightOnly:C,showStepCount:b=!0,completedStepsCount:k=0,showFrigadeBranding:u=!1})=>{var
|
|
1353
|
+
`,Gd=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:r=!0,primaryColor:n="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:c={},selectedStep:a=0,customStepTypes:h,appearance:d,dismissible:g=!1,showHighlightOnly:C,showStepCount:b=!0,completedStepsCount:k=0,showFrigadeBranding:u=!1})=>{var de,te,be,De;let[B,x]=ao(),[F,N]=ao(new Date),T=zd(null),[m,w]=ao(document.querySelector(e[a].selector)),y=As(m,F),[P,O]=ao(),[I,D]=ao(!C),L=(te=(de=e[a])==null?void 0:de.props)!=null&&te.position?e[a].props.position:"absolute",_=((De=(be=e[a])==null?void 0:be.props)==null?void 0:De.zIndex)??90,H=(B==null?void 0:B.width)??Ns,X=(B==null?void 0:B.height)??Os,se=window.location.pathname.split("/").pop();Is(()=>{T.current&&x({width:T.current.clientWidth,height:T.current.clientHeight})},[a,F,L]),zo(()=>{C||D(!0)},[a]);let K=()=>{let j=document.querySelector(e[a].selector);if(!j){O(void 0),w(null);return}P&&P===JSON.stringify(j==null?void 0:j.getBoundingClientRect())||(w(j),N(new Date),j&&O(JSON.stringify(j.getBoundingClientRect())))};if(zo(()=>{let j=new MutationObserver(K);return j.observe(document.body,{subtree:!0,childList:!0}),()=>j.disconnect()},[K]),zo(()=>{let j=new MutationObserver(K);return j.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>j.disconnect()},[K]),zo(()=>{let j=setInterval(()=>{K()},10);return()=>clearInterval(j)},[K]),Is(()=>{setTimeout(()=>{K()},_d),K()},[a,se]),m===null||!p||y.height===0&&y.width===0&&L!=="fixed")return null;let V=i==="auto"?"right":i,q=Sr(y,V,H,s,L),J=y.right+H>(window.innerWidth||document.documentElement.clientWidth),Ce=y.bottom+Os>(window.innerHeight||document.documentElement.clientHeight);J&&i==="auto"&&(q=Sr(y,"left",H,s,L),V="left");let ve=()=>{let j=()=>{if(e[a].handlePrimaryButtonClick&&(e[a].handlePrimaryButtonClick(),D(!1),setTimeout(()=>{K()},30)),k===e.length-1)return o()},xe=()=>{e[a].handleSecondaryButtonClick&&(e[a].handleSecondaryButtonClick(),C&&!e[a].secondaryButtonUri&&D(!1))};return W.createElement(W.Fragment,null,b&&e.length>1&&W.createElement(_r,null,W.createElement(Hr,{className:l("tooltipStepCounter",d)},a+1," of ",e.length)),W.createElement(Wr,{showStepCount:b,className:l("tooltipCTAContainer",d)},e[a].secondaryButtonTitle&&W.createElement(ie,{title:e[a].secondaryButtonTitle,appearance:d,onClick:xe,size:"small",withMargin:!1,secondary:!0}),e[a].primaryButtonTitle&&W.createElement(ie,{title:e[a].primaryButtonTitle,appearance:d,onClick:j,withMargin:!1,size:"small"})))},ye=()=>W.createElement(W.Fragment,null,g&&W.createElement($r,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:l("tooltipClose",d)},W.createElement(Ae,null)),e[a].imageUri&&W.createElement(Mr,{dismissible:g,appearance:d,src:e[a].imageUri,className:l("tooltipImageContainer",d)}),e[a].videoUri&&!e[a].imageUri&&W.createElement(Ur,{dismissible:g,appearance:d,className:l("tooltipVideoContainer",d)},W.createElement(st,{appearance:d,videoUri:e[a].videoUri})),W.createElement(Te,{appearance:d,title:e[a].title,subtitle:e[a].subtitle,size:"small"}),W.createElement(zr,{className:l("tooltipFooter",d)},W.createElement(ve,null))),Q={...{default:j=>{var xe;if((xe=e[a])!=null&&xe.StepContent){let Vt=e[a].StepContent;return W.createElement("div",null,Vt)}return W.createElement(ye,null)}},...h},M=()=>{var j;return e?!((j=e[a])!=null&&j.type)||!Q[e[a].type]?Q.default(e[a]):Q[e[a].type]({stepData:e[a],primaryColor:n}):W.createElement(W.Fragment,null)};if(C&&e[a].complete===!0)return null;let $={top:(q==null?void 0:q.y)-_t,left:(V=="left"?y.x+s.x:(q==null?void 0:q.x)-_t)??0,cursor:C?"pointer":"default",position:L},Se=()=>{let xe=$.left+(V=="left"?-H:24);return Math.min(Math.max(xe,20),window.innerWidth-H-20)},me=()=>{if(L==="fixed")return $.top;let j=$.top+X,xe=20;return j>window.innerHeight-xe?$.top+-X:$.top},z=()=>{C&&(N(new Date),D(!I))};return W.createElement(Vd,null,W.createElement(jd,{style:$,zIndex:_,className:l("tourHighlightContainer",d)},r&&e[a].showHighlight!==!1&&W.createElement(W.Fragment,null,W.createElement(Hd,{style:{position:L},onClick:z,primaryColor:d.theme.colorPrimary,className:l("tourHighlightInnerCircle",d)}),W.createElement(Wd,{style:{position:"absolute"},onClick:z,primaryColor:d.theme.colorPrimary,className:l("tourHighlightOuterCircle",d)}))),W.createElement(Ls,{style:{...$,left:Se(),top:me()},zIndex:_+1,className:l("tooltipContainerWrapper",d)},I&&W.createElement(W.Fragment,null,W.createElement(uo,{ref:T,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:12,...c},appearance:d,className:l("tooltipContainer",d),maxWidth:Ns,zIndex:_+10},W.createElement(M,null)),u&&W.createElement(jr,{className:l("poweredByFrigadeTooltipRibbon",d),appearance:d,zIndex:_+10},W.createElement(fo,{appearance:d})))))},_o=Gd;import{Portal as Yd}from"react-portal";var Xd=({flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:r,showTooltipsSimultaneously:n=!1,onDismiss:s,dismissible:p,tooltipPosition:c="auto",showHighlightOnly:a=!1,dismissBehavior:h="complete-flow",onComplete:d,skipIfNotFound:g=!1,...C})=>{let{getFlow:b,getFlowSteps:k,isLoading:u,targetingLogicShouldHideFlow:B,markStepCompleted:x,markStepStarted:F,markFlowCompleted:N,updateCustomVariables:T,getCurrentStepIndex:m,getStepStatus:w,isStepBlocked:y,getFlowStatus:P,getNumberOfStepsCompleted:O}=ee(),{isLoadingUserFlowStateData:I}=Ee(),{primaryCTAClickSideEffects:D,secondaryCTAClickSideEffects:L}=ae(),{hasOpenModals:_}=Be(),H=m(e),{openFlowStates:X}=qd(G),{mergeAppearanceWithDefault:se}=oe();if(o=se(o),Kd(()=>{T(t)},[t,u]),I)return null;let K=b(e);if(!K||B(K)||P(e)==R||_())return null;let V=k(e);if(Object.keys(X).length>0){let M=Object.keys(X).find($=>X[$]===!0);if(M!==void 0&&M!==e)return Wt.createElement(Wt.Fragment,null)}async function q(M){if(await x(e,M.id),V.map($=>w(e,$.id)).every($=>$===Me)){await N(e);return}if(!a&&H+1<V.length){if(y(e,V[H+1].id))return;await F(e,V[H+1].id)}}function J(M,$,Se){let me=H+1<V.length?V[H+1]:null;r&&r(M,H,$,me),i&&i(M,Se,me)}function Ce(){return V.map(M=>({...M,handleSecondaryButtonClick:async()=>{L(M),M.skippable===!0&&await x(e,M.id,{skipped:!0}),J(M,"secondary",H)},handlePrimaryButtonClick:async()=>{(!M.completionCriteria&&(M.autoMarkCompleted||M.autoMarkCompleted===void 0)||M.completionCriteria&&M.autoMarkCompleted===!0)&&await q(M),J(M,"primary",H),D(M)}}))}async function ve(M){s&&s(),h==="complete-flow"?await N(e):await x(e,M.id)}function ye(){d&&d()}let re=!document.querySelector(V[H].selector);function Q(){let M=V.findIndex($=>!!document.querySelector($.selector));return V.map(($,Se)=>re&&!n&&Se!==M&&g?null:Wt.createElement(_o,{key:$.id,appearance:o,steps:Ce(),selectedStep:Se,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>ve($),tooltipPosition:c,showHighlightOnly:a,completedStepsCount:O(e),onComplete:ye,...C}))}return Wt.createElement(Yd,null,Wt.createElement(ne,{appearance:o}),n||re&&g?Q():Wt.createElement(_o,{appearance:o,steps:Ce(),selectedStep:H,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>ve(V[H]),tooltipPosition:c,completedStepsCount:O(e),showHighlightOnly:a,onComplete:ye,...C}))};import ke,{useEffect as Jd,useRef as Qd,useState as Zd}from"react";import{Portal as Rd}from"react-portal";import Tt from"styled-components";var Ds=Tt.button`
|
|
1354
1354
|
${e=>v(e)} {
|
|
1355
1355
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1356
1356
|
|
|
@@ -1438,7 +1438,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
1438
1438
|
font-size: 14px;
|
|
1439
1439
|
|
|
1440
1440
|
padding: 8px 12px;
|
|
1441
|
-
`;import{AnimatePresence as qs,motion as Ks}from"framer-motion";import Hs from"react";var Vs=({style:e,className:t})=>Hs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Hs.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 js from"react";var Gs=({style:e,className:t})=>js.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"},js.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 ec=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:r="inline",title:n="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:c,markStepCompleted:a,getStepStatus:h,getNumberOfStepsCompleted:d,isLoading:g,targetingLogicShouldHideFlow:C}=
|
|
1441
|
+
`;import{AnimatePresence as qs,motion as Ks}from"framer-motion";import Hs from"react";var Vs=({style:e,className:t})=>Hs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Hs.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 js from"react";var Gs=({style:e,className:t})=>js.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"},js.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 ec=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:r="inline",title:n="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:c,markStepCompleted:a,getStepStatus:h,getNumberOfStepsCompleted:d,isLoading:g,targetingLogicShouldHideFlow:C}=ee(),{primaryCTAClickSideEffects:b}=ae(),k=Qd(null),[u,B]=Zd(!1),{mergeAppearanceWithDefault:x}=oe();s=x(s),Jd(()=>(document.addEventListener("click",F,!1),()=>{document.removeEventListener("click",F,!1)}),[]);let F=y=>{k.current&&!k.current.contains(y.target)&&B(!1)};if(g)return null;let N=p(e);if(!N||C(N))return null;let T=c(e);if(!T||!i)return null;function m(y,P){!y.completionCriteria&&(y.autoMarkCompleted||y.autoMarkCompleted===void 0)&&a(e,y.id),b(y),o&&o(y,P),B(!1)}function w(){return u&&ke.createElement(_s,{className:l("floatingWidgetMenu",s),as:Ks.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:r},T.map((y,P)=>ke.createElement(Ws,{className:l("floatingWidgetMenuItem",s),key:P,onClick:()=>m(y,P)},y.title)))}return r=="inline"?ke.createElement("span",{ref:k},ke.createElement(Ds,{style:t,onClick:()=>{B(!u)},className:l("supportButton",s)},ke.createElement(Ms,{className:l("supportIconContainer",s)},ke.createElement(Gs,{className:l("supportIcon",s),style:{width:"18px",height:"18px"}})),ke.createElement($s,{className:l("supportButtonTitle",s)},n)),ke.createElement(qs,null,ke.createElement(w,null))):ke.createElement(Rd,null,ke.createElement(Us,{style:t,ref:k},ke.createElement(qs,null,ke.createElement(w,null)),ke.createElement(zs,{onClick:()=>{B(!u)},as:Ks.button,whileHover:{scale:1.1},className:l("floatingWidgetButton",s)},ke.createElement(Vs,{className:l("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import je,{useEffect as tc}from"react";import Wo from"styled-components";var Ys=Wo.div`
|
|
1442
1442
|
${e=>v(e)} {
|
|
1443
1443
|
display: flex;
|
|
1444
1444
|
flex-direction: column;
|
|
@@ -1453,17 +1453,17 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
1453
1453
|
border-radius: 12px;
|
|
1454
1454
|
position: relative;
|
|
1455
1455
|
}
|
|
1456
|
-
`,Xs=
|
|
1456
|
+
`,Xs=Wo.div`
|
|
1457
1457
|
display: flex;
|
|
1458
1458
|
flex-direction: column;
|
|
1459
1459
|
flex: 1;
|
|
1460
|
-
`,Js=
|
|
1460
|
+
`,Js=Wo.div`
|
|
1461
1461
|
display: flex;
|
|
1462
1462
|
flex-direction: column;
|
|
1463
1463
|
justify-content: center;
|
|
1464
1464
|
align-items: flex-start;
|
|
1465
1465
|
margin-top: 16px;
|
|
1466
|
-
`,Qs=
|
|
1466
|
+
`,Qs=Wo.div`
|
|
1467
1467
|
${e=>v(e)} {
|
|
1468
1468
|
position: absolute;
|
|
1469
1469
|
top: 16px;
|
|
@@ -1474,7 +1474,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
1474
1474
|
opacity: 0.8;
|
|
1475
1475
|
}
|
|
1476
1476
|
}
|
|
1477
|
-
`;var oc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p})=>{let{getFlow:c,markFlowCompleted:a,markStepCompleted:h,isLoading:d,targetingLogicShouldHideFlow:g,updateCustomVariables:C,getFlowSteps:b,getFlowStatus:k,getCurrentStepIndex:u}=
|
|
1477
|
+
`;var oc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p})=>{let{getFlow:c,markFlowCompleted:a,markStepCompleted:h,isLoading:d,targetingLogicShouldHideFlow:g,updateCustomVariables:C,getFlowSteps:b,getFlowStatus:k,getCurrentStepIndex:u}=ee(),{primaryCTAClickSideEffects:B}=ae(),{mergeAppearanceWithDefault:x}=oe();if(r=x(r),tc(()=>{C(o)},[o,d]),d)return null;let F=c(e);if(!F||g(F)||k(e)===R)return null;let T=b(e)[u(e)];return je.createElement(je.Fragment,null,je.createElement(ne,{appearance:r}),je.createElement(Ys,{appearance:r,className:we(l("embeddedTipContainer",r),n),style:s},(p===!0||T.dismissible)&&je.createElement(Qs,{onClick:async()=>{await a(e),t&&t()},className:l("embeddedTipDismissButton",r)},je.createElement(Ae,null)),je.createElement(Xs,null,je.createElement(Te,{size:"small",appearance:r,title:T.title,subtitle:T.subtitle})),T.primaryButtonTitle&&je.createElement(Js,{className:l("embeddedTipCallToActionContainer",r)},je.createElement(ie,{classPrefix:"embeddedTip",title:T.primaryButtonTitle,appearance:r,withMargin:!1,size:"small",type:"inline",onClick:async()=>{T.handlePrimaryButtonClick(),B(T),!(i&&i(T,u(e),"primary")===!1)&&(await h(e,T.id),await a(e))}}))))};import he,{useEffect as rc}from"react";import Ht from"styled-components";var Zs=Ht.div`
|
|
1478
1478
|
// use the :not annotation
|
|
1479
1479
|
${e=>v(e)} {
|
|
1480
1480
|
display: flex;
|
|
@@ -1519,7 +1519,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
1519
1519
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1520
1520
|
align-items: flex-end;
|
|
1521
1521
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1522
|
-
`;import ol from"react";var rl=({style:e,className:t})=>ol.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"},ol.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 ic=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:r,onButtonClick:n,appearance:s,type:p="full-width",icon:c})=>{let{getFlow:a,markFlowCompleted:h,isLoading:d,targetingLogicShouldHideFlow:g,updateCustomVariables:C,getFlowMetadata:b,getFlowStatus:k,getFlowSteps:u,getCurrentStepIndex:B}=
|
|
1522
|
+
`;import ol from"react";var rl=({style:e,className:t})=>ol.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"},ol.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 ic=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:r,onButtonClick:n,appearance:s,type:p="full-width",icon:c})=>{let{getFlow:a,markFlowCompleted:h,isLoading:d,targetingLogicShouldHideFlow:g,updateCustomVariables:C,getFlowMetadata:b,getFlowStatus:k,getFlowSteps:u,getCurrentStepIndex:B}=ee(),{primaryCTAClickSideEffects:x}=ae(),{mergeAppearanceWithDefault:F}=oe();if(s=F(s),rc(()=>{C(r)},[r,d]),d)return null;let N=a(e);if(!N||g(N)||k(e)===R)return null;let T=u(e),m=T.length>0?T[B(e)]:b(e);return m!=null&&m.title&&(t=m.title),m!=null&&m.subtitle&&(o=m.subtitle),he.createElement(he.Fragment,null,he.createElement(ne,{appearance:s}),he.createElement(Zs,{type:p,appearance:s,className:l("bannerContainer",s)},p!="square"&&he.createElement(Rs,{className:l("bannerIconContainer",s)},c||he.createElement(rl,null)),p==="square"&&m.dismissible&&he.createElement(wr,{type:p,className:l("bannerDismissButtonContainer",s)},he.createElement(br,{type:p,onClick:async()=>{await h(e),i&&i()},className:l("bannerDismissButton",s)},he.createElement(Ae,null))),he.createElement(el,{type:p},he.createElement(Te,{appearance:s,title:t,subtitle:o,classPrefix:"banner"})),he.createElement(tl,{type:p,className:l("bannerCallToActionContainer",s)},he.createElement(ie,{title:(m==null?void 0:m.primaryButtonTitle)??"Get started",appearance:s,onClick:()=>{x(m),n&&n(m,0,"primary")},classPrefix:"banner"})),p!=="square"&&m.dismissible&&he.createElement(wr,{type:p,className:l("bannerDismissButtonContainer",s)},he.createElement(br,{type:p,onClick:async()=>{await h(e),i&&i()},className:l("bannerDismissButton",s)},he.createElement(Ae,null)))))};import Y,{useEffect as nc}from"react";import{Portal as sc}from"react-portal";import Re from"styled-components";var il=Re.div`
|
|
1523
1523
|
${e=>v(e)} {
|
|
1524
1524
|
display: flex;
|
|
1525
1525
|
flex-direction: column;
|
|
@@ -1606,5 +1606,5 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Gt}${r}.${Gt}${r} { ${Object.entries(n).map
|
|
|
1606
1606
|
opacity: 0.8;
|
|
1607
1607
|
}
|
|
1608
1608
|
}
|
|
1609
|
-
`;var lc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,type:p="modal"})=>{let{getFlow:c,markFlowCompleted:a,markStepCompleted:h,getNumberOfStepsCompleted:d,isLoading:g,targetingLogicShouldHideFlow:C,updateCustomVariables:b,getFlowSteps:k,getFlowStatus:u,getCurrentStepIndex:B}=
|
|
1609
|
+
`;var lc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,type:p="modal"})=>{let{getFlow:c,markFlowCompleted:a,markStepCompleted:h,getNumberOfStepsCompleted:d,isLoading:g,targetingLogicShouldHideFlow:C,updateCustomVariables:b,getFlowSteps:k,getFlowStatus:u,getCurrentStepIndex:B}=ee(),{primaryCTAClickSideEffects:x}=ae(),{mergeAppearanceWithDefault:F}=oe(),[N,T]=Y.useState(null),[m,w]=Y.useState(""),{hasOpenModals:y,setKeepCompletedFlowOpenDuringSession:P,shouldKeepCompletedFlowOpenDuringSession:O}=Be();if(r=F(r),nc(()=>{b(o)},[o,g]),g)return null;let I=c(e);if(!I||C(I)||u(e)===R||d(e)===1&&!O(e)||y())return null;let L=k(e)[B(e)];function _(){return Y.createElement(Y.Fragment,null,Y.createElement(kr,null,Y.createElement(Te,{size:"large",appearance:r,title:L.title,subtitle:L.subtitle})),Y.createElement(Tr,{className:l("npsNumberButtonContainer",r),appearance:r},Array.from(Array(10).keys()).map(se=>Y.createElement(nl,{className:l("npsNumberButton",r),selected:N===se+1,key:se,onClick:async()=>{P(e),T(se+1),await h(e,L.id,{score:se+1})},appearance:r},se+1))),Y.createElement(sl,{appearance:r},Y.createElement(Fr,{appearance:r},"Not likely at all"),Y.createElement(Fr,{appearance:r},"Extremely likely")))}function H(){return Y.createElement(Y.Fragment,null,Y.createElement(kr,null,Y.createElement(Te,{appearance:r,title:"Why did you choose this score?",size:"large"})),Y.createElement(ll,{appearance:r,value:m,onChange:se=>{w(se.target.value)},placeHolder:"Add your optional fedback here..."}),Y.createElement(Tr,{appearance:r,className:l("npsNumberButtonContainer",r)},Y.createElement(ie,{size:"large",withMargin:!1,onClick:async()=>{await a(e),i&&i(L,1,"primary")},appearance:r,title:L.secondaryButtonTitle||"Skip",secondary:!0}),Y.createElement(ie,{size:"large",withMargin:!1,onClick:async()=>{await h(e,L.id,{feedbackText:m}),await a(e),i&&i(L,1,"primary")},appearance:r,title:L.primaryButtonTitle||"Submit"})))}function X(){return Y.createElement(Y.Fragment,null,Y.createElement(ne,{appearance:r}),Y.createElement(il,{appearance:r,className:we(l("npsSurveyContainer",r),n),style:s,type:p},Y.createElement(al,{onClick:async()=>{await a(e),t&&t()},className:l("npsSurveyDismissButton",r)},Y.createElement(Ae,null)),d(e)==0&&_(),d(e)==1&&H()))}return p==="inline"?X():Y.createElement(sc,null,X())};import*as Ho from"react";import pl from"react";var dl=({as:e="span",children:t,variant:o="Body1",...i})=>pl.createElement(Hi,{color:"neutral.foreground",fontFamily:"default",forwardedAs:e,variant:o,...i},t),ac=Object.fromEntries(Object.keys(Eo).map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=i=>pl.createElement(dl,{as:t,...i,variant:e},i.children);return o.displayName=`Text.${e}`,[e,o]})),Pr=Object.assign(dl,ac);var cl=({as:e="button",className:t,size:o="md",title:i,variant:r="Primary",...n})=>{var s;return Ho.createElement(Wi,{className:`fr-button-${r.toLowerCase()}${t?` ${t}`:""}`,forwardedAs:e,variant:r,size:o,borderRadius:"md",...n},Ho.createElement(Pr,{color:(s=ro[r])==null?void 0:s.color,fontWeight:"semibold"},i))},pc=Object.fromEntries(Object.keys(ro).map(e=>{let t=o=>Ho.createElement(cl,{...o,variant:e});return t.displayName=`Button.${e}`,[e,t]})),dc=Object.assign(cl,pc);export{oo as Box,dc as Button,Ke as CheckBox,rt as FormLabel,Zo as FormTextField,ic as FrigadeBanner,yr as FrigadeChecklist,qe as FrigadeDefaultAppearance,oc as FrigadeEmbeddedTip,Ni as FrigadeForm,Dd as FrigadeGuide,Ad as FrigadeHeroChecklist,lc as FrigadeNPSSurvey,Od as FrigadeProgressBadge,Ip as FrigadeProvider,ec as FrigadeSupportWidget,Xd as FrigadeTour,Et as ProgressRing,Pr as Text,dr as tokens,Be as useFlowOpens,jt as useFlowResponses,ee as useFlows,lr as useOrganization,Gt as useUser,Ee as useUserFlowStates};
|
|
1610
1610
|
//# sourceMappingURL=index.mjs.map
|