@frigade/react 1.38.9 → 1.38.11
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/dist/index.js +141 -141
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +150 -150
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnPropertyDescriptors;var Wo=Object.getOwnPropertySymbols;var di=Object.prototype.hasOwnProperty,ci=Object.prototype.propertyIsEnumerable;var pi=(e,t,o)=>t in e?sa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))di.call(t,o)&&pi(e,o,t[o]);if(Wo)for(var o of Wo(t))ci.call(t,o)&&pi(e,o,t[o]);return e},j=(e,t)=>la(e,aa(t));var mi=e=>typeof e=="symbol"?e:e+"",$e=(e,t)=>{var o={};for(var i in e)di.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i]);if(e!=null&&Wo)for(var i of Wo(e))t.indexOf(i)<0&&ci.call(e,i)&&(o[i]=e[i]);return o};var $=(e,t,o)=>new Promise((i,n)=>{var r=d=>{try{p(o.next(d))}catch(s){n(s)}},l=d=>{try{p(o.throw(d))}catch(s){n(s)}},p=d=>d.done?i(d.value):Promise.resolve(d.value).then(r,l);p((o=o.apply(e,t)).next())});import Oo,{createContext as Fd,useEffect as lr,useState as qe}from"react";import{ThemeProvider as Nn}from"styled-components";import _t,{useContext as Rp,useEffect as ro,useState as Eo}from"react";import{useCallback as Lt,useContext as ba,useEffect as wa}from"react";import br,{useMemo as fi}from"react";var ui="1.38.9";var st="NOT_STARTED_STEP",de="COMPLETED_FLOW",It="SKIPPED_FLOW",Ot="STARTED_FLOW",Ue="NOT_STARTED_FLOW",Me="COMPLETED_STEP",yo="STARTED_STEP";function Re(){let{publicApiKey:e,userId:t,apiUrl:o}=br.useContext(re);return{config:fi(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":ui,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:fi(()=>`${o}/v1/public/`,[o])}}var pa="frigade-last-call-at-",da="frigade-last-call-data-";function qt(){let{shouldGracefullyDegrade:e,readonly:t}=br.useContext(re);return(o,i)=>$(this,null,function*(){if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Kt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Kt();let n=pa+o,r=da+o;if(typeof window!="undefined"&&window.localStorage&&i&&i.body&&i.method==="POST"){let p=window.localStorage.getItem(n),d=window.localStorage.getItem(r);if(p&&d&&d==i.body){let s=new Date(p);if(new Date().getTime()-s.getTime()<1e3)return Kt()}typeof window!="undefined"&&(window.localStorage.setItem(n,new Date().toISOString()),window.localStorage.setItem(r,i.body))}let l;try{l=yield fetch(o,i)}catch(p){return Kt(p)}return l?l.ok?l:Kt(l.statusText):Kt()})}function Kt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Yt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=br.useContext(re);function o(){return t?!1:e?!0:(console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider"),!1)}return{verifySDKInitiated:o}}import{useContext as Ca,useState as gi}from"react";import{useContext as ma,useEffect as ua,useState as fa}from"react";import ga from"swr";import{useContext as ca}from"react";function Ne(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:n}=ca(re);function r(c,g=!1){var S;return(S=e[c])!=null?S:g}function l(c,g){t(S=>j(w({},S),{[c]:g}))}function p(c){t(g=>{let h=g,{[c]:S}=h,F=$e(h,[mi(c)]);return w({},F)})}function d(c){n.includes(c)||i(g=>[...g,c])}function s(c){return n.includes(c)}function u(c){return Object.entries(e).some(([g,S])=>S&&g!=c)||o}return{getOpenFlowState:r,setOpenFlowState:l,resetOpenFlowState:p,hasOpenModals:u,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:s}}import ha from"swr/immutable";import So from"core-js-pure/actual/structured-clone";function wr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ue(...e){let t=e.shift(),o=e.length===1?e[0]:ue(...e);if(!wr(t)||!wr(o))throw new Error("deepmerge can only merge Objects");let i=So(t);return Object.entries(o).forEach(([n,r])=>{wr(r)?i[n]!==void 0?Object.assign(i,{[n]:ue(i[n],So(r))}):Object.assign(i,{[n]:So(r)}):Array.isArray(r)?i[n]!==void 0?Object.assign(i,{[n]:[...i[n],...So(r)]}):Object.assign(i,{[n]:So(r)}):Object.assign(i,{[n]:r})}),i}function Jt(e){try{return JSON.parse(e)}catch(t){return console.error("Failed to parse Frigade config.yml to JSON",t),null}}var xa="unknown";function _e(){let{config:e,apiUrl:t}=Re(),{publicApiKey:o,userId:i,organizationId:n,flows:r,setShouldGracefullyDegrade:l,readonly:p}=ma(re),{resetOpenFlowState:d}=Ne(),[s,u]=fa(!1),c={data:r.map(T=>({flowId:T.id,flowState:de,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},g=T=>fetch(T,e).then(N=>{if(N.ok)return N.json();throw new Error("Failed to fetch user flow states")}).catch(N=>(console.log(`Error fetching ${T}: ${N}. Will gracefully degrade and hide Frigade`),l(!0),c)),S=o&&r&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${n?`&foreignUserGroupId=${encodeURIComponent(n)}`:""}`:null,{data:F,isLoading:h,mutate:x,error:k}=p?ha(S,g):ga(S,g,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!1,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),b=F==null?void 0:F.data;ua(()=>{!s&&!h&&b&&u(!0)},[b,s,h]);function v(T){return $(this,null,function*(){if(b&&!p){let N=b.find(I=>I.flowId===T);N&&N.flowState!==de&&(N.flowState=de),yield x(Promise.resolve(ue(F,{data:b})),{optimisticData:ue(F,{data:b}),revalidate:!1,rollbackOnError:!1})}})}function M(T){return $(this,null,function*(){if(b&&!p){let N=b.find(I=>I.flowId===T);N&&N.flowState!==It&&(N.flowState=It),yield x(Promise.resolve(ue(F,{data:b})),{optimisticData:ue(F,{data:b}),revalidate:!1,rollbackOnError:!1})}})}function E(T,N,I){return $(this,null,function*(){var U,z;if(b){let G=b.find(_=>_.flowId===T);if(G){let _=r.find(Y=>Y.slug===T),K=Jt(_==null?void 0:_.data),q=(z=(U=K==null?void 0:K.steps)!=null?U:K==null?void 0:K.data)!=null?z:[],O=q.findIndex(Y=>Y.id===N),Z=q&&q.length>O+1?q[O+1]:null;Z&&(G.lastStepId=Z.id),G.stepStates[N]=I,G.flowState=Ot}p||(yield x(Promise.resolve(ue(F,{data:b})),{optimisticData:ue(F,{data:b}),revalidate:!1,rollbackOnError:!1}))}})}function f(T,N,I){return $(this,null,function*(){if(b){let U=b.find(z=>z.flowId===T);U&&(U.lastStepId=N,U.stepStates[N]=I,U.flowState=Ot),p||(yield x(ue(F,{data:b}),{optimisticData:ue(F,{data:b}),revalidate:!1,rollbackOnError:!1}))}})}function A(T){return $(this,null,function*(){if(b){let N=b.find(I=>I.flowId===T);N&&N.flowState!==Ue&&(N.flowState=Ue,N.lastStepId=xa,Object.keys(N.stepStates).forEach(I=>{N.stepStates[I].actionType=st,N.stepStates[I].createdAt=new Date().toISOString()}),yield x(ue(F,{data:b}),{optimisticData:ue(F,{data:b}),revalidate:!1,rollbackOnError:!1}),d(T))}})}function y(T,N,I){return $(this,null,function*(){if(b){let U=b.find(z=>z.flowId===T);U&&(U.stepStates[N]=I),yield x(Promise.resolve(ue(F,{data:b})),{optimisticData:ue(F,{data:b}),revalidate:!1,rollbackOnError:!1})}})}return{userFlowStatesData:b,isLoadingUserFlowStateData:!s,mutateUserFlowState:x,optimisticallyMarkFlowCompleted:v,optimisticallyMarkFlowSkipped:M,optimisticallyMarkFlowNotStarted:A,optimisticallyMarkStepCompleted:E,optimisticallyMarkStepNotStarted:y,optimisticallyMarkStepStarted:f,error:k}}function bo(){let{config:e,apiUrl:t}=Re(),{userFlowStatesData:o,mutateUserFlowState:i}=_e(),{failedFlowResponses:n,setFailedFlowResponses:r,flowResponses:l,setFlowResponses:p}=Ca(re),[d,s]=gi(new Set),[u,c]=gi(new Set),g=qt();function S(x){let k=JSON.stringify(x);if(d.has(k))return null;d.add(k),s(d),u.add(x),c(u);let b=l==null?void 0:l.find(v=>v.flowSlug===x.flowSlug&&v.stepId===x.stepId&&v.actionType===x.actionType&&v.createdAt===x.createdAt);return g(`${t}flowResponses`,j(w({},e),{method:"POST",body:k})).then(v=>{v.status!==200&&v.status!==201?(console.log("Failed to send flow response for step "+x.stepId+". Will retry again later."),r([...n,x])):b||p(M=>[...M!=null?M:[],x])})}function F(x){return $(this,null,function*(){x.foreignUserId&&(x.actionType===Ot||x.actionType===Ue?yield S(x):x.actionType===de?yield S(x):x.actionType===yo?yield S(x):x.actionType===Me?yield S(x):x.actionType===It?yield S(x):x.actionType===st&&(yield S(x)))})}function h(){let x=[];return o==null||o.forEach(k=>{if(k&&k.stepStates&&Object.keys(k.stepStates).length!==0)for(let b in k.stepStates){let v=k.stepStates[b];x.push({foreignUserId:k.foreignUserId,flowSlug:k.flowId,stepId:v.stepId,actionType:v.actionType,data:{},createdAt:new Date(v.createdAt),blocked:v.blocked,hidden:v.hidden})}}),[...x,...l]}return{addResponse:F,setFlowResponses:p,getFlowResponses:h}}import Ta from"swr";var ya=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,hi=e=>{let t=ya.exec(e);if(t===null)return null;let o=null;return t.forEach((i,n)=>{let r=Sa(i,"'","");r.startsWith("flow_")&&(o=r)}),o},Sa=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};var Tr=(s=>(s.CHECKLIST="CHECKLIST",s.FORM="FORM",s.TOUR="TOUR",s.SUPPORT="SUPPORT",s.CUSTOM="CUSTOM",s.BANNER="BANNER",s.EMBEDDED_TIP="EMBEDDED_TIP",s.NPS_SURVEY="NPS_SURVEY",s.ANNOUNCEMENT="ANNOUNCEMENT",s))(Tr||{});function ne(){let{config:e,apiUrl:t}=Re(),{flows:o,setFlows:i,userId:n,organizationId:r,publicApiKey:l,customVariables:p,setCustomVariables:d,hasActiveFullPageFlow:s,setHasActiveFullPageFlow:u,setFlowResponses:c,setShouldGracefullyDegrade:g,shouldGracefullyDegrade:S,readonly:F,flowDataOverrides:h}=ba(re),x={data:[]},{verifySDKInitiated:k}=Yt(),{addResponse:b,getFlowResponses:v}=bo(),M=m=>fetch(m,e).then(C=>C.ok?C.json():(console.log(`Error fetching ${m} (${C.status}): ${C.statusText}. Will gracefully degrade and hide Frigade`),g(!0),x)).catch(C=>(console.log(`Error fetching ${m}: ${C}. Will gracefully degrade and hide Frigade`),g(!0),x)),{mutateUserFlowState:E,userFlowStatesData:f,isLoadingUserFlowStateData:A,optimisticallyMarkFlowCompleted:y,optimisticallyMarkFlowSkipped:T,optimisticallyMarkFlowNotStarted:N,optimisticallyMarkStepCompleted:I,optimisticallyMarkStepNotStarted:U,optimisticallyMarkStepStarted:z}=_e(),{data:G,error:_,isLoading:K}=Ta(l?`${t}flows${F?"?readonly=true":""}`:null,M,{keepPreviousData:!0});wa(()=>{if(_){console.error(_);return}G&&G.data&&i(G.data)},[G,_]);function q(m){if(K)return null;let C=o.find(P=>P.slug===m);return!C&&o.length>0&&!A&&!K?(console.log(`Flow with id ${m} not found`),null):(C&&h&&h[m]&&(C.data=h[m]),(C==null?void 0:C.active)===!1&&!F?null:C)}function O(m){var W,Be,Et,At,Nt;if(!q(m))return[];let C=(W=q(m))==null?void 0:W.data;return C?(C=Z(C),((Nt=(At=(Be=Jt(C))==null?void 0:Be.data)!=null?At:(Et=Jt(C))==null?void 0:Et.steps)!=null?Nt:[]).map(ge=>{let xo=Ge(ge);return j(w({handleSecondaryButtonClick:()=>{ge.skippable===!0&&L(m,ge.id,{skipped:!0})}},ge),{complete:H(m,ge.id)===Me||xo>=1,started:H(m,ge.id)===yo||H(m,ge.id)===Me,currentlyActive:f==null?void 0:f.some(Co=>Co.flowId==m&&Co.lastStepId===ge.id),blocked:V(m,ge.id),hidden:te(m,ge.id),handlePrimaryButtonClick:()=>{(!ge.completionCriteria&&(ge.autoMarkCompleted||ge.autoMarkCompleted===void 0)||ge.completionCriteria&&ge.autoMarkCompleted===!0)&&L(m,ge.id)},progress:xo})}).filter(ge=>ge.hidden!==!0)):[]}function Z(m){return m.replaceAll(/\${(.*?)}/g,(C,P)=>p[P]===void 0?"":String(p[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 Y(m){var P;if(!q(m))return[];let C=q(m).data;return C?(C=Z(C),(P=JSON.parse(C))!=null?P:{}):[]}function se(m,C){d(P=>j(w({},P),{[m]:C}))}function Se(m){!A&&!K&&m&&JSON.stringify(p)!=JSON.stringify(w(w({},p),m))&&Object.keys(m).forEach(C=>{se(C,m[C])})}let ke=Lt((m,C,P)=>$(this,null,function*(){if(!k())return;let W={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:m,stepId:C,actionType:yo,data:P!=null?P:{},createdAt:new Date,blocked:!1,hidden:!1};pe(W)&&(yield z(m,C,W),b(W))}),[n,r,f]),R=Lt((m,C,P)=>$(this,null,function*(){if(!k())return;let W={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:m,stepId:C,actionType:st,data:P!=null?P:{},createdAt:new Date,blocked:!1,hidden:!1};pe(W)&&(yield U(m,C,W),b(W))}),[n,r,f]),L=Lt((m,C,P)=>$(this,null,function*(){if(!k())return;let W={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:m,stepId:C,actionType:Me,data:P!=null?P:{},createdAt:new Date,blocked:!1,hidden:!1};pe(W)&&(yield I(m,C,W),b(W))}),[n,r,f]),ie=Lt((m,C)=>$(this,null,function*(){if(!k()||xt(m)===Ue)return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:m,stepId:"unknown",actionType:Ue,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};yield N(m),pe(P)&&b(P)}),[n,r,f]),Pe=Lt((m,C)=>$(this,null,function*(){if(!k())return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:m,stepId:"unknown",actionType:Ot,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};pe(P)&&b(P)}),[n,r,f]),je=Lt((m,C)=>$(this,null,function*(){if(!k())return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:m,stepId:"unknown",actionType:de,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};pe(P)&&(yield y(m),b(P))}),[n,r,f]),ve=Lt((m,C)=>$(this,null,function*(){if(!k())return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:m,stepId:"unknown",actionType:It,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};pe(P)&&(yield T(m),b(P))}),[n,r,f]);function pe(m){var C;if(f===void 0)return!1;if(f){let P=f.find(W=>W.flowId===m.flowSlug);if(m.actionType===st&&(!(P!=null&&P.stepStates[m.stepId])||P.stepStates[m.stepId].actionType===st))return!1;if(P&&((C=P.stepStates[m.stepId])==null?void 0:C.actionType)===m.actionType){if(m.actionType===Me&&(!m.data||JSON.stringify(m.data)===JSON.stringify({})))return!1;let W=Object.keys(P.stepStates).sort((Be,Et)=>{let At=new Date(P.stepStates[Be].createdAt),Nt=new Date(P.stepStates[Et].createdAt);return At.getTime()-Nt.getTime()});if(P.stepStates[W[W.length-1]].actionType===m.actionType&&m.stepId===W[W.length-1])return!1}if(P&&P.flowState===de&&m.actionType===de)return!1}return!0}function H(m,C){let P=D(m,C);return A?null:P?P.actionType:st}function V(m,C){let P=D(m,C);return P?P.blocked:!1}function te(m,C){let P=D(m,C);return P?P.hidden:!1}function D(m,C){var W;if(A)return null;let P=f==null?void 0:f.find(Be=>Be.flowId===m);return!P||!P.stepStates[C]?null:(W=P.stepStates[C])!=null?W:null}function Q(m){var P,W;if(A||!f)return null;if(xt(m)===Ue)return(P=O(m)[0])!=null?P:null;let C=(W=f.find(Be=>Be.flowId===m))==null?void 0:W.lastStepId;return C?O(m).find(Be=>Be.id===C):null}function we(m){var W;let C=Q(m);if(!C)return 0;let P=(W=O(m).findIndex(Be=>Be.id===C.id))!=null?W:0;return H(m,C.id)===Me&&P<O(m).length-1?P+1:P}function Ge(m){if(!m.completionCriteria)return;let C=hi(m.completionCriteria);if(C===null)return;let P=Ye(C),W=nt(C);return W===0?void 0:P/W}function xt(m){let C=f==null?void 0:f.find(P=>P.flowId===m);return C?C.flowState:null}function Ye(m){let C=O(m);return C.length===0?0:C.filter(W=>H(m,W.id)===Me).length}function nt(m){return O(m).length}function Qe(m){let C=o.find(P=>P.slug===m);return C?(h&&h[m]&&(C.data=h[m]),Jt(C.data)):null}function vt(m){if(F)return!1;if(A||S)return!0;if(m!=null&&m.targetingLogic&&f){let C=f.find(P=>P.flowId===m.slug);if(C)return C.shouldTrigger===!1}return!!(m!=null&&m.targetingLogic&&n&&n.startsWith("guest_"))}function jt(m){let C=q(m);return(C==null?void 0:C.active)===!1?!1:!vt(q(m))}function Gt(){n&&E()}function Bt(){return o}return{getAllFlows:Bt,getFlow:q,getFlowData:Qe,isLoading:A||K,getStepStatus:H,getFlowSteps:O,getCurrentStepIndex:we,markStepStarted:ke,markStepCompleted:L,markFlowNotStarted:ie,markFlowStarted:Pe,markFlowCompleted:je,markFlowSkipped:ve,markStepNotStarted:R,getFlowStatus:xt,getNumberOfStepsCompleted:Ye,getNumberOfSteps:nt,targetingLogicShouldHideFlow:vt,setCustomVariable:se,updateCustomVariables:Se,customVariables:p,getStepOptionalProgress:Ge,getFlowMetadata:Y,isStepBlocked:V,isStepHidden:te,hasActiveFullPageFlow:s,setHasActiveFullPageFlow:u,isFlowAvailableToUser:jt,refresh:Gt}}import{useCallback as zo,useContext as Fa,useEffect as ka}from"react";var Xt="guest_";function wo(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:n}=Fa(re),{config:r,apiUrl:l}=Re(),{mutateUserFlowState:p}=_e(),d=qt(),{verifySDKInitiated:s}=Yt();function u(h){return`frigade-user-registered-${h}`}ka(()=>{if(e&&!t){if(e.startsWith(Xt))return;let h=u(e);localStorage.getItem(h)||(d(`${l}users`,j(w({},r),{method:"POST",body:JSON.stringify({foreignId:e})})),localStorage.setItem(h,"true"))}},[e,n,t]);let c=zo(h=>$(this,null,function*(){if(!s())return;let x={foreignId:e,properties:h};yield d(`${l}users`,j(w({},r),{method:"POST",body:JSON.stringify(x)})),i(k=>w(w({},k),h)),p()}),[e,r,n,p]),g=zo((h,x)=>$(this,null,function*(){if(!s())return;let b={foreignId:e,events:[{event:h,properties:x}]};yield d(`${l}users`,j(w({},r),{method:"POST",body:JSON.stringify(b)})),p()}),[e,r,p]),S=zo((h,x)=>$(this,null,function*(){if(s())if(x&&Object.keys(x).length>0){let k=u(h);localStorage.setItem(k,"true"),o(h);let b={foreignId:h,properties:x};yield d(`${l}users`,j(w({},r),{method:"POST",body:JSON.stringify(b)})),i(v=>w(w({},v),x)),p()}else o(h)}),[r,n,p]),F=zo(h=>$(this,null,function*(){if(!s())return;let x=typeof window!="undefined"?localStorage.getItem($t):null;if(console.log("id",localStorage.getItem($t)),!x)return;let k={foreignId:h,linkGuestId:x};yield d(`${l}users`,j(w({},r),{method:"POST",body:JSON.stringify(k)})),p()}),[r,n,p]);return{userId:e,setUserId:o,setUserIdWithProperties:S,addPropertiesToUser:c,trackEventForUser:g,linkExistingGuestSessionToUser:F}}import{v4 as ed}from"uuid";import rt,{useEffect as yn,useState as Xp}from"react";import Je,{useEffect as vr,useState as La}from"react";import Go from"styled-components";import Pa from"react";import va from"styled-components";var xi="fr-",To="cfr-";function a(e,t){let o=`${xi}${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+" "+To+e}return o}function B(e){if(!e.className||e.className.indexOf(To)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(xi)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Ho(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function Ee(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Ho(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Te(...e){return e.filter(Boolean).join(" ")}function Fo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ba=va.div`
|
|
2
|
+
var na=Object.defineProperty,sa=Object.defineProperties;var la=Object.getOwnPropertyDescriptors;var Wo=Object.getOwnPropertySymbols;var di=Object.prototype.hasOwnProperty,ci=Object.prototype.propertyIsEnumerable;var pi=(e,t,o)=>t in e?na(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))di.call(t,o)&&pi(e,o,t[o]);if(Wo)for(var o of Wo(t))ci.call(t,o)&&pi(e,o,t[o]);return e},V=(e,t)=>sa(e,la(t));var mi=e=>typeof e=="symbol"?e:e+"",$e=(e,t)=>{var o={};for(var i in e)di.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i]);if(e!=null&&Wo)for(var i of Wo(e))t.indexOf(i)<0&&ci.call(e,i)&&(o[i]=e[i]);return o};var L=(e,t,o)=>new Promise((i,n)=>{var r=d=>{try{p(o.next(d))}catch(s){n(s)}},l=d=>{try{p(o.throw(d))}catch(s){n(s)}},p=d=>d.done?i(d.value):Promise.resolve(d.value).then(r,l);p((o=o.apply(e,t)).next())});import Oo,{createContext as Td,useEffect as lr,useState as qe}from"react";import{ThemeProvider as In}from"styled-components";import _t,{useContext as Zp,useEffect as ro,useState as Eo}from"react";import{useCallback as Lt,useContext as Sa,useEffect as ba}from"react";import Sr,{useMemo as fi}from"react";var ui="1.38.11";var st="NOT_STARTED_STEP",de="COMPLETED_FLOW",Nt="SKIPPED_FLOW",Ot="STARTED_FLOW",De="NOT_STARTED_FLOW",Ue="COMPLETED_STEP",yo="STARTED_STEP";function Re(){let{publicApiKey:e,userId:t,apiUrl:o}=Sr.useContext(re);return{config:fi(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":ui,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:fi(()=>`${o}/v1/public/`,[o])}}var aa="frigade-last-call-at-",pa="frigade-last-call-data-";function qt(){let{shouldGracefullyDegrade:e,readonly:t}=Sr.useContext(re);return(o,i)=>L(this,null,function*(){if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Kt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Kt();let n=aa+o,r=pa+o;if(typeof window!="undefined"&&window.localStorage&&i&&i.body&&i.method==="POST"){let p=window.localStorage.getItem(n),d=window.localStorage.getItem(r);if(p&&d&&d==i.body){let s=new Date(p);if(new Date().getTime()-s.getTime()<1e3)return Kt()}typeof window!="undefined"&&(window.localStorage.setItem(n,new Date().toISOString()),window.localStorage.setItem(r,i.body))}let l;try{l=yield fetch(o,i)}catch(p){return Kt(p)}return l?l.ok?l:Kt(l.statusText):Kt()})}function Kt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Yt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=Sr.useContext(re);function o(){return t?!1:e?!0:(console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider"),!1)}return{verifySDKInitiated:o}}import{useContext as xa,useState as gi}from"react";import{useContext as ca,useEffect as ma,useState as ua}from"react";import fa from"swr";import{useContext as da}from"react";function Ie(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:n}=da(re);function r(c,g=!1){var S;return(S=e[c])!=null?S:g}function l(c,g){t(S=>V(w({},S),{[c]:g}))}function p(c){t(g=>{let h=g,{[c]:S}=h,F=$e(h,[mi(c)]);return w({},F)})}function d(c){n.includes(c)||i(g=>[...g,c])}function s(c){return n.includes(c)}function u(c){return Object.entries(e).some(([g,S])=>S&&g!=c)||o}return{getOpenFlowState:r,setOpenFlowState:l,resetOpenFlowState:p,hasOpenModals:u,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:s}}import ga from"swr/immutable";import So from"core-js-pure/actual/structured-clone";function br(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ue(...e){let t=e.shift(),o=e.length===1?e[0]:ue(...e);if(!br(t)||!br(o))throw new Error("deepmerge can only merge Objects");let i=So(t);return Object.entries(o).forEach(([n,r])=>{br(r)?i[n]!==void 0?Object.assign(i,{[n]:ue(i[n],So(r))}):Object.assign(i,{[n]:So(r)}):Array.isArray(r)?i[n]!==void 0?Object.assign(i,{[n]:[...i[n],...So(r)]}):Object.assign(i,{[n]:So(r)}):Object.assign(i,{[n]:r})}),i}function Jt(e){try{return JSON.parse(e)}catch(t){return console.error("Failed to parse Frigade config.yml to JSON",t),null}}var ha="unknown";function _e(){let{config:e,apiUrl:t}=Re(),{publicApiKey:o,userId:i,organizationId:n,flows:r,setShouldGracefullyDegrade:l,readonly:p}=ca(re),{resetOpenFlowState:d}=Ie(),[s,u]=ua(!1),c={data:r.map(T=>({flowId:T.id,flowState:de,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},g=T=>fetch(T,e).then(I=>{if(I.ok)return I.json();throw new Error("Failed to fetch user flow states")}).catch(I=>(console.log(`Error fetching ${T}: ${I}. Will gracefully degrade and hide Frigade`),l(!0),c)),S=o&&r&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${n?`&foreignUserGroupId=${encodeURIComponent(n)}`:""}`:null,{data:F,isLoading:h,mutate:x,error:k}=p?ga(S,g):fa(S,g,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!1,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),b=F==null?void 0:F.data;ma(()=>{!s&&!h&&b&&u(!0)},[b,s,h]);function v(T){return L(this,null,function*(){if(b&&!p){let I=b.find(N=>N.flowId===T);I&&I.flowState!==de&&(I.flowState=de),yield x(Promise.resolve(ue(F,{data:b})),{optimisticData:ue(F,{data:b}),revalidate:!1,rollbackOnError:!1})}})}function $(T){return L(this,null,function*(){if(b&&!p){let I=b.find(N=>N.flowId===T);I&&I.flowState!==Nt&&(I.flowState=Nt),yield x(Promise.resolve(ue(F,{data:b})),{optimisticData:ue(F,{data:b}),revalidate:!1,rollbackOnError:!1})}})}function E(T,I,N){return L(this,null,function*(){var D,z;if(b){let j=b.find(_=>_.flowId===T);if(j){let _=r.find(q=>q.slug===T),G=Jt(_==null?void 0:_.data),K=(z=(D=G==null?void 0:G.steps)!=null?D:G==null?void 0:G.data)!=null?z:[],O=K.findIndex(q=>q.id===I),ee=K&&K.length>O+1?K[O+1]:null;ee&&(j.lastStepId=ee.id),j.stepStates[I]=N,j.flowState=Ot}p||(yield x(Promise.resolve(ue(F,{data:b})),{optimisticData:ue(F,{data:b}),revalidate:!1,rollbackOnError:!1}))}})}function f(T,I,N){return L(this,null,function*(){if(b){let D=b.find(z=>z.flowId===T);D&&(D.lastStepId=I,D.stepStates[I]=N,D.flowState=Ot),p||(yield x(ue(F,{data:b}),{optimisticData:ue(F,{data:b}),revalidate:!1,rollbackOnError:!1}))}})}function A(T){return L(this,null,function*(){if(b){let I=b.find(N=>N.flowId===T);I&&I.flowState!==De&&(I.flowState=De,I.lastStepId=ha,Object.keys(I.stepStates).forEach(N=>{I.stepStates[N].actionType=st,I.stepStates[N].createdAt=new Date().toISOString()}),yield x(ue(F,{data:b}),{optimisticData:ue(F,{data:b}),revalidate:!1,rollbackOnError:!1}),d(T))}})}function y(T,I,N){return L(this,null,function*(){if(b){let D=b.find(z=>z.flowId===T);D&&(D.stepStates[I]=N),yield x(Promise.resolve(ue(F,{data:b})),{optimisticData:ue(F,{data:b}),revalidate:!1,rollbackOnError:!1})}})}return{userFlowStatesData:b,isLoadingUserFlowStateData:!s,mutateUserFlowState:x,optimisticallyMarkFlowCompleted:v,optimisticallyMarkFlowSkipped:$,optimisticallyMarkFlowNotStarted:A,optimisticallyMarkStepCompleted:E,optimisticallyMarkStepNotStarted:y,optimisticallyMarkStepStarted:f,error:k}}function bo(){let{config:e,apiUrl:t}=Re(),{userFlowStatesData:o,mutateUserFlowState:i}=_e(),{failedFlowResponses:n,setFailedFlowResponses:r,flowResponses:l,setFlowResponses:p}=xa(re),[d,s]=gi(new Set),[u,c]=gi(new Set),g=qt();function S(x){let k=JSON.stringify(x);if(d.has(k))return null;d.add(k),s(d),u.add(x),c(u);let b=l==null?void 0:l.find(v=>v.flowSlug===x.flowSlug&&v.stepId===x.stepId&&v.actionType===x.actionType&&v.createdAt===x.createdAt);return g(`${t}flowResponses`,V(w({},e),{method:"POST",body:k})).then(v=>{v.status!==200&&v.status!==201?(console.log("Failed to send flow response for step "+x.stepId+". Will retry again later."),r([...n,x])):b||p($=>[...$!=null?$:[],x])})}function F(x){return L(this,null,function*(){x.foreignUserId&&(x.actionType===Ot||x.actionType===De?yield S(x):x.actionType===de?yield S(x):x.actionType===yo?yield S(x):x.actionType===Ue?yield S(x):x.actionType===Nt?yield S(x):x.actionType===st&&(yield S(x)))})}function h(){let x=[];return o==null||o.forEach(k=>{if(k&&k.stepStates&&Object.keys(k.stepStates).length!==0)for(let b in k.stepStates){let v=k.stepStates[b];x.push({foreignUserId:k.foreignUserId,flowSlug:k.flowId,stepId:v.stepId,actionType:v.actionType,data:{},createdAt:new Date(v.createdAt),blocked:v.blocked,hidden:v.hidden})}}),[...x,...l]}return{addResponse:F,setFlowResponses:p,getFlowResponses:h}}import wa from"swr";var Ca=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,hi=e=>{let t=Ca.exec(e);if(t===null)return null;let o=null;return t.forEach((i,n)=>{let r=ya(i,"'","");r.startsWith("flow_")&&(o=r)}),o},ya=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};var wr=(s=>(s.CHECKLIST="CHECKLIST",s.FORM="FORM",s.TOUR="TOUR",s.SUPPORT="SUPPORT",s.CUSTOM="CUSTOM",s.BANNER="BANNER",s.EMBEDDED_TIP="EMBEDDED_TIP",s.NPS_SURVEY="NPS_SURVEY",s.ANNOUNCEMENT="ANNOUNCEMENT",s))(wr||{});function ne(){let{config:e,apiUrl:t}=Re(),{flows:o,setFlows:i,userId:n,organizationId:r,publicApiKey:l,customVariables:p,setCustomVariables:d,hasActiveFullPageFlow:s,setHasActiveFullPageFlow:u,setFlowResponses:c,setShouldGracefullyDegrade:g,shouldGracefullyDegrade:S,readonly:F,flowDataOverrides:h}=Sa(re),x={data:[]},{verifySDKInitiated:k}=Yt(),{addResponse:b,getFlowResponses:v}=bo(),$=m=>fetch(m,e).then(C=>C.ok?C.json():(console.log(`Error fetching ${m} (${C.status}): ${C.statusText}. Will gracefully degrade and hide Frigade`),g(!0),x)).catch(C=>(console.log(`Error fetching ${m}: ${C}. Will gracefully degrade and hide Frigade`),g(!0),x)),{mutateUserFlowState:E,userFlowStatesData:f,isLoadingUserFlowStateData:A,optimisticallyMarkFlowCompleted:y,optimisticallyMarkFlowSkipped:T,optimisticallyMarkFlowNotStarted:I,optimisticallyMarkStepCompleted:N,optimisticallyMarkStepNotStarted:D,optimisticallyMarkStepStarted:z}=_e(),{data:j,error:_,isLoading:G}=wa(l?`${t}flows${F?"?readonly=true":""}`:null,$,{keepPreviousData:!0});ba(()=>{if(_){console.error(_);return}j&&j.data&&i(j.data)},[j,_]);function K(m){if(G)return null;let C=o.find(P=>P.slug===m);return!C&&o.length>0&&!A&&!G?(console.log(`Flow with id ${m} not found`),null):(C&&h&&h[m]&&(C.data=h[m]),(C==null?void 0:C.active)===!1&&!F?null:C)}function O(m){var W,Be,Et,At,It;if(!K(m))return[];let C=(W=K(m))==null?void 0:W.data;return C?(C=ee(C),((It=(At=(Be=Jt(C))==null?void 0:Be.data)!=null?At:(Et=Jt(C))==null?void 0:Et.steps)!=null?It:[]).map(ge=>{let xo=Ge(ge);return V(w({handleSecondaryButtonClick:()=>{ge.skippable===!0&&U(m,ge.id,{skipped:!0})}},ge),{complete:H(m,ge.id)===Ue||xo>=1,started:H(m,ge.id)===yo||H(m,ge.id)===Ue,currentlyActive:f==null?void 0:f.some(Co=>Co.flowId==m&&Co.lastStepId===ge.id),blocked:J(m,ge.id),hidden:te(m,ge.id),handlePrimaryButtonClick:()=>{(!ge.completionCriteria&&(ge.autoMarkCompleted||ge.autoMarkCompleted===void 0)||ge.completionCriteria&&ge.autoMarkCompleted===!0)&&U(m,ge.id)},progress:xo})}).filter(ge=>ge.hidden!==!0)):[]}function ee(m){return m.replaceAll(/\${(.*?)}/g,(C,P)=>p[P]===void 0?"":String(p[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 q(m){var P;if(!K(m))return[];let C=K(m).data;return C?(C=ee(C),(P=JSON.parse(C))!=null?P:{}):[]}function se(m,C){d(P=>V(w({},P),{[m]:C}))}function Se(m){!A&&!G&&m&&JSON.stringify(p)!=JSON.stringify(w(w({},p),m))&&Object.keys(m).forEach(C=>{se(C,m[C])})}let ke=Lt((m,C,P)=>L(this,null,function*(){if(!k())return;let W={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:m,stepId:C,actionType:yo,data:P!=null?P:{},createdAt:new Date,blocked:!1,hidden:!1};pe(W)&&(yield z(m,C,W),b(W))}),[n,r,f]),Z=Lt((m,C,P)=>L(this,null,function*(){if(!k())return;let W={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:m,stepId:C,actionType:st,data:P!=null?P:{},createdAt:new Date,blocked:!1,hidden:!1};pe(W)&&(yield D(m,C,W),b(W))}),[n,r,f]),U=Lt((m,C,P)=>L(this,null,function*(){if(!k())return;let W={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:m,stepId:C,actionType:Ue,data:P!=null?P:{},createdAt:new Date,blocked:!1,hidden:!1};pe(W)&&(yield N(m,C,W),b(W))}),[n,r,f]),ie=Lt((m,C)=>L(this,null,function*(){if(!k()||xt(m)===De)return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:m,stepId:"unknown",actionType:De,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};yield I(m),pe(P)&&b(P)}),[n,r,f]),Pe=Lt((m,C)=>L(this,null,function*(){if(!k())return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:m,stepId:"unknown",actionType:Ot,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};pe(P)&&b(P)}),[n,r,f]),je=Lt((m,C)=>L(this,null,function*(){if(!k())return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:m,stepId:"unknown",actionType:de,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};pe(P)&&(yield y(m),b(P))}),[n,r,f]),ve=Lt((m,C)=>L(this,null,function*(){if(!k())return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:m,stepId:"unknown",actionType:Nt,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};pe(P)&&(yield T(m),b(P))}),[n,r,f]);function pe(m){var C;if(f===void 0)return!1;if(f){let P=f.find(W=>W.flowId===m.flowSlug);if(m.actionType===st&&(!(P!=null&&P.stepStates[m.stepId])||P.stepStates[m.stepId].actionType===st))return!1;if(P&&((C=P.stepStates[m.stepId])==null?void 0:C.actionType)===m.actionType){if(m.actionType===Ue&&(!m.data||JSON.stringify(m.data)===JSON.stringify({})))return!1;let W=Object.keys(P.stepStates).sort((Be,Et)=>{let At=new Date(P.stepStates[Be].createdAt),It=new Date(P.stepStates[Et].createdAt);return At.getTime()-It.getTime()});if(P.stepStates[W[W.length-1]].actionType===m.actionType&&m.stepId===W[W.length-1])return!1}if(P&&P.flowState===de&&m.actionType===de)return!1}return!0}function H(m,C){let P=M(m,C);return A?null:P?P.actionType:st}function J(m,C){let P=M(m,C);return P?P.blocked:!1}function te(m,C){let P=M(m,C);return P?P.hidden:!1}function M(m,C){var W;if(A)return null;let P=f==null?void 0:f.find(Be=>Be.flowId===m);return!P||!P.stepStates[C]?null:(W=P.stepStates[C])!=null?W:null}function Q(m){var P,W;if(A||!f)return null;if(xt(m)===De)return(P=O(m)[0])!=null?P:null;let C=(W=f.find(Be=>Be.flowId===m))==null?void 0:W.lastStepId;return C?O(m).find(Be=>Be.id===C):null}function we(m){var W;let C=Q(m);if(!C)return 0;let P=(W=O(m).findIndex(Be=>Be.id===C.id))!=null?W:0;return H(m,C.id)===Ue&&P<O(m).length-1?P+1:P}function Ge(m){if(!m.completionCriteria)return;let C=hi(m.completionCriteria);if(C===null)return;let P=Ye(C),W=nt(C);return W===0?void 0:P/W}function xt(m){let C=f==null?void 0:f.find(P=>P.flowId===m);return C?C.flowState:null}function Ye(m){let C=O(m);return C.length===0?0:C.filter(W=>H(m,W.id)===Ue).length}function nt(m){return O(m).length}function Qe(m){let C=o.find(P=>P.slug===m);return C?(h&&h[m]&&(C.data=h[m]),Jt(C.data)):null}function vt(m){if(F)return!1;if(A||S)return!0;if(m!=null&&m.targetingLogic&&f){let C=f.find(P=>P.flowId===m.slug);if(C)return C.shouldTrigger===!1}return!!(m!=null&&m.targetingLogic&&n&&n.startsWith("guest_"))}function jt(m){let C=K(m);return(C==null?void 0:C.active)===!1?!1:!vt(K(m))}function Gt(){n&&E()}function Bt(){return o}return{getAllFlows:Bt,getFlow:K,getFlowData:Qe,isLoading:A||G,getStepStatus:H,getFlowSteps:O,getCurrentStepIndex:we,markStepStarted:ke,markStepCompleted:U,markFlowNotStarted:ie,markFlowStarted:Pe,markFlowCompleted:je,markFlowSkipped:ve,markStepNotStarted:Z,getFlowStatus:xt,getNumberOfStepsCompleted:Ye,getNumberOfSteps:nt,targetingLogicShouldHideFlow:vt,setCustomVariable:se,updateCustomVariables:Se,customVariables:p,getStepOptionalProgress:Ge,getFlowMetadata:q,isStepBlocked:J,isStepHidden:te,hasActiveFullPageFlow:s,setHasActiveFullPageFlow:u,isFlowAvailableToUser:jt,refresh:Gt}}import{useCallback as zo,useContext as Ta,useEffect as Fa}from"react";var Xt="guest_";function wo(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:n}=Ta(re),{config:r,apiUrl:l}=Re(),{mutateUserFlowState:p}=_e(),d=qt(),{verifySDKInitiated:s}=Yt();function u(h){return`frigade-user-registered-${h}`}Fa(()=>{if(e&&!t){if(e.startsWith(Xt))return;let h=u(e);localStorage.getItem(h)||(d(`${l}users`,V(w({},r),{method:"POST",body:JSON.stringify({foreignId:e})})),localStorage.setItem(h,"true"))}},[e,n,t]);let c=zo(h=>L(this,null,function*(){if(!s())return;let x={foreignId:e,properties:h};yield d(`${l}users`,V(w({},r),{method:"POST",body:JSON.stringify(x)})),i(k=>w(w({},k),h)),p()}),[e,r,n,p]),g=zo((h,x)=>L(this,null,function*(){if(!s())return;let b={foreignId:e,events:[{event:h,properties:x}]};yield d(`${l}users`,V(w({},r),{method:"POST",body:JSON.stringify(b)})),p()}),[e,r,p]),S=zo((h,x)=>L(this,null,function*(){if(s())if(x&&Object.keys(x).length>0){let k=u(h);localStorage.setItem(k,"true"),o(h);let b={foreignId:h,properties:x};yield d(`${l}users`,V(w({},r),{method:"POST",body:JSON.stringify(b)})),i(v=>w(w({},v),x)),p()}else o(h)}),[r,n,p]),F=zo(h=>L(this,null,function*(){if(!s())return;let x=typeof window!="undefined"?localStorage.getItem($t):null;if(console.log("id",localStorage.getItem($t)),!x)return;let k={foreignId:h,linkGuestId:x};yield d(`${l}users`,V(w({},r),{method:"POST",body:JSON.stringify(k)})),p()}),[r,n,p]);return{userId:e,setUserId:o,setUserIdWithProperties:S,addPropertiesToUser:c,trackEventForUser:g,linkExistingGuestSessionToUser:F}}import{v4 as Rp}from"uuid";import rt,{useEffect as yn,useState as Jp}from"react";import Je,{useEffect as Pr,useState as Oa}from"react";import Go from"styled-components";import ka from"react";import Pa from"styled-components";var xi="fr-",To="cfr-";function a(e,t){let o=`${xi}${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+" "+To+e}return o}function B(e){if(!e.className||e.className.indexOf(To)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(xi)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Ho(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function Ee(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Ho(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Te(...e){return e.filter(Boolean).join(" ")}function Fo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var va=Pa.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -23,11 +23,11 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
23
23
|
opacity: 1;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
`,Ci=({onClose:e,appearance:t})=>
|
|
26
|
+
`,Ci=({onClose:e,appearance:t})=>ka.createElement(va,{className:a("modalBackground",t),onClick:()=>e()});import Tr from"react";import Ba from"styled-components";var Ea=Ba.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
|
-
`,
|
|
30
|
+
`,Ne=()=>Tr.createElement(Ea,null,Tr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 20 20"},Tr.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5 15L15 5M5 5l10 10"})));import{Portal as La}from"react-portal";import Ii from"react";import Fr from"react";function Aa({style:e,className:t}){return Fr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"54",height:"14",fill:"none",viewBox:"0 0 54 14",style:e,className:t},Fr.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"}),Fr.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 yi=Aa;import kr from"styled-components";import lt from"styled-components";var Vo=lt.div`
|
|
31
31
|
${e=>B(e)} {
|
|
32
32
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
33
33
|
}
|
|
@@ -52,7 +52,7 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
52
52
|
box-sizing: border-box;
|
|
53
53
|
:hover {
|
|
54
54
|
opacity: 0.8;
|
|
55
|
-
}`,
|
|
55
|
+
}`,Na=`
|
|
56
56
|
display: block;
|
|
57
57
|
cursor: pointer;
|
|
58
58
|
position: absolute;
|
|
@@ -62,7 +62,7 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
62
62
|
border: none;
|
|
63
63
|
`,Si=lt.button`
|
|
64
64
|
${e=>B(e)} {
|
|
65
|
-
${e=>e.hasImage?Ia:
|
|
65
|
+
${e=>e.hasImage?Ia:Na};
|
|
66
66
|
}
|
|
67
67
|
`,bi=lt.img`
|
|
68
68
|
${e=>B(e)} {
|
|
@@ -113,7 +113,7 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
113
113
|
color: #808080;
|
|
114
114
|
}
|
|
115
115
|
margin: 0;
|
|
116
|
-
`;var Bi=
|
|
116
|
+
`;var Bi=kr.div`
|
|
117
117
|
background-color: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
118
118
|
position: absolute;
|
|
119
119
|
bottom: -47px;
|
|
@@ -124,7 +124,7 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
124
124
|
align-items: center;
|
|
125
125
|
justify-content: center;
|
|
126
126
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
127
|
-
`,Ei=
|
|
127
|
+
`,Ei=kr(Vo)`
|
|
128
128
|
background-color: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
129
129
|
position: absolute;
|
|
130
130
|
bottom: -60px;
|
|
@@ -137,7 +137,7 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
137
137
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
138
138
|
padding: 0;
|
|
139
139
|
z-index: ${e=>e.zIndex};
|
|
140
|
-
`,Ai=
|
|
140
|
+
`,Ai=kr.div`
|
|
141
141
|
display: flex;
|
|
142
142
|
justify-content: center;
|
|
143
143
|
align-items: center;
|
|
@@ -146,7 +146,7 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
146
146
|
font-size: 12px;
|
|
147
147
|
line-height: 18px;
|
|
148
148
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
149
|
-
`;function jo({appearance:e}){return
|
|
149
|
+
`;function jo({appearance:e}){return Ii.createElement(Ai,{className:a("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",Ii.createElement(yi,null))}var $a=Go.div`
|
|
150
150
|
${e=>B(e)} {
|
|
151
151
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
152
152
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -188,10 +188,10 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
188
188
|
opacity: 1;
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
`,
|
|
191
|
+
`,Ma=Go.div`
|
|
192
192
|
position: relative;
|
|
193
193
|
flex: 0 1 auto;
|
|
194
|
-
`,
|
|
194
|
+
`,Da=Go.div`
|
|
195
195
|
position: absolute;
|
|
196
196
|
top: 16px;
|
|
197
197
|
right: 16px;
|
|
@@ -201,14 +201,14 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
201
201
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
202
202
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
203
203
|
}
|
|
204
|
-
`,
|
|
204
|
+
`,Ua=Go.div`
|
|
205
205
|
overflow: scroll;
|
|
206
206
|
flex: 1 1;
|
|
207
207
|
display: flex;
|
|
208
208
|
::-webkit-scrollbar {
|
|
209
209
|
display: none;
|
|
210
210
|
}
|
|
211
|
-
`,et=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:n,appearance:r,dismissible:l=!0,showFrigadeBranding:p=!1})=>{let[d,s]=
|
|
211
|
+
`,et=({onClose:e,visible:t,headerContent:o=null,style:i=null,children:n,appearance:r,dismissible:l=!0,showFrigadeBranding:p=!1})=>{let[d,s]=Oa("");return Pr(()=>{let u=getComputedStyle(document.body).getPropertyValue("overflow");s(u)},[]),Pr(()=>{let u=c=>{c.key==="Escape"&&e()};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[e]),Pr(()=>{let u=document.body.style;return t?u.setProperty("overflow","hidden"):u.setProperty("overflow",d),()=>{u.setProperty("overflow",d)}},[t]),t?Je.createElement(La,null,Je.createElement(Ci,{appearance:r,onClose:()=>{l&&e()}}),Je.createElement($a,{appearance:r,className:a("modalContainer",r),styleOverrides:i},l&&Je.createElement(Da,{className:a("modalClose",r),onClick:()=>e(),appearance:r},Je.createElement(Ne,null)),o&&Je.createElement(Ma,null,o),Je.createElement(Ua,null,n),p&&Je.createElement(Bi,{appearance:r,className:a("poweredByFrigadeRibbon",r)},Je.createElement(jo,{appearance:r})))):Je.createElement(Je.Fragment,null)};import Ct,{useEffect as vr,useState as _a}from"react";import Ko from"styled-components";import{Portal as Wa}from"react-portal";function za(e){switch(e){case"top-left":return`
|
|
212
212
|
top: 0;
|
|
213
213
|
left: 0;
|
|
214
214
|
`;case"top-right":return`
|
|
@@ -217,7 +217,7 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
217
217
|
`;case"bottom-left":return`
|
|
218
218
|
bottom: 0;
|
|
219
219
|
left: 0;
|
|
220
|
-
`}return"right: 0; bottom: 0;"}var
|
|
220
|
+
`}return"right: 0; bottom: 0;"}var Ha=Ko.div`
|
|
221
221
|
${e=>B(e)} {
|
|
222
222
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
223
223
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -231,12 +231,12 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
231
231
|
width: 350px;
|
|
232
232
|
padding: 24px;
|
|
233
233
|
}
|
|
234
|
-
${e=>
|
|
234
|
+
${e=>za(e.modalPosition)}
|
|
235
235
|
margin: 28px;
|
|
236
|
-
`,
|
|
236
|
+
`,Va=Ko.div`
|
|
237
237
|
position: relative;
|
|
238
238
|
flex: 1;
|
|
239
|
-
`,
|
|
239
|
+
`,ja=Ko.div`
|
|
240
240
|
position: absolute;
|
|
241
241
|
top: 16px;
|
|
242
242
|
right: 16px;
|
|
@@ -246,13 +246,13 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
246
246
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
247
247
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
248
248
|
}
|
|
249
|
-
`,
|
|
249
|
+
`,Ga=Ko.div`
|
|
250
250
|
overflow: scroll;
|
|
251
251
|
flex: 5;
|
|
252
252
|
::-webkit-scrollbar {
|
|
253
253
|
display: none;
|
|
254
254
|
}
|
|
255
|
-
`,qo=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:n,modalPosition:r="bottom-right",dismissible:l=!0})=>{let[p,d]=
|
|
255
|
+
`,qo=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:n,modalPosition:r="bottom-right",dismissible:l=!0})=>{let[p,d]=_a("");return vr(()=>{let s=getComputedStyle(document.body).getPropertyValue("overflow");d(s)},[]),vr(()=>{let s=u=>{u.key==="Escape"&&e()};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[e]),vr(()=>{let s=document.body.style;return t?s.setProperty("overflow","hidden"):s.setProperty("overflow",p),()=>{s.setProperty("overflow",p)}},[t]),t?Ct.createElement(Wa,null,Ct.createElement(Ha,{appearance:n,className:a("cornerModalContainer",n),modalPosition:r},l&&Ct.createElement(ja,{className:a("cornerModalClose",n),onClick:()=>e()},Ct.createElement(Ne,null)),o&&Ct.createElement(Va,null,o),Ct.createElement(Ga,null,i))):Ct.createElement(Ct.Fragment,null)};import{useContext as Ka}from"react";function ce(){let{defaultAppearance:e}=Ka(re);function t(o){var n,r,l;let i=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign((n=i.styleOverrides)!=null?n:{},(r=o.styleOverrides)!=null?r:{}),theme:Object.assign(i.theme,(l=o.theme)!=null?l:{})}:i}return{mergeAppearanceWithDefault:t}}import Mt,{useContext as fp,useEffect as Yi,useState as Dr}from"react";import Zo from"styled-components";import Xo,{useEffect as Di,useState as Ar}from"react";import Ir from"styled-components";import Yo from"styled-components";var Ni=Yo.label`
|
|
256
256
|
${e=>B(e)} {
|
|
257
257
|
font-size: 12px;
|
|
258
258
|
line-height: 18px;
|
|
@@ -283,11 +283,11 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
283
283
|
align-items: flex-start;
|
|
284
284
|
justify-content: left;
|
|
285
285
|
margin-bottom: 10px;
|
|
286
|
-
`;import
|
|
286
|
+
`;import Br from"react";var at={theme:{colorPrimary:"#0171F8",colorSecondary:"#2E343D",colorText:"#0F1114",colorBackground:"#ffffff",colorBackgroundSecondary:"#d2d2d2",colorTextOnPrimaryBackground:"#ffffff",colorTextSecondary:"#2E343D",colorTextDisabled:"#5A6472",colorBorder:"#E5E5E5",colorTextError:"#c00000",colorTextSuccess:"#00D149",borderRadius:10}};function yt({title:e,required:t,appearance:o=at}){return e?Br.createElement(Jo,{className:a("formLabelWrapper",o)},t?Br.createElement(Li,{className:a("formLabelRequired",o),appearance:o},"*"):null,Br.createElement(Ni,{className:a("formLabel",o)},e)):null}import $i from"react";function Qt({title:e,appearance:t}){return e?$i.createElement(Jo,null,$i.createElement(Oi,{className:a("formSubLabel",t)},e)):null}import{z as Er}from"zod";function Mi(e,t){var o,i,n,r,l,p,d;try{if(t){if(t.type=="number"){let s=Er.number();if(t.props)for(let u of t.props)u.requirement=="min"?s=s.min(Number(u.value),(o=u.message)!=null?o:"Value is too small"):u.requirement=="max"?s=s.max(Number(u.value),(i=u.message)!=null?i:"Value is too large"):u.requirement=="positive"?s=s.positive((n=u.message)!=null?n:"Value must be positive"):u.requirement=="negative"&&(s=s.nonpositive((r=u.message)!=null?r:"Value must be negative"));s.parse(Number(e))}if(t.type=="string"){let s=Er.string();if(t.props)for(let u of t.props)u.requirement=="min"?s=s.min(Number(u.value),(l=u.message)!=null?l:"Value is too short"):u.requirement=="max"?s=s.max(Number(u.value),(p=u.message)!=null?p:"Value is too long"):u.requirement=="regex"&&(s=s.regex(new RegExp(String(u.value)),(d=u.message)!=null?d:"Value does not match requirements"));s.parse(e)}return}}catch(s){if(s instanceof Er.ZodError)return s.issues&&s.issues.length>0?s.issues[0].message:null;console.error("Frigade Form validation failed for rule ",t,s)}return null}var qa=Ir.div`
|
|
287
287
|
display: flex;
|
|
288
288
|
flex-direction: column;
|
|
289
289
|
width: 100%;
|
|
290
|
-
`,
|
|
290
|
+
`,Nr=Ir.input`
|
|
291
291
|
${e=>B(e)} {
|
|
292
292
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
293
293
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -303,7 +303,7 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
303
303
|
box-sizing: border-box;
|
|
304
304
|
padding: 0 10px;
|
|
305
305
|
margin-bottom: 10px;
|
|
306
|
-
`,
|
|
306
|
+
`,Ya=Ir.textarea`
|
|
307
307
|
${e=>B(e)} {
|
|
308
308
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
309
309
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -320,13 +320,13 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
320
320
|
box-sizing: border-box;
|
|
321
321
|
margin-bottom: 10px;
|
|
322
322
|
resize: none;
|
|
323
|
-
`;function
|
|
323
|
+
`;function Or({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:n}){let r=e,[l,p]=Ar((n==null?void 0:n.text)||""),[d,s]=Ar(!1),[u,c]=Ar(!1),g=Nr;Di(()=>{l===""&&!d&&(s(!0),S(""))},[]),Di(()=>{if(u){S(l);return}},[u]);function S(h){var k;if(p(h),o({text:h}),r.required===!0&&h.trim()===""){i([{id:r.id,message:`${(k=r.title)!=null?k:"Field"} is required`,hidden:!u}]);return}let x=Mi(h,r.validation);if(x&&(h.trim()!==""||r.required===!0)){i([{id:r.id,message:x,hidden:!u}]);return}i([])}r.multiline&&(g=Ya);function F(){var h;switch((h=r==null?void 0:r.validation)==null?void 0:h.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return Xo.createElement(qa,null,Xo.createElement(yt,{title:r.title,required:r.required,appearance:t.appearance}),Xo.createElement(g,{className:a("inputComponent",t.appearance),value:l,onChange:h=>{S(h.target.value)},appearance:t.appearance,placeholder:r.placeholder,type:F(),onBlur:()=>{c(!0)}}),Xo.createElement(Qt,{title:r.subtitle,appearance:t.appearance}))}import tt,{useEffect as Ui,useState as _i}from"react";import Wi from"styled-components";var Lr="",Ja=Wi.div`
|
|
324
324
|
display: flex;
|
|
325
325
|
flex-direction: column;
|
|
326
326
|
width: 100%;
|
|
327
327
|
-webkit-appearance: none;
|
|
328
328
|
appearance: none;
|
|
329
|
-
`,
|
|
329
|
+
`,Xa=Wi.select`
|
|
330
330
|
${e=>B(e)} {
|
|
331
331
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
332
332
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -347,15 +347,15 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
347
347
|
background-repeat: no-repeat;
|
|
348
348
|
background-size: 1.5em 1.5em;
|
|
349
349
|
-webkit-print-color-adjust: exact;
|
|
350
|
-
`;function zi({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var u,c,g,S,F,h,x,k,b;let r=e,[l,p]=_i(!1),[d,s]=_i(!1);return Ui(()=>{var v
|
|
350
|
+
`;function zi({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var u,c,g,S,F,h,x,k,b;let r=e,[l,p]=_i(!1),[d,s]=_i(!1);return Ui(()=>{var v,$,E,f;if(!((v=i==null?void 0:i.choice)!=null&&v[0])&&!l){if(p(!0),r.requireSelection){o({choice:[Lr]});return}if(r.defaultValue&&(($=r.props.options)!=null&&$.find(A=>A.id===r.defaultValue))){let A=(E=r.props.options)==null?void 0:E.find(y=>y.id===r.defaultValue);o({choice:[A.id]})}else o({choice:[((f=r.props.options)==null?void 0:f[0].id)||""]})}},[]),Ui(()=>{var v;d&&(r.requireSelection&&((v=i==null?void 0:i.choice)==null?void 0:v[0])===Lr?n([{message:"Please select an option",id:r.id}]):n([]))},[(u=i==null?void 0:i.choice)==null?void 0:u[0],d]),tt.createElement(Ja,null,tt.createElement(yt,{title:r.title,required:!1,appearance:t.appearance}),tt.createElement(Xa,{value:(c=i==null?void 0:i.choice)==null?void 0:c[0],onChange:v=>{s(!0),o({choice:[v.target.value]})},placeholder:r.placeholder,appearance:t.appearance,className:a("multipleChoiceSelect",t.appearance)},r.requireSelection&&tt.createElement("option",{key:"null-value",value:Lr,disabled:!0},(g=r.placeholder)!=null?g:"Select an option"),(S=r.props.options)==null?void 0:S.map(v=>tt.createElement("option",{key:v.id,value:v.id},v.title))),((h=(F=r.props.options)==null?void 0:F.find(v=>{var $;return v.id===(($=i==null?void 0:i.choice)==null?void 0:$[0])}))==null?void 0:h.isOpenEnded)&&tt.createElement(tt.Fragment,null,tt.createElement(yt,{title:(b=(k=(x=r.props.options)==null?void 0:x.find(v=>{var $;return v.id===(($=i==null?void 0:i.choice)==null?void 0:$[0])}))==null?void 0:k.openEndedLabel)!=null?b:"Please specify",required:!1,appearance:t.appearance}),tt.createElement(Nr,{type:"text",placeholder:"Enter your answer here",onChange:v=>{o({choice:[v.target.value]})},appearance:t.appearance})),tt.createElement(Qt,{title:r.subtitle,appearance:t.appearance}))}import vo,{useEffect as $r,useState as Vi}from"react";import ji from"styled-components";import Po from"react";import ko from"react";var Hi=({color:e,percentage:t,size:o})=>{let i=o*.5-2,n=2*Math.PI*i,r=(1-t)*n;return ko.createElement("circle",{r:i,cx:o*.5,cy:o*.5,fill:"transparent",stroke:r!==n?e:"",strokeWidth:"3px",strokeDasharray:n,strokeDashoffset:t?r:0})},Qa=({fillColor:e,size:t,percentage:o,children:i,bgColor:n="#D9D9D9",className:r,style:l})=>ko.createElement("svg",{style:l,className:r,width:t,height:t,overflow:"visible"},ko.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},ko.createElement(Hi,{color:n,size:t}),ko.createElement(Hi,{color:e,percentage:Math.max(o,.1),size:t})),i),Zt=Qa;import Za from"styled-components";var Ra=({color:e="#FFFFFF"})=>Po.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Po.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),ep={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},tp={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},op={border:"1px solid #000000",color:"#FFFFFF"},rp={border:"1px solid #C5CBD3"},ip={color:"#FFFFFF"},np={border:"1px solid #C5CBD3"},sp=e=>e==="square"?ep:tp,lp=(e,t)=>e==="square"?t?op:rp:t?ip:np,ap=Za.div`
|
|
351
351
|
${e=>Ee(e)}
|
|
352
|
-
`,pt=({value:e,type:t="round",primaryColor:o="#000000",progress:i,appearance:n=at,style:r,className:l})=>{let p=
|
|
352
|
+
`,pt=({value:e,type:t="round",primaryColor:o="#000000",progress:i,appearance:n=at,style:r,className:l})=>{let p=sp(t),d=lp(t,e);return e===!0?p=V(w(w({},p),d),{backgroundColor:n.theme.colorTextSuccess,borderColor:t==="square"?o:"none"}):p=w(w({},p),d),e!==!0&&t==="round"&&i!==void 0&&i!==1?Po.createElement(Zt,{fillColor:o,percentage:i,size:22}):Po.createElement(ap,{styleOverrides:p,style:r,role:"checkbox",className:Te(a("checkIconContainer",n),a(e?"checkIconContainerChecked":"checkIconContainerUnchecked",n),e?"checkIconContainerChecked":"checkIconContainerUnchecked",l)},e&&Po.createElement(Ra,{color:"#FFFFFF"}))};var pp=ji.div`
|
|
353
353
|
display: flex;
|
|
354
354
|
flex-direction: column;
|
|
355
355
|
width: 100%;
|
|
356
356
|
-webkit-appearance: none;
|
|
357
357
|
appearance: none;
|
|
358
|
-
`,
|
|
358
|
+
`,dp=ji.button`
|
|
359
359
|
${e=>B(e)} {
|
|
360
360
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
361
361
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -380,7 +380,7 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
380
380
|
height: 48px;
|
|
381
381
|
padding: 0 18px;
|
|
382
382
|
margin-bottom: 10px;
|
|
383
|
-
`;function Gi({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var u;let r=e,[l,p]=Vi((i==null?void 0:i.choice)||[]),[d,s]=Vi(!1);return
|
|
383
|
+
`;function Gi({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var u;let r=e,[l,p]=Vi((i==null?void 0:i.choice)||[]),[d,s]=Vi(!1);return $r(()=>{l.length==0&&!d&&(s(!0),o({choice:[]}))},[]),$r(()=>{o({choice:l})},[l]),$r(()=>{r.required&&(l.length<r.props.minChoices||l.length>r.props.maxChoices)?n([{message:"",id:r.id}]):n([])},[l]),vo.createElement(pp,null,vo.createElement(yt,{title:r.title,required:r.required,appearance:t.appearance}),(u=r.props.options)==null?void 0:u.map(c=>vo.createElement(dp,{appearance:t.appearance,className:a(l.includes(c.id)?"multipleChoiceListItemSelected":"multipleChoiceListItem",t.appearance),key:c.id,value:c.id,"data-selected":l.includes(c.id),onClick:()=>{if(l.includes(c.id)){p(l.filter(g=>g!==c.id));return}l.length<r.props.maxChoices?p([...l,c.id]):l.length==1&&r.props.maxChoices==1&&p([c.id])}},c.title,vo.createElement(pt,{type:"round",primaryColor:t.appearance.theme.colorPrimary,value:l.includes(c.id),appearance:t.appearance}))),vo.createElement(Qt,{title:r.subtitle,appearance:t.appearance}))}import Qo from"react";import Ki from"styled-components";import cp from"dompurify";function R(e){return e?{__html:cp.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img","code","li","ul","table","tbody","thead","tr","td","th","h1","h2","h3","h4"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}:{__html:""}}var mp=Ki.h1`
|
|
384
384
|
${e=>B(e)} {
|
|
385
385
|
font-style: normal;
|
|
386
386
|
font-weight: 700;
|
|
@@ -392,7 +392,7 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
392
392
|
margin-bottom: 4px;
|
|
393
393
|
color: ${e=>e.appearance.theme.colorText};
|
|
394
394
|
}
|
|
395
|
-
`,
|
|
395
|
+
`,up=Ki.h2`
|
|
396
396
|
${e=>B(e)} {
|
|
397
397
|
font-style: normal;
|
|
398
398
|
font-weight: 400;
|
|
@@ -401,25 +401,25 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
401
401
|
letter-spacing: 0.28px;
|
|
402
402
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
403
403
|
}
|
|
404
|
-
`;function Oe({appearance:e,title:t,subtitle:o,size:i="medium",classPrefix:n="",ariaPrefix:r=""}){return Qo.createElement(Qo.Fragment,null,Qo.createElement(
|
|
404
|
+
`;function Oe({appearance:e,title:t,subtitle:o,size:i="medium",classPrefix:n="",ariaPrefix:r=""}){return Qo.createElement(Qo.Fragment,null,Qo.createElement(mp,{appearance:e,id:r?`frigade${r}Title`:"frigadeTitle",className:a(`${n}${n?Fo(i):i}Title`,e),dangerouslySetInnerHTML:R(t),size:i}),o&&Qo.createElement(up,{id:r?`frigade${r}Subtitle`:"frigadeSubtitle",appearance:e,className:a(`${n}${n?Fo(i):i}Subtitle`,e),dangerouslySetInnerHTML:R(o),size:i}))}import*as Mr from"react";var qi=e=>Mr.createElement("svg",w({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,"aria-hidden":"true",viewBox:"0 0 16 16"},e),Mr.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"m10.115 1.308 5.635 11.269A2.365 2.365 0 0 1 13.634 16H2.365A2.365 2.365 0 0 1 .25 12.577L5.884 1.308a2.365 2.365 0 0 1 4.231 0zM8 10.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM8 9c.552 0 1-.32 1-.714V4.714C9 4.32 8.552 4 8 4s-1 .32-1 .714v3.572C7 8.68 7.448 9 8 9z"}));var gp=Zo.div`
|
|
405
405
|
display: flex;
|
|
406
406
|
flex-direction: column;
|
|
407
407
|
justify-content: flex-end;
|
|
408
408
|
overflow: visible;
|
|
409
409
|
padding-top: 14px;
|
|
410
|
-
`,
|
|
410
|
+
`,hp=Zo.div`
|
|
411
411
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextError}};
|
|
412
412
|
font-size: 12px;
|
|
413
413
|
margin-bottom: 12px;
|
|
414
414
|
display: flex;
|
|
415
415
|
align-items: center;
|
|
416
|
-
`,
|
|
416
|
+
`,xp=Zo.div`
|
|
417
417
|
margin-right: 4px;
|
|
418
418
|
display: inline-flex;
|
|
419
|
-
`,
|
|
419
|
+
`,Cp=Zo.div`
|
|
420
420
|
padding-left: 1px;
|
|
421
421
|
padding-right: 1px;
|
|
422
|
-
`,
|
|
422
|
+
`,yp={text:Or,multipleChoice:zi,multipleChoiceList:Gi},Ur="frigade-multiInputStepTypeData";function Ji({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r,customFormElements:l,prefillData:p}){var E;let d=t.props,[s,u]=Dr([]),[c,g]=Dr([]),{userId:S}=wo(),[F,h]=Dr(v()||(p?p[t.id]:null)||{}),{readonly:x}=fp(re),k=w(w({},yp),l);Yi(()=>{i(s.length===0)},[s,i]),Yi(()=>{n(F)},[F]);function b(f,A){h(y=>{let T=V(w({},y),{[f.id]:A});return typeof window!="undefined"&&window.localStorage&&!x&&window.localStorage.setItem($(),JSON.stringify(T)),T})}function v(){if(typeof window!="undefined"&&window.localStorage){let f=window.localStorage.getItem($());if(f)return JSON.parse(f)}return null}function $(){return`${Ur}-${e}-${t.id}-${S}`}return Mt.createElement(Cp,{className:a("multiInput",r)},Mt.createElement(Oe,{appearance:r,title:t.title,subtitle:t.subtitle}),Mt.createElement(gp,{className:a("multiInputContainer",r)},(E=d==null?void 0:d.data)==null?void 0:E.map(f=>{let A=s.reverse().find(y=>y.id===f.id);return k[f.type]?Mt.createElement("span",{key:f.id,"data-field-id":f.id,className:a("multiInputField",r)},k[f.type]({formInput:f,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r},onSaveInputData:y=>{!c.includes(f.id)&&y&&(y==null?void 0:y.text)!==""&&g(T=>[...T,f.id]),b(f,y)},inputData:F[f.id],setFormValidationErrors:y=>{y.length===0&&s.length===0||u(T=>y.length===0?T.filter(I=>I.id!==f.id):[...T,...y])}}),A&&A.message&&c.includes(f.id)&&A.hidden!==!0&&Mt.createElement(hp,{key:f.id,style:{overflow:"hidden"},appearance:r,className:a("multiInputValidationError",r)},Mt.createElement(xp,{appearance:r,className:a("multiInputValidationErrorIcon",r)},Mt.createElement(qi,null)),A.message)):null})))}import Rt from"styled-components";var Xi=Rt.div`
|
|
423
423
|
align-items: center;
|
|
424
424
|
display: flex;
|
|
425
425
|
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
@@ -456,7 +456,7 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
456
456
|
background-position: center;
|
|
457
457
|
border-top-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
458
458
|
border-bottom-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
459
|
-
`;import St from"react";import rn from"react";import nn from"styled-components";import
|
|
459
|
+
`;import St from"react";import rn from"react";import nn from"styled-components";import Sp from"styled-components";var on=Sp.div`
|
|
460
460
|
width: 24px;
|
|
461
461
|
height: 24px;
|
|
462
462
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
@@ -474,7 +474,7 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
474
474
|
transform: rotate(360deg);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
`;var
|
|
477
|
+
`;var bp=nn.button`
|
|
478
478
|
justify-content: center;
|
|
479
479
|
align-content: center;
|
|
480
480
|
align-items: center;
|
|
@@ -518,15 +518,15 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
518
518
|
margin-right: 8px;
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
`,le=({onClick:e,title:t,style:o,disabled:i,type:n="inline",size:r="medium",secondary:l=!1,appearance:p,withMargin:d=!0,classPrefix:s="",loading:u=!1,autoFocus:c=!1})=>{var S;function g(){let F=l?"buttonSecondary":"button";return s===""?F:`${s}${Fo(F)}`}return rn.createElement(
|
|
521
|
+
`,le=({onClick:e,title:t,style:o,disabled:i,type:n="inline",size:r="medium",secondary:l=!1,appearance:p,withMargin:d=!0,classPrefix:s="",loading:u=!1,autoFocus:c=!1})=>{var S;function g(){let F=l?"buttonSecondary":"button";return s===""?F:`${s}${Fo(F)}`}return rn.createElement(bp,{tabindex:l?"0":"1",secondary:l,appearance:p,disabled:i||u,loading:(S=u==null?void 0:u.toString())!=null?S:"",onClick:e,styleOverrides:o,type:n,withMargin:d,size:r,className:a(g(),p),autoFocus:c},u?rn.createElement(on,{className:a("buttonLoader",p)}):t!=null?t:"Continue")};var sn=({step:e,canContinue:t,appearance:o,onPrimaryClick:i,onSecondaryClick:n,selectedStep:r,steps:l,onBack:p,allowBackNavigation:d,errorMessage:s,isSaving:u})=>{var S;let c=l.length>1&&r!=0&&d,g=e.primaryButtonTitle&&e.secondaryButtonTitle||c?"inline":"full-width";return St.createElement(St.Fragment,null,s!==null&&s!=null&&St.createElement(Qi,{appearance:o,className:a("formCTAError",o)},s),St.createElement(Xi,{showBackButton:c,className:a("formCTAContainer",o)},c&&St.createElement(le,{title:(S=e.backButtonTitle)!=null?S:"Back",onClick:p,secondary:!0,withMargin:!1,type:g,appearance:o,style:{width:"90px",maxWidth:"90px"},classPrefix:"back"}),St.createElement(Zi,{className:a("ctaWrapper",o)},e.secondaryButtonTitle?St.createElement(le,{title:e.secondaryButtonTitle,onClick:n,secondary:!0,withMargin:!1,type:g,appearance:o,disabled:u}):null," ",e.primaryButtonTitle?St.createElement(le,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:i,type:g,appearance:o,loading:u}):null)))};import _r from"react";import wp from"styled-components";var Tp=wp.div`
|
|
522
522
|
text-align: center;
|
|
523
523
|
color: #e6e6e6;
|
|
524
|
-
`,er=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:n}=ce().mergeAppearanceWithDefault(i);return
|
|
524
|
+
`,er=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:n}=ce().mergeAppearanceWithDefault(i);return _r.createElement(Tp,{className:o},_r.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((r,l)=>_r.createElement("rect",{key:l,x:16*l,y:0,width:8,height:8,rx:4,fill:t===l?n.colorPrimary:"currentColor"}))))};import Dt from"react";import eo from"styled-components";import{useContext as Fp}from"react";function fe(){let e=Fp(re);function t(n){i(n.primaryButtonUri,n.primaryButtonUriTarget)}function o(n){i(n.secondaryButtonUri,n.secondaryButtonUriTarget)}function i(n,r){if(!n)return;let l=n.startsWith("http")?"_blank":"_self";r&&r!=="_blank"&&(l="_self"),e.navigate(n,l)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:i}}var kp=eo.div`
|
|
525
525
|
display: flex;
|
|
526
526
|
flex-wrap: wrap;
|
|
527
527
|
align-content: center;
|
|
528
528
|
justify-content: center;
|
|
529
|
-
`,
|
|
529
|
+
`,Pp=eo.div`
|
|
530
530
|
align-content: center;
|
|
531
531
|
align-items: center;
|
|
532
532
|
display: flex;
|
|
@@ -540,10 +540,10 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
540
540
|
flex-basis: 255px;
|
|
541
541
|
flex-grow: 0;
|
|
542
542
|
flex-shrink: 0;
|
|
543
|
-
`,
|
|
543
|
+
`,vp=eo.img`
|
|
544
544
|
width: 78px;
|
|
545
545
|
height: auto;
|
|
546
|
-
`,
|
|
546
|
+
`,Bp=eo.button`
|
|
547
547
|
font-style: normal;
|
|
548
548
|
font-weight: 600;
|
|
549
549
|
font-size: 13px;
|
|
@@ -556,11 +556,11 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
556
556
|
border-radius: 100px;
|
|
557
557
|
padding: 8px 12px;
|
|
558
558
|
margin-top: 16px;
|
|
559
|
-
`,
|
|
559
|
+
`,Ep=eo.h1`
|
|
560
560
|
font-weight: 700;
|
|
561
561
|
font-size: 28px;
|
|
562
562
|
line-height: 34px;
|
|
563
|
-
`,
|
|
563
|
+
`,Ap=eo.h2`
|
|
564
564
|
font-style: normal;
|
|
565
565
|
font-weight: 400;
|
|
566
566
|
font-size: 16px;
|
|
@@ -569,7 +569,7 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
569
569
|
margin-top: 12px;
|
|
570
570
|
margin-bottom: 16px;
|
|
571
571
|
max-width: 70%;
|
|
572
|
-
`;function ln({stepData:e,appearance:t}){var i,n;let{handleUrl:o}=fe();return Dt.createElement("div",null,Dt.createElement(
|
|
572
|
+
`;function ln({stepData:e,appearance:t}){var i,n;let{handleUrl:o}=fe();return Dt.createElement("div",null,Dt.createElement(Ep,{dangerouslySetInnerHTML:R(e.title)}),Dt.createElement(Ap,{dangerouslySetInnerHTML:R(e.subtitle)}),Dt.createElement(kp,null,(n=(i=e.props)==null?void 0:i.links)==null?void 0:n.map(r=>Dt.createElement(Pp,{key:r.title},Dt.createElement(vp,{src:r.imageUri}),Dt.createElement(Bp,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{var l;r.uri&&o(r.uri,(l=r.uriTarget)!=null?l:"_blank")}},r.title)))))}import oo,{useEffect as _p}from"react";import or from"styled-components";import Wr from"react";var tr=({style:e,className:t})=>Wr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:t,style:e},Wr.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),Wr.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.91 11.672a.375.375 0 010 .656l-5.603 3.113a.375.375 0 01-.557-.328V8.887c0-.286.307-.466.557-.327l5.603 3.112z"}));import Ut,{useRef as Ip,useState as Np}from"react";import to from"styled-components";var Op=to.div`
|
|
573
573
|
display: flex;
|
|
574
574
|
align-items: center;
|
|
575
575
|
justify-content: flex-start;
|
|
@@ -577,7 +577,7 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
577
577
|
width: 100%;
|
|
578
578
|
height: 100%;
|
|
579
579
|
position: relative;
|
|
580
|
-
|
|
580
|
+
`,Lp=to.div`
|
|
581
581
|
position: absolute;
|
|
582
582
|
display: flex;
|
|
583
583
|
align-items: center;
|
|
@@ -596,50 +596,50 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
596
596
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
597
597
|
border-radius: 50%;
|
|
598
598
|
}
|
|
599
|
-
|
|
599
|
+
`,$p=to.video`
|
|
600
600
|
width: 100%;
|
|
601
601
|
height: 100%;
|
|
602
602
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
603
|
-
`,
|
|
603
|
+
`,Mp=to.iframe`
|
|
604
604
|
width: 100%;
|
|
605
605
|
height: 100%;
|
|
606
606
|
min-height: 260px;
|
|
607
607
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
608
|
-
`,
|
|
608
|
+
`,Dp=to.iframe`
|
|
609
609
|
width: 100%;
|
|
610
610
|
height: 100%;
|
|
611
611
|
min-height: 400px;
|
|
612
612
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
613
|
-
`,
|
|
613
|
+
`,Up=to.iframe`
|
|
614
614
|
width: 100%;
|
|
615
615
|
height: 100%;
|
|
616
616
|
min-height: 400px;
|
|
617
617
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
618
|
-
`;function ot({appearance:e,videoUri:t,autoplay:o=!1}){let i=Ip(),[n,r]=
|
|
618
|
+
`;function ot({appearance:e,videoUri:t,autoplay:o=!1}){let i=Ip(),[n,r]=Np(o);if(t.includes("youtube")){let l=t.split("v=")[1],p=l.indexOf("&");return p!==-1&&(l=l.substring(0,p)),Ut.createElement(Mp,{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${l}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,appearance:e,className:a("youtubePlayer",e)})}if(t.includes("vimeo")){let l=t.split("vimeo.com/")[1],p=l.indexOf("&");return p!==-1&&(l=l.substring(0,p)),Ut.createElement(Dp,{width:"100%",height:"100%",src:`https://player.vimeo.com/video/${l}`,frameBorder:"0",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,appearance:e,className:a("vimeoPlayer",e)})}if(t.includes("wistia")){let l=t.split("wistia.com/medias/")[1],p=l.indexOf("&");return p!==-1&&(l=l.substring(0,p)),Ut.createElement(Up,{width:"100%",height:"100%",src:`https://fast.wistia.net/embed/iframe/${l}`,frameBorder:"0",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,appearance:e,className:a("wistiaPlayer",e)})}return Ut.createElement(Op,{className:a("videoPlayerWrapper",e),appearance:e},!n&&Ut.createElement(Lp,{onClick:()=>{r(!0),i.current.play()},appearance:e,className:a("playIconWrapper",e)},Ut.createElement(tr,null)),Ut.createElement($p,{appearance:e,controls:n,ref:i,play:n,src:t,autoPlay:o,muted:o}))}var Wp=or.div`
|
|
619
619
|
${e=>B(e)} {
|
|
620
620
|
display: flex;
|
|
621
621
|
flex-direction: column;
|
|
622
622
|
justify-content: center;
|
|
623
623
|
}
|
|
624
|
-
`,
|
|
624
|
+
`,zp=or.img`
|
|
625
625
|
${e=>B(e)} {
|
|
626
626
|
width: 100%;
|
|
627
627
|
height: auto;
|
|
628
628
|
max-height: 250px;
|
|
629
629
|
margin-bottom: 24px;
|
|
630
630
|
}
|
|
631
|
-
`,
|
|
631
|
+
`,Hp=or.div`
|
|
632
632
|
${e=>B(e)} {
|
|
633
633
|
margin-bottom: 24px;
|
|
634
634
|
}
|
|
635
|
-
`,
|
|
635
|
+
`,Vp=or.div`
|
|
636
636
|
${e=>B(e)} {
|
|
637
637
|
width: 100%;
|
|
638
638
|
height: auto;
|
|
639
639
|
max-height: 250px;
|
|
640
640
|
margin-bottom: 24px;
|
|
641
641
|
}
|
|
642
|
-
`;function an({stepData:e,appearance:t,setCanContinue:o}){return
|
|
642
|
+
`;function an({stepData:e,appearance:t,setCanContinue:o}){return _p(()=>{o(!0)},[]),oo.createElement(Wp,{className:a("callToActionContainer",t)},oo.createElement(Hp,{className:a("callToActionTextContainer",t)},oo.createElement(Oe,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&oo.createElement(zp,{className:a("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&oo.createElement(Vp,{appearance:t,className:a("callToActionVideo",t)},oo.createElement(ot,{appearance:t,videoUri:e.videoUri})))}import dt,{useEffect as zr,useState as Hr}from"react";import bt from"styled-components";var pn=bt.div`
|
|
643
643
|
width: auto;
|
|
644
644
|
display: flex;
|
|
645
645
|
flex-direction: column;
|
|
@@ -692,8 +692,8 @@ var sa=Object.defineProperty,la=Object.defineProperties;var aa=Object.getOwnProp
|
|
|
692
692
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
693
693
|
display: flex;
|
|
694
694
|
align-self: center;
|
|
695
|
-
`;var xn=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let n=e.props,[r,l]=
|
|
696
|
-
${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map(([i,n])=>typeof n=="object"?`${i} { ${Object.entries(n).map(([l,p])=>`${Ho(l)}: ${p};`).join(" ")} }`:`${Ho(i)}: ${n};`).join(" ")} }`).join(" ")}`;function ae({appearance:e}){if(!e||!e.styleOverrides)return Bo.createElement(Bo.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([o,i])=>typeof i=="object");return t.length===0?Bo.createElement(Bo.Fragment,null):Bo.createElement(qp,{inlineStyles:t})}import{useEffect as Yp,useState as Jp}from"react";function Ke(e,t=!0){let[o,i]=Jp(!1),{markStepStarted:n,isLoading:r,getFlowStatus:l,getFlowSteps:p,getCurrentStepIndex:d,targetingLogicShouldHideFlow:s,getFlow:u}=ne(),c=p(e);function g(){return $(this,null,function*(){!o&&!r&&l(e)===Ue&&s(u(e))===!1&&t&&c&&c.length>0&&(i(!0),yield n(e,c[d(e)].id))})}return Yp(()=>{g()},[r,e,t]),{}}var Sn=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:n,customVariables:r,customFormElements:l,onComplete:p,appearance:d,hideOnFlowCompletion:s=!0,onStepCompletion:u,onButtonClick:c,dismissible:g=!0,endFlowOnDismiss:S=!1,modalPosition:F="center",repeatable:h=!1,onDismiss:x,showPagination:k=!1,allowBackNavigation:b=!1,validationHandler:v,showFrigadeBranding:M=!1,onFormDataChange:E,showFooter:f=!0,prefillData:A={},updateUrlOnPageChange:y=!1})=>{let{getFlow:T,getFlowSteps:N,isLoading:I,targetingLogicShouldHideFlow:U,getFlowStatus:z,getCurrentStepIndex:G,markFlowCompleted:_,markFlowNotStarted:K,markStepStarted:q}=ne(),O=G(e),{mergeAppearanceWithDefault:Z}=ce(),[Y,se]=Xp(null),{setOpenFlowState:Se,getOpenFlowState:ke,hasOpenModals:R}=Ne();Ke(e,i);let L=N(e);d=Z(d);let[ie,Pe]=i!==void 0&&n!==void 0?[i,n]:[ke(e,!0),H=>Se(e,H)],je=typeof window!="undefined"?window.location.hash:null;if(yn(()=>{var H;if(L&&L.length>0&&b){let V=typeof window!="undefined"&&((H=window==null?void 0:window.location)!=null&&H.hash)?window.location.hash.replace("#",""):"";if(L&&(L==null?void 0:L.length)>0){let te=-1;if(V){let D=V;te=L.findIndex(Q=>Q.id===D),Y===V&&(te=-1)}te!==-1&&(se(V),q(e,L[te].id))}}},[je]),yn(()=>{!I&&L&&L.length&&typeof window!="undefined"&&b&&(se(L[O].id),window.location.hash=L[O].id)},[I,O,L]),I)return null;let ve=T(e);if(!ve||U(ve)||!L||i!==void 0&&i===!1||z(e)===de&&s&&!h||(o=="modal"||o=="corner-modal")&&R(e))return null;let pe=()=>{Pe(!1),x&&x(),S===!0&&_(e)};if(F=="center"&&o==="modal"||o==="large-modal"){let H={padding:"24px"};return o==="large-modal"?(H.width="85%",H.height="90%",H.maxHeight="800px",H.minHeight="500px",H.padding="0"):H.width="400px",rt.createElement(et,{appearance:d,onClose:pe,visible:ie,style:H,dismissible:g,showFrigadeBranding:M},rt.createElement(ae,{appearance:d}),rt.createElement(ir,{appearance:d,steps:L,selectedStep:O,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:u,flowId:e,type:o,hideOnFlowCompletion:s,onComplete:p,setVisible:n,setShowModal:Pe,onDismiss:x,showPagination:k,customFormElements:l,allowBackNavigation:b,validationHandler:v,onFormDataChange:E,showFooter:f,prefillData:A,updateUrlOnPageChange:y,repeatable:h}))}return o==="modal"&&F!=="center"?rt.createElement(qo,{appearance:d,onClose:pe,visible:ie,modalPosition:F},rt.createElement(ae,{appearance:d}),rt.createElement(ir,{appearance:d,steps:L,selectedStep:O,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:u,flowId:e,type:o,hideOnFlowCompletion:s,onComplete:p,setVisible:n,setShowModal:Pe,onDismiss:x,showPagination:k,customFormElements:l,allowBackNavigation:b,validationHandler:v,onFormDataChange:E,showFooter:f,prefillData:A,updateUrlOnPageChange:y,repeatable:h})):rt.createElement(rt.Fragment,null,rt.createElement(ae,{appearance:d}),rt.createElement(ir,{appearance:d,steps:L,selectedStep:O,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:u,flowId:e,type:o,hideOnFlowCompletion:s,onComplete:p,setVisible:n,setShowModal:Pe,onDismiss:x,showPagination:k,customFormElements:l,allowBackNavigation:b,validationHandler:v,onFormDataChange:E,showFooter:f,prefillData:A,updateUrlOnPageChange:y,repeatable:h}))},bn=Sn;import{useCallback as jr,useContext as Qp,useEffect as Zp}from"react";function Gr(){let{organizationId:e,userId:t,setOrganizationId:o}=Qp(re),{mutateUserFlowState:i}=_e(),{config:n,apiUrl:r}=Re(),l=qt(),{verifySDKInitiated:p}=Yt();function d(g,S){return`frigade-user-group-registered-${g}-${S}`}Zp(()=>{if(t&&e){if(t.startsWith(Xt))return;let g=d(t,e);localStorage.getItem(g)||(l(`${r}userGroups`,j(w({},n),{method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})})),localStorage.setItem(g,"true"))}},[t,e]);let s=jr(g=>$(this,null,function*(){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 S={foreignUserId:t,foreignUserGroupId:e,properties:g};yield l(`${r}userGroups`,j(w({},n),{method:"POST",body:JSON.stringify(S)})),i()}),[e,t,n,i]),u=jr((g,S)=>$(this,null,function*(){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 h={foreignUserId:t,foreignUserGroupId:e,events:[{event:g,properties:S}]};yield l(`${r}userGroups`,j(w({},n),{method:"POST",body:JSON.stringify(h)})),i()}),[e,t,n,i]),c=jr((g,S)=>$(this,null,function*(){if(p())if(S){let F=d(t,g);localStorage.setItem(F,"true"),o(g);let h={foreignUserId:t,foreignUserGroupId:g,properties:S};yield l(`${r}userGroups`,j(w({},n),{method:"POST",body:JSON.stringify(h)})),i()}else o(g)}),[t,n,i]);return{organizationId:e,setOrganizationId:o,setOrganizationIdWithProperties:c,addPropertiesToOrganization:s,trackEventForOrganization:u}}var $t="frigade-xFrigade_guestUserId",Ao="frigade-xFrigade_userId",wn=({})=>{let{setFlowResponses:e}=bo(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=_e(),{userId:n,setUserId:r}=wo(),[l,p]=Eo(n),{getFlowStatus:d}=ne(),{flows:s,userProperties:u,setIsNewGuestUser:c,flowResponses:g}=Rp(re),[S,F]=Eo([]),[h,x]=Eo([]),{organizationId:k}=Gr(),[b,v]=Eo(k),[M,E]=Eo(!1);ro(()=>{if(!o&&t)for(let T=0;T<t.length;T++){let N=t[T],I=s.find(U=>U.slug===(N==null?void 0:N.flowId));if(I&&N&&N.shouldTrigger===!0&&I.type=="FORM"&&I.triggerType==="AUTOMATIC"&&!h.includes(I.slug)){setTimeout(()=>{f(N.flowId)},500);break}}},[o,t]),ro(()=>{g.length>0&&i()},[g]),ro(()=>{M||(E(!0),i())},[o,E]);function f(T){let N=s.find(I=>I.slug===T);N&&N.triggerType==="AUTOMATIC"&&!h.includes(N.slug)&&(x([...h,N.slug]),F([N]))}function A(){if(!n){let T=localStorage.getItem(Ao);if(T){r(T);return}let N=localStorage.getItem($t);if(N){r(N);return}c(!0);let I=Xt+ed();try{localStorage.setItem($t,I)}catch(U){console.log("Failed to save guest user id locally: Local storage unavailable",U)}r(U=>U||I)}}ro(()=>{try{if(s){let T=[];s.forEach(N=>{if(N.data){let I=N.data.match(/"imageUri":"(.*?)"/g);I&&I.forEach(U=>{let z=U.replace('"imageUri":"',"").replace('"',"");if(T.includes(z))return;let G=new Image;G.src=z,T.push(z)})}})}}catch(T){}},[s]),ro(()=>{if(n!==l&&(e([]),i()),p(n),n&&!n.startsWith(Xt))try{localStorage.setItem(Ao,n)}catch(T){console.log("Failed to save user id locally: Local storage available",T)}n===null&&setTimeout(()=>{n===null&&A()},50)},[n,s,u]),ro(()=>{k!=b&&(v(k),e([]),i())},[k,b,v]);function y(){return _t.createElement(_t.Fragment,null,S.map(T=>d(T.slug)!==Ue?null:_t.createElement("span",{key:T.slug},_t.createElement(bn,{flowId:T.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return _t.createElement(_t.Fragment,null,_t.createElement(y,null))};var Tn={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 td(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(Tn[o]){let n=Tn[o].split("."),r=t;n.forEach((l,p)=>{r[l]||(r[l]=p===n.length-1?i:{}),r=r[l]})}}),t}function od(e){if(!e)return;let t=ue({},e),o={};return Object.keys(t).forEach(i=>{let n=`.fr-${i}`;o[n]=t[i]}),o}function Fn(e){let{theme:t,styleOverrides:o}=e,i=td(t),n=od(o);return{overrides:i,css:n}}import hd from"styled-components";import{compose as xd,variant as Pn}from"styled-system";import kn from"react";import rd,{ThemeProvider as id,useTheme as nd}from"styled-components";import{border as sd,color as ld,compose as ad,get as pd,shadow as dd,space as cd,system as md,typography as ud}from"styled-system";var fd={width:{property:"width",scale:"sizes",transform:(e,t)=>pd(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},gd=rd("div")(({css:e})=>e,ad(sd,ld,dd,cd,ud,md(fd))),No=n=>{var r=n,{as:e,children:t,overrides:o}=r,i=$e(r,["as","children","overrides"]);let l=nd(),p={border:"none",boxSizing:"border-box",m:0,p:0},d=()=>kn.createElement(gd,w(w({as:e},p),i),t);if(o!==void 0){let s=ue(l,o);return kn.createElement(id,{theme:s},d())}return d()};var Io={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"}},Cd={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},vn=hd(No)(()=>({whiteSpace:"nowrap"}),xd(Pn({scale:"components.Button",variants:"components.Button"}),Pn({prop:"size",variants:Cd})));import yd from"styled-components";import{variant as Sd,system as bd}from"styled-system";var nr={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 Bn=yd(No)(Sd({scale:"components.Text",variants:"components.Text"}),bd({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var En=4,An="px",wd=20,Td=Object.fromEntries(Array.from(Array(wd+1),(e,t)=>t===0?[.5,`${.5*En}${An}`]:[t,`${t*En}${An}`])),io={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"},sr={colors:j(w({},io),{neutral:{foreground:io.gray300},primary:{background:io.blue500,foreground:io.white,inverted:io.blue500},negative:{foreground:io.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:Td,components:{Button:Io,Text:nr}};var In="https://api.frigade.com",re=Fd({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:at,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{},apiUrl:In,readonly:!1,debug:!1});function kd(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var Pd=({publicApiKey:e,userId:t,organizationId:o,config:i,children:n})=>{var Z,Y,se,Se,ke,R;let r=typeof window!="undefined"?localStorage.getItem($t):null,[l,p]=qe(t||r),[d,s]=qe(o||null),[u,c]=qe([]),[g,S]=qe([]),[F,h]=qe([]),[x,k]=qe({}),[b,v]=qe({}),[M,E]=qe([]),[f,A]=qe({}),[y,T]=qe(!1),[N,I]=qe(!1),[U,z]=qe(!K(e)),G=(L,ie)=>{if(ie==="_blank"){window.open(L,"_blank");return}setTimeout(()=>{window.location.href=L},50)},_={theme:w(w({},at.theme),(Y=(Z=i==null?void 0:i.defaultAppearance)==null?void 0:Z.theme)!=null?Y:{}),styleOverrides:w(w({},at.styleOverrides),(Se=(se=i==null?void 0:i.defaultAppearance)==null?void 0:se.styleOverrides)!=null?Se:{})};function K(L){return!!(L&&L.length>10&&L.substring(0,10)==="api_public")}lr(()=>{t&&p(t)},[t]),lr(()=>{l&&typeof window!="undefined"&&window.localStorage&&window.localStorage.getItem(Ao)&&window.localStorage.getItem(Ao)!==l&&kd()},[l]),lr(()=>{o&&s(o)},[o]),lr(()=>{if(K(e))z(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),z(!0);return}},[e,z]);let q={publicApiKey:e,userId:l,setUserId:p,setFlows:c,flows:u,failedFlowResponses:g,setFailedFlowResponses:S,flowResponses:F,setFlowResponses:h,userProperties:x,setUserProperties:k,openFlowStates:b,setOpenFlowStates:v,completedFlowsToKeepOpenDuringSession:M,setCompletedFlowsToKeepOpenDuringSession:E,customVariables:f,setCustomVariables:A,isNewGuestUser:y,setIsNewGuestUser:T,hasActiveFullPageFlow:N,setHasActiveFullPageFlow:I,organizationId:d,setOrganizationId:s,navigate:i&&i.navigate?i.navigate:G,defaultAppearance:_,shouldGracefullyDegrade:U,setShouldGracefullyDegrade:z,apiUrl:i&&i.apiUrl?i.apiUrl:In,readonly:i&&i.readonly?i.readonly:!1,debug:i&&i.debug?i.debug:!1,flowDataOverrides:i&&i.__internal__?i.__internal__:void 0},{overrides:O}=Fn(_);return U?Oo.createElement(re.Provider,{value:q},Oo.createElement(Nn,{theme:ue(_.theme,sr,O!=null?O:{},(ke=i==null?void 0:i.theme)!=null?ke:{})},n)):Oo.createElement(re.Provider,{value:q},Oo.createElement(Nn,{theme:ue(_.theme,sr,O!=null?O:{},(R=i==null?void 0:i.theme)!=null?R:{})},n,Oo.createElement(wn,null)))};import xc from"react";import Ce,{useEffect as gr,useState as sl}from"react";import Xe,{useState as jd}from"react";import wt from"styled-components";import dr from"react";import Wt from"react";import Ln from"styled-components";var On=Ln.span`
|
|
695
|
+
`;var xn=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let n=e.props,[r,l]=Hr([]),[p,d]=Hr(!1),[s,u]=Hr(e.id);return zr(()=>{r.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),zr(()=>{s!==e.id&&(u(e.id),l([]))},[e]),zr(()=>{o({choice:r}),r.length>=n.minChoices?t(!0):t(!1)},[r]),dt.createElement(pn,{className:a("selectListContainer",i)},dt.createElement(dn,null,dt.createElement(cn,{className:a("selectListTitle",i)},e.title),dt.createElement(mn,{appearance:i,className:a("selectListSubtitle",i)},e.subtitle)),n.options.map((c,g)=>{let S=r.includes(c.id);return dt.createElement(un,{key:`select-item-${g}`,onClick:()=>{if(r.includes(c.id)){l(r.filter(F=>F!==c.id));return}r.length<n.maxChoices?l([...r,c.id]):r.length==1&&n.maxChoices==1&&l([c.id])},hideBottomBorder:g===n.options.length-1,className:a("selectListSelectItem",i)},dt.createElement(fn,{className:a("selectListItemImage",i)},c.imageUri&&dt.createElement(gn,{src:c.imageUri,alt:`select-icon-${g}`}),dt.createElement(hn,{appearance:i,className:a("selectListSelectItemText",i)},c.title)),dt.createElement(pt,{appearance:i,value:S,primaryColor:i.theme.colorPrimary}))}))};import We,{useEffect as Cn,useState as rr}from"react";var jp=({children:e,id:t,shouldWrap:o=!1})=>We.createElement(We.Fragment,null,o?We.createElement("div",{key:t,style:{width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:1,overflowY:"auto"}},e):e),ir=({appearance:e,steps:t,selectedStep:o,customStepTypes:i,customVariables:n,onButtonClick:r,onStepCompletion:l,flowId:p,type:d,hideOnFlowCompletion:s,onComplete:u,setVisible:c,setShowModal:g,onDismiss:S,showPagination:F=!1,customFormElements:h,allowBackNavigation:x,validationHandler:k,onFormDataChange:b,showFooter:v,prefillData:$,updateUrlOnPageChange:E,repeatable:f})=>{var pe;let y=w(w({},{linkCollection:ln,multiInput:Ji,callToAction:an,selectList:xn}),i),{primaryCTAClickSideEffects:T,secondaryCTAClickSideEffects:I}=fe(),[N,D]=rr(!1),[z,j]=rr({}),[_,G]=rr(!1),[K,O]=rr(null),ee=(pe=t[o])!=null?pe:null,{markStepCompleted:q,markStepStarted:se,isLoading:Se,updateCustomVariables:ke,markFlowCompleted:Z}=ne();Cn(()=>{ke(n)},[n,Se]),Cn(()=>{b&&b(z,U(),t[o],o)},[z]);function U(){var J;return{data:(J=z[t[o].id])!=null?J:{},stepId:t[o].id,customVariables:n}}function ie(H,J,te){let M=o+1<t.length?t[o+1]:null;return l&&l(H,te,M,z,U()),r?r(H,o,J,M):!0}function Pe(H,J){j(te=>{let M={};return M[H.id]=J,w(w({},te),M)})}function je(H){return H.selectedStep.imageUri?We.createElement(tn,{image:H.selectedStep.imageUri,appearance:e,className:a("formContainerSidebarImage",e)}):null}let ve=v&&We.createElement(sn,{step:t[o],canContinue:N&&!_,formType:d,selectedStep:o,appearance:e,onPrimaryClick:()=>L(void 0,null,function*(){if(G(!0),k){let te=yield k(t[o],o,t[o+1],z,U());if(te!==!0){O(typeof te=="string"?te:null),G(!1);return}else O(null)}let H=w({},U());yield q(p,t[o].id,H),o+1<t.length&&!x&&(yield se(p,t[o+1].id));let J=ie(t[o],"primary",o);if(o+1>=t.length&&(u&&u(),S&&S(),s&&J&&(c&&c(!1),g(!1)),yield Z(p),f&&(yield se(p,t[0].id),typeof window!="undefined"&&window.localStorage&&Object.keys(window.localStorage).forEach(M=>{M.startsWith(Ur)&&window.localStorage.removeItem(M)}))),T(t[o]),G(!1),typeof window!="undefined"&&!x&&E&&o+1<t.length){let te=new URL(window.location.href);te.searchParams.set("p",t[o+1].id),window.history.pushState({},"",te.toString())}}),onSecondaryClick:()=>{ie(t[o],"secondary",o),I(t[o])},onBack:()=>L(void 0,null,function*(){o-1>=0&&(G(!0),yield se(p,t[o-1].id),G(!1))}),steps:t,allowBackNavigation:x,errorMessage:K,isSaving:_});return We.createElement(We.Fragment,null,We.createElement(Ri,{className:a("formContainer",e)},We.createElement(jp,{id:o,shouldWrap:d==="large-modal"},We.createElement(en,{key:ee.id,type:d,className:a("formContent",e)},t.map(H=>{var te;let J=y[(te=H.type)!=null?te:"multiInput"];return ee.id!==H.id?null:typeof J!="function"?J:We.createElement(J,{key:H.id,stepData:H,canContinue:N,setCanContinue:D,onSaveData:M=>{Pe(H,M)},appearance:e,customFormElements:h,flowId:p,prefillData:$})}),F&&We.createElement(er,{className:a("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),ve)),d=="large-modal"&&We.createElement(je,{selectedStep:t[o]})))};import Bo from"react";import{createGlobalStyle as Gp}from"styled-components";var Kp=Gp`
|
|
696
|
+
${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map(([i,n])=>typeof n=="object"?`${i} { ${Object.entries(n).map(([l,p])=>`${Ho(l)}: ${p};`).join(" ")} }`:`${Ho(i)}: ${n};`).join(" ")} }`).join(" ")}`;function ae({appearance:e}){if(!e||!e.styleOverrides)return Bo.createElement(Bo.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([o,i])=>typeof i=="object");return t.length===0?Bo.createElement(Bo.Fragment,null):Bo.createElement(Kp,{inlineStyles:t})}import{useEffect as qp,useState as Yp}from"react";function Ke(e,t=!0){let[o,i]=Yp(!1),{markStepStarted:n,isLoading:r,getFlowStatus:l,getFlowSteps:p,getCurrentStepIndex:d,targetingLogicShouldHideFlow:s,getFlow:u}=ne(),c=p(e);function g(){return L(this,null,function*(){!o&&!r&&l(e)===De&&s(u(e))===!1&&t&&c&&c.length>0&&(i(!0),yield n(e,c[d(e)].id))})}return qp(()=>{g()},[r,e,t]),{}}var Sn=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:n,customVariables:r,customFormElements:l,onComplete:p,appearance:d,hideOnFlowCompletion:s=!0,onStepCompletion:u,onButtonClick:c,dismissible:g=!0,endFlowOnDismiss:S=!1,modalPosition:F="center",repeatable:h=!1,onDismiss:x,showPagination:k=!1,allowBackNavigation:b=!1,validationHandler:v,showFrigadeBranding:$=!1,onFormDataChange:E,showFooter:f=!0,prefillData:A={},updateUrlOnPageChange:y=!1})=>{let{getFlow:T,getFlowSteps:I,isLoading:N,targetingLogicShouldHideFlow:D,getFlowStatus:z,getCurrentStepIndex:j,markFlowCompleted:_,markFlowNotStarted:G,markStepStarted:K}=ne(),O=j(e),{mergeAppearanceWithDefault:ee}=ce(),[q,se]=Jp(null),{setOpenFlowState:Se,getOpenFlowState:ke,hasOpenModals:Z}=Ie();Ke(e,i);let U=I(e);d=ee(d);let[ie,Pe]=i!==void 0&&n!==void 0?[i,n]:[ke(e,!0),H=>Se(e,H)],je=typeof window!="undefined"?window.location.hash:null;if(yn(()=>{var H;if(U&&U.length>0&&b){let J=typeof window!="undefined"&&((H=window==null?void 0:window.location)!=null&&H.hash)?window.location.hash.replace("#",""):"";if(U&&(U==null?void 0:U.length)>0){let te=-1;if(J){let M=J;te=U.findIndex(Q=>Q.id===M),q===J&&(te=-1)}te!==-1&&(se(J),K(e,U[te].id))}}},[je]),yn(()=>{!N&&U&&U.length&&typeof window!="undefined"&&b&&(se(U[O].id),window.location.hash=U[O].id)},[N,O,U]),N)return null;let ve=T(e);if(!ve||D(ve)||!U||i!==void 0&&i===!1||z(e)===de&&s&&!h||(o=="modal"||o=="corner-modal")&&Z(e))return null;let pe=()=>{Pe(!1),x&&x(),S===!0&&_(e)};if(F=="center"&&o==="modal"||o==="large-modal"){let H={padding:"24px"};return o==="large-modal"?(H.width="85%",H.height="90%",H.maxHeight="800px",H.minHeight="500px",H.padding="0"):H.width="400px",rt.createElement(et,{appearance:d,onClose:pe,visible:ie,style:H,dismissible:g,showFrigadeBranding:$},rt.createElement(ae,{appearance:d}),rt.createElement(ir,{appearance:d,steps:U,selectedStep:O,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:u,flowId:e,type:o,hideOnFlowCompletion:s,onComplete:p,setVisible:n,setShowModal:Pe,onDismiss:x,showPagination:k,customFormElements:l,allowBackNavigation:b,validationHandler:v,onFormDataChange:E,showFooter:f,prefillData:A,updateUrlOnPageChange:y,repeatable:h}))}return o==="modal"&&F!=="center"?rt.createElement(qo,{appearance:d,onClose:pe,visible:ie,modalPosition:F},rt.createElement(ae,{appearance:d}),rt.createElement(ir,{appearance:d,steps:U,selectedStep:O,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:u,flowId:e,type:o,hideOnFlowCompletion:s,onComplete:p,setVisible:n,setShowModal:Pe,onDismiss:x,showPagination:k,customFormElements:l,allowBackNavigation:b,validationHandler:v,onFormDataChange:E,showFooter:f,prefillData:A,updateUrlOnPageChange:y,repeatable:h})):rt.createElement(rt.Fragment,null,rt.createElement(ae,{appearance:d}),rt.createElement(ir,{appearance:d,steps:U,selectedStep:O,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:u,flowId:e,type:o,hideOnFlowCompletion:s,onComplete:p,setVisible:n,setShowModal:Pe,onDismiss:x,showPagination:k,customFormElements:l,allowBackNavigation:b,validationHandler:v,onFormDataChange:E,showFooter:f,prefillData:A,updateUrlOnPageChange:y,repeatable:h}))},bn=Sn;import{useCallback as Vr,useContext as Xp,useEffect as Qp}from"react";function jr(){let{organizationId:e,userId:t,setOrganizationId:o}=Xp(re),{mutateUserFlowState:i}=_e(),{config:n,apiUrl:r}=Re(),l=qt(),{verifySDKInitiated:p}=Yt();function d(g,S){return`frigade-user-group-registered-${g}-${S}`}Qp(()=>{if(t&&e){if(t.startsWith(Xt))return;let g=d(t,e);localStorage.getItem(g)||(l(`${r}userGroups`,V(w({},n),{method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})})),localStorage.setItem(g,"true"))}},[t,e]);let s=Vr(g=>L(this,null,function*(){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 S={foreignUserId:t,foreignUserGroupId:e,properties:g};yield l(`${r}userGroups`,V(w({},n),{method:"POST",body:JSON.stringify(S)})),i()}),[e,t,n,i]),u=Vr((g,S)=>L(this,null,function*(){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 h={foreignUserId:t,foreignUserGroupId:e,events:[{event:g,properties:S}]};yield l(`${r}userGroups`,V(w({},n),{method:"POST",body:JSON.stringify(h)})),i()}),[e,t,n,i]),c=Vr((g,S)=>L(this,null,function*(){if(p())if(S){let F=d(t,g);localStorage.setItem(F,"true"),o(g);let h={foreignUserId:t,foreignUserGroupId:g,properties:S};yield l(`${r}userGroups`,V(w({},n),{method:"POST",body:JSON.stringify(h)})),i()}else o(g)}),[t,n,i]);return{organizationId:e,setOrganizationId:o,setOrganizationIdWithProperties:c,addPropertiesToOrganization:s,trackEventForOrganization:u}}var $t="frigade-xFrigade_guestUserId",Ao="frigade-xFrigade_userId",wn=({})=>{let{setFlowResponses:e}=bo(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=_e(),{userId:n,setUserId:r}=wo(),[l,p]=Eo(n),{getFlowStatus:d}=ne(),{flows:s,userProperties:u,setIsNewGuestUser:c,flowResponses:g}=Zp(re),[S,F]=Eo([]),[h,x]=Eo([]),{organizationId:k}=jr(),[b,v]=Eo(k),[$,E]=Eo(!1);ro(()=>{if(!o&&t)for(let T=0;T<t.length;T++){let I=t[T],N=s.find(D=>D.slug===(I==null?void 0:I.flowId));if(N&&I&&I.shouldTrigger===!0&&N.type=="FORM"&&N.triggerType==="AUTOMATIC"&&!h.includes(N.slug)){setTimeout(()=>{f(I.flowId)},500);break}}},[o,t]),ro(()=>{g.length>0&&i()},[g]),ro(()=>{$||(E(!0),i())},[o,E]);function f(T){let I=s.find(N=>N.slug===T);I&&I.triggerType==="AUTOMATIC"&&!h.includes(I.slug)&&(x([...h,I.slug]),F([I]))}function A(){if(!n){let T=localStorage.getItem(Ao);if(T){r(T);return}let I=localStorage.getItem($t);if(I){r(I);return}c(!0);let N=Xt+Rp();try{localStorage.setItem($t,N)}catch(D){console.log("Failed to save guest user id locally: Local storage unavailable",D)}r(D=>D||N)}}ro(()=>{try{if(s){let T=[];s.forEach(I=>{if(I.data){let N=I.data.match(/"imageUri":"(.*?)"/g);N&&N.forEach(D=>{let z=D.replace('"imageUri":"',"").replace('"',"");if(T.includes(z))return;let j=new Image;j.src=z,T.push(z)})}})}}catch(T){}},[s]),ro(()=>{if(n!==l&&(e([]),i()),p(n),n&&!n.startsWith(Xt))try{localStorage.setItem(Ao,n)}catch(T){console.log("Failed to save user id locally: Local storage available",T)}n===null&&setTimeout(()=>{n===null&&A()},50)},[n,s,u]),ro(()=>{k!=b&&(v(k),e([]),i())},[k,b,v]);function y(){return _t.createElement(_t.Fragment,null,S.map(T=>d(T.slug)!==De?null:_t.createElement("span",{key:T.slug},_t.createElement(bn,{flowId:T.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return _t.createElement(_t.Fragment,null,_t.createElement(y,null))};var Tn={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 ed(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(Tn[o]){let n=Tn[o].split("."),r=t;n.forEach((l,p)=>{r[l]||(r[l]=p===n.length-1?i:{}),r=r[l]})}}),t}function td(e){if(!e)return;let t=ue({},e),o={};return Object.keys(t).forEach(i=>{let n=`.fr-${i}`;o[n]=t[i]}),o}function Fn(e){let{theme:t,styleOverrides:o}=e,i=ed(t),n=td(o);return{overrides:i,css:n}}import gd from"styled-components";import{compose as hd,variant as Pn}from"styled-system";import kn from"react";import od,{ThemeProvider as rd,useTheme as id}from"styled-components";import{border as nd,color as sd,compose as ld,get as ad,shadow as pd,space as dd,system as cd,typography as md}from"styled-system";var ud={width:{property:"width",scale:"sizes",transform:(e,t)=>ad(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},fd=od("div")(({css:e})=>e,ld(nd,sd,pd,dd,md,cd(ud))),Io=n=>{var r=n,{as:e,children:t,overrides:o}=r,i=$e(r,["as","children","overrides"]);let l=id(),p={border:"none",boxSizing:"border-box",m:0,p:0},d=()=>kn.createElement(fd,w(w({as:e},p),i),t);if(o!==void 0){let s=ue(l,o);return kn.createElement(rd,{theme:s},d())}return d()};var No={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"}},xd={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},vn=gd(Io)(()=>({whiteSpace:"nowrap"}),hd(Pn({scale:"components.Button",variants:"components.Button"}),Pn({prop:"size",variants:xd})));import Cd from"styled-components";import{variant as yd,system as Sd}from"styled-system";var nr={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 Bn=Cd(Io)(yd({scale:"components.Text",variants:"components.Text"}),Sd({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var En=4,An="px",bd=20,wd=Object.fromEntries(Array.from(Array(bd+1),(e,t)=>t===0?[.5,`${.5*En}${An}`]:[t,`${t*En}${An}`])),io={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"},sr={colors:V(w({},io),{neutral:{foreground:io.gray300},primary:{background:io.blue500,foreground:io.white,inverted:io.blue500},negative:{foreground:io.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:wd,components:{Button:No,Text:nr}};var Nn="https://api.frigade.com",re=Td({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:at,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{},apiUrl:Nn,readonly:!1,debug:!1});function Fd(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var kd=({publicApiKey:e,userId:t,organizationId:o,config:i,children:n})=>{var ee,q,se,Se,ke,Z;let r=typeof window!="undefined"?localStorage.getItem($t):null,[l,p]=qe(t||r),[d,s]=qe(o||null),[u,c]=qe([]),[g,S]=qe([]),[F,h]=qe([]),[x,k]=qe({}),[b,v]=qe({}),[$,E]=qe([]),[f,A]=qe({}),[y,T]=qe(!1),[I,N]=qe(!1),[D,z]=qe(!G(e)),j=(U,ie)=>{if(ie==="_blank"){window.open(U,"_blank");return}setTimeout(()=>{window.location.href=U},50)},_={theme:w(w({},at.theme),(q=(ee=i==null?void 0:i.defaultAppearance)==null?void 0:ee.theme)!=null?q:{}),styleOverrides:w(w({},at.styleOverrides),(Se=(se=i==null?void 0:i.defaultAppearance)==null?void 0:se.styleOverrides)!=null?Se:{})};function G(U){return!!(U&&U.length>10&&U.substring(0,10)==="api_public")}lr(()=>{t&&p(t)},[t]),lr(()=>{l&&typeof window!="undefined"&&window.localStorage&&window.localStorage.getItem(Ao)&&window.localStorage.getItem(Ao)!==l&&Fd()},[l]),lr(()=>{o&&s(o)},[o]),lr(()=>{if(G(e))z(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),z(!0);return}},[e,z]);let K={publicApiKey:e,userId:l,setUserId:p,setFlows:c,flows:u,failedFlowResponses:g,setFailedFlowResponses:S,flowResponses:F,setFlowResponses:h,userProperties:x,setUserProperties:k,openFlowStates:b,setOpenFlowStates:v,completedFlowsToKeepOpenDuringSession:$,setCompletedFlowsToKeepOpenDuringSession:E,customVariables:f,setCustomVariables:A,isNewGuestUser:y,setIsNewGuestUser:T,hasActiveFullPageFlow:I,setHasActiveFullPageFlow:N,organizationId:d,setOrganizationId:s,navigate:i&&i.navigate?i.navigate:j,defaultAppearance:_,shouldGracefullyDegrade:D,setShouldGracefullyDegrade:z,apiUrl:i&&i.apiUrl?i.apiUrl:Nn,readonly:i&&i.readonly?i.readonly:!1,debug:i&&i.debug?i.debug:!1,flowDataOverrides:i&&i.__internal__?i.__internal__:void 0},{overrides:O}=Fn(_);return D?Oo.createElement(re.Provider,{value:K},Oo.createElement(In,{theme:ue(_.theme,sr,O!=null?O:{},(ke=i==null?void 0:i.theme)!=null?ke:{})},n)):Oo.createElement(re.Provider,{value:K},Oo.createElement(In,{theme:ue(_.theme,sr,O!=null?O:{},(Z=i==null?void 0:i.theme)!=null?Z:{})},n,Oo.createElement(wn,null)))};import xc from"react";import Ce,{useEffect as Rr,useState as nl}from"react";import Xe,{useState as Vd}from"react";import wt from"styled-components";import dr from"react";import Wt from"react";import Ln from"styled-components";var On=Ln.span`
|
|
697
697
|
font-weight: 600;
|
|
698
698
|
font-size: 14px;
|
|
699
699
|
font-style: normal;
|
|
@@ -705,7 +705,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
705
705
|
margin-left: 32px;
|
|
706
706
|
padding-right: 12px;
|
|
707
707
|
${e=>Ee(e)}
|
|
708
|
-
`,
|
|
708
|
+
`,Pd=Ln.div`
|
|
709
709
|
flex-direction: row;
|
|
710
710
|
justify-content: space-between;
|
|
711
711
|
display: flex;
|
|
@@ -714,7 +714,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
714
714
|
padding-right: 8px;
|
|
715
715
|
width: 100%;
|
|
716
716
|
${e=>Ee(e)}
|
|
717
|
-
`,ar=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:n,primaryColor:r="#000000",checkBoxType:l="round",appearance:p})=>Wt.createElement(Wt.Fragment,null,Wt.createElement(
|
|
717
|
+
`,ar=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:n,primaryColor:r="#000000",checkBoxType:l="round",appearance:p})=>Wt.createElement(Wt.Fragment,null,Wt.createElement(Pd,{className:a("checklistStepsContainer",p),appearance:p,styleOverrides:w({},n)},i==="left"&&e&&Wt.createElement(On,{className:a("checklistStepLabel",p),styleOverrides:o,appearnace:p},e),Wt.createElement(pt,{appearance:p,value:t,type:l,primaryColor:r}),i==="right"&&e&&Wt.createElement(On,{className:a("checklistStepLabel",p),styleOverrides:o,appearance:p},e)),Wt.createElement(ae,{appearance:p}));import Lo from"styled-components";var $n=Lo.div`
|
|
718
718
|
font-weight: 700;
|
|
719
719
|
font-size: 18px;
|
|
720
720
|
line-height: 22px;
|
|
@@ -747,7 +747,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
747
747
|
justify-content: flex-start;
|
|
748
748
|
border-bottom: 1px solid ${e=>e.theme.colorBorder};
|
|
749
749
|
padding-right: 16px;
|
|
750
|
-
`;var _n=({data:e,index:t,isSelected:o,primaryColor:i,style:n,onClick:r,appearance:l})=>{var p,d,s,u,c;return dr.createElement("div",{style:{position:"relative",paddingLeft:"0px"},onClick:()=>{r()}},o&&dr.createElement(pr,{className:a("checklistStepItemSelectedIndicator",l),layoutId:"checklis-step-selected",style:{backgroundColor:(d=(p=l==null?void 0:l.theme)==null?void 0:p.colorPrimary)!=null?d:i}}),dr.createElement(Un,{className:a("checklistStepItem",l),key:`hero-checklist-step-${t}`,appearance:l,role:"listitem"},dr.createElement(ar,{value:e.complete,labelPosition:"left",label:(s=e.stepName)!=null?s:e.title,style:n,primaryColor:(c=(u=l==null?void 0:l.theme)==null?void 0:u.colorPrimary)!=null?c:i,appearance:l})))};import zt from"react";import
|
|
750
|
+
`;var _n=({data:e,index:t,isSelected:o,primaryColor:i,style:n,onClick:r,appearance:l})=>{var p,d,s,u,c;return dr.createElement("div",{style:{position:"relative",paddingLeft:"0px"},onClick:()=>{r()}},o&&dr.createElement(pr,{className:a("checklistStepItemSelectedIndicator",l),layoutId:"checklis-step-selected",style:{backgroundColor:(d=(p=l==null?void 0:l.theme)==null?void 0:p.colorPrimary)!=null?d:i}}),dr.createElement(Un,{className:a("checklistStepItem",l),key:`hero-checklist-step-${t}`,appearance:l,role:"listitem"},dr.createElement(ar,{value:e.complete,labelPosition:"left",label:(s=e.stepName)!=null?s:e.title,style:n,primaryColor:(c=(u=l==null?void 0:l.theme)==null?void 0:u.colorPrimary)!=null?c:i,appearance:l})))};import zt from"react";import Gr from"styled-components";import cr from"styled-components";var xC=cr.h1`
|
|
751
751
|
display: flex;
|
|
752
752
|
margin: 0;
|
|
753
753
|
font-size: 18px;
|
|
@@ -773,7 +773,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
773
773
|
border-radius: 20px;
|
|
774
774
|
background-color: ${e=>e.theme.colorPrimary};
|
|
775
775
|
opacity: 0.12;
|
|
776
|
-
`;var
|
|
776
|
+
`;var vd=Gr.div`
|
|
777
777
|
display: flex;
|
|
778
778
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
779
779
|
justify-content: flex-start;
|
|
@@ -781,25 +781,25 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
781
781
|
width: 100%;
|
|
782
782
|
|
|
783
783
|
${e=>Ee(e)}
|
|
784
|
-
`,
|
|
784
|
+
`,Bd=Gr.div`
|
|
785
785
|
flex-grow: 1;
|
|
786
786
|
position: relative;
|
|
787
787
|
${e=>e.textLocation=="top"?"width: 100%;":""}
|
|
788
|
-
`,
|
|
788
|
+
`,Ed=Gr.span`
|
|
789
789
|
font-weight: 600;
|
|
790
790
|
font-size: 14px;
|
|
791
791
|
line-height: 18px;
|
|
792
792
|
padding-right: ${e=>e.padding};
|
|
793
793
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
794
794
|
${e=>Ee(e)}
|
|
795
|
-
`;var ze=({count:e,total:t,display:o="count",textLocation:i="left",style:n={},textStyle:r={},appearance:l})=>{var g;if(t===0)return zt.createElement(zt.Fragment,null);Object.keys(r).length===0&&r.constructor===Object&&(r={color:(g=l==null?void 0:l.theme)==null?void 0:g.colorText});let p=e===0?"10px":`${e/t*100}%`,d=o==="compact"?"8px":"10px",s=Math.round(e/t*100),u=o==="compact"?"10px":"14px",c;return o==="count"||o==="compact"?c=`${e}/${t}`:o==="percent"&&(c=`${s}% complete`),i==="top"&&(u="0px"),zt.createElement(
|
|
795
|
+
`;var ze=({count:e,total:t,display:o="count",textLocation:i="left",style:n={},textStyle:r={},appearance:l})=>{var g;if(t===0)return zt.createElement(zt.Fragment,null);Object.keys(r).length===0&&r.constructor===Object&&(r={color:(g=l==null?void 0:l.theme)==null?void 0:g.colorText});let p=e===0?"10px":`${e/t*100}%`,d=o==="compact"?"8px":"10px",s=Math.round(e/t*100),u=o==="compact"?"10px":"14px",c;return o==="count"||o==="compact"?c=`${e}/${t}`:o==="percent"&&(c=`${s}% complete`),i==="top"&&(u="0px"),zt.createElement(vd,{className:a("progressBarContainer",l),textLocation:i,styleOverrides:n},zt.createElement(Ed,{className:a("progressBarStepText",l),styleOverrides:V(w({},r),{fontSize:o==="compact"?12:14,fontWeight:600}),appearance:l,padding:u,textLocation:i},c),zt.createElement(Bd,{textLocation:i,className:a("progressBar",l)},zt.createElement(Wn,{style:{zIndex:o=="compact"?1:5},fgWidth:p,barHeight:d,appearance:l,className:a("progressBarFill",l)}),zt.createElement(zn,{className:a("progressBarBackground",l),barHeight:d,appearance:l})))};import $o from"react";import Id from"styled-components";import ur from"react";import mr from"react";var no=({stepData:e,appearance:t})=>mr.createElement(mr.Fragment,null,mr.createElement(Mn,{appearance:t,className:a("checklistStepTitle",t),dangerouslySetInnerHTML:R(e.title)}),mr.createElement(Dn,{appearance:t,className:a("checklistStepSubtitle",t),dangerouslySetInnerHTML:R(e.subtitle)}));import Kr from"react";var so=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},i=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return Kr.createElement(Ro,{className:a("ctaContainer",t)},Kr.createElement(le,{appearance:t,title:e.primaryButtonTitle,onClick:o}),e.secondaryButtonTitle&&Kr.createElement(le,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:i,style:{width:"auto",marginRight:"12px"}}))};var lo=({stepData:e,appearance:t})=>ur.createElement(ur.Fragment,null,ur.createElement(no,{stepData:e,appearance:t}),ur.createElement(so,{stepData:e,appearance:t}));import Ad from"react";function Hn(e){return Ad.createElement(ot,{appearance:e.appearance,videoUri:e.videoUri,autoplay:e.autoplay})}var qr="default",Nd=Id.img`
|
|
796
796
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
797
797
|
width: 100%;
|
|
798
798
|
height: auto;
|
|
799
799
|
min-height: 200px;
|
|
800
|
-
`,Vn=({stepData:e,appearance:t})=>{var o;if(e!=null&&e.StepContent){let i=e.StepContent;return $o.createElement("div",null,i)}return $o.createElement($n,{className:a("checklistStepContent",t)},e.imageUri?$o.createElement(
|
|
800
|
+
`,Vn=({stepData:e,appearance:t})=>{var o;if(e!=null&&e.StepContent){let i=e.StepContent;return $o.createElement("div",null,i)}return $o.createElement($n,{className:a("checklistStepContent",t)},e.imageUri?$o.createElement(Nd,{className:a("checklistStepImage",t),src:e.imageUri,appearance:t}):null,e.videoUri?$o.createElement(Hn,{videoUri:e.videoUri,appearance:t,autoplay:(o=e.props)==null?void 0:o.autoplayVideo}):null,$o.createElement(lo,{stepData:e,appearance:t}))};import He,{useRef as Od,useState as Ld}from"react";import ao from"styled-components";var jn=ao.div`
|
|
801
801
|
display: block;
|
|
802
|
-
|
|
802
|
+
`,$d=ao.div`
|
|
803
803
|
display: flex;
|
|
804
804
|
flex-direction: row;
|
|
805
805
|
flex-wrap: wrap;
|
|
@@ -809,20 +809,20 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
809
809
|
align-content: center;
|
|
810
810
|
margin-top: 24px;
|
|
811
811
|
margin-bottom: 24px;
|
|
812
|
-
`,
|
|
812
|
+
`,Md=ao.div`
|
|
813
813
|
display: flex;
|
|
814
814
|
align-items: center;
|
|
815
815
|
justify-content: flex-start;
|
|
816
816
|
flex-direction: column;
|
|
817
817
|
margin-right: 16px;
|
|
818
|
-
`,
|
|
818
|
+
`,Dd=ao.video`
|
|
819
819
|
width: 200px;
|
|
820
820
|
height: 120px;
|
|
821
|
-
`,
|
|
821
|
+
`,Ud=ao.div`
|
|
822
822
|
font-size: 14px;
|
|
823
823
|
line-height: 20px;
|
|
824
824
|
text-align: center;
|
|
825
|
-
`,
|
|
825
|
+
`,_d=ao.div`
|
|
826
826
|
position: absolute;
|
|
827
827
|
width: 200px;
|
|
828
828
|
height: 120px;
|
|
@@ -842,9 +842,9 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
842
842
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
843
843
|
border-radius: 50%;
|
|
844
844
|
}
|
|
845
|
-
`,Gn="videoCarousel",Kn=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.videos))return He.createElement(jn,null,He.createElement(lo,{stepData:e,appearance:t}));function o({video:r}){let l=
|
|
845
|
+
`,Gn="videoCarousel",Kn=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.videos))return He.createElement(jn,null,He.createElement(lo,{stepData:e,appearance:t}));function o({video:r}){let l=Od(),[p,d]=Ld(!1);return He.createElement(Md,null,!p&&He.createElement(_d,{onClick:()=>{d(!0),l.current.play()},appearance:t},He.createElement(tr,null)),He.createElement(Dd,{controls:p,ref:l,play:p,src:r.uri}),He.createElement(Ud,null,r.title))}let i=e.props;return i.videos?He.createElement(jn,null,He.createElement(no,{stepData:e,appearance:t}),He.createElement($d,null,i.videos.map((r,l)=>He.createElement("span",{key:`${r.uri}-${l}`},He.createElement(o,{video:r})))),He.createElement(so,{stepData:e,appearance:t})):null};import ct from"react";import fr from"styled-components";var qn=fr.div`
|
|
846
846
|
display: block;
|
|
847
|
-
`,
|
|
847
|
+
`,Wd=fr.pre`
|
|
848
848
|
display: block;
|
|
849
849
|
background-color: #2a2a2a;
|
|
850
850
|
color: #f8f8f8;
|
|
@@ -860,14 +860,14 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
860
860
|
white-space: -o-pre-wrap; /* Opera 7 */
|
|
861
861
|
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
|
862
862
|
margin-bottom: 24px;
|
|
863
|
-
`,
|
|
863
|
+
`,zd=fr.div`
|
|
864
864
|
font-size: 15px;
|
|
865
865
|
line-height: 20px;
|
|
866
866
|
margin-bottom: 12px;
|
|
867
867
|
margin-top: 12px;
|
|
868
|
-
`,
|
|
868
|
+
`,Hd=fr.div`
|
|
869
869
|
margin-top: 24px;
|
|
870
|
-
`,Yn="codeSnippet",Jn=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.codeSnippets))return ct.createElement(qn,null,ct.createElement(lo,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?ct.createElement(qn,{className:a("codeSnippetContainer",t)},ct.createElement(no,{stepData:e,appearance:t}),ct.createElement(
|
|
870
|
+
`,Yn="codeSnippet",Jn=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.codeSnippets))return ct.createElement(qn,null,ct.createElement(lo,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?ct.createElement(qn,{className:a("codeSnippetContainer",t)},ct.createElement(no,{stepData:e,appearance:t}),ct.createElement(Hd,null,o.codeSnippets.map((n,r)=>ct.createElement("div",{key:r},n.title?ct.createElement(zd,{dangerouslySetInnerHTML:R(n.title)}):null,n.code?ct.createElement(Wd,null,n.code):null))),ct.createElement(so,{stepData:e,appearance:t})):null};var jd=wt.div`
|
|
871
871
|
display: flex;
|
|
872
872
|
flex-direction: row;
|
|
873
873
|
overflow: hidden;
|
|
@@ -875,14 +875,14 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
875
875
|
background: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
876
876
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
877
877
|
${e=>Ee(e)}
|
|
878
|
-
`,
|
|
878
|
+
`,Gd=wt.h1`
|
|
879
879
|
font-size: 18px;
|
|
880
880
|
font-style: normal;
|
|
881
881
|
font-weight: 700;
|
|
882
882
|
line-height: 24px;
|
|
883
883
|
letter-spacing: 0.36px;
|
|
884
884
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
885
|
-
`,
|
|
885
|
+
`,Kd=wt.h2`
|
|
886
886
|
font-size: 14px;
|
|
887
887
|
font-style: normal;
|
|
888
888
|
font-weight: 400;
|
|
@@ -890,27 +890,27 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
890
890
|
letter-spacing: 0.28px;
|
|
891
891
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
892
892
|
margin: 10px 0px 0px 0px;
|
|
893
|
-
`,
|
|
893
|
+
`,qd=wt.div`
|
|
894
894
|
padding: 28px 0px 28px 28px;
|
|
895
895
|
border-bottom: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
896
|
-
`,
|
|
896
|
+
`,Yd=wt.div`
|
|
897
897
|
flex: 1;
|
|
898
|
-
`,
|
|
898
|
+
`,Jd=wt.div`
|
|
899
899
|
list-style: none;
|
|
900
900
|
padding: 0;
|
|
901
901
|
margin: 0;
|
|
902
902
|
cursor: pointer;
|
|
903
903
|
min-width: 300px;
|
|
904
|
-
`,
|
|
904
|
+
`,Xd=wt.div`
|
|
905
905
|
width: 1px;
|
|
906
906
|
margin-right: 40px;
|
|
907
907
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
908
|
-
`,
|
|
908
|
+
`,Qd=wt.div`
|
|
909
909
|
flex: 2;
|
|
910
910
|
padding: 40px 40px 40px 0px;
|
|
911
|
-
`,
|
|
911
|
+
`,Zd=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:n,setSelectedStep:r,className:l="",customStepTypes:p=new Map,appearance:d,type:s})=>{let{mergeAppearanceWithDefault:u}=ce();d=u(d);let c={[qr]:Vn,[Gn]:Kn,[Yn]:Jn},g=w(w({},c),p),[S,F]=Vd(0),h=n!=null?n:S,x=r!=null?r:F,k=o.filter(v=>v.complete===!0).length,b=()=>{var v;return!((v=o[h])!=null&&v.type)||!g[o[h].type]?g[qr]({stepData:o[h],appearance:d}):typeof g[o[h].type]!="function"?g[o[h].type]:g[o[h].type]({stepData:o[h],appearance:d})};return Xe.createElement(jd,{type:s,styleOverrides:i,className:l,appearance:d},Xe.createElement(Yd,{className:a("checklistHeaderContainer",d),appearance:d},Xe.createElement(qd,{className:a("checklistHeader",d),appearance:d},Xe.createElement(Gd,{className:a("checklistTitle",d),appearance:d},e),Xe.createElement(Kd,{className:a("checklistSubtitle",d),appearance:d},t),Xe.createElement(ze,{total:o.length,count:k,style:{marginTop:"24px",paddingRight:"40px"},appearance:d})),Xe.createElement(Jd,{className:a("checklistStepsContainer",d)},o.map((v,$)=>Xe.createElement(_n,{data:v,index:$,key:$,listLength:o.length,isSelected:$===h,primaryColor:d.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{x($)},appearance:d})))),Xe.createElement(Xd,{appearance:d,className:a("checklistDivider",d)}),Xe.createElement(Qd,null,Xe.createElement(b,null)))},Yr=Zd;import Y,{useState as rc}from"react";import Xn from"react";import Rd from"styled-components";var ec=Rd.svg`
|
|
912
912
|
transition: 'transform 0.35s ease-in-out';
|
|
913
|
-
`,po=({style:e,className:t})=>Xn.createElement(
|
|
913
|
+
`,po=({style:e,className:t})=>Xn.createElement(ec,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e,className:t},Xn.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import be from"styled-components";var Jr={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},Qn=be.div`
|
|
914
914
|
max-height: 350px;
|
|
915
915
|
padding-bottom: 40px;
|
|
916
916
|
`,Zn=be.div`
|
|
@@ -1042,7 +1042,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1042
1042
|
`,fs=be.div`
|
|
1043
1043
|
display: block;
|
|
1044
1044
|
width: 100%;
|
|
1045
|
-
`;import
|
|
1045
|
+
`;import tc from"styled-components";var gs=tc.div`
|
|
1046
1046
|
flex-direction: column;
|
|
1047
1047
|
justify-content: center;
|
|
1048
1048
|
display: flex;
|
|
@@ -1123,7 +1123,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1123
1123
|
line-height: 14px;
|
|
1124
1124
|
font-weight: 400;
|
|
1125
1125
|
cursor: pointer;
|
|
1126
|
-
`;var
|
|
1126
|
+
`;var oc=({steps:e,style:t,title:o,primaryColor:i,appearance:n,onButtonClick:r})=>{let{primaryCTAClickSideEffects:l}=fe();return ut.createElement(hs,{style:t,className:a("guideContainer",n)},ut.createElement(Cs,{className:a("guideTitle",n)},o),ut.createElement(xs,{className:a("guideItemContainer",n)},e.map((p,d)=>{var s;return ut.createElement(ys,{key:`guide-${(s=p.id)!=null?s:d}`,className:a("guideItem",n)},p.icon&&ut.createElement(Ss,{className:a("guideIcon",n)},ut.createElement(bs,null,p.icon)),ut.createElement(ws,{className:a("guideItemTitle",n),dangerouslySetInnerHTML:R(p.title)}),ut.createElement(Ts,{className:a("guideItemSubtitle",n),dangerouslySetInnerHTML:R(p.subtitle)}),ut.createElement(Fs,{className:a("guideItemLink",n),color:i,onClick:()=>{p.primaryButtonUri&&l(p),r&&r(p)}},p.primaryButtonTitle))})))},Mo=oc;var ic=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:n,onClose:r,selectedStep:l,setSelectedStep:p,customStepTypes:d,appearance:s,guideData:u,guideTitle:c,onGuideButtonClick:g})=>{let S=({stepData:f,handleSecondaryCTAClick:A,handleCTAClick:y})=>f?Y.createElement(ss,{className:a("checklistStepContainer",s),"data-testid":"checklistStepContainer"},Y.createElement(ls,{appearance:s,className:a("checklistStepTitle",s),dangerouslySetInnerHTML:R(f.title)}),Y.createElement(as,{appearance:s,className:a("checklistStepSubtitle",s),dangerouslySetInnerHTML:R(f.subtitle)}),Y.createElement(ps,{className:a("checklistCTAContainer",s)},f.secondaryButtonTitle&&Y.createElement(le,{title:f.secondaryButtonTitle,onClick:A,appearance:s,secondary:!0}),Y.createElement(le,{title:f.primaryButtonTitle,onClick:y,appearance:s}))):Y.createElement(Y.Fragment,null),h=w(w({},{default:f=>{var I;if((I=e[b])!=null&&I.StepContent){let N=e[b].StepContent;return Y.createElement("div",null,N)}let A=e[b];return Y.createElement(S,{stepData:f,handleCTAClick:()=>{A.handlePrimaryButtonClick&&A.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{A.handleSecondaryButtonClick&&A.handleSecondaryButtonClick()}})}}),d),[x,k]=rc(0),b=l!=null?l:x,v=p!=null?p:k,$=()=>{var f;return e?!((f=e[b])!=null&&f.type)||!h[e[b].type]?h.default(e[b]):typeof h[e[b].type]!="function"?h[e[b].type]:h[e[b].type]({stepData:e[b],primaryColor:s.theme.colorPrimary}):Y.createElement(Y.Fragment,null)},E=e.filter(f=>f.complete).length;return n?(s.theme.modalContainer||(s.theme.borderRadius&&(Jr.borderRadius=s.theme.borderRadius+"px"),s.theme.modalContainer=Jr),Y.createElement(et,{onClose:r,visible:n,appearance:s},Y.createElement(fs,null,Y.createElement(Zn,null,Y.createElement(Rn,{appearance:s,className:a("checklistTitle",s)},t),Y.createElement(es,{appearance:s,className:a("checklistSubtitle",s)},o)),Y.createElement(Qn,null,e&&e.length>0&&Y.createElement(ts,{className:a("stepsContainer",s)},Y.createElement(os,null,Y.createElement("div",{style:{flex:3}},Y.createElement(rs,{className:a("stepsTitle",s)},i)),Y.createElement(us,null,Y.createElement(ze,{style:{width:"100%"},count:E,total:e.length,appearance:s}))),Y.createElement(is,null,Y.createElement(ns,{className:a("checklistStepListContainer",s),appearance:s},e.map((f,A)=>{var T;let y=b===A;return Y.createElement(ds,{selected:y,className:a(`checklistStepListItem${y?"Selected":""}`,s),key:`checklist-guide-step-${(T=f.id)!=null?T:A}`,disabled:f.blocked,onClick:()=>{f.blocked||v(A)},title:f.blocked?"Finish remaining steps to continue":void 0},y&&Y.createElement(pr,{className:a("checklistStepItemSelectedIndicator",s),layoutId:"checklist-step-selected",style:{backgroundColor:s.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),Y.createElement(cs,{selected:y,className:a(`checklistStepListStepName${y?"Selected":""}`,s)},f.stepName),Y.createElement(ms,null,Y.createElement(pt,{value:f.complete,type:"round",primaryColor:s.theme.colorPrimary,progress:f.progress,appearance:s}),Y.createElement(gs,null,Y.createElement(po,{style:{marginLeft:"10px"},color:s.theme.colorBackgroundSecondary}))))})),Y.createElement($,null))),u&&u.length>0&&Y.createElement(Mo,{steps:u,title:c,primaryColor:s.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:s,onButtonClick:f=>(g&&g(f),!0)}))))):Y.createElement(Y.Fragment,null)},Xr=ic;import Me,{useEffect as nc,useState as sc}from"react";import Fe from"react";import ft from"styled-components";var ks=ft.div`
|
|
1127
1127
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1128
1128
|
border: 1px solid;
|
|
1129
1129
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -1168,17 +1168,17 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1168
1168
|
:hover {
|
|
1169
1169
|
opacity: 0.8;
|
|
1170
1170
|
}
|
|
1171
|
-
`,h0=ft.div``,
|
|
1171
|
+
`,h0=ft.div``,Is=ft.p`
|
|
1172
1172
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1173
1173
|
font-weight: 400;
|
|
1174
1174
|
font-size: 14px;
|
|
1175
1175
|
line-height: 22px;
|
|
1176
|
-
`,
|
|
1176
|
+
`,Ns=ft.div`
|
|
1177
1177
|
display: flex;
|
|
1178
1178
|
flex-direction: row;
|
|
1179
1179
|
justify-content: flex-start;
|
|
1180
1180
|
align-items: center;
|
|
1181
|
-
`;var Os=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:n,appearance:r,customStepTypes:l})=>{var c,g;let p=t?{}:{transform:"rotate(90deg)"},d=t?{overflow:"hidden",maxHeight:"0px",transition:"max-height 0.35s ease-out"}:{overflow:"hidden",maxHeight:"1000px",transition:"max-height 0.7s ease-out"};function s(){var S,F;return Fe.createElement(Fe.Fragment,null,e.imageUri||e.videoUri?Fe.createElement(Ps,{className:a("stepMediaContainer",r)},e.imageUri?Fe.createElement(vs,{className:a("stepImage",r),src:e.imageUri}):null,e.videoUri?Fe.createElement(ot,{appearance:r,videoUri:e.videoUri,autoplay:(S=e.props)==null?void 0:S.autoplayVideo}):null):null,Fe.createElement(
|
|
1181
|
+
`;var Os=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:n,appearance:r,customStepTypes:l})=>{var c,g;let p=t?{}:{transform:"rotate(90deg)"},d=t?{overflow:"hidden",maxHeight:"0px",transition:"max-height 0.35s ease-out"}:{overflow:"hidden",maxHeight:"1000px",transition:"max-height 0.7s ease-out"};function s(){var S,F;return Fe.createElement(Fe.Fragment,null,e.imageUri||e.videoUri?Fe.createElement(Ps,{className:a("stepMediaContainer",r)},e.imageUri?Fe.createElement(vs,{className:a("stepImage",r),src:e.imageUri}):null,e.videoUri?Fe.createElement(ot,{appearance:r,videoUri:e.videoUri,autoplay:(S=e.props)==null?void 0:S.autoplayVideo}):null):null,Fe.createElement(Is,{className:a("stepSubtitle",r),appearance:r,dangerouslySetInnerHTML:R(e.subtitle)}),Fe.createElement(Ro,{className:a("checklistCTAContainer",r)},e.secondaryButtonTitle?Fe.createElement(le,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>n(),appearance:r}):null,Fe.createElement(le,{title:(F=e.primaryButtonTitle)!=null?F:"Continue",onClick:()=>i(),appearance:r})))}function u(){if(!l)return null;let S=l[e.type];return S?typeof S!="function"?S:S(e,r):null}return Fe.createElement(ks,{"data-testid":`step-${e.id}`,className:a("checklistStepContainer",r),appearance:r},Fe.createElement(Bs,{className:a("stepHeader",r),onClick:()=>o()},Fe.createElement(Ns,{className:a("stepHeaderContent",r)},Fe.createElement(ar,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(c=r==null?void 0:r.theme)==null?void 0:c.colorPrimary,appearance:r}),Fe.createElement(Es,{appearance:r,className:a("stepTitle",r),dangerouslySetInnerHTML:R(e.title)})),Fe.createElement(As,{className:a("stepChevronContainer",r),appearance:r},Fe.createElement(po,{style:V(w({},p),{transition:"transform 0.2s ease-in-out"})}))),Fe.createElement("div",{key:e.id,style:w({},d),className:a("stepContent",r)},(g=u())!=null?g:s()))};import co from"styled-components";var A0=co.div`
|
|
1182
1182
|
background: #ffffff;
|
|
1183
1183
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
1184
1184
|
border-radius: 6px;
|
|
@@ -1219,23 +1219,23 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1219
1219
|
padding: 24px;
|
|
1220
1220
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
1221
1221
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1222
|
-
`;var lc=({title:e,subtitle:t,steps:o,onClose:i,visible:n,autoExpandFirstIncompleteStep:r=!0,autoCollapse:l=!0,autoExpandNextStep:p=!0,setSelectedStep:d,appearance:s,type:u,className:c,customStepTypes:g,style:S,onButtonClick:F})=>{let h=o.filter(E=>E.complete).length,[x,k]=sc(Array(o.length).fill(!0));
|
|
1222
|
+
`;var lc=({title:e,subtitle:t,steps:o,onClose:i,visible:n,autoExpandFirstIncompleteStep:r=!0,autoCollapse:l=!0,autoExpandNextStep:p=!0,setSelectedStep:d,appearance:s,type:u,className:c,customStepTypes:g,style:S,onButtonClick:F})=>{let h=o.filter(E=>E.complete).length,[x,k]=sc(Array(o.length).fill(!0));nc(()=>{let E=[...x];if(r){for(let f=0;f<o.length;f++)if(!o[f].complete){E[f]=!1;break}k(E)}},[]);let b=E=>{let f=[...x];if(l)for(let A=0;A<x.length;++A)A!=E&&f[E]&&(f[A]=!0);f[E]=!x[E],k(f)};if(!n&&u=="modal")return Me.createElement(Me.Fragment,null);let v=Me.createElement(Me.Fragment,null,Me.createElement(Ls,null,Me.createElement($s,{appearance:s,className:a("checklistTitle",s),dangerouslySetInnerHTML:R(e)}),Me.createElement(Ms,{appearance:s,className:a("checklistSubtitle",s),dangerouslySetInnerHTML:R(t)})),Me.createElement(ze,{display:"percent",count:h,total:o.length,style:{margin:"14px 0px 8px 0px"},appearance:s})),$=Me.createElement(Ds,{className:Te(a("checklistContainer",s),c)},o.map((E,f)=>{var y;let A=x[f];return Me.createElement(Os,{appearance:s,stepData:E,collapsed:A,key:`modal-checklist-${(y=E.id)!=null?y:f}`,onClick:()=>{b(f),d(f),F&&F(o[f],f,x[f]?"expand":"collapse")},onPrimaryButtonClick:()=>{b(f),p&&f<o.length-1&&d(f+1),E.handlePrimaryButtonClick&&E.handlePrimaryButtonClick()},onSecondaryButtonClick:()=>{E.handleSecondaryButtonClick&&E.handleSecondaryButtonClick()},customStepTypes:g})}));return u==="inline"?Me.createElement(Us,{appearance:s,className:Te(a("checklistInlineContainer",s),c),style:S},v,$):Me.createElement(Me.Fragment,null,Me.createElement(et,{onClose:i,visible:n,appearance:s,style:{maxWidth:"600px"},headerContent:v},$))},Qr=lc;import he,{useEffect as Zr,useRef as gc,useState as Ht}from"react";import{useEffect as ac,useState as pc}from"react";var _s=()=>{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]=pc(t),n=null,r=()=>{n!==null?clearTimeout(n):l(),n=setTimeout(()=>{l()},16)},l=()=>{let p=Object.fromEntries(Object.entries(e).map(([d,s])=>{if(!window)return[d,!1];let u=window.matchMedia(s);return u.addEventListener("change",r),[d,u.matches]}));i(p)};return ac(()=>{l()},[]),o};import mo from"react";import xe,{css as Ws,keyframes as zs}from"styled-components";var Hs=Ws`
|
|
1223
1223
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1224
|
-
`,dc=
|
|
1224
|
+
`,dc=Ws`
|
|
1225
1225
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
1226
|
-
`,cc=
|
|
1226
|
+
`,cc=zs`
|
|
1227
1227
|
from {
|
|
1228
1228
|
opacity: 0;
|
|
1229
1229
|
} to {
|
|
1230
1230
|
opacity: 1;
|
|
1231
1231
|
}
|
|
1232
|
-
`,mc=
|
|
1232
|
+
`,mc=zs`
|
|
1233
1233
|
from {
|
|
1234
1234
|
opacity: 1;
|
|
1235
1235
|
} to {
|
|
1236
1236
|
opacity: 0;
|
|
1237
1237
|
}
|
|
1238
|
-
`,
|
|
1238
|
+
`,Vs=xe.div`
|
|
1239
1239
|
margin: 0 -20px;
|
|
1240
1240
|
overflow-x: auto;
|
|
1241
1241
|
padding-left: 20px;
|
|
@@ -1252,13 +1252,13 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1252
1252
|
::-webkit-scrollbar {
|
|
1253
1253
|
display: none;
|
|
1254
1254
|
}
|
|
1255
|
-
`,
|
|
1255
|
+
`,js=xe.div`
|
|
1256
1256
|
display: flex;
|
|
1257
1257
|
flex-flow: row nowrap;
|
|
1258
1258
|
gap: 0 16px;
|
|
1259
1259
|
scroll-snap-align: center;
|
|
1260
1260
|
scroll-snap-stop: always;
|
|
1261
|
-
`,
|
|
1261
|
+
`,Gs=xe.div`
|
|
1262
1262
|
animation: ${e=>e.reversed?mc:cc} 0.25s ease-out;
|
|
1263
1263
|
background: linear-gradient(
|
|
1264
1264
|
to right,
|
|
@@ -1268,8 +1268,8 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1268
1268
|
position: absolute;
|
|
1269
1269
|
width: 64px;
|
|
1270
1270
|
z-index: 10;
|
|
1271
|
-
`,
|
|
1272
|
-
${
|
|
1271
|
+
`,Ks=xe.button`
|
|
1272
|
+
${Hs}
|
|
1273
1273
|
box-shadow: 0 3px 10px 0 rgba(0, 0, 0, 0.1);
|
|
1274
1274
|
align-items: center;
|
|
1275
1275
|
border-radius: 50%;
|
|
@@ -1280,11 +1280,11 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1280
1280
|
justify-content: center;
|
|
1281
1281
|
position: absolute;
|
|
1282
1282
|
width: 48px;
|
|
1283
|
-
`,
|
|
1283
|
+
`,qs=xe.div`
|
|
1284
1284
|
border-radius: ${({theme:e})=>e.borderRadius}px;
|
|
1285
1285
|
padding: 20px;
|
|
1286
|
-
`,
|
|
1287
|
-
${
|
|
1286
|
+
`,Ys=xe(qs)`
|
|
1287
|
+
${Hs}
|
|
1288
1288
|
background: ${({theme:e})=>e.colorBackground};
|
|
1289
1289
|
position: relative;
|
|
1290
1290
|
|
|
@@ -1296,12 +1296,12 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1296
1296
|
${e=>e.blocked?"":`border: 1px solid ${e.theme.colorPrimary};`}
|
|
1297
1297
|
${e=>e.blocked?"cursor: default":"cursor: pointer"}
|
|
1298
1298
|
}
|
|
1299
|
-
`,
|
|
1299
|
+
`,Js=xe.img`
|
|
1300
1300
|
border-radius: 50%;
|
|
1301
1301
|
height: 40px;
|
|
1302
1302
|
margin-bottom: 12px;
|
|
1303
1303
|
width: 40px;
|
|
1304
|
-
`,
|
|
1304
|
+
`,Xs=xe(qs)`
|
|
1305
1305
|
${e=>B(e)} {
|
|
1306
1306
|
${dc}
|
|
1307
1307
|
|
|
@@ -1314,7 +1314,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1314
1314
|
align-items: center;
|
|
1315
1315
|
`,Y0=xe.div`
|
|
1316
1316
|
white-space: nowrap;
|
|
1317
|
-
`,
|
|
1317
|
+
`,Qs=xe.div`
|
|
1318
1318
|
background: #d8fed8;
|
|
1319
1319
|
border-radius: 6px;
|
|
1320
1320
|
float: right;
|
|
@@ -1326,9 +1326,9 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1326
1326
|
line-height: 22px;
|
|
1327
1327
|
letter-spacing: calc(18px * -0.01);
|
|
1328
1328
|
margin: 0;
|
|
1329
|
-
`,
|
|
1329
|
+
`,Zs=xe(uc)`
|
|
1330
1330
|
margin-bottom: 4px;
|
|
1331
|
-
`,
|
|
1331
|
+
`,Rs=xe.div`
|
|
1332
1332
|
display: flex;
|
|
1333
1333
|
flex-flow: row nowrap;
|
|
1334
1334
|
align-items: center;
|
|
@@ -1339,7 +1339,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1339
1339
|
line-height: 20px;
|
|
1340
1340
|
letter-spacing: calc(16px * -0.01);
|
|
1341
1341
|
margin: 0;
|
|
1342
|
-
`,
|
|
1342
|
+
`,el=xe(fc)`
|
|
1343
1343
|
margin-bottom: 4px;
|
|
1344
1344
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1345
1345
|
`}
|
|
@@ -1349,7 +1349,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1349
1349
|
font-size: 14px;
|
|
1350
1350
|
line-height: 22px;
|
|
1351
1351
|
margin: 0;
|
|
1352
|
-
`,
|
|
1352
|
+
`,tl=xe.p`
|
|
1353
1353
|
color: ${({theme:e})=>e.colorText};
|
|
1354
1354
|
font-weight: 600;
|
|
1355
1355
|
font-size: 12px;
|
|
@@ -1361,7 +1361,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1361
1361
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1362
1362
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1363
1363
|
`}
|
|
1364
|
-
`;var
|
|
1364
|
+
`;var ol=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=ce(),{primaryCTAClickSideEffects:n}=fe();o=i(o);let{imageUri:r=null,subtitle:l=null,title:p=null,complete:d=!1,blocked:s=!1}=e,u=e.primaryButtonTitle||e.secondaryButtonTitle,c=()=>{n(e)};return mo.createElement(Ys,{className:a("carouselCard",o),onClick:s?null:c,style:t,blocked:s,complete:d},r&&mo.createElement(Js,{className:a("carouselCardImage",o),src:r,alt:p,style:{opacity:d||s?.4:1}}),d&&mo.createElement(Qs,{className:a("carouselCompletedPill",o)},mo.createElement(tl,{style:{color:"#108E0B"}},"Complete")),p&&mo.createElement(el,{blocked:s,complete:d,className:a("carouselCardTitle",o),dangerouslySetInnerHTML:R(p)}),l&&mo.createElement(Tt.Quiet,{blocked:s,complete:d,className:a("carouselCardSubtitle",o),dangerouslySetInnerHTML:R(l)}))};var hc=()=>he.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},he.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),he.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),he.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),rl=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,n]=Ht(!1),[r,l]=Ht(!1);Zr(()=>{t===!0&&i===!1?n(!0):t===!1&&i===!0&&l(!0)},[t]);let p=()=>{n(!1),l(!1)},d=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return i?he.createElement(Gs,{style:d,reversed:r,onAnimationEnd:r?p:null},he.createElement(Ks,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},he.createElement(hc,null))):null},il=({flowId:e,appearance:t,customVariables:o,className:i})=>{let n=gc(null),[r,l]=Ht(!1),[p,d]=Ht(!1),[s,u]=Ht(null),[c,g]=Ht([]),[S,F]=Ht(0),{isSmall:h}=_s(),x=h?1:3,{getFlowMetadata:k,getFlowSteps:b,getNumberOfStepsCompleted:v,updateCustomVariables:$,isLoading:E}=ne();Zr(()=>{$(o)},[o,E]),Zr(()=>{if(E)return;let N=k(e),D=v(e),z=b(e);u(N),(N.data!==null||N.steps!==null)&&(g(z.sort((j,_)=>Number(j.complete)-Number(_.complete))),d(z.length>x),F(D))},[E]);let f=[];for(let N=0;N<c.length;N+=x)f.push(c.slice(N,N+x));let A=N=>{let D=N.target,z=D.scrollWidth-D.clientWidth,j=Math.ceil(D.scrollLeft);j>0&&r===!1&&l(!0),j===0&&r===!0&&l(!1),j<z&&p===!1&&d(!0),j===z&&p===!0&&d(!1)},y=(N=!0)=>{let D=N?1:-1;n.current!==null&&n.current.scrollBy({left:n.current.clientWidth*D,behavior:"smooth"})},T=null,I=N=>{T!==null?clearTimeout(T):A(N),T=setTimeout(()=>{A(N)},16)};return E?null:he.createElement(Xs,{className:Te(a("carouselContainer",t),i)},he.createElement("div",{style:{display:"flex",justifyContent:h?"center":"space-between",marginBottom:20,flexWrap:h?"wrap":"nowrap",gap:h?16:20}},he.createElement("div",null,he.createElement(Zs,{className:a("carouselTitle",t),dangerouslySetInnerHTML:R(s==null?void 0:s.title)}),he.createElement(Tt.Quiet,{className:a("carouselSubtitle",t),dangerouslySetInnerHTML:R(s==null?void 0:s.subtitle)})),he.createElement(Rs,{className:a("progressWrapper",t)},he.createElement(ze,{count:S,total:c.length,appearance:t}))),he.createElement("div",{style:{position:"relative"}},he.createElement(rl,{show:r,onClick:()=>y(!1)}),he.createElement(rl,{side:"right",show:p,onClick:y}),he.createElement(Vs,{ref:n,onScroll:I},f.map((N,D)=>he.createElement(js,{key:D,style:{flex:`0 0 calc(100% - ${c.length>x?36:0}px)`}},N.map((z,j)=>he.createElement(ol,{key:j,stepData:z,style:{flex:c.length>x?`0 1 calc(100% / ${x} - 16px * 2 / ${x})`:1},appearance:t})))))),he.createElement(ae,{appearance:t}))};var ei=$=>{var E=$,{flowId:e,title:t,subtitle:o,style:i,initialSelectedStep:n,className:r,type:l="inline",onDismiss:p,visible:d,customVariables:s,onStepCompletion:u,onButtonClick:c,appearance:g,hideOnFlowCompletion:S,setVisible:F,customStepTypes:h,checklistStyle:x="default",autoExpandFirstIncompleteStep:k,autoExpandNextStep:b}=E,v=$e(E,["flowId","title","subtitle","style","initialSelectedStep","className","type","onDismiss","visible","customVariables","onStepCompletion","onButtonClick","appearance","hideOnFlowCompletion","setVisible","customStepTypes","checklistStyle","autoExpandFirstIncompleteStep","autoExpandNextStep"]);let{getFlow:f,getFlowSteps:A,markStepCompleted:y,getStepStatus:T,getNumberOfStepsCompleted:I,isLoading:N,targetingLogicShouldHideFlow:D,updateCustomVariables:z,getFlowMetadata:j,isStepBlocked:_,getFlowStatus:G,hasActiveFullPageFlow:K,setHasActiveFullPageFlow:O,markStepStarted:ee,getCurrentStepIndex:q}=ne(),{primaryCTAClickSideEffects:se,secondaryCTAClickSideEffects:Se}=fe(),{getOpenFlowState:ke,setOpenFlowState:Z}=Ie(),[U,ie]=nl(n||0),[Pe,je]=nl(!1),ve=d===void 0?ke(e):d,pe=l==="modal",{mergeAppearanceWithDefault:H}=ce();Ke(e,d);let J=A(e),te=q(e);if(g=H(g),Rr(()=>{z(s)},[s,N]),Rr(()=>{d!==void 0&&(pe&&d===!0?O(!0):pe&&d===!1&&O(!1))},[d,F,K]),Rr(()=>{U!==te&&ie(te)},[te]),N)return null;let M=f(e);if(!M||D(M)||!J||S===!0&&G(e)===de)return null;let Q=j(e);if(Q!=null&&Q.title&&(t=Q.title),Q!=null&&Q.subtitle&&(o=Q.subtitle),!Pe&&n===void 0&&I(e)>0){let m=J.findIndex(C=>C.complete===!1);ie(m>-1?m:J.length-1),je(!0)}function we(){if(U+1>=J.length){pe&&Z(e,!1);return}_(e,J[U+1].id)||ie(U+1)}function Ge(m,C,P){let W=U+1<J.length?J[U+1]:null;c&&c(m,U,C,W)===!0&&pe&&Qe(),u&&u(m,P,W),!u&&!c&&(m.primaryButtonUri||m.secondaryButtonUri)&&pe&&Qe()}function xt(){return J.map((m,C)=>V(w({},m),{handleSecondaryButtonClick:()=>{we(),Se(m),m.skippable===!0&&y(e,m.id,{skipped:!0}),Ge(m,"secondary",C)},handlePrimaryButtonClick:()=>{(!m.completionCriteria&&(m.autoMarkCompleted||m.autoMarkCompleted===void 0)||m.completionCriteria&&m.autoMarkCompleted===!0)&&(y(e,m.id),we()),Ge(m,"primary",C),se(m),T(e,m.id)===Ue&&we()}}))}function Ye(){return Ce.createElement(ae,{appearance:g})}let nt={steps:xt(),title:t,subtitle:o,primaryColor:g.theme.colorPrimary,appearance:g,customStepTypes:h,type:l,className:r,autoExpandFirstIncompleteStep:k,autoExpandNextStep:b};function Qe(){Z(e,!1),p&&p(),F&&F(!1)}function vt(){return Ce.createElement(Ce.Fragment,null,Ce.createElement(Ye,null),Ce.createElement(il,{flowId:e,appearance:g,customVariables:s,className:r}))}function jt(){return Ce.createElement(Ce.Fragment,null,Ce.createElement(Ye,null),Ce.createElement(Qr,w({visible:ve,onClose:()=>{Qe()},selectedStep:U,setSelectedStep:ie,autoExpandNextStep:!0,appearance:g,onButtonClick:c},nt)))}function Gt(){var P;let m=v.guideFlowId,C;return m&&f(m)&&(C=A(m)),Ce.createElement(Ce.Fragment,null,Ce.createElement(Ye,null),Ce.createElement(Xr,w({visible:ve,stepsTitle:Q.stepsTitle?Q.stepsTitle:"Your quick start guide",onClose:()=>{Qe()},selectedStep:U,setSelectedStep:ie,guideData:C,guideTitle:(P=v.guideTitle)!=null?P:"Guide",appearance:g,title:t,subtitle:o,onGuideButtonClick:W=>{Ge(W,"link",0)},customStepTypes:h},nt)))}function Bt(){let m=Ce.createElement(Yr,w({flowId:e,style:i,selectedStep:U,setSelectedStep:ie,appearance:g,type:l},nt));return pe?Ce.createElement(et,{onClose:()=>{Qe()},visible:ve,appearance:g,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},Ce.createElement(Ye,null),m):Ce.createElement(Ce.Fragment,null,Ce.createElement(Ye,null),m)}switch(x){case"condensed":return jt();case"with-guide":return Gt();case"default":return Bt();case"carousel":return vt();default:return Bt()}};var Cc=e=>xc.createElement(ei,w({type:"inline"},e));import kt,{useEffect as yc}from"react";import it from"react";import gr from"styled-components";var sl=gr.div`
|
|
1365
1365
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1366
1366
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1367
1367
|
padding: 10px 12px 10px 12px;
|
|
@@ -1373,27 +1373,27 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1373
1373
|
&:hover {
|
|
1374
1374
|
filter: brightness(.99);
|
|
1375
1375
|
}
|
|
1376
|
-
`,
|
|
1376
|
+
`,ll=gr.div`
|
|
1377
1377
|
display: flex;
|
|
1378
1378
|
flex-direction: row;
|
|
1379
1379
|
justify-content: space-between;
|
|
1380
1380
|
align-items: center;
|
|
1381
1381
|
margin-bottom: ${e=>e.type==="condensed"?"0":"6px"};
|
|
1382
1382
|
flex-grow: 2;
|
|
1383
|
-
`,
|
|
1383
|
+
`,al=gr.div`
|
|
1384
1384
|
text-overflow: ellipsis;
|
|
1385
1385
|
font-weight: 600;
|
|
1386
1386
|
font-size: 14px;
|
|
1387
1387
|
line-height: 16px;
|
|
1388
1388
|
margin-right: ${e=>e.type==="condensed"?"8px":"0"};
|
|
1389
1389
|
text-align: ${e=>e.type==="condensed"?"left":"right"};
|
|
1390
|
-
`,
|
|
1390
|
+
`,pl=gr.div`
|
|
1391
1391
|
width: 20px;
|
|
1392
1392
|
margin-right: 8px;
|
|
1393
1393
|
display: flex;
|
|
1394
1394
|
height: 100%;
|
|
1395
1395
|
align-items: center;
|
|
1396
|
-
`;var
|
|
1396
|
+
`;var dl=({title:e,count:t,total:o,onClick:i,style:n={},className:r,appearance:l,type:p="default"})=>it.createElement(it.Fragment,null,it.createElement(ae,{appearance:l}),it.createElement(sl,{onClick:()=>i!==void 0&&i(),styleOverrides:w(w({},p=="condensed"?{display:"flex",justifyContent:"space-between"}:{}),n),className:Te(r!=null?r:"",a("progressBadgeContainer",l)),appearance:l},p=="condensed"&&o&&o!==0&&it.createElement(pl,{className:a("progressRingContainer",l)},it.createElement(Zt,{size:19,percentage:t/o,fillColor:l.theme.colorPrimary,bgColor:l.theme.colorBackgroundSecondary})),it.createElement(ll,{type:p,className:a("badgeTitleContainer",l)},it.createElement(al,{type:p,appearance:l,className:a("badgeTitle",l)},e),i!==void 0&&it.createElement(po,{className:a("badgeChevron",l),color:l.theme.colorPrimary})),p=="default"&&o&&o!==0&&it.createElement(ze,{display:"compact",count:t,total:o,bgColor:l.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:l,textStyle:{color:"#818898"}})));import Ft from"react";import Do from"styled-components";var cl=Do.div`
|
|
1397
1397
|
display: flex;
|
|
1398
1398
|
flex-direction: row;
|
|
1399
1399
|
width: 100%;
|
|
@@ -1403,19 +1403,19 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1403
1403
|
background-color: ${e=>e.appearance.theme.colorBackground};
|
|
1404
1404
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1405
1405
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1406
|
-
`,
|
|
1406
|
+
`,ml=Do.div`
|
|
1407
1407
|
${e=>B(e)} {
|
|
1408
1408
|
display: flex;
|
|
1409
1409
|
justify-content: center;
|
|
1410
1410
|
align-items: center;
|
|
1411
1411
|
margin-right: 16px;
|
|
1412
1412
|
}
|
|
1413
|
-
`,
|
|
1413
|
+
`,ul=Do.div`
|
|
1414
1414
|
display: flex;
|
|
1415
1415
|
flex-direction: column;
|
|
1416
1416
|
flex: 1;
|
|
1417
1417
|
margin-top: 0;
|
|
1418
|
-
`,
|
|
1418
|
+
`,fl=Do.div`
|
|
1419
1419
|
display: flex;
|
|
1420
1420
|
flex-direction: column;
|
|
1421
1421
|
justify-content: center;
|
|
@@ -1430,7 +1430,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1430
1430
|
:hover {
|
|
1431
1431
|
opacity: 0.8;
|
|
1432
1432
|
}
|
|
1433
|
-
`;var
|
|
1433
|
+
`;var gl=({title:e,subtitle:t,icon:o,appearance:i,count:n,total:r,className:l,style:p})=>Ft.createElement(Ft.Fragment,null,Ft.createElement(cl,{appearance:i,className:Te(a("fullWidthProgressBadgeContainer",i),l!=null?l:""),style:p},o&&Ft.createElement(ml,{className:a("fullWidthProgressBadgeIcon",i)},o),Ft.createElement(ul,null,Ft.createElement(Oe,{size:"small",appearance:i,title:e,subtitle:t})),Ft.createElement(fl,{className:a("fullWidthProgressBadgeProgressContainer",i)},Ft.createElement(ze,{count:n,total:r,display:"percent",textLocation:"top"}))));var Sc=({flowId:e,title:t,subtitle:o,icon:i,style:n,onClick:r,className:l,customVariables:p,hideOnFlowCompletion:d,appearance:s,type:u="default"})=>{let{getFlow:c,getFlowSteps:g,getFlowStatus:S,getNumberOfStepsCompleted:F,isLoading:h,targetingLogicShouldHideFlow:x,updateCustomVariables:k}=ne(),{mergeAppearanceWithDefault:b}=ce();s=b(s);let{setOpenFlowState:v,getOpenFlowState:$}=Ie();if(yc(()=>{k(p)},[p,h]),h)return null;let E=c(e);if(!E||x(E)||d===!0&&S(e)===de)return null;let f=g(e),A=F(e);return u==="full-width"?kt.createElement(kt.Fragment,null,kt.createElement(ae,{appearance:s}),kt.createElement(gl,{title:t,subtitle:o,count:A,total:f.length,style:n,className:l,appearance:s,icon:i,onClick:()=>{}})):kt.createElement(kt.Fragment,null,kt.createElement(ae,{appearance:s}),kt.createElement(dl,{count:A,total:f.length,title:t,style:n,onClick:()=>{v(e,!0),r&&r()},type:u,className:l,appearance:s}))};import bc from"react";var wc=n=>{var r=n,{flowId:e,style:t,appearance:o}=r,i=$e(r,["flowId","style","appearance"]);let{getFlow:l,targetingLogicShouldHideFlow:p,getFlowSteps:d}=ne(),{mergeAppearanceWithDefault:s}=ce();o=s(o);let u=l(e);if(!u||p(u))return null;let c=d(e);return bc.createElement(Mo,w({steps:c,style:t,appearance:o},i))};import gt,{useContext as $c,useEffect as Mc}from"react";import X,{useEffect as uo,useLayoutEffect as Cl,useRef as Bc,useState as fo}from"react";import Uo from"styled-components";import{useCallback as Tc,useEffect as Fc,useState as kc}from"react";var ti=(e,t,o,i={x:20,y:20},n)=>{let r=n=="fixed"?0:window.scrollY,l=n=="fixed"?0:window.scrollX;return t==="left"?{x:e.left-o+i.x+l,y:e.top-i.y+r}:t==="right"?{x:e.left+e.width+i.x+l,y:e.top-i.y+r}:{x:0,y:0}};function hl(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,n]=kc(o),r=Tc(()=>{e&&n(e.getBoundingClientRect())},[e]);return Fc(()=>(r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)),[e,t]),i}import{useContext as Pc,useState as vc}from"react";function xl(){let{debug:e}=Pc(re),[t,o]=vc([]);function i(r){e&&(t.find(l=>l===r)||(o([...t,r]),console.log(r)))}function n(r){e&&(t.find(l=>l===r)||(o([...t,r]),console.warn(r)))}return{logIfDebugMode:i,logErrorIfDebugMode:n}}var yl=300,Sl=100,Ec=500,go=12,Ac=Uo.div`
|
|
1434
1434
|
width: 100%;
|
|
1435
1435
|
height: 100%;
|
|
1436
1436
|
border-radius: 9999px;
|
|
@@ -1453,25 +1453,25 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1453
1453
|
opacity: 0;
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
|
-
`,
|
|
1456
|
+
`,Ic=Uo.div`
|
|
1457
1457
|
width: ${go}px;
|
|
1458
1458
|
height: ${go}px;
|
|
1459
1459
|
border-radius: 100px;
|
|
1460
1460
|
background-color: ${e=>e.primaryColor};
|
|
1461
1461
|
z-index: 20;
|
|
1462
1462
|
opacity: 1;
|
|
1463
|
-
`,
|
|
1463
|
+
`,Nc=Uo.div`
|
|
1464
1464
|
pointer-events: all;
|
|
1465
|
-
`,
|
|
1465
|
+
`,bl=Uo.div`
|
|
1466
1466
|
display: flex;
|
|
1467
1467
|
align-content: center;
|
|
1468
1468
|
justify-content: center;
|
|
1469
1469
|
align-items: center;
|
|
1470
1470
|
z-index: ${e=>e.zIndex?e.zIndex:90};
|
|
1471
|
-
`,Oc=Uo(
|
|
1471
|
+
`,Oc=Uo(bl)`
|
|
1472
1472
|
width: ${go+12}px;
|
|
1473
1473
|
height: ${go+12}px;
|
|
1474
|
-
`,Lc=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:n=!0,primaryColor:r="#000000",offset:l={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:s=0,customStepTypes:u,appearance:c,dismissible:g=!1,showHighlightOnly:S,showStepCount:F=!0,completedStepsCount:h=0,showFrigadeBranding:x=!1,cssPosition:k="absolute",onViewTooltip:b,className:v})=>{var xt,Ye,nt,Qe,vt,jt,Gt,Bt,m,C,P,W,Be,Et,At,
|
|
1474
|
+
`,Lc=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:n=!0,primaryColor:r="#000000",offset:l={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:s=0,customStepTypes:u,appearance:c,dismissible:g=!1,showHighlightOnly:S,showStepCount:F=!0,completedStepsCount:h=0,showFrigadeBranding:x=!1,cssPosition:k="absolute",onViewTooltip:b,className:v})=>{var xt,Ye,nt,Qe,vt,jt,Gt,Bt,m,C,P,W,Be,Et,At,It,ge,xo,Co;let{logErrorIfDebugMode:$}=xl(),[E,f]=fo(),[A,y]=fo(new Date),T=Bc(null),[I,N]=fo(document.querySelector(e[s].selector)),D=hl(I,A),[z,j]=fo(),[_,G]=fo(!S),K=(Ye=(xt=e[s])==null?void 0:xt.props)!=null&&Ye.position?e[s].props.position:k,O=(vt=(Qe=(nt=e[s])==null?void 0:nt.props)==null?void 0:Qe.zIndex)!=null?vt:90,ee=(jt=E==null?void 0:E.width)!=null?jt:yl,q=(Gt=E==null?void 0:E.height)!=null?Gt:Sl,[se,Se]=fo(new Date().getTime());l=(C=(m=(Bt=e[s])==null?void 0:Bt.props)==null?void 0:m.offset)!=null?C:l;let ke=window.location.pathname.split("/").pop();Cl(()=>{T.current&&f({width:T.current.clientWidth,height:T.current.clientHeight})},[s,A,K]),uo(()=>{S||G(!0)},[s]),uo(()=>{p&&_&&b(s)},[_]);let Z=()=>{if(K==="static")return;let oe=document.querySelector(e[s].selector);if(!oe){j(void 0),N(null),$(`FrigadeTour: Could not find element with selector "${e[s].selector}" for step ${e[s].id}`);return}z&&z===JSON.stringify(oe==null?void 0:oe.getBoundingClientRect())||(N(oe),y(new Date),oe&&j(JSON.stringify(oe.getBoundingClientRect())))};if(uo(()=>{let oe=new MutationObserver(Z);return oe.observe(document.body,{subtree:!0,childList:!0}),()=>oe.disconnect()},[Z]),uo(()=>{let oe=new MutationObserver(Z);return oe.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>oe.disconnect()},[Z]),uo(()=>{let oe=setInterval(()=>{Z()},10);return()=>clearInterval(oe)},[Z]),Cl(()=>{setTimeout(()=>{Z()},Ec),Z()},[s,ke]),uo(()=>{if(!p)return;let oe=Ze=>{Ze.key==="Escape"&&t()};return document.addEventListener("keydown",oe),()=>{document.removeEventListener("keydown",oe)}},[]),I===null||!p)return null;let U=i==="auto"?"right":i,ie=ti(D,U,ee,l,K),Pe=D.right+ee>(window.innerWidth||document.documentElement.clientWidth),je=D.bottom+Sl>(window.innerHeight||document.documentElement.clientHeight);Pe&&i==="auto"&&(ie=ti(D,"left",ee,l,K),U="left"),(W=(P=e[s])==null?void 0:P.props)!=null&&W.tooltipPosition&&((Et=(Be=e[s])==null?void 0:Be.props)==null?void 0:Et.tooltipPosition)!=="auto"&&(((It=(At=e[s])==null?void 0:At.props)==null?void 0:It.tooltipPosition)==="left"||((xo=(ge=e[s])==null?void 0:ge.props)==null?void 0:xo.tooltipPosition)==="right")&&(U=e[s].props.tooltipPosition);let ve=()=>{let oe=()=>{if(e[s].handlePrimaryButtonClick&&(e[s].handlePrimaryButtonClick(),G(!1),setTimeout(()=>{Z()},30)),h===e.length-1)return o()},Ze=()=>{e[s].handleSecondaryButtonClick&&(e[s].handleSecondaryButtonClick(),S&&!e[s].secondaryButtonUri&&G(!1))};return X.createElement(X.Fragment,null,F&&e.length>1&&X.createElement(ki,null,X.createElement(vi,{role:"status",className:a("tooltipStepCounter",c)},s+1," of ",e.length)),(e[s].primaryButtonTitle||e[s].secondaryButtonTitle)&&X.createElement(Pi,{showStepCount:F,className:a("tooltipCTAContainer",c)},e[s].secondaryButtonTitle&&X.createElement(le,{title:e[s].secondaryButtonTitle,appearance:c,onClick:Ze,size:"small",withMargin:!1,secondary:!0}),e[s].primaryButtonTitle&&X.createElement(le,{title:e[s].primaryButtonTitle,appearance:c,onClick:oe,autoFocus:!0,withMargin:!1,size:"small"})))},pe=()=>{var oe;return X.createElement(X.Fragment,null,g&&X.createElement(Si,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:a("tooltipClose",c),hasImage:!!e[s].imageUri||!!e[s].videoUri,"aria-label":"Close Tooltip",role:"button",tabIndex:0},X.createElement(Ne,null)),e[s].imageUri&&X.createElement(bi,{dismissible:g,appearance:c,role:"img","aria-label":e[s].title,src:e[s].imageUri,className:a("tooltipImageContainer",c)}),e[s].videoUri&&!e[s].imageUri&&X.createElement(wi,{dismissible:g,appearance:c,role:"video","aria-label":e[s].title,className:a("tooltipVideoContainer",c)},X.createElement(ot,{appearance:c,videoUri:e[s].videoUri,autoplay:(oe=e[s].props)==null?void 0:oe.autoplayVideo})),X.createElement(Fi,{className:a("tooltipContentContainer",c)},X.createElement(Oe,{appearance:c,title:e[s].title,subtitle:e[s].subtitle,size:"small",ariaPrefix:`Tooltip${e[s].id}`}),X.createElement(Ti,{className:a("tooltipFooter",c)},X.createElement(ve,null))))},J=w(w({},{default:oe=>{var Ze;if((Ze=e[s])!=null&&Ze.StepContent){let ia=e[s].StepContent;return X.createElement("div",null,ia)}return X.createElement(pe,null)}}),u),te=()=>{var oe;return e?!((oe=e[s])!=null&&oe.type)||!J[e[s].type]?J.default(e[s]):J[e[s].type]({stepData:e[s],primaryColor:r}):X.createElement(X.Fragment,null)};if(e[s].complete===!0||ie.x==0&&ie.y==0&&new Date().getTime()-se<100)return null;let M={top:(ie==null?void 0:ie.y)-go,left:(Co=U=="left"?D.x+l.x:(ie==null?void 0:ie.x)-go)!=null?Co:0,cursor:S?"pointer":"default",position:K},Q=()=>{let Ze=M.left+(U=="left"?-ee:24);return Math.min(Math.max(Ze,20),window.innerWidth-ee-20)},we=()=>{if(K==="fixed")return M.top;let oe=M.top+q,Ze=20;return oe>window.innerHeight-Ze?M.top+-q:M.top},Ge=()=>{S&&(y(new Date),G(!_))};return X.createElement(Nc,{className:v},X.createElement(Oc,{style:M,zIndex:O,className:a("tourHighlightContainer",c)},n&&e[s].showHighlight!==!1&&k!=="static"&&X.createElement(X.Fragment,null,X.createElement(Ic,{style:{position:K},onClick:Ge,primaryColor:c.theme.colorPrimary,className:a("tourHighlightInnerCircle",c)}),X.createElement(Ac,{style:{position:"absolute"},onClick:Ge,primaryColor:c.theme.colorPrimary,className:a("tourHighlightOuterCircle",c)}))),X.createElement(bl,{style:V(w({},M),{left:Q(),top:we()}),zIndex:O+1,className:a("tooltipContainerWrapper",c)},_&&X.createElement(X.Fragment,null,X.createElement(Vo,{ref:T,role:"dialog","aria-labelledby":`frigadeTooltip${e[s].id}Title`,"aria-describedby":`frigadeTooltip${e[s].id}Subtitle`,layoutId:"tooltip-container",tabIndex:0,"aria-label":"Tooltip",style:w({position:"relative",width:"max-content",right:0,top:k!=="static"?12:0},d),appearance:c,className:a("tooltipContainer",c),maxWidth:yl,zIndex:O+10},X.createElement(te,null)),x&&X.createElement(Ei,{className:a("poweredByFrigadeTooltipRibbon",c),appearance:c,zIndex:O+10},X.createElement(jo,{appearance:c})))))},_o=Lc;import{Portal as Dc}from"react-portal";var Uc=x=>{var k=x,{flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:n,showTooltipsSimultaneously:r=!1,onDismiss:l,dismissible:p,tooltipPosition:d="auto",showHighlightOnly:s=!1,dismissBehavior:u="skip-flow",onComplete:c,skipIfNotFound:g=!1,cssPosition:S="absolute",className:F}=k,h=$e(k,["flowId","customVariables","appearance","onStepCompletion","onButtonClick","showTooltipsSimultaneously","onDismiss","dismissible","tooltipPosition","showHighlightOnly","dismissBehavior","onComplete","skipIfNotFound","cssPosition","className"]);let{getFlow:b,getFlowSteps:v,isLoading:$,targetingLogicShouldHideFlow:E,markStepCompleted:f,markStepStarted:A,markFlowCompleted:y,markFlowSkipped:T,updateCustomVariables:I,getCurrentStepIndex:N,getStepStatus:D,isStepBlocked:z,getFlowStatus:j,getNumberOfStepsCompleted:_}=ne(),{isLoadingUserFlowStateData:G}=_e(),{primaryCTAClickSideEffects:K,secondaryCTAClickSideEffects:O}=fe(),{hasOpenModals:ee}=Ie(),q=N(e),{openFlowStates:se}=$c(re),{mergeAppearanceWithDefault:Se}=ce();if(o=Se(o),Mc(()=>{I(t)},[t,$]),G)return null;let ke=b(e);if(!ke||E(ke)||j(e)==de||ee())return null;let Z=v(e);if(Object.keys(se).length>0){let M=Object.keys(se).find(Q=>se[Q]===!0);if(M!==void 0&&M!==e)return gt.createElement(gt.Fragment,null)}function U(M){return L(this,null,function*(){if(yield f(e,M.id),Z.map(Q=>D(e,Q.id)).every(Q=>Q===Ue)){yield y(e);return}!s&&q+1<Z.length&&!r&&z(e,Z[q+1].id)})}function ie(M,Q,we){let Ge=q+1<Z.length?Z[q+1]:null;n&&n(M,q,Q,Ge),i&&i(M,we,Ge)}function Pe(){return Z.map(M=>V(w({},M),{handleSecondaryButtonClick:()=>L(this,null,function*(){O(M),M.skippable===!0&&(yield f(e,M.id,{skipped:!0})),ie(M,"secondary",q)}),handlePrimaryButtonClick:()=>L(this,null,function*(){(!M.completionCriteria&&(M.autoMarkCompleted||M.autoMarkCompleted===void 0)||M.completionCriteria&&M.autoMarkCompleted===!0)&&(yield U(M)),ie(M,"primary",q),K(M)})}))}function je(M){return L(this,null,function*(){l&&l(),u==="skip-flow"?yield T(e):yield f(e,M.id)})}function ve(){c&&c()}function pe(M){return L(this,null,function*(){yield A(e,Z[M].id)})}let H=!document.querySelector(Z[q].selector);function J(){let M=Z.findIndex((Q,we)=>!!document.querySelector(Q.selector)&&we>=q);return Z.map((Q,we)=>r?gt.createElement(_o,w({key:Q.id,appearance:o,steps:Pe(),selectedStep:we,showTooltipsSimultaneously:r,dismissible:p,onDismiss:()=>je(Q),tooltipPosition:d,showHighlightOnly:s,completedStepsCount:_(e),onComplete:ve,cssPosition:S,onViewTooltip:pe,className:F},h)):g&&H&&we===M?gt.createElement(_o,w({key:Q.id,appearance:o,steps:Pe(),selectedStep:we,showTooltipsSimultaneously:r,dismissible:p,onDismiss:()=>je(Q),tooltipPosition:d,showHighlightOnly:s,completedStepsCount:_(e),onComplete:ve,cssPosition:S,onViewTooltip:pe,className:F},h)):we!=q?null:gt.createElement(_o,w({key:Q.id,appearance:o,steps:Pe(),selectedStep:we,showTooltipsSimultaneously:r,dismissible:p,onDismiss:()=>je(Q),tooltipPosition:d,showHighlightOnly:s,completedStepsCount:_(e),onComplete:ve,cssPosition:S,onViewTooltip:pe,className:F},h)))}function te(){return gt.createElement(gt.Fragment,null,gt.createElement(ae,{appearance:o}),J())}return S==="static"?te():gt.createElement(Dc,null,te())};import Le,{useEffect as _c,useRef as Wc,useState as zc}from"react";import{Portal as Hc}from"react-portal";import Vt from"styled-components";var wl=Vt.button`
|
|
1475
1475
|
${e=>B(e)} {
|
|
1476
1476
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1477
1477
|
|
|
@@ -1489,17 +1489,17 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1489
1489
|
opacity: 0.8;
|
|
1490
1490
|
}
|
|
1491
1491
|
}
|
|
1492
|
-
`,
|
|
1492
|
+
`,Tl=Vt.span`
|
|
1493
1493
|
${e=>B(e)} {
|
|
1494
1494
|
font-size: 12px;
|
|
1495
1495
|
display: inline-block;
|
|
1496
1496
|
}
|
|
1497
|
-
`,
|
|
1497
|
+
`,Fl=Vt.span`
|
|
1498
1498
|
${e=>B(e)} {
|
|
1499
1499
|
font-size: 12px;
|
|
1500
1500
|
display: inline-block;
|
|
1501
1501
|
}
|
|
1502
|
-
`,
|
|
1502
|
+
`,kl=Vt.div`
|
|
1503
1503
|
position: fixed;
|
|
1504
1504
|
right: 0;
|
|
1505
1505
|
bottom: 0;
|
|
@@ -1509,7 +1509,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1509
1509
|
flex-direction: column;
|
|
1510
1510
|
align-items: flex-end;
|
|
1511
1511
|
z-index: 50;
|
|
1512
|
-
`,
|
|
1512
|
+
`,Pl=Vt.button`
|
|
1513
1513
|
${e=>B(e)} {
|
|
1514
1514
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1515
1515
|
background-color: #ffffff;
|
|
@@ -1525,7 +1525,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1525
1525
|
0px 3px 6px -4px rgba(0, 0, 0, 0.12);
|
|
1526
1526
|
border-radius: 45px;
|
|
1527
1527
|
cursor: pointer;
|
|
1528
|
-
`,
|
|
1528
|
+
`,vl=Vt.div`
|
|
1529
1529
|
${e=>B(e)} {
|
|
1530
1530
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1531
1531
|
background: #ffffff;
|
|
@@ -1542,7 +1542,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1542
1542
|
position: ${e=>e.type=="inline"?"absolute":"relative"};
|
|
1543
1543
|
top: ${e=>e.type=="inline"?"68px":0};
|
|
1544
1544
|
margin-left: ${e=>e.type=="inline"?"-127px":0};
|
|
1545
|
-
`,
|
|
1545
|
+
`,Bl=Vt.button`
|
|
1546
1546
|
${e=>B(e)} {
|
|
1547
1547
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1548
1548
|
color: #434343;
|
|
@@ -1559,7 +1559,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1559
1559
|
font-size: 14px;
|
|
1560
1560
|
|
|
1561
1561
|
padding: 8px 12px;
|
|
1562
|
-
`;import
|
|
1562
|
+
`;import El from"react";var Al=({style:e,className:t})=>El.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},El.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 Vc=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:n="inline",title:r="Help",appearance:l})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:s,getStepStatus:u,getNumberOfStepsCompleted:c,isLoading:g,targetingLogicShouldHideFlow:S}=ne(),{primaryCTAClickSideEffects:F}=fe(),h=Wc(null),[x,k]=zc(!1),{mergeAppearanceWithDefault:b}=ce();l=b(l),_c(()=>(document.addEventListener("click",v,!1),()=>{document.removeEventListener("click",v,!1)}),[]);let v=y=>{h.current&&!h.current.contains(y.target)&&k(!1)};if(g)return null;let $=p(e);if(!$||S($))return null;let E=d(e);if(!E||!i)return null;function f(y,T){!y.completionCriteria&&(y.autoMarkCompleted||y.autoMarkCompleted===void 0)&&s(e,y.id),F(y),o&&o(y,T),k(!1)}function A(){return x&&Le.createElement(vl,{className:a("floatingWidgetMenu",l),initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:n},E.map((y,T)=>Le.createElement(Bl,{className:a("floatingWidgetMenuItem",l),key:T,onClick:()=>f(y,T)},y.title)))}return n=="inline"?Le.createElement("span",{ref:h},Le.createElement(ae,{appearance:l}),Le.createElement(wl,{style:t,onClick:()=>{k(!x)},className:a("supportButton",l)},Le.createElement(Fl,{className:a("supportIconContainer",l)},Le.createElement(Nl,{className:a("supportIcon",l),style:{width:"18px",height:"18px"}})),Le.createElement(Tl,{className:a("supportButtonTitle",l)},r)),Le.createElement(A,null)):Le.createElement(Hc,null,Le.createElement(ae,{appearance:l}),Le.createElement(kl,{style:t,ref:h},Le.createElement(A,null),Le.createElement(Pl,{onClick:()=>{k(!x)},whileHover:{scale:1.1},className:a("floatingWidgetButton",l)},Le.createElement(Al,{className:a("floatingWidgetButtonIcon",l),style:{display:"flex",width:"20px",height:"20px"}}))))};import Ve,{useEffect as Kc}from"react";import hr from"styled-components";var Ol=hr.div`
|
|
1563
1563
|
${e=>B(e)} {
|
|
1564
1564
|
display: flex;
|
|
1565
1565
|
flex-direction: column;
|
|
@@ -1574,18 +1574,18 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1574
1574
|
border-radius: 12px;
|
|
1575
1575
|
position: relative;
|
|
1576
1576
|
}
|
|
1577
|
-
|
|
1577
|
+
`,Ll=hr.div`
|
|
1578
1578
|
display: flex;
|
|
1579
1579
|
flex-direction: column;
|
|
1580
1580
|
flex: 1;
|
|
1581
|
-
|
|
1581
|
+
`,$l=hr.div`
|
|
1582
1582
|
display: flex;
|
|
1583
1583
|
flex-direction: row;
|
|
1584
1584
|
justify-content: flex-start;
|
|
1585
1585
|
align-items: center;
|
|
1586
1586
|
margin-top: 16px;
|
|
1587
1587
|
gap: 12px;
|
|
1588
|
-
`,
|
|
1588
|
+
`,Ml=hr.div`
|
|
1589
1589
|
${e=>B(e)} {
|
|
1590
1590
|
position: absolute;
|
|
1591
1591
|
top: 16px;
|
|
@@ -1596,7 +1596,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1596
1596
|
opacity: 0.8;
|
|
1597
1597
|
}
|
|
1598
1598
|
}
|
|
1599
|
-
`;import Pt from"styled-components";var
|
|
1599
|
+
`;import Pt from"styled-components";var Dl=Pt.div`
|
|
1600
1600
|
${e=>B(e)} {
|
|
1601
1601
|
display: flex;
|
|
1602
1602
|
flex-direction: column;
|
|
@@ -1607,28 +1607,28 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1607
1607
|
background-color: ${e=>e.appearance.theme.colorBackground};
|
|
1608
1608
|
position: relative;
|
|
1609
1609
|
}
|
|
1610
|
-
`,
|
|
1610
|
+
`,Ul=Pt.div`
|
|
1611
1611
|
display: flex;
|
|
1612
1612
|
flex-direction: column;
|
|
1613
1613
|
flex: 1;
|
|
1614
|
-
`,
|
|
1614
|
+
`,_l=Pt.div`
|
|
1615
1615
|
display: flex;
|
|
1616
1616
|
flex-direction: column;
|
|
1617
1617
|
justify-content: center;
|
|
1618
1618
|
align-items: center;
|
|
1619
1619
|
margin-bottom: 12px;
|
|
1620
1620
|
margin-top: 4px;
|
|
1621
|
-
`,
|
|
1621
|
+
`,Wl=Pt.div`
|
|
1622
1622
|
display: flex;
|
|
1623
1623
|
flex-direction: row;
|
|
1624
1624
|
justify-content: center;
|
|
1625
1625
|
align-items: stretch;
|
|
1626
1626
|
gap: 16px;
|
|
1627
1627
|
margin-top: 8px;
|
|
1628
|
-
`,
|
|
1628
|
+
`,xr=Pt.div`
|
|
1629
1629
|
margin-top: 16px;
|
|
1630
1630
|
margin-bottom: 16px;
|
|
1631
|
-
`,
|
|
1631
|
+
`,zl=Pt.div`
|
|
1632
1632
|
${e=>B(e)} {
|
|
1633
1633
|
position: absolute;
|
|
1634
1634
|
top: -16px;
|
|
@@ -1639,7 +1639,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1639
1639
|
opacity: 0.8;
|
|
1640
1640
|
}
|
|
1641
1641
|
}
|
|
1642
|
-
`,
|
|
1642
|
+
`,Hl=Pt.h1`
|
|
1643
1643
|
${e=>B(e)} {
|
|
1644
1644
|
font-style: normal;
|
|
1645
1645
|
justify-content: center;
|
|
@@ -1653,7 +1653,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1653
1653
|
color: ${e=>e.appearance.theme.colorText};
|
|
1654
1654
|
margin-bottom: 8px;
|
|
1655
1655
|
}
|
|
1656
|
-
`,
|
|
1656
|
+
`,Vl=Pt.h2`
|
|
1657
1657
|
${e=>B(e)} {
|
|
1658
1658
|
font-style: normal;
|
|
1659
1659
|
justify-content: center;
|
|
@@ -1665,12 +1665,12 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1665
1665
|
letter-spacing: 0.28px;
|
|
1666
1666
|
margin-bottom: 8px;
|
|
1667
1667
|
}
|
|
1668
|
-
`;import
|
|
1668
|
+
`;import jl from"react";import jc from"styled-components";var Gc=jc.img`
|
|
1669
1669
|
width: 100%;
|
|
1670
1670
|
height: 100%;
|
|
1671
1671
|
min-height: 200px;
|
|
1672
1672
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1673
|
-
`;function
|
|
1673
|
+
`;function Cr({stepData:e,appearance:t,classPrefix:o=""}){var i;return e.videoUri?jl.createElement(ot,{appearance:t,videoUri:e.videoUri,autoplay:(i=e.props)==null?void 0:i.autoplayVideo}):e.imageUri?jl.createElement(Gc,{className:a(`${o}image`,t),appearance:t,src:e.imageUri}):null}var qc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:l,dismissible:p,onClick:d})=>{let{getFlow:s,markFlowCompleted:u,markFlowSkipped:c,markStepCompleted:g,isLoading:S,targetingLogicShouldHideFlow:F,updateCustomVariables:h,getFlowSteps:x,getFlowStatus:k,getCurrentStepIndex:b}=ne(),{primaryCTAClickSideEffects:v,secondaryCTAClickSideEffects:$}=fe(),{mergeAppearanceWithDefault:E}=ce();if(Ke(e),n=E(n),Kc(()=>{h(o)},[o,S]),S)return null;let f=s(e);if(!f||F(f)||k(e)===de)return null;let y=x(e)[b(e)];return Ve.createElement(Ve.Fragment,null,Ve.createElement(ae,{appearance:n}),Ve.createElement(Ol,{appearance:n,className:Te(a("embeddedTipContainer",n),r),style:l,onClick:d},(p===!0||y.dismissible)&&Ve.createElement(Ml,{onClick:()=>L(void 0,null,function*(){yield c(e),t&&t()}),className:a("embeddedTipDismissButton",n)},Ve.createElement(Ne,null)),(y.imageUri||y.videoUri)&&Ve.createElement(xr,{className:a("embeddedTipMediaContainer",n)},Ve.createElement(Cr,{appearance:n,stepData:y})),Ve.createElement(Ll,null,Ve.createElement(Oe,{size:"small",appearance:n,title:y.title,subtitle:y.subtitle})),(y.primaryButtonTitle||y.secondaryButtonTitle)&&Ve.createElement($l,{className:a("embeddedTipCallToActionContainer",n)},y.primaryButtonTitle&&Ve.createElement(le,{classPrefix:"embeddedTip",title:y.primaryButtonTitle,appearance:n,withMargin:!1,size:"medium",type:"inline",onClick:()=>L(void 0,null,function*(){y.handlePrimaryButtonClick(),v(y),!(i&&i(y,b(e),"primary")===!1)&&(yield g(e,y.id),yield u(e))})}),y.secondaryButtonTitle&&Ve.createElement(le,{classPrefix:"embeddedTip",title:y.secondaryButtonTitle,appearance:n,withMargin:!1,size:"medium",type:"inline",onClick:()=>L(void 0,null,function*(){y.handleSecondaryButtonClick(),$(y),i&&i(y,b(e),"secondary")}),secondary:!0}))))};import Ae,{useEffect as Yc}from"react";import ho from"styled-components";var Gl=ho.div`
|
|
1674
1674
|
// use the :not annotation
|
|
1675
1675
|
${e=>B(e)} {
|
|
1676
1676
|
display: flex;
|
|
@@ -1682,19 +1682,19 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1682
1682
|
background-color: ${e=>e.appearance.theme.colorBackground};
|
|
1683
1683
|
border-radius: 12px;
|
|
1684
1684
|
}
|
|
1685
|
-
`,
|
|
1685
|
+
`,Kl=ho.div`
|
|
1686
1686
|
${e=>B(e)} {
|
|
1687
1687
|
display: flex;
|
|
1688
1688
|
width: 46px;
|
|
1689
1689
|
height: 46px;
|
|
1690
1690
|
}
|
|
1691
|
-
`,
|
|
1691
|
+
`,ql=ho.div`
|
|
1692
1692
|
display: flex;
|
|
1693
1693
|
flex-direction: column;
|
|
1694
1694
|
flex: 1;
|
|
1695
1695
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1696
1696
|
margin-top: ${e=>e.type==="square"?"12px":"0"};
|
|
1697
|
-
`,
|
|
1697
|
+
`,Yl=ho.div`
|
|
1698
1698
|
display: flex;
|
|
1699
1699
|
flex-direction: column;
|
|
1700
1700
|
justify-content: center;
|
|
@@ -1712,7 +1712,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1712
1712
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1713
1713
|
align-items: flex-end;
|
|
1714
1714
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1715
|
-
`;import ii from"react";var
|
|
1715
|
+
`;import ii from"react";var Jl=({style:e,className:t})=>ii.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"46",height:"46",fill:"none",viewBox:"0 0 46 46",style:e,className:t},ii.createElement("circle",{cx:"23",cy:"23",r:"23",fill:"#E6F1FF"}),ii.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 Jc=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:n,onButtonClick:r,appearance:l,type:p="full-width",icon:d,onClick:s})=>{let{getFlow:u,markFlowCompleted:c,markFlowSkipped:g,isLoading:S,targetingLogicShouldHideFlow:F,updateCustomVariables:h,getFlowMetadata:x,getFlowStatus:k,getFlowSteps:b,getCurrentStepIndex:v}=ne(),{primaryCTAClickSideEffects:$}=fe(),{mergeAppearanceWithDefault:E}=ce();if(Ke(e),l=E(l),Yc(()=>{h(n)},[n,S]),S)return null;let f=u(e);if(!f||F(f)||k(e)===de)return null;let A=b(e),y=A.length>0?A[v(e)]:x(e);return y!=null&&y.title&&(t=y.title),y!=null&&y.subtitle&&(o=y.subtitle),Ae.createElement(Ae.Fragment,null,Ae.createElement(ae,{appearance:l}),Ae.createElement(Gl,{type:p,appearance:l,className:a("bannerContainer",l),onClick:s},p!="square"&&Ae.createElement(Kl,{className:a("bannerIconContainer",l)},d||Ae.createElement(Jl,null)),p==="square"&&y.dismissible&&Ae.createElement(ri,{type:p,className:a("bannerDismissButtonContainer",l)},Ae.createElement(oi,{type:p,onClick:()=>L(void 0,null,function*(){yield g(e),i&&i()}),className:a("bannerDismissButton",l)},Ae.createElement(Ne,null))),Ae.createElement(ql,{type:p},Ae.createElement(Oe,{appearance:l,title:t,subtitle:o,classPrefix:"banner"})),(y==null?void 0:y.primaryButtonTitle)&&Ae.createElement(Yl,{type:p,className:a("bannerCallToActionContainer",l)},Ae.createElement(le,{title:y==null?void 0:y.primaryButtonTitle,appearance:l,onClick:()=>{$(y),r&&r(y,0,"primary")},classPrefix:"banner"})),p!=="square"&&y.dismissible&&Ae.createElement(ri,{type:p,className:a("bannerDismissButtonContainer",l)},Ae.createElement(oi,{type:p,onClick:()=>L(void 0,null,function*(){yield g(e),i&&i()}),className:a("bannerDismissButton",l)},Ae.createElement(Ne,null)))))};import me,{useEffect as Xc}from"react";import{Portal as Qc}from"react-portal";import ht from"styled-components";var Xl=ht.div`
|
|
1716
1716
|
display: flex;
|
|
1717
1717
|
flex-direction: column;
|
|
1718
1718
|
width: 100%;
|
|
@@ -1734,7 +1734,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1734
1734
|
border-width: 1px;
|
|
1735
1735
|
border-color: ${t=>t.appearance.theme.colorBorder};
|
|
1736
1736
|
border-radius: ${t=>t.appearance.theme.borderRadius}px;`:""}
|
|
1737
|
-
`,
|
|
1737
|
+
`,Ql=ht.button`
|
|
1738
1738
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1739
1739
|
border-radius: 8px;
|
|
1740
1740
|
// If selected make border color primary and text color color priamry
|
|
@@ -1760,7 +1760,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1760
1760
|
justify-content: space-between;
|
|
1761
1761
|
margin-top: 16px;
|
|
1762
1762
|
gap: 8px;
|
|
1763
|
-
`,
|
|
1763
|
+
`,Zl=ht.div`
|
|
1764
1764
|
display: flex;
|
|
1765
1765
|
justify-content: space-between;
|
|
1766
1766
|
margin-top: 8px;
|
|
@@ -1781,7 +1781,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1781
1781
|
justify-content: center;
|
|
1782
1782
|
align-items: flex-start;
|
|
1783
1783
|
margin-top: 16px;
|
|
1784
|
-
`,
|
|
1784
|
+
`,Rl=ht.textarea`
|
|
1785
1785
|
${e=>B(e)} {
|
|
1786
1786
|
color: ${e=>e.appearance.theme.colorText};
|
|
1787
1787
|
margin-top: 16px;
|
|
@@ -1794,7 +1794,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1794
1794
|
height: 100px;
|
|
1795
1795
|
resize: none;
|
|
1796
1796
|
}
|
|
1797
|
-
`,
|
|
1797
|
+
`,ea=ht.div`
|
|
1798
1798
|
${e=>B(e)} {
|
|
1799
1799
|
position: absolute;
|
|
1800
1800
|
top: 16px;
|
|
@@ -1805,5 +1805,5 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${To}${t}.${To}${t} { ${Object.entries(o).map
|
|
|
1805
1805
|
opacity: 0.8;
|
|
1806
1806
|
}
|
|
1807
1807
|
}
|
|
1808
|
-
`;var Zc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:l,type:p="modal"})=>{let{getFlow:d,markFlowCompleted:s,markFlowSkipped:u,markStepCompleted:c,getNumberOfStepsCompleted:g,isLoading:S,targetingLogicShouldHideFlow:F,updateCustomVariables:h,getFlowSteps:x,getFlowStatus:k,getFlowMetadata:b}=ne(),{primaryCTAClickSideEffects:v}=fe(),{mergeAppearanceWithDefault
|
|
1808
|
+
`;var Zc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:l,type:p="modal"})=>{let{getFlow:d,markFlowCompleted:s,markFlowSkipped:u,markStepCompleted:c,getNumberOfStepsCompleted:g,isLoading:S,targetingLogicShouldHideFlow:F,updateCustomVariables:h,getFlowSteps:x,getFlowStatus:k,getFlowMetadata:b}=ne(),{primaryCTAClickSideEffects:v}=fe(),{mergeAppearanceWithDefault:$}=ce(),[E,f]=me.useState(null),[A,y]=me.useState(""),T=b(e),{hasOpenModals:I,setKeepCompletedFlowOpenDuringSession:N,shouldKeepCompletedFlowOpenDuringSession:D}=Ie();if(Ke(e),n=$(n),Xc(()=>{h(o)},[o,S]),S)return null;let z=d(e);if(!z||F(z)||k(e)===de||g(e)===1&&!D(e)||I())return null;let _=x(e)[g(e)];function G(){var ee,q;return me.createElement(me.Fragment,null,me.createElement(li,null,me.createElement(Oe,{size:"large",appearance:n,title:_.title,subtitle:_.subtitle})),me.createElement(ni,{className:a("npsNumberButtonContainer",n),appearance:n},Array.from(Array(10).keys()).map(se=>me.createElement(Ql,{className:a("npsNumberButton",n),selected:E===se+1,key:se,onClick:()=>L(this,null,function*(){N(e),f(se+1),yield c(e,_.id,{score:se+1})}),appearance:n},se+1))),me.createElement(Zl,{appearance:n},me.createElement(si,{appearance:n},(ee=T==null?void 0:T.negativeLabel)!=null?ee:"Not likely at all"),me.createElement(si,{appearance:n},(q=T==null?void 0:T.positiveLabel)!=null?q:"Extremely likely")))}function K(){var ee;return me.createElement(me.Fragment,null,me.createElement(li,null,me.createElement(Oe,{appearance:n,title:(ee=_.title)!=null?ee:"Why did you choose this score?",size:"large"})),me.createElement(Rl,{appearance:n,value:A,onChange:q=>{y(q.target.value)},placeholder:"Add your optional feedback here..."}),me.createElement(ni,{appearance:n,className:a("npsNumberButtonContainer",n)},me.createElement(le,{size:"large",withMargin:!1,onClick:()=>L(this,null,function*(){yield s(e),i&&i(_,1,"primary")}),appearance:n,title:_.secondaryButtonTitle||"Skip",secondary:!0}),me.createElement(le,{size:"large",withMargin:!1,onClick:()=>L(this,null,function*(){yield c(e,_.id,{feedbackText:A}),yield s(e),i&&i(_,1,"primary")}),appearance:n,title:_.primaryButtonTitle||"Submit"})))}function O(){return g(e)>=2?null:me.createElement(me.Fragment,null,me.createElement(ae,{appearance:n}),me.createElement(Xl,{appearance:n,className:Te(a("npsSurveyContainer",n),r),style:l,type:p},me.createElement(ea,{onClick:()=>L(this,null,function*(){yield u(e),t&&t()}),className:a("npsSurveyDismissButton",n)},me.createElement(Ne,null)),g(e)==0&&G(),g(e)==1&&K()))}return p==="inline"?O():me.createElement(Qc,null,O())};import ye,{useEffect as Rc}from"react";var em=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:l,dismissible:p=!0,modalPosition:d="center",showPagination:s=!0,allowBackNavigation:u})=>{let{getFlow:c,markFlowCompleted:g,markFlowSkipped:S,markStepCompleted:F,markStepStarted:h,isLoading:x,targetingLogicShouldHideFlow:k,updateCustomVariables:b,getFlowSteps:v,getFlowStatus:$,getCurrentStepIndex:E}=ne(),{primaryCTAClickSideEffects:f,secondaryCTAClickSideEffects:A}=fe(),{mergeAppearanceWithDefault:y}=ce(),{setOpenFlowState:T,getOpenFlowState:I,hasOpenModals:N}=Ie();Ke(e);let[D,z]=[I(e,!0),Se=>T(e,Se)];if(n=y(n),Rc(()=>{b(o)},[o,x]),x)return null;let j=c(e);if(!j||k(j)||$(e)===de||N())return null;let _=v(e),G=E(e),K=_.length,O=_[G],ee=()=>L(void 0,null,function*(){z(!1),yield S(e),t&&t()});function q(){var Se;return ye.createElement(ye.Fragment,null,ye.createElement(ae,{appearance:n}),ye.createElement(Dl,{appearance:n,className:Te(a("announcementContainer",n),r),style:l},(p===!0||O.dismissible)&&d=="inline"&&ye.createElement(zl,{onClick:()=>L(this,null,function*(){yield S(e),t&&t()}),className:a("announcementDismissButton",n)},ye.createElement(Ne,null)),ye.createElement(Ul,null,ye.createElement(Hl,{appearance:n,className:a("announcementTitle",n),dangerouslySetInnerHTML:R(O.title)}),O.subtitle&&ye.createElement(Vl,{appearance:n,className:a("announcementSubtitle",n),dangerouslySetInnerHTML:R(O.subtitle)})),(O.imageUri||O.videoUri)&&ye.createElement(xr,{className:a("announcementMediaContainer",n)},ye.createElement(Cr,{appearance:n,stepData:O})),s&&K>1&&ye.createElement(_l,{className:a("announcementPaginationContainer",n)},ye.createElement(er,{className:a("announcementPagination",n),appearance:n,stepCount:K,currentStep:G})),(O.primaryButtonTitle||O.secondaryButtonTitle)&&ye.createElement(Wl,{allowBackNavigation:u,className:a("announcementCTAContainer",n)},u&&G>0&&ye.createElement(le,{classPrefix:"announcementBack",title:(Se=O.backButtonTitle)!=null?Se:"Back",appearance:n,withMargin:!1,size:"small",type:"full-width",onClick:()=>L(this,null,function*(){i&&i(O,E(e),"back"),yield h(e,_[G-1].id)}),secondary:!0}),O.secondaryButtonTitle&&ye.createElement(le,{classPrefix:"announcement",title:O.secondaryButtonTitle,appearance:n,withMargin:!1,size:"small",type:"full-width",onClick:()=>L(this,null,function*(){O.handleSecondaryButtonClick(),A(O),i&&i(O,E(e),"secondary")}),secondary:!0}),O.primaryButtonTitle&&ye.createElement(le,{classPrefix:"announcement",title:O.primaryButtonTitle,appearance:n,withMargin:!1,size:"small",type:"full-width",onClick:()=>L(this,null,function*(){f(O),!(i&&i(O,E(e),"primary")===!1)&&(E(e)===K-1?(O.handlePrimaryButtonClick(),yield g(e)):O.handlePrimaryButtonClick())})}))))}let se={padding:"24px",maxWidth:"400px"};return d==="inline"?q():d!=="center"?ye.createElement(qo,{modalPosition:d,onClose:ee,visible:D,dismissible:p,appearance:n},q()):ye.createElement(et,{appearance:n,onClose:ee,visible:D,style:se,dismissible:p},q())};import*as yr from"react";import ta from"react";var oa=n=>{var r=n,{as:e="span",children:t,variant:o="Body1"}=r,i=$e(r,["as","children","variant"]);return ta.createElement(Bn,w({color:"neutral.foreground",fontFamily:"default",forwardedAs:e,variant:o},i),t)},tm=Object.fromEntries(Object.keys(nr).map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=i=>ta.createElement(oa,V(w({as:t},i),{variant:e}),i.children);return o.displayName=`Text.${e}`,[e,o]})),ai=Object.assign(oa,tm);var ra=l=>{var p=l,{as:e="button",className:t,size:o="md",title:i,variant:n="Primary"}=p,r=$e(p,["as","className","size","title","variant"]);var d;return yr.createElement(vn,w({className:`fr-button-${n.toLowerCase()}${t?` ${t}`:""}`,forwardedAs:e,variant:n,size:o,borderRadius:"md"},r),yr.createElement(ai,{color:(d=No[n])==null?void 0:d.color,fontWeight:"semibold"},i))},om=Object.fromEntries(Object.keys(No).map(e=>{let t=o=>yr.createElement(ra,V(w({},o),{variant:e}));return t.displayName=`Button.${e}`,[e,t]})),rm=Object.assign(ra,om);export{Io as Box,rm as Button,pt as CheckBox,wr as FlowType,yt as FormLabel,Or as FormTextField,em as FrigadeAnnouncement,Jc as FrigadeBanner,ei as FrigadeChecklist,at as FrigadeDefaultAppearance,qc as FrigadeEmbeddedTip,Sn as FrigadeForm,wc as FrigadeGuide,Cc as FrigadeHeroChecklist,Zc as FrigadeNPSSurvey,Sc as FrigadeProgressBadge,kd as FrigadeProvider,Vc as FrigadeSupportWidget,Uc as FrigadeTour,ze as ProgressBar,Zt as ProgressRing,ai as Text,sr as tokens,Ie as useFlowOpens,bo as useFlowResponses,ne as useFlows,jr as useOrganization,wo as useUser,_e as useUserFlowStates};
|
|
1809
1809
|
//# sourceMappingURL=index.mjs.map
|