@frigade/react 1.35.18 → 1.35.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -0
- package/lib/index.js +73 -73
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +73 -73
- 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 wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import{ThemeProvider as Kp}from"styled-components";import bt,{useContext as Sp,useEffect as Lo,useState as br}from"react";import{useCallback as ht,useContext as Gl,useEffect as Kl}from"react";import Yo,{useMemo as Hr}from"react";var _r="1.35.18 ";var Ne="NOT_STARTED_STEP",q="COMPLETED_FLOW",xo="ABORTED_FLOW",xt="STARTED_FLOW",Me="NOT_STARTED_FLOW",Ue="COMPLETED_STEP",ho="STARTED_STEP";function _e(){let{publicApiKey:e,userId:t,apiUrl:o}=Yo.useContext(K);return{config:Hr(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":_r,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:Hr(()=>`${o}/v1/public/`,[o])}}var Ol="frigade-last-call-at-",Ll="frigade-last-call-data-";function Nt(){let{shouldGracefullyDegrade:e,readonly:t}=Yo.useContext(K);return async(o,i)=>{if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return It();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),It();let r=Ol+o,n=Ll+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 l=new Date(p);if(new Date().getTime()-l.getTime()<1e3)return It()}window.localStorage.setItem(r,new Date().toISOString()),window.localStorage.setItem(n,i.body)}let s;try{s=await fetch(o,i)}catch(p){return It(p)}return s?s.ok?s:It(s.statusText):It()}}function It(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 Hl,useState as jr}from"react";import{useContext as $l,useEffect as Ml,useState as Ul}from"react";import zl from"swr";import{useContext as Dl}from"react";function we(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:r}=Dl(K);function n(d,x=!1){return e[d]??x}function s(d,x){t(T=>({...T,[d]:x}))}function p(d){t(x=>{let{[d]:T,...C}=x;return{...C}})}function c(d){r.includes(d)||i(x=>[...x,d])}function l(d){return r.includes(d)}function g(d){return Object.entries(e).some(([x,T])=>T&&x!=d)||o}return{getOpenFlowState:n,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:g,setKeepCompletedFlowOpenDuringSession:c,shouldKeepCompletedFlowOpenDuringSession:l}}import Wl from"swr/immutable";var _l="unknown";function Be(){let{config:e,apiUrl:t}=_e(),{publicApiKey:o,userId:i,organizationId:r,flows:n,setShouldGracefullyDegrade:s,readonly:p}=$l(K),{resetOpenFlowState:c}=we(),[l,g]=Ul(!1),d={data:n.map(k=>({flowId:k.id,flowState:q,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},x=k=>fetch(k,e).then(P=>{if(P.ok)return P.json();throw new Error("Failed to fetch user flow states")}).catch(P=>(console.log(`Error fetching ${k}: ${P}. Will gracefully degrade and hide Frigade`),s(!0),d)),T=o&&n&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,{data:C,isLoading:S,mutate:f,error:B}=p?Wl(T,x):zl(T,x,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),w=C==null?void 0:C.data;Ml(()=>{!l&&!S&&w&&g(!0)},[w,l,S]);async function b(k){if(w&&!p){let P=w.find(O=>O.flowId===k);P&&P.flowState!==q&&(P.flowState=q),await f(Promise.resolve({...C,data:w}),{optimisticData:{...C,data:w},revalidate:!1,rollbackOnError:!1})}}async function A(k,P,O){if(w){let I=w.find(N=>N.flowId===k);I&&(I.stepStates[P]=O,I.flowState=xt),await f(Promise.resolve({...C,data:w}),{optimisticData:{...C,data:w},revalidate:!1,rollbackOnError:!1})}}async function y(k,P,O){if(w){let I=w.find(N=>N.flowId===k);I&&(I.lastStepId=P,I.stepStates[P]=O,I.flowState=xt),await f({...C,data:w},{optimisticData:{...C,data:w},revalidate:!1,rollbackOnError:!1})}}async function m(k){if(w){let P=w.find(O=>O.flowId===k);P&&P.flowState!==Me&&(P.flowState=Me,P.lastStepId=_l,Object.keys(P.stepStates).forEach(O=>{P.stepStates[O].actionType=Ne,P.stepStates[O].createdAt=new Date().toISOString()}),await f({...C,data:w},{optimisticData:{...C,data:w},revalidate:!1,rollbackOnError:!1}),c(k))}}async function E(k,P){if(w){let O=w.find(I=>I.flowId===k);O&&O.stepStates[P]!==Ne&&(O.stepStates[P]=Ne),await f({...C,data:w},{optimisticData:{...C,data:w},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:w,isLoadingUserFlowStateData:!l,mutateUserFlowState:f,optimisticallyMarkFlowCompleted:b,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:A,optimisticallyMarkStepNotStarted:E,optimisticallyMarkStepStarted:y,error:B}}function Xt(){let{config:e,apiUrl:t}=_e(),{userFlowStatesData:o,mutateUserFlowState:i}=Be(),{failedFlowResponses:r,setFailedFlowResponses:n,flowResponses:s,setFlowResponses:p}=Hl(K),[c,l]=jr(new Set),[g,d]=jr(new Set),x=Nt();function T(f){let B=JSON.stringify(f);if(c.has(B))return null;c.add(B),l(c),g.add(f),d(g);let w=s==null?void 0:s.find(b=>b.flowSlug===f.flowSlug&&b.stepId===f.stepId&&b.actionType===f.actionType&&b.createdAt===f.createdAt);return x(`${t}flowResponses`,{...e,method:"POST",body:B}).then(b=>{b.status!==200&&b.status!==201?(console.log("Failed to send flow response for step "+f.stepId+". Will retry again later."),n([...r,f])):w||p(A=>[...A??[],f])})}async function C(f){f.foreignUserId&&(f.actionType===xt||f.actionType===Me?await T(f):f.actionType===q?await T(f):f.actionType===ho?await T(f):f.actionType===Ue?await T(f):f.actionType===xo?await T(f):f.actionType===Ne&&await T(f))}function S(){let f=[];return o==null||o.forEach(B=>{if(B&&B.stepStates&&Object.keys(B.stepStates).length!==0)for(let w in B.stepStates){let b=B.stepStates[w];f.push({foreignUserId:B.foreignUserId,flowSlug:B.flowId,stepId:b.stepId,actionType:b.actionType,data:{},createdAt:new Date(b.createdAt),blocked:b.blocked,hidden:b.hidden})}}),[...f,...s]}return{addResponse:C,setFlowResponses:p,getFlowResponses:S}}import ql from"swr";var jl=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Vr=e=>{let t=jl.exec(e);if(t===null)return null;let o=null;return t.forEach((i,r)=>{let n=Vl(i,"'","");n.startsWith("flow_")&&(o=n)}),o},Vl=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function Xo(e){try{return JSON.parse(e)}catch(t){return console.error("Failed to parse Frigade config.yml to JSON",t),null}}var Jo=(l=>(l.CHECKLIST="CHECKLIST",l.FORM="FORM",l.TOUR="TOUR",l.SUPPORT="SUPPORT",l.CUSTOM="CUSTOM",l.BANNER="BANNER",l.EMBEDDED_TIP="EMBEDDED_TIP",l.NPS_SURVEY="NPS_SURVEY",l.ANNOUNCEMENT="ANNOUNCEMENT",l))(Jo||{});function Y(){let{config:e,apiUrl:t}=_e(),{flows:o,setFlows:i,userId:r,publicApiKey:n,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:l,setFlowResponses:g,setShouldGracefullyDegrade:d,readonly:x}=Gl(K),T={data:[]},{verifySDKInitiated:C}=Ot(),{addResponse:S,getFlowResponses:f}=Xt(),B=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),T)).catch(h=>(console.log(`Error fetching ${u}: ${h}. Will gracefully degrade and hide Frigade`),d(!0),T)),{mutateUserFlowState:w,userFlowStatesData:b,isLoadingUserFlowStateData:A,optimisticallyMarkFlowCompleted:y,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:E,optimisticallyMarkStepNotStarted:k,optimisticallyMarkStepStarted:P}=Be(),{data:O,error:I,isLoading:N}=ql(n?`${t}flows${x?"?readonly=true":""}`:null,B,{keepPreviousData:!0});Kl(()=>{if(I){console.error(I);return}O&&O.data&&i(O.data)},[O,I]);function $(u){if(N)return null;let h=o.find(v=>v.slug===u);return!h&&o.length>0&&!A&&!N?(console.log(`Flow with id ${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=Xo(h))==null?void 0:W.data)??[]).map(M=>{let $e=se(M);return{handleSecondaryButtonClick:()=>{M.skippable===!0&&j(u,M.id,{skipped:!0})},...M,complete:ge(u,M.id)===Ue||$e>=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:$e}}).filter(M=>M.hidden!==!0)):[]}function ee(u){return u.replaceAll(/\${(.*?)}/g,(h,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 U(u){if(!$(u))return[];let h=$(u).data;return h?(h=ee(h),JSON.parse(h)??{}):[]}function te(u,h){p(v=>({...v,[u]:h}))}function fe(u){!A&&!N&&u&&JSON.stringify(s)!=JSON.stringify({...s,...u})&&Object.keys(u).forEach(h=>{te(h,u[h])})}let X=ht(async(u,h,v)=>{if(!C())return;let W={foreignUserId:r,flowSlug:u,stepId:h,actionType:ho,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await P(u,h,W),S(W))},[r,b]),H=ht(async(u,h,v)=>{if(!C())return;let W={foreignUserId:r,flowSlug:u,stepId:h,actionType:Ne,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await k(u,h),S(W))},[r,b]),j=ht(async(u,h,v)=>{if(!C())return;let W={foreignUserId:r,flowSlug:u,stepId:h,actionType:Ue,data:v??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await E(u,h,W),S(W))},[r,b]),Ce=ht(async(u,h)=>{if(!C()||pe(u)===Me)return;let v={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:Me,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};await m(u),J(v)&&S(v)},[r,b]),Ie=ht(async(u,h)=>{if(!C())return;let v={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:xt,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};J(v)&&S(v)},[r,b]),be=ht(async(u,h)=>{if(!C())return;let v={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:q,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};J(v)&&(await y(u),S(v))},[r,b]),me=ht(async(u,h)=>{if(!C())return;let v={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:xo,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};J(v)&&(await y(u),S(v))},[r,b]);function J(u){var h;if(!b&&u.actionType===Ne)return!1;if(b){let v=b.find(W=>W.flowId===u.flowSlug);if(u.actionType===Ne&&(!(v!=null&&v.stepStates[u.stepId])||v.stepStates[u.stepId].actionType===Ne)||v&&((h=v.stepStates[u.stepId])==null?void 0:h.actionType)===u.actionType||v&&v.flowState===q&&u.actionType===q)return!1}return!0}function ge(u,h){let v=V(u,h);return A?null:v?v.actionType:Ne}function re(u,h){let v=V(u,h);return v?v.blocked:!1}function L(u,h){let v=V(u,h);return v?v.hidden:!1}function V(u,h){if(A)return null;let v=b==null?void 0:b.find(W=>W.flowId===u);return!v||!v.stepStates[h]?null:v.stepStates[h]??null}function G(u){var v;if(A||!b)return null;if(pe(u)===Me)return D(u)[0]??null;let h=(v=b.find(W=>W.flowId===u))==null?void 0:v.lastStepId;return h?D(u).find(W=>W.id===h):null}function ne(u){let h=G(u);if(!h)return 0;let v=D(u).findIndex(W=>W.id===h.id)??0;return ge(u,h.id)===Ue&&v<D(u).length-1?v+1:v}function se(u){if(!u.completionCriteria)return;let h=Vr(u.completionCriteria);if(h===null)return;let v=Ye(h),W=De(h);return W===0?void 0:v/W}function pe(u){let h=b==null?void 0:b.find(v=>v.flowId===u);return h?h.flowState:null}function Ye(u){let h=D(u);return h.length===0?0:h.filter(W=>ge(u,W.id)===Ue).length}function De(u){return D(u).length}function Et(u){let h=o.find(v=>v.slug===u);return h?Xo(h.data):null}function ft(u){if(x)return!1;if(A)return!0;if(u!=null&&u.targetingLogic&&b){let h=b.find(v=>v.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&&w()}return{getFlow:$,getFlowData:Et,isLoading:A||N,getStepStatus:ge,getFlowSteps:D,getCurrentStepIndex:ne,markStepStarted:X,markStepCompleted:j,markFlowNotStarted:Ce,markFlowStarted:Ie,markFlowCompleted:be,markFlowAborted:me,markStepNotStarted:H,getFlowStatus:pe,getNumberOfStepsCompleted:Ye,getNumberOfSteps:De,targetingLogicShouldHideFlow:ft,setCustomVariable:te,updateCustomVariables:fe,customVariables:s,getStepOptionalProgress:se,getFlowMetadata:U,isStepBlocked:re,isStepHidden:L,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:l,isFlowAvailableToUser:At,refresh:gt}}import{useCallback as Qo,useContext as Yl,useEffect as Xl}from"react";var Lt="guest_";function Jt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=Yl(K),{config:n,apiUrl:s}=_e(),{mutateUserFlowState:p}=Be(),c=Nt(),{verifySDKInitiated:l}=Ot();function g(C){return`frigade-user-registered-${C}`}Xl(()=>{if(e&&!t){if(e.startsWith(Lt))return;let C=g(e);localStorage.getItem(C)||(c(`${s}users`,{...n,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(C,"true"))}},[e,r,t]);let d=Qo(async C=>{if(!l())return;let S={foreignId:e,properties:C};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(S)}),i(f=>({...f,...C})),p()},[e,n,r,p]),x=Qo(async(C,S)=>{if(!l())return;let B={foreignId:e,events:[{event:C,properties:S}]};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(B)}),p()},[e,n,p]),T=Qo(async(C,S)=>{if(l())if(S){let f=g(C);localStorage.setItem(f,"true"),o(C);let B={foreignId:C,properties:S};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(B)}),i(w=>({...w,...S})),p()}else o(C)},[n,r,p]);return{userId:e,setUserId:o,setUserIdWithProperties:T,addPropertiesToUser:d,trackEventForUser:x}}import{v4 as bp}from"uuid";import Ge,{useEffect as xp,useState as hp}from"react";import ze,{useEffect as or,useState as ia}from"react";import So from"styled-components";import Jl from"react";import Ql from"styled-components";var Gr="fr-",Qt="cfr-";function a(e,t){let o=`${Gr}${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 F(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(Gr)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Zo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function ke(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Zo(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 Zl=Ql.div`
|
|
2
|
+
import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import{ThemeProvider as Kp}from"styled-components";import bt,{useContext as Sp,useEffect as Lo,useState as br}from"react";import{useCallback as ht,useContext as Gl,useEffect as Kl}from"react";import Yo,{useMemo as Hr}from"react";var _r="1.35.20 ";var Ne="NOT_STARTED_STEP",q="COMPLETED_FLOW",xo="ABORTED_FLOW",xt="STARTED_FLOW",Me="NOT_STARTED_FLOW",Ue="COMPLETED_STEP",ho="STARTED_STEP";function _e(){let{publicApiKey:e,userId:t,apiUrl:o}=Yo.useContext(K);return{config:Hr(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":_r,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:Hr(()=>`${o}/v1/public/`,[o])}}var Ol="frigade-last-call-at-",Ll="frigade-last-call-data-";function Nt(){let{shouldGracefullyDegrade:e,readonly:t}=Yo.useContext(K);return async(o,i)=>{if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return It();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),It();let r=Ol+o,n=Ll+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 l=new Date(p);if(new Date().getTime()-l.getTime()<1e3)return It()}window.localStorage.setItem(r,new Date().toISOString()),window.localStorage.setItem(n,i.body)}let s;try{s=await fetch(o,i)}catch(p){return It(p)}return s?s.ok?s:It(s.statusText):It()}}function It(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 Hl,useState as jr}from"react";import{useContext as $l,useEffect as Ml,useState as Ul}from"react";import zl from"swr";import{useContext as Dl}from"react";function we(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:r}=Dl(K);function n(d,x=!1){return e[d]??x}function s(d,x){t(F=>({...F,[d]:x}))}function p(d){t(x=>{let{[d]:F,...C}=x;return{...C}})}function c(d){r.includes(d)||i(x=>[...x,d])}function l(d){return r.includes(d)}function g(d){return Object.entries(e).some(([x,F])=>F&&x!=d)||o}return{getOpenFlowState:n,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:g,setKeepCompletedFlowOpenDuringSession:c,shouldKeepCompletedFlowOpenDuringSession:l}}import Wl from"swr/immutable";var _l="unknown";function Be(){let{config:e,apiUrl:t}=_e(),{publicApiKey:o,userId:i,organizationId:r,flows:n,setShouldGracefullyDegrade:s,readonly:p}=$l(K),{resetOpenFlowState:c}=we(),[l,g]=Ul(!1),d={data:n.map(T=>({flowId:T.id,flowState:q,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},x=T=>fetch(T,e).then(E=>{if(E.ok)return E.json();throw new Error("Failed to fetch user flow states")}).catch(E=>(console.log(`Error fetching ${T}: ${E}. Will gracefully degrade and hide Frigade`),s(!0),d)),F=o&&n&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${r?`&foreignUserGroupId=${encodeURIComponent(r)}`:""}`:null,{data:C,isLoading:y,mutate:f,error:v}=p?Wl(F,x):zl(F,x,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!0,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>d,onLoadingSlow:()=>d}),w=C==null?void 0:C.data;Ml(()=>{!l&&!y&&w&&g(!0)},[w,l,y]);async function b(T){if(w&&!p){let E=w.find(L=>L.flowId===T);E&&E.flowState!==q&&(E.flowState=q),await f(Promise.resolve({...C,data:w}),{optimisticData:{...C,data:w},revalidate:!1,rollbackOnError:!1})}}async function A(T,E,L){if(w){let N=w.find(I=>I.flowId===T);N&&(N.stepStates[E]=L,N.flowState=xt),await f(Promise.resolve({...C,data:w}),{optimisticData:{...C,data:w},revalidate:!1,rollbackOnError:!1})}}async function S(T,E,L){if(w){let N=w.find(I=>I.flowId===T);N&&(N.lastStepId=E,N.stepStates[E]=L,N.flowState=xt),await f({...C,data:w},{optimisticData:{...C,data:w},revalidate:!1,rollbackOnError:!1})}}async function m(T){if(w){let E=w.find(L=>L.flowId===T);E&&E.flowState!==Me&&(E.flowState=Me,E.lastStepId=_l,Object.keys(E.stepStates).forEach(L=>{E.stepStates[L].actionType=Ne,E.stepStates[L].createdAt=new Date().toISOString()}),await f({...C,data:w},{optimisticData:{...C,data:w},revalidate:!1,rollbackOnError:!1}),c(T))}}async function B(T,E){if(w){let L=w.find(N=>N.flowId===T);L&&L.stepStates[E]!==Ne&&(L.stepStates[E]=Ne),await f({...C,data:w},{optimisticData:{...C,data:w},revalidate:!1,rollbackOnError:!1})}}return{userFlowStatesData:w,isLoadingUserFlowStateData:!l,mutateUserFlowState:f,optimisticallyMarkFlowCompleted:b,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:A,optimisticallyMarkStepNotStarted:B,optimisticallyMarkStepStarted:S,error:v}}function Xt(){let{config:e,apiUrl:t}=_e(),{userFlowStatesData:o,mutateUserFlowState:i}=Be(),{failedFlowResponses:r,setFailedFlowResponses:n,flowResponses:s,setFlowResponses:p}=Hl(K),[c,l]=jr(new Set),[g,d]=jr(new Set),x=Nt();function F(f){let v=JSON.stringify(f);if(c.has(v))return null;c.add(v),l(c),g.add(f),d(g);let w=s==null?void 0:s.find(b=>b.flowSlug===f.flowSlug&&b.stepId===f.stepId&&b.actionType===f.actionType&&b.createdAt===f.createdAt);return x(`${t}flowResponses`,{...e,method:"POST",body:v}).then(b=>{b.status!==200&&b.status!==201?(console.log("Failed to send flow response for step "+f.stepId+". Will retry again later."),n([...r,f])):w||p(A=>[...A??[],f])})}async function C(f){f.foreignUserId&&(f.actionType===xt||f.actionType===Me?await F(f):f.actionType===q?await F(f):f.actionType===ho?await F(f):f.actionType===Ue?await F(f):f.actionType===xo?await F(f):f.actionType===Ne&&await F(f))}function y(){let f=[];return o==null||o.forEach(v=>{if(v&&v.stepStates&&Object.keys(v.stepStates).length!==0)for(let w in v.stepStates){let b=v.stepStates[w];f.push({foreignUserId:v.foreignUserId,flowSlug:v.flowId,stepId:b.stepId,actionType:b.actionType,data:{},createdAt:new Date(b.createdAt),blocked:b.blocked,hidden:b.hidden})}}),[...f,...s]}return{addResponse:C,setFlowResponses:p,getFlowResponses:y}}import ql from"swr";var jl=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Vr=e=>{let t=jl.exec(e);if(t===null)return null;let o=null;return t.forEach((i,r)=>{let n=Vl(i,"'","");n.startsWith("flow_")&&(o=n)}),o},Vl=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function Xo(e){try{return JSON.parse(e)}catch(t){return console.error("Failed to parse Frigade config.yml to JSON",t),null}}var Jo=(l=>(l.CHECKLIST="CHECKLIST",l.FORM="FORM",l.TOUR="TOUR",l.SUPPORT="SUPPORT",l.CUSTOM="CUSTOM",l.BANNER="BANNER",l.EMBEDDED_TIP="EMBEDDED_TIP",l.NPS_SURVEY="NPS_SURVEY",l.ANNOUNCEMENT="ANNOUNCEMENT",l))(Jo||{});function Y(){let{config:e,apiUrl:t}=_e(),{flows:o,setFlows:i,userId:r,publicApiKey:n,customVariables:s,setCustomVariables:p,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:l,setFlowResponses:g,setShouldGracefullyDegrade:d,readonly:x}=Gl(K),F={data:[]},{verifySDKInitiated:C}=Ot(),{addResponse:y,getFlowResponses:f}=Xt(),v=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),F)).catch(h=>(console.log(`Error fetching ${u}: ${h}. Will gracefully degrade and hide Frigade`),d(!0),F)),{mutateUserFlowState:w,userFlowStatesData:b,isLoadingUserFlowStateData:A,optimisticallyMarkFlowCompleted:S,optimisticallyMarkFlowNotStarted:m,optimisticallyMarkStepCompleted:B,optimisticallyMarkStepNotStarted:T,optimisticallyMarkStepStarted:E}=Be(),{data:L,error:N,isLoading:I}=ql(n?`${t}flows${x?"?readonly=true":""}`:null,v,{keepPreviousData:!0});Kl(()=>{if(N){console.error(N);return}L&&L.data&&i(L.data)},[L,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 id ${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=Xo(h))==null?void 0:W.data)??[]).map(M=>{let $e=se(M);return{handleSecondaryButtonClick:()=>{M.skippable===!0&&j(u,M.id,{skipped:!0})},...M,complete:ge(u,M.id)===Ue||$e>=1,blocked:re(u,M.id),hidden:O(u,M.id),handlePrimaryButtonClick:()=>{(!M.completionCriteria&&(M.autoMarkCompleted||M.autoMarkCompleted===void 0)||M.completionCriteria&&M.autoMarkCompleted===!0)&&j(u,M.id)},progress:$e}}).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(!C())return;let W={foreignUserId:r,flowSlug:u,stepId:h,actionType:ho,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await E(u,h,W),y(W))},[r,b]),H=ht(async(u,h,P)=>{if(!C())return;let W={foreignUserId:r,flowSlug:u,stepId:h,actionType:Ne,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await T(u,h),y(W))},[r,b]),j=ht(async(u,h,P)=>{if(!C())return;let W={foreignUserId:r,flowSlug:u,stepId:h,actionType:Ue,data:P??{},createdAt:new Date,blocked:!1,hidden:!1};J(W)&&(await B(u,h,W),y(W))},[r,b]),Ce=ht(async(u,h)=>{if(!C()||pe(u)===Me)return;let P={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:Me,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};await m(u),J(P)&&y(P)},[r,b]),Ie=ht(async(u,h)=>{if(!C())return;let P={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:xt,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&y(P)},[r,b]),be=ht(async(u,h)=>{if(!C())return;let P={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:q,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&(await S(u),y(P))},[r,b]),me=ht(async(u,h)=>{if(!C())return;let P={foreignUserId:r,flowSlug:u,stepId:"unknown",actionType:xo,data:h??{},createdAt:new Date,blocked:!1,hidden:!1};J(P)&&(await S(u),y(P))},[r,b]);function J(u){var h;if(!b&&u.actionType===Ne)return!1;if(b){let P=b.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 O(u,h){let P=V(u,h);return P?P.hidden:!1}function V(u,h){if(A)return null;let P=b==null?void 0:b.find(W=>W.flowId===u);return!P||!P.stepStates[h]?null:P.stepStates[h]??null}function G(u){var P;if(A||!b)return null;if(pe(u)===Me)return D(u)[0]??null;let h=(P=b.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)===Ue&&P<D(u).length-1?P+1:P}function se(u){if(!u.completionCriteria)return;let h=Vr(u.completionCriteria);if(h===null)return;let P=Ye(h),W=De(h);return W===0?void 0:P/W}function pe(u){let h=b==null?void 0:b.find(P=>P.flowId===u);return h?h.flowState:null}function Ye(u){let h=D(u);return h.length===0?0:h.filter(W=>ge(u,W.id)===Ue).length}function De(u){return D(u).length}function Et(u){let h=o.find(P=>P.slug===u);return h?Xo(h.data):null}function ft(u){if(x)return!1;if(A)return!0;if(u!=null&&u.targetingLogic&&b){let h=b.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&&w()}return{getFlow:$,getFlowData:Et,isLoading:A||I,getStepStatus:ge,getFlowSteps:D,getCurrentStepIndex:ne,markStepStarted:X,markStepCompleted:j,markFlowNotStarted:Ce,markFlowStarted:Ie,markFlowCompleted:be,markFlowAborted:me,markStepNotStarted:H,getFlowStatus:pe,getNumberOfStepsCompleted:Ye,getNumberOfSteps:De,targetingLogicShouldHideFlow:ft,setCustomVariable:te,updateCustomVariables:fe,customVariables:s,getStepOptionalProgress:se,getFlowMetadata:U,isStepBlocked:re,isStepHidden:O,hasActiveFullPageFlow:c,setHasActiveFullPageFlow:l,isFlowAvailableToUser:At,refresh:gt}}import{useCallback as Qo,useContext as Yl,useEffect as Xl}from"react";var Lt="guest_";function Jt(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:r}=Yl(K),{config:n,apiUrl:s}=_e(),{mutateUserFlowState:p}=Be(),c=Nt(),{verifySDKInitiated:l}=Ot();function g(C){return`frigade-user-registered-${C}`}Xl(()=>{if(e&&!t){if(e.startsWith(Lt))return;let C=g(e);localStorage.getItem(C)||(c(`${s}users`,{...n,method:"POST",body:JSON.stringify({foreignId:e})}),localStorage.setItem(C,"true"))}},[e,r,t]);let d=Qo(async C=>{if(!l())return;let y={foreignId:e,properties:C};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(y)}),i(f=>({...f,...C})),p()},[e,n,r,p]),x=Qo(async(C,y)=>{if(!l())return;let v={foreignId:e,events:[{event:C,properties:y}]};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(v)}),p()},[e,n,p]),F=Qo(async(C,y)=>{if(l())if(y){let f=g(C);localStorage.setItem(f,"true"),o(C);let v={foreignId:C,properties:y};await c(`${s}users`,{...n,method:"POST",body:JSON.stringify(v)}),i(w=>({...w,...y})),p()}else o(C)},[n,r,p]);return{userId:e,setUserId:o,setUserIdWithProperties:F,addPropertiesToUser:d,trackEventForUser:x}}import{v4 as bp}from"uuid";import Ge,{useEffect as xp,useState as hp}from"react";import ze,{useEffect as or,useState as ia}from"react";import So from"styled-components";import Jl from"react";import Ql from"styled-components";var Gr="fr-",Qt="cfr-";function a(e,t){let o=`${Gr}${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 k(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(Gr)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Zo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function ke(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Zo(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 Zl=Ql.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -7,7 +7,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
7
7
|
left: 0;
|
|
8
8
|
bottom: 0;
|
|
9
9
|
right: 0;
|
|
10
|
-
${e=>
|
|
10
|
+
${e=>k(e)} {
|
|
11
11
|
background-color: rgba(0, 0, 0, 0.6);
|
|
12
12
|
z-index: 1400;
|
|
13
13
|
}
|
|
@@ -28,7 +28,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
30
|
`,Te=()=>Ro.createElement(ea,null,Ro.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 20 20"},Ro.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5 15L15 5M5 5l10 10"})));import{Portal as na}from"react-portal";import ni from"react";import er from"react";function ta({style:e,className:t}){return er.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"54",height:"14",fill:"none",viewBox:"0 0 54 14",style:e,className:t},er.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"}),er.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 qr=ta;import tr from"styled-components";import Xe from"styled-components";var Co=Xe.div`
|
|
31
|
-
${e=>
|
|
31
|
+
${e=>k(e)} {
|
|
32
32
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -57,11 +57,11 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
57
57
|
top: 12px;
|
|
58
58
|
right: 12px;
|
|
59
59
|
`,Yr=Xe.div`
|
|
60
|
-
${e=>
|
|
60
|
+
${e=>k(e)} {
|
|
61
61
|
${e=>e.hasImage?oa:ra};
|
|
62
62
|
}
|
|
63
63
|
`,Xr=Xe.img`
|
|
64
|
-
${e=>
|
|
64
|
+
${e=>k(e)} {
|
|
65
65
|
display: block;
|
|
66
66
|
width: 100%;
|
|
67
67
|
height: auto;
|
|
@@ -69,7 +69,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
69
69
|
object-fit: cover;
|
|
70
70
|
}
|
|
71
71
|
`,Jr=Xe.div`
|
|
72
|
-
${e=>
|
|
72
|
+
${e=>k(e)} {
|
|
73
73
|
display: block;
|
|
74
74
|
width: 100%;
|
|
75
75
|
height: auto;
|
|
@@ -94,14 +94,14 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
94
94
|
flex-shrink: 1;
|
|
95
95
|
gap: 8px;
|
|
96
96
|
height: 64px;
|
|
97
|
-
${e=>
|
|
97
|
+
${e=>k(e)} {
|
|
98
98
|
flex-direction: row;
|
|
99
99
|
justify-content: ${e=>e.showStepCount?"flex-end":"flex-start"};
|
|
100
100
|
align-content: center;
|
|
101
101
|
align-items: center;
|
|
102
102
|
}
|
|
103
103
|
`,ti=Xe.p`
|
|
104
|
-
${e=>
|
|
104
|
+
${e=>k(e)} {
|
|
105
105
|
font-style: normal;
|
|
106
106
|
font-weight: 600;
|
|
107
107
|
font-size: 15px;
|
|
@@ -143,7 +143,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
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
145
|
`;function yo({appearance:e}){return ni.createElement(ii,{className:a("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",ni.createElement(qr,null))}var sa=So.div`
|
|
146
|
-
${e=>
|
|
146
|
+
${e=>k(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}};
|
|
149
149
|
/* Mobile */
|
|
@@ -193,7 +193,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
193
193
|
right: 16px;
|
|
194
194
|
cursor: pointer;
|
|
195
195
|
z-index: 1501;
|
|
196
|
-
${e=>
|
|
196
|
+
${e=>k(e)} {
|
|
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
|
}
|
|
@@ -214,7 +214,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
214
214
|
bottom: 0;
|
|
215
215
|
left: 0;
|
|
216
216
|
`}return"right: 0; bottom: 0;"}var ua=bo.div`
|
|
217
|
-
${e=>
|
|
217
|
+
${e=>k(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}};
|
|
220
220
|
position: fixed;
|
|
@@ -238,7 +238,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
238
238
|
right: 16px;
|
|
239
239
|
cursor: pointer;
|
|
240
240
|
z-index: 1501;
|
|
241
|
-
${e=>
|
|
241
|
+
${e=>k(e)} {
|
|
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
|
}
|
|
@@ -249,7 +249,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
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})=>{let[p,c]=da("");return rr(()=>{let l=getComputedStyle(document.body).getPropertyValue("overflow");c(l)},[]),rr(()=>{let l=g=>{g.key==="Escape"&&e()};return document.addEventListener("keydown",l),()=>{document.removeEventListener("keydown",l)}},[e]),rr(()=>{let l=document.body.style;return t?l.setProperty("overflow","hidden"):l.setProperty("overflow",p),()=>{l.setProperty("overflow",p)}},[t]),t?nt.createElement(ca,null,nt.createElement(ua,{appearance:r,className:a("cornerModalContainer",r),modalPosition:n},s&&nt.createElement(ga,{className:a("cornerModalClose",r),onClick:()=>e()},nt.createElement(Te,null)),o&&nt.createElement(fa,null,o),nt.createElement(xa,null,i))):nt.createElement(nt.Fragment,null)};import{useContext as ha}from"react";function Q(){let{defaultAppearance:e}=ha(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 za,useEffect as Wa,useState as ur}from"react";import vo from"styled-components";import ko,{useEffect as ci,useState as sr}from"react";import lr from"styled-components";import To from"styled-components";var si=To.label`
|
|
252
|
-
${e=>
|
|
252
|
+
${e=>k(e)} {
|
|
253
253
|
font-size: 12px;
|
|
254
254
|
line-height: 18px;
|
|
255
255
|
margin-bottom: 5px;
|
|
@@ -260,7 +260,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
260
260
|
}
|
|
261
261
|
display: flex;
|
|
262
262
|
`,li=To.label`
|
|
263
|
-
${e=>
|
|
263
|
+
${e=>k(e)} {
|
|
264
264
|
font-size: 12px;
|
|
265
265
|
line-height: 20px;
|
|
266
266
|
margin-bottom: 5px;
|
|
@@ -284,7 +284,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
284
284
|
flex-direction: column;
|
|
285
285
|
width: 100%;
|
|
286
286
|
`,ar=lr.input`
|
|
287
|
-
${e=>
|
|
287
|
+
${e=>k(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}};
|
|
290
290
|
font-size: 14px;
|
|
@@ -300,7 +300,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
300
300
|
padding: 0 10px;
|
|
301
301
|
margin-bottom: 10px;
|
|
302
302
|
`,ya=lr.textarea`
|
|
303
|
-
${e=>
|
|
303
|
+
${e=>k(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}};
|
|
306
306
|
font-size: 14px;
|
|
@@ -315,14 +315,14 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
315
315
|
min-height: 70px;
|
|
316
316
|
box-sizing: border-box;
|
|
317
317
|
margin-bottom: 10px;
|
|
318
|
-
`;function pr({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:r}){let n=e,[s,p]=sr((r==null?void 0:r.text)||""),[c,l]=sr(!1),[g,d]=sr(!1),x=ar;ci(()=>{s===""&&!c&&(l(!0),
|
|
318
|
+
`;function pr({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:r}){let n=e,[s,p]=sr((r==null?void 0:r.text)||""),[c,l]=sr(!1),[g,d]=sr(!1),x=ar;ci(()=>{s===""&&!c&&(l(!0),F(""))},[]),ci(()=>{if(g){F(s);return}},[g]);function F(y){if(p(y),o({text:y}),n.required===!0&&y.trim()===""){i([{id:n.id,message:`${n.title??"Field"} is required`,hidden:!g}]);return}let f=di(y,n.validation);if(f&&(y.trim()!==""||n.required===!0)){i([{id:n.id,message:f,hidden:!g}]);return}i([])}n.multiline&&(x=ya);function C(){var y;switch((y=n==null?void 0:n.validation)==null?void 0:y.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return ko.createElement(Ca,null,ko.createElement(st,{title:n.title,required:n.required,appearance:t.appearance}),ko.createElement(x,{className:a("inputComponent",t.appearance),value:s,onChange:y=>{F(y.target.value)},appearance:t.appearance,placeholder:n.placeholder,type:C(),onBlur:()=>{d(!0)}}),ko.createElement(Dt,{title:n.subtitle,appearance:t.appearance}))}import je,{useEffect as mi,useState as ui}from"react";import fi from"styled-components";var dr="",Sa=fi.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
|
`,ba=fi.select`
|
|
325
|
-
${e=>
|
|
325
|
+
${e=>k(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}};
|
|
328
328
|
font-size: 14px;
|
|
@@ -342,7 +342,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}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 gi({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var g,d,x,
|
|
345
|
+
`;function gi({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var g,d,x,F,C,y;let n=e,[s,p]=ui(((g=i==null?void 0:i.choice)==null?void 0:g[0])||""),[c,l]=ui(!1);return mi(()=>{var f,v,w,b;if(s===""&&!c){if(l(!0),n.requireSelection){p(dr);return}if(n.defaultValue&&((f=n.props.options)!=null&&f.find(A=>A.id===n.defaultValue))){let A=(v=n.props.options)==null?void 0:v.find(S=>S.id===n.defaultValue);p(A.id),o({choice:[A.id]})}else p(((w=n.props.options)==null?void 0:w[0].id)||""),o({choice:[((b=n.props.options)==null?void 0:b[0].id)||""]})}},[]),mi(()=>{n.requireSelection&&s===dr?r([{message:"Please select an option",id:n.id}]):r([])},[s]),je.createElement(Sa,null,je.createElement(st,{title:n.title,required:!1,appearance:t.appearance}),je.createElement(ba,{value:s,onChange:f=>{p(f.target.value),o({choice:[f.target.value]})},placeholder:n.placeholder,appearance:t.appearance,className:a("multipleChoiceSelect",t.appearance)},n.requireSelection&&je.createElement("option",{key:"null-value",value:dr,disabled:!0},n.placeholder??"Select an option"),(d=n.props.options)==null?void 0:d.map(f=>je.createElement("option",{key:f.id,value:f.id},f.title))),((F=(x=n.props.options)==null?void 0:x.find(f=>f.id===s))==null?void 0:F.isOpenEnded)&&je.createElement(je.Fragment,null,je.createElement(st,{title:((y=(C=n.props.options)==null?void 0:C.find(f=>f.id===s))==null?void 0:y.openEndedLabel)??"Please specify",required:!1,appearance:t.appearance}),je.createElement(ar,{type:"text",placeholder:"Enter your answer here",onChange:f=>{o({choice:[f.target.value]})},appearance:t.appearance})),je.createElement(Dt,{title:n.subtitle,appearance:t.appearance}))}import to,{useEffect as cr,useState as hi}from"react";import Ci from"styled-components";import eo from"react";import Rt from"react";var xi=({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})},wa=({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(xi,{color:r,size:t}),Rt.createElement(xi,{color:e,percentage:o,size:t})),i),$t=wa;import Ta from"styled-components";var Fa=({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"})),ka={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},Pa={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},va={border:"1px solid #000000",color:"#FFFFFF"},Ba={border:"1px solid #C5CBD3"},Ea={color:"#FFFFFF"},Aa={border:"1px solid #C5CBD3"},Ia=e=>e==="square"?ka:Pa,Na=(e,t)=>e==="square"?t?va:Ba:t?Ea:Aa,Oa=Ta.div`
|
|
346
346
|
${e=>ke(e)}
|
|
347
347
|
`,Qe=({value:e,type:t="round",primaryColor:o="#000000",progress:i,appearance:r=Je,style:n,className:s})=>{let p=Ia(t),c=Na(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(Oa,{styleOverrides:p,style:n,role:"checkbox",className:xe(a("checkIconContainer",r),a(e?"checkIconContainerChecked":"checkIconContainerUnchecked",r),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&eo.createElement(Fa,{color:"#FFFFFF"}))};var La=Ci.div`
|
|
348
348
|
display: flex;
|
|
@@ -351,7 +351,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
351
351
|
-webkit-appearance: none;
|
|
352
352
|
appearance: none;
|
|
353
353
|
`,Da=Ci.button`
|
|
354
|
-
${e=>
|
|
354
|
+
${e=>k(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}};
|
|
357
357
|
font-size: 14px;
|
|
@@ -376,7 +376,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
376
376
|
padding: 0 18px;
|
|
377
377
|
margin-bottom: 10px;
|
|
378
378
|
`;function yi({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:r}){var g;let n=e,[s,p]=hi((i==null?void 0:i.choice)||[]),[c,l]=hi(!1);return cr(()=>{s.length==0&&!c&&(l(!0),o({choice:[]}))},[]),cr(()=>{o({choice:s})},[s]),cr(()=>{n.required&&(s.length<n.props.minChoices||s.length>n.props.maxChoices)?r([{message:"",id:n.id}]):r([])},[s]),to.createElement(La,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(Da,{appearance:t.appearance,className:a(s.includes(d.id)?"multipleChoiceListItemSelected":"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 Si from"styled-components";import $a from"dompurify";function le(e){return{__html:$a.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var Ma=Si.h1`
|
|
379
|
-
${e=>
|
|
379
|
+
${e=>k(e)} {
|
|
380
380
|
font-style: normal;
|
|
381
381
|
font-weight: 700;
|
|
382
382
|
font-size: ${e=>e.size=="small"?"15px":"18px"};
|
|
@@ -388,7 +388,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
388
388
|
color: ${e=>e.appearance.theme.colorText};
|
|
389
389
|
}
|
|
390
390
|
`,Ua=Si.h2`
|
|
391
|
-
${e=>
|
|
391
|
+
${e=>k(e)} {
|
|
392
392
|
font-style: normal;
|
|
393
393
|
font-weight: 400;
|
|
394
394
|
font-size: 14px;
|
|
@@ -414,7 +414,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
414
414
|
`,Va=vo.div`
|
|
415
415
|
padding-left: 1px;
|
|
416
416
|
padding-right: 1px;
|
|
417
|
-
`,Ga={text:pr,multipleChoice:gi,multipleChoiceList:yi},fr="frigade-multiInputStepTypeData";function wi({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:r,appearance:n,customFormElements:s,prefillData:p}){var
|
|
417
|
+
`,Ga={text:pr,multipleChoice:gi,multipleChoiceList:yi},fr="frigade-multiInputStepTypeData";function wi({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:r,appearance:n,customFormElements:s,prefillData:p}){var S;let c=t.props,[l,g]=ur([]),[d,x]=ur([]),{userId:F}=Jt(),[C,y]=ur(b()||(p?p[t.id]:null)||{}),{readonly:f}=za(K),v={...Ga,...s};Wa(()=>{i(l.length===0)},[l,i]);function w(m,B){let T={...C,[m.id]:B};y(T),r(T),window&&window.localStorage&&!f&&window.localStorage.setItem(A(),JSON.stringify(T))}function b(){if(window&&window.localStorage){let m=window.localStorage.getItem(A());if(m)return JSON.parse(m)}return null}function A(){return`${fr}-${e}-${t.id}-${F}`}return Ct.createElement(Va,{className:a("multiInput",n)},Ct.createElement(Fe,{appearance:n,title:t.title,subtitle:t.subtitle}),Ct.createElement(_a,{className:a("multiInputContainer",n)},(S=c.data)==null?void 0:S.map(m=>{let B=l.reverse().find(T=>T.id===m.id);return v[m.type]?Ct.createElement("span",{key:m.id,"data-field-id":m.id,className:a("multiInputField",n)},v[m.type]({formInput:m,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:r,appearance:n},onSaveInputData:T=>{!d.includes(m.id)&&T&&(T==null?void 0:T.text)!==""&&x(E=>[...E,m.id]),w(m,T)},inputData:C[m.id],setFormValidationErrors:T=>{g(E=>T.length===0?E.filter(L=>L.id!==m.id):[...E,...T])}}),B&&B.message&&d.includes(m.id)&&B.hidden!==!0&&Ct.createElement(Ha,{key:m.id,style:{overflow:"hidden"},appearance:n,className:a("multiInputValidationError",n)},Ct.createElement(ja,{appearance:n,className:a("multiInputValidationErrorIcon",n)},Ct.createElement(bi,null)),B.message)):null})))}import yt from"styled-components";var Ti=yt.div`
|
|
418
418
|
align-items: center;
|
|
419
419
|
display: flex;
|
|
420
420
|
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
@@ -458,7 +458,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
458
458
|
`;import lt from"react";import Ka from"react";import Ai from"styled-components";var qa=Ai.button`
|
|
459
459
|
justify-content: center;
|
|
460
460
|
align-content: center;
|
|
461
|
-
${e=>
|
|
461
|
+
${e=>k(e)} {
|
|
462
462
|
display: flex;
|
|
463
463
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
464
464
|
width: ${e=>e.type==="full-width"?"100%":"auto"};
|
|
@@ -487,7 +487,7 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
487
487
|
cursor: not-allowed;
|
|
488
488
|
}
|
|
489
489
|
`,Bo=Ai.div`
|
|
490
|
-
${e=>
|
|
490
|
+
${e=>k(e)} {
|
|
491
491
|
display: flex;
|
|
492
492
|
flex-direction: row;
|
|
493
493
|
justify-content: flex-start;
|
|
@@ -584,24 +584,24 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}from"react";import
|
|
|
584
584
|
min-height: 260px;
|
|
585
585
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
586
586
|
`;function Ve({appearance:e,videoUri:t}){let o=rp(),[i,r]=ip(!1);if(t.includes("youtube")){let n=t.split("v=")[1],s=n.indexOf("&");return s!==-1&&(n=n.substring(0,s)),oo.createElement(ap,{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(np,{className:a("videoPlayerWrapper",e),appearance:e},!i&&oo.createElement(sp,{onClick:()=>{r(!0),o.current.play()},appearance:e},oo.createElement(Eo,null)),oo.createElement(lp,{appearance:e,controls:i,ref:o,play:i,src:t}))}var dp=Io.div`
|
|
587
|
-
${e=>
|
|
587
|
+
${e=>k(e)} {
|
|
588
588
|
display: flex;
|
|
589
589
|
flex-direction: column;
|
|
590
590
|
justify-content: center;
|
|
591
591
|
}
|
|
592
592
|
`,cp=Io.img`
|
|
593
|
-
${e=>
|
|
593
|
+
${e=>k(e)} {
|
|
594
594
|
width: 100%;
|
|
595
595
|
height: auto;
|
|
596
596
|
max-height: 250px;
|
|
597
597
|
margin-bottom: 24px;
|
|
598
598
|
}
|
|
599
599
|
`,mp=Io.div`
|
|
600
|
-
${e=>
|
|
600
|
+
${e=>k(e)} {
|
|
601
601
|
margin-bottom: 24px;
|
|
602
602
|
}
|
|
603
603
|
`,up=Io.div`
|
|
604
|
-
${e=>
|
|
604
|
+
${e=>k(e)} {
|
|
605
605
|
width: 100%;
|
|
606
606
|
height: auto;
|
|
607
607
|
max-height: 250px;
|
|
@@ -660,8 +660,8 @@ import wt,{createContext as Gp,useEffect as $o,useState as Oe}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 ji=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let r=e.props,[n,s]=Cr([]),[p,c]=Cr(!1),[l,g]=Cr(e.id);return hr(()=>{n.length==0&&!p&&(c(!0),o({choice:[]}))},[p]),hr(()=>{l!==e.id&&(g(e.id),s([]))},[e]),hr(()=>{o({choice:n}),n.length>=r.minChoices?t(!0):t(!1)},[n]),Ze.createElement(Di,{className:a("selectListContainer",i)},Ze.createElement($i,null,Ze.createElement(Mi,{className:a("selectListTitle",i)},e.title),Ze.createElement(Ui,{appearance:i,className:a("selectListSubtitle",i)},e.subtitle)),r.options.map((d,x)=>{let
|
|
664
|
-
${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map(([s,p])=>`${Zo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return io.createElement(o,{inlineStyles:t})}var Vi=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:r,customVariables:n,customFormElements:s,onComplete:p,appearance:c,hideOnFlowCompletion:l=!0,onStepCompletion:g,onButtonClick:d,dismissible:x=!0,endFlowOnDismiss:T=!1,modalPosition:C="center",repeatable:S=!1,onDismiss:f,showPagination:B=!1,allowBackNavigation:w=!1,validationHandler:b,showFrigadeBranding:A=!1,onFormDataChange:y,showFooter:m=!0,prefillData:E={}})=>{let{getFlow:k,getFlowSteps:P,isLoading:O,targetingLogicShouldHideFlow:I,getFlowStatus:N,getCurrentStepIndex:$,markFlowCompleted:D,markFlowNotStarted:ee}=Y(),U=$(e),{mergeAppearanceWithDefault:te}=Q(),[fe,X]=hp(!1),{setOpenFlowState:H,getOpenFlowState:j,hasOpenModals:Ce}=we();c=te(c);let[Ie,be]=i!==void 0&&r!==void 0?[i,r]:[j(e,!0),re=>H(e,re)];if(xp(()=>{!fe&&!O&&(X(!0),N(e)===q&&S&&(ee(e),window&&window.localStorage&&Object.keys(window.localStorage).forEach(L=>{L.startsWith(fr)&&window.localStorage.removeItem(L)})),X(!0))},[fe,X,O]),O)return null;let me=k(e);if(!me||I(me))return null;let J=P(e);if(!J||i!==void 0&&i===!1||N(e)===q&&l||(o=="modal"||o=="corner-modal")&&Ce(e))return null;let ge=()=>{be(!1),f&&f(),T===!0&&D(e)};if(C=="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(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:B,customFormElements:s,allowBackNavigation:w,validationHandler:b,onFormDataChange:y,showFooter:m,prefillData:E}))}return o==="modal"&&C!=="center"?Ge.createElement(wo,{appearance:c,onClose:ge,visible:Ie,modalPosition:C},Ge.createElement(oe,{appearance:c}),Ge.createElement(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:B,customFormElements:s,allowBackNavigation:w,validationHandler:b,onFormDataChange:y,showFooter:m,prefillData:E})):Ge.createElement(Ge.Fragment,null,Ge.createElement(oe,{appearance:c}),Ge.createElement(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:B,customFormElements:s,allowBackNavigation:w,validationHandler:b,onFormDataChange:y,showFooter:m,prefillData:E}))},Gi=Vi;import{useCallback as yr,useContext as Cp,useEffect as yp}from"react";function Sr(){let{organizationId:e,userId:t,setOrganizationId:o}=Cp(K),{mutateUserFlowState:i}=Be(),{config:r,apiUrl:n}=_e(),s=Nt(),{verifySDKInitiated:p}=Ot();function c(x,T){return`frigade-user-group-registered-${x}-${T}`}yp(()=>{if(t&&e){if(t.startsWith(Lt))return;let x=c(t,e);localStorage.getItem(x)||(s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(x,"true"))}},[t,e]);let l=yr(async x=>{if(!p())return;if(!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationIdInternal:e,userId:t});return}let T={foreignUserId:t,foreignUserGroupId:e,properties:x};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(T)}),i()},[e,t,r,i]),g=yr(async(x,T)=>{if(!p())return;if(!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationIdInternal:e,userId:t});return}let S={foreignUserId:t,foreignUserGroupId:e,events:[{event:x,properties:T}]};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(S)}),i()},[e,t,r,i]),d=yr(async(x,T)=>{if(p())if(T){let C=c(t,x);localStorage.setItem(C,"true"),o(x);let S={foreignUserId:t,foreignUserGroupId:x,properties:T};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(S)}),i()}else o(x)},[t,r,i]);return{organizationId:e,setOrganizationId:o,setOrganizationIdWithProperties:d,addPropertiesToOrganization:l,trackEventForOrganization:g}}var Ki="frigade-xFrigade_guestUserId",no="frigade-xFrigade_userId",qi=({})=>{let{setFlowResponses:e}=Xt(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=Be(),{userId:r,setUserId:n}=Jt(),[s,p]=br(null),{getFlowStatus:c}=Y(),{flows:l,userProperties:g,setIsNewGuestUser:d,flowResponses:x}=Sp(K),[T,C]=br([]),[S,f]=br([]),{organizationId:B}=Sr();Lo(()=>{if(!o&&t)for(let y=0;y<t.length;y++){let m=t[y],E=l.find(k=>k.slug===(m==null?void 0:m.flowId));if(E&&m&&m.shouldTrigger===!0&&E.type=="FORM"&&E.triggerType==="AUTOMATIC"&&!S.includes(E.slug)){setTimeout(()=>{w(m.flowId)},500);break}}},[o,t]),Lo(()=>{x.length>0&&i()},[x]);function w(y){let m=l.find(E=>E.slug===y);m&&m.triggerType==="AUTOMATIC"&&!S.includes(m.slug)&&(f([...S,m.slug]),C([m]))}function b(){if(!r){let y=localStorage.getItem(no);if(y){n(y);return}let m=localStorage.getItem(Ki);if(m){n(m);return}d(!0);let E=Lt+bp();try{localStorage.setItem(Ki,E)}catch(k){console.log("Failed to save guest user id locally: Local storage unavailable",k)}n(k=>k||E)}}Lo(()=>{try{if(l){let y=[];l.forEach(m=>{if(m.data){let E=m.data.match(/"imageUri":"(.*?)"/g);E&&E.forEach(k=>{let P=k.replace('"imageUri":"',"").replace('"',"");if(y.includes(P))return;let O=new Image;O.src=P,y.push(P)})}})}}catch{}},[l]),Lo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(Lt))try{localStorage.setItem(no,r)}catch(y){console.log("Failed to save user id locally: Local storage available",y)}r===null&&setTimeout(()=>{r===null&&b()},50)},[r,l,g]);function A(){return bt.createElement(bt.Fragment,null,T.map(y=>c(y.slug)!==Me?null:bt.createElement("span",{key:y.slug},bt.createElement(Gi,{flowId:y.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return bt.createElement(bt.Fragment,null,bt.createElement(A,null))};import{ErrorBoundary as qp}from"react-error-boundary";import so from"core-js-pure/actual/structured-clone";function wr(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(!wr(t)||!wr(o))throw new Error("deepmerge can only merge Objects");let i=so(t);return Object.entries(o).forEach(([r,n])=>{wr(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 Yi={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 wp(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(Yi[o]){let r=Yi[o].split("."),n=t;r.forEach((s,p)=>{n[s]||(n[s]=p===r.length-1?i:{}),n=n[s]})}}),t}function Tp(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 Xi(e){let{theme:t,styleOverrides:o}=e,i=wp(t),r=Tp(o);return{overrides:i,css:r}}import Mp from"styled-components";import{compose as Up,variant as Qi}from"styled-system";import Ji from"react";import Fp,{ThemeProvider as kp,useTheme as Pp}from"styled-components";import{border as vp,color as Bp,compose as Ep,get as Ap,shadow as Ip,space as Np,system as Op,typography as Lp}from"styled-system";var Dp={width:{property:"width",scale:"sizes",transform:(e,t)=>Ap(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},$p=Fp("div")(({css:e})=>e,Ep(vp,Bp,Ip,Np,Lp,Op(Dp))),lo=({as:e,children:t,overrides:o,...i})=>{let r=Pp(),n={border:"none",boxSizing:"border-box",m:0,p:0},s=()=>Ji.createElement($p,{as:e,...n,...i},t);if(o!==void 0){let p=pt(r,o);return Ji.createElement(kp,{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"}},zp={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},Zi=Mp(lo)(()=>({whiteSpace:"nowrap"}),Up(Qi({scale:"components.Button",variants:"components.Button"}),Qi({prop:"size",variants:zp})));import Wp from"styled-components";import{variant as _p,system as Hp}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 Ri=Wp(lo)(_p({scale:"components.Text",variants:"components.Text"}),Hp({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var en=4,tn="px",jp=20,Vp=Object.fromEntries(Array.from(Array(jp+1),(e,t)=>t===0?[.5,`${.5*en}${tn}`]:[t,`${t*en}${tn}`])),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"},Tr={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:Vp,components:{Button:ao,Text:Do}};var on="https://api.frigade.com",K=Gp({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:on,readonly:!1});function Yp(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var Xp=({publicApiKey:e,userId:t,organizationId:o,config:i,children:r})=>{var fe,X;let[n,s]=Oe(t||null),[p,c]=Oe(o||null),[l,g]=Oe([]),[d,x]=Oe([]),[T,C]=Oe([]),[S,f]=Oe({}),[B,w]=Oe({}),[b,A]=Oe([]),[y,m]=Oe({}),[E,k]=Oe(!1),[P,O]=Oe(!1),[I,N]=Oe(!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&&Yp()},[n]),$o(()=>{o&&c(o)},[o]),$o(()=>{if(ee(e))N(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),N(!0);return}},[e,N]);let U={publicApiKey:e,userId:n,setUserId:s,setFlows:g,flows:l,failedFlowResponses:d,setFailedFlowResponses:x,flowResponses:T,setFlowResponses:C,userProperties:S,setUserProperties:f,openFlowStates:B,setOpenFlowStates:w,completedFlowsToKeepOpenDuringSession:b,setCompletedFlowsToKeepOpenDuringSession:A,customVariables:y,setCustomVariables:m,isNewGuestUser:E,setIsNewGuestUser:k,hasActiveFullPageFlow:P,setHasActiveFullPageFlow:O,organizationId:p,setOrganizationId:c,navigate:i&&i.navigate?i.navigate:$,defaultAppearance:D,shouldGracefullyDegrade:I,setShouldGracefullyDegrade:N,apiUrl:i&&i.apiUrl?i.apiUrl:on,readonly:i&&i.readonly?i.readonly:!1};if(I)return wt.createElement(K.Provider,{value:U},r);let{overrides:te}=Xi(D);return wt.createElement(qp,{fallback:wt.createElement(wt.Fragment,null,r)},wt.createElement(K.Provider,{value:U},wt.createElement(Kp,{theme:pt(D.theme,Tr,te??{},(i==null?void 0:i.theme)??{})},r,wt.createElement(qi,null))))};import Ud from"react";import ce,{useEffect as Ns,useState as Os}from"react";import We,{useState as ud}from"react";import kt from"styled-components";import zo from"react";import Tt from"react";import nn from"styled-components";var rn=nn.span`
|
|
663
|
+
`;var ji=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let r=e.props,[n,s]=Cr([]),[p,c]=Cr(!1),[l,g]=Cr(e.id);return hr(()=>{n.length==0&&!p&&(c(!0),o({choice:[]}))},[p]),hr(()=>{l!==e.id&&(g(e.id),s([]))},[e]),hr(()=>{o({choice:n}),n.length>=r.minChoices?t(!0):t(!1)},[n]),Ze.createElement(Di,{className:a("selectListContainer",i)},Ze.createElement($i,null,Ze.createElement(Mi,{className:a("selectListTitle",i)},e.title),Ze.createElement(Ui,{appearance:i,className:a("selectListSubtitle",i)},e.subtitle)),r.options.map((d,x)=>{let F=n.includes(d.id);return Ze.createElement(zi,{key:`select-item-${x}`,onClick:()=>{if(n.includes(d.id)){s(n.filter(C=>C!==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:a("selectListSelectItem",i)},Ze.createElement(Wi,{className:a("selectListItemImage",i)},d.imageUri&&Ze.createElement(_i,{src:d.imageUri,alt:`select-icon-${x}`}),Ze.createElement(Hi,{appearance:i,className:a("selectListSelectItemText",i)},d.title)),Ze.createElement(Qe,{appearance:i,value:F,primaryColor:i.theme.colorPrimary}))}))};import Pe,{useEffect as No,useState as ro}from"react";var fp=({children:e,id:t,shouldWrap:o=!1})=>Pe.createElement(Pe.Fragment,null,o?Pe.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:l,onComplete:g,setVisible:d,setShowModal:x,onDismiss:F,showPagination:C=!1,customFormElements:y,allowBackNavigation:f,validationHandler:v,onFormDataChange:w,showFooter:b,prefillData:A})=>{var V;let m={...{linkCollection:Oi,multiInput:wi,callToAction:Li,selectList:ji},...i},{primaryCTAClickSideEffects:B,secondaryCTAClickSideEffects:T}=ie(),[E,L]=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:Ie,markFlowCompleted:be}=Y();No(()=>{Ie(r)},[r,Ce]),No(()=>{w&&w(N,me(),t[o],o)},[N]),No(()=>{window&&f&&!ee&&(window.location.hash=t[o].id,U(!0))},[f,ee,U]),No(()=>{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?Pe.createElement(Ei,{image:G.selectedStep.imageUri,appearance:e,className:a("formContainerSidebarImage",e)}):null}let O=b&&Pe.createElement(Ii,{step:t[o],canContinue:E&&!$,formType:c,selectedStep:o,appearance:e,onPrimaryClick:async()=>{if(D(!0),v){let se=await v(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(),F&&F(),l&&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),T(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 Pe.createElement(Pe.Fragment,null,Pe.createElement(Pi,{className:a("formContainer",e)},Pe.createElement(vi,null,Pe.createElement(fp,{id:o,shouldWrap:c==="large-modal"},Pe.createElement(Bi,{key:X.id,type:c,className:a("formContent",e)},t.map(G=>{let ne=m[G.type];return X.id!==G.id?null:Pe.createElement(ne,{key:G.id,stepData:G,canContinue:E,setCanContinue:L,onSaveData:se=>{ge(G,se)},appearance:e,customFormElements:y,flowId:p,prefillData:A})}),C&&Pe.createElement(Ni,{className:a("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),O))),c=="large-modal"&&Pe.createElement(re,{selectedStep:t[o]})))};import io from"react";import{createGlobalStyle as gp}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=gp`
|
|
664
|
+
${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map(([s,p])=>`${Zo(s)}: ${p};`).join(" ")} }`).join(" ")}`;return io.createElement(o,{inlineStyles:t})}var Vi=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:r,customVariables:n,customFormElements:s,onComplete:p,appearance:c,hideOnFlowCompletion:l=!0,onStepCompletion:g,onButtonClick:d,dismissible:x=!0,endFlowOnDismiss:F=!1,modalPosition:C="center",repeatable:y=!1,onDismiss:f,showPagination:v=!1,allowBackNavigation:w=!1,validationHandler:b,showFrigadeBranding:A=!1,onFormDataChange:S,showFooter:m=!0,prefillData:B={}})=>{let{getFlow:T,getFlowSteps:E,isLoading:L,targetingLogicShouldHideFlow:N,getFlowStatus:I,getCurrentStepIndex:$,markFlowCompleted:D,markFlowNotStarted:ee}=Y(),U=$(e),{mergeAppearanceWithDefault:te}=Q(),[fe,X]=hp(!1),{setOpenFlowState:H,getOpenFlowState:j,hasOpenModals:Ce}=we();c=te(c);let[Ie,be]=i!==void 0&&r!==void 0?[i,r]:[j(e,!0),re=>H(e,re)];if(xp(()=>{!fe&&!L&&(X(!0),I(e)===q&&y&&(ee(e),window&&window.localStorage&&Object.keys(window.localStorage).forEach(O=>{O.startsWith(fr)&&window.localStorage.removeItem(O)})),X(!0))},[fe,X,L]),L)return null;let me=T(e);if(!me||N(me))return null;let J=E(e);if(!J||i!==void 0&&i===!1||I(e)===q&&l||(o=="modal"||o=="corner-modal")&&Ce(e))return null;let ge=()=>{be(!1),f&&f(),F===!0&&D(e)};if(C=="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(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:v,customFormElements:s,allowBackNavigation:w,validationHandler:b,onFormDataChange:S,showFooter:m,prefillData:B}))}return o==="modal"&&C!=="center"?Ge.createElement(wo,{appearance:c,onClose:ge,visible:Ie,modalPosition:C},Ge.createElement(oe,{appearance:c}),Ge.createElement(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:v,customFormElements:s,allowBackNavigation:w,validationHandler:b,onFormDataChange:S,showFooter:m,prefillData:B})):Ge.createElement(Ge.Fragment,null,Ge.createElement(oe,{appearance:c}),Ge.createElement(Oo,{appearance:c,steps:J,selectedStep:U,customStepTypes:t,customVariables:n,onButtonClick:d,onStepCompletion:g,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:r,setShowModal:be,onDismiss:f,showPagination:v,customFormElements:s,allowBackNavigation:w,validationHandler:b,onFormDataChange:S,showFooter:m,prefillData:B}))},Gi=Vi;import{useCallback as yr,useContext as Cp,useEffect as yp}from"react";function Sr(){let{organizationId:e,userId:t,setOrganizationId:o}=Cp(K),{mutateUserFlowState:i}=Be(),{config:r,apiUrl:n}=_e(),s=Nt(),{verifySDKInitiated:p}=Ot();function c(x,F){return`frigade-user-group-registered-${x}-${F}`}yp(()=>{if(t&&e){if(t.startsWith(Lt))return;let x=c(t,e);localStorage.getItem(x)||(s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})}),localStorage.setItem(x,"true"))}},[t,e]);let l=yr(async x=>{if(!p())return;if(!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationIdInternal:e,userId:t});return}let F={foreignUserId:t,foreignUserGroupId:e,properties:x};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(F)}),i()},[e,t,r,i]),g=yr(async(x,F)=>{if(!p())return;if(!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationIdInternal:e,userId:t});return}let y={foreignUserId:t,foreignUserGroupId:e,events:[{event:x,properties:F}]};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(y)}),i()},[e,t,r,i]),d=yr(async(x,F)=>{if(p())if(F){let C=c(t,x);localStorage.setItem(C,"true"),o(x);let y={foreignUserId:t,foreignUserGroupId:x,properties:F};await s(`${n}userGroups`,{...r,method:"POST",body:JSON.stringify(y)}),i()}else o(x)},[t,r,i]);return{organizationId:e,setOrganizationId:o,setOrganizationIdWithProperties:d,addPropertiesToOrganization:l,trackEventForOrganization:g}}var Ki="frigade-xFrigade_guestUserId",no="frigade-xFrigade_userId",qi=({})=>{let{setFlowResponses:e}=Xt(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=Be(),{userId:r,setUserId:n}=Jt(),[s,p]=br(null),{getFlowStatus:c}=Y(),{flows:l,userProperties:g,setIsNewGuestUser:d,flowResponses:x}=Sp(K),[F,C]=br([]),[y,f]=br([]),{organizationId:v}=Sr();Lo(()=>{if(!o&&t)for(let S=0;S<t.length;S++){let m=t[S],B=l.find(T=>T.slug===(m==null?void 0:m.flowId));if(B&&m&&m.shouldTrigger===!0&&B.type=="FORM"&&B.triggerType==="AUTOMATIC"&&!y.includes(B.slug)){setTimeout(()=>{w(m.flowId)},500);break}}},[o,t]),Lo(()=>{x.length>0&&i()},[x]);function w(S){let m=l.find(B=>B.slug===S);m&&m.triggerType==="AUTOMATIC"&&!y.includes(m.slug)&&(f([...y,m.slug]),C([m]))}function b(){if(!r){let S=localStorage.getItem(no);if(S){n(S);return}let m=localStorage.getItem(Ki);if(m){n(m);return}d(!0);let B=Lt+bp();try{localStorage.setItem(Ki,B)}catch(T){console.log("Failed to save guest user id locally: Local storage unavailable",T)}n(T=>T||B)}}Lo(()=>{try{if(l){let S=[];l.forEach(m=>{if(m.data){let B=m.data.match(/"imageUri":"(.*?)"/g);B&&B.forEach(T=>{let E=T.replace('"imageUri":"',"").replace('"',"");if(S.includes(E))return;let L=new Image;L.src=E,S.push(E)})}})}}catch{}},[l]),Lo(()=>{if(r!==s&&e([]),p(r),r&&!r.startsWith(Lt))try{localStorage.setItem(no,r)}catch(S){console.log("Failed to save user id locally: Local storage available",S)}r===null&&setTimeout(()=>{r===null&&b()},50)},[r,l,g]);function A(){return bt.createElement(bt.Fragment,null,F.map(S=>c(S.slug)!==Me?null:bt.createElement("span",{key:S.slug},bt.createElement(Gi,{flowId:S.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return bt.createElement(bt.Fragment,null,bt.createElement(A,null))};import{ErrorBoundary as qp}from"react-error-boundary";import so from"core-js-pure/actual/structured-clone";function wr(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(!wr(t)||!wr(o))throw new Error("deepmerge can only merge Objects");let i=so(t);return Object.entries(o).forEach(([r,n])=>{wr(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 Yi={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 wp(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(Yi[o]){let r=Yi[o].split("."),n=t;r.forEach((s,p)=>{n[s]||(n[s]=p===r.length-1?i:{}),n=n[s]})}}),t}function Tp(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 Xi(e){let{theme:t,styleOverrides:o}=e,i=wp(t),r=Tp(o);return{overrides:i,css:r}}import Mp from"styled-components";import{compose as Up,variant as Qi}from"styled-system";import Ji from"react";import Fp,{ThemeProvider as kp,useTheme as Pp}from"styled-components";import{border as vp,color as Bp,compose as Ep,get as Ap,shadow as Ip,space as Np,system as Op,typography as Lp}from"styled-system";var Dp={width:{property:"width",scale:"sizes",transform:(e,t)=>Ap(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},$p=Fp("div")(({css:e})=>e,Ep(vp,Bp,Ip,Np,Lp,Op(Dp))),lo=({as:e,children:t,overrides:o,...i})=>{let r=Pp(),n={border:"none",boxSizing:"border-box",m:0,p:0},s=()=>Ji.createElement($p,{as:e,...n,...i},t);if(o!==void 0){let p=pt(r,o);return Ji.createElement(kp,{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"}},zp={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},Zi=Mp(lo)(()=>({whiteSpace:"nowrap"}),Up(Qi({scale:"components.Button",variants:"components.Button"}),Qi({prop:"size",variants:zp})));import Wp from"styled-components";import{variant as _p,system as Hp}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 Ri=Wp(lo)(_p({scale:"components.Text",variants:"components.Text"}),Hp({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var en=4,tn="px",jp=20,Vp=Object.fromEntries(Array.from(Array(jp+1),(e,t)=>t===0?[.5,`${.5*en}${tn}`]:[t,`${t*en}${tn}`])),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"},Tr={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:Vp,components:{Button:ao,Text:Do}};var on="https://api.frigade.com",K=Gp({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:on,readonly:!1});function Yp(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var Xp=({publicApiKey:e,userId:t,organizationId:o,config:i,children:r})=>{var fe,X;let[n,s]=Oe(t||null),[p,c]=Oe(o||null),[l,g]=Oe([]),[d,x]=Oe([]),[F,C]=Oe([]),[y,f]=Oe({}),[v,w]=Oe({}),[b,A]=Oe([]),[S,m]=Oe({}),[B,T]=Oe(!1),[E,L]=Oe(!1),[N,I]=Oe(!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&&Yp()},[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:l,failedFlowResponses:d,setFailedFlowResponses:x,flowResponses:F,setFlowResponses:C,userProperties:y,setUserProperties:f,openFlowStates:v,setOpenFlowStates:w,completedFlowsToKeepOpenDuringSession:b,setCompletedFlowsToKeepOpenDuringSession:A,customVariables:S,setCustomVariables:m,isNewGuestUser:B,setIsNewGuestUser:T,hasActiveFullPageFlow:E,setHasActiveFullPageFlow:L,organizationId:p,setOrganizationId:c,navigate:i&&i.navigate?i.navigate:$,defaultAppearance:D,shouldGracefullyDegrade:N,setShouldGracefullyDegrade:I,apiUrl:i&&i.apiUrl?i.apiUrl:on,readonly:i&&i.readonly?i.readonly:!1};if(N)return wt.createElement(K.Provider,{value:U},r);let{overrides:te}=Xi(D);return wt.createElement(qp,{fallback:wt.createElement(wt.Fragment,null,r)},wt.createElement(K.Provider,{value:U},wt.createElement(Kp,{theme:pt(D.theme,Tr,te??{},(i==null?void 0:i.theme)??{})},r,wt.createElement(qi,null))))};import Ud from"react";import ce,{useEffect as Ns,useState as Os}from"react";import We,{useState as ud}from"react";import kt from"styled-components";import zo from"react";import Tt from"react";import nn from"styled-components";var rn=nn.span`
|
|
665
665
|
font-weight: 600;
|
|
666
666
|
font-size: 14px;
|
|
667
667
|
font-style: normal;
|
|
@@ -889,7 +889,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
889
889
|
`,yd=kt.div`
|
|
890
890
|
flex: 2;
|
|
891
891
|
padding: 2rem 2rem 2rem 0rem;
|
|
892
|
-
`,Sd=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:r,setSelectedStep:n,className:s="",customStepTypes:p=new Map,appearance:c,type:l})=>{let{mergeAppearanceWithDefault:g}=Q();c=g(c);let x={...{[Pr]:fn,[xn]:hn,[yn]:Sn},...p},[
|
|
892
|
+
`,Sd=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:r,setSelectedStep:n,className:s="",customStepTypes:p=new Map,appearance:c,type:l})=>{let{mergeAppearanceWithDefault:g}=Q();c=g(c);let x={...{[Pr]:fn,[xn]:hn,[yn]:Sn},...p},[F,C]=ud(0),y=r??F,f=n??C,v=o.filter(b=>b.complete===!0).length,w=()=>{var b;return!((b=o[y])!=null&&b.type)||!x[o[y].type]?x[Pr]({stepData:o[y],appearance:c}):x[o[y].type]({stepData:o[y],appearance:c})};return We.createElement(fd,{type:l,styleOverrides:i,className:s,appearance:c},We.createElement(bn,{style:{flex:1}},We.createElement(bn,{style:{padding:"28px 0px 28px 28px",borderBottom:"1px solid #E5E5E5"}},We.createElement(gd,{className:a("checklistTitle",c),appearance:c},e),We.createElement(xd,{className:a("checklistSubtitle",c),appearance:c},t),We.createElement(Le,{total:o.length,count:v,style:{marginTop:"24px",paddingRight:"40px"},appearance:c})),We.createElement(hd,{className:a("checklistStepsContainer",c)},o.map((b,A)=>We.createElement(dn,{data:b,index:A,key:A,listLength:o.length,isSelected:A===y,primaryColor:c.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{f(A)},appearance:c})))),We.createElement(Cd,{appearance:c,className:a("checklistDivider",c)}),We.createElement(yd,null,We.createElement(w,null)))},vr=Sd;import z,{useState as kd}from"react";import wn from"react";import bd from"styled-components";var wd=bd.svg`
|
|
893
893
|
transition: 'transform 0.35s ease-in-out';
|
|
894
894
|
`,Vt=({style:e,className:t})=>wn.createElement(wd,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e,className:t},wn.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"},Tn=ue.div`
|
|
895
895
|
max-height: 350px;
|
|
@@ -913,7 +913,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
913
913
|
padding-left: 1px;
|
|
914
914
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
915
915
|
`,vn=ue.div`
|
|
916
|
-
${e=>
|
|
916
|
+
${e=>k(e)} {
|
|
917
917
|
border: 1px solid #fafafa;
|
|
918
918
|
}
|
|
919
919
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
@@ -927,7 +927,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
927
927
|
flex-direction: row;
|
|
928
928
|
justify-content: space-between;
|
|
929
929
|
`,En=ue.p`
|
|
930
|
-
${e=>
|
|
930
|
+
${e=>k(e)} {
|
|
931
931
|
font-weight: 400;
|
|
932
932
|
font-size: 10px;
|
|
933
933
|
line-height: 12px;
|
|
@@ -941,7 +941,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
941
941
|
`,In=ue.div`
|
|
942
942
|
flex: 1;
|
|
943
943
|
`,Nn=ue.div`
|
|
944
|
-
${e=>
|
|
944
|
+
${e=>k(e)} {
|
|
945
945
|
display: flex;
|
|
946
946
|
justify-content: center;
|
|
947
947
|
align-content: center;
|
|
@@ -951,7 +951,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
951
951
|
padding-right: 8px;
|
|
952
952
|
}
|
|
953
953
|
`,On=ue.p`
|
|
954
|
-
${e=>
|
|
954
|
+
${e=>k(e)} {
|
|
955
955
|
font-style: normal;
|
|
956
956
|
font-weight: 600;
|
|
957
957
|
font-size: 22px;
|
|
@@ -963,7 +963,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
963
963
|
margin-bottom: 16px;
|
|
964
964
|
}
|
|
965
965
|
`,Ln=ue.p`
|
|
966
|
-
${e=>
|
|
966
|
+
${e=>k(e)} {
|
|
967
967
|
font-weight: 400;
|
|
968
968
|
font-size: 14px;
|
|
969
969
|
line-height: 18px;
|
|
@@ -972,14 +972,14 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
972
972
|
margin-bottom: 8px;
|
|
973
973
|
}
|
|
974
974
|
`,Dn=ue.div`
|
|
975
|
-
${e=>
|
|
975
|
+
${e=>k(e)} {
|
|
976
976
|
display: flex;
|
|
977
977
|
flex-direction: row;
|
|
978
978
|
justify-content: center;
|
|
979
979
|
gap: 8px;
|
|
980
980
|
}
|
|
981
981
|
`,$n=ue.div`
|
|
982
|
-
${e=>
|
|
982
|
+
${e=>k(e)} {
|
|
983
983
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
984
984
|
background-color: ${e=>e.selected?"#FAFAFA":"#FFFFFF"};
|
|
985
985
|
:hover {
|
|
@@ -999,7 +999,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
999
999
|
position: relative;
|
|
1000
1000
|
cursor: pointer;
|
|
1001
1001
|
`,Mn=ue.p`
|
|
1002
|
-
${e=>
|
|
1002
|
+
${e=>k(e)} {
|
|
1003
1003
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1004
1004
|
color: ${e=>e.selected?"#434343":"#BFBFBF"};
|
|
1005
1005
|
}
|
|
@@ -1042,7 +1042,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1042
1042
|
overflow: hidden;
|
|
1043
1043
|
row-gap: 10px;
|
|
1044
1044
|
`,Vn=tt.div`
|
|
1045
|
-
${e=>
|
|
1045
|
+
${e=>k(e)} {
|
|
1046
1046
|
color: #595959;
|
|
1047
1047
|
}
|
|
1048
1048
|
text-transform: uppercase;
|
|
@@ -1052,7 +1052,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1052
1052
|
letter-spacing: 0.09em;
|
|
1053
1053
|
margin-bottom: 12px;
|
|
1054
1054
|
`,Gn=tt.div`
|
|
1055
|
-
${e=>
|
|
1055
|
+
${e=>k(e)} {
|
|
1056
1056
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1057
1057
|
background: #ffffff;
|
|
1058
1058
|
border: 1px solid #fafafa;
|
|
@@ -1065,7 +1065,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1065
1065
|
max-width: 150px;
|
|
1066
1066
|
min-width: 200px;
|
|
1067
1067
|
`,Kn=tt.div`
|
|
1068
|
-
${e=>
|
|
1068
|
+
${e=>k(e)} {
|
|
1069
1069
|
background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);
|
|
1070
1070
|
}
|
|
1071
1071
|
width: 40px;
|
|
@@ -1083,7 +1083,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1083
1083
|
width: 20px;
|
|
1084
1084
|
height: 20px;
|
|
1085
1085
|
`,Yn=tt.div`
|
|
1086
|
-
${e=>
|
|
1086
|
+
${e=>k(e)} {
|
|
1087
1087
|
color: #434343;
|
|
1088
1088
|
}
|
|
1089
1089
|
font-weight: 600;
|
|
@@ -1092,7 +1092,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1092
1092
|
margin-top: 12px;
|
|
1093
1093
|
margin-bottom: 8px;
|
|
1094
1094
|
`,Xn=tt.div`
|
|
1095
|
-
${e=>
|
|
1095
|
+
${e=>k(e)} {
|
|
1096
1096
|
color: #8c8c8c;
|
|
1097
1097
|
}
|
|
1098
1098
|
font-weight: 400;
|
|
@@ -1104,7 +1104,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1104
1104
|
line-height: 14px;
|
|
1105
1105
|
font-weight: 400;
|
|
1106
1106
|
cursor: pointer;
|
|
1107
|
-
`;var Fd=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=ie();return ot.createElement(Hn,{style:t,className:a("guideContainer",r)},ot.createElement(Vn,{className:a("guideTitle",r)},o),ot.createElement(jn,{className:a("guideItemContainer",r)},e.map((p,c)=>ot.createElement(Gn,{key:`guide-${p.id??c}`,className:a("guideItem",r)},p.icon&&ot.createElement(Kn,{className:a("guideIcon",r)},ot.createElement(qn,null,p.icon)),ot.createElement(Yn,{className:a("guideItemTitle",r),dangerouslySetInnerHTML:le(p.title)}),ot.createElement(Xn,{className:a("guideItemSubtitle",r),dangerouslySetInnerHTML:le(p.subtitle)}),ot.createElement(Jn,{className:a("guideItemLink",r),color:i,onClick:()=>{p.primaryButtonUri&&s(p),n&&n(p)}},p.primaryButtonTitle)))))},mo=Fd;var Pd=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:r,onClose:n,selectedStep:s,setSelectedStep:p,customStepTypes:c,appearance:l,guideData:g,guideTitle:d,onGuideButtonClick:x})=>{let
|
|
1107
|
+
`;var Fd=({steps:e,style:t,title:o,primaryColor:i,appearance:r,onButtonClick:n})=>{let{primaryCTAClickSideEffects:s}=ie();return ot.createElement(Hn,{style:t,className:a("guideContainer",r)},ot.createElement(Vn,{className:a("guideTitle",r)},o),ot.createElement(jn,{className:a("guideItemContainer",r)},e.map((p,c)=>ot.createElement(Gn,{key:`guide-${p.id??c}`,className:a("guideItem",r)},p.icon&&ot.createElement(Kn,{className:a("guideIcon",r)},ot.createElement(qn,null,p.icon)),ot.createElement(Yn,{className:a("guideItemTitle",r),dangerouslySetInnerHTML:le(p.title)}),ot.createElement(Xn,{className:a("guideItemSubtitle",r),dangerouslySetInnerHTML:le(p.subtitle)}),ot.createElement(Jn,{className:a("guideItemLink",r),color:i,onClick:()=>{p.primaryButtonUri&&s(p),n&&n(p)}},p.primaryButtonTitle)))))},mo=Fd;var Pd=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:r,onClose:n,selectedStep:s,setSelectedStep:p,customStepTypes:c,appearance:l,guideData:g,guideTitle:d,onGuideButtonClick:x})=>{let F=({stepData:m,handleSecondaryCTAClick:B,handleCTAClick:T})=>m?z.createElement(Nn,{className:a("checklistStepContainer",l),"data-testid":"checklistStepContainer"},z.createElement(On,{appearance:l,className:a("checklistStepTitle",l),dangerouslySetInnerHTML:le(m.title)}),z.createElement(Ln,{appearance:l,className:a("checklistStepSubtitle",l),dangerouslySetInnerHTML:le(m.subtitle)}),z.createElement(Dn,{className:a("checklistCTAContainer",l)},m.secondaryButtonTitle&&z.createElement(Z,{title:m.secondaryButtonTitle,onClick:B,appearance:l,secondary:!0}),z.createElement(Z,{title:m.primaryButtonTitle,onClick:T,appearance:l}))):z.createElement(z.Fragment,null),y={...{default:m=>{var L;if((L=e[w])!=null&&L.StepContent){let N=e[w].StepContent;return z.createElement("div",null,N)}let B=e[w];return z.createElement(F,{stepData:m,handleCTAClick:()=>{B.handlePrimaryButtonClick&&B.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{B.handleSecondaryButtonClick&&B.handleSecondaryButtonClick()}})}},...c},[f,v]=kd(0),w=s??f,b=p??v,A=()=>{var m;return e?!((m=e[w])!=null&&m.type)||!y[e[w].type]?y.default(e[w]):y[e[w].type]({stepData:e[w],primaryColor:l.theme.colorPrimary}):z.createElement(z.Fragment,null)},S=e.filter(m=>m.complete).length;return r?(l.theme.modalContainer||(l.theme.borderRadius&&(Br.borderRadius=l.theme.borderRadius+"px"),l.theme.modalContainer=Br),z.createElement(He,{onClose:n,visible:r,appearance:l},z.createElement(Wn,null,z.createElement(Fn,null,z.createElement(kn,{appearance:l,className:a("checklistTitle",l)},t),z.createElement(Pn,{appearance:l,className:a("checklistSubtitle",l)},o)),z.createElement(Tn,null,e&&e.length>0&&z.createElement(vn,{className:a("stepsContainer",l)},z.createElement(Bn,null,z.createElement("div",{style:{flex:3}},z.createElement(En,{className:a("stepsTitle",l)},i)),z.createElement(zn,null,z.createElement(Le,{style:{width:"100%"},count:S,total:e.length,appearance:l}))),z.createElement(An,null,z.createElement(In,{className:a("checklistStepListContainer",l),appearance:l},e.map((m,B)=>{let T=w===B;return z.createElement($n,{selected:T,className:a(`checklistStepListItem${T?"Selected":""}`,l),key:`checklist-guide-step-${m.id??B}`,disabled:m.blocked,onClick:()=>{m.blocked||b(B)},title:m.blocked?"Finish remaining steps to continue":void 0},T&&z.createElement(Uo,{className:a("checklistStepItemSelectedIndicator",l),layoutId:"checklist-step-selected",style:{backgroundColor:l.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),z.createElement(Mn,{selected:T,className:a(`checklistStepListStepName${T?"Selected":""}`,l)},m.stepName),z.createElement(Un,null,z.createElement(Qe,{value:m.complete,type:"round",primaryColor:l.theme.colorPrimary,progress:m.progress,appearance:l}),z.createElement(_n,null,z.createElement(Vt,{style:{marginLeft:"10px"},color:l.theme.colorBackgroundSecondary}))))})),z.createElement(A,null))),g&&g.length>0&&z.createElement(mo,{steps:g,title:d,primaryColor:l.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:l,onButtonClick:m=>(x&&x(m),!0)}))))):z.createElement(z.Fragment,null)},Er=Pd;import ve,{useEffect as cs,useState as vd}from"react";import he from"react";import rt from"styled-components";var Qn=rt.div`
|
|
1108
1108
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1109
1109
|
border: 1px solid;
|
|
1110
1110
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -1196,7 +1196,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1196
1196
|
padding: 24px;
|
|
1197
1197
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
1198
1198
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1199
|
-
`;var Bd=({title:e,subtitle:t,steps:o,onClose:i,visible:r,autoExpandFirstIncompleteStep:n=!0,autoCollapse:s=!0,autoExpandNextStep:p=!0,selectedStep:c,setSelectedStep:l,appearance:g,type:d,className:x,customStepTypes:
|
|
1199
|
+
`;var Bd=({title:e,subtitle:t,steps:o,onClose:i,visible:r,autoExpandFirstIncompleteStep:n=!0,autoCollapse:s=!0,autoExpandNextStep:p=!0,selectedStep:c,setSelectedStep:l,appearance:g,type:d,className:x,customStepTypes:F,style:C})=>{let y=o.filter(S=>S.complete).length,[f,v]=vd(Array(o.length).fill(!0));cs(()=>{let S=[...f];if(n){for(let m=0;m<o.length;m++)if(!o[m].complete){S[m]=!1;break}v(S)}},[]),cs(()=>{w(c)},[c]);let w=S=>{let m=[...f];if(s)for(let B=0;B<f.length;++B)B!==S&&(m[B]=!0);m[S]=!m[S],v(m)};if(!r&&d=="modal")return ve.createElement(ve.Fragment,null);let b=ve.createElement(ve.Fragment,null,ve.createElement(ss,null,ve.createElement(ls,{appearance:g,className:a("checklistTitle",g),dangerouslySetInnerHTML:le(e)}),ve.createElement(as,{appearance:g,className:a("checklistSubtitle",g),dangerouslySetInnerHTML:le(t)})),ve.createElement(Le,{display:"percent",count:y,total:o.length,style:{margin:"14px 0px 8px 0px"},appearance:g})),A=ve.createElement(ps,{className:xe(a("checklistContainer",g),x)},o.map((S,m)=>{let B=f[m];return ve.createElement(ns,{appearance:g,stepData:S,collapsed:B,key:`modal-checklist-${S.id??m}`,onClick:()=>{if(c===m){w(m);return}l(m)},onPrimaryButtonClick:()=>{S.handlePrimaryButtonClick&&S.handlePrimaryButtonClick(),p&&!S.completionCriteria&&m<f.length-1&&f[m+1]&&l(m+1)},onSecondaryButtonClick:()=>{S.handleSecondaryButtonClick&&S.handleSecondaryButtonClick()},customStepTypes:F})}));return d==="inline"?ve.createElement(ds,{appearance:g,className:xe(a("checklistInlineContainer",g),x),style:C},b,A):ve.createElement(ve.Fragment,null,ve.createElement(He,{onClose:i,visible:r,appearance:g,style:{maxWidth:"600px"},headerContent:b},A))},Ar=Bd;import ae,{useEffect as Ir,useRef as $d,useState as Pt}from"react";import{useEffect as Ed,useState as Ad}from"react";var ms=()=>{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]=Ad(t),r=null,n=()=>{r!==null?clearTimeout(r):s(),r=setTimeout(()=>{s()},16)},s=()=>{let p=Object.fromEntries(Object.entries(e).map(([c,l])=>{if(!window)return[c,!1];let g=window.matchMedia(l);return g.addEventListener("change",n),[c,g.matches]}));i(p)};return Ed(()=>{s()},[]),o};import Kt from"react";import de,{css as us,keyframes as fs}from"styled-components";var gs=us`
|
|
1200
1200
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1201
1201
|
`,Id=us`
|
|
1202
1202
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
@@ -1279,7 +1279,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1279
1279
|
margin-bottom: 12px;
|
|
1280
1280
|
width: 40px;
|
|
1281
1281
|
`,Ts=de(Ss)`
|
|
1282
|
-
${e=>
|
|
1282
|
+
${e=>k(e)} {
|
|
1283
1283
|
${Id}
|
|
1284
1284
|
|
|
1285
1285
|
background: ${({theme:e})=>e.colorBackground};
|
|
@@ -1338,7 +1338,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1338
1338
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1339
1339
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1340
1340
|
`}
|
|
1341
|
-
`;var Es=({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:l=!1}=e,g=e.primaryButtonTitle||e.secondaryButtonTitle,d=()=>{r(e)};return Kt.createElement(bs,{className:a("carouselCard",o),onClick:l?null:d,style:t,blocked:l,complete:c},n&&Kt.createElement(ws,{className:a("carouselCardImage",o),src:n,alt:p,style:{opacity:c||l?.4:1}}),c&&Kt.createElement(Fs,{className:a("carouselCompletedPill",o)},Kt.createElement(Bs,{style:{color:"#108E0B"}},"Complete")),p&&Kt.createElement(vs,{blocked:l,complete:c,className:a("carouselCardTitle",o)},p),s&&Kt.createElement(dt.Quiet,{blocked:l,complete:c,className:a("carouselCardSubtitle",o)},s))};var Md=()=>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"})),As=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,r]=Pt(!1),[n,s]=Pt(!1);Ir(()=>{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(Cs,{style:c,reversed:n,onAnimationEnd:n?p:null},ae.createElement(ys,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},ae.createElement(Md,null))):null},Is=({flowId:e,appearance:t,customVariables:o,className:i})=>{let r=$d(null),[n,s]=Pt(!1),[p,c]=Pt(!1),[l,g]=Pt(null),[d,x]=Pt([]),[
|
|
1341
|
+
`;var Es=({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:l=!1}=e,g=e.primaryButtonTitle||e.secondaryButtonTitle,d=()=>{r(e)};return Kt.createElement(bs,{className:a("carouselCard",o),onClick:l?null:d,style:t,blocked:l,complete:c},n&&Kt.createElement(ws,{className:a("carouselCardImage",o),src:n,alt:p,style:{opacity:c||l?.4:1}}),c&&Kt.createElement(Fs,{className:a("carouselCompletedPill",o)},Kt.createElement(Bs,{style:{color:"#108E0B"}},"Complete")),p&&Kt.createElement(vs,{blocked:l,complete:c,className:a("carouselCardTitle",o)},p),s&&Kt.createElement(dt.Quiet,{blocked:l,complete:c,className:a("carouselCardSubtitle",o)},s))};var Md=()=>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"})),As=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,r]=Pt(!1),[n,s]=Pt(!1);Ir(()=>{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(Cs,{style:c,reversed:n,onAnimationEnd:n?p:null},ae.createElement(ys,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},ae.createElement(Md,null))):null},Is=({flowId:e,appearance:t,customVariables:o,className:i})=>{let r=$d(null),[n,s]=Pt(!1),[p,c]=Pt(!1),[l,g]=Pt(null),[d,x]=Pt([]),[F,C]=Pt(0),{isSmall:y}=ms(),f=y?1:3,{getFlowMetadata:v,getFlowSteps:w,getNumberOfStepsCompleted:b,updateCustomVariables:A,isLoading:S}=Y();Ir(()=>{A(o)},[o,S]),Ir(()=>{if(S)return;let N=v(e),I=b(e),$=w(e);g(N),N.data!==null&&(x($.sort((D,ee)=>Number(D.complete)-Number(ee.complete))),c($.length>f),C(I))},[S]);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)},T=(N=!0)=>{let I=N?1:-1;r.current!==null&&r.current.scrollBy({left:r.current.clientWidth*I,behavior:"smooth"})},E=null,L=N=>{E!==null?clearTimeout(E):B(N),E=setTimeout(()=>{B(N)},16)};return S?null:ae.createElement(Ts,{className:xe(a("carouselContainer",t),i)},ae.createElement("div",{style:{display:"flex",justifyContent:y?"center":"space-between",marginBottom:20,flexWrap:y?"wrap":"nowrap",gap:y?16:20}},ae.createElement("div",null,ae.createElement(ks,{className:a("carouselTitle",t)},l==null?void 0:l.title),ae.createElement(dt.Quiet,{className:a("carouselSubtitle",t)},l==null?void 0:l.subtitle)),ae.createElement(Ps,{className:a("progressWrapper",t)},ae.createElement(Le,{count:F,total:d.length,appearance:t}))),ae.createElement("div",{style:{position:"relative"}},ae.createElement(As,{show:n,onClick:()=>T(!1)}),ae.createElement(As,{side:"right",show:p,onClick:T}),ae.createElement(xs,{ref:r,onScroll:L},m.map((N,I)=>ae.createElement(hs,{key:I,style:{flex:`0 0 calc(100% - ${d.length>f?36:0}px)`}},N.map(($,D)=>ae.createElement(Es,{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 Nr=({flowId:e,title:t,subtitle:o,style:i,initialSelectedStep:r,className:n,type:s="inline",onDismiss:p,visible:c,customVariables:l,onStepCompletion:g,onButtonClick:d,appearance:x,hideOnFlowCompletion:F,setVisible:C,customStepTypes:y,checklistStyle:f="default",autoExpandFirstIncompleteStep:v,autoExpandNextStep:w,...b})=>{let{getFlow:A,getFlowSteps:S,markStepCompleted:m,getStepStatus:B,getNumberOfStepsCompleted:T,isLoading:E,targetingLogicShouldHideFlow:L,updateCustomVariables:N,getFlowMetadata:I,isStepBlocked:$,getFlowStatus:D,hasActiveFullPageFlow:ee,setHasActiveFullPageFlow:U}=Y(),{primaryCTAClickSideEffects:te,secondaryCTAClickSideEffects:fe}=ie(),{getOpenFlowState:X,setOpenFlowState:H}=we(),[j,Ce]=Os(r||0),[Ie,be]=Os(!1),me=c===void 0?X(e):c,J=s==="modal",{mergeAppearanceWithDefault:ge}=Q();if(x=ge(x),Ns(()=>{N(l)},[l,E]),Ns(()=>{c!==void 0&&(J&&c===!0?U(!0):J&&c===!1&&U(!1))},[c,C,ee]),E)return null;let re=A(e);if(!re||L(re))return null;let O=S(e);if(!O||F===!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),!Ie&&r===void 0&&T(e)>0){let u=O.findIndex(h=>h.complete===!1);Ce(u>-1?u:O.length-1),be(!0)}function G(){if(j+1>=O.length){J&&H(e,!1);return}$(e,O[j+1].id)||Ce(j+1)}function ne(u,h,P){let W=j+1<O.length?O[j+1]:null;d&&d(u,j,h,W)===!0&&J&&De(),g&&g(u,P,W),!g&&!d&&(u.primaryButtonUri||u.secondaryButtonUri)&&J&&De()}function se(){return O.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)===Ue&&G()}}))}function pe(){return ce.createElement(oe,{appearance:x})}let Ye={steps:se(),title:t,subtitle:o,primaryColor:x.theme.colorPrimary,appearance:x,customStepTypes:y,type:s,className:n,autoExpandFirstIncompleteStep:v,autoExpandNextStep:w};function De(){H(e,!1),p&&p(),C&&C(!1)}function Et(){return ce.createElement(ce.Fragment,null,ce.createElement(pe,null),ce.createElement(Is,{flowId:e,appearance:x,customVariables:l,className:n}))}function ft(){return ce.createElement(ce.Fragment,null,ce.createElement(pe,null),ce.createElement(Ar,{visible:me,onClose:()=>{De()},selectedStep:j,setSelectedStep:Ce,autoExpandNextStep:!0,appearance:x,...Ye}))}function At(){let u=b.guideFlowId,h;return u&&A(u)&&(h=S(u)),ce.createElement(ce.Fragment,null,ce.createElement(pe,null),ce.createElement(Er,{visible:me,stepsTitle:V.stepsTitle?V.stepsTitle:"Your quick start guide",onClose:()=>{De()},selectedStep:j,setSelectedStep:Ce,guideData:h,guideTitle:b.guideTitle??"Guide",appearance:x,title:t,subtitle:o,onGuideButtonClick:P=>{ne(P,"link",0)},customStepTypes:y,...Ye}))}function gt(){let u=ce.createElement(vr,{flowId:e,style:i,selectedStep:j,setSelectedStep:Ce,appearance:x,type:s,...Ye});return J?ce.createElement(He,{onClose:()=>{De()},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 zd=e=>Ud.createElement(Nr,{type:"inline",...e});import mt,{useEffect as Wd}from"react";import Ke from"react";import jo from"styled-components";var Ls=jo.div`
|
|
1342
1342
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1343
1343
|
border-radius: 8px;
|
|
1344
1344
|
padding: 6px 10px 6px 10px;
|
|
@@ -1378,7 +1378,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1378
1378
|
border-color: ${e=>e.appearance.theme.colorPrimary};
|
|
1379
1379
|
border-radius: 12px;
|
|
1380
1380
|
`,Ws=uo.div`
|
|
1381
|
-
${e=>
|
|
1381
|
+
${e=>k(e)} {
|
|
1382
1382
|
display: flex;
|
|
1383
1383
|
justify-content: center;
|
|
1384
1384
|
align-items: center;
|
|
@@ -1404,7 +1404,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1404
1404
|
:hover {
|
|
1405
1405
|
opacity: 0.8;
|
|
1406
1406
|
}
|
|
1407
|
-
`;var js=({title:e,subtitle:t,icon:o,appearance:i,count:r,total:n,className:s,style:p})=>ct.createElement(ct.Fragment,null,ct.createElement(zs,{appearance:i,className:xe(a("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&ct.createElement(Ws,{className:a("fullWidthProgressBadgeIcon",i)},o),ct.createElement(_s,null,ct.createElement(Fe,{size:"small",appearance:i,title:e,subtitle:t})),ct.createElement(Hs,{className:a("fullWidthProgressBadgeProgressContainer",i)},ct.createElement(Le,{count:r,total:n,display:"percent",textLocation:"top"}))));var _d=({flowId:e,title:t,subtitle:o,icon:i,style:r,onClick:n,className:s,customVariables:p,hideOnFlowCompletion:c,appearance:l,type:g="default"})=>{let{getFlow:d,getFlowSteps:x,getFlowStatus:
|
|
1407
|
+
`;var js=({title:e,subtitle:t,icon:o,appearance:i,count:r,total:n,className:s,style:p})=>ct.createElement(ct.Fragment,null,ct.createElement(zs,{appearance:i,className:xe(a("fullWidthProgressBadgeContainer",i),s??""),style:p},o&&ct.createElement(Ws,{className:a("fullWidthProgressBadgeIcon",i)},o),ct.createElement(_s,null,ct.createElement(Fe,{size:"small",appearance:i,title:e,subtitle:t})),ct.createElement(Hs,{className:a("fullWidthProgressBadgeProgressContainer",i)},ct.createElement(Le,{count:r,total:n,display:"percent",textLocation:"top"}))));var _d=({flowId:e,title:t,subtitle:o,icon:i,style:r,onClick:n,className:s,customVariables:p,hideOnFlowCompletion:c,appearance:l,type:g="default"})=>{let{getFlow:d,getFlowSteps:x,getFlowStatus:F,getNumberOfStepsCompleted:C,isLoading:y,targetingLogicShouldHideFlow:f,updateCustomVariables:v}=Y(),{mergeAppearanceWithDefault:w}=Q();l=w(l);let{setOpenFlowState:b,getOpenFlowState:A}=we();if(Wd(()=>{v(p)},[p,y]),y)return null;let S=d(e);if(!S||f(S)||c===!0&&F(e)===q)return null;let m=x(e),B=C(e);return g==="full-width"?mt.createElement(mt.Fragment,null,mt.createElement(oe,{appearance:l}),mt.createElement(js,{title:t,subtitle:o,count:B,total:m.length,style:r,className:s,appearance:l,icon:i,onClick:()=>{}})):mt.createElement(mt.Fragment,null,mt.createElement(oe,{appearance:l}),mt.createElement(Us,{count:B,total:m.length,title:t,style:r,onClick:()=>{b(e,!0),n&&n()},type:g,className:s,appearance:l}))};import Hd from"react";var jd=({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 l=s(e);return Hd.createElement(mo,{steps:l,style:t,appearance:o,...i})};import ut,{useContext as ec,useEffect as tc}from"react";import _,{useEffect as Vo,useLayoutEffect as Gs,useRef as qd,useState as fo}from"react";import go from"styled-components";import{useCallback as Vd,useEffect as Gd,useState as Kd}from"react";var Or=(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 Vs(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]=Kd(o),n=Vd(()=>{e&&r(e.getBoundingClientRect())},[e]);return Gd(()=>(n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)),[e,t]),i}var Ks=300,qs=100,Yd=500,qt=12,Xd=go.div`
|
|
1408
1408
|
width: 100%;
|
|
1409
1409
|
height: 100%;
|
|
1410
1410
|
border-radius: 9999px;
|
|
@@ -1445,8 +1445,8 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1445
1445
|
`,Zd=go(Ys)`
|
|
1446
1446
|
width: ${qt+12}px;
|
|
1447
1447
|
height: ${qt+12}px;
|
|
1448
|
-
`,Rd=({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:l=0,customStepTypes:g,appearance:d,dismissible:x=!1,showHighlightOnly:
|
|
1449
|
-
${e=>
|
|
1448
|
+
`,Rd=({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:l=0,customStepTypes:g,appearance:d,dismissible:x=!1,showHighlightOnly:F,showStepCount:C=!0,completedStepsCount:y=0,showFrigadeBranding:f=!1,cssPosition:v="absolute"})=>{var se,pe,Ye,De,Et,ft,At,gt,u,h,P,W;let[w,b]=fo(),[A,S]=fo(new Date),m=qd(null),[B,T]=fo(document.querySelector(e[l].selector)),E=Vs(B,A),[L,N]=fo(),[I,$]=fo(!F),D=(pe=(se=e[l])==null?void 0:se.props)!=null&&pe.position?e[l].props.position:v,ee=((De=(Ye=e[l])==null?void 0:Ye.props)==null?void 0:De.zIndex)??90,U=(w==null?void 0:w.width)??Ks,te=(w==null?void 0:w.height)??qs,fe=window.location.pathname.split("/").pop();Gs(()=>{m.current&&b({width:m.current.clientWidth,height:m.current.clientHeight})},[l,A,D]),Vo(()=>{F||$(!0)},[l]);let X=()=>{let M=document.querySelector(e[l].selector);if(!M){N(void 0),T(null);return}L&&L===JSON.stringify(M==null?void 0:M.getBoundingClientRect())||(T(M),S(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]),Gs(()=>{setTimeout(()=>{X()},Yd),X()},[l,fe]),B===null||!p||E.height===0&&E.width===0&&D!=="fixed"&&v!=="static")return null;let H=i==="auto"?"right":i,j=Or(E,H,U,s,D),Ce=E.right+U>(window.innerWidth||document.documentElement.clientWidth),Ie=E.bottom+qs>(window.innerHeight||document.documentElement.clientHeight);Ce&&i==="auto"&&(j=Or(E,"left",U,s,D),H="left"),(ft=(Et=e[l])==null?void 0:Et.props)!=null&&ft.tooltipPosition&&((gt=(At=e[l])==null?void 0:At.props)==null?void 0:gt.tooltipPosition)!=="auto"&&(((h=(u=e[l])==null?void 0:u.props)==null?void 0:h.tooltipPosition)==="left"||((W=(P=e[l])==null?void 0:P.props)==null?void 0:W.tooltipPosition)==="right")&&(H=e[l].props.tooltipPosition);let be=()=>{let M=()=>{if(e[l].handlePrimaryButtonClick&&(e[l].handlePrimaryButtonClick(),$(!1),setTimeout(()=>{X()},30)),y===e.length-1)return o()},$e=()=>{e[l].handleSecondaryButtonClick&&(e[l].handleSecondaryButtonClick(),F&&!e[l].secondaryButtonUri&&$(!1))};return _.createElement(_.Fragment,null,C&&e.length>1&&_.createElement(Rr,null,_.createElement(ti,{className:a("tooltipStepCounter",d)},l+1," of ",e.length)),_.createElement(ei,{showStepCount:C,className:a("tooltipCTAContainer",d)},e[l].secondaryButtonTitle&&_.createElement(Z,{title:e[l].secondaryButtonTitle,appearance:d,onClick:$e,size:"small",withMargin:!1,secondary:!0}),e[l].primaryButtonTitle&&_.createElement(Z,{title:e[l].primaryButtonTitle,appearance:d,onClick:M,withMargin:!1,size:"small"})))},me=()=>_.createElement(_.Fragment,null,x&&_.createElement(Yr,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:a("tooltipClose",d),hasImage:!!e[l].imageUri||!!e[l].videoUri},_.createElement(Te,null)),e[l].imageUri&&_.createElement(Xr,{dismissible:x,appearance:d,src:e[l].imageUri,className:a("tooltipImageContainer",d)}),e[l].videoUri&&!e[l].imageUri&&_.createElement(Jr,{dismissible:x,appearance:d,className:a("tooltipVideoContainer",d)},_.createElement(Ve,{appearance:d,videoUri:e[l].videoUri})),_.createElement(Zr,{className:a("tooltipContentContainer",d)},_.createElement(Fe,{appearance:d,title:e[l].title,subtitle:e[l].subtitle,size:"small"}),_.createElement(Qr,{className:a("tooltipFooter",d)},_.createElement(be,null)))),ge={...{default:M=>{var $e;if(($e=e[l])!=null&&$e.StepContent){let Nl=e[l].StepContent;return _.createElement("div",null,Nl)}return _.createElement(me,null)}},...g},re=()=>{var M;return e?!((M=e[l])!=null&&M.type)||!ge[e[l].type]?ge.default(e[l]):ge[e[l].type]({stepData:e[l],primaryColor:n}):_.createElement(_.Fragment,null)};if(F&&e[l].complete===!0)return null;let O={top:(j==null?void 0:j.y)-qt,left:(H=="left"?E.x+s.x:(j==null?void 0:j.x)-qt)??0,cursor:F?"pointer":"default",position:D},V=()=>{let $e=O.left+(H=="left"?-U:24);return Math.min(Math.max($e,20),window.innerWidth-U-20)},G=()=>{if(D==="fixed")return O.top;let M=O.top+te,$e=20;return M>window.innerHeight-$e?O.top+-te:O.top},ne=()=>{F&&(S(new Date),$(!I))};return _.createElement(Qd,null,_.createElement(Zd,{style:O,zIndex:ee,className:a("tourHighlightContainer",d)},r&&e[l].showHighlight!==!1&&v!=="static"&&_.createElement(_.Fragment,null,_.createElement(Jd,{style:{position:D},onClick:ne,primaryColor:d.theme.colorPrimary,className:a("tourHighlightInnerCircle",d)}),_.createElement(Xd,{style:{position:"absolute"},onClick:ne,primaryColor:d.theme.colorPrimary,className:a("tourHighlightOuterCircle",d)}))),_.createElement(Ys,{style:{...O,left:V(),top:G()},zIndex:ee+1,className:a("tooltipContainerWrapper",d)},I&&_.createElement(_.Fragment,null,_.createElement(Co,{ref:m,layoutId:"tooltip-container",style:{position:"relative",width:"max-content",right:0,top:v!=="static"?12:0,...c},appearance:d,className:a("tooltipContainer",d),maxWidth:Ks,zIndex:ee+10},_.createElement(re,null)),f&&_.createElement(ri,{className:a("poweredByFrigadeTooltipRibbon",d),appearance:d,zIndex:ee+10},_.createElement(yo,{appearance:d})))))},Go=Rd;import{Portal as oc}from"react-portal";var rc=({flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:r,showTooltipsSimultaneously:n=!1,onDismiss:s,dismissible:p,tooltipPosition:c="auto",showHighlightOnly:l=!1,dismissBehavior:g="complete-flow",onComplete:d,skipIfNotFound:x=!1,cssPosition:F="absolute",...C})=>{let{getFlow:y,getFlowSteps:f,isLoading:v,targetingLogicShouldHideFlow:w,markStepCompleted:b,markStepStarted:A,markFlowCompleted:S,updateCustomVariables:m,getCurrentStepIndex:B,getStepStatus:T,isStepBlocked:E,getFlowStatus:L,getNumberOfStepsCompleted:N}=Y(),{isLoadingUserFlowStateData:I}=Be(),{primaryCTAClickSideEffects:$,secondaryCTAClickSideEffects:D}=ie(),{hasOpenModals:ee}=we(),U=B(e),{openFlowStates:te}=ec(K),{mergeAppearanceWithDefault:fe}=Q();if(o=fe(o),tc(()=>{m(t)},[t,v]),I)return null;let X=y(e);if(!X||w(X)||L(e)==q||ee())return null;let H=f(e);if(Object.keys(te).length>0){let O=Object.keys(te).find(V=>te[V]===!0);if(O!==void 0&&O!==e)return ut.createElement(ut.Fragment,null)}async function j(O){if(await b(e,O.id),H.map(V=>T(e,V.id)).every(V=>V===Ue)){await S(e);return}if(!l&&U+1<H.length){if(E(e,H[U+1].id))return;await A(e,H[U+1].id)}}function Ce(O,V,G){let ne=U+1<H.length?H[U+1]:null;r&&r(O,U,V,ne),i&&i(O,G,ne)}function Ie(){return H.map(O=>({...O,handleSecondaryButtonClick:async()=>{D(O),O.skippable===!0&&await b(e,O.id,{skipped:!0}),Ce(O,"secondary",U)},handlePrimaryButtonClick:async()=>{(!O.completionCriteria&&(O.autoMarkCompleted||O.autoMarkCompleted===void 0)||O.completionCriteria&&O.autoMarkCompleted===!0)&&await j(O),Ce(O,"primary",U),$(O)}}))}async function be(O){s&&s(),g==="complete-flow"?await S(e):await b(e,O.id)}function me(){d&&d()}let J=!document.querySelector(H[U].selector);function ge(){let O=H.findIndex(V=>!!document.querySelector(V.selector));return H.map((V,G)=>J&&!n&&G!==O&&x?null:ut.createElement(Go,{key:V.id,appearance:o,steps:Ie(),selectedStep:G,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>be(V),tooltipPosition:c,showHighlightOnly:l,completedStepsCount:N(e),onComplete:me,cssPosition:F,...C}))}function re(){return ut.createElement(ut.Fragment,null,ut.createElement(oe,{appearance:o}),n||J&&x?ge():ut.createElement(Go,{appearance:o,steps:Ie(),selectedStep:U,showTooltipsSimultaneously:n,dismissible:p,onDismiss:()=>be(H[U]),tooltipPosition:c,completedStepsCount:N(e),showHighlightOnly:l,onComplete:me,cssPosition:F,...C}))}return F==="static"?re():ut.createElement(oc,null,re())};import Ae,{useEffect as ic,useRef as nc,useState as sc}from"react";import{Portal as lc}from"react-portal";import vt from"styled-components";var Xs=vt.button`
|
|
1449
|
+
${e=>k(e)} {
|
|
1450
1450
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1451
1451
|
|
|
1452
1452
|
display: flex;
|
|
@@ -1464,12 +1464,12 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1464
1464
|
}
|
|
1465
1465
|
}
|
|
1466
1466
|
`,Js=vt.span`
|
|
1467
|
-
${e=>
|
|
1467
|
+
${e=>k(e)} {
|
|
1468
1468
|
font-size: 12px;
|
|
1469
1469
|
display: inline-block;
|
|
1470
1470
|
}
|
|
1471
1471
|
`,Qs=vt.span`
|
|
1472
|
-
${e=>
|
|
1472
|
+
${e=>k(e)} {
|
|
1473
1473
|
font-size: 12px;
|
|
1474
1474
|
display: inline-block;
|
|
1475
1475
|
}
|
|
@@ -1484,7 +1484,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1484
1484
|
align-items: flex-end;
|
|
1485
1485
|
z-index: 50;
|
|
1486
1486
|
`,Rs=vt.button`
|
|
1487
|
-
${e=>
|
|
1487
|
+
${e=>k(e)} {
|
|
1488
1488
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1489
1489
|
background-color: #ffffff;
|
|
1490
1490
|
border: 1px solid #f5f5f5;
|
|
@@ -1500,7 +1500,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1500
1500
|
border-radius: 45px;
|
|
1501
1501
|
cursor: pointer;
|
|
1502
1502
|
`,el=vt.div`
|
|
1503
|
-
${e=>
|
|
1503
|
+
${e=>k(e)} {
|
|
1504
1504
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1505
1505
|
background: #ffffff;
|
|
1506
1506
|
}
|
|
@@ -1517,7 +1517,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1517
1517
|
top: ${e=>e.type=="inline"?"68px":0};
|
|
1518
1518
|
margin-left: ${e=>e.type=="inline"?"-127px":0};
|
|
1519
1519
|
`,tl=vt.button`
|
|
1520
|
-
${e=>
|
|
1520
|
+
${e=>k(e)} {
|
|
1521
1521
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1522
1522
|
color: #434343;
|
|
1523
1523
|
:hover {
|
|
@@ -1533,8 +1533,8 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1533
1533
|
font-size: 14px;
|
|
1534
1534
|
|
|
1535
1535
|
padding: 8px 12px;
|
|
1536
|
-
`;import ol from"react";var rl=({style:e,className:t})=>ol.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},ol.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 il from"react";var nl=({style:e,className:t})=>il.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"},il.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 ac=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:r="inline",title:n="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:c,markStepCompleted:l,getStepStatus:g,getNumberOfStepsCompleted:d,isLoading:x,targetingLogicShouldHideFlow:
|
|
1537
|
-
${e=>
|
|
1536
|
+
`;import ol from"react";var rl=({style:e,className:t})=>ol.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},ol.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 il from"react";var nl=({style:e,className:t})=>il.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"},il.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 ac=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:r="inline",title:n="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:c,markStepCompleted:l,getStepStatus:g,getNumberOfStepsCompleted:d,isLoading:x,targetingLogicShouldHideFlow:F}=Y(),{primaryCTAClickSideEffects:C}=ie(),y=nc(null),[f,v]=sc(!1),{mergeAppearanceWithDefault:w}=Q();s=w(s),ic(()=>(document.addEventListener("click",b,!1),()=>{document.removeEventListener("click",b,!1)}),[]);let b=T=>{y.current&&!y.current.contains(T.target)&&v(!1)};if(x)return null;let A=p(e);if(!A||F(A))return null;let S=c(e);if(!S||!i)return null;function m(T,E){!T.completionCriteria&&(T.autoMarkCompleted||T.autoMarkCompleted===void 0)&&l(e,T.id),C(T),o&&o(T,E),v(!1)}function B(){return f&&Ae.createElement(el,{className:a("floatingWidgetMenu",s),initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:r},S.map((T,E)=>Ae.createElement(tl,{className:a("floatingWidgetMenuItem",s),key:E,onClick:()=>m(T,E)},T.title)))}return r=="inline"?Ae.createElement("span",{ref:y},Ae.createElement(Xs,{style:t,onClick:()=>{v(!f)},className:a("supportButton",s)},Ae.createElement(Qs,{className:a("supportIconContainer",s)},Ae.createElement(nl,{className:a("supportIcon",s),style:{width:"18px",height:"18px"}})),Ae.createElement(Js,{className:a("supportButtonTitle",s)},n)),Ae.createElement(B,null)):Ae.createElement(lc,null,Ae.createElement(Zs,{style:t,ref:y},Ae.createElement(B,null),Ae.createElement(Rs,{onClick:()=>{v(!f)},whileHover:{scale:1.1},className:a("floatingWidgetButton",s)},Ae.createElement(rl,{className:a("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import qe,{useEffect as pc}from"react";import Ko from"styled-components";var sl=Ko.div`
|
|
1537
|
+
${e=>k(e)} {
|
|
1538
1538
|
display: flex;
|
|
1539
1539
|
flex-direction: column;
|
|
1540
1540
|
width: 100%;
|
|
@@ -1559,7 +1559,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1559
1559
|
align-items: flex-start;
|
|
1560
1560
|
margin-top: 16px;
|
|
1561
1561
|
`,pl=Ko.div`
|
|
1562
|
-
${e=>
|
|
1562
|
+
${e=>k(e)} {
|
|
1563
1563
|
position: absolute;
|
|
1564
1564
|
top: 16px;
|
|
1565
1565
|
right: 16px;
|
|
@@ -1569,9 +1569,9 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1569
1569
|
opacity: 0.8;
|
|
1570
1570
|
}
|
|
1571
1571
|
}
|
|
1572
|
-
`;var dc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p})=>{let{getFlow:c,markFlowCompleted:l,markStepCompleted:g,isLoading:d,targetingLogicShouldHideFlow:x,updateCustomVariables:
|
|
1572
|
+
`;var dc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p})=>{let{getFlow:c,markFlowCompleted:l,markStepCompleted:g,isLoading:d,targetingLogicShouldHideFlow:x,updateCustomVariables:F,getFlowSteps:C,getFlowStatus:y,getCurrentStepIndex:f}=Y(),{primaryCTAClickSideEffects:v}=ie(),{mergeAppearanceWithDefault:w}=Q();if(r=w(r),pc(()=>{F(o)},[o,d]),d)return null;let b=c(e);if(!b||x(b)||y(e)===q)return null;let S=C(e)[f(e)];return qe.createElement(qe.Fragment,null,qe.createElement(oe,{appearance:r}),qe.createElement(sl,{appearance:r,className:xe(a("embeddedTipContainer",r),n),style:s},(p===!0||S.dismissible)&&qe.createElement(pl,{onClick:async()=>{await l(e),t&&t()},className:a("embeddedTipDismissButton",r)},qe.createElement(Te,null)),qe.createElement(ll,null,qe.createElement(Fe,{size:"small",appearance:r,title:S.title,subtitle:S.subtitle})),S.primaryButtonTitle&&qe.createElement(al,{className:a("embeddedTipCallToActionContainer",r)},qe.createElement(Z,{classPrefix:"embeddedTip",title:S.primaryButtonTitle,appearance:r,withMargin:!1,size:"medium",type:"inline",onClick:async()=>{S.handlePrimaryButtonClick(),v(S),!(i&&i(S,f(e),"primary")===!1)&&(await g(e,S.id),await l(e))}}))))};import ye,{useEffect as cc}from"react";import Yt from"styled-components";var dl=Yt.div`
|
|
1573
1573
|
// use the :not annotation
|
|
1574
|
-
${e=>
|
|
1574
|
+
${e=>k(e)} {
|
|
1575
1575
|
display: flex;
|
|
1576
1576
|
flex-direction: ${e=>e.type==="square"?"column":"row"};
|
|
1577
1577
|
width: 100%;
|
|
@@ -1582,7 +1582,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1582
1582
|
border-radius: 12px;
|
|
1583
1583
|
}
|
|
1584
1584
|
`,cl=Yt.div`
|
|
1585
|
-
${e=>
|
|
1585
|
+
${e=>k(e)} {
|
|
1586
1586
|
display: flex;
|
|
1587
1587
|
width: 46px;
|
|
1588
1588
|
height: 46px;
|
|
@@ -1611,7 +1611,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1611
1611
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1612
1612
|
align-items: flex-end;
|
|
1613
1613
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1614
|
-
`;import $r from"react";var fl=({style:e,className:t})=>$r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"46",height:"46",fill:"none",viewBox:"0 0 46 46",style:e,className:t},$r.createElement("circle",{cx:"23",cy:"23",r:"23",fill:"#E6F1FF"}),$r.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 mc=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:r,onButtonClick:n,appearance:s,type:p="full-width",icon:c})=>{let{getFlow:l,markFlowCompleted:g,isLoading:d,targetingLogicShouldHideFlow:x,updateCustomVariables:
|
|
1614
|
+
`;import $r from"react";var fl=({style:e,className:t})=>$r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"46",height:"46",fill:"none",viewBox:"0 0 46 46",style:e,className:t},$r.createElement("circle",{cx:"23",cy:"23",r:"23",fill:"#E6F1FF"}),$r.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 mc=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:r,onButtonClick:n,appearance:s,type:p="full-width",icon:c})=>{let{getFlow:l,markFlowCompleted:g,isLoading:d,targetingLogicShouldHideFlow:x,updateCustomVariables:F,getFlowMetadata:C,getFlowStatus:y,getFlowSteps:f,getCurrentStepIndex:v}=Y(),{primaryCTAClickSideEffects:w}=ie(),{mergeAppearanceWithDefault:b}=Q();if(s=b(s),cc(()=>{F(r)},[r,d]),d)return null;let A=l(e);if(!A||x(A)||y(e)===q)return null;let S=f(e),m=S.length>0?S[v(e)]:C(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(dl,{type:p,appearance:s,className:a("bannerContainer",s)},p!="square"&&ye.createElement(cl,{className:a("bannerIconContainer",s)},c||ye.createElement(fl,null)),p==="square"&&m.dismissible&&ye.createElement(Dr,{type:p,className:a("bannerDismissButtonContainer",s)},ye.createElement(Lr,{type:p,onClick:async()=>{await g(e),i&&i()},className:a("bannerDismissButton",s)},ye.createElement(Te,null))),ye.createElement(ml,{type:p},ye.createElement(Fe,{appearance:s,title:t,subtitle:o,classPrefix:"banner"})),(m==null?void 0:m.primaryButtonTitle)&&ye.createElement(ul,{type:p,className:a("bannerCallToActionContainer",s)},ye.createElement(Z,{title:m==null?void 0:m.primaryButtonTitle,appearance:s,onClick:()=>{w(m),n&&n(m,0,"primary")},classPrefix:"banner"})),p!=="square"&&m.dismissible&&ye.createElement(Dr,{type:p,className:a("bannerDismissButtonContainer",s)},ye.createElement(Lr,{type:p,onClick:async()=>{await g(e),i&&i()},className:a("bannerDismissButton",s)},ye.createElement(Te,null)))))};import R,{useEffect as uc}from"react";import{Portal as fc}from"react-portal";import it from"styled-components";var gl=it.div`
|
|
1615
1615
|
display: flex;
|
|
1616
1616
|
flex-direction: column;
|
|
1617
1617
|
width: 100%;
|
|
@@ -1678,7 +1678,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1678
1678
|
align-items: flex-start;
|
|
1679
1679
|
margin-top: 16px;
|
|
1680
1680
|
`,Cl=it.textarea`
|
|
1681
|
-
${e=>
|
|
1681
|
+
${e=>k(e)} {
|
|
1682
1682
|
margin-top: 16px;
|
|
1683
1683
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1684
1684
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
@@ -1689,7 +1689,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1689
1689
|
height: 100px;
|
|
1690
1690
|
}
|
|
1691
1691
|
`,yl=it.div`
|
|
1692
|
-
${e=>
|
|
1692
|
+
${e=>k(e)} {
|
|
1693
1693
|
position: absolute;
|
|
1694
1694
|
top: 16px;
|
|
1695
1695
|
right: 16px;
|
|
@@ -1699,8 +1699,8 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1699
1699
|
opacity: 0.8;
|
|
1700
1700
|
}
|
|
1701
1701
|
}
|
|
1702
|
-
`;var gc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,type:p="modal"})=>{let{getFlow:c,markFlowCompleted:l,markStepCompleted:g,getNumberOfStepsCompleted:d,isLoading:x,targetingLogicShouldHideFlow:
|
|
1703
|
-
${e=>
|
|
1702
|
+
`;var gc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,type:p="modal"})=>{let{getFlow:c,markFlowCompleted:l,markStepCompleted:g,getNumberOfStepsCompleted:d,isLoading:x,targetingLogicShouldHideFlow:F,updateCustomVariables:C,getFlowSteps:y,getFlowStatus:f,getCurrentStepIndex:v}=Y(),{primaryCTAClickSideEffects:w}=ie(),{mergeAppearanceWithDefault:b}=Q(),[A,S]=R.useState(null),[m,B]=R.useState(""),{hasOpenModals:T,setKeepCompletedFlowOpenDuringSession:E,shouldKeepCompletedFlowOpenDuringSession:L}=we();if(r=b(r),uc(()=>{C(o)},[o,x]),x)return null;let N=c(e);if(!N||F(N)||f(e)===q||d(e)===1&&!L(e)||T())return null;let $=y(e)[d(e)];function D(){return R.createElement(R.Fragment,null,R.createElement(zr,null,R.createElement(Fe,{size:"large",appearance:r,title:$.title,subtitle:$.subtitle})),R.createElement(Mr,{className:a("npsNumberButtonContainer",r),appearance:r},Array.from(Array(10).keys()).map(te=>R.createElement(xl,{className:a("npsNumberButton",r),selected:A===te+1,key:te,onClick:async()=>{E(e),S(te+1),await g(e,$.id,{score:te+1})},appearance:r},te+1))),R.createElement(hl,{appearance:r},R.createElement(Ur,{appearance:r},"Not likely at all"),R.createElement(Ur,{appearance:r},"Extremely likely")))}function ee(){return R.createElement(R.Fragment,null,R.createElement(zr,null,R.createElement(Fe,{appearance:r,title:$.title??"Why did you choose this score?",size:"large"})),R.createElement(Cl,{appearance:r,value:m,onChange:te=>{B(te.target.value)},placeHolder:"Add your optional fedback here..."}),R.createElement(Mr,{appearance:r,className:a("npsNumberButtonContainer",r)},R.createElement(Z,{size:"large",withMargin:!1,onClick:async()=>{await l(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 l(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(gl,{appearance:r,className:xe(a("npsSurveyContainer",r),n),style:s,type:p},R.createElement(yl,{onClick:async()=>{await l(e),t&&t()},className:a("npsSurveyDismissButton",r)},R.createElement(Te,null)),d(e)==0&&D(),d(e)==1&&ee()))}return p==="inline"?U():R.createElement(fc,null,U())};import Se,{useEffect as Cc}from"react";import Bt from"styled-components";var Sl=Bt.div`
|
|
1703
|
+
${e=>k(e)} {
|
|
1704
1704
|
display: flex;
|
|
1705
1705
|
flex-direction: column;
|
|
1706
1706
|
width: 100%;
|
|
@@ -1725,7 +1725,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1725
1725
|
margin-top: 16px;
|
|
1726
1726
|
margin-bottom: 16px;
|
|
1727
1727
|
`,Fl=Bt.div`
|
|
1728
|
-
${e=>
|
|
1728
|
+
${e=>k(e)} {
|
|
1729
1729
|
position: absolute;
|
|
1730
1730
|
top: -16px;
|
|
1731
1731
|
right: -16px;
|
|
@@ -1736,7 +1736,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1736
1736
|
}
|
|
1737
1737
|
}
|
|
1738
1738
|
`,kl=Bt.h1`
|
|
1739
|
-
${e=>
|
|
1739
|
+
${e=>k(e)} {
|
|
1740
1740
|
font-style: normal;
|
|
1741
1741
|
justify-content: center;
|
|
1742
1742
|
text-align: center;
|
|
@@ -1750,7 +1750,7 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1750
1750
|
margin-bottom: 8px;
|
|
1751
1751
|
}
|
|
1752
1752
|
`,Pl=Bt.h2`
|
|
1753
|
-
${e=>
|
|
1753
|
+
${e=>k(e)} {
|
|
1754
1754
|
font-style: normal;
|
|
1755
1755
|
justify-content: center;
|
|
1756
1756
|
text-align: center;
|
|
@@ -1766,5 +1766,5 @@ ${i=>i.inlineStyles.map(([r,n])=>`.${Qt}${r}.${Qt}${r} { ${Object.entries(n).map
|
|
|
1766
1766
|
height: 100%;
|
|
1767
1767
|
min-height: 200px;
|
|
1768
1768
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1769
|
-
`;function Bl({stepData:e,appearance:t,classPrefix:o=""}){return e.videoUri?vl.createElement(Ve,{appearance:t,videoUri:e.videoUri}):e.imageUri?vl.createElement(hc,{className:a(`${o}image`,t),appearance:t,src:e.imageUri}):null}var yc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p=!0,modalPosition:c})=>{let{getFlow:l,markFlowCompleted:g,markStepCompleted:d,isLoading:x,targetingLogicShouldHideFlow:
|
|
1769
|
+
`;function Bl({stepData:e,appearance:t,classPrefix:o=""}){return e.videoUri?vl.createElement(Ve,{appearance:t,videoUri:e.videoUri}):e.imageUri?vl.createElement(hc,{className:a(`${o}image`,t),appearance:t,src:e.imageUri}):null}var yc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:r,className:n,style:s,dismissible:p=!0,modalPosition:c})=>{let{getFlow:l,markFlowCompleted:g,markStepCompleted:d,isLoading:x,targetingLogicShouldHideFlow:F,updateCustomVariables:C,getFlowSteps:y,getFlowStatus:f,getCurrentStepIndex:v}=Y(),{primaryCTAClickSideEffects:w,secondaryCTAClickSideEffects:b}=ie(),{mergeAppearanceWithDefault:A}=Q(),{setOpenFlowState:S,getOpenFlowState:m,hasOpenModals:B}=we(),[T,E]=[m(e,!0),U=>S(e,U)];if(r=A(r),Cc(()=>{C(o)},[o,x]),x)return null;let L=l(e);if(!L||F(L)||f(e)===q||B())return null;let I=y(e)[v(e)],$=()=>{E(!1),t&&t(),g(e)};function D(){return Se.createElement(Se.Fragment,null,Se.createElement(oe,{appearance:r}),Se.createElement(Sl,{appearance:r,className:xe(a("announcementContainer",r),n),style:s},(p===!0||I.dismissible)&&c=="inline"&&Se.createElement(Fl,{onClick:async()=>{await g(e),t&&t()},className:a("announcementDismissButton",r)},Se.createElement(Te,null)),Se.createElement(bl,null,Se.createElement(kl,{appearance:r,className:a("announcementTitle",r),dangerouslySetInnerHTML:le(I.title)}),I.subtitle&&Se.createElement(Pl,{appearance:r,className:a("announcementSubtitle",r),dangerouslySetInnerHTML:le(I.subtitle)})),(I.imageUri||I.videoUri)&&Se.createElement(Tl,{className:a("announcementMediaContainer",r)},Se.createElement(Bl,{appearance:r,stepData:I})),(I.primaryButtonTitle||I.secondaryButtonTitle)&&Se.createElement(wl,{className:a("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(),b(I),i&&i(I,v(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(),w(I),!(i&&i(I,v(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:T,dismissible:p,appearance:r},D()):Se.createElement(He,{appearance:r,onClose:$,visible:T,style:ee,dismissible:p},D())};import*as qo from"react";import El from"react";var Al=({as:e="span",children:t,variant:o="Body1",...i})=>El.createElement(Ri,{color:"neutral.foreground",fontFamily:"default",forwardedAs:e,variant:o,...i},t),Sc=Object.fromEntries(Object.keys(Do).map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=i=>El.createElement(Al,{as:t,...i,variant:e},i.children);return o.displayName=`Text.${e}`,[e,o]})),Wr=Object.assign(Al,Sc);var Il=({as:e="button",className:t,size:o="md",title:i,variant:r="Primary",...n})=>{var s;return qo.createElement(Zi,{className:`fr-button-${r.toLowerCase()}${t?` ${t}`:""}`,forwardedAs:e,variant:r,size:o,borderRadius:"md",...n},qo.createElement(Wr,{color:(s=ao[r])==null?void 0:s.color,fontWeight:"semibold"},i))},bc=Object.fromEntries(Object.keys(ao).map(e=>{let t=o=>qo.createElement(Il,{...o,variant:e});return t.displayName=`Button.${e}`,[e,t]})),wc=Object.assign(Il,bc);export{lo as Box,wc as Button,Qe as CheckBox,Jo as FlowType,st as FormLabel,pr as FormTextField,yc as FrigadeAnnouncement,mc as FrigadeBanner,Nr as FrigadeChecklist,Je as FrigadeDefaultAppearance,dc as FrigadeEmbeddedTip,Vi as FrigadeForm,jd as FrigadeGuide,zd as FrigadeHeroChecklist,gc as FrigadeNPSSurvey,_d as FrigadeProgressBadge,Xp as FrigadeProvider,ac as FrigadeSupportWidget,rc as FrigadeTour,$t as ProgressRing,Wr as Text,Tr as tokens,we as useFlowOpens,Xt as useFlowResponses,Y as useFlows,Sr as useOrganization,Jt as useUser,Be as useUserFlowStates};
|
|
1770
1770
|
//# sourceMappingURL=index.mjs.map
|