@frigade/react 1.35.53 → 1.35.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +51 -49
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +39 -37
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnPropertyDescriptors;var vo=Object.getOwnPropertySymbols;var oi=Object.prototype.hasOwnProperty,ri=Object.prototype.propertyIsEnumerable;var ti=(e,t,o)=>t in e?ia(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))oi.call(t,o)&&ti(e,o,t[o]);if(vo)for(var o of vo(t))ri.call(t,o)&&ti(e,o,t[o]);return e},_=(e,t)=>na(e,sa(t));var ii=e=>typeof e=="symbol"?e:e+"",Ie=(e,t)=>{var o={};for(var i in e)oi.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i]);if(e!=null&&vo)for(var i of vo(e))t.indexOf(i)<0&&ri.call(e,i)&&(o[i]=e[i]);return o};var D=(e,t,o)=>new Promise((i,n)=>{var r=d=>{try{p(o.next(d))}catch(l){n(l)}},s=d=>{try{p(o.throw(d))}catch(l){n(l)}},p=d=>d.done?i(d.value):Promise.resolve(d.value).then(r,s);p((o=o.apply(e,t)).next())});import vt,{createContext as Cd,useEffect as Ko,useState as je}from"react";import{ThemeProvider as yd}from"styled-components";import Pt,{useContext as qp,useEffect as qt,useState as Co}from"react";import{useCallback as Tt,useContext as ya,useEffect as Sa}from"react";import ir,{useMemo as si}from"react";var ni="1.35.53 ";var He="NOT_STARTED_STEP",Z="COMPLETED_FLOW",Bo="ABORTED_FLOW",wt="STARTED_FLOW",Me="NOT_STARTED_FLOW",Ke="COMPLETED_STEP",Eo="STARTED_STEP";function Je(){let{publicApiKey:e,userId:t,apiUrl:o}=ir.useContext(Q);return{config:si(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":ni,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:si(()=>`${o}/v1/public/`,[o])}}var la="frigade-last-call-at-",aa="frigade-last-call-data-";function Ut(){let{shouldGracefullyDegrade:e,readonly:t}=ir.useContext(Q);return(o,i)=>D(this,null,function*(){if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Dt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Dt();let n=la+o,r=aa+o;if(window&&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 l=new Date(p);if(new Date().getTime()-l.getTime()<1e3)return Dt()}window.localStorage.setItem(n,new Date().toISOString()),window.localStorage.setItem(r,i.body)}let s;try{s=yield fetch(o,i)}catch(p){return Dt(p)}return s?s.ok?s:Dt(s.statusText):Dt()})}function Dt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Wt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=ir.useContext(Q);function o(){return t?(console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize"),!1):e?!0:(console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider"),!1)}return{verifySDKInitiated:o}}import{useContext as ha,useState as li}from"react";import{useContext as da,useEffect as ca,useState as ma}from"react";import ua from"swr";import{useContext as pa}from"react";function ve(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:n}=pa(Q);function r(c,f=!1){var y;return(y=e[c])!=null?y:f}function s(c,f){t(y=>_(w({},y),{[c]:f}))}function p(c){t(f=>{let S=f,{[c]:y}=S,T=Ie(S,[ii(c)]);return w({},T)})}function d(c){n.includes(c)||i(f=>[...f,c])}function l(c){return n.includes(c)}function m(c){return Object.entries(e).some(([f,y])=>y&&f!=c)||o}return{getOpenFlowState:r,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:m,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:l}}import fa from"swr/immutable";import so from"core-js-pure/actual/structured-clone";function nr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function he(...e){let t=e.shift(),o=e.length===1?e[0]:he(...e);if(!nr(t)||!nr(o))throw new Error("deepmerge can only merge Objects");let i=so(t);return Object.entries(o).forEach(([n,r])=>{nr(r)?i[n]!==void 0?Object.assign(i,{[n]:he(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}var ga="unknown";function De(){let{config:e,apiUrl:t}=Je(),{publicApiKey:o,userId:i,organizationId:n,flows:r,setShouldGracefullyDegrade:s,readonly:p}=da(Q),{resetOpenFlowState:d}=ve(),[l,m]=ma(!1),c={data:r.map(h=>({flowId:h.id,flowState:Z,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},f=h=>fetch(h,e).then(b=>{if(b.ok)return b.json();throw new Error("Failed to fetch user flow states")}).catch(b=>(console.log(`Error fetching ${h}: ${b}. Will gracefully degrade and hide Frigade`),s(!0),c)),y=o&&r&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${n?`&foreignUserGroupId=${encodeURIComponent(n)}`:""}`:null,{data:T,isLoading:S,mutate:g,error:E}=p?fa(y,f):ua(y,f,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!1,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),k=T==null?void 0:T.data;ca(()=>{!l&&!S&&k&&m(!0)},[k,l,S]);function F(h){return D(this,null,function*(){if(k&&!p){let b=k.find(N=>N.flowId===h);b&&b.flowState!==Z&&(b.flowState=Z),yield g(Promise.resolve(he(T,{data:k})),{optimisticData:he(T,{data:k}),revalidate:!1,rollbackOnError:!1})}})}function A(h,b,N){return D(this,null,function*(){if(k){let L=k.find(O=>O.flowId===h);L&&(L.stepStates[b]=N,L.flowState=wt),yield g(Promise.resolve(he(T,{data:k})),{optimisticData:he(T,{data:k}),revalidate:!1,rollbackOnError:!1})}})}function I(h,b,N){return D(this,null,function*(){if(k){let L=k.find(O=>O.flowId===h);L&&(L.lastStepId=b,L.stepStates[b]=N,L.flowState=wt),yield g(he(T,{data:k}),{optimisticData:he(T,{data:k}),revalidate:!1,rollbackOnError:!1})}})}function x(h){return D(this,null,function*(){if(k){let b=k.find(N=>N.flowId===h);b&&b.flowState!==Me&&(b.flowState=Me,b.lastStepId=ga,Object.keys(b.stepStates).forEach(N=>{b.stepStates[N].actionType=He,b.stepStates[N].createdAt=new Date().toISOString()}),yield g(he(T,{data:k}),{optimisticData:he(T,{data:k}),revalidate:!1,rollbackOnError:!1}),d(h))}})}function v(h,b){return D(this,null,function*(){if(k){let N=k.find(L=>L.flowId===h);N&&N.stepStates[b]!==He&&(N.stepStates[b]=He),yield g(he(T,{data:k}),{optimisticData:he(T,{data:k}),revalidate:!1,rollbackOnError:!1})}})}return{userFlowStatesData:k,isLoadingUserFlowStateData:!l,mutateUserFlowState:g,optimisticallyMarkFlowCompleted:F,optimisticallyMarkFlowNotStarted:x,optimisticallyMarkStepCompleted:A,optimisticallyMarkStepNotStarted:v,optimisticallyMarkStepStarted:I,error:E}}function lo(){let{config:e,apiUrl:t}=Je(),{userFlowStatesData:o,mutateUserFlowState:i}=De(),{failedFlowResponses:n,setFailedFlowResponses:r,flowResponses:s,setFlowResponses:p}=ha(Q),[d,l]=li(new Set),[m,c]=li(new Set),f=Ut();function y(g){let E=JSON.stringify(g);if(d.has(E))return null;d.add(E),l(d),m.add(g),c(m);let k=s==null?void 0:s.find(F=>F.flowSlug===g.flowSlug&&F.stepId===g.stepId&&F.actionType===g.actionType&&F.createdAt===g.createdAt);return f(`${t}flowResponses`,_(w({},e),{method:"POST",body:E})).then(F=>{F.status!==200&&F.status!==201?(console.log("Failed to send flow response for step "+g.stepId+". Will retry again later."),r([...n,g])):k||p(A=>[...A!=null?A:[],g])})}function T(g){return D(this,null,function*(){g.foreignUserId&&(g.actionType===wt||g.actionType===Me?yield y(g):g.actionType===Z?yield y(g):g.actionType===Eo?yield y(g):g.actionType===Ke?yield y(g):g.actionType===Bo?yield y(g):g.actionType===He&&(yield y(g)))})}function S(){let g=[];return o==null||o.forEach(E=>{if(E&&E.stepStates&&Object.keys(E.stepStates).length!==0)for(let k in E.stepStates){let F=E.stepStates[k];g.push({foreignUserId:E.foreignUserId,flowSlug:E.flowId,stepId:F.stepId,actionType:F.actionType,data:{},createdAt:new Date(F.createdAt),blocked:F.blocked,hidden:F.hidden})}}),[...g,...s]}return{addResponse:T,setFlowResponses:p,getFlowResponses:S}}import ba from"swr";var xa=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,ai=e=>{let t=xa.exec(e);if(t===null)return null;let o=null;return t.forEach((i,n)=>{let r=Ca(i,"'","");r.startsWith("flow_")&&(o=r)}),o},Ca=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function sr(e){try{return JSON.parse(e)}catch(t){return console.error("Failed to parse Frigade config.yml to JSON",t),null}}var lr=(l=>(l.CHECKLIST="CHECKLIST",l.FORM="FORM",l.TOUR="TOUR",l.SUPPORT="SUPPORT",l.CUSTOM="CUSTOM",l.BANNER="BANNER",l.EMBEDDED_TIP="EMBEDDED_TIP",l.NPS_SURVEY="NPS_SURVEY",l.ANNOUNCEMENT="ANNOUNCEMENT",l))(lr||{});function R(){let{config:e,apiUrl:t}=Je(),{flows:o,setFlows:i,userId:n,organizationId:r,publicApiKey:s,customVariables:p,setCustomVariables:d,hasActiveFullPageFlow:l,setHasActiveFullPageFlow:m,setFlowResponses:c,setShouldGracefullyDegrade:f,readonly:y}=ya(Q),T={data:[]},{verifySDKInitiated:S}=Wt(),{addResponse:g,getFlowResponses:E}=lo(),k=u=>fetch(u,e).then(C=>C.ok?C.json():(console.log(`Error fetching ${u} (${C.status}): ${C.statusText}. Will gracefully degrade and hide Frigade`),f(!0),T)).catch(C=>(console.log(`Error fetching ${u}: ${C}. Will gracefully degrade and hide Frigade`),f(!0),T)),{mutateUserFlowState:F,userFlowStatesData:A,isLoadingUserFlowStateData:I,optimisticallyMarkFlowCompleted:x,optimisticallyMarkFlowNotStarted:v,optimisticallyMarkStepCompleted:h,optimisticallyMarkStepNotStarted:b,optimisticallyMarkStepStarted:N}=De(),{data:L,error:O,isLoading:j}=ba(s?`${t}flows${y?"?readonly=true":""}`:null,k,{keepPreviousData:!0});Sa(()=>{if(O){console.error(O);return}L&&L.data&&i(L.data)},[L,O]);function M(u){if(j)return null;let C=o.find(P=>P.slug===u);return!C&&o.length>0&&!I&&!j?(console.log(`Flow with id ${u} not found`),null):(C==null?void 0:C.active)===!1&&!y?null:C}function G(u){var z,Oe;if(!M(u))return[];let C=M(u).data;return C?(C=le(C),((Oe=(z=sr(C))==null?void 0:z.data)!=null?Oe:[]).map(Ce=>{let no=J(Ce);return _(w({handleSecondaryButtonClick:()=>{Ce.skippable===!0&&V(u,Ce.id,{skipped:!0})}},Ce),{complete:ue(u,Ce.id)===Ke||no>=1,blocked:Ae(u,Ce.id),hidden:be(u,Ce.id),handlePrimaryButtonClick:()=>{(!Ce.completionCriteria&&(Ce.autoMarkCompleted||Ce.autoMarkCompleted===void 0)||Ce.completionCriteria&&Ce.autoMarkCompleted===!0)&&V(u,Ce.id)},progress:no})}).filter(Ce=>Ce.hidden!==!0)):[]}function le(u){return u.replaceAll(/\${(.*?)}/g,(C,P)=>p[P]===void 0?"":String(p[P]).replace(/[\u00A0-\u9999<>\&]/g,function(z){return"&#"+z.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 pe(u){var P;if(!M(u))return[];let C=M(u).data;return C?(C=le(C),(P=JSON.parse(C))!=null?P:{}):[]}function q(u,C){d(P=>_(w({},P),{[u]:C}))}function se(u){!I&&!j&&u&&JSON.stringify(p)!=JSON.stringify(w(w({},p),u))&&Object.keys(u).forEach(C=>{q(C,u[C])})}let de=Tt((u,C,P)=>D(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:u,stepId:C,actionType:Eo,data:P!=null?P:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield N(u,C,z),g(z))}),[n,r,A]),Se=Tt((u,C,P)=>D(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:u,stepId:C,actionType:He,data:P!=null?P:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield b(u,C),g(z))}),[n,r,A]),V=Tt((u,C,P)=>D(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:u,stepId:C,actionType:Ke,data:P!=null?P:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield h(u,C,z),g(z))}),[n,r,A]),Y=Tt((u,C)=>D(this,null,function*(){if(!S()||fe(u)===Me)return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:u,stepId:"unknown",actionType:Me,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};yield v(u),X(P)&&g(P)}),[n,r,A]),ee=Tt((u,C)=>D(this,null,function*(){if(!S())return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:u,stepId:"unknown",actionType:wt,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};X(P)&&g(P)}),[n,r,A]),Ve=Tt((u,C)=>D(this,null,function*(){if(!S())return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:u,stepId:"unknown",actionType:Z,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};X(P)&&(yield x(u),g(P))}),[n,r,A]),Le=Tt((u,C)=>D(this,null,function*(){if(!S())return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:u,stepId:"unknown",actionType:Bo,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};X(P)&&(yield x(u),g(P))}),[n,r,A]);function X(u){var C;if(!A&&u.actionType===He)return!1;if(A){let P=A.find(z=>z.flowId===u.flowSlug);if(u.actionType===He&&(!(P!=null&&P.stepStates[u.stepId])||P.stepStates[u.stepId].actionType===He)||P&&((C=P.stepStates[u.stepId])==null?void 0:C.actionType)===u.actionType||P&&P.flowState===Z&&u.actionType===Z)return!1}return!0}function ue(u,C){let P=U(u,C);return I?null:P?P.actionType:He}function Ae(u,C){let P=U(u,C);return P?P.blocked:!1}function be(u,C){let P=U(u,C);return P?P.hidden:!1}function U(u,C){var z;if(I)return null;let P=A==null?void 0:A.find(Oe=>Oe.flowId===u);return!P||!P.stepStates[C]?null:(z=P.stepStates[C])!=null?z:null}function $(u){var P,z;if(I||!A)return null;if(fe(u)===Me)return(P=G(u)[0])!=null?P:null;let C=(z=A.find(Oe=>Oe.flowId===u))==null?void 0:z.lastStepId;return C?G(u).find(Oe=>Oe.id===C):null}function W(u){var z;let C=$(u);if(!C)return 0;let P=(z=G(u).findIndex(Oe=>Oe.id===C.id))!=null?z:0;return ue(u,C.id)===Ke&&P<G(u).length-1?P+1:P}function J(u){if(!u.completionCriteria)return;let C=ai(u.completionCriteria);if(C===null)return;let P=$e(C),z=Ge(C);return z===0?void 0:P/z}function fe(u){let C=A==null?void 0:A.find(P=>P.flowId===u);return C?C.flowState:null}function $e(u){let C=G(u);return C.length===0?0:C.filter(z=>ue(u,z.id)===Ke).length}function Ge(u){return G(u).length}function Xe(u){let C=o.find(P=>P.slug===u);return C?sr(C.data):null}function St(u){if(y)return!1;if(I)return!0;if(u!=null&&u.targetingLogic&&A){let C=A.find(P=>P.flowId===u.slug);if(C)return C.shouldTrigger===!1}return!!(u!=null&&u.targetingLogic&&n&&n.startsWith("guest_"))}function $t(u){return!St(M(u))}function Mt(){n&&F()}function bt(){return o}return{getAllFlows:bt,getFlow:M,getFlowData:Xe,isLoading:I||j,getStepStatus:ue,getFlowSteps:G,getCurrentStepIndex:W,markStepStarted:de,markStepCompleted:V,markFlowNotStarted:Y,markFlowStarted:ee,markFlowCompleted:Ve,markFlowAborted:Le,markStepNotStarted:Se,getFlowStatus:fe,getNumberOfStepsCompleted:$e,getNumberOfSteps:Ge,targetingLogicShouldHideFlow:St,setCustomVariable:q,updateCustomVariables:se,customVariables:p,getStepOptionalProgress:J,getFlowMetadata:pe,isStepBlocked:Ae,isStepHidden:be,hasActiveFullPageFlow:l,setHasActiveFullPageFlow:m,isFlowAvailableToUser:$t,refresh:Mt}}import{useCallback as ar,useContext as wa,useEffect as Ta}from"react";var zt="guest_";function ao(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:n}=wa(Q),{config:r,apiUrl:s}=Je(),{mutateUserFlowState:p}=De(),d=Ut(),{verifySDKInitiated:l}=Wt();function m(T){return`frigade-user-registered-${T}`}Ta(()=>{if(e&&!t){if(e.startsWith(zt))return;let T=m(e);localStorage.getItem(T)||(d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify({foreignId:e})})),localStorage.setItem(T,"true"))}},[e,n,t]);let c=ar(T=>D(this,null,function*(){if(!l())return;let S={foreignId:e,properties:T};yield d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify(S)})),i(g=>w(w({},g),T)),p()}),[e,r,n,p]),f=ar((T,S)=>D(this,null,function*(){if(!l())return;let E={foreignId:e,events:[{event:T,properties:S}]};yield d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify(E)})),p()}),[e,r,p]),y=ar((T,S)=>D(this,null,function*(){if(l())if(S){let g=m(T);localStorage.setItem(g,"true"),o(T);let E={foreignId:T,properties:S};yield d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify(E)})),i(k=>w(w({},k),S)),p()}else o(T)}),[r,n,p]);return{userId:e,setUserId:o,setUserIdWithProperties:y,addPropertiesToUser:c,trackEventForUser:f}}import{v4 as Yp}from"uuid";import et,{useEffect as mn,useState as un}from"react";import qe,{useEffect as mr,useState as Ia}from"react";import No from"styled-components";import Fa from"react";import ka from"styled-components";var pi="fr-",po="cfr-";function a(e,t){let o=`${pi}${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+" "+po+e}return o}function B(e){if(!e.className||e.className.indexOf(po)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(pi)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Ao(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function Fe(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Ao(t)}: ${e.styleOverrides[t]};`).join(" "):""}function we(...e){return e.filter(Boolean).join(" ")}function co(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Pa=ka.div`
|
|
2
|
+
var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnPropertyDescriptors;var Bo=Object.getOwnPropertySymbols;var oi=Object.prototype.hasOwnProperty,ri=Object.prototype.propertyIsEnumerable;var ti=(e,t,o)=>t in e?ia(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))oi.call(t,o)&&ti(e,o,t[o]);if(Bo)for(var o of Bo(t))ri.call(t,o)&&ti(e,o,t[o]);return e},_=(e,t)=>na(e,sa(t));var ii=e=>typeof e=="symbol"?e:e+"",Ie=(e,t)=>{var o={};for(var i in e)oi.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i]);if(e!=null&&Bo)for(var i of Bo(e))t.indexOf(i)<0&&ri.call(e,i)&&(o[i]=e[i]);return o};var D=(e,t,o)=>new Promise((i,n)=>{var r=d=>{try{p(o.next(d))}catch(l){n(l)}},s=d=>{try{p(o.throw(d))}catch(l){n(l)}},p=d=>d.done?i(d.value):Promise.resolve(d.value).then(r,s);p((o=o.apply(e,t)).next())});import vt,{createContext as Cd,useEffect as Ko,useState as je}from"react";import{ThemeProvider as yd}from"styled-components";import Pt,{useContext as qp,useEffect as qt,useState as yo}from"react";import{useCallback as Tt,useContext as ya,useEffect as Sa}from"react";import ir,{useMemo as si}from"react";var ni="1.35.54 ";var He="NOT_STARTED_STEP",Z="COMPLETED_FLOW",Eo="ABORTED_FLOW",wt="STARTED_FLOW",Me="NOT_STARTED_FLOW",Ke="COMPLETED_STEP",so="STARTED_STEP";function Je(){let{publicApiKey:e,userId:t,apiUrl:o}=ir.useContext(Q);return{config:si(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":ni,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:si(()=>`${o}/v1/public/`,[o])}}var la="frigade-last-call-at-",aa="frigade-last-call-data-";function Ut(){let{shouldGracefullyDegrade:e,readonly:t}=ir.useContext(Q);return(o,i)=>D(this,null,function*(){if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Dt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Dt();let n=la+o,r=aa+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 l=new Date(p);if(new Date().getTime()-l.getTime()<1e3)return Dt()}typeof window!="undefined"&&(window.localStorage.setItem(n,new Date().toISOString()),window.localStorage.setItem(r,i.body))}let s;try{s=yield fetch(o,i)}catch(p){return Dt(p)}return s?s.ok?s:Dt(s.statusText):Dt()})}function Dt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Wt(){let{publicApiKey:e,shouldGracefullyDegrade:t}=ir.useContext(Q);function o(){return t?(console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize"),!1):e?!0:(console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider"),!1)}return{verifySDKInitiated:o}}import{useContext as ha,useState as li}from"react";import{useContext as da,useEffect as ca,useState as ma}from"react";import ua from"swr";import{useContext as pa}from"react";function ve(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:n}=pa(Q);function r(c,f=!1){var y;return(y=e[c])!=null?y:f}function s(c,f){t(y=>_(w({},y),{[c]:f}))}function p(c){t(f=>{let S=f,{[c]:y}=S,T=Ie(S,[ii(c)]);return w({},T)})}function d(c){n.includes(c)||i(f=>[...f,c])}function l(c){return n.includes(c)}function m(c){return Object.entries(e).some(([f,y])=>y&&f!=c)||o}return{getOpenFlowState:r,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:m,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:l}}import fa from"swr/immutable";import lo from"core-js-pure/actual/structured-clone";function nr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function he(...e){let t=e.shift(),o=e.length===1?e[0]:he(...e);if(!nr(t)||!nr(o))throw new Error("deepmerge can only merge Objects");let i=lo(t);return Object.entries(o).forEach(([n,r])=>{nr(r)?i[n]!==void 0?Object.assign(i,{[n]:he(i[n],lo(r))}):Object.assign(i,{[n]:lo(r)}):Array.isArray(r)?i[n]!==void 0?Object.assign(i,{[n]:[...i[n],...lo(r)]}):Object.assign(i,{[n]:lo(r)}):Object.assign(i,{[n]:r})}),i}var ga="unknown";function De(){let{config:e,apiUrl:t}=Je(),{publicApiKey:o,userId:i,organizationId:n,flows:r,setShouldGracefullyDegrade:s,readonly:p}=da(Q),{resetOpenFlowState:d}=ve(),[l,m]=ma(!1),c={data:r.map(h=>({flowId:h.id,flowState:Z,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},f=h=>fetch(h,e).then(b=>{if(b.ok)return b.json();throw new Error("Failed to fetch user flow states")}).catch(b=>(console.log(`Error fetching ${h}: ${b}. Will gracefully degrade and hide Frigade`),s(!0),c)),y=o&&r&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${n?`&foreignUserGroupId=${encodeURIComponent(n)}`:""}`:null,{data:T,isLoading:S,mutate:g,error:E}=p?fa(y,f):ua(y,f,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!1,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),k=T==null?void 0:T.data;ca(()=>{!l&&!S&&k&&m(!0)},[k,l,S]);function F(h){return D(this,null,function*(){if(k&&!p){let b=k.find(N=>N.flowId===h);b&&b.flowState!==Z&&(b.flowState=Z),yield g(Promise.resolve(he(T,{data:k})),{optimisticData:he(T,{data:k}),revalidate:!1,rollbackOnError:!1})}})}function A(h,b,N){return D(this,null,function*(){if(k){let L=k.find(O=>O.flowId===h);L&&(L.stepStates[b]=N,L.flowState=wt),yield g(Promise.resolve(he(T,{data:k})),{optimisticData:he(T,{data:k}),revalidate:!1,rollbackOnError:!1})}})}function I(h,b,N){return D(this,null,function*(){if(k){let L=k.find(O=>O.flowId===h);L&&(L.lastStepId=b,L.stepStates[b]=N,L.flowState=wt),yield g(he(T,{data:k}),{optimisticData:he(T,{data:k}),revalidate:!1,rollbackOnError:!1})}})}function x(h){return D(this,null,function*(){if(k){let b=k.find(N=>N.flowId===h);b&&b.flowState!==Me&&(b.flowState=Me,b.lastStepId=ga,Object.keys(b.stepStates).forEach(N=>{b.stepStates[N].actionType=He,b.stepStates[N].createdAt=new Date().toISOString()}),yield g(he(T,{data:k}),{optimisticData:he(T,{data:k}),revalidate:!1,rollbackOnError:!1}),d(h))}})}function v(h,b){return D(this,null,function*(){if(k){let N=k.find(L=>L.flowId===h);N&&N.stepStates[b]!==He&&(N.stepStates[b]=He),yield g(he(T,{data:k}),{optimisticData:he(T,{data:k}),revalidate:!1,rollbackOnError:!1})}})}return{userFlowStatesData:k,isLoadingUserFlowStateData:!l,mutateUserFlowState:g,optimisticallyMarkFlowCompleted:F,optimisticallyMarkFlowNotStarted:x,optimisticallyMarkStepCompleted:A,optimisticallyMarkStepNotStarted:v,optimisticallyMarkStepStarted:I,error:E}}function ao(){let{config:e,apiUrl:t}=Je(),{userFlowStatesData:o,mutateUserFlowState:i}=De(),{failedFlowResponses:n,setFailedFlowResponses:r,flowResponses:s,setFlowResponses:p}=ha(Q),[d,l]=li(new Set),[m,c]=li(new Set),f=Ut();function y(g){let E=JSON.stringify(g);if(d.has(E))return null;d.add(E),l(d),m.add(g),c(m);let k=s==null?void 0:s.find(F=>F.flowSlug===g.flowSlug&&F.stepId===g.stepId&&F.actionType===g.actionType&&F.createdAt===g.createdAt);return f(`${t}flowResponses`,_(w({},e),{method:"POST",body:E})).then(F=>{F.status!==200&&F.status!==201?(console.log("Failed to send flow response for step "+g.stepId+". Will retry again later."),r([...n,g])):k||p(A=>[...A!=null?A:[],g])})}function T(g){return D(this,null,function*(){g.foreignUserId&&(g.actionType===wt||g.actionType===Me?yield y(g):g.actionType===Z?yield y(g):g.actionType===so?yield y(g):g.actionType===Ke?yield y(g):g.actionType===Eo?yield y(g):g.actionType===He&&(yield y(g)))})}function S(){let g=[];return o==null||o.forEach(E=>{if(E&&E.stepStates&&Object.keys(E.stepStates).length!==0)for(let k in E.stepStates){let F=E.stepStates[k];g.push({foreignUserId:E.foreignUserId,flowSlug:E.flowId,stepId:F.stepId,actionType:F.actionType,data:{},createdAt:new Date(F.createdAt),blocked:F.blocked,hidden:F.hidden})}}),[...g,...s]}return{addResponse:T,setFlowResponses:p,getFlowResponses:S}}import ba from"swr";var xa=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,ai=e=>{let t=xa.exec(e);if(t===null)return null;let o=null;return t.forEach((i,n)=>{let r=Ca(i,"'","");r.startsWith("flow_")&&(o=r)}),o},Ca=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function sr(e){try{return JSON.parse(e)}catch(t){return console.error("Failed to parse Frigade config.yml to JSON",t),null}}var lr=(l=>(l.CHECKLIST="CHECKLIST",l.FORM="FORM",l.TOUR="TOUR",l.SUPPORT="SUPPORT",l.CUSTOM="CUSTOM",l.BANNER="BANNER",l.EMBEDDED_TIP="EMBEDDED_TIP",l.NPS_SURVEY="NPS_SURVEY",l.ANNOUNCEMENT="ANNOUNCEMENT",l))(lr||{});function R(){let{config:e,apiUrl:t}=Je(),{flows:o,setFlows:i,userId:n,organizationId:r,publicApiKey:s,customVariables:p,setCustomVariables:d,hasActiveFullPageFlow:l,setHasActiveFullPageFlow:m,setFlowResponses:c,setShouldGracefullyDegrade:f,readonly:y}=ya(Q),T={data:[]},{verifySDKInitiated:S}=Wt(),{addResponse:g,getFlowResponses:E}=ao(),k=u=>fetch(u,e).then(C=>C.ok?C.json():(console.log(`Error fetching ${u} (${C.status}): ${C.statusText}. Will gracefully degrade and hide Frigade`),f(!0),T)).catch(C=>(console.log(`Error fetching ${u}: ${C}. Will gracefully degrade and hide Frigade`),f(!0),T)),{mutateUserFlowState:F,userFlowStatesData:A,isLoadingUserFlowStateData:I,optimisticallyMarkFlowCompleted:x,optimisticallyMarkFlowNotStarted:v,optimisticallyMarkStepCompleted:h,optimisticallyMarkStepNotStarted:b,optimisticallyMarkStepStarted:N}=De(),{data:L,error:O,isLoading:j}=ba(s?`${t}flows${y?"?readonly=true":""}`:null,k,{keepPreviousData:!0});Sa(()=>{if(O){console.error(O);return}L&&L.data&&i(L.data)},[L,O]);function M(u){if(j)return null;let C=o.find(P=>P.slug===u);return!C&&o.length>0&&!I&&!j?(console.log(`Flow with id ${u} not found`),null):(C==null?void 0:C.active)===!1&&!y?null:C}function G(u){var z,Oe;if(!M(u))return[];let C=M(u).data;return C?(C=le(C),((Oe=(z=sr(C))==null?void 0:z.data)!=null?Oe:[]).map(Ce=>{let no=J(Ce);return _(w({handleSecondaryButtonClick:()=>{Ce.skippable===!0&&V(u,Ce.id,{skipped:!0})}},Ce),{complete:ue(u,Ce.id)===Ke||no>=1,blocked:Ae(u,Ce.id),hidden:be(u,Ce.id),handlePrimaryButtonClick:()=>{(!Ce.completionCriteria&&(Ce.autoMarkCompleted||Ce.autoMarkCompleted===void 0)||Ce.completionCriteria&&Ce.autoMarkCompleted===!0)&&V(u,Ce.id)},progress:no})}).filter(Ce=>Ce.hidden!==!0)):[]}function le(u){return u.replaceAll(/\${(.*?)}/g,(C,P)=>p[P]===void 0?"":String(p[P]).replace(/[\u00A0-\u9999<>\&]/g,function(z){return"&#"+z.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 pe(u){var P;if(!M(u))return[];let C=M(u).data;return C?(C=le(C),(P=JSON.parse(C))!=null?P:{}):[]}function q(u,C){d(P=>_(w({},P),{[u]:C}))}function se(u){!I&&!j&&u&&JSON.stringify(p)!=JSON.stringify(w(w({},p),u))&&Object.keys(u).forEach(C=>{q(C,u[C])})}let de=Tt((u,C,P)=>D(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:u,stepId:C,actionType:so,data:P!=null?P:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield N(u,C,z),g(z))}),[n,r,A]),Se=Tt((u,C,P)=>D(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:u,stepId:C,actionType:He,data:P!=null?P:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield b(u,C),g(z))}),[n,r,A]),V=Tt((u,C,P)=>D(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:u,stepId:C,actionType:Ke,data:P!=null?P:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield h(u,C,z),g(z))}),[n,r,A]),Y=Tt((u,C)=>D(this,null,function*(){if(!S()||fe(u)===Me)return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:u,stepId:"unknown",actionType:Me,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};yield v(u),X(P)&&g(P)}),[n,r,A]),ee=Tt((u,C)=>D(this,null,function*(){if(!S())return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:u,stepId:"unknown",actionType:wt,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};X(P)&&g(P)}),[n,r,A]),Ve=Tt((u,C)=>D(this,null,function*(){if(!S())return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:u,stepId:"unknown",actionType:Z,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};X(P)&&(yield x(u),g(P))}),[n,r,A]),Le=Tt((u,C)=>D(this,null,function*(){if(!S())return;let P={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:u,stepId:"unknown",actionType:Eo,data:C!=null?C:{},createdAt:new Date,blocked:!1,hidden:!1};X(P)&&(yield x(u),g(P))}),[n,r,A]);function X(u){var C;if(!A&&u.actionType===He)return!1;if(A){let P=A.find(z=>z.flowId===u.flowSlug);if(u.actionType===He&&(!(P!=null&&P.stepStates[u.stepId])||P.stepStates[u.stepId].actionType===He)||P&&((C=P.stepStates[u.stepId])==null?void 0:C.actionType)===u.actionType&&u.actionType!==so||P&&P.flowState===Z&&u.actionType===Z)return!1}return!0}function ue(u,C){let P=U(u,C);return I?null:P?P.actionType:He}function Ae(u,C){let P=U(u,C);return P?P.blocked:!1}function be(u,C){let P=U(u,C);return P?P.hidden:!1}function U(u,C){var z;if(I)return null;let P=A==null?void 0:A.find(Oe=>Oe.flowId===u);return!P||!P.stepStates[C]?null:(z=P.stepStates[C])!=null?z:null}function $(u){var P,z;if(I||!A)return null;if(fe(u)===Me)return(P=G(u)[0])!=null?P:null;let C=(z=A.find(Oe=>Oe.flowId===u))==null?void 0:z.lastStepId;return C?G(u).find(Oe=>Oe.id===C):null}function W(u){var z;let C=$(u);if(!C)return 0;let P=(z=G(u).findIndex(Oe=>Oe.id===C.id))!=null?z:0;return ue(u,C.id)===Ke&&P<G(u).length-1?P+1:P}function J(u){if(!u.completionCriteria)return;let C=ai(u.completionCriteria);if(C===null)return;let P=$e(C),z=Ge(C);return z===0?void 0:P/z}function fe(u){let C=A==null?void 0:A.find(P=>P.flowId===u);return C?C.flowState:null}function $e(u){let C=G(u);return C.length===0?0:C.filter(z=>ue(u,z.id)===Ke).length}function Ge(u){return G(u).length}function Xe(u){let C=o.find(P=>P.slug===u);return C?sr(C.data):null}function St(u){if(y)return!1;if(I)return!0;if(u!=null&&u.targetingLogic&&A){let C=A.find(P=>P.flowId===u.slug);if(C)return C.shouldTrigger===!1}return!!(u!=null&&u.targetingLogic&&n&&n.startsWith("guest_"))}function $t(u){return!St(M(u))}function Mt(){n&&F()}function bt(){return o}return{getAllFlows:bt,getFlow:M,getFlowData:Xe,isLoading:I||j,getStepStatus:ue,getFlowSteps:G,getCurrentStepIndex:W,markStepStarted:de,markStepCompleted:V,markFlowNotStarted:Y,markFlowStarted:ee,markFlowCompleted:Ve,markFlowAborted:Le,markStepNotStarted:Se,getFlowStatus:fe,getNumberOfStepsCompleted:$e,getNumberOfSteps:Ge,targetingLogicShouldHideFlow:St,setCustomVariable:q,updateCustomVariables:se,customVariables:p,getStepOptionalProgress:J,getFlowMetadata:pe,isStepBlocked:Ae,isStepHidden:be,hasActiveFullPageFlow:l,setHasActiveFullPageFlow:m,isFlowAvailableToUser:$t,refresh:Mt}}import{useCallback as ar,useContext as wa,useEffect as Ta}from"react";var zt="guest_";function po(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:n}=wa(Q),{config:r,apiUrl:s}=Je(),{mutateUserFlowState:p}=De(),d=Ut(),{verifySDKInitiated:l}=Wt();function m(T){return`frigade-user-registered-${T}`}Ta(()=>{if(e&&!t){if(e.startsWith(zt))return;let T=m(e);localStorage.getItem(T)||(d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify({foreignId:e})})),localStorage.setItem(T,"true"))}},[e,n,t]);let c=ar(T=>D(this,null,function*(){if(!l())return;let S={foreignId:e,properties:T};yield d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify(S)})),i(g=>w(w({},g),T)),p()}),[e,r,n,p]),f=ar((T,S)=>D(this,null,function*(){if(!l())return;let E={foreignId:e,events:[{event:T,properties:S}]};yield d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify(E)})),p()}),[e,r,p]),y=ar((T,S)=>D(this,null,function*(){if(l())if(S){let g=m(T);localStorage.setItem(g,"true"),o(T);let E={foreignId:T,properties:S};yield d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify(E)})),i(k=>w(w({},k),S)),p()}else o(T)}),[r,n,p]);return{userId:e,setUserId:o,setUserIdWithProperties:y,addPropertiesToUser:c,trackEventForUser:f}}import{v4 as Yp}from"uuid";import et,{useEffect as mn,useState as un}from"react";import qe,{useEffect as mr,useState as Ia}from"react";import No from"styled-components";import Fa from"react";import ka from"styled-components";var pi="fr-",co="cfr-";function a(e,t){let o=`${pi}${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+" "+co+e}return o}function B(e){if(!e.className||e.className.indexOf(co)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(pi)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Ao(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function Fe(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Ao(t)}: ${e.styleOverrides[t]};`).join(" "):""}function we(...e){return e.filter(Boolean).join(" ")}function mo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Pa=ka.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -316,6 +316,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
316
316
|
min-height: 70px;
|
|
317
317
|
box-sizing: border-box;
|
|
318
318
|
margin-bottom: 10px;
|
|
319
|
+
resize: none;
|
|
319
320
|
`;function yr({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:n}){let r=e,[s,p]=hr((n==null?void 0:n.text)||""),[d,l]=hr(!1),[m,c]=hr(!1),f=Cr;Ei(()=>{s===""&&!d&&(l(!0),y(""))},[]),Ei(()=>{if(m){y(s);return}},[m]);function y(S){var E;if(p(S),o({text:S}),r.required===!0&&S.trim()===""){i([{id:r.id,message:`${(E=r.title)!=null?E:"Field"} is required`,hidden:!m}]);return}let g=Bi(S,r.validation);if(g&&(S.trim()!==""||r.required===!0)){i([{id:r.id,message:g,hidden:!m}]);return}i([])}r.multiline&&(f=qa);function T(){var S;switch((S=r==null?void 0:r.validation)==null?void 0:S.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return Uo.createElement(Ka,null,Uo.createElement(ft,{title:r.title,required:r.required,appearance:t.appearance}),Uo.createElement(f,{className:a("inputComponent",t.appearance),value:s,onChange:S=>{y(S.target.value)},appearance:t.appearance,placeholder:r.placeholder,type:T(),onBlur:()=>{c(!0)}}),Uo.createElement(_t,{title:r.subtitle,appearance:t.appearance}))}import Ze,{useEffect as Ai,useState as Oi}from"react";import Ii from"styled-components";var Sr="",Ya=Ii.div`
|
|
320
321
|
display: flex;
|
|
321
322
|
flex-direction: column;
|
|
@@ -343,9 +344,9 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
343
344
|
background-repeat: no-repeat;
|
|
344
345
|
background-size: 1.5em 1.5em;
|
|
345
346
|
-webkit-print-color-adjust: exact;
|
|
346
|
-
`;function Ni({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var m,c,f,y,T,S,g,E,k;let r=e,[s,p]=Oi(!1),[d,l]=Oi(!1);return Ai(()=>{var F,A,I,x;if(!((F=i==null?void 0:i.choice)!=null&&F[0])&&!s){if(p(!0),r.requireSelection){o({choice:[Sr]});return}if(r.defaultValue&&((A=r.props.options)!=null&&A.find(v=>v.id===r.defaultValue))){let v=(I=r.props.options)==null?void 0:I.find(h=>h.id===r.defaultValue);o({choice:[v.id]})}else o({choice:[((x=r.props.options)==null?void 0:x[0].id)||""]})}},[]),Ai(()=>{var F;d&&(r.requireSelection&&((F=i==null?void 0:i.choice)==null?void 0:F[0])===Sr?n([{message:"Please select an option",id:r.id}]):n([]))},[(m=i==null?void 0:i.choice)==null?void 0:m[0],d]),Ze.createElement(Ya,null,Ze.createElement(ft,{title:r.title,required:!1,appearance:t.appearance}),Ze.createElement(Xa,{value:(c=i==null?void 0:i.choice)==null?void 0:c[0],onChange:F=>{l(!0),o({choice:[F.target.value]})},placeholder:r.placeholder,appearance:t.appearance,className:a("multipleChoiceSelect",t.appearance)},r.requireSelection&&Ze.createElement("option",{key:"null-value",value:Sr,disabled:!0},(f=r.placeholder)!=null?f:"Select an option"),(y=r.props.options)==null?void 0:y.map(F=>Ze.createElement("option",{key:F.id,value:F.id},F.title))),((S=(T=r.props.options)==null?void 0:T.find(F=>{var A;return F.id===((A=i==null?void 0:i.choice)==null?void 0:A[0])}))==null?void 0:S.isOpenEnded)&&Ze.createElement(Ze.Fragment,null,Ze.createElement(ft,{title:(k=(E=(g=r.props.options)==null?void 0:g.find(F=>{var A;return F.id===((A=i==null?void 0:i.choice)==null?void 0:A[0])}))==null?void 0:E.openEndedLabel)!=null?k:"Please specify",required:!1,appearance:t.appearance}),Ze.createElement(Cr,{type:"text",placeholder:"Enter your answer here",onChange:F=>{o({choice:[F.target.value]})},appearance:t.appearance})),Ze.createElement(_t,{title:r.subtitle,appearance:t.appearance}))}import
|
|
347
|
+
`;function Ni({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var m,c,f,y,T,S,g,E,k;let r=e,[s,p]=Oi(!1),[d,l]=Oi(!1);return Ai(()=>{var F,A,I,x;if(!((F=i==null?void 0:i.choice)!=null&&F[0])&&!s){if(p(!0),r.requireSelection){o({choice:[Sr]});return}if(r.defaultValue&&((A=r.props.options)!=null&&A.find(v=>v.id===r.defaultValue))){let v=(I=r.props.options)==null?void 0:I.find(h=>h.id===r.defaultValue);o({choice:[v.id]})}else o({choice:[((x=r.props.options)==null?void 0:x[0].id)||""]})}},[]),Ai(()=>{var F;d&&(r.requireSelection&&((F=i==null?void 0:i.choice)==null?void 0:F[0])===Sr?n([{message:"Please select an option",id:r.id}]):n([]))},[(m=i==null?void 0:i.choice)==null?void 0:m[0],d]),Ze.createElement(Ya,null,Ze.createElement(ft,{title:r.title,required:!1,appearance:t.appearance}),Ze.createElement(Xa,{value:(c=i==null?void 0:i.choice)==null?void 0:c[0],onChange:F=>{l(!0),o({choice:[F.target.value]})},placeholder:r.placeholder,appearance:t.appearance,className:a("multipleChoiceSelect",t.appearance)},r.requireSelection&&Ze.createElement("option",{key:"null-value",value:Sr,disabled:!0},(f=r.placeholder)!=null?f:"Select an option"),(y=r.props.options)==null?void 0:y.map(F=>Ze.createElement("option",{key:F.id,value:F.id},F.title))),((S=(T=r.props.options)==null?void 0:T.find(F=>{var A;return F.id===((A=i==null?void 0:i.choice)==null?void 0:A[0])}))==null?void 0:S.isOpenEnded)&&Ze.createElement(Ze.Fragment,null,Ze.createElement(ft,{title:(k=(E=(g=r.props.options)==null?void 0:g.find(F=>{var A;return F.id===((A=i==null?void 0:i.choice)==null?void 0:A[0])}))==null?void 0:E.openEndedLabel)!=null?k:"Please specify",required:!1,appearance:t.appearance}),Ze.createElement(Cr,{type:"text",placeholder:"Enter your answer here",onChange:F=>{o({choice:[F.target.value]})},appearance:t.appearance})),Ze.createElement(_t,{title:r.subtitle,appearance:t.appearance}))}import go,{useEffect as br,useState as $i}from"react";import Mi from"styled-components";import fo from"react";import uo from"react";var Li=({color:e,percentage:t,size:o})=>{let i=o*.5-2,n=2*Math.PI*i,r=(1-t)*n;return uo.createElement("circle",{r:i,cx:o*.5,cy:o*.5,fill:"transparent",stroke:r!==n?e:"",strokeWidth:"3px",strokeDasharray:n,strokeDashoffset:t?r:0})},Ja=({fillColor:e,size:t,percentage:o,children:i,bgColor:n="#D9D9D9",className:r,style:s})=>uo.createElement("svg",{style:s,className:r,width:t,height:t,overflow:"visible"},uo.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},uo.createElement(Li,{color:n,size:t}),uo.createElement(Li,{color:e,percentage:Math.max(o,.1),size:t})),i),Ht=Ja;import Qa from"styled-components";var Za=({color:e="#FFFFFF"})=>fo.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fo.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),Ra={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},ep={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},tp={border:"1px solid #000000",color:"#FFFFFF"},op={border:"1px solid #C5CBD3"},rp={color:"#FFFFFF"},ip={border:"1px solid #C5CBD3"},np=e=>e==="square"?Ra:ep,sp=(e,t)=>e==="square"?t?tp:op:t?rp:ip,lp=Qa.div`
|
|
347
348
|
${e=>Fe(e)}
|
|
348
|
-
`,nt=({value:e,type:t="round",primaryColor:o="#000000",progress:i,appearance:n=it,style:r,className:s})=>{let p=np(t),d=sp(t,e);return e===!0?p=_(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?
|
|
349
|
+
`,nt=({value:e,type:t="round",primaryColor:o="#000000",progress:i,appearance:n=it,style:r,className:s})=>{let p=np(t),d=sp(t,e);return e===!0?p=_(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?fo.createElement(Ht,{fillColor:o,percentage:i,size:22}):fo.createElement(lp,{styleOverrides:p,style:r,role:"checkbox",className:we(a("checkIconContainer",n),a(e?"checkIconContainerChecked":"checkIconContainerUnchecked",n),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&fo.createElement(Za,{color:"#FFFFFF"}))};var ap=Mi.div`
|
|
349
350
|
display: flex;
|
|
350
351
|
flex-direction: column;
|
|
351
352
|
width: 100%;
|
|
@@ -376,7 +377,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
376
377
|
height: 48px;
|
|
377
378
|
padding: 0 18px;
|
|
378
379
|
margin-bottom: 10px;
|
|
379
|
-
`;function Di({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var m;let r=e,[s,p]=$i((i==null?void 0:i.choice)||[]),[d,l]=$i(!1);return br(()=>{s.length==0&&!d&&(l(!0),o({choice:[]}))},[]),br(()=>{o({choice:s})},[s]),br(()=>{r.required&&(s.length<r.props.minChoices||s.length>r.props.maxChoices)?n([{message:"",id:r.id}]):n([])},[s]),
|
|
380
|
+
`;function Di({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var m;let r=e,[s,p]=$i((i==null?void 0:i.choice)||[]),[d,l]=$i(!1);return br(()=>{s.length==0&&!d&&(l(!0),o({choice:[]}))},[]),br(()=>{o({choice:s})},[s]),br(()=>{r.required&&(s.length<r.props.minChoices||s.length>r.props.maxChoices)?n([{message:"",id:r.id}]):n([])},[s]),go.createElement(ap,null,go.createElement(ft,{title:r.title,required:r.required,appearance:t.appearance}),(m=r.props.options)==null?void 0:m.map(c=>go.createElement(pp,{appearance:t.appearance,className:a(s.includes(c.id)?"multipleChoiceListItemSelected":"multipleChoiceListItem",t.appearance),key:c.id,value:c.id,"data-selected":s.includes(c.id),onClick:()=>{if(s.includes(c.id)){p(s.filter(f=>f!==c.id));return}s.length<r.props.maxChoices?p([...s,c.id]):s.length==1&&r.props.maxChoices==1&&p([c.id])}},c.title,go.createElement(nt,{type:"round",primaryColor:t.appearance.theme.colorPrimary,value:s.includes(c.id),appearance:t.appearance}))),go.createElement(_t,{title:r.subtitle,appearance:t.appearance}))}import Wo from"react";import Ui from"styled-components";import dp from"dompurify";function ce(e){return{__html:dp.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img","code"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var cp=Ui.h1`
|
|
380
381
|
${e=>B(e)} {
|
|
381
382
|
font-style: normal;
|
|
382
383
|
font-weight: 700;
|
|
@@ -397,7 +398,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
397
398
|
letter-spacing: 0.28px;
|
|
398
399
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
399
400
|
}
|
|
400
|
-
`;function Ee({appearance:e,title:t,subtitle:o,size:i="medium",classPrefix:n=""}){return Wo.createElement(Wo.Fragment,null,Wo.createElement(cp,{appearance:e,className:a(`${n}${n?
|
|
401
|
+
`;function Ee({appearance:e,title:t,subtitle:o,size:i="medium",classPrefix:n=""}){return Wo.createElement(Wo.Fragment,null,Wo.createElement(cp,{appearance:e,className:a(`${n}${n?mo(i):i}Title`,e),dangerouslySetInnerHTML:ce(t),size:i}),o&&Wo.createElement(mp,{appearance:e,className:a(`${n}${n?mo(i):i}Subtitle`,e),dangerouslySetInnerHTML:ce(o),size:i}))}import*as wr from"react";var Wi=e=>wr.createElement("svg",w({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,"aria-hidden":"true",viewBox:"0 0 16 16"},e),wr.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 fp=zo.div`
|
|
401
402
|
display: flex;
|
|
402
403
|
flex-direction: column;
|
|
403
404
|
justify-content: flex-end;
|
|
@@ -415,7 +416,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
415
416
|
`,xp=zo.div`
|
|
416
417
|
padding-left: 1px;
|
|
417
418
|
padding-right: 1px;
|
|
418
|
-
`,Cp={text:yr,multipleChoice:Ni,multipleChoiceList:Di},Fr="frigade-multiInputStepTypeData";function _i({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r,customFormElements:s,prefillData:p}){var I;let d=t.props,[l,m]=Tr([]),[c,f]=Tr([]),{userId:y}=
|
|
419
|
+
`,Cp={text:yr,multipleChoice:Ni,multipleChoiceList:Di},Fr="frigade-multiInputStepTypeData";function _i({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r,customFormElements:s,prefillData:p}){var I;let d=t.props,[l,m]=Tr([]),[c,f]=Tr([]),{userId:y}=po(),[T,S]=Tr(F()||(p?p[t.id]:null)||{}),{readonly:g}=up(Q),E=w(w({},Cp),s);zi(()=>{i(l.length===0)},[l,i]),zi(()=>{n(T)},[T]);function k(x,v){S(h=>{let b=_(w({},h),{[x.id]:v});return typeof window!="undefined"&&window.localStorage&&!g&&window.localStorage.setItem(A(),JSON.stringify(b)),b})}function F(){if(typeof window!="undefined"&&window.localStorage){let x=window.localStorage.getItem(A());if(x)return JSON.parse(x)}return null}function A(){return`${Fr}-${e}-${t.id}-${y}`}return Ft.createElement(xp,{className:a("multiInput",r)},Ft.createElement(Ee,{appearance:r,title:t.title,subtitle:t.subtitle}),Ft.createElement(fp,{className:a("multiInputContainer",r)},(I=d==null?void 0:d.data)==null?void 0:I.map(x=>{let v=l.reverse().find(h=>h.id===x.id);return E[x.type]?Ft.createElement("span",{key:x.id,"data-field-id":x.id,className:a("multiInputField",r)},E[x.type]({formInput:x,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r},onSaveInputData:h=>{!c.includes(x.id)&&h&&(h==null?void 0:h.text)!==""&&f(b=>[...b,x.id]),k(x,h)},inputData:T[x.id],setFormValidationErrors:h=>{h.length===0&&l.length===0||m(b=>h.length===0?b.filter(N=>N.id!==x.id):[...b,...h])}}),v&&v.message&&c.includes(x.id)&&v.hidden!==!0&&Ft.createElement(gp,{key:x.id,style:{overflow:"hidden"},appearance:r,className:a("multiInputValidationError",r)},Ft.createElement(hp,{appearance:r,className:a("multiInputValidationErrorIcon",r)},Ft.createElement(Wi,null)),v.message)):null})))}import jt from"styled-components";var Hi=jt.div`
|
|
419
420
|
align-items: center;
|
|
420
421
|
display: flex;
|
|
421
422
|
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
@@ -514,7 +515,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
514
515
|
margin-right: 8px;
|
|
515
516
|
}
|
|
516
517
|
}
|
|
517
|
-
`,oe=({onClick:e,title:t,style:o,disabled:i,type:n="inline",size:r="medium",secondary:s=!1,appearance:p,withMargin:d=!0,classPrefix:l="",loading:m=!1})=>{var f;function c(){let y=s?"buttonSecondary":"button";return l===""?y:`${l}${
|
|
518
|
+
`,oe=({onClick:e,title:t,style:o,disabled:i,type:n="inline",size:r="medium",secondary:s=!1,appearance:p,withMargin:d=!0,classPrefix:l="",loading:m=!1})=>{var f;function c(){let y=s?"buttonSecondary":"button";return l===""?y:`${l}${mo(y)}`}return Xi.createElement(Sp,{secondary:s,appearance:p,disabled:i||m,loading:(f=m==null?void 0:m.toString())!=null?f:"",onClick:e,styleOverrides:o,type:n,withMargin:d,size:r,className:a(c(),p)},m?Xi.createElement(Yi,{className:a("buttonLoader",p)}):t!=null?t:"Continue")};var Qi=({step:e,canContinue:t,appearance:o,onPrimaryClick:i,onSecondaryClick:n,selectedStep:r,steps:s,onBack:p,allowBackNavigation:d,errorMessage:l,isSaving:m})=>{var y;let c=s.length>1&&r!=0&&d,f=e.primaryButtonTitle&&e.secondaryButtonTitle||c?"inline":"full-width";return gt.createElement(gt.Fragment,null,l!==null&&l!=null&>.createElement(ji,{appearance:o,className:a("formCTAError",o)},l),gt.createElement(Hi,{showBackButton:c,className:a("formCTAContainer",o)},c&>.createElement(oe,{title:(y=e.backButtonTitle)!=null?y:"Back",onClick:p,secondary:!0,withMargin:!1,type:f,appearance:o,style:{width:"90px",maxWidth:"90px"},classPrefix:"back"}),gt.createElement(Vi,{className:a("ctaWrapper",o)},e.secondaryButtonTitle?gt.createElement(oe,{title:e.secondaryButtonTitle,onClick:n,secondary:!0,withMargin:!1,type:f,appearance:o,disabled:m}):null," ",e.primaryButtonTitle?gt.createElement(oe,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:i,type:f,appearance:o,loading:m}):null)))};import kr from"react";import bp from"styled-components";var wp=bp.div`
|
|
518
519
|
text-align: center;
|
|
519
520
|
`,Zi=({stepCount:e=0,currentStep:t=0,className:o,appearance:i})=>{let{theme:n}=te().mergeAppearanceWithDefault(i);return kr.createElement(wp,{className:o},kr.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((r,s)=>kr.createElement("rect",{key:s,x:16*s,y:0,width:8,height:8,rx:4,fill:t===s?n.colorPrimary:"#E6E6E6"}))))};import kt from"react";import Vt from"styled-components";import{useContext as Tp}from"react";function ae(){let e=Tp(Q);function t(n){i(n.primaryButtonUri,n.primaryButtonUriTarget)}function o(n){i(n.secondaryButtonUri,n.secondaryButtonUriTarget)}function i(n,r){if(!n)return;let s=n.startsWith("http")?"_blank":"_self";r&&r!=="_blank"&&(s="_self"),e.navigate(n,s)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:i}}var Fp=Vt.div`
|
|
520
521
|
display: flex;
|
|
@@ -564,7 +565,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
564
565
|
margin-top: 12px;
|
|
565
566
|
margin-bottom: 16px;
|
|
566
567
|
max-width: 70%;
|
|
567
|
-
`;function Ri({stepData:e,appearance:t}){var i,n;let{handleUrl:o}=ae();return kt.createElement("div",null,kt.createElement(Bp,null,e.title),kt.createElement(Ep,null,e.subtitle),kt.createElement(Fp,null,(n=(i=e.props)==null?void 0:i.links)==null?void 0:n.map(r=>kt.createElement(kp,{key:r.title},kt.createElement(Pp,{src:r.imageUri}),kt.createElement(vp,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{var s;r.uri&&o(r.uri,(s=r.uriTarget)!=null?s:"_blank")}},r.title)))))}import Kt,{useEffect as Dp}from"react";import jo from"styled-components";import Pr from"react";var Ho=({style:e,className:t})=>Pr.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},Pr.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),Pr.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 Gt,{useRef as Ap,useState as Op}from"react";import
|
|
568
|
+
`;function Ri({stepData:e,appearance:t}){var i,n;let{handleUrl:o}=ae();return kt.createElement("div",null,kt.createElement(Bp,null,e.title),kt.createElement(Ep,null,e.subtitle),kt.createElement(Fp,null,(n=(i=e.props)==null?void 0:i.links)==null?void 0:n.map(r=>kt.createElement(kp,{key:r.title},kt.createElement(Pp,{src:r.imageUri}),kt.createElement(vp,{style:{borderColor:t.theme.colorPrimary,color:t.theme.colorPrimary},onClick:()=>{var s;r.uri&&o(r.uri,(s=r.uriTarget)!=null?s:"_blank")}},r.title)))))}import Kt,{useEffect as Dp}from"react";import jo from"styled-components";import Pr from"react";var Ho=({style:e,className:t})=>Pr.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},Pr.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),Pr.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 Gt,{useRef as Ap,useState as Op}from"react";import ho from"styled-components";var Ip=ho.div`
|
|
568
569
|
display: flex;
|
|
569
570
|
align-items: center;
|
|
570
571
|
justify-content: flex-start;
|
|
@@ -572,7 +573,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
572
573
|
width: 100%;
|
|
573
574
|
height: 100%;
|
|
574
575
|
position: relative;
|
|
575
|
-
`,Np=
|
|
576
|
+
`,Np=ho.div`
|
|
576
577
|
position: absolute;
|
|
577
578
|
display: flex;
|
|
578
579
|
align-items: center;
|
|
@@ -591,16 +592,16 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
591
592
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
592
593
|
border-radius: 50%;
|
|
593
594
|
}
|
|
594
|
-
`,Lp=
|
|
595
|
+
`,Lp=ho.video`
|
|
595
596
|
width: 100%;
|
|
596
597
|
height: 100%;
|
|
597
598
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
598
|
-
`,$p=
|
|
599
|
+
`,$p=ho.iframe`
|
|
599
600
|
width: 100%;
|
|
600
601
|
height: 100%;
|
|
601
602
|
min-height: 260px;
|
|
602
603
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
603
|
-
`,Mp=
|
|
604
|
+
`,Mp=ho.iframe`
|
|
604
605
|
width: 100%;
|
|
605
606
|
height: 100%;
|
|
606
607
|
min-height: 400px;
|
|
@@ -682,8 +683,8 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
682
683
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
683
684
|
display: flex;
|
|
684
685
|
align-self: center;
|
|
685
|
-
`;var dn=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let n=e.props,[r,s]=Br([]),[p,d]=Br(!1),[l,m]=Br(e.id);return vr(()=>{r.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),vr(()=>{l!==e.id&&(m(e.id),s([]))},[e]),vr(()=>{o({choice:r}),r.length>=n.minChoices?t(!0):t(!1)},[r]),st.createElement(tn,{className:a("selectListContainer",i)},st.createElement(on,null,st.createElement(rn,{className:a("selectListTitle",i)},e.title),st.createElement(nn,{appearance:i,className:a("selectListSubtitle",i)},e.subtitle)),n.options.map((c,f)=>{let y=r.includes(c.id);return st.createElement(sn,{key:`select-item-${f}`,onClick:()=>{if(r.includes(c.id)){s(r.filter(T=>T!==c.id));return}r.length<n.maxChoices?s([...r,c.id]):r.length==1&&n.maxChoices==1&&s([c.id])},hideBottomBorder:f===n.options.length-1,className:a("selectListSelectItem",i)},st.createElement(ln,{className:a("selectListItemImage",i)},c.imageUri&&st.createElement(an,{src:c.imageUri,alt:`select-icon-${f}`}),st.createElement(pn,{appearance:i,className:a("selectListSelectItemText",i)},c.title)),st.createElement(nt,{appearance:i,value:y,primaryColor:i.theme.colorPrimary}))}))};import Ue,{useEffect as cn,useState as
|
|
686
|
-
${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map(([i,n])=>typeof n=="object"?`${i} { ${Object.entries(n).map(([s,p])=>`${Ao(s)}: ${p};`).join(" ")} }`:`${Ao(i)}: ${n};`).join(" ")} }`).join(" ")}`;function ie({appearance:e}){if(!e||!e.styleOverrides)return xo.createElement(xo.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([o,i])=>typeof i=="object");return t.length===0?xo.createElement(xo.Fragment,null):xo.createElement(Vp,{inlineStyles:t})}var fn=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:n,customVariables:r,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:l=!0,onStepCompletion:m,onButtonClick:c,dismissible:f=!0,endFlowOnDismiss:y=!1,modalPosition:T="center",repeatable:S=!1,onDismiss:g,showPagination:E=!1,allowBackNavigation:k=!1,validationHandler:F,showFrigadeBranding:A=!1,onFormDataChange:I,showFooter:x=!0,prefillData:v={},updateUrlOnPageChange:h=!1})=>{var $;let{getFlow:b,getFlowSteps:N,isLoading:L,targetingLogicShouldHideFlow:O,getFlowStatus:j,getCurrentStepIndex:M,markFlowCompleted:G,markFlowNotStarted:le,markStepStarted:pe}=R(),q=M(e),{mergeAppearanceWithDefault:se}=te(),[de,Se]=un(!1),[V,Y]=un(""),{setOpenFlowState:ee,getOpenFlowState:Ve,hasOpenModals:Le}=ve(),X=N(e);d=se(d);let[ue,Ae]=i!==void 0&&n!==void 0?[i,n]:[Ve(e,!0),W=>ee(e,W)];if(mn(()=>{!de&&!L&&(Se(!0),(j(e)===Z&&S||j(e)===Me)&&(j(e)===Z&&S&&le(e),window&&window.localStorage&&Object.keys(window.localStorage).forEach(J=>{J.startsWith(Fr)&&window.localStorage.removeItem(J)})),Se(!0))},[de,Se,L]),mn(()=>{var J;let W=(J=window==null?void 0:window.location)!=null&&J.hash?window.location.hash.replace("#",""):"";if(W!=V&&X&&(X==null?void 0:X.length)>0){let fe=-1;if(W){let $e=W;fe=X.findIndex(Ge=>Ge.id===$e),V===W&&(fe=-1),Y(W)}else fe=0,Y("");fe!==-1&&pe(e,X[fe].id)}},[X,($=window==null?void 0:window.location)==null?void 0:$.hash]),L)return null;let be=b(e);if(!be||O(be)||!X||i!==void 0&&i===!1||j(e)===Z&&l||(o=="modal"||o=="corner-modal")&&Le(e))return null;let U=()=>{Ae(!1),g&&g(),y===!0&&G(e)};if(T=="center"&&o==="modal"||o==="large-modal"){let W={padding:"24px"};return o==="large-modal"?(W.width="85%",W.height="90%",W.maxHeight="800px",W.minHeight="500px",W.padding="0"):W.width="400px",et.createElement(Qe,{appearance:d,onClose:U,visible:ue,style:W,dismissible:f,showFrigadeBranding:A},et.createElement(ie,{appearance:d}),et.createElement(Vo,{appearance:d,steps:X,selectedStep:q,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:n,setShowModal:Ae,onDismiss:g,showPagination:E,customFormElements:s,allowBackNavigation:k,validationHandler:F,onFormDataChange:I,showFooter:x,prefillData:v,updateUrlOnPageChange:h}))}return o==="modal"&&T!=="center"?et.createElement($o,{appearance:d,onClose:U,visible:ue,modalPosition:T},et.createElement(ie,{appearance:d}),et.createElement(Vo,{appearance:d,steps:X,selectedStep:q,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:n,setShowModal:Ae,onDismiss:g,showPagination:E,customFormElements:s,allowBackNavigation:k,validationHandler:F,onFormDataChange:I,showFooter:x,prefillData:v,updateUrlOnPageChange:h})):et.createElement(et.Fragment,null,et.createElement(ie,{appearance:d}),et.createElement(Vo,{appearance:d,steps:X,selectedStep:q,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:n,setShowModal:Ae,onDismiss:g,showPagination:E,customFormElements:s,allowBackNavigation:k,validationHandler:F,onFormDataChange:I,showFooter:x,prefillData:v,updateUrlOnPageChange:h}))},gn=fn;import{useCallback as Er,useContext as Gp,useEffect as Kp}from"react";function Ar(){let{organizationId:e,userId:t,setOrganizationId:o}=Gp(Q),{mutateUserFlowState:i}=De(),{config:n,apiUrl:r}=Je(),s=Ut(),{verifySDKInitiated:p}=Wt();function d(f,y){return`frigade-user-group-registered-${f}-${y}`}Kp(()=>{if(t&&e){if(t.startsWith(zt))return;let f=d(t,e);localStorage.getItem(f)||(s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})})),localStorage.setItem(f,"true"))}},[t,e]);let l=Er(f=>D(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 y={foreignUserId:t,foreignUserGroupId:e,properties:f};yield s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(y)})),i()}),[e,t,n,i]),m=Er((f,y)=>D(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 S={foreignUserId:t,foreignUserGroupId:e,events:[{event:f,properties:y}]};yield s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(S)})),i()}),[e,t,n,i]),c=Er((f,y)=>D(this,null,function*(){if(p())if(y){let T=d(t,f);localStorage.setItem(T,"true"),o(f);let S={foreignUserId:t,foreignUserGroupId:f,properties:y};yield s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(S)})),i()}else o(f)}),[t,n,i]);return{organizationId:e,setOrganizationId:o,setOrganizationIdWithProperties:c,addPropertiesToOrganization:l,trackEventForOrganization:m}}var hn="frigade-xFrigade_guestUserId",yo="frigade-xFrigade_userId",xn=({})=>{let{setFlowResponses:e}=lo(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=De(),{userId:n,setUserId:r}=ao(),[s,p]=Co(n),{getFlowStatus:d}=R(),{flows:l,userProperties:m,setIsNewGuestUser:c,flowResponses:f}=qp(Q),[y,T]=Co([]),[S,g]=Co([]),{organizationId:E}=Ar(),[k,F]=Co(E),[A,I]=Co(!1);qt(()=>{if(!o&&t)for(let b=0;b<t.length;b++){let N=t[b],L=l.find(O=>O.slug===(N==null?void 0:N.flowId));if(L&&N&&N.shouldTrigger===!0&&L.type=="FORM"&&L.triggerType==="AUTOMATIC"&&!S.includes(L.slug)){setTimeout(()=>{x(N.flowId)},500);break}}},[o,t]),qt(()=>{f.length>0&&i()},[f]),qt(()=>{A||(I(!0),i())},[o,I]);function x(b){let N=l.find(L=>L.slug===b);N&&N.triggerType==="AUTOMATIC"&&!S.includes(N.slug)&&(g([...S,N.slug]),T([N]))}function v(){if(!n){let b=localStorage.getItem(yo);if(b){r(b);return}let N=localStorage.getItem(hn);if(N){r(N);return}c(!0);let L=zt+Yp();try{localStorage.setItem(hn,L)}catch(O){console.log("Failed to save guest user id locally: Local storage unavailable",O)}r(O=>O||L)}}qt(()=>{try{if(l){let b=[];l.forEach(N=>{if(N.data){let L=N.data.match(/"imageUri":"(.*?)"/g);L&&L.forEach(O=>{let j=O.replace('"imageUri":"',"").replace('"',"");if(b.includes(j))return;let M=new Image;M.src=j,b.push(j)})}})}}catch(b){}},[l]),qt(()=>{if(n!==s&&(e([]),i()),p(n),n&&!n.startsWith(zt))try{localStorage.setItem(yo,n)}catch(b){console.log("Failed to save user id locally: Local storage available",b)}n===null&&setTimeout(()=>{n===null&&v()},50)},[n,l,m]),qt(()=>{E!=k&&(F(E),e([]),i())},[E,k,F]);function h(){return Pt.createElement(Pt.Fragment,null,y.map(b=>d(b.slug)!==Me?null:Pt.createElement("span",{key:b.slug},Pt.createElement(gn,{flowId:b.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return Pt.createElement(Pt.Fragment,null,Pt.createElement(h,null))};import{ErrorBoundary as Sd}from"react-error-boundary";var Cn={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 Xp(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(Cn[o]){let n=Cn[o].split("."),r=t;n.forEach((s,p)=>{r[s]||(r[s]=p===n.length-1?i:{}),r=r[s]})}}),t}function Jp(e){if(!e)return;let t=he({},e),o={};return Object.keys(t).forEach(i=>{let n=`.fr-${i}`;o[n]=t[i]}),o}function yn(e){let{theme:t,styleOverrides:o}=e,i=Xp(t),n=Jp(o);return{overrides:i,css:n}}import dd from"styled-components";import{compose as cd,variant as bn}from"styled-system";import Sn from"react";import Qp,{ThemeProvider as Zp,useTheme as Rp}from"styled-components";import{border as ed,color as td,compose as od,get as rd,shadow as id,space as nd,system as sd,typography as ld}from"styled-system";var ad={width:{property:"width",scale:"sizes",transform:(e,t)=>rd(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},pd=Qp("div")(({css:e})=>e,od(ed,td,id,nd,ld,sd(ad))),So=n=>{var r=n,{as:e,children:t,overrides:o}=r,i=Ie(r,["as","children","overrides"]);let s=Rp(),p={border:"none",boxSizing:"border-box",m:0,p:0},d=()=>Sn.createElement(pd,w(w({as:e},p),i),t);if(o!==void 0){let l=he(s,o);return Sn.createElement(Zp,{theme:l},d())}return d()};var bo={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"}},md={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},wn=dd(So)(()=>({whiteSpace:"nowrap"}),cd(bn({scale:"components.Button",variants:"components.Button"}),bn({prop:"size",variants:md})));import ud from"styled-components";import{variant as fd,system as gd}from"styled-system";var Go={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 Tn=ud(So)(fd({scale:"components.Text",variants:"components.Text"}),gd({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Fn=4,kn="px",hd=20,xd=Object.fromEntries(Array.from(Array(hd+1),(e,t)=>t===0?[.5,`${.5*Fn}${kn}`]:[t,`${t*Fn}${kn}`])),Yt={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"},Or={colors:_(w({},Yt),{neutral:{foreground:Yt.gray300},primary:{background:Yt.blue500,foreground:Yt.white,inverted:Yt.blue500},negative:{foreground:Yt.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:xd,components:{Button:bo,Text:Go}};var Pn="https://api.frigade.com",Q=Cd({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:it,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{},apiUrl:Pn,readonly:!1,debug:!1});function bd(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var wd=({publicApiKey:e,userId:t,organizationId:o,config:i,children:n})=>{var q,se,de,Se,V;let[r,s]=je(t||null),[p,d]=je(o||null),[l,m]=je([]),[c,f]=je([]),[y,T]=je([]),[S,g]=je({}),[E,k]=je({}),[F,A]=je([]),[I,x]=je({}),[v,h]=je(!1),[b,N]=je(!1),[L,O]=je(!G(e)),j=(Y,ee)=>{if(ee==="_blank"){window.open(Y,"_blank");return}setTimeout(()=>{window.location.href=Y},50)},M={theme:w(w({},it.theme),(se=(q=i==null?void 0:i.defaultAppearance)==null?void 0:q.theme)!=null?se:{}),styleOverrides:w(w({},it.styleOverrides),(Se=(de=i==null?void 0:i.defaultAppearance)==null?void 0:de.styleOverrides)!=null?Se:{})};function G(Y){return!!(Y&&Y.length>10&&Y.substring(0,10)==="api_public")}Ko(()=>{t&&s(t)},[t]),Ko(()=>{r&&window&&window.localStorage&&window.localStorage.getItem(yo)&&window.localStorage.getItem(yo)!==r&&bd()},[r]),Ko(()=>{o&&d(o)},[o]),Ko(()=>{if(G(e))O(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),O(!0);return}},[e,O]);let le={publicApiKey:e,userId:r,setUserId:s,setFlows:m,flows:l,failedFlowResponses:c,setFailedFlowResponses:f,flowResponses:y,setFlowResponses:T,userProperties:S,setUserProperties:g,openFlowStates:E,setOpenFlowStates:k,completedFlowsToKeepOpenDuringSession:F,setCompletedFlowsToKeepOpenDuringSession:A,customVariables:I,setCustomVariables:x,isNewGuestUser:v,setIsNewGuestUser:h,hasActiveFullPageFlow:b,setHasActiveFullPageFlow:N,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:j,defaultAppearance:M,shouldGracefullyDegrade:L,setShouldGracefullyDegrade:O,apiUrl:i&&i.apiUrl?i.apiUrl:Pn,readonly:i&&i.readonly?i.readonly:!1,debug:i&&i.debug?i.debug:!1};if(L)return vt.createElement(Q.Provider,{value:le},n);let{overrides:pe}=yn(M);return vt.createElement(Sd,{fallback:vt.createElement(vt.Fragment,null,n)},vt.createElement(Q.Provider,{value:le},vt.createElement(yd,{theme:he(M.theme,Or,pe!=null?pe:{},(V=i==null?void 0:i.theme)!=null?V:{})},n,vt.createElement(xn,null))))};import dc from"react";import xe,{useEffect as ol,useState as rl}from"react";import Ye,{useState as zd}from"react";import At from"styled-components";import Xo from"react";import Bt from"react";import Bn from"styled-components";var vn=Bn.span`
|
|
686
|
+
`;var dn=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let n=e.props,[r,s]=Br([]),[p,d]=Br(!1),[l,m]=Br(e.id);return vr(()=>{r.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),vr(()=>{l!==e.id&&(m(e.id),s([]))},[e]),vr(()=>{o({choice:r}),r.length>=n.minChoices?t(!0):t(!1)},[r]),st.createElement(tn,{className:a("selectListContainer",i)},st.createElement(on,null,st.createElement(rn,{className:a("selectListTitle",i)},e.title),st.createElement(nn,{appearance:i,className:a("selectListSubtitle",i)},e.subtitle)),n.options.map((c,f)=>{let y=r.includes(c.id);return st.createElement(sn,{key:`select-item-${f}`,onClick:()=>{if(r.includes(c.id)){s(r.filter(T=>T!==c.id));return}r.length<n.maxChoices?s([...r,c.id]):r.length==1&&n.maxChoices==1&&s([c.id])},hideBottomBorder:f===n.options.length-1,className:a("selectListSelectItem",i)},st.createElement(ln,{className:a("selectListItemImage",i)},c.imageUri&&st.createElement(an,{src:c.imageUri,alt:`select-icon-${f}`}),st.createElement(pn,{appearance:i,className:a("selectListSelectItemText",i)},c.title)),st.createElement(nt,{appearance:i,value:y,primaryColor:i.theme.colorPrimary}))}))};import Ue,{useEffect as cn,useState as xo}from"react";var Hp=({children:e,id:t,shouldWrap:o=!1})=>Ue.createElement(Ue.Fragment,null,o?Ue.createElement("div",{key:t,style:{width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:1,overflowY:"auto"}},e):e),Vo=({appearance:e,steps:t,selectedStep:o,customStepTypes:i,customVariables:n,onButtonClick:r,onStepCompletion:s,flowId:p,type:d,hideOnFlowCompletion:l,onComplete:m,setVisible:c,setShowModal:f,onDismiss:y,showPagination:T=!1,customFormElements:S,allowBackNavigation:g,validationHandler:E,onFormDataChange:k,showFooter:F,prefillData:A,updateUrlOnPageChange:I})=>{var U;let v=w(w({},{linkCollection:Ri,multiInput:_i,callToAction:en,selectList:dn}),i),{primaryCTAClickSideEffects:h,secondaryCTAClickSideEffects:b}=ae(),[N,L]=xo(!1),[O,j]=xo({}),[M,G]=xo(!1),[le,pe]=xo(!1),[q,se]=xo(null),de=(U=t[o])!=null?U:null,{markStepCompleted:Se,markStepStarted:V,isLoading:Y,updateCustomVariables:ee,markFlowCompleted:Ve}=R();cn(()=>{ee(n)},[n,Y]),cn(()=>{k&&k(O,Le(),t[o],o)},[O]);function Le(){var W;return{data:(W=O[t[o].id])!=null?W:{},stepId:t[o].id,customVariables:n}}function X($,W,J){let fe=o+1<t.length?t[o+1]:null;return s&&s($,J,fe,O,Le()),r?r($,o,W,fe):!0}function ue($,W){j(J=>{let fe={};return fe[$.id]=W,w(w({},J),fe)})}function Ae($){return $.selectedStep.imageUri?Ue.createElement(qi,{image:$.selectedStep.imageUri,appearance:e,className:a("formContainerSidebarImage",e)}):null}let be=F&&Ue.createElement(Qi,{step:t[o],canContinue:N&&!M,formType:d,selectedStep:o,appearance:e,onPrimaryClick:()=>D(void 0,null,function*(){if(G(!0),E){let J=yield E(t[o],o,t[o+1],O,Le());if(J!==!0){se(typeof J=="string"?J:null),G(!1);return}else se(null)}let $=w({},Le());yield Se(p,t[o].id,$),o+1<t.length&&!g&&(yield V(p,t[o+1].id));let W=X(t[o],"primary",o);if(o+1>=t.length&&(m&&m(),y&&y(),l&&W&&(c&&c(!1),f(!1)),yield Ve(p)),h(t[o]),G(!1),typeof window!="undefined"&&g&&o+1<t.length&&(window.location.hash=t[o+1].id),typeof window!="undefined"&&!g&&I&&o+1<t.length){let J=new URL(window.location.href);J.searchParams.set("p",t[o+1].id),window.history.pushState({},"",J.toString())}}),onSecondaryClick:()=>{X(t[o],"secondary",o),b(t[o])},onBack:()=>D(void 0,null,function*(){o-1>=0&&(G(!0),g&&(window.location.hash=t[o-1].id),yield V(p,t[o-1].id),G(!1))}),steps:t,allowBackNavigation:g,errorMessage:q,isSaving:M});return Ue.createElement(Ue.Fragment,null,Ue.createElement(Gi,{className:a("formContainer",e)},Ue.createElement(Hp,{id:o,shouldWrap:d==="large-modal"},Ue.createElement(Ki,{key:de.id,type:d,className:a("formContent",e)},t.map($=>{let W=v[$.type];return de.id!==$.id?null:typeof W!="function"?W:Ue.createElement(W,{key:$.id,stepData:$,canContinue:N,setCanContinue:L,onSaveData:J=>{ue($,J)},appearance:e,customFormElements:S,flowId:p,prefillData:A})}),T&&Ue.createElement(Zi,{className:a("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),be)),d=="large-modal"&&Ue.createElement(Ae,{selectedStep:t[o]})))};import Co from"react";import{createGlobalStyle as jp}from"styled-components";var Vp=jp`
|
|
687
|
+
${e=>e.inlineStyles.map(([t,o])=>`.${co}${t}.${co}${t} { ${Object.entries(o).map(([i,n])=>typeof n=="object"?`${i} { ${Object.entries(n).map(([s,p])=>`${Ao(s)}: ${p};`).join(" ")} }`:`${Ao(i)}: ${n};`).join(" ")} }`).join(" ")}`;function ie({appearance:e}){if(!e||!e.styleOverrides)return Co.createElement(Co.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([o,i])=>typeof i=="object");return t.length===0?Co.createElement(Co.Fragment,null):Co.createElement(Vp,{inlineStyles:t})}var fn=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:n,customVariables:r,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:l=!0,onStepCompletion:m,onButtonClick:c,dismissible:f=!0,endFlowOnDismiss:y=!1,modalPosition:T="center",repeatable:S=!1,onDismiss:g,showPagination:E=!1,allowBackNavigation:k=!1,validationHandler:F,showFrigadeBranding:A=!1,onFormDataChange:I,showFooter:x=!0,prefillData:v={},updateUrlOnPageChange:h=!1})=>{var $;let{getFlow:b,getFlowSteps:N,isLoading:L,targetingLogicShouldHideFlow:O,getFlowStatus:j,getCurrentStepIndex:M,markFlowCompleted:G,markFlowNotStarted:le,markStepStarted:pe}=R(),q=M(e),{mergeAppearanceWithDefault:se}=te(),[de,Se]=un(!1),[V,Y]=un(""),{setOpenFlowState:ee,getOpenFlowState:Ve,hasOpenModals:Le}=ve(),X=N(e);d=se(d);let[ue,Ae]=i!==void 0&&n!==void 0?[i,n]:[Ve(e,!0),W=>ee(e,W)];if(mn(()=>{!de&&!L&&(Se(!0),(j(e)===Z&&S||j(e)===Me)&&(j(e)===Z&&S&&le(e),typeof window!="undefined"&&window.localStorage&&Object.keys(window.localStorage).forEach(J=>{J.startsWith(Fr)&&window.localStorage.removeItem(J)})),Se(!0))},[de,Se,L]),mn(()=>{var J;let W=(J=window==null?void 0:window.location)!=null&&J.hash?window.location.hash.replace("#",""):"";if(W!=V&&X&&(X==null?void 0:X.length)>0){let fe=-1;if(W){let $e=W;fe=X.findIndex(Ge=>Ge.id===$e),V===W&&(fe=-1),Y(W)}else fe=0,Y("");fe!==-1&&pe(e,X[fe].id)}},[X,($=window==null?void 0:window.location)==null?void 0:$.hash]),L)return null;let be=b(e);if(!be||O(be)||!X||i!==void 0&&i===!1||j(e)===Z&&l||(o=="modal"||o=="corner-modal")&&Le(e))return null;let U=()=>{Ae(!1),g&&g(),y===!0&&G(e)};if(T=="center"&&o==="modal"||o==="large-modal"){let W={padding:"24px"};return o==="large-modal"?(W.width="85%",W.height="90%",W.maxHeight="800px",W.minHeight="500px",W.padding="0"):W.width="400px",et.createElement(Qe,{appearance:d,onClose:U,visible:ue,style:W,dismissible:f,showFrigadeBranding:A},et.createElement(ie,{appearance:d}),et.createElement(Vo,{appearance:d,steps:X,selectedStep:q,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:n,setShowModal:Ae,onDismiss:g,showPagination:E,customFormElements:s,allowBackNavigation:k,validationHandler:F,onFormDataChange:I,showFooter:x,prefillData:v,updateUrlOnPageChange:h}))}return o==="modal"&&T!=="center"?et.createElement($o,{appearance:d,onClose:U,visible:ue,modalPosition:T},et.createElement(ie,{appearance:d}),et.createElement(Vo,{appearance:d,steps:X,selectedStep:q,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:n,setShowModal:Ae,onDismiss:g,showPagination:E,customFormElements:s,allowBackNavigation:k,validationHandler:F,onFormDataChange:I,showFooter:x,prefillData:v,updateUrlOnPageChange:h})):et.createElement(et.Fragment,null,et.createElement(ie,{appearance:d}),et.createElement(Vo,{appearance:d,steps:X,selectedStep:q,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:n,setShowModal:Ae,onDismiss:g,showPagination:E,customFormElements:s,allowBackNavigation:k,validationHandler:F,onFormDataChange:I,showFooter:x,prefillData:v,updateUrlOnPageChange:h}))},gn=fn;import{useCallback as Er,useContext as Gp,useEffect as Kp}from"react";function Ar(){let{organizationId:e,userId:t,setOrganizationId:o}=Gp(Q),{mutateUserFlowState:i}=De(),{config:n,apiUrl:r}=Je(),s=Ut(),{verifySDKInitiated:p}=Wt();function d(f,y){return`frigade-user-group-registered-${f}-${y}`}Kp(()=>{if(t&&e){if(t.startsWith(zt))return;let f=d(t,e);localStorage.getItem(f)||(s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})})),localStorage.setItem(f,"true"))}},[t,e]);let l=Er(f=>D(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 y={foreignUserId:t,foreignUserGroupId:e,properties:f};yield s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(y)})),i()}),[e,t,n,i]),m=Er((f,y)=>D(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 S={foreignUserId:t,foreignUserGroupId:e,events:[{event:f,properties:y}]};yield s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(S)})),i()}),[e,t,n,i]),c=Er((f,y)=>D(this,null,function*(){if(p())if(y){let T=d(t,f);localStorage.setItem(T,"true"),o(f);let S={foreignUserId:t,foreignUserGroupId:f,properties:y};yield s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(S)})),i()}else o(f)}),[t,n,i]);return{organizationId:e,setOrganizationId:o,setOrganizationIdWithProperties:c,addPropertiesToOrganization:l,trackEventForOrganization:m}}var hn="frigade-xFrigade_guestUserId",So="frigade-xFrigade_userId",xn=({})=>{let{setFlowResponses:e}=ao(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=De(),{userId:n,setUserId:r}=po(),[s,p]=yo(n),{getFlowStatus:d}=R(),{flows:l,userProperties:m,setIsNewGuestUser:c,flowResponses:f}=qp(Q),[y,T]=yo([]),[S,g]=yo([]),{organizationId:E}=Ar(),[k,F]=yo(E),[A,I]=yo(!1);qt(()=>{if(!o&&t)for(let b=0;b<t.length;b++){let N=t[b],L=l.find(O=>O.slug===(N==null?void 0:N.flowId));if(L&&N&&N.shouldTrigger===!0&&L.type=="FORM"&&L.triggerType==="AUTOMATIC"&&!S.includes(L.slug)){setTimeout(()=>{x(N.flowId)},500);break}}},[o,t]),qt(()=>{f.length>0&&i()},[f]),qt(()=>{A||(I(!0),i())},[o,I]);function x(b){let N=l.find(L=>L.slug===b);N&&N.triggerType==="AUTOMATIC"&&!S.includes(N.slug)&&(g([...S,N.slug]),T([N]))}function v(){if(!n){let b=localStorage.getItem(So);if(b){r(b);return}let N=localStorage.getItem(hn);if(N){r(N);return}c(!0);let L=zt+Yp();try{localStorage.setItem(hn,L)}catch(O){console.log("Failed to save guest user id locally: Local storage unavailable",O)}r(O=>O||L)}}qt(()=>{try{if(l){let b=[];l.forEach(N=>{if(N.data){let L=N.data.match(/"imageUri":"(.*?)"/g);L&&L.forEach(O=>{let j=O.replace('"imageUri":"',"").replace('"',"");if(b.includes(j))return;let M=new Image;M.src=j,b.push(j)})}})}}catch(b){}},[l]),qt(()=>{if(n!==s&&(e([]),i()),p(n),n&&!n.startsWith(zt))try{localStorage.setItem(So,n)}catch(b){console.log("Failed to save user id locally: Local storage available",b)}n===null&&setTimeout(()=>{n===null&&v()},50)},[n,l,m]),qt(()=>{E!=k&&(F(E),e([]),i())},[E,k,F]);function h(){return Pt.createElement(Pt.Fragment,null,y.map(b=>d(b.slug)!==Me?null:Pt.createElement("span",{key:b.slug},Pt.createElement(gn,{flowId:b.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return Pt.createElement(Pt.Fragment,null,Pt.createElement(h,null))};import{ErrorBoundary as Sd}from"react-error-boundary";var Cn={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 Xp(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(Cn[o]){let n=Cn[o].split("."),r=t;n.forEach((s,p)=>{r[s]||(r[s]=p===n.length-1?i:{}),r=r[s]})}}),t}function Jp(e){if(!e)return;let t=he({},e),o={};return Object.keys(t).forEach(i=>{let n=`.fr-${i}`;o[n]=t[i]}),o}function yn(e){let{theme:t,styleOverrides:o}=e,i=Xp(t),n=Jp(o);return{overrides:i,css:n}}import dd from"styled-components";import{compose as cd,variant as bn}from"styled-system";import Sn from"react";import Qp,{ThemeProvider as Zp,useTheme as Rp}from"styled-components";import{border as ed,color as td,compose as od,get as rd,shadow as id,space as nd,system as sd,typography as ld}from"styled-system";var ad={width:{property:"width",scale:"sizes",transform:(e,t)=>rd(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},pd=Qp("div")(({css:e})=>e,od(ed,td,id,nd,ld,sd(ad))),bo=n=>{var r=n,{as:e,children:t,overrides:o}=r,i=Ie(r,["as","children","overrides"]);let s=Rp(),p={border:"none",boxSizing:"border-box",m:0,p:0},d=()=>Sn.createElement(pd,w(w({as:e},p),i),t);if(o!==void 0){let l=he(s,o);return Sn.createElement(Zp,{theme:l},d())}return d()};var wo={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"}},md={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},wn=dd(bo)(()=>({whiteSpace:"nowrap"}),cd(bn({scale:"components.Button",variants:"components.Button"}),bn({prop:"size",variants:md})));import ud from"styled-components";import{variant as fd,system as gd}from"styled-system";var Go={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 Tn=ud(bo)(fd({scale:"components.Text",variants:"components.Text"}),gd({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Fn=4,kn="px",hd=20,xd=Object.fromEntries(Array.from(Array(hd+1),(e,t)=>t===0?[.5,`${.5*Fn}${kn}`]:[t,`${t*Fn}${kn}`])),Yt={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"},Or={colors:_(w({},Yt),{neutral:{foreground:Yt.gray300},primary:{background:Yt.blue500,foreground:Yt.white,inverted:Yt.blue500},negative:{foreground:Yt.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:xd,components:{Button:wo,Text:Go}};var Pn="https://api.frigade.com",Q=Cd({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:it,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{},apiUrl:Pn,readonly:!1,debug:!1});function bd(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var wd=({publicApiKey:e,userId:t,organizationId:o,config:i,children:n})=>{var q,se,de,Se,V;let[r,s]=je(t||null),[p,d]=je(o||null),[l,m]=je([]),[c,f]=je([]),[y,T]=je([]),[S,g]=je({}),[E,k]=je({}),[F,A]=je([]),[I,x]=je({}),[v,h]=je(!1),[b,N]=je(!1),[L,O]=je(!G(e)),j=(Y,ee)=>{if(ee==="_blank"){window.open(Y,"_blank");return}setTimeout(()=>{window.location.href=Y},50)},M={theme:w(w({},it.theme),(se=(q=i==null?void 0:i.defaultAppearance)==null?void 0:q.theme)!=null?se:{}),styleOverrides:w(w({},it.styleOverrides),(Se=(de=i==null?void 0:i.defaultAppearance)==null?void 0:de.styleOverrides)!=null?Se:{})};function G(Y){return!!(Y&&Y.length>10&&Y.substring(0,10)==="api_public")}Ko(()=>{t&&s(t)},[t]),Ko(()=>{r&&typeof window!="undefined"&&window.localStorage&&window.localStorage.getItem(So)&&window.localStorage.getItem(So)!==r&&bd()},[r]),Ko(()=>{o&&d(o)},[o]),Ko(()=>{if(G(e))O(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),O(!0);return}},[e,O]);let le={publicApiKey:e,userId:r,setUserId:s,setFlows:m,flows:l,failedFlowResponses:c,setFailedFlowResponses:f,flowResponses:y,setFlowResponses:T,userProperties:S,setUserProperties:g,openFlowStates:E,setOpenFlowStates:k,completedFlowsToKeepOpenDuringSession:F,setCompletedFlowsToKeepOpenDuringSession:A,customVariables:I,setCustomVariables:x,isNewGuestUser:v,setIsNewGuestUser:h,hasActiveFullPageFlow:b,setHasActiveFullPageFlow:N,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:j,defaultAppearance:M,shouldGracefullyDegrade:L,setShouldGracefullyDegrade:O,apiUrl:i&&i.apiUrl?i.apiUrl:Pn,readonly:i&&i.readonly?i.readonly:!1,debug:i&&i.debug?i.debug:!1};if(L)return vt.createElement(Q.Provider,{value:le},n);let{overrides:pe}=yn(M);return vt.createElement(Sd,{fallback:vt.createElement(vt.Fragment,null,n)},vt.createElement(Q.Provider,{value:le},vt.createElement(yd,{theme:he(M.theme,Or,pe!=null?pe:{},(V=i==null?void 0:i.theme)!=null?V:{})},n,vt.createElement(xn,null))))};import dc from"react";import xe,{useEffect as ol,useState as rl}from"react";import Ye,{useState as zd}from"react";import At from"styled-components";import Xo from"react";import Bt from"react";import Bn from"styled-components";var vn=Bn.span`
|
|
687
688
|
font-weight: 600;
|
|
688
689
|
font-size: 14px;
|
|
689
690
|
font-style: normal;
|
|
@@ -704,11 +705,11 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map
|
|
|
704
705
|
padding-right: 8px;
|
|
705
706
|
width: 100%;
|
|
706
707
|
${e=>Fe(e)}
|
|
707
|
-
`,qo=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:n,primaryColor:r="#000000",checkBoxType:s="round",appearance:p})=>Bt.createElement(Bt.Fragment,null,Bt.createElement(Td,{className:a("checklistStepsContainer",p),appearance:p,styleOverrides:w({},n)},i==="left"&&e&&Bt.createElement(vn,{className:a("checklistStepLabel",p),styleOverrides:o,appearnace:p},e),Bt.createElement(nt,{appearance:p,value:t,type:s,primaryColor:r}),i==="right"&&e&&Bt.createElement(vn,{className:a("checklistStepLabel",p),styleOverrides:o,appearance:p},e)),Bt.createElement(ie,{appearance:p}));import
|
|
708
|
+
`,qo=({label:e,value:t,labelStyle:o={},labelPosition:i="right",style:n,primaryColor:r="#000000",checkBoxType:s="round",appearance:p})=>Bt.createElement(Bt.Fragment,null,Bt.createElement(Td,{className:a("checklistStepsContainer",p),appearance:p,styleOverrides:w({},n)},i==="left"&&e&&Bt.createElement(vn,{className:a("checklistStepLabel",p),styleOverrides:o,appearnace:p},e),Bt.createElement(nt,{appearance:p,value:t,type:s,primaryColor:r}),i==="right"&&e&&Bt.createElement(vn,{className:a("checklistStepLabel",p),styleOverrides:o,appearance:p},e)),Bt.createElement(ie,{appearance:p}));import To from"styled-components";var En=To.div`
|
|
708
709
|
font-weight: 700;
|
|
709
710
|
font-size: 18px;
|
|
710
711
|
line-height: 22px;
|
|
711
|
-
`,An=
|
|
712
|
+
`,An=To.p`
|
|
712
713
|
font-weight: 600;
|
|
713
714
|
font-size: 16px;
|
|
714
715
|
line-height: 24px;
|
|
@@ -716,7 +717,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map
|
|
|
716
717
|
letter-spacing: 0.32px;
|
|
717
718
|
font-style: normal;
|
|
718
719
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
719
|
-
`,On=
|
|
720
|
+
`,On=To.p`
|
|
720
721
|
font-weight: 400;
|
|
721
722
|
font-size: 14px;
|
|
722
723
|
font-style: normal;
|
|
@@ -725,14 +726,14 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map
|
|
|
725
726
|
letter-spacing: 0.28px;
|
|
726
727
|
margin: 8px 0px 0px 0px;
|
|
727
728
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
728
|
-
`,Yo=
|
|
729
|
+
`,Yo=To.div`
|
|
729
730
|
width: 6px;
|
|
730
731
|
position: absolute;
|
|
731
732
|
left: 0;
|
|
732
733
|
height: 100%;
|
|
733
734
|
border-top-right-radius: 4px;
|
|
734
735
|
border-bottom-right-radius: 4px;
|
|
735
|
-
`,In=
|
|
736
|
+
`,In=To.div`
|
|
736
737
|
flex-direction: row;
|
|
737
738
|
justify-content: flex-start;
|
|
738
739
|
border-bottom: 1px solid ${e=>e.theme.colorBorder};
|
|
@@ -782,11 +783,11 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map
|
|
|
782
783
|
padding-right: ${e=>e.padding};
|
|
783
784
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
784
785
|
${e=>Fe(e)}
|
|
785
|
-
`;var We=({count:e,total:t,display:o="count",textLocation:i="left",style:n={},textStyle:r={},appearance:s})=>{var f;if(t===0)return Et.createElement(Et.Fragment,null);Object.keys(r).length===0&&r.constructor===Object&&(r={color:(f=s==null?void 0:s.theme)==null?void 0:f.colorText});let p=e===0?"10px":`${e/t*100}%`,d=o==="compact"?"8px":"10px",l=Math.round(e/t*100),m=o==="compact"?"10px":"14px",c;return o==="count"||o==="compact"?c=`${e}/${t}`:o==="percent"&&(c=`${l}% complete`),i==="top"&&(m="0px"),Et.createElement(Fd,{className:a("progressBarContainer",s),textLocation:i,styleOverrides:n},Et.createElement(Pd,{className:a("progressBarStepText",s),styleOverrides:_(w({},r),{fontSize:o==="compact"?12:14,fontWeight:600}),appearance:s,padding:m,textLocation:i},c),Et.createElement(kd,{textLocation:i,className:a("progressBar",s)},Et.createElement(Ln,{style:{zIndex:o=="compact"?1:5},fgWidth:p,barHeight:d,appearance:s,className:a("progressBarFill",s)}),Et.createElement($n,{className:a("progressBarBackground",s),barHeight:d,appearance:s})))};import
|
|
786
|
+
`;var We=({count:e,total:t,display:o="count",textLocation:i="left",style:n={},textStyle:r={},appearance:s})=>{var f;if(t===0)return Et.createElement(Et.Fragment,null);Object.keys(r).length===0&&r.constructor===Object&&(r={color:(f=s==null?void 0:s.theme)==null?void 0:f.colorText});let p=e===0?"10px":`${e/t*100}%`,d=o==="compact"?"8px":"10px",l=Math.round(e/t*100),m=o==="compact"?"10px":"14px",c;return o==="count"||o==="compact"?c=`${e}/${t}`:o==="percent"&&(c=`${l}% complete`),i==="top"&&(m="0px"),Et.createElement(Fd,{className:a("progressBarContainer",s),textLocation:i,styleOverrides:n},Et.createElement(Pd,{className:a("progressBarStepText",s),styleOverrides:_(w({},r),{fontSize:o==="compact"?12:14,fontWeight:600}),appearance:s,padding:m,textLocation:i},c),Et.createElement(kd,{textLocation:i,className:a("progressBar",s)},Et.createElement(Ln,{style:{zIndex:o=="compact"?1:5},fgWidth:p,barHeight:d,appearance:s,className:a("progressBarFill",s)}),Et.createElement($n,{className:a("progressBarBackground",s),barHeight:d,appearance:s})))};import Fo from"react";import Bd from"styled-components";import Zo from"react";import Qo from"react";var Xt=({stepData:e,appearance:t})=>Qo.createElement(Qo.Fragment,null,Qo.createElement(An,{appearance:t,className:a("checklistStepTitle",t),dangerouslySetInnerHTML:ce(e.title)}),Qo.createElement(On,{appearance:t,className:a("checklistStepSubtitle",t),dangerouslySetInnerHTML:ce(e.subtitle)}));import Nr from"react";var Jt=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},i=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return Nr.createElement(_o,{className:a("ctaContainer",t)},Nr.createElement(oe,{appearance:t,title:e.primaryButtonTitle,onClick:o}),e.secondaryButtonTitle&&Nr.createElement(oe,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:i,style:{width:"auto",marginRight:"12px"}}))};var Qt=({stepData:e,appearance:t})=>Zo.createElement(Zo.Fragment,null,Zo.createElement(Xt,{stepData:e,appearance:t}),Zo.createElement(Jt,{stepData:e,appearance:t}));import vd from"react";function Mn(e){return vd.createElement(Re,{appearance:e.appearance,videoUri:e.videoUri})}var Lr="default",Ed=Bd.img`
|
|
786
787
|
border-radius: 4px;
|
|
787
788
|
max-height: 260px;
|
|
788
789
|
min-height: 200px;
|
|
789
|
-
`,Dn=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return
|
|
790
|
+
`,Dn=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return Fo.createElement("div",null,o)}return Fo.createElement(En,{className:a("checklistStepContent",t)},e.imageUri?Fo.createElement(Ed,{className:a("checklistStepImage",t),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Fo.createElement(Mn,{videoUri:e.videoUri,appearance:t}):null,Fo.createElement(Qt,{stepData:e,appearance:t}))};import ze,{useRef as Ad,useState as Od}from"react";import Zt from"styled-components";var Un=Zt.div`
|
|
790
791
|
display: block;
|
|
791
792
|
`,Id=Zt.div`
|
|
792
793
|
display: flex;
|
|
@@ -1107,7 +1108,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map
|
|
|
1107
1108
|
line-height: 14px;
|
|
1108
1109
|
font-weight: 400;
|
|
1109
1110
|
cursor: pointer;
|
|
1110
|
-
`;var Qd=({steps:e,style:t,title:o,primaryColor:i,appearance:n,onButtonClick:r})=>{let{primaryCTAClickSideEffects:s}=ae();return pt.createElement(cs,{style:t,className:a("guideContainer",n)},pt.createElement(us,{className:a("guideTitle",n)},o),pt.createElement(ms,{className:a("guideItemContainer",n)},e.map((p,d)=>{var l;return pt.createElement(fs,{key:`guide-${(l=p.id)!=null?l:d}`,className:a("guideItem",n)},p.icon&&pt.createElement(gs,{className:a("guideIcon",n)},pt.createElement(hs,null,p.icon)),pt.createElement(xs,{className:a("guideItemTitle",n),dangerouslySetInnerHTML:ce(p.title)}),pt.createElement(Cs,{className:a("guideItemSubtitle",n),dangerouslySetInnerHTML:ce(p.subtitle)}),pt.createElement(ys,{className:a("guideItemLink",n),color:i,onClick:()=>{p.primaryButtonUri&&s(p),r&&r(p)}},p.primaryButtonTitle))})))},
|
|
1111
|
+
`;var Qd=({steps:e,style:t,title:o,primaryColor:i,appearance:n,onButtonClick:r})=>{let{primaryCTAClickSideEffects:s}=ae();return pt.createElement(cs,{style:t,className:a("guideContainer",n)},pt.createElement(us,{className:a("guideTitle",n)},o),pt.createElement(ms,{className:a("guideItemContainer",n)},e.map((p,d)=>{var l;return pt.createElement(fs,{key:`guide-${(l=p.id)!=null?l:d}`,className:a("guideItem",n)},p.icon&&pt.createElement(gs,{className:a("guideIcon",n)},pt.createElement(hs,null,p.icon)),pt.createElement(xs,{className:a("guideItemTitle",n),dangerouslySetInnerHTML:ce(p.title)}),pt.createElement(Cs,{className:a("guideItemSubtitle",n),dangerouslySetInnerHTML:ce(p.subtitle)}),pt.createElement(ys,{className:a("guideItemLink",n),color:i,onClick:()=>{p.primaryButtonUri&&s(p),r&&r(p)}},p.primaryButtonTitle))})))},ko=Qd;var Rd=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:n,onClose:r,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:l,guideData:m,guideTitle:c,onGuideButtonClick:f})=>{let y=({stepData:x,handleSecondaryCTAClick:v,handleCTAClick:h})=>x?H.createElement(ts,{className:a("checklistStepContainer",l),"data-testid":"checklistStepContainer"},H.createElement(os,{appearance:l,className:a("checklistStepTitle",l),dangerouslySetInnerHTML:ce(x.title)}),H.createElement(rs,{appearance:l,className:a("checklistStepSubtitle",l),dangerouslySetInnerHTML:ce(x.subtitle)}),H.createElement(is,{className:a("checklistCTAContainer",l)},x.secondaryButtonTitle&&H.createElement(oe,{title:x.secondaryButtonTitle,onClick:v,appearance:l,secondary:!0}),H.createElement(oe,{title:x.primaryButtonTitle,onClick:h,appearance:l}))):H.createElement(H.Fragment,null),S=w(w({},{default:x=>{var N;if((N=e[k])!=null&&N.StepContent){let L=e[k].StepContent;return H.createElement("div",null,L)}let v=e[k];return H.createElement(y,{stepData:x,handleCTAClick:()=>{v.handlePrimaryButtonClick&&v.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{v.handleSecondaryButtonClick&&v.handleSecondaryButtonClick()}})}}),d),[g,E]=Zd(0),k=s!=null?s:g,F=p!=null?p:E,A=()=>{var x;return e?!((x=e[k])!=null&&x.type)||!S[e[k].type]?S.default(e[k]):S[e[k].type]({stepData:e[k],primaryColor:l.theme.colorPrimary}):H.createElement(H.Fragment,null)},I=e.filter(x=>x.complete).length;return n?(l.theme.modalContainer||(l.theme.borderRadius&&(Mr.borderRadius=l.theme.borderRadius+"px"),l.theme.modalContainer=Mr),H.createElement(Qe,{onClose:r,visible:n,appearance:l},H.createElement(ps,null,H.createElement(qn,null,H.createElement(Yn,{appearance:l,className:a("checklistTitle",l)},t),H.createElement(Xn,{appearance:l,className:a("checklistSubtitle",l)},o)),H.createElement(Kn,null,e&&e.length>0&&H.createElement(Jn,{className:a("stepsContainer",l)},H.createElement(Qn,null,H.createElement("div",{style:{flex:3}},H.createElement(Zn,{className:a("stepsTitle",l)},i)),H.createElement(as,null,H.createElement(We,{style:{width:"100%"},count:I,total:e.length,appearance:l}))),H.createElement(Rn,null,H.createElement(es,{className:a("checklistStepListContainer",l),appearance:l},e.map((x,v)=>{var b;let h=k===v;return H.createElement(ns,{selected:h,className:a(`checklistStepListItem${h?"Selected":""}`,l),key:`checklist-guide-step-${(b=x.id)!=null?b:v}`,disabled:x.blocked,onClick:()=>{x.blocked||F(v)},title:x.blocked?"Finish remaining steps to continue":void 0},h&&H.createElement(Yo,{className:a("checklistStepItemSelectedIndicator",l),layoutId:"checklist-step-selected",style:{backgroundColor:l.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),H.createElement(ss,{selected:h,className:a(`checklistStepListStepName${h?"Selected":""}`,l)},x.stepName),H.createElement(ls,null,H.createElement(nt,{value:x.complete,type:"round",primaryColor:l.theme.colorPrimary,progress:x.progress,appearance:l}),H.createElement(ds,null,H.createElement(Rt,{style:{marginLeft:"10px"},color:l.theme.colorBackgroundSecondary}))))})),H.createElement(A,null))),m&&m.length>0&&H.createElement(ko,{steps:m,title:c,primaryColor:l.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:l,onButtonClick:x=>(f&&f(x),!0)}))))):H.createElement(H.Fragment,null)},Dr=Rd;import Ne,{useEffect as Ls,useState as $s}from"react";import Te from"react";import dt from"styled-components";var Ss=dt.div`
|
|
1111
1112
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1112
1113
|
border: 1px solid;
|
|
1113
1114
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -1148,7 +1149,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map
|
|
|
1148
1149
|
:hover {
|
|
1149
1150
|
opacity: 0.8;
|
|
1150
1151
|
}
|
|
1151
|
-
`,
|
|
1152
|
+
`,e0=dt.div``,Ps=dt.p`
|
|
1152
1153
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1153
1154
|
font-weight: 400;
|
|
1154
1155
|
font-size: 14px;
|
|
@@ -1158,7 +1159,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map
|
|
|
1158
1159
|
flex-direction: row;
|
|
1159
1160
|
justify-content: flex-start;
|
|
1160
1161
|
align-items: center;
|
|
1161
|
-
`;var Bs=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:n,appearance:r,customStepTypes:s})=>{var c,f;let p=t?{}:{transform:"rotate(90deg)"},d=t?{overflow:"hidden",maxHeight:"0px",transition:"max-height 0.2s ease-out"}:{overflow:"hidden",maxHeight:"1000px",transition:"max-height 0.15s ease-in"};function l(){var y;return Te.createElement(Te.Fragment,null,e.imageUri||e.videoUri?Te.createElement(bs,{className:a("stepMediaContainer",r)},e.imageUri?Te.createElement(ws,{className:a("stepImage",r),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Te.createElement(Re,{appearance:r,videoUri:e.videoUri}):null):null,Te.createElement(Ps,{className:a("stepSubtitle",r),appearance:r,dangerouslySetInnerHTML:ce(e.subtitle)}),Te.createElement(_o,{className:a("checklistCTAContainer",r)},e.secondaryButtonTitle?Te.createElement(oe,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>n(),appearance:r}):null,Te.createElement(oe,{title:(y=e.primaryButtonTitle)!=null?y:"Continue",onClick:()=>i(),appearance:r})))}function m(){if(!s)return null;let y=s[e.type];return y?y(e,r):null}return Te.createElement(Ss,{"data-testid":`step-${e.id}`,className:a("checklistStepContainer",r),appearance:r},Te.createElement(Ts,{className:a("stepHeader",r)},Te.createElement(vs,null,Te.createElement(qo,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(c=r==null?void 0:r.theme)==null?void 0:c.colorPrimary,appearance:r}),Te.createElement(Fs,{appearance:r,className:a("stepTitle",r),dangerouslySetInnerHTML:ce(e.title),onClick:()=>o()})),Te.createElement(ks,{className:a("stepChevronContainer",r),onClick:()=>o(),appearance:r},Te.createElement(Rt,{style:_(w({},p),{transition:"transform 0.2s ease-in-out"})}))),Te.createElement("div",{key:e.id,style:w({},d)},(f=m())!=null?f:l()))};import eo from"styled-components";var
|
|
1162
|
+
`;var Bs=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:i,onSecondaryButtonClick:n,appearance:r,customStepTypes:s})=>{var c,f;let p=t?{}:{transform:"rotate(90deg)"},d=t?{overflow:"hidden",maxHeight:"0px",transition:"max-height 0.2s ease-out"}:{overflow:"hidden",maxHeight:"1000px",transition:"max-height 0.15s ease-in"};function l(){var y;return Te.createElement(Te.Fragment,null,e.imageUri||e.videoUri?Te.createElement(bs,{className:a("stepMediaContainer",r)},e.imageUri?Te.createElement(ws,{className:a("stepImage",r),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Te.createElement(Re,{appearance:r,videoUri:e.videoUri}):null):null,Te.createElement(Ps,{className:a("stepSubtitle",r),appearance:r,dangerouslySetInnerHTML:ce(e.subtitle)}),Te.createElement(_o,{className:a("checklistCTAContainer",r)},e.secondaryButtonTitle?Te.createElement(oe,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>n(),appearance:r}):null,Te.createElement(oe,{title:(y=e.primaryButtonTitle)!=null?y:"Continue",onClick:()=>i(),appearance:r})))}function m(){if(!s)return null;let y=s[e.type];return y?y(e,r):null}return Te.createElement(Ss,{"data-testid":`step-${e.id}`,className:a("checklistStepContainer",r),appearance:r},Te.createElement(Ts,{className:a("stepHeader",r)},Te.createElement(vs,null,Te.createElement(qo,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(c=r==null?void 0:r.theme)==null?void 0:c.colorPrimary,appearance:r}),Te.createElement(Fs,{appearance:r,className:a("stepTitle",r),dangerouslySetInnerHTML:ce(e.title),onClick:()=>o()})),Te.createElement(ks,{className:a("stepChevronContainer",r),onClick:()=>o(),appearance:r},Te.createElement(Rt,{style:_(w({},p),{transition:"transform 0.2s ease-in-out"})}))),Te.createElement("div",{key:e.id,style:w({},d)},(f=m())!=null?f:l()))};import eo from"styled-components";var f0=eo.div`
|
|
1162
1163
|
background: #ffffff;
|
|
1163
1164
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
1164
1165
|
border-radius: 6px;
|
|
@@ -1287,12 +1288,12 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map
|
|
|
1287
1288
|
|
|
1288
1289
|
background: ${({theme:e})=>e.colorBackground};
|
|
1289
1290
|
}
|
|
1290
|
-
`,
|
|
1291
|
+
`,O0=ge.div`
|
|
1291
1292
|
color: ${({theme:e})=>e.colorPrimary};
|
|
1292
1293
|
display: flex;
|
|
1293
1294
|
flex-flow: row nowrap;
|
|
1294
1295
|
align-items: center;
|
|
1295
|
-
`,
|
|
1296
|
+
`,I0=ge.div`
|
|
1296
1297
|
white-space: nowrap;
|
|
1297
1298
|
`,Ys=ge.div`
|
|
1298
1299
|
background: #d8fed8;
|
|
@@ -1373,7 +1374,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map
|
|
|
1373
1374
|
display: flex;
|
|
1374
1375
|
height: 100%;
|
|
1375
1376
|
align-items: center;
|
|
1376
|
-
`;var al=({title:e,count:t,total:o,onClick:i,style:n={},className:r,appearance:s,type:p="default"})=>tt.createElement(tt.Fragment,null,tt.createElement(ie,{appearance:s}),tt.createElement(il,{onClick:()=>i!==void 0&&i(),styleOverrides:w(w({},p=="condensed"?{display:"flex",justifyContent:"space-between"}:{}),n),className:we(r!=null?r:"",a("progressBadgeContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&tt.createElement(ll,{className:a("progressRingContainer",s)},tt.createElement(Ht,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),tt.createElement(nl,{type:p,className:a("badgeTitleContainer",s)},tt.createElement(sl,{type:p,appearance:s,className:a("badgeTitle",s)},e),i!==void 0&&tt.createElement(Rt,{className:a("badgeChevron",s),color:s.theme.colorPrimary})),p=="default"&&o&&o!==0&&tt.createElement(We,{display:"compact",count:t,total:o,bgColor:s.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:s,textStyle:{color:"#818898"}})));import Ct from"react";import
|
|
1377
|
+
`;var al=({title:e,count:t,total:o,onClick:i,style:n={},className:r,appearance:s,type:p="default"})=>tt.createElement(tt.Fragment,null,tt.createElement(ie,{appearance:s}),tt.createElement(il,{onClick:()=>i!==void 0&&i(),styleOverrides:w(w({},p=="condensed"?{display:"flex",justifyContent:"space-between"}:{}),n),className:we(r!=null?r:"",a("progressBadgeContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&tt.createElement(ll,{className:a("progressRingContainer",s)},tt.createElement(Ht,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),tt.createElement(nl,{type:p,className:a("badgeTitleContainer",s)},tt.createElement(sl,{type:p,appearance:s,className:a("badgeTitle",s)},e),i!==void 0&&tt.createElement(Rt,{className:a("badgeChevron",s),color:s.theme.colorPrimary})),p=="default"&&o&&o!==0&&tt.createElement(We,{display:"compact",count:t,total:o,bgColor:s.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:s,textStyle:{color:"#818898"}})));import Ct from"react";import Po from"styled-components";var pl=Po.div`
|
|
1377
1378
|
display: flex;
|
|
1378
1379
|
flex-direction: row;
|
|
1379
1380
|
width: 100%;
|
|
@@ -1383,25 +1384,25 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map
|
|
|
1383
1384
|
background-color: ${e=>e.appearance.theme.colorBackground};
|
|
1384
1385
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1385
1386
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1386
|
-
`,dl=
|
|
1387
|
+
`,dl=Po.div`
|
|
1387
1388
|
${e=>B(e)} {
|
|
1388
1389
|
display: flex;
|
|
1389
1390
|
justify-content: center;
|
|
1390
1391
|
align-items: center;
|
|
1391
1392
|
margin-right: 16px;
|
|
1392
1393
|
}
|
|
1393
|
-
`,cl=
|
|
1394
|
+
`,cl=Po.div`
|
|
1394
1395
|
display: flex;
|
|
1395
1396
|
flex-direction: column;
|
|
1396
1397
|
flex: 1;
|
|
1397
1398
|
margin-top: 0;
|
|
1398
|
-
`,ml=
|
|
1399
|
+
`,ml=Po.div`
|
|
1399
1400
|
display: flex;
|
|
1400
1401
|
flex-direction: column;
|
|
1401
1402
|
justify-content: center;
|
|
1402
1403
|
margin-left: 16px;
|
|
1403
1404
|
min-width: 200px;
|
|
1404
|
-
`,NS=
|
|
1405
|
+
`,NS=Po.div`
|
|
1405
1406
|
display: flex;
|
|
1406
1407
|
justify-content: center;
|
|
1407
1408
|
align-items: flex-end;
|
|
@@ -1410,7 +1411,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map
|
|
|
1410
1411
|
:hover {
|
|
1411
1412
|
opacity: 0.8;
|
|
1412
1413
|
}
|
|
1413
|
-
`;var ul=({title:e,subtitle:t,icon:o,appearance:i,count:n,total:r,className:s,style:p})=>Ct.createElement(Ct.Fragment,null,Ct.createElement(pl,{appearance:i,className:we(a("fullWidthProgressBadgeContainer",i),s!=null?s:""),style:p},o&&Ct.createElement(dl,{className:a("fullWidthProgressBadgeIcon",i)},o),Ct.createElement(cl,null,Ct.createElement(Ee,{size:"small",appearance:i,title:e,subtitle:t})),Ct.createElement(ml,{className:a("fullWidthProgressBadgeProgressContainer",i)},Ct.createElement(We,{count:n,total:r,display:"percent",textLocation:"top"}))));var uc=({flowId:e,title:t,subtitle:o,icon:i,style:n,onClick:r,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:l,type:m="default"})=>{let{getFlow:c,getFlowSteps:f,getFlowStatus:y,getNumberOfStepsCompleted:T,isLoading:S,targetingLogicShouldHideFlow:g,updateCustomVariables:E}=R(),{mergeAppearanceWithDefault:k}=te();l=k(l);let{setOpenFlowState:F,getOpenFlowState:A}=ve();if(mc(()=>{E(p)},[p,S]),S)return null;let I=c(e);if(!I||g(I)||d===!0&&y(e)===Z)return null;let x=f(e),v=T(e);return m==="full-width"?yt.createElement(yt.Fragment,null,yt.createElement(ie,{appearance:l}),yt.createElement(ul,{title:t,subtitle:o,count:v,total:x.length,style:n,className:s,appearance:l,icon:i,onClick:()=>{}})):yt.createElement(yt.Fragment,null,yt.createElement(ie,{appearance:l}),yt.createElement(al,{count:v,total:x.length,title:t,style:n,onClick:()=>{F(e,!0),r&&r()},type:m,className:s,appearance:l}))};import fc from"react";var gc=n=>{var r=n,{flowId:e,style:t,appearance:o}=r,i=Ie(r,["flowId","style","appearance"]);let{getFlow:s,targetingLogicShouldHideFlow:p,getFlowSteps:d}=R(),{mergeAppearanceWithDefault:l}=te();o=l(o);let m=s(e);if(!m||p(m))return null;let c=d(e);return fc.createElement(
|
|
1414
|
+
`;var ul=({title:e,subtitle:t,icon:o,appearance:i,count:n,total:r,className:s,style:p})=>Ct.createElement(Ct.Fragment,null,Ct.createElement(pl,{appearance:i,className:we(a("fullWidthProgressBadgeContainer",i),s!=null?s:""),style:p},o&&Ct.createElement(dl,{className:a("fullWidthProgressBadgeIcon",i)},o),Ct.createElement(cl,null,Ct.createElement(Ee,{size:"small",appearance:i,title:e,subtitle:t})),Ct.createElement(ml,{className:a("fullWidthProgressBadgeProgressContainer",i)},Ct.createElement(We,{count:n,total:r,display:"percent",textLocation:"top"}))));var uc=({flowId:e,title:t,subtitle:o,icon:i,style:n,onClick:r,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:l,type:m="default"})=>{let{getFlow:c,getFlowSteps:f,getFlowStatus:y,getNumberOfStepsCompleted:T,isLoading:S,targetingLogicShouldHideFlow:g,updateCustomVariables:E}=R(),{mergeAppearanceWithDefault:k}=te();l=k(l);let{setOpenFlowState:F,getOpenFlowState:A}=ve();if(mc(()=>{E(p)},[p,S]),S)return null;let I=c(e);if(!I||g(I)||d===!0&&y(e)===Z)return null;let x=f(e),v=T(e);return m==="full-width"?yt.createElement(yt.Fragment,null,yt.createElement(ie,{appearance:l}),yt.createElement(ul,{title:t,subtitle:o,count:v,total:x.length,style:n,className:s,appearance:l,icon:i,onClick:()=>{}})):yt.createElement(yt.Fragment,null,yt.createElement(ie,{appearance:l}),yt.createElement(al,{count:v,total:x.length,title:t,style:n,onClick:()=>{F(e,!0),r&&r()},type:m,className:s,appearance:l}))};import fc from"react";var gc=n=>{var r=n,{flowId:e,style:t,appearance:o}=r,i=Ie(r,["flowId","style","appearance"]);let{getFlow:s,targetingLogicShouldHideFlow:p,getFlowSteps:d}=R(),{mergeAppearanceWithDefault:l}=te();o=l(o);let m=s(e);if(!m||p(m))return null;let c=d(e);return fc.createElement(ko,w({steps:c,style:t,appearance:o},i))};import It,{useContext as Bc,useEffect as Ec}from"react";import K,{useEffect as tr,useLayoutEffect as hl,useRef as bc,useState as oo}from"react";import vo from"styled-components";import{useCallback as hc,useEffect as xc,useState as Cc}from"react";var _r=(e,t,o,i={x:20,y:20},n)=>{let r=n=="fixed"?0:window.scrollY,s=n=="fixed"?0:window.scrollX;return t==="left"?{x:e.left-o+i.x+s,y:e.top-i.y+r}:t==="right"?{x:e.left+e.width+i.x+s,y:e.top-i.y+r}:{x:0,y:0}};function fl(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]=Cc(o),r=hc(()=>{e&&n(e.getBoundingClientRect())},[e]);return xc(()=>(r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)),[e,t]),i}import{useContext as yc,useState as Sc}from"react";function gl(){let{debug:e}=yc(Q),[t,o]=Sc([]);function i(r){e&&(t.find(s=>s===r)||(o([...t,r]),console.log(r)))}function n(r){e&&(t.find(s=>s===r)||(o([...t,r]),console.warn(r)))}return{logIfDebugMode:i,logErrorIfDebugMode:n}}var xl=300,Cl=100,wc=500,ro=12,Tc=vo.div`
|
|
1414
1415
|
width: 100%;
|
|
1415
1416
|
height: 100%;
|
|
1416
1417
|
border-radius: 9999px;
|
|
@@ -1433,22 +1434,22 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map
|
|
|
1433
1434
|
opacity: 0;
|
|
1434
1435
|
}
|
|
1435
1436
|
}
|
|
1436
|
-
`,Fc=
|
|
1437
|
+
`,Fc=vo.div`
|
|
1437
1438
|
width: ${ro}px;
|
|
1438
1439
|
height: ${ro}px;
|
|
1439
1440
|
border-radius: 100px;
|
|
1440
1441
|
background-color: ${e=>e.primaryColor};
|
|
1441
1442
|
z-index: 20;
|
|
1442
1443
|
opacity: 1;
|
|
1443
|
-
`,kc=
|
|
1444
|
+
`,kc=vo.div`
|
|
1444
1445
|
pointer-events: all;
|
|
1445
|
-
`,yl=
|
|
1446
|
+
`,yl=vo.div`
|
|
1446
1447
|
display: flex;
|
|
1447
1448
|
align-content: center;
|
|
1448
1449
|
justify-content: center;
|
|
1449
1450
|
align-items: center;
|
|
1450
1451
|
z-index: ${e=>e.zIndex?e.zIndex:90};
|
|
1451
|
-
`,Pc=
|
|
1452
|
+
`,Pc=vo(yl)`
|
|
1452
1453
|
width: ${ro+12}px;
|
|
1453
1454
|
height: ${ro+12}px;
|
|
1454
1455
|
`,vc=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:n=!0,primaryColor:r="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:l=0,customStepTypes:m,appearance:c,dismissible:f=!1,showHighlightOnly:y,showStepCount:T=!0,completedStepsCount:S=0,showFrigadeBranding:g=!1,cssPosition:E="absolute"})=>{var $e,Ge,Xe,St,$t,Mt,bt,u,C,P,z,Oe,Ce,no,Jr,Qr,Zr,Rr,ei;let{logErrorIfDebugMode:k}=gl(),[F,A]=oo(),[I,x]=oo(new Date),v=bc(null),[h,b]=oo(document.querySelector(e[l].selector)),N=fl(h,I),[L,O]=oo(),[j,M]=oo(!y),G=(Ge=($e=e[l])==null?void 0:$e.props)!=null&&Ge.position?e[l].props.position:E,le=($t=(St=(Xe=e[l])==null?void 0:Xe.props)==null?void 0:St.zIndex)!=null?$t:90,pe=(Mt=F==null?void 0:F.width)!=null?Mt:xl,q=(bt=F==null?void 0:F.height)!=null?bt:Cl,[se,de]=oo(new Date().getTime());s=(P=(C=(u=e[l])==null?void 0:u.props)==null?void 0:C.offset)!=null?P:s;let Se=window.location.pathname.split("/").pop();hl(()=>{v.current&&A({width:v.current.clientWidth,height:v.current.clientHeight})},[l,I,G]),tr(()=>{y||M(!0)},[l]);let V=()=>{let ne=document.querySelector(e[l].selector);if(!ne){O(void 0),b(null),k(`FrigadeTour: Could not find element with selector "${e[l].selector}" for step ${e[l].id}`);return}L&&L===JSON.stringify(ne==null?void 0:ne.getBoundingClientRect())||(b(ne),x(new Date),ne&&O(JSON.stringify(ne.getBoundingClientRect())))};if(tr(()=>{let ne=new MutationObserver(V);return ne.observe(document.body,{subtree:!0,childList:!0}),()=>ne.disconnect()},[V]),tr(()=>{let ne=new MutationObserver(V);return ne.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>ne.disconnect()},[V]),tr(()=>{let ne=setInterval(()=>{V()},10);return()=>clearInterval(ne)},[V]),hl(()=>{setTimeout(()=>{V()},wc),V()},[l,Se]),h===null||!p)return null;let Y=i==="auto"?"right":i,ee=_r(N,Y,pe,s,G),Ve=N.right+pe>(window.innerWidth||document.documentElement.clientWidth),Le=N.bottom+Cl>(window.innerHeight||document.documentElement.clientHeight);Ve&&i==="auto"&&(ee=_r(N,"left",pe,s,G),Y="left"),(Oe=(z=e[l])==null?void 0:z.props)!=null&&Oe.tooltipPosition&&((no=(Ce=e[l])==null?void 0:Ce.props)==null?void 0:no.tooltipPosition)!=="auto"&&(((Qr=(Jr=e[l])==null?void 0:Jr.props)==null?void 0:Qr.tooltipPosition)==="left"||((Rr=(Zr=e[l])==null?void 0:Zr.props)==null?void 0:Rr.tooltipPosition)==="right")&&(Y=e[l].props.tooltipPosition);let X=()=>{let ne=()=>{if(e[l].handlePrimaryButtonClick&&(e[l].handlePrimaryButtonClick(),M(!1),setTimeout(()=>{V()},30)),S===e.length-1)return o()},mt=()=>{e[l].handleSecondaryButtonClick&&(e[l].handleSecondaryButtonClick(),y&&!e[l].secondaryButtonUri&&M(!1))};return K.createElement(K.Fragment,null,T&&e.length>1&&K.createElement(xi,null,K.createElement(yi,{className:a("tooltipStepCounter",c)},l+1," of ",e.length)),(e[l].primaryButtonTitle||e[l].secondaryButtonTitle)&&K.createElement(Ci,{showStepCount:T,className:a("tooltipCTAContainer",c)},e[l].secondaryButtonTitle&&K.createElement(oe,{title:e[l].secondaryButtonTitle,appearance:c,onClick:mt,size:"small",withMargin:!1,secondary:!0}),e[l].primaryButtonTitle&&K.createElement(oe,{title:e[l].primaryButtonTitle,appearance:c,onClick:ne,withMargin:!1,size:"small"})))},ue=()=>K.createElement(K.Fragment,null,f&&K.createElement(mi,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:a("tooltipClose",c),hasImage:!!e[l].imageUri||!!e[l].videoUri},K.createElement(Be,null)),e[l].imageUri&&K.createElement(ui,{dismissible:f,appearance:c,src:e[l].imageUri,className:a("tooltipImageContainer",c)}),e[l].videoUri&&!e[l].imageUri&&K.createElement(fi,{dismissible:f,appearance:c,className:a("tooltipVideoContainer",c)},K.createElement(Re,{appearance:c,videoUri:e[l].videoUri})),K.createElement(hi,{className:a("tooltipContentContainer",c)},K.createElement(Ee,{appearance:c,title:e[l].title,subtitle:e[l].subtitle,size:"small"}),K.createElement(gi,{className:a("tooltipFooter",c)},K.createElement(X,null)))),be=w(w({},{default:ne=>{var mt;if((mt=e[l])!=null&&mt.StepContent){let ra=e[l].StepContent;return K.createElement("div",null,ra)}return K.createElement(ue,null)}}),m),U=()=>{var ne;return e?!((ne=e[l])!=null&&ne.type)||!be[e[l].type]?be.default(e[l]):be[e[l].type]({stepData:e[l],primaryColor:r}):K.createElement(K.Fragment,null)};if(e[l].complete===!0||ee.x==0&&ee.y==0&&new Date().getTime()-se<100)return null;let $={top:(ee==null?void 0:ee.y)-ro,left:(ei=Y=="left"?N.x+s.x:(ee==null?void 0:ee.x)-ro)!=null?ei:0,cursor:y?"pointer":"default",position:G},W=()=>{let mt=$.left+(Y=="left"?-pe:24);return Math.min(Math.max(mt,20),window.innerWidth-pe-20)},J=()=>{if(G==="fixed")return $.top;let ne=$.top+q,mt=20;return ne>window.innerHeight-mt?$.top+-q:$.top},fe=()=>{y&&(x(new Date),M(!j))};return K.createElement(kc,null,K.createElement(Pc,{style:$,zIndex:le,className:a("tourHighlightContainer",c)},n&&e[l].showHighlight!==!1&&E!=="static"&&K.createElement(K.Fragment,null,K.createElement(Fc,{style:{position:G},onClick:fe,primaryColor:c.theme.colorPrimary,className:a("tourHighlightInnerCircle",c)}),K.createElement(Tc,{style:{position:"absolute"},onClick:fe,primaryColor:c.theme.colorPrimary,className:a("tourHighlightOuterCircle",c)}))),K.createElement(yl,{style:_(w({},$),{left:W(),top:J()}),zIndex:le+1,className:a("tooltipContainerWrapper",c)},j&&K.createElement(K.Fragment,null,K.createElement(Oo,{ref:v,layoutId:"tooltip-container",style:w({position:"relative",width:"max-content",right:0,top:E!=="static"?12:0},d),appearance:c,className:a("tooltipContainer",c),maxWidth:xl,zIndex:le+10},K.createElement(U,null)),g&&K.createElement(bi,{className:a("poweredByFrigadeTooltipRibbon",c),appearance:c,zIndex:le+10},K.createElement(Io,{appearance:c})))))},Hr=vc;import{Portal as Ac}from"react-portal";var Oc=S=>{var g=S,{flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:n,showTooltipsSimultaneously:r=!1,onDismiss:s,dismissible:p,tooltipPosition:d="auto",showHighlightOnly:l=!1,dismissBehavior:m="complete-flow",onComplete:c,skipIfNotFound:f=!1,cssPosition:y="absolute"}=g,T=Ie(g,["flowId","customVariables","appearance","onStepCompletion","onButtonClick","showTooltipsSimultaneously","onDismiss","dismissible","tooltipPosition","showHighlightOnly","dismissBehavior","onComplete","skipIfNotFound","cssPosition"]);let{getFlow:E,getFlowSteps:k,isLoading:F,targetingLogicShouldHideFlow:A,markStepCompleted:I,markStepStarted:x,markFlowCompleted:v,updateCustomVariables:h,getCurrentStepIndex:b,getStepStatus:N,isStepBlocked:L,getFlowStatus:O,getNumberOfStepsCompleted:j}=R(),{isLoadingUserFlowStateData:M}=De(),{primaryCTAClickSideEffects:G,secondaryCTAClickSideEffects:le}=ae(),{hasOpenModals:pe}=ve(),q=b(e),{openFlowStates:se}=Bc(Q),{mergeAppearanceWithDefault:de}=te();if(o=de(o),Ec(()=>{h(t)},[t,F]),M)return null;let Se=E(e);if(!Se||A(Se)||O(e)==Z||pe())return null;let V=k(e);if(Object.keys(se).length>0){let U=Object.keys(se).find($=>se[$]===!0);if(U!==void 0&&U!==e)return It.createElement(It.Fragment,null)}function Y(U){return D(this,null,function*(){if(yield I(e,U.id),V.map($=>N(e,$.id)).every($=>$===Ke)){yield v(e);return}if(!l&&q+1<V.length&&!r){if(L(e,V[q+1].id))return;yield x(e,V[q+1].id)}})}function ee(U,$,W){let J=q+1<V.length?V[q+1]:null;n&&n(U,q,$,J),i&&i(U,W,J)}function Ve(){return V.map(U=>_(w({},U),{handleSecondaryButtonClick:()=>D(this,null,function*(){le(U),U.skippable===!0&&(yield I(e,U.id,{skipped:!0})),ee(U,"secondary",q)}),handlePrimaryButtonClick:()=>D(this,null,function*(){(!U.completionCriteria&&(U.autoMarkCompleted||U.autoMarkCompleted===void 0)||U.completionCriteria&&U.autoMarkCompleted===!0)&&(yield Y(U)),ee(U,"primary",q),G(U)})}))}function Le(U){return D(this,null,function*(){s&&s(),m==="complete-flow"?yield v(e):yield I(e,U.id)})}function X(){c&&c()}let ue=!document.querySelector(V[q].selector);function Ae(){let U=V.findIndex($=>!!document.querySelector($.selector));return V.map(($,W)=>ue&&!r&&W!==U&&f||!r&&W!==q?null:It.createElement(Hr,w({key:$.id,appearance:o,steps:Ve(),selectedStep:W,showTooltipsSimultaneously:r,dismissible:p,onDismiss:()=>Le($),tooltipPosition:d,showHighlightOnly:l,completedStepsCount:j(e),onComplete:X,cssPosition:y},T)))}function be(){return It.createElement(It.Fragment,null,It.createElement(ie,{appearance:o}),Ae())}return y==="static"?be():It.createElement(Ac,null,be())};import _e,{useEffect as Ic,useRef as Nc,useState as Lc}from"react";import{Portal as $c}from"react-portal";import Nt from"styled-components";var Sl=Nt.button`
|
|
@@ -1695,6 +1696,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map
|
|
|
1695
1696
|
line-height: 24px;
|
|
1696
1697
|
width: 100%;
|
|
1697
1698
|
height: 100px;
|
|
1699
|
+
resize: none;
|
|
1698
1700
|
}
|
|
1699
1701
|
`,Vl=ct.div`
|
|
1700
1702
|
${e=>B(e)} {
|
|
@@ -1774,5 +1776,5 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${po}${t}.${po}${t} { ${Object.entries(o).map
|
|
|
1774
1776
|
height: 100%;
|
|
1775
1777
|
min-height: 200px;
|
|
1776
1778
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1777
|
-
`;function Rl({stepData:e,appearance:t,classPrefix:o=""}){return e.videoUri?Zl.createElement(Re,{appearance:t,videoUri:e.videoUri}):e.imageUri?Zl.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:s,dismissible:p=!0,modalPosition:d="center"})=>{let{getFlow:l,markFlowCompleted:m,markStepCompleted:c,isLoading:f,targetingLogicShouldHideFlow:y,updateCustomVariables:T,getFlowSteps:S,getFlowStatus:g,getCurrentStepIndex:E}=R(),{primaryCTAClickSideEffects:k,secondaryCTAClickSideEffects:F}=ae(),{mergeAppearanceWithDefault:A}=te(),{setOpenFlowState:I,getOpenFlowState:x,hasOpenModals:v}=ve(),[h,b]=[x(e,!0),le=>I(e,le)];if(n=A(n),Kc(()=>{T(o)},[o,f]),f)return null;let N=l(e);if(!N||y(N)||g(e)===Z||v())return null;let O=S(e)[E(e)],j=()=>{b(!1),t&&t(),m(e)};function M(){return Pe.createElement(Pe.Fragment,null,Pe.createElement(ie,{appearance:n}),Pe.createElement(Gl,{appearance:n,className:we(a("announcementContainer",n),r),style:s},(p===!0||O.dismissible)&&d=="inline"&&Pe.createElement(Xl,{onClick:()=>D(this,null,function*(){yield m(e),t&&t()}),className:a("announcementDismissButton",n)},Pe.createElement(Be,null)),Pe.createElement(Kl,null,Pe.createElement(Jl,{appearance:n,className:a("announcementTitle",n),dangerouslySetInnerHTML:ce(O.title)}),O.subtitle&&Pe.createElement(Ql,{appearance:n,className:a("announcementSubtitle",n),dangerouslySetInnerHTML:ce(O.subtitle)})),(O.imageUri||O.videoUri)&&Pe.createElement(Yl,{className:a("announcementMediaContainer",n)},Pe.createElement(Rl,{appearance:n,stepData:O})),(O.primaryButtonTitle||O.secondaryButtonTitle)&&Pe.createElement(ql,{className:a("announcementCTAContainer",n)},O.secondaryButtonTitle&&Pe.createElement(oe,{classPrefix:"announcement",title:O.secondaryButtonTitle,appearance:n,withMargin:!1,size:"small",type:"full-width",onClick:()=>D(this,null,function*(){O.handleSecondaryButtonClick(),F(O),i&&i(O,E(e),"secondary")}),secondary:!0}),O.primaryButtonTitle&&Pe.createElement(oe,{classPrefix:"announcement",title:O.primaryButtonTitle,appearance:n,withMargin:!1,size:"small",type:"full-width",onClick:()=>D(this,null,function*(){O.handlePrimaryButtonClick(),k(O),!(i&&i(O,E(e),"primary")===!1)&&(yield c(e,O.id),yield m(e))})}))))}let G={padding:"24px",maxWidth:"400px"};return d==="inline"?M():d!=="center"?Pe.createElement($o,{modalPosition:d,onClose:j,visible:h,dismissible:p,appearance:n},M()):Pe.createElement(Qe,{appearance:n,onClose:j,visible:h,style:G,dismissible:p},M())};import*as rr from"react";import ea from"react";var ta=n=>{var r=n,{as:e="span",children:t,variant:o="Body1"}=r,i=Ie(r,["as","children","variant"]);return ea.createElement(Tn,w({color:"neutral.foreground",fontFamily:"default",forwardedAs:e,variant:o},i),t)},Yc=Object.fromEntries(Object.keys(Go).map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=i=>ea.createElement(ta,_(w({as:t},i),{variant:e}),i.children);return o.displayName=`Text.${e}`,[e,o]})),Xr=Object.assign(ta,Yc);var oa=s=>{var p=s,{as:e="button",className:t,size:o="md",title:i,variant:n="Primary"}=p,r=Ie(p,["as","className","size","title","variant"]);var d;return rr.createElement(wn,w({className:`fr-button-${n.toLowerCase()}${t?` ${t}`:""}`,forwardedAs:e,variant:n,size:o,borderRadius:"md"},r),rr.createElement(Xr,{color:(d=
|
|
1779
|
+
`;function Rl({stepData:e,appearance:t,classPrefix:o=""}){return e.videoUri?Zl.createElement(Re,{appearance:t,videoUri:e.videoUri}):e.imageUri?Zl.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:s,dismissible:p=!0,modalPosition:d="center"})=>{let{getFlow:l,markFlowCompleted:m,markStepCompleted:c,isLoading:f,targetingLogicShouldHideFlow:y,updateCustomVariables:T,getFlowSteps:S,getFlowStatus:g,getCurrentStepIndex:E}=R(),{primaryCTAClickSideEffects:k,secondaryCTAClickSideEffects:F}=ae(),{mergeAppearanceWithDefault:A}=te(),{setOpenFlowState:I,getOpenFlowState:x,hasOpenModals:v}=ve(),[h,b]=[x(e,!0),le=>I(e,le)];if(n=A(n),Kc(()=>{T(o)},[o,f]),f)return null;let N=l(e);if(!N||y(N)||g(e)===Z||v())return null;let O=S(e)[E(e)],j=()=>{b(!1),t&&t(),m(e)};function M(){return Pe.createElement(Pe.Fragment,null,Pe.createElement(ie,{appearance:n}),Pe.createElement(Gl,{appearance:n,className:we(a("announcementContainer",n),r),style:s},(p===!0||O.dismissible)&&d=="inline"&&Pe.createElement(Xl,{onClick:()=>D(this,null,function*(){yield m(e),t&&t()}),className:a("announcementDismissButton",n)},Pe.createElement(Be,null)),Pe.createElement(Kl,null,Pe.createElement(Jl,{appearance:n,className:a("announcementTitle",n),dangerouslySetInnerHTML:ce(O.title)}),O.subtitle&&Pe.createElement(Ql,{appearance:n,className:a("announcementSubtitle",n),dangerouslySetInnerHTML:ce(O.subtitle)})),(O.imageUri||O.videoUri)&&Pe.createElement(Yl,{className:a("announcementMediaContainer",n)},Pe.createElement(Rl,{appearance:n,stepData:O})),(O.primaryButtonTitle||O.secondaryButtonTitle)&&Pe.createElement(ql,{className:a("announcementCTAContainer",n)},O.secondaryButtonTitle&&Pe.createElement(oe,{classPrefix:"announcement",title:O.secondaryButtonTitle,appearance:n,withMargin:!1,size:"small",type:"full-width",onClick:()=>D(this,null,function*(){O.handleSecondaryButtonClick(),F(O),i&&i(O,E(e),"secondary")}),secondary:!0}),O.primaryButtonTitle&&Pe.createElement(oe,{classPrefix:"announcement",title:O.primaryButtonTitle,appearance:n,withMargin:!1,size:"small",type:"full-width",onClick:()=>D(this,null,function*(){O.handlePrimaryButtonClick(),k(O),!(i&&i(O,E(e),"primary")===!1)&&(yield c(e,O.id),yield m(e))})}))))}let G={padding:"24px",maxWidth:"400px"};return d==="inline"?M():d!=="center"?Pe.createElement($o,{modalPosition:d,onClose:j,visible:h,dismissible:p,appearance:n},M()):Pe.createElement(Qe,{appearance:n,onClose:j,visible:h,style:G,dismissible:p},M())};import*as rr from"react";import ea from"react";var ta=n=>{var r=n,{as:e="span",children:t,variant:o="Body1"}=r,i=Ie(r,["as","children","variant"]);return ea.createElement(Tn,w({color:"neutral.foreground",fontFamily:"default",forwardedAs:e,variant:o},i),t)},Yc=Object.fromEntries(Object.keys(Go).map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=i=>ea.createElement(ta,_(w({as:t},i),{variant:e}),i.children);return o.displayName=`Text.${e}`,[e,o]})),Xr=Object.assign(ta,Yc);var oa=s=>{var p=s,{as:e="button",className:t,size:o="md",title:i,variant:n="Primary"}=p,r=Ie(p,["as","className","size","title","variant"]);var d;return rr.createElement(wn,w({className:`fr-button-${n.toLowerCase()}${t?` ${t}`:""}`,forwardedAs:e,variant:n,size:o,borderRadius:"md"},r),rr.createElement(Xr,{color:(d=wo[n])==null?void 0:d.color,fontWeight:"semibold"},i))},Xc=Object.fromEntries(Object.keys(wo).map(e=>{let t=o=>rr.createElement(oa,_(w({},o),{variant:e}));return t.displayName=`Button.${e}`,[e,t]})),Jc=Object.assign(oa,Xc);export{bo as Box,Jc as Button,nt as CheckBox,lr as FlowType,ft as FormLabel,yr as FormTextField,qc as FrigadeAnnouncement,zc as FrigadeBanner,zr as FrigadeChecklist,it as FrigadeDefaultAppearance,Uc as FrigadeEmbeddedTip,fn as FrigadeForm,gc as FrigadeGuide,cc as FrigadeHeroChecklist,jc as FrigadeNPSSurvey,uc as FrigadeProgressBadge,wd as FrigadeProvider,Mc as FrigadeSupportWidget,Oc as FrigadeTour,We as ProgressBar,Ht as ProgressRing,Xr as Text,Or as tokens,ve as useFlowOpens,ao as useFlowResponses,R as useFlows,Ar as useOrganization,po as useUser,De as useUserFlowStates};
|
|
1778
1780
|
//# sourceMappingURL=index.mjs.map
|