@frigade/react 1.32.84 → 1.32.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -0
- package/lib/index.js +252 -252
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +182 -182
- 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 Wa,useEffect as To,useState as Ae}from"react";import{ThemeProvider as Ha}from"styled-components";import gt,{useContext as _a,useEffect as wo,useState as tr}from"react";import{useCallback as mt,useContext as ll,useEffect as al}from"react";import Do,{useMemo as Sr}from"react";var Cr="1.32.84 ";var Ee="NOT_STARTED_STEP",X="COMPLETED_FLOW",no="ABORTED_FLOW",ct="STARTED_FLOW",Ie="NOT_STARTED_FLOW",Ne="COMPLETED_STEP",so="STARTED_STEP";function Me(){let{publicApiKey:e,userId:t,apiUrl:o}=Do.useContext(G);return{config:Sr(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Cr,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:Sr(()=>`${o}/v1/public/`,[o])}}var Xs="frigade-last-call-at-",Qs="frigade-last-call-data-";function Tt(){let{shouldGracefullyDegrade:e,readonly:t}=Do.useContext(G);return async(o,n)=>{if(t&&(n.method==="POST"||n.method==="PUT"||n.method==="DELETE"))return wt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),wt();let r=Xs+o,i=Qs+o;if(window&&window.localStorage&&n&&n.body&&n.method==="POST"){let p=window.localStorage.getItem(r),d=window.localStorage.getItem(i);if(p&&d&&d==n.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(i,n.body)}let s;try{s=await fetch(o,n)}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}=Do.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 il,useState as yr}from"react";import{useContext as Rs,useEffect as el,useState as tl}from"react";import ol from"swr";import{useContext as Zs}from"react";function Fe(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:n,completedFlowsToKeepOpenDuringSession:r}=Zs(G);function i(c,h=!1){return e[c]??h}function s(c,h){t(f=>({...f,[c]:h}))}function p(c){t(h=>{let{[c]:f,...v}=h;return{...v}})}function d(c){r.includes(c)||n(h=>[...h,c])}function a(c){return r.includes(c)}function S(c){return Object.entries(e).some(([h,f])=>f&&h!=c)||o}return{getOpenFlowState:i,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:S,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:a}}var rl="unknown";function Be(){let{config:e,apiUrl:t}=Me(),{publicApiKey:o,userId:n,organizationId:r,flows:i,setShouldGracefullyDegrade:s,readonly:p}=Rs(G),{resetOpenFlowState:d}=Fe(),[a,S]=tl(!1),c={data:i.map(x=>({flowId:x.id,flowState:X,lastStepId:null,userId:n,foreignUserId:n,stepStates:{},shouldTrigger:!1}))},h=x=>fetch(x,e).then(g=>{if(g.ok)return g.json();throw new Error("Failed to fetch user flow states")}).catch(g=>(console.log(`Error fetching ${x}: ${g}. Will gracefully degrade and hide Frigade`),s(!0),c)),{data:f,isLoading:v,mutate:F,error:C}=ol(o&&i&&n?`${t}userFlowStates?foreignUserId=${encodeURIComponent(n)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,h,{revalidateOnFocus:p!==!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),y=f==null?void 0:f.data;el(()=>{!a&&!v&&y&&S(!0)},[y,a,v]);async function T(x){if(y&&!p){let g=y.find(I=>I.flowId===x);g&&g.flowState!==X&&(g.flowState=X),await F(Promise.resolve({...f,data:y}),{optimisticData:{...f,data:y},revalidate:!1,rollbackOnError:!1})}}async function k(x,g,I){if(y){let D=y.find(z=>z.flowId===x);D&&(D.stepStates[g]=I,D.flowState=ct),await F(Promise.resolve({...f,data:y}),{optimisticData:{...f,data:y},revalidate:!1,rollbackOnError:!1})}}async function A(x,g,I){if(y){let D=y.find(z=>z.flowId===x);D&&(D.lastStepId=g,D.stepStates[g]=I,D.flowState=ct),await F({...f,data:y},{optimisticData:{...f,data:y},revalidate:!1,rollbackOnError:!1})}}async function b(x){if(y){let g=y.find(I=>I.flowId===x);g&&g.flowState!==Ie&&(g.flowState=Ie,g.lastStepId=rl,Object.keys(g.stepStates).forEach(I=>{g.stepStates[I].actionType=Ee,g.stepStates[I].createdAt=new Date().toISOString()}),await F({...f,data:y},{optimisticData:{...f,data:y},revalidate:!1,rollbackOnError:!1}),d(x))}}async function m(x,g){if(y){let I=y.find(D=>D.flowId===x);I&&I.stepStates[g]!==Ee&&(I.stepStates[g]=Ee),await F({...f,data:y},{optimisticData:{...f,data:y},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:y,isLoadingUserFlowStateData:!a,mutateUserFlowState:F,optimisticallyMarkFlowCompleted:T,optimisticallyMarkFlowNotStarted:b,optimisticallyMarkStepCompleted:k,optimisticallyMarkStepNotStarted:m,optimisticallyMarkStepStarted:A,error:C}}function Wt(){let{config:e,apiUrl:t}=Me(),{userFlowStatesData:o,mutateUserFlowState:n}=Be(),{failedFlowResponses:r,setFailedFlowResponses:i,flowResponses:s,setFlowResponses:p}=il(G),[d,a]=yr(new Set),[S,c]=yr(new Set),h=Tt();function f(C){let y=JSON.stringify(C);if(d.has(y))return null;d.add(y),a(d),S.add(C),c(S);let T=s==null?void 0:s.find(k=>k.flowSlug===C.flowSlug&&k.stepId===C.stepId&&k.actionType===C.actionType&&k.createdAt===C.createdAt);return h(`${t}flowResponses`,{...e,method:"POST",body:y}).then(k=>{k.status!==200&&k.status!==201?(console.log("Failed to send flow response for step "+C.stepId+". Will retry again later."),i([...r,C])):T||p(A=>[...A??[],C])})}async function v(C){C.foreignUserId&&(C.actionType===ct||C.actionType===Ie?await f(C):C.actionType===X?await f(C):C.actionType===so?await f(C):C.actionType===Ne?await f(C):C.actionType===no?await f(C):C.actionType===Ee&&await f(C))}function F(){let C=[];return o==null||o.forEach(y=>{if(y&&y.stepStates&&Object.keys(y.stepStates).length!==0)for(let T in y.stepStates){let k=y.stepStates[T];C.push({foreignUserId:y.foreignUserId,flowSlug:y.flowId,stepId:k.stepId,actionType:k.actionType,data:{},createdAt:new Date(k.createdAt),blocked:k.blocked,hidden:k.hidden})}}),[...C,...s]}return{addResponse:v,setFlowResponses:p,getFlowResponses:F}}import pl from"swr";var nl=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,br=e=>{let t=nl.exec(e);if(t===null)return null;let o=null;return t.forEach((n,r)=>{let i=sl(n,"'","");i.startsWith("flow_")&&(o=i)}),o},sl=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function Q(){let{config:e,apiUrl:t}=Me(),{flows:o,setFlows:n,userId:r,publicApiKey:i,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:a,setFlowResponses:S,setShouldGracefullyDegrade:c,readonly:h}=ll(G),f={data:[]},{verifySDKInitiated:v}=Ft(),{addResponse:F,getFlowResponses:C}=Wt(),y=u=>fetch(u,e).then(w=>w.ok?w.json():(console.log(`Error fetching ${u} (${w.status}): ${w.statusText}. .Will gracefully degrade and hide Frigade`),c(!0),f)).catch(w=>(console.log(`Error fetching ${u}: ${w}. Will gracefully degrade and hide Frigade`),c(!0),f)),{userFlowStatesData:T,isLoadingUserFlowStateData:k,optimisticallyMarkFlowCompleted:A,optimisticallyMarkFlowNotStarted:b,optimisticallyMarkStepCompleted:m,optimisticallyMarkStepNotStarted:x,optimisticallyMarkStepStarted:g}=Be(),{data:I,error:D,isLoading:z}=pl(i?`${t}flows${h?"?readonly=true":""}`:null,y,{keepPreviousData:!0});al(()=>{if(D){console.error(D);return}I&&I.data&&n(I.data)},[I,D]);function N(u){if(z)return null;let w=o.find(E=>E.slug===u);return!w&&o.length>0&&!k&&!z?(console.log(`Flow with slug ${u} not found`),null):(w==null?void 0:w.active)===!1?null:w}function M(u){var B;if(!N(u))return[];let w=N(u).data;return w?(w=H(w),(((B=JSON.parse(w))==null?void 0:B.data)??[]).map(J=>{let dt=je(J);return{handleSecondaryButtonClick:()=>{J.skippable===!0&&ge(u,J.id,{skipped:!0})},...J,complete:ae(u,J.id)===Ne||dt>=1,blocked:_(u,J.id),hidden:O(u,J.id),handlePrimaryButtonClick:()=>{(!J.completionCriteria&&(J.autoMarkCompleted||J.autoMarkCompleted===void 0)||J.completionCriteria&&J.autoMarkCompleted===!0)&&ge(u,J.id)},progress:dt}}).filter(J=>J.hidden!==!0)):[]}function H(u){return u.replaceAll(/\${(.*?)}/g,(w,E)=>s[E]===void 0?"":String(s[E]).replace(/[\u00A0-\u9999<>\&]/g,function(B){return"&#"+B.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 L(u){if(!N(u))return[];let w=N(u).data;return w?(w=H(w),JSON.parse(w)??{}):[]}function ne(u,w){p(E=>({...E,[u]:w}))}function fe(u){!k&&!z&&u&&JSON.stringify(s)!=JSON.stringify({...s,...u})&&Object.keys(u).forEach(w=>{ne(w,u[w])})}let Y=mt(async(u,w,E)=>{v();let B={foreignUserId:r,flowSlug:u,stepId:w,actionType:so,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};K(B)&&(await g(u,w,B),F(B))},[r,T]),V=mt(async(u,w,E)=>{v();let B={foreignUserId:r,flowSlug:u,stepId:w,actionType:Ee,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};K(B)&&(await x(u,w),F(B))},[r,T]),ge=mt(async(u,w,E)=>{v();let B={foreignUserId:r,flowSlug:u,stepId:w,actionType:Ne,data:E??{},createdAt:new Date,blocked:!1,hidden:!1};K(B)&&(await m(u,w,B),F(B))},[r,T]),ee=mt(async(u,w)=>{if(v(),De(u)===Ie)return;let E={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:Ie,data:w??{},createdAt:new Date,blocked:!1,hidden:!1};await b(u),K(E)&&F(E)},[r,T]),q=mt(async(u,w)=>{v();let E={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:ct,data:w??{},createdAt:new Date,blocked:!1,hidden:!1};K(E)&&F(E)},[r,T]),he=mt(async(u,w)=>{v();let E={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:X,data:w??{},createdAt:new Date,blocked:!1,hidden:!1};K(E)&&(await A(u),F(E))},[r,T]),Te=mt(async(u,w)=>{v();let E={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:no,data:w??{},createdAt:new Date,blocked:!1,hidden:!1};K(E)&&(await A(u),F(E))},[r,T]);function K(u){var w;if(!T&&u.actionType===Ee)return!1;if(T){let E=T.find(B=>B.flowId===u.flowSlug);if(u.actionType===Ee&&(!(E!=null&&E.stepStates[u.stepId])||E.stepStates[u.stepId].actionType===Ee)||E&&((w=E.stepStates[u.stepId])==null?void 0:w.actionType)===u.actionType||E&&E.flowState===X&&u.actionType===X)return!1}return!0}function ae(u,w){let E=te(u,w);return k?null:E?E.actionType:Ee}function _(u,w){let E=te(u,w);return E?E.blocked:!1}function O(u,w){let E=te(u,w);return E?E.hidden:!1}function te(u,w){if(k)return null;let E=T==null?void 0:T.find(B=>B.flowId===u);return!E||!E.stepStates[w]?null:E.stepStates[w]??null}function j(u){var E;if(k||!T)return null;if(De(u)===Ie)return M(u)[0]??null;let w=(E=T.find(B=>B.flowId===u))==null?void 0:E.lastStepId;return w?M(u).find(B=>B.id===w):null}function oe(u){let w=j(u);if(!w)return 0;let E=M(u).findIndex(B=>B.id===w.id)??0;return ae(u,w.id)===Ne&&E<M(u).length-1?E+1:E}function je(u){if(!u.completionCriteria)return;let w=br(u.completionCriteria);if(w===null)return;let E=pt(w),B=W(w);return B===0?void 0:E/B}function De(u){let w=T==null?void 0:T.find(E=>E.flowId===u);return w?w.flowState:null}function pt(u){let w=M(u);return w.length===0?0:w.filter(B=>ae(u,B.id)===Ne).length}function W(u){return M(u).length}function ve(u){return JSON.parse(o.find(w=>w.slug===u).data)}function $e(u){if(h)return!1;if(k)return!0;if(u!=null&&u.targetingLogic&&T){let w=T.find(E=>E.flowId===u.slug);if(w)return w.shouldTrigger===!1}return!!(u!=null&&u.targetingLogic&&r&&r.startsWith("guest_"))}function Oo(u){return!$e(N(u))}return{getFlow:N,getFlowData:ve,isLoading:k||z,getStepStatus:ae,getFlowSteps:M,getCurrentStepIndex:oe,markStepStarted:Y,markStepCompleted:ge,markFlowNotStarted:ee,markFlowStarted:q,markFlowCompleted:he,markFlowAborted:Te,markStepNotStarted:V,getFlowStatus:De,getNumberOfStepsCompleted:pt,getNumberOfSteps:W,targetingLogicShouldHideFlow:$e,setCustomVariable:ne,updateCustomVariables:fe,customVariables:s,getStepOptionalProgress:je,getFlowMetadata:L,isStepBlocked:_,isStepHidden:O,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:a,isFlowAvailableToUser:Oo}}import{useCallback as wr,useContext as dl,useEffect as cl}from"react";var kt="guest_";function Ht(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:n,shouldGracefullyDegrade:r}=dl(G),{config:i,apiUrl:s}=Me(),{mutateUserFlowState:p}=Be(),d=Tt(),{verifySDKInitiated:a}=Ft();cl(()=>{if(e&&!t){if(e.startsWith(kt))return;let h=`frigade-user-registered-${e}`;localStorage.getItem(h)||(d(`${s}users`,{...i,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(h,"true"))}},[e,r,t]);let S=wr(async h=>{a();let f={foreignId:e,properties:h};await d(`${s}users`,{...i,method:"POST",body:JSON.stringify(f)}),n(v=>({...v,...h})),p()},[e,i,r,p]),c=wr(async(h,f)=>{a();let F={foreignId:e,events:[{event:h,properties:f}]};await d(`${s}users`,{...i,method:"POST",body:JSON.stringify(F)}),p()},[e,i,p]);return{userId:e,setUserId:o,addPropertiesToUser:S,trackEventForUser:c}}import{v4 as za}from"uuid";import _e,{useEffect as Da,useState as $a}from"react";import Le,{useEffect as Cl}from"react";import po from"styled-components";import ml from"react";import ul from"styled-components";var Tr="fr-",Vt="cfr-";function l(e,t){let o=`${Tr}${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+" "+Vt+e}return o}function P(e){if(!e.className||e.className.indexOf(Vt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(Tr)?"":`:not(${o.map(n=>`.${n}`).join(", ")})`}function $o(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=>`${$o(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Ce(...e){return e.filter(Boolean).join(" ")}function jt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var fl=ul.div`
|
|
2
|
+
import ht,{createContext as Ha,useEffect as To,useState as Ae}from"react";import{ThemeProvider as Va}from"styled-components";import gt,{useContext as za,useEffect as wo,useState as tr}from"react";import{useCallback as mt,useContext as al,useEffect as pl}from"react";import Do,{useMemo as Sr}from"react";var Cr="1.32.86 ";var Ee="NOT_STARTED_STEP",R="COMPLETED_FLOW",no="ABORTED_FLOW",ct="STARTED_FLOW",Ie="NOT_STARTED_FLOW",Ne="COMPLETED_STEP",so="STARTED_STEP";function Me(){let{publicApiKey:e,userId:t,apiUrl:o}=Do.useContext(G);return{config:Sr(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Cr,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:Sr(()=>`${o}/v1/public/`,[o])}}var Xs="frigade-last-call-at-",Qs="frigade-last-call-data-";function Tt(){let{shouldGracefullyDegrade:e,readonly:t}=Do.useContext(G);return async(o,n)=>{if(t&&(n.method==="POST"||n.method==="PUT"||n.method==="DELETE"))return wt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),wt();let r=Xs+o,i=Qs+o;if(window&&window.localStorage&&n&&n.body&&n.method==="POST"){let p=window.localStorage.getItem(r),d=window.localStorage.getItem(i);if(p&&d&&d==n.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(i,n.body)}let s;try{s=await fetch(o,n)}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}=Do.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 nl,useState as yr}from"react";import{useContext as Rs,useEffect as el,useState as tl}from"react";import ol from"swr";import{useContext as Zs}from"react";function Fe(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:n,completedFlowsToKeepOpenDuringSession:r}=Zs(G);function i(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)||n(f=>[...f,c])}function a(c){return r.includes(c)}function x(c){return Object.entries(e).some(([f,S])=>S&&f!=c)||o}return{getOpenFlowState:i,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:x,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:a}}import rl from"swr/immutable";var il="unknown";function Be(){let{config:e,apiUrl:t}=Me(),{publicApiKey:o,userId:n,organizationId:r,flows:i,setShouldGracefullyDegrade:s,readonly:p}=Rs(G),{resetOpenFlowState:d}=Fe(),[a,x]=tl(!1),c={data:i.map(C=>({flowId:C.id,flowState:R,lastStepId:null,userId:n,foreignUserId:n,stepStates:{},shouldTrigger:!1}))},f=C=>fetch(C,e).then(E=>{if(E.ok)return E.json();throw new Error("Failed to fetch user flow states")}).catch(E=>(console.log(`Error fetching ${C}: ${E}. Will gracefully degrade and hide Frigade`),s(!0),c)),S=o&&i&&n?`${t}userFlowStates?foreignUserId=${encodeURIComponent(n)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,{data:T,isLoading:P,mutate:g,error:v}=p?rl(S,f):ol(S,f,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),h=T==null?void 0:T.data;el(()=>{!a&&!P&&h&&x(!0)},[h,a,P]);async function F(C){if(h&&!p){let E=h.find(O=>O.flowId===C);E&&E.flowState!==R&&(E.flowState=R),await g(Promise.resolve({...T,data:h}),{optimisticData:{...T,data:h},revalidate:!1,rollbackOnError:!1})}}async function I(C,E,O){if(h){let M=h.find(N=>N.flowId===C);M&&(M.stepStates[E]=O,M.flowState=ct),await g(Promise.resolve({...T,data:h}),{optimisticData:{...T,data:h},revalidate:!1,rollbackOnError:!1})}}async function y(C,E,O){if(h){let M=h.find(N=>N.flowId===C);M&&(M.lastStepId=E,M.stepStates[E]=O,M.flowState=ct),await g({...T,data:h},{optimisticData:{...T,data:h},revalidate:!1,rollbackOnError:!1})}}async function m(C){if(h){let E=h.find(O=>O.flowId===C);E&&E.flowState!==Ie&&(E.flowState=Ie,E.lastStepId=il,Object.keys(E.stepStates).forEach(O=>{E.stepStates[O].actionType=Ee,E.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,E){if(h){let O=h.find(M=>M.flowId===C);O&&O.stepStates[E]!==Ee&&(O.stepStates[E]=Ee),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:y,error:v}}function Wt(){let{config:e,apiUrl:t}=Me(),{userFlowStatesData:o,mutateUserFlowState:n}=Be(),{failedFlowResponses:r,setFailedFlowResponses:i,flowResponses:s,setFlowResponses:p}=nl(G),[d,a]=yr(new Set),[x,c]=yr(new Set),f=Tt();function S(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."),i([...r,g])):h||p(I=>[...I??[],g])})}async function T(g){g.foreignUserId&&(g.actionType===ct||g.actionType===Ie?await S(g):g.actionType===R?await S(g):g.actionType===so?await S(g):g.actionType===Ne?await S(g):g.actionType===no?await S(g):g.actionType===Ee&&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 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 dl from"swr";var sl=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,br=e=>{let t=sl.exec(e);if(t===null)return null;let o=null;return t.forEach((n,r)=>{let i=ll(n,"'","");i.startsWith("flow_")&&(o=i)}),o},ll=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function ee(){let{config:e,apiUrl:t}=Me(),{flows:o,setFlows:n,userId:r,publicApiKey:i,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:a,setFlowResponses:x,setShouldGracefullyDegrade:c,readonly:f}=al(G),S={data:[]},{verifySDKInitiated:T}=Ft(),{addResponse:P,getFlowResponses:g}=Wt(),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:h,isLoadingUserFlowStateData:F,optimisticallyMarkFlowCompleted:I,optimisticallyMarkFlowNotStarted:y,optimisticallyMarkStepCompleted:m,optimisticallyMarkStepNotStarted:w,optimisticallyMarkStepStarted:C}=Be(),{data:E,error:O,isLoading:M}=dl(i?`${t}flows${f?"?readonly=true":""}`:null,v,{keepPreviousData:!0});pl(()=>{if(O){console.error(O);return}E&&E.data&&n(E.data)},[E,O]);function N(u){if(M)return null;let b=o.find(B=>B.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:z(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,B)=>s[B]===void 0?"":String(s[B]).replace(/[\u00A0-\u9999<>\&]/g,function(A){return"&#"+A.charCodeAt(0)+";"}).replaceAll(/[\\]/g,"\\\\").replaceAll(/[\"]/g,'\\"').replaceAll(/[\/]/g,"\\/").replaceAll(/[\b]/g,"\\b").replaceAll(/[\f]/g,"\\f").replaceAll(/[\n]/g,"\\n").replaceAll(/[\r]/g,"\\r").replaceAll(/[\t]/g,"\\t"))}function $(u){if(!N(u))return[];let b=N(u).data;return b?(b=H(b),JSON.parse(b)??{}):[]}function X(u,b){p(B=>({...B,[u]:b}))}function Q(u){!F&&!M&&u&&JSON.stringify(s)!=JSON.stringify({...s,...u})&&Object.keys(u).forEach(b=>{X(b,u[b])})}let Y=mt(async(u,b,B)=>{T();let A={foreignUserId:r,flowSlug:u,stepId:b,actionType:so,data:B??{},createdAt:new Date,blocked:!1,hidden:!1};K(A)&&(await C(u,b,A),P(A))},[r,h]),V=mt(async(u,b,B)=>{T();let A={foreignUserId:r,flowSlug:u,stepId:b,actionType:Ee,data:B??{},createdAt:new Date,blocked:!1,hidden:!1};K(A)&&(await w(u,b),P(A))},[r,h]),ge=mt(async(u,b,B)=>{T();let A={foreignUserId:r,flowSlug:u,stepId:b,actionType:Ne,data:B??{},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 B={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:Ie,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};await y(u),K(B)&&P(B)},[r,h]),q=mt(async(u,b)=>{T();let B={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:ct,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};K(B)&&P(B)},[r,h]),he=mt(async(u,b)=>{T();let B={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:R,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};K(B)&&(await I(u),P(B))},[r,h]),Te=mt(async(u,b)=>{T();let B={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:no,data:b??{},createdAt:new Date,blocked:!1,hidden:!1};K(B)&&(await I(u),P(B))},[r,h]);function K(u){var b;if(!h&&u.actionType===Ee)return!1;if(h){let B=h.find(A=>A.flowId===u.flowSlug);if(u.actionType===Ee&&(!(B!=null&&B.stepStates[u.stepId])||B.stepStates[u.stepId].actionType===Ee)||B&&((b=B.stepStates[u.stepId])==null?void 0:b.actionType)===u.actionType||B&&B.flowState===R&&u.actionType===R)return!1}return!0}function pe(u,b){let B=re(u,b);return F?null:B?B.actionType:Ee}function z(u,b){let B=re(u,b);return B?B.blocked:!1}function D(u,b){let B=re(u,b);return B?B.hidden:!1}function re(u,b){if(F)return null;let B=h==null?void 0:h.find(A=>A.flowId===u);return!B||!B.stepStates[b]?null:B.stepStates[b]??null}function j(u){var B;if(F||!h)return null;if(De(u)===Ie)return L(u)[0]??null;let b=(B=h.find(A=>A.flowId===u))==null?void 0:B.lastStepId;return b?L(u).find(A=>A.id===b):null}function ie(u){let b=j(u);if(!b)return 0;let B=L(u).findIndex(A=>A.id===b.id)??0;return pe(u,b.id)===Ne&&B<L(u).length-1?B+1:B}function je(u){if(!u.completionCriteria)return;let b=br(u.completionCriteria);if(b===null)return;let B=pt(b),A=W(b);return A===0?void 0:B/A}function De(u){let b=h==null?void 0:h.find(B=>B.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(B=>B.flowId===u.slug);if(b)return b.shouldTrigger===!1}return!!(u!=null&&u.targetingLogic&&r&&r.startsWith("guest_"))}function Oo(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:X,updateCustomVariables:Q,customVariables:s,getStepOptionalProgress:je,getFlowMetadata:$,isStepBlocked:z,isStepHidden:D,hasActiveFullPageFlow:d,setHasActiveFullPageFlow:a,isFlowAvailableToUser:Oo}}import{useCallback as wr,useContext as cl,useEffect as ml}from"react";var kt="guest_";function Ht(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:n,shouldGracefullyDegrade:r}=cl(G),{config:i,apiUrl:s}=Me(),{mutateUserFlowState:p}=Be(),d=Tt(),{verifySDKInitiated:a}=Ft();ml(()=>{if(e&&!t){if(e.startsWith(kt))return;let f=`frigade-user-registered-${e}`;localStorage.getItem(f)||(d(`${s}users`,{...i,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(f,"true"))}},[e,r,t]);let x=wr(async f=>{a();let S={foreignId:e,properties:f};await d(`${s}users`,{...i,method:"POST",body:JSON.stringify(S)}),n(T=>({...T,...f})),p()},[e,i,r,p]),c=wr(async(f,S)=>{a();let P={foreignId:e,events:[{event:f,properties:S}]};await d(`${s}users`,{...i,method:"POST",body:JSON.stringify(P)}),p()},[e,i,p]);return{userId:e,setUserId:o,addPropertiesToUser:x,trackEventForUser:c}}import{v4 as Wa}from"uuid";import _e,{useEffect as $a,useState as Ma}from"react";import Le,{useEffect as Sl}from"react";import po from"styled-components";import ul from"react";import fl from"styled-components";var Tr="fr-",Vt="cfr-";function l(e,t){let o=`${Tr}${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+" "+Vt+e}return o}function k(e){if(!e.className||e.className.indexOf(Vt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(Tr)?"":`:not(${o.map(n=>`.${n}`).join(", ")})`}function $o(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=>`${$o(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Ce(...e){return e.filter(Boolean).join(" ")}function jt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var gl=fl.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -7,7 +7,7 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
7
7
|
left: 0;
|
|
8
8
|
bottom: 0;
|
|
9
9
|
right: 0;
|
|
10
|
-
${e=>
|
|
10
|
+
${e=>k(e)} {
|
|
11
11
|
background-color: rgba(0, 0, 0, 0.6);
|
|
12
12
|
z-index: 1400;
|
|
13
13
|
}
|
|
@@ -23,12 +23,12 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
23
23
|
opacity: 1;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
`,Fr=({onClose:e,appearance:t})=>
|
|
26
|
+
`,Fr=({onClose:e,appearance:t})=>ul.createElement(gl,{className:l("modalBackground",t),onClick:()=>e()});import Mo from"react";import hl from"styled-components";var xl=hl.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
|
-
`,ke=()=>Mo.createElement(
|
|
31
|
-
${e=>
|
|
30
|
+
`,ke=()=>Mo.createElement(xl,null,Mo.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 20 20"},Mo.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5 15L15 5M5 5l10 10"})));import{Portal as yl}from"react-portal";import $r from"react";import Uo from"react";function Cl({style:e,className:t}){return Uo.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"54",height:"14",fill:"none",viewBox:"0 0 54 14",style:e,className:t},Uo.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"}),Uo.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 kr=Cl;import _o from"styled-components";import et from"styled-components";var lo=et.div`
|
|
31
|
+
${e=>k(e)} {
|
|
32
32
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -45,7 +45,7 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
45
45
|
top: 12px;
|
|
46
46
|
right: 12px;
|
|
47
47
|
`,vr=et.img`
|
|
48
|
-
${e=>
|
|
48
|
+
${e=>k(e)} {
|
|
49
49
|
display: block;
|
|
50
50
|
width: 100%;
|
|
51
51
|
height: auto;
|
|
@@ -54,7 +54,7 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
54
54
|
margin-bottom: 16px;
|
|
55
55
|
}
|
|
56
56
|
`,Er=et.div`
|
|
57
|
-
${e=>
|
|
57
|
+
${e=>k(e)} {
|
|
58
58
|
display: block;
|
|
59
59
|
width: 100%;
|
|
60
60
|
height: auto;
|
|
@@ -78,14 +78,14 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
78
78
|
flex-shrink: 1;
|
|
79
79
|
gap: 8px;
|
|
80
80
|
height: 64px;
|
|
81
|
-
${e=>
|
|
81
|
+
${e=>k(e)} {
|
|
82
82
|
flex-direction: row;
|
|
83
83
|
justify-content: ${e=>e.showStepCount?"flex-end":"flex-start"};
|
|
84
84
|
align-content: center;
|
|
85
85
|
align-items: center;
|
|
86
86
|
}
|
|
87
87
|
`,Nr=et.p`
|
|
88
|
-
${e=>
|
|
88
|
+
${e=>k(e)} {
|
|
89
89
|
font-style: normal;
|
|
90
90
|
font-weight: 600;
|
|
91
91
|
font-size: 15px;
|
|
@@ -126,8 +126,8 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
126
126
|
font-size: 12px;
|
|
127
127
|
line-height: 18px;
|
|
128
128
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
129
|
-
`;function ao({appearance:e}){return $r.createElement(Dr,{className:l("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",$r.createElement(kr,null))}var
|
|
130
|
-
${e=>
|
|
129
|
+
`;function ao({appearance:e}){return $r.createElement(Dr,{className:l("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",$r.createElement(kr,null))}var bl=po.div`
|
|
130
|
+
${e=>k(e)} {
|
|
131
131
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
132
132
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
133
133
|
/* Mobile */
|
|
@@ -168,28 +168,28 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
168
168
|
opacity: 1;
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
`,
|
|
171
|
+
`,wl=po.div`
|
|
172
172
|
position: relative;
|
|
173
173
|
flex: 0 1 auto;
|
|
174
|
-
`,
|
|
174
|
+
`,Tl=po.div`
|
|
175
175
|
position: absolute;
|
|
176
176
|
top: 24px;
|
|
177
177
|
right: 24px;
|
|
178
178
|
cursor: pointer;
|
|
179
179
|
z-index: 1501;
|
|
180
|
-
${e=>
|
|
180
|
+
${e=>k(e)} {
|
|
181
181
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
182
182
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
183
183
|
}
|
|
184
|
-
`,
|
|
184
|
+
`,Fl=po.div`
|
|
185
185
|
overflow: scroll;
|
|
186
186
|
flex: 1 1;
|
|
187
187
|
display: flex;
|
|
188
188
|
::-webkit-scrollbar {
|
|
189
189
|
display: none;
|
|
190
190
|
}
|
|
191
|
-
`,tt=({onClose:e,visible:t,headerContent:o=null,style:n=null,children:r,appearance:i,dismissible:s=!0,showFrigadeBranding:p=!1})=>(
|
|
192
|
-
${e=>
|
|
191
|
+
`,tt=({onClose:e,visible:t,headerContent:o=null,style:n=null,children:r,appearance:i,dismissible:s=!0,showFrigadeBranding:p=!1})=>(Sl(()=>{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(yl,null,Le.createElement(Fr,{appearance:i,onClose:()=>{s&&e()}}),Le.createElement(bl,{appearance:i,className:l("modalContainer",i),styleOverrides:n},s&&Le.createElement(Tl,{className:l("modalClose",i),onClick:()=>e(),appearance:i},Le.createElement(ke,null)),o&&Le.createElement(wl,null,o),Le.createElement(Fl,null,r),p&&Le.createElement(Lr,{appearance:i,className:l("poweredByFrigadeRibbon",i)},Le.createElement(ao,{appearance:i})))):Le.createElement(Le.Fragment,null));import ot,{useEffect as kl}from"react";import co from"styled-components";import{Portal as Pl}from"react-portal";var vl=co.div`
|
|
192
|
+
${e=>k(e)} {
|
|
193
193
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
194
194
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
195
195
|
position: fixed;
|
|
@@ -206,27 +206,27 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
206
206
|
bottom: 0;
|
|
207
207
|
margin-right: 28px;
|
|
208
208
|
margin-bottom: 28px;
|
|
209
|
-
`,
|
|
209
|
+
`,El=co.div`
|
|
210
210
|
position: relative;
|
|
211
211
|
flex: 1;
|
|
212
|
-
`,
|
|
212
|
+
`,Bl=co.div`
|
|
213
213
|
position: absolute;
|
|
214
214
|
top: 24px;
|
|
215
215
|
right: 24px;
|
|
216
216
|
cursor: pointer;
|
|
217
217
|
z-index: 1501;
|
|
218
|
-
${e=>
|
|
218
|
+
${e=>k(e)} {
|
|
219
219
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
220
220
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
221
221
|
}
|
|
222
|
-
`,
|
|
222
|
+
`,Al=co.div`
|
|
223
223
|
overflow: scroll;
|
|
224
224
|
flex: 5;
|
|
225
225
|
::-webkit-scrollbar {
|
|
226
226
|
display: none;
|
|
227
227
|
}
|
|
228
|
-
`,Mr=({onClose:e,visible:t,headerContent:o=null,children:n,appearance:r})=>(
|
|
229
|
-
${e=>
|
|
228
|
+
`,Mr=({onClose:e,visible:t,headerContent:o=null,children:n,appearance:r})=>(kl(()=>{let i=s=>{s.key==="Escape"&&e()};return document.addEventListener("keydown",i),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",i)}},[e,t]),t?ot.createElement(Pl,null,ot.createElement(vl,{appearance:r,className:l("cornerModalContainer",r)},ot.createElement(Bl,{className:l("cornerModalClose",r),onClick:()=>e()},ot.createElement(ke,null)),o&&ot.createElement(El,null,o),ot.createElement(Al,null,n))):ot.createElement(ot.Fragment,null));import{useContext as Il}from"react";function te(){let{defaultAppearance:e}=Il(G);function t(o){let n=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign(n.styleOverrides??{},o.styleOverrides??{}),theme:Object.assign(n.theme,o.theme??{})}:n}return{mergeAppearanceWithDefault:t}}import it,{useContext as ta,useEffect as oa,useState as Yo}from"react";import ho from"styled-components";import fo,{useEffect as Nl,useState as Vr}from"react";import Ho from"styled-components";import mo from"styled-components";var Ur=mo.label`
|
|
229
|
+
${e=>k(e)} {
|
|
230
230
|
font-size: 14px;
|
|
231
231
|
line-height: 20px;
|
|
232
232
|
margin-bottom: 5px;
|
|
@@ -234,7 +234,7 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
234
234
|
}
|
|
235
235
|
display: flex;
|
|
236
236
|
`,_r=mo.label`
|
|
237
|
-
${e=>
|
|
237
|
+
${e=>k(e)} {
|
|
238
238
|
font-size: 12px;
|
|
239
239
|
line-height: 20px;
|
|
240
240
|
margin-bottom: 5px;
|
|
@@ -253,12 +253,12 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
253
253
|
align-items: flex-start;
|
|
254
254
|
justify-content: left;
|
|
255
255
|
margin-bottom: 10px;
|
|
256
|
-
`;import zo 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?zo.createElement(uo,null,t?zo.createElement(zr,{className:l("formLabelRequired",o),appearance:o},"*"):null,zo.createElement(Ur,{className:l("formLabel",o)},e)):null}import Wr from"react";function Pt({title:e,appearance:t}){return e?Wr.createElement(uo,null,Wr.createElement(_r,{className:l("formSubLabel",t)},e)):null}import{z as Wo}from"zod";function Hr(e,t){try{if(t){if(t.type=="number"){let o=Wo.number();if(t.props)for(let n of t.props)n.requirement=="min"?o=o.min(Number(n.value),n.message??"Value is too small"):n.requirement=="max"?o=o.max(Number(n.value),n.message??"Value is too large"):n.requirement=="positive"?o=o.positive(n.message??"Value must be positive"):n.requirement=="negative"&&(o=o.nonpositive(n.message??"Value must be negative"));o.parse(Number(e))}if(t.type=="string"){let o=Wo.string();if(t.props)for(let n of t.props)n.requirement=="min"?o=o.min(Number(n.value),n.message??"Value is too short"):n.requirement=="max"?o=o.max(Number(n.value),n.message??"Value is too long"):n.requirement=="regex"&&(o=o.regex(new RegExp(String(n.value)),n.message??"Value does not match requirements"));o.parse(e)}return}}catch(o){if(o instanceof Wo.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
|
|
256
|
+
`;import zo 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?zo.createElement(uo,null,t?zo.createElement(zr,{className:l("formLabelRequired",o),appearance:o},"*"):null,zo.createElement(Ur,{className:l("formLabel",o)},e)):null}import Wr from"react";function Pt({title:e,appearance:t}){return e?Wr.createElement(uo,null,Wr.createElement(_r,{className:l("formSubLabel",t)},e)):null}import{z as Wo}from"zod";function Hr(e,t){try{if(t){if(t.type=="number"){let o=Wo.number();if(t.props)for(let n of t.props)n.requirement=="min"?o=o.min(Number(n.value),n.message??"Value is too small"):n.requirement=="max"?o=o.max(Number(n.value),n.message??"Value is too large"):n.requirement=="positive"?o=o.positive(n.message??"Value must be positive"):n.requirement=="negative"&&(o=o.nonpositive(n.message??"Value must be negative"));o.parse(Number(e))}if(t.type=="string"){let o=Wo.string();if(t.props)for(let n of t.props)n.requirement=="min"?o=o.min(Number(n.value),n.message??"Value is too short"):n.requirement=="max"?o=o.max(Number(n.value),n.message??"Value is too long"):n.requirement=="regex"&&(o=o.regex(new RegExp(String(n.value)),n.message??"Value does not match requirements"));o.parse(e)}return}}catch(o){if(o instanceof Wo.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 Ll=Ho.div`
|
|
257
257
|
display: flex;
|
|
258
258
|
flex-direction: column;
|
|
259
259
|
width: 100%;
|
|
260
260
|
`,Vo=Ho.input`
|
|
261
|
-
${e=>
|
|
261
|
+
${e=>k(e)} {
|
|
262
262
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
263
263
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
264
264
|
font-size: 14px;
|
|
@@ -273,8 +273,8 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
273
273
|
box-sizing: border-box;
|
|
274
274
|
padding: 0 10px;
|
|
275
275
|
margin-bottom: 10px;
|
|
276
|
-
`,
|
|
277
|
-
${e=>
|
|
276
|
+
`,Ol=Ho.textarea`
|
|
277
|
+
${e=>k(e)} {
|
|
278
278
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
279
279
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
280
280
|
font-size: 14px;
|
|
@@ -289,14 +289,14 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
289
289
|
min-height: 70px;
|
|
290
290
|
box-sizing: border-box;
|
|
291
291
|
margin-bottom: 10px;
|
|
292
|
-
`;function jo({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:n,inputData:r}){let i=e,[s,p]=Vr((r==null?void 0:r.text)||""),[d,a]=Vr(!1),
|
|
292
|
+
`;function jo({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:n,inputData:r}){let i=e,[s,p]=Vr((r==null?void 0:r.text)||""),[d,a]=Vr(!1),x=Vo;Nl(()=>{s===""&&!d&&(a(!0),c(""))},[]);function c(S){if(p(S),o({text:S}),i.required===!0&&S.trim()===""){n([{id:i.id,message:`${i.title??"Field"} is required`}]);return}let T=Hr(S,i.validation);if(T){n([{id:i.id,message:T}]);return}n([])}i.multiline&&(x=Ol);function f(){var S;switch((S=i==null?void 0:i.validation)==null?void 0:S.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return fo.createElement(Ll,null,fo.createElement(rt,{title:i.title,required:i.required,appearance:t.appearance}),fo.createElement(x,{className:l("inputComponent",t.appearance),value:s,onChange:S=>{c(S.target.value)},appearance:t.appearance,placeholder:i.placeholder,type:f()}),fo.createElement(Pt,{title:i.subtitle,appearance:t.appearance}))}import Ue,{useEffect as jr,useState as Gr}from"react";import qr from"styled-components";var Go="",Dl=qr.div`
|
|
293
293
|
display: flex;
|
|
294
294
|
flex-direction: column;
|
|
295
295
|
width: 100%;
|
|
296
296
|
-webkit-appearance: none;
|
|
297
297
|
appearance: none;
|
|
298
|
-
|
|
299
|
-
${e=>
|
|
298
|
+
`,$l=qr.select`
|
|
299
|
+
${e=>k(e)} {
|
|
300
300
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
301
301
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
302
302
|
font-size: 14px;
|
|
@@ -316,16 +316,16 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
316
316
|
background-repeat: no-repeat;
|
|
317
317
|
background-size: 1.5em 1.5em;
|
|
318
318
|
-webkit-print-color-adjust: exact;
|
|
319
|
-
`;function Kr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n,setFormValidationErrors:r}){var
|
|
319
|
+
`;function Kr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n,setFormValidationErrors:r}){var x,c,f,S,T,P;let i=e,[s,p]=Gr(((x=n==null?void 0:n.choice)==null?void 0:x[0])||""),[d,a]=Gr(!1);return jr(()=>{var g,v,h,F;if(s===""&&!d){if(a(!0),i.requireSelection){p(Go);return}if(i.defaultValue&&((g=i.props.options)!=null&&g.find(I=>I.id===i.defaultValue))){let I=(v=i.props.options)==null?void 0:v.find(y=>y.id===i.defaultValue);p(I.id),o({choice:[I.id]})}else p(((h=i.props.options)==null?void 0:h[0].id)||""),o({choice:[((F=i.props.options)==null?void 0:F[0].id)||""]})}},[]),jr(()=>{i.requireSelection&&s===Go?r([{message:"Please select an option",id:i.id}]):r([])},[s]),Ue.createElement(Dl,null,Ue.createElement(rt,{title:i.title,required:!1,appearance:t.appearance}),Ue.createElement($l,{value:s,onChange:g=>{p(g.target.value),o({choice:[g.target.value]})},placeholder:i.placeholder,appearance:t.appearance,className:l("multipleChoiceSelect",t.appearance)},i.requireSelection&&Ue.createElement("option",{key:"null-value",value:Go,disabled:!0},i.placeholder??"Select an option"),(c=i.props.options)==null?void 0:c.map(g=>Ue.createElement("option",{key:g.id,value:g.id},g.title))),((S=(f=i.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=i.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(Vo,{type:"text",placeholder:"Enter your answer here",onChange:g=>{o({choice:[g.target.value]})},appearance:t.appearance})),Ue.createElement(Pt,{title:i.subtitle,appearance:t.appearance}))}import Kt,{useEffect as qo,useState as Jr}from"react";import Xr from"styled-components";import qt from"react";import Gt from"react";import{motion as Ml}from"framer-motion";var Yr=({color:e,percentage:t,size:o})=>{let n=o*.5-2,r=2*Math.PI*n,i=(1-t)*r,s={duration:.3,delay:0,ease:"easeIn"},p={hidden:{strokeDashoffset:r,transition:s},show:{strokeDashoffset:i,transition:s}};return Gt.createElement(Ml.circle,{r:n,cx:o*.5,cy:o*.5,fill:"transparent",stroke:i!==r?e:"",strokeWidth:"3px",strokeDasharray:r,strokeDashoffset:t?i:0,variants:p,transition:s,initial:"hidden",animate:"show"})},Ul=({fillColor:e,size:t,percentage:o,children:n,bgColor:r="#D9D9D9",className:i,style:s})=>Gt.createElement("svg",{style:s,className:i,width:t,height:t,overflow:"visible"},Gt.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},Gt.createElement(Yr,{color:r,size:t}),Gt.createElement(Yr,{color:e,percentage:o,size:t})),n),vt=Ul;import _l from"styled-components";var zl=({color:e="#FFFFFF"})=>qt.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),Wl={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},Hl={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},Vl={border:"1px solid #000000",color:"#FFFFFF"},jl={border:"1px solid #E6E6E6"},Gl={color:"#FFFFFF"},ql={border:"3px solid #D9D9D9"},Kl=e=>e==="square"?Wl:Hl,Yl=(e,t)=>e==="square"?t?Vl:jl:t?Gl:ql,Jl=_l.div`
|
|
320
320
|
${e=>Ge(e)}
|
|
321
|
-
`,Ke=({value:e,type:t="square",primaryColor:o="#000000",progress:n,appearance:r=qe,style:i,className:s})=>{let p=
|
|
321
|
+
`,Ke=({value:e,type:t="square",primaryColor:o="#000000",progress:n,appearance:r=qe,style:i,className:s})=>{let p=Kl(t),d=Yl(t,e);return e===!0?p={...p,...d,backgroundColor:o,borderColor:t==="square"?o:"none"}:p={...p,...d},e!==!0&&t==="round"&&n!==void 0&&n!==1?qt.createElement(vt,{fillColor:o,percentage:n,size:22}):qt.createElement(Jl,{styleOverrides:p,style:i,role:"checkbox",className:Ce(l("checkIconContainer",r),l(e?"checkIconContainerChecked":"checkIconContainerUnchecked",r),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&qt.createElement(zl,{color:"#FFFFFF"}))};var Xl=Xr.div`
|
|
322
322
|
display: flex;
|
|
323
323
|
flex-direction: column;
|
|
324
324
|
width: 100%;
|
|
325
325
|
-webkit-appearance: none;
|
|
326
326
|
appearance: none;
|
|
327
|
-
`,
|
|
328
|
-
${e=>
|
|
327
|
+
`,Ql=Xr.button`
|
|
328
|
+
${e=>k(e)} {
|
|
329
329
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
330
330
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
331
331
|
font-size: 14px;
|
|
@@ -349,8 +349,8 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
349
349
|
height: 60px;
|
|
350
350
|
padding: 0 18px;
|
|
351
351
|
margin-bottom: 10px;
|
|
352
|
-
`;function Qr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n,setFormValidationErrors:r}){var
|
|
353
|
-
${e=>
|
|
352
|
+
`;function Qr({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n,setFormValidationErrors:r}){var x;let i=e,[s,p]=Jr((n==null?void 0:n.choice)||[]),[d,a]=Jr(!1);return qo(()=>{s.length==0&&!d&&(a(!0),o({choice:[]}))},[]),qo(()=>{o({choice:s})},[s]),qo(()=>{i.required&&(s.length<i.props.minChoices||s.length>i.props.maxChoices)?r([{message:"",id:i.id}]):r([])},[s]),Kt.createElement(Xl,null,Kt.createElement(rt,{title:i.title,required:i.required,appearance:t.appearance}),(x=i.props.options)==null?void 0:x.map(c=>Kt.createElement(Ql,{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<i.props.maxChoices?p([...s,c.id]):s.length==1&&i.props.maxChoices==1&&p([c.id])}},c.title,Kt.createElement(Ke,{type:"round",primaryColor:t.appearance.theme.colorPrimary,value:s.includes(c.id),appearance:t.appearance}))),Kt.createElement(Pt,{title:i.subtitle,appearance:t.appearance}))}import go from"react";import Zr from"styled-components";import Zl from"dompurify";function me(e){return{__html:Zl.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var Rl=Zr.h1`
|
|
353
|
+
${e=>k(e)} {
|
|
354
354
|
font-style: normal;
|
|
355
355
|
font-weight: 600;
|
|
356
356
|
font-size: ${e=>e.size=="small"?"15px":"18px"};
|
|
@@ -360,33 +360,33 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
360
360
|
margin-bottom: 4px;
|
|
361
361
|
color: ${e=>e.appearance.theme.colorText};
|
|
362
362
|
}
|
|
363
|
-
`,
|
|
364
|
-
${e=>
|
|
363
|
+
`,ea=Zr.h2`
|
|
364
|
+
${e=>k(e)} {
|
|
365
365
|
font-style: normal;
|
|
366
366
|
font-weight: 400;
|
|
367
367
|
font-size: 15px;
|
|
368
368
|
line-height: 20px;
|
|
369
369
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
370
370
|
}
|
|
371
|
-
`;function Se({appearance:e,title:t,subtitle:o,size:n="medium",classPrefix:r=""}){return go.createElement(go.Fragment,null,go.createElement(
|
|
371
|
+
`;function Se({appearance:e,title:t,subtitle:o,size:n="medium",classPrefix:r=""}){return go.createElement(go.Fragment,null,go.createElement(Rl,{appearance:e,className:l(`${r}${r?jt(n):n}Title`,e),dangerouslySetInnerHTML:me(t),size:n}),o&&go.createElement(ea,{appearance:e,className:l(`${r}${r?jt(n):n}Subtitle`,e),dangerouslySetInnerHTML:me(o),size:n}))}import*as Ko from"react";var Rr=e=>Ko.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:12,height:12,"aria-hidden":"true",viewBox:"0 0 16 16",...e},Ko.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 ra,motion as ia}from"framer-motion";var na=ho.div`
|
|
372
372
|
display: flex;
|
|
373
373
|
flex-direction: column;
|
|
374
374
|
justify-content: flex-end;
|
|
375
375
|
padding-bottom: 14px;
|
|
376
376
|
overflow: visible;
|
|
377
|
-
`,
|
|
377
|
+
`,sa=ho(ia.div)`
|
|
378
378
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextError}};
|
|
379
379
|
font-size: 12px;
|
|
380
380
|
margin-bottom: 12px;
|
|
381
381
|
display: flex;
|
|
382
382
|
align-items: center;
|
|
383
|
-
`,
|
|
383
|
+
`,la=ho.div`
|
|
384
384
|
margin-right: 4px;
|
|
385
385
|
display: inline-flex;
|
|
386
|
-
`,
|
|
386
|
+
`,aa=ho.div`
|
|
387
387
|
padding-left: 1px;
|
|
388
388
|
padding-right: 1px;
|
|
389
|
-
`,
|
|
389
|
+
`,pa={text:jo,multipleChoice:Kr,multipleChoiceList:Qr};function ei({flowId:e,stepData:t,canContinue:o,setCanContinue:n,onSaveData:r,appearance:i,customFormElements:s}){var I;let p=t.props,[d,a]=Yo([]),[x,c]=Yo([]),{userId:f}=Ht(),[S,T]=Yo(h()||{}),{readonly:P}=ta(G),g={...pa,...s};oa(()=>{n(d.length===0)},[d,n]);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 h(){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(aa,{className:l("multiInput",i)},it.createElement(Se,{appearance:i,title:t.title,subtitle:t.subtitle}),it.createElement(na,{className:l("multiInputContainer",i)},(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",i)},g[y.type]({formInput:y,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:n,onSaveData:r,appearance:i},onSaveInputData:C=>{!x.includes(y.id)&&C&&(C==null?void 0:C.text)!==""&&c(E=>[...E,y.id]),v(y,C)},inputData:S[y.id],setFormValidationErrors:C=>{a(E=>C.length===0?E.filter(O=>O.id!==y.id):[...E,...C])}}),it.createElement(ra,null,m&&x.includes(y.id)&&it.createElement(sa,{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:i,className:l("multiInputValidationError",i)},it.createElement(la,{appearance:i,className:l("multiInputValidationErrorIcon",i)},it.createElement(Rr,null)),m))):null})))}import ut from"styled-components";var ti=ut.div`
|
|
390
390
|
align-items: center;
|
|
391
391
|
display: flex;
|
|
392
392
|
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
@@ -425,10 +425,10 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
425
425
|
background-position: center;
|
|
426
426
|
border-top-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
427
427
|
border-bottom-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
428
|
-
`;import nt from"react";import
|
|
428
|
+
`;import nt from"react";import da from"react";import ai from"styled-components";var ca=ai.button`
|
|
429
429
|
justify-content: center;
|
|
430
430
|
align-content: center;
|
|
431
|
-
${e=>
|
|
431
|
+
${e=>k(e)} {
|
|
432
432
|
display: flex;
|
|
433
433
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
434
434
|
width: ${e=>e.type==="full-width"?"100%":"auto"};
|
|
@@ -457,7 +457,7 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
457
457
|
cursor: not-allowed;
|
|
458
458
|
}
|
|
459
459
|
`,xo=ai.div`
|
|
460
|
-
${e=>
|
|
460
|
+
${e=>k(e)} {
|
|
461
461
|
display: flex;
|
|
462
462
|
flex-direction: row;
|
|
463
463
|
justify-content: flex-start;
|
|
@@ -466,14 +466,14 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
466
466
|
margin-right: 8px;
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
`,
|
|
469
|
+
`,ne=({onClick:e,title:t,style:o,disabled:n,type:r="inline",size:i="medium",secondary:s=!1,appearance:p,withMargin:d=!0,classPrefix:a=""})=>{function x(){let c=s?"buttonSecondary":"button";return a===""?c:`${a}${jt(c)}`}return da.createElement(ca,{secondary:s,appearance:p,disabled:n,onClick:e,styleOverrides:o,type:r,withMargin:d,size:i,className:l(x(),p)},t)};var pi=({step:e,canContinue:t,appearance:o,onPrimaryClick:n,onSecondaryClick:r,formType:i,selectedStep:s,steps:p,onBack:d,allowBackNavigation:a,errorMessage:x})=>{let c=i==="inline"?"inline":"full-width",f=p.length>1&&s!=0&&a;return nt.createElement(nt.Fragment,null,x&&nt.createElement(oi,{appearance:o,className:l("formCTAError",o)},x),nt.createElement(ti,{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(ri,{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:n,type:c,appearance:o}):null)))};import Jo from"react";import ma from"styled-components";var ua=ma.div`
|
|
470
470
|
text-align: center;
|
|
471
|
-
`,di=({stepCount:e=0,currentStep:t=0,className:o,appearance:n})=>{let{theme:r}=
|
|
471
|
+
`,di=({stepCount:e=0,currentStep:t=0,className:o,appearance:n})=>{let{theme:r}=te().mergeAppearanceWithDefault(n);return Jo.createElement(ua,{className:o},Jo.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((i,s)=>Jo.createElement("rect",{key:s,x:16*s,y:0,width:8,height:8,rx:4,fill:t===s?r.colorPrimary:"#E6E6E6"}))))};import ft from"react";import Et from"styled-components";import{useContext as fa}from"react";function le(){let e=fa(G);function t(r){n(r.primaryButtonUri,r.primaryButtonUriTarget)}function o(r){n(r.secondaryButtonUri,r.secondaryButtonUriTarget)}function n(r,i){if(!r)return;let s=r.startsWith("http")?"_blank":"_self";i&&i!=="_blank"&&(s="_self"),e.navigate(r,s)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:n}}var ga=Et.div`
|
|
472
472
|
display: flex;
|
|
473
473
|
flex-wrap: wrap;
|
|
474
474
|
align-content: center;
|
|
475
475
|
justify-content: center;
|
|
476
|
-
`,
|
|
476
|
+
`,ha=Et.div`
|
|
477
477
|
align-content: center;
|
|
478
478
|
align-items: center;
|
|
479
479
|
display: flex;
|
|
@@ -487,10 +487,10 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
487
487
|
flex-basis: 255px;
|
|
488
488
|
flex-grow: 0;
|
|
489
489
|
flex-shrink: 0;
|
|
490
|
-
`,
|
|
490
|
+
`,xa=Et.img`
|
|
491
491
|
width: 78px;
|
|
492
492
|
height: auto;
|
|
493
|
-
`,
|
|
493
|
+
`,Ca=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 Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
503
503
|
border-radius: 100px;
|
|
504
504
|
padding: 8px 12px;
|
|
505
505
|
margin-top: 16px;
|
|
506
|
-
`,
|
|
506
|
+
`,Sa=Et.h1`
|
|
507
507
|
font-weight: 700;
|
|
508
508
|
font-size: 28px;
|
|
509
509
|
line-height: 34px;
|
|
510
|
-
`,
|
|
510
|
+
`,ya=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 Wa,useEffect as To,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 n,r;let{handleUrl:o}=
|
|
519
|
+
`;function ci({stepData:e,appearance:t}){var n,r;let{handleUrl:o}=le();return ft.createElement("div",null,ft.createElement(Sa,null,e.title),ft.createElement(ya,null,e.subtitle),ft.createElement(ga,null,(r=(n=e.props)==null?void 0:n.links)==null?void 0:r.map(i=>ft.createElement(ha,{key:i.title},ft.createElement(xa,{src:i.imageUri}),ft.createElement(Ca,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{i.uri&&o(i.uri,i.uriTarget??"_blank")}},i.title)))))}import At,{useEffect as va}from"react";import yo from"styled-components";import Xo from"react";var Co=({style:e,className:t})=>Xo.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},Xo.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),Xo.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 Yt,{useRef as ba,useState as wa}from"react";import So from"styled-components";var Ta=So.div`
|
|
520
520
|
display: flex;
|
|
521
521
|
align-items: center;
|
|
522
522
|
justify-content: flex-start;
|
|
@@ -524,7 +524,7 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
524
524
|
width: 100%;
|
|
525
525
|
height: 100%;
|
|
526
526
|
position: relative;
|
|
527
|
-
`,
|
|
527
|
+
`,Fa=So.div`
|
|
528
528
|
position: absolute;
|
|
529
529
|
display: flex;
|
|
530
530
|
align-items: center;
|
|
@@ -543,41 +543,41 @@ import ht,{createContext as Wa,useEffect as To,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
|
+
`,ka=So.video`
|
|
547
547
|
width: 100%;
|
|
548
548
|
height: 100%;
|
|
549
549
|
min-height: 200px;
|
|
550
550
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
551
|
-
`,
|
|
551
|
+
`,Pa=So.iframe`
|
|
552
552
|
width: 100%;
|
|
553
553
|
height: 100%;
|
|
554
554
|
min-height: 200px;
|
|
555
555
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
556
|
-
`;function Bt({appearance:e,videoUri:t}){let o=
|
|
557
|
-
${e=>
|
|
556
|
+
`;function Bt({appearance:e,videoUri:t}){let o=ba(),[n,r]=wa(!1);if(t.includes("youtube")){let i=t.split("v=")[1],s=i.indexOf("&");return s!==-1&&(i=i.substring(0,s)),Yt.createElement(Pa,{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${i}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,appearance:e})}return Yt.createElement(Ta,{appearance:e},!n&&Yt.createElement(Fa,{onClick:()=>{r(!0),o.current.play()},appearance:e},Yt.createElement(Co,null)),Yt.createElement(ka,{appearance:e,controls:n,ref:o,play:n,src:t}))}var Ea=yo.div`
|
|
557
|
+
${e=>k(e)} {
|
|
558
558
|
display: flex;
|
|
559
559
|
flex-direction: column;
|
|
560
560
|
justify-content: center;
|
|
561
561
|
}
|
|
562
|
-
`,
|
|
563
|
-
${e=>
|
|
562
|
+
`,Ba=yo.img`
|
|
563
|
+
${e=>k(e)} {
|
|
564
564
|
width: 100%;
|
|
565
565
|
height: auto;
|
|
566
566
|
max-height: 250px;
|
|
567
567
|
margin-bottom: 24px;
|
|
568
568
|
}
|
|
569
|
-
`,
|
|
570
|
-
${e=>
|
|
569
|
+
`,Aa=yo.div`
|
|
570
|
+
${e=>k(e)} {
|
|
571
571
|
margin-bottom: 24px;
|
|
572
572
|
}
|
|
573
|
-
`,
|
|
574
|
-
${e=>
|
|
573
|
+
`,Ia=yo.div`
|
|
574
|
+
${e=>k(e)} {
|
|
575
575
|
width: 100%;
|
|
576
576
|
height: auto;
|
|
577
577
|
max-height: 250px;
|
|
578
578
|
margin-bottom: 24px;
|
|
579
579
|
}
|
|
580
|
-
`;function mi({stepData:e,appearance:t,setCanContinue:o}){return
|
|
580
|
+
`;function mi({stepData:e,appearance:t,setCanContinue:o}){return va(()=>{o(!0)},[]),At.createElement(Ea,{className:l("callToActionContainer",t)},At.createElement(Aa,{className:l("callToActionTextContainer",t)},At.createElement(Se,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&At.createElement(Ba,{className:l("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&At.createElement(Ia,{appearance:t,className:l("callToActionVideo",t)},At.createElement(Bt,{appearance:t,videoUri:e.videoUri})))}import Ye,{useEffect as Qo,useState as Zo}from"react";import st from"styled-components";var ui=st.div`
|
|
581
581
|
width: auto;
|
|
582
582
|
display: flex;
|
|
583
583
|
flex-direction: column;
|
|
@@ -630,8 +630,8 @@ import ht,{createContext as Wa,useEffect as To,useState as Ae}from"react";import
|
|
|
630
630
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
631
631
|
display: flex;
|
|
632
632
|
align-self: center;
|
|
633
|
-
`;var bi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:n})=>{let r=e.props,[i,s]=Zo([]),[p,d]=Zo(!1),[a,
|
|
634
|
-
${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map(([s,p])=>`${$o(s)}: ${p};`).join(" ")} }`).join(" ")}`;return Xt.createElement(o,{inlineStyles:t})}var wi=({flowId:e,customStepTypes:t={},type:o="inline",visible:n,setVisible:r,customVariables:i,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:a=!0,onStepCompletion:
|
|
633
|
+
`;var bi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:n})=>{let r=e.props,[i,s]=Zo([]),[p,d]=Zo(!1),[a,x]=Zo(e.id);return Qo(()=>{i.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),Qo(()=>{a!==e.id&&(x(e.id),s([]))},[e]),Qo(()=>{o({choice:i}),i.length>=r.minChoices?t(!0):t(!1)},[i]),Ye.createElement(ui,{className:l("selectListContainer",n)},Ye.createElement(fi,null,Ye.createElement(gi,{className:l("selectListTitle",n)},e.title),Ye.createElement(hi,{appearance:n,className:l("selectListSubtitle",n)},e.subtitle)),r.options.map((c,f)=>{let S=i.includes(c.id);return Ye.createElement(xi,{key:`select-item-${f}`,onClick:()=>{if(i.includes(c.id)){s(i.filter(T=>T!==c.id));return}i.length<r.maxChoices?s([...i,c.id]):i.length==1&&r.maxChoices==1&&s([c.id])},hideBottomBorder:f===r.options.length-1,className:l("selectListSelectItem",n)},Ye.createElement(Ci,{className:l("selectListItemImage",n)},c.imageUri&&Ye.createElement(Si,{src:c.imageUri,alt:`select-icon-${f}`}),Ye.createElement(yi,{appearance:n,className:l("selectListSelectItemText",n)},c.title)),Ye.createElement(Ke,{appearance:n,value:S,primaryColor:n.theme.colorPrimary}))}))};import ye,{useEffect as Ro,useState as Jt}from"react";import{AnimatePresence as Na,motion as La}from"framer-motion";var Oa=({children:e,id:t,shouldWrap:o=!1})=>ye.createElement(ye.Fragment,null,o?ye.createElement(Na,{initial:!1},ye.createElement(La.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),bo=({appearance:e,steps:t,selectedStep:o,customStepTypes:n,customVariables:r,onButtonClick:i,onStepCompletion:s,flowId:p,type:d,hideOnFlowCompletion:a,onComplete:x,setVisible:c,setShowModal:f,onDismiss:S,showPagination:T=!1,customFormElements:P,allowBackNavigation:g,validationHandler:v})=>{var z;let F={...{linkCollection:ci,multiInput:ei,callToAction:mi,selectList:bi},...n},{primaryCTAClickSideEffects:I,secondaryCTAClickSideEffects:y}=le(),[m,w]=Jt(!1),[C,E]=Jt({}),[O,M]=Jt(!1),[N,L]=Jt(!1),[H,$]=Jt(null),X=t[o]??null,{markStepCompleted:Q,markStepStarted:Y,isLoading:V,updateCustomVariables:ge,markFlowCompleted:oe}=ee();Ro(()=>{ge(r)},[r,V]),Ro(()=>{window&&g&&!N&&(window.location.hash=t[o].id,L(!0))},[g,N,L]),Ro(()=>{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)}},[(z=window==null?void 0:window.location)==null?void 0:z.hash,Y,o,t]);function q(){return{data:C[t[o].id]??{},stepId:t[o].id,customVariables:r}}function he(D,re,j){let ie=o+1<t.length?t[o+1]:null;return s&&s(D,j,ie,C,q()),i?i(D,o,re,ie):!0}function Te(D,re){E(j=>{let ie={};return ie[D.id]=re,{...j,...ie}})}function K(D){return D.selectedStep.imageUri?ye.createElement(li,{image:D.selectedStep.imageUri,appearance:e,className:l("formContainerSidebarImage",e)}):null}let pe=ye.createElement(pi,{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=he(t[o],"primary",o);o+1>=t.length&&(x&&x(),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:()=>{he(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(ii,{className:l("formContainer",e)},ye.createElement(ni,null,ye.createElement(Oa,{id:o,shouldWrap:d==="large-modal"},ye.createElement(si,{key:X.id,type:d,className:l("formContent",e)},t.map(D=>{let re=F[D.type];return X.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(di,{className:l("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),pe))),d=="large-modal"&&ye.createElement(K,{selectedStep:t[o]})))};import Xt from"react";import{createGlobalStyle as Da}from"styled-components";function se({appearance:e}){if(!e||!e.styleOverrides)return Xt.createElement(Xt.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([n,r])=>typeof r=="object");if(t.length===0)return Xt.createElement(Xt.Fragment,null);let o=Da`
|
|
634
|
+
${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map(([s,p])=>`${$o(s)}: ${p};`).join(" ")} }`).join(" ")}`;return Xt.createElement(o,{inlineStyles:t})}var wi=({flowId:e,customStepTypes:t={},type:o="inline",visible:n,setVisible:r,customVariables:i,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:a=!0,onStepCompletion:x,onButtonClick:c,dismissible:f=!0,endFlowOnDismiss:S=!1,modalPosition:T="center",repeatable:P=!1,onDismiss:g,showPagination:v=!1,allowBackNavigation:h=!1,validationHandler:F,showFrigadeBranding:I=!1})=>{let{getFlow:y,getFlowSteps:m,isLoading:w,targetingLogicShouldHideFlow:C,getFlowStatus:E,getCurrentStepIndex:O,markFlowCompleted:M,markFlowNotStarted:N}=ee(),L=O(e),{mergeAppearanceWithDefault:H}=te(),[$,X]=Ma(!1),{setOpenFlowState:Q,getOpenFlowState:Y,hasOpenModals:V}=Fe();d=H(d);let[ge,oe]=n!==void 0&&r!==void 0?[n,r]:[Y(e,!0),K=>Q(e,K)];if($a(()=>{!$&&!w&&(X(!0),E(e)===R&&P&&N(e),X(!0))},[$,X,w]),w)return null;let q=y(e);if(!q||C(q))return null;let he=m(e);if(!he||n!==void 0&&n===!1||E(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",_e.createElement(tt,{appearance:d,onClose:Te,visible:ge,style:K,dismissible:f,showFrigadeBranding:I},_e.createElement(se,{appearance:d}),_e.createElement(bo,{appearance:d,steps:he,selectedStep:L,customStepTypes:t,customVariables:i,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"?_e.createElement(Mr,{appearance:d,onClose:Te,visible:ge},_e.createElement(se,{appearance:d}),_e.createElement(bo,{appearance:d,steps:he,selectedStep:L,customStepTypes:t,customVariables:i,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})):_e.createElement(_e.Fragment,null,_e.createElement(se,{appearance:d}),_e.createElement(bo,{appearance:d,steps:he,selectedStep:L,customStepTypes:t,customVariables:i,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}))},Ti=wi;import{useCallback as Fi,useContext as Ua,useEffect as _a}from"react";function er(){let{organizationId:e,userId:t,setOrganizationId:o}=Ua(G),{mutateUserFlowState:n}=Be(),{config:r,apiUrl:i}=Me(),s=Tt(),{verifySDKInitiated:p}=Ft();_a(()=>{if(t&&e){if(t.startsWith(kt))return;let x=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(x)||(s(`${i}userGroups`,{...r,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(x,"true"))}},[t,e]);let d=Fi(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(`${i}userGroups`,{...r,method:"POST",body:JSON.stringify(c)}),n()},[e,t,r,n]),a=Fi(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 S={foreignUserId:t,foreignUserGroupId:e,events:[{event:x,properties:c}]};await s(`${i}userGroups`,{...r,method:"POST",body:JSON.stringify(S)}),n()},[e,t,r,n]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:d,trackEventForOrganization:a}}var ki="frigade-xFrigade_guestUserId",Qt="frigade-xFrigade_userId",Pi=({})=>{let{setFlowResponses:e}=Wt(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:n}=Be(),{userId:r,setUserId:i}=Ht(),[s,p]=tr(null),{getFlowStatus:d}=ee(),{flows:a,userProperties:x,setIsNewGuestUser:c,flowResponses:f}=za(G),[S,T]=tr([]),[P,g]=tr([]),{organizationId:v}=er();wo(()=>{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(()=>{h(m.flowId)},500);break}}},[o,t]),wo(()=>{f.length>0&&n()},[f]);function h(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(Qt);if(y){i(y);return}let m=localStorage.getItem(ki);if(m){i(m);return}c(!0);let w=kt+Wa();try{localStorage.setItem(ki,w)}catch(C){console.log("Failed to save guest user id locally: Local storage unavailable",C)}i(C=>C||w)}}wo(()=>{try{if(a){let y=[];a.forEach(m=>{if(m.data){let w=m.data.match(/"imageUri":"(.*?)"/g);w&&w.forEach(C=>{let E=C.replace('"imageUri":"',"").replace('"',"");if(y.includes(E))return;let O=new Image;O.src=E,y.push(E)})}})}}catch{}},[a]),wo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(kt))try{localStorage.setItem(Qt,r)}catch(y){console.log("Failed to save user id locally: Local storage available",y)}r===null&&setTimeout(()=>{r===null&&F()},50)},[r,a,x]);function I(){return gt.createElement(gt.Fragment,null,S.map(y=>d(y.slug)!==Ie?null:gt.createElement("span",{key:y.slug},gt.createElement(Ti,{flowId:y.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return gt.createElement(gt.Fragment,null,gt.createElement(I,null))};import{ErrorBoundary as ja}from"react-error-boundary";var vi="https://api.frigade.com",G=Ha({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:vi,readonly:!1});function Ga(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var qa=({publicApiKey:e,userId:t,organizationId:o,config:n,children:r})=>{var Q,Y;let[i,s]=Ae(t||null),[p,d]=Ae(o||null),[a,x]=Ae([]),[c,f]=Ae([]),[S,T]=Ae([]),[P,g]=Ae({}),[v,h]=Ae({}),[F,I]=Ae([]),[y,m]=Ae({}),[w,C]=Ae(!1),[E,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=n==null?void 0:n.defaultAppearance)==null?void 0:Q.theme)??{}},styleOverrides:{...qe.styleOverrides,...((Y=n==null?void 0:n.defaultAppearance)==null?void 0:Y.styleOverrides)??{}}};function $(V){return!!(V&&V.length>10&&V.substring(0,10)==="api_public")}To(()=>{t&&s(t)},[t]),To(()=>{i&&window&&window.localStorage&&window.localStorage.getItem(Qt)&&window.localStorage.getItem(Qt)!==i&&Ga()},[i]),To(()=>{o&&d(o)},[o]),To(()=>{if($(e))N(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),N(!0);return}},[e,N]);let X={publicApiKey:e,userId:i,setUserId:s,setFlows:x,flows:a,failedFlowResponses:c,setFailedFlowResponses:f,flowResponses:S,setFlowResponses:T,userProperties:P,setUserProperties:g,openFlowStates:v,setOpenFlowStates:h,completedFlowsToKeepOpenDuringSession:F,setCompletedFlowsToKeepOpenDuringSession:I,customVariables:y,setCustomVariables:m,isNewGuestUser:w,setIsNewGuestUser:C,hasActiveFullPageFlow:E,setHasActiveFullPageFlow:O,organizationId:p,setOrganizationId:d,navigate:n&&n.navigate?n.navigate:L,defaultAppearance:H,shouldGracefullyDegrade:M,setShouldGracefullyDegrade:N,apiUrl:n&&n.apiUrl?n.apiUrl:vi,readonly:n&&n.readonly?n.readonly:!1};return M?ht.createElement(G.Provider,{value:X},r):ht.createElement(ja,{fallback:ht.createElement(ht.Fragment,null,r)},ht.createElement(G.Provider,{value:X},ht.createElement(Va,{theme:H.theme},r,ht.createElement(Pi,null))))};import Vp from"react";import ce,{useEffect as is,useState as ns}from"react";import Oe,{useState as fp}from"react";import St from"styled-components";import Po from"react";import xt from"react";import Bi from"styled-components";var Ei=Bi.span`
|
|
635
635
|
font-weight: 400;
|
|
636
636
|
font-size: 15px;
|
|
637
637
|
line-height: 20px;
|
|
@@ -640,7 +640,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
640
640
|
vertical-align: middle;
|
|
641
641
|
margin-left: 12px;
|
|
642
642
|
padding-right: 12px;
|
|
643
|
-
`,
|
|
643
|
+
`,Ka=Bi.div`
|
|
644
644
|
flex-direction: row;
|
|
645
645
|
justify-content: space-between;
|
|
646
646
|
display: flex;
|
|
@@ -648,7 +648,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
648
648
|
padding-bottom: 20px;
|
|
649
649
|
border-top: 1px solid ${e=>e.theme.colorBorder};
|
|
650
650
|
width: 100%;
|
|
651
|
-
`,Fo=({label:e,value:t,labelStyle:o={},labelPosition:n="right",style:r,primaryColor:i="#000000",checkBoxType:s="square",appearance:p})=>xt.createElement(xt.Fragment,null,xt.createElement(
|
|
651
|
+
`,Fo=({label:e,value:t,labelStyle:o={},labelPosition:n="right",style:r,primaryColor:i="#000000",checkBoxType:s="square",appearance:p})=>xt.createElement(xt.Fragment,null,xt.createElement(Ka,{className:l("checklistStepsContainer",p),appearance:p,style:{...r}},n==="left"&&e&&xt.createElement(Ei,{className:l("checklistStepLabel",p),style:o},e),xt.createElement(Ke,{appearance:p,value:t,type:s,primaryColor:i}),n==="right"&&e&&xt.createElement(Ei,{className:l("checklistStepLabel",p),style:o},e)),xt.createElement(se,{appearance:p}));import{motion as Ya}from"framer-motion";import Zt from"styled-components";var Ai=Zt.div`
|
|
652
652
|
font-weight: 700;
|
|
653
653
|
font-size: 18px;
|
|
654
654
|
line-height: 22px;
|
|
@@ -676,18 +676,18 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
676
676
|
`,Li=Zt.div`
|
|
677
677
|
flex-direction: row;
|
|
678
678
|
justify-content: flex-start;
|
|
679
|
-
`;var Oi=({data:e,index:t,isSelected:o,primaryColor:n,style:r,onClick:i,appearance:s})=>{var p,d;return Po.createElement("div",{style:{position:"relative",paddingLeft:"20px"},onClick:()=>{i()}},o&&Po.createElement(ko,{className:l("checklistStepItemSelectedIndicator",s),as:
|
|
679
|
+
`;var Oi=({data:e,index:t,isSelected:o,primaryColor:n,style:r,onClick:i,appearance:s})=>{var p,d;return Po.createElement("div",{style:{position:"relative",paddingLeft:"20px"},onClick:()=>{i()}},o&&Po.createElement(ko,{className:l("checklistStepItemSelectedIndicator",s),as:Ya.div,layoutId:"checklis-step-selected",style:{backgroundColor:((p=s==null?void 0:s.theme)==null?void 0:p.colorPrimary)??n}}),Po.createElement(Li,{className:l("checklistStepItem",s),key:`hero-checklist-step-${t}`,role:"listitem"},Po.createElement(Fo,{value:e.complete,labelPosition:"left",label:e.stepName,style:r,primaryColor:((d=s==null?void 0:s.theme)==null?void 0:d.colorPrimary)??n,appearance:s})))};import Ct from"react";import{motion as Ja}from"framer-motion";import or from"styled-components";var Xa={backgroundColor:"#E6E6E6"},Qa=or.div`
|
|
680
680
|
display: flex;
|
|
681
681
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
682
682
|
justify-content: flex-start;
|
|
683
683
|
align-items: ${e=>e.textLocation=="top"?"flex-end":"center"};
|
|
684
684
|
|
|
685
685
|
${e=>Ge(e)}
|
|
686
|
-
`,
|
|
686
|
+
`,Za=or.div`
|
|
687
687
|
flex-grow: 1;
|
|
688
688
|
position: relative;
|
|
689
689
|
${e=>e.textLocation=="top"?"width: 100%;":""}
|
|
690
|
-
`,
|
|
690
|
+
`,Ra=or.span`
|
|
691
691
|
font-weight: 500;
|
|
692
692
|
font-size: 15px;
|
|
693
693
|
line-height: 18px;
|
|
@@ -695,13 +695,13 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
695
695
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
696
696
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
697
697
|
${e=>Ge(e)}
|
|
698
|
-
`,
|
|
698
|
+
`,ep={position:"relative",left:0,top:0,width:"100%",minWidth:"40px",height:"10px",borderRadius:"20px"},tp={position:"absolute",left:0,top:0,height:"10px",borderRadius:"20px"},ze=({count:e,total:t,fillColor:o,bgColor:n=Xa.backgroundColor,display:r="count",textLocation:i="left",style:s={},textStyle:p={},appearance:d})=>{var T,P;if(t===0)return Ct.createElement(Ct.Fragment,null);let a=e===0?"10px":`${e/t*100}%`,x=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`),i==="top"&&(f="0px"),Ct.createElement(Qa,{className:l("progressBarContainer",d),textLocation:i,styleOverrides:s},Ct.createElement(Ra,{className:l("progressBarStepText",d),style:{...p,fontSize:r==="compact"?12:15,fontWeight:r==="compact"?400:500},appearance:d,padding:f,textLocation:i},S),Ct.createElement(Za,{textLocation:i,className:l("progressBar",d)},Ct.createElement(Ja.div,{style:{...tp,width:a,height:x,backgroundColor:((T=d==null?void 0:d.theme)==null?void 0:T.colorPrimary)??o,zIndex:r=="compact"?1:5},className:l("progressBarFill",d)}),Ct.createElement("div",{className:l("progressBarBackground",d),style:{...ep,height:x,backgroundColor:((P=d==null?void 0:d.theme)==null?void 0:P.colorSecondary)??n}})))};import Rt from"react";import op from"styled-components";import Eo from"react";import vo from"react";var It=({stepData:e,appearance:t})=>vo.createElement(vo.Fragment,null,vo.createElement(Ii,{appearance:t,className:l("checklistStepTitle",t),dangerouslySetInnerHTML:me(e.title)}),vo.createElement(Ni,{appearance:t,className:l("checklistStepSubtitle",t),dangerouslySetInnerHTML:me(e.subtitle)}));import rr from"react";var Nt=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},n=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return rr.createElement(xo,{className:l("ctaContainer",t)},e.secondaryButtonTitle&&rr.createElement(ne,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:n,style:{width:"auto",marginRight:"12px"}}),rr.createElement(ne,{appearance:t,title:e.primaryButtonTitle,onClick:o}))};var Lt=({stepData:e,appearance:t})=>Eo.createElement(Eo.Fragment,null,Eo.createElement(It,{stepData:e,appearance:t}),Eo.createElement(Nt,{stepData:e,appearance:t}));import Di from"react";function $i(e){if(e.videoUri.includes("youtube")){let t=e.videoUri.split("v=")[1],o=t.indexOf("&");return o!==-1&&(t=t.substring(0,o)),Di.createElement("iframe",{width:"480",height:"260",src:`https://www.youtube.com/embed/${t}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:l("checklistStepVideo",e.appearance)})}else return Di.createElement("video",{width:"480",height:"260",controls:!0,src:e.videoUri})}var ir="default",rp=op.img`
|
|
699
699
|
border-radius: 4px;
|
|
700
700
|
max-height: 260px;
|
|
701
701
|
min-height: 200px;
|
|
702
|
-
`,Mi=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return Rt.createElement("div",null,o)}return Rt.createElement(Ai,{className:l("checklistStepContent",t)},e.imageUri?Rt.createElement(
|
|
702
|
+
`,Mi=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return Rt.createElement("div",null,o)}return Rt.createElement(Ai,{className:l("checklistStepContent",t)},e.imageUri?Rt.createElement(rp,{className:l("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Rt.createElement($i,{videoUri:e.videoUri,appearance:t}):null,Rt.createElement(Lt,{stepData:e,appearance:t}))};import Pe,{useRef as ip,useState as np}from"react";import Ot from"styled-components";var Ui=Ot.div`
|
|
703
703
|
display: block;
|
|
704
|
-
`,
|
|
704
|
+
`,sp=Ot.div`
|
|
705
705
|
display: flex;
|
|
706
706
|
flex-direction: row;
|
|
707
707
|
flex-wrap: wrap;
|
|
@@ -711,20 +711,20 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
711
711
|
align-content: center;
|
|
712
712
|
margin-top: 24px;
|
|
713
713
|
margin-bottom: 24px;
|
|
714
|
-
`,
|
|
714
|
+
`,lp=Ot.div`
|
|
715
715
|
display: flex;
|
|
716
716
|
align-items: center;
|
|
717
717
|
justify-content: flex-start;
|
|
718
718
|
flex-direction: column;
|
|
719
719
|
margin-right: 16px;
|
|
720
|
-
`,
|
|
720
|
+
`,ap=Ot.video`
|
|
721
721
|
width: 200px;
|
|
722
722
|
height: 120px;
|
|
723
|
-
`,
|
|
723
|
+
`,pp=Ot.div`
|
|
724
724
|
font-size: 14px;
|
|
725
725
|
line-height: 20px;
|
|
726
726
|
text-align: center;
|
|
727
|
-
`,
|
|
727
|
+
`,dp=Ot.div`
|
|
728
728
|
position: absolute;
|
|
729
729
|
width: 200px;
|
|
730
730
|
height: 120px;
|
|
@@ -744,9 +744,9 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
744
744
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
745
745
|
border-radius: 50%;
|
|
746
746
|
}
|
|
747
|
-
`,_i="videoCarousel",zi=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return Pe.createElement(Ui,null,Pe.createElement(Lt,{stepData:e,appearance:t}));function o({video:i}){let s=
|
|
747
|
+
`,_i="videoCarousel",zi=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return Pe.createElement(Ui,null,Pe.createElement(Lt,{stepData:e,appearance:t}));function o({video:i}){let s=ip(),[p,d]=np(!1);return Pe.createElement(lp,null,!p&&Pe.createElement(dp,{onClick:()=>{d(!0),s.current.play()},appearance:t},Pe.createElement(Co,null)),Pe.createElement(ap,{controls:p,ref:s,play:p,src:i.uri}),Pe.createElement(pp,null,i.title))}let n=e.props;return n.videos?Pe.createElement(Ui,null,Pe.createElement(It,{stepData:e,appearance:t}),Pe.createElement(sp,null,n.videos.map((i,s)=>Pe.createElement("span",{key:`${i.uri}-${s}`},Pe.createElement(o,{video:i})))),Pe.createElement(Nt,{stepData:e,appearance:t})):null};import Je from"react";import Bo from"styled-components";var Wi=Bo.div`
|
|
748
748
|
display: block;
|
|
749
|
-
`,
|
|
749
|
+
`,cp=Bo.pre`
|
|
750
750
|
display: block;
|
|
751
751
|
background-color: #2a2a2a;
|
|
752
752
|
color: #f8f8f8;
|
|
@@ -762,69 +762,69 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
762
762
|
white-space: -o-pre-wrap; /* Opera 7 */
|
|
763
763
|
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
|
764
764
|
margin-bottom: 24px;
|
|
765
|
-
`,
|
|
765
|
+
`,mp=Bo.div`
|
|
766
766
|
font-size: 15px;
|
|
767
767
|
line-height: 20px;
|
|
768
768
|
margin-bottom: 12px;
|
|
769
769
|
margin-top: 12px;
|
|
770
|
-
`,
|
|
770
|
+
`,up=Bo.div`
|
|
771
771
|
margin-top: 24px;
|
|
772
|
-
`,Hi="codeSnippet",Vi=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.codeSnippets))return Je.createElement(Wi,null,Je.createElement(Lt,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?Je.createElement(Wi,null,Je.createElement(It,{stepData:e,appearance:t}),Je.createElement(
|
|
772
|
+
`,Hi="codeSnippet",Vi=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.codeSnippets))return Je.createElement(Wi,null,Je.createElement(Lt,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?Je.createElement(Wi,null,Je.createElement(It,{stepData:e,appearance:t}),Je.createElement(up,null,o.codeSnippets.map((r,i)=>Je.createElement("div",{key:i},r.title?Je.createElement(mp,null,r.title):null,r.code?Je.createElement(cp,null,r.code):null))),Je.createElement(Nt,{stepData:e,appearance:t})):null};var gp=St.div`
|
|
773
773
|
display: flex;
|
|
774
774
|
flex-direction: row;
|
|
775
775
|
min-width: ${e=>e.type!="modal"?"1000px":"100%"};
|
|
776
776
|
background: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
777
777
|
box-shadow: ${e=>e.type!="modal"?"0px 6px 25px rgba(0, 0, 0, 0.06)":"none"};
|
|
778
778
|
border-radius: 8px;
|
|
779
|
-
`,
|
|
779
|
+
`,hp=St.h1`
|
|
780
780
|
font-size: 24px;
|
|
781
781
|
font-weight: 600;
|
|
782
782
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
783
|
-
`,
|
|
783
|
+
`,xp=St.h2`
|
|
784
784
|
font-size: 15px;
|
|
785
785
|
line-height: 20px;
|
|
786
786
|
color: ${e=>{var t,o;return((o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary)??"#4d4d4d"}};
|
|
787
787
|
margin: 10px 0px 0px 0px;
|
|
788
788
|
`,ji=St.div`
|
|
789
789
|
padding-bottom: 16px;
|
|
790
|
-
`,
|
|
790
|
+
`,Cp=St.div`
|
|
791
791
|
list-style: none;
|
|
792
792
|
padding: 0;
|
|
793
793
|
margin: 0;
|
|
794
794
|
cursor: pointer;
|
|
795
795
|
width: 300px;
|
|
796
|
-
`,
|
|
796
|
+
`,Sp=St.div`
|
|
797
797
|
width: 1px;
|
|
798
798
|
margin: 40px;
|
|
799
799
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
800
|
-
`,
|
|
800
|
+
`,yp=St.div`
|
|
801
801
|
flex: 2;
|
|
802
802
|
padding: 2rem;
|
|
803
|
-
`,
|
|
803
|
+
`,bp=({title:e,subtitle:t,steps:o=[],style:n={},selectedStep:r,setSelectedStep:i,className:s="",customStepTypes:p=new Map,appearance:d,type:a})=>{let{mergeAppearanceWithDefault:x}=te();d=x(d);let f={...{[ir]:Mi,[_i]:zi,[Hi]:Vi},...p},[S,T]=fp(0),P=r??S,g=i??T,v=o.filter(F=>F.complete===!0).length,h=()=>{var F;return!((F=o[P])!=null&&F.type)||!f[o[P].type]?f[ir]({stepData:o[P],appearance:d}):f[o[P].type]({stepData:o[P],appearance:d})};return Oe.createElement(gp,{type:a,style:n,className:s,appearance:d},Oe.createElement(ji,{style:{flex:1}},Oe.createElement(ji,{style:{padding:"30px 0px 30px 30px",borderBottom:"none"}},Oe.createElement(hp,{className:l("checklistTitle",d),appearance:d},e),Oe.createElement(xp,{className:l("checklistSubtitle",d),appearance:d},t),Oe.createElement(ze,{total:o.length,count:v,fillColor:d.theme.colorPrimary,style:{marginTop:"24px"},appearance:d})),Oe.createElement(Cp,{className:l("checklistStepsContainer",d)},o.map((F,I)=>Oe.createElement(Oi,{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(Sp,{appearance:d,className:l("checklistDivider",d)}),Oe.createElement(yp,null,Oe.createElement(h,null)))},nr=bp;import _,{useState as vp}from"react";import Gi from"react";import wp from"styled-components";var Tp=wp.svg`
|
|
804
804
|
transition: 'transform 0.35s ease-in-out';
|
|
805
|
-
`,Dt=({color:e="#323232",style:t,className:o})=>Gi.createElement(
|
|
805
|
+
`,Dt=({color:e="#323232",style:t,className:o})=>Gi.createElement(Tp,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:t,className:o},Gi.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import{motion as Ep}from"framer-motion";import ue from"styled-components";var sr={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},qi=ue.div`
|
|
806
806
|
max-height: 350px;
|
|
807
807
|
padding-bottom: 40px;
|
|
808
|
-
`,Ki=
|
|
808
|
+
`,Ki=ue.div`
|
|
809
809
|
display: flex;
|
|
810
810
|
flex-direction: column;
|
|
811
811
|
margin-top: 20px;
|
|
812
|
-
`,Yi=
|
|
812
|
+
`,Yi=ue.h1`
|
|
813
813
|
font-style: normal;
|
|
814
814
|
font-weight: 600;
|
|
815
815
|
font-size: 30px;
|
|
816
816
|
line-height: 36px;
|
|
817
817
|
margin-bottom: 16px;
|
|
818
818
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
819
|
-
`,Ji=
|
|
819
|
+
`,Ji=ue.h2`
|
|
820
820
|
font-weight: 400;
|
|
821
821
|
font-size: 16px;
|
|
822
822
|
line-height: 20px;
|
|
823
823
|
margin-bottom: 16px;
|
|
824
824
|
padding-left: 1px;
|
|
825
825
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
826
|
-
`,Xi=
|
|
827
|
-
${e=>
|
|
826
|
+
`,Xi=ue.div`
|
|
827
|
+
${e=>k(e)} {
|
|
828
828
|
border: 1px solid #fafafa;
|
|
829
829
|
}
|
|
830
830
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
@@ -833,12 +833,12 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
833
833
|
flex-direction: column;
|
|
834
834
|
min-height: 240px;
|
|
835
835
|
overflow: hidden;
|
|
836
|
-
`,Qi=
|
|
836
|
+
`,Qi=ue.div`
|
|
837
837
|
display: flex;
|
|
838
838
|
flex-direction: row;
|
|
839
839
|
justify-content: space-between;
|
|
840
|
-
`,Zi=
|
|
841
|
-
${e=>
|
|
840
|
+
`,Zi=ue.p`
|
|
841
|
+
${e=>k(e)} {
|
|
842
842
|
font-weight: 400;
|
|
843
843
|
font-size: 10px;
|
|
844
844
|
line-height: 12px;
|
|
@@ -846,13 +846,13 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
846
846
|
color: #8c8c8c;
|
|
847
847
|
margin: 20px;
|
|
848
848
|
}
|
|
849
|
-
`,Ri=
|
|
849
|
+
`,Ri=ue.div`
|
|
850
850
|
display: flex;
|
|
851
851
|
flex-direction: row;
|
|
852
|
-
`,en=
|
|
852
|
+
`,en=ue.div`
|
|
853
853
|
flex: 1;
|
|
854
|
-
`,tn=
|
|
855
|
-
${e=>
|
|
854
|
+
`,tn=ue.div`
|
|
855
|
+
${e=>k(e)} {
|
|
856
856
|
display: flex;
|
|
857
857
|
justify-content: center;
|
|
858
858
|
align-content: center;
|
|
@@ -861,8 +861,8 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
861
861
|
padding-left: 8px;
|
|
862
862
|
padding-right: 8px;
|
|
863
863
|
}
|
|
864
|
-
`,on=
|
|
865
|
-
${e=>
|
|
864
|
+
`,on=ue.p`
|
|
865
|
+
${e=>k(e)} {
|
|
866
866
|
font-style: normal;
|
|
867
867
|
font-weight: 600;
|
|
868
868
|
font-size: 22px;
|
|
@@ -873,8 +873,8 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
873
873
|
margin-top: 20px;
|
|
874
874
|
margin-bottom: 16px;
|
|
875
875
|
}
|
|
876
|
-
`,rn=
|
|
877
|
-
${e=>
|
|
876
|
+
`,rn=ue.p`
|
|
877
|
+
${e=>k(e)} {
|
|
878
878
|
font-weight: 400;
|
|
879
879
|
font-size: 14px;
|
|
880
880
|
line-height: 18px;
|
|
@@ -882,15 +882,15 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
882
882
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
883
883
|
margin-bottom: 8px;
|
|
884
884
|
}
|
|
885
|
-
`,nn=
|
|
886
|
-
${e=>
|
|
885
|
+
`,nn=ue.div`
|
|
886
|
+
${e=>k(e)} {
|
|
887
887
|
display: flex;
|
|
888
888
|
flex-direction: row;
|
|
889
889
|
justify-content: center;
|
|
890
890
|
gap: 8px;
|
|
891
891
|
}
|
|
892
|
-
`,sn=
|
|
893
|
-
${e=>
|
|
892
|
+
`,sn=ue.div`
|
|
893
|
+
${e=>k(e)} {
|
|
894
894
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
895
895
|
background-color: ${e=>e.selected?"#FAFAFA":"#FFFFFF"};
|
|
896
896
|
:hover {
|
|
@@ -909,8 +909,8 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
909
909
|
justify-content: space-between;
|
|
910
910
|
position: relative;
|
|
911
911
|
cursor: pointer;
|
|
912
|
-
`,ln=
|
|
913
|
-
${e=>
|
|
912
|
+
`,ln=ue.p`
|
|
913
|
+
${e=>k(e)} {
|
|
914
914
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
915
915
|
color: ${e=>e.selected?"#434343":"#BFBFBF"};
|
|
916
916
|
}
|
|
@@ -918,12 +918,12 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
918
918
|
font-size: 14px;
|
|
919
919
|
line-height: 22px;
|
|
920
920
|
margin: 0;
|
|
921
|
-
`,an=
|
|
921
|
+
`,an=ue.div`
|
|
922
922
|
display: flex;
|
|
923
923
|
flex-direction: row;
|
|
924
924
|
justify-content: flex-end;
|
|
925
925
|
align-content: center;
|
|
926
|
-
`,pn=
|
|
926
|
+
`,pn=ue.div`
|
|
927
927
|
display: flex;
|
|
928
928
|
flex: 1;
|
|
929
929
|
flex-direction: row;
|
|
@@ -931,14 +931,14 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
931
931
|
align-content: center;
|
|
932
932
|
align-items: center;
|
|
933
933
|
margin-right: 20px;
|
|
934
|
-
`,dn=
|
|
934
|
+
`,dn=ue.div`
|
|
935
935
|
display: block;
|
|
936
936
|
width: 100%;
|
|
937
|
-
`;import
|
|
937
|
+
`;import Fp from"styled-components";var cn=Fp.div`
|
|
938
938
|
flex-direction: column;
|
|
939
939
|
justify-content: center;
|
|
940
940
|
display: flex;
|
|
941
|
-
`;import Qe from"react";import{motion as
|
|
941
|
+
`;import Qe from"react";import{motion as kp}from"framer-motion";import Xe from"styled-components";var mn=Xe.div`
|
|
942
942
|
border: 1px solid #fafafa;
|
|
943
943
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
944
944
|
border-radius: 14px;
|
|
@@ -953,7 +953,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
953
953
|
overflow: hidden;
|
|
954
954
|
row-gap: 10px;
|
|
955
955
|
`,fn=Xe.div`
|
|
956
|
-
${e=>
|
|
956
|
+
${e=>k(e)} {
|
|
957
957
|
color: #595959;
|
|
958
958
|
}
|
|
959
959
|
text-transform: uppercase;
|
|
@@ -963,7 +963,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
963
963
|
letter-spacing: 0.09em;
|
|
964
964
|
margin-bottom: 12px;
|
|
965
965
|
`,gn=Xe.div`
|
|
966
|
-
${e=>
|
|
966
|
+
${e=>k(e)} {
|
|
967
967
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
968
968
|
background: #ffffff;
|
|
969
969
|
border: 1px solid #fafafa;
|
|
@@ -976,7 +976,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
976
976
|
max-width: 150px;
|
|
977
977
|
min-width: 200px;
|
|
978
978
|
`,hn=Xe.div`
|
|
979
|
-
${e=>
|
|
979
|
+
${e=>k(e)} {
|
|
980
980
|
background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);
|
|
981
981
|
}
|
|
982
982
|
width: 40px;
|
|
@@ -994,7 +994,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
994
994
|
width: 20px;
|
|
995
995
|
height: 20px;
|
|
996
996
|
`,Cn=Xe.div`
|
|
997
|
-
${e=>
|
|
997
|
+
${e=>k(e)} {
|
|
998
998
|
color: #434343;
|
|
999
999
|
}
|
|
1000
1000
|
font-weight: 600;
|
|
@@ -1003,7 +1003,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1003
1003
|
margin-top: 12px;
|
|
1004
1004
|
margin-bottom: 8px;
|
|
1005
1005
|
`,Sn=Xe.div`
|
|
1006
|
-
${e=>
|
|
1006
|
+
${e=>k(e)} {
|
|
1007
1007
|
color: #8c8c8c;
|
|
1008
1008
|
}
|
|
1009
1009
|
font-weight: 400;
|
|
@@ -1015,7 +1015,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1015
1015
|
line-height: 14px;
|
|
1016
1016
|
font-weight: 400;
|
|
1017
1017
|
cursor: pointer;
|
|
1018
|
-
`;var
|
|
1018
|
+
`;var Pp=({steps:e,style:t,title:o,primaryColor:n,appearance:r,onButtonClick:i})=>{let{primaryCTAClickSideEffects:s}=le();return Qe.createElement(mn,{style:t,className:l("guideContainer",r)},Qe.createElement(fn,{className:l("guideTitle",r)},o),Qe.createElement(un,{className:l("guideItemContainer",r)},e.map((p,d)=>Qe.createElement(gn,{key:`guide-${p.id??d}`,as:kp.div,whileHover:{boxShadow:"0px 2px 8px rgba(0, 0, 0, 0.05)",transition:{duration:.25}},className:l("guideItem",r)},p.icon&&Qe.createElement(hn,{className:l("guideIcon",r)},Qe.createElement(xn,null,p.icon)),Qe.createElement(Cn,{className:l("guideItemTitle",r),dangerouslySetInnerHTML:me(p.title)}),Qe.createElement(Sn,{className:l("guideItemSubtitle",r),dangerouslySetInnerHTML:me(p.subtitle)}),Qe.createElement(yn,{className:l("guideItemLink",r),color:n,onClick:()=>{p.primaryButtonUri&&s(p),i&&i(p)}},p.primaryButtonTitle)))))},eo=Pp;var Bp=({steps:e,title:t,subtitle:o,stepsTitle:n,visible:r,onClose:i,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:a,guideData:x,guideTitle:c,onGuideButtonClick:f})=>{let S=({stepData:m,handleSecondaryCTAClick:w,handleCTAClick:C})=>m?_.createElement(tn,{className:l("checklistStepContainer",a),"data-testid":"checklistStepContainer"},_.createElement(on,{appearance:a,className:l("checklistStepTitle",a),dangerouslySetInnerHTML:me(m.title)}),_.createElement(rn,{appearance:a,className:l("checklistStepSubtitle",a),dangerouslySetInnerHTML:me(m.subtitle)}),_.createElement(nn,{className:l("checklistCTAContainer",a)},m.secondaryButtonTitle&&_.createElement(ne,{title:m.secondaryButtonTitle,onClick:w,appearance:a,secondary:!0}),_.createElement(ne,{title:m.primaryButtonTitle,onClick:C,appearance:a}))):_.createElement(_.Fragment,null),P={...{default:m=>{var O;if((O=e[h])!=null&&O.StepContent){let M=e[h].StepContent;return _.createElement("div",null,M)}let w=e[h];return _.createElement(S,{stepData:m,handleCTAClick:()=>{w.handlePrimaryButtonClick&&w.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{w.handleSecondaryButtonClick&&w.handleSecondaryButtonClick()}})}},...d},[g,v]=vp(0),h=s??g,F=p??v,I=()=>{var m;return e?!((m=e[h])!=null&&m.type)||!P[e[h].type]?P.default(e[h]):P[e[h].type]({stepData:e[h],primaryColor:a.theme.colorPrimary}):_.createElement(_.Fragment,null)},y=e.filter(m=>m.complete).length;return r?(a.theme.modalContainer||(a.theme.borderRadius&&(sr.borderRadius=a.theme.borderRadius+"px"),a.theme.modalContainer=sr),_.createElement(tt,{onClose:i,visible:r,appearance:a},_.createElement(dn,null,_.createElement(Ki,null,_.createElement(Yi,{appearance:a,className:l("checklistTitle",a)},t),_.createElement(Ji,{appearance:a,className:l("checklistSubtitle",a)},o)),_.createElement(qi,null,e&&e.length>0&&_.createElement(Xi,{className:l("stepsContainer",a)},_.createElement(Qi,null,_.createElement("div",{style:{flex:3}},_.createElement(Zi,{className:l("stepsTitle",a)},n)),_.createElement(pn,null,_.createElement(ze,{fillColor:a.theme.colorPrimary,style:{width:"100%"},count:y,total:e.length,appearance:a}))),_.createElement(Ri,null,_.createElement(en,{className:l("checklistStepListContainer",a),appearance:a},e.map((m,w)=>{let C=h===w;return _.createElement(sn,{selected:C,className:l(`checklistStepListItem${C?"Selected":""}`,a),key:`checklist-guide-step-${m.id??w}`,disabled:m.blocked,onClick:()=>{m.blocked||F(w)},title:m.blocked?"Finish remaining steps to continue":void 0},C&&_.createElement(ko,{className:l("checklistStepItemSelectedIndicator",a),as:Ep.div,layoutId:"checklist-step-selected",style:{backgroundColor:a.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),_.createElement(ln,{selected:C,className:l(`checklistStepListStepName${C?"Selected":""}`,a)},m.stepName),_.createElement(an,null,_.createElement(Ke,{value:m.complete,type:"round",primaryColor:a.theme.colorPrimary,progress:m.progress,appearance:a}),_.createElement(cn,null,_.createElement(Dt,{style:{marginLeft:"10px"},color:a.theme.colorBackgroundSecondary}))))})),_.createElement(I,null))),x&&x.length>0&&_.createElement(eo,{steps:x,title:c,primaryColor:a.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:a,onButtonClick:m=>(f&&f(m),!0)}))))):_.createElement(_.Fragment,null)},lr=Bp;import{useEffect as Ap,useState as Ip}from"react";var bn=()=>{let e={isSmall:"(max-width: 480px)",isMedium:"(min-width: 481px) AND (max-width: 1023px)",isLarge:"(min-width: 1025px)"},t=Object.fromEntries(Object.entries(e).map(([p])=>[p,!1])),[o,n]=Ip(t),r=null,i=()=>{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 x=window.matchMedia(a);return x.addEventListener("change",i),[d,x.matches]}));n(p)};return Ap(()=>{s()},[]),o};import we,{useEffect as $n,useState as Op}from"react";import fe from"react";import{AnimatePresence as Np,motion as Lp}from"framer-motion";import Ze from"styled-components";var wn=Ze.div`
|
|
1019
1019
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1020
1020
|
border: 1px solid;
|
|
1021
1021
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -1052,7 +1052,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1052
1052
|
:hover {
|
|
1053
1053
|
opacity: 0.8;
|
|
1054
1054
|
}
|
|
1055
|
-
`,
|
|
1055
|
+
`,Px=Ze.div``,En=Ze.p`
|
|
1056
1056
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1057
1057
|
font-weight: 400;
|
|
1058
1058
|
font-size: 14px;
|
|
@@ -1062,7 +1062,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1062
1062
|
flex-direction: row;
|
|
1063
1063
|
justify-content: flex-start;
|
|
1064
1064
|
align-items: center;
|
|
1065
|
-
`;var An=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:n,onSecondaryButtonClick:r,appearance:i,customStepTypes:s})=>{var
|
|
1065
|
+
`;var An=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:n,onSecondaryButtonClick:r,appearance:i,customStepTypes:s})=>{var x,c;let p=t?{}:{transform:"rotate(90deg)"};function d(){return fe.createElement(fe.Fragment,null,e.imageUri||e.videoUri?fe.createElement(Tn,{className:l("stepMediaContainer",i)},e.imageUri?fe.createElement(Fn,{className:l("stepImage",i),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?fe.createElement(Bt,{appearance:i,videoUri:e.videoUri}):null):null,fe.createElement(En,{className:l("stepSubtitle",i),appearance:i,dangerouslySetInnerHTML:me(e.subtitle)}),fe.createElement(xo,{className:l("checklistCTAContainer",i)},e.secondaryButtonTitle?fe.createElement(ne,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>r(),appearance:i}):null,fe.createElement(ne,{title:e.primaryButtonTitle??"Continue",onClick:()=>n(),appearance:i})))}function a(){if(!s)return null;let f=s[e.type];return f?f(e,i):null}return fe.createElement(wn,{onClick:()=>t?o():null,"data-testid":`step-${e.id}`,className:l("checklistStepContainer",i),appearance:i},fe.createElement(kn,{className:l("stepHeader",i)},fe.createElement(Bn,null,fe.createElement(Fo,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(x=i==null?void 0:i.theme)==null?void 0:x.colorPrimary,appearance:i}),fe.createElement(Pn,{appearance:i,className:l("stepTitle",i),dangerouslySetInnerHTML:me(e.title)})),fe.createElement(vn,{className:l("stepChevronContainer",i),onClick:()=>o()},fe.createElement(Dt,{style:{...p,transition:"transform 0.1s ease-in-out"},color:(c=i==null?void 0:i.theme)==null?void 0:c.colorTextSecondary}))),fe.createElement(Np,null,!t&&fe.createElement(Lp.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 $t from"styled-components";var zx=$t.div`
|
|
1066
1066
|
background: #ffffff;
|
|
1067
1067
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
1068
1068
|
border-radius: 6px;
|
|
@@ -1101,23 +1101,23 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1101
1101
|
flex-direction: column;
|
|
1102
1102
|
justify-content: space-between;
|
|
1103
1103
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1104
|
-
`;var
|
|
1104
|
+
`;var Dp=({title:e,subtitle:t,steps:o,onClose:n,visible:r,autoExpandFirstIncompleteStep:i=!0,autoCollapse:s=!0,autoExpandNextStep:p=!0,primaryColor:d="#000000",selectedStep:a,setSelectedStep:x,appearance:c,type:f,className:S,customStepTypes:T,style:P})=>{let g=o.filter(m=>m.complete).length,[v,h]=Op(Array(o.length).fill(!0));$n(()=>{let m=[...v];if(i){for(let w=0;w<o.length;w++)if(!o[w].complete){m[w]=!1;break}h(m)}},[]),$n(()=>{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],h(w)};if(!r&&f=="modal")return we.createElement(we.Fragment,null);let I=we.createElement(we.Fragment,null,we.createElement(In,null,we.createElement(Nn,{appearance:c,className:l("checklistTitle",c),dangerouslySetInnerHTML:me(e)}),we.createElement(Ln,{appearance:c,className:l("checklistSubtitle",c),dangerouslySetInnerHTML:me(t)})),we.createElement(ze,{display:"percent",count:g,total:o.length,fillColor:d,style:{margin:"14px 0px 8px 0px"},appearance:c})),y=we.createElement(On,{className:Ce(l("checklistContainer",c),S)},o.map((m,w)=>{let C=v[w];return we.createElement(An,{appearance:c,stepData:m,collapsed:C,key:`modal-checklist-${m.id??w}`,onClick:()=>{if(a===w){F(w);return}x(w)},onPrimaryButtonClick:()=>{m.handlePrimaryButtonClick&&m.handlePrimaryButtonClick(),p&&!m.completionCriteria&&w<v.length-1&&v[w+1]&&x(w+1)},onSecondaryButtonClick:()=>{m.handleSecondaryButtonClick&&m.handleSecondaryButtonClick()},customStepTypes:T})}));return f==="inline"?we.createElement(Dn,{appearance:c,className:Ce(l("checklistInlineContainer",c),S),style:P},I,y):we.createElement(we.Fragment,null,we.createElement(tt,{onClose:n,visible:r,appearance:c,style:{maxWidth:"600px"},headerContent:I},y))},ar=Dp;import ae,{useEffect as pr,useRef as Wp,useState as yt}from"react";import Mt from"react";import de,{css as Mn,keyframes as Un}from"styled-components";var _n=Mn`
|
|
1105
1105
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1106
|
-
|
|
1106
|
+
`,$p=Mn`
|
|
1107
1107
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
1108
|
-
|
|
1108
|
+
`,Mp=Un`
|
|
1109
1109
|
from {
|
|
1110
1110
|
opacity: 0;
|
|
1111
1111
|
} to {
|
|
1112
1112
|
opacity: 1;
|
|
1113
1113
|
}
|
|
1114
|
-
`,
|
|
1114
|
+
`,Up=Un`
|
|
1115
1115
|
from {
|
|
1116
1116
|
opacity: 1;
|
|
1117
1117
|
} to {
|
|
1118
1118
|
opacity: 0;
|
|
1119
1119
|
}
|
|
1120
|
-
`,zn=
|
|
1120
|
+
`,zn=de.div`
|
|
1121
1121
|
margin: 0 -20px;
|
|
1122
1122
|
overflow-x: auto;
|
|
1123
1123
|
padding-left: 20px;
|
|
@@ -1134,14 +1134,14 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1134
1134
|
::-webkit-scrollbar {
|
|
1135
1135
|
display: none;
|
|
1136
1136
|
}
|
|
1137
|
-
`,Wn=
|
|
1137
|
+
`,Wn=de.div`
|
|
1138
1138
|
display: flex;
|
|
1139
1139
|
flex-flow: row nowrap;
|
|
1140
1140
|
gap: 0 16px;
|
|
1141
1141
|
scroll-snap-align: center;
|
|
1142
1142
|
scroll-snap-stop: always;
|
|
1143
|
-
`,Hn=
|
|
1144
|
-
animation: ${e=>e.reversed?Mp
|
|
1143
|
+
`,Hn=de.div`
|
|
1144
|
+
animation: ${e=>e.reversed?Up:Mp} 0.25s ease-out;
|
|
1145
1145
|
background: linear-gradient(
|
|
1146
1146
|
to right,
|
|
1147
1147
|
${({theme:e})=>e.colorBackground}00,
|
|
@@ -1150,7 +1150,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1150
1150
|
position: absolute;
|
|
1151
1151
|
width: 64px;
|
|
1152
1152
|
z-index: 10;
|
|
1153
|
-
`,Vn=
|
|
1153
|
+
`,Vn=de.button`
|
|
1154
1154
|
${_n}
|
|
1155
1155
|
box-shadow: 0 3px 10px 0 rgba(0, 0, 0, 0.1);
|
|
1156
1156
|
align-items: center;
|
|
@@ -1162,10 +1162,10 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1162
1162
|
justify-content: center;
|
|
1163
1163
|
position: absolute;
|
|
1164
1164
|
width: 48px;
|
|
1165
|
-
`,jn=
|
|
1165
|
+
`,jn=de.div`
|
|
1166
1166
|
border-radius: ${({theme:e})=>e.borderRadius}px;
|
|
1167
1167
|
padding: 20px;
|
|
1168
|
-
`,Gn=
|
|
1168
|
+
`,Gn=de(jn)`
|
|
1169
1169
|
${_n}
|
|
1170
1170
|
background: ${({theme:e})=>e.colorBackground};
|
|
1171
1171
|
position: relative;
|
|
@@ -1178,68 +1178,68 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1178
1178
|
${e=>e.blocked?"":`border: 1px solid ${e.theme.colorPrimary};`}
|
|
1179
1179
|
${e=>e.blocked?"cursor: default":"cursor: pointer"}
|
|
1180
1180
|
}
|
|
1181
|
-
`,qn=
|
|
1181
|
+
`,qn=de.img`
|
|
1182
1182
|
border-radius: 50%;
|
|
1183
1183
|
height: 40px;
|
|
1184
1184
|
margin-bottom: 12px;
|
|
1185
1185
|
width: 40px;
|
|
1186
|
-
`,Kn=
|
|
1187
|
-
${e=>
|
|
1188
|
-
${
|
|
1186
|
+
`,Kn=de(jn)`
|
|
1187
|
+
${e=>k(e)} {
|
|
1188
|
+
${$p}
|
|
1189
1189
|
|
|
1190
1190
|
background: ${({theme:e})=>e.colorBackground};
|
|
1191
1191
|
}
|
|
1192
|
-
`,Yn=
|
|
1192
|
+
`,Yn=de.div`
|
|
1193
1193
|
color: ${({theme:e})=>e.colorPrimary};
|
|
1194
1194
|
display: flex;
|
|
1195
1195
|
flex-flow: row nowrap;
|
|
1196
1196
|
align-items: center;
|
|
1197
1197
|
margin-left: 20px;
|
|
1198
|
-
`,Jn=
|
|
1198
|
+
`,Jn=de.div`
|
|
1199
1199
|
white-space: nowrap;
|
|
1200
|
-
`,Xn=
|
|
1200
|
+
`,Xn=de.div`
|
|
1201
1201
|
background: #d8fed8;
|
|
1202
1202
|
border-radius: 6px;
|
|
1203
1203
|
float: right;
|
|
1204
1204
|
margin-bottom: 12px;
|
|
1205
1205
|
padding: 4px 10px;
|
|
1206
|
-
`,
|
|
1206
|
+
`,_p=de.p`
|
|
1207
1207
|
font-weight: bold;
|
|
1208
1208
|
font-size: 18px;
|
|
1209
1209
|
line-height: 22px;
|
|
1210
1210
|
letter-spacing: calc(18px * -0.01);
|
|
1211
1211
|
margin: 0;
|
|
1212
|
-
`,Qn=
|
|
1212
|
+
`,Qn=de(_p)`
|
|
1213
1213
|
margin-bottom: 4px;
|
|
1214
|
-
`,
|
|
1214
|
+
`,zp=de.p`
|
|
1215
1215
|
font-weight: bold;
|
|
1216
1216
|
font-size: 16px;
|
|
1217
1217
|
line-height: 20px;
|
|
1218
1218
|
letter-spacing: calc(16px * -0.01);
|
|
1219
1219
|
margin: 0;
|
|
1220
|
-
`,Zn=
|
|
1220
|
+
`,Zn=de(zp)`
|
|
1221
1221
|
margin-bottom: 4px;
|
|
1222
1222
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1223
1223
|
`}
|
|
1224
|
-
`,We=
|
|
1224
|
+
`,We=de.p`
|
|
1225
1225
|
color: ${({theme:e})=>e.colorText};
|
|
1226
1226
|
font-weight: normal;
|
|
1227
1227
|
font-size: 14px;
|
|
1228
1228
|
line-height: 22px;
|
|
1229
1229
|
margin: 0;
|
|
1230
|
-
`,Rn=
|
|
1230
|
+
`,Rn=de.p`
|
|
1231
1231
|
color: ${({theme:e})=>e.colorText};
|
|
1232
1232
|
font-weight: 600;
|
|
1233
1233
|
font-size: 12px;
|
|
1234
1234
|
line-height: 16px;
|
|
1235
1235
|
margin: 0;
|
|
1236
|
-
`;We.Loud=
|
|
1236
|
+
`;We.Loud=de(We)`
|
|
1237
1237
|
font-weight: 600;
|
|
1238
|
-
`;We.Quiet=
|
|
1238
|
+
`;We.Quiet=de(We)`
|
|
1239
1239
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1240
1240
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1241
1241
|
`}
|
|
1242
|
-
`;var es=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:n}=
|
|
1242
|
+
`;var es=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:n}=te(),{primaryCTAClickSideEffects:r}=le();o=n(o);let{imageUri:i=null,subtitle:s=null,title:p=null,complete:d=!1,blocked:a=!1}=e,x=e.primaryButtonTitle||e.secondaryButtonTitle,c=()=>{r(e)};return Mt.createElement(Gn,{className:l("carouselCard",o),onClick:a?null:c,style:t,blocked:a,complete:d},i&&Mt.createElement(qn,{className:l("carouselCardImage",o),src:i,alt:p,style:{opacity:d||a?.4:1}}),(d||!0)&&Mt.createElement(Xn,{className:l("carouselCompletedPill",o)},Mt.createElement(Rn,{style:{color:"#108E0B"}},"Complete")),p&&Mt.createElement(Zn,{blocked:a,complete:d,className:l("carouselCardTitle",o)},p),s&&Mt.createElement(We.Quiet,{blocked:a,complete:d,className:l("carouselCardSubtitle",o)},s))};import to from"react";var ts=({numberOfStepsCompleted:e,numberOfSteps:t,appearance:o})=>{let n=t>0?e/t:0,r=200,i=Math.min(r,Math.max(10,Math.round(r*n)));return to.createElement(Yn,{className:l("carouselProgressBar",o)},to.createElement(Jn,{as:We.Loud,style:{marginRight:8}},e," of ",t),to.createElement("svg",{height:10,width:r},to.createElement("rect",{x:0,y:0,rx:5,width:r,height:10,fill:"#E6E6E6"}),to.createElement("rect",{x:0,y:0,rx:5,width:i,height:10,fill:"currentColor"})))};var Hp=()=>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"})),os=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[n,r]=yt(!1),[i,s]=yt(!1);pr(()=>{t===!0&&n===!1?r(!0):t===!1&&n===!0&&s(!0)},[t]);let p=()=>{r(!1),s(!1)},d=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return n?ae.createElement(Hn,{style:d,reversed:i,onAnimationEnd:i?p:null},ae.createElement(Vn,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},ae.createElement(Hp,null))):null},rs=({flowId:e,appearance:t,customVariables:o,className:n})=>{let r=Wp(null),[i,s]=yt(!1),[p,d]=yt(!1),[a,x]=yt(null),[c,f]=yt([]),[S,T]=yt(0),{getFlowMetadata:P,getFlowSteps:g,getNumberOfStepsCompleted:v,updateCustomVariables:h,getFlowStatus:F,isLoading:I,targetingLogicShouldHideFlow:y,getFlow:m}=ee();pr(()=>{h(o)},[o,I]),pr(()=>{if(I)return;let N=P(e),L=v(e),H=g(e);x(N),N.data!==null&&(f(H.sort(($,X)=>Number($.complete)-Number(X.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&&i===!1&&s(!0),$===0&&i===!0&&s(!1),$<H&&p===!1&&d(!0),$===H&&p===!0&&d(!1)},E=(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(Kn,{className:Ce(l("carouselContainer",t),n)},ae.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:20}},ae.createElement("div",null,ae.createElement(Qn,{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(ts,{numberOfStepsCompleted:S,numberOfSteps:c.length})),ae.createElement("div",{style:{position:"relative"}},ae.createElement(os,{show:i,onClick:()=>E(!1)}),ae.createElement(os,{side:"right",show:p,onClick:E}),ae.createElement(zn,{ref:r,onScroll:M},w.map((N,L)=>ae.createElement(Wn,{key:L,style:{flex:`0 0 calc(100% - ${c.length>3?36:0}px)`}},N.map((H,$)=>ae.createElement(es,{key:$,stepData:H,style:{flex:c.length>3?"0 1 calc(33% - 16px * 2 / 3)":1},appearance:t})))))),ae.createElement(se,{appearance:t}))};var dr=({flowId:e,title:t,subtitle:o,style:n,initialSelectedStep:r,className:i,type:s="inline",onDismiss:p,visible:d,customVariables:a,onStepCompletion:x,onButtonClick:c,appearance:f,hideOnFlowCompletion:S,setVisible:T,customStepTypes:P,checklistStyle:g="default",autoExpandFirstIncompleteStep:v,autoExpandNextStep:h,...F})=>{let{getFlow:I,getFlowSteps:y,markStepCompleted:m,getStepStatus:w,getNumberOfStepsCompleted:C,isLoading:E,targetingLogicShouldHideFlow:O,updateCustomVariables:M,getFlowMetadata:N,isStepBlocked:L,getFlowStatus:H,hasActiveFullPageFlow:$,setHasActiveFullPageFlow:X}=ee(),{primaryCTAClickSideEffects:Q,secondaryCTAClickSideEffects:Y}=le(),{getOpenFlowState:V,setOpenFlowState:ge}=Fe(),[oe,q]=ns(r||0),[he,Te]=ns(!1),K=d===void 0?V(e):d,pe=s==="modal",{mergeAppearanceWithDefault:z}=te(),{isLarge:D}=bn();if(f=z(f),is(()=>{M(a)},[a,E]),is(()=>{d!==void 0&&(pe&&d===!0?X(!0):pe&&d===!1&&X(!1))},[d,T,$]),E)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),!he&&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,dt){let xr=oe+1<j.length?j[oe+1]:null;c&&c(A,oe,Z,xr)===!0&&pe&&$e(),x&&x(A,dt,xr),!x&&!c&&(A.primaryButtonUri||A.secondaryButtonUri)&&pe&&$e()}function pt(){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:pt(),title:t,subtitle:o,primaryColor:f.theme.colorPrimary,appearance:f,customStepTypes:P,type:s,className:i,autoExpandFirstIncompleteStep:v,autoExpandNextStep:h};function $e(){ge(e,!1),p&&p(),T&&T(!1)}function Oo(){return ce.createElement(ce.Fragment,null,ce.createElement(W,null),ce.createElement(rs,{flowId:e,appearance:f,customVariables:a,className:i}))}function u(){return ce.createElement(ce.Fragment,null,ce.createElement(W,null),ce.createElement(ar,{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(lr,{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:dt=>{De(dt,"link",0)},customStepTypes:P,...ve}))}function B(){if(!D)return u();let A=ce.createElement(nr,{flowId:e,style:n,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 B();case"carousel":return Oo();default:return B()}};var jp=e=>Vp.createElement(dr,{type:"inline",...e});import at,{useEffect as qp}from"react";import He from"react";import Ao from"styled-components";var ss=Ao.div`
|
|
1243
1243
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1244
1244
|
border-radius: 8px;
|
|
1245
1245
|
padding: 6px 10px 6px 10px;
|
|
@@ -1266,7 +1266,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1266
1266
|
display: flex;
|
|
1267
1267
|
height: 100%;
|
|
1268
1268
|
align-items: center;
|
|
1269
|
-
`;import{motion as
|
|
1269
|
+
`;import{motion as Gp}from"framer-motion";var ds=({title:e,count:t,total:o,onClick:n,style:r={},className:i,appearance:s,type:p="default"})=>He.createElement(He.Fragment,null,He.createElement(se,{appearance:s}),He.createElement(ss,{as:Gp.div,whileHover:{opacity:.9},whileTap:{scale:.98},onClick:()=>n!==void 0&&n(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...r},className:Ce(i??"",l("progressRingContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&He.createElement(ps,{className:l("progressRingContainer",s)},He.createElement(vt,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),He.createElement(ls,{type:p,className:l("badgeTitleContainer",s)},He.createElement(as,{type:p,appearance:s,className:l("badgeTitle",s)},e),n!==void 0&&He.createElement(Dt,{className:l("badgeChevron",s),color:s.theme.colorPrimary})),p=="default"&&o&&o!==0&&He.createElement(ze,{display:"compact",count:t,total:o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:s})));import lt from"react";import oo from"styled-components";var cs=oo.div`
|
|
1270
1270
|
display: flex;
|
|
1271
1271
|
flex-direction: row;
|
|
1272
1272
|
width: 100%;
|
|
@@ -1278,7 +1278,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1278
1278
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1279
1279
|
border-radius: 12px;
|
|
1280
1280
|
`,ms=oo.div`
|
|
1281
|
-
${e=>
|
|
1281
|
+
${e=>k(e)} {
|
|
1282
1282
|
display: flex;
|
|
1283
1283
|
justify-content: center;
|
|
1284
1284
|
align-items: center;
|
|
@@ -1295,7 +1295,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1295
1295
|
justify-content: center;
|
|
1296
1296
|
margin-left: 16px;
|
|
1297
1297
|
min-width: 200px;
|
|
1298
|
-
`,
|
|
1298
|
+
`,r0=oo.div`
|
|
1299
1299
|
display: flex;
|
|
1300
1300
|
justify-content: center;
|
|
1301
1301
|
align-items: flex-end;
|
|
@@ -1304,7 +1304,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1304
1304
|
:hover {
|
|
1305
1305
|
opacity: 0.8;
|
|
1306
1306
|
}
|
|
1307
|
-
`;var gs=({title:e,subtitle:t,icon:o,appearance:n,count:r,total:i,className:s,style:p})=>lt.createElement(lt.Fragment,null,lt.createElement(cs,{appearance:n,className:Ce(l("fullWidthProgressBadgeContainer",n),s??""),style:p},o&<.createElement(ms,{className:l("fullWidthProgressBadgeIcon",n)},o),lt.createElement(us,null,lt.createElement(Se,{size:"small",appearance:n,title:e,subtitle:t})),lt.createElement(fs,{className:l("fullWidthProgressBadgeProgressContainer",n)},lt.createElement(ze,{count:r,total:i,display:"percent",textLocation:"top",fillColor:n.theme.colorPrimary}))));var
|
|
1307
|
+
`;var gs=({title:e,subtitle:t,icon:o,appearance:n,count:r,total:i,className:s,style:p})=>lt.createElement(lt.Fragment,null,lt.createElement(cs,{appearance:n,className:Ce(l("fullWidthProgressBadgeContainer",n),s??""),style:p},o&<.createElement(ms,{className:l("fullWidthProgressBadgeIcon",n)},o),lt.createElement(us,null,lt.createElement(Se,{size:"small",appearance:n,title:e,subtitle:t})),lt.createElement(fs,{className:l("fullWidthProgressBadgeProgressContainer",n)},lt.createElement(ze,{count:r,total:i,display:"percent",textLocation:"top",fillColor:n.theme.colorPrimary}))));var Kp=({flowId:e,title:t,subtitle:o,icon:n,style:r,onClick:i,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:a,type:x="default"})=>{let{getFlow:c,getFlowSteps:f,getFlowStatus:S,getNumberOfStepsCompleted:T,isLoading:P,targetingLogicShouldHideFlow:g,updateCustomVariables:v}=ee(),{mergeAppearanceWithDefault:h}=te();a=h(a);let{setOpenFlowState:F,getOpenFlowState:I}=Fe();if(qp(()=>{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 x==="full-width"?at.createElement(at.Fragment,null,at.createElement(se,{appearance:a}),at.createElement(gs,{title:t,subtitle:o,count:w,total:m.length,style:r,className:s,appearance:a,icon:n,onClick:()=>{}})):at.createElement(at.Fragment,null,at.createElement(se,{appearance:a}),at.createElement(ds,{count:w,total:m.length,title:t,style:r,onClick:()=>{F(e,!0),i&&i()},type:x,className:s,appearance:a}))};import Yp from"react";var Jp=({flowId:e,style:t,appearance:o,...n})=>{let{getFlow:r,targetingLogicShouldHideFlow:i,getFlowSteps:s}=ee(),{mergeAppearanceWithDefault:p}=te();o=p(o);let d=r(e);if(!d||i(d))return null;let a=s(e);return Yp.createElement(eo,{steps:a,style:t,appearance:o,...n})};import _t,{useContext as ld,useEffect as ad}from"react";import U,{useEffect as Io,useLayoutEffect as Cs,useRef as ed,useState as ro}from"react";import io from"styled-components";import{useCallback as Xp,useEffect as Qp,useState as Zp}from"react";var cr=(e,t,o,n={x:20,y:20},r)=>{let i=r=="fixed"?0:window.scrollY,s=r=="fixed"?0:window.scrollX;return!e||!e.left||!e.top?{x:0,y:0}:t==="left"?{x:e.left-o+n.x+s,y:e.top-n.y+i}:t==="right"?{x:e.left+e.width+n.x+s,y:e.top-n.y+i}:{x:0,y:0}},hs={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Rp(e){let t=hs;return e&&(t=e.getBoundingClientRect()),t}function xs(e,t){let[o,n]=Zp(hs),r=Xp(()=>{e&&n(Rp(e))},[e]);return Qp(()=>(r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)),[e,t]),o}var Ss=300,ys=100,td=500,Ut=12,od=io.div`
|
|
1308
1308
|
width: 100%;
|
|
1309
1309
|
height: 100%;
|
|
1310
1310
|
border-radius: 9999px;
|
|
@@ -1327,14 +1327,14 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1327
1327
|
opacity: 0;
|
|
1328
1328
|
}
|
|
1329
1329
|
}
|
|
1330
|
-
`,
|
|
1330
|
+
`,rd=io.div`
|
|
1331
1331
|
width: ${Ut}px;
|
|
1332
1332
|
height: ${Ut}px;
|
|
1333
1333
|
border-radius: 100px;
|
|
1334
1334
|
background-color: ${e=>e.primaryColor};
|
|
1335
1335
|
z-index: 20;
|
|
1336
1336
|
opacity: 1;
|
|
1337
|
-
`,
|
|
1337
|
+
`,id=io.div`
|
|
1338
1338
|
pointer-events: all;
|
|
1339
1339
|
`,bs=io.div`
|
|
1340
1340
|
display: flex;
|
|
@@ -1342,11 +1342,11 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1342
1342
|
justify-content: center;
|
|
1343
1343
|
align-items: center;
|
|
1344
1344
|
z-index: ${e=>e.zIndex?e.zIndex:90};
|
|
1345
|
-
`,
|
|
1345
|
+
`,nd=io(bs)`
|
|
1346
1346
|
width: ${Ut+12}px;
|
|
1347
1347
|
height: ${Ut+12}px;
|
|
1348
|
-
`,
|
|
1349
|
-
${e=>
|
|
1348
|
+
`,sd=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:n="auto",showHighlight:r=!0,primaryColor:i="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:a=0,customStepTypes:x,appearance:c,dismissible:f=!1,showHighlightOnly:S,showStepCount:T=!0,completedStepsCount:P=0,showFrigadeBranding:g=!1})=>{var ie,je,De,pt;let[v,h]=ro(),[F,I]=ro(new Date),y=ed(null),[m,w]=ro(document.querySelector(e[a].selector)),C=xs(m,F),[E,O]=ro(),[M,N]=ro(!S),L=(je=(ie=e[a])==null?void 0:ie.props)!=null&&je.position?e[a].props.position:"absolute",H=((pt=(De=e[a])==null?void 0:De.props)==null?void 0:pt.zIndex)??90,$=(v==null?void 0:v.width)??Ss,X=(v==null?void 0:v.height)??ys;Cs(()=>{y.current&&h({width:y.current.clientWidth,height:y.current.clientHeight})},[a,F,L]),Io(()=>{S||N(!0)},[a]);let Q=n==="auto"?"right":n,Y=cr(C,Q,$,s,L),V=C.right+$>(window.innerWidth||document.documentElement.clientWidth),ge=C.bottom+ys>(window.innerHeight||document.documentElement.clientHeight);V&&n==="auto"&&(Y=cr(C,"left",$,s,L),Q="left");let oe=window.location.pathname.split("/").pop(),q=()=>{let W=document.querySelector(e[a].selector);E&&E===JSON.stringify(W==null?void 0:W.getBoundingClientRect())||(w(W),I(new Date),W&&O(JSON.stringify(W.getBoundingClientRect())))};if(Io(()=>{let W=new MutationObserver(q);return W.observe(document.body,{subtree:!0,childList:!0}),()=>W.disconnect()},[q]),Io(()=>{let W=new MutationObserver(q);return W.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>W.disconnect()},[q]),Io(()=>{let W=setInterval(()=>{q()},10);return()=>clearInterval(W)},[q]),Cs(()=>{setTimeout(()=>{q()},td),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 he=()=>{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(Ar,null,U.createElement(Nr,{className:l("tooltipStepCounter",c)},a+1," of ",e.length)),U.createElement(Ir,{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(Pr,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:l("tooltipClose",c)},U.createElement(ke,null)),e[a].imageUri&&U.createElement(vr,{dismissible:f,appearance:c,src:e[a].imageUri,className:l("tooltipImageContainer",c)}),e[a].videoUri&&!e[a].imageUri&&U.createElement(Er,{dismissible:f,appearance:c,className:l("tooltipVideoContainer",c)},U.createElement(Bt,{appearance:c,videoUri:e[a].videoUri})),U.createElement(Se,{appearance:c,title:e[a].title,subtitle:e[a].subtitle,size:"small"}),U.createElement(Br,{className:l("tooltipFooter",c)},U.createElement(he,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)}},...x},z=()=>{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:i}):U.createElement(U.Fragment,null)};if(S&&e[a].complete===!0)return null;let D={top:(Y==null?void 0:Y.y)-Ut,left:(Q=="left"?C.x+s.x:(Y==null?void 0:Y.x)-Ut)??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(id,null,U.createElement(nd,{style:D,zIndex:H,className:l("tourHighlightContainer",c)},r&&e[a].showHighlight!==!1&&U.createElement(U.Fragment,null,U.createElement(rd,{style:{position:L},onClick:j,primaryColor:c.theme.colorPrimary,className:l("tourHighlightInnerCircle",c)}),U.createElement(od,{style:{position:"absolute"},onClick:j,primaryColor:c.theme.colorPrimary,className:l("tourHighlightOuterCircle",c)}))),U.createElement(bs,{style:{...D,left:re()},zIndex:H+1,className:l("tooltipContainerWrapper",c)},M&&U.createElement(U.Fragment,null,U.createElement(lo,{ref:y,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:12,...d},appearance:c,className:l("tooltipContainer",c),maxWidth:Ss,zIndex:H+10},U.createElement(z,null)),g&&U.createElement(Or,{className:l("poweredByFrigadeTooltipRibbon",c),appearance:c,zIndex:H+10},U.createElement(ao,{appearance:c})))))},No=sd;import{Portal as pd}from"react-portal";var dd=({flowId:e,customVariables:t,appearance:o,onStepCompletion:n,onButtonClick:r,showTooltipsSimultaneously:i=!1,onDismiss:s,dismissible:p,tooltipPosition:d="auto",showHighlightOnly:a=!1,dismissBehavior:x="complete-flow",onComplete:c,skipIfNotFound:f=!1,...S})=>{let{getFlow:T,getFlowSteps:P,isLoading:g,targetingLogicShouldHideFlow:v,markStepCompleted:h,markStepStarted:F,markFlowCompleted:I,updateCustomVariables:y,getCurrentStepIndex:m,getStepStatus:w,isStepBlocked:C,getFlowStatus:E,getNumberOfStepsCompleted:O}=ee(),{isLoadingUserFlowStateData:M}=Be(),{primaryCTAClickSideEffects:N,secondaryCTAClickSideEffects:L}=le(),{hasOpenModals:H}=Fe(),$=m(e),{openFlowStates:X}=ld(G),{mergeAppearanceWithDefault:Q}=te();if(o=Q(o),ad(()=>{y(t)},[t,g]),M)return null;let Y=T(e);if(!Y||v(Y)||E(e)==R||H())return null;let V=P(e);if(Object.keys(X).length>0){let z=Object.keys(X).find(D=>X[D]===!0);if(z!==void 0&&z!==e)return _t.createElement(_t.Fragment,null)}async function ge(z){if(await h(e,z.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(z,D,re){let j=$+1<V.length?V[$+1]:null;r&&r(z,$,D,j),n&&n(z,re,j)}function q(){return V.map(z=>({...z,handleSecondaryButtonClick:async()=>{L(z),z.skippable===!0&&await h(e,z.id,{skipped:!0}),oe(z,"secondary",$)},handlePrimaryButtonClick:async()=>{(!z.completionCriteria&&(z.autoMarkCompleted||z.autoMarkCompleted===void 0)||z.completionCriteria&&z.autoMarkCompleted===!0)&&await ge(z),oe(z,"primary",$),N(z)}}))}async function he(z){s&&s(),x==="complete-flow"?await I(e):await h(e,z.id)}function Te(){c&&c()}let K=!document.querySelector(V[$].selector);function pe(){let z=V.findIndex(D=>!!document.querySelector(D.selector));return V.map((D,re)=>K&&!i&&re!==z&&f?null:_t.createElement(No,{key:D.id,appearance:o,steps:q(),selectedStep:re,showTooltipsSimultaneously:i,dismissible:p,onDismiss:()=>he(D),tooltipPosition:d,showHighlightOnly:a,completedStepsCount:O(e),onComplete:Te,...S}))}return _t.createElement(pd,null,_t.createElement(se,{appearance:o}),i||K&&f?pe():_t.createElement(No,{appearance:o,steps:q(),selectedStep:$,showTooltipsSimultaneously:i,dismissible:p,onDismiss:()=>he(V[$]),tooltipPosition:d,completedStepsCount:O(e),showHighlightOnly:a,onComplete:Te,...S}))};import be,{useEffect as cd,useRef as md,useState as ud}from"react";import{Portal as fd}from"react-portal";import bt from"styled-components";var ws=bt.button`
|
|
1349
|
+
${e=>k(e)} {
|
|
1350
1350
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1351
1351
|
|
|
1352
1352
|
display: flex;
|
|
@@ -1364,12 +1364,12 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1364
1364
|
}
|
|
1365
1365
|
}
|
|
1366
1366
|
`,Ts=bt.span`
|
|
1367
|
-
${e=>
|
|
1367
|
+
${e=>k(e)} {
|
|
1368
1368
|
font-size: 12px;
|
|
1369
1369
|
display: inline-block;
|
|
1370
1370
|
}
|
|
1371
1371
|
`,Fs=bt.span`
|
|
1372
|
-
${e=>
|
|
1372
|
+
${e=>k(e)} {
|
|
1373
1373
|
font-size: 12px;
|
|
1374
1374
|
display: inline-block;
|
|
1375
1375
|
}
|
|
@@ -1384,7 +1384,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1384
1384
|
align-items: flex-end;
|
|
1385
1385
|
z-index: 50;
|
|
1386
1386
|
`,Ps=bt.button`
|
|
1387
|
-
${e=>
|
|
1387
|
+
${e=>k(e)} {
|
|
1388
1388
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1389
1389
|
background-color: #ffffff;
|
|
1390
1390
|
border: 1px solid #f5f5f5;
|
|
@@ -1400,7 +1400,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1400
1400
|
border-radius: 45px;
|
|
1401
1401
|
cursor: pointer;
|
|
1402
1402
|
`,vs=bt.div`
|
|
1403
|
-
${e=>
|
|
1403
|
+
${e=>k(e)} {
|
|
1404
1404
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1405
1405
|
background: #ffffff;
|
|
1406
1406
|
}
|
|
@@ -1417,7 +1417,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1417
1417
|
top: ${e=>e.type=="inline"?"68px":0};
|
|
1418
1418
|
margin-left: ${e=>e.type=="inline"?"-127px":0};
|
|
1419
1419
|
`,Es=bt.button`
|
|
1420
|
-
${e=>
|
|
1420
|
+
${e=>k(e)} {
|
|
1421
1421
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1422
1422
|
color: #434343;
|
|
1423
1423
|
:hover {
|
|
@@ -1433,8 +1433,8 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1433
1433
|
font-size: 14px;
|
|
1434
1434
|
|
|
1435
1435
|
padding: 8px 12px;
|
|
1436
|
-
`;import{AnimatePresence as Ls,motion as Os}from"framer-motion";import Bs from"react";var As=({style:e,className:t})=>Bs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Bs.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 Is from"react";var Ns=({style:e,className:t})=>Is.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"},Is.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
|
|
1437
|
-
${e=>
|
|
1436
|
+
`;import{AnimatePresence as Ls,motion as Os}from"framer-motion";import Bs from"react";var As=({style:e,className:t})=>Bs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Bs.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 Is from"react";var Ns=({style:e,className:t})=>Is.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"},Is.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 gd=({flowId:e,style:t,onStepCompletion:o,visible:n=!0,type:r="inline",title:i="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:a,getStepStatus:x,getNumberOfStepsCompleted:c,isLoading:f,targetingLogicShouldHideFlow:S}=ee(),{primaryCTAClickSideEffects:T}=le(),P=md(null),[g,v]=ud(!1),{mergeAppearanceWithDefault:h}=te();s=h(s),cd(()=>(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||!n)return null;function m(C,E){!C.completionCriteria&&(C.autoMarkCompleted||C.autoMarkCompleted===void 0)&&a(e,C.id),T(C),o&&o(C,E),v(!1)}function w(){return g&&be.createElement(vs,{className:l("floatingWidgetMenu",s),as:Os.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:r},y.map((C,E)=>be.createElement(Es,{className:l("floatingWidgetMenuItem",s),key:E,onClick:()=>m(C,E)},C.title)))}return r=="inline"?be.createElement("span",{ref:P},be.createElement(ws,{style:t,onClick:()=>{v(!g)},className:l("supportButton",s)},be.createElement(Fs,{className:l("supportIconContainer",s)},be.createElement(Ns,{className:l("supportIcon",s),style:{width:"18px",height:"18px"}})),be.createElement(Ts,{className:l("supportButtonTitle",s)},i)),be.createElement(Ls,null,be.createElement(w,null))):be.createElement(fd,null,be.createElement(ks,{style:t,ref:P},be.createElement(Ls,null,be.createElement(w,null)),be.createElement(Ps,{onClick:()=>{v(!g)},as:Os.button,whileHover:{scale:1.1},className:l("floatingWidgetButton",s)},be.createElement(As,{className:l("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import Ve,{useEffect as hd}from"react";import Lo from"styled-components";var Ds=Lo.div`
|
|
1437
|
+
${e=>k(e)} {
|
|
1438
1438
|
display: flex;
|
|
1439
1439
|
flex-direction: column;
|
|
1440
1440
|
width: 100%;
|
|
@@ -1459,7 +1459,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1459
1459
|
align-items: flex-start;
|
|
1460
1460
|
margin-top: 16px;
|
|
1461
1461
|
`,Us=Lo.div`
|
|
1462
|
-
${e=>
|
|
1462
|
+
${e=>k(e)} {
|
|
1463
1463
|
position: absolute;
|
|
1464
1464
|
top: 16px;
|
|
1465
1465
|
right: 16px;
|
|
@@ -1469,9 +1469,9 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1469
1469
|
opacity: 0.8;
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
|
-
`;var
|
|
1472
|
+
`;var xd=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:n,appearance:r,className:i,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:a,markStepCompleted:x,isLoading:c,targetingLogicShouldHideFlow:f,updateCustomVariables:S,getFlowSteps:T,getFlowStatus:P,getCurrentStepIndex:g}=ee(),{primaryCTAClickSideEffects:v}=le(),{mergeAppearanceWithDefault:h}=te();if(r=h(r),hd(()=>{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(Ds,{appearance:r,className:Ce(l("embeddedTipContainer",r),i),style:s},(p===!0||y.dismissible)&&Ve.createElement(Us,{onClick:async()=>{await a(e),t&&t()},className:l("embeddedTipDismissButton",r)},Ve.createElement(ke,null)),Ve.createElement($s,null,Ve.createElement(Se,{size:"small",appearance:r,title:y.title,subtitle:y.subtitle})),y.primaryButtonTitle&&Ve.createElement(Ms,{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),!(n&&n(y,g(e),"primary")===!1)&&(await x(e,y.id),await a(e))}}))))};import xe,{useEffect as Cd}from"react";import zt from"styled-components";var _s=zt.div`
|
|
1473
1473
|
// use the :not annotation
|
|
1474
|
-
${e=>
|
|
1474
|
+
${e=>k(e)} {
|
|
1475
1475
|
display: flex;
|
|
1476
1476
|
flex-direction: ${e=>e.type==="square"?"column":"row"};
|
|
1477
1477
|
width: 100%;
|
|
@@ -1484,7 +1484,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1484
1484
|
border-radius: 12px;
|
|
1485
1485
|
}
|
|
1486
1486
|
`,zs=zt.div`
|
|
1487
|
-
${e=>
|
|
1487
|
+
${e=>k(e)} {
|
|
1488
1488
|
display: flex;
|
|
1489
1489
|
width: 36px;
|
|
1490
1490
|
height: 36px;
|
|
@@ -1514,8 +1514,8 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1514
1514
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1515
1515
|
align-items: flex-end;
|
|
1516
1516
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1517
|
-
`;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:"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
|
|
1518
|
-
${e=>
|
|
1517
|
+
`;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:"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 Sd=({flowId:e,title:t,subtitle:o,onDismiss:n,customVariables:r,onButtonClick:i,appearance:s,type:p="full-width",icon:d})=>{let{getFlow:a,markFlowCompleted:x,isLoading:c,targetingLogicShouldHideFlow:f,updateCustomVariables:S,getFlowMetadata:T,getFlowStatus:P,getFlowSteps:g,getCurrentStepIndex:v}=ee(),{primaryCTAClickSideEffects:h}=le(),{mergeAppearanceWithDefault:F}=te();if(s=F(s),Cd(()=>{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),xe.createElement(xe.Fragment,null,xe.createElement(se,{appearance:s}),xe.createElement(_s,{type:p,appearance:s,className:l("bannerContainer",s)},p!="square"&&xe.createElement(zs,{className:l("bannerIconContainer",s)},d||xe.createElement(js,null)),p==="square"&&m.dismissible&&xe.createElement(ur,{type:p,className:l("bannerDismissButtonContainer",s)},xe.createElement(mr,{type:p,onClick:async()=>{await x(e),n&&n()},className:l("bannerDismissButton",s)},xe.createElement(ke,null))),xe.createElement(Ws,{type:p},xe.createElement(Se,{appearance:s,title:t,subtitle:o,classPrefix:"banner"})),xe.createElement(Hs,{type:p,className:l("bannerCallToActionContainer",s)},xe.createElement(ne,{title:(m==null?void 0:m.primaryButtonTitle)??"Get started",appearance:s,onClick:()=>{h(m),i&&i(m,0,"primary")},classPrefix:"banner"})),p!=="square"&&m.dismissible&&xe.createElement(ur,{type:p,className:l("bannerDismissButtonContainer",s)},xe.createElement(mr,{type:p,onClick:async()=>{await x(e),n&&n()},className:l("bannerDismissButton",s)},xe.createElement(ke,null)))))};import J,{useEffect as yd}from"react";import{Portal as bd}from"react-portal";import Re from"styled-components";var Gs=Re.div`
|
|
1518
|
+
${e=>k(e)} {
|
|
1519
1519
|
display: flex;
|
|
1520
1520
|
flex-direction: column;
|
|
1521
1521
|
width: 100%;
|
|
@@ -1527,7 +1527,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1527
1527
|
border-width: 1px;
|
|
1528
1528
|
border-color: ${e=>e.appearance.theme.colorBorder};
|
|
1529
1529
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1530
|
-
position: fixed;
|
|
1530
|
+
position: ${e=>e.type=="modal"?"fixed":"relative"};
|
|
1531
1531
|
left: 50%;
|
|
1532
1532
|
transform: translate(-50%);
|
|
1533
1533
|
bottom: 24px;
|
|
@@ -1573,14 +1573,14 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1573
1573
|
display: flex;
|
|
1574
1574
|
flex-direction: column;
|
|
1575
1575
|
flex: 1;
|
|
1576
|
-
`,
|
|
1576
|
+
`,fy=Re.div`
|
|
1577
1577
|
display: flex;
|
|
1578
1578
|
flex-direction: column;
|
|
1579
1579
|
justify-content: center;
|
|
1580
1580
|
align-items: flex-start;
|
|
1581
1581
|
margin-top: 16px;
|
|
1582
1582
|
`,Ys=Re.textarea`
|
|
1583
|
-
${e=>
|
|
1583
|
+
${e=>k(e)} {
|
|
1584
1584
|
margin-top: 16px;
|
|
1585
1585
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1586
1586
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
@@ -1591,7 +1591,7 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1591
1591
|
height: 100px;
|
|
1592
1592
|
}
|
|
1593
1593
|
`,Js=Re.div`
|
|
1594
|
-
${e=>
|
|
1594
|
+
${e=>k(e)} {
|
|
1595
1595
|
position: absolute;
|
|
1596
1596
|
top: 16px;
|
|
1597
1597
|
right: 16px;
|
|
@@ -1601,5 +1601,5 @@ ${n=>n.inlineStyles.map(([r,i])=>`.${Vt}${r}.${Vt}${r} { ${Object.entries(i).map
|
|
|
1601
1601
|
opacity: 0.8;
|
|
1602
1602
|
}
|
|
1603
1603
|
}
|
|
1604
|
-
`;var
|
|
1604
|
+
`;var wd=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:n,appearance:r,className:i,style:s,type:p="modal"})=>{let{getFlow:d,markFlowCompleted:a,markStepCompleted:x,getNumberOfStepsCompleted:c,isLoading:f,targetingLogicShouldHideFlow:S,updateCustomVariables:T,getFlowSteps:P,getFlowStatus:g,getCurrentStepIndex:v}=ee(),{primaryCTAClickSideEffects:h}=le(),{mergeAppearanceWithDefault:F}=te(),[I,y]=J.useState(null),[m,w]=J.useState(""),{hasOpenModals:C,setKeepCompletedFlowOpenDuringSession:E,shouldKeepCompletedFlowOpenDuringSession:O}=Fe();if(r=F(r),yd(()=>{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 J.createElement(J.Fragment,null,J.createElement(hr,null,J.createElement(Se,{size:"large",appearance:r,title:L.title,subtitle:L.subtitle})),J.createElement(fr,{className:l("npsNumberButtonContainer",r),appearance:r},Array.from(Array(10).keys()).map(Q=>J.createElement(qs,{className:l("npsNumberButton",r),selected:I===Q+1,key:Q,onClick:async()=>{E(e),y(Q+1),await x(e,L.id,{score:Q+1})},appearance:r},Q+1))),J.createElement(Ks,{appearance:r},J.createElement(gr,{appearance:r},"Not likely at all"),J.createElement(gr,{appearance:r},"Extremely likely")))}function $(){return J.createElement(J.Fragment,null,J.createElement(hr,null,J.createElement(Se,{appearance:r,title:"Why did you choose this score?",size:"large"})),J.createElement(Ys,{appearance:r,value:m,onChange:Q=>{w(Q.target.value)},placeHolder:"Add your optional fedback here..."}),J.createElement(fr,{appearance:r,className:l("npsNumberButtonContainer",r)},J.createElement(ne,{size:"large",withMargin:!1,onClick:async()=>{await a(e),n&&n(L,1,"primary")},appearance:r,title:L.secondaryButtonTitle||"Skip",secondary:!0}),J.createElement(ne,{size:"large",withMargin:!1,onClick:async()=>{await x(e,L.id,{feedbackText:m}),await a(e),n&&n(L,1,"primary")},appearance:r,title:L.primaryButtonTitle||"Submit"})))}function X(){return J.createElement(J.Fragment,null,J.createElement(se,{appearance:r}),J.createElement(Gs,{appearance:r,className:Ce(l("npsSurveyContainer",r),i),style:s,type:p},J.createElement(Js,{onClick:async()=>{await a(e),t&&t()},className:l("npsSurveyDismissButton",r)},J.createElement(ke,null)),c(e)==0&&H(),c(e)==1&&$()))}return p==="inline"?X():J.createElement(bd,null,X())};export{Ke as CheckBox,rt as FormLabel,jo as FormTextField,Sd as FrigadeBanner,dr as FrigadeChecklist,qe as FrigadeDefaultAppearance,xd as FrigadeEmbeddedTip,wi as FrigadeForm,Jp as FrigadeGuide,jp as FrigadeHeroChecklist,wd as FrigadeNPSSurvey,Kp as FrigadeProgressBadge,qa as FrigadeProvider,gd as FrigadeSupportWidget,dd as FrigadeTour,vt as ProgressRing,Fe as useFlowOpens,Wt as useFlowResponses,ee as useFlows,er as useOrganization,Ht as useUser};
|
|
1605
1605
|
//# sourceMappingURL=index.mjs.map
|