@frigade/react 1.37.1 → 1.37.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +209 -209
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +183 -183
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=Object.getOwnPropertyDescriptor,Aa=Object.getOwnPropertyDescriptors,Oa=Object.getOwnPropertyNames,Jo=Object.getOwnPropertySymbols,Na=Object.getPrototypeOf,Ar=Object.prototype.hasOwnProperty,hi=Object.prototype.propertyIsEnumerable;var gi=(e,t,o)=>t in e?vo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))Ar.call(t,o)&&gi(e,o,t[o]);if(Jo)for(var o of Jo(t))hi.call(t,o)&&gi(e,o,t[o]);return e},q=(e,t)=>Ba(e,Aa(t));var xi=e=>typeof e=="symbol"?e:e+"",Ye=(e,t)=>{var o={};for(var n in e)Ar.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&Jo)for(var n of Jo(e))t.indexOf(n)<0&&hi.call(e,n)&&(o[n]=e[n]);return o};var Ia=(e,t)=>{for(var o in t)vo(e,o,{get:t[o],enumerable:!0})},Ci=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Oa(t))!Ar.call(e,i)&&i!==o&&vo(e,i,{get:()=>t[i],enumerable:!(n=Ea(t,i))||n.enumerable});return e};var u=(e,t,o)=>(o=e!=null?va(Na(e)):{},Ci(t||!e||!e.__esModule?vo(o,"default",{value:e,enumerable:!0}):o,e)),La=e=>Ci(vo({},"__esModule",{value:!0}),e);var z=(e,t,o)=>new Promise((n,i)=>{var r=d=>{try{p(o.next(d))}catch(l){i(l)}},s=d=>{try{p(o.throw(d))}catch(l){i(l)}},p=d=>d.done?n(d.value):Promise.resolve(d.value).then(r,s);p((o=o.apply(e,t)).next())});var Dd={};Ia(Dd,{Box:()=>go,Button:()=>ka,CheckBox:()=>ht,FlowType:()=>Qo,FormLabel:()=>Pt,FormTextField:()=>pr,FrigadeAnnouncement:()=>wa,FrigadeBanner:()=>na,FrigadeChecklist:()=>kr,FrigadeDefaultAppearance:()=>gt,FrigadeEmbeddedTip:()=>Rl,FrigadeForm:()=>jr,FrigadeGuide:()=>Al,FrigadeHeroChecklist:()=>xl,FrigadeNPSSurvey:()=>ma,FrigadeProgressBadge:()=>Bl,FrigadeProvider:()=>Hn,FrigadeSupportWidget:()=>Yl,FrigadeTour:()=>Dl,ProgressBar:()=>Qe,ProgressRing:()=>Gt,Text:()=>Br,tokens:()=>yr,useFlowOpens:()=>ze,useFlowResponses:()=>so,useFlows:()=>Q,useOrganization:()=>hr,useUser:()=>ao,useUserFlowStates:()=>Xe});module.exports=La(Dd);var te=u(require("react")),Wn=require("styled-components");var ge=u(require("react"));var rt=require("react");var Vt=u(require("react"));var yi="1.32.18";var kt="NOT_STARTED_STEP",se="COMPLETED_FLOW",Xo="ABORTED_FLOW",jt="STARTED_FLOW",et="NOT_STARTED_FLOW",Je="COMPLETED_STEP",Bo="STARTED_STEP";function mt(){let{publicApiKey:e,userId:t,apiUrl:o}=Vt.default.useContext(X);return{config:(0,Vt.useMemo)(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":yi,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:(0,Vt.useMemo)(()=>`${o}/v1/public/`,[o])}}var $a="frigade-last-call-at-",Ma="frigade-last-call-data-";function oo(){let{shouldGracefullyDegrade:e,readonly:t}=Vt.default.useContext(X);return(o,n)=>z(this,null,function*(){if(t&&(n.method==="POST"||n.method==="PUT"||n.method==="DELETE"))return to();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),to();let i=$a+o,r=Ma+o;if(typeof window!="undefined"&&window.localStorage&&n&&n.body&&n.method==="POST"){let p=window.localStorage.getItem(i),d=window.localStorage.getItem(r);if(p&&d&&d==n.body){let l=new Date(p);if(new Date().getTime()-l.getTime()<1e3)return to()}typeof window!="undefined"&&(window.localStorage.setItem(i,new Date().toISOString()),window.localStorage.setItem(r,n.body))}let s;try{s=yield fetch(o,n)}catch(p){return to(p)}return s?s.ok?s:to(s.statusText):to()})}function to(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function ro(){let{publicApiKey:e,shouldGracefullyDegrade:t}=Vt.default.useContext(X);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}}var Eo=require("react");var no=require("react");var bi=u(require("swr"));var Si=require("react");function ze(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:n,completedFlowsToKeepOpenDuringSession:i}=(0,Si.useContext)(X);function r(c,g=!1){var y;return(y=e[c])!=null?y:g}function s(c,g){t(y=>q(w({},y),{[c]:g}))}function p(c){t(g=>{let C=g,{[c]:y}=C,T=Ye(C,[xi(c)]);return w({},T)})}function d(c){i.includes(c)||n(g=>[...g,c])}function l(c){return i.includes(c)}function m(c){return Object.entries(e).some(([g,y])=>y&&g!=c)||o}return{getOpenFlowState:r,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:m,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:l}}var wi=u(require("swr/immutable"));var io=u(require("core-js-pure/actual/structured-clone"));function Or(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ke(...e){let t=e.shift(),o=e.length===1?e[0]:ke(...e);if(!Or(t)||!Or(o))throw new Error("deepmerge can only merge Objects");let n=(0,io.default)(t);return Object.entries(o).forEach(([i,r])=>{Or(r)?n[i]!==void 0?Object.assign(n,{[i]:ke(n[i],(0,io.default)(r))}):Object.assign(n,{[i]:(0,io.default)(r)}):Array.isArray(r)?n[i]!==void 0?Object.assign(n,{[i]:[...n[i],...(0,io.default)(r)]}):Object.assign(n,{[i]:(0,io.default)(r)}):Object.assign(n,{[i]:r})}),n}var Da="unknown";function Xe(){let{config:e,apiUrl:t}=mt(),{publicApiKey:o,userId:n,organizationId:i,flows:r,setShouldGracefullyDegrade:s,readonly:p}=(0,no.useContext)(X),{resetOpenFlowState:d}=ze(),[l,m]=(0,no.useState)(!1),c={data:r.map(b=>({flowId:b.id,flowState:se,lastStepId:null,userId:n,foreignUserId:n,stepStates:{},shouldTrigger:!1}))},g=b=>fetch(b,e).then(k=>{if(k.ok)return k.json();throw new Error("Failed to fetch user flow states")}).catch(k=>(console.log(`Error fetching ${b}: ${k}. Will gracefully degrade and hide Frigade`),s(!0),c)),y=o&&r&&n?`${t}userFlowStates?foreignUserId=${encodeURIComponent(n)}${i?`&foreignUserGroupId=${encodeURIComponent(i)}`:""}`:null,{data:T,isLoading:C,mutate:h,error:O}=p?(0,wi.default)(y,g):(0,bi.default)(y,g,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!1,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),F=T==null?void 0:T.data;(0,no.useEffect)(()=>{!l&&!C&&F&&m(!0)},[F,l,C]);function P(b){return z(this,null,function*(){if(F&&!p){let k=F.find(D=>D.flowId===b);k&&k.flowState!==se&&(k.flowState=se),yield h(Promise.resolve(ke(T,{data:F})),{optimisticData:ke(T,{data:F}),revalidate:!1,rollbackOnError:!1})}})}function v(b,k,D){return z(this,null,function*(){if(F){let N=F.find(L=>L.flowId===b);N&&(N.stepStates[k]=D,N.flowState=jt),yield h(Promise.resolve(ke(T,{data:F})),{optimisticData:ke(T,{data:F}),revalidate:!1,rollbackOnError:!1})}})}function B(b,k,D){return z(this,null,function*(){if(F){let N=F.find(L=>L.flowId===b);N&&(N.lastStepId=k,N.stepStates[k]=D,N.flowState=jt),yield h(ke(T,{data:F}),{optimisticData:ke(T,{data:F}),revalidate:!1,rollbackOnError:!1})}})}function f(b){return z(this,null,function*(){if(F){let k=F.find(D=>D.flowId===b);k&&k.flowState!==et&&(k.flowState=et,k.lastStepId=Da,Object.keys(k.stepStates).forEach(D=>{k.stepStates[D].actionType=kt,k.stepStates[D].createdAt=new Date().toISOString()}),yield h(ke(T,{data:F}),{optimisticData:ke(T,{data:F}),revalidate:!1,rollbackOnError:!1}),d(b))}})}function $(b,k,D){return z(this,null,function*(){if(F){let N=F.find(L=>L.flowId===b);N&&(N.stepStates[k]=D),yield h(Promise.resolve(ke(T,{data:F})),{optimisticData:ke(T,{data:F}),revalidate:!1,rollbackOnError:!1})}})}return{userFlowStatesData:F,isLoadingUserFlowStateData:!l,mutateUserFlowState:h,optimisticallyMarkFlowCompleted:P,optimisticallyMarkFlowNotStarted:f,optimisticallyMarkStepCompleted:v,optimisticallyMarkStepNotStarted:$,optimisticallyMarkStepStarted:B,error:O}}function so(){let{config:e,apiUrl:t}=mt(),{userFlowStatesData:o,mutateUserFlowState:n}=Xe(),{failedFlowResponses:i,setFailedFlowResponses:r,flowResponses:s,setFlowResponses:p}=(0,Eo.useContext)(X),[d,l]=(0,Eo.useState)(new Set),[m,c]=(0,Eo.useState)(new Set),g=oo();function y(h){let O=JSON.stringify(h);if(d.has(O))return null;d.add(O),l(d),m.add(h),c(m);let F=s==null?void 0:s.find(P=>P.flowSlug===h.flowSlug&&P.stepId===h.stepId&&P.actionType===h.actionType&&P.createdAt===h.createdAt);return g(`${t}flowResponses`,q(w({},e),{method:"POST",body:O})).then(P=>{P.status!==200&&P.status!==201?(console.log("Failed to send flow response for step "+h.stepId+". Will retry again later."),r([...i,h])):F||p(v=>[...v!=null?v:[],h])})}function T(h){return z(this,null,function*(){h.foreignUserId&&(h.actionType===jt||h.actionType===et?yield y(h):h.actionType===se?yield y(h):h.actionType===Bo?yield y(h):h.actionType===Je?yield y(h):h.actionType===Xo?yield y(h):h.actionType===kt&&(yield y(h)))})}function C(){let h=[];return o==null||o.forEach(O=>{if(O&&O.stepStates&&Object.keys(O.stepStates).length!==0)for(let F in O.stepStates){let P=O.stepStates[F];h.push({foreignUserId:O.foreignUserId,flowSlug:O.flowId,stepId:P.stepId,actionType:P.actionType,data:{},createdAt:new Date(P.createdAt),blocked:P.blocked,hidden:P.hidden})}}),[...h,...s]}return{addResponse:T,setFlowResponses:p,getFlowResponses:C}}var Fi=u(require("swr"));var Ua=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Ti=e=>{let t=Ua.exec(e);if(t===null)return null;let o=null;return t.forEach((n,i)=>{let r=Wa(n,"'","");r.startsWith("flow_")&&(o=r)}),o},Wa=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function Nr(e){try{return JSON.parse(e)}catch(t){return console.error("Failed to parse Frigade config.yml to JSON",t),null}}var Qo=(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))(Qo||{});function Q(){let{config:e,apiUrl:t}=mt(),{flows:o,setFlows:n,userId:i,organizationId:r,publicApiKey:s,customVariables:p,setCustomVariables:d,hasActiveFullPageFlow:l,setHasActiveFullPageFlow:m,setFlowResponses:c,setShouldGracefullyDegrade:g,readonly:y}=(0,rt.useContext)(X),T={data:[]},{verifySDKInitiated:C}=ro(),{addResponse:h,getFlowResponses:O}=so(),F=x=>fetch(x,e).then(S=>S.ok?S.json():(console.log(`Error fetching ${x} (${S.status}): ${S.statusText}. Will gracefully degrade and hide Frigade`),g(!0),T)).catch(S=>(console.log(`Error fetching ${x}: ${S}. Will gracefully degrade and hide Frigade`),g(!0),T)),{mutateUserFlowState:P,userFlowStatesData:v,isLoadingUserFlowStateData:B,optimisticallyMarkFlowCompleted:f,optimisticallyMarkFlowNotStarted:$,optimisticallyMarkStepCompleted:b,optimisticallyMarkStepNotStarted:k,optimisticallyMarkStepStarted:D}=Xe(),{data:N,error:L,isLoading:K}=(0,Fi.default)(s?`${t}flows${y?"?readonly=true":""}`:null,F,{keepPreviousData:!0});(0,rt.useEffect)(()=>{if(L){console.error(L);return}N&&N.data&&n(N.data)},[N,L]);function _(x){if(K)return null;let S=o.find(E=>E.slug===x);return!S&&o.length>0&&!B&&!K?(console.log(`Flow with id ${x} not found`),null):(S==null?void 0:S.active)===!1&&!y?null:S}function J(x){var I,de;if(!_(x))return[];let S=_(x).data;return S?(S=R(S),((de=(I=Nr(S))==null?void 0:I.data)!=null?de:[]).map(ee=>{let Re=ne(ee);return q(w({handleSecondaryButtonClick:()=>{ee.skippable===!0&&pe(x,ee.id,{skipped:!0})}},ee),{complete:We(x,ee.id)===Je||Re>=1,started:We(x,ee.id)===Bo||We(x,ee.id)===Je,currentlyActive:v==null?void 0:v.some(Nt=>Nt.flowId==x&&Nt.lastStepId===ee.id),blocked:je(x,ee.id),hidden:Ae(x,ee.id),handlePrimaryButtonClick:()=>{(!ee.completionCriteria&&(ee.autoMarkCompleted||ee.autoMarkCompleted===void 0)||ee.completionCriteria&&ee.autoMarkCompleted===!0)&&pe(x,ee.id)},progress:Re})}).filter(ee=>ee.hidden!==!0)):[]}function R(x){return x.replaceAll(/\${(.*?)}/g,(S,E)=>p[E]===void 0?"":String(p[E]).replace(/[\u00A0-\u9999<>\&]/g,function(I){return"&#"+I.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 ye(x){var E;if(!_(x))return[];let S=_(x).data;return S?(S=R(S),(E=JSON.parse(S))!=null?E:{}):[]}function j(x,S){d(E=>q(w({},E),{[x]:S}))}function ue(x){!B&&!K&&x&&JSON.stringify(p)!=JSON.stringify(w(w({},p),x))&&Object.keys(x).forEach(S=>{j(S,x[S])})}let be=(0,rt.useCallback)((x,S,E)=>z(this,null,function*(){if(!C())return;let I={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:x,stepId:S,actionType:Bo,data:E!=null?E:{},createdAt:new Date,blocked:!1,hidden:!1};Fe(I)&&(yield D(x,S,I),h(I))}),[i,r,v]),$e=(0,rt.useCallback)((x,S,E)=>z(this,null,function*(){if(!C())return;let I={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:x,stepId:S,actionType:kt,data:E!=null?E:{},createdAt:new Date,blocked:!1,hidden:!1};Fe(I)&&(yield k(x,S,I),h(I))}),[i,r,v]),pe=(0,rt.useCallback)((x,S,E)=>z(this,null,function*(){if(!C())return;let I={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:x,stepId:S,actionType:Je,data:E!=null?E:{},createdAt:new Date,blocked:!1,hidden:!1};Fe(I)&&(yield b(x,S,I),h(I))}),[i,r,v]),ie=(0,rt.useCallback)((x,S)=>z(this,null,function*(){if(!C()||Se(x)===et)return;let E={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:x,stepId:"unknown",actionType:et,data:S!=null?S:{},createdAt:new Date,blocked:!1,hidden:!1};yield $(x),Fe(E)&&h(E)}),[i,r,v]),Te=(0,rt.useCallback)((x,S)=>z(this,null,function*(){if(!C())return;let E={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:x,stepId:"unknown",actionType:jt,data:S!=null?S:{},createdAt:new Date,blocked:!1,hidden:!1};Fe(E)&&h(E)}),[i,r,v]),W=(0,rt.useCallback)((x,S)=>z(this,null,function*(){if(!C())return;let E={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:x,stepId:"unknown",actionType:se,data:S!=null?S:{},createdAt:new Date,blocked:!1,hidden:!1};Fe(E)&&(yield f(x),h(E))}),[i,r,v]),Ee=(0,rt.useCallback)((x,S)=>z(this,null,function*(){if(!C())return;let E={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:x,stepId:"unknown",actionType:Xo,data:S!=null?S:{},createdAt:new Date,blocked:!1,hidden:!1};Fe(E)&&(yield f(x),h(E))}),[i,r,v]);function Fe(x){var S;if(v===void 0)return!1;if(v){let E=v.find(I=>I.flowId===x.flowSlug);if(x.actionType===kt&&(!(E!=null&&E.stepStates[x.stepId])||E.stepStates[x.stepId].actionType===kt))return!1;if(E&&((S=E.stepStates[x.stepId])==null?void 0:S.actionType)===x.actionType){if(x.actionType===Je&&(!x.data||JSON.stringify(x.data)===JSON.stringify({})))return!1;let I=Object.keys(E.stepStates).sort((de,ee)=>{let Re=new Date(E.stepStates[de].createdAt),Nt=new Date(E.stepStates[ee].createdAt);return Re.getTime()-Nt.getTime()});if(E.stepStates[I[I.length-1]].actionType===x.actionType&&x.stepId===I[I.length-1])return!1}if(E&&E.flowState===se&&x.actionType===se)return!1}return!0}function We(x,S){let E=V(x,S);return B?null:E?E.actionType:kt}function je(x,S){let E=V(x,S);return E?E.blocked:!1}function Ae(x,S){let E=V(x,S);return E?E.hidden:!1}function V(x,S){var I;if(B)return null;let E=v==null?void 0:v.find(de=>de.flowId===x);return!E||!E.stepStates[S]?null:(I=E.stepStates[S])!=null?I:null}function M(x){var E,I;if(B||!v)return null;if(Se(x)===et)return(E=J(x)[0])!=null?E:null;let S=(I=v.find(de=>de.flowId===x))==null?void 0:I.lastStepId;return S?J(x).find(de=>de.id===S):null}function H(x){var I;let S=M(x);if(!S)return 0;let E=(I=J(x).findIndex(de=>de.id===S.id))!=null?I:0;return We(x,S.id)===Je&&E<J(x).length-1?E+1:E}function ne(x){if(!x.completionCriteria)return;let S=Ti(x.completionCriteria);if(S===null)return;let E=Tt(S),I=Ft(S);return I===0?void 0:E/I}function Se(x){let S=v==null?void 0:v.find(E=>E.flowId===x);return S?S.flowState:null}function Tt(x){let S=J(x);return S.length===0?0:S.filter(I=>We(x,I.id)===Je).length}function Ft(x){return J(x).length}function Rt(x){let S=o.find(E=>E.slug===x);return S?Nr(S.data):null}function at(x){if(y)return!1;if(B)return!0;if(x!=null&&x.targetingLogic&&v){let S=v.find(E=>E.flowId===x.slug);if(S)return S.shouldTrigger===!1}return!!(x!=null&&x.targetingLogic&&i&&i.startsWith("guest_"))}function Ot(x){return!at(_(x))}function ct(){i&&P()}function eo(){return o}return{getAllFlows:eo,getFlow:_,getFlowData:Rt,isLoading:B||K,getStepStatus:We,getFlowSteps:J,getCurrentStepIndex:H,markStepStarted:be,markStepCompleted:pe,markFlowNotStarted:ie,markFlowStarted:Te,markFlowCompleted:W,markFlowAborted:Ee,markStepNotStarted:$e,getFlowStatus:Se,getNumberOfStepsCompleted:Tt,getNumberOfSteps:Ft,targetingLogicShouldHideFlow:at,setCustomVariable:j,updateCustomVariables:ue,customVariables:p,getStepOptionalProgress:ne,getFlowMetadata:ye,isStepBlocked:je,isStepHidden:Ae,hasActiveFullPageFlow:l,setHasActiveFullPageFlow:m,isFlowAvailableToUser:Ot,refresh:ct}}var Lt=require("react");var lo="guest_";function ao(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:n,shouldGracefullyDegrade:i}=(0,Lt.useContext)(X),{config:r,apiUrl:s}=mt(),{mutateUserFlowState:p}=Xe(),d=oo(),{verifySDKInitiated:l}=ro();function m(T){return`frigade-user-registered-${T}`}(0,Lt.useEffect)(()=>{if(e&&!t){if(e.startsWith(lo))return;let T=m(e);localStorage.getItem(T)||(d(`${s}users`,q(w({},r),{method:"POST",body:JSON.stringify({foreignId:e})})),localStorage.setItem(T,"true"))}},[e,i,t]);let c=(0,Lt.useCallback)(T=>z(this,null,function*(){if(!l())return;let C={foreignId:e,properties:T};yield d(`${s}users`,q(w({},r),{method:"POST",body:JSON.stringify(C)})),n(h=>w(w({},h),T)),p()}),[e,r,i,p]),g=(0,Lt.useCallback)((T,C)=>z(this,null,function*(){if(!l())return;let O={foreignId:e,events:[{event:T,properties:C}]};yield d(`${s}users`,q(w({},r),{method:"POST",body:JSON.stringify(O)})),p()}),[e,r,p]),y=(0,Lt.useCallback)((T,C)=>z(this,null,function*(){if(l())if(C){let h=m(T);localStorage.setItem(h,"true"),o(T);let O={foreignId:T,properties:C};yield d(`${s}users`,q(w({},r),{method:"POST",body:JSON.stringify(O)})),n(F=>w(w({},F),C)),p()}else o(T)}),[r,i,p]);return{userId:e,setUserId:o,setUserIdWithProperties:y,addPropertiesToUser:c,trackEventForUser:g}}var En=require("uuid");var He=u(require("react"));var Oe=u(require("react")),No=u(require("styled-components"));var Pi=u(require("react")),vi=u(require("styled-components"));var ki="fr-",Ao="cfr-";function a(e,t){let o=`${ki}${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+" "+Ao+e}return o}function A(e){if(!e.className||e.className.indexOf(Ao)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(ki)?"":`:not(${o.map(n=>`.${n}`).join(", ")})`}function Zo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function _e(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Zo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Me(...e){return e.filter(Boolean).join(" ")}function Oo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var za=vi.default.div`
|
|
2
|
+
var va=Object.create;var Ao=Object.defineProperty,Ba=Object.defineProperties,Ea=Object.getOwnPropertyDescriptor,Aa=Object.getOwnPropertyDescriptors,Oa=Object.getOwnPropertyNames,Zo=Object.getOwnPropertySymbols,Na=Object.getPrototypeOf,Lr=Object.prototype.hasOwnProperty,hi=Object.prototype.propertyIsEnumerable;var gi=(e,t,o)=>t in e?Ao(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))Lr.call(t,o)&&gi(e,o,t[o]);if(Zo)for(var o of Zo(t))hi.call(t,o)&&gi(e,o,t[o]);return e},q=(e,t)=>Ba(e,Aa(t));var xi=e=>typeof e=="symbol"?e:e+"",Ye=(e,t)=>{var o={};for(var n in e)Lr.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&Zo)for(var n of Zo(e))t.indexOf(n)<0&&hi.call(e,n)&&(o[n]=e[n]);return o};var Ia=(e,t)=>{for(var o in t)Ao(e,o,{get:t[o],enumerable:!0})},Ci=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Oa(t))!Lr.call(e,i)&&i!==o&&Ao(e,i,{get:()=>t[i],enumerable:!(n=Ea(t,i))||n.enumerable});return e};var u=(e,t,o)=>(o=e!=null?va(Na(e)):{},Ci(t||!e||!e.__esModule?Ao(o,"default",{value:e,enumerable:!0}):o,e)),La=e=>Ci(Ao({},"__esModule",{value:!0}),e);var z=(e,t,o)=>new Promise((n,i)=>{var r=d=>{try{p(o.next(d))}catch(l){i(l)}},s=d=>{try{p(o.throw(d))}catch(l){i(l)}},p=d=>d.done?n(d.value):Promise.resolve(d.value).then(r,s);p((o=o.apply(e,t)).next())});var Dd={};Ia(Dd,{Box:()=>ho,Button:()=>ka,CheckBox:()=>xt,FlowType:()=>tr,FormLabel:()=>vt,FormTextField:()=>ur,FrigadeAnnouncement:()=>wa,FrigadeBanner:()=>na,FrigadeChecklist:()=>Er,FrigadeDefaultAppearance:()=>ht,FrigadeEmbeddedTip:()=>Rl,FrigadeForm:()=>qr,FrigadeGuide:()=>Al,FrigadeHeroChecklist:()=>xl,FrigadeNPSSurvey:()=>ma,FrigadeProgressBadge:()=>Bl,FrigadeProvider:()=>Hn,FrigadeSupportWidget:()=>Yl,FrigadeTour:()=>Dl,ProgressBar:()=>Qe,ProgressRing:()=>Kt,Text:()=>Nr,tokens:()=>Tr,useFlowOpens:()=>ze,useFlowResponses:()=>lo,useFlows:()=>Q,useOrganization:()=>Sr,useUser:()=>po,useUserFlowStates:()=>Xe});module.exports=La(Dd);var ee=u(require("react")),Wn=require("styled-components");var fe=u(require("react"));var it=require("react");var jt=u(require("react"));var yi="1.37.3";var Pt="NOT_STARTED_STEP",ne="COMPLETED_FLOW",Ro="ABORTED_FLOW",Gt="STARTED_FLOW",et="NOT_STARTED_FLOW",Je="COMPLETED_STEP",Oo="STARTED_STEP";function ut(){let{publicApiKey:e,userId:t,apiUrl:o}=jt.default.useContext(X);return{config:(0,jt.useMemo)(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":yi,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:(0,jt.useMemo)(()=>`${o}/v1/public/`,[o])}}var $a="frigade-last-call-at-",Ma="frigade-last-call-data-";function ro(){let{shouldGracefullyDegrade:e,readonly:t}=jt.default.useContext(X);return(o,n)=>z(this,null,function*(){if(t&&(n.method==="POST"||n.method==="PUT"||n.method==="DELETE"))return oo();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),oo();let i=$a+o,r=Ma+o;if(typeof window!="undefined"&&window.localStorage&&n&&n.body&&n.method==="POST"){let p=window.localStorage.getItem(i),d=window.localStorage.getItem(r);if(p&&d&&d==n.body){let l=new Date(p);if(new Date().getTime()-l.getTime()<1e3)return oo()}typeof window!="undefined"&&(window.localStorage.setItem(i,new Date().toISOString()),window.localStorage.setItem(r,n.body))}let s;try{s=yield fetch(o,n)}catch(p){return oo(p)}return s?s.ok?s:oo(s.statusText):oo()})}function oo(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function io(){let{publicApiKey:e,shouldGracefullyDegrade:t}=jt.default.useContext(X);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}}var No=require("react");var so=require("react");var bi=u(require("swr"));var Si=require("react");function ze(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:n,completedFlowsToKeepOpenDuringSession:i}=(0,Si.useContext)(X);function r(c,g=!1){var y;return(y=e[c])!=null?y:g}function s(c,g){t(y=>q(w({},y),{[c]:g}))}function p(c){t(g=>{let C=g,{[c]:y}=C,T=Ye(C,[xi(c)]);return w({},T)})}function d(c){i.includes(c)||n(g=>[...g,c])}function l(c){return i.includes(c)}function m(c){return Object.entries(e).some(([g,y])=>y&&g!=c)||o}return{getOpenFlowState:r,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:m,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:l}}var wi=u(require("swr/immutable"));var no=u(require("core-js-pure/actual/structured-clone"));function $r(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ke(...e){let t=e.shift(),o=e.length===1?e[0]:ke(...e);if(!$r(t)||!$r(o))throw new Error("deepmerge can only merge Objects");let n=(0,no.default)(t);return Object.entries(o).forEach(([i,r])=>{$r(r)?n[i]!==void 0?Object.assign(n,{[i]:ke(n[i],(0,no.default)(r))}):Object.assign(n,{[i]:(0,no.default)(r)}):Array.isArray(r)?n[i]!==void 0?Object.assign(n,{[i]:[...n[i],...(0,no.default)(r)]}):Object.assign(n,{[i]:(0,no.default)(r)}):Object.assign(n,{[i]:r})}),n}var Da="unknown";function Xe(){let{config:e,apiUrl:t}=ut(),{publicApiKey:o,userId:n,organizationId:i,flows:r,setShouldGracefullyDegrade:s,readonly:p}=(0,so.useContext)(X),{resetOpenFlowState:d}=ze(),[l,m]=(0,so.useState)(!1),c={data:r.map(b=>({flowId:b.id,flowState:ne,lastStepId:null,userId:n,foreignUserId:n,stepStates:{},shouldTrigger:!1}))},g=b=>fetch(b,e).then(k=>{if(k.ok)return k.json();throw new Error("Failed to fetch user flow states")}).catch(k=>(console.log(`Error fetching ${b}: ${k}. Will gracefully degrade and hide Frigade`),s(!0),c)),y=o&&r&&n?`${t}userFlowStates?foreignUserId=${encodeURIComponent(n)}${i?`&foreignUserGroupId=${encodeURIComponent(i)}`:""}`:null,{data:T,isLoading:C,mutate:h,error:O}=p?(0,wi.default)(y,g):(0,bi.default)(y,g,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!1,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),F=T==null?void 0:T.data;(0,so.useEffect)(()=>{!l&&!C&&F&&m(!0)},[F,l,C]);function P(b){return z(this,null,function*(){if(F&&!p){let k=F.find(D=>D.flowId===b);k&&k.flowState!==ne&&(k.flowState=ne),yield h(Promise.resolve(ke(T,{data:F})),{optimisticData:ke(T,{data:F}),revalidate:!1,rollbackOnError:!1})}})}function v(b,k,D){return z(this,null,function*(){if(F){let N=F.find(L=>L.flowId===b);N&&(N.stepStates[k]=D,N.flowState=Gt),yield h(Promise.resolve(ke(T,{data:F})),{optimisticData:ke(T,{data:F}),revalidate:!1,rollbackOnError:!1})}})}function B(b,k,D){return z(this,null,function*(){if(F){let N=F.find(L=>L.flowId===b);N&&(N.lastStepId=k,N.stepStates[k]=D,N.flowState=Gt),yield h(ke(T,{data:F}),{optimisticData:ke(T,{data:F}),revalidate:!1,rollbackOnError:!1})}})}function f(b){return z(this,null,function*(){if(F){let k=F.find(D=>D.flowId===b);k&&k.flowState!==et&&(k.flowState=et,k.lastStepId=Da,Object.keys(k.stepStates).forEach(D=>{k.stepStates[D].actionType=Pt,k.stepStates[D].createdAt=new Date().toISOString()}),yield h(ke(T,{data:F}),{optimisticData:ke(T,{data:F}),revalidate:!1,rollbackOnError:!1}),d(b))}})}function $(b,k,D){return z(this,null,function*(){if(F){let N=F.find(L=>L.flowId===b);N&&(N.stepStates[k]=D),yield h(Promise.resolve(ke(T,{data:F})),{optimisticData:ke(T,{data:F}),revalidate:!1,rollbackOnError:!1})}})}return{userFlowStatesData:F,isLoadingUserFlowStateData:!l,mutateUserFlowState:h,optimisticallyMarkFlowCompleted:P,optimisticallyMarkFlowNotStarted:f,optimisticallyMarkStepCompleted:v,optimisticallyMarkStepNotStarted:$,optimisticallyMarkStepStarted:B,error:O}}function lo(){let{config:e,apiUrl:t}=ut(),{userFlowStatesData:o,mutateUserFlowState:n}=Xe(),{failedFlowResponses:i,setFailedFlowResponses:r,flowResponses:s,setFlowResponses:p}=(0,No.useContext)(X),[d,l]=(0,No.useState)(new Set),[m,c]=(0,No.useState)(new Set),g=ro();function y(h){let O=JSON.stringify(h);if(d.has(O))return null;d.add(O),l(d),m.add(h),c(m);let F=s==null?void 0:s.find(P=>P.flowSlug===h.flowSlug&&P.stepId===h.stepId&&P.actionType===h.actionType&&P.createdAt===h.createdAt);return g(`${t}flowResponses`,q(w({},e),{method:"POST",body:O})).then(P=>{P.status!==200&&P.status!==201?(console.log("Failed to send flow response for step "+h.stepId+". Will retry again later."),r([...i,h])):F||p(v=>[...v!=null?v:[],h])})}function T(h){return z(this,null,function*(){h.foreignUserId&&(h.actionType===Gt||h.actionType===et?yield y(h):h.actionType===ne?yield y(h):h.actionType===Oo?yield y(h):h.actionType===Je?yield y(h):h.actionType===Ro?yield y(h):h.actionType===Pt&&(yield y(h)))})}function C(){let h=[];return o==null||o.forEach(O=>{if(O&&O.stepStates&&Object.keys(O.stepStates).length!==0)for(let F in O.stepStates){let P=O.stepStates[F];h.push({foreignUserId:O.foreignUserId,flowSlug:O.flowId,stepId:P.stepId,actionType:P.actionType,data:{},createdAt:new Date(P.createdAt),blocked:P.blocked,hidden:P.hidden})}}),[...h,...s]}return{addResponse:T,setFlowResponses:p,getFlowResponses:C}}var Fi=u(require("swr"));var Ua=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,Ti=e=>{let t=Ua.exec(e);if(t===null)return null;let o=null;return t.forEach((n,i)=>{let r=Wa(n,"'","");r.startsWith("flow_")&&(o=r)}),o},Wa=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function er(e){try{return JSON.parse(e)}catch(t){return console.error("Failed to parse Frigade config.yml to JSON",t),null}}var tr=(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))(tr||{});function Q(){let{config:e,apiUrl:t}=ut(),{flows:o,setFlows:n,userId:i,organizationId:r,publicApiKey:s,customVariables:p,setCustomVariables:d,hasActiveFullPageFlow:l,setHasActiveFullPageFlow:m,setFlowResponses:c,setShouldGracefullyDegrade:g,readonly:y}=(0,it.useContext)(X),T={data:[]},{verifySDKInitiated:C}=io(),{addResponse:h,getFlowResponses:O}=lo(),F=x=>fetch(x,e).then(S=>S.ok?S.json():(console.log(`Error fetching ${x} (${S.status}): ${S.statusText}. Will gracefully degrade and hide Frigade`),g(!0),T)).catch(S=>(console.log(`Error fetching ${x}: ${S}. Will gracefully degrade and hide Frigade`),g(!0),T)),{mutateUserFlowState:P,userFlowStatesData:v,isLoadingUserFlowStateData:B,optimisticallyMarkFlowCompleted:f,optimisticallyMarkFlowNotStarted:$,optimisticallyMarkStepCompleted:b,optimisticallyMarkStepNotStarted:k,optimisticallyMarkStepStarted:D}=Xe(),{data:N,error:L,isLoading:K}=(0,Fi.default)(s?`${t}flows${y?"?readonly=true":""}`:null,F,{keepPreviousData:!0});(0,it.useEffect)(()=>{if(L){console.error(L);return}N&&N.data&&n(N.data)},[N,L]);function _(x){if(K)return null;let S=o.find(E=>E.slug===x);return!S&&o.length>0&&!B&&!K?(console.log(`Flow with id ${x} not found`),null):(S==null?void 0:S.active)===!1&&!y?null:S}function J(x){var I,pe,rt,Re,It;if(!_(x))return[];let S=(I=_(x))==null?void 0:I.data;return S?(S=R(S),((It=(Re=(pe=er(S))==null?void 0:pe.data)!=null?Re:(rt=er(S))==null?void 0:rt.steps)!=null?It:[]).map(Se=>{let Bo=ie(Se);return q(w({handleSecondaryButtonClick:()=>{Se.skippable===!0&&ae(x,Se.id,{skipped:!0})}},Se),{complete:We(x,Se.id)===Je||Bo>=1,started:We(x,Se.id)===Oo||We(x,Se.id)===Je,currentlyActive:v==null?void 0:v.some(Eo=>Eo.flowId==x&&Eo.lastStepId===Se.id),blocked:je(x,Se.id),hidden:Ae(x,Se.id),handlePrimaryButtonClick:()=>{(!Se.completionCriteria&&(Se.autoMarkCompleted||Se.autoMarkCompleted===void 0)||Se.completionCriteria&&Se.autoMarkCompleted===!0)&&ae(x,Se.id)},progress:Bo})}).filter(Se=>Se.hidden!==!0)):[]}function R(x){return x.replaceAll(/\${(.*?)}/g,(S,E)=>p[E]===void 0?"":String(p[E]).replace(/[\u00A0-\u9999<>\&]/g,function(I){return"&#"+I.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 Ce(x){var E;if(!_(x))return[];let S=_(x).data;return S?(S=R(S),(E=JSON.parse(S))!=null?E:{}):[]}function j(x,S){d(E=>q(w({},E),{[x]:S}))}function me(x){!B&&!K&&x&&JSON.stringify(p)!=JSON.stringify(w(w({},p),x))&&Object.keys(x).forEach(S=>{j(S,x[S])})}let be=(0,it.useCallback)((x,S,E)=>z(this,null,function*(){if(!C())return;let I={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:x,stepId:S,actionType:Oo,data:E!=null?E:{},createdAt:new Date,blocked:!1,hidden:!1};Fe(I)&&(yield D(x,S,I),h(I))}),[i,r,v]),$e=(0,it.useCallback)((x,S,E)=>z(this,null,function*(){if(!C())return;let I={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:x,stepId:S,actionType:Pt,data:E!=null?E:{},createdAt:new Date,blocked:!1,hidden:!1};Fe(I)&&(yield k(x,S,I),h(I))}),[i,r,v]),ae=(0,it.useCallback)((x,S,E)=>z(this,null,function*(){if(!C())return;let I={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:x,stepId:S,actionType:Je,data:E!=null?E:{},createdAt:new Date,blocked:!1,hidden:!1};Fe(I)&&(yield b(x,S,I),h(I))}),[i,r,v]),re=(0,it.useCallback)((x,S)=>z(this,null,function*(){if(!C()||ye(x)===et)return;let E={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:x,stepId:"unknown",actionType:et,data:S!=null?S:{},createdAt:new Date,blocked:!1,hidden:!1};yield $(x),Fe(E)&&h(E)}),[i,r,v]),Te=(0,it.useCallback)((x,S)=>z(this,null,function*(){if(!C())return;let E={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:x,stepId:"unknown",actionType:Gt,data:S!=null?S:{},createdAt:new Date,blocked:!1,hidden:!1};Fe(E)&&h(E)}),[i,r,v]),W=(0,it.useCallback)((x,S)=>z(this,null,function*(){if(!C())return;let E={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:x,stepId:"unknown",actionType:ne,data:S!=null?S:{},createdAt:new Date,blocked:!1,hidden:!1};Fe(E)&&(yield f(x),h(E))}),[i,r,v]),Ee=(0,it.useCallback)((x,S)=>z(this,null,function*(){if(!C())return;let E={foreignUserId:i,foreignUserGroupId:r!=null?r:null,flowSlug:x,stepId:"unknown",actionType:Ro,data:S!=null?S:{},createdAt:new Date,blocked:!1,hidden:!1};Fe(E)&&(yield f(x),h(E))}),[i,r,v]);function Fe(x){var S;if(v===void 0)return!1;if(v){let E=v.find(I=>I.flowId===x.flowSlug);if(x.actionType===Pt&&(!(E!=null&&E.stepStates[x.stepId])||E.stepStates[x.stepId].actionType===Pt))return!1;if(E&&((S=E.stepStates[x.stepId])==null?void 0:S.actionType)===x.actionType){if(x.actionType===Je&&(!x.data||JSON.stringify(x.data)===JSON.stringify({})))return!1;let I=Object.keys(E.stepStates).sort((pe,rt)=>{let Re=new Date(E.stepStates[pe].createdAt),It=new Date(E.stepStates[rt].createdAt);return Re.getTime()-It.getTime()});if(E.stepStates[I[I.length-1]].actionType===x.actionType&&x.stepId===I[I.length-1])return!1}if(E&&E.flowState===ne&&x.actionType===ne)return!1}return!0}function We(x,S){let E=V(x,S);return B?null:E?E.actionType:Pt}function je(x,S){let E=V(x,S);return E?E.blocked:!1}function Ae(x,S){let E=V(x,S);return E?E.hidden:!1}function V(x,S){var I;if(B)return null;let E=v==null?void 0:v.find(pe=>pe.flowId===x);return!E||!E.stepStates[S]?null:(I=E.stepStates[S])!=null?I:null}function M(x){var E,I;if(B||!v)return null;if(ye(x)===et)return(E=J(x)[0])!=null?E:null;let S=(I=v.find(pe=>pe.flowId===x))==null?void 0:I.lastStepId;return S?J(x).find(pe=>pe.id===S):null}function H(x){var I;let S=M(x);if(!S)return 0;let E=(I=J(x).findIndex(pe=>pe.id===S.id))!=null?I:0;return We(x,S.id)===Je&&E<J(x).length-1?E+1:E}function ie(x){if(!x.completionCriteria)return;let S=Ti(x.completionCriteria);if(S===null)return;let E=Ft(S),I=kt(S);return I===0?void 0:E/I}function ye(x){let S=v==null?void 0:v.find(E=>E.flowId===x);return S?S.flowState:null}function Ft(x){let S=J(x);return S.length===0?0:S.filter(I=>We(x,I.id)===Je).length}function kt(x){return J(x).length}function eo(x){let S=o.find(E=>E.slug===x);return S?er(S.data):null}function pt(x){if(y)return!1;if(B)return!0;if(x!=null&&x.targetingLogic&&v){let S=v.find(E=>E.flowId===x.slug);if(S)return S.shouldTrigger===!1}return!!(x!=null&&x.targetingLogic&&i&&i.startsWith("guest_"))}function Nt(x){return!pt(_(x))}function mt(){i&&P()}function to(){return o}return{getAllFlows:to,getFlow:_,getFlowData:eo,isLoading:B||K,getStepStatus:We,getFlowSteps:J,getCurrentStepIndex:H,markStepStarted:be,markStepCompleted:ae,markFlowNotStarted:re,markFlowStarted:Te,markFlowCompleted:W,markFlowAborted:Ee,markStepNotStarted:$e,getFlowStatus:ye,getNumberOfStepsCompleted:Ft,getNumberOfSteps:kt,targetingLogicShouldHideFlow:pt,setCustomVariable:j,updateCustomVariables:me,customVariables:p,getStepOptionalProgress:ie,getFlowMetadata:Ce,isStepBlocked:je,isStepHidden:Ae,hasActiveFullPageFlow:l,setHasActiveFullPageFlow:m,isFlowAvailableToUser:Nt,refresh:mt}}var $t=require("react");var ao="guest_";function po(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:n,shouldGracefullyDegrade:i}=(0,$t.useContext)(X),{config:r,apiUrl:s}=ut(),{mutateUserFlowState:p}=Xe(),d=ro(),{verifySDKInitiated:l}=io();function m(T){return`frigade-user-registered-${T}`}(0,$t.useEffect)(()=>{if(e&&!t){if(e.startsWith(ao))return;let T=m(e);localStorage.getItem(T)||(d(`${s}users`,q(w({},r),{method:"POST",body:JSON.stringify({foreignId:e})})),localStorage.setItem(T,"true"))}},[e,i,t]);let c=(0,$t.useCallback)(T=>z(this,null,function*(){if(!l())return;let C={foreignId:e,properties:T};yield d(`${s}users`,q(w({},r),{method:"POST",body:JSON.stringify(C)})),n(h=>w(w({},h),T)),p()}),[e,r,i,p]),g=(0,$t.useCallback)((T,C)=>z(this,null,function*(){if(!l())return;let O={foreignId:e,events:[{event:T,properties:C}]};yield d(`${s}users`,q(w({},r),{method:"POST",body:JSON.stringify(O)})),p()}),[e,r,p]),y=(0,$t.useCallback)((T,C)=>z(this,null,function*(){if(l())if(C){let h=m(T);localStorage.setItem(h,"true"),o(T);let O={foreignId:T,properties:C};yield d(`${s}users`,q(w({},r),{method:"POST",body:JSON.stringify(O)})),n(F=>w(w({},F),C)),p()}else o(T)}),[r,i,p]);return{userId:e,setUserId:o,setUserIdWithProperties:y,addPropertiesToUser:c,trackEventForUser:g}}var En=require("uuid");var He=u(require("react"));var Oe=u(require("react")),$o=u(require("styled-components"));var Pi=u(require("react")),vi=u(require("styled-components"));var ki="fr-",Io="cfr-";function a(e,t){let o=`${ki}${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+" "+Io+e}return o}function A(e){if(!e.className||e.className.indexOf(Io)!==-1)return"";let o=e.className.replace(/\s+/g," ").split(" ");return o.length==1&&o[0].startsWith(ki)?"":`:not(${o.map(n=>`.${n}`).join(", ")})`}function or(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function _e(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${or(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Me(...e){return e.filter(Boolean).join(" ")}function Lo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var za=vi.default.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -23,11 +23,11 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
23
23
|
opacity: 1;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
`,Bi=({onClose:e,appearance:t})=>Pi.default.createElement(za,{className:a("modalBackground",t),onClick:()=>e()});var
|
|
26
|
+
`,Bi=({onClose:e,appearance:t})=>Pi.default.createElement(za,{className:a("modalBackground",t),onClick:()=>e()});var rr=u(require("react")),Ei=u(require("styled-components")),_a=Ei.default.div`
|
|
27
27
|
:hover {
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
|
-
`,Ge=()=>
|
|
30
|
+
`,Ge=()=>rr.default.createElement(_a,null,rr.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 20 20"},rr.default.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5 15L15 5M5 5l10 10"})));var Hi=require("react-portal");var Mr=u(require("react"));var ir=u(require("react"));function Ha({style:e,className:t}){return ir.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"54",height:"14",fill:"none",viewBox:"0 0 54 14",style:e,className:t},ir.default.createElement("path",{fill:"currentColor",d:"M16.293 3.476v1.036h1.593v1.256h-1.593v5.098h-1.41V5.768H14V4.512h.883V3.244c0-.67.294-1.744 1.777-1.744.515 0 .969.049 1.361.146l-.233 1.232a5.939 5.939 0 00-.833-.073c-.442 0-.662.22-.662.67zm6.534.975V5.83c-.846 0-1.63.159-2.342.476v4.56h-1.41V4.513h1.263l.086.61c.846-.451 1.655-.67 2.403-.67zm2.505-.951c-.331.33-.944.33-1.287 0a.93.93 0 01-.246-.659c0-.268.086-.487.246-.646.343-.33.956-.33 1.287 0 .343.33.343.964 0 1.305zm.061 7.366h-1.41V4.512h1.41v6.354zm6.928-5.756c.246.146.368.402.368.756v4.976c0 1.804-.858 2.658-2.672 2.658-.92 0-1.753-.146-2.514-.439l.417-1.073c.674.22 1.336.33 1.974.33.98 0 1.385-.379 1.385-1.403v-.171c-.588.134-1.09.207-1.52.207-.907 0-1.655-.305-2.231-.902-.576-.598-.87-1.39-.87-2.354 0-.963.294-1.756.87-2.354.576-.61 1.324-.914 2.231-.914 1.005 0 1.864.232 2.562.683zm-2.488 4.634a5.15 5.15 0 001.446-.22V5.951a3.695 3.695 0 00-1.446-.292c-1.08 0-1.778.841-1.778 2.048 0 1.22.699 2.037 1.778 2.037zm7.34-5.317c1.52 0 2.28.878 2.28 2.634v3.805h-1.275l-.073-.524c-.601.414-1.288.621-2.084.621-1.263 0-2.06-.658-2.06-1.731 0-1.269 1.25-2.025 3.408-2.025.135 0 .503.013.662.013v-.171c0-1.012-.343-1.451-1.115-1.451-.675 0-1.435.158-2.256.475l-.466-1.012c1.017-.427 2.01-.634 2.979-.634zm-1.839 4.756c0 .427.343.695 1.017.695.528 0 1.251-.22 1.68-.512V8.22h-.441c-1.508 0-2.256.317-2.256.963zm9.953-4.549v-2.83h1.41v7.72c0 .354-.123.598-.368.757-.71.45-1.57.67-2.562.67-.907 0-1.655-.305-2.231-.902-.577-.61-.87-1.39-.87-2.354 0-.963.293-1.756.87-2.354.576-.61 1.324-.914 2.23-.914.43 0 .933.073 1.521.207zM43.84 9.72c.503 0 .981-.098 1.447-.293V5.854a5.15 5.15 0 00-1.447-.22c-1.078 0-1.777.817-1.777 2.037s.699 2.049 1.777 2.049zM54 7.866v.439h-4.573c.184.963.858 1.512 1.827 1.512.613 0 1.275-.146 1.986-.451l.466 1.024c-.87.378-1.729.573-2.575.573-.931 0-1.692-.304-2.268-.902-.576-.61-.87-1.402-.87-2.366 0-.975.294-1.768.87-2.366.576-.597 1.324-.902 2.244-.902.968 0 1.691.33 2.17.975.478.647.723 1.464.723 2.464zm-4.61-.586h3.298c-.086-1.073-.613-1.731-1.581-1.731-.969 0-1.582.695-1.717 1.731z"}),ir.default.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M1.196 1.229A4.009 4.009 0 014.08 0l4.092.027C9.183.027 10 .867 10 1.904c0 .6-.273 1.133-.7 1.478-.31.25-.7.399-1.126.4h-.001l-4.09-.027h-.002a4.804 4.804 0 00-2.614.77A4.986 4.986 0 000 5.974v-1.78C0 3.036.456 1.988 1.196 1.23zm4.525 4.65a4.282 4.282 0 00-1.184 2.513l3.637.023c.131 0 .259-.015.382-.042h.002c.81-.178 1.42-.908 1.44-1.788v-.046a1.9 1.9 0 00-.533-1.328 1.813 1.813 0 00-.908-.508h-.002l-.002-.001a1.68 1.68 0 00-.366-.042A4.084 4.084 0 005.72 5.88zm-4.525-.016A4.235 4.235 0 000 8.829C0 10.997 1.601 12.78 3.654 13V9.265h-.005l.005-.439v-.437h.023a5.175 5.175 0 011.439-3.13 5.05 5.05 0 01.72-.614l-1.754-.011H4.08c-.787 0-1.521.229-2.144.625a4.11 4.11 0 00-.74.603z",clipRule:"evenodd"}))}var Ai=Ha;var sr=u(require("styled-components"));var ft=u(require("styled-components"));var nr=ft.default.div`
|
|
31
31
|
${e=>A(e)} {
|
|
32
32
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
33
33
|
}
|
|
@@ -57,11 +57,11 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
57
57
|
position: absolute;
|
|
58
58
|
top: 12px;
|
|
59
59
|
right: 12px;
|
|
60
|
-
`,Oi=
|
|
60
|
+
`,Oi=ft.default.div`
|
|
61
61
|
${e=>A(e)} {
|
|
62
62
|
${e=>e.hasImage?Va:ja};
|
|
63
63
|
}
|
|
64
|
-
`,Ni=
|
|
64
|
+
`,Ni=ft.default.img`
|
|
65
65
|
${e=>A(e)} {
|
|
66
66
|
display: block;
|
|
67
67
|
width: 100%;
|
|
@@ -69,7 +69,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
69
69
|
min-height: 200px;
|
|
70
70
|
object-fit: cover;
|
|
71
71
|
}
|
|
72
|
-
`,Ii=
|
|
72
|
+
`,Ii=ft.default.div`
|
|
73
73
|
${e=>A(e)} {
|
|
74
74
|
display: block;
|
|
75
75
|
width: 100%;
|
|
@@ -77,19 +77,19 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
77
77
|
margin-top: ${e=>e.dismissible?"24px":"0px"};
|
|
78
78
|
object-fit: cover;
|
|
79
79
|
}
|
|
80
|
-
`,Li=
|
|
80
|
+
`,Li=ft.default.div`
|
|
81
81
|
display: flex;
|
|
82
82
|
flex-direction: row;
|
|
83
83
|
justify-content: space-between;
|
|
84
84
|
align-content: center;
|
|
85
|
-
`,$i=
|
|
85
|
+
`,$i=ft.default.div`
|
|
86
86
|
padding: 22px 22px 12px;
|
|
87
|
-
`,Mi=
|
|
87
|
+
`,Mi=ft.default.div`
|
|
88
88
|
display: flex;
|
|
89
89
|
flex: 1;
|
|
90
90
|
flex-direction: column;
|
|
91
91
|
justify-content: center;
|
|
92
|
-
`,Di=
|
|
92
|
+
`,Di=ft.default.div`
|
|
93
93
|
display: flex;
|
|
94
94
|
flex: 2;
|
|
95
95
|
flex-shrink: 1;
|
|
@@ -101,7 +101,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
101
101
|
align-content: center;
|
|
102
102
|
align-items: center;
|
|
103
103
|
}
|
|
104
|
-
`,Ui=
|
|
104
|
+
`,Ui=ft.default.p`
|
|
105
105
|
${e=>A(e)} {
|
|
106
106
|
font-style: normal;
|
|
107
107
|
font-weight: 600;
|
|
@@ -110,7 +110,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
110
110
|
color: #808080;
|
|
111
111
|
}
|
|
112
112
|
margin: 0;
|
|
113
|
-
`;var Wi=
|
|
113
|
+
`;var Wi=sr.default.div`
|
|
114
114
|
background-color: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
115
115
|
position: absolute;
|
|
116
116
|
bottom: -47px;
|
|
@@ -121,7 +121,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
121
121
|
align-items: center;
|
|
122
122
|
justify-content: center;
|
|
123
123
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
124
|
-
`,zi=(0,
|
|
124
|
+
`,zi=(0,sr.default)(nr)`
|
|
125
125
|
background-color: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
126
126
|
position: absolute;
|
|
127
127
|
bottom: -60px;
|
|
@@ -134,7 +134,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
134
134
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
135
135
|
padding: 0;
|
|
136
136
|
z-index: ${e=>e.zIndex};
|
|
137
|
-
`,_i=
|
|
137
|
+
`,_i=sr.default.div`
|
|
138
138
|
display: flex;
|
|
139
139
|
justify-content: center;
|
|
140
140
|
align-items: center;
|
|
@@ -143,7 +143,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
143
143
|
font-size: 12px;
|
|
144
144
|
line-height: 18px;
|
|
145
145
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
146
|
-
`;function
|
|
146
|
+
`;function lr({appearance:e}){return Mr.default.createElement(_i,{className:a("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",Mr.default.createElement(Ai,null))}var Ga=$o.default.div`
|
|
147
147
|
${e=>A(e)} {
|
|
148
148
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
149
149
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -185,10 +185,10 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
185
185
|
opacity: 1;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
`,Ka
|
|
188
|
+
`,Ka=$o.default.div`
|
|
189
189
|
position: relative;
|
|
190
190
|
flex: 0 1 auto;
|
|
191
|
-
`,qa
|
|
191
|
+
`,qa=$o.default.div`
|
|
192
192
|
position: absolute;
|
|
193
193
|
top: 16px;
|
|
194
194
|
right: 16px;
|
|
@@ -198,14 +198,14 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
198
198
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
199
199
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
200
200
|
}
|
|
201
|
-
`,Ya
|
|
201
|
+
`,Ya=$o.default.div`
|
|
202
202
|
overflow: scroll;
|
|
203
203
|
flex: 1 1;
|
|
204
204
|
display: flex;
|
|
205
205
|
::-webkit-scrollbar {
|
|
206
206
|
display: none;
|
|
207
207
|
}
|
|
208
|
-
`,
|
|
208
|
+
`,gt=({onClose:e,visible:t,headerContent:o=null,style:n=null,children:i,appearance:r,dismissible:s=!0,showFrigadeBranding:p=!1})=>{let[d,l]=(0,Oe.useState)("");return(0,Oe.useEffect)(()=>{let m=getComputedStyle(document.body).getPropertyValue("overflow");l(m)},[]),(0,Oe.useEffect)(()=>{let m=c=>{c.key==="Escape"&&e()};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[e]),(0,Oe.useEffect)(()=>{let m=document.body.style;return t?m.setProperty("overflow","hidden"):m.setProperty("overflow",d),()=>{m.setProperty("overflow",d)}},[t]),t?Oe.default.createElement(Hi.Portal,null,Oe.default.createElement(Bi,{appearance:r,onClose:()=>{s&&e()}}),Oe.default.createElement(Ga,{appearance:r,className:a("modalContainer",r),styleOverrides:n},s&&Oe.default.createElement(qa,{className:a("modalClose",r),onClick:()=>e(),appearance:r},Oe.default.createElement(Ge,null)),o&&Oe.default.createElement(Ka,null,o),Oe.default.createElement(Ya,null,i),p&&Oe.default.createElement(Wi,{appearance:r,className:a("poweredByFrigadeRibbon",r)},Oe.default.createElement(lr,{appearance:r})))):Oe.default.createElement(Oe.default.Fragment,null)};var Ke=u(require("react")),Mo=u(require("styled-components")),Vi=require("react-portal");function Ja(e){switch(e){case"top-left":return`
|
|
209
209
|
top: 0;
|
|
210
210
|
left: 0;
|
|
211
211
|
`;case"top-right":return`
|
|
@@ -214,7 +214,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
214
214
|
`;case"bottom-left":return`
|
|
215
215
|
bottom: 0;
|
|
216
216
|
left: 0;
|
|
217
|
-
`}return"right: 0; bottom: 0;"}var Xa=
|
|
217
|
+
`}return"right: 0; bottom: 0;"}var Xa=Mo.default.div`
|
|
218
218
|
${e=>A(e)} {
|
|
219
219
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
220
220
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
@@ -230,10 +230,10 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
230
230
|
}
|
|
231
231
|
${e=>Ja(e.modalPosition)}
|
|
232
232
|
margin: 28px;
|
|
233
|
-
`,Qa=
|
|
233
|
+
`,Qa=Mo.default.div`
|
|
234
234
|
position: relative;
|
|
235
235
|
flex: 1;
|
|
236
|
-
`,Za=
|
|
236
|
+
`,Za=Mo.default.div`
|
|
237
237
|
position: absolute;
|
|
238
238
|
top: 16px;
|
|
239
239
|
right: 16px;
|
|
@@ -243,13 +243,13 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
243
243
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
244
244
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
245
245
|
}
|
|
246
|
-
`,Ra=
|
|
246
|
+
`,Ra=Mo.default.div`
|
|
247
247
|
overflow: scroll;
|
|
248
248
|
flex: 5;
|
|
249
249
|
::-webkit-scrollbar {
|
|
250
250
|
display: none;
|
|
251
251
|
}
|
|
252
|
-
`,
|
|
252
|
+
`,ar=({onClose:e,visible:t,headerContent:o=null,children:n,appearance:i,modalPosition:r="bottom-right",dismissible:s=!0})=>{let[p,d]=(0,Ke.useState)("");return(0,Ke.useEffect)(()=>{let l=getComputedStyle(document.body).getPropertyValue("overflow");d(l)},[]),(0,Ke.useEffect)(()=>{let l=m=>{m.key==="Escape"&&e()};return document.addEventListener("keydown",l),()=>{document.removeEventListener("keydown",l)}},[e]),(0,Ke.useEffect)(()=>{let l=document.body.style;return t?l.setProperty("overflow","hidden"):l.setProperty("overflow",p),()=>{l.setProperty("overflow",p)}},[t]),t?Ke.default.createElement(Vi.Portal,null,Ke.default.createElement(Xa,{appearance:i,className:a("cornerModalContainer",i),modalPosition:r},s&&Ke.default.createElement(Za,{className:a("cornerModalClose",i),onClick:()=>e()},Ke.default.createElement(Ge,null)),o&&Ke.default.createElement(Qa,null,o),Ke.default.createElement(Ra,null,n))):Ke.default.createElement(Ke.default.Fragment,null)};var ji=require("react");function se(){let{defaultAppearance:e}=(0,ji.useContext)(X);function t(o){var i,r,s;let n=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign((i=n.styleOverrides)!=null?i:{},(r=o.styleOverrides)!=null?r:{}),theme:Object.assign(n.theme,(s=o.theme)!=null?s:{})}:n}return{mergeAppearanceWithDefault:t}}var Ue=u(require("react")),Wo=u(require("styled-components"));var nt=u(require("react")),mr=u(require("styled-components"));var Do=u(require("styled-components"));var Gi=Do.default.label`
|
|
253
253
|
${e=>A(e)} {
|
|
254
254
|
font-size: 12px;
|
|
255
255
|
line-height: 18px;
|
|
@@ -260,14 +260,14 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
260
260
|
letter-spacing: 0.24px;
|
|
261
261
|
}
|
|
262
262
|
display: flex;
|
|
263
|
-
`,Ki=
|
|
263
|
+
`,Ki=Do.default.label`
|
|
264
264
|
${e=>A(e)} {
|
|
265
265
|
font-size: 12px;
|
|
266
266
|
line-height: 20px;
|
|
267
267
|
margin-bottom: 5px;
|
|
268
268
|
}
|
|
269
269
|
display: flex;
|
|
270
|
-
`,qi=
|
|
270
|
+
`,qi=Do.default.span`
|
|
271
271
|
font-weight: 400;
|
|
272
272
|
font-size: 14px;
|
|
273
273
|
line-height: 22px;
|
|
@@ -275,16 +275,16 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
275
275
|
display: flex;
|
|
276
276
|
margin-right: 5px;
|
|
277
277
|
margin-top: 10px;
|
|
278
|
-
`,
|
|
278
|
+
`,pr=Do.default.div`
|
|
279
279
|
display: flex;
|
|
280
280
|
align-items: flex-start;
|
|
281
281
|
justify-content: left;
|
|
282
282
|
margin-bottom: 10px;
|
|
283
|
-
`;var
|
|
283
|
+
`;var dr=u(require("react"));var ht={theme:{colorPrimary:"#0171F8",colorSecondary:"#2E343D",colorText:"#0F1114",colorBackground:"#ffffff",colorBackgroundSecondary:"#d2d2d2",colorTextOnPrimaryBackground:"#ffffff",colorTextSecondary:"#2E343D",colorTextDisabled:"#5A6472",colorBorder:"#E5E5E5",colorTextError:"#c00000",colorTextSuccess:"#00D149",borderRadius:10}};function vt({title:e,required:t,appearance:o=ht}){return e?dr.default.createElement(pr,{className:a("formLabelWrapper",o)},t?dr.default.createElement(qi,{className:a("formLabelRequired",o),appearance:o},"*"):null,dr.default.createElement(Gi,{className:a("formLabel",o)},e)):null}var Dr=u(require("react"));function co({title:e,appearance:t}){return e?Dr.default.createElement(pr,null,Dr.default.createElement(Ki,{className:a("formSubLabel",t)},e)):null}var cr=require("zod");function Yi(e,t){var o,n,i,r,s,p,d;try{if(t){if(t.type=="number"){let l=cr.z.number();if(t.props)for(let m of t.props)m.requirement=="min"?l=l.min(Number(m.value),(o=m.message)!=null?o:"Value is too small"):m.requirement=="max"?l=l.max(Number(m.value),(n=m.message)!=null?n:"Value is too large"):m.requirement=="positive"?l=l.positive((i=m.message)!=null?i:"Value must be positive"):m.requirement=="negative"&&(l=l.nonpositive((r=m.message)!=null?r:"Value must be negative"));l.parse(Number(e))}if(t.type=="string"){let l=cr.z.string();if(t.props)for(let m of t.props)m.requirement=="min"?l=l.min(Number(m.value),(s=m.message)!=null?s:"Value is too short"):m.requirement=="max"?l=l.max(Number(m.value),(p=m.message)!=null?p:"Value is too long"):m.requirement=="regex"&&(l=l.regex(new RegExp(String(m.value)),(d=m.message)!=null?d:"Value does not match requirements"));l.parse(e)}return}}catch(l){if(l instanceof cr.z.ZodError)return l.issues&&l.issues.length>0?l.issues[0].message:null;console.error("Frigade Form validation failed for rule ",t,l)}return null}var ep=mr.default.div`
|
|
284
284
|
display: flex;
|
|
285
285
|
flex-direction: column;
|
|
286
286
|
width: 100%;
|
|
287
|
-
|
|
287
|
+
`,Ur=mr.default.input`
|
|
288
288
|
${e=>A(e)} {
|
|
289
289
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
290
290
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -300,7 +300,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
300
300
|
box-sizing: border-box;
|
|
301
301
|
padding: 0 10px;
|
|
302
302
|
margin-bottom: 10px;
|
|
303
|
-
`,tp=
|
|
303
|
+
`,tp=mr.default.textarea`
|
|
304
304
|
${e=>A(e)} {
|
|
305
305
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
306
306
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -317,13 +317,13 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
317
317
|
box-sizing: border-box;
|
|
318
318
|
margin-bottom: 10px;
|
|
319
319
|
resize: none;
|
|
320
|
-
`;function
|
|
320
|
+
`;function ur({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:n,inputData:i}){let r=e,[s,p]=(0,nt.useState)((i==null?void 0:i.text)||""),[d,l]=(0,nt.useState)(!1),[m,c]=(0,nt.useState)(!1),g=Ur;(0,nt.useEffect)(()=>{s===""&&!d&&(l(!0),y(""))},[]),(0,nt.useEffect)(()=>{if(m){y(s);return}},[m]);function y(C){var O;if(p(C),o({text:C}),r.required===!0&&C.trim()===""){n([{id:r.id,message:`${(O=r.title)!=null?O:"Field"} is required`,hidden:!m}]);return}let h=Yi(C,r.validation);if(h&&(C.trim()!==""||r.required===!0)){n([{id:r.id,message:h,hidden:!m}]);return}n([])}r.multiline&&(g=tp);function T(){var C;switch((C=r==null?void 0:r.validation)==null?void 0:C.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return nt.default.createElement(ep,null,nt.default.createElement(vt,{title:r.title,required:r.required,appearance:t.appearance}),nt.default.createElement(g,{className:a("inputComponent",t.appearance),value:s,onChange:C=>{y(C.target.value)},appearance:t.appearance,placeholder:r.placeholder,type:T(),onBlur:()=>{c(!0)}}),nt.default.createElement(co,{title:r.subtitle,appearance:t.appearance}))}var De=u(require("react")),zr=u(require("styled-components"));var Wr="",op=zr.default.div`
|
|
321
321
|
display: flex;
|
|
322
322
|
flex-direction: column;
|
|
323
323
|
width: 100%;
|
|
324
324
|
-webkit-appearance: none;
|
|
325
325
|
appearance: none;
|
|
326
|
-
`,rp=
|
|
326
|
+
`,rp=zr.default.select`
|
|
327
327
|
${e=>A(e)} {
|
|
328
328
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
329
329
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -344,15 +344,15 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
344
344
|
background-repeat: no-repeat;
|
|
345
345
|
background-size: 1.5em 1.5em;
|
|
346
346
|
-webkit-print-color-adjust: exact;
|
|
347
|
-
`;function Ji({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n,setFormValidationErrors:i}){var m,c,g,y,T,C,h,O,F;let r=e,[s,p]=(0,De.useState)(!1),[d,l]=(0,De.useState)(!1);return(0,De.useEffect)(()=>{var P,v,B,f;if(!((P=n==null?void 0:n.choice)!=null&&P[0])&&!s){if(p(!0),r.requireSelection){o({choice:[
|
|
347
|
+
`;function Ji({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n,setFormValidationErrors:i}){var m,c,g,y,T,C,h,O,F;let r=e,[s,p]=(0,De.useState)(!1),[d,l]=(0,De.useState)(!1);return(0,De.useEffect)(()=>{var P,v,B,f;if(!((P=n==null?void 0:n.choice)!=null&&P[0])&&!s){if(p(!0),r.requireSelection){o({choice:[Wr]});return}if(r.defaultValue&&((v=r.props.options)!=null&&v.find($=>$.id===r.defaultValue))){let $=(B=r.props.options)==null?void 0:B.find(b=>b.id===r.defaultValue);o({choice:[$.id]})}else o({choice:[((f=r.props.options)==null?void 0:f[0].id)||""]})}},[]),(0,De.useEffect)(()=>{var P;d&&(r.requireSelection&&((P=n==null?void 0:n.choice)==null?void 0:P[0])===Wr?i([{message:"Please select an option",id:r.id}]):i([]))},[(m=n==null?void 0:n.choice)==null?void 0:m[0],d]),De.default.createElement(op,null,De.default.createElement(vt,{title:r.title,required:!1,appearance:t.appearance}),De.default.createElement(rp,{value:(c=n==null?void 0:n.choice)==null?void 0:c[0],onChange:P=>{l(!0),o({choice:[P.target.value]})},placeholder:r.placeholder,appearance:t.appearance,className:a("multipleChoiceSelect",t.appearance)},r.requireSelection&&De.default.createElement("option",{key:"null-value",value:Wr,disabled:!0},(g=r.placeholder)!=null?g:"Select an option"),(y=r.props.options)==null?void 0:y.map(P=>De.default.createElement("option",{key:P.id,value:P.id},P.title))),((C=(T=r.props.options)==null?void 0:T.find(P=>{var v;return P.id===((v=n==null?void 0:n.choice)==null?void 0:v[0])}))==null?void 0:C.isOpenEnded)&&De.default.createElement(De.default.Fragment,null,De.default.createElement(vt,{title:(F=(O=(h=r.props.options)==null?void 0:h.find(P=>{var v;return P.id===((v=n==null?void 0:n.choice)==null?void 0:v[0])}))==null?void 0:O.openEndedLabel)!=null?F:"Please specify",required:!1,appearance:t.appearance}),De.default.createElement(Ur,{type:"text",placeholder:"Enter your answer here",onChange:P=>{o({choice:[P.target.value]})},appearance:t.appearance})),De.default.createElement(co,{title:r.subtitle,appearance:t.appearance}))}var tt=u(require("react")),_r=u(require("styled-components"));var uo=u(require("react"));var mo=u(require("react")),Xi=({color:e,percentage:t,size:o})=>{let n=o*.5-2,i=2*Math.PI*n,r=(1-t)*i;return mo.default.createElement("circle",{r:n,cx:o*.5,cy:o*.5,fill:"transparent",stroke:r!==i?e:"",strokeWidth:"3px",strokeDasharray:i,strokeDashoffset:t?r:0})},ip=({fillColor:e,size:t,percentage:o,children:n,bgColor:i="#D9D9D9",className:r,style:s})=>mo.default.createElement("svg",{style:s,className:r,width:t,height:t,overflow:"visible"},mo.default.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},mo.default.createElement(Xi,{color:i,size:t}),mo.default.createElement(Xi,{color:e,percentage:Math.max(o,.1),size:t})),n),Kt=ip;var Qi=u(require("styled-components"));var np=({color:e="#FFFFFF"})=>uo.default.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},uo.default.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),sp={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},lp={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},ap={border:"1px solid #000000",color:"#FFFFFF"},pp={border:"1px solid #C5CBD3"},dp={color:"#FFFFFF"},cp={border:"1px solid #C5CBD3"},mp=e=>e==="square"?sp:lp,up=(e,t)=>e==="square"?t?ap:pp:t?dp:cp,fp=Qi.default.div`
|
|
348
348
|
${e=>_e(e)}
|
|
349
|
-
`,
|
|
349
|
+
`,xt=({value:e,type:t="round",primaryColor:o="#000000",progress:n,appearance:i=ht,style:r,className:s})=>{let p=mp(t),d=up(t,e);return e===!0?p=q(w(w({},p),d),{backgroundColor:i.theme.colorTextSuccess,borderColor:t==="square"?o:"none"}):p=w(w({},p),d),e!==!0&&t==="round"&&n!==void 0&&n!==1?uo.default.createElement(Kt,{fillColor:o,percentage:n,size:22}):uo.default.createElement(fp,{styleOverrides:p,style:r,role:"checkbox",className:Me(a("checkIconContainer",i),a(e?"checkIconContainerChecked":"checkIconContainerUnchecked",i),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&uo.default.createElement(np,{color:"#FFFFFF"}))};var gp=_r.default.div`
|
|
350
350
|
display: flex;
|
|
351
351
|
flex-direction: column;
|
|
352
352
|
width: 100%;
|
|
353
353
|
-webkit-appearance: none;
|
|
354
354
|
appearance: none;
|
|
355
|
-
`,hp=
|
|
355
|
+
`,hp=_r.default.button`
|
|
356
356
|
${e=>A(e)} {
|
|
357
357
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
358
358
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -377,7 +377,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
377
377
|
height: 48px;
|
|
378
378
|
padding: 0 18px;
|
|
379
379
|
margin-bottom: 10px;
|
|
380
|
-
`;function Zi({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n,setFormValidationErrors:i}){var m;let r=e,[s,p]=(0,tt.useState)((n==null?void 0:n.choice)||[]),[d,l]=(0,tt.useState)(!1);return(0,tt.useEffect)(()=>{s.length==0&&!d&&(l(!0),o({choice:[]}))},[]),(0,tt.useEffect)(()=>{o({choice:s})},[s]),(0,tt.useEffect)(()=>{r.required&&(s.length<r.props.minChoices||s.length>r.props.maxChoices)?i([{message:"",id:r.id}]):i([])},[s]),tt.default.createElement(gp,null,tt.default.createElement(
|
|
380
|
+
`;function Zi({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:n,setFormValidationErrors:i}){var m;let r=e,[s,p]=(0,tt.useState)((n==null?void 0:n.choice)||[]),[d,l]=(0,tt.useState)(!1);return(0,tt.useEffect)(()=>{s.length==0&&!d&&(l(!0),o({choice:[]}))},[]),(0,tt.useEffect)(()=>{o({choice:s})},[s]),(0,tt.useEffect)(()=>{r.required&&(s.length<r.props.minChoices||s.length>r.props.maxChoices)?i([{message:"",id:r.id}]):i([])},[s]),tt.default.createElement(gp,null,tt.default.createElement(vt,{title:r.title,required:r.required,appearance:t.appearance}),(m=r.props.options)==null?void 0:m.map(c=>tt.default.createElement(hp,{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(g=>g!==c.id));return}s.length<r.props.maxChoices?p([...s,c.id]):s.length==1&&r.props.maxChoices==1&&p([c.id])}},c.title,tt.default.createElement(xt,{type:"round",primaryColor:t.appearance.theme.colorPrimary,value:s.includes(c.id),appearance:t.appearance}))),tt.default.createElement(co,{title:r.subtitle,appearance:t.appearance}))}var Uo=u(require("react"));var Hr=u(require("styled-components"));var Ri=u(require("dompurify"));function ue(e){return{__html:Ri.default.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img","code","li","ul","table","tbody","thead","tr","td","th","h1","h2","h3","h4"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var xp=Hr.default.h1`
|
|
381
381
|
${e=>A(e)} {
|
|
382
382
|
font-style: normal;
|
|
383
383
|
font-weight: 700;
|
|
@@ -389,7 +389,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
389
389
|
margin-bottom: 4px;
|
|
390
390
|
color: ${e=>e.appearance.theme.colorText};
|
|
391
391
|
}
|
|
392
|
-
`,Cp=
|
|
392
|
+
`,Cp=Hr.default.h2`
|
|
393
393
|
${e=>A(e)} {
|
|
394
394
|
font-style: normal;
|
|
395
395
|
font-weight: 400;
|
|
@@ -398,38 +398,38 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
398
398
|
letter-spacing: 0.28px;
|
|
399
399
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
400
400
|
}
|
|
401
|
-
`;function qe({appearance:e,title:t,subtitle:o,size:n="medium",classPrefix:i=""}){return
|
|
401
|
+
`;function qe({appearance:e,title:t,subtitle:o,size:n="medium",classPrefix:i=""}){return Uo.default.createElement(Uo.default.Fragment,null,Uo.default.createElement(xp,{appearance:e,className:a(`${i}${i?Lo(n):n}Title`,e),dangerouslySetInnerHTML:ue(t),size:n}),o&&Uo.default.createElement(Cp,{appearance:e,className:a(`${i}${i?Lo(n):n}Subtitle`,e),dangerouslySetInnerHTML:ue(o),size:n}))}var Vr=u(require("react"));var en=e=>Vr.createElement("svg",w({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,"aria-hidden":"true",viewBox:"0 0 16 16"},e),Vr.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 yp=Wo.default.div`
|
|
402
402
|
display: flex;
|
|
403
403
|
flex-direction: column;
|
|
404
404
|
justify-content: flex-end;
|
|
405
405
|
overflow: visible;
|
|
406
406
|
padding-top: 14px;
|
|
407
|
-
`,Sp=
|
|
407
|
+
`,Sp=Wo.default.div`
|
|
408
408
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextError}};
|
|
409
409
|
font-size: 12px;
|
|
410
410
|
margin-bottom: 12px;
|
|
411
411
|
display: flex;
|
|
412
412
|
align-items: center;
|
|
413
|
-
`,bp=
|
|
413
|
+
`,bp=Wo.default.div`
|
|
414
414
|
margin-right: 4px;
|
|
415
415
|
display: inline-flex;
|
|
416
|
-
`,wp=
|
|
416
|
+
`,wp=Wo.default.div`
|
|
417
417
|
padding-left: 1px;
|
|
418
418
|
padding-right: 1px;
|
|
419
|
-
`,Tp={text:
|
|
419
|
+
`,Tp={text:ur,multipleChoice:Ji,multipleChoiceList:Zi},jr="frigade-multiInputStepTypeData";function tn({flowId:e,stepData:t,canContinue:o,setCanContinue:n,onSaveData:i,appearance:r,customFormElements:s,prefillData:p}){var B;let d=t.props,[l,m]=(0,Ue.useState)([]),[c,g]=(0,Ue.useState)([]),{userId:y}=po(),[T,C]=(0,Ue.useState)(P()||(p?p[t.id]:null)||{}),{readonly:h}=(0,Ue.useContext)(X),O=w(w({},Tp),s);(0,Ue.useEffect)(()=>{n(l.length===0)},[l,n]),(0,Ue.useEffect)(()=>{i(T)},[T]);function F(f,$){C(b=>{let k=q(w({},b),{[f.id]:$});return typeof window!="undefined"&&window.localStorage&&!h&&window.localStorage.setItem(v(),JSON.stringify(k)),k})}function P(){if(typeof window!="undefined"&&window.localStorage){let f=window.localStorage.getItem(v());if(f)return JSON.parse(f)}return null}function v(){return`${jr}-${e}-${t.id}-${y}`}return Ue.default.createElement(wp,{className:a("multiInput",r)},Ue.default.createElement(qe,{appearance:r,title:t.title,subtitle:t.subtitle}),Ue.default.createElement(yp,{className:a("multiInputContainer",r)},(B=d==null?void 0:d.data)==null?void 0:B.map(f=>{let $=l.reverse().find(b=>b.id===f.id);return O[f.type]?Ue.default.createElement("span",{key:f.id,"data-field-id":f.id,className:a("multiInputField",r)},O[f.type]({formInput:f,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:n,onSaveData:i,appearance:r},onSaveInputData:b=>{!c.includes(f.id)&&b&&(b==null?void 0:b.text)!==""&&g(k=>[...k,f.id]),F(f,b)},inputData:T[f.id],setFormValidationErrors:b=>{b.length===0&&l.length===0||m(k=>b.length===0?k.filter(D=>D.id!==f.id):[...k,...b])}}),$&&$.message&&c.includes(f.id)&&$.hidden!==!0&&Ue.default.createElement(Sp,{key:f.id,style:{overflow:"hidden"},appearance:r,className:a("multiInputValidationError",r)},Ue.default.createElement(bp,{appearance:r,className:a("multiInputValidationErrorIcon",r)},Ue.default.createElement(en,null)),$.message)):null})))}var qt=u(require("styled-components")),on=qt.default.div`
|
|
420
420
|
align-items: center;
|
|
421
421
|
display: flex;
|
|
422
422
|
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
423
423
|
padding-top: 14px;
|
|
424
|
-
`,rn=
|
|
424
|
+
`,rn=qt.default.div`
|
|
425
425
|
color: ${e=>e.appearance.theme.colorTextError};
|
|
426
426
|
font-size: 12px;
|
|
427
|
-
`,nn=
|
|
427
|
+
`,nn=qt.default.div`
|
|
428
428
|
display: flex;
|
|
429
429
|
gap: 12px;
|
|
430
430
|
width: 100%;
|
|
431
431
|
justify-content: flex-end;
|
|
432
|
-
`,sn=
|
|
432
|
+
`,sn=qt.default.div`
|
|
433
433
|
display: flex;
|
|
434
434
|
// If type is set to large-modal, use padding 60px horizontal, 80px vertical
|
|
435
435
|
// Otherwise, use 4px padding
|
|
@@ -437,11 +437,11 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
437
437
|
flex-grow: 1;
|
|
438
438
|
flex-basis: 0;
|
|
439
439
|
position: relative;
|
|
440
|
-
`,ln=
|
|
440
|
+
`,ln=qt.default.div`
|
|
441
441
|
padding: ${e=>e.type==="large-modal"?"50px":"0px"};
|
|
442
442
|
position: relative;
|
|
443
443
|
overflow-y: auto;
|
|
444
|
-
`,an=
|
|
444
|
+
`,an=qt.default.div`
|
|
445
445
|
display: flex;
|
|
446
446
|
align-self: stretch;
|
|
447
447
|
flex-grow: 1;
|
|
@@ -453,7 +453,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
453
453
|
background-position: center;
|
|
454
454
|
border-top-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
455
455
|
border-bottom-right-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
456
|
-
`;var
|
|
456
|
+
`;var Bt=u(require("react"));var Gr=u(require("react")),Kr=u(require("styled-components"));var pn=u(require("styled-components")),dn=pn.default.div`
|
|
457
457
|
width: 24px;
|
|
458
458
|
height: 24px;
|
|
459
459
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
@@ -471,7 +471,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
471
471
|
transform: rotate(360deg);
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
|
-
`;var Fp=
|
|
474
|
+
`;var Fp=Kr.default.button`
|
|
475
475
|
justify-content: center;
|
|
476
476
|
align-content: center;
|
|
477
477
|
align-items: center;
|
|
@@ -504,7 +504,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
504
504
|
opacity: ${e=>e.loading=="true"?"1.0":"0.3"};
|
|
505
505
|
cursor: not-allowed;
|
|
506
506
|
}
|
|
507
|
-
`,
|
|
507
|
+
`,fr=Kr.default.div`
|
|
508
508
|
${e=>A(e)} {
|
|
509
509
|
display: flex;
|
|
510
510
|
flex-direction: row;
|
|
@@ -515,14 +515,14 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
515
515
|
margin-right: 8px;
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
`,
|
|
518
|
+
`,le=({onClick:e,title:t,style:o,disabled:n,type:i="inline",size:r="medium",secondary:s=!1,appearance:p,withMargin:d=!0,classPrefix:l="",loading:m=!1})=>{var g;function c(){let y=s?"buttonSecondary":"button";return l===""?y:`${l}${Lo(y)}`}return Gr.default.createElement(Fp,{secondary:s,appearance:p,disabled:n||m,loading:(g=m==null?void 0:m.toString())!=null?g:"",onClick:e,styleOverrides:o,type:i,withMargin:d,size:r,className:a(c(),p)},m?Gr.default.createElement(dn,{className:a("buttonLoader",p)}):t!=null?t:"Continue")};var cn=({step:e,canContinue:t,appearance:o,onPrimaryClick:n,onSecondaryClick:i,selectedStep:r,steps:s,onBack:p,allowBackNavigation:d,errorMessage:l,isSaving:m})=>{var y;let c=s.length>1&&r!=0&&d,g=e.primaryButtonTitle&&e.secondaryButtonTitle||c?"inline":"full-width";return Bt.default.createElement(Bt.default.Fragment,null,l!==null&&l!=null&&Bt.default.createElement(rn,{appearance:o,className:a("formCTAError",o)},l),Bt.default.createElement(on,{showBackButton:c,className:a("formCTAContainer",o)},c&&Bt.default.createElement(le,{title:(y=e.backButtonTitle)!=null?y:"Back",onClick:p,secondary:!0,withMargin:!1,type:g,appearance:o,style:{width:"90px",maxWidth:"90px"},classPrefix:"back"}),Bt.default.createElement(nn,{className:a("ctaWrapper",o)},e.secondaryButtonTitle?Bt.default.createElement(le,{title:e.secondaryButtonTitle,onClick:i,secondary:!0,withMargin:!1,type:g,appearance:o,disabled:m}):null," ",e.primaryButtonTitle?Bt.default.createElement(le,{disabled:!t,withMargin:!1,title:e.primaryButtonTitle,onClick:n,type:g,appearance:o,loading:m}):null)))};var gr=u(require("react")),mn=u(require("styled-components"));var kp=mn.default.div`
|
|
519
519
|
text-align: center;
|
|
520
|
-
`,un=({stepCount:e=0,currentStep:t=0,className:o,appearance:n})=>{let{theme:i}=
|
|
520
|
+
`,un=({stepCount:e=0,currentStep:t=0,className:o,appearance:n})=>{let{theme:i}=se().mergeAppearanceWithDefault(n);return gr.default.createElement(kp,{className:o},gr.default.createElement("svg",{width:16*e-8,height:8,viewBox:`0 0 ${16*e-8} 8`,fill:"none"},Array(e).fill(null).map((r,s)=>gr.default.createElement("rect",{key:s,x:16*s,y:0,width:8,height:8,rx:4,fill:t===s?i.colorPrimary:"#E6E6E6"}))))};var Mt=u(require("react")),Yt=u(require("styled-components"));var fn=require("react");function ge(){let e=(0,fn.useContext)(X);function t(i){n(i.primaryButtonUri,i.primaryButtonUriTarget)}function o(i){n(i.secondaryButtonUri,i.secondaryButtonUriTarget)}function n(i,r){if(!i)return;let s=i.startsWith("http")?"_blank":"_self";r&&r!=="_blank"&&(s="_self"),e.navigate(i,s)}return{primaryCTAClickSideEffects:t,secondaryCTAClickSideEffects:o,handleUrl:n}}var Pp=Yt.default.div`
|
|
521
521
|
display: flex;
|
|
522
522
|
flex-wrap: wrap;
|
|
523
523
|
align-content: center;
|
|
524
524
|
justify-content: center;
|
|
525
|
-
`,vp=
|
|
525
|
+
`,vp=Yt.default.div`
|
|
526
526
|
align-content: center;
|
|
527
527
|
align-items: center;
|
|
528
528
|
display: flex;
|
|
@@ -536,10 +536,10 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
536
536
|
flex-basis: 255px;
|
|
537
537
|
flex-grow: 0;
|
|
538
538
|
flex-shrink: 0;
|
|
539
|
-
`,Bp=
|
|
539
|
+
`,Bp=Yt.default.img`
|
|
540
540
|
width: 78px;
|
|
541
541
|
height: auto;
|
|
542
|
-
`,Ep=
|
|
542
|
+
`,Ep=Yt.default.button`
|
|
543
543
|
font-style: normal;
|
|
544
544
|
font-weight: 600;
|
|
545
545
|
font-size: 13px;
|
|
@@ -552,11 +552,11 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
552
552
|
border-radius: 100px;
|
|
553
553
|
padding: 8px 12px;
|
|
554
554
|
margin-top: 16px;
|
|
555
|
-
`,Ap=
|
|
555
|
+
`,Ap=Yt.default.h1`
|
|
556
556
|
font-weight: 700;
|
|
557
557
|
font-size: 28px;
|
|
558
558
|
line-height: 34px;
|
|
559
|
-
`,Op=
|
|
559
|
+
`,Op=Yt.default.h2`
|
|
560
560
|
font-style: normal;
|
|
561
561
|
font-weight: 400;
|
|
562
562
|
font-size: 16px;
|
|
@@ -565,7 +565,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
565
565
|
margin-top: 12px;
|
|
566
566
|
margin-bottom: 16px;
|
|
567
567
|
max-width: 70%;
|
|
568
|
-
`;function gn({stepData:e,appearance:t}){var n,i;let{handleUrl:o}=
|
|
568
|
+
`;function gn({stepData:e,appearance:t}){var n,i;let{handleUrl:o}=ge();return Mt.default.createElement("div",null,Mt.default.createElement(Ap,null,e.title),Mt.default.createElement(Op,null,e.subtitle),Mt.default.createElement(Pp,null,(i=(n=e.props)==null?void 0:n.links)==null?void 0:i.map(r=>Mt.default.createElement(vp,{key:r.title},Mt.default.createElement(Bp,{src:r.imageUri}),Mt.default.createElement(Ep,{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)))))}var Et=u(require("react")),zo=u(require("styled-components"));var hr=u(require("react")),xr=({style:e,className:t})=>hr.default.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},hr.default.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}),hr.default.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"}));var st=u(require("react")),Jt=u(require("styled-components"));var Np=Jt.default.div`
|
|
569
569
|
display: flex;
|
|
570
570
|
align-items: center;
|
|
571
571
|
justify-content: flex-start;
|
|
@@ -573,7 +573,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
573
573
|
width: 100%;
|
|
574
574
|
height: 100%;
|
|
575
575
|
position: relative;
|
|
576
|
-
`,Ip=
|
|
576
|
+
`,Ip=Jt.default.div`
|
|
577
577
|
position: absolute;
|
|
578
578
|
display: flex;
|
|
579
579
|
align-items: center;
|
|
@@ -592,66 +592,66 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
592
592
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
593
593
|
border-radius: 50%;
|
|
594
594
|
}
|
|
595
|
-
`,Lp=
|
|
595
|
+
`,Lp=Jt.default.video`
|
|
596
596
|
width: 100%;
|
|
597
597
|
height: 100%;
|
|
598
598
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
599
|
-
`,$p=
|
|
599
|
+
`,$p=Jt.default.iframe`
|
|
600
600
|
width: 100%;
|
|
601
601
|
height: 100%;
|
|
602
602
|
min-height: 260px;
|
|
603
603
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
604
|
-
`,Mp=
|
|
604
|
+
`,Mp=Jt.default.iframe`
|
|
605
605
|
width: 100%;
|
|
606
606
|
height: 100%;
|
|
607
607
|
min-height: 400px;
|
|
608
608
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
609
|
-
}`,Dp=
|
|
609
|
+
}`,Dp=Jt.default.iframe`
|
|
610
610
|
width: 100%;
|
|
611
611
|
height: 100%;
|
|
612
612
|
min-height: 400px;
|
|
613
613
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
614
|
-
`;function
|
|
614
|
+
`;function Ct({appearance:e,videoUri:t}){let o=(0,st.useRef)(),[n,i]=(0,st.useState)(!1);if(t.includes("youtube")){let r=t.split("v=")[1],s=r.indexOf("&");return s!==-1&&(r=r.substring(0,s)),st.default.createElement($p,{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${r}`,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,appearance:e,className:a("youtubePlayer",e)})}if(t.includes("vimeo")){let r=t.split("vimeo.com/")[1],s=r.indexOf("&");return s!==-1&&(r=r.substring(0,s)),st.default.createElement(Mp,{width:"100%",height:"100%",src:`https://player.vimeo.com/video/${r}`,frameBorder:"0",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,appearance:e,className:a("vimeoPlayer",e)})}if(t.includes("wistia")){let r=t.split("wistia.com/medias/")[1],s=r.indexOf("&");return s!==-1&&(r=r.substring(0,s)),st.default.createElement(Dp,{width:"100%",height:"100%",src:`https://fast.wistia.net/embed/iframe/${r}`,frameBorder:"0",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,appearance:e,className:a("wistiaPlayer",e)})}return st.default.createElement(Np,{className:a("videoPlayerWrapper",e),appearance:e},!n&&st.default.createElement(Ip,{onClick:()=>{i(!0),o.current.play()},appearance:e},st.default.createElement(xr,null)),st.default.createElement(Lp,{appearance:e,controls:n,ref:o,play:n,src:t}))}var Up=zo.default.div`
|
|
615
615
|
${e=>A(e)} {
|
|
616
616
|
display: flex;
|
|
617
617
|
flex-direction: column;
|
|
618
618
|
justify-content: center;
|
|
619
619
|
}
|
|
620
|
-
`,Wp=
|
|
620
|
+
`,Wp=zo.default.img`
|
|
621
621
|
${e=>A(e)} {
|
|
622
622
|
width: 100%;
|
|
623
623
|
height: auto;
|
|
624
624
|
max-height: 250px;
|
|
625
625
|
margin-bottom: 24px;
|
|
626
626
|
}
|
|
627
|
-
`,zp=
|
|
627
|
+
`,zp=zo.default.div`
|
|
628
628
|
${e=>A(e)} {
|
|
629
629
|
margin-bottom: 24px;
|
|
630
630
|
}
|
|
631
|
-
`,_p=
|
|
631
|
+
`,_p=zo.default.div`
|
|
632
632
|
${e=>A(e)} {
|
|
633
633
|
width: 100%;
|
|
634
634
|
height: auto;
|
|
635
635
|
max-height: 250px;
|
|
636
636
|
margin-bottom: 24px;
|
|
637
637
|
}
|
|
638
|
-
`;function hn({stepData:e,appearance:t,setCanContinue:o}){return(0,
|
|
638
|
+
`;function hn({stepData:e,appearance:t,setCanContinue:o}){return(0,Et.useEffect)(()=>{o(!0)},[]),Et.default.createElement(Up,{className:a("callToActionContainer",t)},Et.default.createElement(zp,{className:a("callToActionTextContainer",t)},Et.default.createElement(qe,{appearance:t,title:e.title,subtitle:e.subtitle})),e.imageUri&&Et.default.createElement(Wp,{className:a("callToActionImage",t),src:e.imageUri}),!e.imageUri&&e.videoUri&&Et.default.createElement(_p,{appearance:t,className:a("callToActionVideo",t)},Et.default.createElement(Ct,{appearance:t,videoUri:e.videoUri})))}var Ne=u(require("react"));var At=u(require("styled-components")),xn=At.default.div`
|
|
639
639
|
width: auto;
|
|
640
640
|
display: flex;
|
|
641
641
|
flex-direction: column;
|
|
642
642
|
justify-content: center;
|
|
643
643
|
align-items: center;
|
|
644
644
|
padding: 4px;
|
|
645
|
-
`,Cn=
|
|
645
|
+
`,Cn=At.default.div`
|
|
646
646
|
width: 100%;
|
|
647
647
|
text-align: left;
|
|
648
|
-
`,yn=
|
|
648
|
+
`,yn=At.default.h1`
|
|
649
649
|
font-style: normal;
|
|
650
650
|
font-weight: 700;
|
|
651
651
|
font-size: 32px;
|
|
652
652
|
line-height: 38px;
|
|
653
653
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
654
|
-
`,Sn=
|
|
654
|
+
`,Sn=At.default.h1`
|
|
655
655
|
font-style: normal;
|
|
656
656
|
font-weight: 400;
|
|
657
657
|
font-size: 16px;
|
|
@@ -659,7 +659,7 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
659
659
|
margin-top: 16px;
|
|
660
660
|
margin-bottom: 16px;
|
|
661
661
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
662
|
-
`,bn=
|
|
662
|
+
`,bn=At.default.div`
|
|
663
663
|
padding-top: 12px;
|
|
664
664
|
padding-bottom: 12px;
|
|
665
665
|
flex-direction: row;
|
|
@@ -670,17 +670,17 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
670
670
|
cursor: pointer;
|
|
671
671
|
border-bottom: ${e=>e.hideBottomBorder?"none":"1px solid #D8D8D8"};
|
|
672
672
|
width: 100%;
|
|
673
|
-
`,wn=
|
|
673
|
+
`,wn=At.default.div`
|
|
674
674
|
padding-top: 10px;
|
|
675
675
|
padding-bottom: 10px;
|
|
676
676
|
flex-direction: row;
|
|
677
677
|
display: flex;
|
|
678
678
|
justify-content: flex-start;
|
|
679
|
-
`,Tn=
|
|
679
|
+
`,Tn=At.default.img`
|
|
680
680
|
width: 42px;
|
|
681
681
|
height: 42px;
|
|
682
682
|
margin-right: 12px;
|
|
683
|
-
`,Fn=
|
|
683
|
+
`,Fn=At.default.p`
|
|
684
684
|
font-style: normal;
|
|
685
685
|
font-weight: 500;
|
|
686
686
|
font-size: 17px;
|
|
@@ -688,8 +688,8 @@ var va=Object.create;var vo=Object.defineProperty,Ba=Object.defineProperties,Ea=
|
|
|
688
688
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
689
689
|
display: flex;
|
|
690
690
|
align-self: center;
|
|
691
|
-
`;var kn=({stepData:e,setCanContinue:t,onSaveData:o,appearance:n})=>{let i=e.props,[r,s]=(0,Ne.useState)([]),[p,d]=(0,Ne.useState)(!1),[l,m]=(0,Ne.useState)(e.id);return(0,Ne.useEffect)(()=>{r.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),(0,Ne.useEffect)(()=>{l!==e.id&&(m(e.id),s([]))},[e]),(0,Ne.useEffect)(()=>{o({choice:r}),r.length>=i.minChoices?t(!0):t(!1)},[r]),Ne.default.createElement(xn,{className:a("selectListContainer",n)},Ne.default.createElement(Cn,null,Ne.default.createElement(yn,{className:a("selectListTitle",n)},e.title),Ne.default.createElement(Sn,{appearance:n,className:a("selectListSubtitle",n)},e.subtitle)),i.options.map((c,g)=>{let y=r.includes(c.id);return Ne.default.createElement(bn,{key:`select-item-${g}`,onClick:()=>{if(r.includes(c.id)){s(r.filter(T=>T!==c.id));return}r.length<i.maxChoices?s([...r,c.id]):r.length==1&&i.maxChoices==1&&s([c.id])},hideBottomBorder:g===i.options.length-1,className:a("selectListSelectItem",n)},Ne.default.createElement(wn,{className:a("selectListItemImage",n)},c.imageUri&&Ne.default.createElement(Tn,{src:c.imageUri,alt:`select-icon-${g}`}),Ne.default.createElement(Fn,{appearance:n,className:a("selectListSelectItemText",n)},c.title)),Ne.default.createElement(
|
|
692
|
-
${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map(([n,i])=>typeof i=="object"?`${n} { ${Object.entries(i).map(([s,p])=>`${Zo(s)}: ${p};`).join(" ")} }`:`${Zo(n)}: ${i};`).join(" ")} }`).join(" ")}`;function ce({appearance:e}){if(!e||!e.styleOverrides)return uo.default.createElement(uo.default.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([o,n])=>typeof n=="object");return t.length===0?uo.default.createElement(uo.default.Fragment,null):uo.default.createElement(Vp,{inlineStyles:t})}var gr=require("react");function st(e,t=!0){let[o,n]=(0,gr.useState)(!1),{markStepStarted:i,isLoading:r,getFlowStatus:s,getFlowSteps:p,getCurrentStepIndex:d,targetingLogicShouldHideFlow:l,getFlow:m}=Q(),c=p(e);function g(){return z(this,null,function*(){!o&&!r&&s(e)===et&&l(m(e))===!1&&t&&(n(!0),yield i(e,c[d(e)].id))})}return(0,gr.useEffect)(()=>{g()},[r,e,t]),{}}var jr=({flowId:e,customStepTypes:t={},type:o="inline",visible:n,setVisible:i,customVariables:r,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:l=!0,onStepCompletion:m,onButtonClick:c,dismissible:g=!0,endFlowOnDismiss:y=!1,modalPosition:T="center",repeatable:C=!1,onDismiss:h,showPagination:O=!1,allowBackNavigation:F=!1,validationHandler:P,showFrigadeBranding:v=!1,onFormDataChange:B,showFooter:f=!0,prefillData:$={},updateUrlOnPageChange:b=!1})=>{let{getFlow:k,getFlowSteps:D,isLoading:N,targetingLogicShouldHideFlow:L,getFlowStatus:K,getCurrentStepIndex:_,markFlowCompleted:J,markFlowNotStarted:R,markStepStarted:ye}=Q(),j=_(e),{mergeAppearanceWithDefault:ue}=le(),[be,$e]=(0,He.useState)(null),{setOpenFlowState:pe,getOpenFlowState:ie,hasOpenModals:Te}=ze();st(e,n);let W=D(e);d=ue(d);let[Ee,Fe]=n!==void 0&&i!==void 0?[n,i]:[ie(e,!0),V=>pe(e,V)],We=typeof window!="undefined"?window.location.hash:null;if((0,He.useEffect)(()=>{var V;if(W&&W.length>0&&F){let M=typeof window!="undefined"&&((V=window==null?void 0:window.location)!=null&&V.hash)?window.location.hash.replace("#",""):"";if(W&&(W==null?void 0:W.length)>0){let H=-1;if(M){let ne=M;H=W.findIndex(Se=>Se.id===ne),be===M&&(H=-1)}H!==-1&&($e(M),ye(e,W[H].id))}}},[We]),(0,He.useEffect)(()=>{!N&&W&&W.length&&typeof window!="undefined"&&F&&($e(W[j].id),window.location.hash=W[j].id)},[N,j,W]),N)return null;let je=k(e);if(!je||L(je)||!W||n!==void 0&&n===!1||K(e)===se&&l&&!C||(o=="modal"||o=="corner-modal")&&Te(e))return null;let Ae=()=>{Fe(!1),h&&h(),y===!0&&J(e)};if(T=="center"&&o==="modal"||o==="large-modal"){let V={padding:"24px"};return o==="large-modal"?(V.width="85%",V.height="90%",V.maxHeight="800px",V.minHeight="500px",V.padding="0"):V.width="400px",He.default.createElement(ft,{appearance:d,onClose:Ae,visible:Ee,style:V,dismissible:g,showFrigadeBranding:v},He.default.createElement(ce,{appearance:d}),He.default.createElement(fr,{appearance:d,steps:W,selectedStep:j,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:i,setShowModal:Fe,onDismiss:h,showPagination:O,customFormElements:s,allowBackNavigation:F,validationHandler:P,onFormDataChange:B,showFooter:f,prefillData:$,updateUrlOnPageChange:b,repeatable:C}))}return o==="modal"&&T!=="center"?He.default.createElement(ir,{appearance:d,onClose:Ae,visible:Ee,modalPosition:T},He.default.createElement(ce,{appearance:d}),He.default.createElement(fr,{appearance:d,steps:W,selectedStep:j,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:i,setShowModal:Fe,onDismiss:h,showPagination:O,customFormElements:s,allowBackNavigation:F,validationHandler:P,onFormDataChange:B,showFooter:f,prefillData:$,updateUrlOnPageChange:b,repeatable:C})):He.default.createElement(He.default.Fragment,null,He.default.createElement(ce,{appearance:d}),He.default.createElement(fr,{appearance:d,steps:W,selectedStep:j,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:i,setShowModal:Fe,onDismiss:h,showPagination:O,customFormElements:s,allowBackNavigation:F,validationHandler:P,onFormDataChange:B,showFooter:f,prefillData:$,updateUrlOnPageChange:b,repeatable:C}))},vn=jr;var Mt=require("react");function hr(){let{organizationId:e,userId:t,setOrganizationId:o}=(0,Mt.useContext)(X),{mutateUserFlowState:n}=Xe(),{config:i,apiUrl:r}=mt(),s=oo(),{verifySDKInitiated:p}=ro();function d(g,y){return`frigade-user-group-registered-${g}-${y}`}(0,Mt.useEffect)(()=>{if(t&&e){if(t.startsWith(lo))return;let g=d(t,e);localStorage.getItem(g)||(s(`${r}userGroups`,q(w({},i),{method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})})),localStorage.setItem(g,"true"))}},[t,e]);let l=(0,Mt.useCallback)(g=>z(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:g};yield s(`${r}userGroups`,q(w({},i),{method:"POST",body:JSON.stringify(y)})),n()}),[e,t,i,n]),m=(0,Mt.useCallback)((g,y)=>z(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 C={foreignUserId:t,foreignUserGroupId:e,events:[{event:g,properties:y}]};yield s(`${r}userGroups`,q(w({},i),{method:"POST",body:JSON.stringify(C)})),n()}),[e,t,i,n]),c=(0,Mt.useCallback)((g,y)=>z(this,null,function*(){if(p())if(y){let T=d(t,g);localStorage.setItem(T,"true"),o(g);let C={foreignUserId:t,foreignUserGroupId:g,properties:y};yield s(`${r}userGroups`,q(w({},i),{method:"POST",body:JSON.stringify(C)})),n()}else o(g)}),[t,i,n]);return{organizationId:e,setOrganizationId:o,setOrganizationIdWithProperties:c,addPropertiesToOrganization:l,trackEventForOrganization:m}}var Bn="frigade-xFrigade_guestUserId",Uo="frigade-xFrigade_userId",An=({})=>{let{setFlowResponses:e}=so(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:n}=Xe(),{userId:i,setUserId:r}=ao(),[s,p]=(0,ge.useState)(i),{getFlowStatus:d}=Q(),{flows:l,userProperties:m,setIsNewGuestUser:c,flowResponses:g}=(0,ge.useContext)(X),[y,T]=(0,ge.useState)([]),[C,h]=(0,ge.useState)([]),{organizationId:O}=hr(),[F,P]=(0,ge.useState)(O),[v,B]=(0,ge.useState)(!1);(0,ge.useEffect)(()=>{if(!o&&t)for(let k=0;k<t.length;k++){let D=t[k],N=l.find(L=>L.slug===(D==null?void 0:D.flowId));if(N&&D&&D.shouldTrigger===!0&&N.type=="FORM"&&N.triggerType==="AUTOMATIC"&&!C.includes(N.slug)){setTimeout(()=>{f(D.flowId)},500);break}}},[o,t]),(0,ge.useEffect)(()=>{g.length>0&&n()},[g]),(0,ge.useEffect)(()=>{v||(B(!0),n())},[o,B]);function f(k){let D=l.find(N=>N.slug===k);D&&D.triggerType==="AUTOMATIC"&&!C.includes(D.slug)&&(h([...C,D.slug]),T([D]))}function $(){if(!i){let k=localStorage.getItem(Uo);if(k){r(k);return}let D=localStorage.getItem(Bn);if(D){r(D);return}c(!0);let N=lo+(0,En.v4)();try{localStorage.setItem(Bn,N)}catch(L){console.log("Failed to save guest user id locally: Local storage unavailable",L)}r(L=>L||N)}}(0,ge.useEffect)(()=>{try{if(l){let k=[];l.forEach(D=>{if(D.data){let N=D.data.match(/"imageUri":"(.*?)"/g);N&&N.forEach(L=>{let K=L.replace('"imageUri":"',"").replace('"',"");if(k.includes(K))return;let _=new Image;_.src=K,k.push(K)})}})}}catch(k){}},[l]),(0,ge.useEffect)(()=>{if(i!==s&&(e([]),n()),p(i),i&&!i.startsWith(lo))try{localStorage.setItem(Uo,i)}catch(k){console.log("Failed to save user id locally: Local storage available",k)}i===null&&setTimeout(()=>{i===null&&$()},50)},[i,l,m]),(0,ge.useEffect)(()=>{O!=F&&(P(O),e([]),n())},[O,F,P]);function b(){return ge.default.createElement(ge.default.Fragment,null,y.map(k=>d(k.slug)!==et?null:ge.default.createElement("span",{key:k.slug},ge.default.createElement(vn,{flowId:k.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return ge.default.createElement(ge.default.Fragment,null,ge.default.createElement(b,null))};var zn=require("react-error-boundary");var On={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 jp(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,n])=>{if(On[o]){let i=On[o].split("."),r=t;i.forEach((s,p)=>{r[s]||(r[s]=p===i.length-1?n:{}),r=r[s]})}}),t}function Gp(e){if(!e)return;let t=ke({},e),o={};return Object.keys(t).forEach(n=>{let i=`.fr-${n}`;o[i]=t[n]}),o}function Nn(e){let{theme:t,styleOverrides:o}=e,n=jp(t),i=Gp(o);return{overrides:n,css:i}}var In=u(require("styled-components")),Wo=require("styled-system");var Gr=u(require("react")),fo=u(require("styled-components")),Ve=require("styled-system");var Kp={width:{property:"width",scale:"sizes",transform:(e,t)=>(0,Ve.get)(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},qp=(0,fo.default)("div")(({css:e})=>e,(0,Ve.compose)(Ve.border,Ve.color,Ve.shadow,Ve.space,Ve.typography,(0,Ve.system)(Kp))),go=i=>{var r=i,{as:e,children:t,overrides:o}=r,n=Ye(r,["as","children","overrides"]);let s=(0,fo.useTheme)(),p={border:"none",boxSizing:"border-box",m:0,p:0},d=()=>Gr.default.createElement(qp,w(w({as:e},p),n),t);if(o!==void 0){let l=ke(s,o);return Gr.default.createElement(fo.ThemeProvider,{theme:l},d())}return d()};var zo={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"}},Yp={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},Ln=(0,In.default)(go)(()=>({whiteSpace:"nowrap"}),(0,Wo.compose)((0,Wo.variant)({scale:"components.Button",variants:"components.Button"}),(0,Wo.variant)({prop:"size",variants:Yp})));var $n=u(require("styled-components")),xr=require("styled-system");var Cr={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 Mn=(0,$n.default)(go)((0,xr.variant)({scale:"components.Text",variants:"components.Text"}),(0,xr.system)({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Dn=4,Un="px",Jp=20,Xp=Object.fromEntries(Array.from(Array(Jp+1),(e,t)=>t===0?[.5,`${.5*Dn}${Un}`]:[t,`${t*Dn}${Un}`])),ho={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"},yr={colors:q(w({},ho),{neutral:{foreground:ho.gray300},primary:{background:ho.blue500,foreground:ho.white,inverted:ho.blue500},negative:{foreground:ho.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:Xp,components:{Button:zo,Text:Cr}};var _n="https://api.frigade.com",X=(0,te.createContext)({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:gt,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{},apiUrl:_n,readonly:!1,debug:!1});function Qp(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var Hn=({publicApiKey:e,userId:t,organizationId:o,config:n,children:i})=>{var j,ue,be,$e,pe;let[r,s]=(0,te.useState)(t||null),[p,d]=(0,te.useState)(o||null),[l,m]=(0,te.useState)([]),[c,g]=(0,te.useState)([]),[y,T]=(0,te.useState)([]),[C,h]=(0,te.useState)({}),[O,F]=(0,te.useState)({}),[P,v]=(0,te.useState)([]),[B,f]=(0,te.useState)({}),[$,b]=(0,te.useState)(!1),[k,D]=(0,te.useState)(!1),[N,L]=(0,te.useState)(!J(e)),K=(ie,Te)=>{if(Te==="_blank"){window.open(ie,"_blank");return}setTimeout(()=>{window.location.href=ie},50)},_={theme:w(w({},gt.theme),(ue=(j=n==null?void 0:n.defaultAppearance)==null?void 0:j.theme)!=null?ue:{}),styleOverrides:w(w({},gt.styleOverrides),($e=(be=n==null?void 0:n.defaultAppearance)==null?void 0:be.styleOverrides)!=null?$e:{})};function J(ie){return!!(ie&&ie.length>10&&ie.substring(0,10)==="api_public")}(0,te.useEffect)(()=>{t&&s(t)},[t]),(0,te.useEffect)(()=>{r&&typeof window!="undefined"&&window.localStorage&&window.localStorage.getItem(Uo)&&window.localStorage.getItem(Uo)!==r&&Qp()},[r]),(0,te.useEffect)(()=>{o&&d(o)},[o]),(0,te.useEffect)(()=>{if(J(e))L(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),L(!0);return}},[e,L]);let R={publicApiKey:e,userId:r,setUserId:s,setFlows:m,flows:l,failedFlowResponses:c,setFailedFlowResponses:g,flowResponses:y,setFlowResponses:T,userProperties:C,setUserProperties:h,openFlowStates:O,setOpenFlowStates:F,completedFlowsToKeepOpenDuringSession:P,setCompletedFlowsToKeepOpenDuringSession:v,customVariables:B,setCustomVariables:f,isNewGuestUser:$,setIsNewGuestUser:b,hasActiveFullPageFlow:k,setHasActiveFullPageFlow:D,organizationId:p,setOrganizationId:d,navigate:n&&n.navigate?n.navigate:K,defaultAppearance:_,shouldGracefullyDegrade:N,setShouldGracefullyDegrade:L,apiUrl:n&&n.apiUrl?n.apiUrl:_n,readonly:n&&n.readonly?n.readonly:!1,debug:n&&n.debug?n.debug:!1};if(N)return te.default.createElement(X.Provider,{value:R},i);let{overrides:ye}=Nn(_);return te.default.createElement(zn.ErrorBoundary,{fallback:te.default.createElement(te.default.Fragment,null,i)},te.default.createElement(X.Provider,{value:R},te.default.createElement(Wn.ThemeProvider,{theme:ke(_.theme,yr,ye!=null?ye:{},(pe=n==null?void 0:n.theme)!=null?pe:{})},i,te.default.createElement(An,null))))};var hl=u(require("react"));var oe=u(require("react"));var Ze=u(require("react")),Wt=u(require("styled-components"));var _o=u(require("react"));var Dt=u(require("react")),Kr=u(require("styled-components"));var Vn=Kr.default.span`
|
|
691
|
+
`;var kn=({stepData:e,setCanContinue:t,onSaveData:o,appearance:n})=>{let i=e.props,[r,s]=(0,Ne.useState)([]),[p,d]=(0,Ne.useState)(!1),[l,m]=(0,Ne.useState)(e.id);return(0,Ne.useEffect)(()=>{r.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),(0,Ne.useEffect)(()=>{l!==e.id&&(m(e.id),s([]))},[e]),(0,Ne.useEffect)(()=>{o({choice:r}),r.length>=i.minChoices?t(!0):t(!1)},[r]),Ne.default.createElement(xn,{className:a("selectListContainer",n)},Ne.default.createElement(Cn,null,Ne.default.createElement(yn,{className:a("selectListTitle",n)},e.title),Ne.default.createElement(Sn,{appearance:n,className:a("selectListSubtitle",n)},e.subtitle)),i.options.map((c,g)=>{let y=r.includes(c.id);return Ne.default.createElement(bn,{key:`select-item-${g}`,onClick:()=>{if(r.includes(c.id)){s(r.filter(T=>T!==c.id));return}r.length<i.maxChoices?s([...r,c.id]):r.length==1&&i.maxChoices==1&&s([c.id])},hideBottomBorder:g===i.options.length-1,className:a("selectListSelectItem",n)},Ne.default.createElement(wn,{className:a("selectListItemImage",n)},c.imageUri&&Ne.default.createElement(Tn,{src:c.imageUri,alt:`select-icon-${g}`}),Ne.default.createElement(Fn,{appearance:n,className:a("selectListSelectItemText",n)},c.title)),Ne.default.createElement(xt,{appearance:n,value:y,primaryColor:n.theme.colorPrimary}))}))};var he=u(require("react"));var Hp=({children:e,id:t,shouldWrap:o=!1})=>he.default.createElement(he.default.Fragment,null,o?he.default.createElement("div",{key:t,style:{width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:1,overflowY:"auto"}},e):e),Cr=({appearance:e,steps:t,selectedStep:o,customStepTypes:n,customVariables:i,onButtonClick:r,onStepCompletion:s,flowId:p,type:d,hideOnFlowCompletion:l,onComplete:m,setVisible:c,setShowModal:g,onDismiss:y,showPagination:T=!1,customFormElements:C,allowBackNavigation:h,validationHandler:O,onFormDataChange:F,showFooter:P,prefillData:v,updateUrlOnPageChange:B,repeatable:f})=>{var Ae;let b=w(w({},{linkCollection:gn,multiInput:tn,callToAction:hn,selectList:kn}),n),{primaryCTAClickSideEffects:k,secondaryCTAClickSideEffects:D}=ge(),[N,L]=(0,he.useState)(!1),[K,_]=(0,he.useState)({}),[J,R]=(0,he.useState)(!1),[Ce,j]=(0,he.useState)(null),me=(Ae=t[o])!=null?Ae:null,{markStepCompleted:be,markStepStarted:$e,isLoading:ae,updateCustomVariables:re,markFlowCompleted:Te}=Q();(0,he.useEffect)(()=>{re(i)},[i,ae]),(0,he.useEffect)(()=>{F&&F(K,W(),t[o],o)},[K]);function W(){var M;return{data:(M=K[t[o].id])!=null?M:{},stepId:t[o].id,customVariables:i}}function Ee(V,M,H){let ie=o+1<t.length?t[o+1]:null;return s&&s(V,H,ie,K,W()),r?r(V,o,M,ie):!0}function Fe(V,M){_(H=>{let ie={};return ie[V.id]=M,w(w({},H),ie)})}function We(V){return V.selectedStep.imageUri?he.default.createElement(an,{image:V.selectedStep.imageUri,appearance:e,className:a("formContainerSidebarImage",e)}):null}let je=P&&he.default.createElement(cn,{step:t[o],canContinue:N&&!J,formType:d,selectedStep:o,appearance:e,onPrimaryClick:()=>z(void 0,null,function*(){if(R(!0),O){let H=yield O(t[o],o,t[o+1],K,W());if(H!==!0){j(typeof H=="string"?H:null),R(!1);return}else j(null)}let V=w({},W());yield be(p,t[o].id,V),o+1<t.length&&!h&&(yield $e(p,t[o+1].id));let M=Ee(t[o],"primary",o);if(o+1>=t.length&&(m&&m(),y&&y(),l&&M&&(c&&c(!1),g(!1)),yield Te(p),f&&(yield $e(p,t[0].id),typeof window!="undefined"&&window.localStorage&&Object.keys(window.localStorage).forEach(ie=>{ie.startsWith(jr)&&window.localStorage.removeItem(ie)}))),k(t[o]),R(!1),typeof window!="undefined"&&!h&&B&&o+1<t.length){let H=new URL(window.location.href);H.searchParams.set("p",t[o+1].id),window.history.pushState({},"",H.toString())}}),onSecondaryClick:()=>{Ee(t[o],"secondary",o),D(t[o])},onBack:()=>z(void 0,null,function*(){o-1>=0&&(R(!0),yield $e(p,t[o-1].id),R(!1))}),steps:t,allowBackNavigation:h,errorMessage:Ce,isSaving:J});return he.default.createElement(he.default.Fragment,null,he.default.createElement(sn,{className:a("formContainer",e)},he.default.createElement(Hp,{id:o,shouldWrap:d==="large-modal"},he.default.createElement(ln,{key:me.id,type:d,className:a("formContent",e)},t.map(V=>{var H;let M=b[(H=V.type)!=null?H:"multiInput"];return me.id!==V.id?null:typeof M!="function"?M:he.default.createElement(M,{key:V.id,stepData:V,canContinue:N,setCanContinue:L,onSaveData:ie=>{Fe(V,ie)},appearance:e,customFormElements:C,flowId:p,prefillData:v})}),T&&he.default.createElement(un,{className:a("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),je)),d=="large-modal"&&he.default.createElement(We,{selectedStep:t[o]})))};var fo=u(require("react")),Pn=require("styled-components");var Vp=Pn.createGlobalStyle`
|
|
692
|
+
${e=>e.inlineStyles.map(([t,o])=>`.${Io}${t}.${Io}${t} { ${Object.entries(o).map(([n,i])=>typeof i=="object"?`${n} { ${Object.entries(i).map(([s,p])=>`${or(s)}: ${p};`).join(" ")} }`:`${or(n)}: ${i};`).join(" ")} }`).join(" ")}`;function de({appearance:e}){if(!e||!e.styleOverrides)return fo.default.createElement(fo.default.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([o,n])=>typeof n=="object");return t.length===0?fo.default.createElement(fo.default.Fragment,null):fo.default.createElement(Vp,{inlineStyles:t})}var yr=require("react");function lt(e,t=!0){let[o,n]=(0,yr.useState)(!1),{markStepStarted:i,isLoading:r,getFlowStatus:s,getFlowSteps:p,getCurrentStepIndex:d,targetingLogicShouldHideFlow:l,getFlow:m}=Q(),c=p(e);function g(){return z(this,null,function*(){!o&&!r&&s(e)===et&&l(m(e))===!1&&t&&(n(!0),yield i(e,c[d(e)].id))})}return(0,yr.useEffect)(()=>{g()},[r,e,t]),{}}var qr=({flowId:e,customStepTypes:t={},type:o="inline",visible:n,setVisible:i,customVariables:r,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:l=!0,onStepCompletion:m,onButtonClick:c,dismissible:g=!0,endFlowOnDismiss:y=!1,modalPosition:T="center",repeatable:C=!1,onDismiss:h,showPagination:O=!1,allowBackNavigation:F=!1,validationHandler:P,showFrigadeBranding:v=!1,onFormDataChange:B,showFooter:f=!0,prefillData:$={},updateUrlOnPageChange:b=!1})=>{let{getFlow:k,getFlowSteps:D,isLoading:N,targetingLogicShouldHideFlow:L,getFlowStatus:K,getCurrentStepIndex:_,markFlowCompleted:J,markFlowNotStarted:R,markStepStarted:Ce}=Q(),j=_(e),{mergeAppearanceWithDefault:me}=se(),[be,$e]=(0,He.useState)(null),{setOpenFlowState:ae,getOpenFlowState:re,hasOpenModals:Te}=ze();lt(e,n);let W=D(e);d=me(d);let[Ee,Fe]=n!==void 0&&i!==void 0?[n,i]:[re(e,!0),V=>ae(e,V)],We=typeof window!="undefined"?window.location.hash:null;if((0,He.useEffect)(()=>{var V;if(W&&W.length>0&&F){let M=typeof window!="undefined"&&((V=window==null?void 0:window.location)!=null&&V.hash)?window.location.hash.replace("#",""):"";if(W&&(W==null?void 0:W.length)>0){let H=-1;if(M){let ie=M;H=W.findIndex(ye=>ye.id===ie),be===M&&(H=-1)}H!==-1&&($e(M),Ce(e,W[H].id))}}},[We]),(0,He.useEffect)(()=>{!N&&W&&W.length&&typeof window!="undefined"&&F&&($e(W[j].id),window.location.hash=W[j].id)},[N,j,W]),N)return null;let je=k(e);if(!je||L(je)||!W||n!==void 0&&n===!1||K(e)===ne&&l&&!C||(o=="modal"||o=="corner-modal")&&Te(e))return null;let Ae=()=>{Fe(!1),h&&h(),y===!0&&J(e)};if(T=="center"&&o==="modal"||o==="large-modal"){let V={padding:"24px"};return o==="large-modal"?(V.width="85%",V.height="90%",V.maxHeight="800px",V.minHeight="500px",V.padding="0"):V.width="400px",He.default.createElement(gt,{appearance:d,onClose:Ae,visible:Ee,style:V,dismissible:g,showFrigadeBranding:v},He.default.createElement(de,{appearance:d}),He.default.createElement(Cr,{appearance:d,steps:W,selectedStep:j,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:i,setShowModal:Fe,onDismiss:h,showPagination:O,customFormElements:s,allowBackNavigation:F,validationHandler:P,onFormDataChange:B,showFooter:f,prefillData:$,updateUrlOnPageChange:b,repeatable:C}))}return o==="modal"&&T!=="center"?He.default.createElement(ar,{appearance:d,onClose:Ae,visible:Ee,modalPosition:T},He.default.createElement(de,{appearance:d}),He.default.createElement(Cr,{appearance:d,steps:W,selectedStep:j,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:i,setShowModal:Fe,onDismiss:h,showPagination:O,customFormElements:s,allowBackNavigation:F,validationHandler:P,onFormDataChange:B,showFooter:f,prefillData:$,updateUrlOnPageChange:b,repeatable:C})):He.default.createElement(He.default.Fragment,null,He.default.createElement(de,{appearance:d}),He.default.createElement(Cr,{appearance:d,steps:W,selectedStep:j,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:i,setShowModal:Fe,onDismiss:h,showPagination:O,customFormElements:s,allowBackNavigation:F,validationHandler:P,onFormDataChange:B,showFooter:f,prefillData:$,updateUrlOnPageChange:b,repeatable:C}))},vn=qr;var Dt=require("react");function Sr(){let{organizationId:e,userId:t,setOrganizationId:o}=(0,Dt.useContext)(X),{mutateUserFlowState:n}=Xe(),{config:i,apiUrl:r}=ut(),s=ro(),{verifySDKInitiated:p}=io();function d(g,y){return`frigade-user-group-registered-${g}-${y}`}(0,Dt.useEffect)(()=>{if(t&&e){if(t.startsWith(ao))return;let g=d(t,e);localStorage.getItem(g)||(s(`${r}userGroups`,q(w({},i),{method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})})),localStorage.setItem(g,"true"))}},[t,e]);let l=(0,Dt.useCallback)(g=>z(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:g};yield s(`${r}userGroups`,q(w({},i),{method:"POST",body:JSON.stringify(y)})),n()}),[e,t,i,n]),m=(0,Dt.useCallback)((g,y)=>z(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 C={foreignUserId:t,foreignUserGroupId:e,events:[{event:g,properties:y}]};yield s(`${r}userGroups`,q(w({},i),{method:"POST",body:JSON.stringify(C)})),n()}),[e,t,i,n]),c=(0,Dt.useCallback)((g,y)=>z(this,null,function*(){if(p())if(y){let T=d(t,g);localStorage.setItem(T,"true"),o(g);let C={foreignUserId:t,foreignUserGroupId:g,properties:y};yield s(`${r}userGroups`,q(w({},i),{method:"POST",body:JSON.stringify(C)})),n()}else o(g)}),[t,i,n]);return{organizationId:e,setOrganizationId:o,setOrganizationIdWithProperties:c,addPropertiesToOrganization:l,trackEventForOrganization:m}}var Bn="frigade-xFrigade_guestUserId",_o="frigade-xFrigade_userId",An=({})=>{let{setFlowResponses:e}=lo(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:n}=Xe(),{userId:i,setUserId:r}=po(),[s,p]=(0,fe.useState)(i),{getFlowStatus:d}=Q(),{flows:l,userProperties:m,setIsNewGuestUser:c,flowResponses:g}=(0,fe.useContext)(X),[y,T]=(0,fe.useState)([]),[C,h]=(0,fe.useState)([]),{organizationId:O}=Sr(),[F,P]=(0,fe.useState)(O),[v,B]=(0,fe.useState)(!1);(0,fe.useEffect)(()=>{if(!o&&t)for(let k=0;k<t.length;k++){let D=t[k],N=l.find(L=>L.slug===(D==null?void 0:D.flowId));if(N&&D&&D.shouldTrigger===!0&&N.type=="FORM"&&N.triggerType==="AUTOMATIC"&&!C.includes(N.slug)){setTimeout(()=>{f(D.flowId)},500);break}}},[o,t]),(0,fe.useEffect)(()=>{g.length>0&&n()},[g]),(0,fe.useEffect)(()=>{v||(B(!0),n())},[o,B]);function f(k){let D=l.find(N=>N.slug===k);D&&D.triggerType==="AUTOMATIC"&&!C.includes(D.slug)&&(h([...C,D.slug]),T([D]))}function $(){if(!i){let k=localStorage.getItem(_o);if(k){r(k);return}let D=localStorage.getItem(Bn);if(D){r(D);return}c(!0);let N=ao+(0,En.v4)();try{localStorage.setItem(Bn,N)}catch(L){console.log("Failed to save guest user id locally: Local storage unavailable",L)}r(L=>L||N)}}(0,fe.useEffect)(()=>{try{if(l){let k=[];l.forEach(D=>{if(D.data){let N=D.data.match(/"imageUri":"(.*?)"/g);N&&N.forEach(L=>{let K=L.replace('"imageUri":"',"").replace('"',"");if(k.includes(K))return;let _=new Image;_.src=K,k.push(K)})}})}}catch(k){}},[l]),(0,fe.useEffect)(()=>{if(i!==s&&(e([]),n()),p(i),i&&!i.startsWith(ao))try{localStorage.setItem(_o,i)}catch(k){console.log("Failed to save user id locally: Local storage available",k)}i===null&&setTimeout(()=>{i===null&&$()},50)},[i,l,m]),(0,fe.useEffect)(()=>{O!=F&&(P(O),e([]),n())},[O,F,P]);function b(){return fe.default.createElement(fe.default.Fragment,null,y.map(k=>d(k.slug)!==et?null:fe.default.createElement("span",{key:k.slug},fe.default.createElement(vn,{flowId:k.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return fe.default.createElement(fe.default.Fragment,null,fe.default.createElement(b,null))};var zn=require("react-error-boundary");var On={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 jp(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,n])=>{if(On[o]){let i=On[o].split("."),r=t;i.forEach((s,p)=>{r[s]||(r[s]=p===i.length-1?n:{}),r=r[s]})}}),t}function Gp(e){if(!e)return;let t=ke({},e),o={};return Object.keys(t).forEach(n=>{let i=`.fr-${n}`;o[i]=t[n]}),o}function Nn(e){let{theme:t,styleOverrides:o}=e,n=jp(t),i=Gp(o);return{overrides:n,css:i}}var In=u(require("styled-components")),Ho=require("styled-system");var Yr=u(require("react")),go=u(require("styled-components")),Ve=require("styled-system");var Kp={width:{property:"width",scale:"sizes",transform:(e,t)=>(0,Ve.get)(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},qp=(0,go.default)("div")(({css:e})=>e,(0,Ve.compose)(Ve.border,Ve.color,Ve.shadow,Ve.space,Ve.typography,(0,Ve.system)(Kp))),ho=i=>{var r=i,{as:e,children:t,overrides:o}=r,n=Ye(r,["as","children","overrides"]);let s=(0,go.useTheme)(),p={border:"none",boxSizing:"border-box",m:0,p:0},d=()=>Yr.default.createElement(qp,w(w({as:e},p),n),t);if(o!==void 0){let l=ke(s,o);return Yr.default.createElement(go.ThemeProvider,{theme:l},d())}return d()};var Vo={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"}},Yp={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},Ln=(0,In.default)(ho)(()=>({whiteSpace:"nowrap"}),(0,Ho.compose)((0,Ho.variant)({scale:"components.Button",variants:"components.Button"}),(0,Ho.variant)({prop:"size",variants:Yp})));var $n=u(require("styled-components")),br=require("styled-system");var wr={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 Mn=(0,$n.default)(ho)((0,br.variant)({scale:"components.Text",variants:"components.Text"}),(0,br.system)({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Dn=4,Un="px",Jp=20,Xp=Object.fromEntries(Array.from(Array(Jp+1),(e,t)=>t===0?[.5,`${.5*Dn}${Un}`]:[t,`${t*Dn}${Un}`])),xo={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",red500:"#c00000"},Tr={colors:q(w({},xo),{neutral:{foreground:xo.gray300},primary:{background:xo.blue500,foreground:xo.white,inverted:xo.blue500},negative:{foreground:xo.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:Xp,components:{Button:Vo,Text:wr}};var _n="https://api.frigade.com",X=(0,ee.createContext)({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:ht,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{},apiUrl:_n,readonly:!1,debug:!1});function Qp(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var Hn=({publicApiKey:e,userId:t,organizationId:o,config:n,children:i})=>{var j,me,be,$e,ae;let[r,s]=(0,ee.useState)(t||null),[p,d]=(0,ee.useState)(o||null),[l,m]=(0,ee.useState)([]),[c,g]=(0,ee.useState)([]),[y,T]=(0,ee.useState)([]),[C,h]=(0,ee.useState)({}),[O,F]=(0,ee.useState)({}),[P,v]=(0,ee.useState)([]),[B,f]=(0,ee.useState)({}),[$,b]=(0,ee.useState)(!1),[k,D]=(0,ee.useState)(!1),[N,L]=(0,ee.useState)(!J(e)),K=(re,Te)=>{if(Te==="_blank"){window.open(re,"_blank");return}setTimeout(()=>{window.location.href=re},50)},_={theme:w(w({},ht.theme),(me=(j=n==null?void 0:n.defaultAppearance)==null?void 0:j.theme)!=null?me:{}),styleOverrides:w(w({},ht.styleOverrides),($e=(be=n==null?void 0:n.defaultAppearance)==null?void 0:be.styleOverrides)!=null?$e:{})};function J(re){return!!(re&&re.length>10&&re.substring(0,10)==="api_public")}(0,ee.useEffect)(()=>{t&&s(t)},[t]),(0,ee.useEffect)(()=>{r&&typeof window!="undefined"&&window.localStorage&&window.localStorage.getItem(_o)&&window.localStorage.getItem(_o)!==r&&Qp()},[r]),(0,ee.useEffect)(()=>{o&&d(o)},[o]),(0,ee.useEffect)(()=>{if(J(e))L(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),L(!0);return}},[e,L]);let R={publicApiKey:e,userId:r,setUserId:s,setFlows:m,flows:l,failedFlowResponses:c,setFailedFlowResponses:g,flowResponses:y,setFlowResponses:T,userProperties:C,setUserProperties:h,openFlowStates:O,setOpenFlowStates:F,completedFlowsToKeepOpenDuringSession:P,setCompletedFlowsToKeepOpenDuringSession:v,customVariables:B,setCustomVariables:f,isNewGuestUser:$,setIsNewGuestUser:b,hasActiveFullPageFlow:k,setHasActiveFullPageFlow:D,organizationId:p,setOrganizationId:d,navigate:n&&n.navigate?n.navigate:K,defaultAppearance:_,shouldGracefullyDegrade:N,setShouldGracefullyDegrade:L,apiUrl:n&&n.apiUrl?n.apiUrl:_n,readonly:n&&n.readonly?n.readonly:!1,debug:n&&n.debug?n.debug:!1};if(N)return ee.default.createElement(X.Provider,{value:R},i);let{overrides:Ce}=Nn(_);return ee.default.createElement(zn.ErrorBoundary,{fallback:ee.default.createElement(ee.default.Fragment,null,i)},ee.default.createElement(X.Provider,{value:R},ee.default.createElement(Wn.ThemeProvider,{theme:ke(_.theme,Tr,Ce!=null?Ce:{},(ae=n==null?void 0:n.theme)!=null?ae:{})},i,ee.default.createElement(An,null))))};var hl=u(require("react"));var te=u(require("react"));var Ze=u(require("react")),zt=u(require("styled-components"));var jo=u(require("react"));var Ut=u(require("react")),Jr=u(require("styled-components"));var Vn=Jr.default.span`
|
|
693
693
|
font-weight: 600;
|
|
694
694
|
font-size: 14px;
|
|
695
695
|
font-style: normal;
|
|
@@ -701,7 +701,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
701
701
|
margin-left: 32px;
|
|
702
702
|
padding-right: 12px;
|
|
703
703
|
${e=>_e(e)}
|
|
704
|
-
`,Zp=
|
|
704
|
+
`,Zp=Jr.default.div`
|
|
705
705
|
flex-direction: row;
|
|
706
706
|
justify-content: space-between;
|
|
707
707
|
display: flex;
|
|
@@ -710,11 +710,11 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
710
710
|
padding-right: 8px;
|
|
711
711
|
width: 100%;
|
|
712
712
|
${e=>_e(e)}
|
|
713
|
-
`,
|
|
713
|
+
`,Fr=({label:e,value:t,labelStyle:o={},labelPosition:n="right",style:i,primaryColor:r="#000000",checkBoxType:s="round",appearance:p})=>Ut.default.createElement(Ut.default.Fragment,null,Ut.default.createElement(Zp,{className:a("checklistStepsContainer",p),appearance:p,styleOverrides:w({},i)},n==="left"&&e&&Ut.default.createElement(Vn,{className:a("checklistStepLabel",p),styleOverrides:o,appearnace:p},e),Ut.default.createElement(xt,{appearance:p,value:t,type:s,primaryColor:r}),n==="right"&&e&&Ut.default.createElement(Vn,{className:a("checklistStepLabel",p),styleOverrides:o,appearance:p},e)),Ut.default.createElement(de,{appearance:p}));var Co=u(require("styled-components")),jn=Co.default.div`
|
|
714
714
|
font-weight: 700;
|
|
715
715
|
font-size: 18px;
|
|
716
716
|
line-height: 22px;
|
|
717
|
-
`,Gn=
|
|
717
|
+
`,Gn=Co.default.p`
|
|
718
718
|
font-weight: 600;
|
|
719
719
|
font-size: 16px;
|
|
720
720
|
line-height: 24px;
|
|
@@ -722,7 +722,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
722
722
|
letter-spacing: 0.32px;
|
|
723
723
|
font-style: normal;
|
|
724
724
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
725
|
-
`,Kn=
|
|
725
|
+
`,Kn=Co.default.p`
|
|
726
726
|
font-weight: 400;
|
|
727
727
|
font-size: 14px;
|
|
728
728
|
font-style: normal;
|
|
@@ -731,26 +731,26 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
731
731
|
letter-spacing: 0.28px;
|
|
732
732
|
margin: 8px 0px 0px 0px;
|
|
733
733
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
734
|
-
`,
|
|
734
|
+
`,kr=Co.default.div`
|
|
735
735
|
width: 6px;
|
|
736
736
|
position: absolute;
|
|
737
737
|
left: 0;
|
|
738
738
|
height: 100%;
|
|
739
739
|
border-top-right-radius: 4px;
|
|
740
740
|
border-bottom-right-radius: 4px;
|
|
741
|
-
`,qn=
|
|
741
|
+
`,qn=Co.default.div`
|
|
742
742
|
flex-direction: row;
|
|
743
743
|
justify-content: flex-start;
|
|
744
744
|
border-bottom: 1px solid ${e=>e.theme.colorBorder};
|
|
745
745
|
padding-right: 16px;
|
|
746
|
-
`;var Yn=({data:e,index:t,isSelected:o,primaryColor:n,style:i,onClick:r,appearance:s})=>{var p,d,l,m,c;return
|
|
746
|
+
`;var Yn=({data:e,index:t,isSelected:o,primaryColor:n,style:i,onClick:r,appearance:s})=>{var p,d,l,m,c;return jo.default.createElement("div",{style:{position:"relative",paddingLeft:"0px"},onClick:()=>{r()}},o&&jo.default.createElement(kr,{className:a("checklistStepItemSelectedIndicator",s),layoutId:"checklis-step-selected",style:{backgroundColor:(d=(p=s==null?void 0:s.theme)==null?void 0:p.colorPrimary)!=null?d:n}}),jo.default.createElement(qn,{className:a("checklistStepItem",s),key:`hero-checklist-step-${t}`,appearance:s,role:"listitem"},jo.default.createElement(Fr,{value:e.complete,labelPosition:"left",label:(l=e.stepName)!=null?l:e.title,style:i,primaryColor:(c=(m=s==null?void 0:s.theme)==null?void 0:m.colorPrimary)!=null?c:n,appearance:s})))};var Wt=u(require("react")),Pr=u(require("styled-components"));var Go=u(require("styled-components")),Sg=Go.default.h1`
|
|
747
747
|
display: flex;
|
|
748
748
|
margin: 0;
|
|
749
749
|
font-size: 18px;
|
|
750
|
-
`,bg=
|
|
750
|
+
`,bg=Go.default.h2`
|
|
751
751
|
font-size: 15px;
|
|
752
752
|
color: #4d4d4d;
|
|
753
|
-
`,Jn=
|
|
753
|
+
`,Jn=Go.default.div`
|
|
754
754
|
position: absolute;
|
|
755
755
|
left: 0;
|
|
756
756
|
top: 0;
|
|
@@ -759,7 +759,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
759
759
|
border-radius: 20px;
|
|
760
760
|
background-color: ${e=>e.theme.colorPrimary};
|
|
761
761
|
transition: width 0.5s;
|
|
762
|
-
`,Xn=
|
|
762
|
+
`,Xn=Go.default.div`
|
|
763
763
|
position: relative;
|
|
764
764
|
left: 0;
|
|
765
765
|
top: 0;
|
|
@@ -769,7 +769,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
769
769
|
border-radius: 20px;
|
|
770
770
|
background-color: ${e=>e.theme.colorPrimary};
|
|
771
771
|
opacity: 0.12;
|
|
772
|
-
`;var Rp=
|
|
772
|
+
`;var Rp=Pr.default.div`
|
|
773
773
|
display: flex;
|
|
774
774
|
flex-direction: ${e=>e.textLocation=="top"?"column":"row"};
|
|
775
775
|
justify-content: flex-start;
|
|
@@ -777,25 +777,25 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
777
777
|
width: 100%;
|
|
778
778
|
|
|
779
779
|
${e=>_e(e)}
|
|
780
|
-
`,ed=
|
|
780
|
+
`,ed=Pr.default.div`
|
|
781
781
|
flex-grow: 1;
|
|
782
782
|
position: relative;
|
|
783
783
|
${e=>e.textLocation=="top"?"width: 100%;":""}
|
|
784
|
-
`,td=
|
|
784
|
+
`,td=Pr.default.span`
|
|
785
785
|
font-weight: 600;
|
|
786
786
|
font-size: 14px;
|
|
787
787
|
line-height: 18px;
|
|
788
788
|
padding-right: ${e=>e.padding};
|
|
789
789
|
margin-bottom: ${e=>e.textLocation=="top"?"8px":"0px"};
|
|
790
790
|
${e=>_e(e)}
|
|
791
|
-
`;var Qe=({count:e,total:t,display:o="count",textLocation:n="left",style:i={},textStyle:r={},appearance:s})=>{var g;if(t===0)return
|
|
791
|
+
`;var Qe=({count:e,total:t,display:o="count",textLocation:n="left",style:i={},textStyle:r={},appearance:s})=>{var g;if(t===0)return Wt.default.createElement(Wt.default.Fragment,null);Object.keys(r).length===0&&r.constructor===Object&&(r={color:(g=s==null?void 0:s.theme)==null?void 0:g.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`),n==="top"&&(m="0px"),Wt.default.createElement(Rp,{className:a("progressBarContainer",s),textLocation:n,styleOverrides:i},Wt.default.createElement(td,{className:a("progressBarStepText",s),styleOverrides:q(w({},r),{fontSize:o==="compact"?12:14,fontWeight:600}),appearance:s,padding:m,textLocation:n},c),Wt.default.createElement(ed,{textLocation:n,className:a("progressBar",s)},Wt.default.createElement(Jn,{style:{zIndex:o=="compact"?1:5},fgWidth:p,barHeight:d,appearance:s,className:a("progressBarFill",s)}),Wt.default.createElement(Xn,{className:a("progressBarBackground",s),barHeight:d,appearance:s})))};var wo=u(require("react")),Rn=u(require("styled-components"));var qo=u(require("react"));var Ko=u(require("react"));var yo=({stepData:e,appearance:t})=>Ko.default.createElement(Ko.default.Fragment,null,Ko.default.createElement(Gn,{appearance:t,className:a("checklistStepTitle",t),dangerouslySetInnerHTML:ue(e.title)}),Ko.default.createElement(Kn,{appearance:t,className:a("checklistStepSubtitle",t),dangerouslySetInnerHTML:ue(e.subtitle)}));var vr=u(require("react"));var So=({stepData:e,appearance:t})=>{let o=()=>{e.handlePrimaryButtonClick&&e.handlePrimaryButtonClick()},n=()=>{e.handleSecondaryButtonClick&&e.handleSecondaryButtonClick()};return vr.default.createElement(fr,{className:a("ctaContainer",t)},vr.default.createElement(le,{appearance:t,title:e.primaryButtonTitle,onClick:o}),e.secondaryButtonTitle&&vr.default.createElement(le,{appearance:t,secondary:!0,title:e.secondaryButtonTitle,onClick:n,style:{width:"auto",marginRight:"12px"}}))};var bo=({stepData:e,appearance:t})=>qo.default.createElement(qo.default.Fragment,null,qo.default.createElement(yo,{stepData:e,appearance:t}),qo.default.createElement(So,{stepData:e,appearance:t}));var Qn=u(require("react"));function Zn(e){return Qn.default.createElement(Ct,{appearance:e.appearance,videoUri:e.videoUri})}var Xr="default",od=Rn.default.img`
|
|
792
792
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
793
793
|
width: 100%;
|
|
794
794
|
height: auto;
|
|
795
795
|
min-height: 200px;
|
|
796
|
-
`,es=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return
|
|
796
|
+
`,es=({stepData:e,appearance:t})=>{if(e!=null&&e.StepContent){let o=e.StepContent;return wo.default.createElement("div",null,o)}return wo.default.createElement(jn,{className:a("checklistStepContent",t)},e.imageUri?wo.default.createElement(od,{className:a("checklistStepImage",t),src:e.imageUri,style:e.imageStyle,appearance:t}):null,e.videoUri?wo.default.createElement(Zn,{videoUri:e.videoUri,appearance:t}):null,wo.default.createElement(bo,{stepData:e,appearance:t}))};var Ie=u(require("react")),Xt=u(require("styled-components"));var ts=Xt.default.div`
|
|
797
797
|
display: block;
|
|
798
|
-
`,rd=
|
|
798
|
+
`,rd=Xt.default.div`
|
|
799
799
|
display: flex;
|
|
800
800
|
flex-direction: row;
|
|
801
801
|
flex-wrap: wrap;
|
|
@@ -805,20 +805,20 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
805
805
|
align-content: center;
|
|
806
806
|
margin-top: 24px;
|
|
807
807
|
margin-bottom: 24px;
|
|
808
|
-
`,id=
|
|
808
|
+
`,id=Xt.default.div`
|
|
809
809
|
display: flex;
|
|
810
810
|
align-items: center;
|
|
811
811
|
justify-content: flex-start;
|
|
812
812
|
flex-direction: column;
|
|
813
813
|
margin-right: 16px;
|
|
814
|
-
`,nd=
|
|
814
|
+
`,nd=Xt.default.video`
|
|
815
815
|
width: 200px;
|
|
816
816
|
height: 120px;
|
|
817
|
-
`,sd=
|
|
817
|
+
`,sd=Xt.default.div`
|
|
818
818
|
font-size: 14px;
|
|
819
819
|
line-height: 20px;
|
|
820
820
|
text-align: center;
|
|
821
|
-
`,ld=
|
|
821
|
+
`,ld=Xt.default.div`
|
|
822
822
|
position: absolute;
|
|
823
823
|
width: 200px;
|
|
824
824
|
height: 120px;
|
|
@@ -838,9 +838,9 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
838
838
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
839
839
|
border-radius: 50%;
|
|
840
840
|
}
|
|
841
|
-
`,os="videoCarousel",rs=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.videos))return Ie.default.createElement(ts,null,Ie.default.createElement(
|
|
841
|
+
`,os="videoCarousel",rs=({stepData:e,appearance:t})=>{var i;if(!((i=e.props)!=null&&i.videos))return Ie.default.createElement(ts,null,Ie.default.createElement(bo,{stepData:e,appearance:t}));function o({video:r}){let s=(0,Ie.useRef)(),[p,d]=(0,Ie.useState)(!1);return Ie.default.createElement(id,null,!p&&Ie.default.createElement(ld,{onClick:()=>{d(!0),s.current.play()},appearance:t},Ie.default.createElement(xr,null)),Ie.default.createElement(nd,{controls:p,ref:s,play:p,src:r.uri}),Ie.default.createElement(sd,null,r.title))}let n=e.props;return n.videos?Ie.default.createElement(ts,null,Ie.default.createElement(yo,{stepData:e,appearance:t}),Ie.default.createElement(rd,null,n.videos.map((r,s)=>Ie.default.createElement("span",{key:`${r.uri}-${s}`},Ie.default.createElement(o,{video:r})))),Ie.default.createElement(So,{stepData:e,appearance:t})):null};var yt=u(require("react")),Yo=u(require("styled-components"));var is=Yo.default.div`
|
|
842
842
|
display: block;
|
|
843
|
-
`,ad=
|
|
843
|
+
`,ad=Yo.default.pre`
|
|
844
844
|
display: block;
|
|
845
845
|
background-color: #2a2a2a;
|
|
846
846
|
color: #f8f8f8;
|
|
@@ -856,14 +856,14 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
856
856
|
white-space: -o-pre-wrap; /* Opera 7 */
|
|
857
857
|
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
|
858
858
|
margin-bottom: 24px;
|
|
859
|
-
`,pd=
|
|
859
|
+
`,pd=Yo.default.div`
|
|
860
860
|
font-size: 15px;
|
|
861
861
|
line-height: 20px;
|
|
862
862
|
margin-bottom: 12px;
|
|
863
863
|
margin-top: 12px;
|
|
864
|
-
`,dd=
|
|
864
|
+
`,dd=Yo.default.div`
|
|
865
865
|
margin-top: 24px;
|
|
866
|
-
`,ns="codeSnippet",ss=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.codeSnippets))return
|
|
866
|
+
`,ns="codeSnippet",ss=({stepData:e,appearance:t})=>{var n;if(!((n=e.props)!=null&&n.codeSnippets))return yt.default.createElement(is,null,yt.default.createElement(bo,{stepData:e,appearance:t}));let o=e.props;return o.codeSnippets?yt.default.createElement(is,{className:a("codeSnippetContainer",t)},yt.default.createElement(yo,{stepData:e,appearance:t}),yt.default.createElement(dd,null,o.codeSnippets.map((i,r)=>yt.default.createElement("div",{key:r},i.title?yt.default.createElement(pd,{dangerouslySetInnerHTML:ue(i.title)}):null,i.code?yt.default.createElement(ad,null,i.code):null))),yt.default.createElement(So,{stepData:e,appearance:t})):null};var cd=zt.default.div`
|
|
867
867
|
display: flex;
|
|
868
868
|
flex-direction: row;
|
|
869
869
|
overflow: hidden;
|
|
@@ -871,14 +871,14 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
871
871
|
background: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.colorBackground}};
|
|
872
872
|
border-radius: ${e=>{var t;return(t=e.appearance)==null?void 0:t.theme.borderRadius}}px;
|
|
873
873
|
${e=>_e(e)}
|
|
874
|
-
`,md=
|
|
874
|
+
`,md=zt.default.h1`
|
|
875
875
|
font-size: 18px;
|
|
876
876
|
font-style: normal;
|
|
877
877
|
font-weight: 700;
|
|
878
878
|
line-height: 24px;
|
|
879
879
|
letter-spacing: 0.36px;
|
|
880
880
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
881
|
-
`,ud=
|
|
881
|
+
`,ud=zt.default.h2`
|
|
882
882
|
font-size: 14px;
|
|
883
883
|
font-style: normal;
|
|
884
884
|
font-weight: 400;
|
|
@@ -886,22 +886,22 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
886
886
|
letter-spacing: 0.28px;
|
|
887
887
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
888
888
|
margin: 10px 0px 0px 0px;
|
|
889
|
-
`,ls=
|
|
889
|
+
`,ls=zt.default.div``,fd=zt.default.div`
|
|
890
890
|
list-style: none;
|
|
891
891
|
padding: 0;
|
|
892
892
|
margin: 0;
|
|
893
893
|
cursor: pointer;
|
|
894
894
|
min-width: 300px;
|
|
895
|
-
`,gd=
|
|
895
|
+
`,gd=zt.default.div`
|
|
896
896
|
width: 1px;
|
|
897
897
|
margin-right: 40px;
|
|
898
898
|
background: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
899
|
-
`,hd=
|
|
899
|
+
`,hd=zt.default.div`
|
|
900
900
|
flex: 2;
|
|
901
901
|
padding: 40px 40px 40px 0px;
|
|
902
|
-
`,xd=({title:e,subtitle:t,steps:o=[],style:n={},selectedStep:i,setSelectedStep:r,className:s="",customStepTypes:p=new Map,appearance:d,type:l})=>{let{mergeAppearanceWithDefault:m}=
|
|
902
|
+
`,xd=({title:e,subtitle:t,steps:o=[],style:n={},selectedStep:i,setSelectedStep:r,className:s="",customStepTypes:p=new Map,appearance:d,type:l})=>{let{mergeAppearanceWithDefault:m}=se();d=m(d);let c={[Xr]:es,[os]:rs,[ns]:ss},g=w(w({},c),p),[y,T]=(0,Ze.useState)(0),C=i!=null?i:y,h=r!=null?r:T,O=o.filter(P=>P.complete===!0).length,F=()=>{var P;return!((P=o[C])!=null&&P.type)||!g[o[C].type]?g[Xr]({stepData:o[C],appearance:d}):typeof g[o[C].type]!="function"?g[o[C].type]:g[o[C].type]({stepData:o[C],appearance:d})};return Ze.default.createElement(cd,{type:l,styleOverrides:n,className:s,appearance:d},Ze.default.createElement(ls,{style:{flex:1}},Ze.default.createElement(ls,{style:{padding:"28px 0px 28px 28px",borderBottom:"1px solid #E5E5E5"}},Ze.default.createElement(md,{className:a("checklistTitle",d),appearance:d},e),Ze.default.createElement(ud,{className:a("checklistSubtitle",d),appearance:d},t),Ze.default.createElement(Qe,{total:o.length,count:O,style:{marginTop:"24px",paddingRight:"40px"},appearance:d})),Ze.default.createElement(fd,{className:a("checklistStepsContainer",d)},o.map((P,v)=>Ze.default.createElement(Yn,{data:P,index:v,key:v,listLength:o.length,isSelected:v===C,primaryColor:d.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{h(v)},appearance:d})))),Ze.default.createElement(gd,{appearance:d,className:a("checklistDivider",d)}),Ze.default.createElement(hd,null,Ze.default.createElement(F,null)))},Qr=xd;var G=u(require("react"));var Zr=u(require("react")),as=u(require("styled-components")),Cd=as.default.svg`
|
|
903
903
|
transition: 'transform 0.35s ease-in-out';
|
|
904
|
-
`,
|
|
904
|
+
`,To=({style:e,className:t})=>Zr.default.createElement(Cd,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e,className:t},Zr.default.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));var Pe=u(require("styled-components"));var Rr={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},ps=Pe.default.div`
|
|
905
905
|
max-height: 350px;
|
|
906
906
|
padding-bottom: 40px;
|
|
907
907
|
`,ds=Pe.default.div`
|
|
@@ -1037,7 +1037,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1037
1037
|
flex-direction: column;
|
|
1038
1038
|
justify-content: center;
|
|
1039
1039
|
display: flex;
|
|
1040
|
-
`;var
|
|
1040
|
+
`;var bt=u(require("react"));var St=u(require("styled-components"));var Es=St.default.div`
|
|
1041
1041
|
border: 1px solid #fafafa;
|
|
1042
1042
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
1043
1043
|
border-radius: 14px;
|
|
@@ -1045,13 +1045,13 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1045
1045
|
display: flex;
|
|
1046
1046
|
flex-direction: column;
|
|
1047
1047
|
overflow: hidden;
|
|
1048
|
-
`,As=
|
|
1048
|
+
`,As=St.default.div`
|
|
1049
1049
|
display: flex;
|
|
1050
1050
|
flex-wrap: wrap;
|
|
1051
1051
|
justify-content: space-between;
|
|
1052
1052
|
overflow: hidden;
|
|
1053
1053
|
row-gap: 10px;
|
|
1054
|
-
`,Os=
|
|
1054
|
+
`,Os=St.default.div`
|
|
1055
1055
|
${e=>A(e)} {
|
|
1056
1056
|
color: #595959;
|
|
1057
1057
|
}
|
|
@@ -1061,7 +1061,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1061
1061
|
line-height: 12px;
|
|
1062
1062
|
letter-spacing: 0.09em;
|
|
1063
1063
|
margin-bottom: 12px;
|
|
1064
|
-
`,Ns=
|
|
1064
|
+
`,Ns=St.default.div`
|
|
1065
1065
|
${e=>A(e)} {
|
|
1066
1066
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1067
1067
|
background: #ffffff;
|
|
@@ -1074,7 +1074,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1074
1074
|
|
|
1075
1075
|
max-width: 150px;
|
|
1076
1076
|
min-width: 200px;
|
|
1077
|
-
`,Is=
|
|
1077
|
+
`,Is=St.default.div`
|
|
1078
1078
|
${e=>A(e)} {
|
|
1079
1079
|
background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);
|
|
1080
1080
|
}
|
|
@@ -1086,13 +1086,13 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1086
1086
|
justify-content: center;
|
|
1087
1087
|
align-content: center;
|
|
1088
1088
|
align-items: center;
|
|
1089
|
-
`,Ls=
|
|
1089
|
+
`,Ls=St.default.div`
|
|
1090
1090
|
font-weight: 600;
|
|
1091
1091
|
font-size: 20px;
|
|
1092
1092
|
line-height: 24px;
|
|
1093
1093
|
width: 20px;
|
|
1094
1094
|
height: 20px;
|
|
1095
|
-
`,$s=
|
|
1095
|
+
`,$s=St.default.div`
|
|
1096
1096
|
${e=>A(e)} {
|
|
1097
1097
|
color: #434343;
|
|
1098
1098
|
}
|
|
@@ -1101,20 +1101,20 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1101
1101
|
line-height: 17px;
|
|
1102
1102
|
margin-top: 12px;
|
|
1103
1103
|
margin-bottom: 8px;
|
|
1104
|
-
`,Ms=
|
|
1104
|
+
`,Ms=St.default.div`
|
|
1105
1105
|
${e=>A(e)} {
|
|
1106
1106
|
color: #8c8c8c;
|
|
1107
1107
|
}
|
|
1108
1108
|
font-weight: 400;
|
|
1109
1109
|
font-size: 12px;
|
|
1110
1110
|
line-height: 14px;
|
|
1111
|
-
`,Ds=
|
|
1111
|
+
`,Ds=St.default.a`
|
|
1112
1112
|
color: ${e=>e.color};
|
|
1113
1113
|
font-size: 12px;
|
|
1114
1114
|
line-height: 14px;
|
|
1115
1115
|
font-weight: 400;
|
|
1116
1116
|
cursor: pointer;
|
|
1117
|
-
`;var yd=({steps:e,style:t,title:o,primaryColor:n,appearance:i,onButtonClick:r})=>{let{primaryCTAClickSideEffects:s}=
|
|
1117
|
+
`;var yd=({steps:e,style:t,title:o,primaryColor:n,appearance:i,onButtonClick:r})=>{let{primaryCTAClickSideEffects:s}=ge();return bt.default.createElement(Es,{style:t,className:a("guideContainer",i)},bt.default.createElement(Os,{className:a("guideTitle",i)},o),bt.default.createElement(As,{className:a("guideItemContainer",i)},e.map((p,d)=>{var l;return bt.default.createElement(Ns,{key:`guide-${(l=p.id)!=null?l:d}`,className:a("guideItem",i)},p.icon&&bt.default.createElement(Is,{className:a("guideIcon",i)},bt.default.createElement(Ls,null,p.icon)),bt.default.createElement($s,{className:a("guideItemTitle",i),dangerouslySetInnerHTML:ue(p.title)}),bt.default.createElement(Ms,{className:a("guideItemSubtitle",i),dangerouslySetInnerHTML:ue(p.subtitle)}),bt.default.createElement(Ds,{className:a("guideItemLink",i),color:n,onClick:()=>{p.primaryButtonUri&&s(p),r&&r(p)}},p.primaryButtonTitle))})))},Jo=yd;var Sd=({steps:e,title:t,subtitle:o,stepsTitle:n,visible:i,onClose:r,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:l,guideData:m,guideTitle:c,onGuideButtonClick:g})=>{let y=({stepData:f,handleSecondaryCTAClick:$,handleCTAClick:b})=>f?G.default.createElement(Cs,{className:a("checklistStepContainer",l),"data-testid":"checklistStepContainer"},G.default.createElement(ys,{appearance:l,className:a("checklistStepTitle",l),dangerouslySetInnerHTML:ue(f.title)}),G.default.createElement(Ss,{appearance:l,className:a("checklistStepSubtitle",l),dangerouslySetInnerHTML:ue(f.subtitle)}),G.default.createElement(bs,{className:a("checklistCTAContainer",l)},f.secondaryButtonTitle&&G.default.createElement(le,{title:f.secondaryButtonTitle,onClick:$,appearance:l,secondary:!0}),G.default.createElement(le,{title:f.primaryButtonTitle,onClick:b,appearance:l}))):G.default.createElement(G.default.Fragment,null),C=w(w({},{default:f=>{var D;if((D=e[F])!=null&&D.StepContent){let N=e[F].StepContent;return G.default.createElement("div",null,N)}let $=e[F];return G.default.createElement(y,{stepData:f,handleCTAClick:()=>{$.handlePrimaryButtonClick&&$.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{$.handleSecondaryButtonClick&&$.handleSecondaryButtonClick()}})}}),d),[h,O]=(0,G.useState)(0),F=s!=null?s:h,P=p!=null?p:O,v=()=>{var f;return e?!((f=e[F])!=null&&f.type)||!C[e[F].type]?C.default(e[F]):typeof C[e[F].type]!="function"?C[e[F].type]:C[e[F].type]({stepData:e[F],primaryColor:l.theme.colorPrimary}):G.default.createElement(G.default.Fragment,null)},B=e.filter(f=>f.complete).length;return i?(l.theme.modalContainer||(l.theme.borderRadius&&(Rr.borderRadius=l.theme.borderRadius+"px"),l.theme.modalContainer=Rr),G.default.createElement(gt,{onClose:r,visible:i,appearance:l},G.default.createElement(Ps,null,G.default.createElement(ds,null,G.default.createElement(cs,{appearance:l,className:a("checklistTitle",l)},t),G.default.createElement(ms,{appearance:l,className:a("checklistSubtitle",l)},o)),G.default.createElement(ps,null,e&&e.length>0&&G.default.createElement(us,{className:a("stepsContainer",l)},G.default.createElement(fs,null,G.default.createElement("div",{style:{flex:3}},G.default.createElement(gs,{className:a("stepsTitle",l)},n)),G.default.createElement(ks,null,G.default.createElement(Qe,{style:{width:"100%"},count:B,total:e.length,appearance:l}))),G.default.createElement(hs,null,G.default.createElement(xs,{className:a("checklistStepListContainer",l),appearance:l},e.map((f,$)=>{var k;let b=F===$;return G.default.createElement(ws,{selected:b,className:a(`checklistStepListItem${b?"Selected":""}`,l),key:`checklist-guide-step-${(k=f.id)!=null?k:$}`,disabled:f.blocked,onClick:()=>{f.blocked||P($)},title:f.blocked?"Finish remaining steps to continue":void 0},b&&G.default.createElement(kr,{className:a("checklistStepItemSelectedIndicator",l),layoutId:"checklist-step-selected",style:{backgroundColor:l.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),G.default.createElement(Ts,{selected:b,className:a(`checklistStepListStepName${b?"Selected":""}`,l)},f.stepName),G.default.createElement(Fs,null,G.default.createElement(xt,{value:f.complete,type:"round",primaryColor:l.theme.colorPrimary,progress:f.progress,appearance:l}),G.default.createElement(Bs,null,G.default.createElement(To,{style:{marginLeft:"10px"},color:l.theme.colorBackgroundSecondary}))))})),G.default.createElement(v,null))),m&&m.length>0&&G.default.createElement(Jo,{steps:m,title:c,primaryColor:l.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:l,onButtonClick:f=>(g&&g(f),!0)}))))):G.default.createElement(G.default.Fragment,null)},ei=Sd;var xe=u(require("react"));var Le=u(require("react"));var wt=u(require("styled-components")),Us=wt.default.div`
|
|
1118
1118
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1119
1119
|
border: 1px solid;
|
|
1120
1120
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -1126,19 +1126,19 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1126
1126
|
display: flex;
|
|
1127
1127
|
flex-direction: column;
|
|
1128
1128
|
transition: max-height 0.25s;
|
|
1129
|
-
`,Ws=
|
|
1129
|
+
`,Ws=wt.default.div`
|
|
1130
1130
|
display: flex;
|
|
1131
1131
|
margin-bottom: 20px;
|
|
1132
|
-
`,zs=
|
|
1132
|
+
`,zs=wt.default.img`
|
|
1133
1133
|
border-radius: 4px;
|
|
1134
1134
|
max-height: 260px;
|
|
1135
1135
|
min-height: 200px;
|
|
1136
|
-
`,_s=
|
|
1136
|
+
`,_s=wt.default.div`
|
|
1137
1137
|
display: flex;
|
|
1138
1138
|
flex-direction: row;
|
|
1139
1139
|
justify-content: space-between;
|
|
1140
1140
|
align-items: center;
|
|
1141
|
-
`,Hs=
|
|
1141
|
+
`,Hs=wt.default.p`
|
|
1142
1142
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1143
1143
|
font-style: normal;
|
|
1144
1144
|
font-weight: 500;
|
|
@@ -1149,23 +1149,23 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1149
1149
|
:hover {
|
|
1150
1150
|
opacity: 0.8;
|
|
1151
1151
|
}
|
|
1152
|
-
`,Vs=
|
|
1152
|
+
`,Vs=wt.default.div`
|
|
1153
1153
|
cursor: pointer;
|
|
1154
1154
|
color: ${e=>e.appearance.theme.colorTextSecondary};
|
|
1155
1155
|
:hover {
|
|
1156
1156
|
opacity: 0.8;
|
|
1157
1157
|
}
|
|
1158
|
-
`,Qh=
|
|
1158
|
+
`,Qh=wt.default.div``,js=wt.default.p`
|
|
1159
1159
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1160
1160
|
font-weight: 400;
|
|
1161
1161
|
font-size: 14px;
|
|
1162
1162
|
line-height: 22px;
|
|
1163
|
-
`,Gs=
|
|
1163
|
+
`,Gs=wt.default.div`
|
|
1164
1164
|
display: flex;
|
|
1165
1165
|
flex-direction: row;
|
|
1166
1166
|
justify-content: flex-start;
|
|
1167
1167
|
align-items: center;
|
|
1168
|
-
`;var Ks=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:n,onSecondaryButtonClick:i,appearance:r,customStepTypes:s})=>{var c,g;let p=t?{}:{transform:"rotate(90deg)"},d=t?{overflow:"hidden",maxHeight:"0px",transition:"max-height 0.35s ease-out"}:{overflow:"hidden",maxHeight:"1000px",transition:"max-height 0.7s ease-out"};function l(){var y;return Le.default.createElement(Le.default.Fragment,null,e.imageUri||e.videoUri?Le.default.createElement(Ws,{className:a("stepMediaContainer",r)},e.imageUri?Le.default.createElement(zs,{className:a("stepImage",r),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Le.default.createElement(
|
|
1168
|
+
`;var Ks=({stepData:e,collapsed:t,onClick:o,onPrimaryButtonClick:n,onSecondaryButtonClick:i,appearance:r,customStepTypes:s})=>{var c,g;let p=t?{}:{transform:"rotate(90deg)"},d=t?{overflow:"hidden",maxHeight:"0px",transition:"max-height 0.35s ease-out"}:{overflow:"hidden",maxHeight:"1000px",transition:"max-height 0.7s ease-out"};function l(){var y;return Le.default.createElement(Le.default.Fragment,null,e.imageUri||e.videoUri?Le.default.createElement(Ws,{className:a("stepMediaContainer",r)},e.imageUri?Le.default.createElement(zs,{className:a("stepImage",r),src:e.imageUri,style:e.imageStyle}):null,e.videoUri?Le.default.createElement(Ct,{appearance:r,videoUri:e.videoUri}):null):null,Le.default.createElement(js,{className:a("stepSubtitle",r),appearance:r,dangerouslySetInnerHTML:ue(e.subtitle)}),Le.default.createElement(fr,{className:a("checklistCTAContainer",r)},e.secondaryButtonTitle?Le.default.createElement(le,{secondary:!0,title:e.secondaryButtonTitle,onClick:()=>i(),appearance:r}):null,Le.default.createElement(le,{title:(y=e.primaryButtonTitle)!=null?y:"Continue",onClick:()=>n(),appearance:r})))}function m(){if(!s)return null;let y=s[e.type];return y?typeof y!="function"?y:y(e,r):null}return Le.default.createElement(Us,{"data-testid":`step-${e.id}`,className:a("checklistStepContainer",r),appearance:r},Le.default.createElement(_s,{className:a("stepHeader",r)},Le.default.createElement(Gs,null,Le.default.createElement(Fr,{value:e.complete,style:{width:"auto",borderTop:0},primaryColor:(c=r==null?void 0:r.theme)==null?void 0:c.colorPrimary,appearance:r}),Le.default.createElement(Hs,{appearance:r,className:a("stepTitle",r),dangerouslySetInnerHTML:ue(e.title),onClick:()=>o()})),Le.default.createElement(Vs,{className:a("stepChevronContainer",r),onClick:()=>o(),appearance:r},Le.default.createElement(To,{style:q(w({},p),{transition:"transform 0.2s ease-in-out"})}))),Le.default.createElement("div",{key:e.id,style:w({},d)},(g=m())!=null?g:l()))};var Qt=u(require("styled-components")),px=Qt.default.div`
|
|
1169
1169
|
background: #ffffff;
|
|
1170
1170
|
box-shadow: 0px 6px 25px rgba(0, 0, 0, 0.06);
|
|
1171
1171
|
border-radius: 6px;
|
|
@@ -1179,26 +1179,26 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1179
1179
|
|
|
1180
1180
|
max-width: 800px;
|
|
1181
1181
|
min-width: 350px;
|
|
1182
|
-
`,qs=
|
|
1182
|
+
`,qs=Qt.default.div`
|
|
1183
1183
|
display: flex;
|
|
1184
1184
|
flex-direction: column;
|
|
1185
|
-
`,Ys=
|
|
1185
|
+
`,Ys=Qt.default.h1`
|
|
1186
1186
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
1187
1187
|
font-style: normal;
|
|
1188
1188
|
font-weight: 700;
|
|
1189
1189
|
font-size: 20px;
|
|
1190
1190
|
line-height: 24px;
|
|
1191
1191
|
margin-bottom: 8px;
|
|
1192
|
-
`,Js=
|
|
1192
|
+
`,Js=Qt.default.h2`
|
|
1193
1193
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
1194
1194
|
font-weight: 400;
|
|
1195
1195
|
font-size: 14px;
|
|
1196
1196
|
line-height: 23px;
|
|
1197
1197
|
margin: 2px 0 0 0;
|
|
1198
|
-
`,Xs=
|
|
1198
|
+
`,Xs=Qt.default.div`
|
|
1199
1199
|
display: block;
|
|
1200
1200
|
width: 100%;
|
|
1201
|
-
`,Qs=
|
|
1201
|
+
`,Qs=Qt.default.div`
|
|
1202
1202
|
display: flex;
|
|
1203
1203
|
width: 100%;
|
|
1204
1204
|
flex-direction: column;
|
|
@@ -1206,23 +1206,23 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1206
1206
|
padding: 24px;
|
|
1207
1207
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
1208
1208
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1209
|
-
`;var bd=({title:e,subtitle:t,steps:o,onClose:n,visible:i,autoExpandFirstIncompleteStep:r=!0,autoCollapse:s=!0,autoExpandNextStep:p=!0,selectedStep:d,setSelectedStep:l,appearance:m,type:c,className:g,customStepTypes:y,style:T})=>{let C=o.filter(B=>B.complete).length,[h,O]=(0,
|
|
1209
|
+
`;var bd=({title:e,subtitle:t,steps:o,onClose:n,visible:i,autoExpandFirstIncompleteStep:r=!0,autoCollapse:s=!0,autoExpandNextStep:p=!0,selectedStep:d,setSelectedStep:l,appearance:m,type:c,className:g,customStepTypes:y,style:T})=>{let C=o.filter(B=>B.complete).length,[h,O]=(0,xe.useState)(Array(o.length).fill(!0));(0,xe.useEffect)(()=>{let B=[...h];if(r){for(let f=0;f<o.length;f++)if(!o[f].complete){B[f]=!1;break}O(B)}},[]),(0,xe.useEffect)(()=>{r&&F(d)},[d]),(0,xe.useEffect)(()=>{p&&h[d]&&F(d)},[d]),(0,xe.useEffect)(()=>{},[o]);let F=B=>{let f=[...h];if(s)for(let $=0;$<h.length;++$)$!=B&&f[B]&&(f[$]=!0);f[B]=!h[B],O(f)};if(!i&&c=="modal")return xe.default.createElement(xe.default.Fragment,null);let P=xe.default.createElement(xe.default.Fragment,null,xe.default.createElement(qs,null,xe.default.createElement(Ys,{appearance:m,className:a("checklistTitle",m),dangerouslySetInnerHTML:ue(e)}),xe.default.createElement(Js,{appearance:m,className:a("checklistSubtitle",m),dangerouslySetInnerHTML:ue(t)})),xe.default.createElement(Qe,{display:"percent",count:C,total:o.length,style:{margin:"14px 0px 8px 0px"},appearance:m})),v=xe.default.createElement(Xs,{className:Me(a("checklistContainer",m),g)},o.map((B,f)=>{var b;let $=h[f];return xe.default.createElement(Ks,{appearance:m,stepData:B,collapsed:$,key:`modal-checklist-${(b=B.id)!=null?b:f}`,onClick:()=>{d==f?F(f):l(f)},onPrimaryButtonClick:()=>{p&&f<o.length-1&&l(f+1),B.handlePrimaryButtonClick&&B.handlePrimaryButtonClick()},onSecondaryButtonClick:()=>{B.handleSecondaryButtonClick&&B.handleSecondaryButtonClick()},customStepTypes:y})}));return c==="inline"?xe.default.createElement(Qs,{appearance:m,className:Me(a("checklistInlineContainer",m),g),style:T},P,v):xe.default.createElement(xe.default.Fragment,null,xe.default.createElement(gt,{onClose:n,visible:i,appearance:m,style:{maxWidth:"600px"},headerContent:P},v))},ti=bd;var Y=u(require("react"));var Br=require("react"),Zs=()=>{let e={isSmall:"(max-width: 480px)",isMedium:"(min-width: 481px) AND (max-width: 1023px)",isLarge:"(min-width: 1025px)"},t=Object.fromEntries(Object.entries(e).map(([p])=>[p,!1])),[o,n]=(0,Br.useState)(t),i=null,r=()=>{i!==null?clearTimeout(i):s(),i=setTimeout(()=>{s()},16)},s=()=>{let p=Object.fromEntries(Object.entries(e).map(([d,l])=>{if(!window)return[d,!1];let m=window.matchMedia(l);return m.addEventListener("change",r),[d,m.matches]}));n(p)};return(0,Br.useEffect)(()=>{s()},[]),o};var Zt=u(require("react"));var oe=u(require("styled-components"));var Rs=oe.css`
|
|
1210
1210
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1211
|
-
`,wd=
|
|
1211
|
+
`,wd=oe.css`
|
|
1212
1212
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
1213
|
-
`,Td=
|
|
1213
|
+
`,Td=oe.keyframes`
|
|
1214
1214
|
from {
|
|
1215
1215
|
opacity: 0;
|
|
1216
1216
|
} to {
|
|
1217
1217
|
opacity: 1;
|
|
1218
1218
|
}
|
|
1219
|
-
`,Fd=
|
|
1219
|
+
`,Fd=oe.keyframes`
|
|
1220
1220
|
from {
|
|
1221
1221
|
opacity: 1;
|
|
1222
1222
|
} to {
|
|
1223
1223
|
opacity: 0;
|
|
1224
1224
|
}
|
|
1225
|
-
`,el=
|
|
1225
|
+
`,el=oe.default.div`
|
|
1226
1226
|
margin: 0 -20px;
|
|
1227
1227
|
overflow-x: auto;
|
|
1228
1228
|
padding-left: 20px;
|
|
@@ -1239,13 +1239,13 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1239
1239
|
::-webkit-scrollbar {
|
|
1240
1240
|
display: none;
|
|
1241
1241
|
}
|
|
1242
|
-
`,tl=
|
|
1242
|
+
`,tl=oe.default.div`
|
|
1243
1243
|
display: flex;
|
|
1244
1244
|
flex-flow: row nowrap;
|
|
1245
1245
|
gap: 0 16px;
|
|
1246
1246
|
scroll-snap-align: center;
|
|
1247
1247
|
scroll-snap-stop: always;
|
|
1248
|
-
`,ol=
|
|
1248
|
+
`,ol=oe.default.div`
|
|
1249
1249
|
animation: ${e=>e.reversed?Fd:Td} 0.25s ease-out;
|
|
1250
1250
|
background: linear-gradient(
|
|
1251
1251
|
to right,
|
|
@@ -1255,7 +1255,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1255
1255
|
position: absolute;
|
|
1256
1256
|
width: 64px;
|
|
1257
1257
|
z-index: 10;
|
|
1258
|
-
`,rl=
|
|
1258
|
+
`,rl=oe.default.button`
|
|
1259
1259
|
${Rs}
|
|
1260
1260
|
box-shadow: 0 3px 10px 0 rgba(0, 0, 0, 0.1);
|
|
1261
1261
|
align-items: center;
|
|
@@ -1267,10 +1267,10 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1267
1267
|
justify-content: center;
|
|
1268
1268
|
position: absolute;
|
|
1269
1269
|
width: 48px;
|
|
1270
|
-
`,il=
|
|
1270
|
+
`,il=oe.default.div`
|
|
1271
1271
|
border-radius: ${({theme:e})=>e.borderRadius}px;
|
|
1272
1272
|
padding: 20px;
|
|
1273
|
-
`,nl=(0,
|
|
1273
|
+
`,nl=(0,oe.default)(il)`
|
|
1274
1274
|
${Rs}
|
|
1275
1275
|
background: ${({theme:e})=>e.colorBackground};
|
|
1276
1276
|
position: relative;
|
|
@@ -1283,72 +1283,72 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1283
1283
|
${e=>e.blocked?"":`border: 1px solid ${e.theme.colorPrimary};`}
|
|
1284
1284
|
${e=>e.blocked?"cursor: default":"cursor: pointer"}
|
|
1285
1285
|
}
|
|
1286
|
-
`,sl=
|
|
1286
|
+
`,sl=oe.default.img`
|
|
1287
1287
|
border-radius: 50%;
|
|
1288
1288
|
height: 40px;
|
|
1289
1289
|
margin-bottom: 12px;
|
|
1290
1290
|
width: 40px;
|
|
1291
|
-
`,ll=(0,
|
|
1291
|
+
`,ll=(0,oe.default)(il)`
|
|
1292
1292
|
${e=>A(e)} {
|
|
1293
1293
|
${wd}
|
|
1294
1294
|
|
|
1295
1295
|
background: ${({theme:e})=>e.colorBackground};
|
|
1296
1296
|
}
|
|
1297
|
-
`,Tx=
|
|
1297
|
+
`,Tx=oe.default.div`
|
|
1298
1298
|
color: ${({theme:e})=>e.colorPrimary};
|
|
1299
1299
|
display: flex;
|
|
1300
1300
|
flex-flow: row nowrap;
|
|
1301
1301
|
align-items: center;
|
|
1302
|
-
`,Fx=
|
|
1302
|
+
`,Fx=oe.default.div`
|
|
1303
1303
|
white-space: nowrap;
|
|
1304
|
-
`,al=
|
|
1304
|
+
`,al=oe.default.div`
|
|
1305
1305
|
background: #d8fed8;
|
|
1306
1306
|
border-radius: 6px;
|
|
1307
1307
|
float: right;
|
|
1308
1308
|
margin-bottom: 12px;
|
|
1309
1309
|
padding: 4px 10px;
|
|
1310
|
-
`,kd=
|
|
1310
|
+
`,kd=oe.default.p`
|
|
1311
1311
|
font-weight: bold;
|
|
1312
1312
|
font-size: 18px;
|
|
1313
1313
|
line-height: 22px;
|
|
1314
1314
|
letter-spacing: calc(18px * -0.01);
|
|
1315
1315
|
margin: 0;
|
|
1316
|
-
`,pl=(0,
|
|
1316
|
+
`,pl=(0,oe.default)(kd)`
|
|
1317
1317
|
margin-bottom: 4px;
|
|
1318
|
-
`,dl=
|
|
1318
|
+
`,dl=oe.default.div`
|
|
1319
1319
|
display: flex;
|
|
1320
1320
|
flex-flow: row nowrap;
|
|
1321
1321
|
align-items: center;
|
|
1322
1322
|
min-width: 50%;
|
|
1323
|
-
`,Pd=
|
|
1323
|
+
`,Pd=oe.default.p`
|
|
1324
1324
|
font-weight: bold;
|
|
1325
1325
|
font-size: 16px;
|
|
1326
1326
|
line-height: 20px;
|
|
1327
1327
|
letter-spacing: calc(16px * -0.01);
|
|
1328
1328
|
margin: 0;
|
|
1329
|
-
`,cl=(0,
|
|
1329
|
+
`,cl=(0,oe.default)(Pd)`
|
|
1330
1330
|
margin-bottom: 4px;
|
|
1331
1331
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1332
1332
|
`}
|
|
1333
|
-
`,
|
|
1333
|
+
`,_t=oe.default.p`
|
|
1334
1334
|
color: ${({theme:e})=>e.colorText};
|
|
1335
1335
|
font-weight: normal;
|
|
1336
1336
|
font-size: 14px;
|
|
1337
1337
|
line-height: 22px;
|
|
1338
1338
|
margin: 0;
|
|
1339
|
-
`,ml=
|
|
1339
|
+
`,ml=oe.default.p`
|
|
1340
1340
|
color: ${({theme:e})=>e.colorText};
|
|
1341
1341
|
font-weight: 600;
|
|
1342
1342
|
font-size: 12px;
|
|
1343
1343
|
line-height: 16px;
|
|
1344
1344
|
margin: 0;
|
|
1345
|
-
`;
|
|
1345
|
+
`;_t.Loud=(0,oe.default)(_t)`
|
|
1346
1346
|
font-weight: 600;
|
|
1347
|
-
`;
|
|
1347
|
+
`;_t.Quiet=(0,oe.default)(_t)`
|
|
1348
1348
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1349
1349
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1350
1350
|
`}
|
|
1351
|
-
`;var ul=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:n}=
|
|
1351
|
+
`;var ul=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:n}=se(),{primaryCTAClickSideEffects:i}=ge();o=n(o);let{imageUri:r=null,subtitle:s=null,title:p=null,complete:d=!1,blocked:l=!1}=e,m=e.primaryButtonTitle||e.secondaryButtonTitle,c=()=>{i(e)};return Zt.default.createElement(nl,{className:a("carouselCard",o),onClick:l?null:c,style:t,blocked:l,complete:d},r&&Zt.default.createElement(sl,{className:a("carouselCardImage",o),src:r,alt:p,style:{opacity:d||l?.4:1}}),d&&Zt.default.createElement(al,{className:a("carouselCompletedPill",o)},Zt.default.createElement(ml,{style:{color:"#108E0B"}},"Complete")),p&&Zt.default.createElement(cl,{blocked:l,complete:d,className:a("carouselCardTitle",o)},p),s&&Zt.default.createElement(_t.Quiet,{blocked:l,complete:d,className:a("carouselCardSubtitle",o)},s))};var vd=()=>Y.default.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y.default.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),Y.default.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),Y.default.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),fl=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[n,i]=(0,Y.useState)(!1),[r,s]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{t===!0&&n===!1?i(!0):t===!1&&n===!0&&s(!0)},[t]);let p=()=>{i(!1),s(!1)},d=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return n?Y.default.createElement(ol,{style:d,reversed:r,onAnimationEnd:r?p:null},Y.default.createElement(rl,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},Y.default.createElement(vd,null))):null},gl=({flowId:e,appearance:t,customVariables:o,className:n})=>{let i=(0,Y.useRef)(null),[r,s]=(0,Y.useState)(!1),[p,d]=(0,Y.useState)(!1),[l,m]=(0,Y.useState)(null),[c,g]=(0,Y.useState)([]),[y,T]=(0,Y.useState)(0),{isSmall:C}=Zs(),h=C?1:3,{getFlowMetadata:O,getFlowSteps:F,getNumberOfStepsCompleted:P,updateCustomVariables:v,isLoading:B}=Q();(0,Y.useEffect)(()=>{v(o)},[o,B]),(0,Y.useEffect)(()=>{if(B)return;let N=O(e),L=P(e),K=F(e);m(N),(N.data!==null||N.steps!==null)&&(g(K.sort((_,J)=>Number(_.complete)-Number(J.complete))),d(K.length>h),T(L))},[B]);let f=[];for(let N=0;N<c.length;N+=h)f.push(c.slice(N,N+h));let $=N=>{let L=N.target,K=L.scrollWidth-L.clientWidth,_=Math.ceil(L.scrollLeft);_>0&&r===!1&&s(!0),_===0&&r===!0&&s(!1),_<K&&p===!1&&d(!0),_===K&&p===!0&&d(!1)},b=(N=!0)=>{let L=N?1:-1;i.current!==null&&i.current.scrollBy({left:i.current.clientWidth*L,behavior:"smooth"})},k=null,D=N=>{k!==null?clearTimeout(k):$(N),k=setTimeout(()=>{$(N)},16)};return B?null:Y.default.createElement(ll,{className:Me(a("carouselContainer",t),n)},Y.default.createElement("div",{style:{display:"flex",justifyContent:C?"center":"space-between",marginBottom:20,flexWrap:C?"wrap":"nowrap",gap:C?16:20}},Y.default.createElement("div",null,Y.default.createElement(pl,{className:a("carouselTitle",t)},l==null?void 0:l.title),Y.default.createElement(_t.Quiet,{className:a("carouselSubtitle",t)},l==null?void 0:l.subtitle)),Y.default.createElement(dl,{className:a("progressWrapper",t)},Y.default.createElement(Qe,{count:y,total:c.length,appearance:t}))),Y.default.createElement("div",{style:{position:"relative"}},Y.default.createElement(fl,{show:r,onClick:()=>b(!1)}),Y.default.createElement(fl,{side:"right",show:p,onClick:b}),Y.default.createElement(el,{ref:i,onScroll:D},f.map((N,L)=>Y.default.createElement(tl,{key:L,style:{flex:`0 0 calc(100% - ${c.length>h?36:0}px)`}},N.map((K,_)=>Y.default.createElement(ul,{key:_,stepData:K,style:{flex:c.length>h?`0 1 calc(100% / ${h} - 16px * 2 / ${h})`:1},appearance:t})))))),Y.default.createElement(de,{appearance:t}))};var Er=v=>{var B=v,{flowId:e,title:t,subtitle:o,style:n,initialSelectedStep:i,className:r,type:s="inline",onDismiss:p,visible:d,customVariables:l,onStepCompletion:m,onButtonClick:c,appearance:g,hideOnFlowCompletion:y,setVisible:T,customStepTypes:C,checklistStyle:h="default",autoExpandFirstIncompleteStep:O,autoExpandNextStep:F}=B,P=Ye(B,["flowId","title","subtitle","style","initialSelectedStep","className","type","onDismiss","visible","customVariables","onStepCompletion","onButtonClick","appearance","hideOnFlowCompletion","setVisible","customStepTypes","checklistStyle","autoExpandFirstIncompleteStep","autoExpandNextStep"]);let{getFlow:f,getFlowSteps:$,markStepCompleted:b,getStepStatus:k,getNumberOfStepsCompleted:D,isLoading:N,targetingLogicShouldHideFlow:L,updateCustomVariables:K,getFlowMetadata:_,isStepBlocked:J,getFlowStatus:R,hasActiveFullPageFlow:Ce,setHasActiveFullPageFlow:j,markStepStarted:me,getCurrentStepIndex:be}=Q(),{primaryCTAClickSideEffects:$e,secondaryCTAClickSideEffects:ae}=ge(),{getOpenFlowState:re,setOpenFlowState:Te}=ze(),[W,Ee]=(0,te.useState)(i||0),[Fe,We]=(0,te.useState)(!1),je=d===void 0?re(e):d,Ae=s==="modal",{mergeAppearanceWithDefault:V}=se();lt(e,d);let M=$(e),H=be(e);if(g=V(g),(0,te.useEffect)(()=>{K(l)},[l,N]),(0,te.useEffect)(()=>{d!==void 0&&(Ae&&d===!0?j(!0):Ae&&d===!1&&j(!1))},[d,T,Ce]),(0,te.useEffect)(()=>{!N&&M&&M[W]&&k(e,M[W].id)&&k(e,M[W].id)!==Je&&me(e,M[W].id)},[W]),(0,te.useEffect)(()=>{W!==H&&Ee(H)},[H]),N)return null;let ie=f(e);if(!ie||L(ie)||!M||y===!0&&R(e)===ne)return null;let ye=_(e);if(ye!=null&&ye.title&&(t=ye.title),ye!=null&&ye.subtitle&&(o=ye.subtitle),!Fe&&i===void 0&&D(e)>0){let I=M.findIndex(pe=>pe.complete===!1);Ee(I>-1?I:M.length-1),We(!0)}function Ft(){if(W+1>=M.length){Ae&&Te(e,!1);return}J(e,M[W+1].id)||Ee(W+1)}function kt(I,pe,rt){let Re=W+1<M.length?M[W+1]:null;c&&c(I,W,pe,Re)===!0&&Ae&&mt(),m&&m(I,rt,Re),!m&&!c&&(I.primaryButtonUri||I.secondaryButtonUri)&&Ae&&mt()}function eo(){return M.map((I,pe)=>q(w({},I),{handleSecondaryButtonClick:()=>{Ft(),ae(I),I.skippable===!0&&b(e,I.id,{skipped:!0}),kt(I,"secondary",pe)},handlePrimaryButtonClick:()=>{(!I.completionCriteria&&(I.autoMarkCompleted||I.autoMarkCompleted===void 0)||I.completionCriteria&&I.autoMarkCompleted===!0)&&(b(e,I.id),Ft()),kt(I,"primary",pe),$e(I),k(e,I.id)===Je&&Ft()}}))}function pt(){return te.default.createElement(de,{appearance:g})}let Nt={steps:eo(),title:t,subtitle:o,primaryColor:g.theme.colorPrimary,appearance:g,customStepTypes:C,type:s,className:r,autoExpandFirstIncompleteStep:O,autoExpandNextStep:F};function mt(){Te(e,!1),p&&p(),T&&T(!1)}function to(){return te.default.createElement(te.default.Fragment,null,te.default.createElement(pt,null),te.default.createElement(gl,{flowId:e,appearance:g,customVariables:l,className:r}))}function x(){return te.default.createElement(te.default.Fragment,null,te.default.createElement(pt,null),te.default.createElement(ti,w({visible:je,onClose:()=>{mt()},selectedStep:W,setSelectedStep:Ee,autoExpandNextStep:!0,appearance:g},Nt)))}function S(){var rt;let I=P.guideFlowId,pe;return I&&f(I)&&(pe=$(I)),te.default.createElement(te.default.Fragment,null,te.default.createElement(pt,null),te.default.createElement(ei,w({visible:je,stepsTitle:ye.stepsTitle?ye.stepsTitle:"Your quick start guide",onClose:()=>{mt()},selectedStep:W,setSelectedStep:Ee,guideData:pe,guideTitle:(rt=P.guideTitle)!=null?rt:"Guide",appearance:g,title:t,subtitle:o,onGuideButtonClick:Re=>{kt(Re,"link",0)},customStepTypes:C},Nt)))}function E(){let I=te.default.createElement(Qr,w({flowId:e,style:n,selectedStep:W,setSelectedStep:Ee,appearance:g,type:s},Nt));return Ae?te.default.createElement(gt,{onClose:()=>{mt()},visible:je,appearance:g,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},te.default.createElement(pt,null),I):te.default.createElement(te.default.Fragment,null,te.default.createElement(pt,null),I)}switch(h){case"condensed":return x();case"with-guide":return S();case"default":return E();case"carousel":return to();default:return E()}};var xl=e=>hl.default.createElement(Er,w({type:"inline"},e));var ct=u(require("react"));var dt=u(require("react"));var Xo=u(require("styled-components"));var Cl=Xo.default.div`
|
|
1352
1352
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1353
1353
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1354
1354
|
padding: 10px 12px 10px 12px;
|
|
@@ -1360,27 +1360,27 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1360
1360
|
&:hover {
|
|
1361
1361
|
filter: brightness(.99);
|
|
1362
1362
|
}
|
|
1363
|
-
`,yl=
|
|
1363
|
+
`,yl=Xo.default.div`
|
|
1364
1364
|
display: flex;
|
|
1365
1365
|
flex-direction: row;
|
|
1366
1366
|
justify-content: space-between;
|
|
1367
1367
|
align-items: center;
|
|
1368
1368
|
margin-bottom: ${e=>e.type==="condensed"?"0":"6px"};
|
|
1369
1369
|
flex-grow: 2;
|
|
1370
|
-
`,Sl=
|
|
1370
|
+
`,Sl=Xo.default.div`
|
|
1371
1371
|
text-overflow: ellipsis;
|
|
1372
1372
|
font-weight: 600;
|
|
1373
1373
|
font-size: 14px;
|
|
1374
1374
|
line-height: 16px;
|
|
1375
1375
|
margin-right: ${e=>e.type==="condensed"?"8px":"0"};
|
|
1376
1376
|
text-align: ${e=>e.type==="condensed"?"left":"right"};
|
|
1377
|
-
`,bl=
|
|
1377
|
+
`,bl=Xo.default.div`
|
|
1378
1378
|
width: 20px;
|
|
1379
1379
|
margin-right: 8px;
|
|
1380
1380
|
display: flex;
|
|
1381
1381
|
height: 100%;
|
|
1382
1382
|
align-items: center;
|
|
1383
|
-
`;var wl=({title:e,count:t,total:o,onClick:n,style:i={},className:r,appearance:s,type:p="default"})=>
|
|
1383
|
+
`;var wl=({title:e,count:t,total:o,onClick:n,style:i={},className:r,appearance:s,type:p="default"})=>dt.default.createElement(dt.default.Fragment,null,dt.default.createElement(de,{appearance:s}),dt.default.createElement(Cl,{onClick:()=>n!==void 0&&n(),styleOverrides:w(w({},p=="condensed"?{display:"flex",justifyContent:"space-between"}:{}),i),className:Me(r!=null?r:"",a("progressBadgeContainer",s)),appearance:s},p=="condensed"&&o&&o!==0&&dt.default.createElement(bl,{className:a("progressRingContainer",s)},dt.default.createElement(Kt,{size:19,percentage:t/o,fillColor:s.theme.colorPrimary,bgColor:s.theme.colorBackgroundSecondary})),dt.default.createElement(yl,{type:p,className:a("badgeTitleContainer",s)},dt.default.createElement(Sl,{type:p,appearance:s,className:a("badgeTitle",s)},e),n!==void 0&&dt.default.createElement(To,{className:a("badgeChevron",s),color:s.theme.colorPrimary})),p=="default"&&o&&o!==0&&dt.default.createElement(Qe,{display:"compact",count:t,total:o,bgColor:s.theme.colorBackgroundSecondary,style:{width:"100%"},appearance:s,textStyle:{color:"#818898"}})));var Ot=u(require("react"));var Fo=u(require("styled-components"));var Tl=Fo.default.div`
|
|
1384
1384
|
display: flex;
|
|
1385
1385
|
flex-direction: row;
|
|
1386
1386
|
width: 100%;
|
|
@@ -1390,25 +1390,25 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1390
1390
|
background-color: ${e=>e.appearance.theme.colorBackground};
|
|
1391
1391
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1392
1392
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1393
|
-
`,Fl=
|
|
1393
|
+
`,Fl=Fo.default.div`
|
|
1394
1394
|
${e=>A(e)} {
|
|
1395
1395
|
display: flex;
|
|
1396
1396
|
justify-content: center;
|
|
1397
1397
|
align-items: center;
|
|
1398
1398
|
margin-right: 16px;
|
|
1399
1399
|
}
|
|
1400
|
-
`,kl=
|
|
1400
|
+
`,kl=Fo.default.div`
|
|
1401
1401
|
display: flex;
|
|
1402
1402
|
flex-direction: column;
|
|
1403
1403
|
flex: 1;
|
|
1404
1404
|
margin-top: 0;
|
|
1405
|
-
`,Pl=
|
|
1405
|
+
`,Pl=Fo.default.div`
|
|
1406
1406
|
display: flex;
|
|
1407
1407
|
flex-direction: column;
|
|
1408
1408
|
justify-content: center;
|
|
1409
1409
|
margin-left: 16px;
|
|
1410
1410
|
min-width: 200px;
|
|
1411
|
-
`,yC=
|
|
1411
|
+
`,yC=Fo.default.div`
|
|
1412
1412
|
display: flex;
|
|
1413
1413
|
justify-content: center;
|
|
1414
1414
|
align-items: flex-end;
|
|
@@ -1417,7 +1417,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1417
1417
|
:hover {
|
|
1418
1418
|
opacity: 0.8;
|
|
1419
1419
|
}
|
|
1420
|
-
`;var vl=({title:e,subtitle:t,icon:o,appearance:n,count:i,total:r,className:s,style:p})=>
|
|
1420
|
+
`;var vl=({title:e,subtitle:t,icon:o,appearance:n,count:i,total:r,className:s,style:p})=>Ot.default.createElement(Ot.default.Fragment,null,Ot.default.createElement(Tl,{appearance:n,className:Me(a("fullWidthProgressBadgeContainer",n),s!=null?s:""),style:p},o&&Ot.default.createElement(Fl,{className:a("fullWidthProgressBadgeIcon",n)},o),Ot.default.createElement(kl,null,Ot.default.createElement(qe,{size:"small",appearance:n,title:e,subtitle:t})),Ot.default.createElement(Pl,{className:a("fullWidthProgressBadgeProgressContainer",n)},Ot.default.createElement(Qe,{count:i,total:r,display:"percent",textLocation:"top"}))));var Bl=({flowId:e,title:t,subtitle:o,icon:n,style:i,onClick:r,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:l,type:m="default"})=>{let{getFlow:c,getFlowSteps:g,getFlowStatus:y,getNumberOfStepsCompleted:T,isLoading:C,targetingLogicShouldHideFlow:h,updateCustomVariables:O}=Q(),{mergeAppearanceWithDefault:F}=se();l=F(l);let{setOpenFlowState:P,getOpenFlowState:v}=ze();if((0,ct.useEffect)(()=>{O(p)},[p,C]),C)return null;let B=c(e);if(!B||h(B)||d===!0&&y(e)===ne)return null;let f=g(e),$=T(e);return m==="full-width"?ct.default.createElement(ct.default.Fragment,null,ct.default.createElement(de,{appearance:l}),ct.default.createElement(vl,{title:t,subtitle:o,count:$,total:f.length,style:i,className:s,appearance:l,icon:n,onClick:()=>{}})):ct.default.createElement(ct.default.Fragment,null,ct.default.createElement(de,{appearance:l}),ct.default.createElement(wl,{count:$,total:f.length,title:t,style:i,onClick:()=>{P(e,!0),r&&r()},type:m,className:s,appearance:l}))};var El=u(require("react"));var Al=i=>{var r=i,{flowId:e,style:t,appearance:o}=r,n=Ye(r,["flowId","style","appearance"]);let{getFlow:s,targetingLogicShouldHideFlow:p,getFlowSteps:d}=Q(),{mergeAppearanceWithDefault:l}=se();o=l(o);let m=s(e);if(!m||p(m))return null;let c=d(e);return El.default.createElement(Jo,w({steps:c,style:t,appearance:o},n))};var at=u(require("react"));var U=u(require("react"));var vo=u(require("styled-components"));var ko=require("react"),oi=(e,t,o,n={x:20,y:20},i)=>{let r=i=="fixed"?0:window.scrollY,s=i=="fixed"?0:window.scrollX;return t==="left"?{x:e.left-o+n.x+s,y:e.top-n.y+r}:t==="right"?{x:e.left+e.width+n.x+s,y:e.top-n.y+r}:{x:0,y:0}};function Ol(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:()=>{}},[n,i]=(0,ko.useState)(o),r=(0,ko.useCallback)(()=>{e&&i(e.getBoundingClientRect())},[e]);return(0,ko.useEffect)(()=>(r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)),[e,t]),n}var Ar=require("react");function Nl(){let{debug:e}=(0,Ar.useContext)(X),[t,o]=(0,Ar.useState)([]);function n(r){e&&(t.find(s=>s===r)||(o([...t,r]),console.log(r)))}function i(r){e&&(t.find(s=>s===r)||(o([...t,r]),console.warn(r)))}return{logIfDebugMode:n,logErrorIfDebugMode:i}}var Il=300,Ll=100,Bd=500,Po=12,Ed=vo.default.div`
|
|
1421
1421
|
width: 100%;
|
|
1422
1422
|
height: 100%;
|
|
1423
1423
|
border-radius: 9999px;
|
|
@@ -1440,25 +1440,25 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1440
1440
|
opacity: 0;
|
|
1441
1441
|
}
|
|
1442
1442
|
}
|
|
1443
|
-
`,Ad=
|
|
1444
|
-
width: ${
|
|
1445
|
-
height: ${
|
|
1443
|
+
`,Ad=vo.default.div`
|
|
1444
|
+
width: ${Po}px;
|
|
1445
|
+
height: ${Po}px;
|
|
1446
1446
|
border-radius: 100px;
|
|
1447
1447
|
background-color: ${e=>e.primaryColor};
|
|
1448
1448
|
z-index: 20;
|
|
1449
1449
|
opacity: 1;
|
|
1450
|
-
`,Od=
|
|
1450
|
+
`,Od=vo.default.div`
|
|
1451
1451
|
pointer-events: all;
|
|
1452
|
-
`,$l=
|
|
1452
|
+
`,$l=vo.default.div`
|
|
1453
1453
|
display: flex;
|
|
1454
1454
|
align-content: center;
|
|
1455
1455
|
justify-content: center;
|
|
1456
1456
|
align-items: center;
|
|
1457
1457
|
z-index: ${e=>e.zIndex?e.zIndex:90};
|
|
1458
|
-
`,Nd=(0,
|
|
1459
|
-
width: ${
|
|
1460
|
-
height: ${
|
|
1461
|
-
`,Id=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:n="auto",showHighlight:i=!0,primaryColor:r="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:l=0,customStepTypes:m,appearance:c,dismissible:g=!1,showHighlightOnly:y,showStepCount:T=!0,completedStepsCount:C=0,showFrigadeBranding:h=!1,cssPosition:O="absolute",onViewTooltip:F})=>{var
|
|
1458
|
+
`,Nd=(0,vo.default)($l)`
|
|
1459
|
+
width: ${Po+12}px;
|
|
1460
|
+
height: ${Po+12}px;
|
|
1461
|
+
`,Id=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:n="auto",showHighlight:i=!0,primaryColor:r="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:l=0,customStepTypes:m,appearance:c,dismissible:g=!1,showHighlightOnly:y,showStepCount:T=!0,completedStepsCount:C=0,showFrigadeBranding:h=!1,cssPosition:O="absolute",onViewTooltip:F})=>{var kt,eo,pt,Nt,mt,to,x,S,E,I,pe,rt,Re,It,Se,Bo,Eo,ui,fi;let{logErrorIfDebugMode:P}=Nl(),[v,B]=(0,U.useState)(),[f,$]=(0,U.useState)(new Date),b=(0,U.useRef)(null),[k,D]=(0,U.useState)(document.querySelector(e[l].selector)),N=Ol(k,f),[L,K]=(0,U.useState)(),[_,J]=(0,U.useState)(!y),R=(eo=(kt=e[l])==null?void 0:kt.props)!=null&&eo.position?e[l].props.position:O,Ce=(mt=(Nt=(pt=e[l])==null?void 0:pt.props)==null?void 0:Nt.zIndex)!=null?mt:90,j=(to=v==null?void 0:v.width)!=null?to:Il,me=(x=v==null?void 0:v.height)!=null?x:Ll,[be,$e]=(0,U.useState)(new Date().getTime());s=(I=(E=(S=e[l])==null?void 0:S.props)==null?void 0:E.offset)!=null?I:s;let ae=window.location.pathname.split("/").pop();(0,U.useLayoutEffect)(()=>{b.current&&B({width:b.current.clientWidth,height:b.current.clientHeight})},[l,f,R]),(0,U.useEffect)(()=>{y||J(!0)},[l]),(0,U.useEffect)(()=>{p&&_&&F(l)},[_]);let re=()=>{let ce=document.querySelector(e[l].selector);if(!ce){K(void 0),D(null),P(`FrigadeTour: Could not find element with selector "${e[l].selector}" for step ${e[l].id}`);return}L&&L===JSON.stringify(ce==null?void 0:ce.getBoundingClientRect())||(D(ce),$(new Date),ce&&K(JSON.stringify(ce.getBoundingClientRect())))};if((0,U.useEffect)(()=>{let ce=new MutationObserver(re);return ce.observe(document.body,{subtree:!0,childList:!0}),()=>ce.disconnect()},[re]),(0,U.useEffect)(()=>{let ce=new MutationObserver(re);return ce.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>ce.disconnect()},[re]),(0,U.useEffect)(()=>{let ce=setInterval(()=>{re()},10);return()=>clearInterval(ce)},[re]),(0,U.useLayoutEffect)(()=>{setTimeout(()=>{re()},Bd),re()},[l,ae]),k===null||!p)return null;let Te=n==="auto"?"right":n,W=oi(N,Te,j,s,R),Ee=N.right+j>(window.innerWidth||document.documentElement.clientWidth),Fe=N.bottom+Ll>(window.innerHeight||document.documentElement.clientHeight);Ee&&n==="auto"&&(W=oi(N,"left",j,s,R),Te="left"),(rt=(pe=e[l])==null?void 0:pe.props)!=null&&rt.tooltipPosition&&((It=(Re=e[l])==null?void 0:Re.props)==null?void 0:It.tooltipPosition)!=="auto"&&(((Bo=(Se=e[l])==null?void 0:Se.props)==null?void 0:Bo.tooltipPosition)==="left"||((ui=(Eo=e[l])==null?void 0:Eo.props)==null?void 0:ui.tooltipPosition)==="right")&&(Te=e[l].props.tooltipPosition);let We=()=>{let ce=()=>{if(e[l].handlePrimaryButtonClick&&(e[l].handlePrimaryButtonClick(),J(!1),setTimeout(()=>{re()},30)),C===e.length-1)return o()},Lt=()=>{e[l].handleSecondaryButtonClick&&(e[l].handleSecondaryButtonClick(),y&&!e[l].secondaryButtonUri&&J(!1))};return U.default.createElement(U.default.Fragment,null,T&&e.length>1&&U.default.createElement(Mi,null,U.default.createElement(Ui,{className:a("tooltipStepCounter",c)},l+1," of ",e.length)),(e[l].primaryButtonTitle||e[l].secondaryButtonTitle)&&U.default.createElement(Di,{showStepCount:T,className:a("tooltipCTAContainer",c)},e[l].secondaryButtonTitle&&U.default.createElement(le,{title:e[l].secondaryButtonTitle,appearance:c,onClick:Lt,size:"small",withMargin:!1,secondary:!0}),e[l].primaryButtonTitle&&U.default.createElement(le,{title:e[l].primaryButtonTitle,appearance:c,onClick:ce,withMargin:!1,size:"small"})))},je=()=>U.default.createElement(U.default.Fragment,null,g&&U.default.createElement(Oi,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:a("tooltipClose",c),hasImage:!!e[l].imageUri||!!e[l].videoUri},U.default.createElement(Ge,null)),e[l].imageUri&&U.default.createElement(Ni,{dismissible:g,appearance:c,src:e[l].imageUri,className:a("tooltipImageContainer",c)}),e[l].videoUri&&!e[l].imageUri&&U.default.createElement(Ii,{dismissible:g,appearance:c,className:a("tooltipVideoContainer",c)},U.default.createElement(Ct,{appearance:c,videoUri:e[l].videoUri})),U.default.createElement($i,{className:a("tooltipContentContainer",c)},U.default.createElement(qe,{appearance:c,title:e[l].title,subtitle:e[l].subtitle,size:"small"}),U.default.createElement(Li,{className:a("tooltipFooter",c)},U.default.createElement(We,null)))),V=w(w({},{default:ce=>{var Lt;if((Lt=e[l])!=null&&Lt.StepContent){let Pa=e[l].StepContent;return U.default.createElement("div",null,Pa)}return U.default.createElement(je,null)}}),m),M=()=>{var ce;return e?!((ce=e[l])!=null&&ce.type)||!V[e[l].type]?V.default(e[l]):V[e[l].type]({stepData:e[l],primaryColor:r}):U.default.createElement(U.default.Fragment,null)};if(e[l].complete===!0||W.x==0&&W.y==0&&new Date().getTime()-be<100)return null;let H={top:(W==null?void 0:W.y)-Po,left:(fi=Te=="left"?N.x+s.x:(W==null?void 0:W.x)-Po)!=null?fi:0,cursor:y?"pointer":"default",position:R},ie=()=>{let Lt=H.left+(Te=="left"?-j:24);return Math.min(Math.max(Lt,20),window.innerWidth-j-20)},ye=()=>{if(R==="fixed")return H.top;let ce=H.top+me,Lt=20;return ce>window.innerHeight-Lt?H.top+-me:H.top},Ft=()=>{y&&($(new Date),J(!_))};return U.default.createElement(Od,null,U.default.createElement(Nd,{style:H,zIndex:Ce,className:a("tourHighlightContainer",c)},i&&e[l].showHighlight!==!1&&O!=="static"&&U.default.createElement(U.default.Fragment,null,U.default.createElement(Ad,{style:{position:R},onClick:Ft,primaryColor:c.theme.colorPrimary,className:a("tourHighlightInnerCircle",c)}),U.default.createElement(Ed,{style:{position:"absolute"},onClick:Ft,primaryColor:c.theme.colorPrimary,className:a("tourHighlightOuterCircle",c)}))),U.default.createElement($l,{style:q(w({},H),{left:ie(),top:ye()}),zIndex:Ce+1,className:a("tooltipContainerWrapper",c)},_&&U.default.createElement(U.default.Fragment,null,U.default.createElement(nr,{ref:b,layoutId:"tooltip-container",style:w({position:"relative",width:"max-content",right:0,top:O!=="static"?12:0},d),appearance:c,className:a("tooltipContainer",c),maxWidth:Il,zIndex:Ce+10},U.default.createElement(M,null)),h&&U.default.createElement(zi,{className:a("poweredByFrigadeTooltipRibbon",c),appearance:c,zIndex:Ce+10},U.default.createElement(lr,{appearance:c})))))},ri=Id;var Ml=require("react-portal");var Dl=C=>{var h=C,{flowId:e,customVariables:t,appearance:o,onStepCompletion:n,onButtonClick:i,showTooltipsSimultaneously:r=!1,onDismiss:s,dismissible:p,tooltipPosition:d="auto",showHighlightOnly:l=!1,dismissBehavior:m="complete-flow",onComplete:c,skipIfNotFound:g=!1,cssPosition:y="absolute"}=h,T=Ye(h,["flowId","customVariables","appearance","onStepCompletion","onButtonClick","showTooltipsSimultaneously","onDismiss","dismissible","tooltipPosition","showHighlightOnly","dismissBehavior","onComplete","skipIfNotFound","cssPosition"]);let{getFlow:O,getFlowSteps:F,isLoading:P,targetingLogicShouldHideFlow:v,markStepCompleted:B,markStepStarted:f,markFlowCompleted:$,updateCustomVariables:b,getCurrentStepIndex:k,getStepStatus:D,isStepBlocked:N,getFlowStatus:L,getNumberOfStepsCompleted:K}=Q(),{isLoadingUserFlowStateData:_}=Xe(),{primaryCTAClickSideEffects:J,secondaryCTAClickSideEffects:R}=ge(),{hasOpenModals:Ce}=ze(),j=k(e),{openFlowStates:me}=(0,at.useContext)(X),{mergeAppearanceWithDefault:be}=se();if(o=be(o),(0,at.useEffect)(()=>{b(t)},[t,P]),_)return null;let $e=O(e);if(!$e||v($e)||L(e)==ne||Ce())return null;let ae=F(e);if(Object.keys(me).length>0){let M=Object.keys(me).find(H=>me[H]===!0);if(M!==void 0&&M!==e)return at.default.createElement(at.default.Fragment,null)}function re(M){return z(this,null,function*(){if(yield B(e,M.id),ae.map(H=>D(e,H.id)).every(H=>H===Je)){yield $(e);return}!l&&j+1<ae.length&&!r&&N(e,ae[j+1].id)})}function Te(M,H,ie){let ye=j+1<ae.length?ae[j+1]:null;i&&i(M,j,H,ye),n&&n(M,ie,ye)}function W(){return ae.map(M=>q(w({},M),{handleSecondaryButtonClick:()=>z(this,null,function*(){R(M),M.skippable===!0&&(yield B(e,M.id,{skipped:!0})),Te(M,"secondary",j)}),handlePrimaryButtonClick:()=>z(this,null,function*(){(!M.completionCriteria&&(M.autoMarkCompleted||M.autoMarkCompleted===void 0)||M.completionCriteria&&M.autoMarkCompleted===!0)&&(yield re(M)),Te(M,"primary",j),J(M)})}))}function Ee(M){return z(this,null,function*(){s&&s(),m==="complete-flow"?yield $(e):yield B(e,M.id)})}function Fe(){c&&c()}function We(M){return z(this,null,function*(){yield f(e,ae[M].id)})}let je=!document.querySelector(ae[j].selector);function Ae(){let M=ae.findIndex(H=>!!document.querySelector(H.selector));return ae.map((H,ie)=>je&&!r&&ie!==M&&g||!r&&ie!==j?null:at.default.createElement(ri,w({key:H.id,appearance:o,steps:W(),selectedStep:ie,showTooltipsSimultaneously:r,dismissible:p,onDismiss:()=>Ee(H),tooltipPosition:d,showHighlightOnly:l,completedStepsCount:K(e),onComplete:Fe,cssPosition:y,onViewTooltip:We},T)))}function V(){return at.default.createElement(at.default.Fragment,null,at.default.createElement(de,{appearance:o}),Ae())}return y==="static"?V():at.default.createElement(Ml.Portal,null,V())};var we=u(require("react"));var ql=require("react-portal");var Ht=u(require("styled-components"));var Ul=Ht.default.button`
|
|
1462
1462
|
${e=>A(e)} {
|
|
1463
1463
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1464
1464
|
|
|
@@ -1476,17 +1476,17 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1476
1476
|
opacity: 0.8;
|
|
1477
1477
|
}
|
|
1478
1478
|
}
|
|
1479
|
-
`,Wl=
|
|
1479
|
+
`,Wl=Ht.default.span`
|
|
1480
1480
|
${e=>A(e)} {
|
|
1481
1481
|
font-size: 12px;
|
|
1482
1482
|
display: inline-block;
|
|
1483
1483
|
}
|
|
1484
|
-
`,zl=
|
|
1484
|
+
`,zl=Ht.default.span`
|
|
1485
1485
|
${e=>A(e)} {
|
|
1486
1486
|
font-size: 12px;
|
|
1487
1487
|
display: inline-block;
|
|
1488
1488
|
}
|
|
1489
|
-
`,_l=
|
|
1489
|
+
`,_l=Ht.default.div`
|
|
1490
1490
|
position: fixed;
|
|
1491
1491
|
right: 0;
|
|
1492
1492
|
bottom: 0;
|
|
@@ -1496,7 +1496,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1496
1496
|
flex-direction: column;
|
|
1497
1497
|
align-items: flex-end;
|
|
1498
1498
|
z-index: 50;
|
|
1499
|
-
`,Hl=
|
|
1499
|
+
`,Hl=Ht.default.button`
|
|
1500
1500
|
${e=>A(e)} {
|
|
1501
1501
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1502
1502
|
background-color: #ffffff;
|
|
@@ -1512,7 +1512,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1512
1512
|
0px 3px 6px -4px rgba(0, 0, 0, 0.12);
|
|
1513
1513
|
border-radius: 45px;
|
|
1514
1514
|
cursor: pointer;
|
|
1515
|
-
`,Vl=
|
|
1515
|
+
`,Vl=Ht.default.div`
|
|
1516
1516
|
${e=>A(e)} {
|
|
1517
1517
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1518
1518
|
background: #ffffff;
|
|
@@ -1529,7 +1529,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1529
1529
|
position: ${e=>e.type=="inline"?"absolute":"relative"};
|
|
1530
1530
|
top: ${e=>e.type=="inline"?"68px":0};
|
|
1531
1531
|
margin-left: ${e=>e.type=="inline"?"-127px":0};
|
|
1532
|
-
`,jl=
|
|
1532
|
+
`,jl=Ht.default.button`
|
|
1533
1533
|
${e=>A(e)} {
|
|
1534
1534
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1535
1535
|
color: #434343;
|
|
@@ -1546,7 +1546,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1546
1546
|
font-size: 14px;
|
|
1547
1547
|
|
|
1548
1548
|
padding: 8px 12px;
|
|
1549
|
-
`;var
|
|
1549
|
+
`;var ii=u(require("react")),Gl=({style:e,className:t})=>ii.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},ii.default.createElement("path",{fill:"currentColor",d:"M13.43 4.938a4.494 4.494 0 00-1.043-1.435A4.955 4.955 0 009 2.197c-1.276 0-2.48.464-3.387 1.305A4.502 4.502 0 004.57 4.938a4.242 4.242 0 00-.386 1.773v.475c0 .109.087.197.196.197h.95a.197.197 0 00.197-.197V6.71c0-1.749 1.557-3.17 3.473-3.17s3.473 1.421 3.473 3.17c0 .718-.254 1.393-.738 1.955a3.537 3.537 0 01-1.9 1.125 1.928 1.928 0 00-1.085.682c-.271.343-.42.768-.42 1.206v.552c0 .109.088.197.197.197h.95a.197.197 0 00.196-.197v-.552c0-.276.192-.519.457-.578a4.904 4.904 0 002.625-1.56c.335-.392.597-.828.778-1.3a4.256 4.256 0 00-.103-3.303zM9 13.834a.985.985 0 10.001 1.97.985.985 0 00-.001-1.97z"}));var ni=u(require("react")),Kl=({style:e,className:t})=>ni.default.createElement("svg",{style:e,className:t,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor"},ni.default.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"}));var Yl=({flowId:e,style:t,onStepCompletion:o,visible:n=!0,type:i="inline",title:r="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:l,getStepStatus:m,getNumberOfStepsCompleted:c,isLoading:g,targetingLogicShouldHideFlow:y}=Q(),{primaryCTAClickSideEffects:T}=ge(),C=(0,we.useRef)(null),[h,O]=(0,we.useState)(!1),{mergeAppearanceWithDefault:F}=se();s=F(s),(0,we.useEffect)(()=>(document.addEventListener("click",P,!1),()=>{document.removeEventListener("click",P,!1)}),[]);let P=b=>{C.current&&!C.current.contains(b.target)&&O(!1)};if(g)return null;let v=p(e);if(!v||y(v))return null;let B=d(e);if(!B||!n)return null;function f(b,k){!b.completionCriteria&&(b.autoMarkCompleted||b.autoMarkCompleted===void 0)&&l(e,b.id),T(b),o&&o(b,k),O(!1)}function $(){return h&&we.default.createElement(Vl,{className:a("floatingWidgetMenu",s),initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:i},B.map((b,k)=>we.default.createElement(jl,{className:a("floatingWidgetMenuItem",s),key:k,onClick:()=>f(b,k)},b.title)))}return i=="inline"?we.default.createElement("span",{ref:C},we.default.createElement(Ul,{style:t,onClick:()=>{O(!h)},className:a("supportButton",s)},we.default.createElement(zl,{className:a("supportIconContainer",s)},we.default.createElement(Kl,{className:a("supportIcon",s),style:{width:"18px",height:"18px"}})),we.default.createElement(Wl,{className:a("supportButtonTitle",s)},r)),we.default.createElement($,null)):we.default.createElement(ql.Portal,null,we.default.createElement(_l,{style:t,ref:C},we.default.createElement($,null),we.default.createElement(Hl,{onClick:()=>{O(!h)},whileHover:{scale:1.1},className:a("floatingWidgetButton",s)},we.default.createElement(Gl,{className:a("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};var ot=u(require("react"));var Qo=u(require("styled-components"));var Jl=Qo.default.div`
|
|
1550
1550
|
${e=>A(e)} {
|
|
1551
1551
|
display: flex;
|
|
1552
1552
|
flex-direction: column;
|
|
@@ -1561,17 +1561,17 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1561
1561
|
border-radius: 12px;
|
|
1562
1562
|
position: relative;
|
|
1563
1563
|
}
|
|
1564
|
-
`,Xl=
|
|
1564
|
+
`,Xl=Qo.default.div`
|
|
1565
1565
|
display: flex;
|
|
1566
1566
|
flex-direction: column;
|
|
1567
1567
|
flex: 1;
|
|
1568
|
-
`,Ql=
|
|
1568
|
+
`,Ql=Qo.default.div`
|
|
1569
1569
|
display: flex;
|
|
1570
1570
|
flex-direction: column;
|
|
1571
1571
|
justify-content: center;
|
|
1572
1572
|
align-items: flex-start;
|
|
1573
1573
|
margin-top: 16px;
|
|
1574
|
-
`,Zl=
|
|
1574
|
+
`,Zl=Qo.default.div`
|
|
1575
1575
|
${e=>A(e)} {
|
|
1576
1576
|
position: absolute;
|
|
1577
1577
|
top: 16px;
|
|
@@ -1582,7 +1582,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1582
1582
|
opacity: 0.8;
|
|
1583
1583
|
}
|
|
1584
1584
|
}
|
|
1585
|
-
`;var Rl=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:n,appearance:i,className:r,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:l,markStepCompleted:m,isLoading:c,targetingLogicShouldHideFlow:g,updateCustomVariables:y,getFlowSteps:T,getFlowStatus:C,getCurrentStepIndex:h}=Q(),{primaryCTAClickSideEffects:O}=
|
|
1585
|
+
`;var Rl=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:n,appearance:i,className:r,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:l,markStepCompleted:m,isLoading:c,targetingLogicShouldHideFlow:g,updateCustomVariables:y,getFlowSteps:T,getFlowStatus:C,getCurrentStepIndex:h}=Q(),{primaryCTAClickSideEffects:O}=ge(),{mergeAppearanceWithDefault:F}=se();if(lt(e),i=F(i),(0,ot.useEffect)(()=>{y(o)},[o,c]),c)return null;let P=d(e);if(!P||g(P)||C(e)===ne)return null;let B=T(e)[h(e)];return ot.default.createElement(ot.default.Fragment,null,ot.default.createElement(de,{appearance:i}),ot.default.createElement(Jl,{appearance:i,className:Me(a("embeddedTipContainer",i),r),style:s},(p===!0||B.dismissible)&&ot.default.createElement(Zl,{onClick:()=>z(void 0,null,function*(){yield l(e),t&&t()}),className:a("embeddedTipDismissButton",i)},ot.default.createElement(Ge,null)),ot.default.createElement(Xl,null,ot.default.createElement(qe,{size:"small",appearance:i,title:B.title,subtitle:B.subtitle})),B.primaryButtonTitle&&ot.default.createElement(Ql,{className:a("embeddedTipCallToActionContainer",i)},ot.default.createElement(le,{classPrefix:"embeddedTip",title:B.primaryButtonTitle,appearance:i,withMargin:!1,size:"medium",type:"inline",onClick:()=>z(void 0,null,function*(){B.handlePrimaryButtonClick(),O(B),!(n&&n(B,h(e),"primary")===!1)&&(yield m(e,B.id),yield l(e))})}))))};var ve=u(require("react"));var Rt=u(require("styled-components"));var ea=Rt.default.div`
|
|
1586
1586
|
// use the :not annotation
|
|
1587
1587
|
${e=>A(e)} {
|
|
1588
1588
|
display: flex;
|
|
@@ -1594,24 +1594,24 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1594
1594
|
background-color: ${e=>e.appearance.theme.colorBackground};
|
|
1595
1595
|
border-radius: 12px;
|
|
1596
1596
|
}
|
|
1597
|
-
`,ta=
|
|
1597
|
+
`,ta=Rt.default.div`
|
|
1598
1598
|
${e=>A(e)} {
|
|
1599
1599
|
display: flex;
|
|
1600
1600
|
width: 46px;
|
|
1601
1601
|
height: 46px;
|
|
1602
1602
|
}
|
|
1603
|
-
`,oa=
|
|
1603
|
+
`,oa=Rt.default.div`
|
|
1604
1604
|
display: flex;
|
|
1605
1605
|
flex-direction: column;
|
|
1606
1606
|
flex: 1;
|
|
1607
1607
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1608
1608
|
margin-top: ${e=>e.type==="square"?"12px":"0"};
|
|
1609
|
-
`,ra=
|
|
1609
|
+
`,ra=Rt.default.div`
|
|
1610
1610
|
display: flex;
|
|
1611
1611
|
flex-direction: column;
|
|
1612
1612
|
justify-content: center;
|
|
1613
1613
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1614
|
-
`,
|
|
1614
|
+
`,si=Rt.default.div`
|
|
1615
1615
|
display: flex;
|
|
1616
1616
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1617
1617
|
align-items: flex-end;
|
|
@@ -1619,12 +1619,12 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1619
1619
|
:hover {
|
|
1620
1620
|
opacity: 0.8;
|
|
1621
1621
|
}
|
|
1622
|
-
`,
|
|
1622
|
+
`,li=Rt.default.div`
|
|
1623
1623
|
display: flex;
|
|
1624
1624
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1625
1625
|
align-items: flex-end;
|
|
1626
1626
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1627
|
-
`;var
|
|
1627
|
+
`;var Or=u(require("react")),ia=({style:e,className:t})=>Or.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"46",height:"46",fill:"none",viewBox:"0 0 46 46",style:e,className:t},Or.default.createElement("circle",{cx:"23",cy:"23",r:"23",fill:"#E6F1FF"}),Or.default.createElement("path",{stroke:"#0171F8",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M32 18.5l-2.25-1.313M32 18.5v2.25m0-2.25l-2.25 1.313M14 18.5l2.25-1.313M14 18.5l2.25 1.313M14 18.5v2.25m9 3l2.25-1.313M23 23.75l-2.25-1.313M23 23.75V26m0 6.75l2.25-1.313M23 32.75V30.5m0 2.25l-2.25-1.313m0-16.875L23 13.25l2.25 1.313M32 25.25v2.25l-2.25 1.313m-13.5 0L14 27.5v-2.25"}));var na=({flowId:e,title:t,subtitle:o,onDismiss:n,customVariables:i,onButtonClick:r,appearance:s,type:p="full-width",icon:d})=>{let{getFlow:l,markFlowCompleted:m,isLoading:c,targetingLogicShouldHideFlow:g,updateCustomVariables:y,getFlowMetadata:T,getFlowStatus:C,getFlowSteps:h,getCurrentStepIndex:O}=Q(),{primaryCTAClickSideEffects:F}=ge(),{mergeAppearanceWithDefault:P}=se();if(lt(e),s=P(s),(0,ve.useEffect)(()=>{y(i)},[i,c]),c)return null;let v=l(e);if(!v||g(v)||C(e)===ne)return null;let B=h(e),f=B.length>0?B[O(e)]:T(e);return f!=null&&f.title&&(t=f.title),f!=null&&f.subtitle&&(o=f.subtitle),ve.default.createElement(ve.default.Fragment,null,ve.default.createElement(de,{appearance:s}),ve.default.createElement(ea,{type:p,appearance:s,className:a("bannerContainer",s)},p!="square"&&ve.default.createElement(ta,{className:a("bannerIconContainer",s)},d||ve.default.createElement(ia,null)),p==="square"&&f.dismissible&&ve.default.createElement(li,{type:p,className:a("bannerDismissButtonContainer",s)},ve.default.createElement(si,{type:p,onClick:()=>z(void 0,null,function*(){yield m(e),n&&n()}),className:a("bannerDismissButton",s)},ve.default.createElement(Ge,null))),ve.default.createElement(oa,{type:p},ve.default.createElement(qe,{appearance:s,title:t,subtitle:o,classPrefix:"banner"})),(f==null?void 0:f.primaryButtonTitle)&&ve.default.createElement(ra,{type:p,className:a("bannerCallToActionContainer",s)},ve.default.createElement(le,{title:f==null?void 0:f.primaryButtonTitle,appearance:s,onClick:()=>{F(f),r&&r(f,0,"primary")},classPrefix:"banner"})),p!=="square"&&f.dismissible&&ve.default.createElement(li,{type:p,className:a("bannerDismissButtonContainer",s)},ve.default.createElement(si,{type:p,onClick:()=>z(void 0,null,function*(){yield m(e),n&&n()}),className:a("bannerDismissButton",s)},ve.default.createElement(Ge,null)))))};var Z=u(require("react"));var ca=require("react-portal");var Tt=u(require("styled-components"));var sa=Tt.default.div`
|
|
1628
1628
|
display: flex;
|
|
1629
1629
|
flex-direction: column;
|
|
1630
1630
|
width: 100%;
|
|
@@ -1646,7 +1646,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1646
1646
|
border-width: 1px;
|
|
1647
1647
|
border-color: ${t=>t.appearance.theme.colorBorder};
|
|
1648
1648
|
border-radius: ${t=>t.appearance.theme.borderRadius}px;`:""}
|
|
1649
|
-
`,la=
|
|
1649
|
+
`,la=Tt.default.button`
|
|
1650
1650
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1651
1651
|
border-radius: 8px;
|
|
1652
1652
|
// If selected make border color primary and text color color priamry
|
|
@@ -1667,33 +1667,33 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1667
1667
|
display: flex;
|
|
1668
1668
|
justify-content: center;
|
|
1669
1669
|
align-items: center;
|
|
1670
|
-
`,
|
|
1670
|
+
`,ai=Tt.default.div`
|
|
1671
1671
|
display: flex;
|
|
1672
1672
|
justify-content: space-between;
|
|
1673
1673
|
margin-top: 16px;
|
|
1674
1674
|
gap: 8px;
|
|
1675
|
-
`,aa=
|
|
1675
|
+
`,aa=Tt.default.div`
|
|
1676
1676
|
display: flex;
|
|
1677
1677
|
justify-content: space-between;
|
|
1678
1678
|
margin-top: 8px;
|
|
1679
|
-
`,
|
|
1679
|
+
`,pi=Tt.default.div`
|
|
1680
1680
|
font-size: 12px;
|
|
1681
1681
|
line-height: 18px;
|
|
1682
1682
|
color: ${e=>e.appearance.theme.colorTextDisabled};
|
|
1683
1683
|
font-style: normal;
|
|
1684
1684
|
font-weight: 400;
|
|
1685
1685
|
letter-spacing: 0.24px;
|
|
1686
|
-
`,
|
|
1686
|
+
`,di=Tt.default.div`
|
|
1687
1687
|
display: flex;
|
|
1688
1688
|
flex-direction: column;
|
|
1689
1689
|
flex: 1;
|
|
1690
|
-
`,S0=
|
|
1690
|
+
`,S0=Tt.default.div`
|
|
1691
1691
|
display: flex;
|
|
1692
1692
|
flex-direction: column;
|
|
1693
1693
|
justify-content: center;
|
|
1694
1694
|
align-items: flex-start;
|
|
1695
1695
|
margin-top: 16px;
|
|
1696
|
-
`,pa=
|
|
1696
|
+
`,pa=Tt.default.textarea`
|
|
1697
1697
|
${e=>A(e)} {
|
|
1698
1698
|
color: ${e=>e.appearance.theme.colorText};
|
|
1699
1699
|
margin-top: 16px;
|
|
@@ -1706,7 +1706,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1706
1706
|
height: 100px;
|
|
1707
1707
|
resize: none;
|
|
1708
1708
|
}
|
|
1709
|
-
`,da=
|
|
1709
|
+
`,da=Tt.default.div`
|
|
1710
1710
|
${e=>A(e)} {
|
|
1711
1711
|
position: absolute;
|
|
1712
1712
|
top: 16px;
|
|
@@ -1717,7 +1717,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1717
1717
|
opacity: 0.8;
|
|
1718
1718
|
}
|
|
1719
1719
|
}
|
|
1720
|
-
`;var ma=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:n,appearance:i,className:r,style:s,type:p="modal"})=>{let{getFlow:d,markFlowCompleted:l,markStepCompleted:m,getNumberOfStepsCompleted:c,isLoading:g,targetingLogicShouldHideFlow:y,updateCustomVariables:T,getFlowSteps:C,getFlowStatus:h,getFlowMetadata:O}=Q(),{primaryCTAClickSideEffects:F}=
|
|
1720
|
+
`;var ma=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:n,appearance:i,className:r,style:s,type:p="modal"})=>{let{getFlow:d,markFlowCompleted:l,markStepCompleted:m,getNumberOfStepsCompleted:c,isLoading:g,targetingLogicShouldHideFlow:y,updateCustomVariables:T,getFlowSteps:C,getFlowStatus:h,getFlowMetadata:O}=Q(),{primaryCTAClickSideEffects:F}=ge(),{mergeAppearanceWithDefault:P}=se(),[v,B]=Z.default.useState(null),[f,$]=Z.default.useState(""),b=O(e),{hasOpenModals:k,setKeepCompletedFlowOpenDuringSession:D,shouldKeepCompletedFlowOpenDuringSession:N}=ze();if(lt(e),i=P(i),(0,Z.useEffect)(()=>{T(o)},[o,g]),g)return null;let L=d(e);if(!L||y(L)||h(e)===ne||c(e)===1&&!N(e)||k())return null;let _=C(e)[c(e)];function J(){var j,me;return Z.default.createElement(Z.default.Fragment,null,Z.default.createElement(di,null,Z.default.createElement(qe,{size:"large",appearance:i,title:_.title,subtitle:_.subtitle})),Z.default.createElement(ai,{className:a("npsNumberButtonContainer",i),appearance:i},Array.from(Array(10).keys()).map(be=>Z.default.createElement(la,{className:a("npsNumberButton",i),selected:v===be+1,key:be,onClick:()=>z(this,null,function*(){D(e),B(be+1),yield m(e,_.id,{score:be+1})}),appearance:i},be+1))),Z.default.createElement(aa,{appearance:i},Z.default.createElement(pi,{appearance:i},(j=b==null?void 0:b.negativeLabel)!=null?j:"Not likely at all"),Z.default.createElement(pi,{appearance:i},(me=b==null?void 0:b.positiveLabel)!=null?me:"Extremely likely")))}function R(){var j;return Z.default.createElement(Z.default.Fragment,null,Z.default.createElement(di,null,Z.default.createElement(qe,{appearance:i,title:(j=_.title)!=null?j:"Why did you choose this score?",size:"large"})),Z.default.createElement(pa,{appearance:i,value:f,onChange:me=>{$(me.target.value)},placeholder:"Add your optional feedback here..."}),Z.default.createElement(ai,{appearance:i,className:a("npsNumberButtonContainer",i)},Z.default.createElement(le,{size:"large",withMargin:!1,onClick:()=>z(this,null,function*(){yield l(e),n&&n(_,1,"primary")}),appearance:i,title:_.secondaryButtonTitle||"Skip",secondary:!0}),Z.default.createElement(le,{size:"large",withMargin:!1,onClick:()=>z(this,null,function*(){yield m(e,_.id,{feedbackText:f}),yield l(e),n&&n(_,1,"primary")}),appearance:i,title:_.primaryButtonTitle||"Submit"})))}function Ce(){return c(e)>=2?null:Z.default.createElement(Z.default.Fragment,null,Z.default.createElement(de,{appearance:i}),Z.default.createElement(sa,{appearance:i,className:Me(a("npsSurveyContainer",i),r),style:s,type:p},Z.default.createElement(da,{onClick:()=>z(this,null,function*(){yield l(e),t&&t()}),className:a("npsSurveyDismissButton",i)},Z.default.createElement(Ge,null)),c(e)==0&&J(),c(e)==1&&R()))}return p==="inline"?Ce():Z.default.createElement(ca.Portal,null,Ce())};var Be=u(require("react"));var Vt=u(require("styled-components"));var ua=Vt.default.div`
|
|
1721
1721
|
${e=>A(e)} {
|
|
1722
1722
|
display: flex;
|
|
1723
1723
|
flex-direction: column;
|
|
@@ -1728,21 +1728,21 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1728
1728
|
background-color: ${e=>e.appearance.theme.colorBackground};
|
|
1729
1729
|
position: relative;
|
|
1730
1730
|
}
|
|
1731
|
-
`,fa=
|
|
1731
|
+
`,fa=Vt.default.div`
|
|
1732
1732
|
display: flex;
|
|
1733
1733
|
flex-direction: column;
|
|
1734
1734
|
flex: 1;
|
|
1735
|
-
`,ga=
|
|
1735
|
+
`,ga=Vt.default.div`
|
|
1736
1736
|
display: flex;
|
|
1737
1737
|
flex-direction: row;
|
|
1738
1738
|
justify-content: center;
|
|
1739
1739
|
align-items: stretch;
|
|
1740
1740
|
gap: 16px;
|
|
1741
1741
|
margin-top: 8px;
|
|
1742
|
-
`,ha=
|
|
1742
|
+
`,ha=Vt.default.div`
|
|
1743
1743
|
margin-top: 16px;
|
|
1744
1744
|
margin-bottom: 16px;
|
|
1745
|
-
`,xa=
|
|
1745
|
+
`,xa=Vt.default.div`
|
|
1746
1746
|
${e=>A(e)} {
|
|
1747
1747
|
position: absolute;
|
|
1748
1748
|
top: -16px;
|
|
@@ -1753,7 +1753,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1753
1753
|
opacity: 0.8;
|
|
1754
1754
|
}
|
|
1755
1755
|
}
|
|
1756
|
-
`,Ca=
|
|
1756
|
+
`,Ca=Vt.default.h1`
|
|
1757
1757
|
${e=>A(e)} {
|
|
1758
1758
|
font-style: normal;
|
|
1759
1759
|
justify-content: center;
|
|
@@ -1767,7 +1767,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1767
1767
|
color: ${e=>e.appearance.theme.colorText};
|
|
1768
1768
|
margin-bottom: 8px;
|
|
1769
1769
|
}
|
|
1770
|
-
`,ya=
|
|
1770
|
+
`,ya=Vt.default.h2`
|
|
1771
1771
|
${e=>A(e)} {
|
|
1772
1772
|
font-style: normal;
|
|
1773
1773
|
justify-content: center;
|
|
@@ -1779,10 +1779,10 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${Ao}${t}.${Ao}${t} { ${Object.entries(o).map
|
|
|
1779
1779
|
letter-spacing: 0.28px;
|
|
1780
1780
|
margin-bottom: 8px;
|
|
1781
1781
|
}
|
|
1782
|
-
`;var
|
|
1782
|
+
`;var ci=u(require("react")),Sa=u(require("styled-components"));var Ld=Sa.default.img`
|
|
1783
1783
|
width: 100%;
|
|
1784
1784
|
height: 100%;
|
|
1785
1785
|
min-height: 200px;
|
|
1786
1786
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1787
|
-
`;function ba({stepData:e,appearance:t,classPrefix:o=""}){return e.videoUri?
|
|
1787
|
+
`;function ba({stepData:e,appearance:t,classPrefix:o=""}){return e.videoUri?ci.default.createElement(Ct,{appearance:t,videoUri:e.videoUri}):e.imageUri?ci.default.createElement(Ld,{className:a(`${o}image`,t),appearance:t,src:e.imageUri}):null}var wa=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:n,appearance:i,className:r,style:s,dismissible:p=!0,modalPosition:d="center"})=>{let{getFlow:l,markFlowCompleted:m,markStepCompleted:c,isLoading:g,targetingLogicShouldHideFlow:y,updateCustomVariables:T,getFlowSteps:C,getFlowStatus:h,getCurrentStepIndex:O}=Q(),{primaryCTAClickSideEffects:F,secondaryCTAClickSideEffects:P}=ge(),{mergeAppearanceWithDefault:v}=se(),{setOpenFlowState:B,getOpenFlowState:f,hasOpenModals:$}=ze();lt(e);let[b,k]=[f(e,!0),R=>B(e,R)];if(i=v(i),(0,Be.useEffect)(()=>{T(o)},[o,g]),g)return null;let D=l(e);if(!D||y(D)||h(e)===ne||$())return null;let L=C(e)[O(e)],K=()=>{k(!1),t&&t(),m(e)};function _(){return Be.default.createElement(Be.default.Fragment,null,Be.default.createElement(de,{appearance:i}),Be.default.createElement(ua,{appearance:i,className:Me(a("announcementContainer",i),r),style:s},(p===!0||L.dismissible)&&d=="inline"&&Be.default.createElement(xa,{onClick:()=>z(this,null,function*(){yield m(e),t&&t()}),className:a("announcementDismissButton",i)},Be.default.createElement(Ge,null)),Be.default.createElement(fa,null,Be.default.createElement(Ca,{appearance:i,className:a("announcementTitle",i),dangerouslySetInnerHTML:ue(L.title)}),L.subtitle&&Be.default.createElement(ya,{appearance:i,className:a("announcementSubtitle",i),dangerouslySetInnerHTML:ue(L.subtitle)})),(L.imageUri||L.videoUri)&&Be.default.createElement(ha,{className:a("announcementMediaContainer",i)},Be.default.createElement(ba,{appearance:i,stepData:L})),(L.primaryButtonTitle||L.secondaryButtonTitle)&&Be.default.createElement(ga,{className:a("announcementCTAContainer",i)},L.secondaryButtonTitle&&Be.default.createElement(le,{classPrefix:"announcement",title:L.secondaryButtonTitle,appearance:i,withMargin:!1,size:"small",type:"full-width",onClick:()=>z(this,null,function*(){L.handleSecondaryButtonClick(),P(L),n&&n(L,O(e),"secondary")}),secondary:!0}),L.primaryButtonTitle&&Be.default.createElement(le,{classPrefix:"announcement",title:L.primaryButtonTitle,appearance:i,withMargin:!1,size:"small",type:"full-width",onClick:()=>z(this,null,function*(){L.handlePrimaryButtonClick(),F(L),!(n&&n(L,O(e),"primary")===!1)&&(yield c(e,L.id),yield m(e))})}))))}let J={padding:"24px",maxWidth:"400px"};return d==="inline"?_():d!=="center"?Be.default.createElement(ar,{modalPosition:d,onClose:K,visible:b,dismissible:p,appearance:i},_()):Be.default.createElement(gt,{appearance:i,onClose:K,visible:b,style:J,dismissible:p},_())};var Ir=u(require("react"));var mi=u(require("react"));var Ta=i=>{var r=i,{as:e="span",children:t,variant:o="Body1"}=r,n=Ye(r,["as","children","variant"]);return mi.default.createElement(Mn,w({color:"neutral.foreground",fontFamily:"default",forwardedAs:e,variant:o},n),t)},$d=Object.fromEntries(Object.keys(wr).map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=n=>mi.default.createElement(Ta,q(w({as:t},n),{variant:e}),n.children);return o.displayName=`Text.${e}`,[e,o]})),Nr=Object.assign(Ta,$d);var Fa=s=>{var p=s,{as:e="button",className:t,size:o="md",title:n,variant:i="Primary"}=p,r=Ye(p,["as","className","size","title","variant"]);var d;return Ir.createElement(Ln,w({className:`fr-button-${i.toLowerCase()}${t?` ${t}`:""}`,forwardedAs:e,variant:i,size:o,borderRadius:"md"},r),Ir.createElement(Nr,{color:(d=Vo[i])==null?void 0:d.color,fontWeight:"semibold"},n))},Md=Object.fromEntries(Object.keys(Vo).map(e=>{let t=o=>Ir.createElement(Fa,q(w({},o),{variant:e}));return t.displayName=`Button.${e}`,[e,t]})),ka=Object.assign(Fa,Md);0&&(module.exports={Box,Button,CheckBox,FlowType,FormLabel,FormTextField,FrigadeAnnouncement,FrigadeBanner,FrigadeChecklist,FrigadeDefaultAppearance,FrigadeEmbeddedTip,FrigadeForm,FrigadeGuide,FrigadeHeroChecklist,FrigadeNPSSurvey,FrigadeProgressBadge,FrigadeProvider,FrigadeSupportWidget,FrigadeTour,ProgressBar,ProgressRing,Text,tokens,useFlowOpens,useFlowResponses,useFlows,useOrganization,useUser,useUserFlowStates});
|
|
1788
1788
|
//# sourceMappingURL=index.js.map
|