@frigade/react 1.33.0 → 1.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +118 -120
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +168 -170
- 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 Pp,useEffect as vo,useState as Ae}from"react";import{ThemeProvider as vp}from"styled-components";import gt,{useContext as op,useEffect as Fo,useState as sr}from"react";import{useCallback as mt,useContext as Fl,useEffect as kl}from"react";import _o,{useMemo as Pr}from"react";var kr="1.33.0 ";var Be="NOT_STARTED_STEP",R="COMPLETED_FLOW",lo="ABORTED_FLOW",ct="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 ml="frigade-last-call-at-",ul="frigade-last-call-data-";function Tt(){let{shouldGracefullyDegrade:e,readonly:t}=_o.useContext(G);return async(o,i)=>{if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return wt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),wt();let r=ml+o,n=ul+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 wt()}window.localStorage.setItem(r,new Date().toISOString()),window.localStorage.setItem(n,i.body)}let s;try{s=await fetch(o,i)}catch(p){return wt(p)}return s?s.ok?s:wt(s.statusText):wt()}}function wt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Ft(){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 bl,useState as vr}from"react";import{useContext as gl,useEffect as hl,useState as xl}from"react";import Cl from"swr";import{useContext as fl}from"react";function Fe(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:r}=fl(G);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 x(c){return Object.entries(e).some(([f,y])=>y&&f!=c)||o}return{getOpenFlowState:n,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:x,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:a}}import yl 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}=gl(G),{resetOpenFlowState:d}=Fe(),[a,x]=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)),y=o&&n&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,{data:T,isLoading:P,mutate:g,error:v}=p?yl(y,f):Cl(y,f,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),h=T==null?void 0:T.data;hl(()=>{!a&&!P&&h&&x(!0)},[h,a,P]);async function F(C){if(h&&!p){let B=h.find(O=>O.flowId===C);B&&B.flowState!==R&&(B.flowState=R),await g(Promise.resolve({...T,data:h}),{optimisticData:{...T,data:h},revalidate:!1,rollbackOnError:!1})}}async function I(C,B,O){if(h){let M=h.find(N=>N.flowId===C);M&&(M.stepStates[B]=O,M.flowState=ct),await g(Promise.resolve({...T,data:h}),{optimisticData:{...T,data:h},revalidate:!1,rollbackOnError:!1})}}async function S(C,B,O){if(h){let M=h.find(N=>N.flowId===C);M&&(M.lastStepId=B,M.stepStates[B]=O,M.flowState=ct),await g({...T,data:h},{optimisticData:{...T,data:h},revalidate:!1,rollbackOnError:!1})}}async function m(C){if(h){let B=h.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:h},{optimisticData:{...T,data:h},revalidate:!1,rollbackOnError:!1}),d(C))}}async function w(C,B){if(h){let O=h.find(M=>M.flowId===C);O&&O.stepStates[B]!==Be&&(O.stepStates[B]=Be),await g({...T,data:h},{optimisticData:{...T,data:h},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:h,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}=bl(G),[d,a]=vr(new Set),[x,c]=vr(new Set),f=Tt();function y(g){let v=JSON.stringify(g);if(d.has(v))return null;d.add(v),a(d),x.add(g),c(x);let h=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])):h||p(I=>[...I??[],g])})}async function T(g){g.foreignUserId&&(g.actionType===ct||g.actionType===Ie?await y(g):g.actionType===R?await y(g):g.actionType===ao?await y(g):g.actionType===Ne?await y(g):g.actionType===lo?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 h in v.stepStates){let F=v.stepStates[h];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 Pl from"swr";var wl=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Br=e=>{let t=wl.exec(e);if(t===null)return null;let o=null;return t.forEach((i,r)=>{let n=Tl(i,"'","");n.startsWith("flow_")&&(o=n)}),o},Tl=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function ee(){let{config:e,apiUrl:t}=Me(),{flows:o,setFlows:i,userId:r,publicApiKey:n,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:a,setFlowResponses:x,setShouldGracefullyDegrade:c,readonly:f}=Fl(G),y={data:[]},{verifySDKInitiated:T}=Ft(),{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:h,isLoadingUserFlowStateData:F,optimisticallyMarkFlowCompleted:I,optimisticallyMarkFlowNotStarted:S,optimisticallyMarkStepCompleted:m,optimisticallyMarkStepNotStarted:w,optimisticallyMarkStepStarted:C}=Ee(),{data:B,error:O,isLoading:M}=Pl(n?`${t}flows${f?"?readonly=true":""}`:null,v,{keepPreviousData:!0});kl(()=>{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 dt=je(Z);return{handleSecondaryButtonClick:()=>{Z.skippable===!0&&ge(u,Z.id,{skipped:!0})},...Z,complete:pe(u,Z.id)===Ne||dt>=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:dt}}).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=mt(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,h]),V=mt(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,h]),ge=mt(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,h]),oe=mt(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),K(E)&&P(E)},[r,h]),q=mt(async(u,b)=>{T();let E={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:ct,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};K(E)&&P(E)},[r,h]),he=mt(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,h]),Te=mt(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,h]);function K(u){var b;if(!h&&u.actionType===Be)return!1;if(h){let E=h.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=h==null?void 0:h.find(A=>A.flowId===u);return!E||!E.stepStates[b]?null:E.stepStates[b]??null}function j(u){var E;if(F||!h)return null;if(De(u)===Ie)return L(u)[0]??null;let b=(E=h.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=pt(b),A=W(b);return A===0?void 0:E/A}function De(u){let b=h==null?void 0:h.find(E=>E.flowId===u);return b?b.flowState:null}function pt(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&&h){let b=h.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:he,markFlowAborted:Te,markStepNotStarted:V,getFlowStatus:De,getNumberOfStepsCompleted:pt,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 vl,useEffect as Bl}from"react";var kt="guest_";function Vt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=vl(G),{config:n,apiUrl:s}=Me(),{mutateUserFlowState:p}=Ee(),d=Tt(),{verifySDKInitiated:a}=Ft();Bl(()=>{if(e&&!t){if(e.startsWith(kt))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 x=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:x,trackEventForUser:c}}import{v4 as rp}from"uuid";import ze,{useEffect as Za,useState as Ra}from"react";import Le,{useEffect as Dl}from"react";import mo from"styled-components";import El from"react";import Al 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 Il=Al.div`
|
|
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`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -23,11 +23,11 @@ import ht,{createContext as Pp,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})=>Bl.createElement(Al,{className:l("modalBackground",t),onClick:()=>e()});import Ho from"react";import Il from"styled-components";var Nl=Il.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
|
-
`,ke=()=>Ho.createElement(
|
|
30
|
+
`,ke=()=>Ho.createElement(Nl,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 Dl}from"react-portal";import Vr from"react";import Vo from"react";function Ll({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=Ll;import jo from"styled-components";import et from"styled-components";var po=et.div`
|
|
31
31
|
${e=>k(e)} {
|
|
32
32
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
33
33
|
}
|
|
@@ -58,7 +58,6 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
58
58
|
display: block;
|
|
59
59
|
width: 100%;
|
|
60
60
|
height: auto;
|
|
61
|
-
min-height: 200px;
|
|
62
61
|
margin-top: ${e=>e.dismissible?"24px":"0px"};
|
|
63
62
|
margin-bottom: 16px;
|
|
64
63
|
}
|
|
@@ -126,7 +125,7 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
126
125
|
font-size: 12px;
|
|
127
126
|
line-height: 18px;
|
|
128
127
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
129
|
-
`;function co({appearance:e}){return Vr.createElement(Hr,{className:l("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",Vr.createElement(Nr,null))}var
|
|
128
|
+
`;function co({appearance:e}){return Vr.createElement(Hr,{className:l("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",Vr.createElement(Nr,null))}var $l=mo.div`
|
|
130
129
|
${e=>k(e)} {
|
|
131
130
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
132
131
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -168,10 +167,10 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
168
167
|
opacity: 1;
|
|
169
168
|
}
|
|
170
169
|
}
|
|
171
|
-
`,
|
|
170
|
+
`,Ml=mo.div`
|
|
172
171
|
position: relative;
|
|
173
172
|
flex: 0 1 auto;
|
|
174
|
-
`,
|
|
173
|
+
`,Ul=mo.div`
|
|
175
174
|
position: absolute;
|
|
176
175
|
top: 24px;
|
|
177
176
|
right: 24px;
|
|
@@ -181,14 +180,14 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
181
180
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
182
181
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
183
182
|
}
|
|
184
|
-
`,
|
|
183
|
+
`,zl=mo.div`
|
|
185
184
|
overflow: scroll;
|
|
186
185
|
flex: 1 1;
|
|
187
186
|
display: flex;
|
|
188
187
|
::-webkit-scrollbar {
|
|
189
188
|
display: none;
|
|
190
189
|
}
|
|
191
|
-
`,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})=>(Ol(()=>{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(Dl,null,Le.createElement(Ir,{appearance:n,onClose:()=>{s&&e()}}),Le.createElement($l,{appearance:n,className:l("modalContainer",n),styleOverrides:i},s&&Le.createElement(Ul,{className:l("modalClose",n),onClick:()=>e(),appearance:n},Le.createElement(ke,null)),o&&Le.createElement(Ml,null,o),Le.createElement(zl,null,r),p&&Le.createElement(_r,{appearance:n,className:l("poweredByFrigadeRibbon",n)},Le.createElement(co,{appearance:n})))):Le.createElement(Le.Fragment,null));import ot,{useEffect as _l}from"react";import uo from"styled-components";import{Portal as Wl}from"react-portal";var Hl=uo.div`
|
|
192
191
|
${e=>k(e)} {
|
|
193
192
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
194
193
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -206,10 +205,10 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
206
205
|
bottom: 0;
|
|
207
206
|
margin-right: 28px;
|
|
208
207
|
margin-bottom: 28px;
|
|
209
|
-
`,
|
|
208
|
+
`,Vl=uo.div`
|
|
210
209
|
position: relative;
|
|
211
210
|
flex: 1;
|
|
212
|
-
`,
|
|
211
|
+
`,jl=uo.div`
|
|
213
212
|
position: absolute;
|
|
214
213
|
top: 24px;
|
|
215
214
|
right: 24px;
|
|
@@ -219,13 +218,13 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
219
218
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
220
219
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
221
220
|
}
|
|
222
|
-
`,
|
|
221
|
+
`,Gl=uo.div`
|
|
223
222
|
overflow: scroll;
|
|
224
223
|
flex: 5;
|
|
225
224
|
::-webkit-scrollbar {
|
|
226
225
|
display: none;
|
|
227
226
|
}
|
|
228
|
-
`,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})=>(_l(()=>{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(Wl,null,ot.createElement(Hl,{appearance:r,className:l("cornerModalContainer",r)},ot.createElement(jl,{className:l("cornerModalClose",r),onClick:()=>e()},ot.createElement(ke,null)),o&&ot.createElement(Vl,null,o),ot.createElement(Gl,null,i))):ot.createElement(ot.Fragment,null));import{useContext as ql}from"react";function te(){let{defaultAppearance:e}=ql(G);function t(o){let i=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign(i.styleOverrides??{},o.styleOverrides??{}),theme:Object.assign(i.theme,o.theme??{})}:i}return{mergeAppearanceWithDefault:t}}import it,{useContext as xa,useEffect as ha,useState as Ro}from"react";import Co from"styled-components";import xo,{useEffect as Kl,useState as Jr}from"react";import Ko from"styled-components";import fo from"styled-components";var Gr=fo.label`
|
|
229
228
|
${e=>k(e)} {
|
|
230
229
|
font-size: 14px;
|
|
231
230
|
line-height: 20px;
|
|
@@ -253,7 +252,7 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
253
252
|
align-items: flex-start;
|
|
254
253
|
justify-content: left;
|
|
255
254
|
margin-bottom: 10px;
|
|
256
|
-
`;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(go,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
|
|
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(go,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(go,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 Yl=Ko.div`
|
|
257
256
|
display: flex;
|
|
258
257
|
flex-direction: column;
|
|
259
258
|
width: 100%;
|
|
@@ -273,7 +272,7 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
273
272
|
box-sizing: border-box;
|
|
274
273
|
padding: 0 10px;
|
|
275
274
|
margin-bottom: 10px;
|
|
276
|
-
`,
|
|
275
|
+
`,Xl=Ko.textarea`
|
|
277
276
|
${e=>k(e)} {
|
|
278
277
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
279
278
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -289,13 +288,13 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
289
288
|
min-height: 70px;
|
|
290
289
|
box-sizing: border-box;
|
|
291
290
|
margin-bottom: 10px;
|
|
292
|
-
`;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),
|
|
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;Kl(()=>{s===""&&!d&&(a(!0),c(""))},[]);function c(S){if(p(S),o({text:S}),n.required===!0&&S.trim()===""){i([{id:n.id,message:`${n.title??"Field"} is required`}]);return}let T=Xr(S,n.validation);if(T){i([{id:n.id,message:T}]);return}i([])}n.multiline&&(h=Xl);function f(){var S;switch((S=n==null?void 0:n.validation)==null?void 0:S.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return xo.createElement(Yl,null,xo.createElement(rt,{title:n.title,required:n.required,appearance:t.appearance}),xo.createElement(h,{className:l("inputComponent",t.appearance),value:s,onChange:S=>{c(S.target.value)},appearance:t.appearance,placeholder:n.placeholder,type:f()}),xo.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="",Jl=Rr.div`
|
|
293
292
|
display: flex;
|
|
294
293
|
flex-direction: column;
|
|
295
294
|
width: 100%;
|
|
296
295
|
-webkit-appearance: none;
|
|
297
296
|
appearance: none;
|
|
298
|
-
`,
|
|
297
|
+
`,Ql=Rr.select`
|
|
299
298
|
${e=>k(e)} {
|
|
300
299
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
301
300
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -316,15 +315,15 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
316
315
|
background-repeat: no-repeat;
|
|
317
316
|
background-size: 1.5em 1.5em;
|
|
318
317
|
-webkit-print-color-adjust: exact;
|
|
319
|
-
`;function ei({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var
|
|
318
|
+
`;function ei({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var h,c,f,S,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(y=>y.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(Jl,null,Ue.createElement(rt,{title:n.title,required:!1,appearance:t.appearance}),Ue.createElement(Ql,{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))),((S=(f=n.props.options)==null?void 0:f.find(g=>g.id===s))==null?void 0:S.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 Zl}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(Zl.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"})},Rl=({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=Rl;import ea from"styled-components";var ta=({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"})),oa={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},ra={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},ia={border:"1px solid #000000",color:"#FFFFFF"},na={border:"1px solid #E6E6E6"},sa={color:"#FFFFFF"},la={border:"3px solid #D9D9D9"},aa=e=>e==="square"?oa:ra,pa=(e,t)=>e==="square"?t?ia:na:t?sa:la,da=ea.div`
|
|
320
319
|
${e=>Ge(e)}
|
|
321
|
-
`,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=aa(t),d=pa(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(da,{styleOverrides:p,style:n,role:"checkbox",className:Ce(l("checkIconContainer",r),l(e?"checkIconContainerChecked":"checkIconContainerUnchecked",r),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&Kt.createElement(ta,{color:"#FFFFFF"}))};var ca=ri.div`
|
|
322
321
|
display: flex;
|
|
323
322
|
flex-direction: column;
|
|
324
323
|
width: 100%;
|
|
325
324
|
-webkit-appearance: none;
|
|
326
325
|
appearance: none;
|
|
327
|
-
`,
|
|
326
|
+
`,ma=ri.button`
|
|
328
327
|
${e=>k(e)} {
|
|
329
328
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
330
329
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -349,7 +348,7 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
349
348
|
height: 60px;
|
|
350
349
|
padding: 0 18px;
|
|
351
350
|
margin-bottom: 10px;
|
|
352
|
-
`;function ii({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var
|
|
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(ca,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(ma,{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 ho from"react";import ni from"styled-components";import ua from"dompurify";function me(e){return{__html:ua.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var fa=ni.h1`
|
|
353
352
|
${e=>k(e)} {
|
|
354
353
|
font-style: normal;
|
|
355
354
|
font-weight: 600;
|
|
@@ -360,7 +359,7 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
360
359
|
margin-bottom: 4px;
|
|
361
360
|
color: ${e=>e.appearance.theme.colorText};
|
|
362
361
|
}
|
|
363
|
-
`,
|
|
362
|
+
`,ga=ni.h2`
|
|
364
363
|
${e=>k(e)} {
|
|
365
364
|
font-style: normal;
|
|
366
365
|
font-weight: 400;
|
|
@@ -368,40 +367,40 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
368
367
|
line-height: 20px;
|
|
369
368
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
370
369
|
}
|
|
371
|
-
`;function
|
|
370
|
+
`;function Se({appearance:e,title:t,subtitle:o,size:i="medium",classPrefix:r=""}){return ho.createElement(ho.Fragment,null,ho.createElement(fa,{appearance:e,className:l(`${r}${r?Gt(i):i}Title`,e),dangerouslySetInnerHTML:me(t),size:i}),o&&ho.createElement(ga,{appearance:e,className:l(`${r}${r?Gt(i):i}Subtitle`,e),dangerouslySetInnerHTML:me(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 Ca,motion as Sa}from"framer-motion";var ya=Co.div`
|
|
372
371
|
display: flex;
|
|
373
372
|
flex-direction: column;
|
|
374
373
|
justify-content: flex-end;
|
|
375
374
|
padding-bottom: 14px;
|
|
376
375
|
overflow: visible;
|
|
377
|
-
`,
|
|
376
|
+
`,ba=Co(Sa.div)`
|
|
378
377
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextError}};
|
|
379
378
|
font-size: 12px;
|
|
380
379
|
margin-bottom: 12px;
|
|
381
380
|
display: flex;
|
|
382
381
|
align-items: center;
|
|
383
|
-
`,
|
|
382
|
+
`,wa=Co.div`
|
|
384
383
|
margin-right: 4px;
|
|
385
384
|
display: inline-flex;
|
|
386
|
-
`,
|
|
385
|
+
`,Ta=Co.div`
|
|
387
386
|
padding-left: 1px;
|
|
388
387
|
padding-right: 1px;
|
|
389
|
-
`,
|
|
388
|
+
`,Fa={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(),[S,T]=Ro(x()||{}),{readonly:P}=xa(G),g={...Fa,...s};ha(()=>{i(d.length===0)},[d,i]);function v(y,m){let w={...S,[y.id]:m};T(w),r(w),window&&window.localStorage&&!P&&window.localStorage.setItem(F(),JSON.stringify(w))}function x(){if(window&&window.localStorage){let y=window.localStorage.getItem(F());if(y)return JSON.parse(y)}return{}}function F(){return`frigade-multiInputStepTypeData-${e}-${t.id}-${f}`}return it.createElement(Ta,{className:l("multiInput",n)},it.createElement(Se,{appearance:n,title:t.title,subtitle:t.subtitle}),it.createElement(ya,{className:l("multiInputContainer",n)},(I=p.data)==null?void 0:I.map(y=>{var w;let m=(w=d.reverse().find(C=>C.id===y.id))==null?void 0:w.message;return g[y.type]?it.createElement("span",{key:y.id,"data-field-id":y.id,className:l("multiInputField",n)},g[y.type]({formInput:y,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:r,appearance:n},onSaveInputData:C=>{!h.includes(y.id)&&C&&(C==null?void 0:C.text)!==""&&c(B=>[...B,y.id]),v(y,C)},inputData:S[y.id],setFormValidationErrors:C=>{a(B=>C.length===0?B.filter(O=>O.id!==y.id):[...B,...C])}}),it.createElement(Ca,null,m&&h.includes(y.id)&&it.createElement(ba,{initial:{opacity:0,height:0,marginBottom:0},animate:{opacity:1,height:"auto",marginBottom:12},exit:{opacity:0,height:0,marginBottom:0},key:y.id,style:{overflow:"hidden"},transition:{duration:.1,ease:"easeInOut",delay:.5},appearance:n,className:l("multiInputValidationError",n)},it.createElement(wa,{appearance:n,className:l("multiInputValidationErrorIcon",n)},it.createElement(si,null)),m))):null})))}import ft from"styled-components";var ai=ft.div`
|
|
390
389
|
align-items: center;
|
|
391
390
|
display: flex;
|
|
392
391
|
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
393
392
|
padding-top: 14px;
|
|
394
|
-
`,pi=
|
|
393
|
+
`,pi=ft.div`
|
|
395
394
|
color: ${e=>e.appearance.theme.colorTextError};
|
|
396
395
|
font-size: 12px;
|
|
397
|
-
`,di=
|
|
396
|
+
`,di=ft.div`
|
|
398
397
|
display: flex;
|
|
399
398
|
gap: 12px;
|
|
400
|
-
`,ci=
|
|
399
|
+
`,ci=ft.div`
|
|
401
400
|
display: flex;
|
|
402
401
|
flex-direction: row;
|
|
403
402
|
flex: 1 1;
|
|
404
|
-
`,mi=
|
|
403
|
+
`,mi=ft.div`
|
|
405
404
|
display: flex;
|
|
406
405
|
// If type is set to large-modal, use padding 60px horizontal, 80px vertical
|
|
407
406
|
// Otherwise, use 4px padding
|
|
@@ -409,11 +408,11 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
409
408
|
flex-grow: 1;
|
|
410
409
|
flex-basis: 0;
|
|
411
410
|
position: relative;
|
|
412
|
-
`,ui=
|
|
411
|
+
`,ui=ft.div`
|
|
413
412
|
padding: ${e=>e.type==="large-modal"?"50px":"0px"};
|
|
414
413
|
position: relative;
|
|
415
414
|
overflow-y: auto;
|
|
416
|
-
`,fi=
|
|
415
|
+
`,fi=ft.div`
|
|
417
416
|
display: flex;
|
|
418
417
|
align-self: stretch;
|
|
419
418
|
flex-grow: 1;
|
|
@@ -425,7 +424,7 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
425
424
|
background-position: center;
|
|
426
425
|
border-top-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
427
426
|
border-bottom-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
428
|
-
`;import nt from"react";import
|
|
427
|
+
`;import nt from"react";import ka from"react";import gi from"styled-components";var Pa=gi.button`
|
|
429
428
|
justify-content: center;
|
|
430
429
|
align-content: center;
|
|
431
430
|
${e=>k(e)} {
|
|
@@ -456,24 +455,25 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
456
455
|
opacity: 0.3;
|
|
457
456
|
cursor: not-allowed;
|
|
458
457
|
}
|
|
459
|
-
`,
|
|
458
|
+
`,So=gi.div`
|
|
460
459
|
${e=>k(e)} {
|
|
461
460
|
display: flex;
|
|
462
461
|
flex-direction: row;
|
|
463
462
|
justify-content: flex-start;
|
|
463
|
+
margin-top: 8px;
|
|
464
464
|
|
|
465
465
|
& > * {
|
|
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
|
|
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 ka.createElement(Pa,{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 va from"styled-components";var Ba=va.div`
|
|
470
470
|
text-align: center;
|
|
471
|
-
`,
|
|
471
|
+
`,hi=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:r}=te().mergeAppearanceWithDefault(i);return er.createElement(Ba,{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 Ea}from"react";function le(){let e=Ea(G);function t(r){i(r.primaryButtonUri,r.primaryButtonUriTarget)}function o(r){i(r.secondaryButtonUri,r.secondaryButtonUriTarget)}function i(r,n){if(!r)return;let s=r.startsWith("http")?"_blank":"_self";n&&n!=="_blank"&&(s="_self"),e.navigate(r,s)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:i}}var Aa=Et.div`
|
|
472
472
|
display: flex;
|
|
473
473
|
flex-wrap: wrap;
|
|
474
474
|
align-content: center;
|
|
475
475
|
justify-content: center;
|
|
476
|
-
`,
|
|
476
|
+
`,Ia=Et.div`
|
|
477
477
|
align-content: center;
|
|
478
478
|
align-items: center;
|
|
479
479
|
display: flex;
|
|
@@ -487,10 +487,10 @@ import ht,{createContext as Pp,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
|
+
`,Na=Et.img`
|
|
491
491
|
width: 78px;
|
|
492
492
|
height: auto;
|
|
493
|
-
`,
|
|
493
|
+
`,La=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 Pp,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
|
+
`,Oa=Et.h1`
|
|
507
507
|
font-weight: 700;
|
|
508
508
|
font-size: 28px;
|
|
509
509
|
line-height: 34px;
|
|
510
|
-
|
|
510
|
+
`,Da=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 Pp,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}=le();return
|
|
519
|
+
`;function Ci({stepData:e,appearance:t}){var i,r;let{handleUrl:o}=le();return gt.createElement("div",null,gt.createElement(Oa,null,e.title),gt.createElement(Da,null,e.subtitle),gt.createElement(Aa,null,(r=(i=e.props)==null?void 0:i.links)==null?void 0:r.map(n=>gt.createElement(Ia,{key:n.title},gt.createElement(Na,{src:n.imageUri}),gt.createElement(La,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{n.uri&&o(n.uri,n.uriTarget??"_blank")}},n.title)))))}import At,{useEffect as Ha}from"react";import wo from"styled-components";import tr from"react";var yo=({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 $a,useState as Ma}from"react";import bo from"styled-components";var Ua=bo.div`
|
|
520
520
|
display: flex;
|
|
521
521
|
align-items: center;
|
|
522
522
|
justify-content: flex-start;
|
|
@@ -524,7 +524,7 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
524
524
|
width: 100%;
|
|
525
525
|
height: 100%;
|
|
526
526
|
position: relative;
|
|
527
|
-
`,
|
|
527
|
+
`,za=bo.div`
|
|
528
528
|
position: absolute;
|
|
529
529
|
display: flex;
|
|
530
530
|
align-items: center;
|
|
@@ -543,57 +543,55 @@ import ht,{createContext as Pp,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
|
+
`,_a=bo.video`
|
|
547
547
|
width: 100%;
|
|
548
548
|
height: 100%;
|
|
549
|
-
min-height: 200px;
|
|
550
549
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
551
|
-
`,
|
|
550
|
+
`,Wa=bo.iframe`
|
|
552
551
|
width: 100%;
|
|
553
552
|
height: 100%;
|
|
554
|
-
min-height: 200px;
|
|
555
553
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
556
|
-
`;function
|
|
554
|
+
`;function st({appearance:e,videoUri:t}){let o=$a(),[i,r]=Ma(!1);if(t.includes("youtube")){let n=t.split("v=")[1],s=n.indexOf("&");return s!==-1&&(n=n.substring(0,s)),Xt.createElement(Wa,{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(Ua,{className:l("videoPlayerWrapper",e),appearance:e},!i&&Xt.createElement(za,{onClick:()=>{r(!0),o.current.play()},appearance:e},Xt.createElement(yo,null)),Xt.createElement(_a,{appearance:e,controls:i,ref:o,play:i,src:t}))}var Va=wo.div`
|
|
557
555
|
${e=>k(e)} {
|
|
558
556
|
display: flex;
|
|
559
557
|
flex-direction: column;
|
|
560
558
|
justify-content: center;
|
|
561
559
|
}
|
|
562
|
-
`,
|
|
560
|
+
`,ja=wo.img`
|
|
563
561
|
${e=>k(e)} {
|
|
564
562
|
width: 100%;
|
|
565
563
|
height: auto;
|
|
566
564
|
max-height: 250px;
|
|
567
565
|
margin-bottom: 24px;
|
|
568
566
|
}
|
|
569
|
-
`,
|
|
567
|
+
`,Ga=wo.div`
|
|
570
568
|
${e=>k(e)} {
|
|
571
569
|
margin-bottom: 24px;
|
|
572
570
|
}
|
|
573
|
-
`,
|
|
571
|
+
`,qa=wo.div`
|
|
574
572
|
${e=>k(e)} {
|
|
575
573
|
width: 100%;
|
|
576
574
|
height: auto;
|
|
577
575
|
max-height: 250px;
|
|
578
576
|
margin-bottom: 24px;
|
|
579
577
|
}
|
|
580
|
-
`;function
|
|
578
|
+
`;function Si({stepData:e,appearance:t,setCanContinue:o}){return Ha(()=>{o(!0)},[]),At.createElement(Va,{className:l("callToActionContainer",t)},At.createElement(Ga,{className:l("callToActionTextContainer",t)},At.createElement(Se,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&At.createElement(ja,{className:l("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&At.createElement(qa,{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 yi=lt.div`
|
|
581
579
|
width: auto;
|
|
582
580
|
display: flex;
|
|
583
581
|
flex-direction: column;
|
|
584
582
|
justify-content: center;
|
|
585
583
|
align-items: center;
|
|
586
584
|
padding: 4px;
|
|
587
|
-
`,bi=
|
|
585
|
+
`,bi=lt.div`
|
|
588
586
|
width: 100%;
|
|
589
587
|
text-align: left;
|
|
590
|
-
`,wi=
|
|
588
|
+
`,wi=lt.h1`
|
|
591
589
|
font-style: normal;
|
|
592
590
|
font-weight: 700;
|
|
593
591
|
font-size: 32px;
|
|
594
592
|
line-height: 38px;
|
|
595
593
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
596
|
-
`,Ti=
|
|
594
|
+
`,Ti=lt.h1`
|
|
597
595
|
font-style: normal;
|
|
598
596
|
font-weight: 400;
|
|
599
597
|
font-size: 16px;
|
|
@@ -601,7 +599,7 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
601
599
|
margin-top: 16px;
|
|
602
600
|
margin-bottom: 16px;
|
|
603
601
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
604
|
-
`,Fi=
|
|
602
|
+
`,Fi=lt.div`
|
|
605
603
|
padding-top: 12px;
|
|
606
604
|
padding-bottom: 12px;
|
|
607
605
|
flex-direction: row;
|
|
@@ -612,17 +610,17 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
612
610
|
cursor: pointer;
|
|
613
611
|
border-bottom: ${e=>e.hideBottomBorder?"none":"1px solid #D8D8D8"};
|
|
614
612
|
width: 100%;
|
|
615
|
-
`,ki=
|
|
613
|
+
`,ki=lt.div`
|
|
616
614
|
padding-top: 10px;
|
|
617
615
|
padding-bottom: 10px;
|
|
618
616
|
flex-direction: row;
|
|
619
617
|
display: flex;
|
|
620
618
|
justify-content: flex-start;
|
|
621
|
-
`,Pi=
|
|
619
|
+
`,Pi=lt.img`
|
|
622
620
|
width: 42px;
|
|
623
621
|
height: 42px;
|
|
624
622
|
margin-right: 12px;
|
|
625
|
-
`,vi=
|
|
623
|
+
`,vi=lt.p`
|
|
626
624
|
font-style: normal;
|
|
627
625
|
font-weight: 500;
|
|
628
626
|
font-size: 17px;
|
|
@@ -630,8 +628,8 @@ import ht,{createContext as Pp,useEffect as vo,useState as Ae}from"react";import
|
|
|
630
628
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
631
629
|
display: flex;
|
|
632
630
|
align-self: center;
|
|
633
|
-
`;var Bi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let r=e.props,[n,s]=rr([]),[p,d]=rr(!1),[a,
|
|
634
|
-
${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:x,onButtonClick:c,dismissible:f=!0,endFlowOnDismiss:y=!1,modalPosition:T="center",repeatable:P=!1,onDismiss:g,showPagination:v=!1,allowBackNavigation:h=!1,validationHandler:F,showFrigadeBranding:I=!1})=>{let{getFlow:S,getFlowSteps:m,isLoading:w,targetingLogicShouldHideFlow:C,getFlowStatus:B,getCurrentStepIndex:O,markFlowCompleted:M,markFlowNotStarted:N}=ee(),L=O(e),{mergeAppearanceWithDefault:H}=te(),[$,J]=Ra(!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(Za(()=>{!$&&!w&&(J(!0),B(e)===R&&P&&N(e),J(!0))},[$,J,w]),w)return null;let q=S(e);if(!q||C(q))return null;let he=m(e);if(!he||i!==void 0&&i===!1||B(e)===R&&a||(o=="modal"||o=="corner-modal")&&V(e))return null;let Te=()=>{oe(!1),g&&g(),y===!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:he,selectedStep:L,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:x,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:oe,onDismiss:g,showPagination:v,customFormElements:s,allowBackNavigation:h,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:he,selectedStep:L,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:x,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:oe,onDismiss:g,showPagination:v,customFormElements:s,allowBackNavigation:h,validationHandler:F})):ze.createElement(ze.Fragment,null,ze.createElement(se,{appearance:d}),ze.createElement(To,{appearance:d,steps:he,selectedStep:L,customStepTypes:t,customVariables:n,onButtonClick:c,onStepCompletion:x,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:oe,onDismiss:g,showPagination:v,customFormElements:s,allowBackNavigation:h,validationHandler:F}))},Ai=Ei;import{useCallback as Ii,useContext as ep,useEffect as tp}from"react";function nr(){let{organizationId:e,userId:t,setOrganizationId:o}=ep(G),{mutateUserFlowState:i}=Ee(),{config:r,apiUrl:n}=Me(),s=Tt(),{verifySDKInitiated:p}=Ft();tp(()=>{if(t&&e){if(t.startsWith(kt))return;let x=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(x)||(s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(x,"true"))}},[t,e]);let d=Ii(async x=>{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:x};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(c)}),i()},[e,t,r,i]),a=Ii(async(x,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:x,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}=ee(),{flows:a,userProperties:x,setIsNewGuestUser:c,flowResponses:f}=op(G),[y,T]=sr([]),[P,g]=sr([]),{organizationId:v}=nr();Fo(()=>{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(()=>{h(m.flowId)},500);break}}},[o,t]),Fo(()=>{f.length>0&&i()},[f]);function h(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=kt+rp();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 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 O=new Image;O.src=B,S.push(B)})}})}}catch{}},[a]),Fo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(kt))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,x]);function I(){return gt.createElement(gt.Fragment,null,y.map(S=>d(S.slug)!==Ie?null:gt.createElement("span",{key:S.slug},gt.createElement(Ai,{flowId:S.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return gt.createElement(gt.Fragment,null,gt.createElement(I,null))};import{ErrorBoundary as Bp}from"react-error-boundary";import{deepmerge as Ep}from"deepmerge-ts";import Cp from"styled-components";import{compose as yp,variant as Di}from"styled-system";import Oi from"react";import ip,{ThemeProvider as np,useTheme as sp}from"styled-components";import{border as lp,color as ap,compose as pp,get as dp,shadow as cp,space as mp,system as up,typography as fp}from"styled-system";import{deepmerge as gp}from"deepmerge-ts";var hp={width:{property:"width",scale:"sizes",transform:(e,t)=>dp(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=ip("div")(({css:e})=>e,pp(lp,ap,cp,mp,fp,up(hp))),ko=({as:e,children:t,overrides:o,...i})=>{let r=sp(),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=gp(r,o);return Oi.createElement(np,{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=Cp(ko)(()=>({whiteSpace:"nowrap"}),yp(Di({scale:"components.Button",variants:"components.Button"}),Di({prop:"size",variants:Sp})));import bp from"styled-components";import{variant as wp,system as Tp}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=bp(ko)(wp({scale:"components.Text",variants:"components.Text"}),Tp({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Ui=4,zi="px",Fp=20,kp=Object.fromEntries(Array.from(Array(Fp+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:kp,components:{Button:Rt,Text:Po}};var _i="https://api.frigade.com",G=Pp({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 Ap(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var Ip=({publicApiKey:e,userId:t,organizationId:o,config:i,children:r})=>{var Q,Y;let[n,s]=Ae(t||null),[p,d]=Ae(o||null),[a,x]=Ae([]),[c,f]=Ae([]),[y,T]=Ae([]),[P,g]=Ae({}),[v,h]=Ae({}),[F,I]=Ae([]),[S,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&&Ap()},[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:x,flows:a,failedFlowResponses:c,setFailedFlowResponses:f,flowResponses:y,setFlowResponses:T,userProperties:P,setUserProperties:g,openFlowStates:v,setOpenFlowStates:h,completedFlowsToKeepOpenDuringSession:F,setCompletedFlowsToKeepOpenDuringSession:I,customVariables:S,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(Bp,{fallback:ht.createElement(ht.Fragment,null,r)},ht.createElement(G.Provider,{value:J},ht.createElement(vp,{theme:Ep(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 Cs}from"react";import Oe,{useState as Rp}from"react";import yt from"styled-components";import Ao from"react";import xt 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(yi,{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 S=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:S,primaryColor:i.theme.colorPrimary}))}))};import ye,{useEffect as ir,useState as Jt}from"react";import{AnimatePresence as Ka,motion as Ya}from"framer-motion";var Xa=({children:e,id:t,shouldWrap:o=!1})=>ye.createElement(ye.Fragment,null,o?ye.createElement(Ka,{initial:!1},ye.createElement(Ya.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),To=({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:S,showPagination:T=!1,customFormElements:P,allowBackNavigation:g,validationHandler:v})=>{var _;let F={...{linkCollection:Ci,multiInput:li,callToAction:Si,selectList:Bi},...i},{primaryCTAClickSideEffects:I,secondaryCTAClickSideEffects:y}=le(),[m,w]=Jt(!1),[C,B]=Jt({}),[O,M]=Jt(!1),[N,L]=Jt(!1),[H,$]=Jt(null),J=t[o]??null,{markStepCompleted:Q,markStepStarted:Y,isLoading:V,updateCustomVariables:ge,markFlowCompleted:oe}=ee();ir(()=>{ge(r)},[r,V]),ir(()=>{window&&g&&!N&&(window.location.hash=t[o].id,L(!0))},[g,N,L]),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("#",""),j=t.findIndex(ie=>ie.id===re);j!==-1&&Y(p,t[j].id)}},[(_=window==null?void 0:window.location)==null?void 0:_.hash,Y,o,t]);function q(){return{data:C[t[o].id]??{},stepId:t[o].id,customVariables:r}}function xe(D,re,j){let ie=o+1<t.length?t[o+1]:null;return s&&s(D,j,ie,C,q()),n?n(D,o,re,ie):!0}function Te(D,re){B(j=>{let ie={};return ie[D.id]=re,{...j,...ie}})}function K(D){return D.selectedStep.imageUri?ye.createElement(fi,{image:D.selectedStep.imageUri,appearance:e,className:l("formContainerSidebarImage",e)}):null}let pe=ye.createElement(xi,{step:t[o],canContinue:m&&!O,formType:d,selectedStep:o,appearance:e,onPrimaryClick:async()=>{if(M(!0),v){let j=await v(t[o],o,t[o+1],C,q());if(j){$(j),M(!1);return}else $(null)}let D={...q()};await Q(p,t[o].id,D),o+1<t.length&&await Y(p,t[o+1].id);let re=xe(t[o],"primary",o);o+1>=t.length&&(h&&h(),S&&S(),a&&re&&(c&&c(!1),f(!1)),await oe(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),y(t[o])},onBack:async()=>{o-1>=0&&(M(!0),await Y(p,t[o-1].id),M(!1))},steps:t,allowBackNavigation:g,errorMessage:H});return ye.createElement(ye.Fragment,null,ye.createElement(ci,{className:l("formContainer",e)},ye.createElement(mi,null,ye.createElement(Xa,{id:o,shouldWrap:d==="large-modal"},ye.createElement(ui,{key:J.id,type:d,className:l("formContent",e)},t.map(D=>{let re=F[D.type];return J.id!==D.id?null:ye.createElement(re,{key:D.id,stepData:D,canContinue:m,setCanContinue:w,onSaveData:j=>{Te(D,j)},appearance:e,customFormElements:P,flowId:p})}),T&&ye.createElement(hi,{className:l("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),pe))),d=="large-modal"&&ye.createElement(K,{selectedStep:t[o]})))};import Qt from"react";import{createGlobalStyle as Ja}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=Ja`
|
|
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`
|
|
635
633
|
font-weight: 400;
|
|
636
634
|
font-size: 15px;
|
|
637
635
|
line-height: 20px;
|
|
@@ -640,7 +638,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
640
638
|
vertical-align: middle;
|
|
641
639
|
margin-left: 12px;
|
|
642
640
|
padding-right: 12px;
|
|
643
|
-
`,
|
|
641
|
+
`,Ip=Hi.div`
|
|
644
642
|
flex-direction: row;
|
|
645
643
|
justify-content: space-between;
|
|
646
644
|
display: flex;
|
|
@@ -648,14 +646,14 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
648
646
|
padding-bottom: 20px;
|
|
649
647
|
border-top: 1px solid ${e=>e.theme.colorBorder};
|
|
650
648
|
width: 100%;
|
|
651
|
-
`,Bo=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:r,primaryColor:n="#000000",checkBoxType:s="square",appearance:p})=>
|
|
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(Ip,{className:l("checklistStepsContainer",p),appearance:p,style:{...r}},i==="left"&&e&&Ct.createElement(Wi,{className:l("checklistStepLabel",p),style:o},e),Ct.createElement(Ke,{appearance:p,value:t,type:s,primaryColor:n}),i==="right"&&e&&Ct.createElement(Wi,{className:l("checklistStepLabel",p),style:o},e)),Ct.createElement(se,{appearance:p}));import{motion as Np}from"framer-motion";import eo from"styled-components";var Vi=eo.div`
|
|
652
650
|
font-weight: 700;
|
|
653
651
|
font-size: 18px;
|
|
654
652
|
line-height: 22px;
|
|
655
653
|
`,ji=eo.p`
|
|
656
654
|
font-weight: 700;
|
|
657
655
|
font-size: 18px;
|
|
658
|
-
line-height:
|
|
656
|
+
line-height: 30px;
|
|
659
657
|
margin: 20px 0px 0px 0px;
|
|
660
658
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
661
659
|
`,Gi=eo.p`
|
|
@@ -676,18 +674,18 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
676
674
|
`,qi=eo.div`
|
|
677
675
|
flex-direction: row;
|
|
678
676
|
justify-content: flex-start;
|
|
679
|
-
`;var Ki=({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:
|
|
677
|
+
`;var Ki=({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:Np.div,layoutId:"checklis-step-selected",style:{backgroundColor:((p=s==null?void 0:s.theme)==null?void 0:p.colorPrimary)??i}}),Ao.createElement(qi,{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 St from"react";import{motion as Lp}from"framer-motion";import ar from"styled-components";var Op={backgroundColor:"#E6E6E6"},Dp=ar.div`
|
|
680
678
|
display: flex;
|
|
681
679
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
682
680
|
justify-content: flex-start;
|
|
683
681
|
align-items: ${e=>e.textLocation=="top"?"flex-end":"center"};
|
|
684
682
|
|
|
685
683
|
${e=>Ge(e)}
|
|
686
|
-
|
|
684
|
+
`,$p=ar.div`
|
|
687
685
|
flex-grow: 1;
|
|
688
686
|
position: relative;
|
|
689
687
|
${e=>e.textLocation=="top"?"width: 100%;":""}
|
|
690
|
-
`,
|
|
688
|
+
`,Mp=ar.span`
|
|
691
689
|
font-weight: 500;
|
|
692
690
|
font-size: 15px;
|
|
693
691
|
line-height: 18px;
|
|
@@ -695,11 +693,11 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
695
693
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
696
694
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
697
695
|
${e=>Ge(e)}
|
|
698
|
-
`,
|
|
696
|
+
`,Up={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},zp={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},_e=({count:e,total:t,fillColor:o,bgColor:i=Op.backgroundColor,display:r="count",textLocation:n="left",style:s={},textStyle:p={},appearance:d})=>{var T,P;if(t===0)return St.createElement(St.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",S;return r==="count"?S=`${e} of ${t}`:r==="compact"?S=`${c}%`:r==="percent"&&(S=`${c}% complete`),n==="top"&&(f="0px"),St.createElement(Dp,{className:l("progressBarContainer",d),textLocation:n,styleOverrides:s},St.createElement(Mp,{className:l("progressBarStepText",d),style:{...p,fontSize:r==="compact"?12:15,fontWeight:r==="compact"?400:500},appearance:d,padding:f,textLocation:n},S),St.createElement($p,{textLocation:n,className:l("progressBar",d)},St.createElement(Lp.div,{style:{...zp,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)}),St.createElement("div",{className:l("progressBarBackground",d),style:{...Up,height:h,backgroundColor:((P=d==null?void 0:d.theme)==null?void 0:P.colorSecondary)??i}})))};import to from"react";import Wp from"styled-components";import No from"react";import Io from"react";var Nt=({stepData:e,appearance:t})=>Io.createElement(Io.Fragment,null,Io.createElement(ji,{appearance:t,className:l("checklistStepTitle",t),dangerouslySetInnerHTML:me(e.title)}),Io.createElement(Gi,{appearance:t,className:l("checklistStepSubtitle",t),dangerouslySetInnerHTML:me(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 _p from"react";function Yi(e){return _p.createElement(st,{appearance:e.appearance,videoUri:e.videoUri})}var dr="default",Hp=Wp.img`
|
|
699
697
|
border-radius: 4px;
|
|
700
698
|
max-height: 260px;
|
|
701
699
|
min-height: 200px;
|
|
702
|
-
`,
|
|
700
|
+
`,Xi=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return to.createElement("div",null,o)}return to.createElement(Vi,{className:l("checklistStepContent",t)},e.imageUri?to.createElement(Hp,{className:l("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?to.createElement(Yi,{videoUri:e.videoUri,appearance:t}):null,to.createElement(Ot,{stepData:e,appearance:t}))};import Pe,{useRef as Vp,useState as jp}from"react";import Dt from"styled-components";var Ji=Dt.div`
|
|
703
701
|
display: block;
|
|
704
702
|
`,Gp=Dt.div`
|
|
705
703
|
display: flex;
|
|
@@ -744,7 +742,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
744
742
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
745
743
|
border-radius: 50%;
|
|
746
744
|
}
|
|
747
|
-
`,
|
|
745
|
+
`,Qi="videoCarousel",Zi=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return Pe.createElement(Ji,null,Pe.createElement(Ot,{stepData:e,appearance:t}));function o({video:n}){let s=Vp(),[p,d]=jp(!1);return Pe.createElement(qp,null,!p&&Pe.createElement(Xp,{onClick:()=>{d(!0),s.current.play()},appearance:t},Pe.createElement(yo,null)),Pe.createElement(Kp,{controls:p,ref:s,play:p,src:n.uri}),Pe.createElement(Yp,null,n.title))}let i=e.props;return i.videos?Pe.createElement(Ji,null,Pe.createElement(Nt,{stepData:e,appearance:t}),Pe.createElement(Gp,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 Ri=Lo.div`
|
|
748
746
|
display: block;
|
|
749
747
|
`,Jp=Lo.pre`
|
|
750
748
|
display: block;
|
|
@@ -769,7 +767,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
769
767
|
margin-top: 12px;
|
|
770
768
|
`,Zp=Lo.div`
|
|
771
769
|
margin-top: 24px;
|
|
772
|
-
`,
|
|
770
|
+
`,en="codeSnippet",tn=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.codeSnippets))return Xe.createElement(Ri,null,Xe.createElement(Ot,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?Xe.createElement(Ri,null,Xe.createElement(Nt,{stepData:e,appearance:t}),Xe.createElement(Zp,null,o.codeSnippets.map((r,n)=>Xe.createElement("div",{key:n},r.title?Xe.createElement(Qp,null,r.title):null,r.code?Xe.createElement(Jp,null,r.code):null))),Xe.createElement(Lt,{stepData:e,appearance:t})):null};var ed=yt.div`
|
|
773
771
|
display: flex;
|
|
774
772
|
flex-direction: row;
|
|
775
773
|
min-width: ${e=>e.type!="modal"?"1000px":"100%"};
|
|
@@ -782,10 +780,10 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
782
780
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
783
781
|
`,od=yt.h2`
|
|
784
782
|
font-size: 15px;
|
|
785
|
-
line-height:
|
|
783
|
+
line-height: 28px;
|
|
786
784
|
color: ${e=>{var t,o;return((o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary)??"#4d4d4d"}};
|
|
787
785
|
margin: 10px 0px 0px 0px;
|
|
788
|
-
`,
|
|
786
|
+
`,on=yt.div`
|
|
789
787
|
padding-bottom: 16px;
|
|
790
788
|
`,rd=yt.div`
|
|
791
789
|
list-style: none;
|
|
@@ -800,30 +798,30 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
800
798
|
`,nd=yt.div`
|
|
801
799
|
flex: 2;
|
|
802
800
|
padding: 2rem;
|
|
803
|
-
`,sd=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:r,setSelectedStep:n,className:s="",customStepTypes:p=new Map,appearance:d,type:a})=>{let{mergeAppearanceWithDefault:
|
|
801
|
+
`,sd=({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}=te();d=h(d);let f={...{[dr]:Xi,[Qi]:Zi,[en]:tn},...p},[S,T]=Rp(0),P=r??S,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(ed,{type:a,style:i,className:s,appearance:d},Oe.createElement(on,{style:{flex:1}},Oe.createElement(on,{style:{padding:"30px 0px 30px 30px",borderBottom:"none"}},Oe.createElement(td,{className:l("checklistTitle",d),appearance:d},e),Oe.createElement(od,{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(rd,{className:l("checklistStepsContainer",d)},o.map((F,I)=>Oe.createElement(Ki,{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(id,{appearance:d,className:l("checklistDivider",d)}),Oe.createElement(nd,null,Oe.createElement(x,null)))},cr=sd;import z,{useState as md}from"react";import rn from"react";import ld from"styled-components";var ad=ld.svg`
|
|
804
802
|
transition: 'transform 0.35s ease-in-out';
|
|
805
|
-
`,$t=({color:e="#323232",style:t,className:o})=>
|
|
803
|
+
`,$t=({color:e="#323232",style:t,className:o})=>rn.createElement(ad,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},rn.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as ud}from"framer-motion";import ue 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"},nn=ue.div`
|
|
806
804
|
max-height: 350px;
|
|
807
805
|
padding-bottom: 40px;
|
|
808
|
-
`,
|
|
806
|
+
`,sn=ue.div`
|
|
809
807
|
display: flex;
|
|
810
808
|
flex-direction: column;
|
|
811
809
|
margin-top: 20px;
|
|
812
|
-
`,
|
|
810
|
+
`,ln=ue.h1`
|
|
813
811
|
font-style: normal;
|
|
814
812
|
font-weight: 600;
|
|
815
813
|
font-size: 30px;
|
|
816
814
|
line-height: 36px;
|
|
817
815
|
margin-bottom: 16px;
|
|
818
816
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
819
|
-
`,
|
|
817
|
+
`,an=ue.h2`
|
|
820
818
|
font-weight: 400;
|
|
821
819
|
font-size: 16px;
|
|
822
820
|
line-height: 20px;
|
|
823
821
|
margin-bottom: 16px;
|
|
824
822
|
padding-left: 1px;
|
|
825
823
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
826
|
-
`,
|
|
824
|
+
`,pn=ue.div`
|
|
827
825
|
${e=>k(e)} {
|
|
828
826
|
border: 1px solid #fafafa;
|
|
829
827
|
}
|
|
@@ -833,11 +831,11 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
833
831
|
flex-direction: column;
|
|
834
832
|
min-height: 240px;
|
|
835
833
|
overflow: hidden;
|
|
836
|
-
`,
|
|
834
|
+
`,dn=ue.div`
|
|
837
835
|
display: flex;
|
|
838
836
|
flex-direction: row;
|
|
839
837
|
justify-content: space-between;
|
|
840
|
-
`,
|
|
838
|
+
`,cn=ue.p`
|
|
841
839
|
${e=>k(e)} {
|
|
842
840
|
font-weight: 400;
|
|
843
841
|
font-size: 10px;
|
|
@@ -846,12 +844,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
846
844
|
color: #8c8c8c;
|
|
847
845
|
margin: 20px;
|
|
848
846
|
}
|
|
849
|
-
`,
|
|
847
|
+
`,mn=ue.div`
|
|
850
848
|
display: flex;
|
|
851
849
|
flex-direction: row;
|
|
852
|
-
`,
|
|
850
|
+
`,un=ue.div`
|
|
853
851
|
flex: 1;
|
|
854
|
-
`,
|
|
852
|
+
`,fn=ue.div`
|
|
855
853
|
${e=>k(e)} {
|
|
856
854
|
display: flex;
|
|
857
855
|
justify-content: center;
|
|
@@ -861,7 +859,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
861
859
|
padding-left: 8px;
|
|
862
860
|
padding-right: 8px;
|
|
863
861
|
}
|
|
864
|
-
`,
|
|
862
|
+
`,gn=ue.p`
|
|
865
863
|
${e=>k(e)} {
|
|
866
864
|
font-style: normal;
|
|
867
865
|
font-weight: 600;
|
|
@@ -882,14 +880,14 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
882
880
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
883
881
|
margin-bottom: 8px;
|
|
884
882
|
}
|
|
885
|
-
`,
|
|
883
|
+
`,hn=ue.div`
|
|
886
884
|
${e=>k(e)} {
|
|
887
885
|
display: flex;
|
|
888
886
|
flex-direction: row;
|
|
889
887
|
justify-content: center;
|
|
890
888
|
gap: 8px;
|
|
891
889
|
}
|
|
892
|
-
`,
|
|
890
|
+
`,Cn=ue.div`
|
|
893
891
|
${e=>k(e)} {
|
|
894
892
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
895
893
|
background-color: ${e=>e.selected?"#FAFAFA":"#FFFFFF"};
|
|
@@ -918,12 +916,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
918
916
|
font-size: 14px;
|
|
919
917
|
line-height: 22px;
|
|
920
918
|
margin: 0;
|
|
921
|
-
`,
|
|
919
|
+
`,yn=ue.div`
|
|
922
920
|
display: flex;
|
|
923
921
|
flex-direction: row;
|
|
924
922
|
justify-content: flex-end;
|
|
925
923
|
align-content: center;
|
|
926
|
-
`,
|
|
924
|
+
`,bn=ue.div`
|
|
927
925
|
display: flex;
|
|
928
926
|
flex: 1;
|
|
929
927
|
flex-direction: row;
|
|
@@ -931,14 +929,14 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
931
929
|
align-content: center;
|
|
932
930
|
align-items: center;
|
|
933
931
|
margin-right: 20px;
|
|
934
|
-
`,
|
|
932
|
+
`,wn=ue.div`
|
|
935
933
|
display: block;
|
|
936
934
|
width: 100%;
|
|
937
|
-
`;import pd from"styled-components";var
|
|
935
|
+
`;import pd from"styled-components";var Tn=pd.div`
|
|
938
936
|
flex-direction: column;
|
|
939
937
|
justify-content: center;
|
|
940
938
|
display: flex;
|
|
941
|
-
`;import Qe from"react";import{motion as dd}from"framer-motion";import Je from"styled-components";var
|
|
939
|
+
`;import Qe from"react";import{motion as dd}from"framer-motion";import Je from"styled-components";var Fn=Je.div`
|
|
942
940
|
border: 1px solid #fafafa;
|
|
943
941
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
944
942
|
border-radius: 14px;
|
|
@@ -946,13 +944,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
946
944
|
display: flex;
|
|
947
945
|
flex-direction: column;
|
|
948
946
|
overflow: hidden;
|
|
949
|
-
`,
|
|
947
|
+
`,kn=Je.div`
|
|
950
948
|
display: flex;
|
|
951
949
|
flex-wrap: wrap;
|
|
952
950
|
justify-content: space-between;
|
|
953
951
|
overflow: hidden;
|
|
954
952
|
row-gap: 10px;
|
|
955
|
-
`,
|
|
953
|
+
`,Pn=Je.div`
|
|
956
954
|
${e=>k(e)} {
|
|
957
955
|
color: #595959;
|
|
958
956
|
}
|
|
@@ -962,7 +960,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
962
960
|
line-height: 12px;
|
|
963
961
|
letter-spacing: 0.09em;
|
|
964
962
|
margin-bottom: 12px;
|
|
965
|
-
`,
|
|
963
|
+
`,vn=Je.div`
|
|
966
964
|
${e=>k(e)} {
|
|
967
965
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
968
966
|
background: #ffffff;
|
|
@@ -975,7 +973,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
975
973
|
|
|
976
974
|
max-width: 150px;
|
|
977
975
|
min-width: 200px;
|
|
978
|
-
`,
|
|
976
|
+
`,Bn=Je.div`
|
|
979
977
|
${e=>k(e)} {
|
|
980
978
|
background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);
|
|
981
979
|
}
|
|
@@ -987,13 +985,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
987
985
|
justify-content: center;
|
|
988
986
|
align-content: center;
|
|
989
987
|
align-items: center;
|
|
990
|
-
`,
|
|
988
|
+
`,En=Je.div`
|
|
991
989
|
font-weight: 600;
|
|
992
990
|
font-size: 20px;
|
|
993
991
|
line-height: 24px;
|
|
994
992
|
width: 20px;
|
|
995
993
|
height: 20px;
|
|
996
|
-
`,
|
|
994
|
+
`,An=Je.div`
|
|
997
995
|
${e=>k(e)} {
|
|
998
996
|
color: #434343;
|
|
999
997
|
}
|
|
@@ -1002,20 +1000,20 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1002
1000
|
line-height: 17px;
|
|
1003
1001
|
margin-top: 12px;
|
|
1004
1002
|
margin-bottom: 8px;
|
|
1005
|
-
`,
|
|
1003
|
+
`,In=Je.div`
|
|
1006
1004
|
${e=>k(e)} {
|
|
1007
1005
|
color: #8c8c8c;
|
|
1008
1006
|
}
|
|
1009
1007
|
font-weight: 400;
|
|
1010
1008
|
font-size: 12px;
|
|
1011
1009
|
line-height: 14px;
|
|
1012
|
-
`,
|
|
1010
|
+
`,Nn=Je.a`
|
|
1013
1011
|
color: ${e=>e.color};
|
|
1014
1012
|
font-size: 12px;
|
|
1015
1013
|
line-height: 14px;
|
|
1016
1014
|
font-weight: 400;
|
|
1017
1015
|
cursor: pointer;
|
|
1018
|
-
`;var cd=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=le();return Qe.createElement(
|
|
1016
|
+
`;var cd=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=le();return Qe.createElement(Fn,{style:t,className:l("guideContainer",r)},Qe.createElement(Pn,{className:l("guideTitle",r)},o),Qe.createElement(kn,{className:l("guideItemContainer",r)},e.map((p,d)=>Qe.createElement(vn,{key:`guide-${p.id??d}`,as:dd.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:l("guideItem",r)},p.icon&&Qe.createElement(Bn,{className:l("guideIcon",r)},Qe.createElement(En,null,p.icon)),Qe.createElement(An,{className:l("guideItemTitle",r),dangerouslySetInnerHTML:me(p.title)}),Qe.createElement(In,{className:l("guideItemSubtitle",r),dangerouslySetInnerHTML:me(p.subtitle)}),Qe.createElement(Nn,{className:l("guideItemLink",r),color:i,onClick:()=>{p.primaryButtonUri&&s(p),n&&n(p)}},p.primaryButtonTitle)))))},oo=cd;var fd=({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 S=({stepData:m,handleSecondaryCTAClick:w,handleCTAClick:C})=>m?z.createElement(fn,{className:l("checklistStepContainer",a),"data-testid":"checklistStepContainer"},z.createElement(gn,{appearance:a,className:l("checklistStepTitle",a),dangerouslySetInnerHTML:me(m.title)}),z.createElement(xn,{appearance:a,className:l("checklistStepSubtitle",a),dangerouslySetInnerHTML:me(m.subtitle)}),z.createElement(hn,{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 O;if((O=e[x])!=null&&O.StepContent){let M=e[x].StepContent;return z.createElement("div",null,M)}let w=e[x];return z.createElement(S,{stepData:m,handleCTAClick:()=>{w.handlePrimaryButtonClick&&w.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{w.handleSecondaryButtonClick&&w.handleSecondaryButtonClick()}})}},...d},[g,v]=md(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)},y=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(wn,null,z.createElement(sn,null,z.createElement(ln,{appearance:a,className:l("checklistTitle",a)},t),z.createElement(an,{appearance:a,className:l("checklistSubtitle",a)},o)),z.createElement(nn,null,e&&e.length>0&&z.createElement(pn,{className:l("stepsContainer",a)},z.createElement(dn,null,z.createElement("div",{style:{flex:3}},z.createElement(cn,{className:l("stepsTitle",a)},i)),z.createElement(bn,null,z.createElement(_e,{fillColor:a.theme.colorPrimary,style:{width:"100%"},count:y,total:e.length,appearance:a}))),z.createElement(mn,null,z.createElement(un,{className:l("checklistStepListContainer",a),appearance:a},e.map((m,w)=>{let C=x===w;return z.createElement(Cn,{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:ud.div,layoutId:"checklist-step-selected",style:{backgroundColor:a.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),z.createElement(Sn,{selected:C,className:l(`checklistStepListStepName${C?"Selected":""}`,a)},m.stepName),z.createElement(yn,null,z.createElement(Ke,{value:m.complete,type:"round",primaryColor:a.theme.colorPrimary,progress:m.progress,appearance:a}),z.createElement(Tn,null,z.createElement($t,{style:{marginLeft:"10px"},color:a.theme.colorBackgroundSecondary}))))})),z.createElement(I,null))),h&&h.length>0&&z.createElement(oo,{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=fd;import{useEffect as gd,useState as xd}from"react";var Ln=()=>{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]=xd(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 gd(()=>{s()},[]),o};import we,{useEffect as Yn,useState as Sd}from"react";import fe from"react";import{AnimatePresence as hd,motion as Cd}from"framer-motion";import Ze from"styled-components";var On=Ze.div`
|
|
1019
1017
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1020
1018
|
border: 1px solid;
|
|
1021
1019
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -1027,42 +1025,42 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1027
1025
|
display: flex;
|
|
1028
1026
|
flex-direction: column;
|
|
1029
1027
|
transition: max-height 0.25s;
|
|
1030
|
-
|
|
1028
|
+
`,Dn=Ze.div`
|
|
1031
1029
|
display: flex;
|
|
1032
1030
|
margin-bottom: 20px;
|
|
1033
|
-
|
|
1031
|
+
`,$n=Ze.img`
|
|
1034
1032
|
border-radius: 4px;
|
|
1035
1033
|
max-height: 260px;
|
|
1036
1034
|
min-height: 200px;
|
|
1037
|
-
`,
|
|
1035
|
+
`,Mn=Ze.div`
|
|
1038
1036
|
display: flex;
|
|
1039
1037
|
flex-direction: row;
|
|
1040
1038
|
justify-content: space-between;
|
|
1041
1039
|
align-items: center;
|
|
1042
|
-
`,
|
|
1040
|
+
`,Un=Ze.p`
|
|
1043
1041
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1044
1042
|
font-style: normal;
|
|
1045
1043
|
font-weight: 500;
|
|
1046
1044
|
font-size: 16px;
|
|
1047
1045
|
line-height: 18px;
|
|
1048
1046
|
margin-left: 8px;
|
|
1049
|
-
`,
|
|
1047
|
+
`,zn=Ze.div`
|
|
1050
1048
|
padding: 20px;
|
|
1051
1049
|
cursor: pointer;
|
|
1052
1050
|
:hover {
|
|
1053
1051
|
opacity: 0.8;
|
|
1054
1052
|
}
|
|
1055
|
-
`,
|
|
1053
|
+
`,VC=Ze.div``,_n=Ze.p`
|
|
1056
1054
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1057
1055
|
font-weight: 400;
|
|
1058
1056
|
font-size: 14px;
|
|
1059
1057
|
line-height: 22px;
|
|
1060
|
-
`,
|
|
1058
|
+
`,Wn=Ze.div`
|
|
1061
1059
|
display: flex;
|
|
1062
1060
|
flex-direction: row;
|
|
1063
1061
|
justify-content: flex-start;
|
|
1064
1062
|
align-items: center;
|
|
1065
|
-
`;var
|
|
1063
|
+
`;var Hn=({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 fe.createElement(fe.Fragment,null,e.imageUri||e.videoUri?fe.createElement(Dn,{className:l("stepMediaContainer",n)},e.imageUri?fe.createElement($n,{className:l("stepImage",n),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?fe.createElement(st,{appearance:n,videoUri:e.videoUri}):null):null,fe.createElement(_n,{className:l("stepSubtitle",n),appearance:n,dangerouslySetInnerHTML:me(e.subtitle)}),fe.createElement(So,{className:l("checklistCTAContainer",n)},e.secondaryButtonTitle?fe.createElement(ne,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>r(),appearance:n}):null,fe.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 fe.createElement(On,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:l("checklistStepContainer",n),appearance:n},fe.createElement(Mn,{className:l("stepHeader",n)},fe.createElement(Wn,null,fe.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}),fe.createElement(Un,{appearance:n,className:l("stepTitle",n),dangerouslySetInnerHTML:me(e.title)})),fe.createElement(zn,{className:l("stepChevronContainer",n),onClick:()=>o()},fe.createElement($t,{style:{...p,transition:"transform 0.1s ease-in-out"},color:(c=n==null?void 0:n.theme)==null?void 0:c.colorTextSecondary}))),fe.createElement(hd,null,!t&&fe.createElement(Cd.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 r0=Mt.div`
|
|
1066
1064
|
background: #ffffff;
|
|
1067
1065
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
1068
1066
|
border-radius: 6px;
|
|
@@ -1076,48 +1074,48 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1076
1074
|
|
|
1077
1075
|
max-width: 800px;
|
|
1078
1076
|
min-width: 350px;
|
|
1079
|
-
`,
|
|
1077
|
+
`,Vn=Mt.div`
|
|
1080
1078
|
display: flex;
|
|
1081
1079
|
flex-direction: column;
|
|
1082
|
-
`,
|
|
1080
|
+
`,jn=Mt.h1`
|
|
1083
1081
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1084
1082
|
font-style: normal;
|
|
1085
1083
|
font-weight: 700;
|
|
1086
1084
|
font-size: 20px;
|
|
1087
1085
|
line-height: 24px;
|
|
1088
1086
|
margin-bottom: 8px;
|
|
1089
|
-
`,
|
|
1087
|
+
`,Gn=Mt.h2`
|
|
1090
1088
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
1091
1089
|
font-weight: 400;
|
|
1092
1090
|
font-size: 14px;
|
|
1093
1091
|
line-height: 23px;
|
|
1094
1092
|
margin: 2px 0 0 0;
|
|
1095
|
-
`,
|
|
1093
|
+
`,qn=Mt.div`
|
|
1096
1094
|
display: block;
|
|
1097
1095
|
width: 100%;
|
|
1098
|
-
`,
|
|
1096
|
+
`,Kn=Mt.div`
|
|
1099
1097
|
display: flex;
|
|
1100
1098
|
width: 100%;
|
|
1101
1099
|
flex-direction: column;
|
|
1102
1100
|
justify-content: space-between;
|
|
1103
1101
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1104
|
-
`;var
|
|
1102
|
+
`;var yd=({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:S,customStepTypes:T,style:P})=>{let g=o.filter(m=>m.complete).length,[v,x]=Sd(Array(o.length).fill(!0));Yn(()=>{let m=[...v];if(n){for(let w=0;w<o.length;w++)if(!o[w].complete){m[w]=!1;break}x(m)}},[]),Yn(()=>{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(Vn,null,we.createElement(jn,{appearance:c,className:l("checklistTitle",c),dangerouslySetInnerHTML:me(e)}),we.createElement(Gn,{appearance:c,className:l("checklistSubtitle",c),dangerouslySetInnerHTML:me(t)})),we.createElement(_e,{display:"percent",count:g,total:o.length,fillColor:d,style:{margin:"14px 0px 8px 0px"},appearance:c})),y=we.createElement(qn,{className:Ce(l("checklistContainer",c),S)},o.map((m,w)=>{let C=v[w];return we.createElement(Hn,{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(Kn,{appearance:c,className:Ce(l("checklistInlineContainer",c),S),style:P},I,y):we.createElement(we.Fragment,null,we.createElement(tt,{onClose:i,visible:r,appearance:c,style:{maxWidth:"600px"},headerContent:I},y))},fr=yd;import ae,{useEffect as gr,useRef as Pd,useState as bt}from"react";import Ut from"react";import de,{css as Xn,keyframes as Jn}from"styled-components";var Qn=Xn`
|
|
1105
1103
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1106
|
-
`,bd=
|
|
1104
|
+
`,bd=Xn`
|
|
1107
1105
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
1108
|
-
`,wd=
|
|
1106
|
+
`,wd=Jn`
|
|
1109
1107
|
from {
|
|
1110
1108
|
opacity: 0;
|
|
1111
1109
|
} to {
|
|
1112
1110
|
opacity: 1;
|
|
1113
1111
|
}
|
|
1114
|
-
`,Td=
|
|
1112
|
+
`,Td=Jn`
|
|
1115
1113
|
from {
|
|
1116
1114
|
opacity: 1;
|
|
1117
1115
|
} to {
|
|
1118
1116
|
opacity: 0;
|
|
1119
1117
|
}
|
|
1120
|
-
`,
|
|
1118
|
+
`,Zn=de.div`
|
|
1121
1119
|
margin: 0 -20px;
|
|
1122
1120
|
overflow-x: auto;
|
|
1123
1121
|
padding-left: 20px;
|
|
@@ -1134,13 +1132,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1134
1132
|
::-webkit-scrollbar {
|
|
1135
1133
|
display: none;
|
|
1136
1134
|
}
|
|
1137
|
-
`,
|
|
1135
|
+
`,Rn=de.div`
|
|
1138
1136
|
display: flex;
|
|
1139
1137
|
flex-flow: row nowrap;
|
|
1140
1138
|
gap: 0 16px;
|
|
1141
1139
|
scroll-snap-align: center;
|
|
1142
1140
|
scroll-snap-stop: always;
|
|
1143
|
-
`,
|
|
1141
|
+
`,es=de.div`
|
|
1144
1142
|
animation: ${e=>e.reversed?Td:wd} 0.25s ease-out;
|
|
1145
1143
|
background: linear-gradient(
|
|
1146
1144
|
to right,
|
|
@@ -1150,8 +1148,8 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1150
1148
|
position: absolute;
|
|
1151
1149
|
width: 64px;
|
|
1152
1150
|
z-index: 10;
|
|
1153
|
-
`,
|
|
1154
|
-
${
|
|
1151
|
+
`,ts=de.button`
|
|
1152
|
+
${Qn}
|
|
1155
1153
|
box-shadow: 0 3px 10px 0 rgba(0, 0, 0, 0.1);
|
|
1156
1154
|
align-items: center;
|
|
1157
1155
|
border-radius: 50%;
|
|
@@ -1162,11 +1160,11 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1162
1160
|
justify-content: center;
|
|
1163
1161
|
position: absolute;
|
|
1164
1162
|
width: 48px;
|
|
1165
|
-
`,
|
|
1163
|
+
`,os=de.div`
|
|
1166
1164
|
border-radius: ${({theme:e})=>e.borderRadius}px;
|
|
1167
1165
|
padding: 20px;
|
|
1168
|
-
`,
|
|
1169
|
-
${
|
|
1166
|
+
`,rs=de(os)`
|
|
1167
|
+
${Qn}
|
|
1170
1168
|
background: ${({theme:e})=>e.colorBackground};
|
|
1171
1169
|
position: relative;
|
|
1172
1170
|
|
|
@@ -1178,26 +1176,26 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1178
1176
|
${e=>e.blocked?"":`border: 1px solid ${e.theme.colorPrimary};`}
|
|
1179
1177
|
${e=>e.blocked?"cursor: default":"cursor: pointer"}
|
|
1180
1178
|
}
|
|
1181
|
-
`,
|
|
1179
|
+
`,is=de.img`
|
|
1182
1180
|
border-radius: 50%;
|
|
1183
1181
|
height: 40px;
|
|
1184
1182
|
margin-bottom: 12px;
|
|
1185
1183
|
width: 40px;
|
|
1186
|
-
`,
|
|
1184
|
+
`,ns=de(os)`
|
|
1187
1185
|
${e=>k(e)} {
|
|
1188
1186
|
${bd}
|
|
1189
1187
|
|
|
1190
1188
|
background: ${({theme:e})=>e.colorBackground};
|
|
1191
1189
|
}
|
|
1192
|
-
`,
|
|
1190
|
+
`,ss=de.div`
|
|
1193
1191
|
color: ${({theme:e})=>e.colorPrimary};
|
|
1194
1192
|
display: flex;
|
|
1195
1193
|
flex-flow: row nowrap;
|
|
1196
1194
|
align-items: center;
|
|
1197
1195
|
margin-left: 20px;
|
|
1198
|
-
`,
|
|
1196
|
+
`,ls=de.div`
|
|
1199
1197
|
white-space: nowrap;
|
|
1200
|
-
`,
|
|
1198
|
+
`,as=de.div`
|
|
1201
1199
|
background: #d8fed8;
|
|
1202
1200
|
border-radius: 6px;
|
|
1203
1201
|
float: right;
|
|
@@ -1209,7 +1207,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1209
1207
|
line-height: 22px;
|
|
1210
1208
|
letter-spacing: calc(18px * -0.01);
|
|
1211
1209
|
margin: 0;
|
|
1212
|
-
`,
|
|
1210
|
+
`,ps=de(Fd)`
|
|
1213
1211
|
margin-bottom: 4px;
|
|
1214
1212
|
`,kd=de.p`
|
|
1215
1213
|
font-weight: bold;
|
|
@@ -1217,7 +1215,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1217
1215
|
line-height: 20px;
|
|
1218
1216
|
letter-spacing: calc(16px * -0.01);
|
|
1219
1217
|
margin: 0;
|
|
1220
|
-
`,
|
|
1218
|
+
`,ds=de(kd)`
|
|
1221
1219
|
margin-bottom: 4px;
|
|
1222
1220
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1223
1221
|
`}
|
|
@@ -1227,7 +1225,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1227
1225
|
font-size: 14px;
|
|
1228
1226
|
line-height: 22px;
|
|
1229
1227
|
margin: 0;
|
|
1230
|
-
`,
|
|
1228
|
+
`,cs=de.p`
|
|
1231
1229
|
color: ${({theme:e})=>e.colorText};
|
|
1232
1230
|
font-weight: 600;
|
|
1233
1231
|
font-size: 12px;
|
|
@@ -1239,7 +1237,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1239
1237
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1240
1238
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1241
1239
|
`}
|
|
1242
|
-
`;var
|
|
1240
|
+
`;var ms=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=te(),{primaryCTAClickSideEffects:r}=le();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(rs,{className:l("carouselCard",o),onClick:a?null:c,style:t,blocked:a,complete:d},n&&Ut.createElement(is,{className:l("carouselCardImage",o),src:n,alt:p,style:{opacity:d||a?.4:1}}),(d||!0)&&Ut.createElement(as,{className:l("carouselCompletedPill",o)},Ut.createElement(cs,{style:{color:"#108E0B"}},"Complete")),p&&Ut.createElement(ds,{blocked:a,complete:d,className:l("carouselCardTitle",o)},p),s&&Ut.createElement(We.Quiet,{blocked:a,complete:d,className:l("carouselCardSubtitle",o)},s))};import ro from"react";var us=({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 ro.createElement(ss,{className:l("carouselProgressBar",o)},ro.createElement(ls,{as:We.Loud,style:{marginRight:8}},e," of ",t),ro.createElement("svg",{height:10,width:r},ro.createElement("rect",{x:0,y:0,rx:5,width:r,height:10,fill:"#E6E6E6"}),ro.createElement("rect",{x:0,y:0,rx:5,width:n,height:10,fill:"currentColor"})))};var vd=()=>ae.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ae.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),ae.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),ae.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),fs=({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?ae.createElement(es,{style:d,reversed:n,onAnimationEnd:n?p:null},ae.createElement(ts,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},ae.createElement(vd,null))):null},gs=({flowId:e,appearance:t,customVariables:o,className:i})=>{let r=Pd(null),[n,s]=bt(!1),[p,d]=bt(!1),[a,h]=bt(null),[c,f]=bt([]),[S,T]=bt(0),{getFlowMetadata:P,getFlowSteps:g,getNumberOfStepsCompleted:v,updateCustomVariables:x,getFlowStatus:F,isLoading:I,targetingLogicShouldHideFlow:y,getFlow:m}=ee();gr(()=>{x(o)},[o,I]),gr(()=>{if(I)return;let N=P(e),L=v(e),H=g(e);h(N),N.data!==null&&(f(H.sort(($,J)=>Number($.complete)-Number(J.complete))),d(H.length>3),T(L))},[I]);let w=[];for(let N=0;N<c.length;N+=3)w.push(c.slice(N,N+3));let C=N=>{let L=N.target,H=L.scrollWidth-L.clientWidth,$=Math.ceil(L.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 L=N?1:-1;r.current!==null&&r.current.scrollBy({left:r.current.clientWidth*L,behavior:"smooth"})},O=null,M=N=>{O!==null?clearTimeout(O):C(N),O=setTimeout(()=>{C(N)},16)};return I?null:ae.createElement(ns,{className:Ce(l("carouselContainer",t),i)},ae.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:20}},ae.createElement("div",null,ae.createElement(ps,{className:l("carouselTitle",t)},a==null?void 0:a.title),ae.createElement(We.Quiet,{className:l("carouselSubtitle",t)},a==null?void 0:a.subtitle)),ae.createElement(us,{numberOfStepsCompleted:S,numberOfSteps:c.length})),ae.createElement("div",{style:{position:"relative"}},ae.createElement(fs,{show:n,onClick:()=>B(!1)}),ae.createElement(fs,{side:"right",show:p,onClick:B}),ae.createElement(Zn,{ref:r,onScroll:M},w.map((N,L)=>ae.createElement(Rn,{key:L,style:{flex:`0 0 calc(100% - ${c.length>3?36:0}px)`}},N.map((H,$)=>ae.createElement(ms,{key:$,stepData:H,style:{flex:c.length>3?"0 1 calc(33% - 16px * 2 / 3)":1},appearance:t})))))),ae.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:S,setVisible:T,customStepTypes:P,checklistStyle:g="default",autoExpandFirstIncompleteStep:v,autoExpandNextStep:x,...F})=>{let{getFlow:I,getFlowSteps:y,markStepCompleted:m,getStepStatus:w,getNumberOfStepsCompleted:C,isLoading:B,targetingLogicShouldHideFlow:O,updateCustomVariables:M,getFlowMetadata:N,isStepBlocked:L,getFlowStatus:H,hasActiveFullPageFlow:$,setHasActiveFullPageFlow:J}=ee(),{primaryCTAClickSideEffects:Q,secondaryCTAClickSideEffects:Y}=le(),{getOpenFlowState:V,setOpenFlowState:ge}=Fe(),[oe,q]=hs(r||0),[xe,Te]=hs(!1),K=d===void 0?V(e):d,pe=s==="modal",{mergeAppearanceWithDefault:_}=te(),{isLarge:D}=Ln();if(f=_(f),xs(()=>{M(a)},[a,B]),xs(()=>{d!==void 0&&(pe&&d===!0?J(!0):pe&&d===!1&&J(!1))},[d,T,$]),B)return null;let re=I(e);if(!re||O(re))return null;let j=y(e);if(!j||S===!0&&H(e)===R)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=j.findIndex(Z=>Z.complete===!1);q(A>-1?A:j.length-1),Te(!0)}function je(){if(oe+1>=j.length){pe&&ge(e,!1);return}L(e,j[oe+1].id)||q(oe+1)}function De(A,Z,ct){let Fr=oe+1<j.length?j[oe+1]:null;c&&c(A,oe,Z,Fr)===!0&&pe&&$e(),h&&h(A,ct,Fr),!h&&!c&&(A.primaryButtonUri||A.secondaryButtonUri)&&pe&&$e()}function dt(){return j.map((A,Z)=>({...A,handleSecondaryButtonClick:()=>{je(),Y(A),A.skippable===!0&&m(e,A.id,{skipped:!0}),De(A,"secondary",Z)},handlePrimaryButtonClick:()=>{(!A.completionCriteria&&(A.autoMarkCompleted||A.autoMarkCompleted===void 0)||A.completionCriteria&&A.autoMarkCompleted===!0)&&(m(e,A.id),je()),De(A,"primary",Z),Q(A),w(e,A.id)===Ne&&je()}}))}function W(){return ce.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(){ge(e,!1),p&&p(),T&&T(!1)}function zo(){return ce.createElement(ce.Fragment,null,ce.createElement(W,null),ce.createElement(gs,{flowId:e,appearance:f,customVariables:a,className:n}))}function u(){return ce.createElement(ce.Fragment,null,ce.createElement(W,null),ce.createElement(fr,{visible:K,onClose:()=>{$e()},selectedStep:oe,setSelectedStep:q,autoExpandNextStep:!0,appearance:f,...ve}))}function b(){if(!D)return u();let A=F.guideFlowId,Z;return A&&I(A)&&(Z=y(A)),ce.createElement(ce.Fragment,null,ce.createElement(W,null),ce.createElement(ur,{visible:K,stepsTitle:ie.stepsTitle?ie.stepsTitle:"Your quick start guide",onClose:()=>{$e()},selectedStep:oe,setSelectedStep:q,guideData:Z,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=ce.createElement(cr,{flowId:e,style:i,selectedStep:oe,setSelectedStep:q,appearance:f,type:s,...ve});return pe?ce.createElement(tt,{onClose:()=>{$e()},visible:K,appearance:f,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},ce.createElement(W,null),A):ce.createElement(ce.Fragment,null,ce.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 Ed=e=>Bd.createElement(xr,{type:"inline",...e});import pt,{useEffect as Id}from"react";import He from"react";import Oo from"styled-components";var Cs=Oo.div`
|
|
1243
1241
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1244
1242
|
border-radius: 8px;
|
|
1245
1243
|
padding: 6px 10px 6px 10px;
|
|
@@ -1253,20 +1251,20 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1253
1251
|
align-items: center;
|
|
1254
1252
|
margin-bottom: 2px;
|
|
1255
1253
|
flex-grow: 2;
|
|
1256
|
-
`,
|
|
1254
|
+
`,ys=Oo.div`
|
|
1257
1255
|
text-overflow: ellipsis;
|
|
1258
1256
|
font-weight: 600;
|
|
1259
1257
|
font-size: 12px;
|
|
1260
1258
|
line-height: 15px;
|
|
1261
1259
|
text-align: ${e=>e.type==="condensed"?"left":"right"};
|
|
1262
1260
|
color: ${e=>e.appearance.theme.colorPrimary};
|
|
1263
|
-
`,
|
|
1261
|
+
`,bs=Oo.div`
|
|
1264
1262
|
width: 20px;
|
|
1265
1263
|
margin-right: 8px;
|
|
1266
1264
|
display: flex;
|
|
1267
1265
|
height: 100%;
|
|
1268
1266
|
align-items: center;
|
|
1269
|
-
`;import{motion as Ad}from"framer-motion";var
|
|
1267
|
+
`;import{motion as Ad}from"framer-motion";var ws=({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(Cs,{as:Ad.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(bs,{className:l("progressRingContainer",s)},He.createElement(Bt,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),He.createElement(Ss,{type:p,className:l("badgeTitleContainer",s)},He.createElement(ys,{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 io from"styled-components";var Ts=io.div`
|
|
1270
1268
|
display: flex;
|
|
1271
1269
|
flex-direction: row;
|
|
1272
1270
|
width: 100%;
|
|
@@ -1277,25 +1275,25 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1277
1275
|
border-width: 1px;
|
|
1278
1276
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1279
1277
|
border-radius: 12px;
|
|
1280
|
-
`,
|
|
1278
|
+
`,Fs=io.div`
|
|
1281
1279
|
${e=>k(e)} {
|
|
1282
1280
|
display: flex;
|
|
1283
1281
|
justify-content: center;
|
|
1284
1282
|
align-items: center;
|
|
1285
1283
|
margin-right: 16px;
|
|
1286
1284
|
}
|
|
1287
|
-
`,
|
|
1285
|
+
`,ks=io.div`
|
|
1288
1286
|
display: flex;
|
|
1289
1287
|
flex-direction: column;
|
|
1290
1288
|
flex: 1;
|
|
1291
1289
|
margin-top: 0;
|
|
1292
|
-
`,
|
|
1290
|
+
`,Ps=io.div`
|
|
1293
1291
|
display: flex;
|
|
1294
1292
|
flex-direction: column;
|
|
1295
1293
|
justify-content: center;
|
|
1296
1294
|
margin-left: 16px;
|
|
1297
1295
|
min-width: 200px;
|
|
1298
|
-
`,
|
|
1296
|
+
`,yS=io.div`
|
|
1299
1297
|
display: flex;
|
|
1300
1298
|
justify-content: center;
|
|
1301
1299
|
align-items: flex-end;
|
|
@@ -1304,7 +1302,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1304
1302
|
:hover {
|
|
1305
1303
|
opacity: 0.8;
|
|
1306
1304
|
}
|
|
1307
|
-
`;var
|
|
1305
|
+
`;var vs=({title:e,subtitle:t,icon:o,appearance:i,count:r,total:n,className:s,style:p})=>at.createElement(at.Fragment,null,at.createElement(Ts,{appearance:i,className:Ce(l("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&at.createElement(Fs,{className:l("fullWidthProgressBadgeIcon",i)},o),at.createElement(ks,null,at.createElement(Se,{size:"small",appearance:i,title:e,subtitle:t})),at.createElement(Ps,{className:l("fullWidthProgressBadgeProgressContainer",i)},at.createElement(_e,{count:r,total:n,display:"percent",textLocation:"top",fillColor:i.theme.colorPrimary}))));var Nd=({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:S,getNumberOfStepsCompleted:T,isLoading:P,targetingLogicShouldHideFlow:g,updateCustomVariables:v}=ee(),{mergeAppearanceWithDefault:x}=te();a=x(a);let{setOpenFlowState:F,getOpenFlowState:I}=Fe();if(Id(()=>{v(p)},[p,P]),P)return null;let y=c(e);if(!y||g(y)||d===!0&&S(e)===R)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(vs,{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(ws,{count:w,total:m.length,title:t,style:r,onClick:()=>{F(e,!0),n&&n()},type:h,className:s,appearance:a}))};import Ld from"react";var Od=({flowId:e,style:t,appearance:o,...i})=>{let{getFlow:r,targetingLogicShouldHideFlow:n,getFlowSteps:s}=ee(),{mergeAppearanceWithDefault:p}=te();o=p(o);let d=r(e);if(!d||n(d))return null;let a=s(e);return Ld.createElement(oo,{steps:a,style:t,appearance:o,...i})};import _t,{useContext as qd,useEffect as Kd}from"react";import U,{useEffect as Do,useLayoutEffect as As,useRef as zd,useState as no}from"react";import so from"styled-components";import{useCallback as Dd,useEffect as $d,useState as Md}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}},Bs={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Ud(e){let t=Bs;return e&&(t=e.getBoundingClientRect()),t}function Es(e,t){let[o,i]=Md(Bs),r=Dd(()=>{e&&i(Ud(e))},[e]);return $d(()=>(r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)),[e,t]),o}var Is=300,Ns=100,_d=500,zt=12,Wd=so.div`
|
|
1308
1306
|
width: 100%;
|
|
1309
1307
|
height: 100%;
|
|
1310
1308
|
border-radius: 9999px;
|
|
@@ -1336,16 +1334,16 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1336
1334
|
opacity: 1;
|
|
1337
1335
|
`,Vd=so.div`
|
|
1338
1336
|
pointer-events: all;
|
|
1339
|
-
`,
|
|
1337
|
+
`,Ls=so.div`
|
|
1340
1338
|
display: flex;
|
|
1341
1339
|
align-content: center;
|
|
1342
1340
|
justify-content: center;
|
|
1343
1341
|
align-items: center;
|
|
1344
1342
|
z-index: ${e=>e.zIndex?e.zIndex:90};
|
|
1345
|
-
`,jd=so(
|
|
1343
|
+
`,jd=so(Ls)`
|
|
1346
1344
|
width: ${zt+12}px;
|
|
1347
1345
|
height: ${zt+12}px;
|
|
1348
|
-
`,Gd=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:r=!0,primaryColor:n="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:a=0,customStepTypes:
|
|
1346
|
+
`,Gd=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:r=!0,primaryColor:n="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:a=0,customStepTypes:h,appearance:c,dismissible:f=!1,showHighlightOnly:S,showStepCount:T=!0,completedStepsCount:P=0,showFrigadeBranding:g=!1})=>{var ie,je,De,dt;let[v,x]=no(),[F,I]=no(new Date),y=zd(null),[m,w]=no(document.querySelector(e[a].selector)),C=Es(m,F),[B,O]=no(),[M,N]=no(!S),L=(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)??Is,J=(v==null?void 0:v.height)??Ns;As(()=>{y.current&&x({width:y.current.clientWidth,height:y.current.clientHeight})},[a,F,L]),Do(()=>{S||N(!0)},[a]);let Q=i==="auto"?"right":i,Y=hr(C,Q,$,s,L),V=C.right+$>(window.innerWidth||document.documentElement.clientWidth),ge=C.bottom+Ns>(window.innerHeight||document.documentElement.clientHeight);V&&i==="auto"&&(Y=hr(C,"left",$,s,L),Q="left");let oe=window.location.pathname.split("/").pop(),q=()=>{let W=document.querySelector(e[a].selector);B&&B===JSON.stringify(W==null?void 0:W.getBoundingClientRect())||(w(W),I(new Date),W&&O(JSON.stringify(W.getBoundingClientRect())))};if(Do(()=>{let W=new MutationObserver(q);return W.observe(document.body,{subtree:!0,childList:!0}),()=>W.disconnect()},[q]),Do(()=>{let W=new MutationObserver(q);return W.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>W.disconnect()},[q]),Do(()=>{let W=setInterval(()=>{q()},10);return()=>clearInterval(W)},[q]),As(()=>{setTimeout(()=>{q()},_d),q()},[a,oe]),m===null)return U.createElement(U.Fragment,null);if(Y.x==0&&Y.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(()=>{q()},30)),P===e.length-1)return o()},ve=()=>{e[a].handleSecondaryButtonClick&&(e[a].handleSecondaryButtonClick(),S&&!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(Se,{appearance:c,title:e[a].title,subtitle:e[a].subtitle,size:"small"}),U.createElement($r,{className:l("tooltipFooter",c)},U.createElement(xe,null))),pe={...{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)||!pe[e[a].type]?pe.default(e[a]):pe[e[a].type]({stepData:e[a],primaryColor:n}):U.createElement(U.Fragment,null)};if(S&&e[a].complete===!0)return null;let D={top:(Y==null?void 0:Y.y)-zt,left:(Q=="left"?C.x+s.x:(Y==null?void 0:Y.x)-zt)??0,cursor:S?"pointer":"default",position:L},re=()=>{let ve=D.left+(Q=="left"?-$:24);return Math.min(Math.max(ve,20),window.innerWidth-$-20)},j=()=>{S&&(I(new Date),N(!M))};return U.createElement(Vd,null,U.createElement(jd,{style:D,zIndex:H,className:l("tourHighlightContainer",c)},r&&e[a].showHighlight!==!1&&U.createElement(U.Fragment,null,U.createElement(Hd,{style:{position:L},onClick:j,primaryColor:c.theme.colorPrimary,className:l("tourHighlightInnerCircle",c)}),U.createElement(Wd,{style:{position:"absolute"},onClick:j,primaryColor:c.theme.colorPrimary,className:l("tourHighlightOuterCircle",c)}))),U.createElement(Ls,{style:{...D,left:re()},zIndex:H+1,className:l("tooltipContainerWrapper",c)},M&&U.createElement(U.Fragment,null,U.createElement(po,{ref:y,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:12,...d},appearance:c,className:l("tooltipContainer",c),maxWidth:Is,zIndex:H+10},U.createElement(_,null)),g&&U.createElement(Wr,{className:l("poweredByFrigadeTooltipRibbon",c),appearance:c,zIndex:H+10},U.createElement(co,{appearance:c})))))},$o=Gd;import{Portal as Yd}from"react-portal";var Xd=({flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:r,showTooltipsSimultaneously:n=!1,onDismiss:s,dismissible:p,tooltipPosition:d="auto",showHighlightOnly:a=!1,dismissBehavior:h="complete-flow",onComplete:c,skipIfNotFound:f=!1,...S})=>{let{getFlow:T,getFlowSteps:P,isLoading:g,targetingLogicShouldHideFlow:v,markStepCompleted:x,markStepStarted:F,markFlowCompleted:I,updateCustomVariables:y,getCurrentStepIndex:m,getStepStatus:w,isStepBlocked:C,getFlowStatus:B,getNumberOfStepsCompleted:O}=ee(),{isLoadingUserFlowStateData:M}=Ee(),{primaryCTAClickSideEffects:N,secondaryCTAClickSideEffects:L}=le(),{hasOpenModals:H}=Fe(),$=m(e),{openFlowStates:J}=qd(G),{mergeAppearanceWithDefault:Q}=te();if(o=Q(o),Kd(()=>{y(t)},[t,g]),M)return null;let Y=T(e);if(!Y||v(Y)||B(e)==R||H())return null;let V=P(e);if(Object.keys(J).length>0){let _=Object.keys(J).find(D=>J[D]===!0);if(_!==void 0&&_!==e)return _t.createElement(_t.Fragment,null)}async function ge(_){if(await x(e,_.id),V.map(D=>w(e,D.id)).every(D=>D===Ne)){await I(e);return}if(!a&&$+1<V.length){if(C(e,V[$+1].id))return;await F(e,V[$+1].id)}}function oe(_,D,re){let j=$+1<V.length?V[$+1]:null;r&&r(_,$,D,j),i&&i(_,re,j)}function q(){return V.map(_=>({..._,handleSecondaryButtonClick:async()=>{L(_),_.skippable===!0&&await x(e,_.id,{skipped:!0}),oe(_,"secondary",$)},handlePrimaryButtonClick:async()=>{(!_.completionCriteria&&(_.autoMarkCompleted||_.autoMarkCompleted===void 0)||_.completionCriteria&&_.autoMarkCompleted===!0)&&await ge(_),oe(_,"primary",$),N(_)}}))}async function xe(_){s&&s(),h==="complete-flow"?await I(e):await x(e,_.id)}function Te(){c&&c()}let K=!document.querySelector(V[$].selector);function pe(){let _=V.findIndex(D=>!!document.querySelector(D.selector));return V.map((D,re)=>K&&!n&&re!==_&&f?null:_t.createElement($o,{key:D.id,appearance:o,steps:q(),selectedStep:re,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>xe(D),tooltipPosition:d,showHighlightOnly:a,completedStepsCount:O(e),onComplete:Te,...S}))}return _t.createElement(Yd,null,_t.createElement(se,{appearance:o}),n||K&&f?pe():_t.createElement($o,{appearance:o,steps:q(),selectedStep:$,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>xe(V[$]),tooltipPosition:d,completedStepsCount:O(e),showHighlightOnly:a,onComplete:Te,...S}))};import be,{useEffect as Jd,useRef as Qd,useState as Zd}from"react";import{Portal as Rd}from"react-portal";import wt from"styled-components";var Os=wt.button`
|
|
1349
1347
|
${e=>k(e)} {
|
|
1350
1348
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1351
1349
|
|
|
@@ -1363,17 +1361,17 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1363
1361
|
opacity: 0.8;
|
|
1364
1362
|
}
|
|
1365
1363
|
}
|
|
1366
|
-
|
|
1364
|
+
`,Ds=wt.span`
|
|
1367
1365
|
${e=>k(e)} {
|
|
1368
1366
|
font-size: 12px;
|
|
1369
1367
|
display: inline-block;
|
|
1370
1368
|
}
|
|
1371
|
-
|
|
1369
|
+
`,$s=wt.span`
|
|
1372
1370
|
${e=>k(e)} {
|
|
1373
1371
|
font-size: 12px;
|
|
1374
1372
|
display: inline-block;
|
|
1375
1373
|
}
|
|
1376
|
-
`,
|
|
1374
|
+
`,Ms=wt.div`
|
|
1377
1375
|
position: fixed;
|
|
1378
1376
|
right: 0;
|
|
1379
1377
|
bottom: 0;
|
|
@@ -1383,7 +1381,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1383
1381
|
flex-direction: column;
|
|
1384
1382
|
align-items: flex-end;
|
|
1385
1383
|
z-index: 50;
|
|
1386
|
-
`,
|
|
1384
|
+
`,Us=wt.button`
|
|
1387
1385
|
${e=>k(e)} {
|
|
1388
1386
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1389
1387
|
background-color: #ffffff;
|
|
@@ -1399,7 +1397,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1399
1397
|
0px 3px 6px -4px rgba(0, 0, 0, 0.12);
|
|
1400
1398
|
border-radius: 45px;
|
|
1401
1399
|
cursor: pointer;
|
|
1402
|
-
`,
|
|
1400
|
+
`,zs=wt.div`
|
|
1403
1401
|
${e=>k(e)} {
|
|
1404
1402
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1405
1403
|
background: #ffffff;
|
|
@@ -1416,7 +1414,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1416
1414
|
position: ${e=>e.type=="inline"?"absolute":"relative"};
|
|
1417
1415
|
top: ${e=>e.type=="inline"?"68px":0};
|
|
1418
1416
|
margin-left: ${e=>e.type=="inline"?"-127px":0};
|
|
1419
|
-
`,
|
|
1417
|
+
`,_s=wt.button`
|
|
1420
1418
|
${e=>k(e)} {
|
|
1421
1419
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1422
1420
|
color: #434343;
|
|
@@ -1433,7 +1431,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1433
1431
|
font-size: 14px;
|
|
1434
1432
|
|
|
1435
1433
|
padding: 8px 12px;
|
|
1436
|
-
`;import{AnimatePresence as
|
|
1434
|
+
`;import{AnimatePresence as Gs,motion as qs}from"framer-motion";import Ws from"react";var Hs=({style:e,className:t})=>Ws.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Ws.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 Vs from"react";var js=({style:e,className:t})=>Vs.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"},Vs.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"}));var ec=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:r="inline",title:n="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:a,getStepStatus:h,getNumberOfStepsCompleted:c,isLoading:f,targetingLogicShouldHideFlow:S}=ee(),{primaryCTAClickSideEffects:T}=le(),P=Qd(null),[g,v]=Zd(!1),{mergeAppearanceWithDefault:x}=te();s=x(s),Jd(()=>(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||S(I))return null;let y=d(e);if(!y||!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(zs,{className:l("floatingWidgetMenu",s),as:qs.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:r},y.map((C,B)=>be.createElement(_s,{className:l("floatingWidgetMenuItem",s),key:B,onClick:()=>m(C,B)},C.title)))}return r=="inline"?be.createElement("span",{ref:P},be.createElement(Os,{style:t,onClick:()=>{v(!g)},className:l("supportButton",s)},be.createElement($s,{className:l("supportIconContainer",s)},be.createElement(js,{className:l("supportIcon",s),style:{width:"18px",height:"18px"}})),be.createElement(Ds,{className:l("supportButtonTitle",s)},n)),be.createElement(Gs,null,be.createElement(w,null))):be.createElement(Rd,null,be.createElement(Ms,{style:t,ref:P},be.createElement(Gs,null,be.createElement(w,null)),be.createElement(Us,{onClick:()=>{v(!g)},as:qs.button,whileHover:{scale:1.1},className:l("floatingWidgetButton",s)},be.createElement(Hs,{className:l("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import Ve,{useEffect as tc}from"react";import Mo from"styled-components";var Ks=Mo.div`
|
|
1437
1435
|
${e=>k(e)} {
|
|
1438
1436
|
display: flex;
|
|
1439
1437
|
flex-direction: column;
|
|
@@ -1448,17 +1446,17 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1448
1446
|
border-radius: 12px;
|
|
1449
1447
|
position: relative;
|
|
1450
1448
|
}
|
|
1451
|
-
`,
|
|
1449
|
+
`,Ys=Mo.div`
|
|
1452
1450
|
display: flex;
|
|
1453
1451
|
flex-direction: column;
|
|
1454
1452
|
flex: 1;
|
|
1455
|
-
`,
|
|
1453
|
+
`,Xs=Mo.div`
|
|
1456
1454
|
display: flex;
|
|
1457
1455
|
flex-direction: column;
|
|
1458
1456
|
justify-content: center;
|
|
1459
1457
|
align-items: flex-start;
|
|
1460
1458
|
margin-top: 16px;
|
|
1461
|
-
`,
|
|
1459
|
+
`,Js=Mo.div`
|
|
1462
1460
|
${e=>k(e)} {
|
|
1463
1461
|
position: absolute;
|
|
1464
1462
|
top: 16px;
|
|
@@ -1469,7 +1467,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1469
1467
|
opacity: 0.8;
|
|
1470
1468
|
}
|
|
1471
1469
|
}
|
|
1472
|
-
`;var oc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:a,markStepCompleted:
|
|
1470
|
+
`;var oc=({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:S,getFlowSteps:T,getFlowStatus:P,getCurrentStepIndex:g}=ee(),{primaryCTAClickSideEffects:v}=le(),{mergeAppearanceWithDefault:x}=te();if(r=x(r),tc(()=>{S(o)},[o,c]),c)return null;let F=d(e);if(!F||f(F)||P(e)===R)return null;let y=T(e)[g(e)];return Ve.createElement(Ve.Fragment,null,Ve.createElement(se,{appearance:r}),Ve.createElement(Ks,{appearance:r,className:Ce(l("embeddedTipContainer",r),n),style:s},(p===!0||y.dismissible)&&Ve.createElement(Js,{onClick:async()=>{await a(e),t&&t()},className:l("embeddedTipDismissButton",r)},Ve.createElement(ke,null)),Ve.createElement(Ys,null,Ve.createElement(Se,{size:"small",appearance:r,title:y.title,subtitle:y.subtitle})),y.primaryButtonTitle&&Ve.createElement(Xs,{className:l("embeddedTipCallToActionContainer",r)},Ve.createElement(ne,{classPrefix:"embeddedTip",title:y.primaryButtonTitle,appearance:r,withMargin:!1,size:"small",type:"inline",onClick:async()=>{y.handlePrimaryButtonClick(),v(y),!(i&&i(y,g(e),"primary")===!1)&&(await h(e,y.id),await a(e))}}))))};import he,{useEffect as rc}from"react";import Wt from"styled-components";var Qs=Wt.div`
|
|
1473
1471
|
// use the :not annotation
|
|
1474
1472
|
${e=>k(e)} {
|
|
1475
1473
|
display: flex;
|
|
@@ -1483,19 +1481,19 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1483
1481
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1484
1482
|
border-radius: 12px;
|
|
1485
1483
|
}
|
|
1486
|
-
`,
|
|
1484
|
+
`,Zs=Wt.div`
|
|
1487
1485
|
${e=>k(e)} {
|
|
1488
1486
|
display: flex;
|
|
1489
1487
|
width: 36px;
|
|
1490
1488
|
height: 36px;
|
|
1491
1489
|
}
|
|
1492
|
-
`,
|
|
1490
|
+
`,Rs=Wt.div`
|
|
1493
1491
|
display: flex;
|
|
1494
1492
|
flex-direction: column;
|
|
1495
1493
|
flex: 1;
|
|
1496
1494
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1497
1495
|
margin-top: ${e=>e.type==="square"?"12px":"0"};
|
|
1498
|
-
`,
|
|
1496
|
+
`,el=Wt.div`
|
|
1499
1497
|
display: flex;
|
|
1500
1498
|
flex-direction: column;
|
|
1501
1499
|
justify-content: center;
|
|
@@ -1509,12 +1507,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1509
1507
|
:hover {
|
|
1510
1508
|
opacity: 0.8;
|
|
1511
1509
|
}
|
|
1512
|
-
`,
|
|
1510
|
+
`,Sr=Wt.div`
|
|
1513
1511
|
display: flex;
|
|
1514
1512
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1515
1513
|
align-items: flex-end;
|
|
1516
1514
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1517
|
-
`;import
|
|
1515
|
+
`;import tl from"react";var ol=({style:e,className:t})=>tl.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"},tl.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"}));var ic=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:r,onButtonClick:n,appearance:s,type:p="full-width",icon:d})=>{let{getFlow:a,markFlowCompleted:h,isLoading:c,targetingLogicShouldHideFlow:f,updateCustomVariables:S,getFlowMetadata:T,getFlowStatus:P,getFlowSteps:g,getCurrentStepIndex:v}=ee(),{primaryCTAClickSideEffects:x}=le(),{mergeAppearanceWithDefault:F}=te();if(s=F(s),rc(()=>{S(r)},[r,c]),c)return null;let I=a(e);if(!I||f(I)||P(e)===R)return null;let y=g(e),m=y.length>0?y[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(Qs,{type:p,appearance:s,className:l("bannerContainer",s)},p!="square"&&he.createElement(Zs,{className:l("bannerIconContainer",s)},d||he.createElement(ol,null)),p==="square"&&m.dismissible&&he.createElement(Sr,{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(Rs,{type:p},he.createElement(Se,{appearance:s,title:t,subtitle:o,classPrefix:"banner"})),he.createElement(el,{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(Sr,{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 X,{useEffect as nc}from"react";import{Portal as sc}from"react-portal";import Re from"styled-components";var rl=Re.div`
|
|
1518
1516
|
${e=>k(e)} {
|
|
1519
1517
|
display: flex;
|
|
1520
1518
|
flex-direction: column;
|
|
@@ -1535,7 +1533,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1535
1533
|
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
|
|
1536
1534
|
min-width: 550px;
|
|
1537
1535
|
}
|
|
1538
|
-
`,
|
|
1536
|
+
`,il=Re.button`
|
|
1539
1537
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1540
1538
|
border-radius: 8px;
|
|
1541
1539
|
// If selected make border color primary and text color color priamry
|
|
@@ -1556,12 +1554,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1556
1554
|
display: flex;
|
|
1557
1555
|
justify-content: center;
|
|
1558
1556
|
align-items: center;
|
|
1559
|
-
`,
|
|
1557
|
+
`,yr=Re.div`
|
|
1560
1558
|
display: flex;
|
|
1561
1559
|
justify-content: flex-end;
|
|
1562
1560
|
margin-top: 16px;
|
|
1563
1561
|
gap: 8px;
|
|
1564
|
-
`,
|
|
1562
|
+
`,nl=Re.div`
|
|
1565
1563
|
display: flex;
|
|
1566
1564
|
justify-content: space-between;
|
|
1567
1565
|
margin-top: 8px;
|
|
@@ -1573,13 +1571,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1573
1571
|
display: flex;
|
|
1574
1572
|
flex-direction: column;
|
|
1575
1573
|
flex: 1;
|
|
1576
|
-
`,
|
|
1574
|
+
`,Ib=Re.div`
|
|
1577
1575
|
display: flex;
|
|
1578
1576
|
flex-direction: column;
|
|
1579
1577
|
justify-content: center;
|
|
1580
1578
|
align-items: flex-start;
|
|
1581
1579
|
margin-top: 16px;
|
|
1582
|
-
`,
|
|
1580
|
+
`,sl=Re.textarea`
|
|
1583
1581
|
${e=>k(e)} {
|
|
1584
1582
|
margin-top: 16px;
|
|
1585
1583
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
@@ -1590,7 +1588,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1590
1588
|
width: 100%;
|
|
1591
1589
|
height: 100px;
|
|
1592
1590
|
}
|
|
1593
|
-
`,
|
|
1591
|
+
`,ll=Re.div`
|
|
1594
1592
|
${e=>k(e)} {
|
|
1595
1593
|
position: absolute;
|
|
1596
1594
|
top: 16px;
|
|
@@ -1601,5 +1599,5 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${jt}${r}.${jt}${r} { ${Object.entries(n).map
|
|
|
1601
1599
|
opacity: 0.8;
|
|
1602
1600
|
}
|
|
1603
1601
|
}
|
|
1604
|
-
`;var lc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,type:p="modal"})=>{let{getFlow:d,markFlowCompleted:a,markStepCompleted:
|
|
1602
|
+
`;var lc=({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:S,updateCustomVariables:T,getFlowSteps:P,getFlowStatus:g,getCurrentStepIndex:v}=ee(),{primaryCTAClickSideEffects:x}=le(),{mergeAppearanceWithDefault:F}=te(),[I,y]=X.useState(null),[m,w]=X.useState(""),{hasOpenModals:C,setKeepCompletedFlowOpenDuringSession:B,shouldKeepCompletedFlowOpenDuringSession:O}=Fe();if(r=F(r),nc(()=>{T(o)},[o,f]),f)return null;let M=d(e);if(!M||S(M)||g(e)===R||c(e)===1&&!O(e)||C())return null;let L=P(e)[v(e)];function H(){return X.createElement(X.Fragment,null,X.createElement(wr,null,X.createElement(Se,{size:"large",appearance:r,title:L.title,subtitle:L.subtitle})),X.createElement(yr,{className:l("npsNumberButtonContainer",r),appearance:r},Array.from(Array(10).keys()).map(Q=>X.createElement(il,{className:l("npsNumberButton",r),selected:I===Q+1,key:Q,onClick:async()=>{B(e),y(Q+1),await h(e,L.id,{score:Q+1})},appearance:r},Q+1))),X.createElement(nl,{appearance:r},X.createElement(br,{appearance:r},"Not likely at all"),X.createElement(br,{appearance:r},"Extremely likely")))}function $(){return X.createElement(X.Fragment,null,X.createElement(wr,null,X.createElement(Se,{appearance:r,title:"Why did you choose this score?",size:"large"})),X.createElement(sl,{appearance:r,value:m,onChange:Q=>{w(Q.target.value)},placeHolder:"Add your optional fedback here..."}),X.createElement(yr,{appearance:r,className:l("npsNumberButtonContainer",r)},X.createElement(ne,{size:"large",withMargin:!1,onClick:async()=>{await a(e),i&&i(L,1,"primary")},appearance:r,title:L.secondaryButtonTitle||"Skip",secondary:!0}),X.createElement(ne,{size:"large",withMargin:!1,onClick:async()=>{await h(e,L.id,{feedbackText:m}),await a(e),i&&i(L,1,"primary")},appearance:r,title:L.primaryButtonTitle||"Submit"})))}function J(){return X.createElement(X.Fragment,null,X.createElement(se,{appearance:r}),X.createElement(rl,{appearance:r,className:Ce(l("npsSurveyContainer",r),n),style:s,type:p},X.createElement(ll,{onClick:async()=>{await a(e),t&&t()},className:l("npsSurveyDismissButton",r)},X.createElement(ke,null)),c(e)==0&&H(),c(e)==1&&$()))}return p==="inline"?J():X.createElement(sc,null,J())};import*as Uo from"react";import al from"react";var pl=({as:e="span",children:t,variant:o="Body1",...i})=>al.createElement(Mi,{color:"neutral.foreground",fontFamily:"default",forwardedAs:e,variant:o,...i},t),ac=Object.fromEntries(Object.keys(Po).map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=i=>al.createElement(pl,{as:t,...i,variant:e},i.children);return o.displayName=`Text.${e}`,[e,o]})),Tr=Object.assign(pl,ac);var dl=({as:e="button",className:t,size:o="md",title:i,variant:r="Primary",...n})=>{var s;return Uo.createElement($i,{className:`fr-button-${r.toLowerCase()}${t?` ${t}`:""}`,forwardedAs:e,variant:r,size:o,borderRadius:"md",...n},Uo.createElement(Tr,{color:(s=Rt[r])==null?void 0:s.color,fontWeight:"semibold"},i))},pc=Object.fromEntries(Object.keys(Rt).map(e=>{let t=o=>Uo.createElement(dl,{...o,variant:e});return t.displayName=`Button.${e}`,[e,t]})),dc=Object.assign(dl,pc);export{dc as Button,Ke as CheckBox,rt as FormLabel,Xo as FormTextField,ic as FrigadeBanner,xr as FrigadeChecklist,qe as FrigadeDefaultAppearance,oc as FrigadeEmbeddedTip,Ei as FrigadeForm,Od as FrigadeGuide,Ed as FrigadeHeroChecklist,lc as FrigadeNPSSurvey,Nd as FrigadeProgressBadge,Ap as FrigadeProvider,ec as FrigadeSupportWidget,Xd as FrigadeTour,Bt as ProgressRing,Tr as Text,lr as tokens,Fe as useFlowOpens,Ht as useFlowResponses,ee as useFlows,nr as useOrganization,Vt as useUser};
|
|
1605
1603
|
//# sourceMappingURL=index.mjs.map
|