@frigade/react 1.35.50 → 1.35.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +73 -73
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +73 -73
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnPropertyDescriptors;var Po=Object.getOwnPropertySymbols;var oi=Object.prototype.hasOwnProperty,ri=Object.prototype.propertyIsEnumerable;var ti=(e,t,o)=>t in e?ia(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))oi.call(t,o)&&ti(e,o,t[o]);if(Po)for(var o of Po(t))ri.call(t,o)&&ti(e,o,t[o]);return e},_=(e,t)=>na(e,sa(t));var ii=e=>typeof e=="symbol"?e:e+"",Ie=(e,t)=>{var o={};for(var i in e)oi.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i]);if(e!=null&&Po)for(var i of Po(e))t.indexOf(i)<0&&ri.call(e,i)&&(o[i]=e[i]);return o};var D=(e,t,o)=>new Promise((i,n)=>{var r=d=>{try{p(o.next(d))}catch(l){n(l)}},s=d=>{try{p(o.throw(d))}catch(l){n(l)}},p=d=>d.done?i(d.value):Promise.resolve(d.value).then(r,s);p((o=o.apply(e,t)).next())});import Pt,{createContext as Cd,useEffect as Go,useState as je}from"react";import{ThemeProvider as yd}from"styled-components";import kt,{useContext as qp,useEffect as Kt,useState as xo}from"react";import{useCallback as wt,useContext as ya,useEffect as Sa}from"react";import rr,{useMemo as si}from"react";var ni="1.35.50 ";var He="NOT_STARTED_STEP",Z="COMPLETED_FLOW",vo="ABORTED_FLOW",bt="STARTED_FLOW",Me="NOT_STARTED_FLOW",Ke="COMPLETED_STEP",Bo="STARTED_STEP";function Je(){let{publicApiKey:e,userId:t,apiUrl:o}=rr.useContext(Q);return{config:si(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":ni,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:si(()=>`${o}/v1/public/`,[o])}}var la="frigade-last-call-at-",aa="frigade-last-call-data-";function Dt(){let{shouldGracefullyDegrade:e,readonly:t}=rr.useContext(Q);return(o,i)=>D(this,null,function*(){if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Mt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Mt();let n=la+o,r=aa+o;if(window&&window.localStorage&&i&&i.body&&i.method==="POST"){let p=window.localStorage.getItem(n),d=window.localStorage.getItem(r);if(p&&d&&d==i.body){let l=new Date(p);if(new Date().getTime()-l.getTime()<1e3)return Mt()}window.localStorage.setItem(n,new Date().toISOString()),window.localStorage.setItem(r,i.body)}let s;try{s=yield fetch(o,i)}catch(p){return Mt(p)}return s?s.ok?s:Mt(s.statusText):Mt()})}function Mt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Ut(){let{publicApiKey:e,shouldGracefullyDegrade:t}=rr.useContext(Q);function o(){return t?(console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize"),!1):e?!0:(console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider"),!1)}return{verifySDKInitiated:o}}import{useContext as ha,useState as li}from"react";import{useContext as da,useEffect as ca,useState as ma}from"react";import ua from"swr";import{useContext as pa}from"react";function Be(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:n}=pa(Q);function r(c,f=!1){var y;return(y=e[c])!=null?y:f}function s(c,f){t(y=>_(w({},y),{[c]:f}))}function p(c){t(f=>{let S=f,{[c]:y}=S,T=Ie(S,[ii(c)]);return w({},T)})}function d(c){n.includes(c)||i(f=>[...f,c])}function l(c){return n.includes(c)}function m(c){return Object.entries(e).some(([f,y])=>y&&f!=c)||o}return{getOpenFlowState:r,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:m,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:l}}import fa from"swr/immutable";import no from"core-js-pure/actual/structured-clone";function ir(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ce(...e){let t=e.shift(),o=e.length===1?e[0]:Ce(...e);if(!ir(t)||!ir(o))throw new Error("deepmerge can only merge Objects");let i=no(t);return Object.entries(o).forEach(([n,r])=>{ir(r)?i[n]!==void 0?Object.assign(i,{[n]:Ce(i[n],no(r))}):Object.assign(i,{[n]:no(r)}):Array.isArray(r)?i[n]!==void 0?Object.assign(i,{[n]:[...i[n],...no(r)]}):Object.assign(i,{[n]:no(r)}):Object.assign(i,{[n]:r})}),i}var ga="unknown";function De(){let{config:e,apiUrl:t}=Je(),{publicApiKey:o,userId:i,organizationId:n,flows:r,setShouldGracefullyDegrade:s,readonly:p}=da(Q),{resetOpenFlowState:d}=Be(),[l,m]=ma(!1),c={data:r.map(h=>({flowId:h.id,flowState:Z,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},f=h=>fetch(h,e).then(b=>{if(b.ok)return b.json();throw new Error("Failed to fetch user flow states")}).catch(b=>(console.log(`Error fetching ${h}: ${b}. Will gracefully degrade and hide Frigade`),s(!0),c)),y=o&&r&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${n?`&foreignUserGroupId=${encodeURIComponent(n)}`:""}`:null,{data:T,isLoading:S,mutate:g,error:v}=p?fa(y,f):ua(y,f,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!1,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),P=T==null?void 0:T.data;ca(()=>{!l&&!S&&P&&m(!0)},[P,l,S]);function F(h){return D(this,null,function*(){if(P&&!p){let b=P.find(N=>N.flowId===h);b&&b.flowState!==Z&&(b.flowState=Z),yield g(Promise.resolve(Ce(T,{data:P})),{optimisticData:Ce(T,{data:P}),revalidate:!1,rollbackOnError:!1})}})}function A(h,b,N){return D(this,null,function*(){if(P){let L=P.find(O=>O.flowId===h);L&&(L.stepStates[b]=N,L.flowState=bt),yield g(Promise.resolve(Ce(T,{data:P})),{optimisticData:Ce(T,{data:P}),revalidate:!1,rollbackOnError:!1})}})}function I(h,b,N){return D(this,null,function*(){if(P){let L=P.find(O=>O.flowId===h);L&&(L.lastStepId=b,L.stepStates[b]=N,L.flowState=bt),yield g(Ce(T,{data:P}),{optimisticData:Ce(T,{data:P}),revalidate:!1,rollbackOnError:!1})}})}function x(h){return D(this,null,function*(){if(P){let b=P.find(N=>N.flowId===h);b&&b.flowState!==Me&&(b.flowState=Me,b.lastStepId=ga,Object.keys(b.stepStates).forEach(N=>{b.stepStates[N].actionType=He,b.stepStates[N].createdAt=new Date().toISOString()}),yield g(Ce(T,{data:P}),{optimisticData:Ce(T,{data:P}),revalidate:!1,rollbackOnError:!1}),d(h))}})}function B(h,b){return D(this,null,function*(){if(P){let N=P.find(L=>L.flowId===h);N&&N.stepStates[b]!==He&&(N.stepStates[b]=He),yield g(Ce(T,{data:P}),{optimisticData:Ce(T,{data:P}),revalidate:!1,rollbackOnError:!1})}})}return{userFlowStatesData:P,isLoadingUserFlowStateData:!l,mutateUserFlowState:g,optimisticallyMarkFlowCompleted:F,optimisticallyMarkFlowNotStarted:x,optimisticallyMarkStepCompleted:A,optimisticallyMarkStepNotStarted:B,optimisticallyMarkStepStarted:I,error:v}}function so(){let{config:e,apiUrl:t}=Je(),{userFlowStatesData:o,mutateUserFlowState:i}=De(),{failedFlowResponses:n,setFailedFlowResponses:r,flowResponses:s,setFlowResponses:p}=ha(Q),[d,l]=li(new Set),[m,c]=li(new Set),f=Dt();function y(g){let v=JSON.stringify(g);if(d.has(v))return null;d.add(v),l(d),m.add(g),c(m);let P=s==null?void 0:s.find(F=>F.flowSlug===g.flowSlug&&F.stepId===g.stepId&&F.actionType===g.actionType&&F.createdAt===g.createdAt);return f(`${t}flowResponses`,_(w({},e),{method:"POST",body:v})).then(F=>{F.status!==200&&F.status!==201?(console.log("Failed to send flow response for step "+g.stepId+". Will retry again later."),r([...n,g])):P||p(A=>[...A!=null?A:[],g])})}function T(g){return D(this,null,function*(){g.foreignUserId&&(g.actionType===bt||g.actionType===Me?yield y(g):g.actionType===Z?yield y(g):g.actionType===Bo?yield y(g):g.actionType===Ke?yield y(g):g.actionType===vo?yield y(g):g.actionType===He&&(yield y(g)))})}function S(){let g=[];return o==null||o.forEach(v=>{if(v&&v.stepStates&&Object.keys(v.stepStates).length!==0)for(let P in v.stepStates){let F=v.stepStates[P];g.push({foreignUserId:v.foreignUserId,flowSlug:v.flowId,stepId:F.stepId,actionType:F.actionType,data:{},createdAt:new Date(F.createdAt),blocked:F.blocked,hidden:F.hidden})}}),[...g,...s]}return{addResponse:T,setFlowResponses:p,getFlowResponses:S}}import ba from"swr";var xa=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,ai=e=>{let t=xa.exec(e);if(t===null)return null;let o=null;return t.forEach((i,n)=>{let r=Ca(i,"'","");r.startsWith("flow_")&&(o=r)}),o},Ca=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function nr(e){try{return JSON.parse(e)}catch(t){return console.error("Failed to parse Frigade config.yml to JSON",t),null}}var sr=(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))(sr||{});function R(){let{config:e,apiUrl:t}=Je(),{flows:o,setFlows:i,userId:n,organizationId:r,publicApiKey:s,customVariables:p,setCustomVariables:d,hasActiveFullPageFlow:l,setHasActiveFullPageFlow:m,setFlowResponses:c,setShouldGracefullyDegrade:f,readonly:y}=ya(Q),T={data:[]},{verifySDKInitiated:S}=Ut(),{addResponse:g,getFlowResponses:v}=so(),P=C=>fetch(C,e).then(u=>u.ok?u.json():(console.log(`Error fetching ${C} (${u.status}): ${u.statusText}. Will gracefully degrade and hide Frigade`),f(!0),T)).catch(u=>(console.log(`Error fetching ${C}: ${u}. Will gracefully degrade and hide Frigade`),f(!0),T)),{mutateUserFlowState:F,userFlowStatesData:A,isLoadingUserFlowStateData:I,optimisticallyMarkFlowCompleted:x,optimisticallyMarkFlowNotStarted:B,optimisticallyMarkStepCompleted:h,optimisticallyMarkStepNotStarted:b,optimisticallyMarkStepStarted:N}=De(),{data:L,error:O,isLoading:j}=ba(s?`${t}flows${y?"?readonly=true":""}`:null,P,{keepPreviousData:!0});Sa(()=>{if(O){console.error(O);return}L&&L.data&&i(L.data)},[L,O]);function M(C){if(j)return null;let u=o.find(k=>k.slug===C);return!u&&o.length>0&&!I&&!j?(console.log(`Flow with id ${C} not found`),null):(u==null?void 0:u.active)===!1&&!y?null:u}function V(C){var z,he;if(!M(C))return[];let u=M(C).data;return u?(u=le(u),((he=(z=nr(u))==null?void 0:z.data)!=null?he:[]).map(xe=>{let io=J(xe);return _(w({handleSecondaryButtonClick:()=>{xe.skippable===!0&&G(C,xe.id,{skipped:!0})}},xe),{complete:ue(C,xe.id)===Ke||io>=1,blocked:Oe(C,xe.id),hidden:we(C,xe.id),handlePrimaryButtonClick:()=>{(!xe.completionCriteria&&(xe.autoMarkCompleted||xe.autoMarkCompleted===void 0)||xe.completionCriteria&&xe.autoMarkCompleted===!0)&&G(C,xe.id)},progress:io})}).filter(xe=>xe.hidden!==!0)):[]}function le(C){return C.replaceAll(/\${(.*?)}/g,(u,k)=>p[k]===void 0?"":String(p[k]).replace(/[\u00A0-\u9999<>\&]/g,function(z){return"&#"+z.charCodeAt(0)+";"}).replaceAll(/[\\]/g,"\\\\").replaceAll(/[\"]/g,'\\"').replaceAll(/[\/]/g,"\\/").replaceAll(/[\b]/g,"\\b").replaceAll(/[\f]/g,"\\f").replaceAll(/[\n]/g,"\\n").replaceAll(/[\r]/g,"\\r").replaceAll(/[\t]/g,"\\t"))}function pe(C){var k;if(!M(C))return[];let u=M(C).data;return u?(u=le(u),(k=JSON.parse(u))!=null?k:{}):[]}function q(C,u){d(k=>_(w({},k),{[C]:u}))}function se(C){!I&&!j&&C&&JSON.stringify(p)!=JSON.stringify(w(w({},p),C))&&Object.keys(C).forEach(u=>{q(u,C[u])})}let de=wt((C,u,k)=>D(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:u,actionType:Bo,data:k!=null?k:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield N(C,u,z),g(z))}),[n,r,A]),be=wt((C,u,k)=>D(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:u,actionType:He,data:k!=null?k:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield b(C,u),g(z))}),[n,r,A]),G=wt((C,u,k)=>D(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:u,actionType:Ke,data:k!=null?k:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield h(C,u,z),g(z))}),[n,r,A]),Y=wt((C,u)=>D(this,null,function*(){if(!S()||fe(C)===Me)return;let k={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:"unknown",actionType:Me,data:u!=null?u:{},createdAt:new Date,blocked:!1,hidden:!1};yield B(C),X(k)&&g(k)}),[n,r,A]),ee=wt((C,u)=>D(this,null,function*(){if(!S())return;let k={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:"unknown",actionType:bt,data:u!=null?u:{},createdAt:new Date,blocked:!1,hidden:!1};X(k)&&g(k)}),[n,r,A]),Ve=wt((C,u)=>D(this,null,function*(){if(!S())return;let k={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:"unknown",actionType:Z,data:u!=null?u:{},createdAt:new Date,blocked:!1,hidden:!1};X(k)&&(yield x(C),g(k))}),[n,r,A]),Le=wt((C,u)=>D(this,null,function*(){if(!S())return;let k={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:"unknown",actionType:vo,data:u!=null?u:{},createdAt:new Date,blocked:!1,hidden:!1};X(k)&&(yield x(C),g(k))}),[n,r,A]);function X(C){var u;if(!A&&C.actionType===He)return!1;if(A){let k=A.find(z=>z.flowId===C.flowSlug);if(C.actionType===He&&(!(k!=null&&k.stepStates[C.stepId])||k.stepStates[C.stepId].actionType===He)||k&&((u=k.stepStates[C.stepId])==null?void 0:u.actionType)===C.actionType||k&&k.flowState===Z&&C.actionType===Z)return!1}return!0}function ue(C,u){let k=U(C,u);return I?null:k?k.actionType:He}function Oe(C,u){let k=U(C,u);return k?k.blocked:!1}function we(C,u){let k=U(C,u);return k?k.hidden:!1}function U(C,u){var z;if(I)return null;let k=A==null?void 0:A.find(he=>he.flowId===C);return!k||!k.stepStates[u]?null:(z=k.stepStates[u])!=null?z:null}function $(C){var k,z;if(I||!A)return null;if(fe(C)===Me)return(k=V(C)[0])!=null?k:null;let u=(z=A.find(he=>he.flowId===C))==null?void 0:z.lastStepId;return u?V(C).find(he=>he.id===u):null}function W(C){var z;let u=$(C);if(!u)return 0;let k=(z=V(C).findIndex(he=>he.id===u.id))!=null?z:0;return ue(C,u.id)===Ke&&k<V(C).length-1?k+1:k}function J(C){if(!C.completionCriteria)return;let u=ai(C.completionCriteria);if(u===null)return;let k=$e(u),z=Ge(u);return z===0?void 0:k/z}function fe(C){let u=A==null?void 0:A.find(k=>k.flowId===C);return u?u.flowState:null}function $e(C){let u=V(C);return u.length===0?0:u.filter(z=>ue(C,z.id)===Ke).length}function Ge(C){return V(C).length}function Xe(C){let u=o.find(k=>k.slug===C);return u?nr(u.data):null}function St(C){if(y)return!1;if(I)return!0;if(C!=null&&C.targetingLogic&&A){let u=A.find(k=>k.flowId===C.slug);if(u)return u.shouldTrigger===!1}return!!(C!=null&&C.targetingLogic&&n&&n.startsWith("guest_"))}function Lt(C){return!St(M(C))}function $t(){n&&F()}return{getFlow:M,getFlowData:Xe,isLoading:I||j,getStepStatus:ue,getFlowSteps:V,getCurrentStepIndex:W,markStepStarted:de,markStepCompleted:G,markFlowNotStarted:Y,markFlowStarted:ee,markFlowCompleted:Ve,markFlowAborted:Le,markStepNotStarted:be,getFlowStatus:fe,getNumberOfStepsCompleted:$e,getNumberOfSteps:Ge,targetingLogicShouldHideFlow:St,setCustomVariable:q,updateCustomVariables:se,customVariables:p,getStepOptionalProgress:J,getFlowMetadata:pe,isStepBlocked:Oe,isStepHidden:we,hasActiveFullPageFlow:l,setHasActiveFullPageFlow:m,isFlowAvailableToUser:Lt,refresh:$t}}import{useCallback as lr,useContext as wa,useEffect as Ta}from"react";var Wt="guest_";function lo(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:n}=wa(Q),{config:r,apiUrl:s}=Je(),{mutateUserFlowState:p}=De(),d=Dt(),{verifySDKInitiated:l}=Ut();function m(T){return`frigade-user-registered-${T}`}Ta(()=>{if(e&&!t){if(e.startsWith(Wt))return;let T=m(e);localStorage.getItem(T)||(d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify({foreignId:e})})),localStorage.setItem(T,"true"))}},[e,n,t]);let c=lr(T=>D(this,null,function*(){if(!l())return;let S={foreignId:e,properties:T};yield d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify(S)})),i(g=>w(w({},g),T)),p()}),[e,r,n,p]),f=lr((T,S)=>D(this,null,function*(){if(!l())return;let v={foreignId:e,events:[{event:T,properties:S}]};yield d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify(v)})),p()}),[e,r,p]),y=lr((T,S)=>D(this,null,function*(){if(l())if(S){let g=m(T);localStorage.setItem(g,"true"),o(T);let v={foreignId:T,properties:S};yield d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify(v)})),i(P=>w(w({},P),S)),p()}else o(T)}),[r,n,p]);return{userId:e,setUserId:o,setUserIdWithProperties:y,addPropertiesToUser:c,trackEventForUser:f}}import{v4 as Yp}from"uuid";import et,{useEffect as mn,useState as un}from"react";import qe,{useEffect as cr,useState as Ia}from"react";import Io from"styled-components";import Fa from"react";import ka from"styled-components";var pi="fr-",ao="cfr-";function a(e,t){let o=`${pi}${e}`;if(!t)return o;if(t.styleOverrides&&t.styleOverrides[e]){if(typeof t.styleOverrides[e]=="string")return o+" "+t.styleOverrides[e];if(typeof t.styleOverrides[e]=="object")return o+" "+ao+e}return o}function E(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(pi)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Eo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function ke(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Eo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Te(...e){return e.filter(Boolean).join(" ")}function po(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Pa=ka.div`
|
|
2
|
+
var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnPropertyDescriptors;var Po=Object.getOwnPropertySymbols;var oi=Object.prototype.hasOwnProperty,ri=Object.prototype.propertyIsEnumerable;var ti=(e,t,o)=>t in e?ia(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))oi.call(t,o)&&ti(e,o,t[o]);if(Po)for(var o of Po(t))ri.call(t,o)&&ti(e,o,t[o]);return e},_=(e,t)=>na(e,sa(t));var ii=e=>typeof e=="symbol"?e:e+"",Ie=(e,t)=>{var o={};for(var i in e)oi.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i]);if(e!=null&&Po)for(var i of Po(e))t.indexOf(i)<0&&ri.call(e,i)&&(o[i]=e[i]);return o};var D=(e,t,o)=>new Promise((i,n)=>{var r=d=>{try{p(o.next(d))}catch(l){n(l)}},s=d=>{try{p(o.throw(d))}catch(l){n(l)}},p=d=>d.done?i(d.value):Promise.resolve(d.value).then(r,s);p((o=o.apply(e,t)).next())});import Pt,{createContext as Cd,useEffect as Go,useState as je}from"react";import{ThemeProvider as yd}from"styled-components";import kt,{useContext as qp,useEffect as Kt,useState as xo}from"react";import{useCallback as wt,useContext as ya,useEffect as Sa}from"react";import rr,{useMemo as si}from"react";var ni="1.35.51 ";var He="NOT_STARTED_STEP",Z="COMPLETED_FLOW",vo="ABORTED_FLOW",bt="STARTED_FLOW",Me="NOT_STARTED_FLOW",Ke="COMPLETED_STEP",Bo="STARTED_STEP";function Je(){let{publicApiKey:e,userId:t,apiUrl:o}=rr.useContext(Q);return{config:si(()=>({headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-Frigade-SDK-Version":ni,"X-Frigade-SDK-Platform":"React"}}),[e,t]),apiUrl:si(()=>`${o}/v1/public/`,[o])}}var la="frigade-last-call-at-",aa="frigade-last-call-data-";function Dt(){let{shouldGracefullyDegrade:e,readonly:t}=rr.useContext(Q);return(o,i)=>D(this,null,function*(){if(t&&(i.method==="POST"||i.method==="PUT"||i.method==="DELETE"))return Mt();if(e)return console.log(`Skipping ${o} call to Frigade due to error`),Mt();let n=la+o,r=aa+o;if(window&&window.localStorage&&i&&i.body&&i.method==="POST"){let p=window.localStorage.getItem(n),d=window.localStorage.getItem(r);if(p&&d&&d==i.body){let l=new Date(p);if(new Date().getTime()-l.getTime()<1e3)return Mt()}window.localStorage.setItem(n,new Date().toISOString()),window.localStorage.setItem(r,i.body)}let s;try{s=yield fetch(o,i)}catch(p){return Mt(p)}return s?s.ok?s:Mt(s.statusText):Mt()})}function Mt(e){return e&&console.log("Call to Frigade failed",e),{json:()=>({})}}function Ut(){let{publicApiKey:e,shouldGracefullyDegrade:t}=rr.useContext(Q);function o(){return t?(console.error("Frigade hooks cannot be used when Frigade SDK has failed to initialize"),!1):e?!0:(console.error("Frigade hooks cannot be used outside the scope of FrigadeProvider"),!1)}return{verifySDKInitiated:o}}import{useContext as ha,useState as li}from"react";import{useContext as da,useEffect as ca,useState as ma}from"react";import ua from"swr";import{useContext as pa}from"react";function Be(){let{openFlowStates:e,setOpenFlowStates:t,hasActiveFullPageFlow:o,setCompletedFlowsToKeepOpenDuringSession:i,completedFlowsToKeepOpenDuringSession:n}=pa(Q);function r(c,f=!1){var y;return(y=e[c])!=null?y:f}function s(c,f){t(y=>_(w({},y),{[c]:f}))}function p(c){t(f=>{let S=f,{[c]:y}=S,T=Ie(S,[ii(c)]);return w({},T)})}function d(c){n.includes(c)||i(f=>[...f,c])}function l(c){return n.includes(c)}function m(c){return Object.entries(e).some(([f,y])=>y&&f!=c)||o}return{getOpenFlowState:r,setOpenFlowState:s,resetOpenFlowState:p,hasOpenModals:m,setKeepCompletedFlowOpenDuringSession:d,shouldKeepCompletedFlowOpenDuringSession:l}}import fa from"swr/immutable";import no from"core-js-pure/actual/structured-clone";function ir(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ce(...e){let t=e.shift(),o=e.length===1?e[0]:Ce(...e);if(!ir(t)||!ir(o))throw new Error("deepmerge can only merge Objects");let i=no(t);return Object.entries(o).forEach(([n,r])=>{ir(r)?i[n]!==void 0?Object.assign(i,{[n]:Ce(i[n],no(r))}):Object.assign(i,{[n]:no(r)}):Array.isArray(r)?i[n]!==void 0?Object.assign(i,{[n]:[...i[n],...no(r)]}):Object.assign(i,{[n]:no(r)}):Object.assign(i,{[n]:r})}),i}var ga="unknown";function De(){let{config:e,apiUrl:t}=Je(),{publicApiKey:o,userId:i,organizationId:n,flows:r,setShouldGracefullyDegrade:s,readonly:p}=da(Q),{resetOpenFlowState:d}=Be(),[l,m]=ma(!1),c={data:r.map(h=>({flowId:h.id,flowState:Z,lastStepId:null,userId:i,foreignUserId:i,stepStates:{},shouldTrigger:!1}))},f=h=>fetch(h,e).then(b=>{if(b.ok)return b.json();throw new Error("Failed to fetch user flow states")}).catch(b=>(console.log(`Error fetching ${h}: ${b}. Will gracefully degrade and hide Frigade`),s(!0),c)),y=o&&r&&i?`${t}userFlowStates?foreignUserId=${encodeURIComponent(i)}${n?`&foreignUserGroupId=${encodeURIComponent(n)}`:""}`:null,{data:T,isLoading:S,mutate:g,error:E}=p?fa(y,f):ua(y,f,{revalidateOnFocus:!0,revalidateIfStale:!0,keepPreviousData:!0,revalidateOnMount:!1,errorRetryInterval:1e4,errorRetryCount:3,onError:()=>c,onLoadingSlow:()=>c}),P=T==null?void 0:T.data;ca(()=>{!l&&!S&&P&&m(!0)},[P,l,S]);function F(h){return D(this,null,function*(){if(P&&!p){let b=P.find(N=>N.flowId===h);b&&b.flowState!==Z&&(b.flowState=Z),yield g(Promise.resolve(Ce(T,{data:P})),{optimisticData:Ce(T,{data:P}),revalidate:!1,rollbackOnError:!1})}})}function A(h,b,N){return D(this,null,function*(){if(P){let L=P.find(O=>O.flowId===h);L&&(L.stepStates[b]=N,L.flowState=bt),yield g(Promise.resolve(Ce(T,{data:P})),{optimisticData:Ce(T,{data:P}),revalidate:!1,rollbackOnError:!1})}})}function I(h,b,N){return D(this,null,function*(){if(P){let L=P.find(O=>O.flowId===h);L&&(L.lastStepId=b,L.stepStates[b]=N,L.flowState=bt),yield g(Ce(T,{data:P}),{optimisticData:Ce(T,{data:P}),revalidate:!1,rollbackOnError:!1})}})}function x(h){return D(this,null,function*(){if(P){let b=P.find(N=>N.flowId===h);b&&b.flowState!==Me&&(b.flowState=Me,b.lastStepId=ga,Object.keys(b.stepStates).forEach(N=>{b.stepStates[N].actionType=He,b.stepStates[N].createdAt=new Date().toISOString()}),yield g(Ce(T,{data:P}),{optimisticData:Ce(T,{data:P}),revalidate:!1,rollbackOnError:!1}),d(h))}})}function v(h,b){return D(this,null,function*(){if(P){let N=P.find(L=>L.flowId===h);N&&N.stepStates[b]!==He&&(N.stepStates[b]=He),yield g(Ce(T,{data:P}),{optimisticData:Ce(T,{data:P}),revalidate:!1,rollbackOnError:!1})}})}return{userFlowStatesData:P,isLoadingUserFlowStateData:!l,mutateUserFlowState:g,optimisticallyMarkFlowCompleted:F,optimisticallyMarkFlowNotStarted:x,optimisticallyMarkStepCompleted:A,optimisticallyMarkStepNotStarted:v,optimisticallyMarkStepStarted:I,error:E}}function so(){let{config:e,apiUrl:t}=Je(),{userFlowStatesData:o,mutateUserFlowState:i}=De(),{failedFlowResponses:n,setFailedFlowResponses:r,flowResponses:s,setFlowResponses:p}=ha(Q),[d,l]=li(new Set),[m,c]=li(new Set),f=Dt();function y(g){let E=JSON.stringify(g);if(d.has(E))return null;d.add(E),l(d),m.add(g),c(m);let P=s==null?void 0:s.find(F=>F.flowSlug===g.flowSlug&&F.stepId===g.stepId&&F.actionType===g.actionType&&F.createdAt===g.createdAt);return f(`${t}flowResponses`,_(w({},e),{method:"POST",body:E})).then(F=>{F.status!==200&&F.status!==201?(console.log("Failed to send flow response for step "+g.stepId+". Will retry again later."),r([...n,g])):P||p(A=>[...A!=null?A:[],g])})}function T(g){return D(this,null,function*(){g.foreignUserId&&(g.actionType===bt||g.actionType===Me?yield y(g):g.actionType===Z?yield y(g):g.actionType===Bo?yield y(g):g.actionType===Ke?yield y(g):g.actionType===vo?yield y(g):g.actionType===He&&(yield y(g)))})}function S(){let g=[];return o==null||o.forEach(E=>{if(E&&E.stepStates&&Object.keys(E.stepStates).length!==0)for(let P in E.stepStates){let F=E.stepStates[P];g.push({foreignUserId:E.foreignUserId,flowSlug:E.flowId,stepId:F.stepId,actionType:F.actionType,data:{},createdAt:new Date(F.createdAt),blocked:F.blocked,hidden:F.hidden})}}),[...g,...s]}return{addResponse:T,setFlowResponses:p,getFlowResponses:S}}import ba from"swr";var xa=/user.flow\(([^\)]+)\) == '?COMPLETED_FLOW'?/gm,ai=e=>{let t=xa.exec(e);if(t===null)return null;let o=null;return t.forEach((i,n)=>{let r=Ca(i,"'","");r.startsWith("flow_")&&(o=r)}),o},Ca=function(e,t,o){return e.replace(new RegExp(t,"g"),o)};function nr(e){try{return JSON.parse(e)}catch(t){return console.error("Failed to parse Frigade config.yml to JSON",t),null}}var sr=(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))(sr||{});function R(){let{config:e,apiUrl:t}=Je(),{flows:o,setFlows:i,userId:n,organizationId:r,publicApiKey:s,customVariables:p,setCustomVariables:d,hasActiveFullPageFlow:l,setHasActiveFullPageFlow:m,setFlowResponses:c,setShouldGracefullyDegrade:f,readonly:y}=ya(Q),T={data:[]},{verifySDKInitiated:S}=Ut(),{addResponse:g,getFlowResponses:E}=so(),P=C=>fetch(C,e).then(u=>u.ok?u.json():(console.log(`Error fetching ${C} (${u.status}): ${u.statusText}. Will gracefully degrade and hide Frigade`),f(!0),T)).catch(u=>(console.log(`Error fetching ${C}: ${u}. Will gracefully degrade and hide Frigade`),f(!0),T)),{mutateUserFlowState:F,userFlowStatesData:A,isLoadingUserFlowStateData:I,optimisticallyMarkFlowCompleted:x,optimisticallyMarkFlowNotStarted:v,optimisticallyMarkStepCompleted:h,optimisticallyMarkStepNotStarted:b,optimisticallyMarkStepStarted:N}=De(),{data:L,error:O,isLoading:j}=ba(s?`${t}flows${y?"?readonly=true":""}`:null,P,{keepPreviousData:!0});Sa(()=>{if(O){console.error(O);return}L&&L.data&&i(L.data)},[L,O]);function M(C){if(j)return null;let u=o.find(k=>k.slug===C);return!u&&o.length>0&&!I&&!j?(console.log(`Flow with id ${C} not found`),null):(u==null?void 0:u.active)===!1&&!y?null:u}function G(C){var z,he;if(!M(C))return[];let u=M(C).data;return u?(u=le(u),((he=(z=nr(u))==null?void 0:z.data)!=null?he:[]).map(xe=>{let io=J(xe);return _(w({handleSecondaryButtonClick:()=>{xe.skippable===!0&&V(C,xe.id,{skipped:!0})}},xe),{complete:ue(C,xe.id)===Ke||io>=1,blocked:Oe(C,xe.id),hidden:we(C,xe.id),handlePrimaryButtonClick:()=>{(!xe.completionCriteria&&(xe.autoMarkCompleted||xe.autoMarkCompleted===void 0)||xe.completionCriteria&&xe.autoMarkCompleted===!0)&&V(C,xe.id)},progress:io})}).filter(xe=>xe.hidden!==!0)):[]}function le(C){return C.replaceAll(/\${(.*?)}/g,(u,k)=>p[k]===void 0?"":String(p[k]).replace(/[\u00A0-\u9999<>\&]/g,function(z){return"&#"+z.charCodeAt(0)+";"}).replaceAll(/[\\]/g,"\\\\").replaceAll(/[\"]/g,'\\"').replaceAll(/[\/]/g,"\\/").replaceAll(/[\b]/g,"\\b").replaceAll(/[\f]/g,"\\f").replaceAll(/[\n]/g,"\\n").replaceAll(/[\r]/g,"\\r").replaceAll(/[\t]/g,"\\t"))}function pe(C){var k;if(!M(C))return[];let u=M(C).data;return u?(u=le(u),(k=JSON.parse(u))!=null?k:{}):[]}function q(C,u){d(k=>_(w({},k),{[C]:u}))}function se(C){!I&&!j&&C&&JSON.stringify(p)!=JSON.stringify(w(w({},p),C))&&Object.keys(C).forEach(u=>{q(u,C[u])})}let de=wt((C,u,k)=>D(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:u,actionType:Bo,data:k!=null?k:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield N(C,u,z),g(z))}),[n,r,A]),be=wt((C,u,k)=>D(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:u,actionType:He,data:k!=null?k:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield b(C,u),g(z))}),[n,r,A]),V=wt((C,u,k)=>D(this,null,function*(){if(!S())return;let z={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:u,actionType:Ke,data:k!=null?k:{},createdAt:new Date,blocked:!1,hidden:!1};X(z)&&(yield h(C,u,z),g(z))}),[n,r,A]),Y=wt((C,u)=>D(this,null,function*(){if(!S()||fe(C)===Me)return;let k={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:"unknown",actionType:Me,data:u!=null?u:{},createdAt:new Date,blocked:!1,hidden:!1};yield v(C),X(k)&&g(k)}),[n,r,A]),ee=wt((C,u)=>D(this,null,function*(){if(!S())return;let k={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:"unknown",actionType:bt,data:u!=null?u:{},createdAt:new Date,blocked:!1,hidden:!1};X(k)&&g(k)}),[n,r,A]),Ve=wt((C,u)=>D(this,null,function*(){if(!S())return;let k={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:"unknown",actionType:Z,data:u!=null?u:{},createdAt:new Date,blocked:!1,hidden:!1};X(k)&&(yield x(C),g(k))}),[n,r,A]),Le=wt((C,u)=>D(this,null,function*(){if(!S())return;let k={foreignUserId:n,foreignUserGroupId:r!=null?r:null,flowSlug:C,stepId:"unknown",actionType:vo,data:u!=null?u:{},createdAt:new Date,blocked:!1,hidden:!1};X(k)&&(yield x(C),g(k))}),[n,r,A]);function X(C){var u;if(!A&&C.actionType===He)return!1;if(A){let k=A.find(z=>z.flowId===C.flowSlug);if(C.actionType===He&&(!(k!=null&&k.stepStates[C.stepId])||k.stepStates[C.stepId].actionType===He)||k&&((u=k.stepStates[C.stepId])==null?void 0:u.actionType)===C.actionType||k&&k.flowState===Z&&C.actionType===Z)return!1}return!0}function ue(C,u){let k=U(C,u);return I?null:k?k.actionType:He}function Oe(C,u){let k=U(C,u);return k?k.blocked:!1}function we(C,u){let k=U(C,u);return k?k.hidden:!1}function U(C,u){var z;if(I)return null;let k=A==null?void 0:A.find(he=>he.flowId===C);return!k||!k.stepStates[u]?null:(z=k.stepStates[u])!=null?z:null}function $(C){var k,z;if(I||!A)return null;if(fe(C)===Me)return(k=G(C)[0])!=null?k:null;let u=(z=A.find(he=>he.flowId===C))==null?void 0:z.lastStepId;return u?G(C).find(he=>he.id===u):null}function W(C){var z;let u=$(C);if(!u)return 0;let k=(z=G(C).findIndex(he=>he.id===u.id))!=null?z:0;return ue(C,u.id)===Ke&&k<G(C).length-1?k+1:k}function J(C){if(!C.completionCriteria)return;let u=ai(C.completionCriteria);if(u===null)return;let k=$e(u),z=Ge(u);return z===0?void 0:k/z}function fe(C){let u=A==null?void 0:A.find(k=>k.flowId===C);return u?u.flowState:null}function $e(C){let u=G(C);return u.length===0?0:u.filter(z=>ue(C,z.id)===Ke).length}function Ge(C){return G(C).length}function Xe(C){let u=o.find(k=>k.slug===C);return u?nr(u.data):null}function St(C){if(y)return!1;if(I)return!0;if(C!=null&&C.targetingLogic&&A){let u=A.find(k=>k.flowId===C.slug);if(u)return u.shouldTrigger===!1}return!!(C!=null&&C.targetingLogic&&n&&n.startsWith("guest_"))}function Lt(C){return!St(M(C))}function $t(){n&&F()}return{getFlow:M,getFlowData:Xe,isLoading:I||j,getStepStatus:ue,getFlowSteps:G,getCurrentStepIndex:W,markStepStarted:de,markStepCompleted:V,markFlowNotStarted:Y,markFlowStarted:ee,markFlowCompleted:Ve,markFlowAborted:Le,markStepNotStarted:be,getFlowStatus:fe,getNumberOfStepsCompleted:$e,getNumberOfSteps:Ge,targetingLogicShouldHideFlow:St,setCustomVariable:q,updateCustomVariables:se,customVariables:p,getStepOptionalProgress:J,getFlowMetadata:pe,isStepBlocked:Oe,isStepHidden:we,hasActiveFullPageFlow:l,setHasActiveFullPageFlow:m,isFlowAvailableToUser:Lt,refresh:$t}}import{useCallback as lr,useContext as wa,useEffect as Ta}from"react";var Wt="guest_";function lo(){let{userId:e,organizationId:t,setUserId:o,setUserProperties:i,shouldGracefullyDegrade:n}=wa(Q),{config:r,apiUrl:s}=Je(),{mutateUserFlowState:p}=De(),d=Dt(),{verifySDKInitiated:l}=Ut();function m(T){return`frigade-user-registered-${T}`}Ta(()=>{if(e&&!t){if(e.startsWith(Wt))return;let T=m(e);localStorage.getItem(T)||(d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify({foreignId:e})})),localStorage.setItem(T,"true"))}},[e,n,t]);let c=lr(T=>D(this,null,function*(){if(!l())return;let S={foreignId:e,properties:T};yield d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify(S)})),i(g=>w(w({},g),T)),p()}),[e,r,n,p]),f=lr((T,S)=>D(this,null,function*(){if(!l())return;let E={foreignId:e,events:[{event:T,properties:S}]};yield d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify(E)})),p()}),[e,r,p]),y=lr((T,S)=>D(this,null,function*(){if(l())if(S){let g=m(T);localStorage.setItem(g,"true"),o(T);let E={foreignId:T,properties:S};yield d(`${s}users`,_(w({},r),{method:"POST",body:JSON.stringify(E)})),i(P=>w(w({},P),S)),p()}else o(T)}),[r,n,p]);return{userId:e,setUserId:o,setUserIdWithProperties:y,addPropertiesToUser:c,trackEventForUser:f}}import{v4 as Yp}from"uuid";import et,{useEffect as mn,useState as un}from"react";import qe,{useEffect as cr,useState as Ia}from"react";import Io from"styled-components";import Fa from"react";import ka from"styled-components";var pi="fr-",ao="cfr-";function a(e,t){let o=`${pi}${e}`;if(!t)return o;if(t.styleOverrides&&t.styleOverrides[e]){if(typeof t.styleOverrides[e]=="string")return o+" "+t.styleOverrides[e];if(typeof t.styleOverrides[e]=="object")return o+" "+ao+e}return o}function B(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(pi)?"":`:not(${o.map(i=>`.${i}`).join(", ")})`}function Eo(e){return e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}function ke(e){return e!=null&&e.styleOverrides?Object.keys(e.styleOverrides).map(t=>`${Eo(t)}: ${e.styleOverrides[t]};`).join(" "):""}function Te(...e){return e.filter(Boolean).join(" ")}function po(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Pa=ka.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
position: fixed;
|
|
@@ -7,7 +7,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
7
7
|
left: 0;
|
|
8
8
|
bottom: 0;
|
|
9
9
|
right: 0;
|
|
10
|
-
${e=>
|
|
10
|
+
${e=>B(e)} {
|
|
11
11
|
background-color: rgba(0, 0, 0, 0.6);
|
|
12
12
|
z-index: 1400;
|
|
13
13
|
}
|
|
@@ -28,7 +28,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
28
28
|
opacity: 0.8;
|
|
29
29
|
}
|
|
30
30
|
`,Ee=()=>ar.createElement(Ba,null,ar.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 20 20"},ar.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5 15L15 5M5 5l10 10"})));import{Portal as Na}from"react-portal";import Ti from"react";import pr from"react";function Ea({style:e,className:t}){return pr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"54",height:"14",fill:"none",viewBox:"0 0 54 14",style:e,className:t},pr.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"}),pr.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 ci=Ea;import dr from"styled-components";import rt from"styled-components";var Ao=rt.div`
|
|
31
|
-
${e=>
|
|
31
|
+
${e=>B(e)} {
|
|
32
32
|
background: ${e=>e.appearance.theme.colorBackground};
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -58,11 +58,11 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
58
58
|
top: 12px;
|
|
59
59
|
right: 12px;
|
|
60
60
|
`,mi=rt.div`
|
|
61
|
-
${e=>
|
|
61
|
+
${e=>B(e)} {
|
|
62
62
|
${e=>e.hasImage?Aa:Oa};
|
|
63
63
|
}
|
|
64
64
|
`,ui=rt.img`
|
|
65
|
-
${e=>
|
|
65
|
+
${e=>B(e)} {
|
|
66
66
|
display: block;
|
|
67
67
|
width: 100%;
|
|
68
68
|
height: auto;
|
|
@@ -70,7 +70,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
70
70
|
object-fit: cover;
|
|
71
71
|
}
|
|
72
72
|
`,fi=rt.div`
|
|
73
|
-
${e=>
|
|
73
|
+
${e=>B(e)} {
|
|
74
74
|
display: block;
|
|
75
75
|
width: 100%;
|
|
76
76
|
height: auto;
|
|
@@ -95,14 +95,14 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
95
95
|
flex-shrink: 1;
|
|
96
96
|
gap: 8px;
|
|
97
97
|
height: 64px;
|
|
98
|
-
${e=>
|
|
98
|
+
${e=>B(e)} {
|
|
99
99
|
flex-direction: row;
|
|
100
100
|
justify-content: ${e=>e.showStepCount?"flex-end":"flex-start"};
|
|
101
101
|
align-content: center;
|
|
102
102
|
align-items: center;
|
|
103
103
|
}
|
|
104
104
|
`,yi=rt.p`
|
|
105
|
-
${e=>
|
|
105
|
+
${e=>B(e)} {
|
|
106
106
|
font-style: normal;
|
|
107
107
|
font-weight: 600;
|
|
108
108
|
font-size: 15px;
|
|
@@ -144,7 +144,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
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
146
|
`;function Oo({appearance:e}){return Ti.createElement(wi,{className:a("poweredByFrigadeContainer",e),appearance:e},"Powered by \xA0",Ti.createElement(ci,null))}var La=Io.div`
|
|
147
|
-
${e=>
|
|
147
|
+
${e=>B(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}};
|
|
150
150
|
/* Mobile */
|
|
@@ -194,7 +194,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
194
194
|
right: 16px;
|
|
195
195
|
cursor: pointer;
|
|
196
196
|
z-index: 1501;
|
|
197
|
-
${e=>
|
|
197
|
+
${e=>B(e)} {
|
|
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
|
}
|
|
@@ -215,7 +215,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
215
215
|
bottom: 0;
|
|
216
216
|
left: 0;
|
|
217
217
|
`}return"right: 0; bottom: 0;"}var _a=No.div`
|
|
218
|
-
${e=>
|
|
218
|
+
${e=>B(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}};
|
|
221
221
|
position: fixed;
|
|
@@ -239,7 +239,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
239
239
|
right: 16px;
|
|
240
240
|
cursor: pointer;
|
|
241
241
|
z-index: 1501;
|
|
242
|
-
${e=>
|
|
242
|
+
${e=>B(e)} {
|
|
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
|
}
|
|
@@ -250,7 +250,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
250
250
|
display: none;
|
|
251
251
|
}
|
|
252
252
|
`,Lo=({onClose:e,visible:t,headerContent:o=null,children:i,appearance:n,modalPosition:r="bottom-right",dismissible:s=!0})=>{let[p,d]=Ua("");return mr(()=>{let l=getComputedStyle(document.body).getPropertyValue("overflow");d(l)},[]),mr(()=>{let l=m=>{m.key==="Escape"&&e()};return document.addEventListener("keydown",l),()=>{document.removeEventListener("keydown",l)}},[e]),mr(()=>{let l=document.body.style;return t?l.setProperty("overflow","hidden"):l.setProperty("overflow",p),()=>{l.setProperty("overflow",p)}},[t]),t?ut.createElement(Wa,null,ut.createElement(_a,{appearance:n,className:a("cornerModalContainer",n),modalPosition:r},s&&ut.createElement(ja,{className:a("cornerModalClose",n),onClick:()=>e()},ut.createElement(Ee,null)),o&&ut.createElement(Ha,null,o),ut.createElement(Va,null,i))):ut.createElement(ut.Fragment,null)};import{useContext as Ga}from"react";function te(){let{defaultAppearance:e}=Ga(Q);function t(o){var n,r,s;let i=JSON.parse(JSON.stringify(e));return o?{styleOverrides:Object.assign((n=i.styleOverrides)!=null?n:{},(r=o.styleOverrides)!=null?r:{}),theme:Object.assign(i.theme,(s=o.theme)!=null?s:{})}:i}return{mergeAppearanceWithDefault:t}}import Tt,{useContext as up,useEffect as zi,useState as wr}from"react";import Wo from"styled-components";import Do,{useEffect as Ei,useState as gr}from"react";import hr from"styled-components";import $o from"styled-components";var Fi=$o.label`
|
|
253
|
-
${e=>
|
|
253
|
+
${e=>B(e)} {
|
|
254
254
|
font-size: 12px;
|
|
255
255
|
line-height: 18px;
|
|
256
256
|
margin-bottom: 5px;
|
|
@@ -261,7 +261,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
261
261
|
}
|
|
262
262
|
display: flex;
|
|
263
263
|
`,ki=$o.label`
|
|
264
|
-
${e=>
|
|
264
|
+
${e=>B(e)} {
|
|
265
265
|
font-size: 12px;
|
|
266
266
|
line-height: 20px;
|
|
267
267
|
margin-bottom: 5px;
|
|
@@ -285,7 +285,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
285
285
|
flex-direction: column;
|
|
286
286
|
width: 100%;
|
|
287
287
|
`,xr=hr.input`
|
|
288
|
-
${e=>
|
|
288
|
+
${e=>B(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}};
|
|
291
291
|
font-size: 14px;
|
|
@@ -301,7 +301,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
301
301
|
padding: 0 10px;
|
|
302
302
|
margin-bottom: 10px;
|
|
303
303
|
`,qa=hr.textarea`
|
|
304
|
-
${e=>
|
|
304
|
+
${e=>B(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}};
|
|
307
307
|
font-size: 14px;
|
|
@@ -316,14 +316,14 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
316
316
|
min-height: 70px;
|
|
317
317
|
box-sizing: border-box;
|
|
318
318
|
margin-bottom: 10px;
|
|
319
|
-
`;function Cr({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:n}){let r=e,[s,p]=gr((n==null?void 0:n.text)||""),[d,l]=gr(!1),[m,c]=gr(!1),f=xr;Ei(()=>{s===""&&!d&&(l(!0),y(""))},[]),Ei(()=>{if(m){y(s);return}},[m]);function y(S){var
|
|
319
|
+
`;function Cr({formInput:e,customFormTypeProps:t,onSaveInputData:o,setFormValidationErrors:i,inputData:n}){let r=e,[s,p]=gr((n==null?void 0:n.text)||""),[d,l]=gr(!1),[m,c]=gr(!1),f=xr;Ei(()=>{s===""&&!d&&(l(!0),y(""))},[]),Ei(()=>{if(m){y(s);return}},[m]);function y(S){var E;if(p(S),o({text:S}),r.required===!0&&S.trim()===""){i([{id:r.id,message:`${(E=r.title)!=null?E:"Field"} is required`,hidden:!m}]);return}let g=Bi(S,r.validation);if(g&&(S.trim()!==""||r.required===!0)){i([{id:r.id,message:g,hidden:!m}]);return}i([])}r.multiline&&(f=qa);function T(){var S;switch((S=r==null?void 0:r.validation)==null?void 0:S.type){case"email":return"email";case"number":return"number";case"password":return"password"}return null}return Do.createElement(Ka,null,Do.createElement(ft,{title:r.title,required:r.required,appearance:t.appearance}),Do.createElement(f,{className:a("inputComponent",t.appearance),value:s,onChange:S=>{y(S.target.value)},appearance:t.appearance,placeholder:r.placeholder,type:T(),onBlur:()=>{c(!0)}}),Do.createElement(zt,{title:r.subtitle,appearance:t.appearance}))}import Ze,{useEffect as Ai,useState as Oi}from"react";import Ii from"styled-components";var yr="",Ya=Ii.div`
|
|
320
320
|
display: flex;
|
|
321
321
|
flex-direction: column;
|
|
322
322
|
width: 100%;
|
|
323
323
|
-webkit-appearance: none;
|
|
324
324
|
appearance: none;
|
|
325
325
|
`,Xa=Ii.select`
|
|
326
|
-
${e=>
|
|
326
|
+
${e=>B(e)} {
|
|
327
327
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
328
328
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
329
329
|
font-size: 14px;
|
|
@@ -343,7 +343,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
343
343
|
background-repeat: no-repeat;
|
|
344
344
|
background-size: 1.5em 1.5em;
|
|
345
345
|
-webkit-print-color-adjust: exact;
|
|
346
|
-
`;function Ni({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var m,c,f,y,T,S,g,
|
|
346
|
+
`;function Ni({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var m,c,f,y,T,S,g,E,P;let r=e,[s,p]=Oi(!1),[d,l]=Oi(!1);return Ai(()=>{var F,A,I,x;if(!((F=i==null?void 0:i.choice)!=null&&F[0])&&!s){if(p(!0),r.requireSelection){o({choice:[yr]});return}if(r.defaultValue&&((A=r.props.options)!=null&&A.find(v=>v.id===r.defaultValue))){let v=(I=r.props.options)==null?void 0:I.find(h=>h.id===r.defaultValue);o({choice:[v.id]})}else o({choice:[((x=r.props.options)==null?void 0:x[0].id)||""]})}},[]),Ai(()=>{var F;d&&(r.requireSelection&&((F=i==null?void 0:i.choice)==null?void 0:F[0])===yr?n([{message:"Please select an option",id:r.id}]):n([]))},[(m=i==null?void 0:i.choice)==null?void 0:m[0],d]),Ze.createElement(Ya,null,Ze.createElement(ft,{title:r.title,required:!1,appearance:t.appearance}),Ze.createElement(Xa,{value:(c=i==null?void 0:i.choice)==null?void 0:c[0],onChange:F=>{l(!0),o({choice:[F.target.value]})},placeholder:r.placeholder,appearance:t.appearance,className:a("multipleChoiceSelect",t.appearance)},r.requireSelection&&Ze.createElement("option",{key:"null-value",value:yr,disabled:!0},(f=r.placeholder)!=null?f:"Select an option"),(y=r.props.options)==null?void 0:y.map(F=>Ze.createElement("option",{key:F.id,value:F.id},F.title))),((S=(T=r.props.options)==null?void 0:T.find(F=>{var A;return F.id===((A=i==null?void 0:i.choice)==null?void 0:A[0])}))==null?void 0:S.isOpenEnded)&&Ze.createElement(Ze.Fragment,null,Ze.createElement(ft,{title:(P=(E=(g=r.props.options)==null?void 0:g.find(F=>{var A;return F.id===((A=i==null?void 0:i.choice)==null?void 0:A[0])}))==null?void 0:E.openEndedLabel)!=null?P:"Please specify",required:!1,appearance:t.appearance}),Ze.createElement(xr,{type:"text",placeholder:"Enter your answer here",onChange:F=>{o({choice:[F.target.value]})},appearance:t.appearance})),Ze.createElement(zt,{title:r.subtitle,appearance:t.appearance}))}import uo,{useEffect as Sr,useState as $i}from"react";import Mi from"styled-components";import mo from"react";import co from"react";var Li=({color:e,percentage:t,size:o})=>{let i=o*.5-2,n=2*Math.PI*i,r=(1-t)*n;return co.createElement("circle",{r:i,cx:o*.5,cy:o*.5,fill:"transparent",stroke:r!==n?e:"",strokeWidth:"3px",strokeDasharray:n,strokeDashoffset:t?r:0})},Ja=({fillColor:e,size:t,percentage:o,children:i,bgColor:n="#D9D9D9",className:r,style:s})=>co.createElement("svg",{style:s,className:r,width:t,height:t,overflow:"visible"},co.createElement("g",{transform:`rotate(-90 ${`${t*.5} ${t*.5}`})`},co.createElement(Li,{color:n,size:t}),co.createElement(Li,{color:e,percentage:Math.max(o,.1),size:t})),i),_t=Ja;import Qa from"styled-components";var Za=({color:e="#FFFFFF"})=>mo.createElement("svg",{width:10,height:8,viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},mo.createElement("path",{d:"M1 4.34815L3.4618 7L3.4459 6.98287L9 1",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),Ra={width:"22px",height:"22px",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},ep={width:"22px",height:"22px",borderRadius:"40px",display:"flex",justifyContent:"center",alignItems:"center"},tp={border:"1px solid #000000",color:"#FFFFFF"},op={border:"1px solid #C5CBD3"},rp={color:"#FFFFFF"},ip={border:"1px solid #C5CBD3"},np=e=>e==="square"?Ra:ep,sp=(e,t)=>e==="square"?t?tp:op:t?rp:ip,lp=Qa.div`
|
|
347
347
|
${e=>ke(e)}
|
|
348
348
|
`,nt=({value:e,type:t="round",primaryColor:o="#000000",progress:i,appearance:n=it,style:r,className:s})=>{let p=np(t),d=sp(t,e);return e===!0?p=_(w(w({},p),d),{backgroundColor:n.theme.colorTextSuccess,borderColor:t==="square"?o:"none"}):p=w(w({},p),d),e!==!0&&t==="round"&&i!==void 0&&i!==1?mo.createElement(_t,{fillColor:o,percentage:i,size:22}):mo.createElement(lp,{styleOverrides:p,style:r,role:"checkbox",className:Te(a("checkIconContainer",n),a(e?"checkIconContainerChecked":"checkIconContainerUnchecked",n),e?"checkIconContainerChecked":"checkIconContainerUnchecked",s)},e&&mo.createElement(Za,{color:"#FFFFFF"}))};var ap=Mi.div`
|
|
349
349
|
display: flex;
|
|
@@ -352,7 +352,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
352
352
|
-webkit-appearance: none;
|
|
353
353
|
appearance: none;
|
|
354
354
|
`,pp=Mi.button`
|
|
355
|
-
${e=>
|
|
355
|
+
${e=>B(e)} {
|
|
356
356
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
357
357
|
border: 1px solid ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
358
358
|
font-size: 14px;
|
|
@@ -377,7 +377,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
377
377
|
padding: 0 18px;
|
|
378
378
|
margin-bottom: 10px;
|
|
379
379
|
`;function Di({formInput:e,customFormTypeProps:t,onSaveInputData:o,inputData:i,setFormValidationErrors:n}){var m;let r=e,[s,p]=$i((i==null?void 0:i.choice)||[]),[d,l]=$i(!1);return Sr(()=>{s.length==0&&!d&&(l(!0),o({choice:[]}))},[]),Sr(()=>{o({choice:s})},[s]),Sr(()=>{r.required&&(s.length<r.props.minChoices||s.length>r.props.maxChoices)?n([{message:"",id:r.id}]):n([])},[s]),uo.createElement(ap,null,uo.createElement(ft,{title:r.title,required:r.required,appearance:t.appearance}),(m=r.props.options)==null?void 0:m.map(c=>uo.createElement(pp,{appearance:t.appearance,className:a(s.includes(c.id)?"multipleChoiceListItemSelected":"multipleChoiceListItem",t.appearance),key:c.id,value:c.id,"data-selected":s.includes(c.id),onClick:()=>{if(s.includes(c.id)){p(s.filter(f=>f!==c.id));return}s.length<r.props.maxChoices?p([...s,c.id]):s.length==1&&r.props.maxChoices==1&&p([c.id])}},c.title,uo.createElement(nt,{type:"round",primaryColor:t.appearance.theme.colorPrimary,value:s.includes(c.id),appearance:t.appearance}))),uo.createElement(zt,{title:r.subtitle,appearance:t.appearance}))}import Uo from"react";import Ui from"styled-components";import dp from"dompurify";function ce(e){return{__html:dp.sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img"],ALLOWED_ATTR:["style","class","target","id","href","alt","src"]})}}var cp=Ui.h1`
|
|
380
|
-
${e=>
|
|
380
|
+
${e=>B(e)} {
|
|
381
381
|
font-style: normal;
|
|
382
382
|
font-weight: 700;
|
|
383
383
|
font-size: ${e=>e.size=="small"?"15px":"18px"};
|
|
@@ -389,7 +389,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
389
389
|
color: ${e=>e.appearance.theme.colorText};
|
|
390
390
|
}
|
|
391
391
|
`,mp=Ui.h2`
|
|
392
|
-
${e=>
|
|
392
|
+
${e=>B(e)} {
|
|
393
393
|
font-style: normal;
|
|
394
394
|
font-weight: 400;
|
|
395
395
|
font-size: 14px;
|
|
@@ -415,7 +415,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
415
415
|
`,xp=Wo.div`
|
|
416
416
|
padding-left: 1px;
|
|
417
417
|
padding-right: 1px;
|
|
418
|
-
`,Cp={text:Cr,multipleChoice:Ni,multipleChoiceList:Di},Tr="frigade-multiInputStepTypeData";function _i({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r,customFormElements:s,prefillData:p}){var I;let d=t.props,[l,m]=wr([]),[c,f]=wr([]),{userId:y}=lo(),[T,S]=wr(F()||(p?p[t.id]:null)||{}),{readonly:g}=up(Q),
|
|
418
|
+
`,Cp={text:Cr,multipleChoice:Ni,multipleChoiceList:Di},Tr="frigade-multiInputStepTypeData";function _i({flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r,customFormElements:s,prefillData:p}){var I;let d=t.props,[l,m]=wr([]),[c,f]=wr([]),{userId:y}=lo(),[T,S]=wr(F()||(p?p[t.id]:null)||{}),{readonly:g}=up(Q),E=w(w({},Cp),s);zi(()=>{i(l.length===0)},[l,i]),zi(()=>{n(T)},[T]);function P(x,v){S(h=>{let b=_(w({},h),{[x.id]:v});return window&&window.localStorage&&!g&&window.localStorage.setItem(A(),JSON.stringify(b)),b})}function F(){if(window&&window.localStorage){let x=window.localStorage.getItem(A());if(x)return JSON.parse(x)}return null}function A(){return`${Tr}-${e}-${t.id}-${y}`}return Tt.createElement(xp,{className:a("multiInput",r)},Tt.createElement(Ae,{appearance:r,title:t.title,subtitle:t.subtitle}),Tt.createElement(fp,{className:a("multiInputContainer",r)},(I=d==null?void 0:d.data)==null?void 0:I.map(x=>{let v=l.reverse().find(h=>h.id===x.id);return E[x.type]?Tt.createElement("span",{key:x.id,"data-field-id":x.id,className:a("multiInputField",r)},E[x.type]({formInput:x,customFormTypeProps:{flowId:e,stepData:t,canContinue:o,setCanContinue:i,onSaveData:n,appearance:r},onSaveInputData:h=>{!c.includes(x.id)&&h&&(h==null?void 0:h.text)!==""&&f(b=>[...b,x.id]),P(x,h)},inputData:T[x.id],setFormValidationErrors:h=>{h.length===0&&l.length===0||m(b=>h.length===0?b.filter(N=>N.id!==x.id):[...b,...h])}}),v&&v.message&&c.includes(x.id)&&v.hidden!==!0&&Tt.createElement(gp,{key:x.id,style:{overflow:"hidden"},appearance:r,className:a("multiInputValidationError",r)},Tt.createElement(hp,{appearance:r,className:a("multiInputValidationErrorIcon",r)},Tt.createElement(Wi,null)),v.message)):null})))}import Ht from"styled-components";var Hi=Ht.div`
|
|
419
419
|
align-items: center;
|
|
420
420
|
display: flex;
|
|
421
421
|
justify-content: ${e=>e.showBackButton?"space-between":"flex-end"};
|
|
@@ -474,7 +474,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
474
474
|
justify-content: center;
|
|
475
475
|
align-content: center;
|
|
476
476
|
align-items: center;
|
|
477
|
-
${e=>
|
|
477
|
+
${e=>B(e)} {
|
|
478
478
|
display: flex;
|
|
479
479
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
480
480
|
width: ${e=>e.type==="full-width"?"100%":"auto"};
|
|
@@ -504,7 +504,7 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
504
504
|
cursor: not-allowed;
|
|
505
505
|
}
|
|
506
506
|
`,zo=Ji.div`
|
|
507
|
-
${e=>
|
|
507
|
+
${e=>B(e)} {
|
|
508
508
|
display: flex;
|
|
509
509
|
flex-direction: row;
|
|
510
510
|
justify-content: flex-start;
|
|
@@ -606,24 +606,24 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
606
606
|
min-height: 400px;
|
|
607
607
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
608
608
|
}`;function Re({appearance:e,videoUri:t}){let o=Ap(),[i,n]=Op(!1);if(t.includes("youtube")){let r=t.split("v=")[1],s=r.indexOf("&");return s!==-1&&(r=r.substring(0,s)),Vt.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)),Vt.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)})}return Vt.createElement(Ip,{className:a("videoPlayerWrapper",e),appearance:e},!i&&Vt.createElement(Np,{onClick:()=>{n(!0),o.current.play()},appearance:e},Vt.createElement(_o,null)),Vt.createElement(Lp,{appearance:e,controls:i,ref:o,play:i,src:t}))}var Up=Ho.div`
|
|
609
|
-
${e=>
|
|
609
|
+
${e=>B(e)} {
|
|
610
610
|
display: flex;
|
|
611
611
|
flex-direction: column;
|
|
612
612
|
justify-content: center;
|
|
613
613
|
}
|
|
614
614
|
`,Wp=Ho.img`
|
|
615
|
-
${e=>
|
|
615
|
+
${e=>B(e)} {
|
|
616
616
|
width: 100%;
|
|
617
617
|
height: auto;
|
|
618
618
|
max-height: 250px;
|
|
619
619
|
margin-bottom: 24px;
|
|
620
620
|
}
|
|
621
621
|
`,zp=Ho.div`
|
|
622
|
-
${e=>
|
|
622
|
+
${e=>B(e)} {
|
|
623
623
|
margin-bottom: 24px;
|
|
624
624
|
}
|
|
625
625
|
`,_p=Ho.div`
|
|
626
|
-
${e=>
|
|
626
|
+
${e=>B(e)} {
|
|
627
627
|
width: 100%;
|
|
628
628
|
height: auto;
|
|
629
629
|
max-height: 250px;
|
|
@@ -682,8 +682,8 @@ var ia=Object.defineProperty,na=Object.defineProperties;var sa=Object.getOwnProp
|
|
|
682
682
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorText}};
|
|
683
683
|
display: flex;
|
|
684
684
|
align-self: center;
|
|
685
|
-
`;var dn=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let n=e.props,[r,s]=vr([]),[p,d]=vr(!1),[l,m]=vr(e.id);return Pr(()=>{r.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),Pr(()=>{l!==e.id&&(m(e.id),s([]))},[e]),Pr(()=>{o({choice:r}),r.length>=n.minChoices?t(!0):t(!1)},[r]),st.createElement(tn,{className:a("selectListContainer",i)},st.createElement(on,null,st.createElement(rn,{className:a("selectListTitle",i)},e.title),st.createElement(nn,{appearance:i,className:a("selectListSubtitle",i)},e.subtitle)),n.options.map((c,f)=>{let y=r.includes(c.id);return st.createElement(sn,{key:`select-item-${f}`,onClick:()=>{if(r.includes(c.id)){s(r.filter(T=>T!==c.id));return}r.length<n.maxChoices?s([...r,c.id]):r.length==1&&n.maxChoices==1&&s([c.id])},hideBottomBorder:f===n.options.length-1,className:a("selectListSelectItem",i)},st.createElement(ln,{className:a("selectListItemImage",i)},c.imageUri&&st.createElement(an,{src:c.imageUri,alt:`select-icon-${f}`}),st.createElement(pn,{appearance:i,className:a("selectListSelectItemText",i)},c.title)),st.createElement(nt,{appearance:i,value:y,primaryColor:i.theme.colorPrimary}))}))};import Ue,{useEffect as cn,useState as go}from"react";var Hp=({children:e,id:t,shouldWrap:o=!1})=>Ue.createElement(Ue.Fragment,null,o?Ue.createElement("div",{key:t,style:{width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:1,overflowY:"auto"}},e):e),jo=({appearance:e,steps:t,selectedStep:o,customStepTypes:i,customVariables:n,onButtonClick:r,onStepCompletion:s,flowId:p,type:d,hideOnFlowCompletion:l,onComplete:m,setVisible:c,setShowModal:f,onDismiss:y,showPagination:T=!1,customFormElements:S,allowBackNavigation:g,validationHandler:
|
|
686
|
-
${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map(([i,n])=>typeof n=="object"?`${i} { ${Object.entries(n).map(([s,p])=>`${Eo(s)}: ${p};`).join(" ")} }`:`${Eo(i)}: ${n};`).join(" ")} }`).join(" ")}`;function ie({appearance:e}){if(!e||!e.styleOverrides)return ho.createElement(ho.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([o,i])=>typeof i=="object");return t.length===0?ho.createElement(ho.Fragment,null):ho.createElement(Vp,{inlineStyles:t})}var fn=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:n,customVariables:r,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:l=!0,onStepCompletion:m,onButtonClick:c,dismissible:f=!0,endFlowOnDismiss:y=!1,modalPosition:T="center",repeatable:S=!1,onDismiss:g,showPagination:v=!1,allowBackNavigation:P=!1,validationHandler:F,showFrigadeBranding:A=!1,onFormDataChange:I,showFooter:x=!0,prefillData:B={},updateUrlOnPageChange:h=!1})=>{var $;let{getFlow:b,getFlowSteps:N,isLoading:L,targetingLogicShouldHideFlow:O,getFlowStatus:j,getCurrentStepIndex:M,markFlowCompleted:V,markFlowNotStarted:le,markStepStarted:pe}=R(),q=M(e),{mergeAppearanceWithDefault:se}=te(),[de,be]=un(!1),[G,Y]=un(""),{setOpenFlowState:ee,getOpenFlowState:Ve,hasOpenModals:Le}=Be(),X=N(e);d=se(d);let[ue,Oe]=i!==void 0&&n!==void 0?[i,n]:[Ve(e,!0),W=>ee(e,W)];if(mn(()=>{!de&&!L&&(be(!0),(j(e)===Z&&S||j(e)===Me)&&(j(e)===Z&&S&&le(e),window&&window.localStorage&&Object.keys(window.localStorage).forEach(J=>{J.startsWith(Tr)&&window.localStorage.removeItem(J)})),be(!0))},[de,be,L]),mn(()=>{var J;let W=(J=window==null?void 0:window.location)!=null&&J.hash?window.location.hash.replace("#",""):"";if(W!=G&&X&&(X==null?void 0:X.length)>0){let fe=-1;if(W){let $e=W;fe=X.findIndex(Ge=>Ge.id===$e),G===W&&(fe=-1),Y(W)}else fe=0,Y("");fe!==-1&&pe(e,X[fe].id)}},[X,($=window==null?void 0:window.location)==null?void 0:$.hash]),L)return null;let we=b(e);if(!we||O(we)||!X||i!==void 0&&i===!1||j(e)===Z&&l||(o=="modal"||o=="corner-modal")&&Le(e))return null;let U=()=>{Oe(!1),g&&g(),y===!0&&V(e)};if(T=="center"&&o==="modal"||o==="large-modal"){let W={padding:"24px"};return o==="large-modal"?(W.width="85%",W.height="90%",W.maxHeight="800px",W.minHeight="500px",W.padding="0"):W.width="400px",et.createElement(Qe,{appearance:d,onClose:U,visible:ue,style:W,dismissible:f,showFrigadeBranding:A},et.createElement(ie,{appearance:d}),et.createElement(jo,{appearance:d,steps:X,selectedStep:q,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:n,setShowModal:Oe,onDismiss:g,showPagination:v,customFormElements:s,allowBackNavigation:P,validationHandler:F,onFormDataChange:I,showFooter:x,prefillData:B,updateUrlOnPageChange:h}))}return o==="modal"&&T!=="center"?et.createElement(Lo,{appearance:d,onClose:U,visible:ue,modalPosition:T},et.createElement(ie,{appearance:d}),et.createElement(jo,{appearance:d,steps:X,selectedStep:q,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:n,setShowModal:Oe,onDismiss:g,showPagination:v,customFormElements:s,allowBackNavigation:P,validationHandler:F,onFormDataChange:I,showFooter:x,prefillData:B,updateUrlOnPageChange:h})):et.createElement(et.Fragment,null,et.createElement(ie,{appearance:d}),et.createElement(jo,{appearance:d,steps:X,selectedStep:q,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:n,setShowModal:Oe,onDismiss:g,showPagination:v,customFormElements:s,allowBackNavigation:P,validationHandler:F,onFormDataChange:I,showFooter:x,prefillData:B,updateUrlOnPageChange:h}))},gn=fn;import{useCallback as Br,useContext as Gp,useEffect as Kp}from"react";function Er(){let{organizationId:e,userId:t,setOrganizationId:o}=Gp(Q),{mutateUserFlowState:i}=De(),{config:n,apiUrl:r}=Je(),s=Dt(),{verifySDKInitiated:p}=Ut();function d(f,y){return`frigade-user-group-registered-${f}-${y}`}Kp(()=>{if(t&&e){if(t.startsWith(Wt))return;let f=d(t,e);localStorage.getItem(f)||(s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})})),localStorage.setItem(f,"true"))}},[t,e]);let l=Br(f=>D(this,null,function*(){if(!p())return;if(!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationIdInternal:e,userId:t});return}let y={foreignUserId:t,foreignUserGroupId:e,properties:f};yield s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(y)})),i()}),[e,t,n,i]),m=Br((f,y)=>D(this,null,function*(){if(!p())return;if(!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationIdInternal:e,userId:t});return}let S={foreignUserId:t,foreignUserGroupId:e,events:[{event:f,properties:y}]};yield s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(S)})),i()}),[e,t,n,i]),c=Br((f,y)=>D(this,null,function*(){if(p())if(y){let T=d(t,f);localStorage.setItem(T,"true"),o(f);let S={foreignUserId:t,foreignUserGroupId:f,properties:y};yield s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(S)})),i()}else o(f)}),[t,n,i]);return{organizationId:e,setOrganizationId:o,setOrganizationIdWithProperties:c,addPropertiesToOrganization:l,trackEventForOrganization:m}}var hn="frigade-xFrigade_guestUserId",Co="frigade-xFrigade_userId",xn=({})=>{let{setFlowResponses:e}=so(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=De(),{userId:n,setUserId:r}=lo(),[s,p]=xo(n),{getFlowStatus:d}=R(),{flows:l,userProperties:m,setIsNewGuestUser:c,flowResponses:f}=qp(Q),[y,T]=xo([]),[S,g]=xo([]),{organizationId:v}=Er(),[P,F]=xo(v),[A,I]=xo(!1);Kt(()=>{if(!o&&t)for(let b=0;b<t.length;b++){let N=t[b],L=l.find(O=>O.slug===(N==null?void 0:N.flowId));if(L&&N&&N.shouldTrigger===!0&&L.type=="FORM"&&L.triggerType==="AUTOMATIC"&&!S.includes(L.slug)){setTimeout(()=>{x(N.flowId)},500);break}}},[o,t]),Kt(()=>{f.length>0&&i()},[f]),Kt(()=>{A||(I(!0),i())},[o,I]);function x(b){let N=l.find(L=>L.slug===b);N&&N.triggerType==="AUTOMATIC"&&!S.includes(N.slug)&&(g([...S,N.slug]),T([N]))}function B(){if(!n){let b=localStorage.getItem(Co);if(b){r(b);return}let N=localStorage.getItem(hn);if(N){r(N);return}c(!0);let L=Wt+Yp();try{localStorage.setItem(hn,L)}catch(O){console.log("Failed to save guest user id locally: Local storage unavailable",O)}r(O=>O||L)}}Kt(()=>{try{if(l){let b=[];l.forEach(N=>{if(N.data){let L=N.data.match(/"imageUri":"(.*?)"/g);L&&L.forEach(O=>{let j=O.replace('"imageUri":"',"").replace('"',"");if(b.includes(j))return;let M=new Image;M.src=j,b.push(j)})}})}}catch(b){}},[l]),Kt(()=>{if(n!==s&&(e([]),i()),p(n),n&&!n.startsWith(Wt))try{localStorage.setItem(Co,n)}catch(b){console.log("Failed to save user id locally: Local storage available",b)}n===null&&setTimeout(()=>{n===null&&B()},50)},[n,l,m]),Kt(()=>{v!=P&&(F(v),e([]),i())},[v,P,F]);function h(){return kt.createElement(kt.Fragment,null,y.map(b=>d(b.slug)!==Me?null:kt.createElement("span",{key:b.slug},kt.createElement(gn,{flowId:b.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return kt.createElement(kt.Fragment,null,kt.createElement(h,null))};import{ErrorBoundary as Sd}from"react-error-boundary";var Cn={colorPrimary:"colors.primary.background",colorText:"colors.neutral.foreground",colorBackground:"colors.neutral.background",colorBackgroundSecondary:"colors.secondary.background",colorTextOnPrimaryBackground:"colors.primary.foreground",colorTextSecondary:"colors.secondary.foreground",colorTextDisabled:"colors.gray700",colorBorder:"colors.gray800",colorTextError:"colors.negative.foreground",borderRadius:"radii.lg"};function Xp(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(Cn[o]){let n=Cn[o].split("."),r=t;n.forEach((s,p)=>{r[s]||(r[s]=p===n.length-1?i:{}),r=r[s]})}}),t}function Jp(e){if(!e)return;let t=Ce({},e),o={};return Object.keys(t).forEach(i=>{let n=`.fr-${i}`;o[n]=t[i]}),o}function yn(e){let{theme:t,styleOverrides:o}=e,i=Xp(t),n=Jp(o);return{overrides:i,css:n}}import dd from"styled-components";import{compose as cd,variant as bn}from"styled-system";import Sn from"react";import Qp,{ThemeProvider as Zp,useTheme as Rp}from"styled-components";import{border as ed,color as td,compose as od,get as rd,shadow as id,space as nd,system as sd,typography as ld}from"styled-system";var ad={width:{property:"width",scale:"sizes",transform:(e,t)=>rd(t,e,!(typeof e=="number"&&!isNaN(e))||e>1?e:e*100+"%")},height:{property:"height",scale:"sizes"},minWidth:{property:"minWidth",scale:"sizes"},minHeight:{property:"minHeight",scale:"sizes"},maxWidth:{property:"maxWidth",scale:"sizes"},maxHeight:{property:"maxHeight",scale:"sizes"},overflow:!0,overflowX:!0,overflowY:!0,display:!0,verticalAlign:!0},pd=Qp("div")(({css:e})=>e,od(ed,td,id,nd,ld,sd(ad))),yo=n=>{var r=n,{as:e,children:t,overrides:o}=r,i=Ie(r,["as","children","overrides"]);let s=Rp(),p={border:"none",boxSizing:"border-box",m:0,p:0},d=()=>Sn.createElement(pd,w(w({as:e},p),i),t);if(o!==void 0){let l=Ce(s,o);return Sn.createElement(Zp,{theme:l},d())}return d()};var So={Primary:{backgroundColor:"primary.background",color:"primary.foreground","&:hover":{backgroundColor:"blue400"}},Secondary:{backgroundColor:"white",border:"1px solid",borderColor:"gray800",color:"neutral.foreground","&:hover":{backgroundColor:"blue900"}},Link:{backgroundColor:"transparent",color:"primary.inverted"},Plain:{backgroundColor:"transparent",color:"neutral.foreground"}},md={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},wn=dd(yo)(()=>({whiteSpace:"nowrap"}),cd(bn({scale:"components.Button",variants:"components.Button"}),bn({prop:"size",variants:md})));import ud from"styled-components";import{variant as fd,system as gd}from"styled-system";var Vo={Display1:{fontSize:"5xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"4xl"},Display2:{fontSize:"4xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"3xl"},H1:{fontSize:"3xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"2xl"},H2:{fontSize:"2xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"xl"},H3:{fontSize:"xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"lg"},H4:{fontSize:"lg",fontWeight:"bold",letterSpacing:"md",lineHeight:"md"},Body1:{fontSize:"md",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Body2:{fontSize:"sm",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Caption:{fontSize:"xs",fontWeight:"regular",letterSpacing:"md",lineHeight:"sm"}};var Tn=ud(yo)(fd({scale:"components.Text",variants:"components.Text"}),gd({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Fn=4,kn="px",hd=20,xd=Object.fromEntries(Array.from(Array(hd+1),(e,t)=>t===0?[.5,`${.5*Fn}${kn}`]:[t,`${t*Fn}${kn}`])),qt={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"},Ar={colors:_(w({},qt),{neutral:{foreground:qt.gray300},primary:{background:qt.blue500,foreground:qt.white,inverted:qt.blue500},negative:{foreground:qt.red500}}),fonts:{default:"TT Interphases Pro, sans-serif"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{regular:400,semibold:500,bold:700},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"},radii:{md:"8px",lg:"20px",round:"50%"},shadows:{md:"0px 4px 20px rgba(0, 0, 0, 0.06)"},space:xd,components:{Button:So,Text:Vo}};var Pn="https://api.frigade.com",Q=Cd({publicApiKey:"",setUserId:()=>{},flows:[],setFlows:()=>{},failedFlowResponses:[],setFailedFlowResponses:()=>{},flowResponses:[],setFlowResponses:()=>{},userProperties:{},setUserProperties:()=>{},openFlowStates:{},setOpenFlowStates:()=>{},completedFlowsToKeepOpenDuringSession:[],setCompletedFlowsToKeepOpenDuringSession:()=>{},customVariables:{},setCustomVariables:()=>{},isNewGuestUser:!1,setIsNewGuestUser:()=>{},hasActiveFullPageFlow:!1,setHasActiveFullPageFlow:()=>{},organizationId:"",setOrganizationId:()=>{},navigate:()=>{},defaultAppearance:it,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{},apiUrl:Pn,readonly:!1,debug:!1});function bd(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var wd=({publicApiKey:e,userId:t,organizationId:o,config:i,children:n})=>{var q,se,de,be,G;let[r,s]=je(t||null),[p,d]=je(o||null),[l,m]=je([]),[c,f]=je([]),[y,T]=je([]),[S,g]=je({}),[v,P]=je({}),[F,A]=je([]),[I,x]=je({}),[B,h]=je(!1),[b,N]=je(!1),[L,O]=je(!V(e)),j=(Y,ee)=>{if(ee==="_blank"){window.open(Y,"_blank");return}setTimeout(()=>{window.location.href=Y},50)},M={theme:w(w({},it.theme),(se=(q=i==null?void 0:i.defaultAppearance)==null?void 0:q.theme)!=null?se:{}),styleOverrides:w(w({},it.styleOverrides),(be=(de=i==null?void 0:i.defaultAppearance)==null?void 0:de.styleOverrides)!=null?be:{})};function V(Y){return!!(Y&&Y.length>10&&Y.substring(0,10)==="api_public")}Go(()=>{t&&s(t)},[t]),Go(()=>{r&&window&&window.localStorage&&window.localStorage.getItem(Co)&&window.localStorage.getItem(Co)!==r&&bd()},[r]),Go(()=>{o&&d(o)},[o]),Go(()=>{if(V(e))O(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),O(!0);return}},[e,O]);let le={publicApiKey:e,userId:r,setUserId:s,setFlows:m,flows:l,failedFlowResponses:c,setFailedFlowResponses:f,flowResponses:y,setFlowResponses:T,userProperties:S,setUserProperties:g,openFlowStates:v,setOpenFlowStates:P,completedFlowsToKeepOpenDuringSession:F,setCompletedFlowsToKeepOpenDuringSession:A,customVariables:I,setCustomVariables:x,isNewGuestUser:B,setIsNewGuestUser:h,hasActiveFullPageFlow:b,setHasActiveFullPageFlow:N,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:j,defaultAppearance:M,shouldGracefullyDegrade:L,setShouldGracefullyDegrade:O,apiUrl:i&&i.apiUrl?i.apiUrl:Pn,readonly:i&&i.readonly?i.readonly:!1,debug:i&&i.debug?i.debug:!1};if(L)return Pt.createElement(Q.Provider,{value:le},n);let{overrides:pe}=yn(M);return Pt.createElement(Sd,{fallback:Pt.createElement(Pt.Fragment,null,n)},Pt.createElement(Q.Provider,{value:le},Pt.createElement(yd,{theme:Ce(M.theme,Ar,pe!=null?pe:{},(G=i==null?void 0:i.theme)!=null?G:{})},n,Pt.createElement(xn,null))))};import dc from"react";import ye,{useEffect as ol,useState as rl}from"react";import Ye,{useState as zd}from"react";import Et from"styled-components";import Yo from"react";import vt from"react";import Bn from"styled-components";var vn=Bn.span`
|
|
685
|
+
`;var dn=({stepData:e,setCanContinue:t,onSaveData:o,appearance:i})=>{let n=e.props,[r,s]=vr([]),[p,d]=vr(!1),[l,m]=vr(e.id);return Pr(()=>{r.length==0&&!p&&(d(!0),o({choice:[]}))},[p]),Pr(()=>{l!==e.id&&(m(e.id),s([]))},[e]),Pr(()=>{o({choice:r}),r.length>=n.minChoices?t(!0):t(!1)},[r]),st.createElement(tn,{className:a("selectListContainer",i)},st.createElement(on,null,st.createElement(rn,{className:a("selectListTitle",i)},e.title),st.createElement(nn,{appearance:i,className:a("selectListSubtitle",i)},e.subtitle)),n.options.map((c,f)=>{let y=r.includes(c.id);return st.createElement(sn,{key:`select-item-${f}`,onClick:()=>{if(r.includes(c.id)){s(r.filter(T=>T!==c.id));return}r.length<n.maxChoices?s([...r,c.id]):r.length==1&&n.maxChoices==1&&s([c.id])},hideBottomBorder:f===n.options.length-1,className:a("selectListSelectItem",i)},st.createElement(ln,{className:a("selectListItemImage",i)},c.imageUri&&st.createElement(an,{src:c.imageUri,alt:`select-icon-${f}`}),st.createElement(pn,{appearance:i,className:a("selectListSelectItemText",i)},c.title)),st.createElement(nt,{appearance:i,value:y,primaryColor:i.theme.colorPrimary}))}))};import Ue,{useEffect as cn,useState as go}from"react";var Hp=({children:e,id:t,shouldWrap:o=!1})=>Ue.createElement(Ue.Fragment,null,o?Ue.createElement("div",{key:t,style:{width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:1,overflowY:"auto"}},e):e),jo=({appearance:e,steps:t,selectedStep:o,customStepTypes:i,customVariables:n,onButtonClick:r,onStepCompletion:s,flowId:p,type:d,hideOnFlowCompletion:l,onComplete:m,setVisible:c,setShowModal:f,onDismiss:y,showPagination:T=!1,customFormElements:S,allowBackNavigation:g,validationHandler:E,onFormDataChange:P,showFooter:F,prefillData:A,updateUrlOnPageChange:I})=>{var U;let v=w(w({},{linkCollection:Ri,multiInput:_i,callToAction:en,selectList:dn}),i),{primaryCTAClickSideEffects:h,secondaryCTAClickSideEffects:b}=ae(),[N,L]=go(!1),[O,j]=go({}),[M,G]=go(!1),[le,pe]=go(!1),[q,se]=go(null),de=(U=t[o])!=null?U:null,{markStepCompleted:be,markStepStarted:V,isLoading:Y,updateCustomVariables:ee,markFlowCompleted:Ve}=R();cn(()=>{ee(n)},[n,Y]),cn(()=>{P&&P(O,Le(),t[o],o)},[O]);function Le(){var W;return{data:(W=O[t[o].id])!=null?W:{},stepId:t[o].id,customVariables:n}}function X($,W,J){let fe=o+1<t.length?t[o+1]:null;return s&&s($,J,fe,O,Le()),r?r($,o,W,fe):!0}function ue($,W){j(J=>{let fe={};return fe[$.id]=W,w(w({},J),fe)})}function Oe($){return $.selectedStep.imageUri?Ue.createElement(qi,{image:$.selectedStep.imageUri,appearance:e,className:a("formContainerSidebarImage",e)}):null}let we=F&&Ue.createElement(Qi,{step:t[o],canContinue:N&&!M,formType:d,selectedStep:o,appearance:e,onPrimaryClick:()=>D(void 0,null,function*(){if(G(!0),E){let J=yield E(t[o],o,t[o+1],O,Le());if(J!==!0){se(typeof J=="string"?J:null),G(!1);return}else se(null)}let $=w({},Le());yield be(p,t[o].id,$),o+1<t.length&&!g&&(yield V(p,t[o+1].id));let W=X(t[o],"primary",o);if(o+1>=t.length&&(m&&m(),y&&y(),l&&W&&(c&&c(!1),f(!1)),yield Ve(p)),h(t[o]),G(!1),g&&o+1<t.length&&(window.location.hash=t[o+1].id),window&&!g&&I&&o+1<t.length){let J=new URL(window.location.href);J.searchParams.set("p",t[o+1].id),window.history.pushState({},"",J.toString())}}),onSecondaryClick:()=>{X(t[o],"secondary",o),b(t[o])},onBack:()=>D(void 0,null,function*(){o-1>=0&&(G(!0),g&&(window.location.hash=t[o-1].id),yield V(p,t[o-1].id),G(!1))}),steps:t,allowBackNavigation:g,errorMessage:q,isSaving:M});return Ue.createElement(Ue.Fragment,null,Ue.createElement(Gi,{className:a("formContainer",e)},Ue.createElement(Hp,{id:o,shouldWrap:d==="large-modal"},Ue.createElement(Ki,{key:de.id,type:d,className:a("formContent",e)},t.map($=>{let W=v[$.type];return de.id!==$.id?null:typeof W!="function"?W:Ue.createElement(W,{key:$.id,stepData:$,canContinue:N,setCanContinue:L,onSaveData:J=>{ue($,J)},appearance:e,customFormElements:S,flowId:p,prefillData:A})}),T&&Ue.createElement(Zi,{className:a("formPagination",e),appearance:e,stepCount:t.length,currentStep:o}),we)),d=="large-modal"&&Ue.createElement(Oe,{selectedStep:t[o]})))};import ho from"react";import{createGlobalStyle as jp}from"styled-components";var Vp=jp`
|
|
686
|
+
${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map(([i,n])=>typeof n=="object"?`${i} { ${Object.entries(n).map(([s,p])=>`${Eo(s)}: ${p};`).join(" ")} }`:`${Eo(i)}: ${n};`).join(" ")} }`).join(" ")}`;function ie({appearance:e}){if(!e||!e.styleOverrides)return ho.createElement(ho.Fragment,null);let t=Object.entries(e.styleOverrides).filter(([o,i])=>typeof i=="object");return t.length===0?ho.createElement(ho.Fragment,null):ho.createElement(Vp,{inlineStyles:t})}var fn=({flowId:e,customStepTypes:t={},type:o="inline",visible:i,setVisible:n,customVariables:r,customFormElements:s,onComplete:p,appearance:d,hideOnFlowCompletion:l=!0,onStepCompletion:m,onButtonClick:c,dismissible:f=!0,endFlowOnDismiss:y=!1,modalPosition:T="center",repeatable:S=!1,onDismiss:g,showPagination:E=!1,allowBackNavigation:P=!1,validationHandler:F,showFrigadeBranding:A=!1,onFormDataChange:I,showFooter:x=!0,prefillData:v={},updateUrlOnPageChange:h=!1})=>{var $;let{getFlow:b,getFlowSteps:N,isLoading:L,targetingLogicShouldHideFlow:O,getFlowStatus:j,getCurrentStepIndex:M,markFlowCompleted:G,markFlowNotStarted:le,markStepStarted:pe}=R(),q=M(e),{mergeAppearanceWithDefault:se}=te(),[de,be]=un(!1),[V,Y]=un(""),{setOpenFlowState:ee,getOpenFlowState:Ve,hasOpenModals:Le}=Be(),X=N(e);d=se(d);let[ue,Oe]=i!==void 0&&n!==void 0?[i,n]:[Ve(e,!0),W=>ee(e,W)];if(mn(()=>{!de&&!L&&(be(!0),(j(e)===Z&&S||j(e)===Me)&&(j(e)===Z&&S&&le(e),window&&window.localStorage&&Object.keys(window.localStorage).forEach(J=>{J.startsWith(Tr)&&window.localStorage.removeItem(J)})),be(!0))},[de,be,L]),mn(()=>{var J;let W=(J=window==null?void 0:window.location)!=null&&J.hash?window.location.hash.replace("#",""):"";if(W!=V&&X&&(X==null?void 0:X.length)>0){let fe=-1;if(W){let $e=W;fe=X.findIndex(Ge=>Ge.id===$e),V===W&&(fe=-1),Y(W)}else fe=0,Y("");fe!==-1&&pe(e,X[fe].id)}},[X,($=window==null?void 0:window.location)==null?void 0:$.hash]),L)return null;let we=b(e);if(!we||O(we)||!X||i!==void 0&&i===!1||j(e)===Z&&l||(o=="modal"||o=="corner-modal")&&Le(e))return null;let U=()=>{Oe(!1),g&&g(),y===!0&&G(e)};if(T=="center"&&o==="modal"||o==="large-modal"){let W={padding:"24px"};return o==="large-modal"?(W.width="85%",W.height="90%",W.maxHeight="800px",W.minHeight="500px",W.padding="0"):W.width="400px",et.createElement(Qe,{appearance:d,onClose:U,visible:ue,style:W,dismissible:f,showFrigadeBranding:A},et.createElement(ie,{appearance:d}),et.createElement(jo,{appearance:d,steps:X,selectedStep:q,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:n,setShowModal:Oe,onDismiss:g,showPagination:E,customFormElements:s,allowBackNavigation:P,validationHandler:F,onFormDataChange:I,showFooter:x,prefillData:v,updateUrlOnPageChange:h}))}return o==="modal"&&T!=="center"?et.createElement(Lo,{appearance:d,onClose:U,visible:ue,modalPosition:T},et.createElement(ie,{appearance:d}),et.createElement(jo,{appearance:d,steps:X,selectedStep:q,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:n,setShowModal:Oe,onDismiss:g,showPagination:E,customFormElements:s,allowBackNavigation:P,validationHandler:F,onFormDataChange:I,showFooter:x,prefillData:v,updateUrlOnPageChange:h})):et.createElement(et.Fragment,null,et.createElement(ie,{appearance:d}),et.createElement(jo,{appearance:d,steps:X,selectedStep:q,customStepTypes:t,customVariables:r,onButtonClick:c,onStepCompletion:m,flowId:e,type:o,hideOnFlowCompletion:l,onComplete:p,setVisible:n,setShowModal:Oe,onDismiss:g,showPagination:E,customFormElements:s,allowBackNavigation:P,validationHandler:F,onFormDataChange:I,showFooter:x,prefillData:v,updateUrlOnPageChange:h}))},gn=fn;import{useCallback as Br,useContext as Gp,useEffect as Kp}from"react";function Er(){let{organizationId:e,userId:t,setOrganizationId:o}=Gp(Q),{mutateUserFlowState:i}=De(),{config:n,apiUrl:r}=Je(),s=Dt(),{verifySDKInitiated:p}=Ut();function d(f,y){return`frigade-user-group-registered-${f}-${y}`}Kp(()=>{if(t&&e){if(t.startsWith(Wt))return;let f=d(t,e);localStorage.getItem(f)||(s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify({foreignUserId:t,foreignUserGroupId:e})})),localStorage.setItem(f,"true"))}},[t,e]);let l=Br(f=>D(this,null,function*(){if(!p())return;if(!e||!t){console.error("Cannot add properties to organization: Organization ID and User ID must both be set.",{organizationIdInternal:e,userId:t});return}let y={foreignUserId:t,foreignUserGroupId:e,properties:f};yield s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(y)})),i()}),[e,t,n,i]),m=Br((f,y)=>D(this,null,function*(){if(!p())return;if(!e||!t){console.error("Cannot track event for organization: Organization ID and User ID must both be set.",{organizationIdInternal:e,userId:t});return}let S={foreignUserId:t,foreignUserGroupId:e,events:[{event:f,properties:y}]};yield s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(S)})),i()}),[e,t,n,i]),c=Br((f,y)=>D(this,null,function*(){if(p())if(y){let T=d(t,f);localStorage.setItem(T,"true"),o(f);let S={foreignUserId:t,foreignUserGroupId:f,properties:y};yield s(`${r}userGroups`,_(w({},n),{method:"POST",body:JSON.stringify(S)})),i()}else o(f)}),[t,n,i]);return{organizationId:e,setOrganizationId:o,setOrganizationIdWithProperties:c,addPropertiesToOrganization:l,trackEventForOrganization:m}}var hn="frigade-xFrigade_guestUserId",Co="frigade-xFrigade_userId",xn=({})=>{let{setFlowResponses:e}=so(),{userFlowStatesData:t,isLoadingUserFlowStateData:o,mutateUserFlowState:i}=De(),{userId:n,setUserId:r}=lo(),[s,p]=xo(n),{getFlowStatus:d}=R(),{flows:l,userProperties:m,setIsNewGuestUser:c,flowResponses:f}=qp(Q),[y,T]=xo([]),[S,g]=xo([]),{organizationId:E}=Er(),[P,F]=xo(E),[A,I]=xo(!1);Kt(()=>{if(!o&&t)for(let b=0;b<t.length;b++){let N=t[b],L=l.find(O=>O.slug===(N==null?void 0:N.flowId));if(L&&N&&N.shouldTrigger===!0&&L.type=="FORM"&&L.triggerType==="AUTOMATIC"&&!S.includes(L.slug)){setTimeout(()=>{x(N.flowId)},500);break}}},[o,t]),Kt(()=>{f.length>0&&i()},[f]),Kt(()=>{A||(I(!0),i())},[o,I]);function x(b){let N=l.find(L=>L.slug===b);N&&N.triggerType==="AUTOMATIC"&&!S.includes(N.slug)&&(g([...S,N.slug]),T([N]))}function v(){if(!n){let b=localStorage.getItem(Co);if(b){r(b);return}let N=localStorage.getItem(hn);if(N){r(N);return}c(!0);let L=Wt+Yp();try{localStorage.setItem(hn,L)}catch(O){console.log("Failed to save guest user id locally: Local storage unavailable",O)}r(O=>O||L)}}Kt(()=>{try{if(l){let b=[];l.forEach(N=>{if(N.data){let L=N.data.match(/"imageUri":"(.*?)"/g);L&&L.forEach(O=>{let j=O.replace('"imageUri":"',"").replace('"',"");if(b.includes(j))return;let M=new Image;M.src=j,b.push(j)})}})}}catch(b){}},[l]),Kt(()=>{if(n!==s&&(e([]),i()),p(n),n&&!n.startsWith(Wt))try{localStorage.setItem(Co,n)}catch(b){console.log("Failed to save user id locally: Local storage available",b)}n===null&&setTimeout(()=>{n===null&&v()},50)},[n,l,m]),Kt(()=>{E!=P&&(F(E),e([]),i())},[E,P,F]);function h(){return kt.createElement(kt.Fragment,null,y.map(b=>d(b.slug)!==Me?null:kt.createElement("span",{key:b.slug},kt.createElement(gn,{flowId:b.slug,type:"modal",modalPosition:"center",endFlowOnDismiss:!0}))))}return kt.createElement(kt.Fragment,null,kt.createElement(h,null))};import{ErrorBoundary as Sd}from"react-error-boundary";var Cn={colorPrimary:"colors.primary.background",colorText:"colors.neutral.foreground",colorBackground:"colors.neutral.background",colorBackgroundSecondary:"colors.secondary.background",colorTextOnPrimaryBackground:"colors.primary.foreground",colorTextSecondary:"colors.secondary.foreground",colorTextDisabled:"colors.gray700",colorBorder:"colors.gray800",colorTextError:"colors.negative.foreground",borderRadius:"radii.lg"};function Xp(e){if(!e)return;let t={};return Object.entries(e).forEach(([o,i])=>{if(Cn[o]){let n=Cn[o].split("."),r=t;n.forEach((s,p)=>{r[s]||(r[s]=p===n.length-1?i:{}),r=r[s]})}}),t}function Jp(e){if(!e)return;let t=Ce({},e),o={};return Object.keys(t).forEach(i=>{let n=`.fr-${i}`;o[n]=t[i]}),o}function yn(e){let{theme:t,styleOverrides:o}=e,i=Xp(t),n=Jp(o);return{overrides:i,css:n}}import dd from"styled-components";import{compose as cd,variant as bn}from"styled-system";import Sn from"react";import Qp,{ThemeProvider as Zp,useTheme as Rp}from"styled-components";import{border as ed,color as td,compose as od,get as rd,shadow as id,space as nd,system as sd,typography as ld}from"styled-system";var ad={width:{property:"width",scale:"sizes",transform:(e,t)=>rd(t,e,!(typeof e=="number"&&!isNaN(e))||e>1?e:e*100+"%")},height:{property:"height",scale:"sizes"},minWidth:{property:"minWidth",scale:"sizes"},minHeight:{property:"minHeight",scale:"sizes"},maxWidth:{property:"maxWidth",scale:"sizes"},maxHeight:{property:"maxHeight",scale:"sizes"},overflow:!0,overflowX:!0,overflowY:!0,display:!0,verticalAlign:!0},pd=Qp("div")(({css:e})=>e,od(ed,td,id,nd,ld,sd(ad))),yo=n=>{var r=n,{as:e,children:t,overrides:o}=r,i=Ie(r,["as","children","overrides"]);let s=Rp(),p={border:"none",boxSizing:"border-box",m:0,p:0},d=()=>Sn.createElement(pd,w(w({as:e},p),i),t);if(o!==void 0){let l=Ce(s,o);return Sn.createElement(Zp,{theme:l},d())}return d()};var So={Primary:{backgroundColor:"primary.background",color:"primary.foreground","&:hover":{backgroundColor:"blue400"}},Secondary:{backgroundColor:"white",border:"1px solid",borderColor:"gray800",color:"neutral.foreground","&:hover":{backgroundColor:"blue900"}},Link:{backgroundColor:"transparent",color:"primary.inverted"},Plain:{backgroundColor:"transparent",color:"neutral.foreground"}},md={sm:{paddingX:4,paddingY:1},md:{paddingX:6,paddingY:2}},wn=dd(yo)(()=>({whiteSpace:"nowrap"}),cd(bn({scale:"components.Button",variants:"components.Button"}),bn({prop:"size",variants:md})));import ud from"styled-components";import{variant as fd,system as gd}from"styled-system";var Vo={Display1:{fontSize:"5xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"4xl"},Display2:{fontSize:"4xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"3xl"},H1:{fontSize:"3xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"2xl"},H2:{fontSize:"2xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"xl"},H3:{fontSize:"xl",fontWeight:"bold",letterSpacing:"md",lineHeight:"lg"},H4:{fontSize:"lg",fontWeight:"bold",letterSpacing:"md",lineHeight:"md"},Body1:{fontSize:"md",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Body2:{fontSize:"sm",fontWeight:"regular",letterSpacing:"md",lineHeight:"md"},Caption:{fontSize:"xs",fontWeight:"regular",letterSpacing:"md",lineHeight:"sm"}};var Tn=ud(yo)(fd({scale:"components.Text",variants:"components.Text"}),gd({fontWeight:{property:"fontWeight",scale:"fontWeights"}}));var Fn=4,kn="px",hd=20,xd=Object.fromEntries(Array.from(Array(hd+1),(e,t)=>t===0?[.5,`${.5*Fn}${kn}`]:[t,`${t*Fn}${kn}`])),qt={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"},Ar={colors:_(w({},qt),{neutral:{foreground:qt.gray300},primary:{background:qt.blue500,foreground:qt.white,inverted:qt.blue500},negative:{foreground:qt.red500}}),fonts:{default:"TT Interphases Pro, sans-serif"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{regular:400,semibold:500,bold:700},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"},radii:{md:"8px",lg:"20px",round:"50%"},shadows:{md:"0px 4px 20px rgba(0, 0, 0, 0.06)"},space:xd,components:{Button:So,Text:Vo}};var Pn="https://api.frigade.com",Q=Cd({publicApiKey:"",setUserId:()=>{},flows:[],setFlows:()=>{},failedFlowResponses:[],setFailedFlowResponses:()=>{},flowResponses:[],setFlowResponses:()=>{},userProperties:{},setUserProperties:()=>{},openFlowStates:{},setOpenFlowStates:()=>{},completedFlowsToKeepOpenDuringSession:[],setCompletedFlowsToKeepOpenDuringSession:()=>{},customVariables:{},setCustomVariables:()=>{},isNewGuestUser:!1,setIsNewGuestUser:()=>{},hasActiveFullPageFlow:!1,setHasActiveFullPageFlow:()=>{},organizationId:"",setOrganizationId:()=>{},navigate:()=>{},defaultAppearance:it,shouldGracefullyDegrade:!1,setShouldGracefullyDegrade:()=>{},apiUrl:Pn,readonly:!1,debug:!1});function bd(){Object.keys(localStorage).forEach(e=>{e.startsWith("frigade-")&&localStorage.removeItem(e)})}var wd=({publicApiKey:e,userId:t,organizationId:o,config:i,children:n})=>{var q,se,de,be,V;let[r,s]=je(t||null),[p,d]=je(o||null),[l,m]=je([]),[c,f]=je([]),[y,T]=je([]),[S,g]=je({}),[E,P]=je({}),[F,A]=je([]),[I,x]=je({}),[v,h]=je(!1),[b,N]=je(!1),[L,O]=je(!G(e)),j=(Y,ee)=>{if(ee==="_blank"){window.open(Y,"_blank");return}setTimeout(()=>{window.location.href=Y},50)},M={theme:w(w({},it.theme),(se=(q=i==null?void 0:i.defaultAppearance)==null?void 0:q.theme)!=null?se:{}),styleOverrides:w(w({},it.styleOverrides),(be=(de=i==null?void 0:i.defaultAppearance)==null?void 0:de.styleOverrides)!=null?be:{})};function G(Y){return!!(Y&&Y.length>10&&Y.substring(0,10)==="api_public")}Go(()=>{t&&s(t)},[t]),Go(()=>{r&&window&&window.localStorage&&window.localStorage.getItem(Co)&&window.localStorage.getItem(Co)!==r&&bd()},[r]),Go(()=>{o&&d(o)},[o]),Go(()=>{if(G(e))O(!1);else{console.error("Frigade SDK failed to initialize. API key provided is either missing or valid."),O(!0);return}},[e,O]);let le={publicApiKey:e,userId:r,setUserId:s,setFlows:m,flows:l,failedFlowResponses:c,setFailedFlowResponses:f,flowResponses:y,setFlowResponses:T,userProperties:S,setUserProperties:g,openFlowStates:E,setOpenFlowStates:P,completedFlowsToKeepOpenDuringSession:F,setCompletedFlowsToKeepOpenDuringSession:A,customVariables:I,setCustomVariables:x,isNewGuestUser:v,setIsNewGuestUser:h,hasActiveFullPageFlow:b,setHasActiveFullPageFlow:N,organizationId:p,setOrganizationId:d,navigate:i&&i.navigate?i.navigate:j,defaultAppearance:M,shouldGracefullyDegrade:L,setShouldGracefullyDegrade:O,apiUrl:i&&i.apiUrl?i.apiUrl:Pn,readonly:i&&i.readonly?i.readonly:!1,debug:i&&i.debug?i.debug:!1};if(L)return Pt.createElement(Q.Provider,{value:le},n);let{overrides:pe}=yn(M);return Pt.createElement(Sd,{fallback:Pt.createElement(Pt.Fragment,null,n)},Pt.createElement(Q.Provider,{value:le},Pt.createElement(yd,{theme:Ce(M.theme,Ar,pe!=null?pe:{},(V=i==null?void 0:i.theme)!=null?V:{})},n,Pt.createElement(xn,null))))};import dc from"react";import ye,{useEffect as ol,useState as rl}from"react";import Ye,{useState as zd}from"react";import Et from"styled-components";import Yo from"react";import vt from"react";import Bn from"styled-components";var vn=Bn.span`
|
|
687
687
|
font-weight: 600;
|
|
688
688
|
font-size: 14px;
|
|
689
689
|
font-style: normal;
|
|
@@ -892,7 +892,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
892
892
|
`,Kd=Et.div`
|
|
893
893
|
flex: 2;
|
|
894
894
|
padding: 2rem 2rem 2rem 0rem;
|
|
895
|
-
`,qd=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:n,setSelectedStep:r,className:s="",customStepTypes:p=new Map,appearance:d,type:l})=>{let{mergeAppearanceWithDefault:m}=te();d=m(d);let c={[Nr]:Dn,[Wn]:zn,[Hn]:jn},f=w(w({},c),p),[y,T]=zd(0),S=n!=null?n:y,g=r!=null?r:T,
|
|
895
|
+
`,qd=({title:e,subtitle:t,steps:o=[],style:i={},selectedStep:n,setSelectedStep:r,className:s="",customStepTypes:p=new Map,appearance:d,type:l})=>{let{mergeAppearanceWithDefault:m}=te();d=m(d);let c={[Nr]:Dn,[Wn]:zn,[Hn]:jn},f=w(w({},c),p),[y,T]=zd(0),S=n!=null?n:y,g=r!=null?r:T,E=o.filter(F=>F.complete===!0).length,P=()=>{var F;return!((F=o[S])!=null&&F.type)||!f[o[S].type]?f[Nr]({stepData:o[S],appearance:d}):f[o[S].type]({stepData:o[S],appearance:d})};return Ye.createElement(_d,{type:l,styleOverrides:i,className:s,appearance:d},Ye.createElement(Vn,{style:{flex:1}},Ye.createElement(Vn,{style:{padding:"28px 0px 28px 28px",borderBottom:"1px solid #E5E5E5"}},Ye.createElement(Hd,{className:a("checklistTitle",d),appearance:d},e),Ye.createElement(jd,{className:a("checklistSubtitle",d),appearance:d},t),Ye.createElement(We,{total:o.length,count:E,style:{marginTop:"24px",paddingRight:"40px"},appearance:d})),Ye.createElement(Vd,{className:a("checklistStepsContainer",d)},o.map((F,A)=>Ye.createElement(Nn,{data:F,index:A,key:A,listLength:o.length,isSelected:A===S,primaryColor:d.theme.colorPrimary,style:{justifyContent:"space-between"},onClick:()=>{g(A)},appearance:d})))),Ye.createElement(Gd,{appearance:d,className:a("checklistDivider",d)}),Ye.createElement(Kd,null,Ye.createElement(P,null)))},Lr=qd;import H,{useState as Zd}from"react";import Gn from"react";import Yd from"styled-components";var Xd=Yd.svg`
|
|
896
896
|
transition: 'transform 0.35s ease-in-out';
|
|
897
897
|
`,Zt=({style:e,className:t})=>Gn.createElement(Xd,{width:"7",height:"10",viewBox:"0 0 9 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e,className:t},Gn.createElement("path",{d:"M1 13L7.5 7L0.999999 1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}));import Se from"styled-components";var $r={boxShadow:"0px 6px 25px rgba(0, 0, 0, 0.06)",padding:"32px",maxHeight:"700px",msOverflowStyle:"none",scrollbarWidth:"none",paddingBottom:"12px",minHeight:"610px"},Kn=Se.div`
|
|
898
898
|
max-height: 350px;
|
|
@@ -916,7 +916,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
916
916
|
padding-left: 1px;
|
|
917
917
|
color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorTextSecondary}};
|
|
918
918
|
`,Jn=Se.div`
|
|
919
|
-
${e=>
|
|
919
|
+
${e=>B(e)} {
|
|
920
920
|
border: 1px solid #fafafa;
|
|
921
921
|
}
|
|
922
922
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
|
|
@@ -930,7 +930,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
930
930
|
flex-direction: row;
|
|
931
931
|
justify-content: space-between;
|
|
932
932
|
`,Zn=Se.p`
|
|
933
|
-
${e=>
|
|
933
|
+
${e=>B(e)} {
|
|
934
934
|
font-weight: 400;
|
|
935
935
|
font-size: 10px;
|
|
936
936
|
line-height: 12px;
|
|
@@ -944,7 +944,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
944
944
|
`,es=Se.div`
|
|
945
945
|
flex: 1;
|
|
946
946
|
`,ts=Se.div`
|
|
947
|
-
${e=>
|
|
947
|
+
${e=>B(e)} {
|
|
948
948
|
display: flex;
|
|
949
949
|
justify-content: center;
|
|
950
950
|
align-content: center;
|
|
@@ -954,7 +954,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
954
954
|
padding-right: 8px;
|
|
955
955
|
}
|
|
956
956
|
`,os=Se.p`
|
|
957
|
-
${e=>
|
|
957
|
+
${e=>B(e)} {
|
|
958
958
|
font-style: normal;
|
|
959
959
|
font-weight: 600;
|
|
960
960
|
font-size: 22px;
|
|
@@ -966,7 +966,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
966
966
|
margin-bottom: 16px;
|
|
967
967
|
}
|
|
968
968
|
`,rs=Se.p`
|
|
969
|
-
${e=>
|
|
969
|
+
${e=>B(e)} {
|
|
970
970
|
font-weight: 400;
|
|
971
971
|
font-size: 14px;
|
|
972
972
|
line-height: 18px;
|
|
@@ -975,14 +975,14 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
975
975
|
margin-bottom: 8px;
|
|
976
976
|
}
|
|
977
977
|
`,is=Se.div`
|
|
978
|
-
${e=>
|
|
978
|
+
${e=>B(e)} {
|
|
979
979
|
display: flex;
|
|
980
980
|
flex-direction: row;
|
|
981
981
|
justify-content: center;
|
|
982
982
|
gap: 8px;
|
|
983
983
|
}
|
|
984
984
|
`,ns=Se.div`
|
|
985
|
-
${e=>
|
|
985
|
+
${e=>B(e)} {
|
|
986
986
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
987
987
|
background-color: ${e=>e.selected?"#FAFAFA":"#FFFFFF"};
|
|
988
988
|
:hover {
|
|
@@ -1002,7 +1002,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1002
1002
|
position: relative;
|
|
1003
1003
|
cursor: pointer;
|
|
1004
1004
|
`,ss=Se.p`
|
|
1005
|
-
${e=>
|
|
1005
|
+
${e=>B(e)} {
|
|
1006
1006
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1007
1007
|
color: ${e=>e.selected?"#434343":"#BFBFBF"};
|
|
1008
1008
|
}
|
|
@@ -1045,7 +1045,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1045
1045
|
overflow: hidden;
|
|
1046
1046
|
row-gap: 10px;
|
|
1047
1047
|
`,us=at.div`
|
|
1048
|
-
${e=>
|
|
1048
|
+
${e=>B(e)} {
|
|
1049
1049
|
color: #595959;
|
|
1050
1050
|
}
|
|
1051
1051
|
text-transform: uppercase;
|
|
@@ -1055,7 +1055,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1055
1055
|
letter-spacing: 0.09em;
|
|
1056
1056
|
margin-bottom: 12px;
|
|
1057
1057
|
`,fs=at.div`
|
|
1058
|
-
${e=>
|
|
1058
|
+
${e=>B(e)} {
|
|
1059
1059
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1060
1060
|
background: #ffffff;
|
|
1061
1061
|
border: 1px solid #fafafa;
|
|
@@ -1068,7 +1068,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1068
1068
|
max-width: 150px;
|
|
1069
1069
|
min-width: 200px;
|
|
1070
1070
|
`,gs=at.div`
|
|
1071
|
-
${e=>
|
|
1071
|
+
${e=>B(e)} {
|
|
1072
1072
|
background: radial-gradient(50% 50% at 50% 50%, #ffffff 0%, #f7f7f7 100%);
|
|
1073
1073
|
}
|
|
1074
1074
|
width: 40px;
|
|
@@ -1086,7 +1086,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1086
1086
|
width: 20px;
|
|
1087
1087
|
height: 20px;
|
|
1088
1088
|
`,xs=at.div`
|
|
1089
|
-
${e=>
|
|
1089
|
+
${e=>B(e)} {
|
|
1090
1090
|
color: #434343;
|
|
1091
1091
|
}
|
|
1092
1092
|
font-weight: 600;
|
|
@@ -1095,7 +1095,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1095
1095
|
margin-top: 12px;
|
|
1096
1096
|
margin-bottom: 8px;
|
|
1097
1097
|
`,Cs=at.div`
|
|
1098
|
-
${e=>
|
|
1098
|
+
${e=>B(e)} {
|
|
1099
1099
|
color: #8c8c8c;
|
|
1100
1100
|
}
|
|
1101
1101
|
font-weight: 400;
|
|
@@ -1107,7 +1107,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1107
1107
|
line-height: 14px;
|
|
1108
1108
|
font-weight: 400;
|
|
1109
1109
|
cursor: pointer;
|
|
1110
|
-
`;var Qd=({steps:e,style:t,title:o,primaryColor:i,appearance:n,onButtonClick:r})=>{let{primaryCTAClickSideEffects:s}=ae();return pt.createElement(cs,{style:t,className:a("guideContainer",n)},pt.createElement(us,{className:a("guideTitle",n)},o),pt.createElement(ms,{className:a("guideItemContainer",n)},e.map((p,d)=>{var l;return pt.createElement(fs,{key:`guide-${(l=p.id)!=null?l:d}`,className:a("guideItem",n)},p.icon&&pt.createElement(gs,{className:a("guideIcon",n)},pt.createElement(hs,null,p.icon)),pt.createElement(xs,{className:a("guideItemTitle",n),dangerouslySetInnerHTML:ce(p.title)}),pt.createElement(Cs,{className:a("guideItemSubtitle",n),dangerouslySetInnerHTML:ce(p.subtitle)}),pt.createElement(ys,{className:a("guideItemLink",n),color:i,onClick:()=>{p.primaryButtonUri&&s(p),r&&r(p)}},p.primaryButtonTitle))})))},To=Qd;var Rd=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:n,onClose:r,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:l,guideData:m,guideTitle:c,onGuideButtonClick:f})=>{let y=({stepData:x,handleSecondaryCTAClick:
|
|
1110
|
+
`;var Qd=({steps:e,style:t,title:o,primaryColor:i,appearance:n,onButtonClick:r})=>{let{primaryCTAClickSideEffects:s}=ae();return pt.createElement(cs,{style:t,className:a("guideContainer",n)},pt.createElement(us,{className:a("guideTitle",n)},o),pt.createElement(ms,{className:a("guideItemContainer",n)},e.map((p,d)=>{var l;return pt.createElement(fs,{key:`guide-${(l=p.id)!=null?l:d}`,className:a("guideItem",n)},p.icon&&pt.createElement(gs,{className:a("guideIcon",n)},pt.createElement(hs,null,p.icon)),pt.createElement(xs,{className:a("guideItemTitle",n),dangerouslySetInnerHTML:ce(p.title)}),pt.createElement(Cs,{className:a("guideItemSubtitle",n),dangerouslySetInnerHTML:ce(p.subtitle)}),pt.createElement(ys,{className:a("guideItemLink",n),color:i,onClick:()=>{p.primaryButtonUri&&s(p),r&&r(p)}},p.primaryButtonTitle))})))},To=Qd;var Rd=({steps:e,title:t,subtitle:o,stepsTitle:i,visible:n,onClose:r,selectedStep:s,setSelectedStep:p,customStepTypes:d,appearance:l,guideData:m,guideTitle:c,onGuideButtonClick:f})=>{let y=({stepData:x,handleSecondaryCTAClick:v,handleCTAClick:h})=>x?H.createElement(ts,{className:a("checklistStepContainer",l),"data-testid":"checklistStepContainer"},H.createElement(os,{appearance:l,className:a("checklistStepTitle",l),dangerouslySetInnerHTML:ce(x.title)}),H.createElement(rs,{appearance:l,className:a("checklistStepSubtitle",l),dangerouslySetInnerHTML:ce(x.subtitle)}),H.createElement(is,{className:a("checklistCTAContainer",l)},x.secondaryButtonTitle&&H.createElement(oe,{title:x.secondaryButtonTitle,onClick:v,appearance:l,secondary:!0}),H.createElement(oe,{title:x.primaryButtonTitle,onClick:h,appearance:l}))):H.createElement(H.Fragment,null),S=w(w({},{default:x=>{var N;if((N=e[P])!=null&&N.StepContent){let L=e[P].StepContent;return H.createElement("div",null,L)}let v=e[P];return H.createElement(y,{stepData:x,handleCTAClick:()=>{v.handlePrimaryButtonClick&&v.handlePrimaryButtonClick()},handleSecondaryCTAClick:()=>{v.handleSecondaryButtonClick&&v.handleSecondaryButtonClick()}})}}),d),[g,E]=Zd(0),P=s!=null?s:g,F=p!=null?p:E,A=()=>{var x;return e?!((x=e[P])!=null&&x.type)||!S[e[P].type]?S.default(e[P]):S[e[P].type]({stepData:e[P],primaryColor:l.theme.colorPrimary}):H.createElement(H.Fragment,null)},I=e.filter(x=>x.complete).length;return n?(l.theme.modalContainer||(l.theme.borderRadius&&($r.borderRadius=l.theme.borderRadius+"px"),l.theme.modalContainer=$r),H.createElement(Qe,{onClose:r,visible:n,appearance:l},H.createElement(ps,null,H.createElement(qn,null,H.createElement(Yn,{appearance:l,className:a("checklistTitle",l)},t),H.createElement(Xn,{appearance:l,className:a("checklistSubtitle",l)},o)),H.createElement(Kn,null,e&&e.length>0&&H.createElement(Jn,{className:a("stepsContainer",l)},H.createElement(Qn,null,H.createElement("div",{style:{flex:3}},H.createElement(Zn,{className:a("stepsTitle",l)},i)),H.createElement(as,null,H.createElement(We,{style:{width:"100%"},count:I,total:e.length,appearance:l}))),H.createElement(Rn,null,H.createElement(es,{className:a("checklistStepListContainer",l),appearance:l},e.map((x,v)=>{var b;let h=P===v;return H.createElement(ns,{selected:h,className:a(`checklistStepListItem${h?"Selected":""}`,l),key:`checklist-guide-step-${(b=x.id)!=null?b:v}`,disabled:x.blocked,onClick:()=>{x.blocked||F(v)},title:x.blocked?"Finish remaining steps to continue":void 0},h&&H.createElement(qo,{className:a("checklistStepItemSelectedIndicator",l),layoutId:"checklist-step-selected",style:{backgroundColor:l.theme.colorPrimary,borderRadius:0,height:"100%",top:"0%",width:"2px"}}),H.createElement(ss,{selected:h,className:a(`checklistStepListStepName${h?"Selected":""}`,l)},x.stepName),H.createElement(ls,null,H.createElement(nt,{value:x.complete,type:"round",primaryColor:l.theme.colorPrimary,progress:x.progress,appearance:l}),H.createElement(ds,null,H.createElement(Zt,{style:{marginLeft:"10px"},color:l.theme.colorBackgroundSecondary}))))})),H.createElement(A,null))),m&&m.length>0&&H.createElement(To,{steps:m,title:c,primaryColor:l.theme.colorPrimary,style:{border:"none",boxShadow:"none"},appearance:l,onButtonClick:x=>(f&&f(x),!0)}))))):H.createElement(H.Fragment,null)},Mr=Rd;import Ne,{useEffect as Ls,useState as $s}from"react";import Fe from"react";import dt from"styled-components";var Ss=dt.div`
|
|
1111
1111
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1112
1112
|
border: 1px solid;
|
|
1113
1113
|
border-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBorder}};
|
|
@@ -1199,7 +1199,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1199
1199
|
padding: 24px;
|
|
1200
1200
|
border-radius: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.borderRadius}}px;
|
|
1201
1201
|
background-color: ${e=>{var t,o;return(o=(t=e.appearance)==null?void 0:t.theme)==null?void 0:o.colorBackground}};
|
|
1202
|
-
`;var ec=({title:e,subtitle:t,steps:o,onClose:i,visible:n,autoExpandFirstIncompleteStep:r=!0,autoCollapse:s=!0,autoExpandNextStep:p=!0,selectedStep:d,setSelectedStep:l,appearance:m,type:c,className:f,customStepTypes:y,style:T})=>{let S=o.filter(
|
|
1202
|
+
`;var ec=({title:e,subtitle:t,steps:o,onClose:i,visible:n,autoExpandFirstIncompleteStep:r=!0,autoCollapse:s=!0,autoExpandNextStep:p=!0,selectedStep:d,setSelectedStep:l,appearance:m,type:c,className:f,customStepTypes:y,style:T})=>{let S=o.filter(v=>v.complete).length,[g,E]=$s(Array(o.length).fill(!0)),[P,F]=$s(!1);Ls(()=>{let v=[...g];if(r){for(let h=0;h<o.length;h++)if(!o[h].complete){v[h]=!1;break}E(v)}},[]),Ls(()=>{if(!P&&!r){F(!0);return}A(d)},[d]);let A=v=>{let h=[...g];if(s)for(let b=0;b<g.length;++b)b!==v&&(h[b]=!0);h[v]=!h[v],E(h)};if(!n&&c=="modal")return Ne.createElement(Ne.Fragment,null);let I=Ne.createElement(Ne.Fragment,null,Ne.createElement(Es,null,Ne.createElement(As,{appearance:m,className:a("checklistTitle",m),dangerouslySetInnerHTML:ce(e)}),Ne.createElement(Os,{appearance:m,className:a("checklistSubtitle",m),dangerouslySetInnerHTML:ce(t)})),Ne.createElement(We,{display:"percent",count:S,total:o.length,style:{margin:"14px 0px 8px 0px"},appearance:m})),x=Ne.createElement(Is,{className:Te(a("checklistContainer",m),f)},o.map((v,h)=>{var N;let b=g[h];return Ne.createElement(Bs,{appearance:m,stepData:v,collapsed:b,key:`modal-checklist-${(N=v.id)!=null?N:h}`,onClick:()=>{if(d===h){A(h);return}l(h)},onPrimaryButtonClick:()=>{v.handlePrimaryButtonClick&&v.handlePrimaryButtonClick(),p&&!v.completionCriteria&&h<g.length-1&&g[h+1]&&l(h+1)},onSecondaryButtonClick:()=>{v.handleSecondaryButtonClick&&v.handleSecondaryButtonClick()},customStepTypes:y})}));return c==="inline"?Ne.createElement(Ns,{appearance:m,className:Te(a("checklistInlineContainer",m),f),style:T},I,x):Ne.createElement(Ne.Fragment,null,Ne.createElement(Qe,{onClose:i,visible:n,appearance:m,style:{maxWidth:"600px"},headerContent:I},x))},Dr=ec;import me,{useEffect as Ur,useRef as ac,useState as At}from"react";import{useEffect as tc,useState as oc}from"react";var Ms=()=>{let e={isSmall:"(max-width: 480px)",isMedium:"(min-width: 481px) AND (max-width: 1023px)",isLarge:"(min-width: 1025px)"},t=Object.fromEntries(Object.entries(e).map(([p])=>[p,!1])),[o,i]=oc(t),n=null,r=()=>{n!==null?clearTimeout(n):s(),n=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]}));i(p)};return tc(()=>{s()},[]),o};import eo from"react";import ge,{css as Ds,keyframes as Us}from"styled-components";var Ws=Ds`
|
|
1203
1203
|
border: 1px solid ${({theme:e})=>e.colorBorder};
|
|
1204
1204
|
`,rc=Ds`
|
|
1205
1205
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
|
|
@@ -1282,7 +1282,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1282
1282
|
margin-bottom: 12px;
|
|
1283
1283
|
width: 40px;
|
|
1284
1284
|
`,qs=ge(Vs)`
|
|
1285
|
-
${e=>
|
|
1285
|
+
${e=>B(e)} {
|
|
1286
1286
|
${rc}
|
|
1287
1287
|
|
|
1288
1288
|
background: ${({theme:e})=>e.colorBackground};
|
|
@@ -1341,7 +1341,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1341
1341
|
color: ${({theme:e})=>e.colorTextSecondary};
|
|
1342
1342
|
${e=>e.blocked||e.complete?"opacity: 0.4;":`
|
|
1343
1343
|
`}
|
|
1344
|
-
`;var Rs=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=te(),{primaryCTAClickSideEffects:n}=ae();o=i(o);let{imageUri:r=null,subtitle:s=null,title:p=null,complete:d=!1,blocked:l=!1}=e,m=e.primaryButtonTitle||e.secondaryButtonTitle,c=()=>{n(e)};return eo.createElement(Gs,{className:a("carouselCard",o),onClick:l?null:c,style:t,blocked:l,complete:d},r&&eo.createElement(Ks,{className:a("carouselCardImage",o),src:r,alt:p,style:{opacity:d||l?.4:1}}),d&&eo.createElement(Ys,{className:a("carouselCompletedPill",o)},eo.createElement(Zs,{style:{color:"#108E0B"}},"Complete")),p&&eo.createElement(Qs,{blocked:l,complete:d,className:a("carouselCardTitle",o)},p),s&&eo.createElement(xt.Quiet,{blocked:l,complete:d,className:a("carouselCardSubtitle",o)},s))};var pc=()=>me.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},me.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),me.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),me.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),el=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,n]=At(!1),[r,s]=At(!1);Ur(()=>{t===!0&&i===!1?n(!0):t===!1&&i===!0&&s(!0)},[t]);let p=()=>{n(!1),s(!1)},d=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return i?me.createElement(Hs,{style:d,reversed:r,onAnimationEnd:r?p:null},me.createElement(js,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},me.createElement(pc,null))):null},tl=({flowId:e,appearance:t,customVariables:o,className:i})=>{let n=ac(null),[r,s]=At(!1),[p,d]=At(!1),[l,m]=At(null),[c,f]=At([]),[y,T]=At(0),{isSmall:S}=Ms(),g=S?1:3,{getFlowMetadata:
|
|
1344
|
+
`;var Rs=({stepData:e,style:t={},appearance:o})=>{let{mergeAppearanceWithDefault:i}=te(),{primaryCTAClickSideEffects:n}=ae();o=i(o);let{imageUri:r=null,subtitle:s=null,title:p=null,complete:d=!1,blocked:l=!1}=e,m=e.primaryButtonTitle||e.secondaryButtonTitle,c=()=>{n(e)};return eo.createElement(Gs,{className:a("carouselCard",o),onClick:l?null:c,style:t,blocked:l,complete:d},r&&eo.createElement(Ks,{className:a("carouselCardImage",o),src:r,alt:p,style:{opacity:d||l?.4:1}}),d&&eo.createElement(Ys,{className:a("carouselCompletedPill",o)},eo.createElement(Zs,{style:{color:"#108E0B"}},"Complete")),p&&eo.createElement(Qs,{blocked:l,complete:d,className:a("carouselCardTitle",o)},p),s&&eo.createElement(xt.Quiet,{blocked:l,complete:d,className:a("carouselCardSubtitle",o)},s))};var pc=()=>me.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},me.createElement("path",{d:"M14 6L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),me.createElement("path",{d:"M14 18L20 12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),me.createElement("path",{d:"M4 12H20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})),el=({side:e="left",show:t=!1,onClick:o=()=>{}})=>{let[i,n]=At(!1),[r,s]=At(!1);Ur(()=>{t===!0&&i===!1?n(!0):t===!1&&i===!0&&s(!0)},[t]);let p=()=>{n(!1),s(!1)},d=e=="left"?{top:0,bottom:0,left:-20,transform:"rotate(180deg)"}:{top:0,bottom:0,right:-20};return i?me.createElement(Hs,{style:d,reversed:r,onAnimationEnd:r?p:null},me.createElement(js,{onClick:()=>o(),style:{right:16,top:"calc(50% - 24px)"}},me.createElement(pc,null))):null},tl=({flowId:e,appearance:t,customVariables:o,className:i})=>{let n=ac(null),[r,s]=At(!1),[p,d]=At(!1),[l,m]=At(null),[c,f]=At([]),[y,T]=At(0),{isSmall:S}=Ms(),g=S?1:3,{getFlowMetadata:E,getFlowSteps:P,getNumberOfStepsCompleted:F,updateCustomVariables:A,isLoading:I}=R();Ur(()=>{A(o)},[o,I]),Ur(()=>{if(I)return;let L=E(e),O=F(e),j=P(e);m(L),L.data!==null&&(f(j.sort((M,G)=>Number(M.complete)-Number(G.complete))),d(j.length>g),T(O))},[I]);let x=[];for(let L=0;L<c.length;L+=g)x.push(c.slice(L,L+g));let v=L=>{let O=L.target,j=O.scrollWidth-O.clientWidth,M=Math.ceil(O.scrollLeft);M>0&&r===!1&&s(!0),M===0&&r===!0&&s(!1),M<j&&p===!1&&d(!0),M===j&&p===!0&&d(!1)},h=(L=!0)=>{let O=L?1:-1;n.current!==null&&n.current.scrollBy({left:n.current.clientWidth*O,behavior:"smooth"})},b=null,N=L=>{b!==null?clearTimeout(b):v(L),b=setTimeout(()=>{v(L)},16)};return I?null:me.createElement(qs,{className:Te(a("carouselContainer",t),i)},me.createElement("div",{style:{display:"flex",justifyContent:S?"center":"space-between",marginBottom:20,flexWrap:S?"wrap":"nowrap",gap:S?16:20}},me.createElement("div",null,me.createElement(Xs,{className:a("carouselTitle",t)},l==null?void 0:l.title),me.createElement(xt.Quiet,{className:a("carouselSubtitle",t)},l==null?void 0:l.subtitle)),me.createElement(Js,{className:a("progressWrapper",t)},me.createElement(We,{count:y,total:c.length,appearance:t}))),me.createElement("div",{style:{position:"relative"}},me.createElement(el,{show:r,onClick:()=>h(!1)}),me.createElement(el,{side:"right",show:p,onClick:h}),me.createElement(zs,{ref:n,onScroll:N},x.map((L,O)=>me.createElement(_s,{key:O,style:{flex:`0 0 calc(100% - ${c.length>g?36:0}px)`}},L.map((j,M)=>me.createElement(Rs,{key:M,stepData:j,style:{flex:c.length>g?`0 1 calc(100% / ${g} - 16px * 2 / ${g})`:1},appearance:t})))))),me.createElement(ie,{appearance:t}))};var Wr=A=>{var I=A,{flowId:e,title:t,subtitle:o,style:i,initialSelectedStep:n,className:r,type:s="inline",onDismiss:p,visible:d,customVariables:l,onStepCompletion:m,onButtonClick:c,appearance:f,hideOnFlowCompletion:y,setVisible:T,customStepTypes:S,checklistStyle:g="default",autoExpandFirstIncompleteStep:E,autoExpandNextStep:P}=I,F=Ie(I,["flowId","title","subtitle","style","initialSelectedStep","className","type","onDismiss","visible","customVariables","onStepCompletion","onButtonClick","appearance","hideOnFlowCompletion","setVisible","customStepTypes","checklistStyle","autoExpandFirstIncompleteStep","autoExpandNextStep"]);let{getFlow:x,getFlowSteps:v,markStepCompleted:h,getStepStatus:b,getNumberOfStepsCompleted:N,isLoading:L,targetingLogicShouldHideFlow:O,updateCustomVariables:j,getFlowMetadata:M,isStepBlocked:G,getFlowStatus:le,hasActiveFullPageFlow:pe,setHasActiveFullPageFlow:q}=R(),{primaryCTAClickSideEffects:se,secondaryCTAClickSideEffects:de}=ae(),{getOpenFlowState:be,setOpenFlowState:V}=Be(),[Y,ee]=rl(n||0),[Ve,Le]=rl(!1),X=d===void 0?be(e):d,ue=s==="modal",{mergeAppearanceWithDefault:Oe}=te();if(f=Oe(f),ol(()=>{j(l)},[l,L]),ol(()=>{d!==void 0&&(ue&&d===!0?q(!0):ue&&d===!1&&q(!1))},[d,T,pe]),L)return null;let we=x(e);if(!we||O(we))return null;let U=v(e);if(!U||y===!0&&le(e)===Z)return null;let $=M(e);if($!=null&&$.title&&(t=$.title),$!=null&&$.subtitle&&(o=$.subtitle),!Ve&&n===void 0&&N(e)>0){let u=U.findIndex(k=>k.complete===!1);ee(u>-1?u:U.length-1),Le(!0)}function W(){if(Y+1>=U.length){ue&&V(e,!1);return}G(e,U[Y+1].id)||ee(Y+1)}function J(u,k,z){let he=Y+1<U.length?U[Y+1]:null;c&&c(u,Y,k,he)===!0&&ue&&Xe(),m&&m(u,z,he),!m&&!c&&(u.primaryButtonUri||u.secondaryButtonUri)&&ue&&Xe()}function fe(){return U.map((u,k)=>_(w({},u),{handleSecondaryButtonClick:()=>{W(),de(u),u.skippable===!0&&h(e,u.id,{skipped:!0}),J(u,"secondary",k)},handlePrimaryButtonClick:()=>{(!u.completionCriteria&&(u.autoMarkCompleted||u.autoMarkCompleted===void 0)||u.completionCriteria&&u.autoMarkCompleted===!0)&&(h(e,u.id),W()),J(u,"primary",k),se(u),b(e,u.id)===Ke&&W()}}))}function $e(){return ye.createElement(ie,{appearance:f})}let Ge={steps:fe(),title:t,subtitle:o,primaryColor:f.theme.colorPrimary,appearance:f,customStepTypes:S,type:s,className:r,autoExpandFirstIncompleteStep:E,autoExpandNextStep:P};function Xe(){V(e,!1),p&&p(),T&&T(!1)}function St(){return ye.createElement(ye.Fragment,null,ye.createElement($e,null),ye.createElement(tl,{flowId:e,appearance:f,customVariables:l,className:r}))}function Lt(){return ye.createElement(ye.Fragment,null,ye.createElement($e,null),ye.createElement(Dr,w({visible:X,onClose:()=>{Xe()},selectedStep:Y,setSelectedStep:ee,autoExpandNextStep:!0,appearance:f},Ge)))}function $t(){var z;let u=F.guideFlowId,k;return u&&x(u)&&(k=v(u)),ye.createElement(ye.Fragment,null,ye.createElement($e,null),ye.createElement(Mr,w({visible:X,stepsTitle:$.stepsTitle?$.stepsTitle:"Your quick start guide",onClose:()=>{Xe()},selectedStep:Y,setSelectedStep:ee,guideData:k,guideTitle:(z=F.guideTitle)!=null?z:"Guide",appearance:f,title:t,subtitle:o,onGuideButtonClick:he=>{J(he,"link",0)},customStepTypes:S},Ge)))}function C(){let u=ye.createElement(Lr,w({flowId:e,style:i,selectedStep:Y,setSelectedStep:ee,appearance:f,type:s},Ge));return ue?ye.createElement(Qe,{onClose:()=>{Xe()},visible:X,appearance:f,style:{paddingTop:"0px",padding:"12px",paddingLeft:0}},ye.createElement($e,null),u):ye.createElement(ye.Fragment,null,ye.createElement($e,null),u)}switch(g){case"condensed":return Lt();case"with-guide":return $t();case"default":return C();case"carousel":return St();default:return C()}};var cc=e=>dc.createElement(Wr,w({type:"inline"},e));import yt,{useEffect as mc}from"react";import tt from"react";import Ro from"styled-components";var il=Ro.div`
|
|
1345
1345
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1346
1346
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1347
1347
|
padding: 10px 12px 10px 12px;
|
|
@@ -1384,7 +1384,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1384
1384
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1385
1385
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1386
1386
|
`,dl=Fo.div`
|
|
1387
|
-
${e=>
|
|
1387
|
+
${e=>B(e)} {
|
|
1388
1388
|
display: flex;
|
|
1389
1389
|
justify-content: center;
|
|
1390
1390
|
align-items: center;
|
|
@@ -1410,7 +1410,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1410
1410
|
:hover {
|
|
1411
1411
|
opacity: 0.8;
|
|
1412
1412
|
}
|
|
1413
|
-
`;var ul=({title:e,subtitle:t,icon:o,appearance:i,count:n,total:r,className:s,style:p})=>Ct.createElement(Ct.Fragment,null,Ct.createElement(pl,{appearance:i,className:Te(a("fullWidthProgressBadgeContainer",i),s!=null?s:""),style:p},o&&Ct.createElement(dl,{className:a("fullWidthProgressBadgeIcon",i)},o),Ct.createElement(cl,null,Ct.createElement(Ae,{size:"small",appearance:i,title:e,subtitle:t})),Ct.createElement(ml,{className:a("fullWidthProgressBadgeProgressContainer",i)},Ct.createElement(We,{count:n,total:r,display:"percent",textLocation:"top"}))));var uc=({flowId:e,title:t,subtitle:o,icon:i,style:n,onClick:r,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:l,type:m="default"})=>{let{getFlow:c,getFlowSteps:f,getFlowStatus:y,getNumberOfStepsCompleted:T,isLoading:S,targetingLogicShouldHideFlow:g,updateCustomVariables:
|
|
1413
|
+
`;var ul=({title:e,subtitle:t,icon:o,appearance:i,count:n,total:r,className:s,style:p})=>Ct.createElement(Ct.Fragment,null,Ct.createElement(pl,{appearance:i,className:Te(a("fullWidthProgressBadgeContainer",i),s!=null?s:""),style:p},o&&Ct.createElement(dl,{className:a("fullWidthProgressBadgeIcon",i)},o),Ct.createElement(cl,null,Ct.createElement(Ae,{size:"small",appearance:i,title:e,subtitle:t})),Ct.createElement(ml,{className:a("fullWidthProgressBadgeProgressContainer",i)},Ct.createElement(We,{count:n,total:r,display:"percent",textLocation:"top"}))));var uc=({flowId:e,title:t,subtitle:o,icon:i,style:n,onClick:r,className:s,customVariables:p,hideOnFlowCompletion:d,appearance:l,type:m="default"})=>{let{getFlow:c,getFlowSteps:f,getFlowStatus:y,getNumberOfStepsCompleted:T,isLoading:S,targetingLogicShouldHideFlow:g,updateCustomVariables:E}=R(),{mergeAppearanceWithDefault:P}=te();l=P(l);let{setOpenFlowState:F,getOpenFlowState:A}=Be();if(mc(()=>{E(p)},[p,S]),S)return null;let I=c(e);if(!I||g(I)||d===!0&&y(e)===Z)return null;let x=f(e),v=T(e);return m==="full-width"?yt.createElement(yt.Fragment,null,yt.createElement(ie,{appearance:l}),yt.createElement(ul,{title:t,subtitle:o,count:v,total:x.length,style:n,className:s,appearance:l,icon:i,onClick:()=>{}})):yt.createElement(yt.Fragment,null,yt.createElement(ie,{appearance:l}),yt.createElement(al,{count:v,total:x.length,title:t,style:n,onClick:()=>{F(e,!0),r&&r()},type:m,className:s,appearance:l}))};import fc from"react";var gc=n=>{var r=n,{flowId:e,style:t,appearance:o}=r,i=Ie(r,["flowId","style","appearance"]);let{getFlow:s,targetingLogicShouldHideFlow:p,getFlowSteps:d}=R(),{mergeAppearanceWithDefault:l}=te();o=l(o);let m=s(e);if(!m||p(m))return null;let c=d(e);return fc.createElement(To,w({steps:c,style:t,appearance:o},i))};import Ot,{useContext as Bc,useEffect as Ec}from"react";import K,{useEffect as er,useLayoutEffect as hl,useRef as bc,useState as to}from"react";import ko from"styled-components";import{useCallback as hc,useEffect as xc,useState as Cc}from"react";var zr=(e,t,o,i={x:20,y:20},n)=>{let r=n=="fixed"?0:window.scrollY,s=n=="fixed"?0:window.scrollX;return t==="left"?{x:e.left-o+i.x+s,y:e.top-i.y+r}:t==="right"?{x:e.left+e.width+i.x+s,y:e.top-i.y+r}:{x:0,y:0}};function fl(e,t){let o="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[i,n]=Cc(o),r=hc(()=>{e&&n(e.getBoundingClientRect())},[e]);return xc(()=>(r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)),[e,t]),i}import{useContext as yc,useState as Sc}from"react";function gl(){let{debug:e}=yc(Q),[t,o]=Sc([]);function i(r){e&&(t.find(s=>s===r)||(o([...t,r]),console.log(r)))}function n(r){e&&(t.find(s=>s===r)||(o([...t,r]),console.warn(r)))}return{logIfDebugMode:i,logErrorIfDebugMode:n}}var xl=300,Cl=100,wc=500,oo=12,Tc=ko.div`
|
|
1414
1414
|
width: 100%;
|
|
1415
1415
|
height: 100%;
|
|
1416
1416
|
border-radius: 9999px;
|
|
@@ -1451,8 +1451,8 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1451
1451
|
`,Pc=ko(yl)`
|
|
1452
1452
|
width: ${oo+12}px;
|
|
1453
1453
|
height: ${oo+12}px;
|
|
1454
|
-
`,vc=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:n=!0,primaryColor:r="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:l=0,customStepTypes:m,appearance:c,dismissible:f=!1,showHighlightOnly:y,showStepCount:T=!0,completedStepsCount:S=0,showFrigadeBranding:g=!1,cssPosition:
|
|
1455
|
-
${e=>
|
|
1454
|
+
`,vc=({steps:e=[],onDismiss:t,onComplete:o=()=>{},tooltipPosition:i="auto",showHighlight:n=!0,primaryColor:r="#000000",offset:s={x:0,y:0},visible:p=!0,containerStyle:d={},selectedStep:l=0,customStepTypes:m,appearance:c,dismissible:f=!1,showHighlightOnly:y,showStepCount:T=!0,completedStepsCount:S=0,showFrigadeBranding:g=!1,cssPosition:E="absolute"})=>{var $e,Ge,Xe,St,Lt,$t,C,u,k,z,he,xe,io,Xr,Jr,Qr,Zr,Rr,ei;let{logErrorIfDebugMode:P}=gl(),[F,A]=to(),[I,x]=to(new Date),v=bc(null),[h,b]=to(document.querySelector(e[l].selector)),N=fl(h,I),[L,O]=to(),[j,M]=to(!y),G=(Ge=($e=e[l])==null?void 0:$e.props)!=null&&Ge.position?e[l].props.position:E,le=(Lt=(St=(Xe=e[l])==null?void 0:Xe.props)==null?void 0:St.zIndex)!=null?Lt:90,pe=($t=F==null?void 0:F.width)!=null?$t:xl,q=(C=F==null?void 0:F.height)!=null?C:Cl,[se,de]=to(new Date().getTime());s=(z=(k=(u=e[l])==null?void 0:u.props)==null?void 0:k.offset)!=null?z:s;let be=window.location.pathname.split("/").pop();hl(()=>{v.current&&A({width:v.current.clientWidth,height:v.current.clientHeight})},[l,I,G]),er(()=>{y||M(!0)},[l]);let V=()=>{let ne=document.querySelector(e[l].selector);if(!ne){O(void 0),b(null),P(`FrigadeTour: Could not find element with selector "${e[l].selector}" for step ${e[l].id}`);return}L&&L===JSON.stringify(ne==null?void 0:ne.getBoundingClientRect())||(b(ne),x(new Date),ne&&O(JSON.stringify(ne.getBoundingClientRect())))};if(er(()=>{let ne=new MutationObserver(V);return ne.observe(document.body,{subtree:!0,childList:!0}),()=>ne.disconnect()},[V]),er(()=>{let ne=new MutationObserver(V);return ne.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>ne.disconnect()},[V]),er(()=>{let ne=setInterval(()=>{V()},10);return()=>clearInterval(ne)},[V]),hl(()=>{setTimeout(()=>{V()},wc),V()},[l,be]),h===null||!p)return null;let Y=i==="auto"?"right":i,ee=zr(N,Y,pe,s,G),Ve=N.right+pe>(window.innerWidth||document.documentElement.clientWidth),Le=N.bottom+Cl>(window.innerHeight||document.documentElement.clientHeight);Ve&&i==="auto"&&(ee=zr(N,"left",pe,s,G),Y="left"),(xe=(he=e[l])==null?void 0:he.props)!=null&&xe.tooltipPosition&&((Xr=(io=e[l])==null?void 0:io.props)==null?void 0:Xr.tooltipPosition)!=="auto"&&(((Qr=(Jr=e[l])==null?void 0:Jr.props)==null?void 0:Qr.tooltipPosition)==="left"||((Rr=(Zr=e[l])==null?void 0:Zr.props)==null?void 0:Rr.tooltipPosition)==="right")&&(Y=e[l].props.tooltipPosition);let X=()=>{let ne=()=>{if(e[l].handlePrimaryButtonClick&&(e[l].handlePrimaryButtonClick(),M(!1),setTimeout(()=>{V()},30)),S===e.length-1)return o()},mt=()=>{e[l].handleSecondaryButtonClick&&(e[l].handleSecondaryButtonClick(),y&&!e[l].secondaryButtonUri&&M(!1))};return K.createElement(K.Fragment,null,T&&e.length>1&&K.createElement(xi,null,K.createElement(yi,{className:a("tooltipStepCounter",c)},l+1," of ",e.length)),(e[l].primaryButtonTitle||e[l].secondaryButtonTitle)&&K.createElement(Ci,{showStepCount:T,className:a("tooltipCTAContainer",c)},e[l].secondaryButtonTitle&&K.createElement(oe,{title:e[l].secondaryButtonTitle,appearance:c,onClick:mt,size:"small",withMargin:!1,secondary:!0}),e[l].primaryButtonTitle&&K.createElement(oe,{title:e[l].primaryButtonTitle,appearance:c,onClick:ne,withMargin:!1,size:"small"})))},ue=()=>K.createElement(K.Fragment,null,f&&K.createElement(mi,{"data-testid":"tooltip-dismiss",onClick:()=>{t&&t()},className:a("tooltipClose",c),hasImage:!!e[l].imageUri||!!e[l].videoUri},K.createElement(Ee,null)),e[l].imageUri&&K.createElement(ui,{dismissible:f,appearance:c,src:e[l].imageUri,className:a("tooltipImageContainer",c)}),e[l].videoUri&&!e[l].imageUri&&K.createElement(fi,{dismissible:f,appearance:c,className:a("tooltipVideoContainer",c)},K.createElement(Re,{appearance:c,videoUri:e[l].videoUri})),K.createElement(hi,{className:a("tooltipContentContainer",c)},K.createElement(Ae,{appearance:c,title:e[l].title,subtitle:e[l].subtitle,size:"small"}),K.createElement(gi,{className:a("tooltipFooter",c)},K.createElement(X,null)))),we=w(w({},{default:ne=>{var mt;if((mt=e[l])!=null&&mt.StepContent){let ra=e[l].StepContent;return K.createElement("div",null,ra)}return K.createElement(ue,null)}}),m),U=()=>{var ne;return e?!((ne=e[l])!=null&&ne.type)||!we[e[l].type]?we.default(e[l]):we[e[l].type]({stepData:e[l],primaryColor:r}):K.createElement(K.Fragment,null)};if(e[l].complete===!0||ee.x==0&&ee.y==0&&new Date().getTime()-se<100)return null;let $={top:(ee==null?void 0:ee.y)-oo,left:(ei=Y=="left"?N.x+s.x:(ee==null?void 0:ee.x)-oo)!=null?ei:0,cursor:y?"pointer":"default",position:G},W=()=>{let mt=$.left+(Y=="left"?-pe:24);return Math.min(Math.max(mt,20),window.innerWidth-pe-20)},J=()=>{if(G==="fixed")return $.top;let ne=$.top+q,mt=20;return ne>window.innerHeight-mt?$.top+-q:$.top},fe=()=>{y&&(x(new Date),M(!j))};return K.createElement(kc,null,K.createElement(Pc,{style:$,zIndex:le,className:a("tourHighlightContainer",c)},n&&e[l].showHighlight!==!1&&E!=="static"&&K.createElement(K.Fragment,null,K.createElement(Fc,{style:{position:G},onClick:fe,primaryColor:c.theme.colorPrimary,className:a("tourHighlightInnerCircle",c)}),K.createElement(Tc,{style:{position:"absolute"},onClick:fe,primaryColor:c.theme.colorPrimary,className:a("tourHighlightOuterCircle",c)}))),K.createElement(yl,{style:_(w({},$),{left:W(),top:J()}),zIndex:le+1,className:a("tooltipContainerWrapper",c)},j&&K.createElement(K.Fragment,null,K.createElement(Ao,{ref:v,layoutId:"tooltip-container",style:w({position:"relative",width:"max-content",right:0,top:E!=="static"?12:0},d),appearance:c,className:a("tooltipContainer",c),maxWidth:xl,zIndex:le+10},K.createElement(U,null)),g&&K.createElement(bi,{className:a("poweredByFrigadeTooltipRibbon",c),appearance:c,zIndex:le+10},K.createElement(Oo,{appearance:c})))))},_r=vc;import{Portal as Ac}from"react-portal";var Oc=S=>{var g=S,{flowId:e,customVariables:t,appearance:o,onStepCompletion:i,onButtonClick:n,showTooltipsSimultaneously:r=!1,onDismiss:s,dismissible:p,tooltipPosition:d="auto",showHighlightOnly:l=!1,dismissBehavior:m="complete-flow",onComplete:c,skipIfNotFound:f=!1,cssPosition:y="absolute"}=g,T=Ie(g,["flowId","customVariables","appearance","onStepCompletion","onButtonClick","showTooltipsSimultaneously","onDismiss","dismissible","tooltipPosition","showHighlightOnly","dismissBehavior","onComplete","skipIfNotFound","cssPosition"]);let{getFlow:E,getFlowSteps:P,isLoading:F,targetingLogicShouldHideFlow:A,markStepCompleted:I,markStepStarted:x,markFlowCompleted:v,updateCustomVariables:h,getCurrentStepIndex:b,getStepStatus:N,isStepBlocked:L,getFlowStatus:O,getNumberOfStepsCompleted:j}=R(),{isLoadingUserFlowStateData:M}=De(),{primaryCTAClickSideEffects:G,secondaryCTAClickSideEffects:le}=ae(),{hasOpenModals:pe}=Be(),q=b(e),{openFlowStates:se}=Bc(Q),{mergeAppearanceWithDefault:de}=te();if(o=de(o),Ec(()=>{h(t)},[t,F]),M)return null;let be=E(e);if(!be||A(be)||O(e)==Z||pe())return null;let V=P(e);if(Object.keys(se).length>0){let U=Object.keys(se).find($=>se[$]===!0);if(U!==void 0&&U!==e)return Ot.createElement(Ot.Fragment,null)}function Y(U){return D(this,null,function*(){if(yield I(e,U.id),V.map($=>N(e,$.id)).every($=>$===Ke)){yield v(e);return}if(!l&&q+1<V.length&&!r){if(L(e,V[q+1].id))return;yield x(e,V[q+1].id)}})}function ee(U,$,W){let J=q+1<V.length?V[q+1]:null;n&&n(U,q,$,J),i&&i(U,W,J)}function Ve(){return V.map(U=>_(w({},U),{handleSecondaryButtonClick:()=>D(this,null,function*(){le(U),U.skippable===!0&&(yield I(e,U.id,{skipped:!0})),ee(U,"secondary",q)}),handlePrimaryButtonClick:()=>D(this,null,function*(){(!U.completionCriteria&&(U.autoMarkCompleted||U.autoMarkCompleted===void 0)||U.completionCriteria&&U.autoMarkCompleted===!0)&&(yield Y(U)),ee(U,"primary",q),G(U)})}))}function Le(U){return D(this,null,function*(){s&&s(),m==="complete-flow"?yield v(e):yield I(e,U.id)})}function X(){c&&c()}let ue=!document.querySelector(V[q].selector);function Oe(){let U=V.findIndex($=>!!document.querySelector($.selector));return V.map(($,W)=>ue&&!r&&W!==U&&f||!r&&W!==q?null:Ot.createElement(_r,w({key:$.id,appearance:o,steps:Ve(),selectedStep:W,showTooltipsSimultaneously:r,dismissible:p,onDismiss:()=>Le($),tooltipPosition:d,showHighlightOnly:l,completedStepsCount:j(e),onComplete:X,cssPosition:y},T)))}function we(){return Ot.createElement(Ot.Fragment,null,Ot.createElement(ie,{appearance:o}),Oe())}return y==="static"?we():Ot.createElement(Ac,null,we())};import _e,{useEffect as Ic,useRef as Nc,useState as Lc}from"react";import{Portal as $c}from"react-portal";import It from"styled-components";var Sl=It.button`
|
|
1455
|
+
${e=>B(e)} {
|
|
1456
1456
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1457
1457
|
|
|
1458
1458
|
display: flex;
|
|
@@ -1470,12 +1470,12 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
1472
|
`,bl=It.span`
|
|
1473
|
-
${e=>
|
|
1473
|
+
${e=>B(e)} {
|
|
1474
1474
|
font-size: 12px;
|
|
1475
1475
|
display: inline-block;
|
|
1476
1476
|
}
|
|
1477
1477
|
`,wl=It.span`
|
|
1478
|
-
${e=>
|
|
1478
|
+
${e=>B(e)} {
|
|
1479
1479
|
font-size: 12px;
|
|
1480
1480
|
display: inline-block;
|
|
1481
1481
|
}
|
|
@@ -1490,7 +1490,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1490
1490
|
align-items: flex-end;
|
|
1491
1491
|
z-index: 50;
|
|
1492
1492
|
`,Fl=It.button`
|
|
1493
|
-
${e=>
|
|
1493
|
+
${e=>B(e)} {
|
|
1494
1494
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1495
1495
|
background-color: #ffffff;
|
|
1496
1496
|
border: 1px solid #f5f5f5;
|
|
@@ -1506,7 +1506,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1506
1506
|
border-radius: 45px;
|
|
1507
1507
|
cursor: pointer;
|
|
1508
1508
|
`,kl=It.div`
|
|
1509
|
-
${e=>
|
|
1509
|
+
${e=>B(e)} {
|
|
1510
1510
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1511
1511
|
background: #ffffff;
|
|
1512
1512
|
}
|
|
@@ -1523,7 +1523,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1523
1523
|
top: ${e=>e.type=="inline"?"68px":0};
|
|
1524
1524
|
margin-left: ${e=>e.type=="inline"?"-127px":0};
|
|
1525
1525
|
`,Pl=It.button`
|
|
1526
|
-
${e=>
|
|
1526
|
+
${e=>B(e)} {
|
|
1527
1527
|
// Anything inside this block will be ignored if the user provides a custom class
|
|
1528
1528
|
color: #434343;
|
|
1529
1529
|
:hover {
|
|
@@ -1539,8 +1539,8 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1539
1539
|
font-size: 14px;
|
|
1540
1540
|
|
|
1541
1541
|
padding: 8px 12px;
|
|
1542
|
-
`;import vl from"react";var Bl=({style:e,className:t})=>vl.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},vl.createElement("path",{fill:"currentColor",d:"M13.43 4.938a4.494 4.494 0 00-1.043-1.435A4.955 4.955 0 009 2.197c-1.276 0-2.48.464-3.387 1.305A4.502 4.502 0 004.57 4.938a4.242 4.242 0 00-.386 1.773v.475c0 .109.087.197.196.197h.95a.197.197 0 00.197-.197V6.71c0-1.749 1.557-3.17 3.473-3.17s3.473 1.421 3.473 3.17c0 .718-.254 1.393-.738 1.955a3.537 3.537 0 01-1.9 1.125 1.928 1.928 0 00-1.085.682c-.271.343-.42.768-.42 1.206v.552c0 .109.088.197.197.197h.95a.197.197 0 00.196-.197v-.552c0-.276.192-.519.457-.578a4.904 4.904 0 002.625-1.56c.335-.392.597-.828.778-1.3a4.256 4.256 0 00-.103-3.303zM9 13.834a.985.985 0 10.001 1.97.985.985 0 00-.001-1.97z"}));import El from"react";var Al=({style:e,className:t})=>El.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"},El.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 Mc=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:n="inline",title:r="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:l,getStepStatus:m,getNumberOfStepsCompleted:c,isLoading:f,targetingLogicShouldHideFlow:y}=R(),{primaryCTAClickSideEffects:T}=ae(),S=Nc(null),[g,
|
|
1543
|
-
${e=>
|
|
1542
|
+
`;import vl from"react";var Bl=({style:e,className:t})=>vl.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",style:e,className:t},vl.createElement("path",{fill:"currentColor",d:"M13.43 4.938a4.494 4.494 0 00-1.043-1.435A4.955 4.955 0 009 2.197c-1.276 0-2.48.464-3.387 1.305A4.502 4.502 0 004.57 4.938a4.242 4.242 0 00-.386 1.773v.475c0 .109.087.197.196.197h.95a.197.197 0 00.197-.197V6.71c0-1.749 1.557-3.17 3.473-3.17s3.473 1.421 3.473 3.17c0 .718-.254 1.393-.738 1.955a3.537 3.537 0 01-1.9 1.125 1.928 1.928 0 00-1.085.682c-.271.343-.42.768-.42 1.206v.552c0 .109.088.197.197.197h.95a.197.197 0 00.196-.197v-.552c0-.276.192-.519.457-.578a4.904 4.904 0 002.625-1.56c.335-.392.597-.828.778-1.3a4.256 4.256 0 00-.103-3.303zM9 13.834a.985.985 0 10.001 1.97.985.985 0 00-.001-1.97z"}));import El from"react";var Al=({style:e,className:t})=>El.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"},El.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 Mc=({flowId:e,style:t,onStepCompletion:o,visible:i=!0,type:n="inline",title:r="Help",appearance:s})=>{let{getFlow:p,getFlowSteps:d,markStepCompleted:l,getStepStatus:m,getNumberOfStepsCompleted:c,isLoading:f,targetingLogicShouldHideFlow:y}=R(),{primaryCTAClickSideEffects:T}=ae(),S=Nc(null),[g,E]=Lc(!1),{mergeAppearanceWithDefault:P}=te();s=P(s),Ic(()=>(document.addEventListener("click",F,!1),()=>{document.removeEventListener("click",F,!1)}),[]);let F=h=>{S.current&&!S.current.contains(h.target)&&E(!1)};if(f)return null;let A=p(e);if(!A||y(A))return null;let I=d(e);if(!I||!i)return null;function x(h,b){!h.completionCriteria&&(h.autoMarkCompleted||h.autoMarkCompleted===void 0)&&l(e,h.id),T(h),o&&o(h,b),E(!1)}function v(){return g&&_e.createElement(kl,{className:a("floatingWidgetMenu",s),initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},type:n},I.map((h,b)=>_e.createElement(Pl,{className:a("floatingWidgetMenuItem",s),key:b,onClick:()=>x(h,b)},h.title)))}return n=="inline"?_e.createElement("span",{ref:S},_e.createElement(Sl,{style:t,onClick:()=>{E(!g)},className:a("supportButton",s)},_e.createElement(wl,{className:a("supportIconContainer",s)},_e.createElement(Al,{className:a("supportIcon",s),style:{width:"18px",height:"18px"}})),_e.createElement(bl,{className:a("supportButtonTitle",s)},r)),_e.createElement(v,null)):_e.createElement($c,null,_e.createElement(Tl,{style:t,ref:S},_e.createElement(v,null),_e.createElement(Fl,{onClick:()=>{E(!g)},whileHover:{scale:1.1},className:a("floatingWidgetButton",s)},_e.createElement(Bl,{className:a("floatingWidgetButtonIcon",s),style:{display:"flex",width:"20px",height:"20px"}}))))};import ot,{useEffect as Dc}from"react";import tr from"styled-components";var Ol=tr.div`
|
|
1543
|
+
${e=>B(e)} {
|
|
1544
1544
|
display: flex;
|
|
1545
1545
|
flex-direction: column;
|
|
1546
1546
|
width: 100%;
|
|
@@ -1565,7 +1565,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1565
1565
|
align-items: flex-start;
|
|
1566
1566
|
margin-top: 16px;
|
|
1567
1567
|
`,Ll=tr.div`
|
|
1568
|
-
${e=>
|
|
1568
|
+
${e=>B(e)} {
|
|
1569
1569
|
position: absolute;
|
|
1570
1570
|
top: 16px;
|
|
1571
1571
|
right: 16px;
|
|
@@ -1575,9 +1575,9 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1575
1575
|
opacity: 0.8;
|
|
1576
1576
|
}
|
|
1577
1577
|
}
|
|
1578
|
-
`;var Uc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:l,markStepCompleted:m,isLoading:c,targetingLogicShouldHideFlow:f,updateCustomVariables:y,getFlowSteps:T,getFlowStatus:S,getCurrentStepIndex:g}=R(),{primaryCTAClickSideEffects:
|
|
1578
|
+
`;var Uc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:s,dismissible:p})=>{let{getFlow:d,markFlowCompleted:l,markStepCompleted:m,isLoading:c,targetingLogicShouldHideFlow:f,updateCustomVariables:y,getFlowSteps:T,getFlowStatus:S,getCurrentStepIndex:g}=R(),{primaryCTAClickSideEffects:E}=ae(),{mergeAppearanceWithDefault:P}=te();if(n=P(n),Dc(()=>{y(o)},[o,c]),c)return null;let F=d(e);if(!F||f(F)||S(e)===Z)return null;let I=T(e)[g(e)];return ot.createElement(ot.Fragment,null,ot.createElement(ie,{appearance:n}),ot.createElement(Ol,{appearance:n,className:Te(a("embeddedTipContainer",n),r),style:s},(p===!0||I.dismissible)&&ot.createElement(Ll,{onClick:()=>D(void 0,null,function*(){yield l(e),t&&t()}),className:a("embeddedTipDismissButton",n)},ot.createElement(Ee,null)),ot.createElement(Il,null,ot.createElement(Ae,{size:"small",appearance:n,title:I.title,subtitle:I.subtitle})),I.primaryButtonTitle&&ot.createElement(Nl,{className:a("embeddedTipCallToActionContainer",n)},ot.createElement(oe,{classPrefix:"embeddedTip",title:I.primaryButtonTitle,appearance:n,withMargin:!1,size:"medium",type:"inline",onClick:()=>D(void 0,null,function*(){I.handlePrimaryButtonClick(),E(I),!(i&&i(I,g(e),"primary")===!1)&&(yield m(e,I.id),yield l(e))})}))))};import Pe,{useEffect as Wc}from"react";import ro from"styled-components";var $l=ro.div`
|
|
1579
1579
|
// use the :not annotation
|
|
1580
|
-
${e=>
|
|
1580
|
+
${e=>B(e)} {
|
|
1581
1581
|
display: flex;
|
|
1582
1582
|
flex-direction: ${e=>e.type==="square"?"column":"row"};
|
|
1583
1583
|
width: 100%;
|
|
@@ -1588,7 +1588,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1588
1588
|
border-radius: 12px;
|
|
1589
1589
|
}
|
|
1590
1590
|
`,Ml=ro.div`
|
|
1591
|
-
${e=>
|
|
1591
|
+
${e=>B(e)} {
|
|
1592
1592
|
display: flex;
|
|
1593
1593
|
width: 46px;
|
|
1594
1594
|
height: 46px;
|
|
@@ -1617,7 +1617,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1617
1617
|
justify-content: ${e=>e.type==="square"?"flex-end":"center"};
|
|
1618
1618
|
align-items: flex-end;
|
|
1619
1619
|
margin-left: ${e=>e.type==="square"?"0px":"16px"};
|
|
1620
|
-
`;import Vr from"react";var Wl=({style:e,className:t})=>Vr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"46",height:"46",fill:"none",viewBox:"0 0 46 46",style:e,className:t},Vr.createElement("circle",{cx:"23",cy:"23",r:"23",fill:"#E6F1FF"}),Vr.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 zc=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:n,onButtonClick:r,appearance:s,type:p="full-width",icon:d})=>{let{getFlow:l,markFlowCompleted:m,isLoading:c,targetingLogicShouldHideFlow:f,updateCustomVariables:y,getFlowMetadata:T,getFlowStatus:S,getFlowSteps:g,getCurrentStepIndex:
|
|
1620
|
+
`;import Vr from"react";var Wl=({style:e,className:t})=>Vr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"46",height:"46",fill:"none",viewBox:"0 0 46 46",style:e,className:t},Vr.createElement("circle",{cx:"23",cy:"23",r:"23",fill:"#E6F1FF"}),Vr.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 zc=({flowId:e,title:t,subtitle:o,onDismiss:i,customVariables:n,onButtonClick:r,appearance:s,type:p="full-width",icon:d})=>{let{getFlow:l,markFlowCompleted:m,isLoading:c,targetingLogicShouldHideFlow:f,updateCustomVariables:y,getFlowMetadata:T,getFlowStatus:S,getFlowSteps:g,getCurrentStepIndex:E}=R(),{primaryCTAClickSideEffects:P}=ae(),{mergeAppearanceWithDefault:F}=te();if(s=F(s),Wc(()=>{y(n)},[n,c]),c)return null;let A=l(e);if(!A||f(A)||S(e)===Z)return null;let I=g(e),x=I.length>0?I[E(e)]:T(e);return x!=null&&x.title&&(t=x.title),x!=null&&x.subtitle&&(o=x.subtitle),Pe.createElement(Pe.Fragment,null,Pe.createElement(ie,{appearance:s}),Pe.createElement($l,{type:p,appearance:s,className:a("bannerContainer",s)},p!="square"&&Pe.createElement(Ml,{className:a("bannerIconContainer",s)},d||Pe.createElement(Wl,null)),p==="square"&&x.dismissible&&Pe.createElement(jr,{type:p,className:a("bannerDismissButtonContainer",s)},Pe.createElement(Hr,{type:p,onClick:()=>D(void 0,null,function*(){yield m(e),i&&i()}),className:a("bannerDismissButton",s)},Pe.createElement(Ee,null))),Pe.createElement(Dl,{type:p},Pe.createElement(Ae,{appearance:s,title:t,subtitle:o,classPrefix:"banner"})),(x==null?void 0:x.primaryButtonTitle)&&Pe.createElement(Ul,{type:p,className:a("bannerCallToActionContainer",s)},Pe.createElement(oe,{title:x==null?void 0:x.primaryButtonTitle,appearance:s,onClick:()=>{P(x),r&&r(x,0,"primary")},classPrefix:"banner"})),p!=="square"&&x.dismissible&&Pe.createElement(jr,{type:p,className:a("bannerDismissButtonContainer",s)},Pe.createElement(Hr,{type:p,onClick:()=>D(void 0,null,function*(){yield m(e),i&&i()}),className:a("bannerDismissButton",s)},Pe.createElement(Ee,null)))))};import re,{useEffect as _c}from"react";import{Portal as Hc}from"react-portal";import ct from"styled-components";var zl=ct.div`
|
|
1621
1621
|
display: flex;
|
|
1622
1622
|
flex-direction: column;
|
|
1623
1623
|
width: 100%;
|
|
@@ -1686,7 +1686,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1686
1686
|
align-items: flex-start;
|
|
1687
1687
|
margin-top: 16px;
|
|
1688
1688
|
`,jl=ct.textarea`
|
|
1689
|
-
${e=>
|
|
1689
|
+
${e=>B(e)} {
|
|
1690
1690
|
margin-top: 16px;
|
|
1691
1691
|
border: 1px solid ${e=>e.appearance.theme.colorBorder};
|
|
1692
1692
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
@@ -1697,7 +1697,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1697
1697
|
height: 100px;
|
|
1698
1698
|
}
|
|
1699
1699
|
`,Vl=ct.div`
|
|
1700
|
-
${e=>
|
|
1700
|
+
${e=>B(e)} {
|
|
1701
1701
|
position: absolute;
|
|
1702
1702
|
top: 16px;
|
|
1703
1703
|
right: 16px;
|
|
@@ -1707,8 +1707,8 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1707
1707
|
opacity: 0.8;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
|
-
`;var jc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:s,type:p="modal"})=>{let{getFlow:d,markFlowCompleted:l,markStepCompleted:m,getNumberOfStepsCompleted:c,isLoading:f,targetingLogicShouldHideFlow:y,updateCustomVariables:T,getFlowSteps:S,getFlowStatus:g,getFlowMetadata:
|
|
1711
|
-
${e=>
|
|
1710
|
+
`;var jc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:s,type:p="modal"})=>{let{getFlow:d,markFlowCompleted:l,markStepCompleted:m,getNumberOfStepsCompleted:c,isLoading:f,targetingLogicShouldHideFlow:y,updateCustomVariables:T,getFlowSteps:S,getFlowStatus:g,getFlowMetadata:E}=R(),{primaryCTAClickSideEffects:P}=ae(),{mergeAppearanceWithDefault:F}=te(),[A,I]=re.useState(null),[x,v]=re.useState(""),h=E(e),{hasOpenModals:b,setKeepCompletedFlowOpenDuringSession:N,shouldKeepCompletedFlowOpenDuringSession:L}=Be();if(n=F(n),_c(()=>{T(o)},[o,f]),f)return null;let O=d(e);if(!O||y(O)||g(e)===Z||c(e)===1&&!L(e)||b())return null;let M=S(e)[c(e)];function G(){var q,se;return re.createElement(re.Fragment,null,re.createElement(qr,null,re.createElement(Ae,{size:"large",appearance:n,title:M.title,subtitle:M.subtitle})),re.createElement(Gr,{className:a("npsNumberButtonContainer",n),appearance:n},Array.from(Array(10).keys()).map(de=>re.createElement(_l,{className:a("npsNumberButton",n),selected:A===de+1,key:de,onClick:()=>D(this,null,function*(){N(e),I(de+1),yield m(e,M.id,{score:de+1})}),appearance:n},de+1))),re.createElement(Hl,{appearance:n},re.createElement(Kr,{appearance:n},(q=h==null?void 0:h.negativeLabel)!=null?q:"Not likely at all"),re.createElement(Kr,{appearance:n},(se=h==null?void 0:h.positiveLabel)!=null?se:"Extremely likely")))}function le(){var q;return re.createElement(re.Fragment,null,re.createElement(qr,null,re.createElement(Ae,{appearance:n,title:(q=M.title)!=null?q:"Why did you choose this score?",size:"large"})),re.createElement(jl,{appearance:n,value:x,onChange:se=>{v(se.target.value)},placeHolder:"Add your optional fedback here..."}),re.createElement(Gr,{appearance:n,className:a("npsNumberButtonContainer",n)},re.createElement(oe,{size:"large",withMargin:!1,onClick:()=>D(this,null,function*(){yield l(e),i&&i(M,1,"primary")}),appearance:n,title:M.secondaryButtonTitle||"Skip",secondary:!0}),re.createElement(oe,{size:"large",withMargin:!1,onClick:()=>D(this,null,function*(){yield m(e,M.id,{feedbackText:x}),yield l(e),i&&i(M,1,"primary")}),appearance:n,title:M.primaryButtonTitle||"Submit"})))}function pe(){return c(e)>=2?null:re.createElement(re.Fragment,null,re.createElement(ie,{appearance:n}),re.createElement(zl,{appearance:n,className:Te(a("npsSurveyContainer",n),r),style:s,type:p},re.createElement(Vl,{onClick:()=>D(this,null,function*(){yield l(e),t&&t()}),className:a("npsSurveyDismissButton",n)},re.createElement(Ee,null)),c(e)==0&&G(),c(e)==1&&le()))}return p==="inline"?pe():re.createElement(Hc,null,pe())};import ve,{useEffect as Kc}from"react";import Nt from"styled-components";var Gl=Nt.div`
|
|
1711
|
+
${e=>B(e)} {
|
|
1712
1712
|
display: flex;
|
|
1713
1713
|
flex-direction: column;
|
|
1714
1714
|
width: 100%;
|
|
@@ -1733,7 +1733,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1733
1733
|
margin-top: 16px;
|
|
1734
1734
|
margin-bottom: 16px;
|
|
1735
1735
|
`,Xl=Nt.div`
|
|
1736
|
-
${e=>
|
|
1736
|
+
${e=>B(e)} {
|
|
1737
1737
|
position: absolute;
|
|
1738
1738
|
top: -16px;
|
|
1739
1739
|
right: -16px;
|
|
@@ -1744,7 +1744,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1744
1744
|
}
|
|
1745
1745
|
}
|
|
1746
1746
|
`,Jl=Nt.h1`
|
|
1747
|
-
${e=>
|
|
1747
|
+
${e=>B(e)} {
|
|
1748
1748
|
font-style: normal;
|
|
1749
1749
|
justify-content: center;
|
|
1750
1750
|
text-align: center;
|
|
@@ -1758,7 +1758,7 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1758
1758
|
margin-bottom: 8px;
|
|
1759
1759
|
}
|
|
1760
1760
|
`,Ql=Nt.h2`
|
|
1761
|
-
${e=>
|
|
1761
|
+
${e=>B(e)} {
|
|
1762
1762
|
font-style: normal;
|
|
1763
1763
|
justify-content: center;
|
|
1764
1764
|
text-align: center;
|
|
@@ -1774,5 +1774,5 @@ ${e=>e.inlineStyles.map(([t,o])=>`.${ao}${t}.${ao}${t} { ${Object.entries(o).map
|
|
|
1774
1774
|
height: 100%;
|
|
1775
1775
|
min-height: 200px;
|
|
1776
1776
|
border-radius: ${e=>e.appearance.theme.borderRadius}px;
|
|
1777
|
-
`;function Rl({stepData:e,appearance:t,classPrefix:o=""}){return e.videoUri?Zl.createElement(Re,{appearance:t,videoUri:e.videoUri}):e.imageUri?Zl.createElement(Gc,{className:a(`${o}image`,t),appearance:t,src:e.imageUri}):null}var qc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:s,dismissible:p=!0,modalPosition:d="center"})=>{let{getFlow:l,markFlowCompleted:m,markStepCompleted:c,isLoading:f,targetingLogicShouldHideFlow:y,updateCustomVariables:T,getFlowSteps:S,getFlowStatus:g,getCurrentStepIndex:
|
|
1777
|
+
`;function Rl({stepData:e,appearance:t,classPrefix:o=""}){return e.videoUri?Zl.createElement(Re,{appearance:t,videoUri:e.videoUri}):e.imageUri?Zl.createElement(Gc,{className:a(`${o}image`,t),appearance:t,src:e.imageUri}):null}var qc=({flowId:e,onDismiss:t,customVariables:o,onButtonClick:i,appearance:n,className:r,style:s,dismissible:p=!0,modalPosition:d="center"})=>{let{getFlow:l,markFlowCompleted:m,markStepCompleted:c,isLoading:f,targetingLogicShouldHideFlow:y,updateCustomVariables:T,getFlowSteps:S,getFlowStatus:g,getCurrentStepIndex:E}=R(),{primaryCTAClickSideEffects:P,secondaryCTAClickSideEffects:F}=ae(),{mergeAppearanceWithDefault:A}=te(),{setOpenFlowState:I,getOpenFlowState:x,hasOpenModals:v}=Be(),[h,b]=[x(e,!0),le=>I(e,le)];if(n=A(n),Kc(()=>{T(o)},[o,f]),f)return null;let N=l(e);if(!N||y(N)||g(e)===Z||v())return null;let O=S(e)[E(e)],j=()=>{b(!1),t&&t(),m(e)};function M(){return ve.createElement(ve.Fragment,null,ve.createElement(ie,{appearance:n}),ve.createElement(Gl,{appearance:n,className:Te(a("announcementContainer",n),r),style:s},(p===!0||O.dismissible)&&d=="inline"&&ve.createElement(Xl,{onClick:()=>D(this,null,function*(){yield m(e),t&&t()}),className:a("announcementDismissButton",n)},ve.createElement(Ee,null)),ve.createElement(Kl,null,ve.createElement(Jl,{appearance:n,className:a("announcementTitle",n),dangerouslySetInnerHTML:ce(O.title)}),O.subtitle&&ve.createElement(Ql,{appearance:n,className:a("announcementSubtitle",n),dangerouslySetInnerHTML:ce(O.subtitle)})),(O.imageUri||O.videoUri)&&ve.createElement(Yl,{className:a("announcementMediaContainer",n)},ve.createElement(Rl,{appearance:n,stepData:O})),(O.primaryButtonTitle||O.secondaryButtonTitle)&&ve.createElement(ql,{className:a("announcementCTAContainer",n)},O.secondaryButtonTitle&&ve.createElement(oe,{classPrefix:"announcement",title:O.secondaryButtonTitle,appearance:n,withMargin:!1,size:"small",type:"full-width",onClick:()=>D(this,null,function*(){O.handleSecondaryButtonClick(),F(O),i&&i(O,E(e),"secondary")}),secondary:!0}),O.primaryButtonTitle&&ve.createElement(oe,{classPrefix:"announcement",title:O.primaryButtonTitle,appearance:n,withMargin:!1,size:"small",type:"full-width",onClick:()=>D(this,null,function*(){O.handlePrimaryButtonClick(),P(O),!(i&&i(O,E(e),"primary")===!1)&&(yield c(e,O.id),yield m(e))})}))))}let G={padding:"24px",maxWidth:"400px"};return d==="inline"?M():d!=="center"?ve.createElement(Lo,{modalPosition:d,onClose:j,visible:h,dismissible:p,appearance:n},M()):ve.createElement(Qe,{appearance:n,onClose:j,visible:h,style:G,dismissible:p},M())};import*as or from"react";import ea from"react";var ta=n=>{var r=n,{as:e="span",children:t,variant:o="Body1"}=r,i=Ie(r,["as","children","variant"]);return ea.createElement(Tn,w({color:"neutral.foreground",fontFamily:"default",forwardedAs:e,variant:o},i),t)},Yc=Object.fromEntries(Object.keys(Vo).map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=i=>ea.createElement(ta,_(w({as:t},i),{variant:e}),i.children);return o.displayName=`Text.${e}`,[e,o]})),Yr=Object.assign(ta,Yc);var oa=s=>{var p=s,{as:e="button",className:t,size:o="md",title:i,variant:n="Primary"}=p,r=Ie(p,["as","className","size","title","variant"]);var d;return or.createElement(wn,w({className:`fr-button-${n.toLowerCase()}${t?` ${t}`:""}`,forwardedAs:e,variant:n,size:o,borderRadius:"md"},r),or.createElement(Yr,{color:(d=So[n])==null?void 0:d.color,fontWeight:"semibold"},i))},Xc=Object.fromEntries(Object.keys(So).map(e=>{let t=o=>or.createElement(oa,_(w({},o),{variant:e}));return t.displayName=`Button.${e}`,[e,t]})),Jc=Object.assign(oa,Xc);export{yo as Box,Jc as Button,nt as CheckBox,sr as FlowType,ft as FormLabel,Cr as FormTextField,qc as FrigadeAnnouncement,zc as FrigadeBanner,Wr as FrigadeChecklist,it as FrigadeDefaultAppearance,Uc as FrigadeEmbeddedTip,fn as FrigadeForm,gc as FrigadeGuide,cc as FrigadeHeroChecklist,jc as FrigadeNPSSurvey,uc as FrigadeProgressBadge,wd as FrigadeProvider,Mc as FrigadeSupportWidget,Oc as FrigadeTour,We as ProgressBar,_t as ProgressRing,Yr as Text,Ar as tokens,Be as useFlowOpens,so as useFlowResponses,R as useFlows,Er as useOrganization,lo as useUser,De as useUserFlowStates};
|
|
1778
1778
|
//# sourceMappingURL=index.mjs.map
|