@frigade/react 1.33.1 → 1.33.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +2 -1
- package/lib/index.js +190 -190
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +184 -184
- 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 ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import{ThemeProvider as Pp}from"styled-components";import xt,{useContext as tp,useEffect as Fo,useState as sr}from"react";import{useCallback as ut,useContext as Tl,useEffect as Fl}from"react";import _o,{useMemo as Pr}from"react";var kr="1.33.1 ";var Be="NOT_STARTED_STEP",R="COMPLETED_FLOW",lo="ABORTED_FLOW",mt="STARTED_FLOW",Ie="NOT_STARTED_FLOW",Ne="COMPLETED_STEP",ao="STARTED_STEP";function Me(){let{publicApiKey:e,userId:t,apiUrl:o}=_o.useContext(G);return{config:Pr(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":kr,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:Pr(()=>`${o}/v1/public/`,[o])}}var cl="frigade-last-call-at-",ml="frigade-last-call-data-";function Ft(){let{shouldGracefullyDegrade:e,readonly:t}=_o.useContext(G);return async(o,i)=>{if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Tt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Tt();let r=cl+o,n=ml+o;if(window&&window.localStorage&&i&&i.body&&i.method==="POST"){let p=window.localStorage.getItem(r),d=window.localStorage.getItem(n);if(p&&d&&d==i.body){let a=new Date(p);if(new Date().getTime()-a.getTime()<1e3)return Tt()}window.localStorage.setItem(r,new Date().toISOString()),window.localStorage.setItem(n,i.body)}let s;try{s=await fetch(o,i)}catch(p){return Tt(p)}return s?s.ok?s:Tt(s.statusText):Tt()}}function Tt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function kt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=_o.useContext(G);function o(){if(t){console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize");return}e||console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider")}return{verifySDKInitiated:o}}import{useContext as yl,useState as vr}from"react";import{useContext as fl,useEffect as gl,useState as xl}from"react";import hl from"swr";import{useContext as ul}from"react";function Fe(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:r}=ul(G);function n(c,f=!1){return e[c]??f}function s(c,f){t(S=>({...S,[c]:f}))}function p(c){t(f=>{let{[c]:S,...T}=f;return{...T}})}function d(c){r.includes(c)||i(f=>[...f,c])}function a(c){return r.includes(c)}function h(c){return Object.entries(e).some(([f,S])=>S&&f!=c)||o}return{getOpenFlowState:n,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:h,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:a}}import Cl from"swr/immutable";var Sl="unknown";function Ee(){let{config:e,apiUrl:t}=Me(),{publicApiKey:o,userId:i,organizationId:r,flows:n,setShouldGracefullyDegrade:s,readonly:p}=fl(G),{resetOpenFlowState:d}=Fe(),[a,h]=xl(!1),c={data:n.map(C=>({flowId:C.id,flowState:R,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},f=C=>fetch(C,e).then(B=>{if(B.ok)return B.json();throw new Error("Failed to fetch user flow states")}).catch(B=>(console.log(`Error fetching ${C}: ${B}. Will gracefully degrade and hide Frigade`),s(!0),c)),S=o&&n&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,{data:T,isLoading:P,mutate:g,error:v}=p?Cl(S,f):hl(S,f,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),x=T==null?void 0:T.data;gl(()=>{!a&&!P&&x&&h(!0)},[x,a,P]);async function F(C){if(x&&!p){let B=x.find(O=>O.flowId===C);B&&B.flowState!==R&&(B.flowState=R),await g(Promise.resolve({...T,data:x}),{optimisticData:{...T,data:x},revalidate:!1,rollbackOnError:!1})}}async function I(C,B,O){if(x){let M=x.find(N=>N.flowId===C);M&&(M.stepStates[B]=O,M.flowState=mt),await g(Promise.resolve({...T,data:x}),{optimisticData:{...T,data:x},revalidate:!1,rollbackOnError:!1})}}async function y(C,B,O){if(x){let M=x.find(N=>N.flowId===C);M&&(M.lastStepId=B,M.stepStates[B]=O,M.flowState=mt),await g({...T,data:x},{optimisticData:{...T,data:x},revalidate:!1,rollbackOnError:!1})}}async function m(C){if(x){let B=x.find(O=>O.flowId===C);B&&B.flowState!==Ie&&(B.flowState=Ie,B.lastStepId=Sl,Object.keys(B.stepStates).forEach(O=>{B.stepStates[O].actionType=Be,B.stepStates[O].createdAt=new Date().toISOString()}),await g({...T,data:x},{optimisticData:{...T,data:x},revalidate:!1,rollbackOnError:!1}),d(C))}}async function w(C,B){if(x){let O=x.find(M=>M.flowId===C);O&&O.stepStates[B]!==Be&&(O.stepStates[B]=Be),await g({...T,data:x},{optimisticData:{...T,data:x},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:x,isLoadingUserFlowStateData:!a,mutateUserFlowState:g,optimisticallyMarkFlowCompleted:F,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:I,optimisticallyMarkStepNotStarted:w,optimisticallyMarkStepStarted:y,error:v}}function Ht(){let{config:e,apiUrl:t}=Me(),{userFlowStatesData:o,mutateUserFlowState:i}=Ee(),{failedFlowResponses:r,setFailedFlowResponses:n,flowResponses:s,setFlowResponses:p}=yl(G),[d,a]=vr(new Set),[h,c]=vr(new Set),f=Ft();function S(g){let v=JSON.stringify(g);if(d.has(v))return null;d.add(v),a(d),h.add(g),c(h);let x=s==null?void 0:s.find(F=>F.flowSlug===g.flowSlug&&F.stepId===g.stepId&&F.actionType===g.actionType&&F.createdAt===g.createdAt);return f(`${t}flowResponses`,{...e,method:"POST",body:v}).then(F=>{F.status!==200&&F.status!==201?(console.log("Failed to send flow response for step "+g.stepId+". Will retry again later."),n([...r,g])):x||p(I=>[...I??[],g])})}async function T(g){g.foreignUserId&&(g.actionType===mt||g.actionType===Ie?await S(g):g.actionType===R?await S(g):g.actionType===ao?await S(g):g.actionType===Ne?await S(g):g.actionType===lo?await S(g):g.actionType===Be&&await S(g))}function P(){let g=[];return o==null||o.forEach(v=>{if(v&&v.stepStates&&Object.keys(v.stepStates).length!==0)for(let x in v.stepStates){let F=v.stepStates[x];g.push({foreignUserId:v.foreignUserId,flowSlug:v.flowId,stepId:F.stepId,actionType:F.actionType,data:{},createdAt:new Date(F.createdAt),blocked:F.blocked,hidden:F.hidden})}}),[...g,...s]}return{addResponse:T,setFlowResponses:p,getFlowResponses:P}}import kl from"swr";var bl=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Br=e=>{let t=bl.exec(e);if(t===null)return null;let o=null;return t.forEach((i,r)=>{let n=wl(i,"'","");n.startsWith("flow_")&&(o=n)}),o},wl=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function ee(){let{config:e,apiUrl:t}=Me(),{flows:o,setFlows:i,userId:r,publicApiKey:n,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:a,setFlowResponses:h,setShouldGracefullyDegrade:c,readonly:f}=Tl(G),S={data:[]},{verifySDKInitiated:T}=kt(),{addResponse:P,getFlowResponses:g}=Ht(),v=u=>fetch(u,e).then(b=>b.ok?b.json():(console.log(`Error fetching ${u} (${b.status}): ${b.statusText}. .Will gracefully degrade and hide Frigade`),c(!0),S)).catch(b=>(console.log(`Error fetching ${u}: ${b}. Will gracefully degrade and hide Frigade`),c(!0),S)),{userFlowStatesData:x,isLoadingUserFlowStateData:F,optimisticallyMarkFlowCompleted:I,optimisticallyMarkFlowNotStarted:y,optimisticallyMarkStepCompleted:m,optimisticallyMarkStepNotStarted:w,optimisticallyMarkStepStarted:C}=Ee(),{data:B,error:O,isLoading:M}=kl(n?`${t}flows${f?"?readonly=true":""}`:null,v,{keepPreviousData:!0});Fl(()=>{if(O){console.error(O);return}B&&B.data&&i(B.data)},[B,O]);function N(u){if(M)return null;let b=o.find(E=>E.slug===u);return!b&&o.length>0&&!F&&!M?(console.log(`Flow with slug ${u} not found`),null):(b==null?void 0:b.active)===!1?null:b}function L(u){var A;if(!N(u))return[];let b=N(u).data;return b?(b=H(b),(((A=JSON.parse(b))==null?void 0:A.data)??[]).map(Z=>{let ct=je(Z);return{handleSecondaryButtonClick:()=>{Z.skippable===!0&&ge(u,Z.id,{skipped:!0})},...Z,complete:pe(u,Z.id)===Ne||ct>=1,blocked:_(u,Z.id),hidden:D(u,Z.id),handlePrimaryButtonClick:()=>{(!Z.completionCriteria&&(Z.autoMarkCompleted||Z.autoMarkCompleted===void 0)||Z.completionCriteria&&Z.autoMarkCompleted===!0)&&ge(u,Z.id)},progress:ct}}).filter(Z=>Z.hidden!==!0)):[]}function H(u){return u.replaceAll(/\${(.*?)}/g,(b,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 $(u){if(!N(u))return[];let b=N(u).data;return b?(b=H(b),JSON.parse(b)??{}):[]}function J(u,b){p(E=>({...E,[u]:b}))}function Q(u){!F&&!M&&u&&JSON.stringify(s)!=JSON.stringify({...s,...u})&&Object.keys(u).forEach(b=>{J(b,u[b])})}let Y=ut(async(u,b,E)=>{T();let A={foreignUserId:r,flowSlug:u,stepId:b,actionType:ao,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};K(A)&&(await C(u,b,A),P(A))},[r,x]),V=ut(async(u,b,E)=>{T();let A={foreignUserId:r,flowSlug:u,stepId:b,actionType:Be,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};K(A)&&(await w(u,b),P(A))},[r,x]),ge=ut(async(u,b,E)=>{T();let A={foreignUserId:r,flowSlug:u,stepId:b,actionType:Ne,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};K(A)&&(await m(u,b,A),P(A))},[r,x]),oe=ut(async(u,b)=>{if(T(),De(u)===Ie)return;let E={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:Ie,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};await y(u),K(E)&&P(E)},[r,x]),q=ut(async(u,b)=>{T();let E={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:mt,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};K(E)&&P(E)},[r,x]),xe=ut(async(u,b)=>{T();let E={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:R,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};K(E)&&(await I(u),P(E))},[r,x]),Te=ut(async(u,b)=>{T();let E={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:lo,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};K(E)&&(await I(u),P(E))},[r,x]);function K(u){var b;if(!x&&u.actionType===Be)return!1;if(x){let E=x.find(A=>A.flowId===u.flowSlug);if(u.actionType===Be&&(!(E!=null&&E.stepStates[u.stepId])||E.stepStates[u.stepId].actionType===Be)||E&&((b=E.stepStates[u.stepId])==null?void 0:b.actionType)===u.actionType||E&&E.flowState===R&&u.actionType===R)return!1}return!0}function pe(u,b){let E=re(u,b);return F?null:E?E.actionType:Be}function _(u,b){let E=re(u,b);return E?E.blocked:!1}function D(u,b){let E=re(u,b);return E?E.hidden:!1}function re(u,b){if(F)return null;let E=x==null?void 0:x.find(A=>A.flowId===u);return!E||!E.stepStates[b]?null:E.stepStates[b]??null}function j(u){var E;if(F||!x)return null;if(De(u)===Ie)return L(u)[0]??null;let b=(E=x.find(A=>A.flowId===u))==null?void 0:E.lastStepId;return b?L(u).find(A=>A.id===b):null}function ie(u){let b=j(u);if(!b)return 0;let E=L(u).findIndex(A=>A.id===b.id)??0;return pe(u,b.id)===Ne&&E<L(u).length-1?E+1:E}function je(u){if(!u.completionCriteria)return;let b=Br(u.completionCriteria);if(b===null)return;let E=dt(b),A=W(b);return A===0?void 0:E/A}function De(u){let b=x==null?void 0:x.find(E=>E.flowId===u);return b?b.flowState:null}function dt(u){let b=L(u);return b.length===0?0:b.filter(A=>pe(u,A.id)===Ne).length}function W(u){return L(u).length}function ve(u){return JSON.parse(o.find(b=>b.slug===u).data)}function $e(u){if(f)return!1;if(F)return!0;if(u!=null&&u.targetingLogic&&x){let b=x.find(E=>E.flowId===u.slug);if(b)return b.shouldTrigger===!1}return!!(u!=null&&u.targetingLogic&&r&&r.startsWith("guest_"))}function zo(u){return!$e(N(u))}return{getFlow:N,getFlowData:ve,isLoading:F||M,getStepStatus:pe,getFlowSteps:L,getCurrentStepIndex:ie,markStepStarted:Y,markStepCompleted:ge,markFlowNotStarted:oe,markFlowStarted:q,markFlowCompleted:xe,markFlowAborted:Te,markStepNotStarted:V,getFlowStatus:De,getNumberOfStepsCompleted:dt,getNumberOfSteps:W,targetingLogicShouldHideFlow:$e,setCustomVariable:J,updateCustomVariables:Q,customVariables:s,getStepOptionalProgress:je,getFlowMetadata:$,isStepBlocked:_,isStepHidden:D,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:a,isFlowAvailableToUser:zo}}import{useCallback as Er,useContext as Pl,useEffect as vl}from"react";var Pt="guest_";function Vt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=Pl(G),{config:n,apiUrl:s}=Me(),{mutateUserFlowState:p}=Ee(),d=Ft(),{verifySDKInitiated:a}=kt();vl(()=>{if(e&&!t){if(e.startsWith(Pt))return;let f=`frigade-user-registered-${e}`;localStorage.getItem(f)||(d(`${s}users`,{...n,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(f,"true"))}},[e,r,t]);let h=Er(async f=>{a();let S={foreignId:e,properties:f};await d(`${s}users`,{...n,method:"POST",body:JSON.stringify(S)}),i(T=>({...T,...f})),p()},[e,n,r,p]),c=Er(async(f,S)=>{a();let P={foreignId:e,events:[{event:f,properties:S}]};await d(`${s}users`,{...n,method:"POST",body:JSON.stringify(P)}),p()},[e,n,p]);return{userId:e,setUserId:o,addPropertiesToUser:h,trackEventForUser:c}}import{v4 as op}from"uuid";import ze,{useEffect as Qa,useState as Za}from"react";import Le,{useEffect as Ol}from"react";import mo from"styled-components";import Bl from"react";import El from"styled-components";var Ar="fr-",jt="cfr-";function l(e,t){let o=`${Ar}${e}`;if(!t)return o;if(t.styleOverrides&&t.styleOverrides[e]){if(typeof t.styleOverrides[e]=="string")return o+" "+t.styleOverrides[e];if(typeof t.styleOverrides[e]=="object")return o+" "+jt+e}return o}function k(e){if(!e.className||e.className.indexOf(jt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(Ar)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Wo(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=>`${Wo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Ce(...e){return e.filter(Boolean).join(" ")}function Gt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Al=El.div`
|
|
2
|
+
import ht,{createContext as Ap,useEffect as vo,useState as Ae}from"react";import{ThemeProvider as Ip}from"styled-components";import xt,{useContext as rp,useEffect as ko,useState as sr}from"react";import{useCallback as ut,useContext as kl,useEffect as Pl}from"react";import _o,{useMemo as Pr}from"react";var kr="1.33.3 ";var Be="NOT_STARTED_STEP",Z="COMPLETED_FLOW",ao="ABORTED_FLOW",mt="STARTED_FLOW",Ie="NOT_STARTED_FLOW",Ne="COMPLETED_STEP",po="STARTED_STEP";function Me(){let{publicApiKey:e,userId:t,apiUrl:o}=_o.useContext(j);return{config:Pr(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":kr,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:Pr(()=>`${o}/v1/public/`,[o])}}var ul="frigade-last-call-at-",fl="frigade-last-call-data-";function Ft(){let{shouldGracefullyDegrade:e,readonly:t}=_o.useContext(j);return async(o,i)=>{if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Tt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Tt();let r=ul+o,n=fl+o;if(window&&window.localStorage&&i&&i.body&&i.method==="POST"){let p=window.localStorage.getItem(r),d=window.localStorage.getItem(n);if(p&&d&&d==i.body){let a=new Date(p);if(new Date().getTime()-a.getTime()<1e3)return Tt()}window.localStorage.setItem(r,new Date().toISOString()),window.localStorage.setItem(n,i.body)}let s;try{s=await fetch(o,i)}catch(p){return Tt(p)}return s?s.ok?s:Tt(s.statusText):Tt()}}function Tt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function kt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=_o.useContext(j);function o(){if(t){console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize");return}e||console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider")}return{verifySDKInitiated:o}}import{useContext as wl,useState as vr}from"react";import{useContext as xl,useEffect as hl,useState as Cl}from"react";import yl from"swr";import{useContext as gl}from"react";function Fe(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:r}=gl(j);function n(c,f=!1){return e[c]??f}function s(c,f){t(y=>({...y,[c]:f}))}function p(c){t(f=>{let{[c]:y,...T}=f;return{...T}})}function d(c){r.includes(c)||i(f=>[...f,c])}function a(c){return r.includes(c)}function h(c){return Object.entries(e).some(([f,y])=>y&&f!=c)||o}return{getOpenFlowState:n,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:h,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:a}}import Sl from"swr/immutable";var bl="unknown";function Ee(){let{config:e,apiUrl:t}=Me(),{publicApiKey:o,userId:i,organizationId:r,flows:n,setShouldGracefullyDegrade:s,readonly:p}=xl(j),{resetOpenFlowState:d}=Fe(),[a,h]=Cl(!1),c={data:n.map(C=>({flowId:C.id,flowState:Z,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},f=C=>fetch(C,e).then(B=>{if(B.ok)return B.json();throw new Error("Failed to fetch user flow states")}).catch(B=>(console.log(`Error fetching ${C}: ${B}. Will gracefully degrade and hide Frigade`),s(!0),c)),y=o&&n&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,{data:T,isLoading:P,mutate:g,error:v}=p?Sl(y,f):yl(y,f,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),x=T==null?void 0:T.data;hl(()=>{!a&&!P&&x&&h(!0)},[x,a,P]);async function F(C){if(x&&!p){let B=x.find(L=>L.flowId===C);B&&B.flowState!==Z&&(B.flowState=Z),await g(Promise.resolve({...T,data:x}),{optimisticData:{...T,data:x},revalidate:!1,rollbackOnError:!1})}}async function I(C,B,L){if(x){let M=x.find(N=>N.flowId===C);M&&(M.stepStates[B]=L,M.flowState=mt),await g(Promise.resolve({...T,data:x}),{optimisticData:{...T,data:x},revalidate:!1,rollbackOnError:!1})}}async function S(C,B,L){if(x){let M=x.find(N=>N.flowId===C);M&&(M.lastStepId=B,M.stepStates[B]=L,M.flowState=mt),await g({...T,data:x},{optimisticData:{...T,data:x},revalidate:!1,rollbackOnError:!1})}}async function m(C){if(x){let B=x.find(L=>L.flowId===C);B&&B.flowState!==Ie&&(B.flowState=Ie,B.lastStepId=bl,Object.keys(B.stepStates).forEach(L=>{B.stepStates[L].actionType=Be,B.stepStates[L].createdAt=new Date().toISOString()}),await g({...T,data:x},{optimisticData:{...T,data:x},revalidate:!1,rollbackOnError:!1}),d(C))}}async function w(C,B){if(x){let L=x.find(M=>M.flowId===C);L&&L.stepStates[B]!==Be&&(L.stepStates[B]=Be),await g({...T,data:x},{optimisticData:{...T,data:x},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:x,isLoadingUserFlowStateData:!a,mutateUserFlowState:g,optimisticallyMarkFlowCompleted:F,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:I,optimisticallyMarkStepNotStarted:w,optimisticallyMarkStepStarted:S,error:v}}function Ht(){let{config:e,apiUrl:t}=Me(),{userFlowStatesData:o,mutateUserFlowState:i}=Ee(),{failedFlowResponses:r,setFailedFlowResponses:n,flowResponses:s,setFlowResponses:p}=wl(j),[d,a]=vr(new Set),[h,c]=vr(new Set),f=Ft();function y(g){let v=JSON.stringify(g);if(d.has(v))return null;d.add(v),a(d),h.add(g),c(h);let x=s==null?void 0:s.find(F=>F.flowSlug===g.flowSlug&&F.stepId===g.stepId&&F.actionType===g.actionType&&F.createdAt===g.createdAt);return f(`${t}flowResponses`,{...e,method:"POST",body:v}).then(F=>{F.status!==200&&F.status!==201?(console.log("Failed to send flow response for step "+g.stepId+". Will retry again later."),n([...r,g])):x||p(I=>[...I??[],g])})}async function T(g){g.foreignUserId&&(g.actionType===mt||g.actionType===Ie?await y(g):g.actionType===Z?await y(g):g.actionType===po?await y(g):g.actionType===Ne?await y(g):g.actionType===ao?await y(g):g.actionType===Be&&await y(g))}function P(){let g=[];return o==null||o.forEach(v=>{if(v&&v.stepStates&&Object.keys(v.stepStates).length!==0)for(let x in v.stepStates){let F=v.stepStates[x];g.push({foreignUserId:v.foreignUserId,flowSlug:v.flowId,stepId:F.stepId,actionType:F.actionType,data:{},createdAt:new Date(F.createdAt),blocked:F.blocked,hidden:F.hidden})}}),[...g,...s]}return{addResponse:T,setFlowResponses:p,getFlowResponses:P}}import vl from"swr";var Tl=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Br=e=>{let t=Tl.exec(e);if(t===null)return null;let o=null;return t.forEach((i,r)=>{let n=Fl(i,"'","");n.startsWith("flow_")&&(o=n)}),o},Fl=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function R(){let{config:e,apiUrl:t}=Me(),{flows:o,setFlows:i,userId:r,publicApiKey:n,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:a,setFlowResponses:h,setShouldGracefullyDegrade:c,readonly:f}=kl(j),y={data:[]},{verifySDKInitiated:T}=kt(),{addResponse:P,getFlowResponses:g}=Ht(),v=u=>fetch(u,e).then(b=>b.ok?b.json():(console.log(`Error fetching ${u} (${b.status}): ${b.statusText}. .Will gracefully degrade and hide Frigade`),c(!0),y)).catch(b=>(console.log(`Error fetching ${u}: ${b}. Will gracefully degrade and hide Frigade`),c(!0),y)),{userFlowStatesData:x,isLoadingUserFlowStateData:F,optimisticallyMarkFlowCompleted:I,optimisticallyMarkFlowNotStarted:S,optimisticallyMarkStepCompleted:m,optimisticallyMarkStepNotStarted:w,optimisticallyMarkStepStarted:C}=Ee(),{data:B,error:L,isLoading:M}=vl(n?`${t}flows${f?"?readonly=true":""}`:null,v,{keepPreviousData:!0});Pl(()=>{if(L){console.error(L);return}B&&B.data&&i(B.data)},[B,L]);function N(u){if(M)return null;let b=o.find(E=>E.slug===u);return!b&&o.length>0&&!F&&!M?(console.log(`Flow with slug ${u} not found`),null):(b==null?void 0:b.active)===!1?null:b}function O(u){var A;if(!N(u))return[];let b=N(u).data;return b?(b=H(b),(((A=JSON.parse(b))==null?void 0:A.data)??[]).map(Q=>{let ct=je(Q);return{handleSecondaryButtonClick:()=>{Q.skippable===!0&&le(u,Q.id,{skipped:!0})},...Q,complete:de(u,Q.id)===Ne||ct>=1,blocked:_(u,Q.id),hidden:D(u,Q.id),handlePrimaryButtonClick:()=>{(!Q.completionCriteria&&(Q.autoMarkCompleted||Q.autoMarkCompleted===void 0)||Q.completionCriteria&&Q.autoMarkCompleted===!0)&&le(u,Q.id)},progress:ct}}).filter(Q=>Q.hidden!==!0)):[]}function H(u){return u.replaceAll(/\${(.*?)}/g,(b,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 $(u){if(!N(u))return[];let b=N(u).data;return b?(b=H(b),JSON.parse(b)??{}):[]}function X(u,b){p(E=>({...E,[u]:b}))}function ee(u){!F&&!M&&u&&JSON.stringify(s)!=JSON.stringify({...s,...u})&&Object.keys(u).forEach(b=>{X(b,u[b])})}let K=ut(async(u,b,E)=>{T();let A={foreignUserId:r,flowSlug:u,stepId:b,actionType:po,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};q(A)&&(await C(u,b,A),P(A))},[r,x]),te=ut(async(u,b,E)=>{T();let A={foreignUserId:r,flowSlug:u,stepId:b,actionType:Be,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};q(A)&&(await w(u,b),P(A))},[r,x]),le=ut(async(u,b,E)=>{T();let A={foreignUserId:r,flowSlug:u,stepId:b,actionType:Ne,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};q(A)&&(await m(u,b,A),P(A))},[r,x]),J=ut(async(u,b)=>{if(T(),De(u)===Ie)return;let E={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:Ie,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};await S(u),q(E)&&P(E)},[r,x]),G=ut(async(u,b)=>{T();let E={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:mt,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};q(E)&&P(E)},[r,x]),xe=ut(async(u,b)=>{T();let E={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:Z,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};q(E)&&(await I(u),P(E))},[r,x]),Te=ut(async(u,b)=>{T();let E={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:ao,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};q(E)&&(await I(u),P(E))},[r,x]);function q(u){var b;if(!x&&u.actionType===Be)return!1;if(x){let E=x.find(A=>A.flowId===u.flowSlug);if(u.actionType===Be&&(!(E!=null&&E.stepStates[u.stepId])||E.stepStates[u.stepId].actionType===Be)||E&&((b=E.stepStates[u.stepId])==null?void 0:b.actionType)===u.actionType||E&&E.flowState===Z&&u.actionType===Z)return!1}return!0}function de(u,b){let E=re(u,b);return F?null:E?E.actionType:Be}function _(u,b){let E=re(u,b);return E?E.blocked:!1}function D(u,b){let E=re(u,b);return E?E.hidden:!1}function re(u,b){if(F)return null;let E=x==null?void 0:x.find(A=>A.flowId===u);return!E||!E.stepStates[b]?null:E.stepStates[b]??null}function V(u){var E;if(F||!x)return null;if(De(u)===Ie)return O(u)[0]??null;let b=(E=x.find(A=>A.flowId===u))==null?void 0:E.lastStepId;return b?O(u).find(A=>A.id===b):null}function ie(u){let b=V(u);if(!b)return 0;let E=O(u).findIndex(A=>A.id===b.id)??0;return de(u,b.id)===Ne&&E<O(u).length-1?E+1:E}function je(u){if(!u.completionCriteria)return;let b=Br(u.completionCriteria);if(b===null)return;let E=dt(b),A=W(b);return A===0?void 0:E/A}function De(u){let b=x==null?void 0:x.find(E=>E.flowId===u);return b?b.flowState:null}function dt(u){let b=O(u);return b.length===0?0:b.filter(A=>de(u,A.id)===Ne).length}function W(u){return O(u).length}function ve(u){return JSON.parse(o.find(b=>b.slug===u).data)}function $e(u){if(f)return!1;if(F)return!0;if(u!=null&&u.targetingLogic&&x){let b=x.find(E=>E.flowId===u.slug);if(b)return b.shouldTrigger===!1}return!!(u!=null&&u.targetingLogic&&r&&r.startsWith("guest_"))}function zo(u){return!$e(N(u))}return{getFlow:N,getFlowData:ve,isLoading:F||M,getStepStatus:de,getFlowSteps:O,getCurrentStepIndex:ie,markStepStarted:K,markStepCompleted:le,markFlowNotStarted:J,markFlowStarted:G,markFlowCompleted:xe,markFlowAborted:Te,markStepNotStarted:te,getFlowStatus:De,getNumberOfStepsCompleted:dt,getNumberOfSteps:W,targetingLogicShouldHideFlow:$e,setCustomVariable:X,updateCustomVariables:ee,customVariables:s,getStepOptionalProgress:je,getFlowMetadata:$,isStepBlocked:_,isStepHidden:D,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:a,isFlowAvailableToUser:zo}}import{useCallback as Er,useContext as Bl,useEffect as El}from"react";var Pt="guest_";function Vt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=Bl(j),{config:n,apiUrl:s}=Me(),{mutateUserFlowState:p}=Ee(),d=Ft(),{verifySDKInitiated:a}=kt();El(()=>{if(e&&!t){if(e.startsWith(Pt))return;let f=`frigade-user-registered-${e}`;localStorage.getItem(f)||(d(`${s}users`,{...n,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(f,"true"))}},[e,r,t]);let h=Er(async f=>{a();let y={foreignId:e,properties:f};await d(`${s}users`,{...n,method:"POST",body:JSON.stringify(y)}),i(T=>({...T,...f})),p()},[e,n,r,p]),c=Er(async(f,y)=>{a();let P={foreignId:e,events:[{event:f,properties:y}]};await d(`${s}users`,{...n,method:"POST",body:JSON.stringify(P)}),p()},[e,n,p]);return{userId:e,setUserId:o,addPropertiesToUser:h,trackEventForUser:c}}import{v4 as ip}from"uuid";import ze,{useEffect as Ra,useState as ep}from"react";import Le,{useEffect as $l}from"react";import uo from"styled-components";import Al from"react";import Il from"styled-components";var Ar="fr-",jt="cfr-";function l(e,t){let o=`${Ar}${e}`;if(!t)return o;if(t.styleOverrides&&t.styleOverrides[e]){if(typeof t.styleOverrides[e]=="string")return o+" "+t.styleOverrides[e];if(typeof t.styleOverrides[e]=="object")return o+" "+jt+e}return o}function k(e){if(!e.className||e.className.indexOf(jt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(Ar)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Wo(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=>`${Wo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Ce(...e){return e.filter(Boolean).join(" ")}function Gt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Nl=Il.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -23,11 +23,11 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
23
23
|
opacity: 1;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
`,Ir=({onClose:e,appearance:t})=>
|
|
26
|
+
`,Ir=({onClose:e,appearance:t})=>Al.createElement(Nl,{className:l("modalBackground",t),onClick:()=>e()});import Ho from"react";import Ll from"styled-components";var Ol=Ll.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
|
-
`,ke=()=>Ho.createElement(
|
|
30
|
+
`,ke=()=>Ho.createElement(Ol,null,Ho.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 20 20"},Ho.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5 15L15 5M5 5l10 10"})));import{Portal as Ml}from"react-portal";import Vr from"react";import Vo from"react";function Dl({style:e,className:t}){return Vo.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"54",height:"14",fill:"none",viewBox:"0 0 54 14",style:e,className:t},Vo.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"}),Vo.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 Nr=Dl;import jo from"styled-components";import et from"styled-components";var co=et.div`
|
|
31
31
|
${e=>k(e)} {
|
|
32
32
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
33
33
|
}
|
|
@@ -103,7 +103,7 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}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
|
-
`,Wr=jo(
|
|
106
|
+
`,Wr=jo(co)`
|
|
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 ht,{createContext as kp,useEffect as vo,useState as Ae}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 mo({appearance:e}){return Vr.createElement(Hr,{className:l("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",Vr.createElement(Nr,null))}var Ul=uo.div`
|
|
129
129
|
${e=>k(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 ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
167
167
|
opacity: 1;
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
`,
|
|
170
|
+
`,zl=uo.div`
|
|
171
171
|
position: relative;
|
|
172
172
|
flex: 0 1 auto;
|
|
173
|
-
`,
|
|
173
|
+
`,_l=uo.div`
|
|
174
174
|
position: absolute;
|
|
175
175
|
top: 24px;
|
|
176
176
|
right: 24px;
|
|
@@ -180,14 +180,14 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}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
|
-
`,
|
|
183
|
+
`,Wl=uo.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})=>(
|
|
190
|
+
`,tt=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:r,appearance:n,dismissible:s=!0,showFrigadeBranding:p=!1})=>($l(()=>{let d=a=>{a.key==="Escape"&&e()};return document.addEventListener("keydown",d),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",d)}},[e,t]),t?Le.createElement(Ml,null,Le.createElement(Ir,{appearance:n,onClose:()=>{s&&e()}}),Le.createElement(Ul,{appearance:n,className:l("modalContainer",n),styleOverrides:i},s&&Le.createElement(_l,{className:l("modalClose",n),onClick:()=>e(),appearance:n},Le.createElement(ke,null)),o&&Le.createElement(zl,null,o),Le.createElement(Wl,null,r),p&&Le.createElement(_r,{appearance:n,className:l("poweredByFrigadeRibbon",n)},Le.createElement(mo,{appearance:n})))):Le.createElement(Le.Fragment,null));import ot,{useEffect as Hl}from"react";import fo from"styled-components";import{Portal as Vl}from"react-portal";var jl=fo.div`
|
|
191
191
|
${e=>k(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 ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
205
205
|
bottom: 0;
|
|
206
206
|
margin-right: 28px;
|
|
207
207
|
margin-bottom: 28px;
|
|
208
|
-
`,
|
|
208
|
+
`,Gl=fo.div`
|
|
209
209
|
position: relative;
|
|
210
210
|
flex: 1;
|
|
211
|
-
`,
|
|
211
|
+
`,ql=fo.div`
|
|
212
212
|
position: absolute;
|
|
213
213
|
top: 24px;
|
|
214
214
|
right: 24px;
|
|
@@ -218,13 +218,13 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}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
|
-
`,
|
|
221
|
+
`,Kl=fo.div`
|
|
222
222
|
overflow: scroll;
|
|
223
223
|
flex: 5;
|
|
224
224
|
::-webkit-scrollbar {
|
|
225
225
|
display: none;
|
|
226
226
|
}
|
|
227
|
-
`,jr=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:r})=>(
|
|
227
|
+
`,jr=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:r})=>(Hl(()=>{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(Vl,null,ot.createElement(jl,{appearance:r,className:l("cornerModalContainer",r)},ot.createElement(ql,{className:l("cornerModalClose",r),onClick:()=>e()},ot.createElement(ke,null)),o&&ot.createElement(Gl,null,o),ot.createElement(Kl,null,i))):ot.createElement(ot.Fragment,null));import{useContext as Yl}from"react";function oe(){let{defaultAppearance:e}=Yl(j);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 Ca,useEffect as ya,useState as Ro}from"react";import yo from"styled-components";import ho,{useEffect as Xl,useState as Jr}from"react";import Ko from"styled-components";import go from"styled-components";var Gr=go.label`
|
|
228
228
|
${e=>k(e)} {
|
|
229
229
|
font-size: 14px;
|
|
230
230
|
line-height: 20px;
|
|
@@ -232,14 +232,14 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
232
232
|
margin-top: 10px;
|
|
233
233
|
}
|
|
234
234
|
display: flex;
|
|
235
|
-
`,qr=
|
|
235
|
+
`,qr=go.label`
|
|
236
236
|
${e=>k(e)} {
|
|
237
237
|
font-size: 12px;
|
|
238
238
|
line-height: 20px;
|
|
239
239
|
margin-bottom: 5px;
|
|
240
240
|
}
|
|
241
241
|
display: flex;
|
|
242
|
-
`,Kr=
|
|
242
|
+
`,Kr=go.span`
|
|
243
243
|
font-weight: 400;
|
|
244
244
|
font-size: 14px;
|
|
245
245
|
line-height: 22px;
|
|
@@ -247,12 +247,12 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
247
247
|
display: flex;
|
|
248
248
|
margin-right: 5px;
|
|
249
249
|
margin-top: 10px;
|
|
250
|
-
`,go
|
|
250
|
+
`,xo=go.div`
|
|
251
251
|
display: flex;
|
|
252
252
|
align-items: flex-start;
|
|
253
253
|
justify-content: left;
|
|
254
254
|
margin-bottom: 10px;
|
|
255
|
-
`;import Go 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?Go.createElement(
|
|
255
|
+
`;import Go 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?Go.createElement(xo,null,t?Go.createElement(Kr,{className:l("formLabelRequired",o),appearance:o},"*"):null,Go.createElement(Gr,{className:l("formLabel",o)},e)):null}import Yr from"react";function vt({title:e,appearance:t}){return e?Yr.createElement(xo,null,Yr.createElement(qr,{className:l("formSubLabel",t)},e)):null}import{z as qo}from"zod";function Xr(e,t){try{if(t){if(t.type=="number"){let o=qo.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=qo.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 qo.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 Jl=Ko.div`
|
|
256
256
|
display: flex;
|
|
257
257
|
flex-direction: column;
|
|
258
258
|
width: 100%;
|
|
@@ -272,7 +272,7 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
272
272
|
box-sizing: border-box;
|
|
273
273
|
padding: 0 10px;
|
|
274
274
|
margin-bottom: 10px;
|
|
275
|
-
`,
|
|
275
|
+
`,Ql=Ko.textarea`
|
|
276
276
|
${e=>k(e)} {
|
|
277
277
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
278
278
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -288,13 +288,13 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
288
288
|
min-height: 70px;
|
|
289
289
|
box-sizing: border-box;
|
|
290
290
|
margin-bottom: 10px;
|
|
291
|
-
`;function Xo({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:r}){let n=e,[s,p]=Jr((r==null?void 0:r.text)||""),[d,a]=Jr(!1),h=Yo;
|
|
291
|
+
`;function Xo({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:r}){let n=e,[s,p]=Jr((r==null?void 0:r.text)||""),[d,a]=Jr(!1),h=Yo;Xl(()=>{s===""&&!d&&(a(!0),c(""))},[]);function c(y){if(p(y),o({text:y}),n.required===!0&&y.trim()===""){i([{id:n.id,message:`${n.title??"Field"} is required`}]);return}let T=Xr(y,n.validation);if(T){i([{id:n.id,message:T}]);return}i([])}n.multiline&&(h=Ql);function f(){var y;switch((y=n==null?void 0:n.validation)==null?void 0:y.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return ho.createElement(Jl,null,ho.createElement(rt,{title:n.title,required:n.required,appearance:t.appearance}),ho.createElement(h,{className:l("inputComponent",t.appearance),value:s,onChange:y=>{c(y.target.value)},appearance:t.appearance,placeholder:n.placeholder,type:f()}),ho.createElement(vt,{title:n.subtitle,appearance:t.appearance}))}import Ue,{useEffect as Qr,useState as Zr}from"react";import Rr from"styled-components";var Jo="",Zl=Rr.div`
|
|
292
292
|
display: flex;
|
|
293
293
|
flex-direction: column;
|
|
294
294
|
width: 100%;
|
|
295
295
|
-webkit-appearance: none;
|
|
296
296
|
appearance: none;
|
|
297
|
-
`,
|
|
297
|
+
`,Rl=Rr.select`
|
|
298
298
|
${e=>k(e)} {
|
|
299
299
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
300
300
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -315,15 +315,15 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}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 ei({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var h,c,f,
|
|
318
|
+
`;function ei({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var h,c,f,y,T,P;let n=e,[s,p]=Zr(((h=i==null?void 0:i.choice)==null?void 0:h[0])||""),[d,a]=Zr(!1);return Qr(()=>{var g,v,x,F;if(s===""&&!d){if(a(!0),n.requireSelection){p(Jo);return}if(n.defaultValue&&((g=n.props.options)!=null&&g.find(I=>I.id===n.defaultValue))){let I=(v=n.props.options)==null?void 0:v.find(S=>S.id===n.defaultValue);p(I.id),o({choice:[I.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)||""]})}},[]),Qr(()=>{n.requireSelection&&s===Jo?r([{message:"Please select an option",id:n.id}]):r([])},[s]),Ue.createElement(Zl,null,Ue.createElement(rt,{title:n.title,required:!1,appearance:t.appearance}),Ue.createElement(Rl,{value:s,onChange:g=>{p(g.target.value),o({choice:[g.target.value]})},placeholder:n.placeholder,appearance:t.appearance,className:l("multipleChoiceSelect",t.appearance)},n.requireSelection&&Ue.createElement("option",{key:"null-value",value:Jo,disabled:!0},n.placeholder??"Select an option"),(c=n.props.options)==null?void 0:c.map(g=>Ue.createElement("option",{key:g.id,value:g.id},g.title))),((y=(f=n.props.options)==null?void 0:f.find(g=>g.id===s))==null?void 0:y.isOpenEnded)&&Ue.createElement(Ue.Fragment,null,Ue.createElement(rt,{title:((P=(T=n.props.options)==null?void 0:T.find(g=>g.id===s))==null?void 0:P.openEndedLabel)??"Please specify",required:!1,appearance:t.appearance}),Ue.createElement(Yo,{type:"text",placeholder:"Enter your answer here",onChange:g=>{o({choice:[g.target.value]})},appearance:t.appearance})),Ue.createElement(vt,{title:n.subtitle,appearance:t.appearance}))}import Yt,{useEffect as Qo,useState as oi}from"react";import ri from"styled-components";import Kt from"react";import qt from"react";import{motion as ea}from"framer-motion";var ti=({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 qt.createElement(ea.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"})},ta=({fillColor:e,size:t,percentage:o,children:i,bgColor:r="#D9D9D9",className:n,style:s})=>qt.createElement("svg",{style:s,className:n,width:t,height:t,overflow:"visible"},qt.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},qt.createElement(ti,{color:r,size:t}),qt.createElement(ti,{color:e,percentage:o,size:t})),i),Bt=ta;import oa from"styled-components";var ra=({color:e="#FFFFFF"})=>Kt.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Kt.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),ia={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},na={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},sa={border:"1px solid #000000",color:"#FFFFFF"},la={border:"1px solid #E6E6E6"},aa={color:"#FFFFFF"},pa={border:"3px solid #D9D9D9"},da=e=>e==="square"?ia:na,ca=(e,t)=>e==="square"?t?sa:la:t?aa:pa,ma=oa.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=
|
|
320
|
+
`,Ke=({value:e,type:t="square",primaryColor:o="#000000",progress:i,appearance:r=qe,style:n,className:s})=>{let p=da(t),d=ca(t,e);return e===!0?p={...p,...d,backgroundColor:o,borderColor:t==="square"?o:"none"}:p={...p,...d},e!==!0&&t==="round"&&i!==void 0&&i!==1?Kt.createElement(Bt,{fillColor:o,percentage:i,size:22}):Kt.createElement(ma,{styleOverrides:p,style:n,role:"checkbox",className:Ce(l("checkIconContainer",r),l(e?"checkIconContainerChecked":"checkIconContainerUnchecked",r),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&Kt.createElement(ra,{color:"#FFFFFF"}))};var ua=ri.div`
|
|
321
321
|
display: flex;
|
|
322
322
|
flex-direction: column;
|
|
323
323
|
width: 100%;
|
|
324
324
|
-webkit-appearance: none;
|
|
325
325
|
appearance: none;
|
|
326
|
-
`,
|
|
326
|
+
`,fa=ri.button`
|
|
327
327
|
${e=>k(e)} {
|
|
328
328
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
329
329
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -348,7 +348,7 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
348
348
|
height: 60px;
|
|
349
349
|
padding: 0 18px;
|
|
350
350
|
margin-bottom: 10px;
|
|
351
|
-
`;function ii({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var h;let n=e,[s,p]=oi((i==null?void 0:i.choice)||[]),[d,a]=oi(!1);return Qo(()=>{s.length==0&&!d&&(a(!0),o({choice:[]}))},[]),Qo(()=>{o({choice:s})},[s]),Qo(()=>{n.required&&(s.length<n.props.minChoices||s.length>n.props.maxChoices)?r([{message:"",id:n.id}]):r([])},[s]),Yt.createElement(
|
|
351
|
+
`;function ii({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var h;let n=e,[s,p]=oi((i==null?void 0:i.choice)||[]),[d,a]=oi(!1);return Qo(()=>{s.length==0&&!d&&(a(!0),o({choice:[]}))},[]),Qo(()=>{o({choice:s})},[s]),Qo(()=>{n.required&&(s.length<n.props.minChoices||s.length>n.props.maxChoices)?r([{message:"",id:n.id}]):r([])},[s]),Yt.createElement(ua,null,Yt.createElement(rt,{title:n.title,required:n.required,appearance:t.appearance}),(h=n.props.options)==null?void 0:h.map(c=>Yt.createElement(fa,{appearance:t.appearance,className:l("multipleChoiceListItem",t.appearance),key:c.id,value:c.id,"data-selected":s.includes(c.id),onClick:()=>{if(s.includes(c.id)){p(s.filter(f=>f!==c.id));return}s.length<n.props.maxChoices?p([...s,c.id]):s.length==1&&n.props.maxChoices==1&&p([c.id])}},c.title,Yt.createElement(Ke,{type:"round",primaryColor:t.appearance.theme.colorPrimary,value:s.includes(c.id),appearance:t.appearance}))),Yt.createElement(vt,{title:n.subtitle,appearance:t.appearance}))}import Co from"react";import ni from"styled-components";import ga from"dompurify";function ue(e){return{__html:ga.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var xa=ni.h1`
|
|
352
352
|
${e=>k(e)} {
|
|
353
353
|
font-style: normal;
|
|
354
354
|
font-weight: 600;
|
|
@@ -359,7 +359,7 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
359
359
|
margin-bottom: 4px;
|
|
360
360
|
color: ${e=>e.appearance.theme.colorText};
|
|
361
361
|
}
|
|
362
|
-
`,
|
|
362
|
+
`,ha=ni.h2`
|
|
363
363
|
${e=>k(e)} {
|
|
364
364
|
font-style: normal;
|
|
365
365
|
font-weight: 400;
|
|
@@ -367,25 +367,25 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
367
367
|
line-height: 20px;
|
|
368
368
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
369
369
|
}
|
|
370
|
-
`;function
|
|
370
|
+
`;function ye({appearance:e,title:t,subtitle:o,size:i="medium",classPrefix:r=""}){return Co.createElement(Co.Fragment,null,Co.createElement(xa,{appearance:e,className:l(`${r}${r?Gt(i):i}Title`,e),dangerouslySetInnerHTML:ue(t),size:i}),o&&Co.createElement(ha,{appearance:e,className:l(`${r}${r?Gt(i):i}Subtitle`,e),dangerouslySetInnerHTML:ue(o),size:i}))}import*as Zo from"react";var si=e=>Zo.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:12,height:12,"aria-hidden":"true",viewBox:"0 0 16 16",...e},Zo.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 Sa,motion as ba}from"framer-motion";var wa=yo.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
|
-
`,
|
|
376
|
+
`,Ta=yo(ba.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
|
-
`,
|
|
382
|
+
`,Fa=yo.div`
|
|
383
383
|
margin-right: 4px;
|
|
384
384
|
display: inline-flex;
|
|
385
|
-
`,
|
|
385
|
+
`,ka=yo.div`
|
|
386
386
|
padding-left: 1px;
|
|
387
387
|
padding-right: 1px;
|
|
388
|
-
`,
|
|
388
|
+
`,Pa={text:Xo,multipleChoice:ei,multipleChoiceList:ii};function li({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:r,appearance:n,customFormElements:s}){var I;let p=t.props,[d,a]=Ro([]),[h,c]=Ro([]),{userId:f}=Vt(),[y,T]=Ro(x()||{}),{readonly:P}=Ca(j),g={...Pa,...s};ya(()=>{i(d.length===0)},[d,i]);function v(S,m){let w={...y,[S.id]:m};T(w),r(w),window&&window.localStorage&&!P&&window.localStorage.setItem(F(),JSON.stringify(w))}function x(){if(window&&window.localStorage){let S=window.localStorage.getItem(F());if(S)return JSON.parse(S)}return{}}function F(){return`frigade-multiInputStepTypeData-${e}-${t.id}-${f}`}return it.createElement(ka,{className:l("multiInput",n)},it.createElement(ye,{appearance:n,title:t.title,subtitle:t.subtitle}),it.createElement(wa,{className:l("multiInputContainer",n)},(I=p.data)==null?void 0:I.map(S=>{var w;let m=(w=d.reverse().find(C=>C.id===S.id))==null?void 0:w.message;return g[S.type]?it.createElement("span",{key:S.id,"data-field-id":S.id,className:l("multiInputField",n)},g[S.type]({formInput:S,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:r,appearance:n},onSaveInputData:C=>{!h.includes(S.id)&&C&&(C==null?void 0:C.text)!==""&&c(B=>[...B,S.id]),v(S,C)},inputData:y[S.id],setFormValidationErrors:C=>{a(B=>C.length===0?B.filter(L=>L.id!==S.id):[...B,...C])}}),it.createElement(Sa,null,m&&h.includes(S.id)&&it.createElement(Ta,{initial:{opacity:0,height:0,marginBottom:0},animate:{opacity:1,height:"auto",marginBottom:12},exit:{opacity:0,height:0,marginBottom:0},key:S.id,style:{overflow:"hidden"},transition:{duration:.1,ease:"easeInOut",delay:.5},appearance:n,className:l("multiInputValidationError",n)},it.createElement(Fa,{appearance:n,className:l("multiInputValidationErrorIcon",n)},it.createElement(si,null)),m))):null})))}import ft from"styled-components";var ai=ft.div`
|
|
389
389
|
align-items: center;
|
|
390
390
|
display: flex;
|
|
391
391
|
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
@@ -424,7 +424,7 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
424
424
|
background-position: center;
|
|
425
425
|
border-top-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
426
426
|
border-bottom-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
427
|
-
`;import nt from"react";import
|
|
427
|
+
`;import nt from"react";import va from"react";import gi from"styled-components";var Ba=gi.button`
|
|
428
428
|
justify-content: center;
|
|
429
429
|
align-content: center;
|
|
430
430
|
${e=>k(e)} {
|
|
@@ -466,14 +466,14 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
466
466
|
margin-right: 8px;
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
`,ne=({onClick:e,title:t,style:o,disabled:i,type:r="inline",size:n="medium",secondary:s=!1,appearance:p,withMargin:d=!0,classPrefix:a=""})=>{function h(){let c=s?"buttonSecondary":"button";return a===""?c:`${a}${Gt(c)}`}return
|
|
469
|
+
`,ne=({onClick:e,title:t,style:o,disabled:i,type:r="inline",size:n="medium",secondary:s=!1,appearance:p,withMargin:d=!0,classPrefix:a=""})=>{function h(){let c=s?"buttonSecondary":"button";return a===""?c:`${a}${Gt(c)}`}return va.createElement(Ba,{secondary:s,appearance:p,disabled:i,onClick:e,styleOverrides:o,type:r,withMargin:d,size:n,className:l(h(),p)},t)};var xi=({step:e,canContinue:t,appearance:o,onPrimaryClick:i,onSecondaryClick:r,formType:n,selectedStep:s,steps:p,onBack:d,allowBackNavigation:a,errorMessage:h})=>{let c=n==="inline"?"inline":"full-width",f=p.length>1&&s!=0&&a;return nt.createElement(nt.Fragment,null,h&&nt.createElement(pi,{appearance:o,className:l("formCTAError",o)},h),nt.createElement(ai,{showBackButton:f,className:l("formCTAContainer",o)},f&&nt.createElement(ne,{title:e.backButtonTitle??"\u2190",onClick:d,secondary:!0,withMargin:!1,type:c,appearance:o,style:{width:"90px",maxWidth:"90px"},classPrefix:"back"}),nt.createElement(di,{className:l("ctaWrapper",o)},e.secondaryButtonTitle?nt.createElement(ne,{title:e.secondaryButtonTitle,onClick:r,secondary:!0,withMargin:!1,type:c,appearance:o}):null," ",e.primaryButtonTitle?nt.createElement(ne,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:i,type:c,appearance:o}):null)))};import er from"react";import Ea from"styled-components";var Aa=Ea.div`
|
|
470
470
|
text-align: center;
|
|
471
|
-
`,hi=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:r}=
|
|
471
|
+
`,hi=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:r}=oe().mergeAppearanceWithDefault(i);return er.createElement(Aa,{className:o},er.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((n,s)=>er.createElement("rect",{key:s,x:16*s,y:0,width:8,height:8,rx:4,fill:t===s?r.colorPrimary:"#E6E6E6"}))))};import gt from"react";import Et from"styled-components";import{useContext as Ia}from"react";function ae(){let e=Ia(j);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 Na=Et.div`
|
|
472
472
|
display: flex;
|
|
473
473
|
flex-wrap: wrap;
|
|
474
474
|
align-content: center;
|
|
475
475
|
justify-content: center;
|
|
476
|
-
`,
|
|
476
|
+
`,La=Et.div`
|
|
477
477
|
align-content: center;
|
|
478
478
|
align-items: center;
|
|
479
479
|
display: flex;
|
|
@@ -487,10 +487,10 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
487
487
|
flex-basis: 255px;
|
|
488
488
|
flex-grow: 0;
|
|
489
489
|
flex-shrink: 0;
|
|
490
|
-
`,
|
|
490
|
+
`,Oa=Et.img`
|
|
491
491
|
width: 78px;
|
|
492
492
|
height: auto;
|
|
493
|
-
`,
|
|
493
|
+
`,Da=Et.button`
|
|
494
494
|
font-style: normal;
|
|
495
495
|
font-weight: 600;
|
|
496
496
|
font-size: 13px;
|
|
@@ -503,11 +503,11 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
503
503
|
border-radius: 100px;
|
|
504
504
|
padding: 8px 12px;
|
|
505
505
|
margin-top: 16px;
|
|
506
|
-
|
|
506
|
+
`,$a=Et.h1`
|
|
507
507
|
font-weight: 700;
|
|
508
508
|
font-size: 28px;
|
|
509
509
|
line-height: 34px;
|
|
510
|
-
`,
|
|
510
|
+
`,Ma=Et.h2`
|
|
511
511
|
font-style: normal;
|
|
512
512
|
font-weight: 400;
|
|
513
513
|
font-size: 16px;
|
|
@@ -516,7 +516,7 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
516
516
|
margin-top: 12px;
|
|
517
517
|
margin-bottom: 16px;
|
|
518
518
|
max-width: 70%;
|
|
519
|
-
`;function Ci({stepData:e,appearance:t}){var i,r;let{handleUrl:o}=
|
|
519
|
+
`;function Ci({stepData:e,appearance:t}){var i,r;let{handleUrl:o}=ae();return gt.createElement("div",null,gt.createElement($a,null,e.title),gt.createElement(Ma,null,e.subtitle),gt.createElement(Na,null,(r=(i=e.props)==null?void 0:i.links)==null?void 0:r.map(n=>gt.createElement(La,{key:n.title},gt.createElement(Oa,{src:n.imageUri}),gt.createElement(Da,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{n.uri&&o(n.uri,n.uriTarget??"_blank")}},n.title)))))}import At,{useEffect as ja}from"react";import To from"styled-components";import tr from"react";var bo=({style:e,className:t})=>tr.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},tr.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),tr.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 Xt,{useRef as Ua,useState as za}from"react";import wo from"styled-components";var _a=wo.div`
|
|
520
520
|
display: flex;
|
|
521
521
|
align-items: center;
|
|
522
522
|
justify-content: flex-start;
|
|
@@ -524,7 +524,7 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
524
524
|
width: 100%;
|
|
525
525
|
height: 100%;
|
|
526
526
|
position: relative;
|
|
527
|
-
`,
|
|
527
|
+
`,Wa=wo.div`
|
|
528
528
|
position: absolute;
|
|
529
529
|
display: flex;
|
|
530
530
|
align-items: center;
|
|
@@ -543,39 +543,39 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
543
543
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
544
544
|
border-radius: 50%;
|
|
545
545
|
}
|
|
546
|
-
`,
|
|
546
|
+
`,Ha=wo.video`
|
|
547
547
|
width: 100%;
|
|
548
548
|
height: 100%;
|
|
549
549
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
550
|
-
`,
|
|
550
|
+
`,Va=wo.iframe`
|
|
551
551
|
width: 100%;
|
|
552
552
|
height: 100%;
|
|
553
553
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
554
|
-
`;function st({appearance:e,videoUri:t}){let o
|
|
554
|
+
`;function st({appearance:e,videoUri:t}){let o=Ua(),[i,r]=za(!1);if(t.includes("youtube")){let n=t.split("v=")[1],s=n.indexOf("&");return s!==-1&&(n=n.substring(0,s)),Xt.createElement(Va,{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 Xt.createElement(_a,{className:l("videoPlayerWrapper",e),appearance:e},!i&&Xt.createElement(Wa,{onClick:()=>{r(!0),o.current.play()},appearance:e},Xt.createElement(bo,null)),Xt.createElement(Ha,{appearance:e,controls:i,ref:o,play:i,src:t}))}var Ga=To.div`
|
|
555
555
|
${e=>k(e)} {
|
|
556
556
|
display: flex;
|
|
557
557
|
flex-direction: column;
|
|
558
558
|
justify-content: center;
|
|
559
559
|
}
|
|
560
|
-
`,
|
|
560
|
+
`,qa=To.img`
|
|
561
561
|
${e=>k(e)} {
|
|
562
562
|
width: 100%;
|
|
563
563
|
height: auto;
|
|
564
564
|
max-height: 250px;
|
|
565
565
|
margin-bottom: 24px;
|
|
566
566
|
}
|
|
567
|
-
`,
|
|
567
|
+
`,Ka=To.div`
|
|
568
568
|
${e=>k(e)} {
|
|
569
569
|
margin-bottom: 24px;
|
|
570
570
|
}
|
|
571
|
-
`,
|
|
571
|
+
`,Ya=To.div`
|
|
572
572
|
${e=>k(e)} {
|
|
573
573
|
width: 100%;
|
|
574
574
|
height: auto;
|
|
575
575
|
max-height: 250px;
|
|
576
576
|
margin-bottom: 24px;
|
|
577
577
|
}
|
|
578
|
-
`;function
|
|
578
|
+
`;function yi({stepData:e,appearance:t,setCanContinue:o}){return ja(()=>{o(!0)},[]),At.createElement(Ga,{className:l("callToActionContainer",t)},At.createElement(Ka,{className:l("callToActionTextContainer",t)},At.createElement(ye,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&At.createElement(qa,{className:l("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&At.createElement(Ya,{appearance:t,className:l("callToActionVideo",t)},At.createElement(st,{appearance:t,videoUri:e.videoUri})))}import Ye,{useEffect as or,useState as rr}from"react";import lt from"styled-components";var Si=lt.div`
|
|
579
579
|
width: auto;
|
|
580
580
|
display: flex;
|
|
581
581
|
flex-direction: column;
|
|
@@ -628,8 +628,8 @@ import ht,{createContext as kp,useEffect as vo,useState as Ae}from"react";import
|
|
|
628
628
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
629
629
|
display: flex;
|
|
630
630
|
align-self: center;
|
|
631
|
-
`;var Bi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let r=e.props,[n,s]=rr([]),[p,d]=rr(!1),[a,h]=rr(e.id);return or(()=>{n.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),or(()=>{a!==e.id&&(h(e.id),s([]))},[e]),or(()=>{o({choice:n}),n.length>=r.minChoices?t(!0):t(!1)},[n]),Ye.createElement(
|
|
632
|
-
${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map(([s,p])=>`${Wo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return Qt.createElement(o,{inlineStyles:t})}var Ei=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:r,customVariables:n,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:a=!0,onStepCompletion:h,onButtonClick:c,dismissible:f=!0,endFlowOnDismiss:S=!1,modalPosition:T="center",repeatable:P=!1,onDismiss:g,showPagination:v=!1,allowBackNavigation:x=!1,validationHandler:F,showFrigadeBranding:I=!1})=>{let{getFlow:y,getFlowSteps:m,isLoading:w,targetingLogicShouldHideFlow:C,getFlowStatus:B,getCurrentStepIndex:O,markFlowCompleted:M,markFlowNotStarted:N}=ee(),L=O(e),{mergeAppearanceWithDefault:H}=te(),[$,J]=Za(!1),{setOpenFlowState:Q,getOpenFlowState:Y,hasOpenModals:V}=Fe();d=H(d);let[ge,oe]=i!==void 0&&r!==void 0?[i,r]:[Y(e,!0),K=>Q(e,K)];if(Qa(()=>{!$&&!w&&(J(!0),B(e)===R&&P&&N(e),J(!0))},[$,J,w]),w)return null;let q=y(e);if(!q||C(q))return null;let xe=m(e);if(!xe||i!==void 0&&i===!1||B(e)===R&&a||(o=="modal"||o=="corner-modal")&&V(e))return null;let Te=()=>{oe(!1),g&&g(),S===!0&&M(e)};if(T=="center"&&o==="modal"||o==="large-modal"){let K={padding:"24px"};return o==="large-modal"?(K.width="85%",K.height="90%",K.maxHeight="800px",K.minHeight="500px",K.padding="0"):K.width="400px",ze.createElement(tt,{appearance:d,onClose:Te,visible:ge,style:K,dismissible:f,showFrigadeBranding:I},ze.createElement(se,{appearance:d}),ze.createElement(To,{appearance:d,steps:xe,selectedStep:L,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:oe,onDismiss:g,showPagination:v,customFormElements:s,allowBackNavigation:x,validationHandler:F}))}return o==="modal"&&T!=="center"?ze.createElement(jr,{appearance:d,onClose:Te,visible:ge},ze.createElement(se,{appearance:d}),ze.createElement(To,{appearance:d,steps:xe,selectedStep:L,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:oe,onDismiss:g,showPagination:v,customFormElements:s,allowBackNavigation:x,validationHandler:F})):ze.createElement(ze.Fragment,null,ze.createElement(se,{appearance:d}),ze.createElement(To,{appearance:d,steps:xe,selectedStep:L,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:oe,onDismiss:g,showPagination:v,customFormElements:s,allowBackNavigation:x,validationHandler:F}))},Ai=Ei;import{useCallback as Ii,useContext as Ra,useEffect as ep}from"react";function nr(){let{organizationId:e,userId:t,setOrganizationId:o}=Ra(G),{mutateUserFlowState:i}=Ee(),{config:r,apiUrl:n}=Me(),s=Ft(),{verifySDKInitiated:p}=kt();ep(()=>{if(t&&e){if(t.startsWith(Pt))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 d=Ii(async h=>{if(p(),!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let c={foreignUserId:t,foreignUserGroupId:e,properties:h};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(c)}),i()},[e,t,r,i]),a=Ii(async(h,c)=>{if(p(),!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let S={foreignUserId:t,foreignUserGroupId:e,events:[{event:h,properties:c}]};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(S)}),i()},[e,t,r,i]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:d,trackEventForOrganization:a}}var Ni="frigade-xFrigade_guestUserId",Zt="frigade-xFrigade_userId",Li=({})=>{let{setFlowResponses:e}=Ht(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=Ee(),{userId:r,setUserId:n}=Vt(),[s,p]=sr(null),{getFlowStatus:d}=ee(),{flows:a,userProperties:h,setIsNewGuestUser:c,flowResponses:f}=tp(G),[S,T]=sr([]),[P,g]=sr([]),{organizationId:v}=nr();Fo(()=>{if(!o&&t)for(let y=0;y<t.length;y++){let m=t[y],w=a.find(C=>C.slug===(m==null?void 0:m.flowId));if(w&&m&&m.shouldTrigger===!0&&w.type=="FORM"&&w.triggerType==="AUTOMATIC"&&!P.includes(w.slug)){setTimeout(()=>{x(m.flowId)},500);break}}},[o,t]),Fo(()=>{f.length>0&&i()},[f]);function x(y){let m=a.find(w=>w.slug===y);m&&m.triggerType==="AUTOMATIC"&&!P.includes(m.slug)&&(g([...P,m.slug]),T([m]))}function F(){if(!r){let y=localStorage.getItem(Zt);if(y){n(y);return}let m=localStorage.getItem(Ni);if(m){n(m);return}c(!0);let w=Pt+op();try{localStorage.setItem(Ni,w)}catch(C){console.log("Failed to save guest user id locally: Local storage unavailable",C)}n(C=>C||w)}}Fo(()=>{try{if(a){let y=[];a.forEach(m=>{if(m.data){let w=m.data.match(/"imageUri":"(.*?)"/g);w&&w.forEach(C=>{let B=C.replace('"imageUri":"',"").replace('"',"");if(y.includes(B))return;let O=new Image;O.src=B,y.push(B)})}})}}catch{}},[a]),Fo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(Pt))try{localStorage.setItem(Zt,r)}catch(y){console.log("Failed to save user id locally: Local storage available",y)}r===null&&setTimeout(()=>{r===null&&F()},50)},[r,a,h]);function I(){return xt.createElement(xt.Fragment,null,S.map(y=>d(y.slug)!==Ie?null:xt.createElement("span",{key:y.slug},xt.createElement(Ai,{flowId:y.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return xt.createElement(xt.Fragment,null,xt.createElement(I,null))};import{ErrorBoundary as vp}from"react-error-boundary";import{deepmerge as Bp}from"deepmerge-ts";import hp from"styled-components";import{compose as Cp,variant as Di}from"styled-system";import Oi from"react";import rp,{ThemeProvider as ip,useTheme as np}from"styled-components";import{border as sp,color as lp,compose as ap,get as pp,shadow as dp,space as cp,system as mp,typography as up}from"styled-system";import{deepmerge as fp}from"deepmerge-ts";var gp={width:{property:"width",scale:"sizes",transform:(e,t)=>pp(t,e,!(typeof e=="number"&&!isNaN(e))||e>1?e:e*100+"%")},height:{property:"height",scale:"sizes"},minWidth:{property:"minWidth",scale:"sizes"},minHeight:{property:"minHeight",scale:"sizes"},maxWidth:{property:"maxWidth",scale:"sizes"},maxHeight:{property:"maxHeight",scale:"sizes"},overflow:!0,overflowX:!0,overflowY:!0,display:!0,verticalAlign:!0},xp=rp("div")(({css:e})=>e,ap(sp,lp,dp,cp,up,mp(gp))),ko=({as:e,children:t,overrides:o,...i})=>{let r=np(),n={border:"none",boxSizing:"border-box",m:0,p:0},s=()=>Oi.createElement(xp,{as:e,...n,...i},t);if(o!==void 0){let p=fp(r,o);return Oi.createElement(ip,{theme:p},s())}return s()};var Rt={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"}},Sp={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},$i=hp(ko)(()=>({whiteSpace:"nowrap"}),Cp(Di({scale:"components.Button",variants:"components.Button"}),Di({prop:"size",variants:Sp})));import yp from"styled-components";import{variant as bp,system as wp}from"styled-system";var Po={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 Mi=yp(ko)(bp({scale:"components.Text",variants:"components.Text"}),wp({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Ui=4,zi="px",Tp=20,Fp=Object.fromEntries(Array.from(Array(Tp+1),(e,t)=>t===0?[.5,`${.5*Ui}${zi}`]:[t,`${t*Ui}${zi}`])),It={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"},lr={colors:{...It,neutral:{foreground:It.gray300},primary:{background:It.blue500,foreground:It.white,inverted:It.blue500},negative:{foreground:It.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:Fp,components:{Button:Rt,Text:Po}};var _i="https://api.frigade.com",G=kp({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:_i,readonly:!1});function Ep(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var Ap=({publicApiKey:e,userId:t,organizationId:o,config:i,children:r})=>{var Q,Y;let[n,s]=Ae(t||null),[p,d]=Ae(o||null),[a,h]=Ae([]),[c,f]=Ae([]),[S,T]=Ae([]),[P,g]=Ae({}),[v,x]=Ae({}),[F,I]=Ae([]),[y,m]=Ae({}),[w,C]=Ae(!1),[B,O]=Ae(!1),[M,N]=Ae(!$(e)),L=(V,ge)=>{if(ge==="_blank"){window.open(V,"_blank");return}setTimeout(()=>{window.location.href=V},50)},H={theme:{...qe.theme,...((Q=i==null?void 0:i.defaultAppearance)==null?void 0:Q.theme)??{}},styleOverrides:{...qe.styleOverrides,...((Y=i==null?void 0:i.defaultAppearance)==null?void 0:Y.styleOverrides)??{}}};function $(V){return!!(V&&V.length>10&&V.substring(0,10)==="api_public")}vo(()=>{t&&s(t)},[t]),vo(()=>{n&&window&&window.localStorage&&window.localStorage.getItem(Zt)&&window.localStorage.getItem(Zt)!==n&&Ep()},[n]),vo(()=>{o&&d(o)},[o]),vo(()=>{if($(e))N(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),N(!0);return}},[e,N]);let J={publicApiKey:e,userId:n,setUserId:s,setFlows:h,flows:a,failedFlowResponses:c,setFailedFlowResponses:f,flowResponses:S,setFlowResponses:T,userProperties:P,setUserProperties:g,openFlowStates:v,setOpenFlowStates:x,completedFlowsToKeepOpenDuringSession:F,setCompletedFlowsToKeepOpenDuringSession:I,customVariables:y,setCustomVariables:m,isNewGuestUser:w,setIsNewGuestUser:C,hasActiveFullPageFlow:B,setHasActiveFullPageFlow:O,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:L,defaultAppearance:H,shouldGracefullyDegrade:M,setShouldGracefullyDegrade:N,apiUrl:i&&i.apiUrl?i.apiUrl:_i,readonly:i&&i.readonly?i.readonly:!1};return M?ht.createElement(G.Provider,{value:J},r):ht.createElement(vp,{fallback:ht.createElement(ht.Fragment,null,r)},ht.createElement(G.Provider,{value:J},ht.createElement(Pp,{theme:Bp(H.theme,lr,(i==null?void 0:i.theme)??{})},r,ht.createElement(Li,null))))};import Bd from"react";import ce,{useEffect as xs,useState as hs}from"react";import Oe,{useState as Rp}from"react";import yt from"styled-components";import Ao from"react";import Ct from"react";import Hi from"styled-components";var Wi=Hi.span`
|
|
631
|
+
`;var Bi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let r=e.props,[n,s]=rr([]),[p,d]=rr(!1),[a,h]=rr(e.id);return or(()=>{n.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),or(()=>{a!==e.id&&(h(e.id),s([]))},[e]),or(()=>{o({choice:n}),n.length>=r.minChoices?t(!0):t(!1)},[n]),Ye.createElement(Si,{className:l("selectListContainer",i)},Ye.createElement(bi,null,Ye.createElement(wi,{className:l("selectListTitle",i)},e.title),Ye.createElement(Ti,{appearance:i,className:l("selectListSubtitle",i)},e.subtitle)),r.options.map((c,f)=>{let y=n.includes(c.id);return Ye.createElement(Fi,{key:`select-item-${f}`,onClick:()=>{if(n.includes(c.id)){s(n.filter(T=>T!==c.id));return}n.length<r.maxChoices?s([...n,c.id]):n.length==1&&r.maxChoices==1&&s([c.id])},hideBottomBorder:f===r.options.length-1,className:l("selectListSelectItem",i)},Ye.createElement(ki,{className:l("selectListItemImage",i)},c.imageUri&&Ye.createElement(Pi,{src:c.imageUri,alt:`select-icon-${f}`}),Ye.createElement(vi,{appearance:i,className:l("selectListSelectItemText",i)},c.title)),Ye.createElement(Ke,{appearance:i,value:y,primaryColor:i.theme.colorPrimary}))}))};import Se,{useEffect as ir,useState as Jt}from"react";import{AnimatePresence as Xa,motion as Ja}from"framer-motion";var Qa=({children:e,id:t,shouldWrap:o=!1})=>Se.createElement(Se.Fragment,null,o?Se.createElement(Xa,{initial:!1},Se.createElement(Ja.div,{key:t,initial:{opacity:1,y:"100%"},animate:{opacity:1,y:0},exit:{opacity:0,y:"-100%"},transition:{duration:.5,ease:"easeInOut"},style:{width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:1,overflowY:"auto"}},e)):e),Fo=({appearance:e,steps:t,selectedStep:o,customStepTypes:i,customVariables:r,onButtonClick:n,onStepCompletion:s,flowId:p,type:d,hideOnFlowCompletion:a,onComplete:h,setVisible:c,setShowModal:f,onDismiss:y,showPagination:T=!1,customFormElements:P,allowBackNavigation:g,validationHandler:v})=>{var _;let F={...{linkCollection:Ci,multiInput:li,callToAction:yi,selectList:Bi},...i},{primaryCTAClickSideEffects:I,secondaryCTAClickSideEffects:S}=ae(),[m,w]=Jt(!1),[C,B]=Jt({}),[L,M]=Jt(!1),[N,O]=Jt(!1),[H,$]=Jt(null),X=t[o]??null,{markStepCompleted:ee,markStepStarted:K,isLoading:te,updateCustomVariables:le,markFlowCompleted:J}=R();ir(()=>{le(r)},[r,te]),ir(()=>{window&&g&&!N&&(window.location.hash=t[o].id,O(!0))},[g,N,O]),ir(()=>{var D;if(window&&((D=window==null?void 0:window.location)!=null&&D.hash)&&window.location.hash.replace("#","")!==t[o].id){let re=window.location.hash.replace("#",""),V=t.findIndex(ie=>ie.id===re);V!==-1&&K(p,t[V].id)}},[(_=window==null?void 0:window.location)==null?void 0:_.hash,K,o,t]);function G(){return{data:C[t[o].id]??{},stepId:t[o].id,customVariables:r}}function xe(D,re,V){let ie=o+1<t.length?t[o+1]:null;return s&&s(D,V,ie,C,G()),n?n(D,o,re,ie):!0}function Te(D,re){B(V=>{let ie={};return ie[D.id]=re,{...V,...ie}})}function q(D){return D.selectedStep.imageUri?Se.createElement(fi,{image:D.selectedStep.imageUri,appearance:e,className:l("formContainerSidebarImage",e)}):null}let de=Se.createElement(xi,{step:t[o],canContinue:m&&!L,formType:d,selectedStep:o,appearance:e,onPrimaryClick:async()=>{if(M(!0),v){let V=await v(t[o],o,t[o+1],C,G());if(V){$(V),M(!1);return}else $(null)}let D={...G()};await ee(p,t[o].id,D),o+1<t.length&&await K(p,t[o+1].id);let re=xe(t[o],"primary",o);o+1>=t.length&&(h&&h(),y&&y(),a&&re&&(c&&c(!1),f(!1)),await J(p)),I(t[o]),M(!1),window&&g&&o+1<t.length&&(window.location.hash=t[o+1].id)},onSecondaryClick:()=>{xe(t[o],"secondary",o),S(t[o])},onBack:async()=>{o-1>=0&&(M(!0),await K(p,t[o-1].id),M(!1))},steps:t,allowBackNavigation:g,errorMessage:H});return Se.createElement(Se.Fragment,null,Se.createElement(ci,{className:l("formContainer",e)},Se.createElement(mi,null,Se.createElement(Qa,{id:o,shouldWrap:d==="large-modal"},Se.createElement(ui,{key:X.id,type:d,className:l("formContent",e)},t.map(D=>{let re=F[D.type];return X.id!==D.id?null:Se.createElement(re,{key:D.id,stepData:D,canContinue:m,setCanContinue:w,onSaveData:V=>{Te(D,V)},appearance:e,customFormElements:P,flowId:p})}),T&&Se.createElement(hi,{className:l("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),de))),d=="large-modal"&&Se.createElement(q,{selectedStep:t[o]})))};import Qt from"react";import{createGlobalStyle as Za}from"styled-components";function se({appearance:e}){if(!e||!e.styleOverrides)return Qt.createElement(Qt.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([i,r])=>typeof r=="object");if(t.length===0)return Qt.createElement(Qt.Fragment,null);let o=Za`
|
|
632
|
+
${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map(([s,p])=>`${Wo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return Qt.createElement(o,{inlineStyles:t})}var Ei=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:r,customVariables:n,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:a=!0,onStepCompletion:h,onButtonClick:c,dismissible:f=!0,endFlowOnDismiss:y=!1,modalPosition:T="center",repeatable:P=!1,onDismiss:g,showPagination:v=!1,allowBackNavigation:x=!1,validationHandler:F,showFrigadeBranding:I=!1})=>{let{getFlow:S,getFlowSteps:m,isLoading:w,targetingLogicShouldHideFlow:C,getFlowStatus:B,getCurrentStepIndex:L,markFlowCompleted:M,markFlowNotStarted:N}=R(),O=L(e),{mergeAppearanceWithDefault:H}=oe(),[$,X]=ep(!1),{setOpenFlowState:ee,getOpenFlowState:K,hasOpenModals:te}=Fe();d=H(d);let[le,J]=i!==void 0&&r!==void 0?[i,r]:[K(e,!0),q=>ee(e,q)];if(Ra(()=>{!$&&!w&&(X(!0),B(e)===Z&&P&&N(e),X(!0))},[$,X,w]),w)return null;let G=S(e);if(!G||C(G))return null;let xe=m(e);if(!xe||i!==void 0&&i===!1||B(e)===Z&&a||(o=="modal"||o=="corner-modal")&&te(e))return null;let Te=()=>{J(!1),g&&g(),y===!0&&M(e)};if(T=="center"&&o==="modal"||o==="large-modal"){let q={padding:"24px"};return o==="large-modal"?(q.width="85%",q.height="90%",q.maxHeight="800px",q.minHeight="500px",q.padding="0"):q.width="400px",ze.createElement(tt,{appearance:d,onClose:Te,visible:le,style:q,dismissible:f,showFrigadeBranding:I},ze.createElement(se,{appearance:d}),ze.createElement(Fo,{appearance:d,steps:xe,selectedStep:O,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:J,onDismiss:g,showPagination:v,customFormElements:s,allowBackNavigation:x,validationHandler:F}))}return o==="modal"&&T!=="center"?ze.createElement(jr,{appearance:d,onClose:Te,visible:le},ze.createElement(se,{appearance:d}),ze.createElement(Fo,{appearance:d,steps:xe,selectedStep:O,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:J,onDismiss:g,showPagination:v,customFormElements:s,allowBackNavigation:x,validationHandler:F})):ze.createElement(ze.Fragment,null,ze.createElement(se,{appearance:d}),ze.createElement(Fo,{appearance:d,steps:xe,selectedStep:O,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:h,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:J,onDismiss:g,showPagination:v,customFormElements:s,allowBackNavigation:x,validationHandler:F}))},Ai=Ei;import{useCallback as Ii,useContext as tp,useEffect as op}from"react";function nr(){let{organizationId:e,userId:t,setOrganizationId:o}=tp(j),{mutateUserFlowState:i}=Ee(),{config:r,apiUrl:n}=Me(),s=Ft(),{verifySDKInitiated:p}=kt();op(()=>{if(t&&e){if(t.startsWith(Pt))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 d=Ii(async h=>{if(p(),!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let c={foreignUserId:t,foreignUserGroupId:e,properties:h};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(c)}),i()},[e,t,r,i]),a=Ii(async(h,c)=>{if(p(),!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let y={foreignUserId:t,foreignUserGroupId:e,events:[{event:h,properties:c}]};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(y)}),i()},[e,t,r,i]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:d,trackEventForOrganization:a}}var Ni="frigade-xFrigade_guestUserId",Zt="frigade-xFrigade_userId",Li=({})=>{let{setFlowResponses:e}=Ht(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=Ee(),{userId:r,setUserId:n}=Vt(),[s,p]=sr(null),{getFlowStatus:d}=R(),{flows:a,userProperties:h,setIsNewGuestUser:c,flowResponses:f}=rp(j),[y,T]=sr([]),[P,g]=sr([]),{organizationId:v}=nr();ko(()=>{if(!o&&t)for(let S=0;S<t.length;S++){let m=t[S],w=a.find(C=>C.slug===(m==null?void 0:m.flowId));if(w&&m&&m.shouldTrigger===!0&&w.type=="FORM"&&w.triggerType==="AUTOMATIC"&&!P.includes(w.slug)){setTimeout(()=>{x(m.flowId)},500);break}}},[o,t]),ko(()=>{f.length>0&&i()},[f]);function x(S){let m=a.find(w=>w.slug===S);m&&m.triggerType==="AUTOMATIC"&&!P.includes(m.slug)&&(g([...P,m.slug]),T([m]))}function F(){if(!r){let S=localStorage.getItem(Zt);if(S){n(S);return}let m=localStorage.getItem(Ni);if(m){n(m);return}c(!0);let w=Pt+ip();try{localStorage.setItem(Ni,w)}catch(C){console.log("Failed to save guest user id locally: Local storage unavailable",C)}n(C=>C||w)}}ko(()=>{try{if(a){let S=[];a.forEach(m=>{if(m.data){let w=m.data.match(/"imageUri":"(.*?)"/g);w&&w.forEach(C=>{let B=C.replace('"imageUri":"',"").replace('"',"");if(S.includes(B))return;let L=new Image;L.src=B,S.push(B)})}})}}catch{}},[a]),ko(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(Pt))try{localStorage.setItem(Zt,r)}catch(S){console.log("Failed to save user id locally: Local storage available",S)}r===null&&setTimeout(()=>{r===null&&F()},50)},[r,a,h]);function I(){return xt.createElement(xt.Fragment,null,y.map(S=>d(S.slug)!==Ie?null:xt.createElement("span",{key:S.slug},xt.createElement(Ai,{flowId:S.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return xt.createElement(xt.Fragment,null,xt.createElement(I,null))};import{ErrorBoundary as Np}from"react-error-boundary";import{deepmerge as Lp}from"deepmerge-ts";import{deepmerge as np}from"deepmerge-ts";var Oi={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 sp(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(Oi[o]){let r=Oi[o].split("."),n=t;r.forEach((s,p)=>{n[s]||(n[s]=p===r.length-1?i:{}),n=n[s]})}}),t}function lp(e){if(!e)return;let t=np({},e),o={};return Object.keys(t).forEach(i=>{let r=`.fr-${i}`;o[r]=t[i]}),o}function Di(e){let{theme:t,styleOverrides:o}=e,i=sp(t),r=lp(o);return{overrides:i,css:r}}import wp from"styled-components";import{compose as Tp,variant as Mi}from"styled-system";import $i from"react";import ap,{ThemeProvider as pp,useTheme as dp}from"styled-components";import{border as cp,color as mp,compose as up,get as fp,shadow as gp,space as xp,system as hp,typography as Cp}from"styled-system";import{deepmerge as yp}from"deepmerge-ts";var Sp={width:{property:"width",scale:"sizes",transform:(e,t)=>fp(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},bp=ap("div")(({css:e})=>e,up(cp,mp,gp,xp,Cp,hp(Sp))),Rt=({as:e,children:t,overrides:o,...i})=>{let r=dp(),n={border:"none",boxSizing:"border-box",m:0,p:0},s=()=>$i.createElement(bp,{as:e,...n,...i},t);if(o!==void 0){let p=yp(r,o);return $i.createElement(pp,{theme:p},s())}return s()};var eo={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"}},Fp={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},Ui=wp(Rt)(()=>({whiteSpace:"nowrap"}),Tp(Mi({scale:"components.Button",variants:"components.Button"}),Mi({prop:"size",variants:Fp})));import kp from"styled-components";import{variant as Pp,system as vp}from"styled-system";var Po={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 zi=kp(Rt)(Pp({scale:"components.Text",variants:"components.Text"}),vp({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var _i=4,Wi="px",Bp=20,Ep=Object.fromEntries(Array.from(Array(Bp+1),(e,t)=>t===0?[.5,`${.5*_i}${Wi}`]:[t,`${t*_i}${Wi}`])),It={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"},lr={colors:{...It,neutral:{foreground:It.gray300},primary:{background:It.blue500,foreground:It.white,inverted:It.blue500},negative:{foreground:It.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:Ep,components:{Button:eo,Text:Po}};var Hi="https://api.frigade.com",j=Ap({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:Hi,readonly:!1});function Op(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var Dp=({publicApiKey:e,userId:t,organizationId:o,config:i,children:r})=>{var K,te;let[n,s]=Ae(t||null),[p,d]=Ae(o||null),[a,h]=Ae([]),[c,f]=Ae([]),[y,T]=Ae([]),[P,g]=Ae({}),[v,x]=Ae({}),[F,I]=Ae([]),[S,m]=Ae({}),[w,C]=Ae(!1),[B,L]=Ae(!1),[M,N]=Ae(!$(e)),O=(le,J)=>{if(J==="_blank"){window.open(le,"_blank");return}setTimeout(()=>{window.location.href=le},50)},H={theme:{...qe.theme,...((K=i==null?void 0:i.defaultAppearance)==null?void 0:K.theme)??{}},styleOverrides:{...qe.styleOverrides,...((te=i==null?void 0:i.defaultAppearance)==null?void 0:te.styleOverrides)??{}}};function $(le){return!!(le&&le.length>10&&le.substring(0,10)==="api_public")}vo(()=>{t&&s(t)},[t]),vo(()=>{n&&window&&window.localStorage&&window.localStorage.getItem(Zt)&&window.localStorage.getItem(Zt)!==n&&Op()},[n]),vo(()=>{o&&d(o)},[o]),vo(()=>{if($(e))N(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),N(!0);return}},[e,N]);let X={publicApiKey:e,userId:n,setUserId:s,setFlows:h,flows:a,failedFlowResponses:c,setFailedFlowResponses:f,flowResponses:y,setFlowResponses:T,userProperties:P,setUserProperties:g,openFlowStates:v,setOpenFlowStates:x,completedFlowsToKeepOpenDuringSession:F,setCompletedFlowsToKeepOpenDuringSession:I,customVariables:S,setCustomVariables:m,isNewGuestUser:w,setIsNewGuestUser:C,hasActiveFullPageFlow:B,setHasActiveFullPageFlow:L,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:O,defaultAppearance:H,shouldGracefullyDegrade:M,setShouldGracefullyDegrade:N,apiUrl:i&&i.apiUrl?i.apiUrl:Hi,readonly:i&&i.readonly?i.readonly:!1};if(M)return ht.createElement(j.Provider,{value:X},r);let{overrides:ee}=Di(H);return ht.createElement(Np,{fallback:ht.createElement(ht.Fragment,null,r)},ht.createElement(j.Provider,{value:X},ht.createElement(Ip,{theme:Lp(H.theme,lr,ee??{},(i==null?void 0:i.theme)??{})},r,ht.createElement(Li,null))))};import Ld from"react";import me,{useEffect as Cs,useState as ys}from"react";import Oe,{useState as id}from"react";import St from"styled-components";import Ao from"react";import Ct from"react";import ji from"styled-components";var Vi=ji.span`
|
|
633
633
|
font-weight: 400;
|
|
634
634
|
font-size: 15px;
|
|
635
635
|
line-height: 20px;
|
|
@@ -638,7 +638,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
638
638
|
vertical-align: middle;
|
|
639
639
|
margin-left: 12px;
|
|
640
640
|
padding-right: 12px;
|
|
641
|
-
|
|
641
|
+
`,$p=ji.div`
|
|
642
642
|
flex-direction: row;
|
|
643
643
|
justify-content: space-between;
|
|
644
644
|
display: flex;
|
|
@@ -646,24 +646,24 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
646
646
|
padding-bottom: 20px;
|
|
647
647
|
border-top: 1px solid ${e=>e.theme.colorBorder};
|
|
648
648
|
width: 100%;
|
|
649
|
-
`,Bo=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:r,primaryColor:n="#000000",checkBoxType:s="square",appearance:p})=>Ct.createElement(Ct.Fragment,null,Ct.createElement(
|
|
649
|
+
`,Bo=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:r,primaryColor:n="#000000",checkBoxType:s="square",appearance:p})=>Ct.createElement(Ct.Fragment,null,Ct.createElement($p,{className:l("checklistStepsContainer",p),appearance:p,style:{...r}},i==="left"&&e&&Ct.createElement(Vi,{className:l("checklistStepLabel",p),style:o},e),Ct.createElement(Ke,{appearance:p,value:t,type:s,primaryColor:n}),i==="right"&&e&&Ct.createElement(Vi,{className:l("checklistStepLabel",p),style:o},e)),Ct.createElement(se,{appearance:p}));import{motion as Mp}from"framer-motion";import to from"styled-components";var Gi=to.div`
|
|
650
650
|
font-weight: 700;
|
|
651
651
|
font-size: 18px;
|
|
652
652
|
line-height: 22px;
|
|
653
|
-
`,
|
|
653
|
+
`,qi=to.p`
|
|
654
654
|
font-weight: 700;
|
|
655
655
|
font-size: 18px;
|
|
656
656
|
line-height: 30px;
|
|
657
657
|
margin: 20px 0px 0px 0px;
|
|
658
658
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
659
|
-
`,
|
|
659
|
+
`,Ki=to.p`
|
|
660
660
|
font-weight: 400;
|
|
661
661
|
font-size: 15px;
|
|
662
662
|
line-height: 28px;
|
|
663
663
|
max-width: 540px;
|
|
664
664
|
margin: 8px 0px 0px 0px;
|
|
665
665
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
666
|
-
`,Eo=
|
|
666
|
+
`,Eo=to.div`
|
|
667
667
|
width: 4px;
|
|
668
668
|
position: absolute;
|
|
669
669
|
left: 0;
|
|
@@ -671,21 +671,21 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
671
671
|
height: 80%;
|
|
672
672
|
border-top-right-radius: 8px;
|
|
673
673
|
border-bottom-right-radius: 8px;
|
|
674
|
-
`,
|
|
674
|
+
`,Yi=to.div`
|
|
675
675
|
flex-direction: row;
|
|
676
676
|
justify-content: flex-start;
|
|
677
|
-
`;var
|
|
677
|
+
`;var Xi=({data:e,index:t,isSelected:o,primaryColor:i,style:r,onClick:n,appearance:s})=>{var p,d;return Ao.createElement("div",{style:{position:"relative",paddingLeft:"20px"},onClick:()=>{n()}},o&&Ao.createElement(Eo,{className:l("checklistStepItemSelectedIndicator",s),as:Mp.div,layoutId:"checklis-step-selected",style:{backgroundColor:((p=s==null?void 0:s.theme)==null?void 0:p.colorPrimary)??i}}),Ao.createElement(Yi,{className:l("checklistStepItem",s),key:`hero-checklist-step-${t}`,role:"listitem"},Ao.createElement(Bo,{value:e.complete,labelPosition:"left",label:e.stepName,style:r,primaryColor:((d=s==null?void 0:s.theme)==null?void 0:d.colorPrimary)??i,appearance:s})))};import yt from"react";import{motion as Up}from"framer-motion";import ar from"styled-components";var zp={backgroundColor:"#E6E6E6"},_p=ar.div`
|
|
678
678
|
display: flex;
|
|
679
679
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
680
680
|
justify-content: flex-start;
|
|
681
681
|
align-items: ${e=>e.textLocation=="top"?"flex-end":"center"};
|
|
682
682
|
|
|
683
683
|
${e=>Ge(e)}
|
|
684
|
-
|
|
684
|
+
`,Wp=ar.div`
|
|
685
685
|
flex-grow: 1;
|
|
686
686
|
position: relative;
|
|
687
687
|
${e=>e.textLocation=="top"?"width: 100%;":""}
|
|
688
|
-
`,
|
|
688
|
+
`,Hp=ar.span`
|
|
689
689
|
font-weight: 500;
|
|
690
690
|
font-size: 15px;
|
|
691
691
|
line-height: 18px;
|
|
@@ -693,13 +693,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
693
693
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
694
694
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
695
695
|
${e=>Ge(e)}
|
|
696
|
-
`,
|
|
696
|
+
`,Vp={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},jp={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},_e=({count:e,total:t,fillColor:o,bgColor:i=zp.backgroundColor,display:r="count",textLocation:n="left",style:s={},textStyle:p={},appearance:d})=>{var T,P;if(t===0)return yt.createElement(yt.Fragment,null);let a=e===0?"10px":`${e/t*100}%`,h=r==="compact"?"5px":"10px",c=Math.round(e/t*100),f=r==="compact"?"5px":"20px",y;return r==="count"?y=`${e} of ${t}`:r==="compact"?y=`${c}%`:r==="percent"&&(y=`${c}% complete`),n==="top"&&(f="0px"),yt.createElement(_p,{className:l("progressBarContainer",d),textLocation:n,styleOverrides:s},yt.createElement(Hp,{className:l("progressBarStepText",d),style:{...p,fontSize:r==="compact"?12:15,fontWeight:r==="compact"?400:500},appearance:d,padding:f,textLocation:n},y),yt.createElement(Wp,{textLocation:n,className:l("progressBar",d)},yt.createElement(Up.div,{style:{...jp,width:a,height:h,backgroundColor:((T=d==null?void 0:d.theme)==null?void 0:T.colorPrimary)??o,zIndex:r=="compact"?1:5},className:l("progressBarFill",d)}),yt.createElement("div",{className:l("progressBarBackground",d),style:{...Vp,height:h,backgroundColor:((P=d==null?void 0:d.theme)==null?void 0:P.colorSecondary)??i}})))};import oo from"react";import qp from"styled-components";import No from"react";import Io from"react";var Nt=({stepData:e,appearance:t})=>Io.createElement(Io.Fragment,null,Io.createElement(qi,{appearance:t,className:l("checklistStepTitle",t),dangerouslySetInnerHTML:ue(e.title)}),Io.createElement(Ki,{appearance:t,className:l("checklistStepSubtitle",t),dangerouslySetInnerHTML:ue(e.subtitle)}));import pr from"react";var Lt=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},i=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return pr.createElement(So,{className:l("ctaContainer",t)},e.secondaryButtonTitle&&pr.createElement(ne,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:i,style:{width:"auto",marginRight:"12px"}}),pr.createElement(ne,{appearance:t,title:e.primaryButtonTitle,onClick:o}))};var Ot=({stepData:e,appearance:t})=>No.createElement(No.Fragment,null,No.createElement(Nt,{stepData:e,appearance:t}),No.createElement(Lt,{stepData:e,appearance:t}));import Gp from"react";function Ji(e){return Gp.createElement(st,{appearance:e.appearance,videoUri:e.videoUri})}var dr="default",Kp=qp.img`
|
|
697
697
|
border-radius: 4px;
|
|
698
698
|
max-height: 260px;
|
|
699
699
|
min-height: 200px;
|
|
700
|
-
`,
|
|
700
|
+
`,Qi=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return oo.createElement("div",null,o)}return oo.createElement(Gi,{className:l("checklistStepContent",t)},e.imageUri?oo.createElement(Kp,{className:l("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?oo.createElement(Ji,{videoUri:e.videoUri,appearance:t}):null,oo.createElement(Ot,{stepData:e,appearance:t}))};import Pe,{useRef as Yp,useState as Xp}from"react";import Dt from"styled-components";var Zi=Dt.div`
|
|
701
701
|
display: block;
|
|
702
|
-
`,
|
|
702
|
+
`,Jp=Dt.div`
|
|
703
703
|
display: flex;
|
|
704
704
|
flex-direction: row;
|
|
705
705
|
flex-wrap: wrap;
|
|
@@ -709,20 +709,20 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
709
709
|
align-content: center;
|
|
710
710
|
margin-top: 24px;
|
|
711
711
|
margin-bottom: 24px;
|
|
712
|
-
`,
|
|
712
|
+
`,Qp=Dt.div`
|
|
713
713
|
display: flex;
|
|
714
714
|
align-items: center;
|
|
715
715
|
justify-content: flex-start;
|
|
716
716
|
flex-direction: column;
|
|
717
717
|
margin-right: 16px;
|
|
718
|
-
`,
|
|
718
|
+
`,Zp=Dt.video`
|
|
719
719
|
width: 200px;
|
|
720
720
|
height: 120px;
|
|
721
|
-
`,
|
|
721
|
+
`,Rp=Dt.div`
|
|
722
722
|
font-size: 14px;
|
|
723
723
|
line-height: 20px;
|
|
724
724
|
text-align: center;
|
|
725
|
-
`,
|
|
725
|
+
`,ed=Dt.div`
|
|
726
726
|
position: absolute;
|
|
727
727
|
width: 200px;
|
|
728
728
|
height: 120px;
|
|
@@ -742,9 +742,9 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
742
742
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
743
743
|
border-radius: 50%;
|
|
744
744
|
}
|
|
745
|
-
`,
|
|
745
|
+
`,Ri="videoCarousel",en=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return Pe.createElement(Zi,null,Pe.createElement(Ot,{stepData:e,appearance:t}));function o({video:n}){let s=Yp(),[p,d]=Xp(!1);return Pe.createElement(Qp,null,!p&&Pe.createElement(ed,{onClick:()=>{d(!0),s.current.play()},appearance:t},Pe.createElement(bo,null)),Pe.createElement(Zp,{controls:p,ref:s,play:p,src:n.uri}),Pe.createElement(Rp,null,n.title))}let i=e.props;return i.videos?Pe.createElement(Zi,null,Pe.createElement(Nt,{stepData:e,appearance:t}),Pe.createElement(Jp,null,i.videos.map((n,s)=>Pe.createElement("span",{key:`${n.uri}-${s}`},Pe.createElement(o,{video:n})))),Pe.createElement(Lt,{stepData:e,appearance:t})):null};import Xe from"react";import Lo from"styled-components";var tn=Lo.div`
|
|
746
746
|
display: block;
|
|
747
|
-
`,
|
|
747
|
+
`,td=Lo.pre`
|
|
748
748
|
display: block;
|
|
749
749
|
background-color: #2a2a2a;
|
|
750
750
|
color: #f8f8f8;
|
|
@@ -760,68 +760,68 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
760
760
|
white-space: -o-pre-wrap; /* Opera 7 */
|
|
761
761
|
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
|
762
762
|
margin-bottom: 24px;
|
|
763
|
-
`,
|
|
763
|
+
`,od=Lo.div`
|
|
764
764
|
font-size: 15px;
|
|
765
765
|
line-height: 20px;
|
|
766
766
|
margin-bottom: 12px;
|
|
767
767
|
margin-top: 12px;
|
|
768
|
-
`,
|
|
768
|
+
`,rd=Lo.div`
|
|
769
769
|
margin-top: 24px;
|
|
770
|
-
`,
|
|
770
|
+
`,on="codeSnippet",rn=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.codeSnippets))return Xe.createElement(tn,null,Xe.createElement(Ot,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?Xe.createElement(tn,null,Xe.createElement(Nt,{stepData:e,appearance:t}),Xe.createElement(rd,null,o.codeSnippets.map((r,n)=>Xe.createElement("div",{key:n},r.title?Xe.createElement(od,null,r.title):null,r.code?Xe.createElement(td,null,r.code):null))),Xe.createElement(Lt,{stepData:e,appearance:t})):null};var nd=St.div`
|
|
771
771
|
display: flex;
|
|
772
772
|
flex-direction: row;
|
|
773
773
|
min-width: ${e=>e.type!="modal"?"1000px":"100%"};
|
|
774
774
|
background: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
775
775
|
box-shadow: ${e=>e.type!="modal"?"0px 6px 25px rgba(0, 0, 0, 0.06)":"none"};
|
|
776
776
|
border-radius: 8px;
|
|
777
|
-
`,
|
|
777
|
+
`,sd=St.h1`
|
|
778
778
|
font-size: 24px;
|
|
779
779
|
font-weight: 600;
|
|
780
780
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
781
|
-
`,
|
|
781
|
+
`,ld=St.h2`
|
|
782
782
|
font-size: 15px;
|
|
783
783
|
line-height: 28px;
|
|
784
784
|
color: ${e=>{var t,o;return((o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary)??"#4d4d4d"}};
|
|
785
785
|
margin: 10px 0px 0px 0px;
|
|
786
|
-
`,
|
|
786
|
+
`,nn=St.div`
|
|
787
787
|
padding-bottom: 16px;
|
|
788
|
-
`,
|
|
788
|
+
`,ad=St.div`
|
|
789
789
|
list-style: none;
|
|
790
790
|
padding: 0;
|
|
791
791
|
margin: 0;
|
|
792
792
|
cursor: pointer;
|
|
793
793
|
width: 300px;
|
|
794
|
-
`,
|
|
794
|
+
`,pd=St.div`
|
|
795
795
|
width: 1px;
|
|
796
796
|
margin: 40px;
|
|
797
797
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
798
|
-
`,
|
|
798
|
+
`,dd=St.div`
|
|
799
799
|
flex: 2;
|
|
800
800
|
padding: 2rem;
|
|
801
|
-
`,
|
|
801
|
+
`,cd=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:r,setSelectedStep:n,className:s="",customStepTypes:p=new Map,appearance:d,type:a})=>{let{mergeAppearanceWithDefault:h}=oe();d=h(d);let f={...{[dr]:Qi,[Ri]:en,[on]:rn},...p},[y,T]=id(0),P=r??y,g=n??T,v=o.filter(F=>F.complete===!0).length,x=()=>{var F;return!((F=o[P])!=null&&F.type)||!f[o[P].type]?f[dr]({stepData:o[P],appearance:d}):f[o[P].type]({stepData:o[P],appearance:d})};return Oe.createElement(nd,{type:a,style:i,className:s,appearance:d},Oe.createElement(nn,{style:{flex:1}},Oe.createElement(nn,{style:{padding:"30px 0px 30px 30px",borderBottom:"none"}},Oe.createElement(sd,{className:l("checklistTitle",d),appearance:d},e),Oe.createElement(ld,{className:l("checklistSubtitle",d),appearance:d},t),Oe.createElement(_e,{total:o.length,count:v,fillColor:d.theme.colorPrimary,style:{marginTop:"24px"},appearance:d})),Oe.createElement(ad,{className:l("checklistStepsContainer",d)},o.map((F,I)=>Oe.createElement(Xi,{data:F,index:I,key:I,listLength:o.length,isSelected:I===P,primaryColor:d.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{g(I)}})))),Oe.createElement(pd,{appearance:d,className:l("checklistDivider",d)}),Oe.createElement(dd,null,Oe.createElement(x,null)))},cr=cd;import z,{useState as hd}from"react";import sn from"react";import md from"styled-components";var ud=md.svg`
|
|
802
802
|
transition: 'transform 0.35s ease-in-out';
|
|
803
|
-
`,$t=({color:e="#323232",style:t,className:o})=>
|
|
803
|
+
`,$t=({color:e="#323232",style:t,className:o})=>sn.createElement(ud,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},sn.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as Cd}from"framer-motion";import fe from"styled-components";var mr={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},ln=fe.div`
|
|
804
804
|
max-height: 350px;
|
|
805
805
|
padding-bottom: 40px;
|
|
806
|
-
`,
|
|
806
|
+
`,an=fe.div`
|
|
807
807
|
display: flex;
|
|
808
808
|
flex-direction: column;
|
|
809
809
|
margin-top: 20px;
|
|
810
|
-
`,
|
|
810
|
+
`,pn=fe.h1`
|
|
811
811
|
font-style: normal;
|
|
812
812
|
font-weight: 600;
|
|
813
813
|
font-size: 30px;
|
|
814
814
|
line-height: 36px;
|
|
815
815
|
margin-bottom: 16px;
|
|
816
816
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
817
|
-
`,
|
|
817
|
+
`,dn=fe.h2`
|
|
818
818
|
font-weight: 400;
|
|
819
819
|
font-size: 16px;
|
|
820
820
|
line-height: 20px;
|
|
821
821
|
margin-bottom: 16px;
|
|
822
822
|
padding-left: 1px;
|
|
823
823
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
824
|
-
`,
|
|
824
|
+
`,cn=fe.div`
|
|
825
825
|
${e=>k(e)} {
|
|
826
826
|
border: 1px solid #fafafa;
|
|
827
827
|
}
|
|
@@ -831,11 +831,11 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
831
831
|
flex-direction: column;
|
|
832
832
|
min-height: 240px;
|
|
833
833
|
overflow: hidden;
|
|
834
|
-
`,
|
|
834
|
+
`,mn=fe.div`
|
|
835
835
|
display: flex;
|
|
836
836
|
flex-direction: row;
|
|
837
837
|
justify-content: space-between;
|
|
838
|
-
`,
|
|
838
|
+
`,un=fe.p`
|
|
839
839
|
${e=>k(e)} {
|
|
840
840
|
font-weight: 400;
|
|
841
841
|
font-size: 10px;
|
|
@@ -844,12 +844,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
844
844
|
color: #8c8c8c;
|
|
845
845
|
margin: 20px;
|
|
846
846
|
}
|
|
847
|
-
`,
|
|
847
|
+
`,fn=fe.div`
|
|
848
848
|
display: flex;
|
|
849
849
|
flex-direction: row;
|
|
850
|
-
`,
|
|
850
|
+
`,gn=fe.div`
|
|
851
851
|
flex: 1;
|
|
852
|
-
`,
|
|
852
|
+
`,xn=fe.div`
|
|
853
853
|
${e=>k(e)} {
|
|
854
854
|
display: flex;
|
|
855
855
|
justify-content: center;
|
|
@@ -859,7 +859,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
859
859
|
padding-left: 8px;
|
|
860
860
|
padding-right: 8px;
|
|
861
861
|
}
|
|
862
|
-
`,
|
|
862
|
+
`,hn=fe.p`
|
|
863
863
|
${e=>k(e)} {
|
|
864
864
|
font-style: normal;
|
|
865
865
|
font-weight: 600;
|
|
@@ -871,7 +871,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
871
871
|
margin-top: 20px;
|
|
872
872
|
margin-bottom: 16px;
|
|
873
873
|
}
|
|
874
|
-
`,
|
|
874
|
+
`,Cn=fe.p`
|
|
875
875
|
${e=>k(e)} {
|
|
876
876
|
font-weight: 400;
|
|
877
877
|
font-size: 14px;
|
|
@@ -880,14 +880,14 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
880
880
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
881
881
|
margin-bottom: 8px;
|
|
882
882
|
}
|
|
883
|
-
`,
|
|
883
|
+
`,yn=fe.div`
|
|
884
884
|
${e=>k(e)} {
|
|
885
885
|
display: flex;
|
|
886
886
|
flex-direction: row;
|
|
887
887
|
justify-content: center;
|
|
888
888
|
gap: 8px;
|
|
889
889
|
}
|
|
890
|
-
`,
|
|
890
|
+
`,Sn=fe.div`
|
|
891
891
|
${e=>k(e)} {
|
|
892
892
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
893
893
|
background-color: ${e=>e.selected?"#FAFAFA":"#FFFFFF"};
|
|
@@ -907,7 +907,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
907
907
|
justify-content: space-between;
|
|
908
908
|
position: relative;
|
|
909
909
|
cursor: pointer;
|
|
910
|
-
`,
|
|
910
|
+
`,bn=fe.p`
|
|
911
911
|
${e=>k(e)} {
|
|
912
912
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
913
913
|
color: ${e=>e.selected?"#434343":"#BFBFBF"};
|
|
@@ -916,12 +916,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
916
916
|
font-size: 14px;
|
|
917
917
|
line-height: 22px;
|
|
918
918
|
margin: 0;
|
|
919
|
-
`,
|
|
919
|
+
`,wn=fe.div`
|
|
920
920
|
display: flex;
|
|
921
921
|
flex-direction: row;
|
|
922
922
|
justify-content: flex-end;
|
|
923
923
|
align-content: center;
|
|
924
|
-
`,
|
|
924
|
+
`,Tn=fe.div`
|
|
925
925
|
display: flex;
|
|
926
926
|
flex: 1;
|
|
927
927
|
flex-direction: row;
|
|
@@ -929,14 +929,14 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
929
929
|
align-content: center;
|
|
930
930
|
align-items: center;
|
|
931
931
|
margin-right: 20px;
|
|
932
|
-
`,
|
|
932
|
+
`,Fn=fe.div`
|
|
933
933
|
display: block;
|
|
934
934
|
width: 100%;
|
|
935
|
-
`;import
|
|
935
|
+
`;import fd from"styled-components";var kn=fd.div`
|
|
936
936
|
flex-direction: column;
|
|
937
937
|
justify-content: center;
|
|
938
938
|
display: flex;
|
|
939
|
-
`;import Qe from"react";import{motion as
|
|
939
|
+
`;import Qe from"react";import{motion as gd}from"framer-motion";import Je from"styled-components";var Pn=Je.div`
|
|
940
940
|
border: 1px solid #fafafa;
|
|
941
941
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
942
942
|
border-radius: 14px;
|
|
@@ -944,13 +944,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
944
944
|
display: flex;
|
|
945
945
|
flex-direction: column;
|
|
946
946
|
overflow: hidden;
|
|
947
|
-
`,
|
|
947
|
+
`,vn=Je.div`
|
|
948
948
|
display: flex;
|
|
949
949
|
flex-wrap: wrap;
|
|
950
950
|
justify-content: space-between;
|
|
951
951
|
overflow: hidden;
|
|
952
952
|
row-gap: 10px;
|
|
953
|
-
`,
|
|
953
|
+
`,Bn=Je.div`
|
|
954
954
|
${e=>k(e)} {
|
|
955
955
|
color: #595959;
|
|
956
956
|
}
|
|
@@ -960,7 +960,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
960
960
|
line-height: 12px;
|
|
961
961
|
letter-spacing: 0.09em;
|
|
962
962
|
margin-bottom: 12px;
|
|
963
|
-
`,
|
|
963
|
+
`,En=Je.div`
|
|
964
964
|
${e=>k(e)} {
|
|
965
965
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
966
966
|
background: #ffffff;
|
|
@@ -973,7 +973,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
973
973
|
|
|
974
974
|
max-width: 150px;
|
|
975
975
|
min-width: 200px;
|
|
976
|
-
`,
|
|
976
|
+
`,An=Je.div`
|
|
977
977
|
${e=>k(e)} {
|
|
978
978
|
background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);
|
|
979
979
|
}
|
|
@@ -985,13 +985,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
985
985
|
justify-content: center;
|
|
986
986
|
align-content: center;
|
|
987
987
|
align-items: center;
|
|
988
|
-
`,
|
|
988
|
+
`,In=Je.div`
|
|
989
989
|
font-weight: 600;
|
|
990
990
|
font-size: 20px;
|
|
991
991
|
line-height: 24px;
|
|
992
992
|
width: 20px;
|
|
993
993
|
height: 20px;
|
|
994
|
-
`,
|
|
994
|
+
`,Nn=Je.div`
|
|
995
995
|
${e=>k(e)} {
|
|
996
996
|
color: #434343;
|
|
997
997
|
}
|
|
@@ -1000,20 +1000,20 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1000
1000
|
line-height: 17px;
|
|
1001
1001
|
margin-top: 12px;
|
|
1002
1002
|
margin-bottom: 8px;
|
|
1003
|
-
`,
|
|
1003
|
+
`,Ln=Je.div`
|
|
1004
1004
|
${e=>k(e)} {
|
|
1005
1005
|
color: #8c8c8c;
|
|
1006
1006
|
}
|
|
1007
1007
|
font-weight: 400;
|
|
1008
1008
|
font-size: 12px;
|
|
1009
1009
|
line-height: 14px;
|
|
1010
|
-
`,
|
|
1010
|
+
`,On=Je.a`
|
|
1011
1011
|
color: ${e=>e.color};
|
|
1012
1012
|
font-size: 12px;
|
|
1013
1013
|
line-height: 14px;
|
|
1014
1014
|
font-weight: 400;
|
|
1015
1015
|
cursor: pointer;
|
|
1016
|
-
`;var
|
|
1016
|
+
`;var xd=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=ae();return Qe.createElement(Pn,{style:t,className:l("guideContainer",r)},Qe.createElement(Bn,{className:l("guideTitle",r)},o),Qe.createElement(vn,{className:l("guideItemContainer",r)},e.map((p,d)=>Qe.createElement(En,{key:`guide-${p.id??d}`,as:gd.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:l("guideItem",r)},p.icon&&Qe.createElement(An,{className:l("guideIcon",r)},Qe.createElement(In,null,p.icon)),Qe.createElement(Nn,{className:l("guideItemTitle",r),dangerouslySetInnerHTML:ue(p.title)}),Qe.createElement(Ln,{className:l("guideItemSubtitle",r),dangerouslySetInnerHTML:ue(p.subtitle)}),Qe.createElement(On,{className:l("guideItemLink",r),color:i,onClick:()=>{p.primaryButtonUri&&s(p),n&&n(p)}},p.primaryButtonTitle)))))},ro=xd;var yd=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:r,onClose:n,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:a,guideData:h,guideTitle:c,onGuideButtonClick:f})=>{let y=({stepData:m,handleSecondaryCTAClick:w,handleCTAClick:C})=>m?z.createElement(xn,{className:l("checklistStepContainer",a),"data-testid":"checklistStepContainer"},z.createElement(hn,{appearance:a,className:l("checklistStepTitle",a),dangerouslySetInnerHTML:ue(m.title)}),z.createElement(Cn,{appearance:a,className:l("checklistStepSubtitle",a),dangerouslySetInnerHTML:ue(m.subtitle)}),z.createElement(yn,{className:l("checklistCTAContainer",a)},m.secondaryButtonTitle&&z.createElement(ne,{title:m.secondaryButtonTitle,onClick:w,appearance:a,secondary:!0}),z.createElement(ne,{title:m.primaryButtonTitle,onClick:C,appearance:a}))):z.createElement(z.Fragment,null),P={...{default:m=>{var L;if((L=e[x])!=null&&L.StepContent){let M=e[x].StepContent;return z.createElement("div",null,M)}let w=e[x];return z.createElement(y,{stepData:m,handleCTAClick:()=>{w.handlePrimaryButtonClick&&w.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{w.handleSecondaryButtonClick&&w.handleSecondaryButtonClick()}})}},...d},[g,v]=hd(0),x=s??g,F=p??v,I=()=>{var m;return e?!((m=e[x])!=null&&m.type)||!P[e[x].type]?P.default(e[x]):P[e[x].type]({stepData:e[x],primaryColor:a.theme.colorPrimary}):z.createElement(z.Fragment,null)},S=e.filter(m=>m.complete).length;return r?(a.theme.modalContainer||(a.theme.borderRadius&&(mr.borderRadius=a.theme.borderRadius+"px"),a.theme.modalContainer=mr),z.createElement(tt,{onClose:n,visible:r,appearance:a},z.createElement(Fn,null,z.createElement(an,null,z.createElement(pn,{appearance:a,className:l("checklistTitle",a)},t),z.createElement(dn,{appearance:a,className:l("checklistSubtitle",a)},o)),z.createElement(ln,null,e&&e.length>0&&z.createElement(cn,{className:l("stepsContainer",a)},z.createElement(mn,null,z.createElement("div",{style:{flex:3}},z.createElement(un,{className:l("stepsTitle",a)},i)),z.createElement(Tn,null,z.createElement(_e,{fillColor:a.theme.colorPrimary,style:{width:"100%"},count:S,total:e.length,appearance:a}))),z.createElement(fn,null,z.createElement(gn,{className:l("checklistStepListContainer",a),appearance:a},e.map((m,w)=>{let C=x===w;return z.createElement(Sn,{selected:C,className:l(`checklistStepListItem${C?"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},C&&z.createElement(Eo,{className:l("checklistStepItemSelectedIndicator",a),as:Cd.div,layoutId:"checklist-step-selected",style:{backgroundColor:a.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),z.createElement(bn,{selected:C,className:l(`checklistStepListStepName${C?"Selected":""}`,a)},m.stepName),z.createElement(wn,null,z.createElement(Ke,{value:m.complete,type:"round",primaryColor:a.theme.colorPrimary,progress:m.progress,appearance:a}),z.createElement(kn,null,z.createElement($t,{style:{marginLeft:"10px"},color:a.theme.colorBackgroundSecondary}))))})),z.createElement(I,null))),h&&h.length>0&&z.createElement(ro,{steps:h,title:c,primaryColor:a.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:a,onButtonClick:m=>(f&&f(m),!0)}))))):z.createElement(z.Fragment,null)},ur=yd;import{useEffect as Sd,useState as bd}from"react";var Dn=()=>{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]=bd(t),r=null,n=()=>{r!==null?clearTimeout(r):s(),r=setTimeout(()=>{s()},16)},s=()=>{let p=Object.fromEntries(Object.entries(e).map(([d,a])=>{if(!window)return[d,!1];let h=window.matchMedia(a);return h.addEventListener("change",n),[d,h.matches]}));i(p)};return Sd(()=>{s()},[]),o};import we,{useEffect as Jn,useState as Fd}from"react";import ge from"react";import{AnimatePresence as wd,motion as Td}from"framer-motion";import Ze from"styled-components";var $n=Ze.div`
|
|
1017
1017
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1018
1018
|
border: 1px solid;
|
|
1019
1019
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -1025,42 +1025,42 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1025
1025
|
display: flex;
|
|
1026
1026
|
flex-direction: column;
|
|
1027
1027
|
transition: max-height 0.25s;
|
|
1028
|
-
`,
|
|
1028
|
+
`,Mn=Ze.div`
|
|
1029
1029
|
display: flex;
|
|
1030
1030
|
margin-bottom: 20px;
|
|
1031
|
-
|
|
1031
|
+
`,Un=Ze.img`
|
|
1032
1032
|
border-radius: 4px;
|
|
1033
1033
|
max-height: 260px;
|
|
1034
1034
|
min-height: 200px;
|
|
1035
|
-
`,
|
|
1035
|
+
`,zn=Ze.div`
|
|
1036
1036
|
display: flex;
|
|
1037
1037
|
flex-direction: row;
|
|
1038
1038
|
justify-content: space-between;
|
|
1039
1039
|
align-items: center;
|
|
1040
|
-
`,
|
|
1040
|
+
`,_n=Ze.p`
|
|
1041
1041
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1042
1042
|
font-style: normal;
|
|
1043
1043
|
font-weight: 500;
|
|
1044
1044
|
font-size: 16px;
|
|
1045
1045
|
line-height: 18px;
|
|
1046
1046
|
margin-left: 8px;
|
|
1047
|
-
`,
|
|
1047
|
+
`,Wn=Ze.div`
|
|
1048
1048
|
padding: 20px;
|
|
1049
1049
|
cursor: pointer;
|
|
1050
1050
|
:hover {
|
|
1051
1051
|
opacity: 0.8;
|
|
1052
1052
|
}
|
|
1053
|
-
`,
|
|
1053
|
+
`,QC=Ze.div``,Hn=Ze.p`
|
|
1054
1054
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1055
1055
|
font-weight: 400;
|
|
1056
1056
|
font-size: 14px;
|
|
1057
1057
|
line-height: 22px;
|
|
1058
|
-
`,
|
|
1058
|
+
`,Vn=Ze.div`
|
|
1059
1059
|
display: flex;
|
|
1060
1060
|
flex-direction: row;
|
|
1061
1061
|
justify-content: flex-start;
|
|
1062
1062
|
align-items: center;
|
|
1063
|
-
`;var
|
|
1063
|
+
`;var jn=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:r,appearance:n,customStepTypes:s})=>{var h,c;let p=t?{}:{transform:"rotate(90deg)"};function d(){return ge.createElement(ge.Fragment,null,e.imageUri||e.videoUri?ge.createElement(Mn,{className:l("stepMediaContainer",n)},e.imageUri?ge.createElement(Un,{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(Hn,{className:l("stepSubtitle",n),appearance:n,dangerouslySetInnerHTML:ue(e.subtitle)}),ge.createElement(So,{className:l("checklistCTAContainer",n)},e.secondaryButtonTitle?ge.createElement(ne,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>r(),appearance:n}):null,ge.createElement(ne,{title:e.primaryButtonTitle??"Continue",onClick:()=>i(),appearance:n})))}function a(){if(!s)return null;let f=s[e.type];return f?f(e,n):null}return ge.createElement($n,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:l("checklistStepContainer",n),appearance:n},ge.createElement(zn,{className:l("stepHeader",n)},ge.createElement(Vn,null,ge.createElement(Bo,{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(_n,{appearance:n,className:l("stepTitle",n),dangerouslySetInnerHTML:ue(e.title)})),ge.createElement(Wn,{className:l("stepChevronContainer",n),onClick:()=>o()},ge.createElement($t,{style:{...p,transition:"transform 0.1s ease-in-out"},color:(c=n==null?void 0:n.theme)==null?void 0:c.colorTextSecondary}))),ge.createElement(wd,null,!t&&ge.createElement(Td.div,{initial:{opacity:1,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:1,height:0},key:e.id,style:{overflow:"hidden"}},a()??d())))};import Mt from"styled-components";var c0=Mt.div`
|
|
1064
1064
|
background: #ffffff;
|
|
1065
1065
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
1066
1066
|
border-radius: 6px;
|
|
@@ -1074,48 +1074,48 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1074
1074
|
|
|
1075
1075
|
max-width: 800px;
|
|
1076
1076
|
min-width: 350px;
|
|
1077
|
-
`,
|
|
1077
|
+
`,Gn=Mt.div`
|
|
1078
1078
|
display: flex;
|
|
1079
1079
|
flex-direction: column;
|
|
1080
|
-
`,
|
|
1080
|
+
`,qn=Mt.h1`
|
|
1081
1081
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1082
1082
|
font-style: normal;
|
|
1083
1083
|
font-weight: 700;
|
|
1084
1084
|
font-size: 20px;
|
|
1085
1085
|
line-height: 24px;
|
|
1086
1086
|
margin-bottom: 8px;
|
|
1087
|
-
`,
|
|
1087
|
+
`,Kn=Mt.h2`
|
|
1088
1088
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
1089
1089
|
font-weight: 400;
|
|
1090
1090
|
font-size: 14px;
|
|
1091
1091
|
line-height: 23px;
|
|
1092
1092
|
margin: 2px 0 0 0;
|
|
1093
|
-
`,
|
|
1093
|
+
`,Yn=Mt.div`
|
|
1094
1094
|
display: block;
|
|
1095
1095
|
width: 100%;
|
|
1096
|
-
`,
|
|
1096
|
+
`,Xn=Mt.div`
|
|
1097
1097
|
display: flex;
|
|
1098
1098
|
width: 100%;
|
|
1099
1099
|
flex-direction: column;
|
|
1100
1100
|
justify-content: space-between;
|
|
1101
1101
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1102
|
-
`;var
|
|
1102
|
+
`;var kd=({title:e,subtitle:t,steps:o,onClose:i,visible:r,autoExpandFirstIncompleteStep:n=!0,autoCollapse:s=!0,autoExpandNextStep:p=!0,primaryColor:d="#000000",selectedStep:a,setSelectedStep:h,appearance:c,type:f,className:y,customStepTypes:T,style:P})=>{let g=o.filter(m=>m.complete).length,[v,x]=Fd(Array(o.length).fill(!0));Jn(()=>{let m=[...v];if(n){for(let w=0;w<o.length;w++)if(!o[w].complete){m[w]=!1;break}x(m)}},[]),Jn(()=>{F(a)},[a]);let F=m=>{let w=[...v];if(s)for(let C=0;C<v.length;++C)C!==m&&(w[C]=!0);w[m]=!w[m],x(w)};if(!r&&f=="modal")return we.createElement(we.Fragment,null);let I=we.createElement(we.Fragment,null,we.createElement(Gn,null,we.createElement(qn,{appearance:c,className:l("checklistTitle",c),dangerouslySetInnerHTML:ue(e)}),we.createElement(Kn,{appearance:c,className:l("checklistSubtitle",c),dangerouslySetInnerHTML:ue(t)})),we.createElement(_e,{display:"percent",count:g,total:o.length,fillColor:d,style:{margin:"14px 0px 8px 0px"},appearance:c})),S=we.createElement(Yn,{className:Ce(l("checklistContainer",c),y)},o.map((m,w)=>{let C=v[w];return we.createElement(jn,{appearance:c,stepData:m,collapsed:C,key:`modal-checklist-${m.id??w}`,onClick:()=>{if(a===w){F(w);return}h(w)},onPrimaryButtonClick:()=>{m.handlePrimaryButtonClick&&m.handlePrimaryButtonClick(),p&&!m.completionCriteria&&w<v.length-1&&v[w+1]&&h(w+1)},onSecondaryButtonClick:()=>{m.handleSecondaryButtonClick&&m.handleSecondaryButtonClick()},customStepTypes:T})}));return f==="inline"?we.createElement(Xn,{appearance:c,className:Ce(l("checklistInlineContainer",c),y),style:P},I,S):we.createElement(we.Fragment,null,we.createElement(tt,{onClose:i,visible:r,appearance:c,style:{maxWidth:"600px"},headerContent:I},S))},fr=kd;import pe,{useEffect as gr,useRef as Id,useState as bt}from"react";import Ut from"react";import ce,{css as Qn,keyframes as Zn}from"styled-components";var Rn=Qn`
|
|
1103
1103
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1104
|
-
`,
|
|
1104
|
+
`,Pd=Qn`
|
|
1105
1105
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
1106
|
-
`,
|
|
1106
|
+
`,vd=Zn`
|
|
1107
1107
|
from {
|
|
1108
1108
|
opacity: 0;
|
|
1109
1109
|
} to {
|
|
1110
1110
|
opacity: 1;
|
|
1111
1111
|
}
|
|
1112
|
-
`,
|
|
1112
|
+
`,Bd=Zn`
|
|
1113
1113
|
from {
|
|
1114
1114
|
opacity: 1;
|
|
1115
1115
|
} to {
|
|
1116
1116
|
opacity: 0;
|
|
1117
1117
|
}
|
|
1118
|
-
`,
|
|
1118
|
+
`,es=ce.div`
|
|
1119
1119
|
margin: 0 -20px;
|
|
1120
1120
|
overflow-x: auto;
|
|
1121
1121
|
padding-left: 20px;
|
|
@@ -1132,14 +1132,14 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1132
1132
|
::-webkit-scrollbar {
|
|
1133
1133
|
display: none;
|
|
1134
1134
|
}
|
|
1135
|
-
`,
|
|
1135
|
+
`,ts=ce.div`
|
|
1136
1136
|
display: flex;
|
|
1137
1137
|
flex-flow: row nowrap;
|
|
1138
1138
|
gap: 0 16px;
|
|
1139
1139
|
scroll-snap-align: center;
|
|
1140
1140
|
scroll-snap-stop: always;
|
|
1141
|
-
`,
|
|
1142
|
-
animation: ${e=>e.reversed?
|
|
1141
|
+
`,os=ce.div`
|
|
1142
|
+
animation: ${e=>e.reversed?Bd:vd} 0.25s ease-out;
|
|
1143
1143
|
background: linear-gradient(
|
|
1144
1144
|
to right,
|
|
1145
1145
|
${({theme:e})=>e.colorBackground}00,
|
|
@@ -1148,8 +1148,8 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1148
1148
|
position: absolute;
|
|
1149
1149
|
width: 64px;
|
|
1150
1150
|
z-index: 10;
|
|
1151
|
-
`,
|
|
1152
|
-
${
|
|
1151
|
+
`,rs=ce.button`
|
|
1152
|
+
${Rn}
|
|
1153
1153
|
box-shadow: 0 3px 10px 0 rgba(0, 0, 0, 0.1);
|
|
1154
1154
|
align-items: center;
|
|
1155
1155
|
border-radius: 50%;
|
|
@@ -1160,11 +1160,11 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1160
1160
|
justify-content: center;
|
|
1161
1161
|
position: absolute;
|
|
1162
1162
|
width: 48px;
|
|
1163
|
-
`,
|
|
1163
|
+
`,is=ce.div`
|
|
1164
1164
|
border-radius: ${({theme:e})=>e.borderRadius}px;
|
|
1165
1165
|
padding: 20px;
|
|
1166
|
-
`,
|
|
1167
|
-
${
|
|
1166
|
+
`,ns=ce(is)`
|
|
1167
|
+
${Rn}
|
|
1168
1168
|
background: ${({theme:e})=>e.colorBackground};
|
|
1169
1169
|
position: relative;
|
|
1170
1170
|
|
|
@@ -1176,95 +1176,95 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1176
1176
|
${e=>e.blocked?"":`border: 1px solid ${e.theme.colorPrimary};`}
|
|
1177
1177
|
${e=>e.blocked?"cursor: default":"cursor: pointer"}
|
|
1178
1178
|
}
|
|
1179
|
-
`,
|
|
1179
|
+
`,ss=ce.img`
|
|
1180
1180
|
border-radius: 50%;
|
|
1181
1181
|
height: 40px;
|
|
1182
1182
|
margin-bottom: 12px;
|
|
1183
1183
|
width: 40px;
|
|
1184
|
-
`,
|
|
1184
|
+
`,ls=ce(is)`
|
|
1185
1185
|
${e=>k(e)} {
|
|
1186
|
-
${
|
|
1186
|
+
${Pd}
|
|
1187
1187
|
|
|
1188
1188
|
background: ${({theme:e})=>e.colorBackground};
|
|
1189
1189
|
}
|
|
1190
|
-
`,
|
|
1190
|
+
`,as=ce.div`
|
|
1191
1191
|
color: ${({theme:e})=>e.colorPrimary};
|
|
1192
1192
|
display: flex;
|
|
1193
1193
|
flex-flow: row nowrap;
|
|
1194
1194
|
align-items: center;
|
|
1195
1195
|
margin-left: 20px;
|
|
1196
|
-
`,
|
|
1196
|
+
`,ps=ce.div`
|
|
1197
1197
|
white-space: nowrap;
|
|
1198
|
-
`,
|
|
1198
|
+
`,ds=ce.div`
|
|
1199
1199
|
background: #d8fed8;
|
|
1200
1200
|
border-radius: 6px;
|
|
1201
1201
|
float: right;
|
|
1202
1202
|
margin-bottom: 12px;
|
|
1203
1203
|
padding: 4px 10px;
|
|
1204
|
-
`,
|
|
1204
|
+
`,Ed=ce.p`
|
|
1205
1205
|
font-weight: bold;
|
|
1206
1206
|
font-size: 18px;
|
|
1207
1207
|
line-height: 22px;
|
|
1208
1208
|
letter-spacing: calc(18px * -0.01);
|
|
1209
1209
|
margin: 0;
|
|
1210
|
-
`,
|
|
1210
|
+
`,cs=ce(Ed)`
|
|
1211
1211
|
margin-bottom: 4px;
|
|
1212
|
-
`,
|
|
1212
|
+
`,Ad=ce.p`
|
|
1213
1213
|
font-weight: bold;
|
|
1214
1214
|
font-size: 16px;
|
|
1215
1215
|
line-height: 20px;
|
|
1216
1216
|
letter-spacing: calc(16px * -0.01);
|
|
1217
1217
|
margin: 0;
|
|
1218
|
-
`,
|
|
1218
|
+
`,ms=ce(Ad)`
|
|
1219
1219
|
margin-bottom: 4px;
|
|
1220
1220
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1221
1221
|
`}
|
|
1222
|
-
`,We=
|
|
1222
|
+
`,We=ce.p`
|
|
1223
1223
|
color: ${({theme:e})=>e.colorText};
|
|
1224
1224
|
font-weight: normal;
|
|
1225
1225
|
font-size: 14px;
|
|
1226
1226
|
line-height: 22px;
|
|
1227
1227
|
margin: 0;
|
|
1228
|
-
`,
|
|
1228
|
+
`,us=ce.p`
|
|
1229
1229
|
color: ${({theme:e})=>e.colorText};
|
|
1230
1230
|
font-weight: 600;
|
|
1231
1231
|
font-size: 12px;
|
|
1232
1232
|
line-height: 16px;
|
|
1233
1233
|
margin: 0;
|
|
1234
|
-
`;We.Loud=
|
|
1234
|
+
`;We.Loud=ce(We)`
|
|
1235
1235
|
font-weight: 600;
|
|
1236
|
-
`;We.Quiet=
|
|
1236
|
+
`;We.Quiet=ce(We)`
|
|
1237
1237
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1238
1238
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1239
1239
|
`}
|
|
1240
|
-
`;var
|
|
1240
|
+
`;var fs=({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:d=!1,blocked:a=!1}=e,h=e.primaryButtonTitle||e.secondaryButtonTitle,c=()=>{r(e)};return Ut.createElement(ns,{className:l("carouselCard",o),onClick:a?null:c,style:t,blocked:a,complete:d},n&&Ut.createElement(ss,{className:l("carouselCardImage",o),src:n,alt:p,style:{opacity:d||a?.4:1}}),(d||!0)&&Ut.createElement(ds,{className:l("carouselCompletedPill",o)},Ut.createElement(us,{style:{color:"#108E0B"}},"Complete")),p&&Ut.createElement(ms,{blocked:a,complete:d,className:l("carouselCardTitle",o)},p),s&&Ut.createElement(We.Quiet,{blocked:a,complete:d,className:l("carouselCardSubtitle",o)},s))};import io from"react";var gs=({numberOfStepsCompleted:e,numberOfSteps:t,appearance:o})=>{let i=t>0?e/t:0,r=200,n=Math.min(r,Math.max(10,Math.round(r*i)));return io.createElement(as,{className:l("carouselProgressBar",o)},io.createElement(ps,{as:We.Loud,style:{marginRight:8}},e," of ",t),io.createElement("svg",{height:10,width:r},io.createElement("rect",{x:0,y:0,rx:5,width:r,height:10,fill:"#E6E6E6"}),io.createElement("rect",{x:0,y:0,rx:5,width:n,height:10,fill:"currentColor"})))};var Nd=()=>pe.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},pe.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),pe.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),pe.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),xs=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,r]=bt(!1),[n,s]=bt(!1);gr(()=>{t===!0&&i===!1?r(!0):t===!1&&i===!0&&s(!0)},[t]);let p=()=>{r(!1),s(!1)},d=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return i?pe.createElement(os,{style:d,reversed:n,onAnimationEnd:n?p:null},pe.createElement(rs,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},pe.createElement(Nd,null))):null},hs=({flowId:e,appearance:t,customVariables:o,className:i})=>{let r=Id(null),[n,s]=bt(!1),[p,d]=bt(!1),[a,h]=bt(null),[c,f]=bt([]),[y,T]=bt(0),{getFlowMetadata:P,getFlowSteps:g,getNumberOfStepsCompleted:v,updateCustomVariables:x,getFlowStatus:F,isLoading:I,targetingLogicShouldHideFlow:S,getFlow:m}=R();gr(()=>{x(o)},[o,I]),gr(()=>{if(I)return;let N=P(e),O=v(e),H=g(e);h(N),N.data!==null&&(f(H.sort(($,X)=>Number($.complete)-Number(X.complete))),d(H.length>3),T(O))},[I]);let w=[];for(let N=0;N<c.length;N+=3)w.push(c.slice(N,N+3));let C=N=>{let O=N.target,H=O.scrollWidth-O.clientWidth,$=Math.ceil(O.scrollLeft);$>0&&n===!1&&s(!0),$===0&&n===!0&&s(!1),$<H&&p===!1&&d(!0),$===H&&p===!0&&d(!1)},B=(N=!0)=>{let O=N?1:-1;r.current!==null&&r.current.scrollBy({left:r.current.clientWidth*O,behavior:"smooth"})},L=null,M=N=>{L!==null?clearTimeout(L):C(N),L=setTimeout(()=>{C(N)},16)};return I?null:pe.createElement(ls,{className:Ce(l("carouselContainer",t),i)},pe.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:20}},pe.createElement("div",null,pe.createElement(cs,{className:l("carouselTitle",t)},a==null?void 0:a.title),pe.createElement(We.Quiet,{className:l("carouselSubtitle",t)},a==null?void 0:a.subtitle)),pe.createElement(gs,{numberOfStepsCompleted:y,numberOfSteps:c.length})),pe.createElement("div",{style:{position:"relative"}},pe.createElement(xs,{show:n,onClick:()=>B(!1)}),pe.createElement(xs,{side:"right",show:p,onClick:B}),pe.createElement(es,{ref:r,onScroll:M},w.map((N,O)=>pe.createElement(ts,{key:O,style:{flex:`0 0 calc(100% - ${c.length>3?36:0}px)`}},N.map((H,$)=>pe.createElement(fs,{key:$,stepData:H,style:{flex:c.length>3?"0 1 calc(33% - 16px * 2 / 3)":1},appearance:t})))))),pe.createElement(se,{appearance:t}))};var xr=({flowId:e,title:t,subtitle:o,style:i,initialSelectedStep:r,className:n,type:s="inline",onDismiss:p,visible:d,customVariables:a,onStepCompletion:h,onButtonClick:c,appearance:f,hideOnFlowCompletion:y,setVisible:T,customStepTypes:P,checklistStyle:g="default",autoExpandFirstIncompleteStep:v,autoExpandNextStep:x,...F})=>{let{getFlow:I,getFlowSteps:S,markStepCompleted:m,getStepStatus:w,getNumberOfStepsCompleted:C,isLoading:B,targetingLogicShouldHideFlow:L,updateCustomVariables:M,getFlowMetadata:N,isStepBlocked:O,getFlowStatus:H,hasActiveFullPageFlow:$,setHasActiveFullPageFlow:X}=R(),{primaryCTAClickSideEffects:ee,secondaryCTAClickSideEffects:K}=ae(),{getOpenFlowState:te,setOpenFlowState:le}=Fe(),[J,G]=ys(r||0),[xe,Te]=ys(!1),q=d===void 0?te(e):d,de=s==="modal",{mergeAppearanceWithDefault:_}=oe(),{isLarge:D}=Dn();if(f=_(f),Cs(()=>{M(a)},[a,B]),Cs(()=>{d!==void 0&&(de&&d===!0?X(!0):de&&d===!1&&X(!1))},[d,T,$]),B)return null;let re=I(e);if(!re||L(re))return null;let V=S(e);if(!V||y===!0&&H(e)===Z)return null;let ie=N(e);if(ie!=null&&ie.title&&(t=ie.title),ie!=null&&ie.subtitle&&(o=ie.subtitle),!xe&&r===void 0&&C(e)>0){let A=V.findIndex(Q=>Q.complete===!1);G(A>-1?A:V.length-1),Te(!0)}function je(){if(J+1>=V.length){de&&le(e,!1);return}O(e,V[J+1].id)||G(J+1)}function De(A,Q,ct){let Fr=J+1<V.length?V[J+1]:null;c&&c(A,J,Q,Fr)===!0&&de&&$e(),h&&h(A,ct,Fr),!h&&!c&&(A.primaryButtonUri||A.secondaryButtonUri)&&de&&$e()}function dt(){return V.map((A,Q)=>({...A,handleSecondaryButtonClick:()=>{je(),K(A),A.skippable===!0&&m(e,A.id,{skipped:!0}),De(A,"secondary",Q)},handlePrimaryButtonClick:()=>{(!A.completionCriteria&&(A.autoMarkCompleted||A.autoMarkCompleted===void 0)||A.completionCriteria&&A.autoMarkCompleted===!0)&&(m(e,A.id),je()),De(A,"primary",Q),ee(A),w(e,A.id)===Ne&&je()}}))}function W(){return me.createElement(se,{appearance:f})}let ve={steps:dt(),title:t,subtitle:o,primaryColor:f.theme.colorPrimary,appearance:f,customStepTypes:P,type:s,className:n,autoExpandFirstIncompleteStep:v,autoExpandNextStep:x};function $e(){le(e,!1),p&&p(),T&&T(!1)}function zo(){return me.createElement(me.Fragment,null,me.createElement(W,null),me.createElement(hs,{flowId:e,appearance:f,customVariables:a,className:n}))}function u(){return me.createElement(me.Fragment,null,me.createElement(W,null),me.createElement(fr,{visible:q,onClose:()=>{$e()},selectedStep:J,setSelectedStep:G,autoExpandNextStep:!0,appearance:f,...ve}))}function b(){if(!D)return u();let A=F.guideFlowId,Q;return A&&I(A)&&(Q=S(A)),me.createElement(me.Fragment,null,me.createElement(W,null),me.createElement(ur,{visible:q,stepsTitle:ie.stepsTitle?ie.stepsTitle:"Your quick start guide",onClose:()=>{$e()},selectedStep:J,setSelectedStep:G,guideData:Q,guideTitle:F.guideTitle??"Guide",appearance:f,title:t,subtitle:o,onGuideButtonClick:ct=>{De(ct,"link",0)},customStepTypes:P,...ve}))}function E(){if(!D)return u();let A=me.createElement(cr,{flowId:e,style:i,selectedStep:J,setSelectedStep:G,appearance:f,type:s,...ve});return de?me.createElement(tt,{onClose:()=>{$e()},visible:q,appearance:f,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},me.createElement(W,null),A):me.createElement(me.Fragment,null,me.createElement(W,null),A)}switch(g){case"condensed":return u();case"with-guide":return b();case"default":return E();case"carousel":return zo();default:return E()}};var Od=e=>Ld.createElement(xr,{type:"inline",...e});import pt,{useEffect as $d}from"react";import He from"react";import Oo from"styled-components";var Ss=Oo.div`
|
|
1241
1241
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1242
1242
|
border-radius: 8px;
|
|
1243
1243
|
padding: 6px 10px 6px 10px;
|
|
1244
1244
|
min-width: 160px;
|
|
1245
1245
|
cursor: pointer;
|
|
1246
1246
|
background-color: ${e=>e.appearance.theme.colorBackground}};
|
|
1247
|
-
`,
|
|
1247
|
+
`,bs=Oo.div`
|
|
1248
1248
|
display: flex;
|
|
1249
1249
|
flex-direction: row;
|
|
1250
1250
|
justify-content: space-between;
|
|
1251
1251
|
align-items: center;
|
|
1252
1252
|
margin-bottom: 2px;
|
|
1253
1253
|
flex-grow: 2;
|
|
1254
|
-
`,
|
|
1254
|
+
`,ws=Oo.div`
|
|
1255
1255
|
text-overflow: ellipsis;
|
|
1256
1256
|
font-weight: 600;
|
|
1257
1257
|
font-size: 12px;
|
|
1258
1258
|
line-height: 15px;
|
|
1259
1259
|
text-align: ${e=>e.type==="condensed"?"left":"right"};
|
|
1260
1260
|
color: ${e=>e.appearance.theme.colorPrimary};
|
|
1261
|
-
`,
|
|
1261
|
+
`,Ts=Oo.div`
|
|
1262
1262
|
width: 20px;
|
|
1263
1263
|
margin-right: 8px;
|
|
1264
1264
|
display: flex;
|
|
1265
1265
|
height: 100%;
|
|
1266
1266
|
align-items: center;
|
|
1267
|
-
`;import{motion as
|
|
1267
|
+
`;import{motion as Dd}from"framer-motion";var Fs=({title:e,count:t,total:o,onClick:i,style:r={},className:n,appearance:s,type:p="default"})=>He.createElement(He.Fragment,null,He.createElement(se,{appearance:s}),He.createElement(Ss,{as:Dd.div,whileHover:{opacity:.9},whileTap:{scale:.98},onClick:()=>i!==void 0&&i(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...r},className:Ce(n??"",l("progressRingContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&He.createElement(Ts,{className:l("progressRingContainer",s)},He.createElement(Bt,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),He.createElement(bs,{type:p,className:l("badgeTitleContainer",s)},He.createElement(ws,{type:p,appearance:s,className:l("badgeTitle",s)},e),i!==void 0&&He.createElement($t,{className:l("badgeChevron",s),color:s.theme.colorPrimary})),p=="default"&&o&&o!==0&&He.createElement(_e,{display:"compact",count:t,total:o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:s})));import at from"react";import no from"styled-components";var ks=no.div`
|
|
1268
1268
|
display: flex;
|
|
1269
1269
|
flex-direction: row;
|
|
1270
1270
|
width: 100%;
|
|
@@ -1275,25 +1275,25 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1275
1275
|
border-width: 1px;
|
|
1276
1276
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1277
1277
|
border-radius: 12px;
|
|
1278
|
-
`,
|
|
1278
|
+
`,Ps=no.div`
|
|
1279
1279
|
${e=>k(e)} {
|
|
1280
1280
|
display: flex;
|
|
1281
1281
|
justify-content: center;
|
|
1282
1282
|
align-items: center;
|
|
1283
1283
|
margin-right: 16px;
|
|
1284
1284
|
}
|
|
1285
|
-
`,
|
|
1285
|
+
`,vs=no.div`
|
|
1286
1286
|
display: flex;
|
|
1287
1287
|
flex-direction: column;
|
|
1288
1288
|
flex: 1;
|
|
1289
1289
|
margin-top: 0;
|
|
1290
|
-
`,
|
|
1290
|
+
`,Bs=no.div`
|
|
1291
1291
|
display: flex;
|
|
1292
1292
|
flex-direction: column;
|
|
1293
1293
|
justify-content: center;
|
|
1294
1294
|
margin-left: 16px;
|
|
1295
1295
|
min-width: 200px;
|
|
1296
|
-
`,
|
|
1296
|
+
`,By=no.div`
|
|
1297
1297
|
display: flex;
|
|
1298
1298
|
justify-content: center;
|
|
1299
1299
|
align-items: flex-end;
|
|
@@ -1302,7 +1302,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1302
1302
|
:hover {
|
|
1303
1303
|
opacity: 0.8;
|
|
1304
1304
|
}
|
|
1305
|
-
`;var
|
|
1305
|
+
`;var Es=({title:e,subtitle:t,icon:o,appearance:i,count:r,total:n,className:s,style:p})=>at.createElement(at.Fragment,null,at.createElement(ks,{appearance:i,className:Ce(l("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&at.createElement(Ps,{className:l("fullWidthProgressBadgeIcon",i)},o),at.createElement(vs,null,at.createElement(ye,{size:"small",appearance:i,title:e,subtitle:t})),at.createElement(Bs,{className:l("fullWidthProgressBadgeProgressContainer",i)},at.createElement(_e,{count:r,total:n,display:"percent",textLocation:"top",fillColor:i.theme.colorPrimary}))));var Md=({flowId:e,title:t,subtitle:o,icon:i,style:r,onClick:n,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:a,type:h="default"})=>{let{getFlow:c,getFlowSteps:f,getFlowStatus:y,getNumberOfStepsCompleted:T,isLoading:P,targetingLogicShouldHideFlow:g,updateCustomVariables:v}=R(),{mergeAppearanceWithDefault:x}=oe();a=x(a);let{setOpenFlowState:F,getOpenFlowState:I}=Fe();if($d(()=>{v(p)},[p,P]),P)return null;let S=c(e);if(!S||g(S)||d===!0&&y(e)===Z)return null;let m=f(e),w=T(e);return h==="full-width"?pt.createElement(pt.Fragment,null,pt.createElement(se,{appearance:a}),pt.createElement(Es,{title:t,subtitle:o,count:w,total:m.length,style:r,className:s,appearance:a,icon:i,onClick:()=>{}})):pt.createElement(pt.Fragment,null,pt.createElement(se,{appearance:a}),pt.createElement(Fs,{count:w,total:m.length,title:t,style:r,onClick:()=>{F(e,!0),n&&n()},type:h,className:s,appearance:a}))};import Ud from"react";var zd=({flowId:e,style:t,appearance:o,...i})=>{let{getFlow:r,targetingLogicShouldHideFlow:n,getFlowSteps:s}=R(),{mergeAppearanceWithDefault:p}=oe();o=p(o);let d=r(e);if(!d||n(d))return null;let a=s(e);return Ud.createElement(ro,{steps:a,style:t,appearance:o,...i})};import _t,{useContext as Qd,useEffect as Zd}from"react";import U,{useEffect as Do,useLayoutEffect as Ns,useRef as jd,useState as so}from"react";import lo from"styled-components";import{useCallback as _d,useEffect as Wd,useState as Hd}from"react";var hr=(e,t,o,i={x:20,y:20},r)=>{let n=r=="fixed"?0:window.scrollY,s=r=="fixed"?0:window.scrollX;return!e||!e.left||!e.top?{x:0,y:0}:t==="left"?{x:e.left-o+i.x+s,y:e.top-i.y+n}:t==="right"?{x:e.left+e.width+i.x+s,y:e.top-i.y+n}:{x:0,y:0}},As={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Vd(e){let t=As;return e&&(t=e.getBoundingClientRect()),t}function Is(e,t){let[o,i]=Hd(As),r=_d(()=>{e&&i(Vd(e))},[e]);return Wd(()=>(r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)),[e,t]),o}var Ls=300,Os=100,Gd=500,zt=12,qd=lo.div`
|
|
1306
1306
|
width: 100%;
|
|
1307
1307
|
height: 100%;
|
|
1308
1308
|
border-radius: 9999px;
|
|
@@ -1325,25 +1325,25 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1325
1325
|
opacity: 0;
|
|
1326
1326
|
}
|
|
1327
1327
|
}
|
|
1328
|
-
`,
|
|
1328
|
+
`,Kd=lo.div`
|
|
1329
1329
|
width: ${zt}px;
|
|
1330
1330
|
height: ${zt}px;
|
|
1331
1331
|
border-radius: 100px;
|
|
1332
1332
|
background-color: ${e=>e.primaryColor};
|
|
1333
1333
|
z-index: 20;
|
|
1334
1334
|
opacity: 1;
|
|
1335
|
-
`,
|
|
1335
|
+
`,Yd=lo.div`
|
|
1336
1336
|
pointer-events: all;
|
|
1337
|
-
`,
|
|
1337
|
+
`,Ds=lo.div`
|
|
1338
1338
|
display: flex;
|
|
1339
1339
|
align-content: center;
|
|
1340
1340
|
justify-content: center;
|
|
1341
1341
|
align-items: center;
|
|
1342
1342
|
z-index: ${e=>e.zIndex?e.zIndex:90};
|
|
1343
|
-
`,
|
|
1343
|
+
`,Xd=lo(Ds)`
|
|
1344
1344
|
width: ${zt+12}px;
|
|
1345
1345
|
height: ${zt+12}px;
|
|
1346
|
-
`,
|
|
1346
|
+
`,Jd=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:r=!0,primaryColor:n="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:a=0,customStepTypes:h,appearance:c,dismissible:f=!1,showHighlightOnly:y,showStepCount:T=!0,completedStepsCount:P=0,showFrigadeBranding:g=!1})=>{var ie,je,De,dt;let[v,x]=so(),[F,I]=so(new Date),S=jd(null),[m,w]=so(document.querySelector(e[a].selector)),C=Is(m,F),[B,L]=so(),[M,N]=so(!y),O=(je=(ie=e[a])==null?void 0:ie.props)!=null&&je.position?e[a].props.position:"absolute",H=((dt=(De=e[a])==null?void 0:De.props)==null?void 0:dt.zIndex)??90,$=(v==null?void 0:v.width)??Ls,X=(v==null?void 0:v.height)??Os;Ns(()=>{S.current&&x({width:S.current.clientWidth,height:S.current.clientHeight})},[a,F,O]),Do(()=>{y||N(!0)},[a]);let ee=i==="auto"?"right":i,K=hr(C,ee,$,s,O),te=C.right+$>(window.innerWidth||document.documentElement.clientWidth),le=C.bottom+Os>(window.innerHeight||document.documentElement.clientHeight);te&&i==="auto"&&(K=hr(C,"left",$,s,O),ee="left");let J=window.location.pathname.split("/").pop(),G=()=>{let W=document.querySelector(e[a].selector);if(!W){L(void 0),w(null);return}B&&B===JSON.stringify(W==null?void 0:W.getBoundingClientRect())||(w(W),I(new Date),W&&L(JSON.stringify(W.getBoundingClientRect())))};if(Do(()=>{let W=new MutationObserver(G);return W.observe(document.body,{subtree:!0,childList:!0}),()=>W.disconnect()},[G]),Do(()=>{let W=new MutationObserver(G);return W.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>W.disconnect()},[G]),Do(()=>{let W=setInterval(()=>{G()},10);return()=>clearInterval(W)},[G]),Ns(()=>{setTimeout(()=>{G()},Gd),G()},[a,J]),m===null)return U.createElement(U.Fragment,null);if(K.x==0&&K.y==0)return U.createElement(U.Fragment,null);if(!p)return U.createElement(U.Fragment,null);let xe=()=>{let W=()=>{if(e[a].handlePrimaryButtonClick&&(e[a].handlePrimaryButtonClick(),N(!1),setTimeout(()=>{G()},30)),P===e.length-1)return o()},ve=()=>{e[a].handleSecondaryButtonClick&&(e[a].handleSecondaryButtonClick(),y&&!e[a].secondaryButtonUri&&N(!1))};return U.createElement(U.Fragment,null,T&&e.length>1&&U.createElement(Mr,null,U.createElement(zr,{className:l("tooltipStepCounter",c)},a+1," of ",e.length)),U.createElement(Ur,{showStepCount:T,className:l("tooltipCTAContainer",c)},e[a].secondaryButtonTitle&&U.createElement(ne,{title:e[a].secondaryButtonTitle,appearance:c,onClick:ve,size:"small",withMargin:!1,secondary:!0}),e[a].primaryButtonTitle&&U.createElement(ne,{title:e[a].primaryButtonTitle,appearance:c,onClick:W,withMargin:!1,size:"small"})))},Te=()=>U.createElement(U.Fragment,null,f&&U.createElement(Lr,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:l("tooltipClose",c)},U.createElement(ke,null)),e[a].imageUri&&U.createElement(Or,{dismissible:f,appearance:c,src:e[a].imageUri,className:l("tooltipImageContainer",c)}),e[a].videoUri&&!e[a].imageUri&&U.createElement(Dr,{dismissible:f,appearance:c,className:l("tooltipVideoContainer",c)},U.createElement(st,{appearance:c,videoUri:e[a].videoUri})),U.createElement(ye,{appearance:c,title:e[a].title,subtitle:e[a].subtitle,size:"small"}),U.createElement($r,{className:l("tooltipFooter",c)},U.createElement(xe,null))),de={...{default:W=>{var ve;if((ve=e[a])!=null&&ve.StepContent){let $e=e[a].StepContent;return U.createElement("div",null,$e)}return U.createElement(Te,null)}},...h},_=()=>{var W;return e?!((W=e[a])!=null&&W.type)||!de[e[a].type]?de.default(e[a]):de[e[a].type]({stepData:e[a],primaryColor:n}):U.createElement(U.Fragment,null)};if(y&&e[a].complete===!0)return null;let D={top:(K==null?void 0:K.y)-zt,left:(ee=="left"?C.x+s.x:(K==null?void 0:K.x)-zt)??0,cursor:y?"pointer":"default",position:O},re=()=>{let ve=D.left+(ee=="left"?-$:24);return Math.min(Math.max(ve,20),window.innerWidth-$-20)},V=()=>{y&&(I(new Date),N(!M))};return U.createElement(Yd,null,U.createElement(Xd,{style:D,zIndex:H,className:l("tourHighlightContainer",c)},r&&e[a].showHighlight!==!1&&U.createElement(U.Fragment,null,U.createElement(Kd,{style:{position:O},onClick:V,primaryColor:c.theme.colorPrimary,className:l("tourHighlightInnerCircle",c)}),U.createElement(qd,{style:{position:"absolute"},onClick:V,primaryColor:c.theme.colorPrimary,className:l("tourHighlightOuterCircle",c)}))),U.createElement(Ds,{style:{...D,left:re()},zIndex:H+1,className:l("tooltipContainerWrapper",c)},M&&U.createElement(U.Fragment,null,U.createElement(co,{ref:S,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:12,...d},appearance:c,className:l("tooltipContainer",c),maxWidth:Ls,zIndex:H+10},U.createElement(_,null)),g&&U.createElement(Wr,{className:l("poweredByFrigadeTooltipRibbon",c),appearance:c,zIndex:H+10},U.createElement(mo,{appearance:c})))))},$o=Jd;import{Portal as Rd}from"react-portal";var ec=({flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:r,showTooltipsSimultaneously:n=!1,onDismiss:s,dismissible:p,tooltipPosition:d="auto",showHighlightOnly:a=!1,dismissBehavior:h="complete-flow",onComplete:c,skipIfNotFound:f=!1,...y})=>{let{getFlow:T,getFlowSteps:P,isLoading:g,targetingLogicShouldHideFlow:v,markStepCompleted:x,markStepStarted:F,markFlowCompleted:I,updateCustomVariables:S,getCurrentStepIndex:m,getStepStatus:w,isStepBlocked:C,getFlowStatus:B,getNumberOfStepsCompleted:L}=R(),{isLoadingUserFlowStateData:M}=Ee(),{primaryCTAClickSideEffects:N,secondaryCTAClickSideEffects:O}=ae(),{hasOpenModals:H}=Fe(),$=m(e),{openFlowStates:X}=Qd(j),{mergeAppearanceWithDefault:ee}=oe();if(o=ee(o),Zd(()=>{S(t)},[t,g]),M)return null;let K=T(e);if(!K||v(K)||B(e)==Z||H())return null;let te=P(e);if(Object.keys(X).length>0){let _=Object.keys(X).find(D=>X[D]===!0);if(_!==void 0&&_!==e)return _t.createElement(_t.Fragment,null)}async function le(_){if(await x(e,_.id),te.map(D=>w(e,D.id)).every(D=>D===Ne)){await I(e);return}if(!a&&$+1<te.length){if(C(e,te[$+1].id))return;await F(e,te[$+1].id)}}function J(_,D,re){let V=$+1<te.length?te[$+1]:null;r&&r(_,$,D,V),i&&i(_,re,V)}function G(){return te.map(_=>({..._,handleSecondaryButtonClick:async()=>{O(_),_.skippable===!0&&await x(e,_.id,{skipped:!0}),J(_,"secondary",$)},handlePrimaryButtonClick:async()=>{(!_.completionCriteria&&(_.autoMarkCompleted||_.autoMarkCompleted===void 0)||_.completionCriteria&&_.autoMarkCompleted===!0)&&await le(_),J(_,"primary",$),N(_)}}))}async function xe(_){s&&s(),h==="complete-flow"?await I(e):await x(e,_.id)}function Te(){c&&c()}let q=!document.querySelector(te[$].selector);function de(){let _=te.findIndex(D=>!!document.querySelector(D.selector));return te.map((D,re)=>q&&!n&&re!==_&&f?null:_t.createElement($o,{key:D.id,appearance:o,steps:G(),selectedStep:re,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>xe(D),tooltipPosition:d,showHighlightOnly:a,completedStepsCount:L(e),onComplete:Te,...y}))}return _t.createElement(Rd,null,_t.createElement(se,{appearance:o}),n||q&&f?de():_t.createElement($o,{appearance:o,steps:G(),selectedStep:$,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>xe(te[$]),tooltipPosition:d,completedStepsCount:L(e),showHighlightOnly:a,onComplete:Te,...y}))};import be,{useEffect as tc,useRef as oc,useState as rc}from"react";import{Portal as ic}from"react-portal";import wt from"styled-components";var $s=wt.button`
|
|
1347
1347
|
${e=>k(e)} {
|
|
1348
1348
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1349
1349
|
|
|
@@ -1361,17 +1361,17 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1361
1361
|
opacity: 0.8;
|
|
1362
1362
|
}
|
|
1363
1363
|
}
|
|
1364
|
-
`,
|
|
1364
|
+
`,Ms=wt.span`
|
|
1365
1365
|
${e=>k(e)} {
|
|
1366
1366
|
font-size: 12px;
|
|
1367
1367
|
display: inline-block;
|
|
1368
1368
|
}
|
|
1369
|
-
|
|
1369
|
+
`,Us=wt.span`
|
|
1370
1370
|
${e=>k(e)} {
|
|
1371
1371
|
font-size: 12px;
|
|
1372
1372
|
display: inline-block;
|
|
1373
1373
|
}
|
|
1374
|
-
`,
|
|
1374
|
+
`,zs=wt.div`
|
|
1375
1375
|
position: fixed;
|
|
1376
1376
|
right: 0;
|
|
1377
1377
|
bottom: 0;
|
|
@@ -1381,7 +1381,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1381
1381
|
flex-direction: column;
|
|
1382
1382
|
align-items: flex-end;
|
|
1383
1383
|
z-index: 50;
|
|
1384
|
-
`,
|
|
1384
|
+
`,_s=wt.button`
|
|
1385
1385
|
${e=>k(e)} {
|
|
1386
1386
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1387
1387
|
background-color: #ffffff;
|
|
@@ -1397,7 +1397,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1397
1397
|
0px 3px 6px -4px rgba(0, 0, 0, 0.12);
|
|
1398
1398
|
border-radius: 45px;
|
|
1399
1399
|
cursor: pointer;
|
|
1400
|
-
`,
|
|
1400
|
+
`,Ws=wt.div`
|
|
1401
1401
|
${e=>k(e)} {
|
|
1402
1402
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1403
1403
|
background: #ffffff;
|
|
@@ -1414,7 +1414,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1414
1414
|
position: ${e=>e.type=="inline"?"absolute":"relative"};
|
|
1415
1415
|
top: ${e=>e.type=="inline"?"68px":0};
|
|
1416
1416
|
margin-left: ${e=>e.type=="inline"?"-127px":0};
|
|
1417
|
-
`,
|
|
1417
|
+
`,Hs=wt.button`
|
|
1418
1418
|
${e=>k(e)} {
|
|
1419
1419
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1420
1420
|
color: #434343;
|
|
@@ -1431,7 +1431,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1431
1431
|
font-size: 14px;
|
|
1432
1432
|
|
|
1433
1433
|
padding: 8px 12px;
|
|
1434
|
-
`;import{AnimatePresence as
|
|
1434
|
+
`;import{AnimatePresence as Ks,motion as Ys}from"framer-motion";import Vs from"react";var js=({style:e,className:t})=>Vs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Vs.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 Gs from"react";var qs=({style:e,className:t})=>Gs.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"},Gs.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 nc=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:r="inline",title:n="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:a,getStepStatus:h,getNumberOfStepsCompleted:c,isLoading:f,targetingLogicShouldHideFlow:y}=R(),{primaryCTAClickSideEffects:T}=ae(),P=oc(null),[g,v]=rc(!1),{mergeAppearanceWithDefault:x}=oe();s=x(s),tc(()=>(document.addEventListener("click",F,!1),()=>{document.removeEventListener("click",F,!1)}),[]);let F=C=>{P.current&&!P.current.contains(C.target)&&v(!1)};if(f)return null;let I=p(e);if(!I||y(I))return null;let S=d(e);if(!S||!i)return null;function m(C,B){!C.completionCriteria&&(C.autoMarkCompleted||C.autoMarkCompleted===void 0)&&a(e,C.id),T(C),o&&o(C,B),v(!1)}function w(){return g&&be.createElement(Ws,{className:l("floatingWidgetMenu",s),as:Ys.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:r},S.map((C,B)=>be.createElement(Hs,{className:l("floatingWidgetMenuItem",s),key:B,onClick:()=>m(C,B)},C.title)))}return r=="inline"?be.createElement("span",{ref:P},be.createElement($s,{style:t,onClick:()=>{v(!g)},className:l("supportButton",s)},be.createElement(Us,{className:l("supportIconContainer",s)},be.createElement(qs,{className:l("supportIcon",s),style:{width:"18px",height:"18px"}})),be.createElement(Ms,{className:l("supportButtonTitle",s)},n)),be.createElement(Ks,null,be.createElement(w,null))):be.createElement(ic,null,be.createElement(zs,{style:t,ref:P},be.createElement(Ks,null,be.createElement(w,null)),be.createElement(_s,{onClick:()=>{v(!g)},as:Ys.button,whileHover:{scale:1.1},className:l("floatingWidgetButton",s)},be.createElement(js,{className:l("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import Ve,{useEffect as sc}from"react";import Mo from"styled-components";var Xs=Mo.div`
|
|
1435
1435
|
${e=>k(e)} {
|
|
1436
1436
|
display: flex;
|
|
1437
1437
|
flex-direction: column;
|
|
@@ -1446,17 +1446,17 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1446
1446
|
border-radius: 12px;
|
|
1447
1447
|
position: relative;
|
|
1448
1448
|
}
|
|
1449
|
-
`,
|
|
1449
|
+
`,Js=Mo.div`
|
|
1450
1450
|
display: flex;
|
|
1451
1451
|
flex-direction: column;
|
|
1452
1452
|
flex: 1;
|
|
1453
|
-
`,
|
|
1453
|
+
`,Qs=Mo.div`
|
|
1454
1454
|
display: flex;
|
|
1455
1455
|
flex-direction: column;
|
|
1456
1456
|
justify-content: center;
|
|
1457
1457
|
align-items: flex-start;
|
|
1458
1458
|
margin-top: 16px;
|
|
1459
|
-
`,
|
|
1459
|
+
`,Zs=Mo.div`
|
|
1460
1460
|
${e=>k(e)} {
|
|
1461
1461
|
position: absolute;
|
|
1462
1462
|
top: 16px;
|
|
@@ -1467,7 +1467,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1467
1467
|
opacity: 0.8;
|
|
1468
1468
|
}
|
|
1469
1469
|
}
|
|
1470
|
-
`;var
|
|
1470
|
+
`;var lc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:a,markStepCompleted:h,isLoading:c,targetingLogicShouldHideFlow:f,updateCustomVariables:y,getFlowSteps:T,getFlowStatus:P,getCurrentStepIndex:g}=R(),{primaryCTAClickSideEffects:v}=ae(),{mergeAppearanceWithDefault:x}=oe();if(r=x(r),sc(()=>{y(o)},[o,c]),c)return null;let F=d(e);if(!F||f(F)||P(e)===Z)return null;let S=T(e)[g(e)];return Ve.createElement(Ve.Fragment,null,Ve.createElement(se,{appearance:r}),Ve.createElement(Xs,{appearance:r,className:Ce(l("embeddedTipContainer",r),n),style:s},(p===!0||S.dismissible)&&Ve.createElement(Zs,{onClick:async()=>{await a(e),t&&t()},className:l("embeddedTipDismissButton",r)},Ve.createElement(ke,null)),Ve.createElement(Js,null,Ve.createElement(ye,{size:"small",appearance:r,title:S.title,subtitle:S.subtitle})),S.primaryButtonTitle&&Ve.createElement(Qs,{className:l("embeddedTipCallToActionContainer",r)},Ve.createElement(ne,{classPrefix:"embeddedTip",title:S.primaryButtonTitle,appearance:r,withMargin:!1,size:"small",type:"inline",onClick:async()=>{S.handlePrimaryButtonClick(),v(S),!(i&&i(S,g(e),"primary")===!1)&&(await h(e,S.id),await a(e))}}))))};import he,{useEffect as ac}from"react";import Wt from"styled-components";var Rs=Wt.div`
|
|
1471
1471
|
// use the :not annotation
|
|
1472
1472
|
${e=>k(e)} {
|
|
1473
1473
|
display: flex;
|
|
@@ -1481,19 +1481,19 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1481
1481
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1482
1482
|
border-radius: 12px;
|
|
1483
1483
|
}
|
|
1484
|
-
`,
|
|
1484
|
+
`,el=Wt.div`
|
|
1485
1485
|
${e=>k(e)} {
|
|
1486
1486
|
display: flex;
|
|
1487
1487
|
width: 36px;
|
|
1488
1488
|
height: 36px;
|
|
1489
1489
|
}
|
|
1490
|
-
`,
|
|
1490
|
+
`,tl=Wt.div`
|
|
1491
1491
|
display: flex;
|
|
1492
1492
|
flex-direction: column;
|
|
1493
1493
|
flex: 1;
|
|
1494
1494
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1495
1495
|
margin-top: ${e=>e.type==="square"?"12px":"0"};
|
|
1496
|
-
`,
|
|
1496
|
+
`,ol=Wt.div`
|
|
1497
1497
|
display: flex;
|
|
1498
1498
|
flex-direction: column;
|
|
1499
1499
|
justify-content: center;
|
|
@@ -1507,12 +1507,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1507
1507
|
:hover {
|
|
1508
1508
|
opacity: 0.8;
|
|
1509
1509
|
}
|
|
1510
|
-
`,
|
|
1510
|
+
`,yr=Wt.div`
|
|
1511
1511
|
display: flex;
|
|
1512
1512
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1513
1513
|
align-items: flex-end;
|
|
1514
1514
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1515
|
-
`;import
|
|
1515
|
+
`;import rl from"react";var il=({style:e,className:t})=>rl.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"},rl.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 pc=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:r,onButtonClick:n,appearance:s,type:p="full-width",icon:d})=>{let{getFlow:a,markFlowCompleted:h,isLoading:c,targetingLogicShouldHideFlow:f,updateCustomVariables:y,getFlowMetadata:T,getFlowStatus:P,getFlowSteps:g,getCurrentStepIndex:v}=R(),{primaryCTAClickSideEffects:x}=ae(),{mergeAppearanceWithDefault:F}=oe();if(s=F(s),ac(()=>{y(r)},[r,c]),c)return null;let I=a(e);if(!I||f(I)||P(e)===Z)return null;let S=g(e),m=S.length>0?S[v(e)]:T(e);return m!=null&&m.title&&(t=m.title),m!=null&&m.subtitle&&(o=m.subtitle),he.createElement(he.Fragment,null,he.createElement(se,{appearance:s}),he.createElement(Rs,{type:p,appearance:s,className:l("bannerContainer",s)},p!="square"&&he.createElement(el,{className:l("bannerIconContainer",s)},d||he.createElement(il,null)),p==="square"&&m.dismissible&&he.createElement(yr,{type:p,className:l("bannerDismissButtonContainer",s)},he.createElement(Cr,{type:p,onClick:async()=>{await h(e),i&&i()},className:l("bannerDismissButton",s)},he.createElement(ke,null))),he.createElement(tl,{type:p},he.createElement(ye,{appearance:s,title:t,subtitle:o,classPrefix:"banner"})),he.createElement(ol,{type:p,className:l("bannerCallToActionContainer",s)},he.createElement(ne,{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(yr,{type:p,className:l("bannerDismissButtonContainer",s)},he.createElement(Cr,{type:p,onClick:async()=>{await h(e),i&&i()},className:l("bannerDismissButton",s)},he.createElement(ke,null)))))};import Y,{useEffect as dc}from"react";import{Portal as cc}from"react-portal";import Re from"styled-components";var nl=Re.div`
|
|
1516
1516
|
${e=>k(e)} {
|
|
1517
1517
|
display: flex;
|
|
1518
1518
|
flex-direction: column;
|
|
@@ -1533,7 +1533,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1533
1533
|
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
|
|
1534
1534
|
min-width: 550px;
|
|
1535
1535
|
}
|
|
1536
|
-
`,
|
|
1536
|
+
`,sl=Re.button`
|
|
1537
1537
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1538
1538
|
border-radius: 8px;
|
|
1539
1539
|
// If selected make border color primary and text color color priamry
|
|
@@ -1554,12 +1554,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1554
1554
|
display: flex;
|
|
1555
1555
|
justify-content: center;
|
|
1556
1556
|
align-items: center;
|
|
1557
|
-
`,
|
|
1557
|
+
`,Sr=Re.div`
|
|
1558
1558
|
display: flex;
|
|
1559
1559
|
justify-content: flex-end;
|
|
1560
1560
|
margin-top: 16px;
|
|
1561
1561
|
gap: 8px;
|
|
1562
|
-
`,
|
|
1562
|
+
`,ll=Re.div`
|
|
1563
1563
|
display: flex;
|
|
1564
1564
|
justify-content: space-between;
|
|
1565
1565
|
margin-top: 8px;
|
|
@@ -1571,13 +1571,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1571
1571
|
display: flex;
|
|
1572
1572
|
flex-direction: column;
|
|
1573
1573
|
flex: 1;
|
|
1574
|
-
`,
|
|
1574
|
+
`,zb=Re.div`
|
|
1575
1575
|
display: flex;
|
|
1576
1576
|
flex-direction: column;
|
|
1577
1577
|
justify-content: center;
|
|
1578
1578
|
align-items: flex-start;
|
|
1579
1579
|
margin-top: 16px;
|
|
1580
|
-
`,
|
|
1580
|
+
`,al=Re.textarea`
|
|
1581
1581
|
${e=>k(e)} {
|
|
1582
1582
|
margin-top: 16px;
|
|
1583
1583
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
@@ -1588,7 +1588,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1588
1588
|
width: 100%;
|
|
1589
1589
|
height: 100px;
|
|
1590
1590
|
}
|
|
1591
|
-
`,
|
|
1591
|
+
`,pl=Re.div`
|
|
1592
1592
|
${e=>k(e)} {
|
|
1593
1593
|
position: absolute;
|
|
1594
1594
|
top: 16px;
|
|
@@ -1599,5 +1599,5 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1599
1599
|
opacity: 0.8;
|
|
1600
1600
|
}
|
|
1601
1601
|
}
|
|
1602
|
-
`;var
|
|
1602
|
+
`;var mc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,type:p="modal"})=>{let{getFlow:d,markFlowCompleted:a,markStepCompleted:h,getNumberOfStepsCompleted:c,isLoading:f,targetingLogicShouldHideFlow:y,updateCustomVariables:T,getFlowSteps:P,getFlowStatus:g,getCurrentStepIndex:v}=R(),{primaryCTAClickSideEffects:x}=ae(),{mergeAppearanceWithDefault:F}=oe(),[I,S]=Y.useState(null),[m,w]=Y.useState(""),{hasOpenModals:C,setKeepCompletedFlowOpenDuringSession:B,shouldKeepCompletedFlowOpenDuringSession:L}=Fe();if(r=F(r),dc(()=>{T(o)},[o,f]),f)return null;let M=d(e);if(!M||y(M)||g(e)===Z||c(e)===1&&!L(e)||C())return null;let O=P(e)[v(e)];function H(){return Y.createElement(Y.Fragment,null,Y.createElement(wr,null,Y.createElement(ye,{size:"large",appearance:r,title:O.title,subtitle:O.subtitle})),Y.createElement(Sr,{className:l("npsNumberButtonContainer",r),appearance:r},Array.from(Array(10).keys()).map(ee=>Y.createElement(sl,{className:l("npsNumberButton",r),selected:I===ee+1,key:ee,onClick:async()=>{B(e),S(ee+1),await h(e,O.id,{score:ee+1})},appearance:r},ee+1))),Y.createElement(ll,{appearance:r},Y.createElement(br,{appearance:r},"Not likely at all"),Y.createElement(br,{appearance:r},"Extremely likely")))}function $(){return Y.createElement(Y.Fragment,null,Y.createElement(wr,null,Y.createElement(ye,{appearance:r,title:"Why did you choose this score?",size:"large"})),Y.createElement(al,{appearance:r,value:m,onChange:ee=>{w(ee.target.value)},placeHolder:"Add your optional fedback here..."}),Y.createElement(Sr,{appearance:r,className:l("npsNumberButtonContainer",r)},Y.createElement(ne,{size:"large",withMargin:!1,onClick:async()=>{await a(e),i&&i(O,1,"primary")},appearance:r,title:O.secondaryButtonTitle||"Skip",secondary:!0}),Y.createElement(ne,{size:"large",withMargin:!1,onClick:async()=>{await h(e,O.id,{feedbackText:m}),await a(e),i&&i(O,1,"primary")},appearance:r,title:O.primaryButtonTitle||"Submit"})))}function X(){return Y.createElement(Y.Fragment,null,Y.createElement(se,{appearance:r}),Y.createElement(nl,{appearance:r,className:Ce(l("npsSurveyContainer",r),n),style:s,type:p},Y.createElement(pl,{onClick:async()=>{await a(e),t&&t()},className:l("npsSurveyDismissButton",r)},Y.createElement(ke,null)),c(e)==0&&H(),c(e)==1&&$()))}return p==="inline"?X():Y.createElement(cc,null,X())};import*as Uo from"react";import dl from"react";var cl=({as:e="span",children:t,variant:o="Body1",...i})=>dl.createElement(zi,{color:"neutral.foreground",fontFamily:"default",forwardedAs:e,variant:o,...i},t),uc=Object.fromEntries(Object.keys(Po).map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=i=>dl.createElement(cl,{as:t,...i,variant:e},i.children);return o.displayName=`Text.${e}`,[e,o]})),Tr=Object.assign(cl,uc);var ml=({as:e="button",className:t,size:o="md",title:i,variant:r="Primary",...n})=>{var s;return Uo.createElement(Ui,{className:`fr-button-${r.toLowerCase()}${t?` ${t}`:""}`,forwardedAs:e,variant:r,size:o,borderRadius:"md",...n},Uo.createElement(Tr,{color:(s=eo[r])==null?void 0:s.color,fontWeight:"semibold"},i))},fc=Object.fromEntries(Object.keys(eo).map(e=>{let t=o=>Uo.createElement(ml,{...o,variant:e});return t.displayName=`Button.${e}`,[e,t]})),gc=Object.assign(ml,fc);export{Rt as Box,gc as Button,Ke as CheckBox,rt as FormLabel,Xo as FormTextField,pc as FrigadeBanner,xr as FrigadeChecklist,qe as FrigadeDefaultAppearance,lc as FrigadeEmbeddedTip,Ei as FrigadeForm,zd as FrigadeGuide,Od as FrigadeHeroChecklist,mc as FrigadeNPSSurvey,Md as FrigadeProgressBadge,Dp as FrigadeProvider,nc as FrigadeSupportWidget,ec as FrigadeTour,Bt as ProgressRing,Tr as Text,lr as tokens,Fe as useFlowOpens,Ht as useFlowResponses,R as useFlows,nr as useOrganization,Vt as useUser};
|
|
1603
1603
|
//# sourceMappingURL=index.mjs.map
|