@frigade/react 1.35.6 → 1.35.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +213 -212
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +214 -213
- 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 bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import{ThemeProvider as _p}from"styled-components";import St,{useContext as gp,useEffect as Oo,useState as ur}from"react";import{useCallback as xt,useContext as zl,useEffect as Wl}from"react";import qo,{useMemo as Dr}from"react";var Lr="1.35.6 ";var Oe="NOT_STARTED_STEP",q="COMPLETED_FLOW",go="ABORTED_FLOW",gt="STARTED_FLOW",Me="NOT_STARTED_FLOW",Ue="COMPLETED_STEP",xo="STARTED_STEP";function _e(){let{publicApiKey:e,userId:t,apiUrl:o}=qo.useContext(K);return{config:Dr(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Lr,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:Dr(()=>`${o}/v1/public/`,[o])}}var vl="frigade-last-call-at-",Bl="frigade-last-call-data-";function Et(){let{shouldGracefullyDegrade:e,readonly:t}=qo.useContext(K);return async(o,i)=>{if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Bt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Bt();let r=vl+o,n=Bl+o;if(window&&window.localStorage&&i&&i.body&&i.method==="POST"){let p=window.localStorage.getItem(r),c=window.localStorage.getItem(n);if(p&&c&&c==i.body){let a=new Date(p);if(new Date().getTime()-a.getTime()<1e3)return Bt()}window.localStorage.setItem(r,new Date().toISOString()),window.localStorage.setItem(n,i.body)}let s;try{s=await fetch(o,i)}catch(p){return Bt(p)}return s?s.ok?s:Bt(s.statusText):Bt()}}function Bt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function At(){let{publicApiKey:e,shouldGracefullyDegrade:t}=qo.useContext(K);function o(){return t?(console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize"),!1):e?!0:(console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider"),!1)}return{verifySDKInitiated:o}}import{useContext as $l,useState as $r}from"react";import{useContext as Al,useEffect as Nl,useState as Il}from"react";import Ol from"swr";import{useContext as El}from"react";function Te(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:r}=El(K);function n(d,x=!1){return e[d]??x}function s(d,x){t(S=>({...S,[d]:x}))}function p(d){t(x=>{let{[d]:S,...w}=x;return{...w}})}function c(d){r.includes(d)||i(x=>[...x,d])}function a(d){return r.includes(d)}function g(d){return Object.entries(e).some(([x,S])=>S&&x!=d)||o}return{getOpenFlowState:n,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:g,setKeepCompletedFlowOpenDuringSession:c,shouldKeepCompletedFlowOpenDuringSession:a}}import Ll from"swr/immutable";var Dl="unknown";function Ee(){let{config:e,apiUrl:t}=_e(),{publicApiKey:o,userId:i,organizationId:r,flows:n,setShouldGracefullyDegrade:s,readonly:p}=Al(K),{resetOpenFlowState:c}=Te(),[a,g]=Il(!1),d={data:n.map(F=>({flowId:F.id,flowState:q,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},x=F=>fetch(F,e).then(k=>{if(k.ok)return k.json();throw new Error("Failed to fetch user flow states")}).catch(k=>(console.log(`Error fetching ${F}: ${k}. Will gracefully degrade and hide Frigade`),s(!0),d)),S=o&&n&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,{data:w,isLoading:P,mutate:f,error:E}=p?Ll(S,x):Ol(S,x,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),b=w==null?void 0:w.data;Nl(()=>{!a&&!P&&b&&g(!0)},[b,a,P]);async function y(F){if(b&&!p){let k=b.find(O=>O.flowId===F);k&&k.flowState!==q&&(k.flowState=q),await f(Promise.resolve({...w,data:b}),{optimisticData:{...w,data:b},revalidate:!1,rollbackOnError:!1})}}async function A(F,k,O){if(b){let N=b.find(I=>I.flowId===F);N&&(N.stepStates[k]=O,N.flowState=gt),await f(Promise.resolve({...w,data:b}),{optimisticData:{...w,data:b},revalidate:!1,rollbackOnError:!1})}}async function h(F,k,O){if(b){let N=b.find(I=>I.flowId===F);N&&(N.lastStepId=k,N.stepStates[k]=O,N.flowState=gt),await f({...w,data:b},{optimisticData:{...w,data:b},revalidate:!1,rollbackOnError:!1})}}async function m(F){if(b){let k=b.find(O=>O.flowId===F);k&&k.flowState!==Me&&(k.flowState=Me,k.lastStepId=Dl,Object.keys(k.stepStates).forEach(O=>{k.stepStates[O].actionType=Oe,k.stepStates[O].createdAt=new Date().toISOString()}),await f({...w,data:b},{optimisticData:{...w,data:b},revalidate:!1,rollbackOnError:!1}),c(F))}}async function B(F,k){if(b){let O=b.find(N=>N.flowId===F);O&&O.stepStates[k]!==Oe&&(O.stepStates[k]=Oe),await f({...w,data:b},{optimisticData:{...w,data:b},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:b,isLoadingUserFlowStateData:!a,mutateUserFlowState:f,optimisticallyMarkFlowCompleted:y,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:A,optimisticallyMarkStepNotStarted:B,optimisticallyMarkStepStarted:h,error:E}}function qt(){let{config:e,apiUrl:t}=_e(),{userFlowStatesData:o,mutateUserFlowState:i}=Ee(),{failedFlowResponses:r,setFailedFlowResponses:n,flowResponses:s,setFlowResponses:p}=$l(K),[c,a]=$r(new Set),[g,d]=$r(new Set),x=Et();function S(f){let E=JSON.stringify(f);if(c.has(E))return null;c.add(E),a(c),g.add(f),d(g);let b=s==null?void 0:s.find(y=>y.flowSlug===f.flowSlug&&y.stepId===f.stepId&&y.actionType===f.actionType&&y.createdAt===f.createdAt);return x(`${t}flowResponses`,{...e,method:"POST",body:E}).then(y=>{y.status!==200&&y.status!==201?(console.log("Failed to send flow response for step "+f.stepId+". Will retry again later."),n([...r,f])):b||p(A=>[...A??[],f])})}async function w(f){f.foreignUserId&&(f.actionType===gt||f.actionType===Me?await S(f):f.actionType===q?await S(f):f.actionType===xo?await S(f):f.actionType===Ue?await S(f):f.actionType===go?await S(f):f.actionType===Oe&&await S(f))}function P(){let f=[];return o==null||o.forEach(E=>{if(E&&E.stepStates&&Object.keys(E.stepStates).length!==0)for(let b in E.stepStates){let y=E.stepStates[b];f.push({foreignUserId:E.foreignUserId,flowSlug:E.flowId,stepId:y.stepId,actionType:y.actionType,data:{},createdAt:new Date(y.createdAt),blocked:y.blocked,hidden:y.hidden})}}),[...f,...s]}return{addResponse:w,setFlowResponses:p,getFlowResponses:P}}import _l from"swr";var Ml=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Mr=e=>{let t=Ml.exec(e);if(t===null)return null;let o=null;return t.forEach((i,r)=>{let n=Ul(i,"'","");n.startsWith("flow_")&&(o=n)}),o},Ul=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function Y(){let{config:e,apiUrl:t}=_e(),{flows:o,setFlows:i,userId:r,publicApiKey:n,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:a,setFlowResponses:g,setShouldGracefullyDegrade:d,readonly:x}=zl(K),S={data:[]},{verifySDKInitiated:w}=At(),{addResponse:P,getFlowResponses:f}=qt(),E=u=>fetch(u,e).then(C=>C.ok?C.json():(console.log(`Error fetching ${u} (${C.status}): ${C.statusText}. .Will gracefully degrade and hide Frigade`),d(!0),S)).catch(C=>(console.log(`Error fetching ${u}: ${C}. Will gracefully degrade and hide Frigade`),d(!0),S)),{mutateUserFlowState:b,userFlowStatesData:y,isLoadingUserFlowStateData:A,optimisticallyMarkFlowCompleted:h,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:B,optimisticallyMarkStepNotStarted:F,optimisticallyMarkStepStarted:k}=Ee(),{data:O,error:N,isLoading:I}=_l(n?`${t}flows${x?"?readonly=true":""}`:null,E,{keepPreviousData:!0});Wl(()=>{if(N){console.error(N);return}O&&O.data&&i(O.data)},[O,N]);function $(u){if(I)return null;let C=o.find(v=>v.slug===u);return!C&&o.length>0&&!A&&!I?(console.log(`Flow with slug ${u} not found`),null):(C==null?void 0:C.active)===!1?null:C}function D(u){var W;if(!$(u))return[];let C=$(u).data;return C?(C=ee(C),(((W=JSON.parse(C))==null?void 0:W.data)??[]).map(ye=>{let Or=se(ye);return{handleSecondaryButtonClick:()=>{ye.skippable===!0&&H(u,ye.id,{skipped:!0})},...ye,complete:ge(u,ye.id)===Ue||Or>=1,blocked:re(u,ye.id),hidden:L(u,ye.id),handlePrimaryButtonClick:()=>{(!ye.completionCriteria&&(ye.autoMarkCompleted||ye.autoMarkCompleted===void 0)||ye.completionCriteria&&ye.autoMarkCompleted===!0)&&H(u,ye.id)},progress:Or}}).filter(ye=>ye.hidden!==!0)):[]}function ee(u){return u.replaceAll(/\${(.*?)}/g,(C,v)=>s[v]===void 0?"":String(s[v]).replace(/[\u00A0-\u9999<>\&]/g,function(W){return"&#"+W.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 M(u){if(!$(u))return[];let C=$(u).data;return C?(C=ee(C),JSON.parse(C)??{}):[]}function te(u,C){p(v=>({...v,[u]:C}))}function fe(u){!A&&!I&&u&&JSON.stringify(s)!=JSON.stringify({...s,...u})&&Object.keys(u).forEach(C=>{te(C,u[C])})}let X=xt(async(u,C,v)=>{if(!w())return;let W={foreignUserId:r,flowSlug:u,stepId:C,actionType:xo,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await k(u,C,W),P(W))},[r,y]),_=xt(async(u,C,v)=>{if(!w())return;let W={foreignUserId:r,flowSlug:u,stepId:C,actionType:Oe,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await F(u,C),P(W))},[r,y]),H=xt(async(u,C,v)=>{if(!w())return;let W={foreignUserId:r,flowSlug:u,stepId:C,actionType:Ue,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await B(u,C,W),P(W))},[r,y]),Ce=xt(async(u,C)=>{if(!w()||pe(u)===Me)return;let v={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:Me,data:C??{},createdAt:new Date,blocked:!1,hidden:!1};await m(u),J(v)&&P(v)},[r,y]),Ie=xt(async(u,C)=>{if(!w())return;let v={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:gt,data:C??{},createdAt:new Date,blocked:!1,hidden:!1};J(v)&&P(v)},[r,y]),we=xt(async(u,C)=>{if(!w())return;let v={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:q,data:C??{},createdAt:new Date,blocked:!1,hidden:!1};J(v)&&(await h(u),P(v))},[r,y]),me=xt(async(u,C)=>{if(!w())return;let v={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:go,data:C??{},createdAt:new Date,blocked:!1,hidden:!1};J(v)&&(await h(u),P(v))},[r,y]);function J(u){var C;if(!y&&u.actionType===Oe)return!1;if(y){let v=y.find(W=>W.flowId===u.flowSlug);if(u.actionType===Oe&&(!(v!=null&&v.stepStates[u.stepId])||v.stepStates[u.stepId].actionType===Oe)||v&&((C=v.stepStates[u.stepId])==null?void 0:C.actionType)===u.actionType||v&&v.flowState===q&&u.actionType===q)return!1}return!0}function ge(u,C){let v=j(u,C);return A?null:v?v.actionType:Oe}function re(u,C){let v=j(u,C);return v?v.blocked:!1}function L(u,C){let v=j(u,C);return v?v.hidden:!1}function j(u,C){if(A)return null;let v=y==null?void 0:y.find(W=>W.flowId===u);return!v||!v.stepStates[C]?null:v.stepStates[C]??null}function V(u){var v;if(A||!y)return null;if(pe(u)===Me)return D(u)[0]??null;let C=(v=y.find(W=>W.flowId===u))==null?void 0:v.lastStepId;return C?D(u).find(W=>W.id===C):null}function ne(u){let C=V(u);if(!C)return 0;let v=D(u).findIndex(W=>W.id===C.id)??0;return ge(u,C.id)===Ue&&v<D(u).length-1?v+1:v}function se(u){if(!u.completionCriteria)return;let C=Mr(u.completionCriteria);if(C===null)return;let v=Ye(C),W=$e(C);return W===0?void 0:v/W}function pe(u){let C=y==null?void 0:y.find(v=>v.flowId===u);return C?C.flowState:null}function Ye(u){let C=D(u);return C.length===0?0:C.filter(W=>ge(u,W.id)===Ue).length}function $e(u){return D(u).length}function G(u){let C=o.find(v=>v.slug===u);return C?JSON.parse(C.data):null}function Be(u){if(x)return!1;if(A)return!0;if(u!=null&&u.targetingLogic&&y){let C=y.find(v=>v.flowId===u.slug);if(C)return C.shouldTrigger===!1}return!!(u!=null&&u.targetingLogic&&r&&r.startsWith("guest_"))}function Kt(u){return!Be($(u))}function fo(){r&&b()}return{getFlow:$,getFlowData:G,isLoading:A||I,getStepStatus:ge,getFlowSteps:D,getCurrentStepIndex:ne,markStepStarted:X,markStepCompleted:H,markFlowNotStarted:Ce,markFlowStarted:Ie,markFlowCompleted:we,markFlowAborted:me,markStepNotStarted:_,getFlowStatus:pe,getNumberOfStepsCompleted:Ye,getNumberOfSteps:$e,targetingLogicShouldHideFlow:Be,setCustomVariable:te,updateCustomVariables:fe,customVariables:s,getStepOptionalProgress:se,getFlowMetadata:M,isStepBlocked:re,isStepHidden:L,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:a,isFlowAvailableToUser:Kt,refresh:fo}}import{useCallback as Ur,useContext as Hl,useEffect as jl}from"react";var Nt="guest_";function Yt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=Hl(K),{config:n,apiUrl:s}=_e(),{mutateUserFlowState:p}=Ee(),c=Et(),{verifySDKInitiated:a}=At();jl(()=>{if(e&&!t){if(e.startsWith(Nt))return;let x=`frigade-user-registered-${e}`;localStorage.getItem(x)||(c(`${s}users`,{...n,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(x,"true"))}},[e,r,t]);let g=Ur(async x=>{if(!a())return;let S={foreignId:e,properties:x};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(S)}),i(w=>({...w,...x})),p()},[e,n,r,p]),d=Ur(async(x,S)=>{if(!a())return;let P={foreignId:e,events:[{event:x,properties:S}]};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(P)}),p()},[e,n,p]);return{userId:e,setUserId:o,addPropertiesToUser:g,trackEventForUser:d}}import{v4 as xp}from"uuid";import Ge,{useEffect as cp,useState as mp}from"react";import ze,{useEffect as Zl}from"react";import yo from"styled-components";import Vl from"react";import Gl from"styled-components";var zr="fr-",Xt="cfr-";function l(e,t){let o=`${zr}${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+" "+Xt+e}return o}function T(e){if(!e.className||e.className.indexOf(Xt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(zr)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Yo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function Xe(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Yo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function xe(...e){return e.filter(Boolean).join(" ")}function Jt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Kl=Gl.div`
|
|
2
|
+
import wt,{createContext as _p,useEffect as $o,useState as Ie}from"react";import{ThemeProvider as Hp}from"styled-components";import bt,{useContext as xp,useEffect as Lo,useState as fr}from"react";import{useCallback as ht,useContext as Wl,useEffect as _l}from"react";import Yo,{useMemo as Dr}from"react";var Lr="1.35.8 ";var Ne="NOT_STARTED_STEP",q="COMPLETED_FLOW",xo="ABORTED_FLOW",xt="STARTED_FLOW",$e="NOT_STARTED_FLOW",Me="COMPLETED_STEP",ho="STARTED_STEP";function We(){let{publicApiKey:e,userId:t,apiUrl:o}=Yo.useContext(K);return{config:Dr(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":Lr,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:Dr(()=>`${o}/v1/public/`,[o])}}var Bl="frigade-last-call-at-",El="frigade-last-call-data-";function It(){let{shouldGracefullyDegrade:e,readonly:t}=Yo.useContext(K);return async(o,i)=>{if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Nt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Nt();let r=Bl+o,n=El+o;if(window&&window.localStorage&&i&&i.body&&i.method==="POST"){let p=window.localStorage.getItem(r),c=window.localStorage.getItem(n);if(p&&c&&c==i.body){let a=new Date(p);if(new Date().getTime()-a.getTime()<1e3)return Nt()}window.localStorage.setItem(r,new Date().toISOString()),window.localStorage.setItem(n,i.body)}let s;try{s=await fetch(o,i)}catch(p){return Nt(p)}return s?s.ok?s:Nt(s.statusText):Nt()}}function Nt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Ot(){let{publicApiKey:e,shouldGracefullyDegrade:t}=Yo.useContext(K);function o(){return t?(console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize"),!1):e?!0:(console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider"),!1)}return{verifySDKInitiated:o}}import{useContext as Ml,useState as $r}from"react";import{useContext as Nl,useEffect as Il,useState as Ol}from"react";import Ll from"swr";import{useContext as Al}from"react";function we(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:r}=Al(K);function n(d,x=!1){return e[d]??x}function s(d,x){t(b=>({...b,[d]:x}))}function p(d){t(x=>{let{[d]:b,...w}=x;return{...w}})}function c(d){r.includes(d)||i(x=>[...x,d])}function a(d){return r.includes(d)}function g(d){return Object.entries(e).some(([x,b])=>b&&x!=d)||o}return{getOpenFlowState:n,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:g,setKeepCompletedFlowOpenDuringSession:c,shouldKeepCompletedFlowOpenDuringSession:a}}import Dl from"swr/immutable";var $l="unknown";function ve(){let{config:e,apiUrl:t}=We(),{publicApiKey:o,userId:i,organizationId:r,flows:n,setShouldGracefullyDegrade:s,readonly:p}=Nl(K),{resetOpenFlowState:c}=we(),[a,g]=Ol(!1),d={data:n.map(F=>({flowId:F.id,flowState:q,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},x=F=>fetch(F,e).then(k=>{if(k.ok)return k.json();throw new Error("Failed to fetch user flow states")}).catch(k=>(console.log(`Error fetching ${F}: ${k}. Will gracefully degrade and hide Frigade`),s(!0),d)),b=o&&n&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,{data:w,isLoading:v,mutate:f,error:E}=p?Dl(b,x):Ll(b,x,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),S=w==null?void 0:w.data;Il(()=>{!a&&!v&&S&&g(!0)},[S,a,v]);async function y(F){if(S&&!p){let k=S.find(O=>O.flowId===F);k&&k.flowState!==q&&(k.flowState=q),await f(Promise.resolve({...w,data:S}),{optimisticData:{...w,data:S},revalidate:!1,rollbackOnError:!1})}}async function A(F,k,O){if(S){let N=S.find(I=>I.flowId===F);N&&(N.stepStates[k]=O,N.flowState=xt),await f(Promise.resolve({...w,data:S}),{optimisticData:{...w,data:S},revalidate:!1,rollbackOnError:!1})}}async function C(F,k,O){if(S){let N=S.find(I=>I.flowId===F);N&&(N.lastStepId=k,N.stepStates[k]=O,N.flowState=xt),await f({...w,data:S},{optimisticData:{...w,data:S},revalidate:!1,rollbackOnError:!1})}}async function m(F){if(S){let k=S.find(O=>O.flowId===F);k&&k.flowState!==$e&&(k.flowState=$e,k.lastStepId=$l,Object.keys(k.stepStates).forEach(O=>{k.stepStates[O].actionType=Ne,k.stepStates[O].createdAt=new Date().toISOString()}),await f({...w,data:S},{optimisticData:{...w,data:S},revalidate:!1,rollbackOnError:!1}),c(F))}}async function B(F,k){if(S){let O=S.find(N=>N.flowId===F);O&&O.stepStates[k]!==Ne&&(O.stepStates[k]=Ne),await f({...w,data:S},{optimisticData:{...w,data:S},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:S,isLoadingUserFlowStateData:!a,mutateUserFlowState:f,optimisticallyMarkFlowCompleted:y,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:A,optimisticallyMarkStepNotStarted:B,optimisticallyMarkStepStarted:C,error:E}}function Xt(){let{config:e,apiUrl:t}=We(),{userFlowStatesData:o,mutateUserFlowState:i}=ve(),{failedFlowResponses:r,setFailedFlowResponses:n,flowResponses:s,setFlowResponses:p}=Ml(K),[c,a]=$r(new Set),[g,d]=$r(new Set),x=It();function b(f){let E=JSON.stringify(f);if(c.has(E))return null;c.add(E),a(c),g.add(f),d(g);let S=s==null?void 0:s.find(y=>y.flowSlug===f.flowSlug&&y.stepId===f.stepId&&y.actionType===f.actionType&&y.createdAt===f.createdAt);return x(`${t}flowResponses`,{...e,method:"POST",body:E}).then(y=>{y.status!==200&&y.status!==201?(console.log("Failed to send flow response for step "+f.stepId+". Will retry again later."),n([...r,f])):S||p(A=>[...A??[],f])})}async function w(f){f.foreignUserId&&(f.actionType===xt||f.actionType===$e?await b(f):f.actionType===q?await b(f):f.actionType===ho?await b(f):f.actionType===Me?await b(f):f.actionType===xo?await b(f):f.actionType===Ne&&await b(f))}function v(){let f=[];return o==null||o.forEach(E=>{if(E&&E.stepStates&&Object.keys(E.stepStates).length!==0)for(let S in E.stepStates){let y=E.stepStates[S];f.push({foreignUserId:E.foreignUserId,flowSlug:E.flowId,stepId:y.stepId,actionType:y.actionType,data:{},createdAt:new Date(y.createdAt),blocked:y.blocked,hidden:y.hidden})}}),[...f,...s]}return{addResponse:w,setFlowResponses:p,getFlowResponses:v}}import Hl from"swr";var Ul=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Mr=e=>{let t=Ul.exec(e);if(t===null)return null;let o=null;return t.forEach((i,r)=>{let n=zl(i,"'","");n.startsWith("flow_")&&(o=n)}),o},zl=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function Y(){let{config:e,apiUrl:t}=We(),{flows:o,setFlows:i,userId:r,publicApiKey:n,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:a,setFlowResponses:g,setShouldGracefullyDegrade:d,readonly:x}=Wl(K),b={data:[]},{verifySDKInitiated:w}=Ot(),{addResponse:v,getFlowResponses:f}=Xt(),E=u=>fetch(u,e).then(h=>h.ok?h.json():(console.log(`Error fetching ${u} (${h.status}): ${h.statusText}. .Will gracefully degrade and hide Frigade`),d(!0),b)).catch(h=>(console.log(`Error fetching ${u}: ${h}. Will gracefully degrade and hide Frigade`),d(!0),b)),{mutateUserFlowState:S,userFlowStatesData:y,isLoadingUserFlowStateData:A,optimisticallyMarkFlowCompleted:C,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:B,optimisticallyMarkStepNotStarted:F,optimisticallyMarkStepStarted:k}=ve(),{data:O,error:N,isLoading:I}=Hl(n?`${t}flows${x?"?readonly=true":""}`:null,E,{keepPreviousData:!0});_l(()=>{if(N){console.error(N);return}O&&O.data&&i(O.data)},[O,N]);function $(u){if(I)return null;let h=o.find(P=>P.slug===u);return!h&&o.length>0&&!A&&!I?(console.log(`Flow with slug ${u} not found`),null):(h==null?void 0:h.active)===!1?null:h}function D(u){var W;if(!$(u))return[];let h=$(u).data;return h?(h=ee(h),(((W=JSON.parse(h))==null?void 0:W.data)??[]).map(M=>{let De=se(M);return{handleSecondaryButtonClick:()=>{M.skippable===!0&&j(u,M.id,{skipped:!0})},...M,complete:ge(u,M.id)===Me||De>=1,blocked:re(u,M.id),hidden:L(u,M.id),handlePrimaryButtonClick:()=>{(!M.completionCriteria&&(M.autoMarkCompleted||M.autoMarkCompleted===void 0)||M.completionCriteria&&M.autoMarkCompleted===!0)&&j(u,M.id)},progress:De}}).filter(M=>M.hidden!==!0)):[]}function ee(u){return u.replaceAll(/\${(.*?)}/g,(h,P)=>s[P]===void 0?"":String(s[P]).replace(/[\u00A0-\u9999<>\&]/g,function(W){return"&#"+W.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(u){if(!$(u))return[];let h=$(u).data;return h?(h=ee(h),JSON.parse(h)??{}):[]}function te(u,h){p(P=>({...P,[u]:h}))}function fe(u){!A&&!I&&u&&JSON.stringify(s)!=JSON.stringify({...s,...u})&&Object.keys(u).forEach(h=>{te(h,u[h])})}let X=ht(async(u,h,P)=>{if(!w())return;let W={foreignUserId:r,flowSlug:u,stepId:h,actionType:ho,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await k(u,h,W),v(W))},[r,y]),H=ht(async(u,h,P)=>{if(!w())return;let W={foreignUserId:r,flowSlug:u,stepId:h,actionType:Ne,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await F(u,h),v(W))},[r,y]),j=ht(async(u,h,P)=>{if(!w())return;let W={foreignUserId:r,flowSlug:u,stepId:h,actionType:Me,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await B(u,h,W),v(W))},[r,y]),Ce=ht(async(u,h)=>{if(!w()||pe(u)===$e)return;let P={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:$e,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};await m(u),J(P)&&v(P)},[r,y]),Ae=ht(async(u,h)=>{if(!w())return;let P={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:xt,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&v(P)},[r,y]),be=ht(async(u,h)=>{if(!w())return;let P={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:q,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&(await C(u),v(P))},[r,y]),me=ht(async(u,h)=>{if(!w())return;let P={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:xo,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&(await C(u),v(P))},[r,y]);function J(u){var h;if(!y&&u.actionType===Ne)return!1;if(y){let P=y.find(W=>W.flowId===u.flowSlug);if(u.actionType===Ne&&(!(P!=null&&P.stepStates[u.stepId])||P.stepStates[u.stepId].actionType===Ne)||P&&((h=P.stepStates[u.stepId])==null?void 0:h.actionType)===u.actionType||P&&P.flowState===q&&u.actionType===q)return!1}return!0}function ge(u,h){let P=V(u,h);return A?null:P?P.actionType:Ne}function re(u,h){let P=V(u,h);return P?P.blocked:!1}function L(u,h){let P=V(u,h);return P?P.hidden:!1}function V(u,h){if(A)return null;let P=y==null?void 0:y.find(W=>W.flowId===u);return!P||!P.stepStates[h]?null:P.stepStates[h]??null}function G(u){var P;if(A||!y)return null;if(pe(u)===$e)return D(u)[0]??null;let h=(P=y.find(W=>W.flowId===u))==null?void 0:P.lastStepId;return h?D(u).find(W=>W.id===h):null}function ne(u){let h=G(u);if(!h)return 0;let P=D(u).findIndex(W=>W.id===h.id)??0;return ge(u,h.id)===Me&&P<D(u).length-1?P+1:P}function se(u){if(!u.completionCriteria)return;let h=Mr(u.completionCriteria);if(h===null)return;let P=qe(h),W=Le(h);return W===0?void 0:P/W}function pe(u){let h=y==null?void 0:y.find(P=>P.flowId===u);return h?h.flowState:null}function qe(u){let h=D(u);return h.length===0?0:h.filter(W=>ge(u,W.id)===Me).length}function Le(u){return D(u).length}function Et(u){let h=o.find(P=>P.slug===u);return h?JSON.parse(h.data):null}function ft(u){if(x)return!1;if(A)return!0;if(u!=null&&u.targetingLogic&&y){let h=y.find(P=>P.flowId===u.slug);if(h)return h.shouldTrigger===!1}return!!(u!=null&&u.targetingLogic&&r&&r.startsWith("guest_"))}function At(u){return!ft($(u))}function gt(){r&&S()}return{getFlow:$,getFlowData:Et,isLoading:A||I,getStepStatus:ge,getFlowSteps:D,getCurrentStepIndex:ne,markStepStarted:X,markStepCompleted:j,markFlowNotStarted:Ce,markFlowStarted:Ae,markFlowCompleted:be,markFlowAborted:me,markStepNotStarted:H,getFlowStatus:pe,getNumberOfStepsCompleted:qe,getNumberOfSteps:Le,targetingLogicShouldHideFlow:ft,setCustomVariable:te,updateCustomVariables:fe,customVariables:s,getStepOptionalProgress:se,getFlowMetadata:U,isStepBlocked:re,isStepHidden:L,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:a,isFlowAvailableToUser:At,refresh:gt}}import{useCallback as Ur,useContext as jl,useEffect as Vl}from"react";var Lt="guest_";function Jt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=jl(K),{config:n,apiUrl:s}=We(),{mutateUserFlowState:p}=ve(),c=It(),{verifySDKInitiated:a}=Ot();Vl(()=>{if(e&&!t){if(e.startsWith(Lt))return;let x=`frigade-user-registered-${e}`;localStorage.getItem(x)||(c(`${s}users`,{...n,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(x,"true"))}},[e,r,t]);let g=Ur(async x=>{if(!a())return;let b={foreignId:e,properties:x};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(b)}),i(w=>({...w,...x})),p()},[e,n,r,p]),d=Ur(async(x,b)=>{if(!a())return;let v={foreignId:e,events:[{event:x,properties:b}]};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(v)}),p()},[e,n,p]);return{userId:e,setUserId:o,addPropertiesToUser:g,trackEventForUser:d}}import{v4 as hp}from"uuid";import Ve,{useEffect as mp,useState as up}from"react";import Ue,{useEffect as Rl}from"react";import So from"styled-components";import Gl from"react";import Kl from"styled-components";var zr="fr-",Qt="cfr-";function l(e,t){let o=`${zr}${e}`;if(!t)return o;if(t.styleOverrides&&t.styleOverrides[e]){if(typeof t.styleOverrides[e]=="string")return o+" "+t.styleOverrides[e];if(typeof t.styleOverrides[e]=="object")return o+" "+Qt+e}return o}function T(e){if(!e.className||e.className.indexOf(Qt)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(zr)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Xo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function Ye(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Xo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function xe(...e){return e.filter(Boolean).join(" ")}function Zt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var ql=Kl.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -23,11 +23,11 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
23
23
|
opacity: 1;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
`,Wr=({onClose:e,appearance:t})=>
|
|
26
|
+
`,Wr=({onClose:e,appearance:t})=>Gl.createElement(ql,{className:l("modalBackground",t),onClick:()=>e()});import Jo from"react";import Yl from"styled-components";var Xl=Yl.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
|
-
`,
|
|
30
|
+
`,Te=()=>Jo.createElement(Xl,null,Jo.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 20 20"},Jo.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5 15L15 5M5 5l10 10"})));import{Portal as ea}from"react-portal";import Rr from"react";import Qo from"react";function Jl({style:e,className:t}){return Qo.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"54",height:"14",fill:"none",viewBox:"0 0 54 14",style:e,className:t},Qo.createElement("path",{fill:"currentColor",d:"M16.293 3.476v1.036h1.593v1.256h-1.593v5.098h-1.41V5.768H14V4.512h.883V3.244c0-.67.294-1.744 1.777-1.744.515 0 .969.049 1.361.146l-.233 1.232a5.939 5.939 0 00-.833-.073c-.442 0-.662.22-.662.67zm6.534.975V5.83c-.846 0-1.63.159-2.342.476v4.56h-1.41V4.513h1.263l.086.61c.846-.451 1.655-.67 2.403-.67zm2.505-.951c-.331.33-.944.33-1.287 0a.93.93 0 01-.246-.659c0-.268.086-.487.246-.646.343-.33.956-.33 1.287 0 .343.33.343.964 0 1.305zm.061 7.366h-1.41V4.512h1.41v6.354zm6.928-5.756c.246.146.368.402.368.756v4.976c0 1.804-.858 2.658-2.672 2.658-.92 0-1.753-.146-2.514-.439l.417-1.073c.674.22 1.336.33 1.974.33.98 0 1.385-.379 1.385-1.403v-.171c-.588.134-1.09.207-1.52.207-.907 0-1.655-.305-2.231-.902-.576-.598-.87-1.39-.87-2.354 0-.963.294-1.756.87-2.354.576-.61 1.324-.914 2.231-.914 1.005 0 1.864.232 2.562.683zm-2.488 4.634a5.15 5.15 0 001.446-.22V5.951a3.695 3.695 0 00-1.446-.292c-1.08 0-1.778.841-1.778 2.048 0 1.22.699 2.037 1.778 2.037zm7.34-5.317c1.52 0 2.28.878 2.28 2.634v3.805h-1.275l-.073-.524c-.601.414-1.288.621-2.084.621-1.263 0-2.06-.658-2.06-1.731 0-1.269 1.25-2.025 3.408-2.025.135 0 .503.013.662.013v-.171c0-1.012-.343-1.451-1.115-1.451-.675 0-1.435.158-2.256.475l-.466-1.012c1.017-.427 2.01-.634 2.979-.634zm-1.839 4.756c0 .427.343.695 1.017.695.528 0 1.251-.22 1.68-.512V8.22h-.441c-1.508 0-2.256.317-2.256.963zm9.953-4.549v-2.83h1.41v7.72c0 .354-.123.598-.368.757-.71.45-1.57.67-2.562.67-.907 0-1.655-.305-2.231-.902-.577-.61-.87-1.39-.87-2.354 0-.963.293-1.756.87-2.354.576-.61 1.324-.914 2.23-.914.43 0 .933.073 1.521.207zM43.84 9.72c.503 0 .981-.098 1.447-.293V5.854a5.15 5.15 0 00-1.447-.22c-1.078 0-1.777.817-1.777 2.037s.699 2.049 1.777 2.049zM54 7.866v.439h-4.573c.184.963.858 1.512 1.827 1.512.613 0 1.275-.146 1.986-.451l.466 1.024c-.87.378-1.729.573-2.575.573-.931 0-1.692-.304-2.268-.902-.576-.61-.87-1.402-.87-2.366 0-.975.294-1.768.87-2.366.576-.597 1.324-.902 2.244-.902.968 0 1.691.33 2.17.975.478.647.723 1.464.723 2.464zm-4.61-.586h3.298c-.086-1.073-.613-1.731-1.581-1.731-.969 0-1.582.695-1.717 1.731z"}),Qo.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M1.196 1.229A4.009 4.009 0 014.08 0l4.092.027C9.183.027 10 .867 10 1.904c0 .6-.273 1.133-.7 1.478-.31.25-.7.399-1.126.4h-.001l-4.09-.027h-.002a4.804 4.804 0 00-2.614.77A4.986 4.986 0 000 5.974v-1.78C0 3.036.456 1.988 1.196 1.23zm4.525 4.65a4.282 4.282 0 00-1.184 2.513l3.637.023c.131 0 .259-.015.382-.042h.002c.81-.178 1.42-.908 1.44-1.788v-.046a1.9 1.9 0 00-.533-1.328 1.813 1.813 0 00-.908-.508h-.002l-.002-.001a1.68 1.68 0 00-.366-.042A4.084 4.084 0 005.72 5.88zm-4.525-.016A4.235 4.235 0 000 8.829C0 10.997 1.601 12.78 3.654 13V9.265h-.005l.005-.439v-.437h.023a5.175 5.175 0 011.439-3.13 5.05 5.05 0 01.72-.614l-1.754-.011H4.08c-.787 0-1.521.229-2.144.625a4.11 4.11 0 00-.74.603z",clipRule:"evenodd"}))}var _r=Jl;import Zo from"styled-components";import Xe from"styled-components";var Co=Xe.div`
|
|
31
31
|
${e=>T(e)} {
|
|
32
32
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
33
33
|
}
|
|
@@ -38,7 +38,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
38
38
|
min-width: 300px;
|
|
39
39
|
z-index: ${e=>e.zIndex};
|
|
40
40
|
overflow: hidden;
|
|
41
|
-
`,
|
|
41
|
+
`,Ql=`
|
|
42
42
|
display: block;
|
|
43
43
|
cursor: pointer;
|
|
44
44
|
position: absolute;
|
|
@@ -50,17 +50,17 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
50
50
|
right: 12px;
|
|
51
51
|
:hover {
|
|
52
52
|
opacity: 0.8;
|
|
53
|
-
}`,
|
|
53
|
+
}`,Zl=`
|
|
54
54
|
display: block;
|
|
55
55
|
cursor: pointer;
|
|
56
56
|
position: absolute;
|
|
57
57
|
top: 12px;
|
|
58
58
|
right: 12px;
|
|
59
|
-
`,Hr=
|
|
59
|
+
`,Hr=Xe.div`
|
|
60
60
|
${e=>T(e)} {
|
|
61
|
-
${e=>e.hasImage?
|
|
61
|
+
${e=>e.hasImage?Ql:Zl};
|
|
62
62
|
}
|
|
63
|
-
`,jr=
|
|
63
|
+
`,jr=Xe.img`
|
|
64
64
|
${e=>T(e)} {
|
|
65
65
|
display: block;
|
|
66
66
|
width: 100%;
|
|
@@ -68,7 +68,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
68
68
|
min-height: 200px;
|
|
69
69
|
object-fit: cover;
|
|
70
70
|
}
|
|
71
|
-
`,Vr=
|
|
71
|
+
`,Vr=Xe.div`
|
|
72
72
|
${e=>T(e)} {
|
|
73
73
|
display: block;
|
|
74
74
|
width: 100%;
|
|
@@ -76,19 +76,19 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
76
76
|
margin-top: ${e=>e.dismissible?"24px":"0px"};
|
|
77
77
|
object-fit: cover;
|
|
78
78
|
}
|
|
79
|
-
`,Gr=
|
|
79
|
+
`,Gr=Xe.div`
|
|
80
80
|
display: flex;
|
|
81
81
|
flex-direction: row;
|
|
82
82
|
justify-content: space-between;
|
|
83
83
|
align-content: center;
|
|
84
|
-
`,Kr=
|
|
84
|
+
`,Kr=Xe.div`
|
|
85
85
|
padding: 22px 22px 12px;
|
|
86
|
-
`,qr=
|
|
86
|
+
`,qr=Xe.div`
|
|
87
87
|
display: flex;
|
|
88
88
|
flex: 1;
|
|
89
89
|
flex-direction: column;
|
|
90
90
|
justify-content: center;
|
|
91
|
-
`,Yr=
|
|
91
|
+
`,Yr=Xe.div`
|
|
92
92
|
display: flex;
|
|
93
93
|
flex: 2;
|
|
94
94
|
flex-shrink: 1;
|
|
@@ -100,7 +100,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
100
100
|
align-content: center;
|
|
101
101
|
align-items: center;
|
|
102
102
|
}
|
|
103
|
-
`,Xr=
|
|
103
|
+
`,Xr=Xe.p`
|
|
104
104
|
${e=>T(e)} {
|
|
105
105
|
font-style: normal;
|
|
106
106
|
font-weight: 600;
|
|
@@ -109,7 +109,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
109
109
|
color: #808080;
|
|
110
110
|
}
|
|
111
111
|
margin: 0;
|
|
112
|
-
`;var Jr=
|
|
112
|
+
`;var Jr=Zo.div`
|
|
113
113
|
background-color: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
114
114
|
position: absolute;
|
|
115
115
|
bottom: -47px;
|
|
@@ -120,7 +120,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
120
120
|
align-items: center;
|
|
121
121
|
justify-content: center;
|
|
122
122
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
123
|
-
`,Qr=
|
|
123
|
+
`,Qr=Zo(Co)`
|
|
124
124
|
background-color: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
125
125
|
position: absolute;
|
|
126
126
|
bottom: -60px;
|
|
@@ -133,7 +133,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
133
133
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
134
134
|
padding: 0;
|
|
135
135
|
z-index: ${e=>e.zIndex};
|
|
136
|
-
`,Zr=
|
|
136
|
+
`,Zr=Zo.div`
|
|
137
137
|
display: flex;
|
|
138
138
|
justify-content: center;
|
|
139
139
|
align-items: center;
|
|
@@ -142,7 +142,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
142
142
|
font-size: 12px;
|
|
143
143
|
line-height: 18px;
|
|
144
144
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
145
|
-
`;function
|
|
145
|
+
`;function yo({appearance:e}){return Rr.createElement(Zr,{className:l("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",Rr.createElement(_r,null))}var ta=So.div`
|
|
146
146
|
${e=>T(e)} {
|
|
147
147
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
148
148
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -157,7 +157,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
157
157
|
width: ${e=>e.width??"1000px"};
|
|
158
158
|
z-index: 1500;
|
|
159
159
|
border-radius: ${e=>{var t,o;return((o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius)??8}}px;
|
|
160
|
-
${e=>
|
|
160
|
+
${e=>Ye(e)}
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
padding: 32px;
|
|
@@ -184,10 +184,10 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
184
184
|
opacity: 1;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
`,
|
|
187
|
+
`,oa=So.div`
|
|
188
188
|
position: relative;
|
|
189
189
|
flex: 0 1 auto;
|
|
190
|
-
`,
|
|
190
|
+
`,ra=So.div`
|
|
191
191
|
position: absolute;
|
|
192
192
|
top: 16px;
|
|
193
193
|
right: 16px;
|
|
@@ -197,14 +197,14 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
197
197
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
198
198
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
199
199
|
}
|
|
200
|
-
`,
|
|
200
|
+
`,ia=So.div`
|
|
201
201
|
overflow: scroll;
|
|
202
202
|
flex: 1 1;
|
|
203
203
|
display: flex;
|
|
204
204
|
::-webkit-scrollbar {
|
|
205
205
|
display: none;
|
|
206
206
|
}
|
|
207
|
-
`,
|
|
207
|
+
`,_e=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:r,appearance:n,dismissible:s=!0,showFrigadeBranding:p=!1})=>(Rl(()=>{let c=a=>{a.key==="Escape"&&e()};return document.addEventListener("keydown",c),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",c)}},[e,t]),t?Ue.createElement(ea,null,Ue.createElement(Wr,{appearance:n,onClose:()=>{s&&e()}}),Ue.createElement(ta,{appearance:n,className:l("modalContainer",n),styleOverrides:i},s&&Ue.createElement(ra,{className:l("modalClose",n),onClick:()=>e(),appearance:n},Ue.createElement(Te,null)),o&&Ue.createElement(oa,null,o),Ue.createElement(ia,null,r),p&&Ue.createElement(Jr,{appearance:n,className:l("poweredByFrigadeRibbon",n)},Ue.createElement(yo,{appearance:n})))):Ue.createElement(Ue.Fragment,null));import nt,{useEffect as na}from"react";import bo from"styled-components";import{Portal as sa}from"react-portal";function la(e){switch(e){case"top-left":return`
|
|
208
208
|
top: 0;
|
|
209
209
|
left: 0;
|
|
210
210
|
`;case"top-right":return`
|
|
@@ -213,7 +213,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
213
213
|
`;case"bottom-left":return`
|
|
214
214
|
bottom: 0;
|
|
215
215
|
left: 0;
|
|
216
|
-
`}return"right: 0; bottom: 0;"}var
|
|
216
|
+
`}return"right: 0; bottom: 0;"}var aa=bo.div`
|
|
217
217
|
${e=>T(e)} {
|
|
218
218
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
219
219
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -227,12 +227,12 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
227
227
|
width: 350px;
|
|
228
228
|
padding: 24px;
|
|
229
229
|
}
|
|
230
|
-
${e=>
|
|
230
|
+
${e=>la(e.modalPosition)}
|
|
231
231
|
margin: 28px;
|
|
232
|
-
`,
|
|
232
|
+
`,pa=bo.div`
|
|
233
233
|
position: relative;
|
|
234
234
|
flex: 1;
|
|
235
|
-
`,
|
|
235
|
+
`,da=bo.div`
|
|
236
236
|
position: absolute;
|
|
237
237
|
top: 16px;
|
|
238
238
|
right: 16px;
|
|
@@ -242,13 +242,13 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
242
242
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
243
243
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
244
244
|
}
|
|
245
|
-
`,
|
|
245
|
+
`,ca=bo.div`
|
|
246
246
|
overflow: scroll;
|
|
247
247
|
flex: 5;
|
|
248
248
|
::-webkit-scrollbar {
|
|
249
249
|
display: none;
|
|
250
250
|
}
|
|
251
|
-
`,
|
|
251
|
+
`,wo=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:r,modalPosition:n="bottom-right",dismissible:s=!0})=>(na(()=>{if(!s)return;let p=c=>{c.key==="Escape"&&e()};return document.addEventListener("keydown",p),t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset",document.removeEventListener("keydown",p)}},[e,t]),t?nt.createElement(sa,null,nt.createElement(aa,{appearance:r,className:l("cornerModalContainer",r),modalPosition:n},s&&nt.createElement(da,{className:l("cornerModalClose",r),onClick:()=>e()},nt.createElement(Te,null)),o&&nt.createElement(pa,null,o),nt.createElement(ca,null,i))):nt.createElement(nt.Fragment,null));import{useContext as ma}from"react";function Q(){let{defaultAppearance:e}=ma(K);function t(o){let i=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign(i.styleOverrides??{},o.styleOverrides??{}),theme:Object.assign(i.theme,o.theme??{})}:i}return{mergeAppearanceWithDefault:t}}import Ct,{useContext as Da,useEffect as $a,useState as lr}from"react";import vo from"styled-components";import ko,{useEffect as ua,useState as ni}from"react";import tr from"styled-components";import To from"styled-components";var ei=To.label`
|
|
252
252
|
${e=>T(e)} {
|
|
253
253
|
font-size: 12px;
|
|
254
254
|
line-height: 18px;
|
|
@@ -259,14 +259,14 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
259
259
|
letter-spacing: 0.24px;
|
|
260
260
|
}
|
|
261
261
|
display: flex;
|
|
262
|
-
`,ti=
|
|
262
|
+
`,ti=To.label`
|
|
263
263
|
${e=>T(e)} {
|
|
264
264
|
font-size: 12px;
|
|
265
265
|
line-height: 20px;
|
|
266
266
|
margin-bottom: 5px;
|
|
267
267
|
}
|
|
268
268
|
display: flex;
|
|
269
|
-
`,oi=
|
|
269
|
+
`,oi=To.span`
|
|
270
270
|
font-weight: 400;
|
|
271
271
|
font-size: 14px;
|
|
272
272
|
line-height: 22px;
|
|
@@ -274,16 +274,16 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
274
274
|
display: flex;
|
|
275
275
|
margin-right: 5px;
|
|
276
276
|
margin-top: 10px;
|
|
277
|
-
`,To
|
|
277
|
+
`,Fo=To.div`
|
|
278
278
|
display: flex;
|
|
279
279
|
align-items: flex-start;
|
|
280
280
|
justify-content: left;
|
|
281
281
|
margin-bottom: 10px;
|
|
282
|
-
`;import
|
|
282
|
+
`;import Ro from"react";var Je={theme:{colorPrimary:"#0171F8",colorSecondary:"#2E343D",colorText:"#0F1114",colorBackground:"#ffffff",colorBackgroundSecondary:"#d2d2d2",colorTextOnPrimaryBackground:"#ffffff",colorTextSecondary:"#2E343D",colorTextDisabled:"#5A6472",colorBorder:"#E5E5E5",colorTextError:"#c00000",colorTextSuccess:"#00D149",borderRadius:10}};function st({title:e,required:t,appearance:o=Je}){return e?Ro.createElement(Fo,null,t?Ro.createElement(oi,{className:l("formLabelRequired",o),appearance:o},"*"):null,Ro.createElement(ei,{className:l("formLabel",o)},e)):null}import ri from"react";function Dt({title:e,appearance:t}){return e?ri.createElement(Fo,null,ri.createElement(ti,{className:l("formSubLabel",t)},e)):null}import{z as er}from"zod";function ii(e,t){try{if(t){if(t.type=="number"){let o=er.number();if(t.props)for(let i of t.props)i.requirement=="min"?o=o.min(Number(i.value),i.message??"Value is too small"):i.requirement=="max"?o=o.max(Number(i.value),i.message??"Value is too large"):i.requirement=="positive"?o=o.positive(i.message??"Value must be positive"):i.requirement=="negative"&&(o=o.nonpositive(i.message??"Value must be negative"));o.parse(Number(e))}if(t.type=="string"){let o=er.string();if(t.props)for(let i of t.props)i.requirement=="min"?o=o.min(Number(i.value),i.message??"Value is too short"):i.requirement=="max"?o=o.max(Number(i.value),i.message??"Value is too long"):i.requirement=="regex"&&(o=o.regex(new RegExp(String(i.value)),i.message??"Value does not match requirements"));o.parse(e)}return}}catch(o){if(o instanceof er.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 fa=tr.div`
|
|
283
283
|
display: flex;
|
|
284
284
|
flex-direction: column;
|
|
285
285
|
width: 100%;
|
|
286
|
-
`,tr
|
|
286
|
+
`,or=tr.input`
|
|
287
287
|
${e=>T(e)} {
|
|
288
288
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
289
289
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -299,7 +299,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
299
299
|
box-sizing: border-box;
|
|
300
300
|
padding: 0 10px;
|
|
301
301
|
margin-bottom: 10px;
|
|
302
|
-
`,
|
|
302
|
+
`,ga=tr.textarea`
|
|
303
303
|
${e=>T(e)} {
|
|
304
304
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
305
305
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -315,13 +315,13 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
315
315
|
min-height: 70px;
|
|
316
316
|
box-sizing: border-box;
|
|
317
317
|
margin-bottom: 10px;
|
|
318
|
-
`;function
|
|
318
|
+
`;function rr({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:r}){let n=e,[s,p]=ni((r==null?void 0:r.text)||""),[c,a]=ni(!1),g=or;ua(()=>{s===""&&!c&&(a(!0),d(""))},[]);function d(b){if(p(b),o({text:b}),n.required===!0&&b.trim()===""){i([{id:n.id,message:`${n.title??"Field"} is required`}]);return}let w=ii(b,n.validation);if(w){i([{id:n.id,message:w}]);return}i([])}n.multiline&&(g=ga);function x(){var b;switch((b=n==null?void 0:n.validation)==null?void 0:b.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return ko.createElement(fa,null,ko.createElement(st,{title:n.title,required:n.required,appearance:t.appearance}),ko.createElement(g,{className:l("inputComponent",t.appearance),value:s,onChange:b=>{d(b.target.value)},appearance:t.appearance,placeholder:n.placeholder,type:x()}),ko.createElement(Dt,{title:n.subtitle,appearance:t.appearance}))}import He,{useEffect as si,useState as li}from"react";import ai from"styled-components";var ir="",xa=ai.div`
|
|
319
319
|
display: flex;
|
|
320
320
|
flex-direction: column;
|
|
321
321
|
width: 100%;
|
|
322
322
|
-webkit-appearance: none;
|
|
323
323
|
appearance: none;
|
|
324
|
-
`,
|
|
324
|
+
`,ha=ai.select`
|
|
325
325
|
${e=>T(e)} {
|
|
326
326
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
327
327
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -342,15 +342,15 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
342
342
|
background-repeat: no-repeat;
|
|
343
343
|
background-size: 1.5em 1.5em;
|
|
344
344
|
-webkit-print-color-adjust: exact;
|
|
345
|
-
`;function pi({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var g,d,x,
|
|
346
|
-
${e=>
|
|
347
|
-
`,
|
|
345
|
+
`;function pi({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var g,d,x,b,w,v;let n=e,[s,p]=li(((g=i==null?void 0:i.choice)==null?void 0:g[0])||""),[c,a]=li(!1);return si(()=>{var f,E,S,y;if(s===""&&!c){if(a(!0),n.requireSelection){p(ir);return}if(n.defaultValue&&((f=n.props.options)!=null&&f.find(A=>A.id===n.defaultValue))){let A=(E=n.props.options)==null?void 0:E.find(C=>C.id===n.defaultValue);p(A.id),o({choice:[A.id]})}else p(((S=n.props.options)==null?void 0:S[0].id)||""),o({choice:[((y=n.props.options)==null?void 0:y[0].id)||""]})}},[]),si(()=>{n.requireSelection&&s===ir?r([{message:"Please select an option",id:n.id}]):r([])},[s]),He.createElement(xa,null,He.createElement(st,{title:n.title,required:!1,appearance:t.appearance}),He.createElement(ha,{value:s,onChange:f=>{p(f.target.value),o({choice:[f.target.value]})},placeholder:n.placeholder,appearance:t.appearance,className:l("multipleChoiceSelect",t.appearance)},n.requireSelection&&He.createElement("option",{key:"null-value",value:ir,disabled:!0},n.placeholder??"Select an option"),(d=n.props.options)==null?void 0:d.map(f=>He.createElement("option",{key:f.id,value:f.id},f.title))),((b=(x=n.props.options)==null?void 0:x.find(f=>f.id===s))==null?void 0:b.isOpenEnded)&&He.createElement(He.Fragment,null,He.createElement(st,{title:((v=(w=n.props.options)==null?void 0:w.find(f=>f.id===s))==null?void 0:v.openEndedLabel)??"Please specify",required:!1,appearance:t.appearance}),He.createElement(or,{type:"text",placeholder:"Enter your answer here",onChange:f=>{o({choice:[f.target.value]})},appearance:t.appearance})),He.createElement(Dt,{title:n.subtitle,appearance:t.appearance}))}import to,{useEffect as nr,useState as ci}from"react";import mi from"styled-components";import eo from"react";import Rt from"react";var di=({color:e,percentage:t,size:o})=>{let i=o*.5-2,r=2*Math.PI*i,n=(1-t)*r;return Rt.createElement("circle",{r:i,cx:o*.5,cy:o*.5,fill:"transparent",stroke:n!==r?e:"",strokeWidth:"3px",strokeDasharray:r,strokeDashoffset:t?n:0})},Ca=({fillColor:e,size:t,percentage:o,children:i,bgColor:r="#D9D9D9",className:n,style:s})=>Rt.createElement("svg",{style:s,className:n,width:t,height:t,overflow:"visible"},Rt.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},Rt.createElement(di,{color:r,size:t}),Rt.createElement(di,{color:e,percentage:o,size:t})),i),$t=Ca;import ya from"styled-components";var Sa=({color:e="#FFFFFF"})=>eo.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},eo.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),ba={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},wa={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},Ta={border:"1px solid #000000",color:"#FFFFFF"},Fa={border:"1px solid #C5CBD3"},ka={color:"#FFFFFF"},Pa={border:"1px solid #C5CBD3"},va=e=>e==="square"?ba:wa,Ba=(e,t)=>e==="square"?t?Ta:Fa:t?ka:Pa,Ea=ya.div`
|
|
346
|
+
${e=>Ye(e)}
|
|
347
|
+
`,Qe=({value:e,type:t="round",primaryColor:o="#000000",progress:i,appearance:r=Je,style:n,className:s})=>{let p=va(t),c=Ba(t,e);return e===!0?p={...p,...c,backgroundColor:r.theme.colorTextSuccess,borderColor:t==="square"?o:"none"}:p={...p,...c},e!==!0&&t==="round"&&i!==void 0&&i!==1?eo.createElement($t,{fillColor:o,percentage:i,size:22}):eo.createElement(Ea,{styleOverrides:p,style:n,role:"checkbox",className:xe(l("checkIconContainer",r),l(e?"checkIconContainerChecked":"checkIconContainerUnchecked",r),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&eo.createElement(Sa,{color:"#FFFFFF"}))};var Aa=mi.div`
|
|
348
348
|
display: flex;
|
|
349
349
|
flex-direction: column;
|
|
350
350
|
width: 100%;
|
|
351
351
|
-webkit-appearance: none;
|
|
352
352
|
appearance: none;
|
|
353
|
-
`,
|
|
353
|
+
`,Na=mi.button`
|
|
354
354
|
${e=>T(e)} {
|
|
355
355
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
356
356
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -375,7 +375,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
375
375
|
height: 48px;
|
|
376
376
|
padding: 0 18px;
|
|
377
377
|
margin-bottom: 10px;
|
|
378
|
-
`;function ui({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var g;let n=e,[s,p]=ci((i==null?void 0:i.choice)||[]),[c,a]=ci(!1);return
|
|
378
|
+
`;function ui({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var g;let n=e,[s,p]=ci((i==null?void 0:i.choice)||[]),[c,a]=ci(!1);return nr(()=>{s.length==0&&!c&&(a(!0),o({choice:[]}))},[]),nr(()=>{o({choice:s})},[s]),nr(()=>{n.required&&(s.length<n.props.minChoices||s.length>n.props.maxChoices)?r([{message:"",id:n.id}]):r([])},[s]),to.createElement(Aa,null,to.createElement(st,{title:n.title,required:n.required,appearance:t.appearance}),(g=n.props.options)==null?void 0:g.map(d=>to.createElement(Na,{appearance:t.appearance,className:l("multipleChoiceListItem",t.appearance),key:d.id,value:d.id,"data-selected":s.includes(d.id),onClick:()=>{if(s.includes(d.id)){p(s.filter(x=>x!==d.id));return}s.length<n.props.maxChoices?p([...s,d.id]):s.length==1&&n.props.maxChoices==1&&p([d.id])}},d.title,to.createElement(Qe,{type:"round",primaryColor:t.appearance.theme.colorPrimary,value:s.includes(d.id),appearance:t.appearance}))),to.createElement(Dt,{title:n.subtitle,appearance:t.appearance}))}import Po from"react";import fi from"styled-components";import Ia from"dompurify";function le(e){return{__html:Ia.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var Oa=fi.h1`
|
|
379
379
|
${e=>T(e)} {
|
|
380
380
|
font-style: normal;
|
|
381
381
|
font-weight: 700;
|
|
@@ -387,7 +387,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
387
387
|
margin-bottom: 4px;
|
|
388
388
|
color: ${e=>e.appearance.theme.colorText};
|
|
389
389
|
}
|
|
390
|
-
`,
|
|
390
|
+
`,La=fi.h2`
|
|
391
391
|
${e=>T(e)} {
|
|
392
392
|
font-style: normal;
|
|
393
393
|
font-weight: 400;
|
|
@@ -396,42 +396,42 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
396
396
|
letter-spacing: 0.28px;
|
|
397
397
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
398
398
|
}
|
|
399
|
-
`;function
|
|
399
|
+
`;function Fe({appearance:e,title:t,subtitle:o,size:i="medium",classPrefix:r=""}){return Po.createElement(Po.Fragment,null,Po.createElement(Oa,{appearance:e,className:l(`${r}${r?Zt(i):i}Title`,e),dangerouslySetInnerHTML:le(t),size:i}),o&&Po.createElement(La,{appearance:e,className:l(`${r}${r?Zt(i):i}Subtitle`,e),dangerouslySetInnerHTML:le(o),size:i}))}import*as sr from"react";var gi=e=>sr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:12,height:12,"aria-hidden":"true",viewBox:"0 0 16 16",...e},sr.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"}));var Ma=vo.div`
|
|
400
400
|
display: flex;
|
|
401
401
|
flex-direction: column;
|
|
402
402
|
justify-content: flex-end;
|
|
403
403
|
overflow: visible;
|
|
404
404
|
padding-top: 14px;
|
|
405
|
-
`,
|
|
405
|
+
`,Ua=vo.div`
|
|
406
406
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextError}};
|
|
407
407
|
font-size: 12px;
|
|
408
408
|
margin-bottom: 12px;
|
|
409
409
|
display: flex;
|
|
410
410
|
align-items: center;
|
|
411
|
-
`,
|
|
411
|
+
`,za=vo.div`
|
|
412
412
|
margin-right: 4px;
|
|
413
413
|
display: inline-flex;
|
|
414
|
-
`,
|
|
414
|
+
`,Wa=vo.div`
|
|
415
415
|
padding-left: 1px;
|
|
416
416
|
padding-right: 1px;
|
|
417
|
-
`,
|
|
417
|
+
`,_a={text:rr,multipleChoice:pi,multipleChoiceList:ui},ar="frigade-multiInputStepTypeData";function xi({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:r,appearance:n,customFormElements:s,prefillData:p}){var C;let c=t.props,[a,g]=lr([]),[d,x]=lr([]),{userId:b}=Jt(),[w,v]=lr(y()||(p?p[t.id]:null)||{}),{readonly:f}=Da(K),E={..._a,...s};$a(()=>{i(a.length===0)},[a,i]);function S(m,B){let F={...w,[m.id]:B};v(F),r(F),window&&window.localStorage&&!f&&window.localStorage.setItem(A(),JSON.stringify(F))}function y(){if(window&&window.localStorage){let m=window.localStorage.getItem(A());if(m)return JSON.parse(m)}return null}function A(){return`${ar}-${e}-${t.id}-${b}`}return Ct.createElement(Wa,{className:l("multiInput",n)},Ct.createElement(Fe,{appearance:n,title:t.title,subtitle:t.subtitle}),Ct.createElement(Ma,{className:l("multiInputContainer",n)},(C=c.data)==null?void 0:C.map(m=>{var F;let B=(F=a.reverse().find(k=>k.id===m.id))==null?void 0:F.message;return E[m.type]?Ct.createElement("span",{key:m.id,"data-field-id":m.id,className:l("multiInputField",n)},E[m.type]({formInput:m,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:r,appearance:n},onSaveInputData:k=>{!d.includes(m.id)&&k&&(k==null?void 0:k.text)!==""&&x(O=>[...O,m.id]),S(m,k)},inputData:w[m.id],setFormValidationErrors:k=>{g(O=>k.length===0?O.filter(N=>N.id!==m.id):[...O,...k])}}),B&&d.includes(m.id)&&Ct.createElement(Ua,{initial:{opacity:0,height:0,marginBottom:0},animate:{opacity:1,height:"auto",marginBottom:12},exit:{opacity:0,height:0,marginBottom:0},key:m.id,style:{overflow:"hidden"},transition:{duration:.1,ease:"easeInOut",delay:.5},appearance:n,className:l("multiInputValidationError",n)},Ct.createElement(za,{appearance:n,className:l("multiInputValidationErrorIcon",n)},Ct.createElement(gi,null)),B)):null})))}import yt from"styled-components";var hi=yt.div`
|
|
418
418
|
align-items: center;
|
|
419
419
|
display: flex;
|
|
420
420
|
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
421
421
|
padding-top: 14px;
|
|
422
|
-
`,Ci=
|
|
422
|
+
`,Ci=yt.div`
|
|
423
423
|
color: ${e=>e.appearance.theme.colorTextError};
|
|
424
424
|
font-size: 12px;
|
|
425
|
-
`,yi=
|
|
425
|
+
`,yi=yt.div`
|
|
426
426
|
display: flex;
|
|
427
427
|
gap: 12px;
|
|
428
428
|
width: 100%;
|
|
429
429
|
justify-content: flex-end;
|
|
430
|
-
`,Si=
|
|
430
|
+
`,Si=yt.div`
|
|
431
431
|
display: flex;
|
|
432
432
|
flex-direction: row;
|
|
433
433
|
flex: 1 1;
|
|
434
|
-
`,bi=
|
|
434
|
+
`,bi=yt.div`
|
|
435
435
|
display: flex;
|
|
436
436
|
// If type is set to large-modal, use padding 60px horizontal, 80px vertical
|
|
437
437
|
// Otherwise, use 4px padding
|
|
@@ -439,11 +439,11 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
439
439
|
flex-grow: 1;
|
|
440
440
|
flex-basis: 0;
|
|
441
441
|
position: relative;
|
|
442
|
-
`,wi=
|
|
442
|
+
`,wi=yt.div`
|
|
443
443
|
padding: ${e=>e.type==="large-modal"?"50px":"0px"};
|
|
444
444
|
position: relative;
|
|
445
445
|
overflow-y: auto;
|
|
446
|
-
`,Ti=
|
|
446
|
+
`,Ti=yt.div`
|
|
447
447
|
display: flex;
|
|
448
448
|
align-self: stretch;
|
|
449
449
|
flex-grow: 1;
|
|
@@ -455,7 +455,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
455
455
|
background-position: center;
|
|
456
456
|
border-top-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
457
457
|
border-bottom-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
458
|
-
`;import
|
|
458
|
+
`;import lt from"react";import Ha from"react";import Fi from"styled-components";var ja=Fi.button`
|
|
459
459
|
justify-content: center;
|
|
460
460
|
align-content: center;
|
|
461
461
|
${e=>T(e)} {
|
|
@@ -473,7 +473,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
473
473
|
font-size: ${e=>e.size=="small"?"14px":"15px"};
|
|
474
474
|
line-height: 20px;
|
|
475
475
|
font-weight: 500;
|
|
476
|
-
${e=>
|
|
476
|
+
${e=>Ye(e)}
|
|
477
477
|
}
|
|
478
478
|
|
|
479
479
|
font-family: inherit;
|
|
@@ -486,7 +486,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
486
486
|
opacity: 0.3;
|
|
487
487
|
cursor: not-allowed;
|
|
488
488
|
}
|
|
489
|
-
`,
|
|
489
|
+
`,Bo=Fi.div`
|
|
490
490
|
${e=>T(e)} {
|
|
491
491
|
display: flex;
|
|
492
492
|
flex-direction: row;
|
|
@@ -497,14 +497,14 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
497
497
|
margin-right: 8px;
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
|
-
`,Z=({onClick:e,title:t,style:o,disabled:i,type:r="inline",size:n="medium",secondary:s=!1,appearance:p,withMargin:c=!0,classPrefix:a=""})=>{function g(){let d=s?"buttonSecondary":"button";return a===""?d:`${a}${
|
|
500
|
+
`,Z=({onClick:e,title:t,style:o,disabled:i,type:r="inline",size:n="medium",secondary:s=!1,appearance:p,withMargin:c=!0,classPrefix:a=""})=>{function g(){let d=s?"buttonSecondary":"button";return a===""?d:`${a}${Zt(d)}`}return Ha.createElement(ja,{secondary:s,appearance:p,disabled:i,onClick:e,styleOverrides:o,type:r,withMargin:c,size:n,className:l(g(),p)},t??"Continue")};var ki=({step:e,canContinue:t,appearance:o,onPrimaryClick:i,onSecondaryClick:r,selectedStep:n,steps:s,onBack:p,allowBackNavigation:c,errorMessage:a})=>{let g=s.length>1&&n!=0&&c,d=e.primaryButtonTitle&&e.secondaryButtonTitle||g?"inline":"full-width";return lt.createElement(lt.Fragment,null,a!==null&&a!=null&<.createElement(Ci,{appearance:o,className:l("formCTAError",o)},a),lt.createElement(hi,{showBackButton:g,className:l("formCTAContainer",o)},g&<.createElement(Z,{title:e.backButtonTitle??"Back",onClick:p,secondary:!0,withMargin:!1,type:d,appearance:o,style:{width:"90px",maxWidth:"90px"},classPrefix:"back"}),lt.createElement(yi,{className:l("ctaWrapper",o)},e.secondaryButtonTitle?lt.createElement(Z,{title:e.secondaryButtonTitle,onClick:r,secondary:!0,withMargin:!1,type:d,appearance:o}):null," ",e.primaryButtonTitle?lt.createElement(Z,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:i,type:d,appearance:o}):null)))};import pr from"react";import Va from"styled-components";var Ga=Va.div`
|
|
501
501
|
text-align: center;
|
|
502
|
-
`,Pi=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:r}=Q().mergeAppearanceWithDefault(i);return
|
|
502
|
+
`,Pi=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:r}=Q().mergeAppearanceWithDefault(i);return pr.createElement(Ga,{className:o},pr.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((n,s)=>pr.createElement("rect",{key:s,x:16*s,y:0,width:8,height:8,rx:4,fill:t===s?r.colorPrimary:"#E6E6E6"}))))};import St from"react";import Mt from"styled-components";import{useContext as Ka}from"react";function ie(){let e=Ka(K);function t(r){i(r.primaryButtonUri,r.primaryButtonUriTarget)}function o(r){i(r.secondaryButtonUri,r.secondaryButtonUriTarget)}function i(r,n){if(!r)return;let s=r.startsWith("http")?"_blank":"_self";n&&n!=="_blank"&&(s="_self"),e.navigate(r,s)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:i}}var qa=Mt.div`
|
|
503
503
|
display: flex;
|
|
504
504
|
flex-wrap: wrap;
|
|
505
505
|
align-content: center;
|
|
506
506
|
justify-content: center;
|
|
507
|
-
`,
|
|
507
|
+
`,Ya=Mt.div`
|
|
508
508
|
align-content: center;
|
|
509
509
|
align-items: center;
|
|
510
510
|
display: flex;
|
|
@@ -518,10 +518,10 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
518
518
|
flex-basis: 255px;
|
|
519
519
|
flex-grow: 0;
|
|
520
520
|
flex-shrink: 0;
|
|
521
|
-
`,
|
|
521
|
+
`,Xa=Mt.img`
|
|
522
522
|
width: 78px;
|
|
523
523
|
height: auto;
|
|
524
|
-
`,
|
|
524
|
+
`,Ja=Mt.button`
|
|
525
525
|
font-style: normal;
|
|
526
526
|
font-weight: 600;
|
|
527
527
|
font-size: 13px;
|
|
@@ -534,11 +534,11 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
534
534
|
border-radius: 100px;
|
|
535
535
|
padding: 8px 12px;
|
|
536
536
|
margin-top: 16px;
|
|
537
|
-
`,
|
|
537
|
+
`,Qa=Mt.h1`
|
|
538
538
|
font-weight: 700;
|
|
539
539
|
font-size: 28px;
|
|
540
540
|
line-height: 34px;
|
|
541
|
-
`,
|
|
541
|
+
`,Za=Mt.h2`
|
|
542
542
|
font-style: normal;
|
|
543
543
|
font-weight: 400;
|
|
544
544
|
font-size: 16px;
|
|
@@ -547,7 +547,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
547
547
|
margin-top: 12px;
|
|
548
548
|
margin-bottom: 16px;
|
|
549
549
|
max-width: 70%;
|
|
550
|
-
`;function vi({stepData:e,appearance:t}){var i,r;let{handleUrl:o}=ie();return
|
|
550
|
+
`;function vi({stepData:e,appearance:t}){var i,r;let{handleUrl:o}=ie();return St.createElement("div",null,St.createElement(Qa,null,e.title),St.createElement(Za,null,e.subtitle),St.createElement(qa,null,(r=(i=e.props)==null?void 0:i.links)==null?void 0:r.map(n=>St.createElement(Ya,{key:n.title},St.createElement(Xa,{src:n.imageUri}),St.createElement(Ja,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{n.uri&&o(n.uri,n.uriTarget??"_blank")}},n.title)))))}import Ut,{useEffect as np}from"react";import No from"styled-components";import dr from"react";var Eo=({style:e,className:t})=>dr.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},dr.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),dr.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 oo,{useRef as Ra,useState as ep}from"react";import Ao from"styled-components";var tp=Ao.div`
|
|
551
551
|
display: flex;
|
|
552
552
|
align-items: center;
|
|
553
553
|
justify-content: flex-start;
|
|
@@ -555,7 +555,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
555
555
|
width: 100%;
|
|
556
556
|
height: 100%;
|
|
557
557
|
position: relative;
|
|
558
|
-
`,
|
|
558
|
+
`,op=Ao.div`
|
|
559
559
|
position: absolute;
|
|
560
560
|
display: flex;
|
|
561
561
|
align-items: center;
|
|
@@ -574,56 +574,56 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
574
574
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
575
575
|
border-radius: 50%;
|
|
576
576
|
}
|
|
577
|
-
`,
|
|
577
|
+
`,rp=Ao.video`
|
|
578
578
|
width: 100%;
|
|
579
579
|
height: 100%;
|
|
580
580
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
581
|
-
`,
|
|
581
|
+
`,ip=Ao.iframe`
|
|
582
582
|
width: 100%;
|
|
583
583
|
height: 100%;
|
|
584
584
|
min-height: 260px;
|
|
585
585
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
586
|
-
`;function
|
|
586
|
+
`;function je({appearance:e,videoUri:t}){let o=Ra(),[i,r]=ep(!1);if(t.includes("youtube")){let n=t.split("v=")[1],s=n.indexOf("&");return s!==-1&&(n=n.substring(0,s)),oo.createElement(ip,{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${n}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,appearance:e})}return oo.createElement(tp,{className:l("videoPlayerWrapper",e),appearance:e},!i&&oo.createElement(op,{onClick:()=>{r(!0),o.current.play()},appearance:e},oo.createElement(Eo,null)),oo.createElement(rp,{appearance:e,controls:i,ref:o,play:i,src:t}))}var sp=No.div`
|
|
587
587
|
${e=>T(e)} {
|
|
588
588
|
display: flex;
|
|
589
589
|
flex-direction: column;
|
|
590
590
|
justify-content: center;
|
|
591
591
|
}
|
|
592
|
-
`,
|
|
592
|
+
`,lp=No.img`
|
|
593
593
|
${e=>T(e)} {
|
|
594
594
|
width: 100%;
|
|
595
595
|
height: auto;
|
|
596
596
|
max-height: 250px;
|
|
597
597
|
margin-bottom: 24px;
|
|
598
598
|
}
|
|
599
|
-
`,
|
|
599
|
+
`,ap=No.div`
|
|
600
600
|
${e=>T(e)} {
|
|
601
601
|
margin-bottom: 24px;
|
|
602
602
|
}
|
|
603
|
-
`,
|
|
603
|
+
`,pp=No.div`
|
|
604
604
|
${e=>T(e)} {
|
|
605
605
|
width: 100%;
|
|
606
606
|
height: auto;
|
|
607
607
|
max-height: 250px;
|
|
608
608
|
margin-bottom: 24px;
|
|
609
609
|
}
|
|
610
|
-
`;function Bi({stepData:e,appearance:t,setCanContinue:o}){return
|
|
610
|
+
`;function Bi({stepData:e,appearance:t,setCanContinue:o}){return np(()=>{o(!0)},[]),Ut.createElement(sp,{className:l("callToActionContainer",t)},Ut.createElement(ap,{className:l("callToActionTextContainer",t)},Ut.createElement(Fe,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&Ut.createElement(lp,{className:l("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&Ut.createElement(pp,{appearance:t,className:l("callToActionVideo",t)},Ut.createElement(je,{appearance:t,videoUri:e.videoUri})))}import Ze,{useEffect as cr,useState as mr}from"react";import at from"styled-components";var Ei=at.div`
|
|
611
611
|
width: auto;
|
|
612
612
|
display: flex;
|
|
613
613
|
flex-direction: column;
|
|
614
614
|
justify-content: center;
|
|
615
615
|
align-items: center;
|
|
616
616
|
padding: 4px;
|
|
617
|
-
`,Ai=
|
|
617
|
+
`,Ai=at.div`
|
|
618
618
|
width: 100%;
|
|
619
619
|
text-align: left;
|
|
620
|
-
`,Ni=
|
|
620
|
+
`,Ni=at.h1`
|
|
621
621
|
font-style: normal;
|
|
622
622
|
font-weight: 700;
|
|
623
623
|
font-size: 32px;
|
|
624
624
|
line-height: 38px;
|
|
625
625
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
626
|
-
`,Ii=
|
|
626
|
+
`,Ii=at.h1`
|
|
627
627
|
font-style: normal;
|
|
628
628
|
font-weight: 400;
|
|
629
629
|
font-size: 16px;
|
|
@@ -631,7 +631,7 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
631
631
|
margin-top: 16px;
|
|
632
632
|
margin-bottom: 16px;
|
|
633
633
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
634
|
-
`,Oi=
|
|
634
|
+
`,Oi=at.div`
|
|
635
635
|
padding-top: 12px;
|
|
636
636
|
padding-bottom: 12px;
|
|
637
637
|
flex-direction: row;
|
|
@@ -642,17 +642,17 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
642
642
|
cursor: pointer;
|
|
643
643
|
border-bottom: ${e=>e.hideBottomBorder?"none":"1px solid #D8D8D8"};
|
|
644
644
|
width: 100%;
|
|
645
|
-
`,Li=
|
|
645
|
+
`,Li=at.div`
|
|
646
646
|
padding-top: 10px;
|
|
647
647
|
padding-bottom: 10px;
|
|
648
648
|
flex-direction: row;
|
|
649
649
|
display: flex;
|
|
650
650
|
justify-content: flex-start;
|
|
651
|
-
`,Di=
|
|
651
|
+
`,Di=at.img`
|
|
652
652
|
width: 42px;
|
|
653
653
|
height: 42px;
|
|
654
654
|
margin-right: 12px;
|
|
655
|
-
`,$i=
|
|
655
|
+
`,$i=at.p`
|
|
656
656
|
font-style: normal;
|
|
657
657
|
font-weight: 500;
|
|
658
658
|
font-size: 17px;
|
|
@@ -660,8 +660,8 @@ import bt,{createContext as Wp,useEffect as Do,useState as Le}from"react";import
|
|
|
660
660
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
661
661
|
display: flex;
|
|
662
662
|
align-self: center;
|
|
663
|
-
`;var Mi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let r=e.props,[n,s]=
|
|
664
|
-
${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map(([s,p])=>`${Yo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return oo.createElement(o,{inlineStyles:t})}var Ui=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:r,customVariables:n,customFormElements:s,onComplete:p,appearance:c,hideOnFlowCompletion:a=!0,onStepCompletion:g,onButtonClick:d,dismissible:x=!0,endFlowOnDismiss:S=!1,modalPosition:w="center",repeatable:P=!1,onDismiss:f,showPagination:E=!1,allowBackNavigation:b=!1,validationHandler:y,showFrigadeBranding:A=!1,onFormDataChange:h,showFooter:m=!0,prefillData:B={}})=>{let{getFlow:F,getFlowSteps:k,isLoading:O,targetingLogicShouldHideFlow:N,getFlowStatus:I,getCurrentStepIndex:$,markFlowCompleted:D,markFlowNotStarted:ee}=Y(),M=$(e),{mergeAppearanceWithDefault:te}=Q(),[fe,X]=mp(!1),{setOpenFlowState:_,getOpenFlowState:H,hasOpenModals:Ce}=Te();c=te(c);let[Ie,we]=i!==void 0&&r!==void 0?[i,r]:[H(e,!0),re=>_(e,re)];if(cp(()=>{!fe&&!O&&(X(!0),I(e)===q&&P&&(ee(e),window&&window.localStorage&&Object.keys(window.localStorage).forEach(L=>{L.startsWith(lr)&&window.localStorage.removeItem(L)})),X(!0))},[fe,X,O]),O)return null;let me=F(e);if(!me||N(me))return null;let J=k(e);if(!J||i!==void 0&&i===!1||I(e)===q&&a||(o=="modal"||o=="corner-modal")&&Ce(e))return null;let ge=()=>{we(!1),f&&f(),S===!0&&D(e)};if(w=="center"&&o==="modal"||o==="large-modal"){let re={padding:"24px"};return o==="large-modal"?(re.width="85%",re.height="90%",re.maxHeight="800px",re.minHeight="500px",re.padding="0"):re.width="400px",Ge.createElement(He,{appearance:c,onClose:ge,visible:Ie,style:re,dismissible:x,showFrigadeBranding:A},Ge.createElement(oe,{appearance:c}),Ge.createElement(Io,{appearance:c,steps:J,selectedStep:M,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:we,onDismiss:f,showPagination:E,customFormElements:s,allowBackNavigation:b,validationHandler:y,onFormDataChange:h,showFooter:m,prefillData:B}))}return o==="modal"&&w!=="center"?Ge.createElement(bo,{appearance:c,onClose:ge,visible:Ie,modalPosition:w},Ge.createElement(oe,{appearance:c}),Ge.createElement(Io,{appearance:c,steps:J,selectedStep:M,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:we,onDismiss:f,showPagination:E,customFormElements:s,allowBackNavigation:b,validationHandler:y,onFormDataChange:h,showFooter:m,prefillData:B})):Ge.createElement(Ge.Fragment,null,Ge.createElement(oe,{appearance:c}),Ge.createElement(Io,{appearance:c,steps:J,selectedStep:M,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:we,onDismiss:f,showPagination:E,customFormElements:s,allowBackNavigation:b,validationHandler:y,onFormDataChange:h,showFooter:m,prefillData:B}))},zi=Ui;import{useCallback as Wi,useContext as up,useEffect as fp}from"react";function mr(){let{organizationId:e,userId:t,setOrganizationId:o}=up(K),{mutateUserFlowState:i}=Ee(),{config:r,apiUrl:n}=_e(),s=Et(),{verifySDKInitiated:p}=At();fp(()=>{if(t&&e){if(t.startsWith(Nt))return;let g=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(g)||(s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(g,"true"))}},[t,e]);let c=Wi(async g=>{if(!p())return;if(!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let d={foreignUserId:t,foreignUserGroupId:e,properties:g};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(d)}),i()},[e,t,r,i]),a=Wi(async(g,d)=>{if(!p())return;if(!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let S={foreignUserId:t,foreignUserGroupId:e,events:[{event:g,properties:d}]};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(S)}),i()},[e,t,r,i]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:c,trackEventForOrganization:a}}var _i="frigade-xFrigade_guestUserId",ro="frigade-xFrigade_userId",Hi=({})=>{let{setFlowResponses:e}=qt(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=Ee(),{userId:r,setUserId:n}=Yt(),[s,p]=ur(null),{getFlowStatus:c}=Y(),{flows:a,userProperties:g,setIsNewGuestUser:d,flowResponses:x}=gp(K),[S,w]=ur([]),[P,f]=ur([]),{organizationId:E}=mr();Oo(()=>{if(!o&&t)for(let h=0;h<t.length;h++){let m=t[h],B=a.find(F=>F.slug===(m==null?void 0:m.flowId));if(B&&m&&m.shouldTrigger===!0&&B.type=="FORM"&&B.triggerType==="AUTOMATIC"&&!P.includes(B.slug)){setTimeout(()=>{b(m.flowId)},500);break}}},[o,t]),Oo(()=>{x.length>0&&i()},[x]);function b(h){let m=a.find(B=>B.slug===h);m&&m.triggerType==="AUTOMATIC"&&!P.includes(m.slug)&&(f([...P,m.slug]),w([m]))}function y(){if(!r){let h=localStorage.getItem(ro);if(h){n(h);return}let m=localStorage.getItem(_i);if(m){n(m);return}d(!0);let B=Nt+xp();try{localStorage.setItem(_i,B)}catch(F){console.log("Failed to save guest user id locally: Local storage unavailable",F)}n(F=>F||B)}}Oo(()=>{try{if(a){let h=[];a.forEach(m=>{if(m.data){let B=m.data.match(/"imageUri":"(.*?)"/g);B&&B.forEach(F=>{let k=F.replace('"imageUri":"',"").replace('"',"");if(h.includes(k))return;let O=new Image;O.src=k,h.push(k)})}})}}catch{}},[a]),Oo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(Nt))try{localStorage.setItem(ro,r)}catch(h){console.log("Failed to save user id locally: Local storage available",h)}r===null&&setTimeout(()=>{r===null&&y()},50)},[r,a,g]);function A(){return St.createElement(St.Fragment,null,S.map(h=>c(h.slug)!==Me?null:St.createElement("span",{key:h.slug},St.createElement(zi,{flowId:h.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return St.createElement(St.Fragment,null,St.createElement(A,null))};import{ErrorBoundary as Hp}from"react-error-boundary";import io from"core-js-pure/actual/structured-clone";function fr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function dt(...e){let t=e.shift(),o=e.length===1?e[0]:dt(...e);if(!fr(t)||!fr(o))throw new Error("deepmerge can only merge Objects");let i=io(t);return Object.entries(o).forEach(([r,n])=>{fr(n)?i[r]!==void 0?Object.assign(i,{[r]:dt(i[r],io(n))}):Object.assign(i,{[r]:io(n)}):Array.isArray(n)?i[r]!==void 0?Object.assign(i,{[r]:[...i[r],...io(n)]}):Object.assign(i,{[r]:io(n)}):Object.assign(i,{[r]:n})}),i}var ji={colorPrimary:"colors.primary.background",colorText:"colors.neutral.foreground",colorBackground:"colors.neutral.background",colorBackgroundSecondary:"colors.secondary.background",colorTextOnPrimaryBackground:"colors.primary.foreground",colorTextSecondary:"colors.secondary.foreground",colorTextDisabled:"colors.gray700",colorBorder:"colors.gray800",colorTextError:"colors.negative.foreground",borderRadius:"radii.lg"};function hp(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(ji[o]){let r=ji[o].split("."),n=t;r.forEach((s,p)=>{n[s]||(n[s]=p===r.length-1?i:{}),n=n[s]})}}),t}function Cp(e){if(!e)return;let t=dt({},e),o={};return Object.keys(t).forEach(i=>{let r=`.fr-${i}`;o[r]=t[i]}),o}function Vi(e){let{theme:t,styleOverrides:o}=e,i=hp(t),r=Cp(o);return{overrides:i,css:r}}import Ip from"styled-components";import{compose as Op,variant as Ki}from"styled-system";import Gi from"react";import yp,{ThemeProvider as Sp,useTheme as bp}from"styled-components";import{border as wp,color as Tp,compose as Fp,get as kp,shadow as Pp,space as vp,system as Bp,typography as Ep}from"styled-system";var Ap={width:{property:"width",scale:"sizes",transform:(e,t)=>kp(t,e,!(typeof e=="number"&&!isNaN(e))||e>1?e:e*100+"%")},height:{property:"height",scale:"sizes"},minWidth:{property:"minWidth",scale:"sizes"},minHeight:{property:"minHeight",scale:"sizes"},maxWidth:{property:"maxWidth",scale:"sizes"},maxHeight:{property:"maxHeight",scale:"sizes"},overflow:!0,overflowX:!0,overflowY:!0,display:!0,verticalAlign:!0},Np=yp("div")(({css:e})=>e,Fp(wp,Tp,Pp,vp,Ep,Bp(Ap))),no=({as:e,children:t,overrides:o,...i})=>{let r=bp(),n={border:"none",boxSizing:"border-box",m:0,p:0},s=()=>Gi.createElement(Np,{as:e,...n,...i},t);if(o!==void 0){let p=dt(r,o);return Gi.createElement(Sp,{theme:p},s())}return s()};var so={Primary:{backgroundColor:"primary.background",color:"primary.foreground","&:hover":{backgroundColor:"blue400"}},Secondary:{backgroundColor:"white",border:"1px solid",borderColor:"gray800",color:"neutral.foreground","&:hover":{backgroundColor:"blue900"}},Link:{backgroundColor:"transparent",color:"primary.inverted"},Plain:{backgroundColor:"transparent",color:"neutral.foreground"}},Lp={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},qi=Ip(no)(()=>({whiteSpace:"nowrap"}),Op(Ki({scale:"components.Button",variants:"components.Button"}),Ki({prop:"size",variants:Lp})));import Dp from"styled-components";import{variant as $p,system as Mp}from"styled-system";var Lo={Display1:{fontSize:"5xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"4xl"},Display2:{fontSize:"4xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"3xl"},H1:{fontSize:"3xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"2xl"},H2:{fontSize:"2xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"xl"},H3:{fontSize:"xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"lg"},H4:{fontSize:"lg",fontWeight:"bold",letterSpacing:"md",lineHeight:"md"},Body1:{fontSize:"md",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Body2:{fontSize:"sm",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Caption:{fontSize:"xs",fontWeight:"regular",letterSpacing:"md",lineHeight:"sm"}};var Yi=Dp(no)($p({scale:"components.Text",variants:"components.Text"}),Mp({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Xi=4,Ji="px",Up=20,zp=Object.fromEntries(Array.from(Array(Up+1),(e,t)=>t===0?[.5,`${.5*Xi}${Ji}`]:[t,`${t*Xi}${Ji}`])),$t={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",red500:"#c00000"},gr={colors:{...$t,neutral:{foreground:$t.gray300},primary:{background:$t.blue500,foreground:$t.white,inverted:$t.blue500},negative:{foreground:$t.red500}},fonts:{default:"TT Interphases Pro, sans-serif"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{regular:400,semibold:500,bold:700},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"},radii:{md:"8px",lg:"20px",round:"50%"},shadows:{md:"0px 4px 20px rgba(0, 0, 0, 0.06)"},space:zp,components:{Button:so,Text:Lo}};var Qi="https://api.frigade.com",K=Wp({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:Qi,readonly:!1});function jp(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var Vp=({publicApiKey:e,userId:t,organizationId:o,config:i,children:r})=>{var fe,X;let[n,s]=Le(t||null),[p,c]=Le(o||null),[a,g]=Le([]),[d,x]=Le([]),[S,w]=Le([]),[P,f]=Le({}),[E,b]=Le({}),[y,A]=Le([]),[h,m]=Le({}),[B,F]=Le(!1),[k,O]=Le(!1),[N,I]=Le(!ee(e)),$=(_,H)=>{if(H==="_blank"){window.open(_,"_blank");return}setTimeout(()=>{window.location.href=_},50)},D={theme:{...Qe.theme,...((fe=i==null?void 0:i.defaultAppearance)==null?void 0:fe.theme)??{}},styleOverrides:{...Qe.styleOverrides,...((X=i==null?void 0:i.defaultAppearance)==null?void 0:X.styleOverrides)??{}}};function ee(_){return!!(_&&_.length>10&&_.substring(0,10)==="api_public")}Do(()=>{t&&s(t)},[t]),Do(()=>{n&&window&&window.localStorage&&window.localStorage.getItem(ro)&&window.localStorage.getItem(ro)!==n&&jp()},[n]),Do(()=>{o&&c(o)},[o]),Do(()=>{if(ee(e))I(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),I(!0);return}},[e,I]);let M={publicApiKey:e,userId:n,setUserId:s,setFlows:g,flows:a,failedFlowResponses:d,setFailedFlowResponses:x,flowResponses:S,setFlowResponses:w,userProperties:P,setUserProperties:f,openFlowStates:E,setOpenFlowStates:b,completedFlowsToKeepOpenDuringSession:y,setCompletedFlowsToKeepOpenDuringSession:A,customVariables:h,setCustomVariables:m,isNewGuestUser:B,setIsNewGuestUser:F,hasActiveFullPageFlow:k,setHasActiveFullPageFlow:O,organizationId:p,setOrganizationId:c,navigate:i&&i.navigate?i.navigate:$,defaultAppearance:D,shouldGracefullyDegrade:N,setShouldGracefullyDegrade:I,apiUrl:i&&i.apiUrl?i.apiUrl:Qi,readonly:i&&i.readonly?i.readonly:!1};if(N)return bt.createElement(K.Provider,{value:M},r);let{overrides:te}=Vi(D);return bt.createElement(Hp,{fallback:bt.createElement(bt.Fragment,null,r)},bt.createElement(K.Provider,{value:M},bt.createElement(_p,{theme:dt(D.theme,gr,te??{},(i==null?void 0:i.theme)??{})},r,bt.createElement(Hi,null))))};import Od from"react";import ce,{useEffect as vs,useState as Bs}from"react";import We,{useState as ad}from"react";import Ft from"styled-components";import Uo from"react";import wt from"react";import Ri from"styled-components";var Zi=Ri.span`
|
|
663
|
+
`;var Mi=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let r=e.props,[n,s]=mr([]),[p,c]=mr(!1),[a,g]=mr(e.id);return cr(()=>{n.length==0&&!p&&(c(!0),o({choice:[]}))},[p]),cr(()=>{a!==e.id&&(g(e.id),s([]))},[e]),cr(()=>{o({choice:n}),n.length>=r.minChoices?t(!0):t(!1)},[n]),Ze.createElement(Ei,{className:l("selectListContainer",i)},Ze.createElement(Ai,null,Ze.createElement(Ni,{className:l("selectListTitle",i)},e.title),Ze.createElement(Ii,{appearance:i,className:l("selectListSubtitle",i)},e.subtitle)),r.options.map((d,x)=>{let b=n.includes(d.id);return Ze.createElement(Oi,{key:`select-item-${x}`,onClick:()=>{if(n.includes(d.id)){s(n.filter(w=>w!==d.id));return}n.length<r.maxChoices?s([...n,d.id]):n.length==1&&r.maxChoices==1&&s([d.id])},hideBottomBorder:x===r.options.length-1,className:l("selectListSelectItem",i)},Ze.createElement(Li,{className:l("selectListItemImage",i)},d.imageUri&&Ze.createElement(Di,{src:d.imageUri,alt:`select-icon-${x}`}),Ze.createElement($i,{appearance:i,className:l("selectListSelectItemText",i)},d.title)),Ze.createElement(Qe,{appearance:i,value:b,primaryColor:i.theme.colorPrimary}))}))};import ke,{useEffect as Io,useState as ro}from"react";var dp=({children:e,id:t,shouldWrap:o=!1})=>ke.createElement(ke.Fragment,null,o?ke.createElement("div",{key:t,style:{width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:1,overflowY:"auto"}},e):e),Oo=({appearance:e,steps:t,selectedStep:o,customStepTypes:i,customVariables:r,onButtonClick:n,onStepCompletion:s,flowId:p,type:c,hideOnFlowCompletion:a,onComplete:g,setVisible:d,setShowModal:x,onDismiss:b,showPagination:w=!1,customFormElements:v,allowBackNavigation:f,validationHandler:E,onFormDataChange:S,showFooter:y,prefillData:A})=>{var V;let m={...{linkCollection:vi,multiInput:xi,callToAction:Bi,selectList:Mi},...i},{primaryCTAClickSideEffects:B,secondaryCTAClickSideEffects:F}=ie(),[k,O]=ro(!1),[N,I]=ro({}),[$,D]=ro(!1),[ee,U]=ro(!1),[te,fe]=ro(null),X=t[o]??null,{markStepCompleted:H,markStepStarted:j,isLoading:Ce,updateCustomVariables:Ae,markFlowCompleted:be}=Y();Io(()=>{Ae(r)},[r,Ce]),Io(()=>{S&&S(N,me(),t[o],o)},[N]),Io(()=>{window&&f&&!ee&&(window.location.hash=t[o].id,U(!0))},[f,ee,U]),Io(()=>{var G;if(window&&((G=window==null?void 0:window.location)!=null&&G.hash)&&window.location.hash.replace("#","")!==t[o].id){let ne=window.location.hash.replace("#",""),se=t.findIndex(pe=>pe.id===ne);se!==-1&&j(p,t[se].id)}},[(V=window==null?void 0:window.location)==null?void 0:V.hash,j,o,t]);function me(){return{data:N[t[o].id]??{},stepId:t[o].id,customVariables:r}}function J(G,ne,se){let pe=o+1<t.length?t[o+1]:null;return s&&s(G,se,pe,N,me()),n?n(G,o,ne,pe):!0}function ge(G,ne){I(se=>{let pe={};return pe[G.id]=ne,{...se,...pe}})}function re(G){return G.selectedStep.imageUri?ke.createElement(Ti,{image:G.selectedStep.imageUri,appearance:e,className:l("formContainerSidebarImage",e)}):null}let L=y&&ke.createElement(ki,{step:t[o],canContinue:k&&!$,formType:c,selectedStep:o,appearance:e,onPrimaryClick:async()=>{if(D(!0),E){let se=await E(t[o],o,t[o+1],N,me());if(se||se===!1){fe(typeof se=="string"?se:null),D(!1);return}else fe(null)}let G={...me()};await H(p,t[o].id,G),o+1<t.length&&await j(p,t[o+1].id);let ne=J(t[o],"primary",o);o+1>=t.length&&(g&&g(),b&&b(),a&&ne&&(d&&d(!1),x(!1)),await be(p)),B(t[o]),D(!1),window&&f&&o+1<t.length&&(window.location.hash=t[o+1].id)},onSecondaryClick:()=>{J(t[o],"secondary",o),F(t[o])},onBack:async()=>{o-1>=0&&(D(!0),await j(p,t[o-1].id),D(!1))},steps:t,allowBackNavigation:f,errorMessage:te});return ke.createElement(ke.Fragment,null,ke.createElement(Si,{className:l("formContainer",e)},ke.createElement(bi,null,ke.createElement(dp,{id:o,shouldWrap:c==="large-modal"},ke.createElement(wi,{key:X.id,type:c,className:l("formContent",e)},t.map(G=>{let ne=m[G.type];return X.id!==G.id?null:ke.createElement(ne,{key:G.id,stepData:G,canContinue:k,setCanContinue:O,onSaveData:se=>{ge(G,se)},appearance:e,customFormElements:v,flowId:p,prefillData:A})}),w&&ke.createElement(Pi,{className:l("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),L))),c=="large-modal"&&ke.createElement(re,{selectedStep:t[o]})))};import io from"react";import{createGlobalStyle as cp}from"styled-components";function oe({appearance:e}){if(!e||!e.styleOverrides)return io.createElement(io.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([i,r])=>typeof r=="object");if(t.length===0)return io.createElement(io.Fragment,null);let o=cp`
|
|
664
|
+
${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map(([s,p])=>`${Xo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return io.createElement(o,{inlineStyles:t})}var Ui=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:r,customVariables:n,customFormElements:s,onComplete:p,appearance:c,hideOnFlowCompletion:a=!0,onStepCompletion:g,onButtonClick:d,dismissible:x=!0,endFlowOnDismiss:b=!1,modalPosition:w="center",repeatable:v=!1,onDismiss:f,showPagination:E=!1,allowBackNavigation:S=!1,validationHandler:y,showFrigadeBranding:A=!1,onFormDataChange:C,showFooter:m=!0,prefillData:B={}})=>{let{getFlow:F,getFlowSteps:k,isLoading:O,targetingLogicShouldHideFlow:N,getFlowStatus:I,getCurrentStepIndex:$,markFlowCompleted:D,markFlowNotStarted:ee}=Y(),U=$(e),{mergeAppearanceWithDefault:te}=Q(),[fe,X]=up(!1),{setOpenFlowState:H,getOpenFlowState:j,hasOpenModals:Ce}=we();c=te(c);let[Ae,be]=i!==void 0&&r!==void 0?[i,r]:[j(e,!0),re=>H(e,re)];if(mp(()=>{!fe&&!O&&(X(!0),I(e)===q&&v&&(ee(e),window&&window.localStorage&&Object.keys(window.localStorage).forEach(L=>{L.startsWith(ar)&&window.localStorage.removeItem(L)})),X(!0))},[fe,X,O]),O)return null;let me=F(e);if(!me||N(me))return null;let J=k(e);if(!J||i!==void 0&&i===!1||I(e)===q&&a||(o=="modal"||o=="corner-modal")&&Ce(e))return null;let ge=()=>{be(!1),f&&f(),b===!0&&D(e)};if(w=="center"&&o==="modal"||o==="large-modal"){let re={padding:"24px"};return o==="large-modal"?(re.width="85%",re.height="90%",re.maxHeight="800px",re.minHeight="500px",re.padding="0"):re.width="400px",Ve.createElement(_e,{appearance:c,onClose:ge,visible:Ae,style:re,dismissible:x,showFrigadeBranding:A},Ve.createElement(oe,{appearance:c}),Ve.createElement(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:E,customFormElements:s,allowBackNavigation:S,validationHandler:y,onFormDataChange:C,showFooter:m,prefillData:B}))}return o==="modal"&&w!=="center"?Ve.createElement(wo,{appearance:c,onClose:ge,visible:Ae,modalPosition:w},Ve.createElement(oe,{appearance:c}),Ve.createElement(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:E,customFormElements:s,allowBackNavigation:S,validationHandler:y,onFormDataChange:C,showFooter:m,prefillData:B})):Ve.createElement(Ve.Fragment,null,Ve.createElement(oe,{appearance:c}),Ve.createElement(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:a,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:E,customFormElements:s,allowBackNavigation:S,validationHandler:y,onFormDataChange:C,showFooter:m,prefillData:B}))},zi=Ui;import{useCallback as Wi,useContext as fp,useEffect as gp}from"react";function ur(){let{organizationId:e,userId:t,setOrganizationId:o}=fp(K),{mutateUserFlowState:i}=ve(),{config:r,apiUrl:n}=We(),s=It(),{verifySDKInitiated:p}=Ot();gp(()=>{if(t&&e){if(t.startsWith(Lt))return;let g=`frigade-user-group-registered-${t}-${e}`;localStorage.getItem(g)||(s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(g,"true"))}},[t,e]);let c=Wi(async g=>{if(!p())return;if(!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let d={foreignUserId:t,foreignUserGroupId:e,properties:g};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(d)}),i()},[e,t,r,i]),a=Wi(async(g,d)=>{if(!p())return;if(!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationId:e,userId:t});return}let b={foreignUserId:t,foreignUserGroupId:e,events:[{event:g,properties:d}]};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(b)}),i()},[e,t,r,i]);return{organizationId:e,setOrganizationId:o,addPropertiesToOrganization:c,trackEventForOrganization:a}}var _i="frigade-xFrigade_guestUserId",no="frigade-xFrigade_userId",Hi=({})=>{let{setFlowResponses:e}=Xt(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=ve(),{userId:r,setUserId:n}=Jt(),[s,p]=fr(null),{getFlowStatus:c}=Y(),{flows:a,userProperties:g,setIsNewGuestUser:d,flowResponses:x}=xp(K),[b,w]=fr([]),[v,f]=fr([]),{organizationId:E}=ur();Lo(()=>{if(!o&&t)for(let C=0;C<t.length;C++){let m=t[C],B=a.find(F=>F.slug===(m==null?void 0:m.flowId));if(B&&m&&m.shouldTrigger===!0&&B.type=="FORM"&&B.triggerType==="AUTOMATIC"&&!v.includes(B.slug)){setTimeout(()=>{S(m.flowId)},500);break}}},[o,t]),Lo(()=>{x.length>0&&i()},[x]);function S(C){let m=a.find(B=>B.slug===C);m&&m.triggerType==="AUTOMATIC"&&!v.includes(m.slug)&&(f([...v,m.slug]),w([m]))}function y(){if(!r){let C=localStorage.getItem(no);if(C){n(C);return}let m=localStorage.getItem(_i);if(m){n(m);return}d(!0);let B=Lt+hp();try{localStorage.setItem(_i,B)}catch(F){console.log("Failed to save guest user id locally: Local storage unavailable",F)}n(F=>F||B)}}Lo(()=>{try{if(a){let C=[];a.forEach(m=>{if(m.data){let B=m.data.match(/"imageUri":"(.*?)"/g);B&&B.forEach(F=>{let k=F.replace('"imageUri":"',"").replace('"',"");if(C.includes(k))return;let O=new Image;O.src=k,C.push(k)})}})}}catch{}},[a]),Lo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(Lt))try{localStorage.setItem(no,r)}catch(C){console.log("Failed to save user id locally: Local storage available",C)}r===null&&setTimeout(()=>{r===null&&y()},50)},[r,a,g]);function A(){return bt.createElement(bt.Fragment,null,b.map(C=>c(C.slug)!==$e?null:bt.createElement("span",{key:C.slug},bt.createElement(zi,{flowId:C.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return bt.createElement(bt.Fragment,null,bt.createElement(A,null))};import{ErrorBoundary as jp}from"react-error-boundary";import so from"core-js-pure/actual/structured-clone";function gr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pt(...e){let t=e.shift(),o=e.length===1?e[0]:pt(...e);if(!gr(t)||!gr(o))throw new Error("deepmerge can only merge Objects");let i=so(t);return Object.entries(o).forEach(([r,n])=>{gr(n)?i[r]!==void 0?Object.assign(i,{[r]:pt(i[r],so(n))}):Object.assign(i,{[r]:so(n)}):Array.isArray(n)?i[r]!==void 0?Object.assign(i,{[r]:[...i[r],...so(n)]}):Object.assign(i,{[r]:so(n)}):Object.assign(i,{[r]:n})}),i}var ji={colorPrimary:"colors.primary.background",colorText:"colors.neutral.foreground",colorBackground:"colors.neutral.background",colorBackgroundSecondary:"colors.secondary.background",colorTextOnPrimaryBackground:"colors.primary.foreground",colorTextSecondary:"colors.secondary.foreground",colorTextDisabled:"colors.gray700",colorBorder:"colors.gray800",colorTextError:"colors.negative.foreground",borderRadius:"radii.lg"};function Cp(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(ji[o]){let r=ji[o].split("."),n=t;r.forEach((s,p)=>{n[s]||(n[s]=p===r.length-1?i:{}),n=n[s]})}}),t}function yp(e){if(!e)return;let t=pt({},e),o={};return Object.keys(t).forEach(i=>{let r=`.fr-${i}`;o[r]=t[i]}),o}function Vi(e){let{theme:t,styleOverrides:o}=e,i=Cp(t),r=yp(o);return{overrides:i,css:r}}import Op from"styled-components";import{compose as Lp,variant as Ki}from"styled-system";import Gi from"react";import Sp,{ThemeProvider as bp,useTheme as wp}from"styled-components";import{border as Tp,color as Fp,compose as kp,get as Pp,shadow as vp,space as Bp,system as Ep,typography as Ap}from"styled-system";var Np={width:{property:"width",scale:"sizes",transform:(e,t)=>Pp(t,e,!(typeof e=="number"&&!isNaN(e))||e>1?e:e*100+"%")},height:{property:"height",scale:"sizes"},minWidth:{property:"minWidth",scale:"sizes"},minHeight:{property:"minHeight",scale:"sizes"},maxWidth:{property:"maxWidth",scale:"sizes"},maxHeight:{property:"maxHeight",scale:"sizes"},overflow:!0,overflowX:!0,overflowY:!0,display:!0,verticalAlign:!0},Ip=Sp("div")(({css:e})=>e,kp(Tp,Fp,vp,Bp,Ap,Ep(Np))),lo=({as:e,children:t,overrides:o,...i})=>{let r=wp(),n={border:"none",boxSizing:"border-box",m:0,p:0},s=()=>Gi.createElement(Ip,{as:e,...n,...i},t);if(o!==void 0){let p=pt(r,o);return Gi.createElement(bp,{theme:p},s())}return s()};var ao={Primary:{backgroundColor:"primary.background",color:"primary.foreground","&:hover":{backgroundColor:"blue400"}},Secondary:{backgroundColor:"white",border:"1px solid",borderColor:"gray800",color:"neutral.foreground","&:hover":{backgroundColor:"blue900"}},Link:{backgroundColor:"transparent",color:"primary.inverted"},Plain:{backgroundColor:"transparent",color:"neutral.foreground"}},Dp={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},qi=Op(lo)(()=>({whiteSpace:"nowrap"}),Lp(Ki({scale:"components.Button",variants:"components.Button"}),Ki({prop:"size",variants:Dp})));import $p from"styled-components";import{variant as Mp,system as Up}from"styled-system";var Do={Display1:{fontSize:"5xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"4xl"},Display2:{fontSize:"4xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"3xl"},H1:{fontSize:"3xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"2xl"},H2:{fontSize:"2xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"xl"},H3:{fontSize:"xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"lg"},H4:{fontSize:"lg",fontWeight:"bold",letterSpacing:"md",lineHeight:"md"},Body1:{fontSize:"md",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Body2:{fontSize:"sm",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Caption:{fontSize:"xs",fontWeight:"regular",letterSpacing:"md",lineHeight:"sm"}};var Yi=$p(lo)(Mp({scale:"components.Text",variants:"components.Text"}),Up({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Xi=4,Ji="px",zp=20,Wp=Object.fromEntries(Array.from(Array(zp+1),(e,t)=>t===0?[.5,`${.5*Xi}${Ji}`]:[t,`${t*Xi}${Ji}`])),zt={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",red500:"#c00000"},xr={colors:{...zt,neutral:{foreground:zt.gray300},primary:{background:zt.blue500,foreground:zt.white,inverted:zt.blue500},negative:{foreground:zt.red500}},fonts:{default:"TT Interphases Pro, sans-serif"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{regular:400,semibold:500,bold:700},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"},radii:{md:"8px",lg:"20px",round:"50%"},shadows:{md:"0px 4px 20px rgba(0, 0, 0, 0.06)"},space:Wp,components:{Button:ao,Text:Do}};var Qi="https://api.frigade.com",K=_p({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:Je,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{},apiUrl:Qi,readonly:!1});function Vp(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var Gp=({publicApiKey:e,userId:t,organizationId:o,config:i,children:r})=>{var fe,X;let[n,s]=Ie(t||null),[p,c]=Ie(o||null),[a,g]=Ie([]),[d,x]=Ie([]),[b,w]=Ie([]),[v,f]=Ie({}),[E,S]=Ie({}),[y,A]=Ie([]),[C,m]=Ie({}),[B,F]=Ie(!1),[k,O]=Ie(!1),[N,I]=Ie(!ee(e)),$=(H,j)=>{if(j==="_blank"){window.open(H,"_blank");return}setTimeout(()=>{window.location.href=H},50)},D={theme:{...Je.theme,...((fe=i==null?void 0:i.defaultAppearance)==null?void 0:fe.theme)??{}},styleOverrides:{...Je.styleOverrides,...((X=i==null?void 0:i.defaultAppearance)==null?void 0:X.styleOverrides)??{}}};function ee(H){return!!(H&&H.length>10&&H.substring(0,10)==="api_public")}$o(()=>{t&&s(t)},[t]),$o(()=>{n&&window&&window.localStorage&&window.localStorage.getItem(no)&&window.localStorage.getItem(no)!==n&&Vp()},[n]),$o(()=>{o&&c(o)},[o]),$o(()=>{if(ee(e))I(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),I(!0);return}},[e,I]);let U={publicApiKey:e,userId:n,setUserId:s,setFlows:g,flows:a,failedFlowResponses:d,setFailedFlowResponses:x,flowResponses:b,setFlowResponses:w,userProperties:v,setUserProperties:f,openFlowStates:E,setOpenFlowStates:S,completedFlowsToKeepOpenDuringSession:y,setCompletedFlowsToKeepOpenDuringSession:A,customVariables:C,setCustomVariables:m,isNewGuestUser:B,setIsNewGuestUser:F,hasActiveFullPageFlow:k,setHasActiveFullPageFlow:O,organizationId:p,setOrganizationId:c,navigate:i&&i.navigate?i.navigate:$,defaultAppearance:D,shouldGracefullyDegrade:N,setShouldGracefullyDegrade:I,apiUrl:i&&i.apiUrl?i.apiUrl:Qi,readonly:i&&i.readonly?i.readonly:!1};if(N)return wt.createElement(K.Provider,{value:U},r);let{overrides:te}=Vi(D);return wt.createElement(jp,{fallback:wt.createElement(wt.Fragment,null,r)},wt.createElement(K.Provider,{value:U},wt.createElement(Hp,{theme:pt(D.theme,xr,te??{},(i==null?void 0:i.theme)??{})},r,wt.createElement(Hi,null))))};import Ld from"react";import ce,{useEffect as vs,useState as Bs}from"react";import ze,{useState as pd}from"react";import kt from"styled-components";import zo from"react";import Tt from"react";import Ri from"styled-components";var Zi=Ri.span`
|
|
665
665
|
font-weight: 600;
|
|
666
666
|
font-size: 14px;
|
|
667
667
|
font-style: normal;
|
|
@@ -672,7 +672,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
672
672
|
vertical-align: middle;
|
|
673
673
|
margin-left: 32px;
|
|
674
674
|
padding-right: 12px;
|
|
675
|
-
`,
|
|
675
|
+
`,Kp=Ri.div`
|
|
676
676
|
flex-direction: row;
|
|
677
677
|
justify-content: space-between;
|
|
678
678
|
display: flex;
|
|
@@ -680,11 +680,11 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
680
680
|
padding-bottom: 20px;
|
|
681
681
|
padding-right: 8px;
|
|
682
682
|
width: 100%;
|
|
683
|
-
|
|
683
|
+
`,Mo=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:r,primaryColor:n="#000000",checkBoxType:s="round",appearance:p})=>Tt.createElement(Tt.Fragment,null,Tt.createElement(Kp,{className:l("checklistStepsContainer",p),appearance:p,style:{...r}},i==="left"&&e&&Tt.createElement(Zi,{className:l("checklistStepLabel",p),style:o},e),Tt.createElement(Qe,{appearance:p,value:t,type:s,primaryColor:n}),i==="right"&&e&&Tt.createElement(Zi,{className:l("checklistStepLabel",p),style:o},e)),Tt.createElement(oe,{appearance:p}));import po from"styled-components";var en=po.div`
|
|
684
684
|
font-weight: 700;
|
|
685
685
|
font-size: 18px;
|
|
686
686
|
line-height: 22px;
|
|
687
|
-
`,tn=
|
|
687
|
+
`,tn=po.p`
|
|
688
688
|
font-weight: 600;
|
|
689
689
|
font-size: 16px;
|
|
690
690
|
line-height: 24px;
|
|
@@ -692,7 +692,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
692
692
|
letter-spacing: 0.32px;
|
|
693
693
|
font-style: normal;
|
|
694
694
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
695
|
-
`,on=
|
|
695
|
+
`,on=po.p`
|
|
696
696
|
font-weight: 400;
|
|
697
697
|
font-size: 14px;
|
|
698
698
|
font-style: normal;
|
|
@@ -701,45 +701,45 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
701
701
|
letter-spacing: 0.28px;
|
|
702
702
|
margin: 8px 0px 0px 0px;
|
|
703
703
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
704
|
-
`,
|
|
704
|
+
`,Uo=po.div`
|
|
705
705
|
width: 6px;
|
|
706
706
|
position: absolute;
|
|
707
707
|
left: 0;
|
|
708
708
|
height: 100%;
|
|
709
709
|
border-top-right-radius: 4px;
|
|
710
710
|
border-bottom-right-radius: 4px;
|
|
711
|
-
`,rn=
|
|
711
|
+
`,rn=po.div`
|
|
712
712
|
flex-direction: row;
|
|
713
713
|
justify-content: flex-start;
|
|
714
714
|
border-bottom: 1px solid ${e=>e.theme.colorBorder};
|
|
715
715
|
padding-right: 16px;
|
|
716
|
-
`;var nn=({data:e,index:t,isSelected:o,primaryColor:i,style:r,onClick:n,appearance:s})=>{var p,c;return
|
|
716
|
+
`;var nn=({data:e,index:t,isSelected:o,primaryColor:i,style:r,onClick:n,appearance:s})=>{var p,c;return zo.createElement("div",{style:{position:"relative",paddingLeft:"0px"},onClick:()=>{n()}},o&&zo.createElement(Uo,{className:l("checklistStepItemSelectedIndicator",s),layoutId:"checklis-step-selected",style:{backgroundColor:((p=s==null?void 0:s.theme)==null?void 0:p.colorPrimary)??i}}),zo.createElement(rn,{className:l("checklistStepItem",s),key:`hero-checklist-step-${t}`,appearance:s,role:"listitem"},zo.createElement(Mo,{value:e.complete,labelPosition:"left",label:e.stepName??e.title,style:r,primaryColor:((c=s==null?void 0:s.theme)==null?void 0:c.colorPrimary)??i,appearance:s})))};import Ft from"react";import hr from"styled-components";import Re from"styled-components";var ih=Re.div`
|
|
717
717
|
background: #ffffff;
|
|
718
718
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
719
719
|
border-radius: 20px;
|
|
720
720
|
width: 385px;
|
|
721
721
|
padding: 24px 16px 16px 16px;
|
|
722
|
-
`,
|
|
722
|
+
`,nh=Re.div`
|
|
723
723
|
/* Border bottom only on collapsable */
|
|
724
|
-
`,
|
|
724
|
+
`,sh=Re.div`
|
|
725
725
|
display: flex;
|
|
726
726
|
flex-direction: row;
|
|
727
727
|
justify-content: space-between;
|
|
728
728
|
align-content: flex-start;
|
|
729
|
-
`,
|
|
729
|
+
`,lh=Re.h1`
|
|
730
730
|
display: flex;
|
|
731
731
|
margin: 0;
|
|
732
732
|
font-size: 18px;
|
|
733
|
-
`,
|
|
733
|
+
`,ah=Re.h2`
|
|
734
734
|
font-size: 15px;
|
|
735
735
|
color: #4d4d4d;
|
|
736
|
-
`,
|
|
736
|
+
`,ph=Re.ul`
|
|
737
737
|
list-style: none;
|
|
738
|
-
`,
|
|
738
|
+
`,dh=Re.li`
|
|
739
739
|
display: flex;
|
|
740
740
|
justify-content: flex-start;
|
|
741
741
|
flex-direction: row;
|
|
742
|
-
`,sn=
|
|
742
|
+
`,sn=Re.div`
|
|
743
743
|
position: absolute;
|
|
744
744
|
left: 0;
|
|
745
745
|
top: 0;
|
|
@@ -747,7 +747,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
747
747
|
width: ${e=>e.fgWidth};
|
|
748
748
|
border-radius: 20px;
|
|
749
749
|
background-color: ${e=>e.theme.colorPrimary};
|
|
750
|
-
`,ln=
|
|
750
|
+
`,ln=Re.div`
|
|
751
751
|
position: relative;
|
|
752
752
|
left: 0;
|
|
753
753
|
top: 0;
|
|
@@ -757,33 +757,33 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
757
757
|
border-radius: 20px;
|
|
758
758
|
background-color: ${e=>e.theme.colorPrimary};
|
|
759
759
|
opacity: 0.12;
|
|
760
|
-
`;var
|
|
760
|
+
`;var qp=hr.div`
|
|
761
761
|
display: flex;
|
|
762
762
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
763
763
|
justify-content: flex-start;
|
|
764
764
|
align-items: ${e=>e.textLocation=="top"?"flex-end":"center"};
|
|
765
765
|
width: 100%;
|
|
766
766
|
|
|
767
|
-
${e=>
|
|
768
|
-
`,
|
|
767
|
+
${e=>Ye(e)}
|
|
768
|
+
`,Yp=hr.div`
|
|
769
769
|
flex-grow: 1;
|
|
770
770
|
position: relative;
|
|
771
771
|
${e=>e.textLocation=="top"?"width: 100%;":""}
|
|
772
|
-
`,
|
|
772
|
+
`,Xp=hr.span`
|
|
773
773
|
font-weight: 600;
|
|
774
774
|
font-size: 14px;
|
|
775
775
|
line-height: 18px;
|
|
776
776
|
padding-right: ${e=>e.padding};
|
|
777
777
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
778
778
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
779
|
-
${e=>
|
|
780
|
-
`;var
|
|
779
|
+
${e=>Ye(e)}
|
|
780
|
+
`;var Oe=({count:e,total:t,display:o="count",textLocation:i="left",style:r={},textStyle:n={},appearance:s})=>{if(t===0)return Ft.createElement(Ft.Fragment,null);let p=e===0?"10px":`${e/t*100}%`,c=o==="compact"?"5px":"10px",a=Math.round(e/t*100),g=o==="compact"?"5px":"14px",d;return o==="count"?d=`${e}/${t}`:o==="compact"?d=`${a}%`:o==="percent"&&(d=`${a}% complete`),i==="top"&&(g="0px"),Ft.createElement(qp,{className:l("progressBarContainer",s),textLocation:i,styleOverrides:r},Ft.createElement(Xp,{className:l("progressBarStepText",s),style:{...n,fontSize:o==="compact"?12:14,fontWeight:o==="compact"?400:600},appearance:s,padding:g,textLocation:i},d),Ft.createElement(Yp,{textLocation:i,className:l("progressBar",s)},Ft.createElement(sn,{style:{zIndex:o=="compact"?1:5},fgWidth:p,barHeight:c,appearance:s,className:l("progressBarFill",s)}),Ft.createElement(ln,{className:l("progressBarBackground",s),barHeight:c,appearance:s})))};import co from"react";import Qp from"styled-components";import _o from"react";import Wo from"react";var Wt=({stepData:e,appearance:t})=>Wo.createElement(Wo.Fragment,null,Wo.createElement(tn,{appearance:t,className:l("checklistStepTitle",t),dangerouslySetInnerHTML:le(e.title)}),Wo.createElement(on,{appearance:t,className:l("checklistStepSubtitle",t),dangerouslySetInnerHTML:le(e.subtitle)}));import Cr from"react";var _t=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},i=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return Cr.createElement(Bo,{className:l("ctaContainer",t)},Cr.createElement(Z,{appearance:t,title:e.primaryButtonTitle,onClick:o}),e.secondaryButtonTitle&&Cr.createElement(Z,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:i,style:{width:"auto",marginRight:"12px"}}))};var Ht=({stepData:e,appearance:t})=>_o.createElement(_o.Fragment,null,_o.createElement(Wt,{stepData:e,appearance:t}),_o.createElement(_t,{stepData:e,appearance:t}));import Jp from"react";function an(e){return Jp.createElement(je,{appearance:e.appearance,videoUri:e.videoUri})}var yr="default",Zp=Qp.img`
|
|
781
781
|
border-radius: 4px;
|
|
782
782
|
max-height: 260px;
|
|
783
783
|
min-height: 200px;
|
|
784
|
-
`,pn=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return
|
|
784
|
+
`,pn=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return co.createElement("div",null,o)}return co.createElement(en,{className:l("checklistStepContent",t)},e.imageUri?co.createElement(Zp,{className:l("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?co.createElement(an,{videoUri:e.videoUri,appearance:t}):null,co.createElement(Ht,{stepData:e,appearance:t}))};import Be,{useRef as Rp,useState as ed}from"react";import jt from"styled-components";var dn=jt.div`
|
|
785
785
|
display: block;
|
|
786
|
-
`,
|
|
786
|
+
`,td=jt.div`
|
|
787
787
|
display: flex;
|
|
788
788
|
flex-direction: row;
|
|
789
789
|
flex-wrap: wrap;
|
|
@@ -793,20 +793,20 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
793
793
|
align-content: center;
|
|
794
794
|
margin-top: 24px;
|
|
795
795
|
margin-bottom: 24px;
|
|
796
|
-
`,
|
|
796
|
+
`,od=jt.div`
|
|
797
797
|
display: flex;
|
|
798
798
|
align-items: center;
|
|
799
799
|
justify-content: flex-start;
|
|
800
800
|
flex-direction: column;
|
|
801
801
|
margin-right: 16px;
|
|
802
|
-
`,
|
|
802
|
+
`,rd=jt.video`
|
|
803
803
|
width: 200px;
|
|
804
804
|
height: 120px;
|
|
805
|
-
`,
|
|
805
|
+
`,id=jt.div`
|
|
806
806
|
font-size: 14px;
|
|
807
807
|
line-height: 20px;
|
|
808
808
|
text-align: center;
|
|
809
|
-
`,
|
|
809
|
+
`,nd=jt.div`
|
|
810
810
|
position: absolute;
|
|
811
811
|
width: 200px;
|
|
812
812
|
height: 120px;
|
|
@@ -826,9 +826,9 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
826
826
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
827
827
|
border-radius: 50%;
|
|
828
828
|
}
|
|
829
|
-
`,cn="videoCarousel",mn=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return
|
|
829
|
+
`,cn="videoCarousel",mn=({stepData:e,appearance:t})=>{var r;if(!((r=e.props)!=null&&r.videos))return Be.createElement(dn,null,Be.createElement(Ht,{stepData:e,appearance:t}));function o({video:n}){let s=Rp(),[p,c]=ed(!1);return Be.createElement(od,null,!p&&Be.createElement(nd,{onClick:()=>{c(!0),s.current.play()},appearance:t},Be.createElement(Eo,null)),Be.createElement(rd,{controls:p,ref:s,play:p,src:n.uri}),Be.createElement(id,null,n.title))}let i=e.props;return i.videos?Be.createElement(dn,null,Be.createElement(Wt,{stepData:e,appearance:t}),Be.createElement(td,null,i.videos.map((n,s)=>Be.createElement("span",{key:`${n.uri}-${s}`},Be.createElement(o,{video:n})))),Be.createElement(_t,{stepData:e,appearance:t})):null};import et from"react";import Ho from"styled-components";var un=Ho.div`
|
|
830
830
|
display: block;
|
|
831
|
-
`,
|
|
831
|
+
`,sd=Ho.pre`
|
|
832
832
|
display: block;
|
|
833
833
|
background-color: #2a2a2a;
|
|
834
834
|
color: #f8f8f8;
|
|
@@ -844,28 +844,28 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
844
844
|
white-space: -o-pre-wrap; /* Opera 7 */
|
|
845
845
|
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
|
846
846
|
margin-bottom: 24px;
|
|
847
|
-
`,
|
|
847
|
+
`,ld=Ho.div`
|
|
848
848
|
font-size: 15px;
|
|
849
849
|
line-height: 20px;
|
|
850
850
|
margin-bottom: 12px;
|
|
851
851
|
margin-top: 12px;
|
|
852
|
-
`,
|
|
852
|
+
`,ad=Ho.div`
|
|
853
853
|
margin-top: 24px;
|
|
854
|
-
`,fn="codeSnippet",gn=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.codeSnippets))return
|
|
854
|
+
`,fn="codeSnippet",gn=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.codeSnippets))return et.createElement(un,null,et.createElement(Ht,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?et.createElement(un,null,et.createElement(Wt,{stepData:e,appearance:t}),et.createElement(ad,null,o.codeSnippets.map((r,n)=>et.createElement("div",{key:n},r.title?et.createElement(ld,null,r.title):null,r.code?et.createElement(sd,null,r.code):null))),et.createElement(_t,{stepData:e,appearance:t})):null};var dd=kt.div`
|
|
855
855
|
display: flex;
|
|
856
856
|
flex-direction: row;
|
|
857
857
|
overflow: hidden;
|
|
858
858
|
min-width: ${e=>e.type!="modal"?"600px":"100%"};
|
|
859
859
|
background: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
860
860
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
861
|
-
`,
|
|
861
|
+
`,cd=kt.h1`
|
|
862
862
|
font-size: 18px;
|
|
863
863
|
font-style: normal;
|
|
864
864
|
font-weight: 700;
|
|
865
865
|
line-height: 24px;
|
|
866
866
|
letter-spacing: 0.36px;
|
|
867
867
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
868
|
-
`,
|
|
868
|
+
`,md=kt.h2`
|
|
869
869
|
font-size: 14px;
|
|
870
870
|
font-style: normal;
|
|
871
871
|
font-weight: 400;
|
|
@@ -873,22 +873,22 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
873
873
|
letter-spacing: 0.28px;
|
|
874
874
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
875
875
|
margin: 10px 0px 0px 0px;
|
|
876
|
-
`,xn=
|
|
876
|
+
`,xn=kt.div``,ud=kt.div`
|
|
877
877
|
list-style: none;
|
|
878
878
|
padding: 0;
|
|
879
879
|
margin: 0;
|
|
880
880
|
cursor: pointer;
|
|
881
881
|
width: 300px;
|
|
882
|
-
`,
|
|
882
|
+
`,fd=kt.div`
|
|
883
883
|
width: 1px;
|
|
884
884
|
margin-right: 40px;
|
|
885
885
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
886
|
-
`,
|
|
886
|
+
`,gd=kt.div`
|
|
887
887
|
flex: 2;
|
|
888
888
|
padding: 2rem 2rem 2rem 0rem;
|
|
889
|
-
`,
|
|
889
|
+
`,xd=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:r,setSelectedStep:n,className:s="",customStepTypes:p=new Map,appearance:c,type:a})=>{let{mergeAppearanceWithDefault:g}=Q();c=g(c);let x={...{[yr]:pn,[cn]:mn,[fn]:gn},...p},[b,w]=pd(0),v=r??b,f=n??w,E=o.filter(y=>y.complete===!0).length,S=()=>{var y;return!((y=o[v])!=null&&y.type)||!x[o[v].type]?x[yr]({stepData:o[v],appearance:c}):x[o[v].type]({stepData:o[v],appearance:c})};return ze.createElement(dd,{type:a,style:i,className:s,appearance:c},ze.createElement(xn,{style:{flex:1}},ze.createElement(xn,{style:{padding:"28px 0px 28px 28px",borderBottom:"1px solid #E5E5E5"}},ze.createElement(cd,{className:l("checklistTitle",c),appearance:c},e),ze.createElement(md,{className:l("checklistSubtitle",c),appearance:c},t),ze.createElement(Oe,{total:o.length,count:E,style:{marginTop:"24px",paddingRight:"40px"},appearance:c})),ze.createElement(ud,{className:l("checklistStepsContainer",c)},o.map((y,A)=>ze.createElement(nn,{data:y,index:A,key:A,listLength:o.length,isSelected:A===v,primaryColor:c.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{f(A)}})))),ze.createElement(fd,{appearance:c,className:l("checklistDivider",c)}),ze.createElement(gd,null,ze.createElement(S,null)))},Sr=xd;import z,{useState as bd}from"react";import hn from"react";import hd from"styled-components";var Cd=hd.svg`
|
|
890
890
|
transition: 'transform 0.35s ease-in-out';
|
|
891
|
-
`,
|
|
891
|
+
`,Vt=({style:e,className:t})=>hn.createElement(Cd,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e,className:t},hn.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import ue from"styled-components";var br={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},Cn=ue.div`
|
|
892
892
|
max-height: 350px;
|
|
893
893
|
padding-bottom: 40px;
|
|
894
894
|
`,yn=ue.div`
|
|
@@ -1020,11 +1020,11 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1020
1020
|
`,Dn=ue.div`
|
|
1021
1021
|
display: block;
|
|
1022
1022
|
width: 100%;
|
|
1023
|
-
`;import
|
|
1023
|
+
`;import yd from"styled-components";var $n=yd.div`
|
|
1024
1024
|
flex-direction: column;
|
|
1025
1025
|
justify-content: center;
|
|
1026
1026
|
display: flex;
|
|
1027
|
-
`;import
|
|
1027
|
+
`;import ot from"react";import tt from"styled-components";var Mn=tt.div`
|
|
1028
1028
|
border: 1px solid #fafafa;
|
|
1029
1029
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
1030
1030
|
border-radius: 14px;
|
|
@@ -1032,13 +1032,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1032
1032
|
display: flex;
|
|
1033
1033
|
flex-direction: column;
|
|
1034
1034
|
overflow: hidden;
|
|
1035
|
-
`,Un=
|
|
1035
|
+
`,Un=tt.div`
|
|
1036
1036
|
display: flex;
|
|
1037
1037
|
flex-wrap: wrap;
|
|
1038
1038
|
justify-content: space-between;
|
|
1039
1039
|
overflow: hidden;
|
|
1040
1040
|
row-gap: 10px;
|
|
1041
|
-
`,zn=
|
|
1041
|
+
`,zn=tt.div`
|
|
1042
1042
|
${e=>T(e)} {
|
|
1043
1043
|
color: #595959;
|
|
1044
1044
|
}
|
|
@@ -1048,7 +1048,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1048
1048
|
line-height: 12px;
|
|
1049
1049
|
letter-spacing: 0.09em;
|
|
1050
1050
|
margin-bottom: 12px;
|
|
1051
|
-
`,Wn=
|
|
1051
|
+
`,Wn=tt.div`
|
|
1052
1052
|
${e=>T(e)} {
|
|
1053
1053
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1054
1054
|
background: #ffffff;
|
|
@@ -1061,7 +1061,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1061
1061
|
|
|
1062
1062
|
max-width: 150px;
|
|
1063
1063
|
min-width: 200px;
|
|
1064
|
-
`,_n=
|
|
1064
|
+
`,_n=tt.div`
|
|
1065
1065
|
${e=>T(e)} {
|
|
1066
1066
|
background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);
|
|
1067
1067
|
}
|
|
@@ -1073,13 +1073,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1073
1073
|
justify-content: center;
|
|
1074
1074
|
align-content: center;
|
|
1075
1075
|
align-items: center;
|
|
1076
|
-
`,Hn=
|
|
1076
|
+
`,Hn=tt.div`
|
|
1077
1077
|
font-weight: 600;
|
|
1078
1078
|
font-size: 20px;
|
|
1079
1079
|
line-height: 24px;
|
|
1080
1080
|
width: 20px;
|
|
1081
1081
|
height: 20px;
|
|
1082
|
-
`,jn=
|
|
1082
|
+
`,jn=tt.div`
|
|
1083
1083
|
${e=>T(e)} {
|
|
1084
1084
|
color: #434343;
|
|
1085
1085
|
}
|
|
@@ -1088,20 +1088,20 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1088
1088
|
line-height: 17px;
|
|
1089
1089
|
margin-top: 12px;
|
|
1090
1090
|
margin-bottom: 8px;
|
|
1091
|
-
`,Vn=
|
|
1091
|
+
`,Vn=tt.div`
|
|
1092
1092
|
${e=>T(e)} {
|
|
1093
1093
|
color: #8c8c8c;
|
|
1094
1094
|
}
|
|
1095
1095
|
font-weight: 400;
|
|
1096
1096
|
font-size: 12px;
|
|
1097
1097
|
line-height: 14px;
|
|
1098
|
-
`,Gn=
|
|
1098
|
+
`,Gn=tt.a`
|
|
1099
1099
|
color: ${e=>e.color};
|
|
1100
1100
|
font-size: 12px;
|
|
1101
1101
|
line-height: 14px;
|
|
1102
1102
|
font-weight: 400;
|
|
1103
1103
|
cursor: pointer;
|
|
1104
|
-
`;var
|
|
1104
|
+
`;var Sd=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=ie();return ot.createElement(Mn,{style:t,className:l("guideContainer",r)},ot.createElement(zn,{className:l("guideTitle",r)},o),ot.createElement(Un,{className:l("guideItemContainer",r)},e.map((p,c)=>ot.createElement(Wn,{key:`guide-${p.id??c}`,className:l("guideItem",r)},p.icon&&ot.createElement(_n,{className:l("guideIcon",r)},ot.createElement(Hn,null,p.icon)),ot.createElement(jn,{className:l("guideItemTitle",r),dangerouslySetInnerHTML:le(p.title)}),ot.createElement(Vn,{className:l("guideItemSubtitle",r),dangerouslySetInnerHTML:le(p.subtitle)}),ot.createElement(Gn,{className:l("guideItemLink",r),color:i,onClick:()=>{p.primaryButtonUri&&s(p),n&&n(p)}},p.primaryButtonTitle)))))},mo=Sd;var wd=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:r,onClose:n,selectedStep:s,setSelectedStep:p,customStepTypes:c,appearance:a,guideData:g,guideTitle:d,onGuideButtonClick:x})=>{let b=({stepData:m,handleSecondaryCTAClick:B,handleCTAClick:F})=>m?z.createElement(vn,{className:l("checklistStepContainer",a),"data-testid":"checklistStepContainer"},z.createElement(Bn,{appearance:a,className:l("checklistStepTitle",a),dangerouslySetInnerHTML:le(m.title)}),z.createElement(En,{appearance:a,className:l("checklistStepSubtitle",a),dangerouslySetInnerHTML:le(m.subtitle)}),z.createElement(An,{className:l("checklistCTAContainer",a)},m.secondaryButtonTitle&&z.createElement(Z,{title:m.secondaryButtonTitle,onClick:B,appearance:a,secondary:!0}),z.createElement(Z,{title:m.primaryButtonTitle,onClick:F,appearance:a}))):z.createElement(z.Fragment,null),v={...{default:m=>{var O;if((O=e[S])!=null&&O.StepContent){let N=e[S].StepContent;return z.createElement("div",null,N)}let B=e[S];return z.createElement(b,{stepData:m,handleCTAClick:()=>{B.handlePrimaryButtonClick&&B.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{B.handleSecondaryButtonClick&&B.handleSecondaryButtonClick()}})}},...c},[f,E]=bd(0),S=s??f,y=p??E,A=()=>{var m;return e?!((m=e[S])!=null&&m.type)||!v[e[S].type]?v.default(e[S]):v[e[S].type]({stepData:e[S],primaryColor:a.theme.colorPrimary}):z.createElement(z.Fragment,null)},C=e.filter(m=>m.complete).length;return r?(a.theme.modalContainer||(a.theme.borderRadius&&(br.borderRadius=a.theme.borderRadius+"px"),a.theme.modalContainer=br),z.createElement(_e,{onClose:n,visible:r,appearance:a},z.createElement(Dn,null,z.createElement(yn,null,z.createElement(Sn,{appearance:a,className:l("checklistTitle",a)},t),z.createElement(bn,{appearance:a,className:l("checklistSubtitle",a)},o)),z.createElement(Cn,null,e&&e.length>0&&z.createElement(wn,{className:l("stepsContainer",a)},z.createElement(Tn,null,z.createElement("div",{style:{flex:3}},z.createElement(Fn,{className:l("stepsTitle",a)},i)),z.createElement(Ln,null,z.createElement(Oe,{style:{width:"100%"},count:C,total:e.length,appearance:a}))),z.createElement(kn,null,z.createElement(Pn,{className:l("checklistStepListContainer",a),appearance:a},e.map((m,B)=>{let F=S===B;return z.createElement(Nn,{selected:F,className:l(`checklistStepListItem${F?"Selected":""}`,a),key:`checklist-guide-step-${m.id??B}`,disabled:m.blocked,onClick:()=>{m.blocked||y(B)},title:m.blocked?"Finish remaining steps to continue":void 0},F&&z.createElement(Uo,{className:l("checklistStepItemSelectedIndicator",a),layoutId:"checklist-step-selected",style:{backgroundColor:a.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),z.createElement(In,{selected:F,className:l(`checklistStepListStepName${F?"Selected":""}`,a)},m.stepName),z.createElement(On,null,z.createElement(Qe,{value:m.complete,type:"round",primaryColor:a.theme.colorPrimary,progress:m.progress,appearance:a}),z.createElement($n,null,z.createElement(Vt,{style:{marginLeft:"10px"},color:a.theme.colorBackgroundSecondary}))))})),z.createElement(A,null))),g&&g.length>0&&z.createElement(mo,{steps:g,title:d,primaryColor:a.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:a,onButtonClick:m=>(x&&x(m),!0)}))))):z.createElement(z.Fragment,null)},wr=wd;import Pe,{useEffect as ss,useState as Td}from"react";import he from"react";import rt from"styled-components";var Kn=rt.div`
|
|
1105
1105
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1106
1106
|
border: 1px solid;
|
|
1107
1107
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -1113,19 +1113,19 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1113
1113
|
display: flex;
|
|
1114
1114
|
flex-direction: column;
|
|
1115
1115
|
transition: max-height 0.25s;
|
|
1116
|
-
`,qn=
|
|
1116
|
+
`,qn=rt.div`
|
|
1117
1117
|
display: flex;
|
|
1118
1118
|
margin-bottom: 20px;
|
|
1119
|
-
`,Yn=
|
|
1119
|
+
`,Yn=rt.img`
|
|
1120
1120
|
border-radius: 4px;
|
|
1121
1121
|
max-height: 260px;
|
|
1122
1122
|
min-height: 200px;
|
|
1123
|
-
`,Xn=
|
|
1123
|
+
`,Xn=rt.div`
|
|
1124
1124
|
display: flex;
|
|
1125
1125
|
flex-direction: row;
|
|
1126
1126
|
justify-content: space-between;
|
|
1127
1127
|
align-items: center;
|
|
1128
|
-
`,Jn=
|
|
1128
|
+
`,Jn=rt.p`
|
|
1129
1129
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1130
1130
|
font-style: normal;
|
|
1131
1131
|
font-weight: 500;
|
|
@@ -1136,22 +1136,23 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1136
1136
|
:hover {
|
|
1137
1137
|
opacity: 0.8;
|
|
1138
1138
|
}
|
|
1139
|
-
`,Qn=
|
|
1139
|
+
`,Qn=rt.div`
|
|
1140
1140
|
cursor: pointer;
|
|
1141
|
+
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
1141
1142
|
:hover {
|
|
1142
1143
|
opacity: 0.8;
|
|
1143
1144
|
}
|
|
1144
|
-
`,
|
|
1145
|
+
`,r0=rt.div``,Zn=rt.p`
|
|
1145
1146
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1146
1147
|
font-weight: 400;
|
|
1147
1148
|
font-size: 14px;
|
|
1148
1149
|
line-height: 22px;
|
|
1149
|
-
`,Rn=
|
|
1150
|
+
`,Rn=rt.div`
|
|
1150
1151
|
display: flex;
|
|
1151
1152
|
flex-direction: row;
|
|
1152
1153
|
justify-content: flex-start;
|
|
1153
1154
|
align-items: center;
|
|
1154
|
-
`;var es=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:r,appearance:n,customStepTypes:s})=>{var d
|
|
1155
|
+
`;var es=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:r,appearance:n,customStepTypes:s})=>{var d;let p=t?{}:{transform:"rotate(90deg)"},c=t?{overflow:"hidden",maxHeight:"0px",transition:"max-height 0.2s ease-out"}:{overflow:"hidden",maxHeight:"1000px",transition:"max-height 0.15s ease-in"};function a(){return he.createElement(he.Fragment,null,e.imageUri||e.videoUri?he.createElement(qn,{className:l("stepMediaContainer",n)},e.imageUri?he.createElement(Yn,{className:l("stepImage",n),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?he.createElement(je,{appearance:n,videoUri:e.videoUri}):null):null,he.createElement(Zn,{className:l("stepSubtitle",n),appearance:n,dangerouslySetInnerHTML:le(e.subtitle)}),he.createElement(Bo,{className:l("checklistCTAContainer",n)},e.secondaryButtonTitle?he.createElement(Z,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>r(),appearance:n}):null,he.createElement(Z,{title:e.primaryButtonTitle??"Continue",onClick:()=>i(),appearance:n})))}function g(){if(!s)return null;let x=s[e.type];return x?x(e,n):null}return he.createElement(Kn,{"data-testid":`step-${e.id}`,className:l("checklistStepContainer",n),appearance:n},he.createElement(Xn,{className:l("stepHeader",n)},he.createElement(Rn,null,he.createElement(Mo,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(d=n==null?void 0:n.theme)==null?void 0:d.colorPrimary,appearance:n}),he.createElement(Jn,{appearance:n,className:l("stepTitle",n),dangerouslySetInnerHTML:le(e.title),onClick:()=>o()})),he.createElement(Qn,{className:l("stepChevronContainer",n),onClick:()=>o(),appearance:n},he.createElement(Vt,{style:{...p,transition:"transform 0.2s ease-in-out"}}))),he.createElement("div",{key:e.id,style:{...c}},g()??a()))};import Gt from"styled-components";var x0=Gt.div`
|
|
1155
1156
|
background: #ffffff;
|
|
1156
1157
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
1157
1158
|
border-radius: 6px;
|
|
@@ -1165,26 +1166,26 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1165
1166
|
|
|
1166
1167
|
max-width: 800px;
|
|
1167
1168
|
min-width: 350px;
|
|
1168
|
-
`,ts=
|
|
1169
|
+
`,ts=Gt.div`
|
|
1169
1170
|
display: flex;
|
|
1170
1171
|
flex-direction: column;
|
|
1171
|
-
`,os=
|
|
1172
|
+
`,os=Gt.h1`
|
|
1172
1173
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1173
1174
|
font-style: normal;
|
|
1174
1175
|
font-weight: 700;
|
|
1175
1176
|
font-size: 20px;
|
|
1176
1177
|
line-height: 24px;
|
|
1177
1178
|
margin-bottom: 8px;
|
|
1178
|
-
`,rs=
|
|
1179
|
+
`,rs=Gt.h2`
|
|
1179
1180
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
1180
1181
|
font-weight: 400;
|
|
1181
1182
|
font-size: 14px;
|
|
1182
1183
|
line-height: 23px;
|
|
1183
1184
|
margin: 2px 0 0 0;
|
|
1184
|
-
`,is=
|
|
1185
|
+
`,is=Gt.div`
|
|
1185
1186
|
display: block;
|
|
1186
1187
|
width: 100%;
|
|
1187
|
-
`,ns=
|
|
1188
|
+
`,ns=Gt.div`
|
|
1188
1189
|
display: flex;
|
|
1189
1190
|
width: 100%;
|
|
1190
1191
|
flex-direction: column;
|
|
@@ -1192,17 +1193,17 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1192
1193
|
padding: 24px;
|
|
1193
1194
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
1194
1195
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1195
|
-
`;var
|
|
1196
|
+
`;var Fd=({title:e,subtitle:t,steps:o,onClose:i,visible:r,autoExpandFirstIncompleteStep:n=!0,autoCollapse:s=!0,autoExpandNextStep:p=!0,selectedStep:c,setSelectedStep:a,appearance:g,type:d,className:x,customStepTypes:b,style:w})=>{let v=o.filter(C=>C.complete).length,[f,E]=Td(Array(o.length).fill(!0));ss(()=>{let C=[...f];if(n){for(let m=0;m<o.length;m++)if(!o[m].complete){C[m]=!1;break}E(C)}},[]),ss(()=>{S(c)},[c]);let S=C=>{let m=[...f];if(s)for(let B=0;B<f.length;++B)B!==C&&(m[B]=!0);m[C]=!m[C],E(m)};if(!r&&d=="modal")return Pe.createElement(Pe.Fragment,null);let y=Pe.createElement(Pe.Fragment,null,Pe.createElement(ts,null,Pe.createElement(os,{appearance:g,className:l("checklistTitle",g),dangerouslySetInnerHTML:le(e)}),Pe.createElement(rs,{appearance:g,className:l("checklistSubtitle",g),dangerouslySetInnerHTML:le(t)})),Pe.createElement(Oe,{display:"percent",count:v,total:o.length,style:{margin:"14px 0px 8px 0px"},appearance:g})),A=Pe.createElement(is,{className:xe(l("checklistContainer",g),x)},o.map((C,m)=>{let B=f[m];return Pe.createElement(es,{appearance:g,stepData:C,collapsed:B,key:`modal-checklist-${C.id??m}`,onClick:()=>{if(c===m){S(m);return}a(m)},onPrimaryButtonClick:()=>{C.handlePrimaryButtonClick&&C.handlePrimaryButtonClick(),p&&!C.completionCriteria&&m<f.length-1&&f[m+1]&&a(m+1)},onSecondaryButtonClick:()=>{C.handleSecondaryButtonClick&&C.handleSecondaryButtonClick()},customStepTypes:b})}));return d==="inline"?Pe.createElement(ns,{appearance:g,className:xe(l("checklistInlineContainer",g),x),style:w},y,A):Pe.createElement(Pe.Fragment,null,Pe.createElement(_e,{onClose:i,visible:r,appearance:g,style:{maxWidth:"600px"},headerContent:y},A))},Tr=Fd;import ae,{useEffect as Fr,useRef as Id,useState as Pt}from"react";import{useEffect as kd,useState as Pd}from"react";var ls=()=>{let e={isSmall:"(max-width: 480px)",isMedium:"(min-width: 481px) AND (max-width: 1023px)",isLarge:"(min-width: 1025px)"},t=Object.fromEntries(Object.entries(e).map(([p])=>[p,!1])),[o,i]=Pd(t),r=null,n=()=>{r!==null?clearTimeout(r):s(),r=setTimeout(()=>{s()},16)},s=()=>{let p=Object.fromEntries(Object.entries(e).map(([c,a])=>{if(!window)return[c,!1];let g=window.matchMedia(a);return g.addEventListener("change",n),[c,g.matches]}));i(p)};return kd(()=>{s()},[]),o};import Kt from"react";import de,{css as as,keyframes as ps}from"styled-components";var ds=as`
|
|
1196
1197
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1197
|
-
`,
|
|
1198
|
+
`,vd=as`
|
|
1198
1199
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
1199
|
-
`,
|
|
1200
|
+
`,Bd=ps`
|
|
1200
1201
|
from {
|
|
1201
1202
|
opacity: 0;
|
|
1202
1203
|
} to {
|
|
1203
1204
|
opacity: 1;
|
|
1204
1205
|
}
|
|
1205
|
-
`,
|
|
1206
|
+
`,Ed=ps`
|
|
1206
1207
|
from {
|
|
1207
1208
|
opacity: 1;
|
|
1208
1209
|
} to {
|
|
@@ -1232,7 +1233,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1232
1233
|
scroll-snap-align: center;
|
|
1233
1234
|
scroll-snap-stop: always;
|
|
1234
1235
|
`,us=de.div`
|
|
1235
|
-
animation: ${e=>e.reversed?Bd
|
|
1236
|
+
animation: ${e=>e.reversed?Ed:Bd} 0.25s ease-out;
|
|
1236
1237
|
background: linear-gradient(
|
|
1237
1238
|
to right,
|
|
1238
1239
|
${({theme:e})=>e.colorBackground}00,
|
|
@@ -1276,16 +1277,16 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1276
1277
|
width: 40px;
|
|
1277
1278
|
`,Cs=de(gs)`
|
|
1278
1279
|
${e=>T(e)} {
|
|
1279
|
-
${
|
|
1280
|
+
${vd}
|
|
1280
1281
|
|
|
1281
1282
|
background: ${({theme:e})=>e.colorBackground};
|
|
1282
1283
|
}
|
|
1283
|
-
`,
|
|
1284
|
+
`,O0=de.div`
|
|
1284
1285
|
color: ${({theme:e})=>e.colorPrimary};
|
|
1285
1286
|
display: flex;
|
|
1286
1287
|
flex-flow: row nowrap;
|
|
1287
1288
|
align-items: center;
|
|
1288
|
-
`,
|
|
1289
|
+
`,L0=de.div`
|
|
1289
1290
|
white-space: nowrap;
|
|
1290
1291
|
`,ys=de.div`
|
|
1291
1292
|
background: #d8fed8;
|
|
@@ -1293,30 +1294,30 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1293
1294
|
float: right;
|
|
1294
1295
|
margin-bottom: 12px;
|
|
1295
1296
|
padding: 4px 10px;
|
|
1296
|
-
`,
|
|
1297
|
+
`,Ad=de.p`
|
|
1297
1298
|
font-weight: bold;
|
|
1298
1299
|
font-size: 18px;
|
|
1299
1300
|
line-height: 22px;
|
|
1300
1301
|
letter-spacing: calc(18px * -0.01);
|
|
1301
1302
|
margin: 0;
|
|
1302
|
-
`,Ss=de(
|
|
1303
|
+
`,Ss=de(Ad)`
|
|
1303
1304
|
margin-bottom: 4px;
|
|
1304
1305
|
`,bs=de.div`
|
|
1305
1306
|
display: flex;
|
|
1306
1307
|
flex-flow: row nowrap;
|
|
1307
1308
|
align-items: center;
|
|
1308
1309
|
min-width: 50%;
|
|
1309
|
-
`,
|
|
1310
|
+
`,Nd=de.p`
|
|
1310
1311
|
font-weight: bold;
|
|
1311
1312
|
font-size: 16px;
|
|
1312
1313
|
line-height: 20px;
|
|
1313
1314
|
letter-spacing: calc(16px * -0.01);
|
|
1314
1315
|
margin: 0;
|
|
1315
|
-
`,ws=de(
|
|
1316
|
+
`,ws=de(Nd)`
|
|
1316
1317
|
margin-bottom: 4px;
|
|
1317
1318
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1318
1319
|
`}
|
|
1319
|
-
`,
|
|
1320
|
+
`,dt=de.p`
|
|
1320
1321
|
color: ${({theme:e})=>e.colorText};
|
|
1321
1322
|
font-weight: normal;
|
|
1322
1323
|
font-size: 14px;
|
|
@@ -1328,27 +1329,27 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1328
1329
|
font-size: 12px;
|
|
1329
1330
|
line-height: 16px;
|
|
1330
1331
|
margin: 0;
|
|
1331
|
-
`;
|
|
1332
|
+
`;dt.Loud=de(dt)`
|
|
1332
1333
|
font-weight: 600;
|
|
1333
|
-
`;
|
|
1334
|
+
`;dt.Quiet=de(dt)`
|
|
1334
1335
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1335
1336
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1336
1337
|
`}
|
|
1337
|
-
`;var Fs=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=Q(),{primaryCTAClickSideEffects:r}=ie();o=i(o);let{imageUri:n=null,subtitle:s=null,title:p=null,complete:c=!1,blocked:a=!1}=e,g=e.primaryButtonTitle||e.secondaryButtonTitle,d=()=>{r(e)};return
|
|
1338
|
+
`;var Fs=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=Q(),{primaryCTAClickSideEffects:r}=ie();o=i(o);let{imageUri:n=null,subtitle:s=null,title:p=null,complete:c=!1,blocked:a=!1}=e,g=e.primaryButtonTitle||e.secondaryButtonTitle,d=()=>{r(e)};return Kt.createElement(xs,{className:l("carouselCard",o),onClick:a?null:d,style:t,blocked:a,complete:c},n&&Kt.createElement(hs,{className:l("carouselCardImage",o),src:n,alt:p,style:{opacity:c||a?.4:1}}),c&&Kt.createElement(ys,{className:l("carouselCompletedPill",o)},Kt.createElement(Ts,{style:{color:"#108E0B"}},"Complete")),p&&Kt.createElement(ws,{blocked:a,complete:c,className:l("carouselCardTitle",o)},p),s&&Kt.createElement(dt.Quiet,{blocked:a,complete:c,className:l("carouselCardSubtitle",o)},s))};var Od=()=>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"})),ks=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,r]=Pt(!1),[n,s]=Pt(!1);Fr(()=>{t===!0&&i===!1?r(!0):t===!1&&i===!0&&s(!0)},[t]);let p=()=>{r(!1),s(!1)},c=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return i?ae.createElement(us,{style:c,reversed:n,onAnimationEnd:n?p:null},ae.createElement(fs,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},ae.createElement(Od,null))):null},Ps=({flowId:e,appearance:t,customVariables:o,className:i})=>{let r=Id(null),[n,s]=Pt(!1),[p,c]=Pt(!1),[a,g]=Pt(null),[d,x]=Pt([]),[b,w]=Pt(0),{isSmall:v}=ls(),f=v?1:3,{getFlowMetadata:E,getFlowSteps:S,getNumberOfStepsCompleted:y,updateCustomVariables:A,isLoading:C}=Y();Fr(()=>{A(o)},[o,C]),Fr(()=>{if(C)return;let N=E(e),I=y(e),$=S(e);g(N),N.data!==null&&(x($.sort((D,ee)=>Number(D.complete)-Number(ee.complete))),c($.length>f),w(I))},[C]);let m=[];for(let N=0;N<d.length;N+=f)m.push(d.slice(N,N+f));let B=N=>{let I=N.target,$=I.scrollWidth-I.clientWidth,D=Math.ceil(I.scrollLeft);D>0&&n===!1&&s(!0),D===0&&n===!0&&s(!1),D<$&&p===!1&&c(!0),D===$&&p===!0&&c(!1)},F=(N=!0)=>{let I=N?1:-1;r.current!==null&&r.current.scrollBy({left:r.current.clientWidth*I,behavior:"smooth"})},k=null,O=N=>{k!==null?clearTimeout(k):B(N),k=setTimeout(()=>{B(N)},16)};return C?null:ae.createElement(Cs,{className:xe(l("carouselContainer",t),i)},ae.createElement("div",{style:{display:"flex",justifyContent:v?"center":"space-between",marginBottom:20,flexWrap:v?"wrap":"nowrap",gap:v?16:20}},ae.createElement("div",null,ae.createElement(Ss,{className:l("carouselTitle",t)},a==null?void 0:a.title),ae.createElement(dt.Quiet,{className:l("carouselSubtitle",t)},a==null?void 0:a.subtitle)),ae.createElement(bs,{className:l("progressWrapper",t)},ae.createElement(Oe,{count:b,total:d.length,appearance:t}))),ae.createElement("div",{style:{position:"relative"}},ae.createElement(ks,{show:n,onClick:()=>F(!1)}),ae.createElement(ks,{side:"right",show:p,onClick:F}),ae.createElement(cs,{ref:r,onScroll:O},m.map((N,I)=>ae.createElement(ms,{key:I,style:{flex:`0 0 calc(100% - ${d.length>f?36:0}px)`}},N.map(($,D)=>ae.createElement(Fs,{key:D,stepData:$,style:{flex:d.length>f?`0 1 calc(100% / ${f} - 16px * 2 / ${f})`:1},appearance:t})))))),ae.createElement(oe,{appearance:t}))};var kr=({flowId:e,title:t,subtitle:o,style:i,initialSelectedStep:r,className:n,type:s="inline",onDismiss:p,visible:c,customVariables:a,onStepCompletion:g,onButtonClick:d,appearance:x,hideOnFlowCompletion:b,setVisible:w,customStepTypes:v,checklistStyle:f="default",autoExpandFirstIncompleteStep:E,autoExpandNextStep:S,...y})=>{let{getFlow:A,getFlowSteps:C,markStepCompleted:m,getStepStatus:B,getNumberOfStepsCompleted:F,isLoading:k,targetingLogicShouldHideFlow:O,updateCustomVariables:N,getFlowMetadata:I,isStepBlocked:$,getFlowStatus:D,hasActiveFullPageFlow:ee,setHasActiveFullPageFlow:U}=Y(),{primaryCTAClickSideEffects:te,secondaryCTAClickSideEffects:fe}=ie(),{getOpenFlowState:X,setOpenFlowState:H}=we(),[j,Ce]=Bs(r||0),[Ae,be]=Bs(!1),me=c===void 0?X(e):c,J=s==="modal",{mergeAppearanceWithDefault:ge}=Q();if(x=ge(x),vs(()=>{N(a)},[a,k]),vs(()=>{c!==void 0&&(J&&c===!0?U(!0):J&&c===!1&&U(!1))},[c,w,ee]),k)return null;let re=A(e);if(!re||O(re))return null;let L=C(e);if(!L||b===!0&&D(e)===q)return null;let V=I(e);if(V!=null&&V.title&&(t=V.title),V!=null&&V.subtitle&&(o=V.subtitle),!Ae&&r===void 0&&F(e)>0){let u=L.findIndex(h=>h.complete===!1);Ce(u>-1?u:L.length-1),be(!0)}function G(){if(j+1>=L.length){J&&H(e,!1);return}$(e,L[j+1].id)||Ce(j+1)}function ne(u,h,P){let W=j+1<L.length?L[j+1]:null;d&&d(u,j,h,W)===!0&&J&&Le(),g&&g(u,P,W),!g&&!d&&(u.primaryButtonUri||u.secondaryButtonUri)&&J&&Le()}function se(){return L.map((u,h)=>({...u,handleSecondaryButtonClick:()=>{G(),fe(u),u.skippable===!0&&m(e,u.id,{skipped:!0}),ne(u,"secondary",h)},handlePrimaryButtonClick:()=>{(!u.completionCriteria&&(u.autoMarkCompleted||u.autoMarkCompleted===void 0)||u.completionCriteria&&u.autoMarkCompleted===!0)&&(m(e,u.id),G()),ne(u,"primary",h),te(u),B(e,u.id)===Me&&G()}}))}function pe(){return ce.createElement(oe,{appearance:x})}let qe={steps:se(),title:t,subtitle:o,primaryColor:x.theme.colorPrimary,appearance:x,customStepTypes:v,type:s,className:n,autoExpandFirstIncompleteStep:E,autoExpandNextStep:S};function Le(){H(e,!1),p&&p(),w&&w(!1)}function Et(){return ce.createElement(ce.Fragment,null,ce.createElement(pe,null),ce.createElement(Ps,{flowId:e,appearance:x,customVariables:a,className:n}))}function ft(){return ce.createElement(ce.Fragment,null,ce.createElement(pe,null),ce.createElement(Tr,{visible:me,onClose:()=>{Le()},selectedStep:j,setSelectedStep:Ce,autoExpandNextStep:!0,appearance:x,...qe}))}function At(){let u=y.guideFlowId,h;return u&&A(u)&&(h=C(u)),ce.createElement(ce.Fragment,null,ce.createElement(pe,null),ce.createElement(wr,{visible:me,stepsTitle:V.stepsTitle?V.stepsTitle:"Your quick start guide",onClose:()=>{Le()},selectedStep:j,setSelectedStep:Ce,guideData:h,guideTitle:y.guideTitle??"Guide",appearance:x,title:t,subtitle:o,onGuideButtonClick:P=>{ne(P,"link",0)},customStepTypes:v,...qe}))}function gt(){let u=ce.createElement(Sr,{flowId:e,style:i,selectedStep:j,setSelectedStep:Ce,appearance:x,type:s,...qe});return J?ce.createElement(_e,{onClose:()=>{Le()},visible:me,appearance:x,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},ce.createElement(pe,null),u):ce.createElement(ce.Fragment,null,ce.createElement(pe,null),u)}switch(f){case"condensed":return ft();case"with-guide":return At();case"default":return gt();case"carousel":return Et();default:return gt()}};var Dd=e=>Ld.createElement(kr,{type:"inline",...e});import mt,{useEffect as $d}from"react";import Ge from"react";import jo from"styled-components";var Es=jo.div`
|
|
1338
1339
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1339
1340
|
border-radius: 8px;
|
|
1340
1341
|
padding: 6px 10px 6px 10px;
|
|
1341
1342
|
min-width: 160px;
|
|
1342
1343
|
cursor: pointer;
|
|
1343
1344
|
background-color: ${e=>e.appearance.theme.colorBackground}};
|
|
1344
|
-
`,As=
|
|
1345
|
+
`,As=jo.div`
|
|
1345
1346
|
display: flex;
|
|
1346
1347
|
flex-direction: row;
|
|
1347
1348
|
justify-content: space-between;
|
|
1348
1349
|
align-items: center;
|
|
1349
1350
|
margin-bottom: 2px;
|
|
1350
1351
|
flex-grow: 2;
|
|
1351
|
-
`,Ns=
|
|
1352
|
+
`,Ns=jo.div`
|
|
1352
1353
|
text-overflow: ellipsis;
|
|
1353
1354
|
font-weight: 600;
|
|
1354
1355
|
font-size: 12px;
|
|
@@ -1356,13 +1357,13 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1356
1357
|
margin-right: ${e=>e.type==="condensed"?"8px":"0"};
|
|
1357
1358
|
text-align: ${e=>e.type==="condensed"?"left":"right"};
|
|
1358
1359
|
color: ${e=>e.appearance.theme.colorPrimary};
|
|
1359
|
-
`,Is=
|
|
1360
|
+
`,Is=jo.div`
|
|
1360
1361
|
width: 20px;
|
|
1361
1362
|
margin-right: 8px;
|
|
1362
1363
|
display: flex;
|
|
1363
1364
|
height: 100%;
|
|
1364
1365
|
align-items: center;
|
|
1365
|
-
`;var Os=({title:e,count:t,total:o,onClick:i,style:r={},className:n,appearance:s,type:p="default"})=>
|
|
1366
|
+
`;var Os=({title:e,count:t,total:o,onClick:i,style:r={},className:n,appearance:s,type:p="default"})=>Ge.createElement(Ge.Fragment,null,Ge.createElement(oe,{appearance:s}),Ge.createElement(Es,{onClick:()=>i!==void 0&&i(),style:{...p=="condensed"?{display:"flex",justifyContent:"space-between"}:{},...r},className:xe(n??"",l("progressRingContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&Ge.createElement(Is,{className:l("progressRingContainer",s)},Ge.createElement($t,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),Ge.createElement(As,{type:p,className:l("badgeTitleContainer",s)},Ge.createElement(Ns,{type:p,appearance:s,className:l("badgeTitle",s)},e),i!==void 0&&Ge.createElement(Vt,{className:l("badgeChevron",s),color:s.theme.colorPrimary})),p=="default"&&o&&o!==0&&Ge.createElement(Oe,{display:"compact",count:t,total:o,bgColor:s.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:s})));import ct from"react";import uo from"styled-components";var Ls=uo.div`
|
|
1366
1367
|
display: flex;
|
|
1367
1368
|
flex-direction: row;
|
|
1368
1369
|
width: 100%;
|
|
@@ -1373,25 +1374,25 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1373
1374
|
border-width: 1px;
|
|
1374
1375
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1375
1376
|
border-radius: 12px;
|
|
1376
|
-
`,Ds=
|
|
1377
|
+
`,Ds=uo.div`
|
|
1377
1378
|
${e=>T(e)} {
|
|
1378
1379
|
display: flex;
|
|
1379
1380
|
justify-content: center;
|
|
1380
1381
|
align-items: center;
|
|
1381
1382
|
margin-right: 16px;
|
|
1382
1383
|
}
|
|
1383
|
-
`,$s=
|
|
1384
|
+
`,$s=uo.div`
|
|
1384
1385
|
display: flex;
|
|
1385
1386
|
flex-direction: column;
|
|
1386
1387
|
flex: 1;
|
|
1387
1388
|
margin-top: 0;
|
|
1388
|
-
`,Ms=
|
|
1389
|
+
`,Ms=uo.div`
|
|
1389
1390
|
display: flex;
|
|
1390
1391
|
flex-direction: column;
|
|
1391
1392
|
justify-content: center;
|
|
1392
1393
|
margin-left: 16px;
|
|
1393
1394
|
min-width: 200px;
|
|
1394
|
-
`,
|
|
1395
|
+
`,Ny=uo.div`
|
|
1395
1396
|
display: flex;
|
|
1396
1397
|
justify-content: center;
|
|
1397
1398
|
align-items: flex-end;
|
|
@@ -1400,7 +1401,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1400
1401
|
:hover {
|
|
1401
1402
|
opacity: 0.8;
|
|
1402
1403
|
}
|
|
1403
|
-
`;var Us=({title:e,subtitle:t,icon:o,appearance:i,count:r,total:n,className:s,style:p})=>
|
|
1404
|
+
`;var Us=({title:e,subtitle:t,icon:o,appearance:i,count:r,total:n,className:s,style:p})=>ct.createElement(ct.Fragment,null,ct.createElement(Ls,{appearance:i,className:xe(l("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&ct.createElement(Ds,{className:l("fullWidthProgressBadgeIcon",i)},o),ct.createElement($s,null,ct.createElement(Fe,{size:"small",appearance:i,title:e,subtitle:t})),ct.createElement(Ms,{className:l("fullWidthProgressBadgeProgressContainer",i)},ct.createElement(Oe,{count:r,total:n,display:"percent",textLocation:"top"}))));var Md=({flowId:e,title:t,subtitle:o,icon:i,style:r,onClick:n,className:s,customVariables:p,hideOnFlowCompletion:c,appearance:a,type:g="default"})=>{let{getFlow:d,getFlowSteps:x,getFlowStatus:b,getNumberOfStepsCompleted:w,isLoading:v,targetingLogicShouldHideFlow:f,updateCustomVariables:E}=Y(),{mergeAppearanceWithDefault:S}=Q();a=S(a);let{setOpenFlowState:y,getOpenFlowState:A}=we();if($d(()=>{E(p)},[p,v]),v)return null;let C=d(e);if(!C||f(C)||c===!0&&b(e)===q)return null;let m=x(e),B=w(e);return g==="full-width"?mt.createElement(mt.Fragment,null,mt.createElement(oe,{appearance:a}),mt.createElement(Us,{title:t,subtitle:o,count:B,total:m.length,style:r,className:s,appearance:a,icon:i,onClick:()=>{}})):mt.createElement(mt.Fragment,null,mt.createElement(oe,{appearance:a}),mt.createElement(Os,{count:B,total:m.length,title:t,style:r,onClick:()=>{y(e,!0),n&&n()},type:g,className:s,appearance:a}))};import Ud from"react";var zd=({flowId:e,style:t,appearance:o,...i})=>{let{getFlow:r,targetingLogicShouldHideFlow:n,getFlowSteps:s}=Y(),{mergeAppearanceWithDefault:p}=Q();o=p(o);let c=r(e);if(!c||n(c))return null;let a=s(e);return Ud.createElement(mo,{steps:a,style:t,appearance:o,...i})};import ut,{useContext as Jd,useEffect as Qd}from"react";import _,{useEffect as Vo,useLayoutEffect as Ws,useRef as jd,useState as fo}from"react";import go from"styled-components";import{useCallback as Wd,useEffect as _d,useState as Hd}from"react";var Pr=(e,t,o,i={x:20,y:20},r)=>{let n=r=="fixed"?0:window.scrollY,s=r=="fixed"?0:window.scrollX;return t==="left"?{x:e.left-o+i.x+s,y:e.top-i.y+n}:t==="right"?{x:e.left+e.width+i.x+s,y:e.top-i.y+n}:{x:0,y:0}};function zs(e,t){let o="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[i,r]=Hd(o),n=Wd(()=>{e&&r(e.getBoundingClientRect())},[e]);return _d(()=>(n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)),[e,t]),i}var _s=300,Hs=100,Vd=500,qt=12,Gd=go.div`
|
|
1404
1405
|
width: 100%;
|
|
1405
1406
|
height: 100%;
|
|
1406
1407
|
border-radius: 9999px;
|
|
@@ -1423,25 +1424,25 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1423
1424
|
opacity: 0;
|
|
1424
1425
|
}
|
|
1425
1426
|
}
|
|
1426
|
-
`,
|
|
1427
|
-
width: ${
|
|
1428
|
-
height: ${
|
|
1427
|
+
`,Kd=go.div`
|
|
1428
|
+
width: ${qt}px;
|
|
1429
|
+
height: ${qt}px;
|
|
1429
1430
|
border-radius: 100px;
|
|
1430
1431
|
background-color: ${e=>e.primaryColor};
|
|
1431
1432
|
z-index: 20;
|
|
1432
1433
|
opacity: 1;
|
|
1433
|
-
`,
|
|
1434
|
+
`,qd=go.div`
|
|
1434
1435
|
pointer-events: all;
|
|
1435
|
-
`,js=
|
|
1436
|
+
`,js=go.div`
|
|
1436
1437
|
display: flex;
|
|
1437
1438
|
align-content: center;
|
|
1438
1439
|
justify-content: center;
|
|
1439
1440
|
align-items: center;
|
|
1440
1441
|
z-index: ${e=>e.zIndex?e.zIndex:90};
|
|
1441
|
-
`,
|
|
1442
|
-
width: ${
|
|
1443
|
-
height: ${
|
|
1444
|
-
`,
|
|
1442
|
+
`,Yd=go(js)`
|
|
1443
|
+
width: ${qt+12}px;
|
|
1444
|
+
height: ${qt+12}px;
|
|
1445
|
+
`,Xd=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:r=!0,primaryColor:n="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:c={},selectedStep:a=0,customStepTypes:g,appearance:d,dismissible:x=!1,showHighlightOnly:b,showStepCount:w=!0,completedStepsCount:v=0,showFrigadeBranding:f=!1,cssPosition:E="absolute"})=>{var se,pe,qe,Le,Et,ft,At,gt,u,h,P,W;let[S,y]=fo(),[A,C]=fo(new Date),m=jd(null),[B,F]=fo(document.querySelector(e[a].selector)),k=zs(B,A),[O,N]=fo(),[I,$]=fo(!b),D=(pe=(se=e[a])==null?void 0:se.props)!=null&&pe.position?e[a].props.position:E,ee=((Le=(qe=e[a])==null?void 0:qe.props)==null?void 0:Le.zIndex)??90,U=(S==null?void 0:S.width)??_s,te=(S==null?void 0:S.height)??Hs,fe=window.location.pathname.split("/").pop();Ws(()=>{m.current&&y({width:m.current.clientWidth,height:m.current.clientHeight})},[a,A,D]),Vo(()=>{b||$(!0)},[a]);let X=()=>{let M=document.querySelector(e[a].selector);if(!M){N(void 0),F(null);return}O&&O===JSON.stringify(M==null?void 0:M.getBoundingClientRect())||(F(M),C(new Date),M&&N(JSON.stringify(M.getBoundingClientRect())))};if(Vo(()=>{let M=new MutationObserver(X);return M.observe(document.body,{subtree:!0,childList:!0}),()=>M.disconnect()},[X]),Vo(()=>{let M=new MutationObserver(X);return M.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>M.disconnect()},[X]),Vo(()=>{let M=setInterval(()=>{X()},10);return()=>clearInterval(M)},[X]),Ws(()=>{setTimeout(()=>{X()},Vd),X()},[a,fe]),B===null||!p||k.height===0&&k.width===0&&D!=="fixed"&&E!=="static")return null;let H=i==="auto"?"right":i,j=Pr(k,H,U,s,D),Ce=k.right+U>(window.innerWidth||document.documentElement.clientWidth),Ae=k.bottom+Hs>(window.innerHeight||document.documentElement.clientHeight);Ce&&i==="auto"&&(j=Pr(k,"left",U,s,D),H="left"),(ft=(Et=e[a])==null?void 0:Et.props)!=null&&ft.tooltipPosition&&((gt=(At=e[a])==null?void 0:At.props)==null?void 0:gt.tooltipPosition)!=="auto"&&(((h=(u=e[a])==null?void 0:u.props)==null?void 0:h.tooltipPosition)==="left"||((W=(P=e[a])==null?void 0:P.props)==null?void 0:W.tooltipPosition)==="right")&&(H=e[a].props.tooltipPosition);let be=()=>{let M=()=>{if(e[a].handlePrimaryButtonClick&&(e[a].handlePrimaryButtonClick(),$(!1),setTimeout(()=>{X()},30)),v===e.length-1)return o()},De=()=>{e[a].handleSecondaryButtonClick&&(e[a].handleSecondaryButtonClick(),b&&!e[a].secondaryButtonUri&&$(!1))};return _.createElement(_.Fragment,null,w&&e.length>1&&_.createElement(qr,null,_.createElement(Xr,{className:l("tooltipStepCounter",d)},a+1," of ",e.length)),_.createElement(Yr,{showStepCount:w,className:l("tooltipCTAContainer",d)},e[a].secondaryButtonTitle&&_.createElement(Z,{title:e[a].secondaryButtonTitle,appearance:d,onClick:De,size:"small",withMargin:!1,secondary:!0}),e[a].primaryButtonTitle&&_.createElement(Z,{title:e[a].primaryButtonTitle,appearance:d,onClick:M,withMargin:!1,size:"small"})))},me=()=>_.createElement(_.Fragment,null,x&&_.createElement(Hr,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:l("tooltipClose",d),hasImage:!!e[a].imageUri||!!e[a].videoUri},_.createElement(Te,null)),e[a].imageUri&&_.createElement(jr,{dismissible:x,appearance:d,src:e[a].imageUri,className:l("tooltipImageContainer",d)}),e[a].videoUri&&!e[a].imageUri&&_.createElement(Vr,{dismissible:x,appearance:d,className:l("tooltipVideoContainer",d)},_.createElement(je,{appearance:d,videoUri:e[a].videoUri})),_.createElement(Kr,{className:l("tooltipContentContainer",d)},_.createElement(Fe,{appearance:d,title:e[a].title,subtitle:e[a].subtitle,size:"small"}),_.createElement(Gr,{className:l("tooltipFooter",d)},_.createElement(be,null)))),ge={...{default:M=>{var De;if((De=e[a])!=null&&De.StepContent){let vl=e[a].StepContent;return _.createElement("div",null,vl)}return _.createElement(me,null)}},...g},re=()=>{var M;return e?!((M=e[a])!=null&&M.type)||!ge[e[a].type]?ge.default(e[a]):ge[e[a].type]({stepData:e[a],primaryColor:n}):_.createElement(_.Fragment,null)};if(b&&e[a].complete===!0)return null;let L={top:(j==null?void 0:j.y)-qt,left:(H=="left"?k.x+s.x:(j==null?void 0:j.x)-qt)??0,cursor:b?"pointer":"default",position:D},V=()=>{let De=L.left+(H=="left"?-U:24);return Math.min(Math.max(De,20),window.innerWidth-U-20)},G=()=>{if(D==="fixed")return L.top;let M=L.top+te,De=20;return M>window.innerHeight-De?L.top+-te:L.top},ne=()=>{b&&(C(new Date),$(!I))};return _.createElement(qd,null,_.createElement(Yd,{style:L,zIndex:ee,className:l("tourHighlightContainer",d)},r&&e[a].showHighlight!==!1&&E!=="static"&&_.createElement(_.Fragment,null,_.createElement(Kd,{style:{position:D},onClick:ne,primaryColor:d.theme.colorPrimary,className:l("tourHighlightInnerCircle",d)}),_.createElement(Gd,{style:{position:"absolute"},onClick:ne,primaryColor:d.theme.colorPrimary,className:l("tourHighlightOuterCircle",d)}))),_.createElement(js,{style:{...L,left:V(),top:G()},zIndex:ee+1,className:l("tooltipContainerWrapper",d)},I&&_.createElement(_.Fragment,null,_.createElement(Co,{ref:m,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:E!=="static"?12:0,...c},appearance:d,className:l("tooltipContainer",d),maxWidth:_s,zIndex:ee+10},_.createElement(re,null)),f&&_.createElement(Qr,{className:l("poweredByFrigadeTooltipRibbon",d),appearance:d,zIndex:ee+10},_.createElement(yo,{appearance:d})))))},Go=Xd;import{Portal as Zd}from"react-portal";var Rd=({flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:r,showTooltipsSimultaneously:n=!1,onDismiss:s,dismissible:p,tooltipPosition:c="auto",showHighlightOnly:a=!1,dismissBehavior:g="complete-flow",onComplete:d,skipIfNotFound:x=!1,cssPosition:b="absolute",...w})=>{let{getFlow:v,getFlowSteps:f,isLoading:E,targetingLogicShouldHideFlow:S,markStepCompleted:y,markStepStarted:A,markFlowCompleted:C,updateCustomVariables:m,getCurrentStepIndex:B,getStepStatus:F,isStepBlocked:k,getFlowStatus:O,getNumberOfStepsCompleted:N}=Y(),{isLoadingUserFlowStateData:I}=ve(),{primaryCTAClickSideEffects:$,secondaryCTAClickSideEffects:D}=ie(),{hasOpenModals:ee}=we(),U=B(e),{openFlowStates:te}=Jd(K),{mergeAppearanceWithDefault:fe}=Q();if(o=fe(o),Qd(()=>{m(t)},[t,E]),I)return null;let X=v(e);if(!X||S(X)||O(e)==q||ee())return null;let H=f(e);if(Object.keys(te).length>0){let L=Object.keys(te).find(V=>te[V]===!0);if(L!==void 0&&L!==e)return ut.createElement(ut.Fragment,null)}async function j(L){if(await y(e,L.id),H.map(V=>F(e,V.id)).every(V=>V===Me)){await C(e);return}if(!a&&U+1<H.length){if(k(e,H[U+1].id))return;await A(e,H[U+1].id)}}function Ce(L,V,G){let ne=U+1<H.length?H[U+1]:null;r&&r(L,U,V,ne),i&&i(L,G,ne)}function Ae(){return H.map(L=>({...L,handleSecondaryButtonClick:async()=>{D(L),L.skippable===!0&&await y(e,L.id,{skipped:!0}),Ce(L,"secondary",U)},handlePrimaryButtonClick:async()=>{(!L.completionCriteria&&(L.autoMarkCompleted||L.autoMarkCompleted===void 0)||L.completionCriteria&&L.autoMarkCompleted===!0)&&await j(L),Ce(L,"primary",U),$(L)}}))}async function be(L){s&&s(),g==="complete-flow"?await C(e):await y(e,L.id)}function me(){d&&d()}let J=!document.querySelector(H[U].selector);function ge(){let L=H.findIndex(V=>!!document.querySelector(V.selector));return H.map((V,G)=>J&&!n&&G!==L&&x?null:ut.createElement(Go,{key:V.id,appearance:o,steps:Ae(),selectedStep:G,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>be(V),tooltipPosition:c,showHighlightOnly:a,completedStepsCount:N(e),onComplete:me,cssPosition:b,...w}))}function re(){return ut.createElement(ut.Fragment,null,ut.createElement(oe,{appearance:o}),n||J&&x?ge():ut.createElement(Go,{appearance:o,steps:Ae(),selectedStep:U,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>be(H[U]),tooltipPosition:c,completedStepsCount:N(e),showHighlightOnly:a,onComplete:me,cssPosition:b,...w}))}return b==="static"?re():ut.createElement(Zd,null,re())};import Ee,{useEffect as ec,useRef as tc,useState as oc}from"react";import{Portal as rc}from"react-portal";import vt from"styled-components";var Vs=vt.button`
|
|
1445
1446
|
${e=>T(e)} {
|
|
1446
1447
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1447
1448
|
|
|
@@ -1459,17 +1460,17 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1459
1460
|
opacity: 0.8;
|
|
1460
1461
|
}
|
|
1461
1462
|
}
|
|
1462
|
-
`,Gs=
|
|
1463
|
+
`,Gs=vt.span`
|
|
1463
1464
|
${e=>T(e)} {
|
|
1464
1465
|
font-size: 12px;
|
|
1465
1466
|
display: inline-block;
|
|
1466
1467
|
}
|
|
1467
|
-
`,Ks=
|
|
1468
|
+
`,Ks=vt.span`
|
|
1468
1469
|
${e=>T(e)} {
|
|
1469
1470
|
font-size: 12px;
|
|
1470
1471
|
display: inline-block;
|
|
1471
1472
|
}
|
|
1472
|
-
`,qs=
|
|
1473
|
+
`,qs=vt.div`
|
|
1473
1474
|
position: fixed;
|
|
1474
1475
|
right: 0;
|
|
1475
1476
|
bottom: 0;
|
|
@@ -1479,7 +1480,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1479
1480
|
flex-direction: column;
|
|
1480
1481
|
align-items: flex-end;
|
|
1481
1482
|
z-index: 50;
|
|
1482
|
-
`,Ys=
|
|
1483
|
+
`,Ys=vt.button`
|
|
1483
1484
|
${e=>T(e)} {
|
|
1484
1485
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1485
1486
|
background-color: #ffffff;
|
|
@@ -1495,7 +1496,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1495
1496
|
0px 3px 6px -4px rgba(0, 0, 0, 0.12);
|
|
1496
1497
|
border-radius: 45px;
|
|
1497
1498
|
cursor: pointer;
|
|
1498
|
-
`,Xs=
|
|
1499
|
+
`,Xs=vt.div`
|
|
1499
1500
|
${e=>T(e)} {
|
|
1500
1501
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1501
1502
|
background: #ffffff;
|
|
@@ -1512,7 +1513,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1512
1513
|
position: ${e=>e.type=="inline"?"absolute":"relative"};
|
|
1513
1514
|
top: ${e=>e.type=="inline"?"68px":0};
|
|
1514
1515
|
margin-left: ${e=>e.type=="inline"?"-127px":0};
|
|
1515
|
-
`,Js=
|
|
1516
|
+
`,Js=vt.button`
|
|
1516
1517
|
${e=>T(e)} {
|
|
1517
1518
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1518
1519
|
color: #434343;
|
|
@@ -1529,7 +1530,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1529
1530
|
font-size: 14px;
|
|
1530
1531
|
|
|
1531
1532
|
padding: 8px 12px;
|
|
1532
|
-
`;import Qs from"react";var Zs=({style:e,className:t})=>Qs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Qs.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 Rs from"react";var el=({style:e,className:t})=>Rs.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"},Rs.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
|
|
1533
|
+
`;import Qs from"react";var Zs=({style:e,className:t})=>Qs.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},Qs.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 Rs from"react";var el=({style:e,className:t})=>Rs.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"},Rs.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 ic=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:r="inline",title:n="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:c,markStepCompleted:a,getStepStatus:g,getNumberOfStepsCompleted:d,isLoading:x,targetingLogicShouldHideFlow:b}=Y(),{primaryCTAClickSideEffects:w}=ie(),v=tc(null),[f,E]=oc(!1),{mergeAppearanceWithDefault:S}=Q();s=S(s),ec(()=>(document.addEventListener("click",y,!1),()=>{document.removeEventListener("click",y,!1)}),[]);let y=F=>{v.current&&!v.current.contains(F.target)&&E(!1)};if(x)return null;let A=p(e);if(!A||b(A))return null;let C=c(e);if(!C||!i)return null;function m(F,k){!F.completionCriteria&&(F.autoMarkCompleted||F.autoMarkCompleted===void 0)&&a(e,F.id),w(F),o&&o(F,k),E(!1)}function B(){return f&&Ee.createElement(Xs,{className:l("floatingWidgetMenu",s),initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:r},C.map((F,k)=>Ee.createElement(Js,{className:l("floatingWidgetMenuItem",s),key:k,onClick:()=>m(F,k)},F.title)))}return r=="inline"?Ee.createElement("span",{ref:v},Ee.createElement(Vs,{style:t,onClick:()=>{E(!f)},className:l("supportButton",s)},Ee.createElement(Ks,{className:l("supportIconContainer",s)},Ee.createElement(el,{className:l("supportIcon",s),style:{width:"18px",height:"18px"}})),Ee.createElement(Gs,{className:l("supportButtonTitle",s)},n)),Ee.createElement(B,null)):Ee.createElement(rc,null,Ee.createElement(qs,{style:t,ref:v},Ee.createElement(B,null),Ee.createElement(Ys,{onClick:()=>{E(!f)},whileHover:{scale:1.1},className:l("floatingWidgetButton",s)},Ee.createElement(Zs,{className:l("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import Ke,{useEffect as nc}from"react";import Ko from"styled-components";var tl=Ko.div`
|
|
1533
1534
|
${e=>T(e)} {
|
|
1534
1535
|
display: flex;
|
|
1535
1536
|
flex-direction: column;
|
|
@@ -1544,17 +1545,17 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1544
1545
|
border-radius: 12px;
|
|
1545
1546
|
position: relative;
|
|
1546
1547
|
}
|
|
1547
|
-
`,ol=
|
|
1548
|
+
`,ol=Ko.div`
|
|
1548
1549
|
display: flex;
|
|
1549
1550
|
flex-direction: column;
|
|
1550
1551
|
flex: 1;
|
|
1551
|
-
`,rl=
|
|
1552
|
+
`,rl=Ko.div`
|
|
1552
1553
|
display: flex;
|
|
1553
1554
|
flex-direction: column;
|
|
1554
1555
|
justify-content: center;
|
|
1555
1556
|
align-items: flex-start;
|
|
1556
1557
|
margin-top: 16px;
|
|
1557
|
-
`,il=
|
|
1558
|
+
`,il=Ko.div`
|
|
1558
1559
|
${e=>T(e)} {
|
|
1559
1560
|
position: absolute;
|
|
1560
1561
|
top: 16px;
|
|
@@ -1565,7 +1566,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1565
1566
|
opacity: 0.8;
|
|
1566
1567
|
}
|
|
1567
1568
|
}
|
|
1568
|
-
`;var
|
|
1569
|
+
`;var sc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p})=>{let{getFlow:c,markFlowCompleted:a,markStepCompleted:g,isLoading:d,targetingLogicShouldHideFlow:x,updateCustomVariables:b,getFlowSteps:w,getFlowStatus:v,getCurrentStepIndex:f}=Y(),{primaryCTAClickSideEffects:E}=ie(),{mergeAppearanceWithDefault:S}=Q();if(r=S(r),nc(()=>{b(o)},[o,d]),d)return null;let y=c(e);if(!y||x(y)||v(e)===q)return null;let C=w(e)[f(e)];return Ke.createElement(Ke.Fragment,null,Ke.createElement(oe,{appearance:r}),Ke.createElement(tl,{appearance:r,className:xe(l("embeddedTipContainer",r),n),style:s},(p===!0||C.dismissible)&&Ke.createElement(il,{onClick:async()=>{await a(e),t&&t()},className:l("embeddedTipDismissButton",r)},Ke.createElement(Te,null)),Ke.createElement(ol,null,Ke.createElement(Fe,{size:"small",appearance:r,title:C.title,subtitle:C.subtitle})),C.primaryButtonTitle&&Ke.createElement(rl,{className:l("embeddedTipCallToActionContainer",r)},Ke.createElement(Z,{classPrefix:"embeddedTip",title:C.primaryButtonTitle,appearance:r,withMargin:!1,size:"medium",type:"inline",onClick:async()=>{C.handlePrimaryButtonClick(),E(C),!(i&&i(C,f(e),"primary")===!1)&&(await g(e,C.id),await a(e))}}))))};import ye,{useEffect as lc}from"react";import Yt from"styled-components";var nl=Yt.div`
|
|
1569
1570
|
// use the :not annotation
|
|
1570
1571
|
${e=>T(e)} {
|
|
1571
1572
|
display: flex;
|
|
@@ -1577,24 +1578,24 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1577
1578
|
background-color: ${e=>e.appearance.theme.colorBackground};
|
|
1578
1579
|
border-radius: 12px;
|
|
1579
1580
|
}
|
|
1580
|
-
`,sl=
|
|
1581
|
+
`,sl=Yt.div`
|
|
1581
1582
|
${e=>T(e)} {
|
|
1582
1583
|
display: flex;
|
|
1583
1584
|
width: 46px;
|
|
1584
1585
|
height: 46px;
|
|
1585
1586
|
}
|
|
1586
|
-
`,ll=
|
|
1587
|
+
`,ll=Yt.div`
|
|
1587
1588
|
display: flex;
|
|
1588
1589
|
flex-direction: column;
|
|
1589
1590
|
flex: 1;
|
|
1590
1591
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1591
1592
|
margin-top: ${e=>e.type==="square"?"12px":"0"};
|
|
1592
|
-
`,al=
|
|
1593
|
+
`,al=Yt.div`
|
|
1593
1594
|
display: flex;
|
|
1594
1595
|
flex-direction: column;
|
|
1595
1596
|
justify-content: center;
|
|
1596
1597
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1597
|
-
`,
|
|
1598
|
+
`,vr=Yt.div`
|
|
1598
1599
|
display: flex;
|
|
1599
1600
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1600
1601
|
align-items: flex-end;
|
|
@@ -1602,12 +1603,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1602
1603
|
:hover {
|
|
1603
1604
|
opacity: 0.8;
|
|
1604
1605
|
}
|
|
1605
|
-
`,
|
|
1606
|
+
`,Br=Yt.div`
|
|
1606
1607
|
display: flex;
|
|
1607
1608
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1608
1609
|
align-items: flex-end;
|
|
1609
1610
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1610
|
-
`;import
|
|
1611
|
+
`;import Er from"react";var pl=({style:e,className:t})=>Er.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"46",height:"46",fill:"none",viewBox:"0 0 46 46",style:e,className:t},Er.createElement("circle",{cx:"23",cy:"23",r:"23",fill:"#E6F1FF"}),Er.createElement("path",{stroke:"#0171F8",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M32 18.5l-2.25-1.313M32 18.5v2.25m0-2.25l-2.25 1.313M14 18.5l2.25-1.313M14 18.5l2.25 1.313M14 18.5v2.25m9 3l2.25-1.313M23 23.75l-2.25-1.313M23 23.75V26m0 6.75l2.25-1.313M23 32.75V30.5m0 2.25l-2.25-1.313m0-16.875L23 13.25l2.25 1.313M32 25.25v2.25l-2.25 1.313m-13.5 0L14 27.5v-2.25"}));var ac=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:r,onButtonClick:n,appearance:s,type:p="full-width",icon:c})=>{let{getFlow:a,markFlowCompleted:g,isLoading:d,targetingLogicShouldHideFlow:x,updateCustomVariables:b,getFlowMetadata:w,getFlowStatus:v,getFlowSteps:f,getCurrentStepIndex:E}=Y(),{primaryCTAClickSideEffects:S}=ie(),{mergeAppearanceWithDefault:y}=Q();if(s=y(s),lc(()=>{b(r)},[r,d]),d)return null;let A=a(e);if(!A||x(A)||v(e)===q)return null;let C=f(e),m=C.length>0?C[E(e)]:w(e);return m!=null&&m.title&&(t=m.title),m!=null&&m.subtitle&&(o=m.subtitle),ye.createElement(ye.Fragment,null,ye.createElement(oe,{appearance:s}),ye.createElement(nl,{type:p,appearance:s,className:l("bannerContainer",s)},p!="square"&&ye.createElement(sl,{className:l("bannerIconContainer",s)},c||ye.createElement(pl,null)),p==="square"&&m.dismissible&&ye.createElement(Br,{type:p,className:l("bannerDismissButtonContainer",s)},ye.createElement(vr,{type:p,onClick:async()=>{await g(e),i&&i()},className:l("bannerDismissButton",s)},ye.createElement(Te,null))),ye.createElement(ll,{type:p},ye.createElement(Fe,{appearance:s,title:t,subtitle:o,classPrefix:"banner"})),(m==null?void 0:m.primaryButtonTitle)&&ye.createElement(al,{type:p,className:l("bannerCallToActionContainer",s)},ye.createElement(Z,{title:m==null?void 0:m.primaryButtonTitle,appearance:s,onClick:()=>{S(m),n&&n(m,0,"primary")},classPrefix:"banner"})),p!=="square"&&m.dismissible&&ye.createElement(Br,{type:p,className:l("bannerDismissButtonContainer",s)},ye.createElement(vr,{type:p,onClick:async()=>{await g(e),i&&i()},className:l("bannerDismissButton",s)},ye.createElement(Te,null)))))};import R,{useEffect as pc}from"react";import{Portal as dc}from"react-portal";import it from"styled-components";var dl=it.div`
|
|
1611
1612
|
display: flex;
|
|
1612
1613
|
flex-direction: column;
|
|
1613
1614
|
width: 100%;
|
|
@@ -1626,7 +1627,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1626
1627
|
z-index: 1000;
|
|
1627
1628
|
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
|
|
1628
1629
|
min-width: 550px;
|
|
1629
|
-
`,cl=
|
|
1630
|
+
`,cl=it.button`
|
|
1630
1631
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1631
1632
|
border-radius: 8px;
|
|
1632
1633
|
// If selected make border color primary and text color color priamry
|
|
@@ -1647,33 +1648,33 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1647
1648
|
display: flex;
|
|
1648
1649
|
justify-content: center;
|
|
1649
1650
|
align-items: center;
|
|
1650
|
-
`,
|
|
1651
|
+
`,Ar=it.div`
|
|
1651
1652
|
display: flex;
|
|
1652
1653
|
justify-content: space-between;
|
|
1653
1654
|
margin-top: 16px;
|
|
1654
1655
|
gap: 8px;
|
|
1655
|
-
`,ml=
|
|
1656
|
+
`,ml=it.div`
|
|
1656
1657
|
display: flex;
|
|
1657
1658
|
justify-content: space-between;
|
|
1658
1659
|
margin-top: 8px;
|
|
1659
|
-
`,
|
|
1660
|
+
`,Nr=it.div`
|
|
1660
1661
|
font-size: 12px;
|
|
1661
1662
|
line-height: 18px;
|
|
1662
1663
|
color: ${e=>e.appearance.theme.colorTextDisabled};
|
|
1663
1664
|
font-style: normal;
|
|
1664
1665
|
font-weight: 400;
|
|
1665
1666
|
letter-spacing: 0.24px;
|
|
1666
|
-
`,
|
|
1667
|
+
`,Ir=it.div`
|
|
1667
1668
|
display: flex;
|
|
1668
1669
|
flex-direction: column;
|
|
1669
1670
|
flex: 1;
|
|
1670
|
-
`,
|
|
1671
|
+
`,_b=it.div`
|
|
1671
1672
|
display: flex;
|
|
1672
1673
|
flex-direction: column;
|
|
1673
1674
|
justify-content: center;
|
|
1674
1675
|
align-items: flex-start;
|
|
1675
1676
|
margin-top: 16px;
|
|
1676
|
-
`,ul=
|
|
1677
|
+
`,ul=it.textarea`
|
|
1677
1678
|
${e=>T(e)} {
|
|
1678
1679
|
margin-top: 16px;
|
|
1679
1680
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
@@ -1684,7 +1685,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1684
1685
|
width: 100%;
|
|
1685
1686
|
height: 100px;
|
|
1686
1687
|
}
|
|
1687
|
-
`,fl=
|
|
1688
|
+
`,fl=it.div`
|
|
1688
1689
|
${e=>T(e)} {
|
|
1689
1690
|
position: absolute;
|
|
1690
1691
|
top: 16px;
|
|
@@ -1695,7 +1696,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1695
1696
|
opacity: 0.8;
|
|
1696
1697
|
}
|
|
1697
1698
|
}
|
|
1698
|
-
`;var
|
|
1699
|
+
`;var cc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,type:p="modal"})=>{let{getFlow:c,markFlowCompleted:a,markStepCompleted:g,getNumberOfStepsCompleted:d,isLoading:x,targetingLogicShouldHideFlow:b,updateCustomVariables:w,getFlowSteps:v,getFlowStatus:f,getCurrentStepIndex:E}=Y(),{primaryCTAClickSideEffects:S}=ie(),{mergeAppearanceWithDefault:y}=Q(),[A,C]=R.useState(null),[m,B]=R.useState(""),{hasOpenModals:F,setKeepCompletedFlowOpenDuringSession:k,shouldKeepCompletedFlowOpenDuringSession:O}=we();if(r=y(r),pc(()=>{w(o)},[o,x]),x)return null;let N=c(e);if(!N||b(N)||f(e)===q||d(e)===1&&!O(e)||F())return null;let $=v(e)[d(e)];function D(){return R.createElement(R.Fragment,null,R.createElement(Ir,null,R.createElement(Fe,{size:"large",appearance:r,title:$.title,subtitle:$.subtitle})),R.createElement(Ar,{className:l("npsNumberButtonContainer",r),appearance:r},Array.from(Array(10).keys()).map(te=>R.createElement(cl,{className:l("npsNumberButton",r),selected:A===te+1,key:te,onClick:async()=>{k(e),C(te+1),await g(e,$.id,{score:te+1})},appearance:r},te+1))),R.createElement(ml,{appearance:r},R.createElement(Nr,{appearance:r},"Not likely at all"),R.createElement(Nr,{appearance:r},"Extremely likely")))}function ee(){return R.createElement(R.Fragment,null,R.createElement(Ir,null,R.createElement(Fe,{appearance:r,title:$.title??"Why did you choose this score?",size:"large"})),R.createElement(ul,{appearance:r,value:m,onChange:te=>{B(te.target.value)},placeHolder:"Add your optional fedback here..."}),R.createElement(Ar,{appearance:r,className:l("npsNumberButtonContainer",r)},R.createElement(Z,{size:"large",withMargin:!1,onClick:async()=>{await a(e),i&&i($,1,"primary")},appearance:r,title:$.secondaryButtonTitle||"Skip",secondary:!0}),R.createElement(Z,{size:"large",withMargin:!1,onClick:async()=>{await g(e,$.id,{feedbackText:m}),await a(e),i&&i($,1,"primary")},appearance:r,title:$.primaryButtonTitle||"Submit"})))}function U(){return d(e)>=2?null:R.createElement(R.Fragment,null,R.createElement(oe,{appearance:r}),R.createElement(dl,{appearance:r,className:xe(l("npsSurveyContainer",r),n),style:s,type:p},R.createElement(fl,{onClick:async()=>{await a(e),t&&t()},className:l("npsSurveyDismissButton",r)},R.createElement(Te,null)),d(e)==0&&D(),d(e)==1&&ee()))}return p==="inline"?U():R.createElement(dc,null,U())};import Se,{useEffect as fc}from"react";import Bt from"styled-components";var gl=Bt.div`
|
|
1699
1700
|
${e=>T(e)} {
|
|
1700
1701
|
display: flex;
|
|
1701
1702
|
flex-direction: column;
|
|
@@ -1706,21 +1707,21 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1706
1707
|
background-color: ${e=>e.appearance.theme.colorBackground};
|
|
1707
1708
|
position: relative;
|
|
1708
1709
|
}
|
|
1709
|
-
`,xl=
|
|
1710
|
+
`,xl=Bt.div`
|
|
1710
1711
|
display: flex;
|
|
1711
1712
|
flex-direction: column;
|
|
1712
1713
|
flex: 1;
|
|
1713
|
-
`,hl=
|
|
1714
|
+
`,hl=Bt.div`
|
|
1714
1715
|
display: flex;
|
|
1715
1716
|
flex-direction: row;
|
|
1716
1717
|
justify-content: center;
|
|
1717
1718
|
align-items: stretch;
|
|
1718
1719
|
gap: 16px;
|
|
1719
1720
|
margin-top: 8px;
|
|
1720
|
-
`,Cl=
|
|
1721
|
+
`,Cl=Bt.div`
|
|
1721
1722
|
margin-top: 16px;
|
|
1722
1723
|
margin-bottom: 16px;
|
|
1723
|
-
`,yl=
|
|
1724
|
+
`,yl=Bt.div`
|
|
1724
1725
|
${e=>T(e)} {
|
|
1725
1726
|
position: absolute;
|
|
1726
1727
|
top: -16px;
|
|
@@ -1731,7 +1732,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1731
1732
|
opacity: 0.8;
|
|
1732
1733
|
}
|
|
1733
1734
|
}
|
|
1734
|
-
`,Sl=
|
|
1735
|
+
`,Sl=Bt.h1`
|
|
1735
1736
|
${e=>T(e)} {
|
|
1736
1737
|
font-style: normal;
|
|
1737
1738
|
justify-content: center;
|
|
@@ -1745,7 +1746,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1745
1746
|
color: ${e=>e.appearance.theme.colorText};
|
|
1746
1747
|
margin-bottom: 8px;
|
|
1747
1748
|
}
|
|
1748
|
-
`,bl=
|
|
1749
|
+
`,bl=Bt.h2`
|
|
1749
1750
|
${e=>T(e)} {
|
|
1750
1751
|
font-style: normal;
|
|
1751
1752
|
justify-content: center;
|
|
@@ -1757,10 +1758,10 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Xt}${r}.${Xt}${r} { ${Object.entries(n).map
|
|
|
1757
1758
|
letter-spacing: 0.28px;
|
|
1758
1759
|
margin-bottom: 8px;
|
|
1759
1760
|
}
|
|
1760
|
-
`;import wl from"react";import
|
|
1761
|
+
`;import wl from"react";import mc from"styled-components";var uc=mc.img`
|
|
1761
1762
|
width: 100%;
|
|
1762
1763
|
height: 100%;
|
|
1763
1764
|
min-height: 200px;
|
|
1764
1765
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1765
|
-
`;function Tl({stepData:e,appearance:t,classPrefix:o=""}){return e.videoUri?wl.createElement(
|
|
1766
|
+
`;function Tl({stepData:e,appearance:t,classPrefix:o=""}){return e.videoUri?wl.createElement(je,{appearance:t,videoUri:e.videoUri}):e.imageUri?wl.createElement(uc,{className:l(`${o}image`,t),appearance:t,src:e.imageUri}):null}var gc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p=!0,modalPosition:c})=>{let{getFlow:a,markFlowCompleted:g,markStepCompleted:d,isLoading:x,targetingLogicShouldHideFlow:b,updateCustomVariables:w,getFlowSteps:v,getFlowStatus:f,getCurrentStepIndex:E}=Y(),{primaryCTAClickSideEffects:S,secondaryCTAClickSideEffects:y}=ie(),{mergeAppearanceWithDefault:A}=Q(),{setOpenFlowState:C,getOpenFlowState:m,hasOpenModals:B}=we(),[F,k]=[m(e,!0),U=>C(e,U)];if(r=A(r),fc(()=>{w(o)},[o,x]),x)return null;let O=a(e);if(!O||b(O)||f(e)===q||B())return null;let I=v(e)[E(e)],$=()=>{k(!1),t&&t(),g(e)};function D(){return Se.createElement(Se.Fragment,null,Se.createElement(oe,{appearance:r}),Se.createElement(gl,{appearance:r,className:xe(l("announcementContainer",r),n),style:s},(p===!0||I.dismissible)&&c=="inline"&&Se.createElement(yl,{onClick:async()=>{await g(e),t&&t()},className:l("announcementDismissButton",r)},Se.createElement(Te,null)),Se.createElement(xl,null,Se.createElement(Sl,{appearance:r,className:l("announcementTitle",r),dangerouslySetInnerHTML:le(I.title)}),I.subtitle&&Se.createElement(bl,{appearance:r,className:l("announcementSubtitle",r),dangerouslySetInnerHTML:le(I.subtitle)})),(I.imageUri||I.videoUri)&&Se.createElement(Cl,{className:l("announcementMediaContainer",r)},Se.createElement(Tl,{appearance:r,stepData:I})),(I.primaryButtonTitle||I.secondaryButtonTitle)&&Se.createElement(hl,{className:l("announcementCTAContainer",r)},I.secondaryButtonTitle&&Se.createElement(Z,{classPrefix:"announcement",title:I.secondaryButtonTitle,appearance:r,withMargin:!1,size:"small",type:"full-width",onClick:async()=>{I.handleSecondaryButtonClick(),y(I),i&&i(I,E(e),"secondary")},secondary:!0}),I.primaryButtonTitle&&Se.createElement(Z,{classPrefix:"announcement",title:I.primaryButtonTitle,appearance:r,withMargin:!1,size:"small",type:"full-width",onClick:async()=>{I.handlePrimaryButtonClick(),S(I),!(i&&i(I,E(e),"primary")===!1)&&(await d(e,I.id),await g(e))}}))))}let ee={padding:"24px",maxWidth:"400px"};return c==="inline"?D():c!=="center"?Se.createElement(wo,{modalPosition:c,onClose:$,visible:F,dismissible:p,appearance:r},D()):Se.createElement(_e,{appearance:r,onClose:$,visible:F,style:ee,dismissible:p},D())};import*as qo from"react";import Fl from"react";var kl=({as:e="span",children:t,variant:o="Body1",...i})=>Fl.createElement(Yi,{color:"neutral.foreground",fontFamily:"default",forwardedAs:e,variant:o,...i},t),xc=Object.fromEntries(Object.keys(Do).map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=i=>Fl.createElement(kl,{as:t,...i,variant:e},i.children);return o.displayName=`Text.${e}`,[e,o]})),Or=Object.assign(kl,xc);var Pl=({as:e="button",className:t,size:o="md",title:i,variant:r="Primary",...n})=>{var s;return qo.createElement(qi,{className:`fr-button-${r.toLowerCase()}${t?` ${t}`:""}`,forwardedAs:e,variant:r,size:o,borderRadius:"md",...n},qo.createElement(Or,{color:(s=ao[r])==null?void 0:s.color,fontWeight:"semibold"},i))},hc=Object.fromEntries(Object.keys(ao).map(e=>{let t=o=>qo.createElement(Pl,{...o,variant:e});return t.displayName=`Button.${e}`,[e,t]})),Cc=Object.assign(Pl,hc);export{lo as Box,Cc as Button,Qe as CheckBox,st as FormLabel,rr as FormTextField,gc as FrigadeAnnouncement,ac as FrigadeBanner,kr as FrigadeChecklist,Je as FrigadeDefaultAppearance,sc as FrigadeEmbeddedTip,Ui as FrigadeForm,zd as FrigadeGuide,Dd as FrigadeHeroChecklist,cc as FrigadeNPSSurvey,Md as FrigadeProgressBadge,Gp as FrigadeProvider,ic as FrigadeSupportWidget,Rd as FrigadeTour,$t as ProgressRing,Or as Text,xr as tokens,we as useFlowOpens,Xt as useFlowResponses,Y as useFlows,ur as useOrganization,Jt as useUser,ve as useUserFlowStates};
|
|
1766
1767
|
//# sourceMappingURL=index.mjs.map
|